blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 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 684M ⌀ | 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 132
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 28
values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
34054d789ba36e2a8be15d5588b17dbfcf2cecac | ab0d04905191fb9cf230b05316dd87eb958d38bd | /degraph-testing-demo/src/main/java/de/frvabe/Include.java | 5501877e7f0bd7bc5988af48e726659dd6b00e39 | [] | no_license | FrVaBe/degraph | 8b387f6327bb759e0d2837bc53ba41f164afbda3 | 6cafaaf21ff607522867427907bfc9bbde9bebcb | refs/heads/master | 2020-04-06T04:04:15.846549 | 2017-03-16T20:32:36 | 2017-03-16T20:32:36 | 83,061,266 | 1 | 1 | null | 2017-02-25T20:48:09 | 2017-02-24T16:30:32 | Java | UTF-8 | Java | false | false | 51 | java | package de.frvabe;
public class Include {
}
| [
"franz.van.betteraey@heuboe.de"
] | franz.van.betteraey@heuboe.de |
1f9674525e6466af3c0ea9c063e6242cc9b4e5dd | 953d67cf2e3f07753ae687f95de5363ecbe36882 | /Hibernate_Pagination/src/com/demo/ClientTest.java | 515961e3e280db7533f969b1b1a10cd8fd0c7297 | [] | no_license | Tushaar7/Hibernate | 6fb4fb35802cf36f5ab1cc2b275aa199a0123114 | f894c7a559c2211ab5b4b8f3bd683781c7ca3769 | refs/heads/master | 2022-12-21T23:02:48.703220 | 2019-12-09T18:21:27 | 2019-12-09T18:21:27 | 96,116,069 | 0 | 0 | null | 2022-12-16T05:46:46 | 2017-07-03T13:52:19 | JavaScript | UTF-8 | Java | false | false | 1,243 | java | package com.demo;
import java.util.List;
import org.hibernate.Query;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.hibernate.classic.Session;
public class ClientTest {
public static void main(String[] args) {
SessionFactory sessionfactory = new Configuration().configure().buildSessionFactory();
Session session = sessionfactory.openSession();
session.beginTransaction();
Query query1 = session.createQuery("from Student");
// Pagination
query1.setFirstResult(4);
query1.setMaxResults(5);
List<Student> list1 = query1.list();
for(Student s1 : list1)
System.out.println(s1);
System.out.println("--------------------------------------");
//We want to fetch a specific column from database using select query
//Here we going to fetch name column from database
//so change List<Student> to List<String> bcoz name having String data type
Query query2 = session.createQuery("select name from Student");
query2.setFirstResult(0);
query2.setMaxResults(5);
List<String> list2 = query2.list();
for(String s2 : list2)
System.out.println(s2);
session.getTransaction().commit();
session.close();
sessionfactory.close();
}
}
| [
"tushardhake7@gmail.com"
] | tushardhake7@gmail.com |
d0f1f0ecb11d0762ae5dd17fe94b7ae309355b3d | 28e0c158f449d3bafd3b53143b63ff5565e0ba88 | /app/src/main/java/com/ncrsoft/service/Downloader.java | 8978249a9ce821bae3a81ea69d4979605f6334d0 | [] | no_license | bhuriavikash/Blaze | 37f3b571535f396a955c1d5a65e76f4459d09b36 | cdeb8eda40da76818ab7311db9c2e32e4a264794 | refs/heads/master | 2021-01-22T20:08:29.816184 | 2017-03-25T10:43:38 | 2017-03-25T10:43:38 | 85,282,424 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,860 | java | /**
* Copyright (C) 2010-2012 Regis Montoya (aka r3gis - www.r3gis.fr)
* This file is part of CSipSimple.
*
* CSipSimple 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.
* If you own a pjsip commercial license you can also redistribute it
* and/or modify it under the terms of the GNU Lesser General Public License
* as an android library.
*
* CSipSimple 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 CSipSimple. If not, see <http://www.gnu.org/licenses/>.
*/
package com.ncrsoft.service;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.ResponseHandler;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import android.app.Activity;
import android.app.IntentService;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Intent;
import android.support.v4.app.NotificationCompat;
import android.support.v4.app.NotificationCompat.Builder;
import android.text.TextUtils;
import android.view.View;
import android.widget.RemoteViews;
import com.ncrsoft.R;
import com.ncrsoft.ui.SipHome;
import com.ncrsoft.utils.Log;
import com.ncrsoft.utils.MD5;
public class Downloader extends IntentService {
private final static String THIS_FILE = "Downloader";
public final static String EXTRA_ICON = "icon";
public final static String EXTRA_TITLE = "title";
public final static String EXTRA_OUTPATH = "outpath";
public final static String EXTRA_CHECK_MD5 = "checkMd5";
public final static String EXTRA_PENDING_FINISH_INTENT = "pendingIntent";
private static final int NOTIF_DOWNLOAD = 0;
private NotificationManager notificationManager;
private DefaultHttpClient client;
public Downloader() {
super("Downloader");
}
@Override
public void onCreate() {
super.onCreate();
notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
client = new DefaultHttpClient();
}
@Override
public void onDestroy() {
super.onDestroy();
client.getConnectionManager().shutdown();
}
@Override
protected void onHandleIntent(Intent intent) {
HttpGet getMethod = new HttpGet(intent.getData().toString());
int result = Activity.RESULT_CANCELED;
String outPath = intent.getStringExtra(EXTRA_OUTPATH);
boolean checkMd5 = intent.getBooleanExtra(EXTRA_CHECK_MD5, false);
int icon = intent.getIntExtra(EXTRA_ICON, 0);
String title = intent.getStringExtra(EXTRA_TITLE);
boolean showNotif = (icon > 0 && !TextUtils.isEmpty(title));
// Build notification
Builder nb = new NotificationCompat.Builder(this);
nb.setWhen(System.currentTimeMillis());
nb.setContentTitle(title);
nb.setSmallIcon(android.R.drawable.stat_sys_download);
nb.setOngoing(true);
Intent i = new Intent(this, SipHome.class);
nb.setContentIntent(PendingIntent.getActivity(this, 0, i, PendingIntent.FLAG_UPDATE_CURRENT));
RemoteViews contentView = new RemoteViews(getApplicationContext().getPackageName(), R.layout.download_notif);
contentView.setImageViewResource(R.id.status_icon, icon);
contentView.setTextViewText(R.id.status_text, getResources().getString(R.string.downloading_text));
contentView.setProgressBar(R.id.status_progress, 50, 0, false);
contentView.setViewVisibility(R.id.status_progress_wrapper, View.VISIBLE);
nb.setContent(contentView);
final Notification notification = showNotif ? nb.build() : null;
notification.contentView = contentView;
if(!TextUtils.isEmpty(outPath)) {
try {
File output = new File(outPath);
if (output.exists()) {
output.delete();
}
if(notification != null) {
notificationManager.notify(NOTIF_DOWNLOAD, notification);
}
ResponseHandler<Boolean> responseHandler = new FileStreamResponseHandler(output, new Progress() {
private int oldState = 0;
@Override
public void run(long progress, long total) {
//Log.d(THIS_FILE, "Progress is "+progress+" on "+total);
int newState = (int) Math.round(progress * 50.0f/total);
if(oldState != newState) {
notification.contentView.setProgressBar(R.id.status_progress, 50, newState, false);
notificationManager.notify(NOTIF_DOWNLOAD, notification);
oldState = newState;
}
}
});
boolean hasReply = client.execute(getMethod, responseHandler);
if(hasReply) {
if(checkMd5) {
URL url = new URL(intent.getData().toString().concat(".md5sum"));
InputStream content = (InputStream) url.getContent();
if(content != null) {
BufferedReader br = new BufferedReader(new InputStreamReader(content));
String downloadedMD5 = "";
try {
downloadedMD5 = br.readLine().split(" ")[0];
} catch (NullPointerException e) {
throw new IOException("md5_verification : no sum on server");
}
if (!MD5.checkMD5(downloadedMD5, output)) {
throw new IOException("md5_verification : incorrect");
}
}
}
PendingIntent pendingIntent = (PendingIntent) intent.getParcelableExtra(EXTRA_PENDING_FINISH_INTENT);
try {
Runtime.getRuntime().exec("chmod 644 " + outPath);
} catch (IOException e) {
Log.e(THIS_FILE, "Unable to make the apk file readable", e);
}
Log.d(THIS_FILE, "Download finished of : " + outPath);
if(pendingIntent != null) {
notification.contentIntent = pendingIntent;
notification.flags = Notification.FLAG_AUTO_CANCEL;
notification.icon = android.R.drawable.stat_sys_download_done;
notification.contentView.setViewVisibility(R.id.status_progress_wrapper, View.GONE);
notification.contentView.setTextViewText(R.id.status_text,
getResources().getString(R.string.done)
// TODO should be a parameter of this class
+" - Click to install");
notificationManager.notify(NOTIF_DOWNLOAD, notification);
/*
try {
pendingIntent.send();
notificationManager.cancel(NOTIF_DOWNLOAD);
} catch (CanceledException e) {
Log.e(THIS_FILE, "Impossible to start pending intent for download finish");
}
*/
}else {
Log.w(THIS_FILE, "Invalid pending intent for finish !!!");
}
result = Activity.RESULT_OK;
}
} catch (IOException e) {
Log.e(THIS_FILE, "Exception in download", e);
}
}
if(result == Activity.RESULT_CANCELED) {
notificationManager.cancel(NOTIF_DOWNLOAD);
}
}
public interface Progress {
void run(long progress, long total);
}
private class FileStreamResponseHandler implements ResponseHandler<Boolean> {
private Progress mProgress;
private File mFile;
FileStreamResponseHandler(File outputFile, Progress progress) {
mFile = outputFile;
mProgress = progress;
}
public Boolean handleResponse(HttpResponse response) throws ClientProtocolException, IOException {
FileOutputStream fos = new FileOutputStream(mFile.getPath());
HttpEntity entity = response.getEntity();
boolean done = false;
try {
if (entity != null) {
Long length = entity.getContentLength();
InputStream input = entity.getContent();
byte[] buffer = new byte[4096];
int size = 0;
int total = 0;
while (true) {
size = input.read(buffer);
if (size == -1) break;
fos.write(buffer, 0, size);
total += size;
mProgress.run(total, length);
}
done = true;
}
}catch(IOException e) {
Log.e(THIS_FILE, "Problem on downloading");
}finally {
fos.close();
}
return done;
}
}
}
| [
"bhuriavikash@gmail.com"
] | bhuriavikash@gmail.com |
aff48c7ba9956e715974d9ad94c55bdad7699642 | 0e4c02fe73cf6f14b1c9a60f3c4951d32755ae30 | /crf-builder-model/src/main/java/org/modelcatalogue/crf/model/DisplayStatus.java | fc4bfdb86116006aa64a73fc71dc84081802a403 | [
"Apache-2.0"
] | permissive | toskrip/crf-builder | fd13f369b074756f20f4ff93dbbc31d8192f21e9 | ec3cdc0255ca6c65ecbc5321ec98aa36f7e1c02d | refs/heads/master | 2023-04-10T15:14:57.366568 | 2021-04-20T09:01:56 | 2021-04-20T09:01:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 86 | java | package org.modelcatalogue.crf.model;
public enum DisplayStatus {
SHOW, HIDE;
}
| [
"vladimir@orany.cz"
] | vladimir@orany.cz |
ddb9b4da8625302f8c31b59395ccbf35f5ef90a0 | 8eb4cfd916ff603c706bb335d6c58dba0d9a6f3a | /TRAINING/JPA/JPM_141_JPA_JPQL/src/com/jp/jpql/dao/BookDaoImpl.java | 1f8dcd5d9508d12ad1689ce7059abc9f2fd1dfb7 | [] | no_license | DarshanChaudhari/CoderTechnology | 73175b714d389d5516aaeebfb00337185cb3a9f3 | 585dc899a7aedecebc5951dc22b117cd4e85adad | refs/heads/master | 2022-08-09T05:28:14.178785 | 2019-01-04T13:41:42 | 2019-01-04T13:41:42 | 158,165,011 | 0 | 0 | null | 2022-07-23T06:07:21 | 2018-11-19T05:08:51 | HTML | UTF-8 | Java | false | false | 2,390 | java | package com.jp.jpql.dao;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.Query;
import javax.persistence.TypedQuery;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.jp.jpql.entity.Book;
import com.jp.jpql.util.JPAUtil;
public class BookDaoImpl implements IBookDao {
private EntityManager entityManager;
private Logger logger;
public BookDaoImpl() {
entityManager = JPAUtil.getEntityManager();
logger = LoggerFactory.getLogger(BookDaoImpl.class);
}
@Override
public Book getBookById(int id) {
//Book book = entityManager.find(Book.class, id);
//logger.info("Invoked getBookByID at BookDaoImpl and book found is : ",book);
//return book;
TypedQuery<Book> query = entityManager.createNamedQuery("getAllBooksId", Book.class);
query.setParameter("Id",id);
Book book = query.getSingleResult();
//logger.info("Invoked getBookByID at BookDaoImpl and book found is : ",book);
return book;
}
@Override
public List<Book> getBookByTitle(String title) {
String qStr = "Select b1 from Book b1 WHERE b1.title LIKE :ptitle";
TypedQuery<Book> query = entityManager.createQuery(qStr,Book.class);
query.setParameter("ptitle", "%"+title+"%");
return query.getResultList();
}
@Override
public Long getBookCount() {
String qStr = "SELECT COUNT(b1.id) FROM Book b1";
TypedQuery<Long> query = entityManager.createQuery(qStr,Long.class);
Long count = query.getSingleResult();
return count;
}
@Override
public List<Book> getAuthorBooks(String author) {
String qStr= "SELECT b1 FROM Book b1 WHERE b1.author=:pAuthor"; // pAuthor dynamic parameter
TypedQuery<Book> query = entityManager.createQuery(qStr,Book.class);
query.setParameter("pAuthor", author);
List<Book> bookList = query.getResultList();
return bookList;
}
@SuppressWarnings("unchecked")
@Override
public List<Book> getAllBooks() {
Query query = entityManager.createNamedQuery("getAllBooks");
return query.getResultList();
}
@Override
public List<Book> getBooksInPriceRange(double low, double high) {
String qStr = "SELECT b1 from Book b1 WHERE b1.price between :low and :high";
TypedQuery<Book> query = entityManager.createQuery(qStr,Book.class);
query.setParameter("low", low);
query.setParameter("high", high);
List<Book> bookList = query.getResultList();
return bookList;
}
}
| [
"cbs.chouhan@gmail.com"
] | cbs.chouhan@gmail.com |
89a0feb94d8215fdf29976442cef5a25d13aab85 | 6d5871cc20989fbd0efc073b87b9575958382894 | /task/dev6/src/main/java/com/github/zubarevladimir/Format/DateContainer/Patterns/FNotZeroDatePattern.java | 48d6b1e4b2f85d0a15fd79dea89c49359a036071 | [] | no_license | ZubarevVladimir/Epam | 2e0ffb6ff40a4f0a2b349755dbc5ee8f36f2bc60 | 76d2a9f9c536d8ae3d4b2385aba7114037c77223 | refs/heads/master | 2021-01-09T06:17:59.707644 | 2017-06-25T10:31:46 | 2017-06-25T10:31:46 | 80,940,737 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 813 | java | package com.github.zubarevladimir.Format.DataContainer.Patterns;
import java.util.Calendar;
/**
* Represent an abstract date format pattern for a hundredths of a second in a date and time.
* Gets in range from 1 - 9. If equals 0 or less returns empty string
*/
public class FNotZeroDatePattern extends DatePattern {
private static final String PATTERN = "F";
private static final int HUNDRED_TO_GET_TENTHS = 100;
private static final String EMPTY = "";
private final Calendar date;
public FNotZeroDatePattern(Calendar date) {
super(PATTERN);
this.date = date;
}
@Override
public String getResult() {
String result = "" + date.get(Calendar.MILLISECOND);
if (result.equals("0")) {
return "";
} else {
return result.substring(0, PATTERN.length());
}
}
}
| [
"zubarev.v.l.1996@gmail.com"
] | zubarev.v.l.1996@gmail.com |
71e4faad92fcc4bb764947a5075d942db0c1dc3c | e622b674e3096fdd59a3a08abfc761735b618050 | /basicmr/src/com/jhc/mr/solrkey/BeanRunnerSolrKey.java | 18a23af6d4504a411ff8ad4fb46ae6bc04d89bbe | [] | no_license | haha-jhc/MapReduce- | 85c1e604855c151931e5fc1bf8390d4206659b85 | 3682bab2af892d057b0abb71aa06e4937ac732eb | refs/heads/master | 2020-03-30T05:39:48.955083 | 2018-11-26T11:26:16 | 2018-11-26T11:26:16 | 150,812,351 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 2,556 | java | package com.jhc.mr.solrkey;
import java.io.IOException;
import org.apache.commons.lang.StringUtils;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Reducer;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
public class BeanRunnerSolrKey {
static class BeanMapper extends Mapper<LongWritable, Text, Text, Text>{
@Override
protected void map(LongWritable key, Text value, Mapper<LongWritable, Text, Text, Text>.Context context)
throws IOException, InterruptedException {
String line =value.toString();
String[] fields = StringUtils.split(line,"\t");
String timestamp = fields[0];
String ip = fields[1];
String domain = fields[4];
Text Width =new Text(fields[5]);
Text tx = new Text(timestamp +"\t"+domain+"\t"+ip);
context.write(Width, tx);
}
}
static class BeanReducer extends Reducer<Text, Text, Text, Text>{
@Override
protected void reduce(Text key, Iterable<Text> values, Reducer<Text, Text, Text, Text>.Context context)
throws IOException, InterruptedException {
for(Text value:values){
context.write(key, value);
}
}
}
public static void main(String[] args) throws IOException, ClassNotFoundException, InterruptedException {
// TODO Auto-generated method stub
Configuration conf =new Configuration();
Job job =Job.getInstance(conf);
job.setJarByClass(BeanRunnerSolrKey.class);
job.setMapperClass(BeanMapper.class);
job.setReducerClass(BeanReducer.class);
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(Text.class);
String inputPath="/usr/jhc/mapreduce/data";
String outputPath="/usr/jhc/mapreduce/sorlkey";
//判断output 文件夹是否存在
Path path=new Path(outputPath);
FileSystem fileSystem =path.getFileSystem(conf);
if (fileSystem.exists(path)) {
fileSystem.delete(path,true);
}
// //本次job作业要处理的原始数据所在路径
FileInputFormat.setInputPaths(job, new Path(inputPath));
// //本次job作业产生结果的输出路径
FileOutputFormat.setOutputPath(job, new Path(outputPath));
//提交本次作业
job.waitForCompletion(true);
}
}
| [
"1253167553@qq.com"
] | 1253167553@qq.com |
d8db4d107a072740ae79664fab985377ef3e2c67 | 64a3da6346e76961310720e4c55f7482cad14d05 | /src/main/java/com/zuoqiang/test/id/StringPool.java | 1f17fe987ba51b287a0ebbed074a989173c49141 | [] | no_license | zuoqiangTX/ioproject | 6642dfc87b3e07da1db74ee1ca0a4881c03a21a4 | 0087a1391e238cf021272be69e84dcbb581d1218 | refs/heads/master | 2022-11-05T21:55:50.536739 | 2022-01-04T14:10:57 | 2022-01-04T14:10:57 | 130,237,324 | 1 | 0 | null | 2022-10-12T20:38:28 | 2018-04-19T15:35:54 | Java | UTF-8 | Java | false | false | 3,252 | java | package com.zuoqiang.test.id;
/**
* @author zuoqiang
* @version 1.0
* @description todo
* @date 2021/3/9 3:41 下午
*/
/**
* Copy to jodd.util
* <p>
* Pool of <code>String</code> constants to prevent repeating of
* hard-coded <code>String</code> literals in the code.
* Due to fact that these are <code>public static final</code>
* they will be inlined by java compiler and
* reference to this class will be dropped.
* There is <b>no</b> performance gain of using this pool.
* Read: https://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.10.5
* <ul>
* <li>Literal strings within the same class in the same package represent references to the same <code>String</code> object.</li>
* <li>Literal strings within different classes in the same package represent references to the same <code>String</code> object.</li>
* <li>Literal strings within different classes in different packages likewise represent references to the same <code>String</code> object.</li>
* <li>Strings computed by constant expressions are computed at compile time and then treated as if they were literals.</li>
* <li>Strings computed by concatenation at run time are newly created and therefore distinct.</li>
* </ul>
*/
public interface StringPool {
String AMPERSAND = "&";
String AND = "and";
String AT = "@";
String ASTERISK = "*";
String STAR = ASTERISK;
String BACK_SLASH = "\\";
String COLON = ":";
String COMMA = ",";
String DASH = "-";
String DOLLAR = "$";
String DOT = ".";
String DOTDOT = "..";
String DOT_CLASS = ".class";
String DOT_JAVA = ".java";
String DOT_XML = ".xml";
String EMPTY = "";
String EQUALS = "=";
String FALSE = "false";
String SLASH = "/";
String HASH = "#";
String HAT = "^";
String LEFT_BRACE = "{";
String LEFT_BRACKET = "(";
String LEFT_CHEV = "<";
String DOT_NEWLINE = ",\n";
String NEWLINE = "\n";
String N = "n";
String NO = "no";
String NULL = "null";
String OFF = "off";
String ON = "on";
String PERCENT = "%";
String PIPE = "|";
String PLUS = "+";
String QUESTION_MARK = "?";
String EXCLAMATION_MARK = "!";
String QUOTE = "\"";
String RETURN = "\r";
String TAB = "\t";
String RIGHT_BRACE = "}";
String RIGHT_BRACKET = ")";
String RIGHT_CHEV = ">";
String SEMICOLON = ";";
String SINGLE_QUOTE = "'";
String BACKTICK = "`";
String SPACE = " ";
String TILDA = "~";
String LEFT_SQ_BRACKET = "[";
String RIGHT_SQ_BRACKET = "]";
String TRUE = "true";
String UNDERSCORE = "_";
String UTF_8 = "UTF-8";
String US_ASCII = "US-ASCII";
String ISO_8859_1 = "ISO-8859-1";
String Y = "y";
String YES = "yes";
String ONE = "1";
String ZERO = "0";
String DOLLAR_LEFT_BRACE = "${";
String HASH_LEFT_BRACE = "#{";
String CRLF = "\r\n";
String HTML_NBSP = " ";
String HTML_AMP = "&";
String HTML_QUOTE = """;
String HTML_LT = "<";
String HTML_GT = ">";
// ---------------------------------------------------------------- array
String[] EMPTY_ARRAY = new String[0];
byte[] BYTES_NEW_LINE = StringPool.NEWLINE.getBytes();
}
| [
"zuoqiang@lianlianpay.com"
] | zuoqiang@lianlianpay.com |
98c0ab546b4b0d385be7809c152a23b84b6a5168 | b059e83c5b821ff34350a0bd1688faeeb7f7070f | /Cafufa/src/main/java/br/edu/undb/cafufa/repository/Cortesias.java | 0e0718d2d74b8084b69a1faf65616b035bf890ce | [] | no_license | rfaelduarte/projetoundb | 6900a764e36dcd2e0ace7e0adda2f30d9acb9557 | 87988534f8743fd296b055fe58f88713785f0939 | refs/heads/master | 2021-01-10T05:04:25.133538 | 2015-12-15T00:35:33 | 2015-12-15T00:35:33 | 48,007,372 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,507 | java | package br.edu.undb.cafufa.repository;
import java.io.Serializable;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;
import javax.inject.Inject;
import br.edu.undb.cafufa.model.Evento;
import br.edu.undb.cafufa.model.EventoIngresso;
public class Cortesias implements Serializable {
private static final long serialVersionUID = 1L;
private Connection con;
private PreparedStatement pstm;
private ResultSet rs;
@Inject
public Cortesias(Connection con) {
this.con = con;
}
public EventoIngresso porEvento(Evento evento, Date dataInicial, Date dataFinal) throws SQLException {
EventoIngresso cortesia = new EventoIngresso();
cortesia.setId(1);
cortesia.setNome("Cortesia");
cortesia.setQuantidade(0);
String sql = "select count(*) as quantidade from cortesia "
+ "inner join evento_ingresso_tipo "
+ "on cortesia.evento_ingresso_tipo_id="
+ "evento_ingresso_tipo.evento_ingresso_tipo_id "
+ "where evento_ingresso_tipo.evento_id=? and "
+ "cortesia.created_at between ? and ? "
+ "group by evento_id;";
pstm = con.prepareStatement(sql);
pstm.setInt(1, evento.getId());
pstm.setDate(2, new java.sql.Date(dataInicial.getTime()));
pstm.setDate(3, new java.sql.Date(dataFinal.getTime()));
System.out.println(pstm.toString());
rs = pstm.executeQuery();
while (rs.next()) {
cortesia.setQuantidade(rs.getInt("quantidade"));
}
return cortesia;
}
} | [
"renanmvc@hotmail.com"
] | renanmvc@hotmail.com |
9fb04c5ddeb2ec3386ab292ef9e6def36620de39 | a5316f4191e52b61d9db91f323a05a53d0b4b1b2 | /DS-Project-GerryGonzales-x17140493/src/main/java/Models/Heating.java | e58f149e5f36c7956c0c20f93d90bbe4138929c4 | [] | no_license | taekaboy24/DS-Project | b745288d34dd6851a3ee752a2b5f818d3a4cdcb8 | 463e76c4ef25c31d19354512bd59d408a86b1324 | refs/heads/master | 2023-03-25T11:37:31.512037 | 2021-03-26T13:23:54 | 2021-03-26T13:23:54 | 350,145,232 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 996 | java | package Models;
public class Heating {
private String appliance, applianceName;
private boolean on;
private int temperature;
private int speed;
public Heating() {
this.appliance="Heating";
this.on=true;
this.applianceName="Heating Name";
this.temperature=20;
this.speed=1;
}
public String getAppliance() {
return appliance;
}
public void setAppliance(String appliance) {
this.appliance = appliance;
}
public String getApplianceName() {
return applianceName;
}
public void setApplianceName(String applianceName) {
this.applianceName = applianceName;
}
public boolean isOn() {
return on;
}
public void setOn(boolean on) {
this.on = on;
}
public int getTemperature() {
return temperature;
}
public void setTemperature(int temperature) {
this.temperature = temperature;
}
public int getSpeed() {
return speed;
}
public void setSpeed(int speed) {
this.speed = speed;
}
}
| [
"Taekaboy@Taekaboy"
] | Taekaboy@Taekaboy |
d6199c64b6d475db1def092d64e7cd6c9a98c350 | 42caa2e42deb681b18750b8fa107f85b3181787f | /Laborator/Lab7/src/task6/QueenPool.java | cc7258b69faaa19df3c3a1261d747752e6ae790c | [
"MIT"
] | permissive | Teo48/APD | f36bdf9064d3726961de2d00773813051224072b | 1afbb8f0b03264bb38bdeb5e0dccc54c113bc03a | refs/heads/main | 2023-03-05T20:42:53.483596 | 2021-02-19T20:42:51 | 2021-02-19T20:42:51 | 300,716,658 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,081 | java | package task6;
import task3.Main;
import task4.PathFinderPool;
import java.util.ArrayList;
import java.util.concurrent.RecursiveTask;
public class QueenPool extends RecursiveTask<Void> {
private final int step;
private final int [] queenPosition;
public QueenPool(int step, int[] queenPosition) {
this.step = step;
this.queenPosition = queenPosition;
}
private static boolean check(int[] arr, int step) {
for (int i = 0; i <= step; i++) {
for (int j = i + 1; j <= step; j++) {
if (arr[i] == arr[j] || arr[i] + i == arr[j] + j || arr[i] + j == arr[j] + i)
return false;
}
}
return true;
}
@Override
protected Void compute() {
ArrayList<QueenPool> tasks = new ArrayList<>();
if (Main.N == step) {
Main.printQueens(queenPosition);
return null;
}
for (int i = 0; i < Main.N; ++i) {
int[] newGraph = queenPosition.clone();
newGraph[step] = i;
if (check(newGraph, step)) {
var t = new QueenPool(step + 1, newGraph);
tasks.add(t);
t.fork();
}
}
for (var i : tasks) {
i.join();
}
return null;
}
}
| [
"teo_matei1999@yahoo.com"
] | teo_matei1999@yahoo.com |
9563f0b60b3a73135f3d54decc4fc6afd2b1d74c | 53a48fdc98b1c635552710245f5062e474066efd | /datagenerator/src/main/java/com/example/model/APIEquipType.java | e9e27026a87e5f409d7e4b41037a333e5a5e54a6 | [] | no_license | kcwikizh/Akashi-Toolkit | 0b373429706132c2b32b10dd569045dd86039993 | ea5ac6517d626a9b07cc9a786df47a106a5a30fb | refs/heads/master | 2020-12-11T03:24:25.228509 | 2018-05-18T11:09:37 | 2018-05-18T11:09:37 | 53,382,996 | 35 | 17 | null | 2018-02-27T02:16:45 | 2016-03-08T04:39:29 | Java | UTF-8 | Java | false | false | 1,178 | java | package com.example.model;
/**
* Created by Rikka on 2016/10/4.
*/
public class APIEquipType {
private int show_flg;
private String name;
private int id;
private String chinese_name;
public APIEquipType(int show_flg, String name, int id, String chinese_name) {
this.show_flg = show_flg;
this.name = name;
this.id = id;
this.chinese_name = chinese_name;
}
public int getShowFlag() {
return show_flg;
}
public void setShowFlag(int show_flg) {
this.show_flg = show_flg;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getChineseName() {
return chinese_name;
}
public void setChinesName(String chinese_name) {
this.chinese_name = chinese_name;
}
@Override
public String toString() {
return "APIEquipType{" +
"id=" + id +
", chinese_name='" + chinese_name + '\'' +
'}';
}
}
| [
"rikka@xing.moe"
] | rikka@xing.moe |
ce61a6402d713522b15d4a9280082108f41d4aa8 | 995f73d30450a6dce6bc7145d89344b4ad6e0622 | /Mate20-9.0/src/main/java/com/huawei/hilink/framework/aidl/HilinkServiceProxy.java | 3340795e2dc2e299b6878a26e1b2bcf780513bda | [] | no_license | morningblu/HWFramework | 0ceb02cbe42585d0169d9b6c4964a41b436039f5 | 672bb34094b8780806a10ba9b1d21036fd808b8e | refs/heads/master | 2023-07-29T05:26:14.603817 | 2021-09-03T05:23:34 | 2021-09-03T05:23:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,867 | java | package com.huawei.hilink.framework.aidl;
import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Bundle;
import android.os.IBinder;
import android.os.RemoteException;
import android.util.Log;
import com.huawei.hilink.framework.aidl.IHilinkService;
import java.io.Closeable;
public class HilinkServiceProxy implements Closeable {
public static final int ERRORCODE_BAD_REQUEST = 400;
public static final int ERRORCODE_INITIALIZATION_FAILURE = 12;
public static final int ERRORCODE_MAX_SERVICE_NUM_REACHED = 10;
public static final int ERRORCODE_METHOD_NOT_ALLOWED = 405;
public static final int ERRORCODE_NOT_FOUND = 404;
public static final int ERRORCODE_NO_NETWORK = 3;
public static final int ERRORCODE_NULLPOINTER = 2;
public static final int ERRORCODE_OK = 0;
public static final int ERRORCODE_PERMISSION_DENIED = 11;
public static final int ERRORCODE_REQUEST_ILLEGAL = 5;
public static final int ERRORCODE_REQUEST_NOLONGER_EXIST = 8;
public static final int ERRORCODE_RUNTIME = 4;
public static final int ERRORCODE_SERVICE_ALREADY_EXIST = 7;
public static final int ERRORCODE_TASK_QUEUE_FULL = 6;
private static final String TAG = "hilinkService";
private ServiceConnection conn = new ServiceConnection() {
public void onServiceConnected(ComponentName name, IBinder service) {
Log.i(HilinkServiceProxy.TAG, "onServiceConnected");
HilinkServiceProxy.this.hilinkServiceBinder = IHilinkService.Stub.asInterface(service);
}
public void onServiceDisconnected(ComponentName name) {
Log.i(HilinkServiceProxy.TAG, "onServiceDisconnected");
HilinkServiceProxy.this.hilinkServiceBinder = null;
}
};
private Context context;
/* access modifiers changed from: private */
public IHilinkService hilinkServiceBinder;
public HilinkServiceProxy(Context context2) {
if (context2 != null) {
this.context = context2;
Intent intent = new Intent();
intent.setComponent(new ComponentName("com.huawei.hilink.framework", "com.huawei.hilink.framework.HilinkService"));
context2.bindService(intent, this.conn, 1);
}
}
public int discover(DiscoverRequest request, ServiceFoundCallbackWrapper callback) {
if (this.hilinkServiceBinder == null) {
return 12;
}
try {
return this.hilinkServiceBinder.discover(request, callback);
} catch (RemoteException e) {
return 4;
}
}
public int call(CallRequest request, ResponseCallbackWrapper callback) {
if (this.hilinkServiceBinder == null) {
return 12;
}
try {
return this.hilinkServiceBinder.call(request, callback);
} catch (RemoteException e) {
return 4;
}
}
public int publish(String serviceType, String serviceID, RequestHandlerWrapper requestHandler) {
if (this.hilinkServiceBinder == null) {
return 12;
}
try {
return this.hilinkServiceBinder.publishKeepOnline(serviceType, serviceID, requestHandler);
} catch (RemoteException e) {
return 4;
}
}
public int publish(String serviceType, String serviceID, PendingIntent pendingIntent) {
if (this.hilinkServiceBinder == null) {
return 12;
}
try {
return this.hilinkServiceBinder.publishCanbeOffline(serviceType, serviceID, pendingIntent);
} catch (RemoteException e) {
return 4;
}
}
public static CallRequest getCallRequest(Intent intent) {
if (intent != null) {
Bundle bundle = intent.getExtras();
if (bundle != null) {
return (CallRequest) bundle.get("CallRequest");
}
}
return null;
}
public void unpublish(String serviceID) {
if (this.hilinkServiceBinder != null) {
try {
this.hilinkServiceBinder.unpublish(serviceID);
} catch (RemoteException e) {
Log.e(TAG, "unpublish failed");
}
}
}
public int sendResponse(int errorCode, String payload, int requestID) {
if (this.hilinkServiceBinder == null) {
return 12;
}
try {
return this.hilinkServiceBinder.sendResponse(errorCode, payload, requestID);
} catch (RemoteException e) {
return 4;
}
}
public void close() {
if (this.context != null) {
this.context.unbindService(this.conn);
this.hilinkServiceBinder = null;
}
}
}
| [
"dstmath@163.com"
] | dstmath@163.com |
d8832a01c288c845bf16d196b4d3a425b5b4a78a | b12e3e8142b451259cbaa9d2b2df6cfa62e7d346 | /src/com/markey/proxy/ActionOne.java | 06309e505321f8ff2ff4c6e08ff0226c1422ea5e | [] | no_license | markey92/helloworld | e7c9421de2f041dc5355184b1adf9505240c7921 | 410df6497d70929705681f2e86a88563bb56f980 | refs/heads/master | 2021-01-01T06:12:26.156842 | 2018-10-04T16:06:36 | 2018-10-04T16:06:36 | 97,378,612 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 135 | java | package com.markey.proxy;
//第一种动作,包含sayHello方法
public interface ActionOne {
public void sayHello(String word);
}
| [
"1053667066@qq.com"
] | 1053667066@qq.com |
9073443577fc85e8c0be7d11f2e2e1576044eda3 | b93a3d2ae6c8599b80f6885d95102cea2c4d13f4 | /app/src/test/java/com/fy/seekbar/demo/ExampleUnitTest.java | ff5674b572a3e206d694247040672c852c0b797a | [
"Apache-2.0"
] | permissive | lookfuyao/SeekBarFloatProject | 6c757a40aee8f892d869d9bf1267f886bbfdc3d2 | 407559389f296f2e0414cef8ecf8640b12d9b41f | refs/heads/master | 2021-01-21T23:05:10.890029 | 2017-06-27T07:00:54 | 2017-06-27T07:00:54 | 95,191,334 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 397 | java | package com.fy.seekbar.demo;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"yao.fu@tinno.com"
] | yao.fu@tinno.com |
d850a23b14761aca0ef19bf2246b98ae058bbbfa | 07209188d61141aa2bfb618e3a990b58666c91d7 | /restpolloloko/src/main/java/com/afr/restpolloloko/MainActivity.java | 2f5c756fbc2e9e3494f22124617a4b7eae4302fe | [] | no_license | Alfonfdez/practica04 | 07328f33ec59e45ba80fab351f412df02154449a | 7ab0adf6cd168b9caf95df516f3e4524876ef3a9 | refs/heads/master | 2020-06-05T06:15:55.088807 | 2019-10-03T12:28:11 | 2019-10-03T12:28:11 | 192,342,266 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,462 | java | package com.afr.restpolloloko;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import com.afr.restpolloloko.activity.AltaCamareroActivity;
import com.afr.restpolloloko.activity.AltaProductoActivity;
import com.afr.restpolloloko.activity.CamareroActivity;
import com.afr.restpolloloko.activity.EstadisticaPedidoActivity;
import com.afr.restpolloloko.activity.PedidoActivity;
import com.afr.restpolloloko.activity.ProductoActivity;
import com.afr.restpolloloko.apirest.JsonPlaceHolderApi;
import com.afr.restpolloloko.model.Camarero;
import org.w3c.dom.Text;
import java.util.List;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
public class MainActivity extends AppCompatActivity implements View.OnClickListener{
//I- Declarar las variables
private Button botonCamarero;
private Button botonProducto;
private Button botonPedido;
private Button botonAltaCamarero;
private Button botonAltaProducto;
private Button botonEstadisticaPedido;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
botonCamarero = (Button) findViewById(R.id.id_button_camarero);
botonProducto = (Button) findViewById(R.id.id_button_producto);
botonPedido = (Button) findViewById(R.id.id_button_pedido);
botonAltaCamarero = (Button) findViewById(R.id.id_button_alta_camarero);
botonAltaProducto = (Button) findViewById(R.id.id_button_alta_producto);
botonEstadisticaPedido = (Button) findViewById(R.id.id_button_estadistica);
botonCamarero.setOnClickListener(this);
botonProducto.setOnClickListener(this);
botonPedido.setOnClickListener(this);
botonAltaCamarero.setOnClickListener(this);
botonAltaProducto.setOnClickListener(this);
botonEstadisticaPedido.setOnClickListener(this);
}
@Override
public void onClick(View v) {
String tag = v.getTag().toString();
Log.d("DEBUG", tag);
switch(tag){
case "1":
Intent intentCamarero = new Intent(this, CamareroActivity.class);
startActivity(intentCamarero);
break;
case "2":
Intent intentProducto = new Intent(this, ProductoActivity.class);
startActivity(intentProducto);
break;
case "3":
Intent intentPedido = new Intent(this, PedidoActivity.class);
startActivity(intentPedido);
break;
case "4":
Intent intentAltaCamarero = new Intent(this, AltaCamareroActivity.class);
startActivity(intentAltaCamarero);
break;
case "5":
Intent intentAltaProducto = new Intent(this, AltaProductoActivity.class);
startActivity(intentAltaProducto);
break;
case "6":
Intent intentEstadisticaPedido = new Intent(this, EstadisticaPedidoActivity.class);
startActivity(intentEstadisticaPedido);
break;
}
}
}
| [
"alfonfdez2@hotmail.com"
] | alfonfdez2@hotmail.com |
f66946c3322d43c9c1278c01dc5e37e6e117ab05 | 35dcced34f39f1c4ee74d43f5edb6e16f61f2303 | /03. Desarrollo/02. CodigoFuente/tecnica/V1.0.0/src/main/java/co/edu/sena/dwbh/config/LiquibaseConfiguration.java | 1bb672b5253e0a63fef7b4d99423afe08a2c5633 | [] | no_license | Lotbrock/D.W.B.H-CORPORATION | 459fded0bcd5afb4da5eadeedc077729948759a6 | 405a3d298705e7bd86dead16f741b906e22a504b | refs/heads/master | 2022-01-31T18:24:32.353081 | 2018-12-10T18:08:51 | 2018-12-10T18:08:51 | 151,576,870 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,990 | java | package co.edu.sena.dwbh.config;
import javax.sql.DataSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.liquibase.LiquibaseProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.core.task.TaskExecutor;
import io.github.jhipster.config.JHipsterConstants;
import io.github.jhipster.config.liquibase.AsyncSpringLiquibase;
import liquibase.integration.spring.SpringLiquibase;
@Configuration
public class LiquibaseConfiguration {
private final Logger log = LoggerFactory.getLogger(LiquibaseConfiguration.class);
private final Environment env;
public LiquibaseConfiguration(Environment env) {
this.env = env;
}
@Bean
public SpringLiquibase liquibase(@Qualifier("taskExecutor") TaskExecutor taskExecutor,
DataSource dataSource, LiquibaseProperties liquibaseProperties) {
// Use liquibase.integration.spring.SpringLiquibase if you don't want Liquibase to start asynchronously
SpringLiquibase liquibase = new AsyncSpringLiquibase(taskExecutor, env);
liquibase.setDataSource(dataSource);
liquibase.setChangeLog("classpath:config/liquibase/master.xml");
liquibase.setContexts(liquibaseProperties.getContexts());
liquibase.setDefaultSchema(liquibaseProperties.getDefaultSchema());
liquibase.setDropFirst(liquibaseProperties.isDropFirst());
liquibase.setChangeLogParameters(liquibaseProperties.getParameters());
if (env.acceptsProfiles(JHipsterConstants.SPRING_PROFILE_NO_LIQUIBASE)) {
liquibase.setShouldRun(false);
} else {
liquibase.setShouldRun(liquibaseProperties.isEnabled());
log.debug("Configuring Liquibase");
}
return liquibase;
}
}
| [
"jafajardo37@misena.edu.co"
] | jafajardo37@misena.edu.co |
28ea72a2e0e1d4d14b1e342f7df2384fee12f881 | 82a0f7a5fa5bdea20e073e6a6cf35352e84dba17 | /JavaBasicSyntax/src/SumNIntegers.java | 21669fecf66fff99ebd0c2436bbb76ffd1ce93d0 | [
"MIT"
] | permissive | Shtereva/Software-Technologies | 8ce99a70bcc93dee5f77d322f496d3bf24e62823 | 73ddb3e1bfa3589b552663497d0315aeba6d0bdd | refs/heads/master | 2021-01-01T16:56:53.826814 | 2017-09-03T13:08:17 | 2017-09-03T13:08:17 | 97,714,563 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 395 | java | import java.util.Scanner;
public class SumNIntegers {
public static void main(String[] arg) {
Scanner console = new Scanner(System.in);
int num = Integer.parseInt(console.nextLine());
long result = 0;
for (int i = 0; i < num; i++){
result += Integer.parseInt(console.nextLine());
}
System.out.println("Sum = " + result);
}
}
| [
"a.i.shtereva@gmail.com"
] | a.i.shtereva@gmail.com |
e85bfb286f9e6e72e81a14908f6ac1f1ad34dc3c | 297e0b6ac5ac8c6edae27930f7673d29550b5762 | /src/main/java/com/apress/spring/config/AuthorizationServerConfig.java | 52088b9a29308c093fed542f86b039689a9e0bb9 | [] | no_license | mr-robot-in/spring-oauth-blog | d1ab53f733fe4a604931039c28bda47dde6abbb7 | 902afd4cf556f8af72e2175d39600afda720c096 | refs/heads/master | 2022-05-10T07:25:39.675060 | 2017-07-23T09:07:18 | 2017-07-23T09:07:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,889 | java | package com.apress.spring.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer;
import org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerConfigurerAdapter;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer;
import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerEndpointsConfigurer;
import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerSecurityConfigurer;
@Configuration
@EnableAuthorizationServer
public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdapter {
@Autowired
private AuthenticationManager authenticationManager;
@Value("${spring.oauth2.client.clientId}")
private String clientId;
@Value("${spring.oauth2.client.secret}")
private String secret;
@Override
public void configure(AuthorizationServerSecurityConfigurer security) throws Exception {
security.checkTokenAccess("isAuthenticated()");
}
@Override
public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
clients.inMemory().withClient(clientId)
.authorizedGrantTypes("client_credentials","password")
.authorities("ROLE_CLIENT","ROLE_TRUSTED_CLIENT")
.scopes("read","write","trust")
.resourceIds("oauth2-resource")
.accessTokenValiditySeconds(5000)
.secret(secret);
}
@Override
public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
endpoints.authenticationManager(authenticationManager);
}
}
| [
"bharat.a.parmar@capgemini.com"
] | bharat.a.parmar@capgemini.com |
54a7c60a4b701f1e9d0abc4c14f31821c6449f2c | bc53aecdbb40d389f563f76f8a706d61d0a4b380 | /source/SQLParserDemo/src/demos/dlineage/Dlineage.java | e2d188387efe4f635db0daec3b92e8eae8c27716 | [
"MIT"
] | permissive | kyryl-bogach/sql-jpql-compiler | f0d5462945199e879d68a409969043d4e76e0ffd | 03a9f11bcd68651e22bc36a4ac587fb2b474266a | refs/heads/master | 2023-03-03T14:16:18.442644 | 2021-02-11T19:11:41 | 2021-02-11T19:11:41 | 159,367,377 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 21,204 | java |
package demos.dlineage;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import demos.dlineage.columnImpact.ColumnImpact;
import demos.dlineage.metadata.DDLParser;
import demos.dlineage.metadata.DDLSchema;
import demos.dlineage.metadata.ProcedureRelationScanner;
import demos.dlineage.metadata.ViewParser;
import demos.dlineage.model.ddl.schema.database;
import demos.dlineage.model.metadata.ColumnMetaData;
import demos.dlineage.model.metadata.MetaScanner;
import demos.dlineage.model.metadata.ProcedureMetaData;
import demos.dlineage.model.metadata.TableMetaData;
import demos.dlineage.model.xml.columnImpactResult;
import demos.dlineage.model.xml.procedureImpactResult;
import demos.dlineage.util.Pair;
import demos.dlineage.util.SQLUtil;
import demos.dlineage.util.XML2Model;
import demos.dlineage.util.XMLUtil;
import gudusoft.gsqlparser.EDbVendor;
import gudusoft.gsqlparser.TGSqlParser;
public class Dlineage
{
public static final String TABLE_CONSTANT = "CONSTANT";
private Map<TableMetaData, List<ColumnMetaData>> tableColumns = new HashMap<TableMetaData, List<ColumnMetaData>>( );
private Pair<procedureImpactResult, List<ProcedureMetaData>> procedures = new Pair<procedureImpactResult, List<ProcedureMetaData>>( new procedureImpactResult( ),
new ArrayList<ProcedureMetaData>( ) );
private boolean strict = false;
private boolean showUIInfo = false;
private File sqlDir;
private File[] sqlFiles;
private String sqlContent;
private EDbVendor vendor;
public Dlineage( String sqlContent, EDbVendor vendor, boolean strict,
boolean showUIInfo )
{
this.strict = strict;
this.showUIInfo = showUIInfo;
this.vendor = vendor;
this.sqlFiles = null;
this.sqlContent = sqlContent;
tableColumns.clear( );
procedures = new Pair<procedureImpactResult, List<ProcedureMetaData>>( new procedureImpactResult( ),
new ArrayList<ProcedureMetaData>( ) );
String content = sqlContent;
String database = null;
TGSqlParser parser = new TGSqlParser( vendor );
parser.sqltext = content.toUpperCase( );
int ret = parser.parse( );
if ( ret == 0 )
{
String returnDatabase = new DDLParser( tableColumns,
procedures,
vendor,
parser,
strict,
database ).getDatabase( );
if ( returnDatabase != null )
{
database = returnDatabase;
}
returnDatabase = new ViewParser( tableColumns,
vendor,
parser,
strict,
database ).getDatabase( );
if ( returnDatabase != null )
{
database = returnDatabase;
}
returnDatabase = new ProcedureRelationScanner( procedures,
vendor,
parser,
strict,
database ).getDatabase( );
}
else
{
System.err.println( parser.getErrormessage( ) );
}
}
public Dlineage( String[] sqlContents, EDbVendor vendor, boolean strict,
boolean showUIInfo )
{
this.strict = strict;
this.showUIInfo = showUIInfo;
this.vendor = vendor;
this.sqlFiles = null;
tableColumns.clear( );
procedures = new Pair<procedureImpactResult, List<ProcedureMetaData>>( new procedureImpactResult( ),
new ArrayList<ProcedureMetaData>( ) );
String database = null;
for ( int i = 0; i < sqlContents.length; i++ )
{
String content = sqlContents[i];
TGSqlParser parser = new TGSqlParser( vendor );
parser.sqltext = content.toUpperCase( );
int ret = parser.parse( );
if ( ret == 0 )
{
String returnDatabase = new DDLParser( tableColumns,
procedures,
vendor,
parser,
strict,
database ).getDatabase( );
if ( returnDatabase != null )
{
database = returnDatabase;
}
returnDatabase = new ViewParser( tableColumns,
vendor,
parser,
strict,
database ).getDatabase( );
if ( returnDatabase != null )
{
database = returnDatabase;
}
database = new ProcedureRelationScanner( procedures,
vendor,
parser,
strict,
database ).getDatabase( );
if ( returnDatabase != null )
{
database = returnDatabase;
}
}
else
{
System.err.println( parser.getErrormessage( ) );
}
}
}
public Dlineage( File[] sqlFiles, EDbVendor vendor, boolean strict,
boolean showUIInfo )
{
this.strict = strict;
this.showUIInfo = showUIInfo;
this.vendor = vendor;
this.sqlFiles = sqlFiles;
tableColumns.clear( );
procedures = new Pair<procedureImpactResult, List<ProcedureMetaData>>( new procedureImpactResult( ),
new ArrayList<ProcedureMetaData>( ) );
File[] children = sqlFiles;
String database = null;
for ( int i = 0; i < children.length; i++ )
{
File child = children[i];
if ( child.isDirectory( ) )
continue;
String content = SQLUtil.getFileContent( child );
TGSqlParser parser = new TGSqlParser( vendor );
parser.sqltext = content.toUpperCase( );
int ret = parser.parse( );
if ( ret == 0 )
{
String returnDatabase = new DDLParser( tableColumns,
procedures,
vendor,
parser,
strict,
database ).getDatabase( );
if ( returnDatabase != null )
{
database = returnDatabase;
}
returnDatabase = new ViewParser( tableColumns,
vendor,
parser,
strict,
database ).getDatabase( );
if ( returnDatabase != null )
{
database = returnDatabase;
}
returnDatabase = new ProcedureRelationScanner( procedures,
vendor,
parser,
strict,
database ).getDatabase( );
if ( returnDatabase != null )
{
database = returnDatabase;
}
}
else
{
System.err.println( parser.getErrormessage( ) );
}
}
}
public Dlineage( File sqlDir, EDbVendor vendor, boolean strict,
boolean showUIInfo )
{
this.strict = strict;
this.showUIInfo = showUIInfo;
this.sqlDir = sqlDir;
this.vendor = vendor;
tableColumns.clear( );
procedures = new Pair<procedureImpactResult, List<ProcedureMetaData>>( new procedureImpactResult( ),
new ArrayList<ProcedureMetaData>( ) );
File[] children = listFiles( sqlDir );
String database = null;
for ( int i = 0; i < children.length; i++ )
{
File child = children[i];
if ( child.isDirectory( ) )
continue;
String content = SQLUtil.getFileContent( child );
TGSqlParser parser = new TGSqlParser( vendor );
parser.sqltext = content.toUpperCase( );
int ret = parser.parse( );
if ( ret == 0 )
{
String returnDatabase = new DDLParser( tableColumns,
procedures,
vendor,
parser,
strict,
database ).getDatabase( );
if ( returnDatabase != null )
{
database = returnDatabase;
}
returnDatabase = new ViewParser( tableColumns,
vendor,
parser,
strict,
database ).getDatabase( );
if ( returnDatabase != null )
{
database = returnDatabase;
}
returnDatabase = new ProcedureRelationScanner( procedures,
vendor,
parser,
strict,
database ).getDatabase( );
if ( returnDatabase != null )
{
database = returnDatabase;
}
}
else
{
System.err.println( parser.getErrormessage( ) );
}
}
}
public void columnImpact( )
{
String result = getColumnImpactResult( false );
System.out.println( result );
}
public String getColumnImpactResult( )
{
return getColumnImpactResult( true );
}
public String getColumnImpactResult( boolean analyzeDlineage )
{
if ( sqlContent == null )
{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance( );
Document doc = null;
Element columnImpactResult = null;
try
{
DocumentBuilder builder = factory.newDocumentBuilder( );
doc = builder.newDocument( );
doc.setXmlVersion( "1.0" );
columnImpactResult = doc.createElement( "columnImpactResult" );
doc.appendChild( columnImpactResult );
if ( sqlDir != null && sqlDir.isDirectory( ) )
{
Element dirNode = doc.createElement( "dir" );
dirNode.setAttribute( "name", sqlDir.getAbsolutePath( ) );
columnImpactResult.appendChild( dirNode );
}
}
catch ( ParserConfigurationException e )
{
e.printStackTrace( );
}
File[] children = sqlFiles == null ? listFiles( sqlDir ) : sqlFiles;
for ( int i = 0; i < children.length; i++ )
{
File child = children[i];
if ( child.isDirectory( ) )
continue;
if ( child != null )
{
Element fileNode = doc.createElement( "file" );
fileNode.setAttribute( "name", child.getAbsolutePath( ) );
ColumnImpact impact = new ColumnImpact( fileNode,
vendor,
tableColumns,
strict );
impact.setDebug( false );
impact.setShowUIInfo( showUIInfo );
impact.setTraceErrorMessage( false );
impact.setAnalyzeDlineage( analyzeDlineage );
impact.ignoreTopSelect( false );
impact.impactSQL( );
if ( impact.getErrorMessage( ) != null
&& impact.getErrorMessage( ).trim( ).length( ) > 0 )
{
System.err.println( impact.getErrorMessage( ).trim( ) );
}
if ( fileNode.hasChildNodes( ) )
{
columnImpactResult.appendChild( fileNode );
}
}
}
if ( doc != null )
{
try
{
return XMLUtil.format( doc, 2 );
}
catch ( Exception e )
{
e.printStackTrace( );
}
}
}
else
{
ColumnImpact impact = new ColumnImpact( sqlContent,
vendor,
tableColumns,
strict );
impact.setDebug( false );
impact.setShowUIInfo( showUIInfo );
impact.setTraceErrorMessage( false );
impact.setAnalyzeDlineage( true );
impact.impactSQL( );
if ( impact.getErrorMessage( ) != null
&& impact.getErrorMessage( ).trim( ).length( ) > 0 )
{
System.err.println( impact.getErrorMessage( ).trim( ) );
}
return impact.getImpactResult( );
}
return null;
}
public void forwardAnalyze( String tableColumn,
List<ColumnMetaData[]> relations )
{
ColumnMetaData columnMetaData = new MetaScanner( this ).getColumnMetaData( tableColumn );
List<ColumnMetaData> columns = new ArrayList<ColumnMetaData>( );
Iterator<TableMetaData> iter = tableColumns.keySet( ).iterator( );
while ( iter.hasNext( ) )
{
columns.addAll( tableColumns.get( iter.next( ) ) );
}
if ( columnMetaData != null )
{
outputForwardAnalyze( columnMetaData, columns, 0, relations );
}
}
public void backwardAnalyze( String viewColumn,
List<ColumnMetaData[]> relations )
{
ColumnMetaData columnMetaData = new MetaScanner( this ).getColumnMetaData( viewColumn );
if ( columnMetaData != null )
{
outputBackwardAnalyze( columnMetaData, 0, relations );
}
}
private void outputBackwardAnalyze( ColumnMetaData columnMetaData,
int level, List<ColumnMetaData[]> relations )
{
if ( level > 0 )
{
for ( int i = 0; i < level; i++ )
{
System.out.print( "---" );
}
System.out.print( ">" );
}
System.out.println( columnMetaData.getDisplayFullName( ) );
if ( columnMetaData.getReferColumns( ) != null
&& columnMetaData.getReferColumns( ).length > 0 )
{
for ( int i = 0; i < columnMetaData.getReferColumns( ).length; i++ )
{
ColumnMetaData sourceColumn = columnMetaData.getReferColumns( )[i];
if ( containsRelation( columnMetaData, sourceColumn, relations ) )
{
outputBackwardAnalyze( columnMetaData.getReferColumns( )[i],
level + 1,
relations );
}
}
}
}
private boolean containsRelation( ColumnMetaData targetColumn,
ColumnMetaData sourceColumn, List<ColumnMetaData[]> relations )
{
if ( relations == null )
return false;
for ( int i = 0; i < relations.size( ); i++ )
{
ColumnMetaData[] relation = relations.get( i );
if ( relation[0].equals( targetColumn )
&& relation[1].equals( sourceColumn ) )
return true;
}
return false;
}
private void outputForwardAnalyze( ColumnMetaData columnMetaData,
List<ColumnMetaData> columns, int level,
List<ColumnMetaData[]> relations )
{
if ( level > 0 )
{
for ( int i = 0; i < level; i++ )
{
System.out.print( "---" );
}
System.out.print( ">" );
}
System.out.println( columnMetaData.getDisplayFullName( ) );
for ( int i = 0; i < columns.size( ); i++ )
{
ColumnMetaData targetColumn = columns.get( i );
if ( Arrays.asList( targetColumn.getReferColumns( ) )
.contains( columnMetaData ) )
{
if ( containsRelation( targetColumn, columnMetaData, relations ) )
{
outputForwardAnalyze( targetColumn,
columns,
level + 1,
relations );
}
}
}
}
public void outputDDLSchema( )
{
System.out.println( new DDLSchema( tableColumns ).getSchemaXML( ) );
}
public database[] getDataMetaInfos( )
{
return new DDLSchema( tableColumns ).getDataMetaInfos( );
}
private File[] listFiles( File sqlFiles )
{
List<File> children = new ArrayList<File>( );
if ( sqlFiles != null )
listFiles( sqlFiles, children );
return children.toArray( new File[0] );
}
private void listFiles( File rootFile, List<File> children )
{
if ( rootFile.isFile( ) )
children.add( rootFile );
else
{
File[] files = rootFile.listFiles( );
for ( int i = 0; i < files.length; i++ )
{
listFiles( files[i], children );
}
}
}
public columnImpactResult generateColumnImpact( StringBuilder errorMessage )
{
PrintStream systemSteam = System.err;
ByteArrayOutputStream sw = new ByteArrayOutputStream( );
PrintStream pw = new PrintStream( sw );
System.setErr( pw );
String impactResult = this.getColumnImpactResult( );
pw.close( );
System.setErr( systemSteam );
if ( errorMessage != null )
{
errorMessage.append( new String( sw.toByteArray( ) ).trim( ) );
}
return getColumnImpactResult( impactResult );
}
private columnImpactResult getColumnImpactResult( String result )
{
try
{
String[] results = result.split( "\n" );
StringBuilder buffer = new StringBuilder( );
for ( int i = 0; i < results.length; i++ )
{
String line = results[i];
if ( line.indexOf( "columnImpactResult" ) != -1
|| line.indexOf( "targetColumn" ) != -1
|| line.indexOf( "sourceColumn" ) != -1
|| line.indexOf( "linkTable" ) != -1 )
{
buffer.append( line ).append( "\n" );
}
}
return XML2Model.loadXML( columnImpactResult.class,
buffer.toString( ) );
}
catch ( Exception e )
{
e.printStackTrace( );
}
return null;
}
public static void main( String[] args )
{
if ( args.length < 1 )
{
System.out.println( "Usage: java Dlineage [/f <path_to_sql_file>] [/d <path_to_directory_includes_sql_files>] [/t <database type>] [/fo <table column>] [/b <view column>] [/ddl] [/s] [/log]" );
System.out.println( "/f: Option, specify the sql file path to analyze dlineage." );
System.out.println( "/d: Option, specify the sql directory path to analyze dlineage." );
System.out.println( "/d: Option, forward analyze the specified table column." );
System.out.println( "/t: Option, set the database type. Support oracle, mysql, mssql, db2, netezza, teradata, informix, sybase, postgresql, hive, greenplum and redshift, the default type is oracle" );
System.out.println( "/fo: Option, forward analyze the specified table column." );
System.out.println( "/b: Option, backward analyze the specified view column." );
System.out.println( "/ddl: Option, output the database DDL schema." );
System.out.println( "/s: Option, set the strict match mode. It will match the catalog name and schema name." );
System.out.println( "/log: Option, generate a dlineage.log file to log information." );
return;
}
File sqlFiles = null;
List<String> argList = Arrays.asList( args );
if ( argList.indexOf( "/f" ) != -1
&& argList.size( ) > argList.indexOf( "/f" ) + 1 )
{
sqlFiles = new File( args[argList.indexOf( "/f" ) + 1] );
if ( !sqlFiles.exists( ) || !sqlFiles.isFile( ) )
{
System.out.println( sqlFiles + " is not a valid file." );
return;
}
}
else if ( argList.indexOf( "/d" ) != -1
&& argList.size( ) > argList.indexOf( "/d" ) + 1 )
{
sqlFiles = new File( args[argList.indexOf( "/d" ) + 1] );
if ( !sqlFiles.exists( ) || !sqlFiles.isDirectory( ) )
{
System.out.println( sqlFiles + " is not a valid directory." );
return;
}
}
else
{
System.out.println( "Please specify a sql file path or directory path to analyze dlineage." );
return;
}
EDbVendor vendor = EDbVendor.dbvoracle;
int index = argList.indexOf( "/t" );
if ( index != -1 && args.length > index + 1 )
{
if ( args[index + 1].equalsIgnoreCase( "mssql" ) )
{
vendor = EDbVendor.dbvmssql;
}
else if ( args[index + 1].equalsIgnoreCase( "db2" ) )
{
vendor = EDbVendor.dbvdb2;
}
else if ( args[index + 1].equalsIgnoreCase( "mysql" ) )
{
vendor = EDbVendor.dbvmysql;
}
else if ( args[index + 1].equalsIgnoreCase( "netezza" ) )
{
vendor = EDbVendor.dbvnetezza;
}
else if ( args[index + 1].equalsIgnoreCase( "teradata" ) )
{
vendor = EDbVendor.dbvteradata;
}
else if ( args[index + 1].equalsIgnoreCase( "oracle" ) )
{
vendor = EDbVendor.dbvoracle;
}
else if ( args[index + 1].equalsIgnoreCase( "informix" ) )
{
vendor = EDbVendor.dbvinformix;
}
else if ( args[index + 1].equalsIgnoreCase( "sybase" ) )
{
vendor = EDbVendor.dbvsybase;
}
else if ( args[index + 1].equalsIgnoreCase( "postgresql" ) )
{
vendor = EDbVendor.dbvpostgresql;
}
else if ( args[index + 1].equalsIgnoreCase( "hive" ) )
{
vendor = EDbVendor.dbvhive;
}
else if ( args[index + 1].equalsIgnoreCase( "greenplum" ) )
{
vendor = EDbVendor.dbvgreenplum;
}
else if ( args[index + 1].equalsIgnoreCase( "redshift" ) )
{
vendor = EDbVendor.dbvredshift;
}
}
boolean strict = argList.indexOf( "/s" ) != -1;
boolean log = argList.indexOf( "/log" ) != -1;
PrintStream pw = null;
ByteArrayOutputStream sw = null;
PrintStream systemSteam = System.err;
try
{
sw = new ByteArrayOutputStream( );
pw = new PrintStream( sw );
System.setErr( pw );
}
catch ( Exception e )
{
e.printStackTrace( );
}
Dlineage dlineage = new Dlineage( sqlFiles, vendor, strict, false );
boolean forwardAnalyze = argList.indexOf( "/fo" ) != -1;
boolean backwardAnalyze = argList.indexOf( "/b" ) != -1;
boolean outputDDL = argList.indexOf( "/ddl" ) != -1;
if ( !forwardAnalyze && !backwardAnalyze && !outputDDL )
{
dlineage.columnImpact( );
}
else if ( outputDDL )
{
dlineage.outputDDLSchema( );
}
else
{
DlineageRelation relation = new DlineageRelation( );
columnImpactResult impactResult = relation.generateColumnImpact( dlineage,
null );
List<ColumnMetaData[]> relations = relation.collectDlineageRelations( dlineage,
impactResult );
if ( forwardAnalyze
&& argList.size( ) > argList.indexOf( "/fo" ) + 1 )
{
String tableColumn = argList.get( argList.indexOf( "/fo" ) + 1 );
dlineage.forwardAnalyze( tableColumn, relations );
}
if ( backwardAnalyze
&& argList.size( ) > argList.indexOf( "/b" ) + 1 )
{
String viewColumn = argList.get( argList.indexOf( "/b" ) + 1 );
dlineage.backwardAnalyze( viewColumn, relations );
}
}
if ( pw != null )
{
pw.close( );
}
if ( sw != null )
{
String errorMessage = sw.toString( ).trim( );
if ( errorMessage.length( ) > 0 )
{
if ( log )
{
try
{
pw = new PrintStream( new File( ".", "dlineage.log" ) );
pw.print( errorMessage );
}
catch ( FileNotFoundException e )
{
e.printStackTrace( );
}
}
System.setErr( systemSteam );
System.err.println( errorMessage );
}
}
}
public Map<TableMetaData, List<ColumnMetaData>> getMetaData( )
{
return tableColumns;
}
public Pair<procedureImpactResult, List<ProcedureMetaData>> getProcedures( )
{
return procedures;
}
public boolean isStrict( )
{
return strict;
}
public EDbVendor getVendor( )
{
return vendor;
}
}
| [
"kyryl.bogachy@um.es"
] | kyryl.bogachy@um.es |
e01e6815fdd45490aa6a52990128bc1981c1acfb | 3efc2074ee6f64c92c2e0c272153f8d602b65945 | /Muse_Valerio/Muse/srcRTP/com/sun/media/rtp/RTPControlImpl.java | d95017adac26155a89a82e0d6e089cda0bd7c2b1 | [] | no_license | marconanni/muse3 | 80ea97e2357d42a8426ca565f179ed62ea421dfe | 98004320df6eef09a97915c0c02b1e3146ea2bd1 | refs/heads/master | 2021-01-10T18:44:32.171711 | 2010-03-03T14:44:18 | 2010-03-03T14:44:18 | 34,604,347 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,656 | java | // Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3)
// Source File Name: RTPControlImpl.java
package com.sun.media.rtp;
import com.sun.media.util.RTPInfo;
import java.awt.Component;
import java.util.Enumeration;
import java.util.Hashtable;
import javax.media.Format;
import javax.media.rtp.*;
// Referenced classes of package com.sun.media.rtp:
// RecvSSRCInfo, SSRCInfo
public abstract class RTPControlImpl
implements RTPControl, RTPInfo
{
public RTPControlImpl()
{
cname = null;
codeclist = null;
rtptime = 0;
seqno = 0;
payload = -1;
codec = "";
currentformat = null;
stream = null;
codeclist = new Hashtable(5);
}
public abstract int getSSRC();
public abstract String getCNAME();
public void addFormat(Format info, int payload)
{
codeclist.put(new Integer(payload), info);
}
public Format getFormat()
{
return currentformat;
}
public Format getFormat(int payload)
{
return (Format)codeclist.get(new Integer(payload));
}
public Format[] getFormatList()
{
Format infolist[] = new Format[codeclist.size()];
int i = 0;
for(Enumeration e = codeclist.elements(); e.hasMoreElements();)
{
Format f = (Format)e.nextElement();
infolist[i++] = (Format)f.clone();
}
return infolist;
}
public void setRTPInfo(int rtptime, int seqno)
{
this.rtptime = rtptime;
this.seqno = seqno;
}
public String toString()
{
String s = "\n\tRTPTime is " + rtptime + "\n\tSeqno is " + seqno;
if(codeclist != null)
s = s + "\n\tCodecInfo is " + codeclist.toString();
else
s = s + "\n\tcodeclist is null";
return s;
}
public ReceptionStats getReceptionStats()
{
if(stream == null)
{
return null;
} else
{
RecvSSRCInfo recvstream = (RecvSSRCInfo)stream;
return recvstream.getSourceReceptionStats();
}
}
public GlobalReceptionStats getGlobalStats()
{
return null;
}
public Component getControlComponent()
{
return null;
}
String cname;
Hashtable codeclist;
int rtptime;
int seqno;
int payload;
String codec;
Format currentformat;
SSRCInfo stream;
}
| [
"pire.dejaco@0b1e5f34-49f6-11de-a65c-33beeba39556"
] | pire.dejaco@0b1e5f34-49f6-11de-a65c-33beeba39556 |
59776b542756dc63f8f6079fcbc8686e971691e5 | 8af1164bac943cef64e41bae312223c3c0e38114 | /results-java/aosp-mirror--platform_frameworks_base/27c2ce3c4078c54df0a0ff98101e409344a70532/after/ImageUtils.java | 824b62a7b424fd1fcff6ea1319f60d431c1e2b21 | [] | no_license | fracz/refactor-extractor | 3ae45c97cc63f26d5cb8b92003b12f74cc9973a9 | dd5e82bfcc376e74a99e18c2bf54c95676914272 | refs/heads/master | 2021-01-19T06:50:08.211003 | 2018-11-30T13:00:57 | 2018-11-30T13:00:57 | 87,353,478 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,873 | java | /*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.layoutlib.bridge.intensive.util;
import android.annotation.NonNull;
import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import javax.imageio.ImageIO;
import static java.awt.RenderingHints.*;
import static java.awt.image.BufferedImage.TYPE_INT_ARGB;
import static java.io.File.separatorChar;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
// Adapted by taking the relevant pieces of code from the following classes:
//
// com.android.tools.idea.rendering.ImageUtils,
// com.android.tools.idea.tests.gui.framework.fixture.layout.ImageFixture and
// com.android.tools.idea.rendering.RenderTestBase
/**
* Utilities related to image processing.
*/
public class ImageUtils {
/**
* Normally, this test will fail when there is a missing thumbnail. However, when
* you create creating a new test, it's useful to be able to turn this off such that
* you can generate all the missing thumbnails in one go, rather than having to run
* the test repeatedly to get to each new render assertion generating its thumbnail.
*/
private static final boolean FAIL_ON_MISSING_THUMBNAIL = true;
private static final int THUMBNAIL_SIZE = 250;
private static final double MAX_PERCENT_DIFFERENCE = 0.3;
public static void requireSimilar(@NonNull String relativePath, @NonNull BufferedImage image)
throws IOException {
int maxDimension = Math.max(image.getWidth(), image.getHeight());
double scale = THUMBNAIL_SIZE / (double)maxDimension;
BufferedImage thumbnail = scale(image, scale, scale);
InputStream is = ImageUtils.class.getClassLoader().getResourceAsStream(relativePath);
if (is == null) {
String message = "Unable to load golden thumbnail: " + relativePath + "\n";
message = saveImageAndAppendMessage(thumbnail, message, relativePath);
if (FAIL_ON_MISSING_THUMBNAIL) {
fail(message);
} else {
System.out.println(message);
}
}
else {
try {
BufferedImage goldenImage = ImageIO.read(is);
assertImageSimilar(relativePath, goldenImage, thumbnail, MAX_PERCENT_DIFFERENCE);
} finally {
is.close();
}
}
}
public static void assertImageSimilar(String relativePath, BufferedImage goldenImage,
BufferedImage image, double maxPercentDifferent) throws IOException {
assertEquals("Only TYPE_INT_ARGB image types are supported", TYPE_INT_ARGB, image.getType());
if (goldenImage.getType() != TYPE_INT_ARGB) {
BufferedImage temp = new BufferedImage(goldenImage.getWidth(), goldenImage.getHeight(),
TYPE_INT_ARGB);
temp.getGraphics().drawImage(goldenImage, 0, 0, null);
goldenImage = temp;
}
assertEquals(TYPE_INT_ARGB, goldenImage.getType());
int imageWidth = Math.min(goldenImage.getWidth(), image.getWidth());
int imageHeight = Math.min(goldenImage.getHeight(), image.getHeight());
// Blur the images to account for the scenarios where there are pixel
// differences
// in where a sharp edge occurs
// goldenImage = blur(goldenImage, 6);
// image = blur(image, 6);
int width = 3 * imageWidth;
@SuppressWarnings("UnnecessaryLocalVariable")
int height = imageHeight; // makes code more readable
BufferedImage deltaImage = new BufferedImage(width, height, TYPE_INT_ARGB);
Graphics g = deltaImage.getGraphics();
// Compute delta map
long delta = 0;
for (int y = 0; y < imageHeight; y++) {
for (int x = 0; x < imageWidth; x++) {
int goldenRgb = goldenImage.getRGB(x, y);
int rgb = image.getRGB(x, y);
if (goldenRgb == rgb) {
deltaImage.setRGB(imageWidth + x, y, 0x00808080);
continue;
}
// If the pixels have no opacity, don't delta colors at all
if (((goldenRgb & 0xFF000000) == 0) && (rgb & 0xFF000000) == 0) {
deltaImage.setRGB(imageWidth + x, y, 0x00808080);
continue;
}
int deltaR = ((rgb & 0xFF0000) >>> 16) - ((goldenRgb & 0xFF0000) >>> 16);
int newR = 128 + deltaR & 0xFF;
int deltaG = ((rgb & 0x00FF00) >>> 8) - ((goldenRgb & 0x00FF00) >>> 8);
int newG = 128 + deltaG & 0xFF;
int deltaB = (rgb & 0x0000FF) - (goldenRgb & 0x0000FF);
int newB = 128 + deltaB & 0xFF;
int avgAlpha = ((((goldenRgb & 0xFF000000) >>> 24)
+ ((rgb & 0xFF000000) >>> 24)) / 2) << 24;
int newRGB = avgAlpha | newR << 16 | newG << 8 | newB;
deltaImage.setRGB(imageWidth + x, y, newRGB);
delta += Math.abs(deltaR);
delta += Math.abs(deltaG);
delta += Math.abs(deltaB);
}
}
// 3 different colors, 256 color levels
long total = imageHeight * imageWidth * 3L * 256L;
float percentDifference = (float) (delta * 100 / (double) total);
String error = null;
String imageName = getName(relativePath);
if (percentDifference > maxPercentDifferent) {
error = String.format("Images differ (by %.1f%%)", percentDifference);
} else if (Math.abs(goldenImage.getWidth() - image.getWidth()) >= 2) {
error = "Widths differ too much for " + imageName + ": " +
goldenImage.getWidth() + "x" + goldenImage.getHeight() +
"vs" + image.getWidth() + "x" + image.getHeight();
} else if (Math.abs(goldenImage.getHeight() - image.getHeight()) >= 2) {
error = "Heights differ too much for " + imageName + ": " +
goldenImage.getWidth() + "x" + goldenImage.getHeight() +
"vs" + image.getWidth() + "x" + image.getHeight();
}
assertEquals(TYPE_INT_ARGB, image.getType());
if (error != null) {
// Expected on the left
// Golden on the right
g.drawImage(goldenImage, 0, 0, null);
g.drawImage(image, 2 * imageWidth, 0, null);
// Labels
if (imageWidth > 80) {
g.setColor(Color.RED);
g.drawString("Expected", 10, 20);
g.drawString("Actual", 2 * imageWidth + 10, 20);
}
File output = new File(getFailureDir(), "delta-" + imageName);
if (output.exists()) {
boolean deleted = output.delete();
assertTrue(deleted);
}
ImageIO.write(deltaImage, "PNG", output);
error += " - see details in " + output.getPath() + "\n";
error = saveImageAndAppendMessage(image, error, relativePath);
System.out.println(error);
fail(error);
}
g.dispose();
}
/**
* Resize the given image
*
* @param source the image to be scaled
* @param xScale x scale
* @param yScale y scale
* @return the scaled image
*/
@NonNull
public static BufferedImage scale(@NonNull BufferedImage source, double xScale, double yScale) {
int sourceWidth = source.getWidth();
int sourceHeight = source.getHeight();
int destWidth = Math.max(1, (int) (xScale * sourceWidth));
int destHeight = Math.max(1, (int) (yScale * sourceHeight));
int imageType = source.getType();
if (imageType == BufferedImage.TYPE_CUSTOM) {
imageType = BufferedImage.TYPE_INT_ARGB;
}
if (xScale > 0.5 && yScale > 0.5) {
BufferedImage scaled =
new BufferedImage(destWidth, destHeight, imageType);
Graphics2D g2 = scaled.createGraphics();
g2.setComposite(AlphaComposite.Src);
g2.setColor(new Color(0, true));
g2.fillRect(0, 0, destWidth, destHeight);
if (xScale == 1 && yScale == 1) {
g2.drawImage(source, 0, 0, null);
} else {
setRenderingHints(g2);
g2.drawImage(source, 0, 0, destWidth, destHeight, 0, 0, sourceWidth, sourceHeight,
null);
}
g2.dispose();
return scaled;
} else {
// When creating a thumbnail, using the above code doesn't work very well;
// you get some visible artifacts, especially for text. Instead use the
// technique of repeatedly scaling the image into half; this will cause
// proper averaging of neighboring pixels, and will typically (for the kinds
// of screen sizes used by this utility method in the layout editor) take
// about 3-4 iterations to get the result since we are logarithmically reducing
// the size. Besides, each successive pass in operating on much fewer pixels
// (a reduction of 4 in each pass).
//
// However, we may not be resizing to a size that can be reached exactly by
// successively diving in half. Therefore, once we're within a factor of 2 of
// the final size, we can do a resize to the exact target size.
// However, we can get even better results if we perform this final resize
// up front. Let's say we're going from width 1000 to a destination width of 85.
// The first approach would cause a resize from 1000 to 500 to 250 to 125, and
// then a resize from 125 to 85. That last resize can distort/blur a lot.
// Instead, we can start with the destination width, 85, and double it
// successfully until we're close to the initial size: 85, then 170,
// then 340, and finally 680. (The next one, 1360, is larger than 1000).
// So, now we *start* the thumbnail operation by resizing from width 1000 to
// width 680, which will preserve a lot of visual details such as text.
// Then we can successively resize the image in half, 680 to 340 to 170 to 85.
// We end up with the expected final size, but we've been doing an exact
// divide-in-half resizing operation at the end so there is less distortion.
int iterations = 0; // Number of halving operations to perform after the initial resize
int nearestWidth = destWidth; // Width closest to source width that = 2^x, x is integer
int nearestHeight = destHeight;
while (nearestWidth < sourceWidth / 2) {
nearestWidth *= 2;
nearestHeight *= 2;
iterations++;
}
BufferedImage scaled = new BufferedImage(nearestWidth, nearestHeight, imageType);
Graphics2D g2 = scaled.createGraphics();
setRenderingHints(g2);
g2.drawImage(source, 0, 0, nearestWidth, nearestHeight, 0, 0, sourceWidth, sourceHeight,
null);
g2.dispose();
sourceWidth = nearestWidth;
sourceHeight = nearestHeight;
source = scaled;
for (int iteration = iterations - 1; iteration >= 0; iteration--) {
int halfWidth = sourceWidth / 2;
int halfHeight = sourceHeight / 2;
scaled = new BufferedImage(halfWidth, halfHeight, imageType);
g2 = scaled.createGraphics();
setRenderingHints(g2);
g2.drawImage(source, 0, 0, halfWidth, halfHeight, 0, 0, sourceWidth, sourceHeight,
null);
g2.dispose();
sourceWidth = halfWidth;
sourceHeight = halfHeight;
source = scaled;
iterations--;
}
return scaled;
}
}
private static void setRenderingHints(@NonNull Graphics2D g2) {
g2.setRenderingHint(KEY_INTERPOLATION,VALUE_INTERPOLATION_BILINEAR);
g2.setRenderingHint(KEY_RENDERING, VALUE_RENDER_QUALITY);
g2.setRenderingHint(KEY_ANTIALIASING, VALUE_ANTIALIAS_ON);
}
/**
* Directory where to write the thumbnails and deltas.
*/
@NonNull
private static File getFailureDir() {
String workingDirString = System.getProperty("user.dir");
File failureDir = new File(workingDirString, "out/failures");
//noinspection ResultOfMethodCallIgnored
failureDir.mkdirs();
return failureDir; //$NON-NLS-1$
}
/**
* Saves the generated thumbnail image and appends the info message to an initial message
*/
@NonNull
private static String saveImageAndAppendMessage(@NonNull BufferedImage image,
@NonNull String initialMessage, @NonNull String relativePath) throws IOException {
File output = new File(getFailureDir(), getName(relativePath));
if (output.exists()) {
boolean deleted = output.delete();
assertTrue(deleted);
}
ImageIO.write(image, "PNG", output);
initialMessage += "Thumbnail for current rendering stored at " + output.getPath();
// initialMessage += "\nRun the following command to accept the changes:\n";
// initialMessage += String.format("mv %1$s %2$s", output.getPath(),
// ImageUtils.class.getResource(relativePath).getPath());
// The above has been commented out, since the destination path returned is in out dir
// and it makes the tests pass without the code being actually checked in.
return initialMessage;
}
private static String getName(@NonNull String relativePath) {
return relativePath.substring(relativePath.lastIndexOf(separatorChar) + 1);
}
} | [
"fraczwojciech@gmail.com"
] | fraczwojciech@gmail.com |
64bb34404a18845cf7787985c317c3a14da62b8b | 9d5cefcd966d539a4a4ff5aacc6eb4c9732f3ac5 | /src/com/piano/structure/decorator/DecoratorClient.java | ac9eacd845adf781ae9d101865c63265d1822c9a | [] | no_license | PianoCello/design-pattern | a5af266ec2c77edb837e4dfe3110eda1b28ea730 | 8d7ba6ee1d5663209e7d761098fbe71b59be906a | refs/heads/master | 2022-10-24T04:17:52.972137 | 2020-06-13T16:11:37 | 2020-06-13T16:11:37 | 272,018,225 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 562 | java | package com.piano.structure.decorator;
/**
* 装饰模式测试客户端
*/
public class DecoratorClient {
public static void main(String[] args) {
Component component,component1,component2;
//创建具体构件对象
component = new ListBox();
//创建装饰后的构件对象
component1 = new BlackBorderDecorator(component);
//将装饰了一次的对象注入另一个装饰类中,进行第二次装饰
component2 = new ScrollBarDecorator(component1);
component2.display();
}
}
| [
"1146726774@qq.com"
] | 1146726774@qq.com |
80bbf12070950312f8eb3afdd82f7abe3d84a40d | 90c27199726ca39d311c35a447d596e9735d1b66 | /app/src/main/java/com/schoolrun/reimu/buttonchange/GameButton.java | 960a1d7fb4af6f0cf5c3cd663d958b51016ed4b4 | [] | no_license | tinaq/schoolrun | 75dbd74ec97d82ee26040d8af23079b2bf1560b1 | 243d75f12a625d94fca6a1e5389fda70ee47398a | refs/heads/master | 2021-01-22T20:34:52.501357 | 2017-03-17T16:28:33 | 2017-03-17T16:28:33 | 85,332,117 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,916 | java | package com.schoolrun.reimu.buttonchange;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Typeface;
import android.support.v4.content.res.ResourcesCompat;
import android.view.View;
import android.widget.Button;
/**
* Created by Reimu on 2016-09-21.
*/
public class GameButton extends Button {
int height;
int width;
SharedPreferences pref;
Typeface custom_font;
String type;
Context context;
int color;
String text;
public GameButton(Context context,String type) {
super(context);
this.context=context;
this.type = type;
pref=context.getSharedPreferences("high",0);
this.height=pref.getInt("buttonHeight",0);
width=pref.getInt("buttonWidth",0);
color =R.color.textColor;
init();
}
public GameButton(Context context,String type, String text){
super(context);
this.text = text;
this.type=type;
this.context=context;
pref=context.getSharedPreferences("high",0);
this.height=pref.getInt("buttonHeight",0);
width=pref.getInt("buttonWidth",0);
color =R.color.textColor;
init();
}
public GameButton(Context context,String type, String text,int h, int w){
super(context);
this.text = text;
this.type=type;
this.context=context;
pref=context.getSharedPreferences("high",0);
this.height=h;
width=w;
color =R.color.textColor;
init();
}
public GameButton(Context context,String type,int h, int w){
super(context);
this.type=type;
this.context=context;
pref=context.getSharedPreferences("high",0);
height=h;
width=w;
color =R.color.textColor;
setMinimumHeight(0);
setMinimumWidth(0);
init();
}
void init() {
custom_font = Typeface.createFromAsset(getContext().getAssets(), "fonts/Molot.otf");
setBackgroundResource(R.drawable.buttonshape);
setHeight(height);
setWidth(width);
if(type.equals("start")){
setOnClickListener(new OnStartActivityClickListener(context){
});
}
else if (!type.equals("back")) {
setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (type.equals("select")) {
GameButton.this.getContext().startActivity(new Intent(GameButton.this.getContext(), Select.class));
} else if (type.equals("shop")) {
GameButton.this.getContext().startActivity(new Intent(GameButton.this.getContext(), Shop.class));
}
((Activity) GameButton.this.getContext()).finish();
}
});
}
}
public void onDraw(Canvas c){
Paint paint = new Paint();
paint.setColor(ResourcesCompat.getColor(context.getResources(), R.color.textColor, null));
paint.setTextSize(height/2);
paint.setTypeface(custom_font);
paint.setStyle(Paint.Style.STROKE);
paint.setTextAlign(Paint.Align.CENTER);
paint.setStrokeWidth(10);
Paint paintInside = new Paint();
paintInside.setColor(Color.WHITE);
paintInside.setTextSize(height/2);
paintInside.setTypeface(custom_font);
paintInside.setTextAlign(Paint.Align.CENTER);
if(text==null) {
if (type.equals("start")) {
c.drawText("START", width / 2, (float) (height * 0.75 - 7.5), paint);
c.drawText("START", width / 2, (float) (height * 0.75 - 7.5), paintInside);
} else if (type.equals("select")) {
c.drawText("SELECT", width / 2, (float) (height * 0.75 - 7.5), paint);
c.drawText("SELECT", width / 2, (float) (height * 0.75 - 7.5), paintInside);
} else if (type.equals("shop")) {
c.drawText("SHOP", width / 2, (float) (height * 0.75 - 7.5), paint);
c.drawText("SHOP", width / 2, (float) (height * 0.75 - 7.5), paintInside);
} else if (type.equals("back")) {
c.drawText("BACK", width / 2, (float) (height * 0.75 - 7.5), paint);
c.drawText("BACK", width / 2, (float) (height * 0.75 - 7.5), paintInside);
}
}
else{
c.drawText( text,width/2,(float)(height*0.75-7.5), paint);
c.drawText( text,width/2,(float)(height*0.75-7.5), paintInside);
}
}
} | [
"tina.qian@yahoo.ca"
] | tina.qian@yahoo.ca |
6d708788f04b785eeb5239436d5affb2cb59cee1 | 9fffaf3c89aac791f5cd3ea7fecbe6a5227c0749 | /test/src/org/omegat/util/editor/EditorUtilsTest.java | 636430d82e4e119273d77b154af3f06336b4951a | [] | no_license | 5t111111/omegat | a8e7997ac2218efa48f42533127ae7cc95c2bcd2 | 7f51955f7b9b8ef9e88a22440e99a47e59dbfba5 | refs/heads/master | 2021-01-13T00:38:33.319330 | 2015-12-05T07:19:09 | 2015-12-05T07:19:09 | 47,446,713 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,970 | java | /**************************************************************************
OmegaT - Computer Assisted Translation (CAT) tool
with fuzzy matching, translation memory, keyword search,
glossaries, and translation leveraging into updated projects.
Copyright (C) 2011 Alex Buloichik
2015 Aaron Madlon-Kay
Home page: http://www.omegat.org/
Support center: http://groups.yahoo.com/group/OmegaT/
This file is part of OmegaT.
OmegaT 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.
OmegaT 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.omegat.util.editor;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import junit.framework.TestCase;
import org.omegat.core.Core;
import org.omegat.core.data.NotLoadedProject;
import org.omegat.core.data.ProjectProperties;
import org.omegat.gui.editor.EditorUtils;
import org.omegat.gui.editor.IEditor.CHANGE_CASE_TO;
import org.omegat.gui.glossary.GlossaryEntry;
import org.omegat.tokenizer.ITokenizer;
import org.omegat.tokenizer.LuceneEnglishTokenizer;
import org.omegat.util.Language;
public class EditorUtilsTest extends TestCase {
public void testRemoveDirectionChars() {
assertEquals("|", EditorUtils.removeDirectionChars("|"));
assertEquals("", EditorUtils.removeDirectionChars("\u202A"));
assertEquals("", EditorUtils.removeDirectionChars("\u202B"));
assertEquals("", EditorUtils.removeDirectionChars("\u202C"));
assertEquals("zz", EditorUtils.removeDirectionChars("\u202Az\u202Bz\u202C"));
assertEquals("zz", EditorUtils.removeDirectionChars("zz"));
}
public void testChangeCase() {
Locale locale = Locale.ENGLISH;
ITokenizer tokenizer = new LuceneEnglishTokenizer();
String input = "a I've GOT a {crazy} text hErE including 1 \u65e5\u672c\u8a9e!";
String round1 = EditorUtils.doChangeCase(input, CHANGE_CASE_TO.CYCLE, locale, tokenizer);
assertEquals("A I'VE GOT A {CRAZY} TEXT HERE INCLUDING 1 \u65e5\u672c\u8a9e!", round1);
assertEquals(round1, EditorUtils.doChangeCase(input, CHANGE_CASE_TO.UPPER, locale, tokenizer));
String round2 = EditorUtils.doChangeCase(round1, CHANGE_CASE_TO.CYCLE, locale, tokenizer);
assertEquals("a i've got a {crazy} text here including 1 \u65e5\u672c\u8a9e!", round2);
assertEquals(round2, EditorUtils.doChangeCase(input, CHANGE_CASE_TO.LOWER, locale, tokenizer));
String round3 = EditorUtils.doChangeCase(round2, CHANGE_CASE_TO.CYCLE, locale, tokenizer);
assertEquals("A i've got a {crazy} text here including 1 \u65e5\u672c\u8a9e!", round3);
assertEquals(round3, EditorUtils.doChangeCase(input, CHANGE_CASE_TO.SENTENCE, locale, tokenizer));
String round4 = EditorUtils.doChangeCase(round3, CHANGE_CASE_TO.CYCLE, locale, tokenizer);
assertEquals("A I've Got A {Crazy} Text Here Including 1 \u65e5\u672c\u8a9e!", round4);
assertEquals(round4, EditorUtils.doChangeCase(input, CHANGE_CASE_TO.TITLE, locale, tokenizer));
String round5 = EditorUtils.doChangeCase(round4, CHANGE_CASE_TO.CYCLE, locale, tokenizer);
assertEquals(round1, round5);
input = "lower case only";
assertEquals(input, EditorUtils.doChangeCase(input, CHANGE_CASE_TO.LOWER, locale, tokenizer));
assertEquals("LOWER CASE ONLY", EditorUtils.doChangeCase(input, CHANGE_CASE_TO.UPPER, locale, tokenizer));
assertEquals("Lower case only", EditorUtils.doChangeCase(input, CHANGE_CASE_TO.SENTENCE, locale, tokenizer));
assertEquals("Lower Case Only", EditorUtils.doChangeCase(input, CHANGE_CASE_TO.TITLE, locale, tokenizer));
assertEquals("Lower case only", EditorUtils.doChangeCase(input, CHANGE_CASE_TO.CYCLE, locale, tokenizer));
input = "UPPER CASE ONLY";
assertEquals("upper case only", EditorUtils.doChangeCase(input, CHANGE_CASE_TO.LOWER, locale, tokenizer));
assertEquals(input, EditorUtils.doChangeCase(input, CHANGE_CASE_TO.UPPER, locale, tokenizer));
assertEquals("Upper case only", EditorUtils.doChangeCase(input, CHANGE_CASE_TO.SENTENCE, locale, tokenizer));
assertEquals("Upper Case Only", EditorUtils.doChangeCase(input, CHANGE_CASE_TO.TITLE, locale, tokenizer));
assertEquals("upper case only", EditorUtils.doChangeCase(input, CHANGE_CASE_TO.CYCLE, locale, tokenizer));
input = "Title Case Only";
assertEquals("title case only", EditorUtils.doChangeCase(input, CHANGE_CASE_TO.LOWER, locale, tokenizer));
assertEquals("TITLE CASE ONLY", EditorUtils.doChangeCase(input, CHANGE_CASE_TO.UPPER, locale, tokenizer));
assertEquals("Title case only", EditorUtils.doChangeCase(input, CHANGE_CASE_TO.SENTENCE, locale, tokenizer));
assertEquals(input, EditorUtils.doChangeCase(input, CHANGE_CASE_TO.TITLE, locale, tokenizer));
assertEquals("TITLE CASE ONLY", EditorUtils.doChangeCase(input, CHANGE_CASE_TO.CYCLE, locale, tokenizer));
input = "Sentence case string";
assertEquals("sentence case string", EditorUtils.doChangeCase(input, CHANGE_CASE_TO.LOWER, locale, tokenizer));
assertEquals("SENTENCE CASE STRING", EditorUtils.doChangeCase(input, CHANGE_CASE_TO.UPPER, locale, tokenizer));
assertEquals(input, EditorUtils.doChangeCase(input, CHANGE_CASE_TO.SENTENCE, locale, tokenizer));
assertEquals("Sentence Case String", EditorUtils.doChangeCase(input, CHANGE_CASE_TO.TITLE, locale, tokenizer));
assertEquals("Sentence Case String", EditorUtils.doChangeCase(input, CHANGE_CASE_TO.CYCLE, locale, tokenizer));
input = "mIxed CaSe oNly";
assertEquals("mixed case only", EditorUtils.doChangeCase(input, CHANGE_CASE_TO.LOWER, locale, tokenizer));
assertEquals("MIXED CASE ONLY", EditorUtils.doChangeCase(input, CHANGE_CASE_TO.UPPER, locale, tokenizer));
assertEquals("Mixed case only", EditorUtils.doChangeCase(input, CHANGE_CASE_TO.SENTENCE, locale, tokenizer));
assertEquals("Mixed Case Only", EditorUtils.doChangeCase(input, CHANGE_CASE_TO.TITLE, locale, tokenizer));
assertEquals("MIXED CASE ONLY", EditorUtils.doChangeCase(input, CHANGE_CASE_TO.CYCLE, locale, tokenizer));
// Ambiguous only
input = "A B C";
assertEquals("a b c", EditorUtils.doChangeCase(input, CHANGE_CASE_TO.LOWER, locale, tokenizer));
assertEquals(input, EditorUtils.doChangeCase(input, CHANGE_CASE_TO.UPPER, locale, tokenizer));
assertEquals("A b c", EditorUtils.doChangeCase(input, CHANGE_CASE_TO.SENTENCE, locale, tokenizer));
assertEquals(input, EditorUtils.doChangeCase(input, CHANGE_CASE_TO.TITLE, locale, tokenizer));
round2 = EditorUtils.doChangeCase(input, CHANGE_CASE_TO.CYCLE, locale, tokenizer);
assertEquals("a b c", round2);
round3 = EditorUtils.doChangeCase(round2, CHANGE_CASE_TO.CYCLE, locale, tokenizer);
assertEquals("A b c", round3);
round4 = EditorUtils.doChangeCase(round3, CHANGE_CASE_TO.CYCLE, locale, tokenizer);
assertEquals(input, round4);
// No letter-containing tokens
input = "{!} 1 \u65e5\u672c\u8a9e";
assertEquals(input, EditorUtils.doChangeCase(input, CHANGE_CASE_TO.LOWER, locale, tokenizer));
assertEquals(input, EditorUtils.doChangeCase(input, CHANGE_CASE_TO.UPPER, locale, tokenizer));
assertEquals(input, EditorUtils.doChangeCase(input, CHANGE_CASE_TO.SENTENCE, locale, tokenizer));
assertEquals(input, EditorUtils.doChangeCase(input, CHANGE_CASE_TO.TITLE, locale, tokenizer));
assertEquals(input, EditorUtils.doChangeCase(input, CHANGE_CASE_TO.CYCLE, locale, tokenizer));
// Single tokens
input = "lower";
assertEquals(input, EditorUtils.doChangeCase(input, CHANGE_CASE_TO.LOWER, locale, tokenizer));
assertEquals("LOWER", EditorUtils.doChangeCase(input, CHANGE_CASE_TO.UPPER, locale, tokenizer));
assertEquals("Lower", EditorUtils.doChangeCase(input, CHANGE_CASE_TO.SENTENCE, locale, tokenizer));
assertEquals("Lower", EditorUtils.doChangeCase(input, CHANGE_CASE_TO.TITLE, locale, tokenizer));
assertEquals("Lower", EditorUtils.doChangeCase(input, CHANGE_CASE_TO.CYCLE, locale, tokenizer));
input = "UPPER";
assertEquals("upper", EditorUtils.doChangeCase(input, CHANGE_CASE_TO.LOWER, locale, tokenizer));
assertEquals(input, EditorUtils.doChangeCase(input, CHANGE_CASE_TO.UPPER, locale, tokenizer));
assertEquals("Upper", EditorUtils.doChangeCase(input, CHANGE_CASE_TO.SENTENCE, locale, tokenizer));
assertEquals("Upper", EditorUtils.doChangeCase(input, CHANGE_CASE_TO.TITLE, locale, tokenizer));
assertEquals("upper", EditorUtils.doChangeCase(input, CHANGE_CASE_TO.CYCLE, locale, tokenizer));
input = "Title";
assertEquals("title", EditorUtils.doChangeCase(input, CHANGE_CASE_TO.LOWER, locale, tokenizer));
assertEquals("TITLE", EditorUtils.doChangeCase(input, CHANGE_CASE_TO.UPPER, locale, tokenizer));
assertEquals(input, EditorUtils.doChangeCase(input, CHANGE_CASE_TO.SENTENCE, locale, tokenizer));
assertEquals(input, EditorUtils.doChangeCase(input, CHANGE_CASE_TO.TITLE, locale, tokenizer));
assertEquals("TITLE", EditorUtils.doChangeCase(input, CHANGE_CASE_TO.CYCLE, locale, tokenizer));
input = "mIxed";
assertEquals("mixed", EditorUtils.doChangeCase(input, CHANGE_CASE_TO.LOWER, locale, tokenizer));
assertEquals("MIXED", EditorUtils.doChangeCase(input, CHANGE_CASE_TO.UPPER, locale, tokenizer));
assertEquals("Mixed", EditorUtils.doChangeCase(input, CHANGE_CASE_TO.SENTENCE, locale, tokenizer));
assertEquals("Mixed", EditorUtils.doChangeCase(input, CHANGE_CASE_TO.TITLE, locale, tokenizer));
assertEquals("MIXED", EditorUtils.doChangeCase(input, CHANGE_CASE_TO.CYCLE, locale, tokenizer));
// Ambiguous
input = "A";
assertEquals("a", EditorUtils.doChangeCase(input, CHANGE_CASE_TO.LOWER, locale, tokenizer));
assertEquals(input, EditorUtils.doChangeCase(input, CHANGE_CASE_TO.UPPER, locale, tokenizer));
assertEquals(input, EditorUtils.doChangeCase(input, CHANGE_CASE_TO.SENTENCE, locale, tokenizer));
assertEquals(input, EditorUtils.doChangeCase(input, CHANGE_CASE_TO.TITLE, locale, tokenizer));
assertEquals("a", EditorUtils.doChangeCase(input, CHANGE_CASE_TO.CYCLE, locale, tokenizer));
}
public void testReplaceGlossaryEntries() {
List<GlossaryEntry> entries = new ArrayList<GlossaryEntry>();
entries.add(new GlossaryEntry("snowman", "sneeuwpop", "", false));
entries.add(new GlossaryEntry("Bob", "Blub", "", false));
String srcText = "Snowman Bob went to the snowman party. SnOwMaN!";
String expected = "Sneeuwpop Blub went to the sneeuwpop party. sneeuwpop!";
Locale locale = Locale.ENGLISH;
ITokenizer tokenizer = new LuceneEnglishTokenizer();
assertEquals(expected, EditorUtils.replaceGlossaryEntries(srcText, entries,
locale, tokenizer));
// Empty cases
assertNull(EditorUtils.replaceGlossaryEntries(null, entries, locale, tokenizer));
assertEquals("", EditorUtils.replaceGlossaryEntries("", entries, locale, tokenizer));
assertSame(srcText, EditorUtils.replaceGlossaryEntries(srcText, null, locale, tokenizer));
assertSame(srcText, EditorUtils.replaceGlossaryEntries(srcText, new ArrayList<GlossaryEntry>(), locale, tokenizer));
try {
EditorUtils.replaceGlossaryEntries(srcText, entries, null, tokenizer);
fail("Should give NPE when given null locale");
} catch (NullPointerException ex) {
}
try {
EditorUtils.replaceGlossaryEntries(srcText, entries, locale, null);
fail("Should give NPE when given null tokenizer");
} catch (NullPointerException ex) {
}
}
}
| [
"baenej@gmail.com"
] | baenej@gmail.com |
b5133661f578e854089fe9a3b0a4838dd0fd007c | 992972bc1f6af4bc87bb519765a135e74d4de901 | /test/ru/job4j/array/MinDiapasonTest.java | e9a6a07b45051e6fc95eb900fdf642aa6d8b1a2c | [] | no_license | GgPonomareva/job4j_elementary | 4f6334a606ec1969804438bc82ed84eb9cfc9417 | d03b47bd1207d4faa516155cb4a16d4ffb02bbc7 | refs/heads/master | 2023-06-15T18:20:02.027624 | 2021-07-14T09:08:15 | 2021-07-14T09:08:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 950 | java | package ru.job4j.array;
import org.junit.Assert;
import org.junit.Test;
public class MinDiapasonTest {
@Test
public void whenFirstMin() {
int[] array = new int[] {-1, 0, 5, 10};
int start = 1;
int finish = 3;
int result = MinDiapason.findMin(array, start, finish);
int expected = 0;
Assert.assertEquals(expected, result);
}
@Test
public void whenLastMin() {
int[] array = new int[] {10, 5, 3, 1};
int start = 1;
int finish = 3;
int result = MinDiapason.findMin(array, start, finish);
int expected = 1;
Assert.assertEquals(expected, result);
}
@Test
public void whenMiddleMin() {
int[] array = new int[] {10, 2, 5, 1};
int start = 0;
int finish = 2;
int result = MinDiapason.findMin(array, start, finish);
int expected = 2;
Assert.assertEquals(expected, result);
}
}
| [
"li.c@mail.ru"
] | li.c@mail.ru |
5edf7feeb442b65c95322c9150f09e608fd52ac5 | f91c55669d5eb5525e2a4e225657a4118e0cbf77 | /CarPartsStore/src/main/java/za/ac/cput/group3b/domain/Customer/Payment/CustomerPaymentMethod.java | d80eeb1bd1f1095140bceb221a6028499437e3b9 | [] | no_license | CalebYPI/CarPartsStore-master | 3e95a86ed378e3028df8ecbaaab717d87935af57 | e377cd54bdd81f2f53758006399c245e23cd2b88 | refs/heads/master | 2021-06-17T05:42:23.059916 | 2019-05-22T07:50:15 | 2019-05-22T07:50:15 | 187,091,898 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 92 | java | package za.ac.cput.group3b.domain.Customer.Payment;
public class CustomerPaymentMethod {
}
| [
"caleb.ypi@gmail.com"
] | caleb.ypi@gmail.com |
f5cc60dfddc60c57047c128bc226c7bb8303d0f8 | 02577e8867281162602c2dfcc1ef702e7617fefe | /src/main/java/com/example/demo/StockController.java | 827dd39eafad9438b590cc0deb282c5b44eac6af | [] | no_license | ambriel2016/StockTracker | 9c47fb4659541dcb2e3678e69053b09d95791a58 | 61b6862b5425cc3e2870dfda95f42da17b1a2a17 | refs/heads/master | 2021-02-09T03:43:20.039055 | 2019-08-20T22:47:41 | 2019-08-20T22:47:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,911 | java | package com.example.demo;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import javax.validation.Valid;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.Errors;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import com.example.demo.StockTransaction.State;
@RestController
public class StockController {
private final StockTransactionRepository stockTransactionRepository;
private final RealizedStockRepository realizedStockRepository;
private final SymbolRepository symbolRepository;
private final StockService stockService;
public StockController(StockTransactionRepository stockTransactionRepository,
RealizedStockRepository realizedStockRepository, SymbolRepository symbolRepository,
StockService stockService) {
this.stockTransactionRepository = stockTransactionRepository;
this.realizedStockRepository = realizedStockRepository;
this.symbolRepository = symbolRepository;
this.stockService = stockService;
}
@GetMapping("/current")
public List<StockTotalObject> currentStockInfo() {
List<StockTransaction> stockList = stockTransactionRepository.findAllByOrderBySymbolAsc();
List<StockTotalObject> stockTotalObjectList = stockService.getStockInfo(stockList);
return stockTotalObjectList;
}
@GetMapping("/profits")
public String profits() {
List<StockTransaction> stockList = stockTransactionRepository.findAllByOrderBySymbolAsc();
List<StockTotalObject> stockTotalObjectList = stockService.getStockInfo(stockList);
String profit = stockService.getTotalProfit(stockTotalObjectList);
return profit;
}
@GetMapping("/realized")
public List<StockRealized> realizedProfits() {
List<StockRealized> realizedList = realizedStockRepository.findAll();
return realizedList;
}
@GetMapping("/transactions")
public List<StockTransaction> transactions() {
List<StockTransaction> transactions = stockTransactionRepository.findAllByOrderBySymbolAsc();
return transactions;
}
@PostMapping("/post")
public ResponseEntity<?> post(@Valid @RequestBody StockTransaction st, Errors errors){
if (errors.hasErrors() || stockService.getCurrentPrice(st.getSymbol()).compareTo(BigDecimal.ZERO) == 0
|| st.getNumOfShares() == 0) {
return ResponseEntity.badRequest().body("Bad Request");
}
st.setSymbol(st.getSymbol().toUpperCase());
if (st.getState().name().equals("PURCHASE"))
st.setSharesInLot(st.getNumOfShares());
if (st.getState().name().equals("SALE")){
stockService.calcRealizedProfit(st);
}
return ResponseEntity.ok(stockTransactionRepository.save(st));
}
@GetMapping("/sample")
public ResponseEntity<?> sample(){
String[] array = {"AAPL", "TWTR", "NFLX", "MSFT", "GOOG", "TSLA", "AMD", "NVDA", "FB", "UBER", "GE", "AMZN"};
String random = array[(int) (Math.random() * array.length)];
StockTransaction st = new StockTransaction();
st.setSymbol(random);
st.setNumOfShares(100);
st.setSharesInLot(st.getNumOfShares());
st.setState(State.PURCHASE);
st.setPriceOfShares(stockService.getCurrentPrice(random));
return ResponseEntity.ok(stockTransactionRepository.save(st));
}
@GetMapping("/samplesale")
public ResponseEntity<StockTransaction> sampleSale(){
String[] array = {"AAPL", "MSFT", "FB", "GOOG"};
String random = array[(int) (Math.random() * array.length)];
StockTransaction st = new StockTransaction();
st.setSymbol(random);
st.setNumOfShares(100);
st.setPriceOfShares(stockService.getCurrentPrice(random));
st.setState(State.SALE);
stockService.calcRealizedProfit(st);
return ResponseEntity.ok(stockTransactionRepository.save(st));
}
}
| [
"rsmithmachines@gmail.com"
] | rsmithmachines@gmail.com |
bb7bd2cdddb6809f8e572cd32df17da5c4ddf1d2 | e70abc02efbb8a7637eb3655f287b0a409cfa23b | /hyjf-mybatis/src/main/java/com/hyjf/mybatis/mapper/customize/AleveCustomizeMapper.java | 9c50d917da8dbd8c055924f8c4b30d32499b8799 | [] | no_license | WangYouzheng1994/hyjf | ecb221560460e30439f6915574251266c1a49042 | 6cbc76c109675bb1f120737f29a786fea69852fc | refs/heads/master | 2023-05-12T03:29:02.563411 | 2020-05-19T13:49:56 | 2020-05-19T13:49:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 450 | java | package com.hyjf.mybatis.mapper.customize;
import com.hyjf.mybatis.model.customize.AleveLogCustomize;
import java.util.List;
/**
* Created by cuigq on 2018/1/22.
*/
public interface AleveCustomizeMapper {
Integer queryAleveLogCount(AleveLogCustomize aleveLogCustomize);
List<AleveLogCustomize> queryAleveLogList(AleveLogCustomize aleveLogCustomize);
List<AleveLogCustomize> queryAleveLogListByTranstype(List<String> tranStype);
}
| [
"heshuying@hyjf.com"
] | heshuying@hyjf.com |
c1288f2dbc1d79f04de679494449edc50f50ab64 | 081abe5c7cf70f11bbeb9777d23f99b978d25af4 | /src/com/example/bluetoothutil/BluetoothServerService.java | 5a1a93e5f84a0a0294f8479ac288f414893cfad0 | [
"Apache-2.0"
] | permissive | dzhiqin/BlueToothTest | 5e17a876216f944c2e27415396de1394a103dedb | e1c462b314c6ea0f695424f9825c8504f0ec4eaf | refs/heads/master | 2016-09-12T18:10:03.351078 | 2016-05-02T23:47:57 | 2016-05-02T23:47:57 | 57,201,474 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 3,976 | java | package com.example.bluetoothutil;
import java.io.Serializable;
import android.app.Service;
import android.bluetooth.BluetoothAdapter;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.bluetooth.BluetoothSocket;
public class BluetoothServerService extends Service {
//蓝牙适配器
private final BluetoothAdapter bluetoothAdapter=BluetoothAdapter.getDefaultAdapter();
private BluetoothCommunThread communThread;
//控制信息广播接收器
private BroadcastReceiver controlReceiver=new BroadcastReceiver(){
public void onReceive(Context context,Intent intent){
LogUtil.v("DEBUG", "BluetoothServerService_bluetoothAdapter_onReceive");
String action =intent.getAction();
if(BluetoothTools.ACTION_STOP_SERVICE.equals(action)){
//停止后台服务
if(communThread!=null){
communThread.isRun=false;
}
stopSelf();
}else if(BluetoothTools.ACTION_DATA_TO_SERVICE.equals(action)){
//发送数据
Object data=intent.getSerializableExtra(BluetoothTools.DATA);
if(communThread!=null){
communThread.writeObject(data);
}
}
}
};
//接收其他线程消息的handler
private Handler serviceHandler =new Handler(){
@Override
public void handleMessage(Message msg){
LogUtil.v("DEBUG", "BluetoothServerService_serviceHandller_handleMessage");
switch(msg.what){
case BluetoothTools.MESSAGE_CONNECT_SUCCESS:
LogUtil.v("DEBUG", "BluetoothServerService_serviceHandller_handleMessage_connectSuccess");
//连接成功,开启通讯线程
communThread=new BluetoothCommunThread(serviceHandler,(BluetoothSocket)msg.obj);
communThread.start();
//发送连接成功信息
Intent connSuccIntent=new Intent(BluetoothTools.ACTION_CONNECT_SUCCESS);
sendBroadcast(connSuccIntent);
break;
case BluetoothTools.MESSAGE_CONNECT_ERROR:
LogUtil.v("DEBUG", "BluetoothServerService_serviceHandller_handleMessage_connectError");
//连接错误,发送连接错误广播
Intent errIntent=new Intent(BluetoothTools.ACTION_CONNECT_ERROR);
sendBroadcast(errIntent);
break;
case BluetoothTools.MESSAGE_READ_OBJECT:
LogUtil.v("DEBUG", "BluetoothServerService_serviceHandller_handleMessage_readObject");
//读取到数据,发送数据广播
Intent dataIntent=new Intent(BluetoothTools.ACTION_DATA_TO_GAME);
dataIntent.putExtra(BluetoothTools.DATA,(Serializable)msg.obj);
sendBroadcast(dataIntent);
break;
default:
break;
}
super.handleMessage(msg);
}
};
@Override
public IBinder onBind(Intent arg0) {
// TODO 自动生成的方法存根
return null;
}
/*
* 获取通讯线程
*/
public BluetoothCommunThread getBluetoothCommunThread(){
return communThread;
}
public void onCreate(){
LogUtil.v("DEBUG", "BluetoothServerService_onCreate");
IntentFilter controlFilter=new IntentFilter();
controlFilter.addAction(BluetoothTools.ACTION_START_SERVER);
controlFilter.addAction(BluetoothTools.ACTION_STOP_SERVICE);
controlFilter.addAction(BluetoothTools.ACTION_DATA_TO_SERVICE);
//注册BroadcastReciver
registerReceiver(controlReceiver,controlFilter);
bluetoothAdapter.enable(); //打开蓝牙
//开启蓝牙发现功能30秒
Intent discoveryIntent=new Intent(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE);
discoveryIntent.putExtra(BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION,300);
discoveryIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(discoveryIntent);
//开启后台连接线程
new BluetoothServerConnThread(serviceHandler).start();
super.onCreate();
}
public void onDestroy(){
LogUtil.v("DEBUG", "BluetoothServerService_onDestroy");
if(communThread!=null){
communThread.isRun=false;
}
unregisterReceiver(controlReceiver);
super.onDestroy();
}
}
| [
"dzhiqin@126.com"
] | dzhiqin@126.com |
52071847b96fd458212c8927a3c9a82a96ca38e0 | 3f7a2e12a8991bb08064a7f9ce1346d286ff74ac | /src/java/crud/factory/DAOAbstractFactory.java | 0feb3ca095f94b4676a39105eb8cb6d2dc7184ae | [] | no_license | lunegreiros/Trabalho | d51c9a036e50c11574cb60ad3656872e9dba1184 | 09cfbb289a70ed4af64a7b8f79c4c7b400104a0f | refs/heads/master | 2020-09-07T06:52:57.148059 | 2020-01-09T15:20:22 | 2020-01-09T15:20:22 | 220,692,630 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 781 | 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 crud.factory;
import crud.dao.ExpressaoDAO;
import crud.dao.PalavraDAO;
/**
*
* @author aluno
*/
public abstract class DAOAbstractFactory {
public static final int JDBC = 1;
public static final int HIBERNATE = 2;
public abstract PalavraDAO createPalavraDAO();
public abstract ExpressaoDAO createExpressaoDAO();
public static DAOAbstractFactory createFactory(int tipo) {
switch(tipo) {
//case JDBC: return new JDBCDAOFactory();
case HIBERNATE: return new HibernateDAOFactory();
}
return null;
}
}
| [
"lunegreiros@gmail.com"
] | lunegreiros@gmail.com |
8c2d695801b4faad0a92719f76e94b7797d03dcc | 7a2c66bf546b5a637f4704502487e7bab6d81cc9 | /src/main/java/net/haesleinhuepf/clij2/plugins/WriteValuesToPositions.java | 2679654b900b6ee6b7618d584acebc034b4ab513 | [
"BSD-3-Clause"
] | permissive | maarzt/clij2 | 470a13565e4f996dfaf72c3eebce4544d76c1c8c | c65124ab157b04726c731bfdbf6c3aae15a4f072 | refs/heads/master | 2021-04-20T13:10:58.980067 | 2020-03-22T20:59:31 | 2020-03-22T20:59:31 | 249,686,118 | 0 | 0 | NOASSERTION | 2020-03-24T11:07:48 | 2020-03-24T11:07:47 | null | UTF-8 | Java | false | false | 1,982 | java | package net.haesleinhuepf.clij2.plugins;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
import net.haesleinhuepf.clij.macro.CLIJMacroPlugin;
import net.haesleinhuepf.clij.macro.CLIJOpenCLProcessor;
import net.haesleinhuepf.clij.macro.documentation.OffersDocumentation;
import net.haesleinhuepf.clij2.AbstractCLIJ2Plugin;
import net.haesleinhuepf.clij2.CLIJ2;
import org.scijava.plugin.Plugin;
import java.util.HashMap;
/**
* Author: @haesleinhuepf
* June 2019
*/
@Plugin(type = CLIJMacroPlugin.class, name = "CLIJ2_writeValuesToPositions")
public class WriteValuesToPositions extends AbstractCLIJ2Plugin implements CLIJMacroPlugin, CLIJOpenCLProcessor, OffersDocumentation {
@Override
public boolean executeCL() {
ClearCLBuffer positionsAndValues = (ClearCLBuffer)( args[0]);
ClearCLBuffer buffer = (ClearCLBuffer)( args[1]);
return writeValuesToPositions(getCLIJ2(), positionsAndValues, buffer);
}
public static boolean writeValuesToPositions(CLIJ2 clij2, ClearCLBuffer positionsAndValues, ClearCLBuffer dst) {
HashMap<String, Object> parameters = new HashMap<>();
parameters.put("src", positionsAndValues);
parameters.put("dst", dst);
long[] size = new long[] { positionsAndValues.getWidth(), 1, 1};
clij2.execute(WriteValuesToPositions.class, "write_values_to_positions_3d_x.cl", "write_values_to_positions_" + dst.getDimension() + "d", size, size, parameters);
return true;
}
@Override
public String getParameterHelpText() {
return "Image positionsAndValues, Image destination";
}
@Override
public String getDescription() {
return "Takes an image with three/four rows (2D: height = 3; 3D: height = 4): x, y [, z] and v and target image. " +
"The value v will be written at position x/y[/z] in the target image.";
}
@Override
public String getAvailableForDimensions() {
return "2D, 3D";
}
}
| [
"rhaase@mpi-cbg.de"
] | rhaase@mpi-cbg.de |
d9eac13c432bff2cefc4f5f71378f72f64666419 | 6d577a4cdd6681a33dd7a2a5d03099225c28fdfd | /src/main/java/com/ibaixiong/merchant/service/impl/SsssGetcashServiceImpl.java | aa614a719c313e548240bdcd9f3a935f7480c8d4 | [] | no_license | hansq-rokey/h7 | 19286e5d4d4349203d68b21c5bcea8e68c618594 | cb9aed341b1e85c96ae0ab65c6a6b9b1ffcf0683 | refs/heads/master | 2021-01-18T03:37:30.461519 | 2017-03-22T08:55:33 | 2017-03-22T08:55:33 | 85,805,001 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,474 | java | package com.ibaixiong.merchant.service.impl;
import java.util.Date;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.github.pagehelper.PageHelper;
import com.ibaixiong.constant.Constant;
import com.ibaixiong.constant.PageConstant;
import com.ibaixiong.core.utils.CodeUtil;
import com.ibaixiong.entity.SsssCityMerchant;
import com.ibaixiong.entity.SsssGetcash;
import com.ibaixiong.entity.User;
import com.ibaixiong.merchant.dao.SsssCityMerchantDao;
import com.ibaixiong.merchant.dao.SsssGetcashDao;
import com.ibaixiong.merchant.service.SsssGetcashService;
@Service
public class SsssGetcashServiceImpl implements SsssGetcashService {
@Resource
SsssGetcashDao ssssGetcashDao;
@Resource
SsssCityMerchantDao ssssCityMerchantDao;
@Transactional
@Override
public void insert(Float money, User user) {
//插入金额变更记录
//SsssInfo ssssInfo = ssssInfoDao.getByUserId(user.getId());
SsssCityMerchant merchant = ssssCityMerchantDao.getByUserId(user.getId());
String payNumber = CodeUtil.getPayNumber(user.getId());
/*PayHistory history = new PayHistory();
history.setStatus(Constant.Status.WAIT.getStatus());
history.setPayNumber(payNumber);
history.setCreateDateTime(new Date());
history.setUserId(user.getId());
history.setMoney(-money);
history.setMerchantId(merchant.getId());
history.setType(Constant.PayHistoryStatus.GETCASH.getStatus());
history.setRemainMoney(merchant.getMoney().floatValue()+history.getMoney().floatValue());
payHistoryDao.insertSelective(history);*/
//插入提现表
SsssGetcash cash = new SsssGetcash();
cash.setCityMerchantId(merchant.getId());
cash.setCreateDateTime(new Date());
cash.setBankName(merchant.getBankName());
cash.setBankNumber(merchant.getBankNumber());
cash.setBankAddress(merchant.getBankAddress());
cash.setUserId(user.getId());
cash.setMoney(money);
cash.setStatus(Constant.Status.WAIT.getStatus());
cash.setInvalid(false);
cash.setPayNumber(payNumber);
ssssGetcashDao.insertSelective(cash);
/*merchant.setMoney(history.getRemainMoney());
ssssCityMerchantDao.updateByPrimaryKeySelective(merchant);*/
}
@Override
public List<SsssGetcash> getList(Map<String, Object> map) {
PageHelper.startPage((Integer) map.get("pageNo"), PageConstant.bbspageSize, true);
return ssssGetcashDao.getList(map);
}
}
| [
"hanshuaiqi@ibaixiong.com"
] | hanshuaiqi@ibaixiong.com |
5f28db3e9fc38aef697a7e43ede66f1874a00928 | 69306c9aa8be7cac726d477a1f8111e614034898 | /app/src/main/java/com/bank/reference/ui/AlternatingColorListAdapter.java | d811dbd5c4b267fe596ba0b3013ed90ae5ddc511 | [
"Apache-2.0"
] | permissive | kkroo/bankapp | 706b862b1b9f965763332b577c256674ff3a7f07 | 1e56c807d3dc899d3dd04d49258d4e79699c04d2 | refs/heads/master | 2021-01-19T11:37:16.636589 | 2014-08-18T16:52:08 | 2014-08-18T16:52:08 | 22,546,895 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,793 | java |
package com.bank.reference.ui;
import android.view.LayoutInflater;
import com.bank.R;
import com.bank.R.drawable;
import com.github.kevinsawicki.wishlist.SingleTypeAdapter;
import java.util.List;
/**
* List adapter that colors rows in alternating colors
*
* @param <V>
*/
public abstract class AlternatingColorListAdapter<V> extends
SingleTypeAdapter<V> {
private final int primaryResource;
private final int secondaryResource;
/**
* Create adapter with alternating row colors
*
* @param layoutId
* @param inflater
* @param items
*/
public AlternatingColorListAdapter(final int layoutId, final LayoutInflater inflater,
final List<V> items) {
this(layoutId, inflater, items, true);
}
/**
* Create adapter with alternating row colors
*
* @param layoutId
* @param inflater
* @param items
* @param selectable
*/
public AlternatingColorListAdapter(final int layoutId, final LayoutInflater inflater,
final List<V> items, final boolean selectable) {
super(inflater, layoutId);
if (selectable) {
primaryResource = drawable.table_background_selector;
secondaryResource = drawable.table_background_alternate_selector;
} else {
primaryResource = R.color.pager_background;
secondaryResource = R.color.pager_background_alternate;
}
setItems(items);
}
@Override
protected void update(final int position, final V item) {
if (position % 2 != 0)
updater.view.setBackgroundResource(primaryResource);
else
updater.view.setBackgroundResource(secondaryResource);
}
}
| [
"omar@fusi.io"
] | omar@fusi.io |
9429a0b36a8c43eeaf49a3e90e9ce5469f339412 | 7eec511b04f2e53daed3b6696d1ea32b23a6b85c | /projects/ale3otik/src/main/java/ru/mipt/diht/students/ale3otik/threads/ThreadsCounter.java | 56aaad08211bdb8356ee7884ab872687845ad9d6 | [] | no_license | ale3otik/fizteh-java-2015 | b9dc7f36e1e34ea187ac53f74f459dea45fd34b4 | be0fd43e7e9cfde988317266230c30d7d9fa576c | refs/heads/master | 2021-01-18T07:18:35.793448 | 2015-12-19T14:38:29 | 2015-12-19T14:38:29 | 42,772,809 | 0 | 0 | null | 2015-10-28T23:12:47 | 2015-09-19T12:56:21 | Java | UTF-8 | Java | false | false | 1,861 | java | package ru.mipt.diht.students.ale3otik.threads;
/**
* Created by alex on 05.12.15.
*/
public class ThreadsCounter {
private static class Counter {
private static final long SLEEP_TIME = 1000;
private static Object synchronizer = new Object();
private static volatile int currentNum;
private static volatile int numOfThreads;
private class InnerThreadCounter extends Thread {
private int myNumber;
InnerThreadCounter(int num) {
this.myNumber = num;
}
@Override
public void run() {
try {
while (true) {
synchronized (synchronizer) {
while (currentNum != this.myNumber) {
synchronizer.wait();
}
System.out.println("Thread-" + (this.myNumber + 1));
++currentNum;
currentNum %= numOfThreads;
if (this.myNumber == numOfThreads - 1) {
Thread.sleep(SLEEP_TIME);
}
synchronizer.notifyAll();
}
}
} catch (InterruptedException e) {
return;
}
}
}
public void count(String[] args) {
numOfThreads = new Integer(args[0]);
currentNum = 0;
for (int i = 0; i < numOfThreads; ++i) {
InnerThreadCounter counter = new InnerThreadCounter(i);
counter.start();
}
}
}
public static void main(String[] args) {
Counter counter = new Counter();
counter.count(args);
}
}
| [
"aleksey.zotov@phystech.edu"
] | aleksey.zotov@phystech.edu |
d03ea99f54fbe6cd490ab2ea1f97029d0eecef37 | 32d373bdd62a23a8d1db79accde683d835bf1aa8 | /JAVA程序/Game05.java | f42e1aa3329460789eec521ea0fa24f7a1442dc9 | [] | no_license | sqsgalaxys/workspace | 77f585574111369e1ea892838e7b4737e9e943f8 | 0777c68f530aaabffa9a5a294b14c449774b6ac3 | refs/heads/master | 2021-01-01T17:27:06.512834 | 2016-09-20T12:19:55 | 2016-09-20T12:19:55 | null | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 803 | java | // 游戏档案库
import javax.swing.*;
public class Game05
{
public static void main(String[] args)
{
boolean cont = false;
do {
cont = false;
// 定义字符串数组存储游戏名称
String names[] = {
"Define : \"Games\"",
"The Dungeon Defender",
"Regional Math - a - thon",
"National Math - a - tgon"
};
// 获取用户输入的名称在数组中的索引
int element = Integer.parseInt(JOptionPane.showInputDialog("Which element?"));
String output = "The name of the game is:\n";
output += names[element];
// 输出选择的游戏
JOptionPane.showMessageDialog(null,output);
// 是否继续
String repeat = JOptionPane.showInputDialog("Again?");
if (repeat.equals("yes")) {
cont = true;
}
}
while (cont);
}
}
| [
"samlv@tencent.com"
] | samlv@tencent.com |
2b8a1fcba14828a1c5764758dea360dc8b25dc05 | 75c1250dde2ff6b8b1c68054c3e9485574b591a2 | /src/main/java/net/juancarlosfernandez/jhipster/web/rest/errors/FieldErrorVM.java | 13846af35f4a494ae68dc2e2a100acbda1bc8bee | [] | no_license | jferna57-org/21-points-jhipster | 64c21da645bc7d56a4afd4c5209d303cb437d120 | 48fdd8c2159a1267e4366cd9228e589fee20c7f1 | refs/heads/master | 2020-06-11T06:12:53.713037 | 2016-12-06T16:42:11 | 2016-12-06T16:42:11 | 75,750,007 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 664 | java | package net.juancarlosfernandez.jhipster.web.rest.errors;
import java.io.Serializable;
public class FieldErrorVM implements Serializable {
private static final long serialVersionUID = 1L;
private final String objectName;
private final String field;
private final String message;
public FieldErrorVM(String dto, String field, String message) {
this.objectName = dto;
this.field = field;
this.message = message;
}
public String getObjectName() {
return objectName;
}
public String getField() {
return field;
}
public String getMessage() {
return message;
}
}
| [
"jferna57@gmail.com"
] | jferna57@gmail.com |
c7b1b5e9a46e411d19e376b15cd321c4c1fb8ed3 | 3007f2b8a6ca89cf64a9fa0068e28eeb525ff3f9 | /api/src/main/java/com/debug/kill/kill/api/response/BaseResponse.java | 57a00ca369acc536ca0b9df175792afca199682e | [] | no_license | lvchengming1017/kill | 70ca9a0ca26d9cb780e7d96486de01063dc40d96 | 2ea0d39065ea3163290e2623caa7280ae497ec7f | refs/heads/master | 2022-11-07T13:53:10.262799 | 2020-02-18T08:35:04 | 2020-02-18T08:35:04 | 241,318,215 | 0 | 0 | null | 2022-10-12T20:36:58 | 2020-02-18T09:13:51 | Java | UTF-8 | Java | false | false | 963 | java | package com.debug.kill.kill.api.response;
import com.debug.kill.kill.api.enums.StatusCode;
public class BaseResponse<T> {
private Integer code;
private String msg;
private T data;
public BaseResponse(Integer code, String msg) {
this.code = code;
this.msg = msg;
}
public BaseResponse(StatusCode statusCode) {
this.code = statusCode.getCode();
this.msg = statusCode.getMsg();
}
public BaseResponse(Integer code, String msg, T data) {
this.code = code;
this.msg = msg;
this.data = data;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public T getData() {
return data;
}
public void setData(T data) {
this.data = data;
}
}
| [
"824099646@qq.com"
] | 824099646@qq.com |
17213fd952f8e0f3205b3eb64338a05f3afe2f8b | 43060956a19d67503af823cdf8998af33768b5dc | /.metadata/.plugins/org.eclipse.wst.server.core/tmp0/work/Catalina/localhost/Test1/org/apache/jsp/page/index_jsp.java | 20d7a1d8c86a325a704ed90d5887f61be02a3899 | [] | no_license | SarinRupp/SpringProject | 14be4eb70e70fb6f1b0d10c54bd29268cb664808 | 999174402119cb4bd9aca8b1751ec8ea92ef5701 | refs/heads/master | 2021-01-10T15:34:14.677747 | 2015-11-03T06:58:32 | 2015-11-03T06:58:32 | 45,436,783 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,652 | java | /*
* Generated by the Jasper component of Apache Tomcat
* Version: Apache Tomcat/8.0.23
* Generated at: 2015-11-03 06:57:43 UTC
* Note: The last modified time of this file was set to
* the last modified time of the source file after
* generation to assist with modification tracking.
*/
package org.apache.jsp.page;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
public final class index_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent,
org.apache.jasper.runtime.JspSourceImports {
private static final javax.servlet.jsp.JspFactory _jspxFactory =
javax.servlet.jsp.JspFactory.getDefaultFactory();
private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants;
static {
_jspx_dependants = new java.util.HashMap<java.lang.String,java.lang.Long>(2);
_jspx_dependants.put("jar:file:/C:/Users/A%20RIN/Documents/GitHub/SpringProject/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Test1/WEB-INF/lib/jstl-1.2.jar!/META-INF/c.tld", Long.valueOf(1153359882000L));
_jspx_dependants.put("/WEB-INF/lib/jstl-1.2.jar", Long.valueOf(1446167757551L));
}
private static final java.util.Set<java.lang.String> _jspx_imports_packages;
private static final java.util.Set<java.lang.String> _jspx_imports_classes;
static {
_jspx_imports_packages = new java.util.HashSet<>();
_jspx_imports_packages.add("javax.servlet");
_jspx_imports_packages.add("javax.servlet.http");
_jspx_imports_packages.add("javax.servlet.jsp");
_jspx_imports_classes = null;
}
private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fc_005fforEach_0026_005fvar_005fitems;
private javax.el.ExpressionFactory _el_expressionfactory;
private org.apache.tomcat.InstanceManager _jsp_instancemanager;
public java.util.Map<java.lang.String,java.lang.Long> getDependants() {
return _jspx_dependants;
}
public java.util.Set<java.lang.String> getPackageImports() {
return _jspx_imports_packages;
}
public java.util.Set<java.lang.String> getClassImports() {
return _jspx_imports_classes;
}
public void _jspInit() {
_005fjspx_005ftagPool_005fc_005fforEach_0026_005fvar_005fitems = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
_jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig());
}
public void _jspDestroy() {
_005fjspx_005ftagPool_005fc_005fforEach_0026_005fvar_005fitems.release();
}
public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response)
throws java.io.IOException, javax.servlet.ServletException {
final java.lang.String _jspx_method = request.getMethod();
if (!"GET".equals(_jspx_method) && !"POST".equals(_jspx_method) && !"HEAD".equals(_jspx_method) && !javax.servlet.DispatcherType.ERROR.equals(request.getDispatcherType())) {
response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, "JSPs only permit GET POST or HEAD");
return;
}
final javax.servlet.jsp.PageContext pageContext;
javax.servlet.http.HttpSession session = null;
final javax.servlet.ServletContext application;
final javax.servlet.ServletConfig config;
javax.servlet.jsp.JspWriter out = null;
final java.lang.Object page = this;
javax.servlet.jsp.JspWriter _jspx_out = null;
javax.servlet.jsp.PageContext _jspx_page_context = null;
try {
response.setContentType("text/html; charset=ISO-8859-1");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write("\r\n");
out.write(" \r\n");
out.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\r\n");
out.write("<html>\r\n");
out.write("<head>\r\n");
out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">\r\n");
out.write("<title>Student Information</title>\r\n");
out.write("\r\n");
out.write("<script src=\"");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${pageContext.request.contextPath}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null));
out.write("/resources/js/jquery-1.9.1.min.js\"></script>\r\n");
out.write("<script src=\"");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${pageContext.request.contextPath}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null));
out.write("/resources/js/angular.min.js\"></script>\r\n");
out.write("\r\n");
out.write("<link href=\"");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${pageContext.request.contextPath}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null));
out.write("/resources/css/bootstrap.css\" rel=\"stylesheet\">\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("<!-- internal style -->\r\n");
out.write("<style>\r\n");
out.write(" th{text-align: center;}\r\n");
out.write(" @media screen and (max-width: 600px) {\r\n");
out.write(" #tablerepone {\r\n");
out.write(" overflow: scroll;\r\n");
out.write(" }\r\n");
out.write("}\r\n");
out.write("#status,#option{\r\n");
out.write("\ttext-align: center;\r\n");
out.write("}\r\n");
out.write("#status img{\r\n");
out.write("\twidth:35px;\r\n");
out.write("\tcursor:pointer;\t\r\n");
out.write("}\r\n");
out.write("</style>\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("</head>\r\n");
out.write("<body>\r\n");
out.write("\t<div class=\"\">\r\n");
out.write("\t<center><h1>STUDENT REGISTER</h1></center>\r\n");
out.write("\t\r\n");
out.write("\t\t<!-- Form for add new information -->\r\n");
out.write("\t\t\r\n");
out.write("\t \r\n");
out.write("\t <!-- End of Form for add new information -->\r\n");
out.write("\t \r\n");
out.write("\t\t<div class=\"col-sm-12\">\r\n");
out.write("\t\t<div ng-app=\"myApp\" ng-controller=\"planetController\"> \r\n");
out.write("\t\t\t<div class=\"panel panel-info\">\r\n");
out.write("\t\t\t\r\n");
out.write("\t\t\t\t\r\n");
out.write("\t\t\t\t<!-- Div Table for show information -->\r\n");
out.write("\t\t\t\t<div class=\"panel-body\" id=\"tablerepone\" > \r\n");
out.write("\t\t\t\t<span>\r\n");
out.write("\t\t\t\t<a class=\"btn btn-success\" href=\"");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${pageContext.request.contextPath}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null));
out.write("/add\">ADD</a>\r\n");
out.write("\t\t\t\t</span>\r\n");
out.write("\t\t\t\t<span>\r\n");
out.write("\t\t\t\t\t<a href=\"");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${pageContext.request.contextPath}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null));
out.write("/search\" class=\"btn btn-default\">\r\n");
out.write(" \t\t\t\t<span class=\"glyphicon glyphicon-search\"></span></a>\r\n");
out.write("\t\t\t\t</span>\r\n");
out.write("\t\t\t\t<h1>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${msg}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null));
out.write("</h1>\r\n");
out.write("\t\t\t\t<br/><br/>\t\t\t \r\n");
out.write("\t\t\t\t\t<table class=\"table table-striped table-bordered table-hover table-condensed\" >\r\n");
out.write("\t\t\t\t\t\t\t<thead>\r\n");
out.write("\t\t\t\t\t\t\t\r\n");
out.write("\t\t\t\t\t\t\t<tr>\t\t\t\t\t\t\t\r\n");
out.write("\t\t\t\t\t\t\t\r\n");
out.write("\t\t\t\t\t\t\t\t<th>ID</th>\r\n");
out.write("\t\t\t\t\t\t\t\t<th>FRIST NAME</th>\r\n");
out.write("\t\t\t\t\t\t\t\t<th>LASTNAME</th>\t\t\t\t\t\t\t\t\r\n");
out.write("\t\t\t\t\t\t\t\t<th>CLASSROOM</th>\t\r\n");
out.write("\t\t\t\t\t\t\t\t<th>ACTIOIN</th>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n");
out.write("\t\t\t\t\t\t\t</tr>\r\n");
out.write("\t\t\t\t\t\t\t</thead>\r\n");
out.write("\t\t\t\t\t\t\t<tbody >\r\n");
out.write("\t\t\t\t\t\t ");
if (_jspx_meth_c_005fforEach_005f0(_jspx_page_context))
return;
out.write("\t\t\t\t\t\t\t\t \r\n");
out.write("\t\t\t\t\t\t\t</tbody>\r\n");
out.write("\t\t\t\t\t</table>\r\n");
out.write("\t\t\t\t\r\n");
out.write("\t\t\t\t<!-- End of div Table for show information -->\r\n");
out.write("\t\t\t</div>\r\n");
out.write("\t\t\t</div>\r\n");
out.write("\t\t </div>\r\n");
out.write("\t\t</div>\r\n");
out.write("\t</div>\r\n");
out.write("\t<!-- <script type=\"text/javascript\">\t\t\r\n");
out.write("\t function deletePost(id) {\t\t \t\t \r\n");
out.write("\t\t\t $.post(\"delete\", {\r\n");
out.write("\t \t\t\tid : id\t \t\t\t \t\r\n");
out.write("\t \t\t}, function(data, status) {\r\n");
out.write("\t \t\t\t\r\n");
out.write("\t \t\t});\r\n");
out.write("\t\t\t window.location.reload(); \r\n");
out.write("\t \t}\t\r\n");
out.write("\t</script> -->\r\n");
out.write("</body>\r\n");
out.write("</html>");
} catch (java.lang.Throwable t) {
if (!(t instanceof javax.servlet.jsp.SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
try {
if (response.isCommitted()) {
out.flush();
} else {
out.clearBuffer();
}
} catch (java.io.IOException e) {}
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
else throw new ServletException(t);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
private boolean _jspx_meth_c_005fforEach_005f0(javax.servlet.jsp.PageContext _jspx_page_context)
throws java.lang.Throwable {
javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
// c:forEach
org.apache.taglibs.standard.tag.rt.core.ForEachTag _jspx_th_c_005fforEach_005f0 = (org.apache.taglibs.standard.tag.rt.core.ForEachTag) _005fjspx_005ftagPool_005fc_005fforEach_0026_005fvar_005fitems.get(org.apache.taglibs.standard.tag.rt.core.ForEachTag.class);
_jspx_th_c_005fforEach_005f0.setPageContext(_jspx_page_context);
_jspx_th_c_005fforEach_005f0.setParent(null);
// /page/index.jsp(73,7) name = var type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_c_005fforEach_005f0.setVar("element");
// /page/index.jsp(73,7) name = items type = javax.el.ValueExpression reqTime = true required = false fragment = false deferredValue = true expectedTypeName = java.lang.Object deferredMethod = false methodSignature = null
_jspx_th_c_005fforEach_005f0.setItems(new org.apache.jasper.el.JspValueExpression("/page/index.jsp(73,7) '${list}'",_el_expressionfactory.createValueExpression(_jspx_page_context.getELContext(),"${list}",java.lang.Object.class)).getValue(_jspx_page_context.getELContext()));
int[] _jspx_push_body_count_c_005fforEach_005f0 = new int[] { 0 };
try {
int _jspx_eval_c_005fforEach_005f0 = _jspx_th_c_005fforEach_005f0.doStartTag();
if (_jspx_eval_c_005fforEach_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
do {
out.write("\r\n");
out.write("\t\t\t\t\t\t\t<tr>\r\n");
out.write("\t\t\t\t\t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${element.id}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null));
out.write("</td>\r\n");
out.write("\t\t\t\t\t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${element.first_name}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null));
out.write("</td>\r\n");
out.write("\t\t\t\t\t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${element.last_name}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null));
out.write("</td>\t\t\t\t\t\t\t\r\n");
out.write("\t\t\t\t\t\t\t<td>");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${element.classroom}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null));
out.write("</td>\r\n");
out.write("\t\t\t\t\t\t\t\t <td id=\"option\">\t\t\t\t\t\r\n");
out.write("\t\t\t\t\t\t\t\t\t<a class=\"btn btn-default\" href=\"");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${pageContext.request.contextPath}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null));
out.write("/update/");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${element.id}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null));
out.write("\">Update</a>\r\n");
out.write("\t\t\t\t\t\t\t\t\t<!-- <span><button id=\"btnedit\" name=\"btnedit\" class=\"btn btn-success\">View</button></span> -->\r\n");
out.write("\t\t\t\t\t\t\t\t\t<a class=\"btn btn-success\" href=\"");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${pageContext.request.contextPath}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null));
out.write("/view/");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${element.id}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null));
out.write("\">View</a>\r\n");
out.write("\t\t\t\t\t\t\t\t\t");
out.write("\r\n");
out.write("\t\t\t\t\t\t\t\t\t<a class=\"btn btn-danger\" href=\"");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${pageContext.request.contextPath}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null));
out.write("/delete/");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${element.id}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null));
out.write("\">DELETE</a>\r\n");
out.write("\t\t\t\t\t\t\t\t</td>\r\n");
out.write("\t\t\t\t\t\t\t</tr>\r\n");
out.write("\t\t\t\t\t");
int evalDoAfterBody = _jspx_th_c_005fforEach_005f0.doAfterBody();
if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
break;
} while (true);
}
if (_jspx_th_c_005fforEach_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
return true;
}
} catch (java.lang.Throwable _jspx_exception) {
while (_jspx_push_body_count_c_005fforEach_005f0[0]-- > 0)
out = _jspx_page_context.popBody();
_jspx_th_c_005fforEach_005f0.doCatch(_jspx_exception);
} finally {
_jspx_th_c_005fforEach_005f0.doFinally();
_005fjspx_005ftagPool_005fc_005fforEach_0026_005fvar_005fitems.reuse(_jspx_th_c_005fforEach_005f0);
}
return false;
}
}
| [
"hemsarin.rupp@gmail.com"
] | hemsarin.rupp@gmail.com |
4384476424e6635778038efc6eda6e0342733cd5 | a0987d9bb371254b9255fd0cd6412f516ebcff75 | /Sivanag/src/4ChkEvenOdd.java | c95d540a2251e17684cf0e87c758ace50a5abbc3 | [] | no_license | TechieFrogs-US-JUNE-AUGUST/JavaPractices | b6d642dcfabc17500469af7912fe27105c6b89a8 | 5333cbbbde59457e19ce3ab5fc8f8f7e2b092243 | refs/heads/main | 2023-08-14T08:57:07.245458 | 2021-10-03T13:34:19 | 2021-10-03T13:34:19 | 379,934,283 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 263 | java |
class ChkEvenOddnumber
{
public static void main(String args[])
{
int x=98;
if(x % 2 == 0)
System.out.println("Given Number is Even Number");
else
System.out.println("Given Number is Odd Number");
}
} | [
"sivanag.patibandla@gmail.com"
] | sivanag.patibandla@gmail.com |
ba6ee3d56de4b4199a194fb2578afe306266b150 | 30de406cc23c923d2a313e73bd2d4f3ccfec3bbc | /app/src/main/java/com/example/efrainmg90/userloginparse/MainActivity.java | ecd820273fdcc2cae1a1551678c4e8174b4f14b1 | [] | no_license | efrainmg90/UserLoginParse | 79eaaa97c1d29a25a0159b57eaf4c56bdbfb5119 | e7bad0f73a9394116a1d09865a10929ec539298b | refs/heads/master | 2021-01-20T05:52:44.890663 | 2017-04-29T22:24:56 | 2017-04-29T22:24:56 | 89,816,195 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,560 | java | package com.example.efrainmg90.userloginparse;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.parse.LogInCallback;
import com.parse.ParseException;
import com.parse.ParseUser;
public class MainActivity extends AppCompatActivity {
EditText edtUsername,edtPassword;
Button btnLogin,btnRegister;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
edtUsername = (EditText) findViewById(R.id.edt_username);
edtPassword = (EditText) findViewById(R.id.edt_password);
btnLogin = (Button) findViewById(R.id.btn_login);
btnRegister = (Button) findViewById(R.id.btn_register);
btnLogin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
login(edtUsername.getText().toString(),edtPassword.getText().toString());
}
});
btnRegister.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(MainActivity.this,RegisterActivity.class);
startActivity(intent);
finish();
}
});
verifySession();
}
private void login(String user,String pass){
ParseUser.logInInBackground(user, pass, new LogInCallback() {
public void done(ParseUser user, ParseException e) {
if (user != null) {
// Hooray! The user is logged in.
redirectHome();
} else {
// Signup failed. Look at the ParseException to see what happened.
Toast.makeText(MainActivity.this, "Nose pudo iniciar sesion por :"+e, Toast.LENGTH_SHORT).show();
}
}
});
}
private void redirectHome(){
Intent intent = new Intent(MainActivity.this,HomeActivity.class);
startActivity(intent);
finish();
}
private void verifySession(){
ParseUser currentUser = ParseUser.getCurrentUser();
if (currentUser != null) {
// do stuff with the user
redirectHome();
} else {
// show the signup or login screen
}
}
}
| [
"efrainmg90@gmail.com"
] | efrainmg90@gmail.com |
f4180ffb2d41f4fa5fb03f0ea34fedfc3d8910de | 0af8b92686a58eb0b64e319b22411432aca7a8f3 | /large-multiproject/project68/src/test/java/org/gradle/test/performance68_3/Test68_247.java | 94d7e5384e41fef649b44f4dcc60862090359a8e | [] | no_license | gradle/performance-comparisons | b0d38db37c326e0ce271abebdb3c91769b860799 | e53dc7182fafcf9fedf07920cbbea8b40ee4eef4 | refs/heads/master | 2023-08-14T19:24:39.164276 | 2022-11-24T05:18:33 | 2022-11-24T05:18:33 | 80,121,268 | 17 | 15 | null | 2022-09-30T08:04:35 | 2017-01-26T14:25:33 | null | UTF-8 | Java | false | false | 292 | java | package org.gradle.test.performance68_3;
import static org.junit.Assert.*;
public class Test68_247 {
private final Production68_247 production = new Production68_247("value");
@org.junit.Test
public void test() {
assertEquals(production.getProperty(), "value");
}
} | [
"cedric.champeau@gmail.com"
] | cedric.champeau@gmail.com |
be4918086d4df267b87008828d414b37addf1cf6 | 62c46c0e4e58077247eb39ab738f2dd3fef7aa41 | /simple/src/main/java/io/github/jzdayz/javassist/TestBean.java | 449c72947f021405e2f80238a9fec72c776268d9 | [
"Apache-2.0"
] | permissive | jzdayz/java-simples | 4cba0a729d7b857bbe209f95c2a7f2fa1e7511f8 | 3d5575dd0278af5376c21cdfb56a42895b19f1d9 | refs/heads/master | 2023-04-14T12:29:58.991043 | 2021-04-28T03:12:41 | 2021-04-28T03:12:41 | 260,084,208 | 0 | 1 | null | 2020-09-30T01:45:56 | 2020-04-30T01:22:18 | JavaScript | UTF-8 | Java | false | false | 137 | java | package io.github.jzdayz.javassist;
public class TestBean {
public void show(TestBean tb){
System.out.println(1);
}
}
| [
"1397649957@qq.com"
] | 1397649957@qq.com |
ac797a9a2583ffbae4294bef097ca4f9508e6bbc | c38bedca1ec1578f87d89698ce1395c7f6b10b53 | /src/game/demineur/menu/settings/SettingReader.java | 3d4f872173ea9d63a69e7a4d9a194a7fc0438fa4 | [] | no_license | TristanBoulesteix/Demineur-Java | 0a6a557dbdbd2ce5b4245eeb4f2a246758f4bda5 | ab6faa5a0727c241d6ac71c369d6f376f9411282 | refs/heads/master | 2021-04-09T16:12:41.651647 | 2018-04-08T07:54:47 | 2018-04-08T07:54:47 | 125,618,419 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 5,606 | java | package game.demineur.menu.settings;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import org.ini4j.InvalidFileFormatException;
import org.ini4j.Wini;
import game.demineur.popup.Popup;
import game.demineur.utils.Path;
import game.library.Restart;
public class SettingReader {
private final File settingPathFile = new File(Path.DEFAULT_PATH_INI);
private String pathOfSettings;
private String profilName, score, defaultGridSize, defaultColorGrid;
private Wini iniPath = null;
@SuppressWarnings("unused")
private Wini iniDefaultSetting;
private Wini iniSettings;
private File settingFile;
public SettingReader() {
getCurrentSettingPath();
setCurrentSettingSate();
}
private void setCurrentSettingSate() {
try {
settingFile = new File(Path.SETTINGS_PATH + "setting.ini");
pathOfSettings = iniPath.get("Relative path", "Default_path");
iniDefaultSetting = new Wini(new File(pathOfSettings));
iniSettings = new Wini(settingFile);
String tempProfilName = iniSettings.get("User informations", "Nom");
if (tempProfilName.equals("Guest")) {
profilName = Popup.needToCreateNewProfil();
SettingsUtils.addNewProfile(profilName, this, true);
} else {
profilName = tempProfilName;
}
score = iniSettings.get("User informations", "Best score");
defaultGridSize = iniSettings.get("Game settings", "Default grid");
defaultColorGrid = iniSettings.get("Game settings", "Color grid");
} catch (InvalidFileFormatException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
private void getCurrentSettingPath() {
String temporaryString = null;
try {
iniPath = new Wini(settingPathFile);
temporaryString = iniPath.get("Relative path", "Current_path");
} catch (InvalidFileFormatException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
if (temporaryString.equals("Default path")) {
pathOfSettings = iniPath.get("Relative path", "Default_path");
createNewSettingsFile();
} else {
pathOfSettings = temporaryString;
}
}
public void updateProfilNameINI(String profilName) {
try {
iniSettings = new Wini(settingFile);
iniSettings.put("User informations", "Nom", profilName);
iniSettings.store();
this.profilName = profilName;
} catch (IOException e) {
e.printStackTrace();
}
}
public void updateGridSizeINI(String gridSize) {
try {
iniSettings = new Wini(settingFile);
iniSettings.put("Game settings", "Default grid", gridSize);
iniSettings.store();
this.defaultGridSize = gridSize;
} catch (IOException e) {
e.printStackTrace();
}
}
public void updateColorINI(String colorName) {
try {
iniSettings = new Wini(settingFile);
iniSettings.put("Game settings", "Color grid", colorName);
iniSettings.store();
setDefaultColorGrid(colorName);
} catch (IOException e) {
e.printStackTrace();
}
}
public void createNewSettingsFile() {
String settingName = Path.SETTINGS_PATH + "setting.ini";
File settingModel = new File(pathOfSettings);
InputStream streamed;
String line;
try {
FileWriter writer = new FileWriter(settingName, true);
BufferedWriter bufferW = new BufferedWriter(writer);
streamed = new FileInputStream(settingModel);
InputStreamReader reader = new InputStreamReader(streamed);
BufferedReader bufferR = new BufferedReader(reader);
while ((line = bufferR.readLine()) != null) {
bufferW.write(line + "\n");
}
bufferW.close();
bufferR.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
updatePathOfSetting(settingName);
Restart restart = new Restart();
restart.restartApplication();
}
private void updatePathOfSetting(String path) {
File file = new File(path);
String absolutePath = file.getAbsoluteFile().getParentFile().getAbsolutePath();
try {
iniPath = new Wini(settingPathFile);
iniPath.put("Relative path", "Current_path", path);
iniPath.put("Absolute path", "Current_absolute path", absolutePath);
iniPath.store();
} catch (IOException e) {
e.printStackTrace();
}
settingFile = file;
try {
iniSettings = new Wini(file);
} catch (InvalidFileFormatException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
public boolean setDefaultSettingsPath() {
boolean success = true;
try {
iniPath.put("Relative path", "Current_path", "Default path");
iniPath.put("Absolute path", "Current_absolute path", "null");
iniPath.store();
} catch (IOException e) {
e.printStackTrace();
success = false;
}
return success;
}
/**
* @return the pathOfSettings
*/
public String getPathOfSettings() {
return pathOfSettings;
}
/**
* @return the profilName
*/
public String getProfilName() {
return profilName;
}
/**
* @return the score
*/
public String getScore() {
return score;
}
/**
* @return the defaultGridSize
*/
public String getDefaultGridSize() {
return defaultGridSize;
}
/**
* @return the defaultColorGrid
*/
public String getDefaultColorGrid() {
return defaultColorGrid;
}
/**
* @param defaultColorGrid
* the defaultColorGrid to set
*/
public void setDefaultColorGrid(String defaultColorGrid) {
this.defaultColorGrid = defaultColorGrid;
}
}
| [
"tristan.boulesteix@gmail.com"
] | tristan.boulesteix@gmail.com |
3ba0b5cf2270ad1896449d2f4d2d3ac097d723a4 | f4975228359e9eb6e3c1af87a965d14f51218208 | /src/main/java/org/telegram/tl/TLContext.java | a214ea29066862f7ad97e4d7a00fef5695d87347 | [
"MIT"
] | permissive | 2k13yr/telegram-tl-core | b01b8d797e1354d1b525d9f10ce7bee0657afc3c | 95b11f2068c789109775103c0744658c0e6d24a4 | refs/heads/master | 2021-01-16T21:38:21.570193 | 2014-02-10T09:28:15 | 2014-02-10T09:28:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,841 | java | package org.telegram.tl;
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.zip.GZIPInputStream;
/**
* TypeLanguage context object. It performs deserialization of objects and vectors.
* All known classes might be registered in context for deserialization.
* Often this might be performed from inherited class in init() method call.
* If TL-Object contains static int field CLASS_ID, then it might be used for registration,
* but it uses reflection so it might be slow in some cases. It recommended to manually pass CLASS_ID
* to registerClass method.
*
* @author Korshakov Stepan <me@ex3ndr.com>
*/
public abstract class TLContext {
private HashMap<Integer, Class> registeredClasses = new HashMap<Integer, Class>();
private HashMap<Integer, Class> registeredCompatClasses = new HashMap<Integer, Class>();
public TLContext() {
init();
}
protected void init() {
}
public boolean isSupportedObject(TLObject object) {
return isSupportedObject(object.getClassId());
}
public boolean isSupportedObject(int classId) {
return registeredClasses.containsKey(classId);
}
public <T extends TLObject> void registerClass(Class<T> tClass) {
try {
int classId = tClass.getField("CLASS_ID").getInt(null);
registeredClasses.put(classId, tClass);
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}
public <T extends TLObject> void registerClass(int clazzId, Class<T> tClass) {
registeredClasses.put(clazzId, tClass);
}
public <T extends TLObject> void registerCompatClass(Class<T> tClass) {
try {
int classId = tClass.getField("CLASS_ID").getInt(null);
registeredCompatClasses.put(classId, tClass);
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}
public <T extends TLObject> void registerCompatClass(int clazzId, Class<T> tClass) {
registeredCompatClasses.put(clazzId, tClass);
}
protected TLObject convertCompatClass(TLObject src) {
return src;
}
public TLObject deserializeMessage(byte[] data) throws IOException {
return deserializeMessage(new ByteArrayInputStream(data));
}
public TLObject deserializeMessage(int clazzId, InputStream stream) throws IOException {
if (clazzId == TLGzipObject.CLASS_ID) {
TLGzipObject obj = new TLGzipObject();
obj.deserializeBody(stream, this);
BufferedInputStream gzipInputStream = new BufferedInputStream(new GZIPInputStream(new ByteArrayInputStream(obj.getPackedData())));
int innerClazzId = StreamingUtils.readInt(gzipInputStream);
return deserializeMessage(innerClazzId, gzipInputStream);
}
if (clazzId == TLBoolTrue.CLASS_ID) {
return new TLBoolTrue();
}
if (clazzId == TLBoolFalse.CLASS_ID) {
return new TLBoolFalse();
}
if (registeredCompatClasses.containsKey(clazzId)) {
try {
Class messageClass = registeredCompatClasses.get(clazzId);
TLObject message = (TLObject) messageClass.getConstructor().newInstance();
message.deserializeBody(stream, this);
return convertCompatClass(message);
} catch (DeserializeException e) {
throw e;
} catch (Exception e) {
e.printStackTrace();
throw new IOException("Unable to deserialize data");
}
}
try {
Class messageClass = registeredClasses.get(clazzId);
if (messageClass != null) {
TLObject message = (TLObject) messageClass.getConstructor().newInstance();
message.deserializeBody(stream, this);
return message;
} else {
throw new DeserializeException("Unsupported class: #" + Integer.toHexString(clazzId));
}
} catch (DeserializeException e) {
throw e;
} catch (Exception e) {
e.printStackTrace();
throw new IOException("Unable to deserialize data");
}
}
public TLObject deserializeMessage(InputStream stream) throws IOException {
int clazzId = StreamingUtils.readInt(stream);
return deserializeMessage(clazzId, stream);
}
public TLVector deserializeVector(InputStream stream) throws IOException {
int clazzId = StreamingUtils.readInt(stream);
if (clazzId == TLVector.CLASS_ID) {
TLVector res = new TLVector();
res.deserializeBody(stream, this);
return res;
} else if (clazzId == TLGzipObject.CLASS_ID) {
TLGzipObject obj = new TLGzipObject();
obj.deserializeBody(stream, this);
BufferedInputStream gzipInputStream = new BufferedInputStream(new GZIPInputStream(new ByteArrayInputStream(obj.getPackedData())));
return deserializeVector(gzipInputStream);
} else {
throw new IOException("Unable to deserialize vector");
}
}
public TLIntVector deserializeIntVector(InputStream stream) throws IOException {
int clazzId = StreamingUtils.readInt(stream);
if (clazzId == TLVector.CLASS_ID) {
TLIntVector res = new TLIntVector();
res.deserializeBody(stream, this);
return res;
} else if (clazzId == TLGzipObject.CLASS_ID) {
TLGzipObject obj = new TLGzipObject();
obj.deserializeBody(stream, this);
BufferedInputStream gzipInputStream = new BufferedInputStream(new GZIPInputStream(new ByteArrayInputStream(obj.getPackedData())));
return deserializeIntVector(gzipInputStream);
} else {
throw new IOException("Unable to deserialize vector");
}
}
public TLLongVector deserializeLongVector(InputStream stream) throws IOException {
int clazzId = StreamingUtils.readInt(stream);
if (clazzId == TLVector.CLASS_ID) {
TLLongVector res = new TLLongVector();
res.deserializeBody(stream, this);
return res;
} else if (clazzId == TLGzipObject.CLASS_ID) {
TLGzipObject obj = new TLGzipObject();
obj.deserializeBody(stream, this);
BufferedInputStream gzipInputStream = new BufferedInputStream(new GZIPInputStream(new ByteArrayInputStream(obj.getPackedData())));
return deserializeLongVector(gzipInputStream);
} else {
throw new IOException("Unable to deserialize vector");
}
}
public TLStringVector deserializeStringVector(InputStream stream) throws IOException {
int clazzId = StreamingUtils.readInt(stream);
if (clazzId == TLVector.CLASS_ID) {
TLStringVector res = new TLStringVector();
res.deserializeBody(stream, this);
return res;
} else if (clazzId == TLGzipObject.CLASS_ID) {
TLGzipObject obj = new TLGzipObject();
obj.deserializeBody(stream, this);
BufferedInputStream gzipInputStream = new BufferedInputStream(new GZIPInputStream(new ByteArrayInputStream(obj.getPackedData())));
return deserializeStringVector(gzipInputStream);
} else {
throw new IOException("Unable to deserialize vector");
}
}
public TLBytes allocateBytes(int size) {
return new TLBytes(new byte[size], 0, size);
}
}
| [
"me@ex3ndr.com"
] | me@ex3ndr.com |
091ccdb27e0fa6f3afe7adafd491cf687bf81ebe | effa9e5d7242e70d45a3a3b5f5a82591d08eafd1 | /chapter01/src/com/bean/Student.java | faf5eaee9cb15aa7988564072db760cf3c7064a9 | [] | no_license | lch-java/test1001 | 7aebbf10dbbd5e8748969b3cfd93f9abe0aafb7d | 248362dfeb41c8df301a932c5c402d41044ec307 | refs/heads/master | 2023-06-14T08:56:09.328385 | 2021-07-10T10:46:59 | 2021-07-10T10:46:59 | 384,666,165 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 244 | java | package com.bean;
public class Student {
//5个Field
public int no; //这整个是一个Field对象
private String name; //Field对象
protected int age;
boolean sex;
public static final double MATH_PAI = 3.14;
}
| [
"lch@bjpowernode.com"
] | lch@bjpowernode.com |
7b9956629090087f4b0a9cc85c7adae4075898d8 | 5b056b1fbf34ab2289457c53c4334aa33eed3be3 | /src/main/java/pro/buildmysoftware/patterns/factory/Bar.java | a4bec2591a6351ad55554680fd9c7eca70bde1ae | [] | no_license | mikewojtyna/effective-java-training | f18eca3802e16463807365f61ddb21fe675827e5 | cbc9e0767d8896ea04f45352216580f844ef9fc8 | refs/heads/master | 2020-11-25T04:02:15.130422 | 2019-12-19T14:33:45 | 2019-12-19T14:33:45 | 228,493,518 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 95 | java | package pro.buildmysoftware.patterns.factory;
interface Bar {
Drink order(MenuItem type);
}
| [
"mike@buildmysoftware.pro"
] | mike@buildmysoftware.pro |
94d86332f7d0f404775b4bf921f5da3b7f2ce97d | 742120330d22d8f4828fb6941d5a795e2c8a3226 | /com/aionemu/gameserver/services/RespawnService.java | 26dcc686480fd62949c52b88f64b259f0de270df | [] | no_license | Avol/TestProject | 33aa898db2a09cb13d04cc63e2bb26438c523255 | fa31fc7f6635a34f5cc79a1861a6eccd08ff0e14 | refs/heads/master | 2021-01-10T18:39:00.145747 | 2009-10-13T13:10:17 | 2009-10-13T13:13:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,887 | java | /*
* This file is part of aion-unique <aion-unique.smfnew.com>.
*
* aion-unique 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.
*
* aion-unique 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 aion-unique. If not, see <http://www.gnu.org/licenses/>.
*/
package com.aionemu.gameserver.services;
import org.apache.log4j.Logger;
import com.aionemu.gameserver.model.gameobjects.Npc;
import com.aionemu.gameserver.model.templates.SpawnTemplate;
import com.aionemu.gameserver.network.aion.serverpackets.SM_DELETE;
import com.aionemu.gameserver.utils.PacketSendUtility;
import com.aionemu.gameserver.utils.ThreadPoolManager;
import com.aionemu.gameserver.world.World;
/**
* @author ATracer
*
*/
public class RespawnService
{
private static final Logger log = Logger.getLogger(RespawnService.class);
private static final int RESPAWN_DEFAULT_DELAY = 80000;
private static RespawnService instance = new RespawnService();
public void scheduleRespawnTask(final Npc npc)
{
final World world = npc.getActiveRegion().getWorld();
//TODO separate thread executor for decay/spawns
// or schedule separate decay runnable service with queue
ThreadPoolManager.getInstance().schedule(new Runnable()
{
@Override
public void run()
{
world.spawn(npc);
npc.getController().onRespawn();
}
}, RESPAWN_DEFAULT_DELAY);
}
public static RespawnService getInstance()
{
return instance;
}
}
| [
"aego.support@gmail.com"
] | aego.support@gmail.com |
7ddcaba3c5f04e2335eee7b4866b2840a78b87a4 | a54536b1f6238656c9502ec2098b824c5439da2c | /app/src/main/java/com/mancy/p2ptext/ViewHodler/BaseHodler.java | 32b2e9faaa9775ab89d25cfe17258629d82a87b4 | [] | no_license | LinmmMancy/P2pText | dd7d07546b56a4b770db39f0e440ac5d819b018c | 834befc7d3ab7e5d64747c30060157863cd270df | refs/heads/master | 2020-05-21T02:08:49.665222 | 2017-03-17T12:57:12 | 2017-03-17T12:57:12 | 84,556,750 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 648 | java | package com.mancy.p2ptext.ViewHodler;
import android.view.View;
import butterknife.ButterKnife;
/**
* Created by Mancy on 2017/3/14.
*/
public abstract class BaseHodler<T> {
private final View rootView;
public BaseHodler() {
rootView = initView();
rootView.setTag(this);
ButterKnife.inject(this, rootView);
}
public View getView() {
return rootView;
}
private T t;
public void setData(T t) {
this.t = t;
setChildData();
}
public T getT() {
return t;
}
protected abstract void setChildData();
public abstract View initView();
}
| [
"519660797@qq.com"
] | 519660797@qq.com |
8dd86d4dafe3d75eb7d3c339defa70527e94e8ef | cc812e4f60ab7ad519a081883b4786185ef3cf14 | /src/test/java/avramenko/lab01/sorters/MergeSorterQuickTest.java | 14861ec2bfbeb998c4040175b7e254f557ac2b2a | [] | no_license | avramenkokaterina/netcracker_lab1 | 2b2b1a10046cbefba2135af345c59f915deecb28 | ae146f28eb7de08485c77b3faeefa9104c26f020 | refs/heads/master | 2020-04-07T03:29:45.913978 | 2019-01-23T15:11:46 | 2019-01-23T15:11:46 | 158,018,504 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,141 | java | package avramenko.lab01.sorters;
import org.junit.Assert;
import org.junit.Test;
import java.util.Random;
public class MergeSorterQuickTest {
private int[] createArray() {
int[] testArray = new int[50];
Random random = new Random();
for (int i = 0; i < testArray.length; i++) {
testArray[i] = random.nextInt();
}
MergeSorterQuick mergeSorterQuick = new MergeSorterQuick();
int[] result = mergeSorterQuick.sort(testArray);
return result;
}
@Test
public void sortTest() {
int[] testArray = createArray();
boolean isSorted = true;
for (int i = 0; i < testArray.length - 1; i++) {
if (testArray[i] > testArray[i + 1]) {
isSorted = false;
}
}
Assert.assertTrue("Oh no...", isSorted);
}
@Test(timeout = 10000)
public void sortTimeTest() {
int[] testArray = createArray();
}
@Test(expected = IndexOutOfBoundsException.class)
public void sortExceptionTest() {
int[] testArray = createArray();
int element = testArray[51];
}
} | [
"k.avramenko111@gmail.com"
] | k.avramenko111@gmail.com |
3ff9efe0e0556dcc7a3a34ee9a30ee7d1dbac0fa | 841a00497a8a8c40693b746e4b98992b6444389c | /gateway/src/main/java/com/ecoleprimaire/gateway/config/GatewayConfiguration.java | 3355393ec0af444949c2236b2696389514aa80a1 | [] | no_license | celloupro/gestionEcoleMicroservice | b4d0200684ecd4322f7895e421cf1544b7f7058b | 50980c8385bba90c00192caaff8761254a1743a5 | refs/heads/master | 2023-04-02T11:15:45.180401 | 2021-03-27T20:51:00 | 2021-03-27T20:51:00 | 352,163,419 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,064 | java | package com.ecoleprimaire.gateway.config;
import io.github.jhipster.config.JHipsterProperties;
import com.ecoleprimaire.gateway.gateway.accesscontrol.AccessControlFilter;
import com.ecoleprimaire.gateway.gateway.responserewriting.SwaggerBasePathRewritingFilter;
import org.springframework.cloud.netflix.zuul.filters.RouteLocator;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class GatewayConfiguration {
@Configuration
public static class SwaggerBasePathRewritingConfiguration {
@Bean
public SwaggerBasePathRewritingFilter swaggerBasePathRewritingFilter() {
return new SwaggerBasePathRewritingFilter();
}
}
@Configuration
public static class AccessControlFilterConfiguration {
@Bean
public AccessControlFilter accessControlFilter(RouteLocator routeLocator, JHipsterProperties jHipsterProperties) {
return new AccessControlFilter(routeLocator, jHipsterProperties);
}
}
}
| [
"mamadoucelloudiallo24@gmail.com"
] | mamadoucelloudiallo24@gmail.com |
cee60a4862f75a99011fd6812155444e42fdf549 | b9a450938dae9c6457dc2ee601a6f4286089f543 | /02-app-b2c/src/main/java/com/codingstudy/b2c/service/ProductService.java | cb6175404ea3cbc1dcab5df2cc540018b730b234 | [] | no_license | ming201005/study-security-elementui | dd9fb17565bd0395099ad69f2cb9f35f098bd4b3 | 5231096bbf7f30f4da0ac7dc39ed49868cfdf63f | refs/heads/master | 2022-06-26T16:50:06.115608 | 2020-03-26T05:40:25 | 2020-03-26T05:40:25 | 247,744,169 | 12 | 8 | null | 2022-06-17T02:57:08 | 2020-03-16T15:21:04 | Java | UTF-8 | Java | false | false | 619 | java | package com.codingstudy.b2c.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.codingstudy.b2c.entity.Product;
import java.util.Map;
/**
* (Product)表服务接口
* 该类由EasyCode工具生成
* @author 小明哥
* @since 2020-03-15 22:49:39
*/
public interface ProductService extends IService<Product> {
/**
* 商品列表(后台管理列表,带搜索)
* @param searchModel
* @return
*/
Page<Map<String,Object>> getList(Page<Map<String, Object>> page, Product searchModel);
} | [
"2720387088@qq.com"
] | 2720387088@qq.com |
e20125c5be82f20bf1f01ba025d512710d020aa4 | 01dde18a3637d72d0ca7d4ff80e6e501b925b167 | /app/src/main/java/com/project/wisdomfirecontrol/firecontrol/ui/utils/DatasUtils.java | 285c4e81c66a307cd5abd9cb2298acca3e103ef8 | [] | no_license | liangminxiong/CommonApp | 6242e06da9dfdfdf88fbfdfd3f66a2bb1c717ff0 | c2f5a5af6c141ad2b4abc2d44cbf7f17a05b095d | refs/heads/master | 2020-03-29T18:44:02.449317 | 2019-05-05T03:10:41 | 2019-05-05T03:10:44 | 150,228,572 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 32,276 | java | package com.project.wisdomfirecontrol.firecontrol.ui.utils;
import android.content.Context;
import android.text.TextUtils;
import com.mvp_0726.common.utils.Constans;
import com.project.wisdomfirecontrol.R;
import com.project.wisdomfirecontrol.common.base.Global;
import com.project.wisdomfirecontrol.common.base.UserInfo;
import com.project.wisdomfirecontrol.common.base.UserManage;
import com.project.wisdomfirecontrol.common.util.LogUtil;
import com.project.wisdomfirecontrol.firecontrol.model.bean.video.Organ;
import com.project.wisdomfirecontrol.firecontrol.model.bean.video.VideoEquipmentDataBean;
import com.project.wisdomfirecontrol.firecontrol.model.bean.video.VideoesBean;
import com.project.wisdomfirecontrol.firecontrol.model.bean.video.VideoesXBean;
import com.project.wisdomfirecontrol.firecontrol.treesList.Node;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Administrator on 2018/5/14.
*/
public class DatasUtils {
private static int firstOsize;
private static String secondId;
private static String secondOrgShortName;
private static String firstVRegistrationNO;
private static int firstVsize;
private static int secondVsize;
private static String firstVehicleId;
private static String secondVehicleId;
private static String secondVehicleRegistrationNO;
private static int secondOsize;
private static String thirdOrgansId;
private static String thirdOrgansOrgShortName;
private static int thirdVsize;
private static int thirdOsize;
private static String thirdVehicleId;
private static String thirdVehicleRegistrationNO;
private static String thirdOrganId;
private static String thirdOrganOrgShortName;
private static int fourthVsize;
private static int fourthOsize;
private static String fourthvehicleId;
private static String fourthvehicleRegistrationNO;
private static String fourthOrganId;
private static String fourthOrganOrgShortName;
private static int fifthVsize;
private static String fifthVehicleId;
private static String fifthVehicleRegistrationNO;
private static int fifthOsize;
private static String fifthOrganId;
private static String fifthOrganOrgShortName;
private static int sixthVsize;
private static int sixthOsize;
private static String sixthVehicleId;
private static String sixthVehicleRegistrationNO;
private static String firstVehicleTerminalNO;
private static String secondVehicleTerminalNO;
private static String thirdVehicleTerminalNO;
private static String fourthvehicleTerminalNO;
private static String fifthVehicleTerminalNO;
private static String sixthVehicleTerminalNO;
public static List<Node> ReturnTreesDatas(List<VideoEquipmentDataBean> msg) {
List<Node> mDatas = new ArrayList<Node>();
int size = msg.size();
if (size <= 0) {
return new ArrayList<Node>();
}
String treeStr = initDatasTreeStr(msg);
VideoEquipmentDataBean msgBean = msg.get(0);
String orgShortName = msgBean.getOrgName();
// String fatherPid = msgBean.getPid();
String fatherId = msgBean.getId();
List<VideoesBean> firstVehicles = msgBean.getVideoes();
firstVsize = firstVehicles.size();
List<VideoEquipmentDataBean.OrgansBean> firstOrgans = msgBean.getOrgans();
firstOsize = firstOrgans.size();
/*第一层*/
// id , pid , label , 其他属性
mDatas.add(new Node(fatherId, "1000000000", orgShortName, treeStr, ""));
if (firstVsize > 0) {
// for (VideoEquipmentDataBean.VideoesBean firstVehicle : firstVehicles) {
for (VideoesBean firstVehicle : firstVehicles) {
firstVehicleId = firstVehicle.getId();
firstVRegistrationNO = firstVehicle.getName();
firstVehicleTerminalNO = firstVehicle.getTerminalno();
mDatas.add(new Node(firstVehicleId + "", fatherId + "", firstVRegistrationNO, Constans.COUNT_ZERO, firstVehicleTerminalNO));
}
}
/*第二层*/
if (firstOsize > 0) {
for (VideoEquipmentDataBean.OrgansBean firstOrgan : firstOrgans) {
String strSecond = initDatasTreeStrSecond(firstOrgan);
secondId = firstOrgan.getId();
secondOrgShortName = firstOrgan.getOrgName();
List<VideoesXBean> secondVehicles = firstOrgan.getVideoes();
secondVsize = secondVehicles.size();
List<Organ> organs = firstOrgan.getOrgans();
secondOsize = organs.size();
mDatas.add(new Node(secondId + "", fatherId + "", secondOrgShortName, strSecond, ""));
if (secondVsize > 0) {
for (VideoesXBean secondVehicle : secondVehicles) {
secondVehicleId = secondVehicle.getId();
secondVehicleRegistrationNO = secondVehicle.getName();
secondVehicleTerminalNO = secondVehicle.getTerminalno();
mDatas.add(new Node(secondVehicleId + "", secondId + "",
secondVehicleRegistrationNO, Constans.COUNT_ZERO, secondVehicleTerminalNO));
}
}
// 第三层
if (secondOsize > 0) {
for (Organ organ : organs) {
String strThird = initDatasTreeStrThird(organ);
thirdOrgansId = organ.getId();
thirdOrgansOrgShortName = organ.getOrgName();
List<VideoesBean> thirdVehicles = organ.getVideoes();
thirdVsize = thirdVehicles.size();
List<Organ> thirdOrgans = organ.getOrgans();
thirdOsize = thirdOrgans.size();
LogUtil.d("=======++ DataUtils =3=" + thirdOrgansOrgShortName + "++ " + thirdVsize);
// 第三层总数据
mDatas.add(new Node(thirdOrgansId + "", secondId + "", thirdOrgansOrgShortName, strThird, ""));
if (thirdVsize > 0) {
for (VideoesBean thirdVehicle : thirdVehicles) {
thirdVehicleId = thirdVehicle.getId();
thirdVehicleRegistrationNO = thirdVehicle.getName();
thirdVehicleTerminalNO = thirdVehicle.getTerminalno();
mDatas.add(new Node(thirdVehicleId + "", thirdOrgansId + "", thirdVehicleRegistrationNO,
Constans.COUNT_ZERO, thirdVehicleTerminalNO));
}
}
// 第四层
if (thirdOsize > 0) {
for (Organ thirdOrgan : thirdOrgans) {
String strFouth = initDatasTreeStrFouth(thirdOrgan);
thirdOrganId = thirdOrgan.getId();
thirdOrganOrgShortName = thirdOrgan.getOrgName();
List<VideoesBean> fourthvehicles = thirdOrgan.getVideoes();
fourthVsize = fourthvehicles.size();
List<Organ> fourthOrgans = thirdOrgan.getOrgans();
fourthOsize = fourthOrgans.size();
LogUtil.d("=======++ DataUtils =4=" + thirdOrganOrgShortName + "++ " + fourthVsize);
mDatas.add(new Node(thirdOrganId + "", thirdOrgansId + "", thirdOrganOrgShortName, strFouth, ""));
if (fourthVsize > 0) {
for (VideoesBean fourthvehicle : fourthvehicles) {
fourthvehicleId = fourthvehicle.getId();
fourthvehicleRegistrationNO = fourthvehicle.getName();
fourthvehicleTerminalNO = fourthvehicle.getTerminalno();
mDatas.add(new Node(fourthvehicleId + "", thirdOrganId + "", fourthvehicleRegistrationNO,
Constans.COUNT_ZERO, fourthvehicleTerminalNO));
}
}
// 第五层
if (fourthOsize > 0) {
for (Organ fourthOrgan : fourthOrgans) {
String strFifth = initDatasTreeStrFifth(fourthOrgan);
fourthOrganId = fourthOrgan.getId();
fourthOrganOrgShortName = fourthOrgan.getOrgName();
List<VideoesBean> fifthVehicles = fourthOrgan.getVideoes();
fifthVsize = fifthVehicles.size();
List<Organ> fifthOrgans = fourthOrgan.getOrgans();
fifthOsize = fifthOrgans.size();
mDatas.add(new Node(fourthOrganId + "", thirdOrganId + "", fourthOrganOrgShortName, strFifth, ""));
if (fifthVsize > 0) {
for (VideoesBean fifthVehicle : fifthVehicles) {
fifthVehicleId = fifthVehicle.getId();
fifthVehicleRegistrationNO = fifthVehicle.getName();
fifthVehicleTerminalNO = fifthVehicle.getTerminalno();
mDatas.add(new Node(fifthVehicleId + "", thirdOrganId + "", fifthVehicleRegistrationNO,
Constans.COUNT_ZERO, fifthVehicleTerminalNO));
}
}
// 第六层
if (fifthOsize > 0) {
for (Organ fifthOrgan : fifthOrgans) {
String strSixth = initDatasTreeStrFouth(fifthOrgan);
fifthOrganId = fifthOrgan.getId();
fifthOrganOrgShortName = fifthOrgan.getOrgName();
List<VideoesBean> sixthVehicles = fifthOrgan.getVideoes();
sixthVsize = sixthVehicles.size();
List<Organ> sixthOrganOrgans = fifthOrgan.getOrgans();
sixthOsize = sixthOrganOrgans.size();
mDatas.add(new Node(fifthOrganId + "", fourthOrganId + "", fifthOrganOrgShortName, strSixth, ""));
if (sixthVsize > 0) {
for (VideoesBean sixthVehicle : sixthVehicles) {
sixthVehicleId = sixthVehicle.getId();
sixthVehicleRegistrationNO = sixthVehicle.getName();
sixthVehicleTerminalNO = sixthVehicle.getTerminalno();
mDatas.add(new Node(sixthVehicleId + "", fifthOrganId + "",
sixthVehicleRegistrationNO, Constans.COUNT_ZERO, sixthVehicleTerminalNO));
}
}
}
}
}
}
}
}
}
}
}
}
return mDatas;
}
private static String initDatasTreeStr(List<VideoEquipmentDataBean> msg) {
int countAll = 0;
int size = msg.size();
if (size <= 0) {
return "";
}
VideoEquipmentDataBean msgBean = msg.get(0);
// 第二层
// List<VideoEquipmentDataBean.VideoesBean> firstVehicles = msgBean.getVideoes();
List<VideoesBean> firstVehicles = msgBean.getVideoes();
firstVsize = firstVehicles.size();
List<VideoEquipmentDataBean.OrgansBean> firstOrgans = msgBean.getOrgans();
firstOsize = firstOrgans.size();
// id , pid , label , 其他属性
if (firstVsize > 0) {
countAll = firstVsize;
}
if (firstOsize > 0) {
for (VideoEquipmentDataBean.OrgansBean organ : firstOrgans) {
List<VideoesXBean> secondVehicles = organ.getVideoes();
secondVsize = secondVehicles.size();
List<Organ> organs = organ.getOrgans();
secondOsize = organs.size();
if (secondVsize > 0) {
for (VideoesXBean secondVehicle : secondVehicles) {
countAll++;
}
}
// 第三层
if (secondOsize > 0) {
for (Organ secondOrgans : organs) {
List<VideoesBean> thirdVehicles = secondOrgans.getVideoes();
thirdVsize = thirdVehicles.size();
List<Organ> thirdOrgans = secondOrgans.getOrgans();
thirdOsize = thirdOrgans.size();
if (thirdVsize > 0) {
for (VideoesBean thirdVehicle : thirdVehicles) {
countAll++;
}
}
// 第四层
if (thirdOsize > 0) {
for (Organ thirdOrgan : thirdOrgans) {
List<VideoesBean> fourthvehicles = thirdOrgan.getVideoes();
fourthVsize = fourthvehicles.size();
List<Organ> fourthOrgans = thirdOrgan.getOrgans();
fourthOsize = fourthOrgans.size();
if (fourthVsize > 0) {
for (VideoesBean fourthvehicle : fourthvehicles) {
countAll++;
}
}
// 第五层
if (fourthOsize > 0) {
for (Organ fourthOrgan : fourthOrgans) {
List<VideoesBean> fifthVehicles = fourthOrgan.getVideoes();
fifthVsize = fifthVehicles.size();
List<Organ> fifthOrgans = fourthOrgan.getOrgans();
fifthOsize = fifthOrgans.size();
if (fifthVsize > 0) {
for (VideoesBean fifthVehicle : fifthVehicles) {
countAll++;
}
}
// 第六层
if (fifthOsize > 0) {
for (Organ fifthOrgan : fifthOrgans) {
List<VideoesBean> sixthVehicles = fifthOrgan.getVideoes();
sixthVsize = sixthVehicles.size();
List<Organ> sixthOrganOrgans = fifthOrgan.getOrgans();
sixthOsize = sixthOrganOrgans.size();
if (sixthVsize > 0) {
for (VideoesBean sixthVehicle : sixthVehicles) {
countAll++;
}
}
}
}
}
}
}
}
}
}
}
}
return String.valueOf(countAll);
}
private static String initDatasTreeStrSecond(VideoEquipmentDataBean.OrgansBean firstOrgans) {
int countAll = 0;
List<VideoesXBean> secondVehicles = firstOrgans.getVideoes();
secondVsize = secondVehicles.size();
List<Organ> organs = firstOrgans.getOrgans();
secondOsize = organs.size();
if (secondVsize > 0) {
for (VideoesXBean secondVehicle : secondVehicles) {
countAll++;
}
}
// 第三层
if (secondOsize > 0) {
for (Organ secondOrgans : organs) {
List<VideoesBean> thirdVehicles = secondOrgans.getVideoes();
thirdVsize = thirdVehicles.size();
List<Organ> thirdOrgans = secondOrgans.getOrgans();
thirdOsize = thirdOrgans.size();
if (thirdVsize > 0) {
for (VideoesBean thirdVehicle : thirdVehicles) {
countAll++;
}
}
// 第四层
if (thirdOsize > 0) {
for (Organ thirdOrgan : thirdOrgans) {
List<VideoesBean> fourthvehicles = thirdOrgan.getVideoes();
fourthVsize = fourthvehicles.size();
List<Organ> fourthOrgans = thirdOrgan.getOrgans();
fourthOsize = fourthOrgans.size();
if (fourthVsize > 0) {
for (VideoesBean fourthvehicle : fourthvehicles) {
countAll++;
}
}
// 第五层
if (fourthOsize > 0) {
for (Organ fourthOrgan : fourthOrgans) {
List<VideoesBean> fifthVehicles = fourthOrgan.getVideoes();
fifthVsize = fifthVehicles.size();
List<Organ> fifthOrgans = fourthOrgan.getOrgans();
fifthOsize = fifthOrgans.size();
if (fifthVsize > 0) {
for (VideoesBean fifthVehicle : fifthVehicles) {
countAll++;
}
}
// 第六层
if (fifthOsize > 0) {
for (Organ fifthOrgan : fifthOrgans) {
List<VideoesBean> sixthVehicles = fifthOrgan.getVideoes();
sixthVsize = sixthVehicles.size();
List<Organ> sixthOrganOrgans = fifthOrgan.getOrgans();
sixthOsize = sixthOrganOrgans.size();
if (sixthVsize > 0) {
for (VideoesBean sixthVehicle : sixthVehicles) {
countAll++;
}
}
}
}
}
}
}
}
}
}
return countAll + "";
}
private static String initDatasTreeStrThird(Organ organ) {
int countAll = 0;
List<VideoesBean> secondVehicles = organ.getVideoes();
secondVsize = secondVehicles.size();
List<Organ> organs = organ.getOrgans();
secondOsize = organs.size();
if (secondVsize > 0) {
for (VideoesBean secondVehicle : secondVehicles) {
countAll++;
}
}
// 第三层
if (secondOsize > 0) {
for (Organ secondOrgans : organs) {
List<VideoesBean> thirdVehicles = secondOrgans.getVideoes();
thirdVsize = thirdVehicles.size();
List<Organ> thirdOrgans = secondOrgans.getOrgans();
thirdOsize = thirdOrgans.size();
if (thirdVsize > 0) {
for (VideoesBean thirdVehicle : thirdVehicles) {
countAll++;
}
}
// 第四层
if (thirdOsize > 0) {
for (Organ thirdOrgan : thirdOrgans) {
List<VideoesBean> fourthvehicles = thirdOrgan.getVideoes();
fourthVsize = fourthvehicles.size();
List<Organ> fourthOrgans = thirdOrgan.getOrgans();
fourthOsize = fourthOrgans.size();
if (fourthVsize > 0) {
for (VideoesBean fourthvehicle : fourthvehicles) {
countAll++;
}
}
// 第五层
if (fourthOsize > 0) {
for (Organ fourthOrgan : fourthOrgans) {
List<VideoesBean> fifthVehicles = fourthOrgan.getVideoes();
fifthVsize = fifthVehicles.size();
List<Organ> fifthOrgans = fourthOrgan.getOrgans();
fifthOsize = fifthOrgans.size();
if (fifthVsize > 0) {
for (VideoesBean fifthVehicle : fifthVehicles) {
countAll++;
}
}
// 第六层
if (fifthOsize > 0) {
for (Organ fifthOrgan : fifthOrgans) {
List<VideoesBean> sixthVehicles = fifthOrgan.getVideoes();
sixthVsize = sixthVehicles.size();
// List<OrgansBean> sixthOrganOrgans = fifthOrgan.getOrgans();
// sixthOsize = sixthOrganOrgans.size();
if (sixthVsize > 0) {
for (VideoesBean sixthVehicle : sixthVehicles) {
countAll++;
}
}
}
}
}
}
}
}
}
}
return countAll + "";
}
private static String initDatasTreeStrFouth(Organ organ) {
int countAll = 0;
List<VideoesBean> secondVehicles = organ.getVideoes();
secondVsize = secondVehicles.size();
List<Organ> organs = organ.getOrgans();
secondOsize = organs.size();
if (secondVsize > 0) {
for (VideoesBean secondVehicle : secondVehicles) {
countAll++;
}
}
// 第三层
if (secondOsize > 0) {
for (Organ secondOrgans : organs) {
List<VideoesBean> thirdVehicles = secondOrgans.getVideoes();
thirdVsize = thirdVehicles.size();
List<Organ> thirdOrgans = secondOrgans.getOrgans();
thirdOsize = thirdOrgans.size();
if (thirdVsize > 0) {
for (VideoesBean thirdVehicle : thirdVehicles) {
countAll++;
}
}
// 第四层
if (thirdOsize > 0) {
for (Organ thirdOrgan : thirdOrgans) {
List<VideoesBean> fourthvehicles = thirdOrgan.getVideoes();
fourthVsize = fourthvehicles.size();
List<Organ> fourthOrgans = thirdOrgan.getOrgans();
fourthOsize = fourthOrgans.size();
if (fourthVsize > 0) {
for (VideoesBean fourthvehicle : fourthvehicles) {
countAll++;
}
}
// 第五层
if (fourthOsize > 0) {
for (Organ fourthOrgan : fourthOrgans) {
List<VideoesBean> fifthVehicles = fourthOrgan.getVideoes();
fifthVsize = fifthVehicles.size();
List<Organ> fifthOrgans = fourthOrgan.getOrgans();
fifthOsize = fifthOrgans.size();
if (fifthVsize > 0) {
for (VideoesBean fifthVehicle : fifthVehicles) {
countAll++;
}
}
// 第六层
if (fifthOsize > 0) {
for (Organ fifthOrgan : fifthOrgans) {
List<VideoesBean> sixthVehicles = fifthOrgan.getVideoes();
sixthVsize = sixthVehicles.size();
List<Organ> sixthOrganOrgans = fifthOrgan.getOrgans();
sixthOsize = sixthOrganOrgans.size();
if (sixthVsize > 0) {
for (VideoesBean sixthVehicle : sixthVehicles) {
countAll++;
}
}
}
}
}
}
}
}
}
}
return countAll + "";
}
private static String initDatasTreeStrFifth(Organ organ) {
int countAll = 0;
List<VideoesBean> secondVehicles = organ.getVideoes();
secondVsize = secondVehicles.size();
List<Organ> organs = organ.getOrgans();
secondOsize = organs.size();
if (secondVsize > 0) {
for (VideoesBean secondVehicle : secondVehicles) {
countAll++;
}
}
// 第三层
if (secondOsize > 0) {
for (Organ secondOrgans : organs) {
List<VideoesBean> thirdVehicles = secondOrgans.getVideoes();
thirdVsize = thirdVehicles.size();
List<Organ> thirdOrgans = secondOrgans.getOrgans();
thirdOsize = thirdOrgans.size();
if (thirdVsize > 0) {
for (VideoesBean thirdVehicle : thirdVehicles) {
countAll++;
}
}
// 第四层
if (thirdOsize > 0) {
for (Organ thirdOrgan : thirdOrgans) {
List<VideoesBean> fourthvehicles = thirdOrgan.getVideoes();
fourthVsize = fourthvehicles.size();
List<Organ> fourthOrgans = thirdOrgan.getOrgans();
fourthOsize = fourthOrgans.size();
if (fourthVsize > 0) {
for (VideoesBean fourthvehicle : fourthvehicles) {
countAll++;
}
}
// 第五层
if (fourthOsize > 0) {
for (Organ fourthOrgan : fourthOrgans) {
List<VideoesBean> fifthVehicles = fourthOrgan.getVideoes();
fifthVsize = fifthVehicles.size();
List<Organ> fifthOrgans = fourthOrgan.getOrgans();
fifthOsize = fifthOrgans.size();
if (fifthVsize > 0) {
for (VideoesBean fifthVehicle : fifthVehicles) {
countAll++;
}
}
// 第六层
if (fifthOsize > 0) {
for (Organ fifthOrgan : fifthOrgans) {
List<VideoesBean> sixthVehicles = fifthOrgan.getVideoes();
sixthVsize = sixthVehicles.size();
List<Organ> sixthOrganOrgans = fifthOrgan.getOrgans();
sixthOsize = sixthOrganOrgans.size();
if (sixthVsize > 0) {
for (VideoesBean sixthVehicle : sixthVehicles) {
countAll++;
}
}
}
}
}
}
}
}
}
}
return countAll + "";
}
public static String getUserId(Context context) {
String userid = "";
boolean hasUserInfo = UserManage.getInstance().hasUserInfo(Global.mContext);
if (hasUserInfo) {
UserInfo userIdInfo = UserManage.getInstance().getUserIdInfo(Global.mContext);
userid = userIdInfo.getUserid();
if (TextUtils.isEmpty(userid)) {
Global.showToast(context.getResources().getString(R.string.login_again));
} else {
return userid;
}
}
return userid;
}
public static String getUserPid(Context context) {
String pid = "";
boolean hasUserInfo = UserManage.getInstance().hasUserInfo(Global.mContext);
if (hasUserInfo) {
UserInfo userIdInfo = UserManage.getInstance().getUserIdInfo(Global.mContext);
pid = userIdInfo.getPid();
if (TextUtils.isEmpty(pid)) {
Global.showToast(context.getResources().getString(R.string.login_again));
} else {
return pid;
}
}
return pid;
}
public static UserInfo getUserInfos(Context context) {
UserInfo userIdInfo = null;
boolean hasUserInfo = UserManage.getInstance().hasUserInfo(Global.mContext);
if (hasUserInfo) {
userIdInfo = UserManage.getInstance().getUserInfo(Global.mContext);
return userIdInfo;
} else {
Global.showToast(context.getResources().getString(R.string.login_again));
}
return userIdInfo;
}
}
| [
"1409318524@qq.com"
] | 1409318524@qq.com |
0e1074a465229bc228e7c0894f7639d79eae753c | 6edfebcbb2a3b1e299b8e3d2c60ff43555778d8e | /test/src/test/task1.java | 5528d6531a8cfdb92ca3a9c259f837c6960b371f | [] | no_license | BhaveshVaghasiya/JavaCode | 7cf58d564586e91d3d0cc1d3fa31b3b3302ee2f8 | 46c36b51038fbbf10abb94d6e8a964aab3524ab2 | refs/heads/master | 2023-06-30T22:56:46.045484 | 2021-08-08T09:36:14 | 2021-08-08T09:36:14 | 361,733,724 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,279 | java | package test;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class task1 {
/*
* public static void MyGETRequest() throws IOException { URL urlForGetRequest =
* new URL("https://http-hunt.thoughtworks-labs.net/challenge"); String readLine
* = null; HttpURLConnection conection = (HttpURLConnection)
* urlForGetRequest.openConnection(); conection.setRequestMethod("GET");
* conection.setRequestProperty("userId", "e_NkqYoch"); // set userId its a
* sample here int responseCode = conection.getResponseCode(); if (responseCode
* == HttpURLConnection.HTTP_OK) { BufferedReader in = new BufferedReader( new
* InputStreamReader(conection.getInputStream())); StringBuffer response = new
* StringBuffer(); while ((readLine = in .readLine()) != null) {
* response.append(readLine); } in .close(); // print result
* System.out.println("JSON String Result " + response.toString());
* //GetAndPost.POSTRequest(response.toString()); } else {
* System.out.println("GET NOT WORKED"); } } public static void main(String
* args[]) { try { MyGETRequest(); } catch (IOException e) { // TODO
* Auto-generated catch block e.printStackTrace(); } }
*/
}
| [
"bhaveshvaghasiya2894@gmail.com"
] | bhaveshvaghasiya2894@gmail.com |
0f82046f901e10e83812f123efa494fad724b6c0 | 28551a27ebed5a703139b647da6f47ee7e31b20a | /src/UserInterface/Dispenser/Admin/ManagePatientComplaintsJPanel.java | 50e79e5d28151b2355bbf358db173a775a5d2436 | [] | no_license | bue-twitter/AntiDrugCounterfeiting | a3d72e7c7ced740a8a93b8690da9415c06916ad8 | ca64def1cab01e23a2ed0ee878f282478ce09049 | refs/heads/master | 2020-05-02T13:45:23.046230 | 2014-05-19T23:14:48 | 2014-05-19T23:14:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,594 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package UserInterface.Dispenser.Admin;
import Business.Dispenser.AdverseEffectsWorkRequest;
import Business.Dispenser.DispenserEnterprise;
import Business.Network;
import Business.UserAccount;
import Business.WorkRequest;
import java.awt.CardLayout;
import java.util.ArrayList;
import javax.swing.JPanel;
import javax.swing.table.DefaultTableModel;
/**
*
* @author karanmankodi
*/
public class ManagePatientComplaintsJPanel extends javax.swing.JPanel {
private JPanel upcJPanel;
private DispenserEnterprise dispEnt;
private UserAccount ua;
Network network;
AdverseEffectsWorkRequest req;
/**
* Creates new form ManagePatientComplaintsJPanel
*/
public ManagePatientComplaintsJPanel(JPanel upcJPanel, Network network, DispenserEnterprise dispEnt, UserAccount ua) {
initComponents();
this.upcJPanel = upcJPanel;
this.dispEnt = dispEnt;
this.ua = ua;
this.network = network;
Refresh();
}
/**
* 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")
public void Refresh(){
int rowCount = complaintsJTable.getRowCount();
for (int i = rowCount - 1; i >= 0; i--) {
((DefaultTableModel) complaintsJTable.getModel()).removeRow(i);
}
ArrayList<WorkRequest> swList = dispEnt.getWorkQueue().getWorkRequestList();
for (WorkRequest wr : swList) {
if (wr instanceof AdverseEffectsWorkRequest) {
req = (AdverseEffectsWorkRequest)wr;
if ((wr.getStatus().equals(WorkRequest.Status.ReportSuspicion)) && wr.getStatus().equals(WorkRequest.Status.PrescriptionChanged)) {
break;
} else {
Object row[] = new Object[3];
row [0] = wr;
row [1] = req.getPatient();
row [2] = wr.getDrug();
((DefaultTableModel) complaintsJTable.getModel()).addRow(row);
}
}
}
}
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jScrollPane1 = new javax.swing.JScrollPane();
complaintsJTable = new javax.swing.JTable();
backJButton = new javax.swing.JButton();
complaintDetailsJButton = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
setBackground(new java.awt.Color(255, 255, 255));
complaintsJTable.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null},
{null, null, null},
{null, null, null},
{null, null, null}
},
new String [] {
"Complaint ID", "Patient", "Drug"
}
));
jScrollPane1.setViewportView(complaintsJTable);
backJButton.setText("Back");
backJButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
backJButtonActionPerformed(evt);
}
});
complaintDetailsJButton.setText("See Complaint");
complaintDetailsJButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
complaintDetailsJButtonActionPerformed(evt);
}
});
jLabel1.setText("--- PATIENT COMPLAINTS ---");
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jScrollPane1)
.add(layout.createSequentialGroup()
.add(127, 127, 127)
.add(jLabel1)
.addContainerGap())
.add(layout.createSequentialGroup()
.addContainerGap()
.add(backJButton)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(complaintDetailsJButton))
);
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(7, 7, 7)
.add(jLabel1)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
.add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 134, Short.MAX_VALUE)
.add(102, 102, 102)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(backJButton)
.add(complaintDetailsJButton)))
);
}// </editor-fold>//GEN-END:initComponents
private void backJButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_backJButtonActionPerformed
// TODO add your handling code here:
upcJPanel.remove(this);
CardLayout cardLayout = (CardLayout) upcJPanel.getLayout();
cardLayout.previous(upcJPanel);
}//GEN-LAST:event_backJButtonActionPerformed
private void complaintDetailsJButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_complaintDetailsJButtonActionPerformed
// TODO add your handling code here:
int selectedRow = complaintsJTable.getSelectedRow();
AdverseEffectsWorkRequest wr = (AdverseEffectsWorkRequest)complaintsJTable.getValueAt(selectedRow, 0);
ComplaintDetailsJPanel cdjp = new ComplaintDetailsJPanel(upcJPanel, ua, wr, network);
upcJPanel.add("Complaint Details", cdjp);
CardLayout card = (CardLayout)upcJPanel.getLayout();
card.next(upcJPanel);
}//GEN-LAST:event_complaintDetailsJButtonActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton backJButton;
private javax.swing.JButton complaintDetailsJButton;
private javax.swing.JTable complaintsJTable;
private javax.swing.JLabel jLabel1;
private javax.swing.JScrollPane jScrollPane1;
// End of variables declaration//GEN-END:variables
}
| [
"karan_k_m@yahoo.com"
] | karan_k_m@yahoo.com |
a222af3d687304284d026708c28e3047fc0be218 | d8ece358ad0ce666849244c0f70852136d6bee90 | /src/com/chinaedustar/publish/model/TreeViewQueryObject.java | bc28f4d3ac44713fc8e34f19222372c550445971 | [] | no_license | yxxcrtd/Publish | 0590b2e07a79742e03eaea02d6b9ec46b6f4cfaa | cb3bc8f480282ff1ba895c0e51058e76db6d65bc | refs/heads/master | 2020-05-31T15:20:59.186270 | 2019-06-05T08:16:23 | 2019-06-05T08:16:23 | 190,354,067 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 527 | java | package com.chinaedustar.publish.model;
/**
* 树形结构的查询语句对象。
* 保存了从树形结构的表中查询出结果的 where 与 order 子句。
* @author wangyi
*
*/
public class TreeViewQueryObject {
private String where;
private String order;
public String getOrder() {
return order;
}
public void setOrder(String order) {
this.order = order;
}
public String getWhere() {
return where;
}
public void setWhere(String where) {
this.where = where;
}
}
| [
"yxxcrtd@gmail.com"
] | yxxcrtd@gmail.com |
bfba4386f9fd439ae4663c4ddaab79991ad7f004 | fd6de0070e59501a95d29fd098dd5664e0320ac6 | /TodoApp/src/main/java/com/todo/app/controller/AppLoadController.java | fa60253d441127921a91a2906aae362dbb9e46a2 | [] | no_license | nitishsati82/openproject | bdc4d4b3cb476b871405bad6a7898e555a536f5f | 288ae92ea49b2fa95cfe70d7b4201f39f8d21ced | refs/heads/master | 2022-11-19T07:54:41.250815 | 2020-07-17T11:49:35 | 2020-07-17T11:49:35 | 270,175,309 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 423 | java | package com.todo.app.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@Controller
@RequestMapping(path = "/todoApp/")
public class AppLoadController {
@RequestMapping(value = "/", method = RequestMethod.GET)
public String goToHomePage() {
return "todoApp";
}
}
| [
"nitishsati8@gmail.com"
] | nitishsati8@gmail.com |
40920ed59e56b66f201932c04440e5ffa4b61280 | 20838b82fd1d23dff45b042efbde8e7e64bc0ba7 | /src/chapter1/node8/interfaceE9/ADAPHero.java | a005f94ec45fd44fd25ba1316636437536d67d5f | [] | no_license | ssxrs312/JavaLearning | befe46057550e2a0d91c9cd1b0b5e0cbeaba1586 | 583f93e8b031d1d8de19cdf5d854310353f01b75 | refs/heads/master | 2020-06-23T21:22:21.194105 | 2019-08-08T13:00:08 | 2019-08-08T13:00:08 | 198,755,391 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 193 | java | package chapter1.node8.interfaceE9;
public class ADAPHero extends Hero{
@Override
public void attack() {
System.out.println("进行物理攻击、进行魔法攻击");
}
}
| [
"14414286@qq.com"
] | 14414286@qq.com |
f01d051c3539ec53d3c96fb8076d430fe30f6ce4 | 98764f286fd76044242f8de2db6c4a1f9a17e073 | /java/src/forloopsexamples/ForLoop.java | 648542c2e153a981648a4564fbb35724214d0270 | [] | no_license | ankita-arch/java | 05b7ffe69d69e6a9770d094f67e58a388dc3158d | ac75adc956468093c20f0c686a56e90eecdb053d | refs/heads/master | 2022-09-08T19:21:46.828206 | 2020-05-28T20:42:13 | 2020-05-28T20:42:13 | 267,690,121 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 186 | java | package forloopsexamples;
public class ForLoop {
public static void main(String[] args) {
for(int i=0;i<=100;i=i+1) {
System.out.println("hello world" + i);
}
}
} | [
"bhagi@Ankita-PC"
] | bhagi@Ankita-PC |
e68f8ff8c378141ee1153d14da67f169a44e03dc | 86345749502d029bbd24f3d566dcb6f917d7d55d | /src/com/info/Playground.java | d4446b85425af9d8a0b090595e4f5796f39de11c | [] | no_license | ravimaha513/JavaWonders | 7ac00e0118448b42374ce4d9d03083e0b1038ebf | c58791265d7d89f0dec33751885296aa3d69cdb3 | refs/heads/master | 2022-09-07T23:46:14.530790 | 2020-05-29T00:01:32 | 2020-05-29T00:01:32 | 267,722,465 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 820 | java | package com.info;
public class Playground {
Swing swing;
Slide slide;
SeeSaw seeSaw;
//default with initialize properties
public Playground() {
this(new Swing("swing","rope"), new Slide() , new SeeSaw());
}
//
public Playground(Swing swing, Slide slide, SeeSaw seeSaw) {
this.swing = swing;
this.slide = slide;
this.seeSaw = seeSaw;
}
public Swing getSwing() {
return swing;
}
public void setSwing(Swing swing) {
this.swing = swing;
}
public Slide getSlide() {
return slide;
}
public void setSlide(Slide slide) {
this.slide = slide;
}
public SeeSaw getSeeSaw() {
return seeSaw;
}
public void setSeeSaw(SeeSaw seeSaw) {
this.seeSaw = seeSaw;
}
}
| [
"ravi_maha16@yahoo.com"
] | ravi_maha16@yahoo.com |
453785f4cbe315d2c3531b9f00727b14552e2143 | 75715daf71d7c8a7dbfba31cfc435cb71c0d874d | /app/src/main/java/com/codebosses/architecturecomponentpractice/adapter/UserAdapter.java | 650e5dfcad98829ba3f6a8cf48cc1b869a821c14 | [] | no_license | shariqansari1819/ArchitectureComponentDemo | 3aa33c926d70a744d123d212b148784962d80b4b | 35b3dcc36327b13af68b36a83fcc8de71014dcf4 | refs/heads/master | 2020-06-03T03:22:24.072093 | 2019-06-11T17:03:05 | 2019-06-11T17:03:05 | 191,414,227 | 5 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,602 | java | package com.codebosses.architecturecomponentpractice.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.databinding.DataBindingUtil;
import androidx.recyclerview.widget.RecyclerView;
import com.codebosses.architecturecomponentpractice.R;
import com.codebosses.architecturecomponentpractice.database.User;
import com.codebosses.architecturecomponentpractice.databinding.RowUsersBinding;
import java.util.ArrayList;
import java.util.List;
public class UserAdapter extends RecyclerView.Adapter<UserAdapter.UserHolder> {
private Context context;
private LayoutInflater layoutInflater;
private OnItemLongPressed onItemLongPressed;
private List<User> userList = new ArrayList<>();
public UserAdapter(Context context) {
this.context = context;
layoutInflater = LayoutInflater.from(context);
}
public void setUserList(List<User> userList) {
this.userList = userList;
notifyDataSetChanged();
}
public void setOnItemLongPressed(OnItemLongPressed onItemLongPressed) {
this.onItemLongPressed = onItemLongPressed;
}
@NonNull
@Override
public UserHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
RowUsersBinding rowUsersBinding = DataBindingUtil.inflate(layoutInflater, R.layout.row_users, parent, false);
return new UserHolder(rowUsersBinding);
}
@Override
public void onBindViewHolder(@NonNull UserHolder holder, int position) {
holder.rowUsersBinding.setUser(userList.get(position));
}
@Override
public int getItemCount() {
return userList.size();
}
public class UserHolder extends RecyclerView.ViewHolder {
RowUsersBinding rowUsersBinding;
public UserHolder(@NonNull RowUsersBinding rowUsersBinding) {
super(rowUsersBinding.getRoot());
this.rowUsersBinding = rowUsersBinding;
rowUsersBinding.getRoot().setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
if (onItemLongPressed != null) {
onItemLongPressed.onLogPressed(v, userList.get(getAdapterPosition()), getAdapterPosition());
}
return true;
}
});
}
}
public interface OnItemLongPressed {
public void onLogPressed(View view, User user, int position);
}
}
| [
"shariq@leadconcept.com"
] | shariq@leadconcept.com |
3a68dda3a28f6274a3d72552d08f41031a358e4b | fad18cbaff180e5e46947321dc414899ab35efaf | /dsw/tadsstore-spring/src/main/java/br/senac/tads4/dsw/tadsstore/controller/ProdutoController.java | 3012ff68774437dfad014a696fc2e4db360e86c8 | [
"MIT"
] | permissive | Maltasga/senac-tads | a87f5c9ee499f3ed53d2845f186f2c3ad6c5c113 | 8557b442fb95bb909293701ad287dd0e7e3e9f8f | refs/heads/master | 2021-01-01T16:54:40.996414 | 2017-11-28T15:38:18 | 2017-11-28T15:38:18 | 97,951,240 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,110 | java | package br.senac.tads4.dsw.tadsstore.controller;
import br.senac.tads4.dsw.tadsstore.common.entity.Produto;
import br.senac.tads4.dsw.tadsstore.common.service.ProdutoService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
/**
*
* @author gabriel.malta
*/
@Controller
@RequestMapping("/produto")
public class ProdutoController {
@Autowired
private ProdutoService service;// = new ProdutoServiceJPAImpl();
@RequestMapping
public ModelAndView listar() {
List<Produto> lista = service.listar(0, 100);
return new ModelAndView("produto/lista").addObject("itens", lista);
}
@RequestMapping("/{id}")
public ModelAndView obterPorId(@PathVariable("id") Long idProduto) {
Produto p = service.obter(idProduto);
return new ModelAndView("produto/detalhe").addObject("produto", p);
}
}
| [
"gmalta44@gmail.com"
] | gmalta44@gmail.com |
2ca6182af9f7096ce0b1eb9b1c5a72d2d1ca2305 | a5d8918d6b9748f55b01a0ff4b9afac96420825e | /src/main/java/com/example/service/RoleCrudRepository.java | ddb1703301048ffa62b6694b741576d214f09b72 | [] | no_license | maniram-yadav/spring-security-session-authentication | 778ea5323f16a2227bfb7f99d613d9a1cc751276 | e10d4f3b280403f95fa54eb69d6c1a95cca75d41 | refs/heads/master | 2020-08-01T03:30:32.562794 | 2019-10-02T05:39:48 | 2019-10-02T05:39:48 | 210,846,122 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 379 | java | package com.example.service;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import com.example.model.Roles;
import com.example.model.Users;
@Repository
public interface RoleCrudRepository extends CrudRepository<Roles, Integer> {
public Users findByRole(String role);
public Users findByRoleId(Integer roleId);
}
| [
"maniram.yadav@glaucuslogistics.com"
] | maniram.yadav@glaucuslogistics.com |
2bc23e9eac7ad9cd3578c26ed274905ec8b437a0 | 172e0c689dbb899774466dcce7bc553bee28b6f8 | /services/rest/src/main/java/mil/nga/giat/geowave/service/rest/operations/AddSpatialIndexCommand.java | f823db299646a5a6b5275cdea08717a54564d1b7 | [
"Apache-2.0",
"LicenseRef-scancode-free-unknown",
"LicenseRef-scancode-public-domain"
] | permissive | sam-radiant/geowave | c57bb9bb1ad435a648a3caec2cbcf3ea886116a9 | d94a56078294de9e3082e3b3ff2bf5dfc68d1b8c | refs/heads/master | 2021-04-26T22:29:21.630552 | 2018-05-16T19:51:40 | 2018-05-16T19:51:40 | 124,101,125 | 0 | 0 | Apache-2.0 | 2018-05-16T19:51:41 | 2018-03-06T15:49:00 | Java | UTF-8 | Java | false | false | 5,482 | java | /*******************************************************************************
* Copyright (c) 2013-2017 Contributors to the Eclipse Foundation
*
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Apache License,
* Version 2.0 which accompanies this distribution and is available at
* http://www.apache.org/licenses/LICENSE-2.0.txt
******************************************************************************/
package mil.nga.giat.geowave.service.rest.operations;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import com.beust.jcommander.Parameter;
import com.beust.jcommander.ParameterException;
import com.beust.jcommander.Parameters;
import com.beust.jcommander.ParametersDelegate;
import mil.nga.giat.geowave.core.cli.api.OperationParams;
import mil.nga.giat.geowave.core.cli.api.ServiceEnabledCommand;
import mil.nga.giat.geowave.core.cli.api.ServiceStatus;
import mil.nga.giat.geowave.core.cli.operations.config.ConfigSection;
import mil.nga.giat.geowave.core.cli.operations.config.options.ConfigOptions;
import mil.nga.giat.geowave.core.geotime.ingest.SpatialOptions;
import mil.nga.giat.geowave.core.store.cli.remote.options.IndexPluginOptions;
import mil.nga.giat.geowave.core.store.operations.remote.options.BasicIndexOptions;
@Parameters(commandDescription = "Configure an index for usage in GeoWave")
public class AddSpatialIndexCommand extends
ServiceEnabledCommand<String>
{
/**
* A REST Operation for the AddIndexCommand where --type=spatial
*/
@Parameter(description = "<name>", required = true)
private List<String> parameters = new ArrayList<String>();
@Parameter(names = {
"-d",
"--default"
}, description = "Make this the default index creating stores")
private Boolean makeDefault;
private ServiceStatus status = ServiceStatus.OK;
@ParametersDelegate
private final BasicIndexOptions basicIndexOptions = new BasicIndexOptions();
private IndexPluginOptions pluginOptions = new IndexPluginOptions();
@ParametersDelegate
SpatialOptions opts = new SpatialOptions();
@Override
public boolean prepare(
final OperationParams params ) {
pluginOptions.selectPlugin("spatial");
pluginOptions.setBasicIndexOptions(basicIndexOptions);
pluginOptions.setDimensionalityTypeOptions(opts);
return true;
}
@Override
public void execute(
final OperationParams params ) {
computeResults(params);
}
@Override
public String getId() {
return ConfigSection.class.getName() + ".addindex/spatial";
}
@Override
public String getPath() {
return "v0/config/addindex/spatial";
}
public IndexPluginOptions getPluginOptions() {
return pluginOptions;
}
public String getPluginName() {
return parameters.get(0);
}
public String getNamespace() {
return IndexPluginOptions.getIndexNamespace(getPluginName());
}
public List<String> getParameters() {
return parameters;
}
public void setParameters(
final String indexName ) {
parameters = new ArrayList<String>();
parameters.add(indexName);
}
public Boolean getMakeDefault() {
return makeDefault;
}
public void setMakeDefault(
final Boolean makeDefault ) {
this.makeDefault = makeDefault;
}
public String getType() {
return "spatial";
}
public void setPluginOptions(
final IndexPluginOptions pluginOptions ) {
this.pluginOptions = pluginOptions;
}
public ServiceStatus getStatus() {
return status;
}
public void setStatus(
ServiceStatus status ) {
this.status = status;
}
@Override
public Pair<ServiceStatus, String> executeService(
OperationParams params )
throws Exception {
String ret = computeResults(params);
return ImmutablePair.of(
status,
ret);
}
@Override
public String computeResults(
final OperationParams params ) {
// Ensure that a name is chosen.
if (getParameters().size() < 1) {
System.out.println(getParameters());
throw new ParameterException(
"Must specify index name");
}
if (getType() == null) {
throw new ParameterException(
"No type could be infered");
}
final File propFile = getGeoWaveConfigFile(params);
final Properties existingProps = ConfigOptions.loadProperties(propFile);
// Make sure we're not already in the index.
final IndexPluginOptions existPlugin = new IndexPluginOptions();
if (existPlugin.load(
existingProps,
getNamespace())) {
setStatus(ServiceStatus.DUPLICATE);
return "That index already exists: " + getPluginName();
}
pluginOptions.save(
existingProps,
getNamespace());
// Make default?
if (Boolean.TRUE.equals(makeDefault)) {
existingProps.setProperty(
IndexPluginOptions.DEFAULT_PROPERTY_NAMESPACE,
getPluginName());
}
// Write properties file
ConfigOptions.writeProperties(
propFile,
existingProps);
StringBuilder builder = new StringBuilder();
for (Object key : existingProps.keySet()) {
String[] split = key.toString().split(
"\\.");
if (split.length > 1) {
if (split[1].equals(parameters.get(0))) {
builder.append(key.toString() + "=" + existingProps.getProperty(key.toString()) + "\n");
}
}
}
setStatus(ServiceStatus.OK);
return builder.toString();
}
}
| [
"rfecher@gmail.com"
] | rfecher@gmail.com |
e6dad9fee75a26f3a879cfb98d81abcdad0435a9 | 358c2a900a616c22ff1d36ed233907c82e1ee605 | /Achei_Classificados/app/src/test/java/br/com/acheiclassificados/achei_classificados/ExampleUnitTest.java | 210814ab7f697485f1837efe3d7315ecd2cfe067 | [] | no_license | guilhermedourado/Achei_Classificados | 2c41989736a90f1df5e611d26ea5d853a54bbb8a | cd5cc1c1d79f1d75ceb84187db715832be950528 | refs/heads/master | 2020-03-08T10:54:11.339083 | 2018-04-04T18:32:31 | 2018-04-04T18:32:31 | 128,084,525 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 423 | java | package br.com.acheiclassificados.achei_classificados;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"guilhermedourado96@hotmail.com"
] | guilhermedourado96@hotmail.com |
96f9c5e2397b2c0ba13a6ceb672afc84066204a8 | 1f1e225dece97ab5c8acbf549fa817a6a07d1ffc | /src/test/java/testscripts/ShoppingSiteOld.java | 20f2827265253878a47ab255622ab4e0ef7f372e | [] | no_license | nkgn/ShoppingSite | 789fb437b2e9396f5bf52a7d4d4465bf13770810 | 53ed7054487c74dce4c2566078c9bbed5f9359e5 | refs/heads/master | 2020-03-16T23:30:19.406017 | 2018-05-15T05:42:08 | 2018-05-15T05:42:08 | 133,080,288 | 0 | 0 | null | 2018-05-15T05:42:09 | 2018-05-11T19:25:42 | null | UTF-8 | Java | false | false | 2,557 | java | package testscripts;
import java.io.File;
import java.util.Properties;
import java.util.concurrent.TimeUnit;
import org.apache.commons.io.FileUtils;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.Assert;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Parameters;
import pageResources.HelperClass;
import pages.CustomerDetailsPage;
import pages.HomePage;
import pages.LoginPage;
public class ShoppingSiteOld {
private WebDriver driver;
HomePage homePage;
LoginPage loginPage ;
CustomerDetailsPage custDetails;
//String baseURL ; // = "http://ecommerce.saipratap.net/index.php" ;
String baseURL = "http://ecommerce.saipratap.net/index.php" ;
Properties properties;
@BeforeSuite
public void setUp() throws InterruptedException {
System.setProperty("webdriver.chrome.driver", "drivers/chromedriver.exe");
driver = new ChromeDriver();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(3, TimeUnit.MILLISECONDS);
//baseURL = loadPropertiesFile();
driver.get(baseURL);
Thread.sleep(2000);
Assert.assertEquals(driver.getCurrentUrl(),baseURL);
//System.out.println(driver.getCurrentUrl());
HelperClass.driver = driver;
homePage = new HomePage(driver);
loginPage = new LoginPage(driver);
custDetails = new CustomerDetailsPage(driver);
}
/**
* This function will execute before each Test tag in testng.xml
* @param browser
* @throws Exception
*/
/* This function will take screenshot
* @param webdriver
* @param fileWithPath
* @throws Exception
*/
public static void takeSnapShot(WebDriver webdriver,String fileWithPath) throws Exception{
//Convert web driver object to TakeScreenshot
TakesScreenshot scrShot =((TakesScreenshot)webdriver);
//Call getScreenshotAs method to create image file
File SrcFile=scrShot.getScreenshotAs(OutputType.FILE);
//Move image file to new destination
File DestFile=new File(fileWithPath);
//Copy file at destination
FileUtils.copyFile(SrcFile, DestFile);
}
@AfterSuite
public void cleanUp() {
driver.close();
driver.quit();
}
}
| [
"n_kgn@yahoo.com"
] | n_kgn@yahoo.com |
b67c280f9c86a27f4056884b22c6efe9724cb26b | baba7ae4f32f0e680f084effcd658890183e7710 | /MutationFramework/muJava/muJavaMutantStructure/Persistence/TobiasSamples/Debug2/int_maxElement(int)/COI_6/Debug2.java | e69770dc0ba08efe4f76e1a22eba12f83758b12b | [
"Apache-2.0"
] | permissive | TUBS-ISF/MutationAnalysisForDBC-FormaliSE21 | 75972c823c3c358494d2a2e9ec12e0a00e26d771 | de825bc9e743db851f5ec1c5133dca3f04d20bad | refs/heads/main | 2023-04-22T21:29:28.165271 | 2021-05-17T07:43:22 | 2021-05-17T07:43:22 | 368,096,901 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,789 | java | // This is a mutant program.
// Author : ysma
public class Debug2
{
/*@
@ normal_behavior
@ requires true;
@ ensures \result>=0 ==> a[\result]==x;
@*/
public static int linearSearch( int[] a, int x )
{
int i = a.length - 1;
/*@ loop_invariant !(\exists int q; q >= i+1 && q < a.length; a[q]==x) && i>=-1 && i<a.length;
@ decreases i+1;
@*/
while (i >= 0 && a[i] != x) {
i = i - 1;
}
return i;
}
/*@
@ normal_behavior
@ requires A.length > 0;
@ ensures (\forall int q; q >= 0 & q < A.length; A[\result]>=A[q]);
@*/
public static int maxElement( int[] A )
{
int i = 0;
int j = 1;
/*@ loop_invariant (\forall int q; q >= 0 && q < j; A[i]>=A[q]) && i>=0 && i<A.length && j>0 && j<=A.length;
@ decreases A.length - j;
@*/
while (j != A.length) {
if (A[j] > A[i]) {
i = j;
} else {
if (!(A[j] <= A[i])) {
;
}
}
j = j + 1;
}
return i;
}
/*@
@ normal_behavior
@ requires n >= 0 && n<6;
@ ensures \result==Helper.factorial(n);
@*/
public static int fac( int n )
{
int f = 0;
if (n == 0) {
f = 1;
} else {
if (n == 1) {
f = 1;
} else {
if (n >= 2) {
int tmp = n - 1;
f = n * Helper.factorial( tmp );
}
}
}
return f;
}
/*@
@ normal_behavior
@ requires A.length > 0 && (\forall int i; i>=0 & i<A.length; A[i] == 0 || A[i] == 1 || A[i] == 2);
@ ensures (\forall int q; q >= 1 && q < \result.length; \result[q-1]<=\result[q]);
@*/
public static int[] DutchFlag( int[] A )
{
int wb = 0;
int wt = 0;
int bb = A.length;
/*@ loop_invariant (\forall int i; i>=0 & i<A.length; A[i] == 0 || A[i] == 1 || A[i] == 2) && (\forall int q; q >= 0 && q < wb; A[q]==0) && (\forall int q; q >= wb && q < wt; A[q]==1) && (\forall int q; q >= bb && q < A.length; A[q]==2) && 0<=wb && wb<=wt && wt<=bb && bb<=A.length;
@ decreases bb-wt;
@*/
while (wt != bb) {
if (A[wt] == 0) {
int t = A[wt];
A[wt] = A[wb];
A[wb] = t;
wt = wt + 1;
wb = wb + 1;
} else {
if (A[wt] == 1) {
wt = wt + 1;
} else {
if (A[wt] == 2) {
int t = A[wt];
A[wt] = A[bb - 1];
A[bb - 1] = t;
bb = bb - 1;
}
}
}
}
return A;
}
}
| [
"a.knueppel@tu-bs.de"
] | a.knueppel@tu-bs.de |
0fae5ce68a782bb1642fa814f8ad374d1d140e31 | d22c55956541b1067c0d169d2dd051e4cbbf0d1e | /src/main/java/org/o7planning/freemarker/controller/MainController.java | ea46abb48eb96c4bc53eaecbd10e349787828565 | [] | no_license | Marwenjf/Spring-Boot-et-FreeMaker | 5b70f6f6952d981c6689e838e626698d0e6e8039 | b8ddab387424e2936679886a36bf9e876c36d550 | refs/heads/master | 2021-05-05T09:31:34.549406 | 2018-01-17T19:35:46 | 2018-01-17T19:35:46 | 117,883,057 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,313 | java | package org.o7planning.freemarker.controller;
import java.util.ArrayList;
import java.util.List;
import org.o7planning.freemarker.form.PersonForm;
import org.o7planning.freemarker.model.Person;
import org.springframework.beans.factory.annotation.Value;
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.RequestMethod;
@Controller
public class MainController {
private static List<Person> persons = new ArrayList<Person>();
static {
persons.add(new Person("Bill", "Gates"));
persons.add(new Person("Steve", "Jobs"));
}
// Injectez (inject) de l'application.properties.
@Value("${welcome.message}")
private String message;
@Value("${error.message}")
private String errorMessage;
@RequestMapping(value = { "/", "/index" }, method = RequestMethod.GET)
public String index(Model model) {
model.addAttribute("message", message);
return "index";
}
@RequestMapping(value = { "/personList" }, method = RequestMethod.GET)
public String personList(Model model) {
model.addAttribute("persons", persons);
return "personList";
}
@RequestMapping(value = { "/addPerson" }, method = RequestMethod.GET)
public String addPersonForm(Model model) {
PersonForm personForm = new PersonForm();
model.addAttribute("personForm", personForm);
return "addPerson";
}
@RequestMapping(value = { "/addPerson" }, method = RequestMethod.POST)
public String addPersonSave(Model model, @ModelAttribute("personForm") PersonForm personForm) {
String firstName = personForm.getFirstName();
String lastName = personForm.getLastName();
if (firstName != null && firstName.length() > 0
&& lastName != null && lastName.length() > 0) {
Person newPerson = new Person(firstName, lastName);
persons.add(newPerson);
return "redirect:/personList";
}
String error = "First Name & Last Name is required!";
model.addAttribute("errorMessage", error);
return "addPerson";
}
}
| [
"marwenjaffel@gmail.com"
] | marwenjaffel@gmail.com |
0833c3274133a25d52398bd61922fe929622f7f1 | 16e440bd22fa0f489056d6f854b19df2a024bc58 | /library-Support/src/main/java/com/zxning/library/ui/views/NestRadioGroup.java | 44901a41e0f2c24b29d72c5b1b04382f4a403e9b | [] | no_license | AsaLynn/MyBox | 0e49d357e2a47abbeb0da0645189a9facd7183fe | e9dde7d2f1bd7c8ce5d5d6f58fd62847854d354d | refs/heads/master | 2022-04-12T17:08:56.122381 | 2020-03-12T06:30:06 | 2020-03-12T06:30:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,171 | java | package com.zxning.library.ui.views;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.TypedArray;
import android.os.Build;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CompoundButton;
import android.widget.LinearLayout;
/**
* 支持嵌套CompoundButton和ViewGroup的NestRadioGroup
* @author 农民伯伯 http://www.cnblogs.com/over140/
*/
public class NestRadioGroup extends LinearLayout {
// holds the checked id; the selection is empty by default
//选中的id,默认选择是空的
private int mCheckedId = -1;
// tracks children radio buttons checked state
//子控件的选中监听器
private CompoundButton.OnCheckedChangeListener mChildOnCheckedChangeListener;
// when true, mOnCheckedChangeListener discards events
//当变量为true时,moncheckedchangelistener不相应事件
private boolean mProtectFromCheckedChange = false;
//子控件选中变化监听.
private OnCheckedChangeListener mOnCheckedChangeListener;
//子控件增加减少变化监听.
private PassThroughHierarchyChangeListener mPassThroughListener;
//代码中使用的构造函数.
public NestRadioGroup(Context context) {
super(context);
init();
}
//xml布局中使用的构造函数.
public NestRadioGroup(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
//初始化监听器,以及设置子控件变化监听.
private void init() {
mCheckedId = View.NO_ID;
setOrientation(HORIZONTAL);
mChildOnCheckedChangeListener = new CheckedStateTracker();
mPassThroughListener = new PassThroughHierarchyChangeListener();
super.setOnHierarchyChangeListener(mPassThroughListener);
}
/**
* 设置子控件增加或删除监听.
*/
@Override
public void setOnHierarchyChangeListener(OnHierarchyChangeListener listener) {
// the user listener is delegated to our pass-through listener
mPassThroughListener.mOnHierarchyChangeListener = listener;
}
/**
* xml转化成view完成后的回调.
*/
@Override
protected void onFinishInflate() {
super.onFinishInflate();
// checks the appropriate radio button as requested in the XML file
//在xml文件中按要求检查适当的radio button
if (mCheckedId != View.NO_ID) {
mProtectFromCheckedChange = true;
setCheckedStateForView(mCheckedId, true);
mProtectFromCheckedChange = false;
setCheckedId(mCheckedId);
}
}
/** 递归查找具有选中属性的子控件 */
private static CompoundButton findCheckedView(View child) {
if (child instanceof CompoundButton)
return (CompoundButton) child;
if (child instanceof ViewGroup) {
ViewGroup group = (ViewGroup) child;
for (int i = 0, j = group.getChildCount(); i < j; i++) {
CompoundButton check = findCheckedView(group.getChildAt(i));
if (check != null)
return check;
}
}
return null;// 没有找到
}
@Override
public void addView(View child, int index, ViewGroup.LayoutParams params) {
final CompoundButton view = findCheckedView(child);
if (view != null) {
if (view.isChecked()) {
mProtectFromCheckedChange = true;
if (mCheckedId != -1) {
setCheckedStateForView(mCheckedId, false);
}
mProtectFromCheckedChange = false;
setCheckedId(view.getId());
}
}
super.addView(child, index, params);
}
/**
* <p>
* Sets the selection to the radio button whose identifier is passed in
* parameter. Using -1 as the selection identifier clears the selection;
* such an operation is equivalent to invoking {@link #clearCheck()}.
* 根据id设置选中radio button
* </p>
*
* @param id
* the unique id of the radio button to select in this group
*
* @see #getCheckedRadioButtonId()
* @see #clearCheck()
*/
public void check(int id) {
// don't even bother
if (id != -1 && (id == mCheckedId)) {
return;
}
if (mCheckedId != -1) {
setCheckedStateForView(mCheckedId, false);
}
if (id != -1) {
setCheckedStateForView(id, true);
}
setCheckedId(id);
}
//设置选中的id,相应变化监听.
private void setCheckedId(int id) {
mCheckedId = id;
if (mOnCheckedChangeListener != null) {
mOnCheckedChangeListener.onCheckedChanged(this, mCheckedId);
}
}
//设置CompoundButton的选中状态.
private void setCheckedStateForView(int viewId, boolean checked) {
View checkedView = findViewById(viewId);
if (checkedView != null && checkedView instanceof CompoundButton) {
((CompoundButton) checkedView).setChecked(checked);
}
}
/**
* <p>
* Returns the identifier of the selected radio button in this group. Upon
* empty selection, the returned value is -1.
* 获取选中的radiobutton的id.
* </p>
*
* @return the unique id of the selected radio button in this group
*
* @see #check(int)
* @see #clearCheck()
*
* @attr ref android.R.styleable#NestRadioGroup_checkedButton
*/
public int getCheckedRadioButtonId() {
return mCheckedId;
}
/**
* <p>
* Clears the selection. When the selection is cleared, no radio button in
* this group is selected and {@link #getCheckedRadioButtonId()} returns
* null.
* 清空所有radiobutton的选中状态.
* </p>
*
* @see #check(int)
* @see #getCheckedRadioButtonId()
*/
public void clearCheck() {
check(-1);
}
/**
* <p>
* Register a callback to be invoked when the checked radio button changes
* in this group.
* 设置radiobutton的选中变化监听.
* </p>
*
* @param listener
* the callback to call on checked state change
*/
public void setOnCheckedChangeListener(OnCheckedChangeListener listener) {
mOnCheckedChangeListener = listener;
}
/**
* {产生布局参数.
*/
@Override
public LayoutParams generateLayoutParams(AttributeSet attrs) {
return new LayoutParams(getContext(), attrs);
}
/**
* 检验布局参数.
*/
@Override
protected boolean checkLayoutParams(ViewGroup.LayoutParams p) {
return p instanceof LayoutParams;
}
//产生默认布局参数.
@Override
protected LinearLayout.LayoutParams generateDefaultLayoutParams() {
return new LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT);
}
/**
* <p>
* This set of layout parameters defaults the width and the height of the
* children to {@link #WRAP_CONTENT} when they are not specified in the XML
* file. Otherwise, this class ussed the value read from the XML file.
* </p>
*
* 布局参数的抽象描述.
*
*/
public static class LayoutParams extends LinearLayout.LayoutParams {
/**
* {@inheritDoc}
*/
public LayoutParams(Context c, AttributeSet attrs) {
super(c, attrs);
}
/**
* {@inheritDoc}
*/
public LayoutParams(int w, int h) {
super(w, h);
}
/**
* {@inheritDoc}
*/
public LayoutParams(int w, int h, float initWeight) {
super(w, h, initWeight);
}
/**
* {@inheritDoc}
*/
public LayoutParams(ViewGroup.LayoutParams p) {
super(p);
}
/**
* {@inheritDoc}
*/
public LayoutParams(MarginLayoutParams source) {
super(source);
}
/**
* <p>
* Fixes the child's width to
* {@link ViewGroup.LayoutParams#WRAP_CONTENT} and the
* child's height to
* {@link ViewGroup.LayoutParams#WRAP_CONTENT} when not
* specified in the XML file.
* </p>
*
* @param a
* the styled attributes set
* @param widthAttr
* the width attribute to fetch
* @param heightAttr
* the height attribute to fetch
*/
@Override
protected void setBaseAttributes(TypedArray a, int widthAttr,
int heightAttr) {
if (a.hasValue(widthAttr)) {
width = a.getLayoutDimension(widthAttr, "layout_width");
} else {
width = WRAP_CONTENT;
}
if (a.hasValue(heightAttr)) {
height = a.getLayoutDimension(heightAttr, "layout_height");
} else {
height = WRAP_CONTENT;
}
}
}
/**
* <p>
* Interface definition for a callback to be invoked when the checked radio
* changed in this group.
* 一个回调函数的接口定义,当被选中的radiobutton改变的时候回调函数.
*
* </p>
*/
public interface OnCheckedChangeListener {
/**
* <p>
* Called when the checked radio button has changed. When the selection
* is cleared, checkedId is -1.
* 当被选中的radiobutton发生变化回调该函数.当没有任何选中,选中的id就是-1.
* </p>
*
* @param group
* the group in which the checked radio button has changed
* 已更改了选中radiobutton的父控件.
* @param checkedId
* the unique identifier of the newly checked radio button
* 最新选中的radiobutton的id.
*/
public void onCheckedChanged(NestRadioGroup group, int checkedId);
}
//选中监听描述.
private class CheckedStateTracker implements
CompoundButton.OnCheckedChangeListener {
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
// prevents from infinite recursion
//防止无限递归
if (mProtectFromCheckedChange) {
return;
}
mProtectFromCheckedChange = true;
if (mCheckedId != -1) {
setCheckedStateForView(mCheckedId, false);
}
mProtectFromCheckedChange = false;
int id = buttonView.getId();
setCheckedId(id);
}
}
/**
* <p>
* A pass-through listener acts upon the events and dispatches them to
* another listener. This allows the table layout to set its own internal
* hierarchy change listener without preventing the user to setup his.
* 行为事件监听和分配给其他监听器的事件。这允许表布局来设置它自己的内部
*层次结构变化的侦听器,而不妨碍用户设置
* 实现该回调接口,当view中的层次结构变化的时候进行回调.
* 每当一个子控件从该控件增加或删除的时候,结构发生变化
* </p>
*/
private class PassThroughHierarchyChangeListener implements
OnHierarchyChangeListener {
private OnHierarchyChangeListener mOnHierarchyChangeListener;
/**
* {@inheritDoc}
*/
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
public void onChildViewAdded(View parent, View child) {
if (parent == NestRadioGroup.this) {
CompoundButton view = findCheckedView(child);// 查找子控件
if (view != null) {
int id = view.getId();
// generates an id if it's missing
if (id == View.NO_ID
&& Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
id = View.generateViewId();
view.setId(id);
}
view.setOnCheckedChangeListener(mChildOnCheckedChangeListener);
}
}
if (mOnHierarchyChangeListener != null) {
mOnHierarchyChangeListener.onChildViewAdded(parent, child);
}
}
/**
* {@inheritDoc}
*/
public void onChildViewRemoved(View parent, View child) {
if (parent == NestRadioGroup.this) {
CompoundButton view = findCheckedView(child);// 查找子控件
if (view != null) {
view.setOnCheckedChangeListener(null);
}
}
if (mOnHierarchyChangeListener != null) {
mOnHierarchyChangeListener.onChildViewRemoved(parent, child);
}
}
}
} | [
"zhang721588@163.com"
] | zhang721588@163.com |
1ba8cd15fc00c35ffda667a2d50b00a9cedddb34 | 5f1d7c935a0493044d046c1c4ec35f0bb6460bef | /src/module/ObservePattern/DisplayElement.java | 716b4e6a06f241acc49f7bd0e5f8094a75a139c5 | [] | no_license | Nnnnnnnnnical/headFirstDesign | 10c48c7c8b3d2674a24c16a6b7b55b08b4c40ea0 | 25fb6816a96bced99ccdc121a91e302880f8d674 | refs/heads/master | 2020-04-06T14:54:23.517029 | 2018-11-26T07:31:40 | 2018-11-26T07:31:40 | 157,558,682 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 95 | java | package module.ObservePattern;
public interface DisplayElement {
public void display();
}
| [
"1121176110@qq.com"
] | 1121176110@qq.com |
c8b864feefff3a5178f248b573a8c03d5f39b86f | 76a1dc1deabf5a959f4c6ea4225406894fa65444 | /app/src/main/java/com/example/android/bakingtime/database/RecipeDao.java | 8c04281a340d561fa98ed329af0d22d10bf4a423 | [] | no_license | megaalpha200/Baking_Time | 66f22831763b4c66c1de7312cbbe106b1308a681 | a9359a304d3790d7baad7e0b634bcaab878585c5 | refs/heads/master | 2020-03-24T02:38:33.565056 | 2018-07-29T00:31:54 | 2018-07-29T00:31:54 | 142,384,709 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 938 | java | package com.example.android.bakingtime.database;
import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Delete;
import android.arch.persistence.room.Insert;
import android.arch.persistence.room.OnConflictStrategy;
import android.arch.persistence.room.Query;
import android.arch.persistence.room.Update;
import com.example.android.bakingtime.models.Recipe;
import java.util.List;
@Dao
public interface RecipeDao {
@Query("SELECT * FROM recipe")
List<Recipe> loadAllRecipes();
@Insert(onConflict = OnConflictStrategy.REPLACE)
void insertRecipe(Recipe recipe);
@Update(onConflict = OnConflictStrategy.REPLACE)
void updateRecipe(Recipe recipe);
@Query("DELETE FROM recipe WHERE id=:recipeId")
void deleteRecipeBasedOnRecipeId(int recipeId);
@Delete
void deleteRecipe(Recipe recipe);
@Query("SELECT * FROM recipe WHERE id=:id")
Recipe loadRecipeById(int id);
}
| [
"megaalpha200@gmail.com"
] | megaalpha200@gmail.com |
21a16ff5e94f207c5acc5d4178243d3684514ea2 | 6a1e9af856c6e35aab6c2ab5127592ddc212c0b3 | /Product/src/main/java/com/stayoh/hospitality/gateway/order/OrderGatewaySql.java | 6b3eeb0e331c24bc70ef28c84eeac77fd04a21dc | [] | no_license | Akash-Pradhaan/Orders | 47233677a8cd27e01decc05a99517f6733b60bfd | cf40d02e8dccd9d4f649ce148e90ecd33a1b665b | refs/heads/master | 2020-05-17T06:44:39.242724 | 2019-04-26T05:57:06 | 2019-04-26T05:57:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 804 | java | package com.stayoh.hospitality.gateway.order;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.stayoh.hospitality.entity.Order;
import com.stayoh.hospitality.repository.OrderRepository;
@Service
public class OrderGatewaySql implements OrderGateway{
@Autowired
private OrderRepository repository;
@Override
public Order save(Order order) {
return repository.save(order);
}
@Override
public Order find(Integer oid) {
return repository.findById(oid).orElse(null);
}
@Override
public List<Order> findAll() {
return repository.findAll();
}
@Override
public Integer delete(Integer oid) {
try {
repository.deleteById(oid);
}catch(Exception e) {
return 0;
}
return 1;
}
}
| [
"akashpradhan5500@gmail.com"
] | akashpradhan5500@gmail.com |
5180cfb94cca2647bd18422be2a7957694343db0 | d1195c8554762cba6a7a5aaa801ca25b31080858 | /src/main/java/com/poly/controller/ShoppingCartController.java | 52b3b8b9e128f7625fc30f67e019924fcc459903 | [] | no_license | GoalShop/GoalShop-1 | b8b556a7e1678d4a0f1866b8448e3e0ce7b47a79 | 643e0da373061cd42f60db3624e8bda5821fbad1 | refs/heads/main | 2023-08-19T19:17:41.616706 | 2021-10-30T08:07:36 | 2021-10-30T08:07:36 | 413,252,706 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 280 | java | package com.poly.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class ShoppingCartController {
@RequestMapping("/cart/view")
public String cart() {
return "cart/view";
}
}
| [
"91859987+GoalShop@users.noreply.github.com"
] | 91859987+GoalShop@users.noreply.github.com |
ff5c2840c6120755ebe2632903830c9d4db837a1 | 134b9e0aa79d083dec81ddfe1df00a516c1f1d18 | /src/test/java/com/sistemaspadrao/crud/web/rest/TestUtil.java | 0cff1f150fcaf8de8665c6215f8f6aa2c4e34818 | [] | no_license | rafaelluciodeveloper/crudjhipster | d1b03fff945cd58b17e1ce3fe60832611c822a6a | 0300a636f4cfa31de6bb9e2adddb0d37c8d66708 | refs/heads/master | 2020-03-20T22:24:11.173903 | 2018-06-18T19:23:39 | 2018-06-18T19:23:39 | 137,796,577 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,189 | java | package com.sistemaspadrao.crud.web.rest;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import org.hamcrest.Description;
import org.hamcrest.TypeSafeDiagnosingMatcher;
import org.springframework.format.datetime.standard.DateTimeFormatterRegistrar;
import org.springframework.format.support.DefaultFormattingConversionService;
import org.springframework.format.support.FormattingConversionService;
import org.springframework.http.MediaType;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.time.ZonedDateTime;
import java.time.format.DateTimeParseException;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Utility class for testing REST controllers.
*/
public class TestUtil {
/** MediaType for JSON UTF8 */
public static final MediaType APPLICATION_JSON_UTF8 = new MediaType(
MediaType.APPLICATION_JSON.getType(),
MediaType.APPLICATION_JSON.getSubtype(), StandardCharsets.UTF_8);
/**
* Convert an object to JSON byte array.
*
* @param object
* the object to convert
* @return the JSON byte array
* @throws IOException
*/
public static byte[] convertObjectToJsonBytes(Object object)
throws IOException {
ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
JavaTimeModule module = new JavaTimeModule();
mapper.registerModule(module);
return mapper.writeValueAsBytes(object);
}
/**
* Create a byte array with a specific size filled with specified data.
*
* @param size the size of the byte array
* @param data the data to put in the byte array
* @return the JSON byte array
*/
public static byte[] createByteArray(int size, String data) {
byte[] byteArray = new byte[size];
for (int i = 0; i < size; i++) {
byteArray[i] = Byte.parseByte(data, 2);
}
return byteArray;
}
/**
* A matcher that tests that the examined string represents the same instant as the reference datetime.
*/
public static class ZonedDateTimeMatcher extends TypeSafeDiagnosingMatcher<String> {
private final ZonedDateTime date;
public ZonedDateTimeMatcher(ZonedDateTime date) {
this.date = date;
}
@Override
protected boolean matchesSafely(String item, Description mismatchDescription) {
try {
if (!date.isEqual(ZonedDateTime.parse(item))) {
mismatchDescription.appendText("was ").appendValue(item);
return false;
}
return true;
} catch (DateTimeParseException e) {
mismatchDescription.appendText("was ").appendValue(item)
.appendText(", which could not be parsed as a ZonedDateTime");
return false;
}
}
@Override
public void describeTo(Description description) {
description.appendText("a String representing the same Instant as ").appendValue(date);
}
}
/**
* Creates a matcher that matches when the examined string reprensents the same instant as the reference datetime
* @param date the reference datetime against which the examined string is checked
*/
public static ZonedDateTimeMatcher sameInstant(ZonedDateTime date) {
return new ZonedDateTimeMatcher(date);
}
/**
* Verifies the equals/hashcode contract on the domain object.
*/
@SuppressWarnings("unchecked")
public static void equalsVerifier(Class clazz) throws Exception {
Object domainObject1 = clazz.getConstructor().newInstance();
assertThat(domainObject1.toString()).isNotNull();
assertThat(domainObject1).isEqualTo(domainObject1);
assertThat(domainObject1.hashCode()).isEqualTo(domainObject1.hashCode());
// Test with an instance of another class
Object testOtherObject = new Object();
assertThat(domainObject1).isNotEqualTo(testOtherObject);
assertThat(domainObject1).isNotEqualTo(null);
// Test with an instance of the same class
Object domainObject2 = clazz.getConstructor().newInstance();
assertThat(domainObject1).isNotEqualTo(domainObject2);
// HashCodes are equals because the objects are not persisted yet
assertThat(domainObject1.hashCode()).isEqualTo(domainObject2.hashCode());
}
/**
* Create a FormattingConversionService which use ISO date format, instead of the localized one.
* @return the FormattingConversionService
*/
public static FormattingConversionService createFormattingConversionService() {
DefaultFormattingConversionService dfcs = new DefaultFormattingConversionService ();
DateTimeFormatterRegistrar registrar = new DateTimeFormatterRegistrar();
registrar.setUseIsoFormat(true);
registrar.registerFormatters(dfcs);
return dfcs;
}
}
| [
"jhipster-bot@users.noreply.github.com"
] | jhipster-bot@users.noreply.github.com |
7e08fd2ffa6177d81f70ababba22ce834ec4e5d7 | b7f9caee297ab1323617b3d6c01c2b6ec26abac6 | /DrawPanel.java | d62a584e9767be0ee13d008670bd5295d732ca67 | [] | no_license | itdev-study/Java-SuperPaint-Application | 2cb046b4e9b23dda3a3843bfb7c487baa2882cac | f0c1c82f967c3ef9d9400280290ecc1117855886 | refs/heads/master | 2020-03-12T00:12:59.179668 | 2018-04-20T09:50:53 | 2018-04-20T09:50:53 | 130,343,971 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,652 | java | import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JPanel;
import javax.swing.JLabel;
import java.awt.BorderLayout;
import java.awt.event.MouseEvent;
import java.awt.event.MouseAdapter;
import java.util.ArrayList;
/**
* This class handles mouse events and uses them to draw shapes.
* It contains a dynamic stack myShapes which is the shapes drawn on the panel.
* It contains a dynamic stack clearedShape which is the shapes cleared from the panel.
* It has many variables for the current shape [type, variable to store shape object, color, fill].
* It contains a JLabel called statusLabel for the mouse coordinates
* It has mutator methods for currentShapeType, currentShapeColor and currentShapeFilled.
* It has methods for undoing, redoing and clearing shapes.
* It has a private inner class MouseHandler which extends MouseAdapter and
* handles mouse and mouse motion events used for drawing the current shape.
*/
public class DrawPanel extends JPanel
{
private LinkedList<MyShape> myShapes; //dynamic stack of shapes
private LinkedList<MyShape> clearedShapes; //dynamic stack of cleared shapes from undo
//current Shape variables
private int currentShapeType; //0 for line, 1 for rect, 2 for oval
private MyShape currentShapeObject; //stores the current shape object
private Color currentShapeColor; //current shape color
private boolean currentShapeFilled; //determine whether shape is filled or not
JLabel statusLabel; //status label for mouse coordinates
/**
* This constructor initializes the dynamic stack for myShapes and clearedShapes.
* It sets the current shape variables to default values.
* It initalizes statusLabel from JLabel passed in.
* Sets up the panel and adds event handling for mouse events.
*/
public DrawPanel(JLabel statusLabel){
myShapes = new LinkedList<MyShape>(); //initialize myShapes dynamic stack
clearedShapes = new LinkedList<MyShape>(); //initialize clearedShapes dynamic stack
//Initialize current Shape variables
currentShapeType=0;
currentShapeObject=null;
currentShapeColor=Color.BLACK;
currentShapeFilled=false;
this.statusLabel = statusLabel; //Initialize statusLabel
setLayout(new BorderLayout()); //sets layout to border layout; default is flow layout
setBackground( Color.WHITE ); //sets background color of panel to white
add( statusLabel, BorderLayout.SOUTH ); //adds a statuslabel to the south border
// event handling for mouse and mouse motion events
MouseHandler handler = new MouseHandler();
addMouseListener( handler );
addMouseMotionListener( handler );
}
/**
* Calls the draw method for the existing shapes.
*/
public void paintComponent( Graphics g )
{
super.paintComponent( g );
// draw the shapes
ArrayList<MyShape> shapeArray=myShapes.getArray();
for ( int counter=shapeArray.size()-1; counter>=0; counter-- )
shapeArray.get(counter).draw(g);
//draws the current Shape Object if it is not null
if (currentShapeObject!=null)
currentShapeObject.draw(g);
}
//Mutator methods for currentShapeType, currentShapeColor and currentShapeFilled
/**
* Sets the currentShapeType to type (0 for line, 1 for rect, 2 for oval) passed in.
*/
public void setCurrentShapeType(int type)
{
currentShapeType=type;
}
/**
* Sets the currentShapeColor to the Color object passed in.
* The Color object contains the color for the current shape.
*/
public void setCurrentShapeColor(Color color)
{
currentShapeColor=color;
}
/**
* Sets the boolean currentShapeFilled to boolean filled passed in.
* If filled=true, current shape is filled.
* If filled=false, current shape is not filled.
*/
public void setCurrentShapeFilled(boolean filled)
{
currentShapeFilled=filled;
}
/**
* Clear the last shape drawn and calls repaint() to redraw the panel if clearedShapes is not empty
*/
public void clearLastShape()
{
if (! myShapes.isEmpty())
{
clearedShapes.addFront(myShapes.removeFront());
repaint();
}
}
/**
* Redo the last shape cleared if clearedShapes is not empty
* It calls repaint() to redraw the panel.
*/
public void redoLastShape()
{
if (! clearedShapes.isEmpty())
{
myShapes.addFront(clearedShapes.removeFront());
repaint();
}
}
/**
* Remove all shapes in current drawing. Also makes clearedShapes empty since you cannot redo after clear.
* It called repaint() to redraw the panel.
*/
public void clearDrawing()
{
myShapes.makeEmpty();
clearedShapes.makeEmpty();
repaint();
}
/**
* Private inner class that implements MouseAdapter and does event handling for mouse events.
*/
private class MouseHandler extends MouseAdapter
{
/**
* When mouse is pressed draw a shape object based on type, color and filled.
* X1,Y1 & X2,Y2 coordinate for the drawn shape are both set to the same X & Y mouse position.
*/
public void mousePressed( MouseEvent event )
{
switch (currentShapeType) //0 for line, 1 for rect, 2 for oval
{
case 0:
currentShapeObject= new MyLine( event.getX(), event.getY(),
event.getX(), event.getY(), currentShapeColor);
break;
case 1:
currentShapeObject= new MyRectangle( event.getX(), event.getY(),
event.getX(), event.getY(), currentShapeColor, currentShapeFilled);
break;
case 2:
currentShapeObject= new MyOval( event.getX(), event.getY(),
event.getX(), event.getY(), currentShapeColor, currentShapeFilled);
break;
}// end switch case
} // end method mousePressed
/**
* When mouse is released set currentShapeObject's x2 & y2 to mouse pos.
* Then addFront currentShapeObject onto the myShapes dynamic Stack
* and set currentShapeObject to null [clearing current shape object since it has been drawn].
* Lastly, it clears all shape objects in clearedShapes [because you cannot redo after a new drawing]
* and calls repaint() to redraw panel.
*/
public void mouseReleased( MouseEvent event )
{
//sets currentShapeObject x2 & Y2
currentShapeObject.setX2(event.getX());
currentShapeObject.setY2(event.getY());
myShapes.addFront(currentShapeObject); //addFront currentShapeObject onto myShapes
currentShapeObject=null; //sets currentShapeObject to null
clearedShapes.makeEmpty(); //clears clearedShapes
repaint();
} // end method mouseReleased
/**
* This method gets the mouse pos when it is moving and sets it to statusLabel.
*/
public void mouseMoved( MouseEvent event )
{
statusLabel.setText(String.format("Mouse Coordinates X: %d Y: %d",event.getX(),event.getY()));
} // end method mouseMoved
/**
* This method gets the mouse position when it is dragging and sets x2 & y2 of current shape to the mouse pos
* It also gets the mouse position when it is dragging and sets it to statusLabel
* Then it calls repaint() to redraw the panel
*/
public void mouseDragged( MouseEvent event )
{
//sets currentShapeObject x2 & Y2
currentShapeObject.setX2(event.getX());
currentShapeObject.setY2(event.getY());
//sets statusLabel to current mouse position
statusLabel.setText(String.format("Mouse Coordinates X: %d Y: %d",event.getX(),event.getY()));
repaint();
} // end method mouseDragged
}// end MouseHandler
} // end class DrawPanel | [
"jimmy_wang@live.ca"
] | jimmy_wang@live.ca |
7c313535acb056bd1bc74fa65f9dfb373385104d | 69baa2bdf1c57cfdb83454b3a641572a49fece85 | /ApiExamples/Java/src/main/java/Examples/ExMailMerge.java | c41ea2e9d800657357b331f1129a2a6ead19bea1 | [
"MIT"
] | permissive | Srinivas572/Aspose.Words-for-Java | 1484e16c5fa478776916329c6d47cba6d4dcef0f | 009293249976c0935564a57292b630fb0401e39e | refs/heads/master | 2022-11-13T07:02:26.866655 | 2020-06-24T11:40:47 | 2020-06-24T11:40:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 47,237 | java | package Examples;
//////////////////////////////////////////////////////////////////////////
// Copyright (c) 2001-2020 Aspose Pty Ltd. All Rights Reserved.
//
// This file is part of Aspose.Words. The source code in this file
// is only intended as a supplement to the documentation, and is provided
// "as is", without warranty of any kind, either expressed or implied.
//////////////////////////////////////////////////////////////////////////
import com.aspose.words.*;
import com.aspose.words.net.System.Data.*;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import java.sql.ResultSet;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Map;
public class ExMailMerge extends ApiExampleBase {
@Test
public void executeArray() throws Exception {
//ExStart
//ExFor:MailMerge.Execute(String[], Object[])
//ExFor:ContentDisposition
//ExSummary:Performs a simple insertion of data into merge fields and sends the document to the browser inline.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.insertField(" MERGEFIELD FullName ");
builder.insertParagraph();
builder.insertField(" MERGEFIELD Company ");
builder.insertParagraph();
builder.insertField(" MERGEFIELD Address ");
builder.insertParagraph();
builder.insertField(" MERGEFIELD City ");
// Fill the fields in the document with user data
doc.getMailMerge().execute(new String[] { "FullName", "Company", "Address", "City" },
new Object[] { "James Bond", "MI5 Headquarters", "Milbank", "London" });
//ExEnd
doc = DocumentHelper.saveOpen(doc);
TestUtil.mailMergeMatchesArray(new String[][] { new String[] {"James Bond", "MI5 Headquarters", "Milbank", "London"} }, doc, true);
}
@Test
public void executeDataReader() throws Exception {
//ExStart
//ExFor:MailMerge.Execute(IDataReader)
//ExSummary:Shows how to run a mail merge using data from a data reader.
// Create a new document and populate it with merge fields
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.write("Product:\t");
builder.insertField(" MERGEFIELD ProductName");
builder.write("\nSupplier:\t");
builder.insertField(" MERGEFIELD CompanyName");
builder.writeln();
builder.insertField(" MERGEFIELD QuantityPerUnit");
builder.write(" for $");
builder.insertField(" MERGEFIELD UnitPrice");
// "DocumentHelper.executeDataTable" is utility function that creates a connection, command,
// executes the command and return the result in a DataTable
ResultSet resultSet = DocumentHelper.executeDataTable(
"SELECT Products.ProductName, Suppliers.CompanyName, Products.QuantityPerUnit, " +
"{fn ROUND(Products.UnitPrice,2)} as UnitPrice " +
"FROM Products INNER JOIN Suppliers ON Products.SupplierID = Suppliers.SupplierID");
DataTable dataTable = new DataTable(resultSet, "OrderDetails");
// Open the data reader
IDataReader dataReader = new DataTableReader(dataTable);
// Now we can take the data from the reader and use it in the mail merge
doc.getMailMerge().execute(dataReader);
doc.save(getArtifactsDir() + "MailMerge.ExecuteDataReader.docx");
//ExEnd
}
@Test
public void executeDataTable() throws Exception {
//ExStart
//ExFor:Document
//ExFor:MailMerge
//ExFor:MailMerge.Execute(DataTable)
//ExFor:MailMerge.Execute(DataRow)
//ExFor:Document.MailMerge
//ExSummary:Executes mail merge from data stored in a ResultSet.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.insertField(" MERGEFIELD CustomerName ");
builder.insertParagraph();
builder.insertField(" MERGEFIELD Address ");
// This example creates a table, but you would normally load table from a database
DataTable table = new DataTable("Test");
table.getColumns().add("CustomerName");
table.getColumns().add("Address");
table.getRows().add(new Object[]{"Thomas Hardy", "120 Hanover Sq., London"});
table.getRows().add(new Object[]{"Paolo Accorti", "Via Monte Bianco 34, Torino"});
// Field values from the table are inserted into the mail merge fields found in the document
doc.getMailMerge().execute(table);
doc.save(getArtifactsDir() + "MailMerge.ExecuteDataTable.docx");
// Create a copy of our document to perform another mail merge
doc = new Document();
builder = new DocumentBuilder(doc);
builder.insertField(" MERGEFIELD CustomerName ");
builder.insertParagraph();
builder.insertField(" MERGEFIELD Address ");
// We can also source values for a mail merge from a single row in the table
doc.getMailMerge().execute(table.getRows().get(1));
doc.save(getArtifactsDir() + "MailMerge.ExecuteDataTable.OneRow.docx");
//ExEnd
}
//ExStart
//ExFor:MailMerge.ExecuteWithRegions(DataSet)
//ExSummary:Shows how to create a nested mail merge with regions with data from a data set with two related tables.
@Test
public void executeWithRegionsNested() throws Exception {
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Create a MERGEFIELD with a value of "TableStart:Customers"
// Normally, MERGEFIELDs specify the name of the column that they take row data from
// "TableStart:Customers" however means that we are starting a mail merge region which belongs to a table called "Customers"
// This will start the outer region and an "TableEnd:Customers" MERGEFIELD will signify its end
builder.insertField(" MERGEFIELD TableStart:Customers");
// Data from rows of the "CustomerName" column of the "Customers" table will go in this MERGEFIELD
builder.write("Orders for ");
builder.insertField(" MERGEFIELD CustomerName");
builder.write(":");
// Create column headers for a table which will contain values from the second inner region
builder.startTable();
builder.insertCell();
builder.write("Item");
builder.insertCell();
builder.write("Quantity");
builder.endRow();
// We have a second data table called "Orders", which has a many-to-one relationship with "Customers",
// related by a "CustomerID" column
// We will start this inner mail merge region over which the "Orders" table will preside,
// which will iterate over the "Orders" table once for each merge of the outer "Customers" region,
// picking up rows with the same CustomerID value
builder.insertCell();
builder.insertField(" MERGEFIELD TableStart:Orders");
builder.insertField(" MERGEFIELD ItemName");
builder.insertCell();
builder.insertField(" MERGEFIELD Quantity");
// End the inner region
// One stipulation of using regions and tables is that the opening and closing of a mail merge region must
// only happen over one row of a document's table
builder.insertField(" MERGEFIELD TableEnd:Orders");
builder.endTable();
// End the outer region
builder.insertField(" MERGEFIELD TableEnd:Customers");
DataSet customersAndOrders = createDataSet();
doc.getMailMerge().executeWithRegions(customersAndOrders);
doc.save(getArtifactsDir() + "MailMerge.ExecuteWithRegionsNested.docx");
}
/// <summary>
/// Generates a data set which has two data tables named "Customers" and "Orders",
/// with a one-to-many relationship between the former and latter on the "CustomerID" column.
/// </summary>
private static DataSet createDataSet() {
// Create the outer mail merge
DataTable tableCustomers = new DataTable("Customers");
tableCustomers.getColumns().add("CustomerID");
tableCustomers.getColumns().add("CustomerName");
tableCustomers.getRows().add(new Object[]{1, "John Doe"});
tableCustomers.getRows().add(new Object[]{2, "Jane Doe"});
// Create the table for the inner merge
DataTable tableOrders = new DataTable("Orders");
tableOrders.getColumns().add("CustomerID");
tableOrders.getColumns().add("ItemName");
tableOrders.getColumns().add("Quantity");
tableOrders.getRows().add(new Object[]{1, "Hawaiian", 2});
tableOrders.getRows().add(new Object[]{2, "Pepperoni", 1});
tableOrders.getRows().add(new Object[]{2, "Chicago", 1});
// Add both tables to a data set
DataSet dataSet = new DataSet();
dataSet.getTables().add(tableCustomers);
dataSet.getTables().add(tableOrders);
// The "CustomerID" column, also the primary key of the customers table is the foreign key for the Orders table
dataSet.getRelations().add(tableCustomers.getColumns().get("CustomerID"), tableOrders.getColumns().get("CustomerID"));
return dataSet;
}
//ExEnd
@Test
public void executeWithRegionsConcurrent() throws Exception {
//ExStart
//ExFor:MailMerge.ExecuteWithRegions(DataTable)
//ExFor:MailMerge.ExecuteWithRegions(DataView)
//ExSummary:Shows how to use regions to execute two separate mail merges in one document.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// If we want to perform two consecutive mail merges on one document while taking data from two tables
// that are related to each other in any way, we can separate the mail merges with regions
// A mail merge region starts and ends with "TableStart:[RegionName]" and "TableEnd:[RegionName]" MERGEFIELDs
// These regions are separate for unrelated data, while they can be nested for hierarchical data
builder.writeln("\tCities: ");
builder.insertField(" MERGEFIELD TableStart:Cities");
builder.insertField(" MERGEFIELD Name");
builder.insertField(" MERGEFIELD TableEnd:Cities");
builder.insertParagraph();
// Both MERGEFIELDs refer to a same column name, but values for each will come from different data tables
builder.writeln("\tFruit: ");
builder.insertField(" MERGEFIELD TableStart:Fruit");
builder.insertField(" MERGEFIELD Name");
builder.insertField(" MERGEFIELD TableEnd:Fruit");
// Create two data tables that aren't linked or related in any way which we still want in the same document
DataTable tableCities = new DataTable("Cities");
tableCities.getColumns().add("Name");
tableCities.getRows().add(new Object[]{"Washington"});
tableCities.getRows().add(new Object[]{"London"});
tableCities.getRows().add(new Object[]{"New York"});
DataTable tableFruit = new DataTable("Fruit");
tableFruit.getColumns().add("Name");
tableFruit.getRows().add(new Object[]{"Cherry"});
tableFruit.getRows().add(new Object[]{"Apple"});
tableFruit.getRows().add(new Object[]{"Watermelon"});
tableFruit.getRows().add(new Object[]{"Banana"});
// We will need to run one mail merge per table
// This mail merge will populate the MERGEFIELDs in the "Cities" range, while leaving the fields in "Fruit" empty
doc.getMailMerge().executeWithRegions(tableCities);
doc.save(getArtifactsDir() + "MailMerge.ExecuteWithRegionsConcurrent.docx");
//ExEnd
}
@Test
public void mailMergeRegionInfo() throws Exception {
//ExStart
//ExFor:MailMerge.GetFieldNamesForRegion(System.String)
//ExFor:MailMerge.GetFieldNamesForRegion(System.String,System.Int32)
//ExFor:MailMerge.GetRegionsByName(System.String)
//ExFor:MailMerge.RegionEndTag
//ExFor:MailMerge.RegionStartTag
//ExSummary:Shows how to create, list and read mail merge regions.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// These tags, which go inside MERGEFIELDs, denote the strings that signify the starts and ends of mail merge regions
Assert.assertEquals(doc.getMailMerge().getRegionStartTag(), "TableStart");
Assert.assertEquals(doc.getMailMerge().getRegionEndTag(), "TableEnd");
// By using these tags, we will start and end a "MailMergeRegion1", which will contain MERGEFIELDs for two columns
builder.insertField(" MERGEFIELD TableStart:MailMergeRegion1");
builder.insertField(" MERGEFIELD Column1");
builder.write(", ");
builder.insertField(" MERGEFIELD Column2");
builder.insertField(" MERGEFIELD TableEnd:MailMergeRegion1");
// We can keep track of merge regions and their columns by looking at these collections
ArrayList<MailMergeRegionInfo> regions = doc.getMailMerge().getRegionsByName("MailMergeRegion1");
Assert.assertEquals(regions.size(), 1);
Assert.assertEquals(regions.get(0).getName(), "MailMergeRegion1");
String[] mergeFieldNames = doc.getMailMerge().getFieldNamesForRegion("MailMergeRegion1");
Assert.assertEquals(mergeFieldNames[0], "Column1");
Assert.assertEquals(mergeFieldNames[1], "Column2");
// Insert a region with the same name as an existing region, which will make it a duplicate
builder.insertParagraph(); // A single row/paragraph cannot be shared by multiple regions
builder.insertField(" MERGEFIELD TableStart:MailMergeRegion1");
builder.insertField(" MERGEFIELD Column3");
builder.insertField(" MERGEFIELD TableEnd:MailMergeRegion1");
// Regions that share the same name are still accounted for and can be accessed by index
regions = doc.getMailMerge().getRegionsByName("MailMergeRegion1");
Assert.assertEquals(regions.size(), 2);
mergeFieldNames = doc.getMailMerge().getFieldNamesForRegion("MailMergeRegion1", 1);
Assert.assertEquals(mergeFieldNames[0], "Column3");
//ExEnd
}
//ExStart
//ExFor:MailMerge.MergeDuplicateRegions
//ExSummary:Shows how to work with duplicate mail merge regions.
@Test(dataProvider = "mergeDuplicateRegionsDataProvider") //ExSkip
public void mergeDuplicateRegions(boolean isMergeDuplicateRegions) throws Exception {
// Create a document and table that we will merge
Document doc = createSourceDocMergeDuplicateRegions();
DataTable dataTable = createSourceTableMergeDuplicateRegions();
// If this property is false, the first region will be merged
// while the MERGEFIELDs of the second one will be left in the pre-merge state
// To get both regions merged we would have to execute the mail merge twice, on a table of the same name
// If this is set to true, both regions will be affected by the merge
doc.getMailMerge().setMergeDuplicateRegions(isMergeDuplicateRegions);
doc.getMailMerge().executeWithRegions(dataTable);
doc.save(getArtifactsDir() + "MailMerge.MergeDuplicateRegions.docx");
}
@DataProvider(name = "mergeDuplicateRegionsDataProvider")
public static Object[][] mergeDuplicateRegionsDataProvider() {
return new Object[][]
{
{true},
{false},
};
}
/// <summary>
/// Return a document that contains two duplicate mail merge regions (sharing the same name in the "TableStart/End" tags).
/// </summary>
private static Document createSourceDocMergeDuplicateRegions() throws Exception {
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.insertField(" MERGEFIELD TableStart:MergeRegion");
builder.insertField(" MERGEFIELD Column1");
builder.insertField(" MERGEFIELD TableEnd:MergeRegion");
builder.insertParagraph();
builder.insertField(" MERGEFIELD TableStart:MergeRegion");
builder.insertField(" MERGEFIELD Column2");
builder.insertField(" MERGEFIELD TableEnd:MergeRegion");
return doc;
}
/// <summary>
/// Create a data table with one row and two columns.
/// </summary>
private static DataTable createSourceTableMergeDuplicateRegions() {
DataTable dataTable = new DataTable("MergeRegion");
dataTable.getColumns().add("Column1");
dataTable.getColumns().add("Column2");
dataTable.getRows().add(new Object[]{"Value 1", "Value 2"});
return dataTable;
}
//ExEnd
//ExStart
//ExFor:MailMerge.PreserveUnusedTags
//ExSummary:Shows how to preserve the appearance of alternative mail merge tags that go unused during a mail merge.
@Test (dataProvider = "preserveUnusedTagsDataProvider") //ExSkip
public void preserveUnusedTags(boolean doPreserveUnusedTags) throws Exception
{
// Create a document and table that we will merge
Document doc = createSourceDocWithAlternativeMergeFields();
DataTable dataTable = createSourceTablePreserveUnusedTags();
// By default, alternative merge tags that can't receive data because the data source has no columns with their name
// are converted to and left on display as MERGEFIELDs after the mail merge
// We can preserve their original appearance setting this attribute to true
doc.getMailMerge().setPreserveUnusedTags(doPreserveUnusedTags);
doc.getMailMerge().execute(dataTable);
doc.save(getArtifactsDir() + "MailMerge.PreserveUnusedTags.docx");
Assert.assertEquals(doc.getText().contains("{{ Column2 }}"), doPreserveUnusedTags);
}
@DataProvider(name = "preserveUnusedTagsDataProvider")
public static Object[][] preserveUnusedTagsDataProvider() throws Exception {
return new Object[][]
{
{false},
{true},
};
}
/// <summary>
/// Create a document and add two tags that can accept mail merge data that are not the traditional MERGEFIELDs.
/// </summary>
private static Document createSourceDocWithAlternativeMergeFields() throws Exception {
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.writeln("{{ Column1 }}");
builder.writeln("{{ Column2 }}");
// Our tags will only register as destinations for mail merge data if we set this to true
doc.getMailMerge().setUseNonMergeFields(true);
return doc;
}
/// <summary>
/// Create a simple data table with one column.
/// </summary>
private static DataTable createSourceTablePreserveUnusedTags() {
DataTable dataTable = new DataTable("MyTable");
dataTable.getColumns().add("Column1");
dataTable.getRows().add(new Object[]{"Value1"});
return dataTable;
}
//ExEnd
//ExStart
//ExFor:MailMerge.MergeWholeDocument
//ExSummary:Shows the relationship between mail merges with regions and field updating.
@Test (dataProvider = "mergeWholeDocumentDataProvider") //ExSkip
public void mergeWholeDocument(boolean doMergeWholeDocument) throws Exception
{
// Create a document and data table that will both be merged
Document doc = createSourceDocMergeWholeDocument();
DataTable dataTable = createSourceTableMergeWholeDocument();
// A regular mail merge will update all fields in the document as part of the procedure,
// which will happen if this property is set to true
// Otherwise, a mail merge with regions will only update fields
// within a mail merge region which matches the name of the DataTable
doc.getMailMerge().setMergeWholeDocument(doMergeWholeDocument);
doc.getMailMerge().executeWithRegions(dataTable);
// If true, all fields in the document will be updated upon merging
// In this case that property is false, so the first QUOTE field will not be updated and will not show a value,
// but the second one inside the region designated by the data table name will show the correct value
doc.save(getArtifactsDir() + "MailMerge.MergeWholeDocument.docx");
Assert.assertEquals(doMergeWholeDocument, doc.getText().contains("This QUOTE field is outside of the \"MyTable\" merge region."));
}
@DataProvider(name = "mergeWholeDocumentDataProvider")
public static Object[][] mergeWholeDocumentDataProvider() throws Exception {
return new Object[][]
{
{false},
{true},
};
}
/// <summary>
/// Create a document with a QUOTE field outside and one more inside a mail merge region called "MyTable"
/// </summary>
private static Document createSourceDocMergeWholeDocument() throws Exception {
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Insert QUOTE field outside of any mail merge regions
FieldQuote field = (FieldQuote) builder.insertField(FieldType.FIELD_QUOTE, true);
field.setText("This QUOTE field is outside of the \"MyTable\" merge region.");
// Start "MyTable" merge region
builder.insertParagraph();
builder.insertField(" MERGEFIELD TableStart:MyTable");
// Insert QUOTE field inside "MyTable" merge region
field = (FieldQuote) builder.insertField(FieldType.FIELD_QUOTE, true);
field.setText("This QUOTE field is inside the \"MyTable\" merge region.");
builder.insertParagraph();
// Add a MERGEFIELD for a column in the data table, end the "MyTable" region and return the document
builder.insertField(" MERGEFIELD MyColumn");
builder.insertField(" MERGEFIELD TableEnd:MyTable");
return doc;
}
/// <summary>
/// Create a simple data table that will be used in a mail merge.
/// </summary>
private static DataTable createSourceTableMergeWholeDocument() {
DataTable dataTable = new DataTable("MyTable");
dataTable.getColumns().add("MyColumn");
dataTable.getRows().add(new Object[]{"MyValue"});
return dataTable;
}
//ExEnd
//ExStart
//ExFor:MailMerge.UseWholeParagraphAsRegion
//ExSummary:Shows the relationship between mail merge regions and paragraphs.
@Test //ExSkip
public void useWholeParagraphAsRegion() throws Exception {
// Create a document with 2 mail merge regions in one paragraph and a table to which can fill one of the regions during a mail merge
Document doc = createSourceDocWithNestedMergeRegions();
DataTable dataTable = createSourceTableDataTableForOneRegion();
// By default, a paragraph can belong to no more than one mail merge region
// Our document breaks this rule so executing a mail merge with regions now will cause an exception to be thrown
Assert.assertTrue(doc.getMailMerge().getUseWholeParagraphAsRegion());
Assert.assertThrows(IllegalStateException.class, () -> doc.getMailMerge().executeWithRegions(dataTable));
// If we set this variable to false, paragraphs and mail merge regions are independent so we can safely run our mail merge
doc.getMailMerge().setUseWholeParagraphAsRegion(false);
doc.getMailMerge().executeWithRegions(dataTable);
// Our first region is populated, while our second is safely displayed as unused all across one paragraph
doc.save(getArtifactsDir() + "MailMerge.UseWholeParagraphAsRegion.docx");
}
/// <summary>
/// Create a document with two mail merge regions sharing one paragraph.
/// </summary>
private static Document createSourceDocWithNestedMergeRegions() throws Exception {
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.write("Region 1: ");
builder.insertField(" MERGEFIELD TableStart:MyTable");
builder.insertField(" MERGEFIELD Column1");
builder.write(", ");
builder.insertField(" MERGEFIELD Column2");
builder.insertField(" MERGEFIELD TableEnd:MyTable");
builder.write(", Region 2: ");
builder.insertField(" MERGEFIELD TableStart:MyOtherTable");
builder.insertField(" MERGEFIELD TableEnd:MyOtherTable");
return doc;
}
/// <summary>
/// Create a data table that can populate one region during a mail merge.
/// </summary>
private static DataTable createSourceTableDataTableForOneRegion() {
DataTable dataTable = new DataTable("MyTable");
dataTable.getColumns().add("Column1");
dataTable.getColumns().add("Column2");
dataTable.getRows().add(new Object[]{"Value 1", "Value 2"});
return dataTable;
}
//ExEnd
@Test (dataProvider = "trimWhiteSpacesDataProvider")
public void trimWhiteSpaces(boolean doTrimWhitespaces) throws Exception
{
//ExStart
//ExFor:MailMerge.TrimWhitespaces
//ExSummary:Shows how to trimmed whitespaces from mail merge values.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.insertField("MERGEFIELD myMergeField", null);
doc.getMailMerge().setTrimWhitespaces(doTrimWhitespaces);
doc.getMailMerge().execute(new String[] { "myMergeField" }, new Object[] { "\t hello world! " });
if (doTrimWhitespaces)
Assert.assertEquals("hello world!\f", doc.getText());
else
Assert.assertEquals("\t hello world! \f", doc.getText());
//ExEnd
}
//JAVA-added data provider for test method
@DataProvider(name = "trimWhiteSpacesDataProvider")
public static Object[][] trimWhiteSpacesDataProvider() throws Exception
{
return new Object[][]
{
{false},
{true},
};
}
@Test
public void mailMergeGetFieldNames() throws Exception {
Document doc = new Document();
//ExStart
//ExFor:MailMerge.GetFieldNames
//ExSummary:Shows how to get names of all merge fields in a document.
String[] fieldNames = doc.getMailMerge().getFieldNames();
//ExEnd
}
@Test
public void deleteFields() throws Exception {
Document doc = new Document();
//ExStart
//ExFor:MailMerge.DeleteFields
//ExSummary:Shows how to delete all merge fields from a document without executing mail merge.
doc.getMailMerge().deleteFields();
//ExEnd
}
@Test
public void removeContainingFields() throws Exception {
Document doc = new Document();
//ExStart
//ExFor:MailMerge.CleanupOptions
//ExFor:MailMergeCleanupOptions
//ExSummary:Shows how to instruct the mail merge engine to remove any containing fields from around a merge field during mail merge.
doc.getMailMerge().setCleanupOptions(MailMergeCleanupOptions.REMOVE_CONTAINING_FIELDS);
//ExEnd
}
@Test
public void removeUnusedFields() throws Exception {
Document doc = new Document();
//ExStart
//ExFor:MailMerge.CleanupOptions
//ExFor:MailMergeCleanupOptions
//ExSummary:Shows how to automatically remove unmerged merge fields during mail merge.
doc.getMailMerge().setCleanupOptions(MailMergeCleanupOptions.REMOVE_UNUSED_FIELDS);
//ExEnd
}
@Test
public void removeEmptyParagraphs() throws Exception {
Document doc = new Document();
//ExStart
//ExFor:MailMerge.CleanupOptions
//ExFor:MailMergeCleanupOptions
//ExSummary:Shows how to make sure empty paragraphs that result from merging fields with no data are removed from the document.
doc.getMailMerge().setCleanupOptions(MailMergeCleanupOptions.REMOVE_EMPTY_PARAGRAPHS);
//ExEnd
}
@Test(enabled = false, description = "WORDSNET-17733", dataProvider = "removeColonBetweenEmptyMergeFieldsDataProvider")
public void removeColonBetweenEmptyMergeFields(final String punctuationMark,
final boolean isCleanupParagraphsWithPunctuationMarks, final String resultText) throws Exception {
//ExStart
//ExFor:MailMerge.CleanupParagraphsWithPunctuationMarks
//ExSummary:Shows how to remove paragraphs with punctuation marks after mail merge operation.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
FieldMergeField mergeFieldOption1 = (FieldMergeField) builder.insertField("MERGEFIELD", "Option_1");
mergeFieldOption1.setFieldName("Option_1");
// Here is the complete list of cleanable punctuation marks:
// !
// ,
// .
// :
// ;
// ?
// ¡
// ¿
builder.write(punctuationMark);
FieldMergeField mergeFieldOption2 = (FieldMergeField) builder.insertField("MERGEFIELD", "Option_2");
mergeFieldOption2.setFieldName("Option_2");
doc.getMailMerge().setCleanupOptions(MailMergeCleanupOptions.REMOVE_EMPTY_PARAGRAPHS);
// The default value of the option is true which means that the behavior was changed to mimic MS Word
// If you rely on the old behavior are able to revert it by setting the option to false
doc.getMailMerge().setCleanupParagraphsWithPunctuationMarks(isCleanupParagraphsWithPunctuationMarks);
doc.getMailMerge().execute(new String[]{"Option_1", "Option_2"}, new Object[]{null, null});
doc.save(getArtifactsDir() + "MailMerge.RemoveColonBetweenEmptyMergeFields.docx");
//ExEnd
Assert.assertEquals(doc.getText(), resultText);
}
@DataProvider(name = "removeColonBetweenEmptyMergeFieldsDataProvider")
public static Object[][] removeColonBetweenEmptyMergeFieldsDataProvider() {
return new Object[][]
{
{"!", false, ""},
{", ", false, ""},
{" . ", false, ""},
{" :", false, ""},
{" ; ", false, ""},
{" ? ", false, ""},
{" ¡ ", false, ""},
{" ¿ ", false, ""},
{"!", true, "!\f"},
{", ", true, ", \f"},
{" . ", true, " . \f"},
{" :", true, " :\f"},
{" ; ", true, " ; \f"},
{" ? ", true, " ? \f"},
{" ¡ ", true, " ¡ \f"},
{" ¿ ", true, " ¿ \f"},
};
}
//ExStart
//ExFor:MailMerge.MappedDataFields
//ExFor:MappedDataFieldCollection
//ExFor:MappedDataFieldCollection.Add
//ExFor:MappedDataFieldCollection.Clear
//ExFor:MappedDataFieldCollection.ContainsKey(String)
//ExFor:MappedDataFieldCollection.ContainsValue(String)
//ExFor:MappedDataFieldCollection.Count
//ExFor:MappedDataFieldCollection.GetEnumerator
//ExFor:MappedDataFieldCollection.Item(String)
//ExFor:MappedDataFieldCollection.Remove(String)
//ExSummary:Shows how to map data columns and MERGEFIELDs with different names so the data is transferred between them during a mail merge.
@Test //ExSkip
public void mappedDataFieldCollection() throws Exception {
// Create a document and table that we will merge
Document doc = createSourceDocMappedDataFields();
DataTable dataTable = createSourceTableMappedDataFields();
// We have a column "Column2" in the data table that doesn't have a respective MERGEFIELD in the document
// Also, we have a MERGEFIELD named "Column3" that does not exist as a column in the data source
// If data from "Column2" is suitable for the "Column3" MERGEFIELD,
// we can map that column name to the MERGEFIELD in the "MappedDataFields" key/value pair
MappedDataFieldCollection mappedDataFields = doc.getMailMerge().getMappedDataFields();
// A data source column name is linked to a MERGEFIELD name by adding an element like this
mappedDataFields.add("MergeFieldName", "DataSourceColumnName");
// So, values from "Column2" will now go into MERGEFIELDs named "Column3" as well as "Column2", if there are any
mappedDataFields.add("Column3", "Column2");
// The MERGEFIELD name is the "key" to the respective data source column name "value"
Assert.assertEquals(mappedDataFields.get("MergeFieldName"), "DataSourceColumnName");
Assert.assertTrue(mappedDataFields.containsKey("MergeFieldName"));
Assert.assertTrue(mappedDataFields.containsValue("DataSourceColumnName"));
// Now if we run this mail merge, the "Column3" MERGEFIELDs will take data from "Column2" of the table
doc.getMailMerge().execute(dataTable);
// We can count and iterate over the mapped columns/fields
Assert.assertEquals(mappedDataFields.getCount(), 2);
Iterator<Map.Entry<String, String>> enumerator = mappedDataFields.iterator();
try {
while (enumerator.hasNext()) {
Map.Entry<String, String> dataField = enumerator.next();
System.out.println(MessageFormat.format("Column named {0} is mapped to MERGEFIELDs named {1}", dataField.getValue(), dataField.getKey()));
}
} finally {
if (enumerator != null) enumerator.remove();
}
// We can also remove some or all of the elements
mappedDataFields.remove("MergeFieldName");
Assert.assertFalse(mappedDataFields.containsKey("MergeFieldName"));
Assert.assertFalse(mappedDataFields.containsValue("DataSourceColumnName"));
mappedDataFields.clear();
Assert.assertEquals(mappedDataFields.getCount(), 0);
// Removing the mapped key/value pairs has no effect on the document because the merge was already done with them in place
doc.save(getArtifactsDir() + "MailMerge.MappedDataFieldCollection.docx");
}
/// <summary>
/// Create a document with 2 MERGEFIELDs, one of which does not have a corresponding column in the data table.
/// </summary>
private static Document createSourceDocMappedDataFields() throws Exception {
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Insert two MERGEFIELDs that will accept data from that table
builder.insertField(" MERGEFIELD Column1");
builder.write(", ");
builder.insertField(" MERGEFIELD Column3");
return doc;
}
/// <summary>
/// Create a data table with 2 columns, one of which does not have a corresponding MERGEFIELD in our source document.
/// </summary>
private static DataTable createSourceTableMappedDataFields() {
// Create a data table that will be used in a mail merge
DataTable dataTable = new DataTable("MyTable");
dataTable.getColumns().add("Column1");
dataTable.getColumns().add("Column2");
dataTable.getRows().add(new Object[]{"Value1", "Value2"});
return dataTable;
}
//ExEnd
@Test
public void getFieldNames() throws Exception {
//ExStart
//ExFor:FieldAddressBlock
//ExFor:FieldAddressBlock.GetFieldNames
//ExSummary:Shows how to get mail merge field names used by the field.
Document doc = new Document(getMyDir() + "Field sample - ADDRESSBLOCK.docx");
String[] addressFieldsExpect = {"Company", "First Name", "Middle Name", "Last Name", "Suffix", "Address 1", "City", "State", "Country or Region", "Postal Code"};
FieldAddressBlock addressBlockField = (FieldAddressBlock) doc.getRange().getFields().get(0);
String[] addressBlockFieldNames = addressBlockField.getFieldNames();
//ExEnd
Assert.assertEquals(addressBlockFieldNames, addressFieldsExpect);
String[] greetingFieldsExpect = {"Courtesy Title", "Last Name"};
FieldGreetingLine greetingLineField = (FieldGreetingLine) doc.getRange().getFields().get(1);
String[] greetingLineFieldNames = greetingLineField.getFieldNames();
Assert.assertEquals(greetingLineFieldNames, greetingFieldsExpect);
}
@Test
public void useNonMergeFields() throws Exception {
Document doc = new Document();
//ExStart
//ExFor:MailMerge.UseNonMergeFields
//ExSummary:Shows how to perform mail merge into merge fields and into additional fields types.
doc.getMailMerge().setUseNonMergeFields(true);
//ExEnd
}
/// <summary>
/// Without TestCaseSource/TestCase because of some strange behavior when using long data.
/// </summary>
@Test
public void mustacheTemplateSyntaxTrue() throws Exception
{
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.write("{{ testfield1 }}");
builder.write("{{ testfield2 }}");
builder.write("{{ testfield3 }}");
doc.getMailMerge().setUseNonMergeFields(true);
doc.getMailMerge().setPreserveUnusedTags(true);
DataTable table = new DataTable("Test");
table.getColumns().add("testfield2");
table.getRows().add("value 1");
doc.getMailMerge().execute(table);
String paraText = DocumentHelper.getParagraphText(doc, 0);
Assert.assertEquals("{{ testfield1 }}value 1{{ testfield3 }}\f", paraText);
}
@Test
public void mustacheTemplateSyntaxFalse() throws Exception
{
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.write("{{ testfield1 }}");
builder.write("{{ testfield2 }}");
builder.write("{{ testfield3 }}");
doc.getMailMerge().setUseNonMergeFields(true);
doc.getMailMerge().setPreserveUnusedTags(false);
DataTable table = new DataTable("Test");
table.getColumns().add("testfield2");
table.getRows().add("value 1");
doc.getMailMerge().execute(table);
String paraText = DocumentHelper.getParagraphText(doc, 0);
Assert.assertEquals("\u0013MERGEFIELD \"testfield1\"\u0014«testfield1»\u0015value 1\u0013MERGEFIELD \"testfield3\"\u0014«testfield3»\u0015\f", paraText);
}
@Test
public void testMailMergeGetRegionsHierarchy() throws Exception {
//ExStart
//ExFor:MailMerge.GetRegionsHierarchy
//ExFor:MailMergeRegionInfo
//ExFor:MailMergeRegionInfo.Regions
//ExFor:MailMergeRegionInfo.Name
//ExFor:MailMergeRegionInfo.Fields
//ExFor:MailMergeRegionInfo.StartField
//ExFor:MailMergeRegionInfo.EndField
//ExFor:MailMergeRegionInfo.Level
//ExSummary:Shows how to get MailMergeRegionInfo and work with it.
Document doc = new Document(getMyDir() + "Mail merge regions.docx");
// Returns a full hierarchy of regions (with fields) available in the document
MailMergeRegionInfo regionInfo = doc.getMailMerge().getRegionsHierarchy();
// Get top regions in the document
ArrayList topRegions = regionInfo.getRegions();
Assert.assertEquals(topRegions.size(), 2);
Assert.assertEquals(((MailMergeRegionInfo) topRegions.get(0)).getName(), "Region1");
Assert.assertEquals(((MailMergeRegionInfo) topRegions.get(1)).getName(), "Region2");
Assert.assertEquals(((MailMergeRegionInfo) topRegions.get(0)).getLevel(), 1);
Assert.assertEquals(((MailMergeRegionInfo) topRegions.get(1)).getLevel(), 1);
// Get nested region in first top region
ArrayList nestedRegions = ((MailMergeRegionInfo) topRegions.get(0)).getRegions();
Assert.assertEquals(nestedRegions.size(), 2);
Assert.assertEquals(((MailMergeRegionInfo) nestedRegions.get(0)).getName(), "NestedRegion1");
Assert.assertEquals(((MailMergeRegionInfo) nestedRegions.get(1)).getName(), "NestedRegion2");
Assert.assertEquals(((MailMergeRegionInfo) nestedRegions.get(0)).getLevel(), 2);
Assert.assertEquals(((MailMergeRegionInfo) nestedRegions.get(1)).getLevel(), 2);
// Get field list in first top region
ArrayList fieldList = ((MailMergeRegionInfo) topRegions.get(0)).getFields();
Assert.assertEquals(fieldList.size(), 4);
FieldMergeField startFieldMergeField = ((MailMergeRegionInfo) nestedRegions.get(0)).getStartField();
Assert.assertEquals(startFieldMergeField.getFieldName(), "TableStart:NestedRegion1");
FieldMergeField endFieldMergeField = ((MailMergeRegionInfo) nestedRegions.get(0)).getEndField();
Assert.assertEquals(endFieldMergeField.getFieldName(), "TableEnd:NestedRegion1");
//ExEnd
}
@Test
public void testTagsReplacedEventShouldRisedWithUseNonMergeFieldsOption() throws Exception {
//ExStart
//ExFor:MailMerge.MailMergeCallback
//ExFor:IMailMergeCallback
//ExFor:IMailMergeCallback.TagsReplaced
//ExSummary:Shows how to define custom logic for handling events during mail merge.
Document document = new Document();
document.getMailMerge().setUseNonMergeFields(true);
MailMergeCallbackStub mailMergeCallbackStub = new MailMergeCallbackStub();
document.getMailMerge().setMailMergeCallback(mailMergeCallbackStub);
document.getMailMerge().execute(new String[0], new Object[0]);
Assert.assertEquals(mailMergeCallbackStub.getTagsReplacedCounter(), 1);
}
private static class MailMergeCallbackStub implements IMailMergeCallback {
public void tagsReplaced() {
mTagsReplacedCounter++;
}
public int getTagsReplacedCounter() {
return mTagsReplacedCounter;
}
private int mTagsReplacedCounter;
}
//ExEnd
@Test
public void getRegionsByName() throws Exception {
Document doc = new Document(getMyDir() + "Mail merge regions.docx");
ArrayList<MailMergeRegionInfo> regions = doc.getMailMerge().getRegionsByName("Region1");
Assert.assertEquals(doc.getMailMerge().getRegionsByName("Region1").size(), 1);
for (MailMergeRegionInfo region : regions) Assert.assertEquals(region.getName(), "Region1");
regions = doc.getMailMerge().getRegionsByName("Region2");
Assert.assertEquals(doc.getMailMerge().getRegionsByName("Region2").size(), 1);
for (MailMergeRegionInfo region : regions) Assert.assertEquals(region.getName(), "Region2");
regions = doc.getMailMerge().getRegionsByName("NestedRegion1");
Assert.assertEquals(doc.getMailMerge().getRegionsByName("NestedRegion1").size(), 2);
for (MailMergeRegionInfo region : regions) Assert.assertEquals(region.getName(), "NestedRegion1");
}
@Test
public void cleanupOptions() throws Exception {
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.startTable();
builder.insertCell();
builder.insertField(" MERGEFIELD TableStart:StudentCourse ");
builder.insertCell();
builder.insertField(" MERGEFIELD CourseName ");
builder.insertCell();
builder.insertField(" MERGEFIELD TableEnd:StudentCourse ");
builder.endTable();
DataTable data = getDataTable();
doc.getMailMerge().setCleanupOptions(MailMergeCleanupOptions.REMOVE_EMPTY_TABLE_ROWS);
doc.getMailMerge().executeWithRegions(data);
doc.save(getArtifactsDir() + "MailMerge.CleanupOptions.docx");
Assert.assertTrue(DocumentHelper.compareDocs(getArtifactsDir() + "MailMerge.CleanupOptions.docx", getGoldsDir() + "MailMerge.CleanupOptions Gold.docx"));
}
/**
* Create DataTable and fill it with data.
* In real life this DataTable should be filled from a database.
*/
private static DataTable getDataTable() {
DataTable dataTable = new DataTable("StudentCourse");
dataTable.getColumns().add("CourseName");
DataRow dataRowEmpty = dataTable.newRow();
dataTable.getRows().add(dataRowEmpty);
dataRowEmpty.set(0, "");
for (int i = 0; i < 10; i++) {
DataRow datarow = dataTable.newRow();
dataTable.getRows().add(datarow);
datarow.set(0, "Course " + Integer.toString(i));
}
return dataTable;
}
@Test (dataProvider = "unconditionalMergeFieldsAndRegionsDataProvider")
public void unconditionalMergeFieldsAndRegions(boolean doCountAllMergeFields) throws Exception
{
//ExStart
//ExFor:MailMerge.UnconditionalMergeFieldsAndRegions
//ExSummary:Shows how to merge fields or regions regardless of the parent IF field's condition.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Insert a MERGEFIELD nested inside an IF field
// Since the statement of the IF field is false, the result of the inner MERGEFIELD will not be displayed
// and the MERGEFIELD will not receive any data during a mail merge
FieldIf fieldIf = (FieldIf) builder.insertField(" IF 1 = 2 ");
builder.moveTo(fieldIf.getSeparator());
builder.insertField(" MERGEFIELD FullName ");
// We can still count MERGEFIELDs inside false-statement IF fields if we set this flag to true
doc.getMailMerge().setUnconditionalMergeFieldsAndRegions(doCountAllMergeFields);
DataTable dataTable = new DataTable();
dataTable.getColumns().add("FullName");
dataTable.getRows().add("James Bond");
// Execute the mail merge
doc.getMailMerge().execute(dataTable);
// The result will not be visible in the document because the IF field is false, but the inner MERGEFIELD did indeed receive data
doc.save(getArtifactsDir() + "MailMerge.UnconditionalMergeFieldsAndRegions.docx");
if (doCountAllMergeFields)
Assert.assertEquals("IF 1 = 2 \"James Bond\"", doc.getText().trim());
else
Assert.assertEquals("IF 1 = 2 \u0013 MERGEFIELD FullName \u0014«FullName»", doc.getText().trim());
//ExEnd
}
//JAVA-added data provider for test method
@DataProvider(name = "unconditionalMergeFieldsAndRegionsDataProvider")
public static Object[][] unconditionalMergeFieldsAndRegionsDataProvider() throws Exception
{
return new Object[][]
{
{false},
{true},
};
}
}
| [
"falleretic@gmail.com"
] | falleretic@gmail.com |
3612183ecdaeace68fd0e3ab00e6fa9d4909be14 | 502ea93de54a1be3ef42edb0412a2bf4bc9ddbef | /sources/com/google/android/gms/ads/internal/overlay/C3108d.java | eebf2ed4005d7c58233705ed106889e3e2652583 | [] | no_license | dovanduy/MegaBoicotApk | c0852af0773be1b272ec907113e8f088addb0f0c | 56890cb9f7afac196bd1fec2d1326f2cddda37a3 | refs/heads/master | 2020-07-02T04:28:02.199907 | 2019-08-08T20:44:49 | 2019-08-08T20:44:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 468 | java | package com.google.android.gms.ads.internal.overlay;
import com.google.android.gms.internal.ads.C4125rn;
/* renamed from: com.google.android.gms.ads.internal.overlay.d */
final /* synthetic */ class C3108d implements C4125rn {
/* renamed from: a */
private final C3107c f9100a;
C3108d(C3107c cVar) {
this.f9100a = cVar;
}
/* renamed from: a */
public final void mo12684a(boolean z) {
this.f9100a.f9082c.mo15904o();
}
}
| [
"pablo.valle.b@gmail.com"
] | pablo.valle.b@gmail.com |
71eea6db592316508661919e3d3841e5e4c0f2be | af366cd732b1e6bbf9e220c536032515c70e41b9 | /MyJava2/src/exceptionhandling/E14.java | 16175a389fdc8313bb3b1a4f371fca6caa146956 | [] | no_license | Dibyajyoti4170/MyJavaCodes | 045d0eb454853167da657ba32a9afa934abedb77 | 6a4ad406b85faf39e962495a84096ad2e1e21dae | refs/heads/master | 2020-08-31T04:12:51.255762 | 2019-11-25T04:10:58 | 2019-11-25T04:10:58 | 218,584,244 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 443 | java | package exceptionhandling;
public class E14 {
static void m1() throws ClassNotFoundException
{
System.out.println("from m1()");
Class.forName("java.util.Scanner");
System.out.println("m1 done");
}
public static void main(String[] args) throws ClassNotFoundException {
System.out.println("from main");
m1();
System.out.println("main ends");
}
}
//output
//from main
//from m1()
//m1 done
//main ends
| [
"personal@192.168.1.7"
] | personal@192.168.1.7 |
1b1eb9ab1f8f4a4c513783a71950d844180e56ba | 5f44f71b08cfc583f6804e68b3abce7ad95182df | /ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java | 0be3522c1edf29459d9bcdb3e710bc199ca99fb8 | [] | no_license | dc1323/10le8 | 36db33958a4b4ebe9f473c421f74636821a01260 | 9665321cfd1e4642833adbf8a19d6342c78f2eff | refs/heads/master | 2023-02-09T12:15:03.373778 | 2021-01-02T11:28:37 | 2021-01-02T11:28:37 | 314,724,390 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,639 | java | package com.ruoyi.system.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.ruoyi.system.domain.SysUserRole;
/**
* 用户与角色关联表 数据层
*
* @author ruoyi
*/
public interface SysUserRoleMapper {
/**
* 通过用户ID查询用户和角色关联
*
* @param userId 用户ID
* @return 用户和角色关联列表
*/
public List<SysUserRole> selectUserRoleByUserId(Long userId);
/**
* 通过用户ID删除用户和角色关联
*
* @param userId 用户ID
* @return 结果
*/
public int deleteUserRoleByUserId(Long userId);
/**
* 批量删除用户和角色关联
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteUserRole(Long[] ids);
/**
* 通过角色ID查询角色使用数量
*
* @param roleId 角色ID
* @return 结果
*/
public int countUserRoleByRoleId(Long roleId);
/**
* 批量新增用户角色信息
*
* @param userRoleList 用户角色列表
* @return 结果
*/
public int batchUserRole(List<SysUserRole> userRoleList);
/**
* 删除用户和角色关联信息
*
* @param userRole 用户和角色关联信息
* @return 结果
*/
public int deleteUserRoleInfo(SysUserRole userRole);
/**
* 批量取消授权用户角色
*
* @param roleId 角色ID
* @param userIds 需要删除的用户数据ID
* @return 结果
*/
public int deleteUserRoleInfos(@Param("roleId") Long roleId, @Param("userIds") Long[] userIds);
}
| [
"miles.jiang@anker.com"
] | miles.jiang@anker.com |
ce46980a515e13c84bd2424d1cb3ef493a4cdad4 | b803051f4404d9962d0bcb084492f87034db2737 | /android/app/src/main/java/de/uni_bremen/informatik/ChannelMethods.java | f62bfb3dc50aef3e5ce16fd824b380332bfc0c90 | [
"MIT",
"Apache-2.0"
] | permissive | Tiltification/sonic-tilt | ad4c2cc2957919b89e47a423db8ee7d4ab401b2a | 7a9799c74ee6dc16eaeafe84350ce50e44d4948f | refs/heads/master | 2023-06-26T09:05:12.455668 | 2023-06-13T07:02:15 | 2023-06-13T07:02:15 | 410,888,798 | 8 | 6 | null | null | null | null | UTF-8 | Java | false | false | 1,123 | java | package de.uni_bremen.informatik;
/**
* Created by Fida on 22.01.21.
*/
enum ChannelMethods {
START_STOP_AUDIO("toggleAudio","switchOff"),
INPUT_VALUE_X("sendAngleXToLibPd","targetX"),
START_AUDIO_ON_BOOT("applyUserPrefsAfterUIRendered","startAudioOnBoot"),
INPUT_PINK_NOISE("togglePinkNoise","pinkMute"),
INPUT_VALUE_Y("sendAngleYToLibPd","targetY"),
PINK_NOISE_RANGE("setPinkNoiseSensitivityRange","range"),
PLAY_IN_BACKGROUND("playInBackground","play");
String methodName;
String param1;
ChannelMethods(String methodName, String param1) {
this.methodName = methodName;
this.param1 = param1;
}
public String getMethodName() {
return methodName;
}
public String getParam1() {
return param1;
}
public boolean equals(ChannelMethods method){
return method != null && equals(method.getMethodName());
}
public boolean equals(String methodName){
return this.methodName.equals(methodName);
}
}
| [
"navid@uni-bremen.de"
] | navid@uni-bremen.de |
bdfa168e4ffa2555c26aef6b022d9bc7b4a65fd0 | 87f7af1e58e6f6e029ef7bc4877f3e78926c6c81 | /desdiown-programacion-46c8059d5bb2/Evaluación 1/Examen 1/Ejercicios realizados/Pseudocódigos sobre Netbeans/Ejercicios programación/src/EjerciciosPseudocódigo/Ejercicio7.java | ada7b7bafcb575526e784b26e9be2e3a9833d06f | [] | no_license | d3sd1/uc3m-workarounds | a115942b4fb2c1003bc770134973ed4304b30fee | ada16b68a26c11081db696cca813a28551957661 | refs/heads/master | 2020-12-12T12:27:39.685148 | 2020-04-23T21:29:58 | 2020-04-23T21:29:58 | 234,124,789 | 0 | 0 | null | 2020-04-23T21:30:00 | 2020-01-15T16:35:43 | HTML | UTF-8 | Java | false | false | 497 | java | package EjerciciosPseudocódigo;
import java.util.Scanner;
public class Ejercicio7 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("Introduce un número: ");
int number_fact = input.nextInt();
int number_final = 1;
for(int i = 1; i <= number_fact; i++)
{
number_final *= i;
}
System.out.println("El factorial de !" + number_fact + " es " + number_final);
}
}
| [
"andreigarciacuadra@gmail.com"
] | andreigarciacuadra@gmail.com |
999b23c4e955b8b80495b3e9453aaa3f48842c0f | ed3cb95dcc590e98d09117ea0b4768df18e8f99e | /project_1_1/src/h/i/f/Calc_1_1_7858.java | 5dd70af9d0fee77d15e7c06545b726aea0c16ab0 | [] | no_license | chalstrick/bigRepo1 | ac7fd5785d475b3c38f1328e370ba9a85a751cff | dad1852eef66fcec200df10083959c674fdcc55d | refs/heads/master | 2016-08-11T17:59:16.079541 | 2015-12-18T14:26:49 | 2015-12-18T14:26:49 | 48,244,030 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 131 | java | package h.i.f;
public class Calc_1_1_7858 {
/** @return the sum of a and b */
public int add(int a, int b) {
return a+b;
}
}
| [
"christian.halstrick@sap.com"
] | christian.halstrick@sap.com |
ac5b1056c3c97f0ff3cc54a624af935bfd0000c8 | 30b74e9203585fa3d146b840ef52afe7c1023b2f | /JSP_1st_Project/web/WEB-INF/jspwork/org/apache/jsp/views/_4_menuResult_jsp.java | 511d0555d046f903fc829e9accbf3a55370d50d3 | [] | no_license | Git-Panther/Wakanda_JSP | 959cc48610c54867f9eb12967c86d5f9ad3fa31b | e747d46afead59fb271559c28a1497ec9f9c3864 | refs/heads/master | 2020-03-18T23:31:08.773214 | 2018-06-05T12:48:30 | 2018-06-05T12:48:30 | 135,407,571 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,814 | java | /*
* Generated by the Jasper component of Apache Tomcat
* Version: Apache Tomcat/8.0.52
* Generated at: 2018-05-30 11:03:28 UTC
* Note: The last modified time of this file was set to
* the last modified time of the source file after
* generation to assist with modification tracking.
*/
package org.apache.jsp.views;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
public final class _4_menuResult_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent,
org.apache.jasper.runtime.JspSourceImports {
private static final javax.servlet.jsp.JspFactory _jspxFactory =
javax.servlet.jsp.JspFactory.getDefaultFactory();
private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants;
private static final java.util.Set<java.lang.String> _jspx_imports_packages;
private static final java.util.Set<java.lang.String> _jspx_imports_classes;
static {
_jspx_imports_packages = new java.util.HashSet<>();
_jspx_imports_packages.add("javax.servlet");
_jspx_imports_packages.add("javax.servlet.http");
_jspx_imports_packages.add("javax.servlet.jsp");
_jspx_imports_classes = null;
}
private volatile javax.el.ExpressionFactory _el_expressionfactory;
private volatile org.apache.tomcat.InstanceManager _jsp_instancemanager;
public java.util.Map<java.lang.String,java.lang.Long> getDependants() {
return _jspx_dependants;
}
public java.util.Set<java.lang.String> getPackageImports() {
return _jspx_imports_packages;
}
public java.util.Set<java.lang.String> getClassImports() {
return _jspx_imports_classes;
}
public javax.el.ExpressionFactory _jsp_getExpressionFactory() {
if (_el_expressionfactory == null) {
synchronized (this) {
if (_el_expressionfactory == null) {
_el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
}
}
}
return _el_expressionfactory;
}
public org.apache.tomcat.InstanceManager _jsp_getInstanceManager() {
if (_jsp_instancemanager == null) {
synchronized (this) {
if (_jsp_instancemanager == null) {
_jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig());
}
}
}
return _jsp_instancemanager;
}
public void _jspInit() {
}
public void _jspDestroy() {
}
public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response)
throws java.io.IOException, javax.servlet.ServletException {
final java.lang.String _jspx_method = request.getMethod();
if (!"GET".equals(_jspx_method) && !"POST".equals(_jspx_method) && !"HEAD".equals(_jspx_method) && !javax.servlet.DispatcherType.ERROR.equals(request.getDispatcherType())) {
response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, "JSPs only permit GET POST or HEAD");
return;
}
final javax.servlet.jsp.PageContext pageContext;
javax.servlet.http.HttpSession session = null;
final javax.servlet.ServletContext application;
final javax.servlet.ServletConfig config;
javax.servlet.jsp.JspWriter out = null;
final java.lang.Object page = this;
javax.servlet.jsp.JspWriter _jspx_out = null;
javax.servlet.jsp.PageContext _jspx_page_context = null;
try {
response.setContentType("text/html; charset=UTF-8");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write("\r\n");
out.write("<!DOCTYPE html>\r\n");
out.write("<html>\r\n");
out.write("<head>\r\n");
out.write("<meta charset=\"UTF-8\">\r\n");
out.write("<title>Result of to select a menu</title>\r\n");
String name = (String)request.getAttribute("name");
String menu = (String)request.getAttribute("menu");
int score = (Integer)request.getAttribute("score");
out.write("\r\n");
out.write("</head>\r\n");
out.write("<body>\r\n");
out.write("\t");
if(score != 0){
out.write("\r\n");
out.write("\t<h1>\r\n");
out.write("\t\tChosen Campion : ");
out.print(name);
out.write("\r\n");
out.write("\t\t<br>Message : ");
out.print(menu);
out.write("\r\n");
out.write("\t\t<br>Score : ");
out.print(score);
out.write("\r\n");
out.write("\t</h1>\r\n");
out.write("\t");
}else{
out.write("\r\n");
out.write("\t\t<h1>고인물</h1>\r\n");
out.write("\t");
}
out.write("\r\n");
out.write("\t<!-- 위처럼 끊어서 코딩 가능 -->\r\n");
out.write("</body>\r\n");
out.write("</html>");
} catch (java.lang.Throwable t) {
if (!(t instanceof javax.servlet.jsp.SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
try {
if (response.isCommitted()) {
out.flush();
} else {
out.clearBuffer();
}
} catch (java.io.IOException e) {}
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
else throw new ServletException(t);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
}
| [
"KYG@KYG"
] | KYG@KYG |
3a23f96abbe4b33c1b3bdea95ef91ff14bdec730 | 5eaa08fc5b1a6f92e0f80138a5997a7148602db2 | /ProxiBanqueSI/src/main/java/com/adaming/dao/IDaoConseiller.java | 242ff2950029c6eed14f16f173ca1ee87bc3713c | [] | no_license | benjimoule/ProxiBanqueSIEclipse | 156fb665f60f1c3914c15c5995986fb66817f0ec | 455fc00b699d90dd4d689109288ff977b36bad73 | refs/heads/master | 2021-01-01T05:19:22.233088 | 2016-04-26T13:36:27 | 2016-04-26T13:36:27 | 56,773,032 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 343 | java | package com.adaming.dao;
import java.util.List;
import com.adaming.entities.Conseiller;
public interface IDaoConseiller {
List<Conseiller> getAllConseillers();
Conseiller getConseillerById(int id);
void addConseiller(Conseiller conseiller);
void updateConseiller(Conseiller conseiller);
void deleteConseiller(int id);
}
| [
"benjamin.policand@hotmail.fr"
] | benjamin.policand@hotmail.fr |
e5b4d7f8966bb12f1f53d42f90a241553b70ceab | a06c2b43bb164564fb2a8d9262d3194fbc70838f | /src/main/java/com/zlrwjzan/manicure/modules/us/service/ManicureStyleService.java | debf96217f0c81687657d31ad5da36d01a2c94a7 | [] | no_license | ZLRWJZAN/manicure | d086712f461947ee0644c865a028f22b3f1c7beb | 66d2c58eccf7eb306aaf4bc28e476f121317f357 | refs/heads/master | 2023-02-23T20:50:51.984727 | 2021-01-26T01:41:01 | 2021-01-26T01:41:01 | 332,706,895 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 339 | java | package com.zlrwjzan.manicure.modules.us.service;
import com.zlrwjzan.manicure.modules.us.model.ManicureStyle;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 款式表 服务类
* </p>
*
* @author ${author}
* @since 2021-01-22
*/
public interface ManicureStyleService extends IService<ManicureStyle> {
}
| [
"“1753161465@qq.com"
] | “1753161465@qq.com |
81a7f134c8b3606157274e713c3ccc8a8f730ae9 | b781b42dd719767e4adcec21bc1f3de60907ddad | /src/FactoryMethodPattern/DomesticInterestPlan.java | 1333b71792a71e2771f92a264ee5d843bc69ebec | [] | no_license | maulikomal/Java-Example | 1ba2da47b460c609360a75b567aea39364adfcea | f2dfee2afbf9eda1be28145c905bc9bf976ff78e | refs/heads/master | 2021-01-20T08:34:08.680264 | 2017-08-27T17:10:00 | 2017-08-27T17:10:00 | 101,564,080 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 216 | java | package FactoryMethodPattern;
public class DomesticInterestPlan extends InterestRatePlan{
public void getRate(){
System.out.print("Get Rate Method called from DomesticInterestPlan class");
rate = 3.50;
}
}
| [
"dmaulik.ip@gmail.com"
] | dmaulik.ip@gmail.com |
61a66264f153994762424b430d7a4e479414458e | f79fe2dc4971ed91145a4a574ca27c172b0bf68b | /src/main/java/samrock/MissingChapter.java | 3008e56bbf4631edf1077a4c49c8b5001cb0bc5f | [] | no_license | naaspati-practicing/SamrockTools | d3a3ef4c5646db1554a277030ca3492c4b4d81b8 | e2cc56be53fc8cca6cdec59ed358017d8515fdc2 | refs/heads/master | 2020-04-15T22:38:07.644568 | 2019-07-17T16:37:34 | 2019-07-17T16:37:34 | 165,080,383 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 313 | java | package samrock;
public class MissingChapter {
public final int manga_id;
public final double number;
public final String title;
public MissingChapter(int manga_id, double number, String title) {
this.manga_id = manga_id;
this.number = number;
this.title = title;
}
} | [
"naaspati@gmail.com"
] | naaspati@gmail.com |
cba0232f8532926cc9ed285abd045f8d0e04b42f | 8b63b7b7a37ab2a2c0f63097fe20bf171e2662d6 | /HO2/webapp/WEB-INF/classes/victor/HTTPOperationController.java | f93542d91ec21f11ad794aafb799e442813edac1 | [] | no_license | VladTepes2112/TTBootCampHandsOn | 22058194c04d9b4f55815d5cf9dcf78c33b23184 | 2268c7c5c932ee610236042ccfd1f33d81b5fe26 | refs/heads/main | 2023-01-05T03:10:16.599696 | 2020-11-02T00:20:03 | 2020-11-02T00:20:03 | 307,138,495 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 244 | java | package victor;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
| [
"victor.carrillo.2112@hotmail.com"
] | victor.carrillo.2112@hotmail.com |
2a027c2dac3958f29fd3979092fb30cf0ea45710 | 2d45824443a6f97529cc939102c88e496b33b3f5 | /GeeksForGeeks/src/com/shrvn/ds/linkedlist/LinkedList.java | 1f3a259285e9cf91628f47ee4b6c985c1fec4a06 | [] | no_license | shra012/Java-Problems | 28d1a919b57b137d35a438643afd6749e576781f | f0fb92d70bb7778208bb333b6de26b91e1a71790 | refs/heads/master | 2022-01-12T20:28:57.447055 | 2021-12-26T15:32:41 | 2021-12-26T15:32:41 | 67,307,230 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,859 | java | package com.shrvn.ds.linkedlist;
/**
* @author shravan
*
*/
public class LinkedList {
Node head;
public static class Node{
public Node next;
public int data;
public Node(int data) {
this.data = data;
this.next =null;
}
public Node() {
}
public Node(Node node){
this.data=node.data;
this.next=node.next;
}
}
public void push(int new_data){
Node new_node = new Node(new_data);
new_node.next=head;
head=new_node;
}
public void append(int new_data){
Node new_node = new Node(new_data);
if(head==null){
head=new_node;
return;
}
Node temp=head;
while(temp.next!=null){
temp=temp.next;
}
temp.next=new_node;
return;
}
public void push(Node prev_node,int data){
if(prev_node==null){
System.out.println("The given previous node is null.");
return;
}
Node new_node = new Node(data);
new_node.next=prev_node.next;
prev_node.next = new_node;
}
public void deleteKey(int data){
Node temp = head,prev_node=null;
if(temp != null && temp.data == data){
head=temp.next;
return;
}
while(temp!=null && temp.data!=data){
prev_node=temp;
temp=temp.next;
}
if(temp==null){
return;
}
prev_node.next=temp.next;
return;
}
public void deletePosition(int position){
if(head==null){
return;
}
Node temp = head,prev_node=null;
if(position==0){
head=temp.next;
return;
}
int i=0;
while(temp!=null && i!=position){
prev_node=temp;
temp=temp.next;
i++;
}
prev_node.next=temp.next;
return;
}
public void printList(){
Node temp = head;
while(temp!=null){
System.out.print(temp.data+" ");
temp=temp.next;
}
System.out.println();
}
public int length(Node node){
return 1+length(node);
}
public Node getNewNode(Node node){
return new Node(node);
}
public void recursiveReverse(Node head){
Node first;
Node rest;
Node top=last();
/* empty list */
if (head == null)
return;
/* suppose first = {1, 2, 3}, rest = {2, 3} */
first = head;
rest = first.next;
/* List has only one node */
if (rest == null)
return;
/* reverse the rest list and put the first element at the end */
recursiveReverse(rest);
first.next.next = first;
/* tricky step -- see the diagram */
first.next = null;
/* fix the head pointer */
this.head = top;
}
public Node last(){
Node temp =head;
Node prev =null;
while(temp!=null){
prev=temp;
temp=temp.next;
}
return prev;
}
public void swap(int firstData, int secondData){
if(firstData==secondData) return;
if(head==null) return;
Node first=head,second=head;
Node prev_first=null,prev_seond=null;
while(first!=null && first.data!=firstData){
prev_first=first;
first=first.next;
}
while(second!=null && second.data!=secondData){
prev_seond=second;
second=second.next;
}
if(first==null || second ==null){
return;
}
if(null!=prev_first){
prev_first.next=second;
}else{
head=first;
}
if(null!=prev_seond){
prev_seond.next=first;
}else{
head=second;
}
Node temp;
temp=first.next;
first.next=second.next;
second.next=temp;
return;
}
public void reverseList(){
if(head==null) return;
Node prev=null,
current=head,
next=null;
while(current!=null){
next=current.next;
current.next=prev;
prev=current;
current=next;
}
head=prev;
}
public Node getHead(){
return this.head;
}
public Node getNewNode(){
Node node = new Node();
return node;
}
public static void main(String[] args) {
LinkedList list = new LinkedList();
list.push(0);
list.push(1);
list.push(2);
list.push(3);
list.push(4);
list.append(5);
list.append(6);
list.append(7);
list.append(8);
list.printList();
list.deletePosition(1);
list.printList();
list.deleteKey(0);
list.printList();
}
}
| [
"shravan_fisher@yahoo.ca"
] | shravan_fisher@yahoo.ca |
0d2437139f7939eec3a6e442366a3e84e2fbc746 | 2c723719a36de4355814f29069f6927df9090dab | /src/main/java/com/venkat/resume/repository/ImageRepository.java | 461cd5e8006b8b78db91cbe9e2b78b387d6d6732 | [] | no_license | jarugulavenkat7/ResumeMaker_Backend | b6cc9336a6cfec1441633e2ceae8f64858781a91 | bd8d7cb938c665e83a6c559f0a77d0089d9dbdd1 | refs/heads/master | 2023-06-26T18:32:59.411496 | 2021-07-21T19:19:19 | 2021-07-21T19:19:19 | 387,912,333 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 345 | java | package com.venkat.resume.repository;
import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import com.venkat.resume.model.Image;
@Repository
public interface ImageRepository extends JpaRepository<Image, Long> {
Optional<Image> findByName(String name);
}
| [
"jarugulavenkat7@gmail.com"
] | jarugulavenkat7@gmail.com |
d7f7db3895fb28a78a6bca03b4c5d429f3dbc6c1 | e4e3dc49a1e92195d97f61c5c8f36178214e12c2 | /src/net/wit/dao/impl/MobileSegmentDaoImpl.java | a0e62e091d032a1609b8fe835b5658abef9f11b8 | [] | no_license | pologood/FMCG | 1a393fcc4c7942ca932a2ee5c169c3bf630145e0 | 690cb06da198fb6a3dec98c1ed7b4886b716a40b | refs/heads/master | 2021-01-09T20:08:09.461153 | 2017-02-06T09:27:48 | 2017-02-06T09:27:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,071 | java | /*
* Copyright 2005-2013 rsico. All rights reserved.
* Support: http://www.rsico.cn
* License: http://www.rsico.cn/license
*/
package net.wit.dao.impl;
import javax.persistence.FlushModeType;
import javax.persistence.NoResultException;
import net.wit.dao.MobileSegmentDao;
import net.wit.entity.MobileSegment;
import org.springframework.stereotype.Repository;
/**
* Dao - 手机快充价格
*
* @author rsico Team
* @version 3.0
*/
@Repository("mobileSegmentDaoImpl")
public class MobileSegmentDaoImpl extends BaseDaoImpl<MobileSegment, Long> implements MobileSegmentDao {
public MobileSegment findByMobile(String mobile) {
if (mobile == null) {
return null;
}
String jpql = "select mobileSegment from MobileSegment mobileSegment where mobileSegment.segment = :segment";
try {
int segment = Integer.parseInt( mobile.substring(0,7) );
return entityManager.createQuery(jpql, MobileSegment.class).setFlushMode(FlushModeType.COMMIT).setParameter("segment",segment).getSingleResult();
} catch (NoResultException e) {
return null;
}
}
} | [
"hujun519191086@163.com"
] | hujun519191086@163.com |
4f50e4a0d567a55e6971132752a5e2b8fc7b2488 | 6529e711cdcd26aea49a5a3a53de974ff7810696 | /src/main/java/com/zy17/guess/famous/entity/Subject.java | 33b398d36ef43f6cf73559273acc1d7491e249b1 | [] | no_license | iforgetyou/guess | 89dbd48b31727c2e29cdd4f0d24d85fe345e8d12 | 5038b6942022b0a9d65660413db496f801873677 | refs/heads/master | 2020-04-06T04:45:18.641139 | 2017-12-29T03:23:07 | 2017-12-29T03:23:07 | 82,916,768 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 856 | java | package com.zy17.guess.famous.entity;
import lombok.Data;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
/**
* 题目
* 2017/2/28 zy17
*/
@Data
@Entity
public class Subject extends BaseEntity {
@Id
@GeneratedValue(generator = "uuid")
@GenericGenerator(name = "uuid", strategy = "uuid2")
private String subjectId;
@Column(nullable = false)
private String topicId;
// 名人id
private String celebrityId;
// 名人头像
private String avatar;
// 描述
private String description;
// 大图详情
private String celebrityUrl;
// 正确答案
private String rightAnswer;
private String answerA;
private String answerB;
private String answerC;
private String answerD;
}
| [
"iforgetyou_521@126.com"
] | iforgetyou_521@126.com |
9bf9e03caa254c09585387465fadb50921a6eec0 | a1730de4b50c17ecd388a995a1526c2eab80cb7d | /Examples/src/AsposeCellsExamples/TechnicalArticles/AutoFitRowsforMergedCells.java | cc15ba2ae0d8f7401add2c37bea5121a49624d3b | [
"MIT"
] | permissive | aspose-cells/Aspose.Cells-for-Java | 2dcba41fc99b0f4b3c089f2ff1a3bcd32591eea1 | 42d501da827058d07df7399ae104bb2eb88929c3 | refs/heads/master | 2023-09-04T21:35:15.198721 | 2023-08-10T09:26:41 | 2023-08-10T09:26:41 | 2,849,714 | 133 | 89 | MIT | 2023-03-07T09:39:29 | 2011-11-25T13:16:33 | Java | UTF-8 | Java | false | false | 1,815 | java | package AsposeCellsExamples.TechnicalArticles;
import com.aspose.cells.AutoFitMergedCellsType;
import com.aspose.cells.AutoFitterOptions;
import com.aspose.cells.Range;
import com.aspose.cells.Style;
import com.aspose.cells.Workbook;
import com.aspose.cells.Worksheet;
import AsposeCellsExamples.Utils;
public class AutoFitRowsforMergedCells {
public static void main(String[] args) throws Exception {
// ExStart:1
// The path to the documents directory.
String dataDir = Utils.getSharedDataDir(AutoFitRowsforMergedCells.class) + "TechnicalArticles/";
// Instantiate a new Workbook
Workbook workbook = new Workbook();
// Get the first (default) worksheet
Worksheet _worksheet = workbook.getWorksheets().get(0);
// Create a range A1:B1
Range range = _worksheet.getCells().createRange(0, 0, 1, 2);
// Merge the cells
range.merge();
// Insert value to the merged cell A1
_worksheet.getCells().get(0, 0).setValue(
"A quick brown fox jumps over the lazy dog. A quick brown fox jumps over the lazy dog....end");
// Create a style object
Style style = _worksheet.getCells().get(0, 0).getStyle();
// Set wrapping text on
style.setTextWrapped(true);
// Apply the style to the cell
_worksheet.getCells().get(0, 0).setStyle(style);
// Create an object for AutoFitterOptions
AutoFitterOptions options = new AutoFitterOptions();
// Set auto-fit for merged cells
options.setAutoFitMergedCellsType(AutoFitMergedCellsType.EACH_LINE);
// Autofit rows in the sheet(including the merged cells)
_worksheet.autoFitRows(options);
// Save the Excel file
workbook.save(dataDir + "AFRFMergedCells.xlsx");
// ExEnd:1
System.out.println("AutoFitRowsforMergedCells executed successfully.");
}
}
| [
"m.ahmadchishti@gmail.com"
] | m.ahmadchishti@gmail.com |
011538ce414339fcf6bc7d2246228951957e8851 | 45189a704c0050101058da752a1d7ae2fba9c5b2 | /src/main/java/entities/User.java | 55d8f4716bf22344783c3307ce2dbd12c53bd134 | [] | no_license | IvelinStoyanovIS/LibExperiment1 | 67c0304c0883d549517fce05864825c370368d3b | 3de0f619ad94a324dbae664d9f78760a2951a49f | refs/heads/master | 2021-04-30T03:51:38.872983 | 2018-06-21T06:28:55 | 2018-06-21T06:28:55 | 121,523,871 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,153 | java | package entities;
public class User {
private int id;
private String userName;
private String password;
private String hashedPassword;
private int role_id;
public User()
{
}
public User(String userName,String password, String hasedPassword) {
this.userName = userName;
this.password = password;
this.hashedPassword=hasedPassword;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getHashedPassword() {
return hashedPassword;
}
public void setHashedPassword(String hasedPassword) {
this.hashedPassword = hasedPassword;
}
public int getRole_id() {
return role_id;
}
public void setRole_id(int role_id) {
this.role_id = role_id;
}
} | [
"bibishte@gmail.com"
] | bibishte@gmail.com |
f1cee10d6df47f12eeec272f192d9770551bc19e | c074acf2945feebfe5927478eb36dee946364f0a | /leetcode/src/main/java/com/chang/leetcode/Problem86.java | cd380bf0d9f99944c8721ca1082ffc0d789171e5 | [] | no_license | wooyeeyii/think-in-java | fcbf9d7baf9fe30ac0dbdb8ebe43a98f69541175 | 3d8c7ab5a7ede7b9d625881bda350ecc19a47375 | refs/heads/master | 2021-11-08T17:08:10.117191 | 2021-11-05T01:22:40 | 2021-11-05T01:22:40 | 178,848,694 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,614 | java | /*
* 86. Partition List
*
* Given a linked list and a value x, partition it such that all nodes
* less than x come before nodes greater than or equal to x.
*
* You should preserve the original relative order of the nodes in each of the two partitions.
*
* Example:
* Input: head = 1->4->3->2->5->2, x = 3
* Output: 1->2->2->4->3->5
*/
package com.chang.leetcode;
import com.chang.common.ListNode;
public class Problem86 {
public ListNode partition(ListNode head, int x) {
ListNode preHead = new ListNode(-1);
preHead.next = head;
ListNode prePos = preHead;
ListNode nodePos = head;
ListNode pre = preHead;
ListNode node = head;
while (null != node && x > node.val) {
if (node.val > nodePos.val) {
prePos = pre;
nodePos = node;
}
pre = node;
node = node.next;
}
if (null != node && node.val >= x) {
if (node.val > nodePos.val) {
prePos = pre;
nodePos = node;
}
pre = node;
node = node.next;
}
while (null != node) {
if (node.val < x) {
pre.next = node.next;
node.next = prePos.next;
prePos.next = node;
prePos = node;
node = pre.next;
} else {
pre = node;
node = node.next;
}
}
return preHead.next;
}
public static void main(String[] args) {
Problem86 problem = new Problem86();
ListNode n1 = new ListNode(1);
ListNode n2 = new ListNode(4);
ListNode n3 = new ListNode(3);
ListNode n4 = new ListNode(2);
ListNode n5 = new ListNode(5);
ListNode n6 = new ListNode(2);
n1.next = n2;
n2.next = n3;
n3.next = n4;
n4.next = n5;
n5.next = n6;
ListNode res = problem.partition(n1, 3);
//1->2->2->4->3->5
while (null != res) {
System.out.println(res.val + ", ");
res = res.next;
}
System.out.println("#################");
// input [3,1] 2
//output [1,3]
ListNode m1 = new ListNode(3);
ListNode m2 = new ListNode(1);
m1.next = m2;
ListNode res2 = problem.partition(m1, 2);
//1->2->2->4->3->5
while (null != res2) {
System.out.println(res2.val + ", ");
res2 = res2.next;
}
System.out.println("#################");
}
}
| [
"wooyeeyii@163.com"
] | wooyeeyii@163.com |
81863fc9b8039d889065fb2cc9b7b83759cfbd45 | fa5fb9ccc28d8ebdfb4ec10098241822c3129bee | /DrivingTest/app/src/main/java/cn/hongjitech/vehicle/javaBean/ReservationInfoRoot.java | 138c38ce6cbe3bc4370ce0025c60c5e202f91a36 | [] | no_license | JiaoPengJob/TechPro | b9a83b07c061fae284330613e96ebaca737e5a5c | 6d930653fabb338f10b37899f9eaf646599eaa5d | refs/heads/master | 2020-04-06T06:53:41.157609 | 2016-09-14T02:39:09 | 2016-09-14T02:39:09 | 65,542,251 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 682 | java | package cn.hongjitech.vehicle.javaBean;
import java.util.List;
/**
* 预约信息:根
*/
public class ReservationInfoRoot {
private String result;
private List<ReservationInfo> data;
public ReservationInfoRoot() {
}
public ReservationInfoRoot(String result, List<ReservationInfo> data) {
this.result = result;
this.data = data;
}
public String getResult() {
return result;
}
public void setResult(String result) {
this.result = result;
}
public List<ReservationInfo> getData() {
return data;
}
public void setData(List<ReservationInfo> data) {
this.data = data;
}
}
| [
"jiaopengjob@outlook.com"
] | jiaopengjob@outlook.com |
942cb2c7a641316868041e91f52cae8e45fa8924 | c0e8bc799e8b993f9f8eebf39b77f8d956792c92 | /OAuth2Resources/src/main/java/com/wab/ipdb/IP.java | 201b600959b8866a63a508f617dca809cfb7de5f | [] | no_license | jlhuang9/springboot-oa | 379241713d4d62716ef0d752378964c23a4c00b1 | 226007520f9f22eee0b0bcbfa5ea80651c2a5f42 | refs/heads/master | 2021-05-02T06:06:23.886837 | 2018-02-09T03:45:44 | 2018-02-09T03:45:44 | 120,852,775 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,399 | java | package com.wab.ipdb;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.io.ClassPathResource;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.charset.Charset;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.ReentrantLock;
/**
* @author hcq
* https://www.ipip.net/download.html 免费库下载
* https://www.ipip.net/index.html#down demo
* @create 2018-01-29 下午 6:14
**/
public class IP {
public static final String IP_DB_NAME = "17monipdb.dat";
public static final String OS_NAME = "os.name";
private static Logger LOG = LoggerFactory.getLogger(IP.class);
public static void init() {
String osName = System.getProperty(OS_NAME);
LOG.info("OS_NAME is 【{}】", osName);
LOG.info("加载IPDB文件中。。。。");
// if (osName.startsWith("Win")) {
ClassPathResource classPathResource = new ClassPathResource(IP_DB_NAME);
try {
InputStream inputStream = classPathResource.getInputStream();
LOG.info("inputStream");
load(inputStream);
if (enableFileWatch) {
watch();
}
LOG.info("加载完成");
} catch (IOException e) {
LOG.error("加载失败 >>>>> {}", e);
}
}
public static boolean enableFileWatch = false;
private static int offset;
private static int[] index = new int[256];
private static ByteBuffer dataBuffer;
private static ByteBuffer indexBuffer;
private static Long lastModifyTime = 0L;
private static File ipFile;
private static ReentrantLock lock = new ReentrantLock();
public static void load(String filename) {
ipFile = new File(filename);
load();
if (enableFileWatch) {
watch();
}
}
public static void load(String filename, boolean strict) throws Exception {
ipFile = new File(filename);
if (strict) {
int contentLength = Long.valueOf(ipFile.length()).intValue();
if (contentLength < 512 * 1024) {
throw new Exception("ip data file error.");
}
}
load();
if (enableFileWatch) {
watch();
}
}
public static String[] find(String ip) {
int ip_prefix_value = new Integer(ip.substring(0, ip.indexOf(".")));
long ip2long_value = ip2long(ip);
int start = index[ip_prefix_value];
int max_comp_len = offset - 1028;
long index_offset = -1;
int index_length = -1;
byte b = 0;
for (start = start * 8 + 1024; start < max_comp_len; start += 8) {
if (int2long(indexBuffer.getInt(start)) >= ip2long_value) {
index_offset = bytesToLong(b, indexBuffer.get(start + 6), indexBuffer.get(start + 5), indexBuffer.get(start + 4));
index_length = 0xFF & indexBuffer.get(start + 7);
break;
}
}
byte[] areaBytes;
lock.lock();
try {
dataBuffer.position(offset + (int) index_offset - 1024);
areaBytes = new byte[index_length];
dataBuffer.get(areaBytes, 0, index_length);
} finally {
lock.unlock();
}
return new String(areaBytes, Charset.forName("UTF-8")).split("\t", -1);
}
private static void watch() {
Executors.newScheduledThreadPool(1).scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
long time = ipFile.lastModified();
if (time > lastModifyTime) {
lastModifyTime = time;
load();
}
}
}, 1000L, 5000L, TimeUnit.MILLISECONDS);
}
private static void load(InputStream inputStream) {
lock.lock();
try {
dataBuffer = ByteBuffer.allocate(23002367);
int readBytesLength;
byte[] chunk = new byte[4096];
while (inputStream.available() > 0) {
readBytesLength = inputStream.read(chunk);
dataBuffer.put(chunk, 0, readBytesLength);
}
dataBuffer.position(0);
int indexLength = dataBuffer.getInt();
byte[] indexBytes = new byte[indexLength];
dataBuffer.get(indexBytes, 0, indexLength - 4);
indexBuffer = ByteBuffer.wrap(indexBytes);
indexBuffer.order(ByteOrder.LITTLE_ENDIAN);
offset = indexLength;
int loop = 0;
while (loop++ < 256) {
index[loop - 1] = indexBuffer.getInt();
}
indexBuffer.order(ByteOrder.BIG_ENDIAN);
} catch (IOException ioe) {
ioe.printStackTrace();
} finally {
try {
if (inputStream != null) {
inputStream.close();
}
} catch (IOException e) {
e.printStackTrace();
}
lock.unlock();
}
}
private static void load() {
lastModifyTime = ipFile.lastModified();
FileInputStream fin = null;
lock.lock();
try {
dataBuffer = ByteBuffer.allocate(Long.valueOf(ipFile.length()).intValue());
fin = new FileInputStream(ipFile);
int readBytesLength;
byte[] chunk = new byte[4096];
while (fin.available() > 0) {
readBytesLength = fin.read(chunk);
dataBuffer.put(chunk, 0, readBytesLength);
}
dataBuffer.position(0);
int indexLength = dataBuffer.getInt();
byte[] indexBytes = new byte[indexLength];
dataBuffer.get(indexBytes, 0, indexLength - 4);
indexBuffer = ByteBuffer.wrap(indexBytes);
indexBuffer.order(ByteOrder.LITTLE_ENDIAN);
offset = indexLength;
int loop = 0;
while (loop++ < 256) {
index[loop - 1] = indexBuffer.getInt();
}
indexBuffer.order(ByteOrder.BIG_ENDIAN);
} catch (IOException ioe) {
ioe.printStackTrace();
} finally {
try {
if (fin != null) {
fin.close();
}
} catch (IOException e) {
e.printStackTrace();
}
lock.unlock();
}
}
private static long bytesToLong(byte a, byte b, byte c, byte d) {
return int2long((((a & 0xff) << 24) | ((b & 0xff) << 16) | ((c & 0xff) << 8) | (d & 0xff)));
}
private static int str2Ip(String ip) {
String[] ss = ip.split("\\.");
int a, b, c, d;
a = Integer.parseInt(ss[0]);
b = Integer.parseInt(ss[1]);
c = Integer.parseInt(ss[2]);
d = Integer.parseInt(ss[3]);
return (a << 24) | (b << 16) | (c << 8) | d;
}
private static long ip2long(String ip) {
return int2long(str2Ip(ip));
}
private static long int2long(int i) {
long l = i & 0x7fffffffL;
if (i < 0) {
l |= 0x080000000L;
}
return l;
}
} | [
"wminhub@163.com"
] | wminhub@163.com |
cfe10b8cea118e8902bf2231f100a58c2047d54a | 4f7721d7445428b3f6e33d9915e73873b8ed7bfb | /app/src/main/java/com/imc/getout/fragments/joinFragments/Invite.java | bba9ba6228c6f952057e8f7e27b9b3bf7b234db3 | [] | no_license | denizgencay/GetOut | a9c9702562178b1edae86cfe2a0fb4d702e6e60e | 30a4b91b9da4d3bd0ddc6ba87b4f346a78558284 | refs/heads/main | 2023-04-01T19:32:45.732894 | 2020-12-29T15:15:57 | 2020-12-29T15:15:57 | 352,601,431 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,412 | java | package com.imc.getout.fragments.joinFragments;
public class Invite {
private String title,location,name,date,personNumber,address,state,city,photoUrl,userUid;
public Invite(String title, String location, String name, String date, String personNumber, String address, String state, String city, String photoUrl,String userUid) {
this.title = title;
this.location = location;
this.name = name;
this.date = date;
this.personNumber = personNumber;
this.address = address;
this.state = state;
this.city = city;
this.photoUrl = photoUrl;
this.userUid = userUid;
}
public String getUserUid() {
return userUid;
}
public String getTitle() {
return this.title;
}
public String getLocation() {
return this.location;
}
public String getname() {
return this.name;
}
public String getDate() {
return this.date;
}
public String getPersonNumber() {
return this.personNumber;
}
public String getAddress() {
return this.address;
}
public String getState() {
if (state != null) {
return this.state;
} else {
return "";
}
}
public String getCity() {
return this.city;
}
public String getPhotoUrl() {
return this.photoUrl;
}
}
| [
"egecanceylan@github.com"
] | egecanceylan@github.com |
d96973f5956d0862834d69755ab5ca668050454b | 4ca8d20d23db7c32a2bd86dd6d5cd351058ae91b | /src/main/java/com/xero/models/accounting/TenNinteyNineContact.java | 79b62a43504faff435d4660e2e71d43adfb4d391 | [
"MIT"
] | permissive | BlackWind57/Xero-Java | 5d8cad57521d0e033f8122c34f33327dc0c7299a | ca40b735961c35c1d5dc5d75a9d0da8daf9fa416 | refs/heads/master | 2021-03-06T03:17:25.191676 | 2020-03-05T05:50:48 | 2020-03-05T05:50:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,553 | java | /*
* Accounting API
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 2.0.3
* Contact: api@xero.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package com.xero.models.accounting;
import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.UUID;
import org.threeten.bp.LocalDateTime;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
/**
* TenNinteyNineContact
*/
public class TenNinteyNineContact {
@JsonProperty("Box1")
private Double box1;
@JsonProperty("Box2")
private Double box2;
@JsonProperty("Box3")
private Double box3;
@JsonProperty("Box4")
private Double box4;
@JsonProperty("Box5")
private Double box5;
@JsonProperty("Box6")
private Double box6;
@JsonProperty("Box7")
private Double box7;
@JsonProperty("Box8")
private Double box8;
@JsonProperty("Box9")
private Double box9;
@JsonProperty("Box10")
private Double box10;
@JsonProperty("Box11")
private Double box11;
@JsonProperty("Box13")
private Double box13;
@JsonProperty("Box14")
private Double box14;
@JsonProperty("Name")
private String name;
@JsonProperty("FederalTaxIDType")
private String federalTaxIDType;
@JsonProperty("City")
private String city;
@JsonProperty("Zip")
private String zip;
@JsonProperty("State")
private String state;
@JsonProperty("Email")
private String email;
@JsonProperty("StreetAddress")
private String streetAddress;
@JsonProperty("TaxID")
private String taxID;
@JsonProperty("ContactId")
private UUID contactId;
public TenNinteyNineContact box1(Double box1) {
this.box1 = box1;
return this;
}
/**
* Box 1 on 1099 Form
* @return box1
**/
@ApiModelProperty(value = "Box 1 on 1099 Form")
public Double getBox1() {
return box1;
}
public void setBox1(Double box1) {
this.box1 = box1;
}
public TenNinteyNineContact box2(Double box2) {
this.box2 = box2;
return this;
}
/**
* Box 2 on 1099 Form
* @return box2
**/
@ApiModelProperty(value = "Box 2 on 1099 Form")
public Double getBox2() {
return box2;
}
public void setBox2(Double box2) {
this.box2 = box2;
}
public TenNinteyNineContact box3(Double box3) {
this.box3 = box3;
return this;
}
/**
* Box 3 on 1099 Form
* @return box3
**/
@ApiModelProperty(value = "Box 3 on 1099 Form")
public Double getBox3() {
return box3;
}
public void setBox3(Double box3) {
this.box3 = box3;
}
public TenNinteyNineContact box4(Double box4) {
this.box4 = box4;
return this;
}
/**
* Box 4 on 1099 Form
* @return box4
**/
@ApiModelProperty(value = "Box 4 on 1099 Form")
public Double getBox4() {
return box4;
}
public void setBox4(Double box4) {
this.box4 = box4;
}
public TenNinteyNineContact box5(Double box5) {
this.box5 = box5;
return this;
}
/**
* Box 5 on 1099 Form
* @return box5
**/
@ApiModelProperty(value = "Box 5 on 1099 Form")
public Double getBox5() {
return box5;
}
public void setBox5(Double box5) {
this.box5 = box5;
}
public TenNinteyNineContact box6(Double box6) {
this.box6 = box6;
return this;
}
/**
* Box 6 on 1099 Form
* @return box6
**/
@ApiModelProperty(value = "Box 6 on 1099 Form")
public Double getBox6() {
return box6;
}
public void setBox6(Double box6) {
this.box6 = box6;
}
public TenNinteyNineContact box7(Double box7) {
this.box7 = box7;
return this;
}
/**
* Box 7 on 1099 Form
* @return box7
**/
@ApiModelProperty(value = "Box 7 on 1099 Form")
public Double getBox7() {
return box7;
}
public void setBox7(Double box7) {
this.box7 = box7;
}
public TenNinteyNineContact box8(Double box8) {
this.box8 = box8;
return this;
}
/**
* Box 8 on 1099 Form
* @return box8
**/
@ApiModelProperty(value = "Box 8 on 1099 Form")
public Double getBox8() {
return box8;
}
public void setBox8(Double box8) {
this.box8 = box8;
}
public TenNinteyNineContact box9(Double box9) {
this.box9 = box9;
return this;
}
/**
* Box 9 on 1099 Form
* @return box9
**/
@ApiModelProperty(value = "Box 9 on 1099 Form")
public Double getBox9() {
return box9;
}
public void setBox9(Double box9) {
this.box9 = box9;
}
public TenNinteyNineContact box10(Double box10) {
this.box10 = box10;
return this;
}
/**
* Box 10 on 1099 Form
* @return box10
**/
@ApiModelProperty(value = "Box 10 on 1099 Form")
public Double getBox10() {
return box10;
}
public void setBox10(Double box10) {
this.box10 = box10;
}
public TenNinteyNineContact box11(Double box11) {
this.box11 = box11;
return this;
}
/**
* Box 11 on 1099 Form
* @return box11
**/
@ApiModelProperty(value = "Box 11 on 1099 Form")
public Double getBox11() {
return box11;
}
public void setBox11(Double box11) {
this.box11 = box11;
}
public TenNinteyNineContact box13(Double box13) {
this.box13 = box13;
return this;
}
/**
* Box 13 on 1099 Form
* @return box13
**/
@ApiModelProperty(value = "Box 13 on 1099 Form")
public Double getBox13() {
return box13;
}
public void setBox13(Double box13) {
this.box13 = box13;
}
public TenNinteyNineContact box14(Double box14) {
this.box14 = box14;
return this;
}
/**
* Box 14 on 1099 Form
* @return box14
**/
@ApiModelProperty(value = "Box 14 on 1099 Form")
public Double getBox14() {
return box14;
}
public void setBox14(Double box14) {
this.box14 = box14;
}
public TenNinteyNineContact name(String name) {
this.name = name;
return this;
}
/**
* Contact name on 1099 Form
* @return name
**/
@ApiModelProperty(value = "Contact name on 1099 Form")
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public TenNinteyNineContact federalTaxIDType(String federalTaxIDType) {
this.federalTaxIDType = federalTaxIDType;
return this;
}
/**
* Contact Fed Tax ID type
* @return federalTaxIDType
**/
@ApiModelProperty(value = "Contact Fed Tax ID type")
public String getFederalTaxIDType() {
return federalTaxIDType;
}
public void setFederalTaxIDType(String federalTaxIDType) {
this.federalTaxIDType = federalTaxIDType;
}
public TenNinteyNineContact city(String city) {
this.city = city;
return this;
}
/**
* Contact city on 1099 Form
* @return city
**/
@ApiModelProperty(value = "Contact city on 1099 Form")
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public TenNinteyNineContact zip(String zip) {
this.zip = zip;
return this;
}
/**
* Contact zip on 1099 Form
* @return zip
**/
@ApiModelProperty(value = "Contact zip on 1099 Form")
public String getZip() {
return zip;
}
public void setZip(String zip) {
this.zip = zip;
}
public TenNinteyNineContact state(String state) {
this.state = state;
return this;
}
/**
* Contact State on 1099 Form
* @return state
**/
@ApiModelProperty(value = "Contact State on 1099 Form")
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public TenNinteyNineContact email(String email) {
this.email = email;
return this;
}
/**
* Contact email on 1099 Form
* @return email
**/
@ApiModelProperty(value = "Contact email on 1099 Form")
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public TenNinteyNineContact streetAddress(String streetAddress) {
this.streetAddress = streetAddress;
return this;
}
/**
* Contact address on 1099 Form
* @return streetAddress
**/
@ApiModelProperty(value = "Contact address on 1099 Form")
public String getStreetAddress() {
return streetAddress;
}
public void setStreetAddress(String streetAddress) {
this.streetAddress = streetAddress;
}
public TenNinteyNineContact taxID(String taxID) {
this.taxID = taxID;
return this;
}
/**
* Contact tax id on 1099 Form
* @return taxID
**/
@ApiModelProperty(value = "Contact tax id on 1099 Form")
public String getTaxID() {
return taxID;
}
public void setTaxID(String taxID) {
this.taxID = taxID;
}
public TenNinteyNineContact contactId(UUID contactId) {
this.contactId = contactId;
return this;
}
/**
* Contact contact id
* @return contactId
**/
@ApiModelProperty(value = "Contact contact id")
public UUID getContactId() {
return contactId;
}
public void setContactId(UUID contactId) {
this.contactId = contactId;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
TenNinteyNineContact tenNinteyNineContact = (TenNinteyNineContact) o;
return Objects.equals(this.box1, tenNinteyNineContact.box1) &&
Objects.equals(this.box2, tenNinteyNineContact.box2) &&
Objects.equals(this.box3, tenNinteyNineContact.box3) &&
Objects.equals(this.box4, tenNinteyNineContact.box4) &&
Objects.equals(this.box5, tenNinteyNineContact.box5) &&
Objects.equals(this.box6, tenNinteyNineContact.box6) &&
Objects.equals(this.box7, tenNinteyNineContact.box7) &&
Objects.equals(this.box8, tenNinteyNineContact.box8) &&
Objects.equals(this.box9, tenNinteyNineContact.box9) &&
Objects.equals(this.box10, tenNinteyNineContact.box10) &&
Objects.equals(this.box11, tenNinteyNineContact.box11) &&
Objects.equals(this.box13, tenNinteyNineContact.box13) &&
Objects.equals(this.box14, tenNinteyNineContact.box14) &&
Objects.equals(this.name, tenNinteyNineContact.name) &&
Objects.equals(this.federalTaxIDType, tenNinteyNineContact.federalTaxIDType) &&
Objects.equals(this.city, tenNinteyNineContact.city) &&
Objects.equals(this.zip, tenNinteyNineContact.zip) &&
Objects.equals(this.state, tenNinteyNineContact.state) &&
Objects.equals(this.email, tenNinteyNineContact.email) &&
Objects.equals(this.streetAddress, tenNinteyNineContact.streetAddress) &&
Objects.equals(this.taxID, tenNinteyNineContact.taxID) &&
Objects.equals(this.contactId, tenNinteyNineContact.contactId);
}
@Override
public int hashCode() {
return Objects.hash(box1, box2, box3, box4, box5, box6, box7, box8, box9, box10, box11, box13, box14, name, federalTaxIDType, city, zip, state, email, streetAddress, taxID, contactId);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class TenNinteyNineContact {\n");
sb.append(" box1: ").append(toIndentedString(box1)).append("\n");
sb.append(" box2: ").append(toIndentedString(box2)).append("\n");
sb.append(" box3: ").append(toIndentedString(box3)).append("\n");
sb.append(" box4: ").append(toIndentedString(box4)).append("\n");
sb.append(" box5: ").append(toIndentedString(box5)).append("\n");
sb.append(" box6: ").append(toIndentedString(box6)).append("\n");
sb.append(" box7: ").append(toIndentedString(box7)).append("\n");
sb.append(" box8: ").append(toIndentedString(box8)).append("\n");
sb.append(" box9: ").append(toIndentedString(box9)).append("\n");
sb.append(" box10: ").append(toIndentedString(box10)).append("\n");
sb.append(" box11: ").append(toIndentedString(box11)).append("\n");
sb.append(" box13: ").append(toIndentedString(box13)).append("\n");
sb.append(" box14: ").append(toIndentedString(box14)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" federalTaxIDType: ").append(toIndentedString(federalTaxIDType)).append("\n");
sb.append(" city: ").append(toIndentedString(city)).append("\n");
sb.append(" zip: ").append(toIndentedString(zip)).append("\n");
sb.append(" state: ").append(toIndentedString(state)).append("\n");
sb.append(" email: ").append(toIndentedString(email)).append("\n");
sb.append(" streetAddress: ").append(toIndentedString(streetAddress)).append("\n");
sb.append(" taxID: ").append(toIndentedString(taxID)).append("\n");
sb.append(" contactId: ").append(toIndentedString(contactId)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
| [
"sid.maestre@gmail.com"
] | sid.maestre@gmail.com |
ca368234d79217595084199a6edf766b24af815b | 224249cc7de0ad1848b515f12bb5f462ae8773af | /src/main/java/com/tangmo/xizhu/customer/service/VersionService.java | 0a776194e5d413176daa8455d61107789b7ceab1 | [] | no_license | chamberSccc/xizhu-customer | 805f6c6e0897a761dcaac3e5a061197188e131a2 | f456583e18a7e16707266dcdb8a1afb401e28f5a | refs/heads/master | 2022-03-10T20:29:25.390796 | 2020-03-15T08:10:42 | 2020-03-15T08:10:42 | 214,382,144 | 0 | 0 | null | 2022-02-09T22:19:19 | 2019-10-11T08:20:03 | Java | UTF-8 | Java | false | false | 398 | java | package com.tangmo.xizhu.customer.service;
import com.tangmo.xizhu.customer.common.HttpResult;
/**
* @Author chen bo
* @Date 2019/12/9
* @Version V1.0
* @Description: 版本service
**/
public interface VersionService {
/**
* @param
* @return
* @author chen bo
* @date 2019/12/9
* @description: 获取最新版本号
*/
HttpResult getLatestVersion();
}
| [
"chamber_work@163.com"
] | chamber_work@163.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.