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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
b231f47709a4d0f7f9d48fab37b4af2a453f8cda | 352cb15cce9be9e4402131bb398a3c894b9c72bc | /src/main/java/bytedance/other/UTF8.java | 22b771c6f26f1083d30611b2511e572bfb5b7090 | [
"MIT"
] | permissive | DonaldY/LeetCode-Practice | 9f67220bc6087c2c34606f81154a3e91c5ee6673 | 2b7e6525840de7ea0aed68a60cdfb1757b183fec | refs/heads/master | 2023-04-27T09:58:36.792602 | 2023-04-23T15:49:22 | 2023-04-23T15:49:22 | 179,708,097 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,642 | java | package bytedance.other;
/**
* 拓展练习 - UTF-8 编码验证
*
* 这是 UTF-8 编码的工作方式:
*
* Char. number range | UTF-8 octet sequence
* (hexadecimal) | (binary)
* --------------------+---------------------------------------------
* 0000 0000-0000 007F | 0xxxxxxx
* 0000 0080-0000 07FF | 110xxxxx 10xxxxxx
* 0000 0800-0000 FFFF | 1110xxxx 10xxxxxx 10xxxxxx
* 0001 0000-0010 FFFF | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
*
* 示例 1:
*
* data = [197, 130, 1], 表示 8 位的序列: 11000101 10000010 00000001.
*
* 返回 true 。
* 这是有效的 utf-8 编码,为一个2字节字符,跟着一个1字节字符。
* 示例 2:
*
* data = [235, 140, 4], 表示 8 位的序列: 11101011 10001100 00000100.
*
* 返回 false 。
* 前 3 位都是 1 ,第 4 位为 0 表示它是一个3字节字符。
* 下一个字节是开头为 10 的延续字节,这是正确的。
* 但第二个延续字节不以 10 开头,所以是不符合规则的。
*
* 题意: 比对
*
* 思路: 直接比对
*/
public class UTF8 {
// Time: o(n), Space: o(1)
public boolean validUtf8(int[] data) {
int cnt = 0;
for (int num : data) {
if (cnt == 0) {
if ((num >> 5) == 0b110) cnt = 1;
else if ((num >> 4) == 0b1110) cnt = 2;
else if ((num >> 3) == 0b11110) cnt = 3;
else if ((num >> 7) > 0) return false;
} else {
if ((num >> 6) != 0b10) return false;
--cnt;
}
}
return cnt == 0;
}
}
| [
"448641125@qq.com"
] | 448641125@qq.com |
62afd57076e50258a87576920d634d811baab0d6 | 3db588324f98706c8d6ef7482acb0fa653c2c6cb | /src/main/java/com/gul/repo/StudentRepository.java | 1a1828b30fbf74fe6c13f6ec41cf18276cb978ca | [] | no_license | qtalish/TaskSchedulerExample | e7c730cecab9b00b1b1ee371cfa98ee49a036932 | ecb4104a5365006f7c377f9f906ab8352afb0435 | refs/heads/master | 2022-12-22T00:00:31.770061 | 2020-03-12T06:48:37 | 2020-03-12T06:48:37 | 246,760,283 | 0 | 0 | null | 2022-06-21T02:58:16 | 2020-03-12T06:30:15 | Java | UTF-8 | Java | false | false | 271 | java | package com.gul.repo;
import org.springframework.data.jpa.repository.JpaRepository;
import com.gul.entity.Student;
public interface StudentRepository extends JpaRepository<Student, Integer> {
Student findByEmailAndPassword(String email,String password);
}
| [
"qtalish97@gmail.com"
] | qtalish97@gmail.com |
911ea0f4de5501605c311a84ff13b458c8e59ca4 | afd9e744b606b03a7f6b19fea82ac88d4c34763b | /src/WantOffer/Solution24.java | 42feff7c2081bc53d7f4d30c1647477d9096c478 | [] | no_license | Franciswyyy/Algorithm-Base | 136a6ad0f6408d4ee0e9812ae9dd4ddb9c031fc0 | c95f9b37f574ce805a1a4d0e11d4dbab4e3c588d | refs/heads/master | 2020-03-19T03:20:07.208360 | 2018-09-20T15:24:44 | 2018-09-20T15:24:44 | 135,718,608 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 427 | java | package WantOffer;
public class Solution24 {
public boolean isSymmetrical(TreeNode pRoot) {
return pRoot == null || helper(pRoot.left,pRoot.right);
}
private boolean helper(TreeNode left, TreeNode right){
if(left == null || right == null) return left == right;
if(left.val != right.val) return false;
return helper(left.left,right.right) && helper(left.right, right.left);
}
}
| [
"826531768@qq.com"
] | 826531768@qq.com |
b7b8b9151eac3acbe2d269f490453fbd810d5b2f | a9c3bc848352608a1a299f0812aaf8ff56e22ec2 | /src/main/java/at/htlkaindorf/bigbrain/server/errors/AlreadyInGameError.java | 497c3fb21b1c02908bc7c1e9a2d3b67551686e3b | [] | no_license | BiggusBrainus/brain-server | df25856ad7972185217339172c82fa95645c7753 | 9e54e9dc2ffc9e98292590c1a808f3a908869f9a | refs/heads/master | 2023-06-05T12:58:07.177554 | 2021-06-27T08:26:03 | 2021-06-27T08:26:03 | 348,682,969 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 353 | java | package at.htlkaindorf.bigbrain.server.errors;
/**
* This error should be thrown, when a
* player tries to join a lobby that's already
* in-game.
* @version BigBrain v1
* @since 25.05.2021
* @author m4ttm00ny
*/
public class AlreadyInGameError extends Exception {
public AlreadyInGameError(String message) {
super(message);
}
}
| [
"m4ttm00ny@gmail.com"
] | m4ttm00ny@gmail.com |
4000d7b59d6199430d5c0a07d9cb8ddc4f1b1ea6 | ebc1629c82a03a5bf3f9a1f3e48edff61a7cfb5a | /src/main/java/com/gvsoft/analyse/MessageHandle.java | f1ca36566f1aa22d3e64140e0a00ef55d4f1ce6b | [] | no_license | zhaoqb2015/msgRouting | 2b5b91514d9caa455cf887a85989029bc72fa7fa | 11404909726e6f1a97238ee8680bc9ffa94ec086 | refs/heads/master | 2021-01-18T18:40:09.496652 | 2015-07-31T03:59:17 | 2015-07-31T03:59:17 | 39,988,053 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 245 | java | package com.gvsoft.analyse;
/**
* Created with IntelliJ IDEA.
* User: zhaoqiubo
* Date: 15/7/29
* Time: 上午9:51
* To change this template use File | Settings | File Templates.
*/
public class MessageHandle extends AbstractHandle {
}
| [
"18604055343@163.com"
] | 18604055343@163.com |
0dd7c2118aeb8eb62ab3dfccd1351d4ee5ab8ba6 | 03505684c37433c13d6be84f6906df77daf66036 | /MigrationMiner/src/main/java/com/project/settings/AppSettings.java | 0e81b3d461d5830f932ce1397f7bf7774944b863 | [
"MIT"
] | permissive | adel794/MigrationMiner | edbb6667fb47ca324b4f0f1aa30d9eee1b4b144e | 3c66a794a01b97b0273ba1597d2c3c1ce2758ff9 | refs/heads/master | 2020-06-26T01:46:59.887736 | 2019-07-28T12:56:14 | 2019-07-28T12:56:14 | 199,487,626 | 1 | 0 | MIT | 2019-07-29T16:18:30 | 2019-07-29T16:18:29 | null | UTF-8 | Java | false | false | 336 | java | package com.project.settings;
public class AppSettings {
//Type of the project we want to test
public static ProjectType projectType=ProjectType.Java;
public static boolean isTest=false; // Make this true when you run test client
public static boolean isUsingLD=false; // set if our search using library doumenation or not
}
| [
"hussien89aa@yahoo.com"
] | hussien89aa@yahoo.com |
2478327755b9f20a0b8b32bed4790e86b175117b | 58869a2955b52eadcae729b8d43f862cdfaef4fb | /src/main/java/com/huawei/cn/favorites/domain/UrlLibrary.java | 593a8cfa22ef9a2d3df7452ccdc8bb67102018b8 | [] | no_license | devinAlex/springboot-jpa | 82a675b09b6b6dae8c435e3829899632484e164c | fe073e29105cf380396c780ec679889a9c565461 | refs/heads/master | 2020-03-11T15:23:51.449774 | 2018-04-18T15:26:01 | 2018-04-18T15:26:01 | 130,083,043 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,073 | java | package com.huawei.cn.favorites.domain;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import java.io.Serializable;
/**
* Created by DingYS on 2016/12/29.
*/
@Entity
public class UrlLibrary extends Entitys implements Serializable{
@Id
@GeneratedValue
private Long id;
@Column(nullable = false)
private String url;
@Column(nullable = true)
private String logoUrl;
@Column(columnDefinition="INT default 0")
private int count;
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getLogoUrl() {
return logoUrl;
}
public void setLogoUrl(String logoUrl) {
this.logoUrl = logoUrl;
}
}
| [
"1161515052@qq.com"
] | 1161515052@qq.com |
8fb0cae111ca4722f2eb830d246af58382104d29 | a949a6610c4a6129a442dc251c36a005d3516881 | /mcp-server/src/main/java/com/jiuye/mcp/server/service/home/IHomePageService.java | c1897b82187b7f1d502debdf58f1cf0ab31a5ecb | [
"Apache-2.0"
] | permissive | jydata/MCP | e51494b4206e2badb8261448a3453d88d6781518 | 3535c2ec0e712994cf58b3785cfd1b36deb49b9a | refs/heads/master | 2022-08-23T09:51:59.709461 | 2022-07-01T05:30:06 | 2022-07-01T05:30:06 | 137,862,809 | 13 | 7 | Apache-2.0 | 2022-07-01T05:30:07 | 2018-06-19T08:30:49 | Java | UTF-8 | Java | false | false | 1,382 | java | package com.jiuye.mcp.server.service.home;
import com.jiuye.mcp.server.model.home.HomeCommonEntity;
import com.jiuye.mcp.server.model.home.HomeFinenessStatisticEntity;
import com.jiuye.mcp.server.model.home.HomeSyncTimeEnity;
import com.jiuye.mcp.server.model.home.HomeTableCountEntity;
import com.jiuye.mcp.server.model.home.HomeSyncAgentErrorLogEntity;
import java.util.List;
/**
* @author zp
* @date 2018/12/11 0011
*/
public interface IHomePageService {
/**
* 查询各状态的job数量
*
* @return
*/
List<HomeCommonEntity> queryJobs();
/**
* 查询源端、终端、路由数量
*
* @return
*/
List<HomeCommonEntity> queryTechDatas();
/**
* 查询数据量对比
*
* @return
*/
List<HomeFinenessStatisticEntity> queryTableCounts();
/**
* Agent Error Sql统计
*
* @return
*/
List<HomeSyncAgentErrorLogEntity> queryAgentErrorSqlCounts();
/**
* 同步job数据折线图
*
* @return
*/
List<HomeSyncTimeEnity> querySyncJobData();
/**
* 同步Agent数据折线图
*
* @return
*/
List<HomeSyncTimeEnity> querySyncAgentData();
/**
* 两周内热度表集合
*
* @param fineness 时间粒度
* @return
*/
List<HomeTableCountEntity> queryHotTables(String fineness);
}
| [
"felix2003@live.cn"
] | felix2003@live.cn |
bcfd0d6027c301f93e2b7803e47e68c0de4e14ba | 81745eeaad28f4fab52d22844cc3493c8035d05a | /app/src/main/java/com/uniapp/noteapplication/controller/CategoryController.java | 4656b437cbbe9213b336aaebbe8f33ca1876e3d9 | [] | no_license | PhamTienThao/Note_Assignment_Management | 345ca1d1aa20b6447a70e0328d419237ed09b108 | 4156d15eaae619bc090a0918ba3d554c3b357d48 | refs/heads/master | 2023-07-14T23:44:10.367355 | 2021-08-30T04:36:12 | 2021-08-30T04:36:12 | 401,216,750 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,150 | java | package com.uniapp.noteapplication.controller;
import android.content.Context;
import android.os.AsyncTask;
import android.os.Parcelable;
import android.text.TextUtils;
import androidx.core.content.ContextCompat;
import androidx.room.Room;
import com.uniapp.noteapplication.adapter.CategoryAdapter;
import com.uniapp.noteapplication.dao.CategoryDao;
import com.uniapp.noteapplication.database.CategoryDatabase;
import com.uniapp.noteapplication.model.Category;
import com.uniapp.noteapplication.view.ICategoryView;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
public class CategoryController implements ICategoryController {
ICategoryView categoryView;
private CategoryDatabase categoryDatabase;
String currentDate = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss", Locale.getDefault()).format(new Date());
public CategoryController(ICategoryView verificationView) {
this.categoryView = verificationView;
categoryDatabase = Room.databaseBuilder((Context) verificationView, CategoryDatabase.class, CategoryDatabase.DB_NAME).build();
}
@Override
public void insertCategory(Map<String, Object> params) {
try {
CategoryDao categoryDao = categoryDatabase.getCategoryDao();
Category category = new Category();
String txtCategory = (String) params.get("category");
category.setName(txtCategory);
category.setDate(currentDate);
if (!isEmpty(txtCategory)) {
Executor myExecutor = Executors.newSingleThreadExecutor();
myExecutor.execute(() -> {
categoryDao.insertCategory(category);
categoryView.processDialogDisable();
ContextCompat.getMainExecutor((Context) categoryView).execute(() -> {
categoryView.handleInsertEvent("Successfully!");
});
});
} else {
categoryView.handleInsertEvent("Please fill all empty fields!");
}
} catch (Exception e) {
categoryView.handleInsertEvent(e.getMessage());
}
}
@Override
public void getListItem() {
new getListItemTask().execute();
}
@Override
public boolean isEmpty(String textBox) {
if(TextUtils.isEmpty(textBox))
return true;
else
return false;
}
private class getListItemTask extends AsyncTask<Void, List<Category>, List<Category>> {
@Override
public List<Category> doInBackground(Void... maps) {
CategoryDao categoryDao = categoryDatabase.getCategoryDao();
List<Category> category = categoryDao.getAllCategory();
return category;
}
@Override
protected void onPostExecute(List<Category> categoryList) {
super.onPostExecute(categoryList);
categoryView.displayItem(categoryList);
}
}
}
| [
"phamtienthao88@gmail.com"
] | phamtienthao88@gmail.com |
b7883ae346371e681c6d3dab12b6fc29ff16f8db | c55562eb6793ebc54bb1071b2ac63b39921244b9 | /src/main/java/cn/haohaoli/book/headfirst/facade/version2/Test.java | 486c3a7132870932528c1f72f8d170d3fffa311d | [
"Apache-2.0"
] | permissive | 27392/java-notes | 5ac1880caffb098b26edf080912d7051fd0d1646 | df3994c08e70eb889bacdf51aa4bc67534bb777f | refs/heads/master | 2022-09-27T00:41:47.771008 | 2022-08-30T02:13:34 | 2022-08-30T02:13:34 | 164,189,896 | 11 | 1 | Apache-2.0 | 2020-11-16T07:00:11 | 2019-01-05T06:47:34 | Java | UTF-8 | Java | false | false | 668 | java | package cn.haohaoli.book.headfirst.facade.version2;
/**
* @author lwh
*/
public class Test {
public static void main(String[] args) {
PopcornPopper popper = new PopcornPopper();
Lights lights = new Lights();
Screen screen = new Screen();
Projector projector = new Projector();
Amplifier amp = new Amplifier();
DvdPlayer dvd = new DvdPlayer();
HomeTheaterFacade homeTheater = new HomeTheaterFacade(popper, lights, screen, projector, amp, dvd);
homeTheater.watchMovie("movie");
System.out.println();
homeTheater.endMovie();
}
}
| [
"liwenhao@dgg.net"
] | liwenhao@dgg.net |
ed4bd2bbd9078ae7534efc8d525a7fcd9c523aa6 | 903be4f617a2db222ffe48498291fde8947ac1e3 | /org/omg/CosNaming/NameComponentHelper.java | 0b37fec7732ec946a7543f0b964aa384bfb99217 | [] | no_license | CrazyITBoy/jdk1_8_source | 28b33e029a3a972ee30fa3c0429d8f193373a5c3 | d01551b2df442d1912403127a1c56a06ac84f7bd | refs/heads/master | 2022-12-10T07:27:54.028455 | 2020-07-05T15:18:50 | 2020-07-05T15:18:50 | 273,000,289 | 0 | 1 | null | 2020-06-27T15:22:27 | 2020-06-17T14:45:23 | Java | UTF-8 | Java | false | false | 2,860 | java | package org.omg.CosNaming;
/**
* org/omg/CosNaming/NameComponentHelper.java .
* Generated by the IDL-to-Java compiler (portable), version "3.2"
* from /jenkins/workspace/8-2-build-macosx-x86_64/jdk8u251/737/corba/src/share/classes/org/omg/CosNaming/nameservice.idl
* Thursday, March 12, 2020 2:38:17 AM PDT
*/
abstract public class NameComponentHelper
{
private static String _id = "IDL:omg.org/CosNaming/NameComponent:1.0";
public static void insert (org.omg.CORBA.Any a, org.omg.CosNaming.NameComponent that)
{
org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
a.type (type ());
write (out, that);
a.read_value (out.create_input_stream (), type ());
}
public static org.omg.CosNaming.NameComponent extract (org.omg.CORBA.Any a)
{
return read (a.create_input_stream ());
}
private static org.omg.CORBA.TypeCode __typeCode = null;
private static boolean __active = false;
synchronized public static org.omg.CORBA.TypeCode type ()
{
if (__typeCode == null)
{
synchronized (org.omg.CORBA.TypeCode.class)
{
if (__typeCode == null)
{
if (__active)
{
return org.omg.CORBA.ORB.init().create_recursive_tc ( _id );
}
__active = true;
org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember [2];
org.omg.CORBA.TypeCode _tcOf_members0 = null;
_tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0);
_tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CosNaming.IstringHelper.id (), "Istring", _tcOf_members0);
_members0[0] = new org.omg.CORBA.StructMember (
"id",
_tcOf_members0,
null);
_tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0);
_tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CosNaming.IstringHelper.id (), "Istring", _tcOf_members0);
_members0[1] = new org.omg.CORBA.StructMember (
"kind",
_tcOf_members0,
null);
__typeCode = org.omg.CORBA.ORB.init ().create_struct_tc (org.omg.CosNaming.NameComponentHelper.id (), "NameComponent", _members0);
__active = false;
}
}
}
return __typeCode;
}
public static String id ()
{
return _id;
}
public static org.omg.CosNaming.NameComponent read (org.omg.CORBA.portable.InputStream istream)
{
org.omg.CosNaming.NameComponent value = new org.omg.CosNaming.NameComponent ();
value.id = istream.read_string ();
value.kind = istream.read_string ();
return value;
}
public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CosNaming.NameComponent value)
{
ostream.write_string (value.id);
ostream.write_string (value.kind);
}
}
| [
"1396757497@qq.com"
] | 1396757497@qq.com |
66d1d94d92d3d0fe4641bb5330a1cb60713c1bc1 | f6a4536bf909eee4570ccbd1bee8d748cea26436 | /src/com/piyush/graph/Graph.java | 2f16482ef0846dcbbd5130ebe99e6b8e4c066390 | [] | no_license | piyushthummar/PCT-Practice | 5cb0fd0579c42b5496eb0d5cb0804c5259da715f | 2165fa92733aa13cf4f2eb2d38a31b56cb4c8963 | refs/heads/master | 2020-08-27T09:44:18.612426 | 2020-05-28T18:42:13 | 2020-05-28T18:42:13 | 217,321,247 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 995 | java | package com.piyush.graph;
import java.util.LinkedList;
import java.util.List;
public class Graph {
int vertices;
static List<Integer> adjacencyList[];
public Graph(int vertices) {
this.vertices = vertices;
adjacencyList = new LinkedList[vertices];
for(int index=0; index<vertices; index++)
adjacencyList[index] = new LinkedList<>();
}
public void addEdgeForUndirectedGraph(int srcVertex, int destVertex)
{
adjacencyList[srcVertex].add(destVertex);
adjacencyList[destVertex].add(srcVertex);
}
public void addEdgeForDirectedGraph(int srcVertex, int destVertex)
{
adjacencyList[srcVertex].add(destVertex);
}
public void printGraph()
{
//System.out.println("inside printGraph");
for(int index=0; index<vertices; index++)
{
System.out.println("\nAdjacency list of vertex " + index);
System.out.print(index + "(head)");
for(Integer item : adjacencyList[index])
{
System.out.print(" -> " + item);
}
System.out.println();
}
}
}
| [
"piyushthummar305@gmail.com"
] | piyushthummar305@gmail.com |
372e97dd1c724ab50c80a52a8e69989c893b5c63 | d88aeb2e0d763ac1b354682889cafbfc286ffc83 | /src/e_oop/AirConditioner.java | c43b5752bf58d3a6a59207efaeae9b56587959ba | [] | no_license | Melgoon/BasicJava | 4eb9956dac6000a29e94051caaed36db9ffbb655 | 8551e6939d5735bbd0ffbd3410ce0c83d74bd047 | refs/heads/master | 2020-12-27T09:46:57.491543 | 2020-02-21T09:38:56 | 2020-02-21T09:38:56 | 237,856,812 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,455 | java | package e_oop;
import java.util.Scanner;
public class AirConditioner {
boolean power; // 전원
int temperature; // 온도
int airVolume; // 풍향
final int MAX_TEMPERATURE = 30;
final int MIN_TEMPERATURE = 18;
AirConditioner(){
power = false;
temperature = 24;
airVolume = 1;
}
Scanner s = new Scanner(System.in);
// 전원버튼
void power(){
power = !power; // on/off
System.out.println("POWER : " + (power ? "ON" : "OFF"));
}
// 온도 + 버튼
void temperatureUp(){
if(power && temperature < MAX_TEMPERATURE){
temperature++;
}
}
// 온도 - 버튼
void temperatureDown(){
if(power && MIN_TEMPERATURE < temperature){
temperature--;
}
}
//풍량 버튼
void airVolume(){
if(power){
if(3 < ++airVolume){ // 누를때마다 1씩 증가 3이 넘으면 다시 1로 돌아간다.
airVolume = 1; // 1로 돌아간다.
}
}
}
//온도가 18~30 까지만 변경할 수 있게 해주시고, 전원을 켰을때만 버튼들이 작동되도록 메소드들을 변경해주세요.
public static void main(String[] args){
AirConditioner ac = new AirConditioner();
ac.power();
System.out.println(ac.power);
ac.temperatureUp();
System.out.println(ac.temperature);
ac.temperatureUp();
System.out.println(ac.temperature);
ac.temperatureUp();
System.out.println(ac.temperature);
ac.temperatureUp();
System.out.println(ac.temperature);
ac.temperatureUp();
System.out.println(ac.temperature);
ac.temperatureUp();
System.out.println(ac.temperature);
ac.temperatureDown();
System.out.println(ac.temperature);
ac.temperatureDown();
System.out.println(ac.temperature);
ac.temperatureDown();
System.out.println(ac.temperature);
ac.temperatureDown();
System.out.println(ac.temperature);
ac.temperatureDown();
System.out.println(ac.temperature);
ac.temperatureDown();
System.out.println(ac.temperature);
ac.temperatureDown();
System.out.println(ac.temperature);
ac.temperatureDown();
System.out.println(ac.temperature);
ac.temperatureDown();
System.out.println(ac.temperature);
ac.temperatureDown();
System.out.println(ac.temperature);
ac.temperatureDown();
System.out.println(ac.temperature);
ac.temperatureDown();
System.out.println(ac.temperature);
ac.airVolume();
System.out.println(ac.airVolume);
ac.airVolume();
System.out.println(ac.airVolume);
ac.airVolume();
System.out.println(ac.airVolume);
}
}
| [
"dbdnd2@gmail.com"
] | dbdnd2@gmail.com |
c2132d1dd57b13aa7288dec6bed7c3adb2ea6372 | 58a2e5f2b6632c91825c75be39479f1be8ede0e1 | /app/src/main/java/com/example/quantumcoder/moodleplus/Fragments/FragmentHome.java | 02d0457670c96f2c6a8754e2fa18402bb89b77dd | [] | no_license | ayushgupt/Moodle_Plus_Android_App | bd7d22cd9c452345c52084e1d8ccae2dd36a1ee4 | d6b8504347a6c5bd9d2f2f5c39fc4501d39ca54b | refs/heads/master | 2020-12-24T12:20:09.920509 | 2016-03-15T07:26:36 | 2016-03-15T07:26:36 | 73,056,671 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,718 | java | package com.example.quantumcoder.moodleplus;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import static android.widget.Toast.LENGTH_SHORT;
import static com.android.volley.VolleyLog.TAG;
public class FragmentHome extends Fragment {
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.home_layout,null);
}
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
Log.v("HomeFragment", "onActivityCreated().");
Log.v("ListsavedInstanceState", savedInstanceState == null ? "true" : "false");
//Generate list View from ArrayList
displayListView();
}
private void displayListView() {
JSONObject courseobject = SessionManager.getCourseData();
JSONArray courses = null;
try {
courses = (JSONArray) courseobject.get("courses");
} catch (JSONException e) {
Toast.makeText(getContext(),"Not registered for any courses",Toast.LENGTH_LONG).show();
}
//Array of courses
String t[] = new String[courses.length()];
String coursename = "";
String coursecode = "";
int courseId = 0;
//For Loop for Making Buttons.. Button for each course is made in one loop
for (int i = 0; i < courses.length(); i++)
{
//made a temporary jsonobject which has json of only one course at a time
JSONObject course = null;
try
{
course = courses.getJSONObject(i);
Log.d(TAG, course.toString());
coursename = (String) course.get("name");
coursecode = (String) course.get("code");
courseId = (int) course.get("id");
t[i] = coursecode +":"+ coursename;
} catch (JSONException e)
{
e.printStackTrace();
}
}
//create an ArrayAdaptar from the String Array
CoursesArrayAdapter dataAdapter = new CoursesArrayAdapter(getContext(), t);
ListView listView = (ListView) getView().findViewById(R.id.Courses);
// Assign adapter to ListView
listView.setAdapter(dataAdapter);
//enables filtering for the contents of the given ListView
listView.setTextFilterEnabled(true);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
Toast.makeText(getActivity().getApplicationContext(), "Course selected", LENGTH_SHORT).show();
TextView textview = (TextView) view.findViewById(R.id.courseName);
MainActivity.selectedcoursecode = textview.getText().toString().split(":")[0];
Log.d(TAG,MainActivity.selectedcoursecode);
FragmentTransaction xfragmentTransaction = getActivity().getSupportFragmentManager().beginTransaction();
xfragmentTransaction.replace(R.id.containerView, new FragmentTabs()).commit();
}
});
}
/*
@Override
public void onStart() {
super.onStart();
try {
createCourseButtons(SessionManager.getCourseData());
} catch (JSONException e) {
e.printStackTrace();
}
}
*/
// creates course buttons given json object
//TODO: Change layout and design of course buttons
/*
public void createCourseButtons(JSONObject courseobject) throws JSONException
{
//The CourseObject contained Json of user and courses..So courses now has only course specific json..
JSONArray courses = (JSONArray) courseobject.get("courses");
String coursename = "";
String coursecode = "";
int courseId = 0;
//For Loop for Making Buttons.. Button for each course is made in one loop
for (int i = 0; i < courses.length(); i++)
{
//made a temporary jsonobject which has json of only one course at a time
JSONObject course = null;
try
{
course = courses.getJSONObject(i);
Log.d(TAG, course.toString());
coursename = (String) course.get("name");
coursecode = (String) course.get("code");
courseId = (int) course.get("id");
//Course Name, Code and Id is assigned in different Temporary variables...
} catch (JSONException e)
{
e.printStackTrace();
}
final Button courseButton = new Button(getActivity());
final int finalCourseId = courseId;
//Buttons Text is Set By concatenating Code and Name
courseButton.setText(coursecode + ": " + coursename);
//Buttons Id is its course Id
courseButton.setId(finalCourseId);
Log.d(TAG, coursecode);
//Buttons Alignment
courseButton.setGravity(Gravity.CENTER);
courseButton.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
//What happens on Clicking The Button..???
courseButton.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
}
});
View rootView = getView();
//ll object of type Linear Layout is made which is basically instance of Linear Layout whose id is courses...
//lp object of linear layout parameters are made
RelativeLayout rl = (RelativeLayout) rootView.findViewById(R.id.layout_home);
RelativeLayout.LayoutParams rp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
rp.setMargins(20, 80, 0, 0);
//Button and Parameters are added to the reference of Linear Layout we made...
rl.addView(courseButton, rp);
}
}
*/
}
| [
"singhmanish1997@gmail.com"
] | singhmanish1997@gmail.com |
573641d479a15affe342b7c2793e1a465dc08ca8 | 8b467efb9d6e25217cc1b39b8d8d97b05a7454a2 | /httprequest/src/main/java/com/http/request/Api/BaseResultEntity.java | c2220afa0ecf990cb357c3809d8389bc01d9edcf | [] | no_license | GitHubOfXing/RxProject | ecc9e03227ac1f644d5e766c09751e3ad84b58c4 | 129672e67ccfbe263b0d734a415966912c9995a4 | refs/heads/master | 2021-01-11T19:51:54.757318 | 2017-02-17T11:02:43 | 2017-02-17T11:02:43 | 79,409,902 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 695 | java | package com.http.request.Api;
/**
* 回调信息统一封装类
* Created by WZG on 2016/7/16.
*/
public class BaseResultEntity<T> {
// 判断标示
private int state;
// 提示信息
private String stateInfo;
//显示数据(用户需要关心的数据)
private T resInfo;
public String getMsg() {
return stateInfo;
}
public void setMsg(String msg) {
this.stateInfo = msg;
}
public T getData() {
return resInfo;
}
public void setData(T data) {
this.resInfo = data;
}
public int getRet() {
return state;
}
public void setRet(int ret) {
this.state = ret;
}
}
| [
"lichenxing@duia.com"
] | lichenxing@duia.com |
af9b2e52d47a5c7c625f5d1cdcf657030d0dab63 | c651610a0c8ccec36c145aca8913dd937167767e | /src/main/java/com/lxg/springboot/model/Applypage.java | 46a73447e7a04e78c32fb41ccfd2d31a3a973f6c | [] | no_license | guofengma/spring_store | d88121022d9f4852f953087943244f2cf03d26c5 | 55b85cf485e8484f2438ffc1f4d92608fa064563 | refs/heads/master | 2020-04-19T01:43:14.248232 | 2018-07-06T06:53:16 | 2018-07-06T06:53:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 547 | java | package com.lxg.springboot.model;
import java.io.Serializable;
import java.util.List;
public class Applypage implements Serializable {
/**
* author zhenghong@xrfinance.com
*
*/
private static final long serialVersionUID = 1L;
private int totalpage;
private List<Apply> apply;
public int getTotalpage() {
return totalpage;
}
public void setTotalpage(int totalpage) {
this.totalpage = totalpage;
}
public List<Apply> getApply() {
return apply;
}
public void setApply(List<Apply> apply) {
this.apply = apply;
}
} | [
"644094961@qq.com"
] | 644094961@qq.com |
6c3890af534846f24f89087654da0ef229f1ef68 | 4b4072e2f981a319254b686d7f390604dab01e0c | /src/com/sc/main/Country.java | 4dd011efc848a73dba9e4f1f62f067f8789dc096 | [] | no_license | disgraceful/SortCountry | 271e742e17451d4fb7351a7f9dded3246cbf80ae | 043c229a64b8e7d1650e3b6d83e4095c2b72b8f2 | refs/heads/master | 2021-09-02T09:12:36.653321 | 2018-01-01T09:35:31 | 2018-01-01T09:35:31 | 115,910,403 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,392 | java | package com.sc.main;
import java.util.Comparator;
public class Country {
private String name;
private long population;
private double popDensity;
private double square;
public Country(String name, String population, String popDensity) {
super();
this.name = name;
this.population = Long.parseLong(population);
this.popDensity = Double.parseDouble(popDensity);
this.square= this.population/this.popDensity;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public long getPopulation() {
return population;
}
public void setPopulation(long population) {
this.population = population;
}
public double getPopDensity() {
return popDensity;
}
public void setPopDensity(double popDensity) {
this.popDensity = popDensity;
}
public double getSquare() {
return square;
}
public void setSquare(double square) {
this.square = square;
}
static Comparator<Country> compareByPopulation() {
return new Comparator<Country>() {
@Override
public int compare(Country o1, Country o2) {
return (int) (o2.getPopulation() - o1.getPopulation());
}
};
}
static Comparator<Country> compareByDensity() {
return new Comparator<Country>() {
@Override
public int compare(Country o1, Country o2) {
return Double.compare(o2.getPopDensity(),o1.getPopDensity());
}
};
}
}
| [
"noolic97@gmail.com"
] | noolic97@gmail.com |
0bff1791ab05929fce9c082b2956d981732fcbcb | a97796337930d9f94025cb8df2a17cd71be9a808 | /src/main/java/com/watashi/bookstore/strategy/troca/EnviaEmailStatusDaTroca.java | 2444069c36dd0d160681dbbf608f47a232471592 | [] | no_license | LeilaWatashi/watashi-bookstore | 79b8e416e48bb59167d4e6301a2799fd768bf6fb | b6fc3661ac55b7c09dcdd2cf5fc847650d52b7b4 | refs/heads/master | 2023-08-15T07:21:44.627106 | 2021-10-05T19:41:31 | 2021-10-05T19:41:31 | 411,870,702 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,016 | java | package com.watashi.bookstore.strategy.troca;
import com.watashi.bookstore.domain.EntidadeDominio;
import com.watashi.bookstore.domain.Transicao;
import com.watashi.bookstore.strategy.IStrategy;
import com.watashi.bookstore.strategy.email.troca.EnviaEmailSolicitacaoTroca;
import com.watashi.bookstore.strategy.email.troca.EnviaEmailTrocaCodigoRastreio;
import com.watashi.bookstore.strategy.email.troca.EnviaEmailTrocaRecusada;
import com.watashi.bookstore.strategy.transicao.GeraCodigoRastreioTransicao;
import com.watashi.bookstore.util.Util;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;
@Component
public class EnviaEmailStatusDaTroca implements IStrategy {
@Autowired
private ValidaDadosTroca validaDadosTroca;
@Autowired
private EnviaEmailSolicitacaoTroca enviaEmailSolicitacaoTroca;
@Autowired
private EnviaEmailTrocaCodigoRastreio enviaEmailTrocaCodigoRastreio;
@Autowired
private EnviaEmailTrocaRecusada enviaEmailTrocaRecusada;
@Override
public String processar(final EntidadeDominio entidade) {
if(entidade instanceof Transicao){
Transicao transicao = (Transicao) entidade;
if(transicao.getPedido() != null
&& transicao.getPedido().getStatusPedido() != null
&& transicao.getPedido().getStatusPedido().getId() != null
&& Util.isNotNull(transicao.getTipoTransicao())
&& transicao.getTipoTransicao().getId().equals(1)){
Map<Integer, IStrategy> mapaEnvioDeEmail = new HashMap<>();
mapaEnvioDeEmail.put(7, enviaEmailSolicitacaoTroca);
mapaEnvioDeEmail.put(8, enviaEmailTrocaRecusada);
mapaEnvioDeEmail.put(9, enviaEmailTrocaCodigoRastreio);
Integer statusPedidoId = transicao.getPedido().getStatusPedido().getId();
String msg = validaDadosTroca.processar(transicao);
if(mapaEnvioDeEmail.containsKey(statusPedidoId)){
mapaEnvioDeEmail.get(statusPedidoId).processar(transicao);
}
}
}
return null;
}
}
| [
"leilawatashi@gmail.com"
] | leilawatashi@gmail.com |
1c0722133ea597ca7c8fa4130c006f32f0fcf10f | f71dfa1bc240fa3315f71a572229b7353fc3527f | /HBUtrade/app/src/main/java/com/example/lxy/hbutrade/ui/RegisteredActivity.java | b08febf1acd827fd242e308b32c9a8e0ec21a1a2 | [] | no_license | paranoia0618/myGraduatiProject | ef483fff6112f211aeca5214253082c713351765 | 3e03836cccece25c960a62ceec87310366744d23 | refs/heads/master | 2020-03-06T14:57:38.748369 | 2018-03-29T08:49:57 | 2018-03-29T08:49:57 | 126,945,715 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,289 | java | package com.example.lxy.hbutrade.ui;
import android.os.Bundle;
import android.text.TextUtils;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.Toast;
import com.example.lxy.hbutrade.R;
import com.example.lxy.hbutrade.base.BaseActivity;
import com.example.lxy.hbutrade.entity.MyUser;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import cn.bmob.v3.exception.BmobException;
import cn.bmob.v3.listener.SaveListener;
/**
* 项目名:XSYTrade
* 包名:com.wsg.xsytrade.ui
* 文件名:RegisteredActivity
* 创建者:wsg
* 创建时间:2017/9/16 19:17
* 描述:注册页面
*/
public class RegisteredActivity extends BaseActivity {
@BindView(R.id.et_user)
EditText etUser;
@BindView(R.id.et_age)
EditText etAge;
@BindView(R.id.et_desc)
EditText etDesc;
@BindView(R.id.rb_boy)
RadioButton rbBoy;
@BindView(R.id.rb_girl)
RadioButton rbGirl;
@BindView(R.id.mRadioGroup)
RadioGroup mRadioGroup;
@BindView(R.id.et_pass)
EditText etPass;
@BindView(R.id.et_password)
EditText etPassword;
@BindView(R.id.et_email)
EditText etEmail;
@BindView(R.id.btnRegistered)
Button btnRegistered;
//性别
private boolean isGender = true;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_registered);
ButterKnife.bind(this);
}
@OnClick(R.id.btnRegistered)
public void onViewClicked() {
//获取到输入框的值
String name = etUser.getText().toString().trim();
String age = etAge.getText().toString().trim();
String desc = etDesc.getText().toString().trim();
String pass = etPass.getText().toString().trim();
String password = etPassword.getText().toString().trim();
String email = etEmail.getText().toString().trim();
//判断是否为空
if (!TextUtils.isEmpty(name) & !TextUtils.isEmpty(age) &
!TextUtils.isEmpty(pass) &
!TextUtils.isEmpty(password) &
!TextUtils.isEmpty(email)) {
//判断两次输入的密码是否一致
if (pass.equals(password)) {
//先把性别判断一下
mRadioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
if (checkedId == R.id.rb_boy) {
isGender = true;
} else if (checkedId == R.id.rb_girl) {
isGender = false;
}
}
});
//判断简介是否为空
if (TextUtils.isEmpty(desc)) {
desc = getString(R.string.text_nothing);
}
//注册
MyUser user = new MyUser();
user.setUsername(name);
user.setPassword(password);
user.setEmail(email);
user.setAge(Integer.parseInt(age));
user.setSex(isGender);
user.setDesc(desc);
user.signUp(new SaveListener<MyUser>() {
@Override
public void done(MyUser myUser, BmobException e) {
if(e==null){
Toast.makeText(RegisteredActivity.this, R.string.text_registered_successful, Toast.LENGTH_SHORT).show();
finish();
}else{
Toast.makeText(RegisteredActivity.this, getString(R.string.text_registered_failure) + e.toString(), Toast.LENGTH_SHORT).show();
}
}
});
} else {
Toast.makeText(this, R.string.text_two_input_not_consistent, Toast.LENGTH_SHORT).show();
}
} else {
Toast.makeText(this, getString(R.string.text_tost_empty), Toast.LENGTH_SHORT).show();
}
}
}
| [
"1947696970@qq.com"
] | 1947696970@qq.com |
35edbac1497cbe3c881240cb137befb8286ccb9a | 3fb17ca7e5a61c5828dfc8175d383f7dc0ab9c01 | /src/main/java/de/telekom/sea/javaChallenge/part1/Part1.java | 03c3c24ee3d45809970eb0ecc5ab4cd64728cab4 | [] | no_license | Ichcodealsobinich/Java-Checkpoint | 8c233e6aa34e0655f98ba5d610a85cc8084d98ec | 45b257b94144efcbb97661b5f192bd85de113877 | refs/heads/main | 2023-05-31T22:31:34.668904 | 2021-06-08T12:15:25 | 2021-06-08T12:15:25 | 373,067,209 | 0 | 0 | null | 2021-06-08T12:15:20 | 2021-06-02T06:45:09 | Java | UTF-8 | Java | false | false | 407 | java | package de.telekom.sea.javaChallenge.part1;
public class Part1 {
public void run() {
System.out.println();
System.out.println("############ Part 1 #############");
System.out.println();
/* does not work because a final variable cannot be changed later.
* i++ would change the final variable i.*/
for (/*final*/ int i = 0; i< 8; i++) {
System.out.println( "Geht nicht" );
}
}
}
| [
"f.leonhardt@telekom.de"
] | f.leonhardt@telekom.de |
225c044b9bb9adca5b047cd7297ed77ece3704f1 | 1af5d059f4336957c5444a41c6653bc8ccfe307a | /ProgForce/src/main/java/andrei/grinchenko/dao/DaoCategory.java | 86d2e72aceae0e7026c1db88cee27d4b69cc78c7 | [] | no_license | grinchen/ProgForceTest | 06602214268fa8cdd008228fae7da2cc093aa294 | 054b865084332be6a8e007ac692ed87a1e251c00 | refs/heads/master | 2021-01-10T10:58:40.319287 | 2016-02-24T11:17:54 | 2016-02-24T11:17:54 | 52,431,496 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,311 | java | package andrei.grinchenko.dao;
import java.io.IOException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import andrei.grinchenko.entities.Category;
import andrei.grinchenko.entities.Market;
import andrei.grinchenko.managers.DBConnection;
/**
* Class DaoCategory encapsulates access to "category" table in DB.
*/
public class DaoCategory {
/**
* Read Category by title and referenced Market
*
* @param title field 'title' in table 'category'
* @param market Market object
* @return Category object
*/
public Category readByTitle (String title, Market market) {
Category category = new Category();
try (Connection connection = DBConnection.getConnection();
Statement statement = connection.createStatement();
ResultSet resultSet =
statement.executeQuery("SELECT * FROM `category` WHERE (`title` = '"
+ title + "' AND `market_id`='" + market.getId() + "');")) {
resultSet.first();
category.setId(resultSet.getInt(1));
category.setTitle(resultSet.getString(2));
category.setMarketId(resultSet.getInt(3));
} catch (SQLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return category;
}
}
| [
"andrii.grinchenko@gmail.com"
] | andrii.grinchenko@gmail.com |
c2ad440795cfcc59b1aa54f0baef0e26880a6f1c | 5ac50e3bd63a15d81fb0f7dcfea1c7bc4394e999 | /src/Business/Organization/SensorOrganization.java | d5d3672f35e3d79298dbdf2b0987ed421e1c0bb9 | [] | no_license | wenkaiZ/Simulated-Smart-City-Environment-Monitoring-System | 188a04f4e8b90ae496acb7afa3e785b91f58a334 | 315f57ca6851c4494208fe871fca7a8408910e1d | refs/heads/master | 2020-05-02T16:40:32.003820 | 2019-03-27T21:24:22 | 2019-03-27T21:24:22 | 178,076,092 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,071 | 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 Business.Organization;
import Business.Role.Role;
import Business.Role.SensorManagerRole;
import Business.Sensor.Sensor;
import java.util.ArrayList;
/**
*
* @author zhengwenkai
*/
public class SensorOrganization extends Organization{
private ArrayList<Sensor> sensorDirectory;
public SensorOrganization(){
super(Type.Sensor.getValue());
super.setOrganizationType(Type.Sensor);
sensorDirectory = new ArrayList<>();
}
@Override
public ArrayList<Role> getSupportedRole() {
// ArrayList<Role> roles = new ArrayList();
// roles.add(new SensorManagerRole());
return null;
}
public ArrayList<Sensor> getSensorDirectory() {
return sensorDirectory;
}
public void setSensorDirectory(ArrayList<Sensor> sensorDirectory) {
this.sensorDirectory = sensorDirectory;
}
}
| [
"zheng.wenk@husky.neu.edu"
] | zheng.wenk@husky.neu.edu |
7f73ef05b0285c53a8619269d6bde27f297ff52f | fbd16739b5a5e476916fa22ddcd2157fafff82b9 | /src/minecraft_server/net/minecraft/world/gen/feature/WorldGenTallGrass.java | 60e1a250f8605e861da30b23e86f3da279aea41b | [] | no_license | CodeMajorGeek/lwjgl3-mcp908 | 6b49c80944ab87f1c863ff537417f53f16c643d5 | 2a6d28f2b7541b760ebb8e7a6dc905465f935a64 | refs/heads/master | 2020-06-18T19:53:49.089357 | 2019-07-14T13:14:06 | 2019-07-14T13:14:06 | 196,421,564 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,504 | java | package net.minecraft.world.gen.feature;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.world.World;
public class WorldGenTallGrass extends WorldGenerator
{
private Block field_150522_a;
private int tallGrassMetadata;
private static final String __OBFID = "CL_00000437";
public WorldGenTallGrass(Block p_i45466_1_, int p_i45466_2_)
{
this.field_150522_a = p_i45466_1_;
this.tallGrassMetadata = p_i45466_2_;
}
public boolean generate(World p_76484_1_, Random p_76484_2_, int p_76484_3_, int p_76484_4_, int p_76484_5_)
{
Block var6;
while (((var6 = p_76484_1_.getBlock(p_76484_3_, p_76484_4_, p_76484_5_)).getMaterial() == Material.air || var6.getMaterial() == Material.field_151584_j) && p_76484_4_ > 0)
{
--p_76484_4_;
}
for (int var7 = 0; var7 < 128; ++var7)
{
int var8 = p_76484_3_ + p_76484_2_.nextInt(8) - p_76484_2_.nextInt(8);
int var9 = p_76484_4_ + p_76484_2_.nextInt(4) - p_76484_2_.nextInt(4);
int var10 = p_76484_5_ + p_76484_2_.nextInt(8) - p_76484_2_.nextInt(8);
if (p_76484_1_.isAirBlock(var8, var9, var10) && this.field_150522_a.canBlockStay(p_76484_1_, var8, var9, var10))
{
p_76484_1_.setBlock(var8, var9, var10, this.field_150522_a, this.tallGrassMetadata, 2);
}
}
return true;
}
}
| [
"37310498+CodeMajorGeek@users.noreply.github.com"
] | 37310498+CodeMajorGeek@users.noreply.github.com |
5be924414401200291db16cbdaea256cbd4f7a14 | 2cdf74c0392dfc09d1c24720269375fbf5c1389e | /BackEnd/Spring mvc/src/main/java/com/capgemini/springmvc/dao/EmployeeDAO.java | ff591d4ba92664bb4f6eb35c05f9a1bf1ad4c7c7 | [] | no_license | avinashmonde/TY_CG_HTD_PuneMumbai_JFS_AvinashMonde | c196b6253ca0ec277a352c301cf898fecc56ee2c | b5b9d430ab908a82922dffecd6114dc53c27dfb0 | refs/heads/master | 2020-09-24T21:23:26.361097 | 2019-12-21T17:03:14 | 2019-12-21T17:03:14 | 225,846,399 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 392 | java | package com.capgemini.springmvc.dao;
import com.capgemini.springmvc.bean.EmployeeInfoBean;
public interface EmployeeDAO {
public EmployeeInfoBean getEmployee(int empId);
public EmployeeInfoBean authenticate(int empid, String pwd);
public boolean addEmployee(EmployeeInfoBean employeeInfoBean);
//public boolean updateEmployee(EmployeeInfoBean employeeInfoBean);
}//End of DAO Method
| [
"avinashmonde.1998@gmail.com"
] | avinashmonde.1998@gmail.com |
55dd971888ec88d12b1d8ede50e6e8248d37cbad | 52a92610f1b56815392bcaf9ec84516e166ab0b3 | /app/src/main/java/com/example/simplenotes/MainActivity.java | e38f640f80b6ae156079d8e87ad4b502de5bde36 | [] | no_license | shahhimtest/SimpleNotes | 877554b700ef78741a9a5c5b14b7efd8dddb7788 | 8894670431deacc06387d310d2ddac13398151b5 | refs/heads/main | 2023-07-17T03:47:07.482454 | 2021-06-27T10:11:13 | 2021-06-27T10:11:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,076 | java | package com.example.simplenotes;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
public class MainActivity extends AppCompatActivity {
public static final String EXTRA_MESSAGE = "com.example.SimpleNotes.MESSAGE";
private Object v;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// CODE from HERE
// add the list of notes to the listView in the main activity
// => getting a list of files and adding them to an Array
// => converting the array to an arrayAdapter with all filenames
// => adding the adapter to the listView
File files = getFilesDir();
String[] array = files.list();
ArrayList<String> arrayList = new ArrayList<>();
final ArrayAdapter adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, arrayList);
for (String filename : array) {
filename = filename.replace(".txt", "");
System.out.println(filename);
adapter.add(filename);
}
final ListView listView = (ListView) findViewById(R.id.listView);
listView.setAdapter(adapter);
//public void onClick(){
/* public void onClick(View v) {
EditText editTextHeading = (EditText) findViewById(R.id.editTextTextPersonName);
EditText editTextContent = (EditText) findViewById(R.id.contentField);
String heading = editTextHeading.getText().toString().trim();
String content = editTextContent.getText().toString().trim();
if (!heading.isEmpty()) {
if(!content.isEmpty()) {
try {
FileOutputStream fileOutputStream = openFileOutput(heading + ".txt", Context.MODE_PRIVATE); // heading will be the filename
fileOutputStream.write(content.getBytes());
fileOutputStream.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
adapter.add(heading);
listView.setAdapter(adapter);
} else {
editTextContent.setError("Content can't be empty!");
}
} else {
editTextHeading.setError("Heading can't be empty!");
}
} */
Button save = (Button) findViewById(R.id.saveButton);
save.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
EditText editTextHeading = (EditText) findViewById(R.id.editTextTextPersonName);
EditText editTextContent = (EditText) findViewById(R.id.contentField);
String heading = editTextHeading.getText().toString().trim();
String content = editTextContent.getText().toString().trim();
editTextHeading.setText("");
editTextContent.setText("");
if (!heading.isEmpty()) {
if(!content.isEmpty()) {
try {
FileOutputStream fileOutputStream = openFileOutput(heading + ".txt", Context.MODE_PRIVATE); // heading will be the filename
fileOutputStream.write(content.getBytes());
fileOutputStream.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
adapter.add(heading);
listView.setAdapter(adapter);
} else {
editTextContent.setError("Content can't be empty!");
}
} else {
editTextHeading.setError("Heading can't be empty!");
}
}
});
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
String item = listView.getItemAtPosition(position).toString();
Intent intent = new Intent(getApplication(), Note.class);
intent.putExtra(EXTRA_MESSAGE, item);
startActivity(intent);
}
});
}
} | [
"00zrhun@gmail.com"
] | 00zrhun@gmail.com |
99bb456f8c7cf58a37bf220a0b43a471b50b4ced | 8f1f47d40d6df748cb2ef2d8e70fad6a98e6deb0 | /src/config/assets/AssetStore.java | e6a925983a71bd9e922205c28e9e61dd2f0f7f78 | [] | no_license | swdevbali/A-Tactical-RPG-Engine | e01a1b9687780a5854fdd687c248de6030944703 | 91ba80bf464940710ed4f9917014b5b026c38c57 | refs/heads/master | 2020-12-01T01:15:21.718623 | 2012-04-13T21:14:07 | 2012-04-13T21:14:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,505 | java | package config.assets;
import java.util.*;
import org.apache.log4j.Logger;
import common.gui.ResourceManager;
import common.gui.Sprite;
import common.interfaces.IWeapon;
import config.Config;
import engine.skills.ISkill;
/**
* Keeps Track of all the item, skills.
*
* @author Bilal Hussain
*/
public class AssetStore {
private static final Logger log = Logger.getLogger(AssetStore.class);
private static AssetStore singleton = new AssetStore();
private Map<UUID, IWeapon> weapons = Collections.synchronizedMap(new HashMap<UUID, IWeapon>());
private Map<UUID, ISkill> skills = Collections.synchronizedMap(new HashMap<UUID, ISkill>());
private Map<UUID, MusicData> music = Collections.synchronizedMap(new HashMap<UUID, MusicData>());
private Map<UUID, MusicData> sounds = Collections.synchronizedMap(new HashMap<UUID, MusicData>());
public IWeapon getWeapon(UUID id) {
final IWeapon w = weapons.get(id);
assert w != null : "Weapon not found: " + id + "\n" + weapons;
return w;
}
public MusicData getMusic(UUID id) {
final MusicData w = music.get(id);
assert w != null : "Music not found: " + id + "\n" + music;
return w;
}
public MusicData getSound(UUID id) {
final MusicData w = sounds.get(id);
assert w != null : "Sound not found: " + id + "\n" + sounds;
return w;
}
public ISkill getSkill(UUID id) {
final ISkill s = skills.get(id);
assert s != null : "Skill not found: " + id;
return s;
}
public ArrayList<ISkill> getSkills(Collection<UUID> ids) {
ArrayList<ISkill> skills = new ArrayList<ISkill>();
for (UUID id : ids) {
skills.add(getSkill(id));
}
return skills;
}
public void loadAssets(AssetsLocations paths) {
weapons.clear();
skills.clear();
music.clear();
sounds.clear();
Weapons ws = Config.loadPreference(paths.weaponsPath);
weapons.putAll(ws.getMap());
Skills ss = Config.loadPreference(paths.skillsPath);
skills.putAll(ss.getMap());
music.putAll(Config.<Musics> loadPreference(paths.musicLocation).getMap());
sounds.putAll(Config.<Musics> loadPreference(paths.soundsLocation).getMap());
}
// For editor
public void loadWeapons(Weapons w) {
weapons.clear();
weapons.putAll(w.getMap());
log.debug("Loaded weapons");
}
public void loadSkill(Skills s) {
skills.clear();
skills.putAll(s.getMap());
log.debug("Loaded skills");
}
private AssetStore() {
}
public static AssetStore instance() {
return singleton;
}
public Map<UUID, IWeapon> getWeapons() {
return weapons;
}
}
| [
"bh246@st-andrews.ac.uk"
] | bh246@st-andrews.ac.uk |
2fc8e1a4c969bd4e78bc65beef7f1731c1a2ff16 | be9e651961b76febd66d9eabf91314e22ad14174 | /javaPractice/OOPPracticals/Practical9.java | 7f7fa120ba6e9a775494eac9f7b19149dacd9692 | [] | no_license | sanghis96/ProgrammingCentre | 30e9befa53f5e5439c9b1c98cbf2acb68b48f8e4 | ecc36dc6fff7f759e0dc44e191e5c870fd9e57ee | refs/heads/master | 2020-04-12T05:36:08.612172 | 2017-09-17T19:17:45 | 2017-09-17T19:17:45 | 60,556,116 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,366 | java | import java.util.ArrayList;
import java.util.Iterator;
import java.util.Scanner;
class item
{
private final String itemName;
private final long rate;
private final int quantity;
item(String itemName,long rate,int quantity)
{
this.itemName=itemName;
this.quantity=quantity;
this.rate=rate;
}
void display()
{ System.out.print(itemName + "\t\t" + rate + "\t" + quantity); }
long getRate()
{ return rate; }
int getQuantity()
{ return quantity; }
}
public class Practical9
{
private static Scanner sc;
public static void main(String[] args)
{
int c=1;
long total;
ArrayList<ArrayList<item>> ArrBill = new ArrayList<>();
sc = new Scanner(System.in);
System.out.print("Enter the Number of bills:");
int m = sc.nextInt();
for(int i=0;i<m;i++)
{
System.out.println("\nBILL"+(i+1));
ArrayList<item> Arritem = new ArrayList<>();
c=1;
while(c==1)
{
System.out.print("Enter name of the item:");
String n = sc.next();
System.out.print("Enter rate of the item:");
long r = sc.nextLong();
System.out.print("Enter Quantity of the item:");
int q = sc.nextInt();
item it = new item(n,r,q);
Arritem.add(it);
System.out.print("Add More items? (1-YES/0-NO)");
c =sc.nextInt();
}
ArrBill.add(Arritem);
}
int count=1;
Iterator<ArrayList<item>> itr=ArrBill.iterator();
while(itr.hasNext())
{
total=0;
ArrayList<item> i1= itr.next();
Iterator<item> itr1 =i1.iterator();
System.out.println("\n\tBILL"+count);
System.out.println("Item Name\tRate\tQuantity");
while(itr1.hasNext())
{
item s=itr1.next();
total +=s.getRate()*s.getQuantity();
s.display();
System.out.println("\t:"+s.getRate()*s.getQuantity());
}
count++;
System.out.println("------------------------------------");
System.out.println("Total Amount is\t\t\t:"+total);
}
}
}
| [
"sanghi.samarth@gmail.com"
] | sanghi.samarth@gmail.com |
a296e1f33c5ea374a984403922976735b606016a | 641f1d44b5c02a013817af60c23ba41c6423f6ce | /DanieleTengaU1Capstone/src/main/java/Capstone/DanieleTengaU1Capstone/dao/GamesJdbcTemplateImpl.java | b935af9d44c0faa54ac765a3d94f472302cd9c28 | [] | no_license | xitraisia/Daniele_Tenga_JavaS1 | b0fc7e54995c6463bacbf700e6518ac73b3fc594 | 6b9c712bc1f84158f1df26fa396b64041a4e772b | refs/heads/main | 2023-05-05T16:42:19.833144 | 2021-05-21T19:25:45 | 2021-05-21T19:25:45 | 339,541,718 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,570 | java | package Capstone.DanieleTengaU1Capstone.dao;
import Capstone.DanieleTengaU1Capstone.model.Consoles;
import Capstone.DanieleTengaU1Capstone.model.Games;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
@Repository
public class GamesJdbcTemplateImpl implements GamesDao{
//create
//retrieve
//update
//delete
//retrieve games by studio
//retrieve by esrb rating
//retrieve by title
private JdbcTemplate jdbcTemplate;
private static final String INSERT_GAME_SQL =
// private int game_id;
// private String title;
// private String esrb_rating;
// private String description;
// private BigDecimal price;
// private String studio;
// private int quantity;
"insert into game (title, esrb_rating, description, price, studio, quantity) values (?, ?, ?, ?, ?,?)";
private static final String SELECT_GAME_SQL =
"select * from game where game_id = ?";
private static final String SELECT_ALL_GAMES_SQL =
"select * from game";
private static final String UPDATE_GAME_SQL =
"update game set title = ?, esrb_rating = ?, description = ?, price = ?, studio = ?, quantity = ? where game_id = ?";
private static final String DELETE_GAME =
"delete from game where game_id = ?";
private static final String SELECT_GAME_BY_STUDIO_SQL =
"select * from game where studio = ?";
private static final String SELECT_GAME_BY_ESRB_RATING_SQL =
"select * from game where esrb_rating= ?";
private static final String SELECT_GAME_BY_TITLE_SQL =
"select * from game where title = ?";
@Autowired
public GamesJdbcTemplateImpl(JdbcTemplate jdbcTemplate) {
this.jdbcTemplate = jdbcTemplate;
}
@Override
@Transactional
public Games addGames(Games games) {
jdbcTemplate.update(
INSERT_GAME_SQL,
games.getTitle(),
games.getEsrb_rating(),
games.getDescription(),
games.getPrice(),
games.getStudio(),
games.getQuantity());
int id = jdbcTemplate.queryForObject("select LAST_INSERT_ID()", Integer.class);
games.setGame_id(id);
return games;
}
@Override
public Games getGame(int id) {
try {
return jdbcTemplate.queryForObject(SELECT_GAME_SQL, this::mapRowToGame, id);
} catch (EmptyResultDataAccessException e) {
// if there is no match for this album id, return null
return null;
}
}
@Override
public List<Games> getAllGame() {
return jdbcTemplate.query(SELECT_ALL_GAMES_SQL, this::mapRowToGame);
}
@Override
public void updateGame(Games games) {
jdbcTemplate.update(
UPDATE_GAME_SQL,
games.getTitle(),
games.getEsrb_rating(),
games.getDescription(),
games.getPrice(),
games.getStudio(),
games.getQuantity(),
games.getGame_id());
}
@Override
public void deleteConsole(int id) {
jdbcTemplate.update(DELETE_GAME, id);
}
@Override
public List<Games> getGamesByStudio(String studioId) {
return jdbcTemplate.query(SELECT_GAME_BY_STUDIO_SQL, this::mapRowToGame,studioId);
}
@Override
public List<Games> getGamesByEsrb(String esrbId) {
return jdbcTemplate.query(SELECT_GAME_BY_ESRB_RATING_SQL, this::mapRowToGame,esrbId);
}
@Override
public List<Games> getGamesByTitle(String titleId) {
return jdbcTemplate.query(SELECT_GAME_BY_TITLE_SQL, this::mapRowToGame,titleId);
}
private Games mapRowToGame(ResultSet rs, int rowNum) throws SQLException {
Games games = new Games();
games.setGame_id(rs.getInt("game_id"));
games.setTitle(rs.getString("title"));
games.setEsrb_rating(rs.getString("esrb_rating"));
games.setDescription(rs.getString("description"));
games.setPrice(rs.getBigDecimal("price"));
games.setStudio(rs.getString("studio"));
games.setQuantity(rs.getInt("quantity"));
return games;
}
}
| [
"cookiie@Danieles-Air-2.attlocal.net"
] | cookiie@Danieles-Air-2.attlocal.net |
501af75ca5c1046a2794342bddaa71ca2e772acd | 0d10f7890a406ff2e9f8537596cd81e68be532d1 | /swingy/src/main/java/com/gmail/hilgardvr/swingy/model/characters/Villian.java | b8f621fcea022b4a2ff4b0eae7368c6760708023 | [] | no_license | hilgardvr/swingy | 1ce6a15187d25022f2ea3c9a41442178ac84d73d | ff64f064fdc5a4a356cb2233601a0fd23f273d95 | refs/heads/master | 2022-12-11T10:01:35.771270 | 2020-09-06T16:30:01 | 2020-09-06T16:30:01 | 293,317,197 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,388 | java | package com.gmail.hilgardvr.swingy.model.characters;
import java.util.Random;
public class Villian extends Character {
String names[];
Random rand;
boolean dropArtifact;
int attackArr[];
int defenceArr[];
int hitArr[];
public Villian(Hero hero) {
names = new String[] { "Troll", "Monster", "Arsenal Supporter" };
this.attackArr = new int[] { 30, 25, 35 };
this.defenceArr = new int[] { 10, 12, 8 };
this.hitArr = new int[] { 100, 120, 80 };
}
@Override
public String toString() {
return (this.getName() + "\n\tlevel: " + this.getLevel() + "\n\tattack: " + this.getAttack() + "\n\tdefence: "
+ this.getDefence() + "\n\thit points: " + this.getHitPoints());
}
public void setStats(int level) {
rand = new Random();
int n = rand.nextInt(3);
int temp = rand.nextInt(3);
if (n == 2) {
dropArtifact = true;
}
n = rand.nextInt(3);
this.setName(names[n]);
this.setLevel(level + temp);
this.setAttack((int)(attackArr[n] * Math.pow(1.09, this.getLevel())));
this.setDefence((int)(defenceArr[n] * Math.pow(1.09, this.getLevel())));
this.setHitPoints((int)(hitArr[n] * Math.pow(1.09, this.getLevel())));
}
public boolean getDropArtifact() {
return this.dropArtifact;
}
} | [
"hilgardvr@gmail.com"
] | hilgardvr@gmail.com |
d9eb2d12b96b3c24a165a3d2f3fa64ac5d1ff9ad | 548a1c32b458942313afe1c469b6ad49ba984d0a | /final_chemin/src/main/java/com/kh/chemin/common/StringArrayType.java | 24d2a85eb80b74697369c4e46a3f52c381874b2b | [] | no_license | shfkddlgpqls/newChemin | e6a53e2ab264b7ee81334e1ba7ab68398b01bd1a | ad72e638a1058a84b6ec72be41de69bedd3fba71 | refs/heads/master | 2020-03-28T06:01:51.579375 | 2018-10-15T12:20:45 | 2018-10-15T12:20:45 | 147,809,881 | 0 | 2 | null | 2018-10-15T12:20:47 | 2018-09-07T10:39:33 | JavaScript | UTF-8 | Java | false | false | 1,558 | java | package com.kh.chemin.common;
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.apache.ibatis.type.JdbcType;
import org.apache.ibatis.type.TypeHandler;
public class StringArrayType implements TypeHandler<String[]> {
@Override
public void setParameter(PreparedStatement ps, int i, String[] parameter, JdbcType jdbcType) throws SQLException {
// 값을 집어넣었을때 알아서 return됨. int i은 index번호, jdbctype은 jdbc에서 어떤 타입으로 가져오는지, parameter는 가져오는 값
if(parameter!=null) {
ps.setString(i, String.join(",", parameter)); //,를 중심으로 들어온 parameter값을 (이쁘게)합침.ps는 mybatis가 알아서 보내줌
}
else {
ps.setString(i, "");
}
}
// 타입으로 가져오기.
//1) 이름으로 가져오기
@Override
public String[] getResult(ResultSet rs, String columnName) throws SQLException {
String columnValue=rs.getString(columnName);
String[] columnArray=columnValue.split(",");
return columnArray;
}
//2) index로 가져오기
@Override
public String[] getResult(ResultSet rs, int columnIndex) throws SQLException {
String columnValue=rs.getString(columnIndex);
String[] columnArray=columnValue.split(",");
return columnArray;
}
@Override
public String[] getResult(CallableStatement cs, int columnIndex) throws SQLException {
String columnValue=cs.getString(columnIndex);
String[] columnArray=columnValue.split(",");
return columnArray;
}
}
| [
"gpqlsgkrud@naver.com"
] | gpqlsgkrud@naver.com |
ec6bc66dd287c06c94df7dfd2783ead41d368e7f | 684cb20da303b2a1446cafe462ef27791c93a81a | /src/test/java/com/cybertek/day04_LocatingChecBoxes/LocatingRadioBtn.java | 5e9b05fd3514d587d88f626c57a3a6e9599d5067 | [] | no_license | Nasratullahsarabi/SeleniumProject | cbd7dea45be931913b4b7fb6c618f730c65b59a2 | 247d37f0550f4cd9c1abb2f75cf03b07140523bc | refs/heads/master | 2023-08-22T20:58:23.371532 | 2021-09-30T18:49:26 | 2021-09-30T18:49:26 | 402,506,891 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,073 | java | package com.cybertek.day04_LocatingChecBoxes;
import io.github.bonigarcia.wdm.WebDriverManager;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import java.util.List;
public class LocatingRadioBtn {
public static void main(String[] args) {
WebDriverManager.chromedriver().setup();
WebDriver driver = new ChromeDriver();
driver.get("http://practice.cybertekschool.com/radio_buttons");
WebElement radioBtnBlue = driver.findElement(By.id("blue"));
System.out.println("radioBtnBlue.isSelected() = " + radioBtnBlue.isSelected());
WebElement redRadio = driver.findElement(By.id("red"));
System.out.println("radioBtnBlue.isSelected() = " + redRadio.isSelected());
redRadio.click();
System.out.println("redRadio.isSelected() = " + redRadio.isSelected());
System.out.println("radioBtnBlue.isSelected() = " + radioBtnBlue.isSelected());
WebElement greenRadio = driver.findElement(By.id("green"));
System.out.println("radioBtnBlue.isSelected() = " + greenRadio.isSelected());
System.out.println("greenRadio.isEnabled() = " + greenRadio.isEnabled());
greenRadio.click();
System.out.println("greenRadio.isSelected() = " + greenRadio.isSelected());
List<WebElement> allRadios = driver.findElements(By.name("color"));
System.out.println("allRadios.size() = " + allRadios.size());
allRadios.get(2).click();
for (WebElement eachRadio : allRadios) {
System.out.println("-----------------------------------------");
System.out.println("eachRadio.getAttribute(\"id\") = " + eachRadio.getAttribute("id"));
System.out.println("eachRadio.isSelected() = " + eachRadio.isSelected());
System.out.println("eachRadio.isEnabled() = " + eachRadio.isEnabled());
System.out.println("-----------------------------------------");
}
// driver.quit();
}
}
| [
"Nasratullah_sarabi@yahoo.com"
] | Nasratullah_sarabi@yahoo.com |
66d355f5dcae1a8aa22e8822c8613242b0b2b7f9 | 69e8b5fb48d1eb21e86eb96297d80ab43735bb88 | /src/main/java/com/pvphall/vine/preprocessor/PreProcessor.java | d98a1896350d44ea81d087509c1030447ababaea | [
"MIT"
] | permissive | PvPHall/Vine | e1b9a2a134dad11fe77cede81cf6e4059b49abe8 | 3ad68a9148b03e0b2eb6cc04f6b8a77de8f6ba20 | refs/heads/master | 2023-01-30T21:51:38.580757 | 2020-12-07T10:35:21 | 2020-12-07T10:35:21 | 319,094,551 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,224 | java | /*
* MIT License
*
* Copyright (c) 2020 PvPHall
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.pvphall.vine.preprocessor;
import com.pvphall.vine.api.IPreProcessor;
import com.pvphall.vine.api.AbstractPreProcessor;
import com.pvphall.vine.api.files.IFileProcessor;
import com.pvphall.vine.utils.FileUtils;
import java.io.File;
import java.util.Properties;
public class PreProcessor extends AbstractPreProcessor {
private PreProcessor(File source, File destination) {
super(source, destination);
}
private PreProcessor(File source, File destination, Properties properties) {
super(source, destination, properties);
}
public static IPreProcessor makePreProcessor(File source, File destination) {
return new PreProcessor(source, destination);
}
public static IPreProcessor makePreProcessor(File source, File destination, Properties properties) {
return new PreProcessor(source, destination, properties);
}
@Override
public boolean preprocess(IFileProcessor fileProcessor) {
FileUtils.copyDirectory(this.getSource(), this.getDestination(), fileProcessor);
return false;
}
}
| [
"quiibzdev@gmail.com"
] | quiibzdev@gmail.com |
e12f2b44c0db961ad373ca125e68c437ad6a5928 | 2eab57156a0f89fe20d1fae91d38808b3cb58865 | /src/main/java/com/example/sdad/demo/DemoApplication.java | 692774acb12bd243d48e34ad21169c4cf0ad6abf | [] | no_license | Aleapord/BowlingService | 02cbe94bbba90c98b86b2a8f09611d59a1cd5ed8 | 9ef82623aa9b3c89056c2afccd9e16d59f7c2cf0 | refs/heads/master | 2020-06-03T21:19:37.127334 | 2019-06-13T09:43:48 | 2019-06-13T09:43:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 322 | java | package com.example.sdad.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
| [
"13767593046@163.com"
] | 13767593046@163.com |
4f593d9bc7b2bcb8482af25408cda91fcec571b2 | b79762ec7facbe42976fb64f5ce862355f8c4385 | /DenoisingInCT/src/index/IndexValue.java | b851a06601e0b357fc7add1e84abebbb359a63fe | [] | no_license | harrycui/ExternalDenoising | 99c7f1399bdaceed93cd12b736da514c8ae33b80 | 62e0568d36dd9a63ce79415a2c968885249d1878 | refs/heads/master | 2021-01-20T11:50:19.547272 | 2017-02-19T03:39:46 | 2017-02-19T03:39:46 | 43,934,132 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 278 | java | package index;
public class IndexValue {
private byte[] iv;
private byte[] cipher;
public IndexValue(byte[] iv, byte[] cipher) {
this.iv = iv;
this.cipher = cipher;
}
public byte[] getIv() {
return iv;
}
public byte[] getCipher() {
return cipher;
}
}
| [
"cuihelei@gmail.com"
] | cuihelei@gmail.com |
402b46293d6abc2c62b5e325f99b775938a9a189 | 235d8f8f4d3782de42d1f72fb3095593f114c93c | /ui/src/com/ignathick/hotel2/ui/Interfaces/IAction.java | 4923a9d4d602d9cf1cb00024a1fc2846b010a29e | [
"MIT"
] | permissive | alexanderignathick/learn_java_se_program | f6517b8f93432ea1739e882c5f48e2a92ca33a1d | 3a81e8b29053a5d6a46757c963123c68e6018861 | refs/heads/master | 2021-01-05T14:57:00.919036 | 2020-02-17T08:46:57 | 2020-02-17T08:46:57 | 241,056,362 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 103 | java | package com.ignathick.hotel2.ui.Interfaces;
public interface IAction {
public void execute();
}
| [
"shock3r.brest@gmail.com"
] | shock3r.brest@gmail.com |
ff5937a384fbc3a5464944f89ce82574d1acedc0 | 2647c76aba0dd0e3ddec3cff97b42c5d4bb73a6b | /cloud-consumer-feign-hystrix-order80/src/main/java/com/exmaple/project/service/PaymentHystrixFallbackServiceImpl.java | b0dd427ec227de6cf7a81e27fa1209c9d624ef6d | [] | no_license | tanxxtarena/springcloud2 | cfe86dcd0dafd1c3018d572f8c5acd35b5545350 | f11670304918722dcf4fed3fa5f4b409c829bcb6 | refs/heads/master | 2022-06-28T12:57:07.317240 | 2020-03-20T01:41:00 | 2020-03-20T01:41:00 | 246,733,919 | 1 | 0 | null | 2022-06-21T02:58:17 | 2020-03-12T03:21:40 | Java | UTF-8 | Java | false | false | 638 | java | package com.exmaple.project.service;
import org.springframework.stereotype.Component;
/**
* @author: tanxx
* @create: 2020-03-14 13:44
* @description: 统一的服务降级处理类
**/
@Component
public class PaymentHystrixFallbackServiceImpl implements PaymentHystrixService {
@Override
public String hystrixOk() {
return Thread.currentThread().getName() + " PaymentHystrixFallbackService hystrixOk";
}
@Override
public String hystrixTimeout(long time) {
return Thread.currentThread().getName() + " hystrixTimeoutHandler 超过" + time + " s等待,客户端自我保护降级。";
}
}
| [
"tanxxtarena@163.com"
] | tanxxtarena@163.com |
05976725f3218c5a39e819b914cb7298bdaaaea8 | cc00011b2aae8f612e68753ddab1de1588d08c5c | /src/com/situ/mall/service/impl/ProductServiceImpl.java | 109b0c07ac467be3611d8e1ee1ce9f6ee6d5a81a | [] | no_license | exceedy/java1707mall | c6a374d0dd151d64d446548593056beecfda60a1 | 1c8af8f079a62d7bdef4428a41d917c614b3c42a | refs/heads/master | 2021-07-22T05:06:37.295723 | 2017-10-30T00:50:29 | 2017-10-30T00:50:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,302 | java | package com.situ.mall.service.impl;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.situ.mall.common.ServletRespone;
import com.situ.mall.dao.ProductDao;
import com.situ.mall.pojo.Product;
import com.situ.mall.service.IProductService;
import com.situ.mall.service.IStaticPageService;
import com.situ.mall.vo.PageBean;
import com.situ.mall.vo.SearchCondition;
@Service
public class ProductServiceImpl implements IProductService{
@Autowired
private ProductDao productDao;
@Autowired
private IStaticPageService staticPageService;
public PageBean<Product> pageList(int pageIndex, int pageSize) {
PageBean<Product> pageBean = new PageBean<Product>();
pageBean.setPageIndex(pageIndex);
pageBean.setPageSize(pageSize);
int totalCount = productDao.getCount();
pageBean.setTotalCount(totalCount);
int totalPage = (int) Math.ceil(1.0 * totalCount / pageSize);
pageBean.setTotalPage(totalPage);
int index = (pageIndex - 1) * pageSize;
List<Product> list = productDao.getPageList(index,pageSize);
pageBean.setList(list);
return pageBean;
}
public PageBean<Product> searchConditionSelect(SearchCondition<Product> searchCondition) {
PageBean<Product> pageBean = new PageBean<Product>();
Integer pageIndex = searchCondition.getPageIndex();
Integer pageSize = searchCondition.getPageSize();
pageBean.setPageIndex(pageIndex);
pageBean.setPageSize(pageSize);
int totalCount = productDao.getSearchConditionCount(searchCondition);
pageBean.setTotalCount(totalCount);
int totalPage = (int) Math.ceil(1.0 * totalCount / pageSize);
pageBean.setTotalPage(totalPage);
int index = (pageIndex - 1) * pageSize;
searchCondition.setPageIndex(index);
List<Product> list = productDao.getSearchConditionList(searchCondition);
pageBean.setList(list);
return pageBean;
}
public ServletRespone addProduct(Product product) {
int result = productDao.addProduct(product);
try {
if (result > 0) {
return ServletRespone.creatSuccess("添加成功");
} else {
return ServletRespone.creatError("添加失败");
}
} catch (Exception e) {
return ServletRespone.creatError("添加失败");
}
}
public Product findById(Integer id) {
return productDao.findById(id);
}
public boolean updateProduct(Product product) {
int retult = productDao.updateProduct(product);
return retult > 0 ? true : false;
}
public ServletRespone deleteProduct(Integer id) {
try {
int result = productDao.deleteProduct(id);
if (result > 0) {
return ServletRespone.creatSuccess("删除成功");
} else {
return ServletRespone.creatError("删除失败");
}
} catch (Exception e) {
return ServletRespone.creatError("删除失败");
}
}
public boolean updateStatus(Integer id, int status) {
int result = productDao.updateStatus(id,status);
return result > 0 ? true : false ;
}
/*public List<Product> getCategoryProduct(Integer categoryId) {
return productDao.getCategoryProduct(categoryId);
}*/
public PageBean<Product> getPageBean(Integer pageIndex, Integer sunCategoryId, Integer pageSize) {
PageBean<Product> pageBean = new PageBean<Product>();
pageBean.setPageIndex(pageIndex);
pageBean.setPageSize(pageSize);
int totalCount = productDao.getCategoryProductCount(sunCategoryId);
pageBean.setTotalCount(totalCount);
int totalPage = (int) Math.ceil((double) totalCount / pageSize);
pageBean.setTotalPage(totalPage);
int index = (pageIndex - 1) * pageSize;
List<Product> list = productDao.getCategoryProduct(index, sunCategoryId, pageSize);
pageBean.setList(list);
return pageBean;
}
public ServletRespone show(Integer id) {
if (null == id) {
return ServletRespone.creatError("id不能为空");
}
Product product = productDao.findById(id);
if (null == product) {
return ServletRespone.creatError("没有该商品");
}
Map<String, Object> root = new HashMap<String, Object>();
root.put("product", product);
productDao.updateStatus(id,1);
if (staticPageService.productIndex(root, id)) {
return ServletRespone.creatSuccess("静态成功");
}
return ServletRespone.creatError("静态失败");
}
}
| [
"1391850302@qq.com"
] | 1391850302@qq.com |
cdfd89e31bd039d1dc91b5b9f8e5127e26d9385a | ad16d02692ef9537b69ee4ff4cc726b4c951e3ca | /src/main/java/generics/CuriousRecurringGeneric.java | 6f274f987de639981ba8252355a3108a78f63914 | [] | no_license | jinfengf/thinking-in-java | ee89d1f9379ce4a4e76f30de1bce39a2d91f0a78 | 74cc1136a0383688e4c8b9f91d9533e52544d0bf | refs/heads/master | 2020-03-27T17:52:06.037007 | 2018-12-29T02:54:24 | 2018-12-29T02:54:24 | 146,880,352 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 185 | java | package generics;
/**
* Created by jiguang on 2018/8/31.
*/
class GenericType<T> {}
public class CuriousRecurringGeneric extends GenericType<CuriousRecurringGeneric> {
}
| [
"jinfeng@jiguang.cn"
] | jinfeng@jiguang.cn |
25eba20fcad2c8eef63be2375fbebbce3419e803 | ec36fb0c0235cea72d377beae46543100673983b | /plugins_src/org/jarmytoolplugins/newarmylisteditorplugin/weaponeditor/components/WeaponTypePanel.java | 46554b15aa5636b29cafc478ceced4723d2b0aab | [] | no_license | BackupTheBerlios/jarmytool | d9058dd19d12e52a8e7cdf0629744874e95fd061 | 73e315e51217a453b554dcededd88a393f3bf08d | refs/heads/master | 2021-01-02T09:14:28.998677 | 2004-09-06T14:02:25 | 2004-09-06T14:02:25 | 40,081,538 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,580 | java | /*
* WeaponTypePanel.java
*
* Created on 14 October 2003, 16:14
*/
package org.jarmytoolplugins.newarmylisteditorplugin.weaponeditor.components;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Vector;
import javax.swing.table.DefaultTableModel;
import org.jArmyTool.data.dataBeans.armylist.ArmylistWeapon;
import org.jArmyTool.data.dataBeans.util.WeaponProfile;
/**
*
* @author pasleh
*/
public class WeaponTypePanel extends javax.swing.JPanel {
private Collection armylistWeapons;
private WeaponProfile profile;
private DefaultTableModel model;
/** Creates new form WeaponTypePanel */
public WeaponTypePanel(WeaponProfile profile, Collection armylistWeapons) {
this.armylistWeapons = armylistWeapons;
this.profile = profile;
initComponents();
this.nameLabel.setText(this.profile.getName()+":");
this.initTable();
}
private void initTable(){
Vector profileVector = new Vector(this.profile.getHeaders());
profileVector.add(0, "Name");
this.model = new DefaultTableModel(profileVector, 0);
Iterator iterator = this.armylistWeapons.iterator();
while(iterator.hasNext()){
ArmylistWeapon weapon = (ArmylistWeapon)iterator.next();
Vector vector = new Vector(weapon.getStats());
vector.add(0, weapon.getName() );
this.model.addRow(vector);
}
this.jTable1.setModel(this.model);
}
public WeaponProfile getWeaponProfile(){
return this.profile;
}
public Collection getWeapons(){
this.jTable1.editCellAt(0,0);
LinkedList list = new LinkedList();
Iterator tableIterator = this.model.getDataVector().iterator();
while(tableIterator.hasNext()){
Iterator rowIterator = ((Vector)tableIterator.next()).iterator();
if(!rowIterator.hasNext())
continue;
String name = rowIterator.next().toString();
if(name == null || name.length() <= 0)
continue;
ArmylistWeapon weapon = new ArmylistWeapon(name, this.profile);
while(rowIterator.hasNext()){
Object cell = rowIterator.next();
try{
if(cell == null || ((String)cell).length() == 0)
cell = " ";
}catch(ClassCastException e){
cell = " ";
}
weapon.addStat(cell.toString());
}
list.add(weapon);
}
return list;
}
/** 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.
*/
private void initComponents() {//GEN-BEGIN:initComponents
headerPanel = new javax.swing.JPanel();
jPanel1 = new javax.swing.JPanel();
nameLabel = new javax.swing.JLabel();
dataPanel = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
controlPanel = new javax.swing.JPanel();
addButton = new javax.swing.JButton();
setLayout(new java.awt.BorderLayout());
headerPanel.setLayout(new java.awt.BorderLayout());
nameLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
nameLabel.setText("name");
jPanel1.add(nameLabel);
headerPanel.add(jPanel1, java.awt.BorderLayout.WEST);
add(headerPanel, java.awt.BorderLayout.NORTH);
dataPanel.setLayout(new java.awt.BorderLayout());
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
jScrollPane1.setViewportView(jTable1);
dataPanel.add(jScrollPane1, java.awt.BorderLayout.CENTER);
add(dataPanel, java.awt.BorderLayout.CENTER);
addButton.setText("Add New Weapon");
addButton.setMargin(new java.awt.Insets(0, 0, 0, 0));
addButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
addButtonActionPerformed(evt);
}
});
controlPanel.add(addButton);
add(controlPanel, java.awt.BorderLayout.SOUTH);
}//GEN-END:initComponents
private void addButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addButtonActionPerformed
Vector newRow = new Vector();
newRow.add("");
this.model.addRow(newRow);
}//GEN-LAST:event_addButtonActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton addButton;
private javax.swing.JPanel controlPanel;
private javax.swing.JPanel dataPanel;
private javax.swing.JPanel headerPanel;
private javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable jTable1;
private javax.swing.JLabel nameLabel;
// End of variables declaration//GEN-END:variables
}
| [
"pjlehtim"
] | pjlehtim |
98aa33ea99661181adac7cbb7d75550d6562050b | bf0f16635f2c32086206d3c3c6d8bad03e56625a | /src/main/java/pdf/CreateProblemPDF.java | c09af7ee394dbc13ad7df12531177a83fc227231 | [] | no_license | GuesmiHachem/E-qrqc | 5b8038c1b853f2af7507dab042216ae4928c7a39 | e1e9e27b192d1ee52a5147c154ed26c515ecbea2 | refs/heads/master | 2020-04-07T13:41:04.469248 | 2018-11-20T17:56:59 | 2018-11-20T17:56:59 | 158,416,810 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 33,759 | 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 pdf;
import com.itextpdf.text.BadElementException;
import com.itextpdf.text.BaseColor;
import com.itextpdf.text.Chunk;
import com.itextpdf.text.Document;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.Font;
import com.itextpdf.text.Image;
import com.itextpdf.text.Paragraph;
import com.itextpdf.text.Phrase;
import com.itextpdf.text.Rectangle;
import com.itextpdf.text.pdf.PdfPCell;
import com.itextpdf.text.pdf.PdfPTable;
import com.itextpdf.text.pdf.PdfPageEventHelper;
import com.itextpdf.text.pdf.PdfWriter;
import domaine.Config;
import entity.Problem;
import entity.Step1;
import entity.Step1Action;
import entity.Step1AlertCan;
import entity.Step1AlertShould;
import entity.Step1SecurityPlan;
import entity.Step1Why;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import service.ServiceProblem;
import servlet.ProblemPdf;
/**
*
* @author Hachem
*/
public class CreateProblemPDF {
public CreateProblemPDF(Problem problem) {
createProblemPDF(problem);
}
public void createProblemPDF(Problem problem) {
Document document = new Document();
//float widthPage = document.getPageSize().getWidth();
//float heightPage = document.getPageSize().getHeight();
try {
PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(new Config().pathPdf + problem.getCode() + ".pdf"));
createFooter(document, writer);
document.addTitle(problem.getCode());
document.open();
createHeader(document, problem);
retourLine(document);
createTitle1(document);
retourLine(document);
createProfileUser(document, problem);
retourLine(document);
createDescriptionProblem(document, problem);
retourLine(document);
createTitle2(document, "Step1");
retourLine(document);
createTitle3(document, "Caractérisation");
retourLine(document);
createStep1Part1(document, problem);
retourLine(document);
createAlertUser(document, problem);
retourLine(document);
createStep1Other(document, problem);
retourLine(document);
document.newPage();
create2Piece(document, problem);
retourLine(document);
retourLine(document);
createTitle3(document, "Actions immédiates");
retourLine(document);
createStep1Part2(document, problem);
retourLine(document);
createPlanSecurisation(document, problem);
retourLine(document);
createTitle3(document, "Analyse et actions définitives");
retourLine(document);
createListWhy(document, problem);
retourLine(document);
createListAction(document, problem);
retourLine(document);
//createFooter(document, writer);
} catch (Exception e) {
System.out.println(e);
}
document.close();
}
public class FooterTable extends PdfPageEventHelper {
protected PdfPTable footer;
// protected Phrase watermark = new Phrase("e-QRQC -- V 1.0", new Font(FontFamily.TIMES_ROMAN, 60, Font.NORMAL, BaseColor.LIGHT_GRAY));
public FooterTable(PdfPTable footer) {
this.footer = footer;
}
@Override
public void onEndPage(PdfWriter writer, Document document) {
footer.writeSelectedRows(0, -1, 36, 36, writer.getDirectContent());
//PdfContentByte canvas = writer.getDirectContentUnder();
//ColumnText.showTextAligned(canvas, Element.ALIGN_CENTER, watermark, 298, 421, 45);
}
}
public void performTask(HttpServletRequest request, HttpServletResponse response) throws ServletException,
IOException {
String idProblem = request.getParameter("id");
entity.Problem problem = ServiceProblem.find(Integer.parseInt(idProblem));
entity.User userProblem = problem.getIdUser();
File pdfFile = new File(new Config().pathPdf + problem.getCode() + ".pdf");
response.setContentType("application/pdf");
response.setContentLength((int) pdfFile.length());
FileInputStream fileInputStream = new FileInputStream(pdfFile);
OutputStream responseOutputStream = response.getOutputStream();
int bytes;
while ((bytes = fileInputStream.read()) != -1) {
responseOutputStream.write(bytes);
}
}
public void retourLine(Document document) {
try {
Paragraph par = new Paragraph();
par.add("\n");
document.add(par);
} catch (DocumentException ex) {
Logger.getLogger(ProblemPdf.class.getName()).log(Level.SEVERE, null, ex);
}
}
public void createTitle1(Document document) throws DocumentException, IOException {
PdfPTable table = new PdfPTable(1);
table.setWidthPercentage(100);
table.setWidths(new int[]{1});
PdfPCell cell = new Colonne("Rapport de QRQC", 18, BaseColor.WHITE, BaseColor.GRAY, 8, PdfPCell.ALIGN_CENTER, 1).getPdfCell();
cell.setBorder(Rectangle.BOX);
cell.setBorderWidth(0.1f);
cell.setBorderColor(BaseColor.LIGHT_GRAY);
table.addCell(cell);
// table.addCell(new Colonne("Rapport de QRQC", 15, BaseColor.WHITE, BaseColor.BLUE, 5, PdfPCell.ALIGN_CENTER, 1).getPdfCell());
document.add(table);
}
public void createTitle2(Document document, String chaine) throws DocumentException, IOException {
PdfPTable table = new PdfPTable(1);
table.setWidthPercentage(100);
table.setWidths(new int[]{1});
PdfPCell cell = new Colonne(chaine, 12, BaseColor.WHITE, BaseColor.DARK_GRAY, 5, PdfPCell.ALIGN_CENTER, 1).getPdfCell();
cell.setBorder(Rectangle.BOX);
cell.setBorderWidth(0.1f);
// cell.setBorderColor(BaseColor.BLUE);
table.addCell(cell);
document.add(table);
}
public void createTitle3(Document document, String chaine) throws DocumentException, IOException {
PdfPTable table = new PdfPTable(1);
table.setWidthPercentage(100);
table.setWidths(new int[]{1});
PdfPCell cell = new Colonne(chaine, 12, BaseColor.BLACK, BaseColor.ORANGE, 5, PdfPCell.ALIGN_CENTER, 1).getPdfCell();
//cell.setBorder(Rectangle.BOX);
//cell.setBorderWidth(0);
// cell.setBorderColor(BaseColor.BLUE);
table.addCell(cell);
document.add(table);
}
public void createHeader(Document document, entity.Problem problem) throws DocumentException, IOException {
Font fontBlue = new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL, BaseColor.BLACK);
Chunk fontBlueText1 = new Chunk("Société de Tri & de Retouche STR TQM\n", fontBlue);
Chunk fontBlueText2 = new Chunk("Tunisie\n", fontBlue);
Chunk fontBlueText3 = new Chunk("Adresse : Rue abderrahmen elbahri Boumhal\n", fontBlue);
Chunk fontBlueText4 = new Chunk("Tél : 58533201 / 58533200\n", fontBlue);
Image img = Image.getInstance(new Config().pathPictureUser + "logo.png");
img.setAlt("ffff");
img.scaleToFit(100, 100);
Paragraph par = new Paragraph();
par.add(fontBlueText1);
par.add(fontBlueText2);
par.add(fontBlueText3);
par.add(fontBlueText4);
PdfPCell cell1 = new PdfPCell(img);
cell1.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
cell1.setBorderWidth(0);
PdfPCell cell3 = new PdfPCell(par);
cell3.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
cell3.setBorderWidth(0);
PdfPCell cell2 = new PdfPCell();
cell2.setBorderWidth(0);
PdfPTable tableHeader2 = new PdfPTable(3);
tableHeader2.setWidthPercentage(100);
tableHeader2.setWidths(new int[]{1, 2, 2});
tableHeader2.addCell(cell1);
tableHeader2.addCell(cell2);
tableHeader2.addCell(cell3);
tableHeader2.completeRow();
PdfPCell cell11 = new PdfPCell(tableHeader2);
cell11.setBorderColor(BaseColor.LIGHT_GRAY);
cell11.setPadding(5);
PdfPTable tableHeader1 = new PdfPTable(1);
tableHeader1.setWidthPercentage(100);
tableHeader1.addCell(cell11);
document.add(tableHeader1);
}
public void createFooter(Document document, PdfWriter writer) throws DocumentException, IOException {
//=========================================
Font f1 = new Font(Font.FontFamily.TIMES_ROMAN, 9, Font.NORMAL, BaseColor.DARK_GRAY);
Chunk ch1 = new Chunk("Document généré le \n" + new Date().toLocaleString().substring(0, 12) + "\n" + new Date().toLocaleString().substring(12), f1);
Paragraph p1 = new Paragraph(ch1);
PdfPCell cell1 = new PdfPCell(p1);
cell1.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
cell1.setBorderWidth(0);
//=========================================
Font f2 = new Font(Font.FontFamily.TIMES_ROMAN, 9, Font.NORMAL, BaseColor.DARK_GRAY);
Chunk ch11 = new Chunk("Rapport génerer automatiquement par la base e-QRQC V1.0 de STR\n", f2);
//Chunk ch22 = new Chunk("Tunisie\n", f2);
Chunk ch33 = new Chunk("Adresse : Rue abderrahmen elbahri Boumhal Tél : 58533201 / 58533200 site web : www.tunisiestr.com\n", f2);
//Chunk ch44 = new Chunk("Tél : 58533201 / 58533200\n", f2);
Paragraph par1 = new Paragraph();
par1.add(ch11);
//par1.add(ch22);
par1.add(ch33);
//par1.add(ch44);
PdfPCell cell2 = new PdfPCell(par1);
cell2.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
cell2.setBorderWidth(0);
//=========================================
Font f3 = new Font(Font.FontFamily.TIMES_ROMAN, 9, Font.NORMAL, BaseColor.DARK_GRAY);
// Chunk ch3 = new Chunk("Page " + document.getPageNumber() + 1 + "/" + document.getPageNumber() + " ", f3);
Chunk ch3 = new Chunk("Page ", f3);
Paragraph p3 = new Paragraph(ch3);
PdfPCell cell3 = new PdfPCell(p3);
cell3.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
cell3.setBorderWidth(0);
//=========================================
PdfPTable tableHeader2 = new PdfPTable(3);
tableHeader2.setWidthPercentage(100);
tableHeader2.setWidths(new int[]{1, 3, 1});
tableHeader2.addCell(cell1);
tableHeader2.addCell(cell2);
tableHeader2.addCell(cell3);
tableHeader2.completeRow();
PdfPCell cell11 = new PdfPCell(tableHeader2);
cell11.setBorderColor(BaseColor.LIGHT_GRAY);
cell11.setPadding(0);
PdfPTable tableHeader1 = new PdfPTable(1);
tableHeader1.setTotalWidth(523);
tableHeader1.setWidthPercentage(100);
tableHeader1.addCell(cell11);
//=========================================
FooterTable event = new FooterTable(tableHeader1);
writer.setPageEvent(event);
}
public void createProfileUser(Document document, entity.Problem problem) throws DocumentException, IOException {
Step1 step1 = problem.getIdStep1();
PdfPTable table = new PdfPTable(3);
table.setWidthPercentage(100);
table.setWidths(new int[]{2, 1, 1});
table.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
Image img = Image.getInstance(new Config().pathPictureUser + problem.getIdUser().getPicture());
img.scaleToFit(100, 100);
PdfPCell cel = new PdfPCell(img);
cel.setColspan(1);
cel.setRowspan(6);
cel.setPadding(10);
cel.setVerticalAlignment(PdfPCell.ALIGN_CENTER);
cel.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
table.addCell(cel);
table.addCell(new Colonne("Prénom", 10, BaseColor.BLACK, BaseColor.LIGHT_GRAY, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne(problem.getIdUser().getFirstName(), 10, BaseColor.DARK_GRAY, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne("Nom", 10, BaseColor.BLACK, BaseColor.LIGHT_GRAY, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne(problem.getIdUser().getName(), 10, BaseColor.DARK_GRAY, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne("Niveau Equipe", 10, BaseColor.BLACK, BaseColor.LIGHT_GRAY, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne(problem.getIdUser().getIdLevel0().getName(), 10, BaseColor.DARK_GRAY, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne("Niveau 1", 10, BaseColor.BLACK, BaseColor.LIGHT_GRAY, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne(problem.getIdUser().getIdLevel0().getIdLevel1().getName(), 10, BaseColor.DARK_GRAY, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne("Niveau 2", 10, BaseColor.BLACK, BaseColor.LIGHT_GRAY, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne(problem.getIdUser().getIdLevel0().getIdLevel1().getIdLevel2().getName(), 10, BaseColor.DARK_GRAY, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne("Niveau 3", 10, BaseColor.BLACK, BaseColor.LIGHT_GRAY, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne(problem.getIdUser().getIdLevel0().getIdLevel1().getIdLevel2().getIdLevel3().getName(), 10, BaseColor.DARK_GRAY, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
document.add(table);
}
public void createDescriptionProblem(Document document, entity.Problem problem) throws DocumentException, IOException {
PdfPTable table = new PdfPTable(4);
table.setWidthPercentage(100);
table.setWidths(new int[]{1, 1, 1, 1});
table.addCell(new Colonne("Probléme", 12, BaseColor.WHITE, BaseColor.DARK_GRAY, 5, PdfPCell.ALIGN_CENTER, 4).getPdfCell());
table.addCell(new Colonne("Code Probléme", 10, BaseColor.BLACK, BaseColor.LIGHT_GRAY, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne(problem.getCode(), 10, BaseColor.BLACK, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne("Type Probléme", 10, BaseColor.BLACK, BaseColor.LIGHT_GRAY, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne(problem.getIdTypeProblem().getName(), 10, BaseColor.BLACK, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne("Réference", 10, BaseColor.BLACK, BaseColor.LIGHT_GRAY, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne(problem.getReference(), 10, BaseColor.BLACK, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne("Status", 10, BaseColor.BLACK, BaseColor.LIGHT_GRAY, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne(problem.getStatus(), 10, BaseColor.BLACK, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne("Date création", 10, BaseColor.BLACK, BaseColor.LIGHT_GRAY, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne(problem.getDateCreation().toLocaleString(), 10, BaseColor.BLACK, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne("Créér par", 10, BaseColor.BLACK, BaseColor.LIGHT_GRAY, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne(problem.getIdUser().getFirstName() + " " + problem.getIdUser().getName(), 10, BaseColor.BLACK, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
document.add(table);
}
public void createStep1Part1(Document document, entity.Problem problem) throws DocumentException, IOException {
Step1 step1 = problem.getIdStep1();
PdfPTable table = new PdfPTable(4);
table.setWidthPercentage(100);
table.setWidths(new int[]{1, 1, 1, 1});
//table.addCell(new Colonne("Caractérisation", 12, BaseColor.BLACK, BaseColor.ORANGE, 5, PdfPCell.ALIGN_CENTER, 4).getPdfCell());
table.addCell(new Colonne("Que s'est t'il passé ?", 10, BaseColor.BLACK, BaseColor.LIGHT_GRAY, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne(step1.getWhat(), 10, BaseColor.BLACK, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne("Quand ?", 10, BaseColor.BLACK, BaseColor.LIGHT_GRAY, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne(step1.getWhen(), 10, BaseColor.BLACK, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne("Où ?", 10, BaseColor.BLACK, BaseColor.LIGHT_GRAY, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne(step1.getWhere(), 10, BaseColor.BLACK, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne("Comment ?", 10, BaseColor.BLACK, BaseColor.LIGHT_GRAY, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne(step1.getHow(), 10, BaseColor.BLACK, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne("Combien ?", 10, BaseColor.BLACK, BaseColor.LIGHT_GRAY, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne(step1.getHowMutch() + "", 10, BaseColor.BLACK, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne("Pourquoi ?", 10, BaseColor.BLACK, BaseColor.LIGHT_GRAY, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne(step1.getWhy(), 10, BaseColor.BLACK, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.completeRow();
document.add(table);
}
public void createAlertUser(Document document, entity.Problem problem) throws DocumentException, IOException {
Step1 step1 = problem.getIdStep1();
PdfPTable table = new PdfPTable(2);
table.setWidthPercentage(100);
table.setWidths(new int[]{1, 1});
com.itextpdf.text.List list1 = new com.itextpdf.text.List();
for (Step1AlertCan step1AlertCan : step1.getStep1AlertCanList()) {
list1.add(step1AlertCan.getIdTypeUser().getName());
}
com.itextpdf.text.List list2 = new com.itextpdf.text.List();
for (Step1AlertShould step1AlertShould : step1.getStep1AlertShouldList()) {
list2.add(step1AlertShould.getIdTypeUser().getName());
}
PdfPCell cell1 = new PdfPCell();
cell1.addElement(list1);
PdfPCell cell2 = new PdfPCell();
cell2.addElement(list2);
table.addCell(new Colonne("Utilisateur Qui doit être Alerté", 10, BaseColor.BLACK, BaseColor.LIGHT_GRAY, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne("Utilisateur Qui peut être Alerté", 10, BaseColor.BLACK, BaseColor.LIGHT_GRAY, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(cell1);
table.addCell(cell2);
document.add(table);
}
public void create2Piece(Document document, entity.Problem problem) throws DocumentException, IOException {
Step1 step1 = problem.getIdStep1();
PdfPTable table = new PdfPTable(2);
table.setWidthPercentage(100);
table.setWidths(new int[]{1, 1});
Image imgBad = null;
Image imgGood = null;
try {
imgBad = Image.getInstance(new Config().pathPictureProblem + step1.getBadPiece());
} catch (BadElementException ex) {
Logger.getLogger(ProblemPdf.class.getName()).log(Level.SEVERE, null, ex);
imgBad = null;
} catch (IOException ex) {
Logger.getLogger(ProblemPdf.class.getName()).log(Level.SEVERE, null, ex);
imgBad = null;
}
try {
imgGood = Image.getInstance(new Config().pathPictureProblem + step1.getGoodPiece());
} catch (BadElementException ex) {
Logger.getLogger(ProblemPdf.class.getName()).log(Level.SEVERE, null, ex);
imgGood = null;
} catch (IOException ex) {
Logger.getLogger(ProblemPdf.class.getName()).log(Level.SEVERE, null, ex);
imgGood = null;
}
PdfPCell cell1 = new PdfPCell(new Phrase("Pas d'image"));
cell1.setFixedHeight(100);
cell1.setPadding(10);
if (imgBad != null) {
cell1 = new PdfPCell(imgBad);
cell1.setFixedHeight(100);
cell1.setPadding(10);
}
PdfPCell cell2 = new PdfPCell(new Phrase("Pas d'image"));
cell2.setFixedHeight(100);
cell2.setPadding(10);
if (imgGood != null) {
cell2 = new PdfPCell(imgGood);
cell2.setFixedHeight(100);
cell2.setPadding(10);
}
table.addCell(new Colonne("PIECE MAUVAISE", 10, BaseColor.BLACK, BaseColor.RED, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne("PIECE BONNE", 10, BaseColor.BLACK, BaseColor.GREEN, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(cell1);
table.addCell(cell2);
document.add(table);
}
public void createStep1Other(Document document, entity.Problem problem) throws DocumentException, IOException {
Step1 step1 = problem.getIdStep1();
PdfPTable table = new PdfPTable(2);
table.setWidthPercentage(50);
table.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
table.setWidths(new int[]{1, 1});
table.addCell(new Colonne("Respect du standard", 10, BaseColor.BLACK, BaseColor.LIGHT_GRAY, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
if (step1.getRespectStandard()) {
table.addCell(new Colonne("Oui", 10, BaseColor.GREEN, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
} else {
table.addCell(new Colonne("Non", 10, BaseColor.RED, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
}
table.addCell(new Colonne("Probléme recurrent", 10, BaseColor.BLACK, BaseColor.LIGHT_GRAY, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
if (step1.getRecognizedProblem()) {
table.addCell(new Colonne("Oui", 10, BaseColor.GREEN, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
} else {
table.addCell(new Colonne("Non", 10, BaseColor.RED, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
}
table.completeRow();
document.add(table);
}
public void createStep1Part2(Document document, entity.Problem problem) throws DocumentException, IOException {
Step1 step1 = problem.getIdStep1();
PdfPTable table = new PdfPTable(4);
table.setWidthPercentage(100);
table.setWidths(new int[]{1, 1, 1, 1});
table.addCell(new Colonne("Lancer un tri ?", 10, BaseColor.BLACK, BaseColor.LIGHT_GRAY, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
if (step1.getSort()) {
table.addCell(new Colonne("Oui", 10, BaseColor.GREEN, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
} else {
table.addCell(new Colonne("Non", 10, BaseColor.RED, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
}
table.addCell(new Colonne("Quel est le critéré de tri ?", 10, BaseColor.BLACK, BaseColor.LIGHT_GRAY, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne(step1.getSortCriterion(), 10, BaseColor.BLACK, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne("Autre Actions immédiates", 10, BaseColor.BLACK, BaseColor.LIGHT_GRAY, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne(step1.getImmediateActions().trim(), 10, BaseColor.BLACK, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne("Validation de redémarrage", 10, BaseColor.BLACK, BaseColor.LIGHT_GRAY, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
if (step1.getStartValidation()) {
table.addCell(new Colonne("Oui", 10, BaseColor.GREEN, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
} else {
table.addCell(new Colonne("Non", 10, BaseColor.RED, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
}
table.completeRow();
document.add(table);
}
public void createPlanSecurisation(Document document, entity.Problem problem) throws DocumentException, IOException {
Step1 step1 = problem.getIdStep1();
PdfPTable table = new PdfPTable(4);
table.setWidthPercentage(100);
table.setWidths(new int[]{1, 1, 1, 1});
table.addCell(new Colonne("Plan de securité", 12, BaseColor.BLACK, BaseColor.GRAY, 5, PdfPCell.ALIGN_CENTER, 4).getPdfCell());
table.addCell(new Colonne("Où", 10, BaseColor.BLACK, BaseColor.LIGHT_GRAY, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne("Qui", 10, BaseColor.BLACK, BaseColor.LIGHT_GRAY, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne("Combien", 10, BaseColor.BLACK, BaseColor.LIGHT_GRAY, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne("Resultat", 10, BaseColor.BLACK, BaseColor.LIGHT_GRAY, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
for (Step1SecurityPlan step1SecurityPlan : step1.getStep1SecurityPlanList()) {
table.addCell(new Colonne(step1SecurityPlan.getWhere(), 10, BaseColor.DARK_GRAY, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne(step1SecurityPlan.getWho(), 10, BaseColor.DARK_GRAY, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne(step1SecurityPlan.getHowMuch() + "", 10, BaseColor.DARK_GRAY, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne(step1SecurityPlan.getResult() + "", 10, BaseColor.DARK_GRAY, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
}
document.add(table);
}
public void createListWhy(Document document, entity.Problem problem) throws DocumentException, IOException {
Step1 step1 = problem.getIdStep1();
PdfPTable table = new PdfPTable(3);
table.setWidthPercentage(100);
table.setWidths(new int[]{1, 2, 2});
table.addCell(new Colonne("5 Pourquois", 12, BaseColor.BLACK, BaseColor.GRAY, 5, PdfPCell.ALIGN_CENTER, 4).getPdfCell());
table.addCell(new Colonne("ID", 10, BaseColor.BLACK, BaseColor.LIGHT_GRAY, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne("Pourquoi", 10, BaseColor.BLACK, BaseColor.LIGHT_GRAY, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne("Commentaire", 10, BaseColor.BLACK, BaseColor.LIGHT_GRAY, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
for (int i = 0; i < step1.getStep1WhyList().size(); i++) {
Step1Why Step1Why = step1.getStep1WhyList().get(i);
table.addCell(new Colonne((i + 1) + "", 10, BaseColor.DARK_GRAY, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne(Step1Why.getWhy(), 10, BaseColor.DARK_GRAY, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne(Step1Why.getComment() + "", 10, BaseColor.DARK_GRAY, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
}
for (int i = step1.getStep1ActionList().size(); i < 5; i++) {
table.addCell(new Colonne((i + 1) + " ", 10, BaseColor.DARK_GRAY, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne(" ", 10, BaseColor.DARK_GRAY, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne(" ", 10, BaseColor.DARK_GRAY, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
}
document.add(table);
}
public void createListAction(Document document, entity.Problem problem) throws DocumentException, IOException {
Step1 step1 = problem.getIdStep1();
PdfPTable table = new PdfPTable(6);
table.setWidthPercentage(100);
table.setWidths(new int[]{1, 2, 1, 2, 3, 1});
table.addCell(new Colonne("Action", 12, BaseColor.BLACK, BaseColor.GRAY, 5, PdfPCell.ALIGN_CENTER, 6).getPdfCell());
table.addCell(new Colonne("ID", 10, BaseColor.BLACK, BaseColor.LIGHT_GRAY, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne("Action", 10, BaseColor.BLACK, BaseColor.LIGHT_GRAY, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne("Qui", 10, BaseColor.BLACK, BaseColor.LIGHT_GRAY, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne("Quand", 10, BaseColor.BLACK, BaseColor.LIGHT_GRAY, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne("Commentaire", 10, BaseColor.BLACK, BaseColor.LIGHT_GRAY, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne("Status", 10, BaseColor.BLACK, BaseColor.LIGHT_GRAY, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
for (int i = 0; i < step1.getStep1ActionList().size(); i++) {
Step1Action step1Action = step1.getStep1ActionList().get(i);
table.addCell(new Colonne((i + 1) + "", 10, BaseColor.DARK_GRAY, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne(step1Action.getAction(), 10, BaseColor.DARK_GRAY, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne(step1Action.getWho() + "", 10, BaseColor.DARK_GRAY, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne(step1Action.getWhen() + "", 10, BaseColor.DARK_GRAY, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne(step1Action.getComment().trim() + "", 10, BaseColor.DARK_GRAY, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
if (step1Action.getStatus() == 100) {
table.addCell(new Colonne(step1Action.getStatus() + "", 10, BaseColor.GREEN, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
} else {
table.addCell(new Colonne(step1Action.getStatus() + "", 10, BaseColor.PINK, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
}
}
for (int i = step1.getStep1ActionList().size(); i < 5; i++) {
table.addCell(new Colonne((i + 1) + " ", 10, BaseColor.DARK_GRAY, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne(" ", 10, BaseColor.DARK_GRAY, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne(" ", 10, BaseColor.DARK_GRAY, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne(" ", 10, BaseColor.DARK_GRAY, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne(" ", 10, BaseColor.DARK_GRAY, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
table.addCell(new Colonne(" ", 10, BaseColor.DARK_GRAY, BaseColor.WHITE, 5, PdfPCell.ALIGN_LEFT, 1).getPdfCell());
}
document.add(table);
}
public class Colonne {
public String text;
public int size;
public BaseColor color;
public BaseColor background;
public float padding;
public int horizontalAlignment;
public int colspan;
public PdfPCell pdfCell;
public Paragraph paragraph;
public Chunk chunk;
public Font font;
public Colonne() {
text = "";
size = 10;
color = BaseColor.BLACK;
background = BaseColor.WHITE;
padding = 5;
horizontalAlignment = PdfPCell.ALIGN_LEFT;
colspan = 1;
}
public Colonne(String text, int size, BaseColor color, BaseColor background, float padding, int horizontalAlignment, int colspan) {
super();
this.text = text;
this.size = size;
this.color = color;
this.background = background;
this.padding = padding;
this.horizontalAlignment = horizontalAlignment;
this.colspan = colspan;
font = new Font(Font.FontFamily.TIMES_ROMAN, size, Font.NORMAL, color);
chunk = new Chunk(text);
chunk.setFont(font);
paragraph = new Paragraph(chunk);
pdfCell = new PdfPCell(paragraph);
pdfCell.setBackgroundColor(background);
pdfCell.setHorizontalAlignment(horizontalAlignment);
pdfCell.setPadding(padding);
pdfCell.setColspan(colspan);
}
public PdfPCell getPdfCell() {
return pdfCell;
}
}
}
| [
"guesmi.hachem@gmail.com"
] | guesmi.hachem@gmail.com |
7bf50a75443a2209ab0037766a3b71aa18cb3b0b | 0aabd1b5a183cdd47b8cbd06a3a7d91a28295001 | /DS_Lab3/src/Receiver.java | 86e343fd6a548f8f3cfa50de851a0dece710ce2e | [] | no_license | xincen/DS_Lab3 | 7d8071f5595a71e685d05c35a1aee96a974eb7d0 | 0f0ba2df6cf1ccb987b1e1eb40c0133ed6c3a850 | refs/heads/master | 2016-08-04T10:02:30.980712 | 2014-02-13T00:38:45 | 2014-02-13T00:38:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,254 | java | import java.net.*;
import java.io.*;
import java.util.LinkedList;
public class Receiver extends Thread {
private Socket socket;
private LinkedList<TimeStampedMessage> in_buffer;
private ObjectInputStream in;
private MessagePasser mp;
public Receiver(Socket aSocket, LinkedList<TimeStampedMessage> aBuffer, MessagePasser mp)
{
this.socket = aSocket;
this.in_buffer = aBuffer;
this.mp = mp;
}
public void teardown() {
try {
in.close();
}
catch (IOException e) {
System.out.println("Closing...");
}
}
public void run() {
try {
in = new ObjectInputStream(socket.getInputStream());
TimeStampedMessage m;
while(true) {
Thread.sleep(100);
m = (TimeStampedMessage) in.readObject();
synchronized(in_buffer) {
in_buffer.add(m);
}
mp.processInBuffer();
//System.out.println("in receiver " + mp.getPid());
if (mp.getPid() == 4) // logger
mp.receive();
}
}
catch (IOException e) {
//e.printStackTrace();
}
catch (ClassNotFoundException e) {
e.printStackTrace();
}
catch (InterruptedException e) {
e.printStackTrace();
}
finally {
try {
socket.close();
in.close();
}
catch (IOException e) {
e.printStackTrace();
}
}
}
} | [
"xincen.hao@gmail.com"
] | xincen.hao@gmail.com |
39aa6e198d22e55832e90abc4637a06e6c6c1015 | e977c424543422f49a25695665eb85bfc0700784 | /benchmark/icse15/1167470/buggy-version/db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/AppRequester.java | 02d9d14cbf302743d78b5c8a956164dd9d38b4d7 | [] | no_license | amir9979/pattern-detector-experiment | 17fcb8934cef379fb96002450d11fac62e002dd3 | db67691e536e1550245e76d7d1c8dced181df496 | refs/heads/master | 2022-02-18T10:24:32.235975 | 2019-09-13T15:42:55 | 2019-09-13T15:42:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,438 | java | /*
Derby - Class org.apache.derby.impl.drda.AppRequester
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.apache.derby.impl.drda;
import org.apache.derby.iapi.services.sanity.SanityManager;
import org.apache.derby.iapi.reference.DRDAConstants;
import org.apache.derby.iapi.reference.Limits;
/**
AppRequester stores information about the application requester.
It is used so that multiple sessions can share information when they are
started from the same version of the application requester.
*/
class AppRequester
{
protected static final int MGR_LEVEL_UNKNOWN = -1;
protected static final int UNKNOWN_CLIENT = 0;
protected static final int JCC_CLIENT = 1;
protected static final int CCC_CLIENT = 2; // not yet supported.
protected static final int DNC_CLIENT = 3; // derby net client
private static final int [] MIN_MGR_LEVELS = {
3, // AGENT - JCC comes in at 3
4, // CCSIDMGR
3, // CMNAPPC,
4, // CMNSYNCPT
5, // CMNTCPIP
1, // DICTIONARY
3, // RDB
4, // RSYNCMGR
1, // SECMGR
6, // SQLAM
1, // SUPERVISOR
5, // SYNCPTMGR
1208, // UNICODEMGR
0 // XAMGR
};
// Application requester information
protected String extnam; // External Name - EXCSAT
protected String srvnam; // Server Name - EXCSAT
protected String srvrlslv; // Server Product Release Level - EXCSAT
protected String srvclsnm; // Server Class Name - EXCSAT
protected String spvnam; // Supervisor Name - EXCSAT
protected String prdid; // Product specific identifier - ACCRDB protected
private int[] managerLevels = new int[CodePoint.MGR_CODEPOINTS.length];
private int clientType;
protected int versionLevel;
protected int releaseLevel;
protected int modifyLevel;
// constructor
/**
* AppRequester constructor
*
* @exception throws IOException
*/
AppRequester ()
{
for (int i = 0; i < CodePoint.MGR_CODEPOINTS.length; i++)
managerLevels[i] = MGR_LEVEL_UNKNOWN;
}
/**
* get the Application requester manager level
*
* @param manager codepoint for manager we are looking for
*
* @return manager level for that manager
*/
protected int getManagerLevel(int manager)
{
int mindex = CodePoint.getManagerIndex(manager);
if (SanityManager.DEBUG)
{
if (mindex < 0 || mindex > managerLevels.length)
SanityManager.THROWASSERT("Unknown manager "+ manager + " mindex = "+
mindex);
}
return managerLevels[mindex];
}
protected void setClientVersion(String productId)
{
prdid = productId;
versionLevel = Integer.parseInt(prdid.substring (3, 5));
releaseLevel = Integer.parseInt(prdid.substring (5, 7));
modifyLevel = Integer.parseInt(prdid.substring (7, 8));
if (srvrlslv == null)
{ clientType = UNKNOWN_CLIENT; }
else if (srvrlslv.indexOf("JCC") != -1)
{ clientType = JCC_CLIENT; }
else if
(
(srvrlslv.indexOf(DRDAConstants.DERBY_DRDA_CLIENT_ID) != -1)
)
{ clientType = DNC_CLIENT; }
else
{ clientType = UNKNOWN_CLIENT; }
}
/**
* Returns true if Derby's client driver supports SECMEC_USRSSBPWD
* DRDA security mechanism.
*/
protected boolean supportsSecMecUSRSSBPWD()
{
return
(
( clientType == DNC_CLIENT ) &&
( greaterThanOrEqualTo( 10, 2, 0 ) )
);
}
/**
* Check if the client expects QRYCLSIMP to be supported when the
* protocol is LMTBLKPRC.
*
* @return <code>true</code> if QRYCLSIMP is supported for
* LMTBLKPRC
*/
protected final boolean supportsQryclsimpForLmtblkprc() {
return clientType == DNC_CLIENT;
}
/**
* Check if provided JCC version level is greaterThanOrEqualTo current level
*
* @param vLevel Version level
* @param rLevel Release level
* @param mLevel Modification level
*/
protected boolean greaterThanOrEqualTo(int vLevel, int rLevel, int mLevel)
{
if (versionLevel > vLevel)
return true;
else if (versionLevel == vLevel) {
if (releaseLevel > rLevel)
return true;
else if (releaseLevel == rLevel)
if (modifyLevel >= mLevel)
return true;
}
return false;
}
/**
* set Application requester manager level
* if the manager level is less than the minimum manager level,
* set the manager level to zero (saying we can't handle this
* level), this will be returned
* to the application requester and he can decide whether or not to
* proceed
* For CCSIDMGR, if the target server supports the CCSID manager but
* not the CCSID requested, the value returned is FFFF
* For now, we won't support the CCSIDMGR since JCC doesn't request it.
*
* @param manager codepoint of the manager
* @param managerLevel level for that manager
*
*/
protected void setManagerLevel(int manager, int managerLevel)
{
int i = CodePoint.getManagerIndex(manager);
if (SanityManager.DEBUG)
{
if (i < 0 || i > managerLevels.length)
SanityManager.THROWASSERT("Unknown manager "+ manager + " i = " + i);
}
if (managerLevel >= MIN_MGR_LEVELS[i])
managerLevels[i] = managerLevel;
else
managerLevels[i] = 0;
}
/**
* Check if the application requester is the same as this one
*
* @param a application requester to compare to
* @return true if same false otherwise
*/
protected boolean equals(AppRequester a)
{
// check prdid - this should be different if they are different
if (!prdid.equals(a.prdid))
return false;
// check server product release level
if (notEquals(srvrlslv, a.srvrlslv))
return false;
// check server names
if (notEquals(extnam, a.extnam))
return false;
if (notEquals(srvnam, a.srvnam))
return false;
if (notEquals(srvclsnm, a.srvclsnm))
return false;
if (notEquals(spvnam, a.spvnam))
return false;
// check manager levels
for (int i = 0; i < managerLevels.length; i++)
if (managerLevels[i] != a.managerLevels[i])
return false;
// O.K. looks good
return true;
}
/**
* Check whether two objects are not equal when 1 of the objects could
* be null
*
* @param a first object
* @param b second object
* @return true if not equals false otherwise
*/
private boolean notEquals(Object a, Object b)
{
if (a != null && b == null)
return true;
if (a == null && b != null)
return true;
if (a != null && !a.equals(b))
return true;
return false;
}
/**
* Get the maximum length supported for an exception's message
* parameter string.
*/
protected int supportedMessageParamLength() {
switch (clientType) {
case JCC_CLIENT:
case DNC_CLIENT:
return Limits.DB2_JCC_MAX_EXCEPTION_PARAM_LENGTH;
default:
// Default is the max for C clients, since that is more
// restricted than for JCC clients. Note, though, that
// JCC clients are the only ones supported right now.
return Limits.DB2_CCC_MAX_EXCEPTION_PARAM_LENGTH;
}
}
/**
* Get the type of the client.
*/
protected int getClientType() {
return clientType;
}
/**
* Is this an AppRequester that supports XA
*
* return true if XAMGR >= 7, false otherwise
**/
protected boolean isXARequester()
{
return (getManagerLevel(CodePoint.XAMGR) >= 7);
}
/**
* Tells whether the client sends a trailing Derby-specific status byte
* when transferring EXTDTA objects.
*
* @return {@code true} if the status byte is sent, {@code false} if not
*/
protected boolean supportsEXTDTAAbort() {
return (clientType == DNC_CLIENT && greaterThanOrEqualTo(10, 6, 0));
}
/**
* Returns whether our AppRequester's UNICODEMGR supports UTF8 (CCSID 1208)
* @return {@code true} if the AppRequester supports CCSID 1208, {@code false} if not
*/
protected boolean supportsUtf8Ccsid() {
return (getManagerLevel(CodePoint.UNICODEMGR) == CcsidManager.UTF8_CCSID);
}
protected boolean supportsSessionDataCaching() {
return (clientType == DNC_CLIENT && greaterThanOrEqualTo(10, 4, 0));
}
protected boolean supportsUDTs() {
return (clientType == DNC_CLIENT && greaterThanOrEqualTo(10, 6, 0));
}
protected boolean supportsTimestampNanoseconds() {
return (clientType == DNC_CLIENT && greaterThanOrEqualTo(10, 6, 0));
}
protected boolean supportsBooleanValues() {
return (clientType == DNC_CLIENT && greaterThanOrEqualTo(10, 7, 0));
}
/**
* The timestamp length may be truncated for old versions of Derby.
* See DERBY-2602.
*/
protected int getTimestampLength()
{
return supportsTimestampNanoseconds() ?
DRDAConstants.JDBC_TIMESTAMP_LENGTH : DRDAConstants.DRDA_OLD_TIMESTAMP_LENGTH;
}
}
| [
"durieuxthomas@hotmail.com"
] | durieuxthomas@hotmail.com |
8c4f7c0d945da3b65e0dc895ffbfe2dbaee4fad7 | ab88b1cdb34c17516e155c2b69af3b56d7f78f47 | /src/br/com/qualiti/DeliveryQualiti/repositorio/RepositorioPedidosArray.java | 2dd74fe940eb8ce88915c5ede60bc9206283606d | [] | no_license | lucasbr023/DeliveryQualiti | 082402c44726cd72595db54bf86ac52779e824bb | 01e1dc6a22b9a9895a864a812d0ea24dd2dd4ed3 | refs/heads/master | 2020-05-17T10:36:45.752385 | 2015-06-13T18:54:26 | 2015-06-13T18:54:26 | 35,336,611 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,284 | java | package br.com.qualiti.DeliveryQualiti.repositorio;
import br.com.qualiti.DeliveryQualiti.classes.Pedido;
public class RepositorioPedidosArray {
private int indice;
private static final int TAMANHO_CACHE = 100;
private Pedido[] pedidos;
public RepositorioPedidosArray() {
pedidos = new Pedido[TAMANHO_CACHE];
indice = 0;
}
private int procurarIndice(int codigo){
int posicao = -1;
for(int i = 0; i < indice; i++){
posicao = i;
break;
}
return posicao;
}
public boolean existe(int codigo){
return procurarIndice(codigo) != -1;
}
public void inserir(Pedido pedido){
pedidos[indice++] = pedido;
}
public Pedido procurar(int codigo){
Pedido retorno = null;
int indice = 0;
if(existe(codigo)){
indice = procurarIndice(codigo);
retorno = pedidos[indice];
}
return retorno;
}
public void atualizar(Pedido pedido){
if(existe(pedido.getCodigo())){
int i = procurarIndice(pedido.getCodigo());
pedidos[i] = pedido;
}
}
public void remover(int codigo){
int i = 0;
if (existe(codigo)){
i = procurarIndice(codigo);
pedidos[i] = pedidos[indice - 1];
pedidos[indice - 1] = null;
indice--;
}
}
public Pedido[] buscarTodosPedido(){
return pedidos;
}
}
| [
"lmc3@cin.ufpe.br"
] | lmc3@cin.ufpe.br |
63692b94d8e369b0d62ea65a65f199e0dc6e7355 | 257bfe6399214dc822b178ce29b3eb4a5629f616 | /src/main/java/com/edu/repositories/UserRepository.java | 730ee2223ee122638ba6e03f546f99bb2acec031 | [] | no_license | nam956287/dbjava | 5f77825fd7a60c506adde214d64a1c2f32b80449 | d5c67885e0f9b18c48f295fce13414db2a2bda84 | refs/heads/main | 2023-06-21T06:41:41.344341 | 2021-08-05T04:09:23 | 2021-08-05T04:09:23 | 392,894,407 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 194 | java | package com.edu.repositories;
import org.springframework.data.repository.CrudRepository;
import com.edu.model.User;
public interface UserRepository extends CrudRepository<User, String> {
}
| [
"TechCare@DESKTOP-MQBT788"
] | TechCare@DESKTOP-MQBT788 |
423e4a062fa3d0398ca56f296c53ef5523297db2 | a53cfea684614cfea220be491f1223ef502203df | /src/main/java/com/example/posassist/entities/Recipe.java | ca80ebe67cd9d0365aaa93bb3073c9e024a87f1b | [] | no_license | neharajesh/POS-Assist | 2dde1c1e7eae7042c805aa5379d0494aa78f900b | 100de7cfb7db90cfb08df9b551067e0401873688 | refs/heads/master | 2023-01-05T07:01:46.120194 | 2020-10-15T22:02:35 | 2020-10-15T22:02:35 | 303,207,406 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 578 | java | package com.example.posassist.entities;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
import java.util.HashSet;
import java.util.Set;
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@Entity
@Table(name = "recipe")
public class Recipe {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String recipeName;
@OneToOne
private Item item;
@OneToMany
private Set<Ingredient> ingredientQuantities = new HashSet<>();
}
| [
"leehanseok3@gmail.com"
] | leehanseok3@gmail.com |
0593609a34c422ca743fe1f0782cd9ce57d6f3d8 | 44857dfdd14651f656526ca0ef451355d336a210 | /src/com/fasterxml/jackson/databind/ser/std/NullSerializer.java | 0937a4f6e7a536c68fb32745fc97daf51d394bdb | [] | no_license | djun100/yueTV | a410ca9255fd5a3f915e8a84c879ad7aeb142719 | 8ca9d1e37ee1eb3dea7cf3fdfcfde7a7e3eae9e0 | refs/heads/master | 2021-01-23T13:56:59.567927 | 2014-03-17T02:02:23 | 2014-03-17T02:02:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,403 | java | package com.fasterxml.jackson.databind.ser.std;
import java.lang.reflect.Type;
import java.io.IOException;
import com.fasterxml.jackson.core.*;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.annotation.JacksonStdImpl;
import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper;
/**
* This is a simple dummy serializer that will just output literal
* JSON null value whenever serialization is requested.
* Used as the default "null serializer" (which is used for serializing
* null object references unless overridden), as well as for some
* more exotic types (java.lang.Void).
*/
@JacksonStdImpl
public class NullSerializer
extends StdSerializer<Object>
{
public final static NullSerializer instance = new NullSerializer();
private NullSerializer() { super(Object.class); }
@Override
public void serialize(Object value, JsonGenerator jgen, SerializerProvider provider)
throws IOException, JsonGenerationException
{
jgen.writeNull();
}
@Override
public JsonNode getSchema(SerializerProvider provider, Type typeHint)
throws JsonMappingException
{
return createSchemaNode("null");
}
@Override
public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint)
{
visitor.expectNullFormat(typeHint);
}
}
| [
"djun100@qq.com"
] | djun100@qq.com |
85195002febe336c377559598e20ca016af78356 | c53c074440f01951e24fec40b24ac9fe02b6a2a9 | /s/o/src/main/java/threadpool/BasicThreadPool.java | ae1ea750f7f9a19e0ec7d475b755d32bca5446ed | [] | no_license | robertfg/Sandbox | c1c0ca73bf4f5e3b4707ca33bd6c22de60c276dd | cd808cf3ccf6f5e51e920ed52363f5e435c6dad1 | refs/heads/master | 2021-04-27T10:59:50.060378 | 2018-02-28T02:50:38 | 2018-02-28T02:50:38 | 122,550,086 | 0 | 0 | null | 2018-02-22T23:56:00 | 2018-02-22T23:56:00 | null | WINDOWS-1252 | Java | false | false | 2,806 | java | package threadpool;
import java.util.LinkedList;
/**
* Very basic implementation of a thread pool.
*
* @author Rob Gordon.
*/
public class BasicThreadPool {
private BlockingQueue queue = new BlockingQueue();
private boolean closed = true;
private int poolSize = 3;
public void setPoolSize(int poolSize) {
this.poolSize = poolSize;
}
public int getPoolSize() {
return poolSize;
}
synchronized public void start() {
if (!closed) {
throw new IllegalStateException("Pool already started.");
}
closed = false;
for (int i = 0; i < poolSize; ++i) {
new PooledThread().start();
}
}
synchronized public void execute(Runnable job) {
if (closed) {
throw new PoolClosedException();
}
queue.enqueue(job);
}
private class PooledThread extends Thread {
public void run() {
while (true) {
Runnable job = (Runnable) queue.dequeue();
if (job == null) {
break;
}
try {
job.run();
} catch (Throwable t) {
// ignore
}
}
}
}
public void close() {
closed = true;
queue.close();
}
private static class PoolClosedException extends RuntimeException {
PoolClosedException() {
super ("Pool closed.");
}
}
}
/*
* Copyright © 2004, Rob Gordon.
*/
/**
*
* @author Rob Gordon.
*/
class BlockingQueue {
private final LinkedList list = new LinkedList();
private boolean closed = false;
private boolean wait = false;
synchronized public void enqueue(Object o) {
if (closed) {
throw new ClosedException();
}
list.add(o);
notify();
}
synchronized public Object dequeue() {
while (!closed && list.size() == 0) {
try {
wait();
}
catch (InterruptedException e) {
// ignore
}
}
if (list.size() == 0) {
return null;
}
return list.removeFirst();
}
synchronized public int size() {
return list.size();
}
synchronized public void close() {
closed = true;
notifyAll();
}
synchronized public void open() {
closed = false;
}
public static class ClosedException extends RuntimeException {
ClosedException() {
super("Queue closed.");
}
}
}
| [
"degs@ubuntu.(none)"
] | degs@ubuntu.(none) |
a8fd06a9eb665f59453234893d63b1d2eb7696ee | 4109f6d1704a03d888153c9dafffe157e2d75807 | /app/src/main/java/com/example/android/tourguideapp/Hotels.java | af023ea556b084acb1ac0be3fc5cd096ee795443 | [] | no_license | Murok2/TourGuideApp | 001b7100417ebad1f20672871a58fca639fc009f | 46f8a4ed0d6034f2c7036e41f9271a48bb374d7f | refs/heads/master | 2023-03-07T21:46:44.030878 | 2021-02-18T15:27:29 | 2021-02-18T15:27:29 | 340,092,518 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,345 | java | package com.example.android.tourguideapp;
import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.fragment.app.Fragment;
import java.util.ArrayList;
public class Hotels extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.word_list, container, false);
final ArrayList<Word> words = new ArrayList<>();
words.add(new Word("Tyan-Shan",
"Services: Bar, Restaurant, Laundry full cycle, Suitable for children \n" +
" Price for 1 day: Econom-1000som, Standart-1500som, Luxury-3000som", "Jalal-Abad, Hotel Tyan-Shan \n" +
"OPEN 24HOUR" , R.drawable.tyan_shan,
"40.927138,-287.004042",
"996772167128" ));
WordAdapter adapter = new WordAdapter(getActivity(), words);
ListView listView = (ListView) rootView.findViewById(R.id.list);
listView.setAdapter(adapter);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Word word = words.get(position);
TextView titleName = view.findViewById(R.id.place_name);
RelativeLayout descriptionLayout= view.findViewById(R.id.expandable);
TextView callText= view.findViewById(R.id.call_textView);
ImageView callImage= view.findViewById(R.id.call_imageView);
if (word.isOpen) {
descriptionLayout.setVisibility(View.GONE);
word.isOpen = false;
}else if (!word.isOpen) {
descriptionLayout.setVisibility(View.VISIBLE);
callText.setVisibility(View.VISIBLE);
callImage.setVisibility(View.VISIBLE);
word.isOpen = true;
}
}
});
return rootView;
}
} | [
"murok.maratbekkyzy@iaau.edu.kg"
] | murok.maratbekkyzy@iaau.edu.kg |
c4b6053d21494000547b190003ffd0932b81d24d | a0180da749d7418e6bbdc74b4209afbf1033d35d | /app/src/main/java/nl/droidcon/conference2014/adapters/ViewConferenceInflater.java | 0beb09fc9be0c5f4607c487b471c64e563832f96 | [
"Apache-2.0"
] | permissive | dvsknt/droidconNL-2014 | a09393407e9d48f72702094c54d55190581a8b99 | 69c9e411ad6bf0515cc7c2e3ca80088bfb93819b | refs/heads/master | 2020-05-18T11:04:24.099659 | 2014-12-02T04:48:36 | 2014-12-02T04:48:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,007 | java | package nl.droidcon.conference2014.adapters;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.squareup.picasso.Picasso;
import java.text.SimpleDateFormat;
import java.util.Date;
import nl.droidcon.conference2014.BaseApplication;
import nl.droidcon.conference2014.R;
import nl.droidcon.conference2014.objects.Conference;
import nl.droidcon.conference2014.utils.WordColor;
/**
* Render a Conference object every time {@link this#getView(
* nl.droidcon.conference2014.objects.Conference, int, android.view.View, android.view.ViewGroup)}
* is called.
*
* @author Arnaud Camus
*/
public class ViewConferenceInflater extends ItemInflater<Conference> {
SimpleDateFormat simpleDateFormat;
public ViewConferenceInflater(Context ctx) {
super(ctx);
simpleDateFormat = new SimpleDateFormat("E, HH:mm");
}
@Override
public View getView(Conference object, int position, View convertView, ViewGroup parent) {
View v = convertView;
ViewHolder holder;
if (v == null) {
v = LayoutInflater.from(mContext).inflate(R.layout.adapter_conference, parent, false);
holder = new ViewHolder();
holder.dateStart = (TextView) v.findViewById(R.id.dateStart);
holder.location = (TextView) v.findViewById(R.id.location);
holder.headline = (TextView) v.findViewById(R.id.headline);
holder.speaker = (TextView) v.findViewById(R.id.speaker);
holder.image = (ImageView) v.findViewById(R.id.image);
holder.favorite = (ImageView) v.findViewById(R.id.favorite);
v.setTag(holder);
} else {
holder = (ViewHolder) v.getTag();
}
holder.dateStart.setText(simpleDateFormat.format(new Date(object.getStartDate())));
holder.location.setText(String.format(mContext.getString(R.string.location),
object.getLocation()));
holder.location.setTextColor(WordColor.generateColor(object.getLocation()));
holder.headline.setText(object.getHeadeline());
holder.speaker.setText(object.getSpeaker());
// picasso
Picasso.with(mContext.getApplicationContext())
.load(object.getSpeakerImageUrl())
.transform(((BaseApplication)mContext.getApplicationContext()).mPicassoTransformation)
.into(holder.image);
holder.favorite.setImageResource(object.isFavorite(mContext)
? R.drawable.ic_favorite_grey600_18dp
: R.drawable.ic_favorite_outline_grey600_18dp);
return v;
}
private class ViewHolder {
TextView dateStart;
TextView location;
TextView headline;
TextView speaker;
ImageView image;
ImageView favorite;
}
}
| [
"camus_b@epitech.eu"
] | camus_b@epitech.eu |
8d5dc39a0626e3c08a4fc90b602b7d42c58121f9 | 9ec0dac1086ac68ec0819f8c268e988f98a2315c | /Lecturer Assignments (מטלות מנחה)/Lecturer Assigment 12 (ממן 12)/Segment2.java | a1d08dce8ad15ea0a239e1f0f78705be81e2fcd7 | [] | no_license | evgenyna/OpenU-IntroToJavaProgramming-20441-2021a | 2880f6a145b966245aeee5b0ca583c1e58abaeed | f16122386433a8ffc78f15704f41ae11b68d90d9 | refs/heads/main | 2023-03-02T03:58:38.942641 | 2021-02-07T10:20:00 | 2021-02-07T10:20:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,521 | java | /**
*
* This class is used to represent a line using a center point and a length.
*
* @author Julian Goncharenko
* @since 28/11/2020
*
*/
public class Segment2 {
private Point _poCenter;
private double _length;
final double DEFAULT_VALUE = 0;
/**
* Constructs a new segment using 4 specified x y coordinates:
* two coordinates for the left point and two coordinates for the right point.
* If the y coordinates are different,
* change the y of the right point to be equal to the y of the left point.
*
* @param leftX - X value of left point
* @param leftY - Y value of left point
* @param rightX - X value of right point
* @param rightY - Y value of right point
*/
public Segment2(double leftX, double leftY, double rightX, double rightY) {
if(leftX < DEFAULT_VALUE)
leftX = DEFAULT_VALUE;
if(leftY < DEFAULT_VALUE)
leftY = DEFAULT_VALUE;
if(rightX < DEFAULT_VALUE)
rightX = DEFAULT_VALUE;
if(rightY < DEFAULT_VALUE)
rightY = DEFAULT_VALUE;
if (leftY != rightY) {
rightY = leftY;
}
double x = (leftX + rightX) / 2;
_length = rightX - leftX;
_poCenter = new Point(x, rightY);
}
/**
* Constructs a new segment using a center point and the segment length.
*
* @param poCenter - the Center Point
* @param length - the segment length
*/
public Segment2(Point poCenter, double length) {
_poCenter = new Point(poCenter);
_length = length;
}
/**
* Constructs a new segment using two Points.
* If the y coordinates are different,
* change the y of the right point to be equal to the y of the left point.
*
* @param left - The left point of the segment
* @param right - The right point of the segment
*/
public Segment2(Point left, Point right) {
double x, y;
if (left.getY() != right.getY()) {
y = left.getY();
right.setY(y);
}
x = (right.getX() + left.getX()) / 2;
_length = right.getX() - left.getX();
_poCenter = new Point(x, right.getY());
}
/**
* Copy Constructor. Construct a segment using a reference segment.
*
* @param other - the reference segment
*/
public Segment2(Segment2 other) {
_poCenter = new Point(other._poCenter);
_length = other._length;
}
/**
* Change the segment size by moving the right point by delta.
* Will be implemented only for a valid delta: only if the new right point remains the right point.
*
* @param delta - The length change
*/
public void changeSize(double delta) {
double tempLength = getLength();
_poCenter.setX(delta / 2);
_length = _length + delta;
if (!getPoRight().isRight(getPoLeft()) && _length < DEFAULT_VALUE) {
_length = tempLength;
}
}
/**
* Check if the reference segment is equal to this segment.
*
* @param other - the reference segment
* @return True if the reference segment is equal to this segment
*/
public boolean equals(Segment2 other) {
return other._poCenter.equals(_poCenter) && other._length == _length;
}
/**
* Returns the segment length
*
* @return The segment length
*/
public double getLength() {
return _length;
}
/**
* Returns the left point of the segment.
*
* @return The left point of the segment
*/
public Point getPoLeft() {
double x, y;
x = _poCenter.getX() - (_length / 2);
y = _poCenter.getY();
return new Point(x, y);
}
/**
* Returns the right point of the segment.
*
* @return The right point of the segment
*/
public Point getPoRight() {
double x, y;
x = _poCenter.getX() + (_length / 2);
y = _poCenter.getY();
return new Point(x, y);
}
/**
* Check if this segment is above a reference segment.
*
* @param other- the reference segment
* @return True if this segment is above the reference segment
*/
public boolean isAbove(Segment2 other) {
return _poCenter.isAbove(other._poCenter);
}
/**
* Check if this segment is bigger than a reference segment.
*
* @param other - the reference segment
* @return True if this segment is bigger than the reference segment
*/
public boolean isBigger(Segment2 other) {
return getLength() > other.getLength();
}
/**
* Check if this segment is left of a received segment.
*
* @param other - the reference segment
* @return True if this segment is left to the reference segment
*/
public boolean isLeft(Segment2 other) {
return _poCenter.isLeft(other._poCenter);
}
/**
* Check if this segment is right of a received segment.
*
* @param other - the reference segment
* @return True if this segment is right to the reference segment
*/
public boolean isRight(Segment2 other) {
return getPoRight().isRight(other.getPoRight());
}
/**
* Check if this segment is under of a received segment.
*
* @param other - the reference segment
* @return True if this segment is under to the reference segment
*/
public boolean isUnder(Segment2 other) {
return _poCenter.isUnder(other.getPoLeft());
}
/**
* Move the segment horizontally by delta.
*
* @param delta - the displacement size
*/
public void moveHorizontal(double delta) {
_poCenter.move(delta, DEFAULT_VALUE);
}
/**
* Move the segment vertically by delta.
*
* @param delta - the displacement size
*/
public void moveVertical(double delta) {
_poCenter.move(DEFAULT_VALUE, delta);
}
/**
* Returns the overlap size of this segment and a reference segment.
*
* @param other - the reference segment
* @return The overlap size
*/
public double overlap(Segment2 other) {
if(getPoLeft().getX() <= other.getPoLeft().getX()) {
if(getPoRight().getX() <= other.getPoRight().getX() && getPoRight().getX() >= other.getPoLeft().getX()) {
return getPoRight().getX() - other.getPoLeft().getX();
}
if(getPoRight().getX() >= other.getPoRight().getX()) {
return other.getLength();
}
} else {
if(getPoRight().getX() <= other.getPoRight().getX()) {
return getLength();
}
if(getPoRight().getX() >= other.getPoRight().getX() && getPoLeft().getX() <= other.getPoRight().getX()) {
return other.getPoRight().getX() - getPoLeft().getX();
}
}
return DEFAULT_VALUE;
}
/**
* Check if a point is located on the segment.
*
* @param p - a point to be checked
* @return True if p is on this segment
*/
public boolean pointOnSegment(Point p) {
return p.isRight(getPoLeft()) && p.isLeft(getPoRight());
}
/**
* Return a string representation of this segment in the format (3.0,4.0)---(3.0,6.0).
*
* @overrides toString in class java.lang.Object
* @return String representation of this segment
*/
@Override
public String toString() {
Point left = getPoLeft();
Point right = getPoRight();
double leftX = left.getX();
double leftY = left.getY();
double rightX = right.getX();
double rightY = right.getY();
return "(" + leftX + "," + leftY + ")---(" + rightX + "," + rightY + ")";
}
/**
* Compute the trapeze perimeter,
* which is constructed by this segment and a reference segment.
*
* @param other - the reference segment
* @return The trapeze perimeter
*/
public double trapezePerimeter(Segment2 other) {
double a, b, c, d;
a = getLength();
b = other.getLength();
c = getPoLeft().distance(other.getPoLeft());
d = getPoRight().distance(other.getPoRight());
return a + b + c + d;
}
}
| [
"julianmotorbreathe@gmail.com"
] | julianmotorbreathe@gmail.com |
77f42297865041495c15d1653766884cf8f86f0e | 0ca50bde7ef8f4f99c788c0dfce89af992424b9e | /TAGA/PersistanceBD/src/androidTest/java/com/societe/persistancebd/ExampleInstrumentedTest.java | fc4df8e2fe41aff307abc22328936e151958a4b7 | [] | no_license | CamilleTh/androidFormation | e90b4e0a47cec2928726704f84f277eea6791ae9 | ffb6af467fa11698974daf2f2781f1d0e2780abc | refs/heads/master | 2020-03-31T21:02:18.786663 | 2019-01-10T16:48:25 | 2019-01-10T16:48:25 | 152,564,802 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 754 | java | package com.societe.persistancebd;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.societe.persistancebd", appContext.getPackageName());
}
}
| [
"thomassin.camille@gmail.com"
] | thomassin.camille@gmail.com |
6a0ffc0c32e7e276f5acb0617b2e4ec0c6fb3dda | a8bbb7b5300b9698617c3f2b5dacd343f2e4e9db | /DesignPatterns/src/state/DataConnectionState.java | 5bf2656d0a66942ac817e31f1b8e902903553a41 | [] | no_license | jarretsaf/SELab | f8d42d4b3f62ebb33ce271c0f5e7f4c114a38127 | 890367d2f7dca10930f958bf0b5a128891262a9c | refs/heads/master | 2020-04-15T09:46:00.511960 | 2019-04-08T12:25:42 | 2019-04-08T12:25:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 86 | java | package state;
public interface DataConnectionState {
public void info();
}
| [
"jarret@unigoa.ac.in"
] | jarret@unigoa.ac.in |
f153627d7f5f37f1e484f0c0b4d77ed4a5692943 | 17d36f0b5e366c26fa8098825ba11b8d667f7fb0 | /src/com/malware/mail/ReportSender.java | 123ee430ec0820b0e8d3ca50da04026c26afcbe0 | [] | no_license | julien-medori/INF358-AndroidMalwareProject | 36d38ad8326f26695109eb0ef492b374084e604d | 41b968de99f4ec89eecaab593b893f5a32ae3dbe | refs/heads/master | 2020-05-17T20:24:48.900646 | 2014-05-01T10:05:57 | 2014-05-01T10:05:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,228 | java | /***********************************************************************
* This file is part of INF358-AndroidMalwareProject
*
* Copyright (c) 2012 GPL Project Developer
*
* INF358-AndroidMalwareProject is free software: you may copy, redistribute
* and/or modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of the
* License, or (at your option) any later version.
*
* This file 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/>.
*
* authors: Issa CAMARA, Wajih JMAIEL, Julien MEDORI, Hakim WADIL
***********************************************************************/
package com.malware.mail;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Timer;
import java.util.TimerTask;
import com.malware.service.MyService;
public class ReportSender {
private MyService service;
private long frequency;
public ReportSender(MyService service, long frequency) {
this.service = service;
this.frequency = frequency;
}
public void runTask() {
Timer timer = new Timer();
timer.schedule(new Task(service), 10000, frequency);
}
}
class Task extends TimerTask {
private MyService service;
public Task(MyService service) {
this.service = service;
}
@Override
public void run() {
String report = readFile("tmp");
// Create an email and send it to recipients
service.sendMail("Reporting", report);
service.deleteFile("tmp");
}
private String readFile(String fileName){
StringBuffer report = new StringBuffer();
try {
FileInputStream fis = service.openFileInput(fileName);
int value;
while ((value = fis.read()) != -1)
report.append((char) value);
fis.close();
} catch (IOException e) {
e.printStackTrace();
}
return report.toString();
}
} | [
"julien@medori.rezel.enst.fr"
] | julien@medori.rezel.enst.fr |
d70d7c32d072d5e5a6c408e26e49e7a52ba20e6e | 9174610314ea3d849d4a124835555a21068f22d3 | /src/algorithmization/program/Task7.java | ff4900265a48081d1744bd3a1c146b505ab4899b | [] | no_license | denis-tumel/baseKnowledge | 22f5a9676593a26c415d563e0c2055d46b85cc7b | f50f5357ca3c358851eae2229c824ea2497c5407 | refs/heads/master | 2020-09-01T12:50:11.048557 | 2019-11-01T10:17:56 | 2019-11-01T10:17:56 | 218,961,477 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 357 | java | package algorithmization.program;
public class Task7 {
public static void main(String[] args) {
int sum = 0;
for (int i = 1; i < 10; i += 2){
sum += fact(i);
}
System.out.println(sum);
}
private static int fact(int i){
if (i == 1)
return i;
return i * fact(--i);
}
}
| [
"denis.tumel.98@mail.ru"
] | denis.tumel.98@mail.ru |
75dd1209189316c9eebe98ea6f75e7805ba64d31 | f6f96cbe72228dec5ca4b44f7b32dfb4db5679a2 | /src/main/java/com/wj/nongtian/controller/NotifyController.java | ae3a32ba814fadcf8ea6ec3fdd614e720affc76e | [] | no_license | wj2479/NongTianServer | 166cf5ec1f92554a18c5c071c9fadf7b5885af54 | e314ff94e9ff2fc5d2d766428d1923b13bfe44ee | refs/heads/master | 2022-06-25T11:41:22.400703 | 2020-08-18T15:26:27 | 2020-08-18T15:26:27 | 239,090,278 | 0 | 0 | null | 2022-06-17T02:52:27 | 2020-02-08T07:59:22 | TSQL | UTF-8 | Java | false | false | 3,321 | java | package com.wj.nongtian.controller;
import com.alibaba.druid.util.StringUtils;
import com.wj.nongtian.ResultCode;
import com.wj.nongtian.entity.Notify;
import com.wj.nongtian.entity.NotifyReceiver;
import com.wj.nongtian.service.NotifyService;
import com.wj.nongtian.service.UserService;
import com.wj.nongtian.utils.JsonUtils;
import org.apache.log4j.Logger;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 通知相关请求
*/
@RestController
@RequestMapping("/notify")
public class NotifyController {
private Logger logger = Logger.getLogger(getClass());
private final NotifyService notifyService;
private final UserService userService;
public NotifyController(NotifyService notifyService, UserService userService) {
this.notifyService = notifyService;
this.userService = userService;
}
@RequestMapping(value = "/getPublishNotify", method = RequestMethod.GET)
public String getPublishNotify(Integer uid) {
if (uid == null || !userService.isUserExist(uid)) {
return JsonUtils.getJsonResult(ResultCode.RESULT_PARAMS_ERROR);
}
List<Notify> notifyList = notifyService.getPublishNotify(uid);
if (notifyList != null) {
return JsonUtils.getJsonResult(ResultCode.RESULT_OK, notifyList);
} else {
return JsonUtils.getJsonResult(ResultCode.RESULT_FAILED);
}
}
@RequestMapping(value = "/publish", method = RequestMethod.GET)
public String publish(Notify notify) {
if (StringUtils.isEmpty(notify.getContent()) || !userService.isUserExist(notify.getUid())) {
return JsonUtils.getJsonResult(ResultCode.RESULT_PARAMS_ERROR);
}
boolean isSuccess = notifyService.publishNotify(notify);
if (isSuccess) {
return JsonUtils.getJsonResult(ResultCode.RESULT_OK, "发布成功");
} else {
return JsonUtils.getJsonResult(ResultCode.RESULT_FAILED, "发布失败");
}
}
@RequestMapping(value = "/getReceivedNotify", method = RequestMethod.GET)
public String getReceivedNotify(Integer uid) {
if (uid == null || !userService.isUserExist(uid)) {
return JsonUtils.getJsonResult(ResultCode.RESULT_PARAMS_ERROR);
}
List<NotifyReceiver> notifyList = notifyService.getReceivedNotify(uid);
if (notifyList != null) {
return JsonUtils.getJsonResult(ResultCode.RESULT_OK, notifyList);
} else {
return JsonUtils.getJsonResult(ResultCode.RESULT_FAILED);
}
}
@RequestMapping(value = "/setNotifyRead", method = RequestMethod.GET)
public String setNotifyRead(Integer uid, Integer nid) {
if (uid == null || !userService.isUserExist(uid) || nid == null) {
return JsonUtils.getJsonResult(ResultCode.RESULT_PARAMS_ERROR);
}
boolean isSuccess = notifyService.setNotifyRead(uid, nid);
if (isSuccess) {
return JsonUtils.getJsonResult(ResultCode.RESULT_OK, "设置成功");
} else {
return JsonUtils.getJsonResult(ResultCode.RESULT_FAILED, "设置失败");
}
}
}
| [
"289415600@qq.com"
] | 289415600@qq.com |
655b40906be9ada14b1a3d93b76922cb54f67bb3 | 17a0a233c1f7ba72423edadf54473b987468e428 | /AulasOpetPOO/Java_BANCOdeDados/src/Principal.java | 69942beb6578c2e7e0b8eb51f3786cce7b6f216e | [] | no_license | LindomarB/JAVA_Lee | ac8cc7051ad66b281d154ea6275386d26dc09e73 | 8ce0a6580f7cba0c5f2aa1469dc350e7ec51fde3 | refs/heads/master | 2021-12-31T07:55:39.288808 | 2020-08-15T13:42:25 | 2020-08-15T13:42:25 | 234,209,198 | 0 | 0 | null | null | null | null | MacCentralEurope | Java | false | false | 1,914 | java | import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
public class Principal {
public static void main(String[] args) {
String url = "jdbc:oracle:thin:@localhost:1521: XE";
String usuario = "aluno";
String senha = "aluno";
Connection conexao = null;
String consulta = null;
PreparedStatement pst= null;
ResultSet resultado= null;
/// conexao
try {
conexao = DriverManager.getConnection(url,usuario,senha);
System.out.println("conectado!!");
//select
consulta = "select * from cadastro_pessoa";
pst = conexao.prepareStatement(consulta);
resultado = pst.executeQuery();
// MOSTRA NA TELA
while(resultado.next()) {
System.out.println(resultado.getString("PESSOA_ID")+" "+resultado.getString("PESSOA_NOME"));
}
// INSERIR UM REGISTRO NO BANCO
consulta = "INSERT INTO CADASTRO_PESSOA (PESSOA_ID, PESSOA_NOME, PESSOA_DOB, PESSOA_SEXO) VALUES( PESSOA_SEQUENCE.NEXTVAL, 'PIA DE PREDIO', '4/12/1986', 'M')";
pst = conexao.prepareStatement(consulta);
pst.executeUpdate();
conexao.commit();
//inserir no banco metodo 2
consulta = "INSERT INTO CADASTRO_PESSOA (PESSOA_ID, PESSOA_NOME, PESSOA_DOB, PESSOA_SEXO) VALUES( PESSOA_SEQUENCE.NEXTVAL, ?, ?, ?)";
pst = conexao.prepareStatement(consulta);
pst.setString(1, "jose das cova silva");
pst.setString(2, "12/12/1222");
pst.setString(3, "M");
pst.executeUpdate();
conexao.commit();
} catch (SQLException e) {
System.out.println("erro ao conectar "+e );
}finally {
try {
resultado.close();
pst.close();
conexao.close();
System.out.println("fechou a conex„o");
} catch (SQLException e) {
System.out.println("erro ao fechar "+e);
}
}
}
}
| [
"Lindomar1802@gmail.com"
] | Lindomar1802@gmail.com |
5ae8436599ae765bf96d8b06f32e35fa6e68b047 | 156d4a4972b4166fead127d0b724452f58413bb1 | /src/main/java/pl/coderslab/app/WebConfig.java | 216c0b98558fb422a909ff00ffdb0ee87589fa65 | [] | no_license | aleksandra-marszalek/Workshop_4 | 15474032e8fded3e6554e9808d99713496223692 | 95d7cb8a2f4fd20182122aa7d4f5da6e03a7fd15 | refs/heads/master | 2020-03-13T21:41:41.816840 | 2018-04-30T16:36:24 | 2018-04-30T16:36:24 | 131,301,802 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 603 | java | package pl.coderslab.app;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
@Configuration
@EnableWebMvc
public class WebConfig extends WebMvcConfigurerAdapter {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/books/**") .allowedMethods("GET", "POST", "PUT", "DELETE") .allowedOrigins("http://localhost");
}
} | [
"aaleksandra.mmarszalek@gmail.com"
] | aaleksandra.mmarszalek@gmail.com |
d236f985d53a9b9bca0744504c00e085a29490be | c2d8181a8e634979da48dc934b773788f09ffafb | /storyteller/output/startbahn/SetSelectionOfArtistThreadArtistAction.java | 493c4f580b0d611c7bc8ab93e309976753efdcf4 | [] | no_license | toukubo/storyteller | ccb8281cdc17b87758e2607252d2d3c877ffe40c | 6128b8d275efbf18fd26d617c8503a6e922c602d | refs/heads/master | 2021-05-03T16:30:14.533638 | 2016-04-20T12:52:46 | 2016-04-20T12:52:46 | 9,352,300 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,529 | java | package net.startbahn.web;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.startbahn.model.*;
import net.startbahn.model.crud.*;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.Restrictions;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.web.context.support.WebApplicationContextUtils;
import net.enclosing.util.HibernateSession;
public class SetSelectionOfArtistThreadArtistAction extends Action{
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest req,
HttpServletResponse res) throws Exception{
Session session = new HibernateSession().currentSession(this
.getServlet().getServletContext());
for (int I = 0; I < req.getParameterValues("id").length; i++) {
Criteria criteria2 = session.createCriteria(ArtistThread.class);
criteria2.add(Restrictions.idEq(Integer.valueOf(req.getParameterValues("id")[i])));
ArtistThread artistThread = (ArtistThread)criteria2.uniqueResult();
artistThread.setartist(true);
session.save(artistThread);
}
transaction.commit();
session.flush();
return mapping.findForward("success");
}
} | [
"toukubo@gmail.com"
] | toukubo@gmail.com |
4a9ab76a9c0aa2946414312803dd6da7d0e86c62 | 0e8c83e6b3de422f5031f3250e288727bf4b3036 | /src/java/service/ApplicationConfig.java | d71f49735aad3b6ff73a4e49602a75981a37611c | [] | no_license | vophihungvn/photo_social_network | 08f51a45da65dd8f45eb7ffd7e01f2031c7de41b | e5df03f0f9d8a1886f44d01e3529bb09b61095a4 | refs/heads/master | 2021-01-09T22:38:21.468349 | 2017-05-29T11:59:34 | 2017-05-29T11:59:34 | 92,735,039 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 991 | 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 service;
import java.util.Set;
import javax.ws.rs.core.Application;
/**
*
* @author Hung-PC
*/
@javax.ws.rs.ApplicationPath("api")
public class ApplicationConfig extends Application {
@Override
public Set<Class<?>> getClasses() {
Set<Class<?>> resources = new java.util.HashSet<Class<?>>();
addRestResourceClasses(resources);
return resources;
}
/**
* Do not modify addRestResourceClasses() method.
* It is automatically populated with
* all resources defined in the project.
* If required, comment out calling this method in getClasses().
*/
private void addRestResourceClasses(Set<Class<?>> resources) {
resources.add(api.UserFacadeREST.class);
resources.add(service.ImageFacadeREST.class);
}
}
| [
"vphungkhtn@gmail.com"
] | vphungkhtn@gmail.com |
015c833e9e9ec2b80e54e52b45bf9a9ff985cbe5 | 968531d88c43f71b2fca69d01fd219fef0bcb289 | /src/refactor/Day31/Day_28_RenameBooleanMethod.java | c3d8ab7d4051203893f892cb80fef659b5d2d54a | [] | no_license | wushj/MyCodeLearning | bd7b51bed71d7b8eb8af1208d775d08c543de367 | 8683523dcd55100e59c26c1b2a468ee09006d70a | refs/heads/master | 2020-12-02T06:41:46.526648 | 2017-09-21T05:20:30 | 2017-09-21T05:20:30 | 96,881,964 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 982 | java | package refactor.Day31;
/**
* Created by WU on 2017/7/3.
* 如果一个方法带有大量的bool 参数时,可以根据bool 参数的数量,提取出若干个独立的方法来简化参数。
*/
public class Day_28_RenameBooleanMethod {
/*---------------------------before--------------------------*/
public class BankAccount {
public void createAccount(Object customer, boolean withChecking, boolean withSavings) {
// do work
}
}
/*---------------------------after---------------------------*/
public class BankAccount2 {
public void createAccountWithChecking(Object customer) {
createAccount(customer, true, false);
}
public void CreateAccountWithCheckingAndSavings(Object customer) {
createAccount(customer, true, true);
}
private void createAccount(Object customer, boolean withChecking, boolean withSavings) {
// do work
}
}
}
| [
"wusjcoding@foxmail.com"
] | wusjcoding@foxmail.com |
5502c9b2f8a56d632f63df88d88222c94ab6fbc8 | a6ff7a994ecfe54642752d9bc4d780c42eafce59 | /unit/src/main/java/com/erayic/agr/unit/adapter/entity/UnitListItemByEnvironmentEntity.java | 6d942584b71932f754530fd9ee195095f9463466 | [] | no_license | chenxizhe/monster | efdebc446c85f3b73258a669d67957ce512af76b | 43314e29111065b1bf77fa74a864bec7818349ef | refs/heads/master | 2023-05-06T12:48:51.978300 | 2017-07-27T02:05:37 | 2017-07-27T02:05:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,446 | java | package com.erayic.agr.unit.adapter.entity;
import com.chad.library.adapter.base.entity.MultiItemEntity;
import java.util.Map;
/**
* 作者:hejian
* 邮箱:hkceey@outlook.com
* 注解:
*/
public class UnitListItemByEnvironmentEntity implements MultiItemEntity {
public static final int TYPE_AIR_TEM = 0;//空气温度
public static final int TYPE_AIR_HUM = 1;//空气湿度
public static final int TYPE_SOIL_TEM = 2;//土壤温度
public static final int TYPE_SOIL_HUM = 3;//土壤湿度
public static final int TYPE_WATER = 4;//降水量
public static final int TYPE_ILL = 5;//光照强度
public static final int TYPE_WIND = 6;//风力
public static final int TYPE_CO2 = 7;//二氧化碳
private String name;
private String subName;
private Map<String,String> map;
private int itemType;
@Override
public int getItemType() {
return itemType;
}
public void setItemType(int itemType) {
this.itemType = itemType;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSubName() {
return subName;
}
public void setSubName(String subName) {
this.subName = subName;
}
public Map<String, String> getMap() {
return map;
}
public void setMap(Map<String, String> map) {
this.map = map;
}
}
| [
"hkceey@outlook.com"
] | hkceey@outlook.com |
77af3944a640dd60d5bb04e94271c2d5ba27024d | b481557b5d0e85a057195d8e2ed85555aaf6b4e7 | /src/main/java/com/jlee/leetcodesolutions/LeetCode1089.java | fa1241349a70dc18023d6bfe33d71aebd727ed7c | [] | no_license | jlee301/leetcodesolutions | b9c61d7fbe96bcb138a2727b69b3a39bbe153911 | 788ac8c1c95eb78eda27b21ecb7b29eea1c7b5a4 | refs/heads/master | 2021-06-05T12:27:42.795124 | 2019-08-11T23:04:07 | 2019-08-11T23:04:07 | 113,272,040 | 0 | 1 | null | 2020-10-12T23:39:27 | 2017-12-06T05:16:39 | Java | UTF-8 | Java | false | false | 425 | java | package com.jlee.leetcodesolutions;
public class LeetCode1089 {
/*
* https://leetcode.com/problems/duplicate-zeros/
*/
public void duplicateZeros(int[] arr) {
// [1,0,2,3,0,4,5,0]
for(int i = 0; i < arr.length; i++) {
if(arr[i] == 0) {
int j = arr.length-1;
while(j > i+1) {
arr[j] = arr[j-1];
j--;
}
arr[j] = 0;
i = j;
}
}
}
}
| [
"john.m.lee@gmail.com"
] | john.m.lee@gmail.com |
b53656f618989eb22a4ed50d8201224c764548cd | a40d7ed9afbaac90c546022d5baa211901e9ac02 | /services/salesdb/src/com/salesdb/service/ChannelsServiceImpl.java | ce8bc58522a29dcfd8b8108f26854e2ad48af850 | [] | no_license | Sushma-M/repo00922333333 | 9ef747fc9d8326be51b4100f33d58855529e2fae | 80d56ff1e9727c8ceef2a6b235d451b8f5ff6c48 | refs/heads/master | 2021-05-05T19:04:42.149275 | 2018-01-16T11:42:32 | 2018-01-16T11:42:32 | 117,676,525 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,366 | java | /*Copyright (c) 2015-2016 wavemaker-com All Rights Reserved.This software is the confidential and proprietary information of wavemaker-com You shall not disclose such Confidential Information and shall use it only in accordance with the terms of the source code license agreement you entered into with wavemaker-com*/
package com.salesdb.service;
/*This is a Studio Managed File. DO NOT EDIT THIS FILE. Your changes may be reverted by Studio.*/
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Lazy;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import com.wavemaker.runtime.data.dao.WMGenericDao;
import com.wavemaker.runtime.data.exception.EntityNotFoundException;
import com.wavemaker.runtime.data.export.ExportType;
import com.wavemaker.runtime.data.expression.QueryFilter;
import com.wavemaker.runtime.data.model.AggregationInfo;
import com.wavemaker.runtime.file.model.Downloadable;
import com.salesdb.Channels;
import com.salesdb.Reps;
/**
* ServiceImpl object for domain model class Channels.
*
* @see Channels
*/
@Service("salesdb.ChannelsService")
@Validated
public class ChannelsServiceImpl implements ChannelsService {
private static final Logger LOGGER = LoggerFactory.getLogger(ChannelsServiceImpl.class);
@Lazy
@Autowired
@Qualifier("salesdb.RepsService")
private RepsService repsService;
@Autowired
@Qualifier("salesdb.ChannelsDao")
private WMGenericDao<Channels, Integer> wmGenericDao;
public void setWMGenericDao(WMGenericDao<Channels, Integer> wmGenericDao) {
this.wmGenericDao = wmGenericDao;
}
@Transactional(value = "salesdbTransactionManager")
@Override
public Channels create(Channels channels) {
LOGGER.debug("Creating a new Channels with information: {}", channels);
List<Reps> repses = channels.getRepses();
Channels channelsCreated = this.wmGenericDao.create(channels);
if(repses != null) {
for(Reps _reps : repses) {
_reps.setChannels(channelsCreated);
LOGGER.debug("Creating a new child Reps with information: {}", _reps);
repsService.create(_reps);
}
}
return channelsCreated;
}
@Transactional(readOnly = true, value = "salesdbTransactionManager")
@Override
public Channels getById(Integer channelsId) throws EntityNotFoundException {
LOGGER.debug("Finding Channels by id: {}", channelsId);
Channels channels = this.wmGenericDao.findById(channelsId);
if (channels == null){
LOGGER.debug("No Channels found with id: {}", channelsId);
throw new EntityNotFoundException(String.valueOf(channelsId));
}
return channels;
}
@Transactional(readOnly = true, value = "salesdbTransactionManager")
@Override
public Channels findById(Integer channelsId) {
LOGGER.debug("Finding Channels by id: {}", channelsId);
return this.wmGenericDao.findById(channelsId);
}
@Transactional(rollbackFor = EntityNotFoundException.class, value = "salesdbTransactionManager")
@Override
public Channels update(Channels channels) throws EntityNotFoundException {
LOGGER.debug("Updating Channels with information: {}", channels);
this.wmGenericDao.update(channels);
Integer channelsId = channels.getId();
return this.wmGenericDao.findById(channelsId);
}
@Transactional(value = "salesdbTransactionManager")
@Override
public Channels delete(Integer channelsId) throws EntityNotFoundException {
LOGGER.debug("Deleting Channels with id: {}", channelsId);
Channels deleted = this.wmGenericDao.findById(channelsId);
if (deleted == null) {
LOGGER.debug("No Channels found with id: {}", channelsId);
throw new EntityNotFoundException(String.valueOf(channelsId));
}
this.wmGenericDao.delete(deleted);
return deleted;
}
@Transactional(readOnly = true, value = "salesdbTransactionManager")
@Override
public Page<Channels> findAll(QueryFilter[] queryFilters, Pageable pageable) {
LOGGER.debug("Finding all Channels");
return this.wmGenericDao.search(queryFilters, pageable);
}
@Transactional(readOnly = true, value = "salesdbTransactionManager")
@Override
public Page<Channels> findAll(String query, Pageable pageable) {
LOGGER.debug("Finding all Channels");
return this.wmGenericDao.searchByQuery(query, pageable);
}
@Transactional(readOnly = true, value = "salesdbTransactionManager")
@Override
public Downloadable export(ExportType exportType, String query, Pageable pageable) {
LOGGER.debug("exporting data in the service salesdb for table Channels to {} format", exportType);
return this.wmGenericDao.export(exportType, query, pageable);
}
@Transactional(readOnly = true, value = "salesdbTransactionManager")
@Override
public long count(String query) {
return this.wmGenericDao.count(query);
}
@Transactional(readOnly = true, value = "salesdbTransactionManager")
@Override
public Page<Map<String, Object>> getAggregatedValues(AggregationInfo aggregationInfo, Pageable pageable) {
return this.wmGenericDao.getAggregatedValues(aggregationInfo, pageable);
}
@Transactional(readOnly = true, value = "salesdbTransactionManager")
@Override
public Page<Reps> findAssociatedRepses(Integer id, Pageable pageable) {
LOGGER.debug("Fetching all associated repses");
StringBuilder queryBuilder = new StringBuilder();
queryBuilder.append("channels.id = '" + id + "'");
return repsService.findAll(queryBuilder.toString(), pageable);
}
/**
* This setter method should only be used by unit tests
*
* @param service RepsService instance
*/
protected void setRepsService(RepsService service) {
this.repsService = service;
}
}
| [
"sushma.maddirala@imaginea.com"
] | sushma.maddirala@imaginea.com |
0fc020d516492f88dffdabe421fec09db4e9b234 | e0ce8cb64702eccce7f6940d283bc93e8f632745 | /tags/1.1/src/org/jajim/interfaz/listeners/AceptarContactoActionListener.java | 77305c9c9b6e1f15c8c868ed3b9608fde76794e7 | [] | no_license | BackupTheBerlios/jajim-svn | 5842b35027d995358e605fbd2c5b61dc2b6f7e80 | 7fa2082094decb25e7765aaaebd611c418676f07 | refs/heads/master | 2021-01-01T17:56:36.627562 | 2013-12-06T20:16:30 | 2013-12-06T20:16:30 | 40,748,648 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,012 | java | /*
Jabber client.
Copyright (C) 2010 Florencio Cañizal Calles
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.jajim.interfaz.listeners;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.List;
import org.jajim.controladores.ContactosControlador;
import org.jajim.excepciones.ImposibleAñadirContactoException;
import org.jajim.interfaz.dialogos.AceptarContactoFormulario;
import org.jajim.interfaz.dialogos.MensajeError;
/**
* @author Florencio Cañizal Calles
* @version 1.1
* Clase oyente que se ejecuta cuando se selecciona la opción aceptar del cuadro
* de diálogo de aceptar contacto. Utiliza los controladores para dar de alta al
* contacto.
*/
public class AceptarContactoActionListener implements ActionListener{
private AceptarContactoFormulario acf;
/**
* Constructor de la clase. Inicializa las variables necesarias.
* @param ctc Controlador de los contactos.
*/
public AceptarContactoActionListener(AceptarContactoFormulario acf){
this.acf = acf;
}
/**
* Método que se ejecuta cuando se selecciona la opción aceptar del cuadro de
* diálogo de aceptar contacto. Utiliza los controladores para dar de alta al
* contacto.
* @param e Evento que produce la ejecución del método.
*/
@Override
public void actionPerformed(ActionEvent e){
// Conseguir la información introducida por el usuario y el contacto que
// se va añadir
List<String> campos = acf.getCampos();
String contacto = campos.get(0);
String alias = campos.get(1);
String grupo = campos.get(2);
// Comprabar si los campos introducidos son correctos.
if(contacto.compareTo("") == 0 || alias.compareTo("") == 0){
new MensajeError(acf,"campos_invalidos_error",MensajeError.WARNING);
}
// Llamar al controlador de contactos para que realice las operaciones ne
// cesarias.
try{
ContactosControlador ctc = ContactosControlador.getInstancia();
ctc.aceptarContacto(contacto,alias,grupo);
// Cerrar el cuadro de diálogo
acf.dispose();
}catch(ImposibleAñadirContactoException iace){
new MensajeError(acf,"imposible_añadir_contacto_error",MensajeError.ERR);
acf.dispose();
}
}
}
| [
"npi83@66271abf-8d89-0410-bfa2-80b8d0f357ea"
] | npi83@66271abf-8d89-0410-bfa2-80b8d0f357ea |
ea1454b3639ae1da755bd9e382117ddcae65a164 | a67b443bab042c3ca69b42932b25c5279ae7c679 | /app/src/main/java/cn/njthl/cleaner/ui/view/IOrderNoConfirmAtView.java | e6e5c63bbd4aad49264d42ed58c94364eb9f0008 | [] | no_license | chenzongguo/Cleaner | fad32fab48bb4d014f8eb9f6e6c4dcf69e7c0e6f | 0672efee721206ece1ba8a1989adb7296cc2972d | refs/heads/master | 2020-08-08T18:59:46.797013 | 2019-11-04T00:32:08 | 2019-11-04T00:32:08 | 213,894,543 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 211 | java | package cn.njthl.cleaner.ui.view;
import android.widget.ImageView;
import android.widget.ListView;
public interface IOrderNoConfirmAtView {
ListView getLvOrderNoConfirm();
ImageView getImaNoOrder();
}
| [
"1196437229@qq.com"
] | 1196437229@qq.com |
940c7b9e75fabfddd59a98da6229ad7147a352a9 | 988a2b0113eceb5602d89fad3ab6e2af7967703d | /src/main/java/de/ts/hackerrang/arraymanipulation/SlopeTrackingStrategy.java | a7aaadfd08c202217be196aadb34de760c605266 | [
"Apache-2.0"
] | permissive | MuesLee/Hackerrang | a154168e93c04e6f916fb16f28b4aba5d8bbd77b | 625a585d8893188234cb299a2b29943c699c41f2 | refs/heads/master | 2022-12-10T10:09:27.908856 | 2020-08-19T13:08:57 | 2020-08-19T13:08:57 | 284,924,126 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 842 | java | package de.ts.hackerrang.arraymanipulation;
public class SlopeTrackingStrategy implements ArrayManipulationStrategy {
@Override
public long computeMaxSum(int n, int[][] queries) {
long[] slopeStorage = new long[n];
for (int[] slopeRange : queries) {
int rangeStart = slopeRange[0] - 1;
int rangeEnd = slopeRange[1] - 1;
int slope = slopeRange[2];
slopeStorage[rangeStart] += slope;
if (rangeEnd + 1 < slopeStorage.length) {
slopeStorage[rangeEnd + 1] -= slope;
}
}
long maxValue = Long.MIN_VALUE;
long currentValue = 0;
for (long slope : slopeStorage) {
currentValue += slope;
maxValue = Math.max(currentValue, maxValue);
}
return maxValue;
}
}
| [
"stimo@gmx.net"
] | stimo@gmx.net |
935eb17f4038423d6bf4dc6e412f693538cb4237 | 471579962eb0abf949c73685353ef0098a8ad127 | /HelloGradle/src/main/java/com/ytgrading/bean/DepositForm.java | c0486e078e137a986afd4f383a53f98ec53f4824 | [] | no_license | huyulin11/gradle | a727c7e31b9a42aee6decd5d6a5f5ceac84180f3 | 3cdc3b8b02e9f48af93d1cc6087b61f67cf45a0e | refs/heads/master | 2020-04-13T07:09:16.437325 | 2019-02-26T03:20:13 | 2019-02-26T03:20:13 | 163,042,029 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,446 | java | package com.ytgrading.bean;
public class DepositForm {
private String entitytype;
private String innerno;
private String deposittimestart;
private String deposittimeend;
private String amountstart;
private String amountend;
private String amount;
private String depositstatus;
public String getEntitytype() {
return entitytype;
}
public void setEntitytype(String entitytype) {
this.entitytype = entitytype;
}
public String getInnerno() {
return innerno;
}
public void setInnerno(String innerno) {
this.innerno = innerno;
}
public String getDeposittimestart() {
return deposittimestart;
}
public void setDeposittimestart(String deposittimestart) {
this.deposittimestart = deposittimestart;
}
public String getDeposittimeend() {
return deposittimeend;
}
public void setDeposittimeend(String deposittimeend) {
this.deposittimeend = deposittimeend;
}
public String getAmountstart() {
return amountstart;
}
public void setAmountstart(String amountstart) {
this.amountstart = amountstart;
}
public String getAmountend() {
return amountend;
}
public void setAmountend(String amountend) {
this.amountend = amountend;
}
public String getAmount() {
return amount;
}
public void setAmount(String amount) {
this.amount = amount;
}
public String getDepositstatus() {
return depositstatus;
}
public void setDepositstatus(String depositstatus) {
this.depositstatus = depositstatus;
}
}
| [
"huyulin11@sina.cn"
] | huyulin11@sina.cn |
2ee5e047b1863d93bba6a72b04970ff196a26eae | b9126b446838e4134ca0ad13451726b9930dcb73 | /app/src/main/java/com/appmoviles/miprimerapp/Persona.java | 107ed0f0ab63b29fe17da31d2c0717bfeee8c00b | [] | no_license | juan-bol/MiPrimerApp | 7600075c5fbfa587e07e1c22ee6e854e123588b9 | 23d805c97234dec542b8a51d079d38ccf6d7438e | refs/heads/master | 2020-04-20T04:06:41.631538 | 2019-03-18T02:33:10 | 2019-03-18T02:33:10 | 168,617,706 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 251 | java | package com.appmoviles.miprimerapp;
class Persona {
public String nombre;
public String numero;
public Persona(){ }
public Persona(String nombre, String numero) {
this.nombre = nombre;
this.numero = numero;
}
}
| [
"juan-bol98@hotmail.com"
] | juan-bol98@hotmail.com |
aaec208aff9084da8ada12a64b5d4e6f2fb68e8b | 5be236f6e4dc7bf810b2d469b4e0155e02081491 | /labs/Day4StereoTypes/src/main/java/iti/Main.java | 7a2e28177ac89de41b5c88e57debf071fb528486 | [] | no_license | ahmedasemsery/springCoreLabs | 85d6ef7613ca4dba3d77a2d428ad82b26073dad7 | 2ace50211a59cca8bf84ece271d78c316ae60a4a | refs/heads/main | 2023-04-20T19:19:36.993178 | 2021-05-05T12:43:34 | 2021-05-05T12:43:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 508 | java | package iti;
import iti.services.Service1;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class Main {
public static void main(String[] args) {
ApplicationContext context = new ClassPathXmlApplicationContext("day4.xml");
context.getBean("account");
// context.getBean("service1");
Service1 service = context.getBean("service1", Service1.class);
service.print();
}
} | [
"ahmedasemsery@gmail.com"
] | ahmedasemsery@gmail.com |
f30cdf59285205bcaacf41f2ff2a8a613c244bd0 | 05bacb4927256bf4445585378032101cb487e897 | /src/main/java/com/sunflower/petal/service/MaterialManufacturerService.java | 02a2175841dd4ba3e45ea04e441a36e0e75188bd | [] | no_license | kuixiang/petal | e82055947de3848b4cb54870cedae3a2cf5f596f | 8f64922d3267c52e71b6de8a9fcb3a6da453f91c | refs/heads/master | 2016-09-11T04:06:10.817124 | 2015-09-07T02:26:00 | 2015-09-07T02:26:00 | 34,526,174 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,690 | java | package com.sunflower.petal.service;
import com.sunflower.petal.dao.MaterialDao;
import com.sunflower.petal.dao.MaterialManufacturerDao;
import com.sunflower.petal.entity.DataTableRequest;
import com.sunflower.petal.entity.DataTableResponse;
import com.sunflower.petal.entity.Material;
import com.sunflower.petal.entity.MaterialManufacturerRL;
import com.sunflower.petal.utils.CommonUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Created by xiangkui on 14-2-13.
*/
@Service("materialManufacturerService")
public class MaterialManufacturerService {
@Autowired
private MaterialManufacturerDao materialManufacturerDao;
public void buildRLByMaterialId(Long materialId,Long[] manufacturerIds,String beizhu){
materialManufacturerDao.deleteBLByMaterialId(materialId);
if(null!=manufacturerIds && manufacturerIds.length>0)
materialManufacturerDao.addRLByMaterialId(materialId,manufacturerIds,beizhu);
}
public void buildRLByManufacturerId(Long manufacturerId,Long[] materialIds,String beizhu){
materialManufacturerDao.deleteBLByManufacturerId(manufacturerId);
if(null!=materialIds && materialIds.length>0)
materialManufacturerDao.addRLByManufacturerId(manufacturerId,materialIds,beizhu);
}
public List<MaterialManufacturerRL> getRLByMaterialId(Long materialId){
return materialManufacturerDao.queryByMaterialId(materialId);
}
public List<MaterialManufacturerRL> getRLByManufacturerId(Long manufacturerId){
return materialManufacturerDao.queryByManufacturerId(manufacturerId);
}
}
| [
"itxiangkui@gmail.com"
] | itxiangkui@gmail.com |
25ba9ab3547c5d88f6ae81f086f2903a9a3fdadc | d3bb461562527a180ec517d65c85238ade517461 | /android/app/src/main/java/com/example/myshop/adapter/RauAdapter.java | caee9681da0c9abeb0d837ddba093554b3ede2ce | [] | no_license | ductm-it/LauVietApp | f571d25821835c396974ea0154bb759c75579f50 | 1e6ddb584c4baa43fbd061e57932b14ee68e831e | refs/heads/master | 2022-11-15T00:16:16.906751 | 2020-07-10T08:43:45 | 2020-07-10T08:43:45 | 278,519,030 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,875 | java | package com.example.myshop.adapter;
import android.content.Context;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.myshop.R;
import com.example.myshop.model.SanPham;
import com.squareup.picasso.Picasso;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;
public class RauAdapter extends BaseAdapter {
Context context;
ArrayList<SanPham> arrayrau;
public RauAdapter(Context context, ArrayList<SanPham> arrayrau) {
this.context = context;
this.arrayrau = arrayrau;
}
public void setfilter(List<SanPham> actorsList){
arrayrau=new ArrayList<>();
arrayrau.addAll(actorsList);
notifyDataSetChanged();
}
@Override
public int getCount() {
return arrayrau.size();
}
@Override
public Object getItem(int position) {
return arrayrau.get(position);
}
@Override
public long getItemId(int position) {
return 0;
}
public class ViewHolder{
public TextView txtrauTen,getTxtrauGia,getTxtrauMota;
public ImageView imgrau;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
RauAdapter.ViewHolder viewHolder=null;
if (convertView==null){
viewHolder=new ViewHolder();
LayoutInflater layoutInflater=(LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView=layoutInflater.inflate(R.layout.list_rau,null);
viewHolder.txtrauTen=(TextView) convertView.findViewById(R.id.txtrauTen);
viewHolder.getTxtrauGia=(TextView) convertView.findViewById(R.id.txtrauGia);
viewHolder.getTxtrauMota=(TextView) convertView.findViewById(R.id.txtrauMota);
viewHolder.imgrau=convertView.findViewById(R.id.imagerau);
convertView.setTag(viewHolder);
}else {
viewHolder= (RauAdapter.ViewHolder) convertView.getTag();
}
SanPham sanPham=(SanPham) getItem(position);
viewHolder.txtrauTen.setText(sanPham.getName());
DecimalFormat decimalFormat=new DecimalFormat("###,###,###");
viewHolder.getTxtrauGia.setText("Giá: "+decimalFormat.format(sanPham.getPrice())+" Đồng");
viewHolder.getTxtrauMota.setMaxLines(2);
viewHolder.getTxtrauMota.setEllipsize(TextUtils.TruncateAt.END);
viewHolder.getTxtrauMota.setText(sanPham.getDescription() );
Picasso.with(context).load(sanPham.getImage())
// .placeholder(R.drawable.loader)
// .error(R.drawable.close)
.into(viewHolder.imgrau);
return convertView;
}
}
| [
"tranminhduc1299@gmail.com"
] | tranminhduc1299@gmail.com |
52b98bf63778b39b1dea6ffc710030f9b9576212 | e7d97a981fd97be27206c7fc83b2fbc2bd35888d | /Professional_internship_training/designer1/src/main/java/com/nchu/utils/JDBCHelper.java | c9119e0e40591c716d5bdfe0159e838f8b6310b1 | [] | no_license | flyfishboy/Project-summary | 2463bccd0a23e530d8dcf3857e876f4cc7e4187f | 0d0f17cc534ee4a4a1d13af817d354b01225483d | refs/heads/master | 2022-07-12T19:05:27.230953 | 2019-09-18T03:27:35 | 2019-09-18T03:27:35 | 206,247,499 | 1 | 2 | null | 2022-06-21T04:12:13 | 2019-09-04T06:27:09 | JavaScript | UTF-8 | Java | false | false | 9,131 | java | package com.nchu.utils;
import java.io.IOException;
import java.io.InputStream;
import java.sql.*;
import java.util.Properties;
public class JDBCHelper {
private static String driver ;
private static String url ;
private static String username ;
private static String password ;
private static boolean autoCommit ;
private static int isolation ;
// 用来表示一个连接
private static Connection conn ;
static{
config() ;
}
// 读取配置文件
private static void config(){
Properties p = new Properties() ;
InputStream ins = JDBCHelper.class.getResourceAsStream("/db.properties") ;
try {
p.load( ins ) ;
// 获取到对应的属性(根据键 获取值 )
String database = p.getProperty("connect") ;
driver = p.getProperty(database+".driver") ;
url = p.getProperty(database+".url") ;
username = p.getProperty(database+".username") ;
password = p.getProperty(database+".password") ;
String autocommit = p.getProperty("autocommit") ;
autoCommit = Boolean.valueOf( autocommit ) ;
String level = p.getProperty("transactionIsolation") ;
isolation = Integer.valueOf( level ) ;
// 做一次判断 (应该等于 1 2 4 8 中的一个值 )
if( isolation <= 0 ){
isolation = 2 ;
}
} catch (IOException e) {
e.printStackTrace();
}
}
// 加载驱动
private static void load(){
try {
Class.forName(driver) ;
} catch (ClassNotFoundException e) {
System.out.println("加载驱动失败" + e.getMessage());
}
}
/**
* 判断连接是否有效
* @return false 表示连接 无效
* true 表示连接有效
*/
private static boolean isValid(){
try {
if( conn != null ){
// 如果 该链接在 3 秒内 是 有效的 , 那么返回 true
return conn.isValid( 3 ) ;
}
} catch (SQLException e) {
e.printStackTrace();
}
return false ;
}
// 建立连接
private static Connection conn(){
// 加载驱动
load() ;
try {
if( ! isValid() ){ // 证明 此时的连接 是已经关闭的 或者是 无效的 ,所以应该创建这个连接
conn = DriverManager.getConnection( url , username , password ) ;
}
} catch (SQLException e) {
System.out.println("建立连接失败 " + e.getMessage() );
}
return conn ;
}
// 设置 事务的隔离级别 、自动提交
private static void setTransaction(){
// 证明 Connection 是有效的
if( ! isValid() ){
// 能进入到这里,证明是无效的
conn = conn() ;
}
try {
conn.setAutoCommit( autoCommit );
} catch (SQLException e) {
System.out.println("设置事务自动提交失败 " + e.getMessage() );
}
try {
conn.setTransactionIsolation( isolation );
} catch (SQLException e) {
System.out.println("设置事务隔离级别失败 " + e.getMessage() );
}
}
/**
* 提交事务
* @return
*/
private static void commit( Connection c ){
if( c != null && !autoCommit ){
try {
c.commit(); // 提交事务
} catch (SQLException e) {
System.out.println("提交事务失败 :" + e.getMessage() );
}
}
}
/**
* 回滚事务
* @return
*/
private static void rollback( Connection c ){
if( c != null && !autoCommit ){
try {
c.rollback();
} catch (SQLException e) {
System.out.println("回滚事务失败 :" + e.getMessage() );
}
}
}
// 创建Statement 对象
private static Statement state(){
conn = conn() ;
Statement st = null ;
try {
st = conn.createStatement() ;
} catch (SQLException e) {
System.out.println("创建 Statement 对象失败 " + e.getMessage() );
}
return st ;
}
// 创建 PreparedStatment 对象
private static PreparedStatement prepare( String SQL , boolean autoGeneartedKeys){
conn = conn() ;
PreparedStatement ps = null ;
try {
if( autoGeneartedKeys ) {
ps = conn.prepareStatement(SQL , Statement.RETURN_GENERATED_KEYS );
}else{
ps = conn.prepareStatement( SQL ) ;
}
} catch (SQLException e) {
System.out.println("创建 PreparedStatement 对象失败 " + e.getMessage() );
}
return ps ;
}
/**
* 执行 DDL、和 DML
*/
public static boolean execute( String SQL , Object... params ){
setTransaction() ;
boolean flag = false ;
if( SQL == null || SQL.trim().isEmpty() || SQL.trim().toLowerCase().startsWith("select") ){
throw new RuntimeException("你传入的SQL为空或是一个查询语句") ;
}
Connection c = null ;
if( params.length > 0 ){
// 此时的SQL 语句中有占位符,并且 传入了参数
PreparedStatement ps = prepare( SQL , false ) ;
try {
c = ps.getConnection() ;
} catch (SQLException e) {
e.printStackTrace();
}
try {
// 填充占位符
for( int i = 0 ; i < params.length ; i ++){
ps.setObject( i+1 , params[i] ) ;
}
ps.executeUpdate() ;
commit( c );
flag = true ;
} catch (SQLException e) {
System.out.println("操作失败 " + e.getMessage() );
rollback( c );
}
}else{
Statement st = state() ;
try {
c = st.getConnection() ;
} catch (SQLException e) {
e.printStackTrace();
}
try {
st.executeUpdate( SQL ) ;
// 提交事务
commit( c );
flag = true ;
} catch (SQLException e) {
System.out.println("执行失败" + e.getMessage() );
rollback( c );
}
}
return flag ;
}
/**
* 执行 DQL 语句
*/
public static ResultSet query( String SQL , Object ... params ){
ResultSet rs = null ;
if( SQL == null || SQL.trim().isEmpty() || !SQL.trim().toLowerCase().startsWith("select") ){
throw new RuntimeException("你传入的SQL为空或不是一个查询语句") ;
}
if( params.length > 0 ){
PreparedStatement ps = prepare( SQL , false ) ;
try {
for( int i =0 ; i < params.length ; i ++ ){
ps.setObject( i + 1 , params[i] ) ;
}
rs = ps.executeQuery() ;
} catch (SQLException e) {
e.printStackTrace();
}
}else{
Statement st = state() ;
try {
rs = st.executeQuery( SQL ) ;
} catch (SQLException e) {
e.printStackTrace();
}
}
return rs ;
}
/**
* 处理结果
* @param
*/
public static void meta( ResultSet rs ){
if( rs != null ){
try {
ResultSetMetaData rsmd = rs.getMetaData() ;
int count = rsmd.getColumnCount() ;
while( rs.next() ){
for( int i = 0 ; i < count ; i++){
System.out.println(rs.getObject( i + 1 ) ) ;
}
System.out.println();
}
} catch (SQLException e) {
e.printStackTrace();
}
}
}
// 关闭资源
public static void release( Object o ){
if( o != null ){
if( o instanceof Connection ){
Connection c = (Connection) o ;
try {
c.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
if( o instanceof Statement ){
Statement st = (Statement) o ;
try {
st.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
if( o instanceof ResultSet ){
ResultSet rs = (ResultSet) o ;
try {
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
}
}
| [
"2924466431@qq.com"
] | 2924466431@qq.com |
6cb91475ef4756a8bbba0da2f736993d694373a8 | c7a32973cb35160c65d7c722135b19b924288e42 | /bungeeClient/edu/cmu/cs/bungee/client/viz/markup/BungeeClickHandler.java | cde92a7210cb2022c7e9ad35323f1b3aae15a020 | [] | no_license | derthick/bungee-view | f70c5e3df1f2f81f818949fe384ce32282157eb0 | 452d95b022c928da44daa01fa65867c651ae569b | refs/heads/master | 2021-01-01T05:46:22.250420 | 2016-05-05T19:20:01 | 2016-05-05T19:20:01 | 58,075,795 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,690 | java | package edu.cmu.cs.bungee.client.viz.markup;
import static edu.cmu.cs.bungee.javaExtensions.Util.printModifiersEx;
import org.eclipse.jdt.annotation.NonNull;
import edu.cmu.cs.bungee.client.viz.bungeeCore.UserAction;
import edu.cmu.cs.bungee.piccoloUtils.gui.MyInputEventHandler;
import edu.umd.cs.piccolo.event.PInputEvent;
public class BungeeClickHandler<T extends KnowsBungee> extends MyInputEventHandler<T> {
private static final @NonNull BungeeClickHandler<KnowsBungee> BUNGEE_CLICK_HANDLER = new BungeeClickHandler<>(
KnowsBungee.class);
protected BungeeClickHandler(final @NonNull Class<?> _nodeType) {
super(_nodeType);
}
public static @NonNull BungeeClickHandler<KnowsBungee> getBungeeClickHandler() {
return BUNGEE_CLICK_HANDLER;
}
@Override
public boolean shiftKeysChanged(final @NonNull KnowsBungee node, final @NonNull PInputEvent e) {
return enter(node, e);
}
@Override
public boolean enter(final @NonNull KnowsBungee node, final @NonNull PInputEvent e) {
// System.out.println("BungeeClickHandler.enter " + node + "
// getModifiersEx=" + e.getModifiersEx()
// + " isUnderMouse=" + node.isUnderMouse(true, e));
boolean result = isMouseEventApplicable(node, true, e);
if (result && !node.brush(true, e)) {
result = UserAction.setClickDesc(e, node.getModifiersEx(e), node.art());
}
return result;
}
@Override
public boolean exit(final @NonNull KnowsBungee node, final @NonNull PInputEvent e) {
// System.out.println("BungeeClickHandler.exit " + node);
// userAction = null;
final boolean result = isMouseEventApplicable(node, false, e);
if (result) {
node.brush(false, e);
node.art().resetClickDesc();
}
return result;
}
@Override
public boolean click(final @NonNull KnowsBungee node, final @NonNull PInputEvent e) {
// System.out.println("BungeeClickHandler.click " + node);
boolean result = false;
if (isMouseEventApplicable(node, true, e)) {
final int modifiers = node.getModifiersEx(e);
final UserAction userAction = UserAction.getAction(e, node.art(), modifiers);
if (userAction != null) {
node.printUserAction(modifiers);
result = userAction.performWhenQueryValid();
} else {
System.err.println("BungeeClickHandler.click: No userAction found " + e.getPickedNode()
+ printModifiersEx(modifiers));
}
}
return result;
}
protected static boolean isMouseEventApplicable(final @NonNull KnowsBungee node, final boolean state,
final @NonNull PInputEvent e) {
return node.art().isReady() && node.isUnderMouse(state, e);
}
// @Override
// public void mayHideTransients(final DraggableFacetNode node) {
// node.mayHideTransients((PNode) node);
// }
}
| [
"markderthick@gmail.com"
] | markderthick@gmail.com |
4e77da5bb4bd1484fd426ec8232b037f9aa702e8 | 4f767c0b46f8bbdb6e0ca89c15427abf9dac1b2f | /src/main/java/pl/com/bottega/mathplay/ConsoleApplication.java | 6bcc34afc7de7655e0fd3288bcfe1a667815c98e | [] | no_license | AnnaKrzysztoszek/document-management | ae3979d85ca29496a4393b35bb185c47a570043d | a6ab1d4d85bf8135e46484034d521a58c202a792 | refs/heads/master | 2021-01-17T06:03:00.870002 | 2016-08-28T14:50:23 | 2016-08-28T14:50:23 | 60,955,906 | 0 | 0 | null | 2016-06-12T08:26:27 | 2016-06-12T08:26:27 | null | UTF-8 | Java | false | false | 1,185 | java | package pl.com.bottega.mathplay;
import java.util.Collection;
import java.util.Scanner;
/**
* Created by anna on 25.08.2016.
*/
public abstract class ConsoleApplication {
protected Scanner scanner = new Scanner(System.in);
public void run() {
while (true) {
printMenu();
System.out.println("Choose option or if you do not want play enter 'quit': ");
String cmd = getCommand();
if (cmd.equals("quit"))
return;
execute(cmd);
}
}
private void printMenu() {
Collection<String> menuItems = menuItems();
System.out.println("Playing with math for high school students");
for (String item : menuItems)
System.out.println(item);
}
private String getCommand() {
return scanner.nextLine();
}
protected void execute(String cmd) {
CommandFactory commandFactory = commandFactory();
Command command = commandFactory.createCommand(cmd);
command.execute();
}
protected abstract pl.com.bottega.mathplay.CommandFactory commandFactory();
protected abstract Collection<String> menuItems();
}
| [
"krzysztoszek.a@gmail.com"
] | krzysztoszek.a@gmail.com |
27ada6d025e6a17ab7f9f6a6c961e283bccbac68 | 4fe05b350c2157f9153f369cb052ff1fd5b15edf | /src/main/java/com/dipgen/service/security/UserService.java | 318c5675e3896e7de4819fab7b0517ec0afdf1f9 | [
"BSD-3-Clause"
] | permissive | jirkapinkas/dipgen | fb5d281e1de69b85bb2446cac162e987c16b2d30 | a71cc945d2d47685ca3abbe90546b303aab67071 | refs/heads/master | 2020-05-30T04:27:44.684396 | 2013-10-28T08:40:35 | 2013-10-28T08:40:35 | 12,518,111 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,319 | java | package com.dipgen.service.security;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.encoding.Md5PasswordEncoder;
import org.springframework.security.authentication.encoding.PasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.dipgen.entity.security.Role;
import com.dipgen.entity.security.Role.ROLE_TYPE;
import com.dipgen.entity.security.User;
import com.dipgen.repository.security.RoleRepository;
import com.dipgen.repository.security.UserRepository;
@SuppressWarnings("deprecation")
@Service
@Transactional
public class UserService {
@Autowired
private UserRepository userRepository;
@Autowired
private RoleRepository roleRepository;
public List<User> findAll() {
return userRepository.findAllUsersWithRoles();
}
public User create(User user) {
user.setEnabled(true);
user.setRegistrationDate(new Date());
PasswordEncoder encoder = new Md5PasswordEncoder();
String hashedPass = encoder.encodePassword(user.getPassword(), null);
user.setPassword(hashedPass);
return userRepository.save(user);
}
public User update(User user) {
return userRepository.save(user);
}
public User updateWithNewPassword(User user) {
PasswordEncoder encoder = new Md5PasswordEncoder();
String hashedPass = encoder.encodePassword(user.getPassword(), null);
user.setPassword(hashedPass);
return userRepository.save(user);
}
public User findOne(int userId) {
return userRepository.findOne(userId);
}
public User findOne(String name) {
return userRepository.findByName(name);
}
public void assignRole(int userId, int roleId) {
User user = userRepository.findOne(userId);
user.getRoles().add(roleRepository.findOne(roleId));
}
public boolean isPremium(String username) {
User user = userRepository.findByName(username);
List<Role> userRoles = user.getRoles();
for (Role role : userRoles) {
if (role.getName() == ROLE_TYPE.ROLE_PREMIUM) {
return true;
}
}
return false;
}
public void delete(int userId) {
userRepository.delete(userId);
}
public void deactivate(String name) {
User user = userRepository.findByName(name);
user.setEnabled(false);
}
}
| [
"jirka.pinkas@gmail.com"
] | jirka.pinkas@gmail.com |
eda5d2c8fdf0a40cd005510699743acf1268ae5b | 08d423b8b70b144b3ca3b3dde4c87cef31c8cf0b | /app/src/main/java/com/home/jzandroidchartdemo2/view/epoxy/MainEpoxyController.java | ef9cea614f427c265a7192c97d8a21ae897a7850 | [] | no_license | tenSunFree/JZAndroidChartDemo2 | 38556dc77d6225e13ffa9f62886396d03202e1fd | 606a3f03ea13635ab5fd4d566c51a3ccc621d3d8 | refs/heads/master | 2022-11-30T10:44:57.219147 | 2020-08-03T19:50:29 | 2020-08-03T19:50:29 | 284,792,412 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,551 | java | package com.home.jzandroidchartdemo2.view.epoxy;
import com.airbnb.epoxy.AutoModel;
import com.airbnb.epoxy.EpoxyController;
import com.home.jzandroidchartdemo2.ActivityMainBottomBarBindingModel_;
import com.home.jzandroidchartdemo2.ActivityMainTopBarBindingModel_;
import com.home.jzandroidchartdemo2.R;
import java.util.List;
import cn.jingzhuan.lib.chart.data.CandlestickValue;
public class MainEpoxyController extends EpoxyController {
@AutoModel
MainCenterBarEpoxyModel_ mainCenterBarEpoxyModel_;
private int height;
private List<CandlestickValue> candlestickValueList;
public MainEpoxyController(int height, List<CandlestickValue> list) {
this.height = height;
this.candlestickValueList = list;
}
@Override
protected void buildModels() {
initTopModel();
initCenterModel();
initBottomModel();
}
private void initTopModel() {
new ActivityMainTopBarBindingModel_()
.id("ActivityMainTopBarBindingModel_")
.imageResource(R.drawable.icon_top_bar)
.addTo(this);
}
private void initCenterModel() {
mainCenterBarEpoxyModel_.candlestickValues = candlestickValueList;
mainCenterBarEpoxyModel_.height = height;
mainCenterBarEpoxyModel_.addTo(this);
}
private void initBottomModel() {
new ActivityMainBottomBarBindingModel_()
.id("ActivityMainBottomBarBindingModel_").imageResource(R.drawable.icon_bottom_bar)
.addTo(this);
}
} | [
"sunwenyen@gmail.com"
] | sunwenyen@gmail.com |
33139ff5b0aeaad371340892d09768e5d6e9c469 | e1c82d63301fd016116930f50034938208857e30 | /src/com/javarush/test/level11/lesson06/task05/Solution.java | 546e0fd3b1f22150115c0cab4bf5d5a155ce2b4b | [] | no_license | AlexBort/JavaRushHomeWork | e8b11629e426211fe032d3ca78771398fe84c8b0 | 68f7508ec8cef0e32797574b32b467e205f2ca1d | refs/heads/master | 2021-01-11T15:35:19.320377 | 2017-01-31T17:22:46 | 2017-01-31T17:22:46 | 80,541,801 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,345 | java | package com.javarush.test.level11.lesson06.task05;
/* ИТ-компания
Написать девять классов: Worker(сотрудник), Clerk (клерк), IT (ИТ-специалист), Programmer(программист),
ProjectManager(менеджер проекта), CTO(технический директор), HR(рекрутер),
OfficeManager(офис-менеджер), Cleaner (уборщик).
Унаследовать программиста, менеджера проекта и технического директора от ИТ-специалиста.
Унаследовать рекрутера, уборщика и офис-менеджера от клерка.
Унаследовать клерка и ИТ-специалиста от сотрудника.
*/
public class Solution
{
public static void main(String[] args)
{
}
public class Worker
{
}
public class Clerk extends Worker
{
}
public class IT extends Worker
{
}
public class Programmer extends IT
{
}
public class ProjectManager extends IT
{
}
public class CTO extends IT
{
}
public class OfficeManager extends Clerk
{
}
public class HR extends Clerk
{
}
public class Cleaner extends Clerk
{
}
}
| [
"bortolo1994@gmail.com"
] | bortolo1994@gmail.com |
8d1fb014126623a001da56c49d1381a89f5f8a45 | ed9eaec84195d990b7f05623e152d75cac98769a | /src/main/java/io/stibits/domain/AbstractAuditingEntity.java | 883407ec467f1352947156f41691cef885662113 | [] | no_license | BulkSecurityGeneratorProject/extract-from-blockchain | 4ef3a22ea6fe49fb369144d1a18edda198803ea4 | 3f728325a7a17b6fb26349a59a14cf1c05945f16 | refs/heads/master | 2022-12-10T07:41:13.695608 | 2019-04-22T11:23:45 | 2019-04-22T11:23:45 | 296,582,922 | 0 | 0 | null | 2020-09-18T09:59:14 | 2020-09-18T09:59:13 | null | UTF-8 | Java | false | false | 2,207 | java | package io.stibits.domain;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.hibernate.envers.Audited;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import java.io.Serializable;
import java.time.Instant;
import javax.persistence.Column;
import javax.persistence.EntityListeners;
import javax.persistence.MappedSuperclass;
/**
* Base abstract class for entities which will hold definitions for created, last modified by and created,
* last modified by date.
*/
@MappedSuperclass
@Audited
@EntityListeners(AuditingEntityListener.class)
public abstract class AbstractAuditingEntity implements Serializable {
private static final long serialVersionUID = 1L;
@CreatedBy
@Column(name = "created_by", nullable = false, length = 50, updatable = false)
@JsonIgnore
private String createdBy;
@CreatedDate
@Column(name = "created_date", updatable = false)
@JsonIgnore
private Instant createdDate = Instant.now();
@LastModifiedBy
@Column(name = "last_modified_by", length = 50)
@JsonIgnore
private String lastModifiedBy;
@LastModifiedDate
@Column(name = "last_modified_date")
@JsonIgnore
private Instant lastModifiedDate = Instant.now();
public String getCreatedBy() {
return createdBy;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
public Instant getCreatedDate() {
return createdDate;
}
public void setCreatedDate(Instant createdDate) {
this.createdDate = createdDate;
}
public String getLastModifiedBy() {
return lastModifiedBy;
}
public void setLastModifiedBy(String lastModifiedBy) {
this.lastModifiedBy = lastModifiedBy;
}
public Instant getLastModifiedDate() {
return lastModifiedDate;
}
public void setLastModifiedDate(Instant lastModifiedDate) {
this.lastModifiedDate = lastModifiedDate;
}
}
| [
"mhammam@sitibits.io"
] | mhammam@sitibits.io |
b48f870a811ea91afa64a406bd801cadfba3b0bb | 8c9b743f156307cfb8781f95d2039f3697305b78 | /src/com/gargoylesoftware/htmlunit/javascript/host/event/MediaStreamEvent.java | 7790b0b43aac6b575f0398318c97e80769faea1b | [] | no_license | jiafenggit/HtmlUnitTao | f8fbd9065b03b6cd0f3a4ce1db6b4fbfd4941000 | ede3e10603d16f022b60798ea340c392f57495f7 | refs/heads/master | 2021-04-28T23:46:58.642674 | 2016-03-15T08:08:02 | 2016-03-15T08:08:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,403 | java | /*
* Copyright (c) 2002-2015 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.gargoylesoftware.htmlunit.javascript.host.event;
import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.CHROME;
import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.FF;
import com.gargoylesoftware.htmlunit.javascript.configuration.JsxClass;
import com.gargoylesoftware.htmlunit.javascript.configuration.JsxConstructor;
import com.gargoylesoftware.htmlunit.javascript.configuration.WebBrowser;
/**
* A JavaScript object for {@code MediaStreamEvent}.
*
* @version $Revision: 10589 $
* @author Ahmed Ashour
*/
@JsxClass(browsers = { @WebBrowser(CHROME), @WebBrowser(FF) })
public class MediaStreamEvent extends Event {
/**
* Creates an instance.
*/
@JsxConstructor
public MediaStreamEvent() {
}
}
| [
"jeruen@gmail.com"
] | jeruen@gmail.com |
6265bc54daa36bd52d1986d6454e07b5e1503352 | fd1a5a6d21948d3e50742d617b40146acd326609 | /src/examples/eAgenda/data/Meeting.java | dbf7fe75a0ad63c3a6234ec1f8083459fec0d299 | [] | no_license | Droop/DimaX | 468c0b85c197695d8a4c044079539a729551fa69 | 886410ead3d8d89f7b517efa0e1245bc66773fa9 | refs/heads/master | 2021-01-01T05:41:32.873760 | 2011-12-12T14:53:12 | 2011-12-12T14:53:12 | 2,634,865 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 2,871 | java | package examples.eAgenda.data;
import java.io.Serializable;
import java.util.ArrayList;
/** Structure for a meeting within the agenda */
public class Meeting extends Activity implements Serializable {
/**
*
*/
private static final long serialVersionUID = -593275503402727257L;
int[] durationSet;
boolean selfNecessary;
Day limitDay;
People necessaryMembers;
People otherMembers;
/** Time in millisecond before wich the meeting should not take place */
long startLimit;
public Meeting() {
this("","", new int[2], null, null, null, true, false, System.currentTimeMillis());
}
public Meeting(final String titl, final int mini, final int maxi, final Day valid, final People necessary, final People wished, final boolean movable) {
this(titl, "", null, valid, necessary, wished, true, movable, System.currentTimeMillis());
this.setDuration(mini, maxi);
}
/** Create a meeting that may start from now */
public Meeting(final String titl, final String descript, final int[] duration, final Day valid, final People necessary, final People wished, final boolean selfNecess, final boolean movable) {
this(titl, descript, duration, valid, necessary, wished, selfNecess, movable, System.currentTimeMillis());
}
public Meeting(final String titl, final String descript, final int[] duration, final Day valid, final People necessary, final People wished, final boolean selfNecess, final boolean movable, final long sLimit) {
super(titl, descript, movable);
this.durationSet = duration;
this.limitDay = valid;
this.necessaryMembers = necessary;
this.otherMembers = wished;
this.selfNecessary = selfNecess;
this.startLimit = sLimit;
}
public ArrayList getAllParticipants() {
final ArrayList res = this.necessaryMembers.getCanonicalList();
res.addAll(this.otherMembers.getCanonicalList());
return res;
}
public ArrayList getNecessParticipants() {
if (this.necessaryMembers.getSize()!=0) {
final ArrayList res = this.necessaryMembers.getCanonicalList();
return res;}
else return new ArrayList();
}
public int[] getDurationSet() {
return this.durationSet;
}
public Day getLimitDay() {
return this.limitDay;
}
public People getNecessaryParticipants() {
return this.necessaryMembers;
}
public People getOtherParticipants() {
return this.otherMembers;
}
/** Time in millisecond before wich the meeting should not take place */
public long getStartLimit() {
return this.startLimit;
}
public boolean isSelfNecessary() {
return this.selfNecessary;
}
public void setDuration(final int mini, final int maxi) {
this.durationSet[0] = mini;
this.durationSet[1] = maxi;
}
public void setLimitDay(final Day d) {
this.limitDay = d;
}
public void setSelfNecessary(final boolean b) {
this.selfNecessary = b;
}
}
| [
"sylvain.ductor@lip6.fr"
] | sylvain.ductor@lip6.fr |
989db9c25fdf2828a50b89698575ba2b4e7208c0 | 602844fc9ed2ebef0a955e468836f43473d5a310 | /src/main/java/com/codeadda/jersey/api/config/EmployeeConfig.java | f8d92241c90960400c8fa0e92db9eaf57d35301b | [] | no_license | ChandraManiGupta/spring-boot-jersey-integration | 81e7cee1ed1932265a22b2897c83e4399b2a9e2c | 128c050c1e1e39f0bec9564dad31e97b0102166a | refs/heads/master | 2020-09-19T23:33:25.409510 | 2019-11-27T02:04:29 | 2019-11-27T02:04:29 | 224,323,675 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 410 | java | package com.codeadda.jersey.api.config;
import javax.ws.rs.ApplicationPath;
import org.glassfish.jersey.server.ResourceConfig;
import org.springframework.stereotype.Component;
import com.codeadda.jersey.api.controller.EmployeeController;
@Component
@ApplicationPath("/jersey")
public class EmployeeConfig extends ResourceConfig{
public EmployeeConfig() {
register(EmployeeController.class);
}
}
| [
"talk2guddu01@gmail.com"
] | talk2guddu01@gmail.com |
e48ffe6a35bc8baa2d3322bb1b321e1285dd5813 | 99c1de2498e4345727b51ed48116df56efe4bfb3 | /src/de/georgwiese/functionInspector/controller/PathCollector.java | 2f746783fea510d8def2af40b57c24fb93926f56 | [] | no_license | georgwiese/Function-Inspector-Android | 33bc6cb22be5d6f925c19331a0da16dd31fb49e0 | c7625d18d900882f0c95ef5e2c61c44f821ab37a | refs/heads/master | 2021-04-09T16:53:01.879446 | 2012-09-20T11:28:44 | 2012-09-20T11:28:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,857 | java | package de.georgwiese.functionInspector.controller;
import java.util.ArrayList;
import de.georgwiese.calculationFunktions.Point;
import de.georgwiese.functionInspector.uiClasses.FktCanvas;
import de.georgwiese.functionInspector.uiClasses.Helper;
import de.georgwiese.functionInspector.uiClasses.Point2D;
import android.graphics.Matrix;
import android.graphics.Path;
import android.util.Log;
public class PathCollector {
// Number of pixels plus width that are drawn in best quality
static final int TOLERANCE_SIDE = 50;
StateHolder sh;
FktCanvas canvas;
ArrayList<Path> paths;
ArrayList<ArrayList<Point>> roots, extrema, inflections;
ArrayList<Point> intersections;
ArrayList<ArrayList<Double>> discontinuities;
Matrix transMatrix;
double[] originalPos, currentPos;
double[] originalZoom, currentZoom;
public PathCollector(StateHolder sh, FktCanvas canvas) {
this.sh = sh;
this.canvas = canvas;
paths = new ArrayList<Path>();
roots = new ArrayList<ArrayList<Point>>();
extrema = new ArrayList<ArrayList<Point>>();
inflections = new ArrayList<ArrayList<Point>>();
intersections = new ArrayList<Point>();
discontinuities = new ArrayList<ArrayList<Double>>();
transMatrix = new Matrix();
originalPos = new double[2];
currentPos = new double[2];
originalZoom = new double[2];
currentZoom = new double[2];
originalPos[0] = 0;
originalPos[1] = 0;
currentPos[0] = 0;
currentPos[1] = 0;
originalZoom[0] = 1;
originalZoom[1] = 1;
currentZoom[0] = 1;
currentZoom[1] = 1;
}
public void setPathsAndPoints(ArrayList<Path> paths, ArrayList<ArrayList<Point>> roots,
ArrayList<ArrayList<Point>> extrema, ArrayList<ArrayList<Point>> inflections,
ArrayList<Point> intersections, ArrayList<ArrayList<Double>> discontinuities,
double[] pos, double[] zoom) {
this.paths = paths;
originalPos = pos.clone();
currentPos = pos.clone();
originalZoom = zoom.clone();
currentZoom = zoom.clone();
this.roots = roots;
this.extrema = extrema;
this.inflections = inflections;
this.intersections = intersections;
this.discontinuities = discontinuities;
}
public ArrayList<Path> getPaths() {
return paths;
}
public ArrayList<ArrayList<Point>> getRoots() {
return roots;
}
public ArrayList<ArrayList<Point>> getExtrema() {
return extrema;
}
public ArrayList<ArrayList<Point>> getInflections() {
return inflections;
}
public ArrayList<ArrayList<Double>> getDiscontinuities() {
return discontinuities;
}
public ArrayList<Point> getIntersections() {
return intersections;
}
public void clearPaths(){
paths.clear();
}
public void update(){
// get Old and new positions in Units as Point2D
Point2D newCurrentPos = new Point2D(sh.getMiddle(0), sh.getMiddle(1));
Point2D oldCurrentPos = new Point2D(currentPos[0], currentPos[1]);
double[] newCurrentZoom = sh.getZoom();
double[] oldCurrentZoom = currentZoom.clone();
transMatrix.reset();
transMatrix.setScale((float)(newCurrentZoom[0] / oldCurrentZoom[0]),
(float)(newCurrentZoom[1] / oldCurrentZoom[1]),
canvas.getWidth()/2, canvas.getHeight()/2);
//transMatrix.setTranslate(Helper.getDeltaPx(oldCurrentPos.x - newCurrentPos.x, sh.getZoom(0)),
// Helper.getDeltaPx(newCurrentPos.y - oldCurrentPos.y, sh.getZoom(1)));
for(Path p:paths){
if (p != null){
p.transform(transMatrix);
p.offset(Helper.getDeltaPx(oldCurrentPos.x - newCurrentPos.x, sh.getZoom(0)),
Helper.getDeltaPx(newCurrentPos.y - oldCurrentPos.y, sh.getZoom(1)));
}
}
currentZoom = sh.getZoom().clone();
currentPos = sh.getMiddle().clone();
if(Helper.getDeltaPx(Math.abs(currentPos[0] - originalPos[0]), sh.getZoom(0)) > TOLERANCE_SIDE ||
oldCurrentZoom[0] != newCurrentZoom[0] || oldCurrentZoom[1] != newCurrentZoom[1])
sh.redraw = true;
}
}
| [
"georgwiese@gmail.com"
] | georgwiese@gmail.com |
b5c9b32003a3d66de8b0f122105d1a53140f94ec | 2f8ee7fea62d02994d192a9509ef8a8c82ddea68 | /app/src/androidTest/java/com/example/androidlearningdemo/ExampleInstrumentedTest.java | c9b28ffa9258a2ccdc70d4e5aca1b2d39e2d2aa2 | [] | no_license | sysuleiw/AndroidLearningDemo | 335ab32daf877f2a6c21b7850aedabaf138b664d | 81b750a6d70d2d5527d7d1d7d36f9eff620e2f6e | refs/heads/master | 2020-04-29T13:59:48.167507 | 2019-04-18T03:21:58 | 2019-04-18T03:21:58 | 176,183,287 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 746 | java | package com.example.androidlearningdemo;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.androidlearningdemo", appContext.getPackageName());
}
}
| [
"sysuleiw@163.com"
] | sysuleiw@163.com |
977c8b9930f456f3f6f93972437800fbed91c490 | b09f7be67bb0c8abd461fbe12f0cfcc339b9e433 | /app/src/main/java/com/ubimobitech/ubitwitter/model/UserMention.java | 0ce544ea582e77d0d2ba98d1328ca732809a14ee | [] | no_license | benakiva/ubitwitter | c7cf3c1be7d7f21fcd4ef73d8cde410d189d6f3d | 99f727875101323863f28c4c03f319ebb538915b | refs/heads/master | 2021-01-16T17:47:31.696097 | 2015-06-29T13:48:07 | 2015-06-29T13:48:07 | 38,249,726 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 643 | java | /**
* FILE: UserMention.java
* AUTHOR: Dr. Isaac Ben-Akiva <isaac.ben-akiva@ubimobitech.com>
* <p/>
* CREATED ON: 27/06/15
*/
package com.ubimobitech.ubitwitter.model;
import java.util.List;
/**
* Created by benakiva on 27/06/15.
*/
public class UserMention {
private String screen_name;
private List<Integer> indices;
public String getScreenName() {
return screen_name;
}
public int getStartIndex() {
return (indices != null & indices.size() == 2) ? indices.get(0) : 0;
}
public int getEndIndex() {
return (indices != null & indices.size() == 2) ? indices.get(1) : 0;
}
}
| [
"isaac.ben-akiva@ubimobitech.com"
] | isaac.ben-akiva@ubimobitech.com |
60c45caff16b4b07553aba19f35704085aee98c7 | d6a720cb89ac8a9c21dae598ff3046c3ebc68f32 | /ExampleHerencia/src/main/java/examengeopagos/Alfa.java | 32349a0db6aa304d220378b77fe2e43170403cc5 | [] | no_license | SoniaAbregu/ExampleHerencia | 89c47654e04dc9209ba2812591989ea8514823c7 | f41d2bc37ed5cdc7767ad05f11c698baa00fedcf | refs/heads/master | 2021-01-24T08:49:17.827365 | 2018-02-26T16:29:05 | 2018-02-26T16:29:05 | 122,996,668 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 318 | java | package examengeopagos;
public class Alfa {
public String nombre = "Sonia";
public Alfa() {
}
public Alfa(String nombre) {
super();
this.nombre = nombre;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
}
| [
"Mar@DESKTOP-JDMHTVM"
] | Mar@DESKTOP-JDMHTVM |
a751134cac5783b6c0cc1582a7b56549dd095d2e | 95308916eb1e6fcf0793685f946dea60ed95682b | /Varun/Day3Inheritance/src/com/hsbc/banking/utility/FormatHelper.java | 36623b07c6d481bf4288c6a11f7b2ab7e9af91bd | [] | no_license | eswaribala/rpshsbcjava2020 | 3d00c6184221196ca94723c3587cbfe5ca90234c | 2ef8adfa149d9d036ff5411918df722844c2fdac | refs/heads/master | 2022-12-29T01:38:48.579248 | 2020-10-20T11:51:15 | 2020-10-20T11:51:15 | 295,621,023 | 1 | 21 | null | 2020-10-19T08:15:54 | 2020-09-15T05:11:31 | HTML | UTF-8 | Java | false | false | 470 | java | package com.hsbc.banking.utility;
public class FormatHelper {
public static void Formatter(int num) {
System.out.printf("%d%n", num);
}
public static void Formatter(long num) {
System.out.printf("%010d%n", num);
}
public static void Formatter(float num) {
System.out.printf("%6.2f%n", num);
}
public static void Formatter(double num) {
System.out.printf("%8.5f%n", num);
}
public static void main(String[] args) {
Formatter(466456.43f);
}
}
| [
"v.gujarathi777@gmail.com"
] | v.gujarathi777@gmail.com |
2f24304213a058b87141a13b634014aff60c8f38 | 2c73dd929f3d29b035f18ce740d56d9f7242bfc8 | /core/project/src/main/java/com/webank/wedatasphere/qualitis/rule/dao/repository/RuleGroupRepository.java | 414324c59a173d02fcc72f416d7601dfd2b761c2 | [
"Apache-2.0"
] | permissive | WeBankFinTech/Qualitis | bf15fdaf3b9def7d1e5ae74acd3821c5ec66ebe6 | 4625b455b92d43de561bcf9b0abd4d724c1b43cf | refs/heads/master | 2023-07-23T02:59:56.420736 | 2023-07-14T02:50:05 | 2023-07-14T02:50:05 | 223,347,908 | 633 | 290 | Apache-2.0 | 2023-07-19T05:29:15 | 2019-11-22T07:29:02 | Java | UTF-8 | Java | false | false | 1,283 | java | /*
* Copyright 2019 WeBank
*
* 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.webank.wedatasphere.qualitis.rule.dao.repository;
import com.webank.wedatasphere.qualitis.rule.entity.RuleGroup;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
/**
* @author howeye
*/
public interface RuleGroupRepository extends JpaRepository<RuleGroup, Long> {
/**
* Find rule group by rule group name and project id
* @param ruleGroupName
* @param projectId
* @return
*/
RuleGroup findByRuleGroupNameAndProjectId(String ruleGroupName, Long projectId);
/**
* Find rule group list by project id
* @param projectId
* @return
*/
List<RuleGroup> findByProjectId(Long projectId);
}
| [
"chenmutime@outlook.com"
] | chenmutime@outlook.com |
2b828e39526692369815a85ad673ce845654405d | 4a54e11906b626a3b838236addb4bd6adb1123c1 | /SocialLibrary/src/com/epam/android/social/fragments/TwitterDialogsFragment.java | 47eae51b53882c0e415cceab838a78c1848e494f | [] | no_license | smgoss/training-android-epam | 8195c30e8050a10bf5d50ce12faa2b3fee20ce8d | 39fc551d6295759ee6dc9f4b74e89a3bb8a255a2 | refs/heads/master | 2021-01-10T03:24:46.952423 | 2012-06-08T08:36:16 | 2012-06-08T08:36:16 | 55,811,536 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,382 | java | package com.epam.android.social.fragments;
import java.util.List;
import android.os.Bundle;
import android.widget.BaseAdapter;
import com.epam.android.common.model.BaseModel;
import com.epam.android.social.R;
import com.epam.android.social.adapter.TwitterDialogsAdapter;
import com.epam.android.social.common.fragments.CommonTwitterFragment;
import com.epam.android.social.constants.ApplicationConstants;
import com.epam.android.social.model.TwitterDialogs;
public class TwitterDialogsFragment extends CommonTwitterFragment<TwitterDialogs>{
private static final String TAG = TwitterDialogsFragment.class
.getSimpleName();
public static TwitterDialogsFragment newInstance(String query,
String accountName) {
Bundle bundle = new Bundle();
TwitterDialogsFragment fragment = new TwitterDialogsFragment();
bundle.putString(ApplicationConstants.ARG_QUERY, query);
bundle.putString(ApplicationConstants.ARG_PROFILE_NAME, accountName);
fragment.setArguments(bundle);
return fragment;
}
private TwitterDialogsFragment() {
}
@Override
public BaseAdapter createAdapter(List<? extends BaseModel> list) {
return new TwitterDialogsAdapter(getContext(), R.layout.tweet,
(List<TwitterDialogs>) list);
}
@Override
public int getProgressBarResource() {
return R.id.progress_bar_on_listView;
}
}
| [
"ilya.shknaj@258f82a4-f076-c894-e823-74c26278488b"
] | ilya.shknaj@258f82a4-f076-c894-e823-74c26278488b |
b43a957d2a3e4d9cf82d068c229ec76309b6a0e7 | f8d6b74a52f734c734e63f6ca82bda34e6d44ba7 | /src/main/com/silverboyf/java8/lambda/LambdaSample.java | b9f715ed4845377d9041f966182e19cd48e4da66 | [] | no_license | silverboyf/java8_tutorial | 591a7762cabb537767abc5c711a9f2358a797a68 | b719af9ece2fc260e89ef4112e23cfefbdbdd4dc | refs/heads/master | 2021-01-13T02:30:27.198978 | 2015-02-13T06:02:47 | 2015-02-13T06:02:47 | 30,741,618 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 153 | java | package com.silverboyf.java8.lambda;
public class LambdaSample {
public static void main(String[] args) {
// TODO Auto-generated method stub
}
}
| [
"silverboyf@10.12.57.212"
] | silverboyf@10.12.57.212 |
0149f51b7449573b01ab66bea6be51a6f407d021 | 369270a14e669687b5b506b35895ef385dad11ab | /java.corba/org/omg/CORBA/WrongTransactionHelper.java | 4e77ec60b5d3307caf313e7144b1aadca746d58e | [] | no_license | zcc888/Java9Source | 39254262bd6751203c2002d9fc020da533f78731 | 7776908d8053678b0b987101a50d68995c65b431 | refs/heads/master | 2021-09-10T05:49:56.469417 | 2018-03-20T06:26:03 | 2018-03-20T06:26:03 | 125,970,208 | 3 | 3 | null | null | null | null | UTF-8 | Java | false | false | 2,450 | java | /*
* Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package org.omg.CORBA;
/**
* The Helper for {@code WrongTransaction}. For more information on
* Helper files, see <a href="doc-files/generatedfiles.html#helper">
* "Generated Files: Helper Files"</a>.<P>
* org/omg/CORBA/WrongTransactionHelper.java
* Generated by the IDL-to-Java compiler (portable), version "3.0"
* from CORBA.idl
* Thursday, August 24, 2000 5:32:50 PM PDT
*/
abstract public class WrongTransactionHelper
{
private static String _id = "IDL:omg.org/CORBA/WrongTransaction:1.0";
public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.WrongTransaction that)
{
org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
a.type (type ());
write (out, that);
a.read_value (out.create_input_stream (), type ());
}
public static org.omg.CORBA.WrongTransaction extract (org.omg.CORBA.Any a)
{
return read (a.create_input_stream ());
}
private static org.omg.CORBA.TypeCode __typeCode = null;
private static boolean __active = false;
synchronized public static org.omg.CORBA.TypeCode type ()
{
if (__typeCode == null)
{
synchronized (org.omg.CORBA.TypeCode.class)
{
if (__typeCode == null)
{
if (__active)
{
return org.omg.CORBA.ORB.init().create_recursive_tc ( _id );
}
__active = true;
org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember [0];
org.omg.CORBA.TypeCode _tcOf_members0 = null;
__typeCode = org.omg.CORBA.ORB.init ().create_exception_tc (org.omg.CORBA.WrongTransactionHelper.id (), "WrongTransaction", _members0);
__active = false;
}
}
}
return __typeCode;
}
public static String id ()
{
return _id;
}
public static org.omg.CORBA.WrongTransaction read (org.omg.CORBA.portable.InputStream istream)
{
org.omg.CORBA.WrongTransaction value = new org.omg.CORBA.WrongTransaction ();
// read and discard the repository ID
istream.read_string ();
return value;
}
public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.WrongTransaction value)
{
// write the repository ID
ostream.write_string (id ());
}
}
| [
"841617433@qq.com"
] | 841617433@qq.com |
40455a5e8092daa58c4df2b295f11c15e4b42ed8 | 0231cb905dcd12c46929e5d8e6f18a7a8ec912ca | /StarPattern4.java | ed200cdde937eaa7a100bbd43c80478a7aa1145f | [] | no_license | coding4Lif3/JavaMasterClassProjects | 5a08ef42c98f60eb9a4657896280c1493fe57e01 | 773dd01441a0e6b9ac6d5ca3b061a1862a941652 | refs/heads/master | 2022-09-06T11:22:38.985418 | 2020-05-17T11:37:27 | 2020-05-17T11:37:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,169 | java | public class StarPattern4 {
public static void starPattern4(int number) {
for (int i = 1; i <= number; i++) {
for (int j = 1; j <= i; j++) {
System.out.print("*");
}
System.out.println();
}
for (int k = (number-1); k >= 0; k--) { // You could use the same variables i, and j
for (int m = 1; m <= k; m++) { // but I like changing them, and since I do not
System.out.print("*"); // like using the letter l I use m.
}
System.out.println();
}
}
}
//public class StarPattern4 {
//
// public static void starPattern4(int number){
//
// for (int i = 1; i <= number; i++){
// for (int j= 1; j <= i; j++){
// System.out.print("* ");
// }
// System.out.println(" ");
// }
// for (int i = (number-1); i > 0; i--){
// for (int j= 1; j <= i; j++){
// System.out.print("* ");
// }
// System.out.println(" ");
// }
// }
// }
//
| [
"ronroberts@callronroberts.com"
] | ronroberts@callronroberts.com |
af75daa19dc0370e6e6a8df7d5dc94b118bbc262 | c466b5c273b7fdd325ea12f09db9cbb12e8967c0 | /Problem_a.java | 8df2402db4d4e8cd894102efaa75e74bd0c7f961 | [] | no_license | snehalgupta/Competitive-Programming-codes | f883944d9833daee2d9a9a030b2e3e82653720f5 | 8a9ea97c0993fd9a80d7d48ef44f27c961fa51ab | refs/heads/master | 2021-01-24T09:26:27.317609 | 2018-02-26T18:52:15 | 2018-02-26T18:52:15 | 123,015,227 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,848 | java | package pr1;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
class Node{
int val;
int id;
public Node(int v1,int n1){
val=v1;
id=n1;
}
}
class heap{
Node[] harr;
int capacity;
int heap_size;
public heap(int n){
heap_size=0;
capacity=n;
harr=new Node[n];
}
public int parent(int i){
return (i-1)/2;
}
public int left(int i){
return 2*i + 1;
}
public int right(int i){
return 2*i +2;
}
public void insert(Node k){
Node temp;
if(heap_size == capacity){
System.out.println("Overflow");
return;
}
heap_size++;
int i=heap_size-1;
harr[i]=k;
while( i != 0 && harr[parent(i)].val < harr[i].val){
temp=harr[i];
harr[i]=harr[parent(i)];
harr[parent(i)]=temp;
i=parent(i);
}
}
public Node extractmin(){
if(heap_size <= 0){
return null;
}
if(heap_size == 1){
heap_size--;
return harr[0];
}
Node root=harr[0];
//System.out.println("root"+root+" "+harr[0]);
harr[0]=harr[heap_size - 1];
heap_size--;
this.MinHeapify(0);
return root;
}
private void MinHeapify(int i){
Node temp;
int l = left(i);
int r= right(i);
int smallest = i;
if( l < heap_size && harr[l].val > harr[i].val){
smallest=l;
}
if( r < heap_size && harr[r].val > harr[smallest].val){
smallest=r;
}
if( smallest != i){
temp=harr[i];
harr[i]=harr[smallest];
harr[smallest]=temp;
MinHeapify(smallest);
}
}
}
public class Problem_a {
public static void main(String[] args) {
// TODO Auto-generated method stub
Reader.init(System.in);
try{
int n=Reader.nextInt();
int m=Reader.nextInt();
if (n == 1){
int cv=Reader.nextInt();
int res=0;
if(cv <= m){
res=cv;
}
else{
res=findmax(cv,m);}
System.out.println(res);
}
else{
int[] arr=new int[n];
int[] arr1=new int[n];
heap h=new heap(100000);
for(int i=0;i<n;i++){
int vgh=Reader.nextInt();
Node n5=new Node(vgh,i);
h.insert(n5);
arr[i]=1;
arr1[i]=vgh;
}
int c=m-n;
for(int j=1;j<=c;j++){
Node b=h.extractmin();
if (b.val!= 1)
{arr[b.id]+=1;
int cvb=findmax(arr1[b.id],arr[b.id]);
Node ce=new Node(cvb,b.id);
h.insert(ce);}
else{
h.insert(b);
break;
}
}
Node res=h.extractmin();
System.out.println(res.val);
}
} catch (IOException e) {
e.printStackTrace();
}
}
public static int findmax(int max,int bn){
int lo=0;
int hi=max;
int[] arr=new int[max];
for(int j=0;j<max;j++){
arr[j]=1;
}
while(lo < hi){
int x=lo+(hi-lo)/2;
int required = 1,current=0;
for(int i=0;i<max;i++){
if(current+arr[i] <= x){
current+=arr[i];
}
else{
required++;
current=arr[i];
}
}
if(required <= bn){
hi=x;
}
else{
lo=x+1;
}
}
return lo;
}
}
/** Class for buffered reading int and double values */
class Reader {
static BufferedReader reader;
static StringTokenizer tokenizer;
/** call this method to initialize reader for InputStream */
static void init(InputStream input) {
reader = new BufferedReader(
new InputStreamReader(input) );
tokenizer = new StringTokenizer("");
}
/** get next word */
static String next() throws IOException {
while ( ! tokenizer.hasMoreTokens() ) {
//TODO add check for eof if necessary
tokenizer = new StringTokenizer(
reader.readLine() );
}
return tokenizer.nextToken();
}
static int nextInt() throws IOException {
return Integer.parseInt( next() );
}
static double nextDouble() throws IOException {
return Double.parseDouble( next() );
}
} | [
"snehal16201@iiitd.ac.in"
] | snehal16201@iiitd.ac.in |
3accc356fa16ee9c3acf2a63869f20d76239af45 | 8959647c098a26d2e5ed39e960868c3e1d09a43e | /app/src/main/java/com/android/yahoo/sharkfeed/util/EndlessRecyclerViewScrollListener.java | 6aef2a92944baf1a616958b2543f4063c20180ca | [
"Apache-2.0"
] | permissive | saipraneshm/SharkFeed | cf439a7788a58fcc1f57806f8e846e244519923d | b5e009bc6489a35b508f329b74197ac350a54ae4 | refs/heads/master | 2021-03-27T20:02:37.022681 | 2017-10-04T00:34:36 | 2017-10-04T00:34:36 | 94,085,469 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,979 | java | package com.android.yahoo.sharkfeed.util;
import android.content.Context;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
/**
* This abstract class is used to implement endless scrolling.
* Whenever the recycler view reaches the end of the scroll (page), we trigger a method, which
* is then called by the recycler view, this method then perform the operation of loading or
* appending more pages.
*/
public abstract class EndlessRecyclerViewScrollListener extends RecyclerView.OnScrollListener {
private static final String TAG = EndlessRecyclerViewScrollListener.class.getSimpleName();
// The minimum amount of items to have below your current scroll position
// before loading more.
private int visibleThreshold = 5;
// The current offset index of data you have loaded
private int currentPage = 1;
// The total number of items in the dataset after the last load
private int previousTotalItemCount = 0;
// True if we are still waiting for the last set of data to load.
private boolean loading = true;
// Sets the starting page index
private int startingPageIndex = 0;
RecyclerView.LayoutManager mLayoutManager;
private Context mContext;
public EndlessRecyclerViewScrollListener(GridLayoutManager layoutManager, Context context) {
this.mLayoutManager = layoutManager;
visibleThreshold = visibleThreshold * layoutManager.getSpanCount();
mContext = context;
}
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
if(newState == RecyclerView.SCROLL_STATE_IDLE){
int lastVisibleItemPosition = ((GridLayoutManager)mLayoutManager)
.findLastVisibleItemPosition();
int firstVisibleItemPosition = ((GridLayoutManager)mLayoutManager)
.findFirstVisibleItemPosition();
int totalItemCount = mLayoutManager.getItemCount();
int difference = lastVisibleItemPosition - firstVisibleItemPosition;
int start = firstVisibleItemPosition > difference
? firstVisibleItemPosition - difference : firstVisibleItemPosition;
int last = lastVisibleItemPosition + difference < totalItemCount
? lastVisibleItemPosition + difference
: lastVisibleItemPosition;
/* Log.d(TAG, "start " + start + ": " + " last " + ": " + last);
Log.d(TAG, "first visible " + firstVisibleItemPosition + ": " + " last visible " + ": "
+ lastVisibleItemPosition);*/
for(int i = last ; i > start + 10; i-- ){
preloadData(i);
}
}
}
// This happens many times a second during a scroll, so be wary of the code you place here.
// We are given a few useful parameters to help us work out if we need to load some more data,
// but first we check if we are waiting for the previous load to finish.
@Override
public void onScrolled(RecyclerView view, int dx, int dy) {
currentPage = QueryPreferences.getPageNumber(mContext);
int lastVisibleItemPosition = 0;
int totalItemCount = mLayoutManager.getItemCount();
lastVisibleItemPosition = ((GridLayoutManager) mLayoutManager)
.findLastVisibleItemPosition();
// If the total item count is zero and the previous isn't, assume the
// list is invalidated and should be reset back to initial state
if (totalItemCount < previousTotalItemCount) {
Log.d(TAG, "tic < ptic");
this.currentPage = this.startingPageIndex;
this.previousTotalItemCount = totalItemCount;
if (totalItemCount == 0) {
Log.d(TAG, "loading failed");
this.loading = true;
}
}
// If it’s still loading, we check to see if the dataset count has
// changed, if so we conclude it has finished loading and update the current page
// number and total item count.
if (loading && (totalItemCount > previousTotalItemCount)) {
Log.d(TAG, "updating the page count");
loading = false;
previousTotalItemCount = totalItemCount;
}
// If it isn’t currently loading, we check to see if we have breached
// the visibleThreshold and need to reload more data.
// If we do need to reload some more data, we execute onLoadMore to fetch the data.
// threshold should reflect how many total columns there are too
if (!loading && (lastVisibleItemPosition + visibleThreshold) > totalItemCount) {
Log.d(TAG, "incrementing current page: " + currentPage);
currentPage++;
onLoadMore(currentPage, totalItemCount, view);
loading = true;
}
}
// Call this method whenever performing new searches
public void resetState() {
this.currentPage = this.startingPageIndex;
this.previousTotalItemCount = 0;
this.loading = true;
}
//
public void resetToInitialState(){
this.currentPage = 0;
this.previousTotalItemCount = 0;
this.loading = false;
}
// Defines the process for actually loading more data based on page
public abstract void onLoadMore(int page, int totalItemsCount, RecyclerView view);
public abstract void preloadData(int itemPosition);
public void setCurrentPage(int currentPage) {
this.currentPage = currentPage;
}
public int getCurrentPage() {
return currentPage;
}
}
| [
"saipranesh.mukkala@sjsu.edu"
] | saipranesh.mukkala@sjsu.edu |
77c9c06fd3ab9ae01438fa9dba9cb7032f6615be | 1005a937a93cd175addf63ef0c0da4ad31882bce | /promotion-service/src/test/java/com/meru/promotion/service/PromotionServiceTest1.java | a7bcd47f631f2ca9fd60c655289178cf8f9ccaf7 | [] | no_license | subho911/meru | 0c2e31b2e9b1e5380392e267725fdcc7d8c63e4e | 194d1f19b00d34f21802df3160816d2654556d2a | refs/heads/master | 2020-05-26T01:53:26.756936 | 2019-05-30T12:07:14 | 2019-05-30T12:07:14 | 188,065,825 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 631 | java | package com.meru.promotion.service;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;
public class PromotionServiceTest1 {
@Before
public void setUp() throws Exception {
}
@Test
public void savePromotion() {
}
@Test
public void findAllPromotions() {
}
@Test
public void findById() {
}
@Test
public void findByName() {
}
@Test
public void updatePromotion() {
}
@Test
public void deleteAllPromotions() {
}
@Test
public void deleteSelectedPromoton() {
}
} | [
"subhadip.debnath@wipro.com"
] | subhadip.debnath@wipro.com |
d0d84100fc37760e1c1f39396955f60281c826bf | 6ceb586fefcf0263da6a17892f2b4ce96fe27ebf | /RetoMapsSave/app/build/tmp/kapt3/stubs/debug/com/example/persistence/data/local/AppDatabase.java | 208014cb765c1978e61871c9725885e127b21997 | [] | no_license | xSoek/MapsLocator | e5f3cae3b1f2ca719bb45bc0518fde8fbefa698a | 3625c94538cd0cf047797246e4e80c6f6dfa42b4 | refs/heads/master | 2020-09-06T14:06:44.820188 | 2019-11-08T13:39:54 | 2019-11-08T13:39:54 | 220,443,073 | 0 | 0 | null | 2019-11-08T13:51:24 | 2019-11-08T10:27:07 | Java | UTF-8 | Java | false | false | 872 | java | package com.example.persistence.data.local;
import java.lang.System;
@androidx.room.Database(entities = {com.example.retomapssave.Dao.Location.class}, version = 1)
@kotlin.Metadata(mv = {1, 1, 15}, bv = {1, 0, 3}, k = 1, d1 = {"\u0000\u0012\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\b\'\u0018\u00002\u00020\u0001B\u0005\u00a2\u0006\u0002\u0010\u0002J\b\u0010\u0003\u001a\u00020\u0004H&\u00a8\u0006\u0005"}, d2 = {"Lcom/example/persistence/data/local/AppDatabase;", "Landroidx/room/RoomDatabase;", "()V", "locationDao", "Lcom/example/retomapssave/Dao/LocationDao;", "app_debug"})
public abstract class AppDatabase extends androidx.room.RoomDatabase {
@org.jetbrains.annotations.NotNull()
public abstract com.example.retomapssave.Dao.LocationDao locationDao();
public AppDatabase() {
super();
}
} | [
"jorge.depazcabanas@gmail.com"
] | jorge.depazcabanas@gmail.com |
d78f2985814c635d9d684c62d6b974eb1e6e2c83 | cfd1db71724edcbfbb6c95eb4274e672d60b77e5 | /Dispensador/app/src/main/java/com/example/ana/dispensador/cubacaguaActivity.java | 48524bdc87fbb370ea563c950c456e0c92411336 | [] | no_license | melquizedecm/androidStudio | 53f5b0f9f8067cf21d0a9da7fdfa5b75e1c73acb | 86008843709cda6445b71cbea77287d6275eb23f | refs/heads/master | 2020-04-01T03:17:29.125605 | 2019-09-08T02:55:15 | 2019-09-08T02:55:15 | 152,816,324 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,430 | java | package com.example.ana.dispensador;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothSocket;
import android.content.Intent;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.UUID;
public class cubacaguaActivity extends AppCompatActivity {
private TextView menu, ok;
Handler bluetoothIn;
final int handlerState = 0;
private BluetoothAdapter btAdapter = null;
private BluetoothSocket btSocket = null;
private StringBuilder DataStringIN = new StringBuilder();
private ConnectedThread MyConexionBT;
private static final UUID BTMODULEUUID = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");
private static String address = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_cubacagua);
menu = (TextView) findViewById(R.id.btnmenu);
ok = (TextView) findViewById(R.id.btnok);
bluetoothIn = new Handler() {
public void handleMessage(android.os.Message msg) {
if (msg.what == handlerState) {
String readMessage = (String) msg.obj;
DataStringIN.append(readMessage);
int endOfLineIndex = DataStringIN.indexOf("#");
if (endOfLineIndex > 0) {
String dataInPrint = DataStringIN.substring(0, endOfLineIndex);
Toast.makeText(getBaseContext(), "Bluetooth: " + dataInPrint, Toast.LENGTH_LONG).show();
DataStringIN.delete(0, DataStringIN.length());
}
}
}
};
menu.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(cubacaguaActivity.this, MenuActivity.class);
startActivity(intent);
finish();
}
});
ok.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//Mandar caracter al bluetooth
MyConexionBT.write("8");
Intent intent = new Intent(cubacaguaActivity.this, MenuActivity.class);
startActivity(intent);
finish();
}
});
btAdapter = BluetoothAdapter.getDefaultAdapter();
VerificarEstadoBT();
}
private BluetoothSocket createBluetoothSocket(BluetoothDevice device) throws IOException
{
return device.createRfcommSocketToServiceRecord(BTMODULEUUID);
}
@Override
public void onResume() {
super.onResume();
//Consigue la direccion MAC desde DeviceListActivity via intent
Intent intent = getIntent();
//Consigue la direccion MAC desde DeviceListActivity via EXTRA
address = intent.getStringExtra(DeviceListActivity.EXTRA_DEVICE_ADDRESS);
//Setea la direccion MAC
BluetoothDevice device = btAdapter.getRemoteDevice(address);
try {
btSocket = createBluetoothSocket(device);
} catch (IOException e) {
Toast.makeText(getBaseContext(), "La creacción del Socket fallo", Toast.LENGTH_LONG).show();
}
// Establece la conexión con el socket Bluetooth.
try {
btSocket.connect();
} catch (IOException e) {
try {
btSocket.close();
} catch (IOException e2) {}
}
MyConexionBT = new ConnectedThread(btSocket);
MyConexionBT.start();
}
@Override
public void onPause() {
super.onPause();
try { // Cuando se sale de la aplicación esta parte permite
// que no se deje abierto el socket
btSocket.close();
} catch (IOException e2) {}
}
//Comprueba que el dispositivo Bluetooth Bluetooth está disponible y solicita que se active si está desactivado
private void VerificarEstadoBT() {
if(btAdapter==null) {
Toast.makeText(getBaseContext(), "El dispositivo no soporta bluetooth", Toast.LENGTH_LONG).show();
} else {
if (btAdapter.isEnabled()) {
} else {
Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
startActivityForResult(enableBtIntent, 1);
}
}
}
class ConnectedThread extends Thread {
private final InputStream mmInStream;
private final OutputStream mmOutStream;
public ConnectedThread(BluetoothSocket socket) {
InputStream tmpIn = null;
OutputStream tmpOut = null;
try {
tmpIn = socket.getInputStream();
tmpOut = socket.getOutputStream();
} catch (IOException e) { }
mmInStream = tmpIn;
mmOutStream = tmpOut;
}
public void run() {
byte[] buffer = new byte[256];
int bytes;
// Se mantiene en modo escucha para determinar el ingreso de datos
while (true) {
try {
bytes = mmInStream.read(buffer);
String readMessage = new String(buffer, 0, bytes);
// Envia los datos obtenidos hacia el evento via handler
bluetoothIn.obtainMessage(handlerState, bytes, -1, readMessage).sendToTarget();
} catch (IOException e) {
break;
}
}
}
//Envio de trama
public void write(String input) {
try {
mmOutStream.write(input.getBytes());
}
catch (IOException e) {
Toast.makeText(getBaseContext(), "La Conexión fallo", Toast.LENGTH_LONG).show();
finish();
}
}
}
}
| [
"melqui21@hotmail.com"
] | melqui21@hotmail.com |
999cd83b1c042c1a4d9411728a7d7a1eb28c56c6 | ace645abcb3c3f37d4009aa5ea695d1fecabd7ea | /src/main/java/pages/telecomunications/MobilePhoneReplenishmentPage.java | 05fa221955d6b78dbb382e04b97fdac5dc962526 | [] | no_license | RomanKly/autoTestSelenium | 11ad404a41f64cdf1774817e96f01f07ab65b2c8 | 29a690f8ab6958996d4f3e498723eaff67ae881e | refs/heads/main | 2023-07-02T03:06:39.904469 | 2021-07-30T13:02:13 | 2021-07-30T13:02:13 | 391,061,812 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,182 | java | package pages.telecomunications;
import org.junit.jupiter.api.Assertions;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import pages.base.BasePage;
public class MobilePhoneReplenishmentPage extends BasePage {
public MobilePhoneReplenishmentPage(WebDriver driver) {
super(driver);
}
private final By buttonWallet = By.xpath("//div[text()='My wallet']");
private final By inputCardNumber = By.xpath("//input[@data-qa-node='numberdebitSource']");
private final By inputCardExpDate = By.xpath("//input[@data-qa-node='expiredebitSource']");
private final By inputCardCvv = By.xpath("//input[@data-qa-node='cvvdebitSource']");
private final By inputPhoneNumber = By.xpath("//input[@data-qa-node='phone-number']");
private final By inputAmount = By.xpath("//input[@data-qa-node='amount']");
private final By buttonSubmitToTheCart = By.xpath("//button[@data-qa-node='submit']");
private final By paymentDetails = By.xpath("//span[@data-qa-node='details']");
private final By inputFirstName = By.xpath("//input[@data-qa-node='firstNamedebitSource']");
private final By inputLastName = By.xpath("//input[@data-qa-node='lastNamedebitSource']");
/*
* Choose a card from the wallet
*/
public MobilePhoneReplenishmentPage SelectCardFromWallet(){
driver.findElement(buttonWallet).click();
return this;
}
/**
* @param number phone number
*/
public MobilePhoneReplenishmentPage enterForNumber(String number){
driver.findElement(inputPhoneNumber).sendKeys(number);
return this;
}
/**
* @param amount amount
*/
public MobilePhoneReplenishmentPage enterAmount(String amount){
driver.findElement(inputAmount).sendKeys(amount);
return this;
}
/**
* @param numberCard number card
*/
public MobilePhoneReplenishmentPage enterForCardNumber(String numberCard){
driver.findElement(inputCardNumber).sendKeys(numberCard);
return this;
}
/**
* @param expDate eperation date
*/
public MobilePhoneReplenishmentPage enterCardExpDate(String expDate){
driver.findElement(inputCardExpDate).sendKeys(expDate);
return this;
}
/**
* @param cvv card cvv
*/
public MobilePhoneReplenishmentPage enterCvv(String cvv){
driver.findElement(inputCardCvv).sendKeys(cvv);
return this;
}
public MobilePhoneReplenishmentPage enterFirstName(String firstName){
waitElementIsVisible(driver.findElement(inputFirstName));
driver.findElement(inputFirstName).sendKeys(firstName);
return this;
}
public MobilePhoneReplenishmentPage enterLastName(String lastName){
waitElementIsVisible(driver.findElement(inputLastName));
driver.findElement(inputLastName).sendKeys(lastName);
return this;
}
/*
* click button To the card
*/
public MobilePhoneReplenishmentPage submitToTheCard(){
driver.findElement(buttonSubmitToTheCart).click();
return this;
}
/**
* @param text text message Mobil top-up
**/
public MobilePhoneReplenishmentPage checkPaymentDetails(String text){
waitElementIsVisible(driver.findElement(paymentDetails));
WebElement details = driver.findElement(paymentDetails);
Assertions.assertEquals(text, details.getText());
return this;
}
}
| [
"32329159+RomanKly@users.noreply.github.com"
] | 32329159+RomanKly@users.noreply.github.com |
0276239cccff3e24a16ec31f78d1f5da065956fc | 9e9169ecfb97e5d6b5cfe34b19bff1ff3de4a35e | /AndroidStudioProjects/MailSendWithoutIntent/app/src/main/java/com/example/mailsendwithoutintent/MainActivity.java | d9d6dbf7056e7a848d3390a66054a2be422eb1b7 | [] | no_license | vigneshnarayana/Source-code | 1d3de1da0e02af97a9ddf956699d3dca108afaad | 02b264e89889488251e44420192ba3f4e363d531 | refs/heads/main | 2023-04-03T10:48:32.819385 | 2021-03-25T05:26:36 | 2021-03-25T05:26:36 | 351,312,710 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,280 | java | package com.example.mailsendwithoutintent;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
private EditText email, subject, message;
private Button button;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
email = findViewById(R.id.email);
subject = findViewById(R.id.subject);
message = findViewById(R.id.message);
button = findViewById(R.id.btn);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
senEmail();
}
});
}
private void senEmail() {
String mEmail = email.getText().toString();
String mSubject = subject.getText().toString();
String mMessage = message.getText().toString();
JavaMailAPI javaMailAPI = new JavaMailAPI(this, mEmail, mSubject, mMessage);
javaMailAPI.execute();
Toast.makeText(this, "Sended", Toast.LENGTH_SHORT).show();
}
} | [
"vikivignesh28599@gmail.com"
] | vikivignesh28599@gmail.com |
aa549afac122eae9f0f4a19238946c475f0cd6b4 | 9d052249c3df9b494191dd1a331722522fcdd977 | /java-leet-code/src/main/java/com/example/Solution2.java | 4b7d63b6e28b0ab70aa3d7ac3cc4c8ecd8d1a1ac | [] | no_license | jinglv/java-sample | c7aed4192991c2080e94d42a46e46b385b5cf185 | d2eaf5dfc648066ff85f85f73cc13b1592ac4e18 | refs/heads/master | 2022-07-19T07:45:43.000112 | 2021-01-15T11:11:30 | 2021-01-15T11:11:30 | 250,814,553 | 0 | 0 | null | 2022-06-17T03:29:25 | 2020-03-28T14:24:46 | Java | UTF-8 | Java | false | false | 1,811 | java | package com.example;
/**
* @author jingLv
* @date 2021/01/07
*/
public class Solution2 {
public static void main(String[] args) {
int[] num = {5, 5, 5, 10, 5, 5, 10, 20, 20, 20};
boolean b = lemonadeChange(num);
System.out.println(b);
}
public static boolean lemonadeChange(int[] bills) {
// 统计店员所拥有的5元和10元的数量(20元的不需要统计,
// 因为顾客只能使用5元,10元和20元,而20元是没法给顾客找零的)
int fiveCount = 0;
int tenCount = 0;
// 循环遍历拥有的纸币
for (int bill : bills) {
// 如果顾客使用的是5元,不用找零,5元数量加1
if (bill == 5) {
fiveCount++;
} else if (bill == 10) {
//如果顾客使用的是10元,需要找他5元,所以5元数量减1,10元数量加1
fiveCount--;
tenCount++;
} else if (tenCount > 0) {
//否则顾客使用的只能是20元,顾客使用20元的时候,如果我们有10元的,要尽量先给他10元的,然后再给他5元的,所以这里5元和10元数量都要减1
fiveCount--;
tenCount--;
} else {
//如果顾客使用的是20元,而店员没有10元的,就只能给他找3个5元的,所以5元的数量要减3
fiveCount -= 3;
}
// 上面我们找零的时候并没有判断5元的数量,如果5元的数量小于0,说明上面某一步找零的时候5元的不够了,也就是说没法给顾客找零,直接返回false即可
if (fiveCount < 0) {
return false;
}
}
return true;
}
}
| [
"lvjing@renmaitech.com"
] | lvjing@renmaitech.com |
efdeb2255dda88b99a1a2f3cb2fbfe75ea8b1687 | 15ef8ec1f9745ed019ea65bed08eec473cead6a7 | /luyten-0.4.3/org/fife/ui/rsyntaxtextarea/TokenFactory.java | 47b97f890983765fe97478c43eec608be063d314 | [] | no_license | dcyjukxm/Procyon-Luyten | 671a2b49cd51f4be9709f050ba27cf2cf4fd0a8c | 1f8f4877f2e54379bc8507fd51a5b1914ea83960 | refs/heads/master | 2021-07-02T18:05:36.366368 | 2017-09-25T00:06:02 | 2017-09-25T00:06:02 | 104,684,998 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 355 | java | package org.fife.ui.rsyntaxtextarea;
import javax.swing.text.*;
interface TokenFactory
{
TokenImpl createToken();
TokenImpl createToken(Segment param_0, int param_1, int param_2, int param_3, int param_4);
TokenImpl createToken(char[] param_0, int param_1, int param_2, int param_3, int param_4);
void resetAllTokens();
}
| [
"22905289+dcyjukxm@users.noreply.github.com"
] | 22905289+dcyjukxm@users.noreply.github.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.