blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
sequencelengths
1
1
author_id
stringlengths
0
313
50c16921966735f8d7a293945f8211f06146b069
a515469a3ebeb9d6364f70b99805947267c975a0
/src/main/java/com/jiwon/book/chap11/MemberDao.java
11f669ddccee53d216f5289f3e8215de55d9519c
[]
no_license
jiwonxx/jiwon-springweb
a188a2c9b867838e7042f00c6a65e2870be15078
1b6336043a820aef79952246973ab03645ed3e51
refs/heads/master
2020-05-21T06:05:10.706622
2019-06-07T07:37:24
2019-06-07T07:37:24
185,934,638
0
0
null
null
null
null
UTF-8
Java
false
false
2,159
java
package com.jiwon.book.chap11; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.BeanPropertyRowMapper; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.RowMapper; import org.springframework.stereotype.Repository; /** * SpringJdbc를 사용해서 구현 * * @author Jacob */ @Repository public class MemberDao { static final String INSERT = "INSERT member(email, password, name) VALUES(?, sha2(?,256), ?)"; static final String SELECT_ALL = "SELECT memberId, email, name, left(cdate,19) cdate FROM member ORDER BY memberId desc LIMIT ?,?"; static final String COUNT_ALL = "SELECT count(memberId) count FROM member"; static final String SELECT_BY_LOGIN = "SELECT memberId, email, password, name FROM member WHERE (email,password) = (?,sha2(?,256))"; static final String CHANGE_PASSWORD = "UPDATE member SET password=sha2(?,256) WHERE (memberId, password)=(?, sha2(?,256))"; @Autowired JdbcTemplate jdbcTemplate; final RowMapper<Member> memberRowMapper = new BeanPropertyRowMapper<>( Member.class); /** * p.201 [리스트 8.12]의 insert() 메서드 수정. 회원 등록 */ public void insert(Member member) { jdbcTemplate.update(INSERT, member.getEmail(), member.getPassword(), member.getName()); } /** * p.195 [리스트 8.9] selectAll() 메서드 수정. 회원 목록 */ public List<Member> selectAll(int offset, int count) { return jdbcTemplate.query(SELECT_ALL, memberRowMapper, offset, count); } /** * 회원 수 */ public int countAll() { return jdbcTemplate.queryForObject(COUNT_ALL, Integer.class); } /** * 이메일과 비밀번호로 멤버 가져오기. 로그인 할 때 사용한다. */ public Member selectByLogin(String email, String password) { return jdbcTemplate.queryForObject(SELECT_BY_LOGIN, memberRowMapper, email, password); } /** * 비밀번호 변경 */ public int changePassword(String memberId, String currentPassword, String newPassword) { return jdbcTemplate.update(CHANGE_PASSWORD, newPassword, memberId, currentPassword); } }
437b37259309301f15876d7c4b3fd3b961416770
246e04969a83826267a6716060c2ea773c9ac7b4
/PepperSayList/PepperSayList/app/src/main/java/andorid/ohwada/jp/peppersaylist/CreateActivity.java
7b0cb0af9e9fef2d8c78f90fff1db4383ce5a866
[]
no_license
OmicronWang/Pepper_Android
4cdf304679a35b438c4bd40aed18d3033e605194
90998390031d4962375c826106d3b0c377809c2d
refs/heads/master
2020-06-11T09:31:31.184090
2015-10-04T08:02:21
2015-10-04T08:02:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,190
java
/** * Pepper controlled by Android * 2015-08-01 K.OHWADA */ package andorid.ohwada.jp.peppersaylist; import android.content.Intent; import android.os.Bundle; import android.view.View; /** * Create record */ public class CreateActivity extends SqlCommonActivity { // flag from MainActivity private boolean isAdd = false; /** * === onCreate === * @param Bundle savedInstanceState */ @Override public void onCreate( Bundle savedInstanceState ) { super.onCreate( savedInstanceState ); execCreate(); // hide update & delete button mButtonUpdate.setVisibility( View.GONE ); mButtonDelete.setVisibility( View.GONE ); // show showRocord(); } /** * show rocord */ private void showRocord() { isAdd = false; clearText(); // get id from bundle Intent intent = getIntent(); Bundle bundle = intent.getExtras(); // check bundle if ( bundle == null ) return; String msg = bundle.getString( BUNDLE_EXTRA_MSG ); // check id if ( "".equals( msg ) ) return; // set EditText mEditTextMsg.setText( msg ); isAdd = true; } /**= * --- onClick Create --- */ @Override public void onClickRecCreate( View v ) { createRecord(); clearText(); } /** * create record */ private void createRecord() { // get value String msg = getEditTextMsg(); if ( "".equals(msg) ) { toast_short( R.string.toast_please_enter ); return; } // save to DB MsgRecord r = new MsgRecord( getEditTextTitle(), msg ) ; long ret = mHelper.insert( r ); // message if ( ret > 0 ) { toast_short( R.string.toast_create_success ); } else { toast_short( R.string.toast_create_failed ); } // delete if Over mHelper.deleteIfOver(); // finish and back if from MainActivity if ( isAdd ) finish(); } }
165dbde67a5bf5cff78e2f198a3c0f950c6fe371
70bc03244df8f0f8cadec0cb83769e5035d0ba50
/src/main/java/com/dachen/springweb/rabbitmq/routing/EmitLogDirect.java
2297b5a6df64e3c2bf65dc41cb7ca1b0c6a34aa3
[]
no_license
zhongh08/springweb
3f5841f90b04cd9a8066b5aec8064b8b83e6e66a
065962be566658f3a9eb6b35745ee248587bba94
refs/heads/master
2023-07-20T00:26:38.934074
2019-08-22T09:20:54
2019-08-22T09:20:54
142,514,051
0
0
null
null
null
null
UTF-8
Java
false
false
960
java
package com.dachen.springweb.rabbitmq.routing; import com.rabbitmq.client.Channel; import com.rabbitmq.client.Connection; import com.rabbitmq.client.ConnectionFactory; public class EmitLogDirect { private static final String EXCHANGE_NAME = "direct_logs"; public static void main(String[] argv) throws java.io.IOException, java.util.concurrent.TimeoutException{ ConnectionFactory factory = new ConnectionFactory(); factory.setHost("localhost"); Connection connection = factory.newConnection(); Channel channel = connection.createChannel(); channel.exchangeDeclare(EXCHANGE_NAME, "direct"); String severity = "severity123"; String message = "message123"; channel.basicPublish(EXCHANGE_NAME, severity, null, message.getBytes()); System.out.println(" [x] Sent '" + severity + "':'" + message + "'"); channel.close(); connection.close(); } }
5b9a59aac5fd6450a60eae033890620ceb7c1cc7
e5b295ea5d4e519be0d83ba61ed3f915db0d1e3c
/spring-boot-oauth2-resource/src/test/java/com/guide/oauth2/resource/common/RestDocsConfiguration.java
64f79d336467ff6c4537f1d5ee3840589a2b7d03
[]
no_license
uchupura/spring-boot-guides
a69415e725b9e03bee7697c14010ba8bee12e4bf
94f797ff8ed31be962fc3a1d276a3329d02d14d7
refs/heads/master
2023-06-15T22:16:34.721741
2021-07-13T02:25:04
2021-07-13T02:25:04
305,999,225
2
0
null
null
null
null
UTF-8
Java
false
false
692
java
package com.guide.oauth2.resource.common; import org.springframework.boot.test.autoconfigure.restdocs.RestDocsMockMvcConfigurationCustomizer; import org.springframework.boot.test.context.TestConfiguration; import org.springframework.context.annotation.Bean; import static org.springframework.restdocs.operation.preprocess.Preprocessors.prettyPrint; @TestConfiguration public class RestDocsConfiguration { @Bean public RestDocsMockMvcConfigurationCustomizer restDocsMockMvcConfigurationCustomizer() { return configurer -> configurer.operationPreprocessors() .withRequestDefaults(prettyPrint()) .withResponseDefaults(prettyPrint()); } }
0a8e07010a6a382e394591246096ce177c1862df
d48cfe7bb65c3169dea931f605d62b4340222d75
/chinahrd-hrbi/base/src/main/java/net/chinahrd/eis/permission/model/RbacPermission.java
cb71911ffbc6842bb544c062bbf5cc161cb05112
[]
no_license
a559927z/doc
7b65aeff1d4606bab1d7f71307d6163b010a226d
04e812838a5614ed78f8bbfa16a377e7398843fc
refs/heads/master
2022-12-23T12:09:32.360591
2019-07-15T17:52:54
2019-07-15T17:52:54
195,972,411
0
0
null
2022-12-16T07:47:50
2019-07-09T09:02:38
JavaScript
UTF-8
Java
false
false
708
java
package net.chinahrd.eis.permission.model; import java.io.Serializable; public class RbacPermission implements Serializable { private static final long serialVersionUID = 8739783846731071660L; private String fullPath; private String itemCodes; private String roleKey; public String getFullPath() { return fullPath; } public void setFullPath(String fullPath) { this.fullPath = fullPath; } public String getItemCodes() { return itemCodes; } public void setItemCodes(String itemCodes) { this.itemCodes = itemCodes; } public String getRoleKey() { return roleKey; } public void setRoleKey(String roleKey) { this.roleKey = roleKey; } }
9c9d07413e2de716c4e4d24261f5ae838c33fd6b
69e96c420779d9088d1bce14174f9edb95e3c0ea
/src/main/java/com/imooc/miaosha/result/Result.java
4cf6fd7e3173e1c49bb8e58666116da1970c440d
[]
no_license
CharlotteZeng/miaosha
f804c387225329536f6b4217a93dc62a6ee965a3
d88f909cb157534f50569c947c2db0097db3e8a2
refs/heads/master
2022-06-21T13:14:17.232498
2020-06-29T12:29:00
2020-06-29T12:30:15
240,858,413
0
0
null
2022-06-17T02:54:46
2020-02-16T08:41:16
Java
UTF-8
Java
false
false
1,016
java
package com.imooc.miaosha.result; import com.imooc.miaosha.domain.User; public class Result<T> { private int code; private String msg; private T data; private Result(T data) { this.code = CodeMsg.SUCCESS.getCode(); this.msg = CodeMsg.SUCCESS.getMsg(); this.data = data; } public static <T> Result success(T data){ return new Result<T>(data); } public static <T> Result<T> error(CodeMsg cm){ return new Result<T>(cm); } public Result(CodeMsg cm) { if (cm==null) return; this.code=cm.getCode(); this.msg=cm.getMsg(); } public int getCode() { return code; } public void setCode(int code) { this.code = code; } public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } public T getData() { return data; } public void setData(T data) { this.data = data; } }
e464a5bc0f415a98869eb98140ecbebf3648fe83
48bbb84c3b4b453b2b86b3e0876836b5559d29d5
/sample/src/main/java/space/darkowlzz/google_sheets2android/Team.java
d7db2d03038e8d8a67e9c9d31646201d9080c4ab
[ "MIT" ]
permissive
darkowlzz/gsheets2a
494a17c1ca40085404cc4c02591cff3e75db1a24
0eeb420a39ba849a3adebf2fdb0afaaa6866fc55
refs/heads/master
2016-08-11T13:26:26.887997
2016-01-20T10:18:01
2016-01-20T10:18:01
48,430,355
1
0
null
null
null
null
UTF-8
Java
false
false
492
java
package space.darkowlzz.google_sheets2android; import java.util.ArrayList; import space.darkowlzz.gsheets2a.GSheets2A; public class Team implements GSheets2A.DataObject { String name; Integer totalWins; @Override public void saveData(ArrayList<String> data) { // As per the table https://docs.google.com/spreadsheets/d/1tJ64Y8hje0ui4ap9U33h3KWwpxT_-JuVMSZzxD2Er8k name = data.get(1); totalWins = Math.round(Float.parseFloat(data.get(3))); } }
d1ab288f277d232ace8ad83879e50da6550ac199
14b84f05ffbd10000dec888027bf63425b815a7b
/app/src/main/java/com/example/myapplication/AddImg.java
069a92b35f017200e1d3ddb9a02a89e7278c4b7f
[]
no_license
Adarsh2801-r/Track_and_Trigger
7899b6ca1cc53dc2c38e034999d8c6c8a7941dc9
1a9de223761f184070f366938d9bc94f0017f119
refs/heads/master
2023-04-17T16:34:43.112607
2021-04-25T17:42:55
2021-04-25T17:42:55
308,632,236
0
1
null
null
null
null
UTF-8
Java
false
false
2,250
java
package com.example.myapplication; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.net.Uri; import android.os.Bundle; import android.os.Environment; import android.provider.MediaStore; import android.view.View; import android.widget.Button; import android.widget.ImageView; import java.io.File; import java.io.FileOutputStream; public class AddImg extends AppCompatActivity { private static final int GALLERY_REQUEST_CODE = 123; ImageView imageView; Button pick_btn; Button btn; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_add_img); imageView = findViewById(R.id.imageView3); pick_btn = findViewById(R.id.button2); btn = findViewById(R.id.button4); pick_btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent.createChooser(intent,"Pick an image"),GALLERY_REQUEST_CODE); } }); btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_TEXT, "Image"); sendIntent.setType("text/plain"); Intent shareIntent = Intent.createChooser(sendIntent, null); startActivity(shareIntent); } }); } @Override protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == GALLERY_REQUEST_CODE && resultCode == RESULT_OK && data != null) { Uri imageData = data.getData(); imageView.setImageURI(imageData); } } }
759ca8ffff9f3a7a7cb199b551e9e983d2f876ec
6eff6d5a38a09886d3a851f93d88c1e1a507d5b3
/src/com/keertech/demo/bean/extend/GenericDepartment.java
f8e8997a064d52fb3ee5ca2226f5496be076ea19
[]
no_license
KenySee/Ext4JXC
95b7eef76f77584e71c1defa25e0cc2410834e29
acaa3d022e05a345af5371e96657446572558506
refs/heads/master
2021-08-22T13:41:03.478153
2017-11-30T09:50:53
2017-11-30T09:50:53
103,358,881
1
0
null
null
null
null
UTF-8
Java
false
false
308
java
package com.keertech.demo.bean.extend; import javax.persistence.Entity; import com.keer.core.annotation.Description; import com.keer.core.bean.organization.Department; @Entity @Description(Name="部门",Icon="folder_key") @SuppressWarnings("serial") public class GenericDepartment extends Department { }
6431195ebe6f918d4f9c1fc73dc576d5066a4291
3957681394478c52508742b7bb82f5e9e18370a1
/app/src/androidTest/java/com/example/alumfial1/factorial_igorcb/ExampleInstrumentedTest.java
70405964542b810cd9e12223aed550a88ac02e3f
[]
no_license
igorchipana/Factorial_IgorCB
bbd1e6f60b7d0a5d52eb83d00de965828968a96a
6828fabbf5750503d64edceab7ef3ab746826479
refs/heads/master
2020-03-10T03:14:17.271290
2018-04-11T22:00:36
2018-04-11T22:00:36
129,159,082
0
0
null
null
null
null
UTF-8
Java
false
false
777
java
package com.example.alumfial1.factorial_igorcb; 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() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.example.alumfial1.factorial_igorcb", appContext.getPackageName()); } }
882564c5626a9a2e4e38b13c3049afda5c70abde
9d9bb5df280b7ae0013fc4a331dd9585aadcaefc
/SumRootToLeafNumbers/Solution.java
303bc38523300bcc152cd801c7774c3a47b0bda5
[]
no_license
tinyfox266/leetcode
70f54a61372aba00145c60099b8717a1fed62ea9
5d7698f55949589a60060521d3c9c1d11de54636
refs/heads/master
2021-01-10T02:35:10.055484
2015-09-04T12:28:41
2015-09-04T12:28:41
35,986,165
0
0
null
null
null
null
UTF-8
Java
false
false
937
java
public class Solution { public int sumNumbers(TreeNode root) { if (root == null) return 0; List<String> allPaths = allPaths(root); int sum=0; for (String s:allPaths) { sum += Integer.parseInt(s); } return sum; } public List<String> allPaths(TreeNode root) { List<String> res = new LinkedList<String>(); if (root.left == null && root.right == null) { res.add(Integer.toString(root.val)); } if (root.left != null) { List<String> leftPaths = allPaths(root.left); for (String s: leftPaths) { res.add(root.val + s); } } if (root.right != null) { List<String> rightPaths = allPaths(root.right); for (String s: rightPaths) { res.add(root.val + s); } } return res; } }
4b554a3e7435ab5aa69cad65d2f1f892d661d4b0
3a9ef46b5c63fb131d62658190a3670ec4833de6
/Concurrency/src/p130717/StopExample.java
6fb4e880ede23d935e48828dfd1d7738fd725b47
[]
no_license
XRater/EPAM-Java-Course-2017
3ad57d439be9991fc4b96d995f06ec36f24eb0ad
ca6d482a9f7e19aee08a98352b050f92214a6408
refs/heads/master
2020-12-02T22:53:33.802206
2017-08-10T00:15:13
2017-08-10T00:15:13
96,197,813
0
0
null
null
null
null
UTF-8
Java
false
false
965
java
package p130717; import utlis.Utils; import javax.naming.event.ObjectChangeListener; import java.util.Arrays; public class StopExample { static class Task implements Runnable { Object lock = new Object(); int x = 0; int y = 0; @Override public void run() { synchronized (lock) { x += 10; Utils.pause(1000); y -= 10; } } public int[] get() { int[] result = new int[2]; synchronized (lock) { result[0] = x; result[1] = y; } return result; } } public static void main(String[] args) { System.out.println("start"); Task t = new Task(); Thread thread = new Thread(t); thread.start(); Utils.pause(200); thread.stop(); System.out.println(Arrays.toString(t.get())); } }
df82fb9b5809c4050fc53cb521fe0612fdc2f4ae
df06a6afa03911c2ff30390cf2675392741beffa
/QuickLauncher Src/app/src/androidTest/java/lynxdom/com/quicklauncher/ExampleInstrumentedTest.java
279e645feafec7858a54b2bcc7c28aae4cf80b76
[]
no_license
llum6003/Android-Studio-Part-1-4
0bb91070674f9938b9f2be0a000eda70307f6d95
544ecf65dceb6c6241622f515288d0fe802ac531
refs/heads/master
2020-04-05T22:12:42.868650
2018-11-15T17:05:33
2018-11-15T17:05:33
157,248,794
0
0
null
null
null
null
UTF-8
Java
false
false
734
java
package lynxdom.com.quicklauncher; 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("lynxdom.com.quicklauncher", appContext.getPackageName()); } }
83e85b0986d5626c23cc4690ba1d3cbb9cd8a016
289a3eadd2a26fc7f82ca0d58a29902b753dcee3
/craft3data/src/com/hiveworkshop/wc3/gui/modeledit/selection/VertexSelectionHelper.java
947726c2788172cf6b0817a0fcad719da516e122
[ "MIT" ]
permissive
Retera/ReterasModelStudio
e6cfe3099eed1c6426dff34f2f965ca040597d34
2b7c9f0c223874381074f4e04f82442f03a8ec53
refs/heads/master
2023-08-30T19:26:33.917185
2023-06-02T03:00:14
2023-06-02T03:00:14
39,873,368
59
18
null
2021-05-30T21:14:35
2015-07-29T04:32:41
Java
UTF-8
Java
false
false
220
java
package com.hiveworkshop.wc3.gui.modeledit.selection; import java.util.Collection; import com.hiveworkshop.wc3.mdl.Vertex; public interface VertexSelectionHelper { void selectVertices(Collection<Vertex> vertices); }
8b77156f31f963f15c87a8014dadea16d06ba5b8
ab1c88065da70ca0346fd1f0ac50877e10161832
/src/it/unisa/codeSmellAnalyzer/beans/InvocationBean.java
cd7fedd459e5a67f2ae8bfe41ee52efed6a62f6e
[]
no_license
DustinLim/mscthesis-preprocessor
4d9136e1defabf4da3816e67e7323642d6738d49
86885eab99f1962816e2c3699d811d294ad6bfb5
refs/heads/master
2021-05-12T05:33:17.674345
2017-02-11T21:53:44
2018-01-17T06:37:43
117,196,829
0
1
null
null
null
null
UTF-8
Java
false
false
1,659
java
package it.unisa.codeSmellAnalyzer.beans; import org.eclipse.jdt.core.dom.ASTNode; import org.eclipse.jdt.core.dom.MethodInvocation; public class InvocationBean { private MethodInvocation node; private String uid; private String name; private boolean isChainedMethodCall; private String belongingClassName; private int lineNumber; public MethodInvocation getNode() { return node; } public void setNode(MethodInvocation node) { this.node = node; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getUID() { return uid; } public void setUID(String uid) { this.uid = uid; } public boolean isChainedMethodCall() { return isChainedMethodCall; } public void setChainedMethodCall(boolean isChainedMethodCall) { this.isChainedMethodCall = isChainedMethodCall; } public String getBelongingClassName() { return belongingClassName; } public void setBelongingClassName(String belongingClassName) { this.belongingClassName = belongingClassName; } public int getLineNumber() { return lineNumber; } public void setLineNumber(int lineNumber) { this.lineNumber = lineNumber; } public String toString() { return node.toString(); } public String toShortString() { String shortString = ""; ASTNode pointer = node; while (pointer instanceof MethodInvocation) { node = (MethodInvocation) pointer; shortString = "." + node.getName() + "( )" + shortString; pointer = node.getExpression(); } return shortString; } public boolean isRootInvocation() { return !(node.getParent() instanceof MethodInvocation); } }
13934d435fd8618a89ac363a591543050cc81b97
3cf745120c0aee8ebc0f90790e7e96fb48214c05
/ssi-backend/src/test/java/com/dh/spring5webapp/services/CategoryServiceImplTest.java
321e6448ce64a8bdb9209aeba8ffb5e2cae6ecb2
[]
no_license
fercho-ayala/ssi-code-team
bd62391989c3681a21b7f9e45a5fabaa2b600c67
df6217024e7279c44f74379d055e7f17faef1228
refs/heads/master
2020-04-09T00:42:57.841936
2018-08-28T23:31:05
2018-08-28T23:31:05
159,878,273
0
1
null
2018-11-30T21:02:26
2018-11-30T21:02:26
null
UTF-8
Java
false
false
1,733
java
package com.dh.spring5webapp.services; import com.dh.spring5webapp.model.Category; import com.dh.spring5webapp.repositories.CategoryRepository; import org.junit.Assert; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import java.util.ArrayList; import java.util.List; import static org.mockito.Mockito.*; public class CategoryServiceImplTest { private static final String OTRA_CAT = "OTRACAT"; private List<Category> categorySet; @Mock CategoryRepository categoryRepository; @InjectMocks CategoryServiceImpl categoryServiceImpl; @Before public void setUp() { MockitoAnnotations.initMocks(this); categorySet = new ArrayList<>(); Category category = new Category(); category.setName(OTRA_CAT); categorySet.add(category); when(categoryRepository.findAll()).thenReturn(categorySet); } @Test public void testGetCategories() throws Exception { List<Category> result = categoryServiceImpl.findAll(); Assert.assertEquals(categorySet, result); verify(categoryRepository, times(1)).findAll(); } @Test @Ignore public void testFindById() throws Exception { Category result = categoryServiceImpl.findById(Long.valueOf(1)); Assert.assertEquals(new Category(), result); } /*@Test @Ignore public void testFind() throws Exception { when(categoryRepository.findByCode(any())).thenReturn(null); List<Category> result = categoryServiceImpl.find("code"); Assert.assertEquals(Arrays.<Category>asList(new Category()), result); }*/ }
ffd496dc7d09b64de13dd82cfcc07e0561b4b30b
17eddc09a1ee0adf6457353e34f9c4928956b356
/src/main/java/spring/prog/springprog/model/Author.java
e8d8e421df3fb7f2db5ead85f331267cc952a70d
[]
no_license
lyaysan4/spring-prog
802f7132e0655c2e19efb6d8b26731dcc5801b24
71bd703706c6987f08e8bb975159cb0ec31b70ab
refs/heads/master
2021-08-23T20:32:54.659237
2017-12-06T12:25:47
2017-12-06T12:25:47
106,173,863
0
0
null
null
null
null
UTF-8
Java
false
false
951
java
package spring.prog.springprog.model; import javax.persistence.*; import java.util.List; @Entity public class Author { @Id @GeneratedValue private Long id; private String name; @OneToMany(cascade = CascadeType.ALL, mappedBy = "author") private List<Book> books; public Author() { } public Author(String name, List<Book> books) { this.name = name; this.books = books; } public Author(String name){ this.name = name; } @Override public String toString() { return name; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public List<Book> getBooks() { return books; } public void addBook(Book book) { books.add(book); } }
80de731c9c7ba79b6b4fa65edadc32321a49ed88
a5858c7901990f38a246975a757565d5bd899f52
/LeetCode/src/main/java/cn/tree/MinDepthBinaryTree.java
d7aef858bee4eb1f2b53e28ef1929719437f7781
[]
no_license
superman-wrdh/My-OJ
fca5274bc044cacbd2844d571b19e245b08ec0ab
4528e9cc0d132cfd903b9c7241df5623bfd7611f
refs/heads/master
2021-05-13T12:09:19.233303
2020-06-09T13:04:01
2020-06-09T13:04:01
116,665,405
4
0
null
null
null
null
UTF-8
Java
false
false
639
java
package cn.tree; /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ // TODO https://leetcode.com/problems/minimum-depth-of-binary-tree/submissions/ public class MinDepthBinaryTree { public int minDepth(TreeNode root) { if (root == null) return 0; if (root.left == null && root.right == null) return 1; if (root.left == null) return 1 + minDepth(root.right); if (root.right == null) return 1 + minDepth(root.left); return 1 + Math.min(minDepth(root.left), minDepth(root.right)); } }
[ "hczwbs19931015" ]
hczwbs19931015
6aa2cc39fd12d953ad8fa1238d0f424603740bcd
4fec93570ceab0b16863f7d5c8d2ce262d0e0f6c
/Users_Info/src/main/java/com/user/Users_Info/UsersInfoApplication.java
6a2a2bfe96e16d2ec134d71844ea904c577a42c3
[]
no_license
vidythakoor/User_Info
a44a131a5d05499e66e899ec77fd74bb4951394a
10a473918e331100b5bff34cf0b3c7b08c37abd3
refs/heads/master
2022-06-22T23:05:53.944405
2019-08-07T07:41:54
2019-08-07T07:41:54
200,996,882
0
0
null
2022-06-21T01:37:00
2019-08-07T07:29:16
Java
UTF-8
Java
false
false
318
java
package com.user.Users_Info; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class UsersInfoApplication { public static void main(String[] args) { SpringApplication.run(UsersInfoApplication.class, args); } }
[ "Vidyesh@Vidyesh" ]
Vidyesh@Vidyesh
7a30dd586d6aa8a0c6578c9382091af75e58f7e6
49c32ecee08d6297b46b12f66364e9cbbe92a8b9
/GenericCollection/src/main/java/ua/homestudents/GroupController.java
5a4930667f1319c24a35a1ecefa2f7b007bfc434
[]
no_license
olehLaz/Oop2020
8a348b6e9e24d65f108108b69745a6b76874d86b
6348800fc2d46cded79d3234ad05e5e8459def2e
refs/heads/master
2022-12-25T10:07:09.360553
2020-02-04T16:33:15
2020-02-04T16:33:15
235,641,362
0
0
null
null
null
null
UTF-8
Java
false
false
842
java
package ua.homestudents; public class GroupController { private GroupDAO groupDAO; public GroupController(GroupDAO groupDAO) { super(); this.groupDAO = groupDAO; } public GroupController() { super(); } public GroupDAO getGroupDAO() { return groupDAO; } public void setGroupDAO(GroupDAO groupDAO) { this.groupDAO = groupDAO; } public Group loadGroupByName(String groupName) { if (groupDAO == null) { throw new IllegalArgumentException("Null GroupDAO realisation"); } return groupDAO.loadGroupByName(groupName); } public void saveGroup(Group group) { if (groupDAO == null) { throw new IllegalArgumentException("Null GroupDAO realisation"); } groupDAO.saveGroup(group); } }
efa9fbcee9b0874a66183a75080b96e144ed666c
0624a1092caf74fb8b5ba3f552d5fa32d60bc503
/website/src/main/java/com/province/survey/dao/TabMapper.java
ba71e464c3d430ad0fbb2bad600ddd167b3cc4ec
[]
no_license
HuangQAQ/province-online-website
4a73e5f98978ac05bbf25812cf453dd455e99c6b
26062d4e1e58de63eb96de75794dd4f43561b0f9
refs/heads/master
2020-07-23T09:01:50.658380
2019-09-29T02:43:18
2019-09-29T02:43:18
207,507,345
0
0
null
2019-09-10T08:39:21
2019-09-10T08:39:20
null
UTF-8
Java
false
false
1,261
java
package com.province.survey.dao; import com.province.survey.entity.det; import com.province.survey.entity.inf; import com.province.survey.entity.user; import org.springframework.stereotype.Repository; import java.util.List; @Repository public interface TabMapper { //查询用户是否存在 int findUser(String name); //查询用户密码 String findPwd(String name); //插入一个用户 void insertUser(user user); //通过id查询题目描述 List<inf> findDes(String username); //通过num查询相应题目 inf findOneDes(inf t); //通过num查询所有题目的选项 List<det> findOptByNum(inf t); //查询一个调查表中num的最大值 int findMaxNum(String username); //查询一个题中选项的最大值 int findMaxId(inf t); //插入题目 void insertInf(inf t); //插入题目描述 void insertOpt(det t); //更新题目描述 void updateDes(inf t); //更新选项描述 void updateOpt(det t); //更新选项选择情况 void updateRes(det t); //删除题目信息 void deleteDes(inf t); //删除单个选项信息 void deleteOneOpt(det t); //删除所有选项信息 void deleteAllOpt(inf t); }
df2f65ab3e982038dcbc914c3b0821c8b1f177f6
ec19c3169493876f9f961ab16ce403d345080748
/src/se/ritzau/gimli/DenonAVR.java
6a016d1e70827185eb8913ba8380968f457adfe2
[]
no_license
ritzau/denon-remote
ef45d32386851ca3ddae45a9fcbaf67041aca691
9f4988a3d4f58fefed14fb24c1c13feabdd417ad
refs/heads/master
2016-09-03T07:01:26.948783
2011-01-12T12:37:19
2011-01-12T12:37:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,646
java
package se.ritzau.gimli; import java.io.IOException; import java.net.UnknownHostException; import se.ritzau.gimli.command.MasterVolumeCommand; import se.ritzau.gimli.command.MaxVolumeCommand; import se.ritzau.gimli.command.PowerCommand; import se.ritzau.gimli.command.VolumeCommand; public class DenonAVR { public static final PowerCommand power = new PowerCommand(); public static final VolumeCommand masterVolume = new MasterVolumeCommand(); public static final VolumeCommand maxMasterVolume = new MaxVolumeCommand(); private DenonCore core; public DenonAVR(AVRUI ui, Connection connection) { this.core = new DenonCore(ui, connection); // XXX stop the thread? connection.startThread(); registerCommands(); } public DenonAVR(AVRUI ui, String address) throws UnknownHostException, IOException { this(ui, new SocketConnection(address)); } private void registerCommands() { core.registerCommand(power); core.registerCommand(masterVolume); core.registerCommand(maxMasterVolume); } public boolean isConnected() { return core.isConnected(); } public boolean isPoweredOn() throws InterruptedException { return core.get(power); } public void turnOn() { core.send(power.buildCommand(true)); } public void turnOff() { core.send(power.buildCommand(false)); } public float getMasterVolume() throws InterruptedException { return core.get(masterVolume); } public void setMasterVolume(float value) { core.send(masterVolume.buildCommand(value)); } }
5d0748a1d8bcc5ac743262cf3230d9c423624bc4
4365604e3579b526d473c250853548aed38ecb2a
/modules/dfp_appengine/src/main/java/com/google/api/ads/admanager/jaxws/v202011/ArchiveMobileApplications.java
25d4c85ca64a2fea1cc79bcb99d5058bfb3232eb
[ "Apache-2.0" ]
permissive
lmaeda/googleads-java-lib
6e73572b94b6dcc46926f72dd4e1a33a895dae61
cc5b2fc8ef76082b72f021c11ff9b7e4d9326aca
refs/heads/master
2023-08-12T19:03:46.808180
2021-09-28T16:48:04
2021-09-28T16:48:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,545
java
// Copyright 2020 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.api.ads.admanager.jaxws.v202011; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlType; /** * * The action used to deactivate {@link MobileApplication} objects. * * * <p>Java class for ArchiveMobileApplications complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="ArchiveMobileApplications"> * &lt;complexContent> * &lt;extension base="{https://www.google.com/apis/ads/publisher/v202011}MobileApplicationAction"> * &lt;sequence> * &lt;/sequence> * &lt;/extension> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "ArchiveMobileApplications") public class ArchiveMobileApplications extends MobileApplicationAction { }
d5f5cda343586145d124e3817e83d1354ab169d0
481f685206e83f0d0a406fc2d089225d94554766
/FileWriting/src/com/del/FileChannelTransfer.java
1a5e1aa38e5da555aeff48ee50c1d26903eaacef
[]
no_license
LiteYaga/Piyush
f1483042c88291cead164ba0b20849dc7bb44417
feb8a39f8e5f995862ebbfc5d57a675e776db8c8
refs/heads/master
2020-03-23T09:25:40.800674
2018-08-06T04:24:00
2018-08-06T04:24:00
141,386,945
0
0
null
null
null
null
UTF-8
Java
false
false
1,014
java
package com.del; import java.io.FileNotFoundException; import java.io.IOException; import java.io.RandomAccessFile; import java.nio.channels.FileChannel; public class FileChannelTransfer { public static void main(String[] args) { RandomAccessFile rFile=null; RandomAccessFile rToFile=null; try { rFile=new RandomAccessFile("output.txt", "rw"); FileChannel fromChnl=rFile.getChannel(); rToFile= new RandomAccessFile("file2.txt","rw"); FileChannel toChnl=rToFile.getChannel(); long pos=0; long count=fromChnl.size(); toChnl.transferFrom(fromChnl, pos, count); System.out.println("data transfered"); } catch(FileNotFoundException e) { e.printStackTrace(); } catch(IOException e) { e.printStackTrace(); } finally { try { if(rToFile!=null) { rToFile.close(); } if(rFile!=null) { rFile.close(); } } catch (IOException e) { e.printStackTrace(); } } } }
c897432ee814112d31fb1ff43ba7023dcf72f9bd
89e6b793b804be85a09f28493cd26714358bcd2c
/chapter_002/src/main/java/ru/job4j/strategypattern/Paint.java
ac22c98402c34ed1d972cc11145f8e7357954af5
[ "Apache-2.0" ]
permissive
mixed2004/borisovm
1e5e7daff7992c2c61f7aa837a1eb484cf5ac5ad
c708e4652ecb4eeca23e81e2593d05d254c6130a
refs/heads/master
2021-01-22T15:11:07.448892
2019-10-19T20:55:45
2019-10-19T20:55:45
102,377,964
0
0
Apache-2.0
2020-10-12T18:44:57
2017-09-04T15:52:05
Java
UTF-8
Java
false
false
345
java
package ru.job4j.strategypattern; /** * class Paint. * * @author Maxim Borisov (mail: [email protected]) * @version 1 * @since 25.02.2018 */ public class Paint { /** * methot to draw the object. * @param shape interface for figure */ public void draw(Shape shape) { System.out.println(shape.draw()); } }
5ecaf67034c0c629f9983acb350de41630c5553c
1b22b4a57641cb1bb0ee6bf1e1ad497485c94ed1
/app/src/main/java/com/example/team_11/MainActivity.java
904bd5f07c240199ef371b0956b7a0f21c9af59e
[]
no_license
CMPUT301F21T11/Team-11
257835b4b7d3a9976a4ce27350c17715323e956e
a60dbf21b1e27587bb717c9f7e138019e257fb72
refs/heads/master
2023-08-14T01:39:50.556812
2021-10-04T18:10:09
2021-10-04T18:10:09
411,527,143
0
0
null
2021-10-04T04:56:15
2021-09-29T04:16:40
Java
UTF-8
Java
false
false
332
java
package com.example.team_11; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } }
4e7c486f2c98ddd74b72a7fcfe2c9b49472d1b27
a7f40cf21ee8c9daf17708d6b737915ac2b36426
/PPOOL/src/main/java/com/ppool/view/DownloadView.java
56cf4bd1ca4ec03902b4b8f4a6d397165a3e52b3
[]
no_license
erewhon13/ppool
f8f364a2d051acdddb30d91f316f1301f1b83d1b
f9c49cabd4f3c4cb4757ebede54aab649722cd0f
refs/heads/master
2021-01-22T09:26:36.128724
2015-08-30T14:24:56
2015-08-30T14:24:56
39,364,566
0
0
null
null
null
null
UTF-8
Java
false
false
1,887
java
package com.ppool.view; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.FileInputStream; import java.util.Map; import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.web.servlet.view.AbstractView; import com.ppool.dto.HistoryUploadFile; public class DownloadView extends AbstractView { //응답 컨텐츠를 생성하는 용도의 메서드 @Override protected void renderMergedOutputModel( Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) throws Exception { HistoryUploadFile file = (HistoryUploadFile)model.get("uploadfile"); //다운로드 처리 //1. 브라우저에게 처리할 수 없는 컨텐츠로 알려주어서 다운로드 처리하도록 지정 response.setContentType("application/octet-stream"); //2. 다운로드 처리할 때 필요한 정보 제공 (브라우저의 다운로드 창에 표시될 파일이름) String encodedFileName = new String(file.getUploadUserFileName().getBytes("euc-kr"), "iso-8859-1"); response.addHeader( "Content-Disposition", "Attachment;Filename=\"" + encodedFileName + "\""); //3. 파일을 응답스트림에 기록 ServletContext application = request.getSession().getServletContext(); String file2 = application.getRealPath( "/WEB-INF/uploadfiles/" + file.getUploadSavedFileName()); BufferedInputStream istream = new BufferedInputStream(new FileInputStream(file2)); BufferedOutputStream ostream = new BufferedOutputStream(response.getOutputStream()); while (true) { int data = istream.read(); if (data != -1) ostream.write(data); else break; } istream.close(); ostream.close(); } }
3c29255e713bbc23f27e7f3d10b256b9779a8bcb
3dd4e1b1ebe4ea744ddc9dd30d1208656b769d2b
/src/main/java/com/xawl/shop/controller/OrderController.java
10ea155621d0d87dc0f2da96ba04f3d7d0b3f2cd
[]
no_license
VinceLz/shop
3627aff6322017df634f13e662ace8cc8f17e5e4
bb2c8039f8219110b850c64b464ab7ad64d0bb89
refs/heads/master
2021-05-02T17:51:31.679630
2017-01-09T11:26:55
2017-01-09T11:26:55
74,647,285
38
1
null
null
null
null
UTF-8
Java
false
false
10,139
java
package com.xawl.shop.controller; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID; import javax.annotation.Resource; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import com.xawl.shop.domain.Business; import com.xawl.shop.domain.Goods; import com.xawl.shop.domain.JSON; import com.xawl.shop.domain.Order; import com.xawl.shop.domain.OrderItem; import com.xawl.shop.domain.User; import com.xawl.shop.domain.VO.OrderItemVO; import com.xawl.shop.domain.VO.OrderVO; import com.xawl.shop.interceptor.JsonMenu; import com.xawl.shop.interceptor.Role; import com.xawl.shop.interceptor.UserSession; import com.xawl.shop.pagination.Page; import com.xawl.shop.service.BusinessService; import com.xawl.shop.service.CartItemService; import com.xawl.shop.service.GoodsService; import com.xawl.shop.service.OrderService; import com.xawl.shop.util.ArrayUtil; import com.xawl.shop.util.DateUtil; import com.xawl.shop.util.keyUtil; @Controller public class OrderController extends BaseController { public static String OK = "1"; // 已审核 public static String NO = "0"; // 待审核 public static String ORDER_NO_PLAY = "-1"; // 待支付 public static String ORDER_YES_PLAY = "0"; // 已经支付 待处理 public static String ORDER_DEAL = "2"; // 待确认 已处理 public static String ORDER_SUCCESS = "3"; // 完成 完成 public static String ORDER_FAIL = "1"; // 退款 退款 @Resource private OrderService orderService; @Resource private GoodsService goodsService; @Resource private CartItemService cartItemService; @Resource private BusinessService businessService; // 获取所有订单 @RequestMapping("/admin/order/list") public @ResponseBody @Role(role = Role.ROLE_ADMIN) @JsonMenu(menu = "Order") Object list(Page<Order> page, JSON json) { // System.out.println(page.getParams().get("bname").toString().isEmpty()); List<Order> findPage = orderService.findPage(page); page.setResults(findPage); json.add("page", page); return json.toString(); } // 获取子订单!! 详情 @RequestMapping("/admin/order/get") @Role(role = Role.ROLE_ADMIN) public @ResponseBody Object view(@RequestParam() String oid, JSON json) { List<OrderItemVO> all = orderService.getAll(oid); json.add("orderitem", all); return json.toString(); } // 审核通过 @RequestMapping("/admin/order/examineOk") @Role(role = Role.ROLE_ADMIN) public @ResponseBody Object examine(@RequestParam() String oid, JSON json) { Map map = new HashMap<>(); map.put("oinspect", OK); map.put("oid", oid); orderService.examine(map); return json.toString(); } // 获取自己的订单 // 1 商家的 // 2 用户的 // 创建订单 购买一个 @RequestMapping("/front/order/add") public @ResponseBody Object createOrder(JSON json, @RequestParam() String gid, @UserSession(session = "user") User user) { Goods goods = goodsService.get(gid); if (goods == null) { json.add("status", keyUtil.SERVICE_FAIL); return json + ""; // 传入的商品不存在 } // 1 先创建order订单对象 OrderVO order = new OrderVO(); String uuid = UUID.randomUUID().toString(); order.setOid(uuid);// 订单号 String date = DateUtil.getSqlDate(); order.setOrdertime(date); // status 默认是0 未支付 order.setUid(user.getUid()); order.setUname(user.getUname()); order.setUphone(user.getUphone()); order.setBid(goods.getBid()); order.setBname(goods.getBname()); order.setBphone(businessService.getPhoneByBid(goods.getBid())); // 商家电话 order.setStatus(-1); // oinspect 是审核 0表示为审核 // currentPrice 表示修改后的价格 // orderItem OrderItem orderItem = new OrderItem(); orderItem.setGid(goods.getGid()); orderItem.setGname(goods.getGname()); orderItem.setOid(uuid); orderItem.setGprice(goods.getGprice()); orderItem.setGimage(ArrayUtil.Array2String(goods.getGimage())); order.setTotal(orderItem.getGprice()); order.setCurrentprice(orderItem.getGprice()); order.getItemlist().add(orderItem); // 封装完毕 // 写入数据库 List orderList = new ArrayList<OrderVO>(); orderList.add(order); orderService.insert(orderList); order.getItemlist().clear(); json.add("orders", orderList); return json + ""; } // 购物车批量购买 // 一个商家生成一个订单 @RequestMapping("/front/order/addAll") public @ResponseBody Object createOrder2(JSON json, @RequestParam() String[] gid, @UserSession(session = "user") User user) { // 1 先遍历所有 的gid 找出相同的gid对应的bid商家 生成一单 ArrayList<Goods> arrayList = new ArrayList<Goods>(); List<OrderVO> orders = new ArrayList<OrderVO>(); for (int i = 0; i < gid.length; i++) { Goods goods = goodsService.get(gid[i]); if (goods != null) { arrayList.add(goods); } } if (arrayList.size() == 0) { json.add("status", keyUtil.SERVICE_FAIL); return json + ""; } boolean flag = false; for (Goods goods : arrayList) { flag = false; for (OrderVO orderVO : orders) { if (goods.getBid() == orderVO.getBid()) { // 已经有了该商家的订单 OrderItem item = new OrderItem(); item.setGid(goods.getGid()); item.setGname(goods.getGname()); item.setGprice(goods.getGprice()); item.setGimage(ArrayUtil.Array2String(goods.getGimage())); item.setOid(orderVO.getOid()); orderVO.getItemlist().add(item); orderVO.setTotal(orderVO.getAllTotal()); // 刷新总价 orderVO.setCurrentprice(orderVO.getAllTotal()); // 刷新总价 flag = true; break; } } // 新建订单 if (!flag) { OrderVO order = new OrderVO(); String uuid = UUID.randomUUID().toString(); order.setOid(uuid);// 订单号 String date = DateUtil.getSqlDate(); order.setOrdertime(date); // status 默认是0 未支付 order.setUid(user.getUid()); order.setUname(user.getUname()); order.setUphone(user.getUphone()); order.setBid(goods.getBid()); order.setBname(goods.getBname()); order.setBphone(businessService.getPhoneByBid(goods.getBid())); order.setStatus(-1); // 订单项 OrderItem orderItem = new OrderItem(); orderItem.setGid(goods.getGid()); orderItem.setGname(goods.getGname()); orderItem.setOid(uuid); orderItem.setGprice(goods.getGprice()); orderItem.setGimage(ArrayUtil.Array2String(goods.getGimage())); order.setTotal(orderItem.getGprice()); order.setCurrentprice(orderItem.getGprice()); order.getItemlist().add(orderItem); orders.add(order); } } orderService.insert(orders); // 把ordersVO对象转换为orders对象 for (OrderVO order : orders) { order.getItemlist().clear(); } // 删除购物车的选中的条目 json.add("orders", orders); return json + ""; } @RequestMapping("/front/order/statusList") public @ResponseBody @Role(role = Role.ROLE_USER) Object getOrderStatusNumber(JSON json, @UserSession(session = "user") User user) { Map<String, Map<String, Integer>> status_number = orderService .getOrderStatusNumber(user.getUid()); Map<String, Integer> map = status_number.get(null); json.add("status_array", map); // 判断是否是商家 return json + ""; } @RequestMapping("/front/order/statusbusiness") public @ResponseBody Object getOrderStatusNumber2(JSON json, @UserSession(session = "business") Business business) { if (business != null) { // 传递商家订单信息 Map<String, Map<String, Integer>> status_business = orderService .getOrderStatusNumberByBid(business.getBid()); Map<String, Integer> map1 = status_business.get(null); json.add("status_array", map1); } return json + ""; } // ToDo 获取商家对应的订单集合状态 // 根据传入的状态吗,获取对应的状态的订单集合 @RequestMapping("/front/order/statusBycode") public @ResponseBody Object getOrderStatusNumbers(JSON json, @UserSession(session = "user") User user, @RequestParam() String status) { Map map = new HashMap<>(); map.put("uid", user.getUid()); map.put("status", status); List<OrderVO> statusByCode = orderService.getStatusByCode(map); json.add("orders", statusByCode); return json + ""; } // 支付 @RequestMapping("/front/order/updateOrder") public @ResponseBody Object updateStatus(JSON json, @UserSession(session = "user") User user, @RequestParam() String status, @RequestParam() String oid) { // TODO 支付成功调用此函数 // TODO 进一步检测,去数据库查询金额是否到账后,进行更改订单状态 Map map = new HashMap<String, Object>(); map.put("uid", user.getUid()); map.put("status", status); map.put("oid", oid); orderService.updateCode(map); return json + ""; } @RequestMapping("/front/order/updateOrderBusiness") public @ResponseBody @Role(role = Role.ROLE_BUSINESS) Object updateStatus2(JSON json, @UserSession(session = "business") Business business, @RequestParam() String status, @RequestParam() String oid) { // TODO 支付成功调用此函数 // TODO 进一步检测,去数据库查询金额是否到账后,进行更改订单状态 Map map = new HashMap<String, Object>(); map.put("bid", business.getBid()); map.put("status", status); map.put("oid", oid); orderService.updateCodeBusiness(map); return json + ""; } // 支付成功后的异步通知 @RequestMapping("/front/order/return_pay") public @ResponseBody Object pay_return(JSON json) { //异步通知一般是检测订单支付是否正常 //同步通知一般是通知用户支付状态 return json + ""; } }
7d123750c298e91fb0ea5c8b3200ed272bc47707
dcf1d4f1f0af061fafaa3b7621ee35c6e6943cf6
/app/src/main/java/com/android/masiro/proj05/fragment.java
680790bc792e02f88cfdf3c8490718a38ea53c7f
[]
no_license
masiro97/Android05
889e81197d50c042acf14af460fbb80920245bab
369c3d147fa14f86bacf68d4b05253989848a39c
refs/heads/master
2021-01-18T21:55:47.283919
2017-04-02T17:26:08
2017-04-02T17:26:08
87,028,620
0
0
null
null
null
null
UTF-8
Java
false
false
853
java
package com.android.masiro.proj05; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; /** * Created by haeyoung on 2017-03-30. */ public class fragment extends Fragment { TextView t; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View fragview = inflater.inflate(R.layout.fragment1,container,false); t = (TextView)fragview.findViewById(R.id.textView4); t.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { } }); return fragview; } }
d08a1f8b296e3472819a65191954e38896b84f3e
b3ac50e2975e2bdddc39016b9c0a3d737c49ca62
/src/main/java/firstLesson/Book.java
c6d7efc57a2d699a273d8aa283f5ebfe8e951e4e
[]
no_license
marcin22216/naukaJavy
cd3550be5880f22f58b586025bf6741fb5614919
c5bbe70aea0fa50f5c3b2d18c9b20c4ec46a6def
refs/heads/master
2021-07-19T05:15:26.445137
2019-01-21T09:05:19
2019-01-21T09:05:19
149,169,398
0
0
null
null
null
null
UTF-8
Java
false
false
237
java
package firstLesson; public class Book { private double price; public void setPrice(double cenaKsiazki) { this.price = cenaKsiazki; } public double getPrice() { return this.price; } }
ff3f2c5851fc090154f2412840eb63824e7168ee
4ac1f13b0ae845739cea56a46b9cf4d512a7e02d
/Shop/src/entities/Book.java
c2fd3849e3cbceb3d3afa3a3524b507dfaab89dc
[]
no_license
PieroVaghi/CorsoJava
207d6a2851199d4b2bfd8e19855eef00f8c8c259
67ffe33ceadb5103fdce4ea88ab2d053ea0cd685
refs/heads/master
2020-08-05T02:04:58.137859
2019-12-05T11:37:50
2019-12-05T11:37:50
212,356,801
0
0
null
null
null
null
UTF-8
Java
false
false
900
java
package entities; public class Book extends Product { private String author, category; private int pages; public Book() {} public String getAuthor() { return author; } public void setAuthor(String author) { this.author = author; } public String getCategory() { return category; } public void setCategory(String genre) { this.category = genre; } public int getPages() { return pages; } public void setPages(int pages) { this.pages = pages; } @Override public String toString() { return super.toString() + "\n" + (author != null ? "author: " + author + ", \n" : "") + (category != null ? "category: " + category + ", \n" : "") + "pages: " + pages; } @Override public boolean valid() { return super.valid() && pages>0 && notVoid(author) && notVoid(category) ; } }
d9e69d446798c2f3e9b85b8b737d4ec5b27d315e
40390908f3d89ce8bd2de07a5d21e2097543f0c9
/src/main/java/com/study/method/Student.java
fe8acef180a8e4de7512547fa19c73f276165b37
[]
no_license
lxpCodes/jdk8
c2e8884754bd1feb0c54e2925f5d61ff7fdc34ac
d018ecccde268728bf8c8394f58b47c3596d7d1e
refs/heads/master
2022-04-23T18:24:12.651377
2020-04-27T10:03:38
2020-04-27T10:03:38
256,091,026
0
0
null
null
null
null
UTF-8
Java
false
false
1,274
java
package com.study.method; /** * @ClassName Student * @Description TODO * @Author liangxp * @Date 2020/4/14 16:18 **/ public class Student { private String name; private int score; public Student(String name, int score) { this.name = name; this.score = score; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getScore() { return score; } public void setScore(int score) { this.score = score; } public static int compareByScore(Student student1, Student student2){ return student1.getScore() - student2.getScore(); } public static int compareByName(Student student1, Student student2){ return student1.getName().compareToIgnoreCase(student2.getName()); } public int compareStuByScore(Student student){ return this.getScore() -student.getScore(); } public int compareStuByName(Student student){ return this.getName().compareToIgnoreCase(student.getName()); } @Override public String toString() { return "Student{" + "name='" + name + '\'' + ", score=" + score + '}'; } }
832577346bcb26f3dc56b352c992c9f0a2de6f08
bf2966abae57885c29e70852243a22abc8ba8eb0
/aws-java-sdk-iot/src/main/java/com/amazonaws/services/iot/model/transform/ListDomainConfigurationsResultJsonUnmarshaller.java
d45ef0695dfca893b9b577ae8ad56242b482235d
[ "Apache-2.0" ]
permissive
kmbotts/aws-sdk-java
ae20b3244131d52b9687eb026b9c620da8b49935
388f6427e00fb1c2f211abda5bad3a75d29eef62
refs/heads/master
2021-12-23T14:39:26.369661
2021-07-26T20:09:07
2021-07-26T20:09:07
246,296,939
0
0
Apache-2.0
2020-03-10T12:37:34
2020-03-10T12:37:33
null
UTF-8
Java
false
false
3,335
java
/* * Copyright 2016-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.iot.model.transform; import java.math.*; import javax.annotation.Generated; import com.amazonaws.services.iot.model.*; import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*; import com.amazonaws.transform.*; import com.fasterxml.jackson.core.JsonToken; import static com.fasterxml.jackson.core.JsonToken.*; /** * ListDomainConfigurationsResult JSON Unmarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class ListDomainConfigurationsResultJsonUnmarshaller implements Unmarshaller<ListDomainConfigurationsResult, JsonUnmarshallerContext> { public ListDomainConfigurationsResult unmarshall(JsonUnmarshallerContext context) throws Exception { ListDomainConfigurationsResult listDomainConfigurationsResult = new ListDomainConfigurationsResult(); int originalDepth = context.getCurrentDepth(); String currentParentElement = context.getCurrentParentElement(); int targetDepth = originalDepth + 1; JsonToken token = context.getCurrentToken(); if (token == null) token = context.nextToken(); if (token == VALUE_NULL) { return listDomainConfigurationsResult; } while (true) { if (token == null) break; if (token == FIELD_NAME || token == START_OBJECT) { if (context.testExpression("domainConfigurations", targetDepth)) { context.nextToken(); listDomainConfigurationsResult.setDomainConfigurations(new ListUnmarshaller<DomainConfigurationSummary>( DomainConfigurationSummaryJsonUnmarshaller.getInstance()) .unmarshall(context)); } if (context.testExpression("nextMarker", targetDepth)) { context.nextToken(); listDomainConfigurationsResult.setNextMarker(context.getUnmarshaller(String.class).unmarshall(context)); } } else if (token == END_ARRAY || token == END_OBJECT) { if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) { if (context.getCurrentDepth() <= originalDepth) break; } } token = context.nextToken(); } return listDomainConfigurationsResult; } private static ListDomainConfigurationsResultJsonUnmarshaller instance; public static ListDomainConfigurationsResultJsonUnmarshaller getInstance() { if (instance == null) instance = new ListDomainConfigurationsResultJsonUnmarshaller(); return instance; } }
[ "" ]
9ba8b3cf736cd810902d00b4907fa2ec4ff5a1ad
aefafb99b7aac0fe792c72c80cdfa52db03e0951
/gen/com/throttle/Manifest.java
065370d8f27a750bf31ea01ea3414f9d1a9387e5
[]
no_license
rohanbomle15/throttle
d899f937a9cc841b060f9276e44b8aa3d7817ca4
046fc620c51efb2af06d46d6fc68405a9fcac7d6
refs/heads/master
2020-04-23T09:41:37.336522
2019-02-17T03:26:10
2019-02-17T03:26:10
171,077,432
0
0
null
null
null
null
UTF-8
Java
false
false
363
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */ package com.throttle; public final class Manifest { public static final class permission { public static final String MAPS_RECEIVE="com.throttle.MAPS_RECEIVE"; } }
d5810e06e1bda74929dd9ed53d39e17bb58741b8
8768e13f4a0c4cc9f736ccfead91806ede9ac5ba
/p6_package/LinkListIteratorClass.java
78415d0d8ca5616e8025dc8a93b9f8eec651114a
[]
no_license
wrobelcarter1/CS-249
4fa799a3c188741ee53a68744e7a25279c6d2ef6
15225c43d2ee771521441c7e71374262e982b0e1
refs/heads/master
2020-05-02T11:51:44.419860
2019-03-27T07:57:36
2019-03-27T07:57:36
177,942,441
0
0
null
null
null
null
UTF-8
Java
false
false
9,388
java
package p6_package; /** * * @author carterwrobel */ public class LinkListIteratorClass extends java.lang.Object { private class NodeClass { int nodeData; NodeClass nextRef; private NodeClass() { nodeData = 0; nextRef = null; } private NodeClass( int newData ) { nodeData = newData; nextRef = null; } } /** * Provides constant -999999 for access failure messaging */ public static final int FAILED_ACCESS = -999999; /** * reference to head node */ private LinkListIteratorClass.NodeClass headRef; /** * reference to current/cursor node */ private LinkListIteratorClass.NodeClass cursorRef; /** * Default constructor */ public LinkListIteratorClass() { // Set the refs to null headRef = null; cursorRef = null; } /** * Copy constructor * @param copied - LinkListIteratorClass object to be copied */ public LinkListIteratorClass(LinkListIteratorClass copied) { if( copied.headRef != null && copied.cursorRef != null ) { // create new headref headRef = new NodeClass(copied.headRef.nodeData); // TWR is this working reference // CWR is copied working reference NodeClass TWR = headRef; NodeClass CWR = copied.headRef; // loop values and copies them into list while( CWR.nextRef != null ) { // update CWR CWR = CWR.nextRef; // check for cursor ref if( CWR == copied.cursorRef ) { cursorRef = new NodeClass(CWR.nodeData); TWR.nextRef = cursorRef; TWR = TWR.nextRef; } else // Copy the node { TWR.nextRef = new NodeClass(CWR.nodeData); TWR = TWR.nextRef; } } } } /** * Clears list */ public void clear() { // Sets the ref to null headRef = null; cursorRef = null; } /** * Displays linked list for diagnostic purposes */ public void displayList() { System.out.print("Data Display: "); NodeClass tempNode = headRef; while( tempNode != null ) { // Checks if the node is the cursor to put brackets around it if( tempNode == cursorRef ) { System.out.print("[" + Integer.toString(tempNode.nodeData) + "] "); tempNode = tempNode.nextRef; } // If the node is not the cursor then print it normally else { System.out.print(Integer.toString(tempNode.nodeData) + " "); tempNode = tempNode.nextRef; } } // set to next line after finnish printing System.out.println(""); } /** * Acquires data at cursor * <p> * @return integer value at cursor location if available, * FAILED_ACCESS otherwise */ public int getDataAtCursor() { // checks if it is null if(cursorRef == null) { return FAILED_ACCESS; } // returns the data at cursor return headRef.nodeData; } /** * Recursive method finds a reference to the node just prior to the cursor; * initially called with head reference * <p> * @param workingRef - current NodeClass reference in the list * <p> * @return NodeClass reference to the item just prior to * the cursor location */ private LinkListIteratorClass.NodeClass getRefBeforeCursor( LinkListIteratorClass.NodeClass workingRef) { // sets the working ref to the head workingRef = headRef; // Recursviely calls the function to find the previous node if(workingRef.nextRef != cursorRef ) { workingRef = workingRef.nextRef; return getRefBeforeCursor(workingRef.nextRef); } return workingRef; } /** * Inserts value after cursor * <p> * @param newValue - Value to be inserted in list */ public void insertAfterCursor(int newValue) { // if list is empty set first value and head if( isEmpty() ) { cursorRef = new NodeClass(newValue); headRef = cursorRef; } // If the list is not empty else { // Checks if there is nothing next to the cursor if( cursorRef.nextRef == null ) { cursorRef.nextRef = new NodeClass(newValue); } // Removes the node and reassigns other nodes else { NodeClass oldNode = cursorRef.nextRef; NodeClass newNode = new NodeClass(newValue); cursorRef.nextRef = newNode; newNode.nextRef = oldNode; } } } /** * Inserts value prior to cursor * <p> * @param newValue - Value to be inserted in list */ public void insertBeforeCursor(int newValue) { // Checks if it empty if( isEmpty() ) { cursorRef = new NodeClass(newValue); headRef = cursorRef; } else { NodeClass newNode = new NodeClass(newValue); if(headRef.nextRef == null) { newNode.nextRef = cursorRef; headRef = newNode; } else { // moves previous to save the node before movePrevious(); NodeClass oldNode = cursorRef; // moves back moveNext(); // updates references newNode.nextRef = cursorRef; oldNode.nextRef = newNode; } } } /** * Checks for at last item in list * <p> * @return Boolean result of test */ public boolean isAtEndOfList() { // checks if the cursor ref to the next is null return ( cursorRef.nextRef == null ); } /** * Reports list empty status * <p> * @return Boolean evidence of empty list */ public boolean isEmpty() { // Checks if the head is null return ( headRef == null); } /** * Moves cursor to next node if it is not at end */ public void moveNext() { // checks if its not at the end if(!isAtEndOfList()) { // updates the cursorRef cursorRef = cursorRef.nextRef; } } /** * Moves cursor to previous node if it is not already at head */ public void movePrevious() { if(cursorRef != headRef) { NodeClass tempNode = headRef; boolean test = true; while( test ) { if(tempNode.nextRef == cursorRef) { cursorRef = tempNode; test = false; } tempNode = tempNode.nextRef; } } } /** * Removes item at current location/cursor if available * <p> * Sets cursor to previous node unless cursor is at head * <p> * @return integer value removed if available, FAILED_ACCESS otherwise */ public int removeDataAtCursor() { // checks if it is the last item left if( isAtEndOfList() && cursorRef == headRef ) { int valueRemoved = cursorRef.nodeData; clear(); return valueRemoved; } // If its not the last item if(cursorRef != null) { // checks if it as the head ref if(cursorRef == headRef) { int valueRemoved = cursorRef.nodeData; NodeClass tempNode = cursorRef; moveNext(); headRef = cursorRef; return valueRemoved; } // if not then remove it normally else { int valueRemoved = cursorRef.nodeData; NodeClass nodeAfter = cursorRef.nextRef; movePrevious(); NodeClass nodeBefore = cursorRef; moveNext(); nodeBefore.nextRef = nodeAfter; cursorRef = nodeBefore; return valueRemoved; } } return FAILED_ACCESS; } /** * Sets cursor to first item in list */ public void setToFirstItem() { // updates the cursor cursorRef = headRef; } /** * Sets cursor to last item in list */ public void setToLastItem() { // Checks if its at the end while(!isAtEndOfList()) { cursorRef = cursorRef.nextRef; } } }
3010c03d35f01c94f2c77adc482b59cfde8f0009
112433cd3973d8e78a279185d5c087964d2b726e
/test_graduate/src/main/java/com/qhg/service/ClazzServiceImpl.java
057bf942771dcb3f078e78c3bbd1d63599e25598
[]
no_license
pengwei-x/GitFile
713bb91a8dff2635dc693cfecdb8312d35525129
0d6535c70e1844290167e9db934bb98bf8d75bc3
refs/heads/master
2020-05-22T17:00:14.920609
2019-05-13T08:48:58
2019-05-13T08:48:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,682
java
package com.qhg.service; import com.qhg.dao.ClazzMapper; import com.qhg.model.Clazz; import com.qhg.model.ClazzExample; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.List; /** * @Auther: admin * @Date: 2019/3/31 18:00 * @Description: 班级 */ @Service @Transactional //开启事务 public class ClazzServiceImpl implements ClazzService { /* * 新建班级 * */ @Autowired ClazzMapper clazzMapper; public void addClazz(Clazz clazz){ clazzMapper.insert(clazz); } public List<Clazz> selectAllClazz(){//查询所有班级信息 return clazzMapper.selectAllClazz(); } @Override public Clazz selectClazz(String clazzId) { return clazzMapper.selectByPrimaryKey(clazzId); } @Override public boolean clazzName(String clazzName) { ClazzExample clazzExample=new ClazzExample(); ClazzExample.Criteria criteria = clazzExample.createCriteria(); criteria.andClazzNameEqualTo(clazzName); List<Clazz> clazzes = clazzMapper.selectByExample(clazzExample); int x=clazzes.size(); return 0==x; } public void updateClazzSelective(Clazz clazz) { //更新班级信息 // updateByPrimaryKeySelective updateByPrimaryKey // 前者只是更新新的model中不为空的字段。后者则会将为空的字段在数据库中置为NULL。 clazzMapper.updateByPrimaryKeySelective(clazz); } public void delClazzOfId(String clazzId){ clazzMapper.deleteByPrimaryKey(clazzId); } }
8171df4e4122c2839b38f000dc81776a29afac1c
760c0d9a9d55629f354cefc1a974daa19026e618
/codigo/java/sigeven/sigeven-business/src/main/java/br/jus/stj/sigeven/business/evento/EventoBean.java
b07d973a597e49d5cb8c5a88fbb4d631bf462804
[]
no_license
EdmarJr/nevegis
901b3060b8e24f6c6880c01e3a912db8568a1145
49c17b9589b57bd72f0f1399ce7092e26a060975
refs/heads/master
2020-04-06T14:37:22.028964
2014-11-21T11:07:20
2014-11-21T11:07:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,186
java
package br.jus.stj.sigeven.business.evento; import java.util.List; import javax.ejb.EJB; import javax.ejb.Stateless; import javax.inject.Inject; import br.jus.stj.sigeven.business.cargo.CargoBean; import br.jus.stj.sigeven.business.fornecedor.FornecedorBean; import br.jus.stj.sigeven.business.grupoparticipante.GrupoParticipanteBean; import br.jus.stj.sigeven.business.orgao.OrgaoBean; import br.jus.stj.sigeven.business.servicoprestadoevento.ServicoPrestadoEventoBean; import br.jus.stj.sigeven.business.tiposervico.TipoServicoBean; import br.jus.stj.sigeven.business.tratamento.TratamentoBean; import br.jus.stj.sigeven.entity.db2.sigeven.EventoSGVEN; import br.jus.stj.sigeven.entity.db2.sigeven.FornecedorSGVEN; import br.jus.stj.sigeven.entity.db2.sigeven.ServicoPrestadoEventoSGVEN; import br.jus.stj.sigeven.entity.db2.sigeven.TipoServicoSGVEN; import br.jus.stj.sigeven.persistence.EventoDAO; @Stateless public class EventoBean { @Inject private EventoDAO eventoDAO; @EJB private CargoBean cargoDB2Bean; @EJB private FornecedorBean fornecedorBean; @EJB private ServicoPrestadoEventoBean servicoPrestadoEventoBean; @EJB private OrgaoBean orgaoDB2Bean; @EJB private TipoServicoBean tipoServicoBean; @EJB private TratamentoBean tratamentoDB2Bean; @EJB private GrupoParticipanteBean grupoDB2Bean; public EventoSGVEN incluir(EventoSGVEN evento, List<ServicoPrestadoEventoSGVEN> servicos) { evento = eventoDAO.incluir(evento); incluirServicoPrestado(evento, servicos); return evento; } public EventoSGVEN incluir(EventoSGVEN evento){ return eventoDAO.incluir(evento); } public EventoSGVEN alterarEvento(EventoSGVEN evento, List<ServicoPrestadoEventoSGVEN> servicos, List<ServicoPrestadoEventoSGVEN> servicosExcluir) { EventoSGVEN eventoTemp = eventoDAO.obterPorId(EventoSGVEN.class, evento.getId()); popularEvento(evento, eventoTemp); evento = eventoDAO.atualizar(eventoTemp); incluirServicoPrestado(evento, servicos); excluirServicoPrestado(evento, servicosExcluir); return evento; } private void popularEvento(EventoSGVEN evento, EventoSGVEN eventoTemp) { eventoTemp.setCustoFinal(evento.getCustoFinal()); eventoTemp.setDataFim(evento.getDataFim()); eventoTemp.setDataInicio(evento.getDataInicio()); eventoTemp.setHora(evento.getHora()); eventoTemp.setLocal(evento.getLocal()); eventoTemp.setMestreCerimoniaSGVEN(evento.getMestreCerimoniaSGVEN()); eventoTemp.setNome(evento.getNome()); eventoTemp.setObservacao(evento.getObservacao()); eventoTemp.setParticipantes(evento.getParticipantes()); eventoTemp.setServicoPrestadoEventoSGVEN(evento.getServicoPrestadoEventoSGVEN()); eventoTemp.setStatus(evento.getStatus()); eventoTemp.setTaquigrafia(evento.getTaquigrafia()); eventoTemp.setTipoEvento(evento.getTipoEvento()); eventoTemp.setTraducaoLibra(evento.getTraducaoLibra()); eventoTemp.setUsuario(evento.getUsuario()); } private void excluirServicoPrestado(EventoSGVEN evento, List<ServicoPrestadoEventoSGVEN> servicosExcluir) { for (ServicoPrestadoEventoSGVEN tempExcluir : servicosExcluir) { tempExcluir.setEventoSGVEN(evento); tempExcluir.setFornecedorSGVEN(fornecedorBean.obterPorId( FornecedorSGVEN.class, tempExcluir.getFornecedorSGVEN() .getId())); tempExcluir.setTipoServicoSGVEN(tipoServicoBean.obterPorId( TipoServicoSGVEN.class, tempExcluir.getTipoServicoSGVEN() .getId())); servicoPrestadoEventoBean.excluir(tempExcluir); } } private void incluirServicoPrestado(EventoSGVEN evento, List<ServicoPrestadoEventoSGVEN> servicos) { for (ServicoPrestadoEventoSGVEN temp : servicos) { temp.setEventoSGVEN(evento); temp.setFornecedorSGVEN(fornecedorBean.obterPorId( FornecedorSGVEN.class, temp.getFornecedorSGVEN().getId())); temp.setTipoServicoSGVEN(tipoServicoBean.obterPorId( TipoServicoSGVEN.class, temp.getTipoServicoSGVEN().getId())); servicoPrestadoEventoBean.salvar(temp); } } public EventoSGVEN alterarEvento(EventoSGVEN evento){ return eventoDAO.atualizar(evento); } public boolean verificaMesmoNomeincluir(EventoSGVEN evento) { EventoSGVEN verificador = eventoDAO.recuperarPorNome(evento.getNome()); if (verificador != null) return true; return false; } public List<EventoSGVEN> recuperarTodos() { return eventoDAO.recuperarTodos(new EventoSGVEN()); } public EventoSGVEN recuperarPorId(Long id) { return eventoDAO.recuperarPorId(id); } public List<EventoSGVEN> pesquisar(EventoSGVEN evento) { return eventoDAO.pesquisar(evento); } public boolean alterar(EventoSGVEN evento) { eventoDAO.atualizar(evento); return true; } public void excluir(EventoSGVEN evento) { eventoDAO.excluir(evento); } @SuppressWarnings("unchecked") public List<EventoSGVEN> pesquisaPorParametros(EventoSGVEN evento) { List<? extends Object> listaEvento = eventoDAO.consultaEvento(evento); return (List<EventoSGVEN>) listaEvento; } public EventoSGVEN recuperarEventoComParticipantes(EventoSGVEN evento) { EventoSGVEN eventoTemp = eventoDAO .recuperarEventoComParticipantes(evento.getId()); return eventoTemp; } }
fe78a4f6b72a96ef1563de3472eb3f5bc3151bcb
05a354d6e0c3f494a141895d379eb12f718e8961
/app/src/main/java/com/vb/tracker/free/routinecalendar/RoutineSimpleItemTouchHelperCallback.java
ee4bf0f66f2021c3bc7aba11133dc621a6ce12eb
[]
no_license
VBrazhnik/VBtracker
3dabff68d247d61d8524d496624d1cce1357efce
ab74782b222f8683841627711858b6859c494e61
refs/heads/master
2021-04-15T17:37:38.691847
2018-03-22T15:01:35
2018-03-22T15:01:35
126,259,843
1
1
null
null
null
null
UTF-8
Java
false
false
5,101
java
package com.vb.tracker.free.routinecalendar; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Typeface; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.helper.ItemTouchHelper; import android.view.View; import com.vb.tracker.R; import com.vb.tracker.free.VBtracker; import com.vb.tracker.free.colorpicker.ColorPalette; import com.vb.tracker.free.helper.ItemTouchHelperAdapter; import com.vb.tracker.free.helper.ItemTouchHelperViewHolder; class RoutineSimpleItemTouchHelperCallback extends ItemTouchHelper.Callback { private static final float ALPHA_FULL = 1.0f; private final ItemTouchHelperAdapter mAdapter; RoutineSimpleItemTouchHelperCallback(ItemTouchHelperAdapter adapter) { mAdapter = adapter; } @Override public boolean isLongPressDragEnabled() { return true; } @Override public boolean isItemViewSwipeEnabled() { return true; } @Override public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) { if (viewHolder instanceof RoutineRecyclerListAdapter.ItemViewHolderNotDone) { return makeMovementFlags(0, ItemTouchHelper.END); } else if (viewHolder instanceof RoutineRecyclerListAdapter.ItemViewHolderDone) { return makeMovementFlags(0, ItemTouchHelper.START); } return makeMovementFlags(0, 0); } @Override public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder source, RecyclerView.ViewHolder target) { if (source.getItemViewType() != target.getItemViewType()) { return false; } mAdapter.onItemMove(source.getAdapterPosition(), target.getAdapterPosition()); return true; } @Override public void onSwiped(RecyclerView.ViewHolder viewHolder, int i) { if (i == 32) { mAdapter.onItemRightDismiss(viewHolder.getAdapterPosition()); } if (i == 16) { mAdapter.onItemLeftDismiss(viewHolder.getAdapterPosition()); } } @Override public void onChildDraw(Canvas c, RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, float dX, float dY, int actionState, boolean isCurrentlyActive) { final int scale = (int) recyclerView.getContext().getResources().getDisplayMetrics().density; if (actionState == ItemTouchHelper.ACTION_STATE_SWIPE) { View itemView = viewHolder.itemView; final float alpha = ALPHA_FULL - Math.abs(dX) / (float) viewHolder.itemView.getWidth(); viewHolder.itemView.setAlpha(alpha); viewHolder.itemView.setTranslationX(dX); Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); paint.setStrokeWidth((float) 0.3); if (dX > 0) { paint.setColor(ColorPalette.GREEN.getColor()); paint.setTextSize(20 * scale); paint.setTypeface(Typeface.createFromAsset(recyclerView.getContext().getAssets(), "font/Roboto-Thin.ttf")); c.drawText(VBtracker.getInstance().getString(R.string.done).toUpperCase(), itemView.getLeft() + 10 * scale, itemView.getBottom() - (itemView.getBottom() - itemView.getTop()) / 2 + 7 * scale, paint); c.drawLine(itemView.getRight(), (float) itemView.getBottom() - 1, 0, (float) itemView.getBottom() - 1, paint); } else { paint.setColor(ColorPalette.RED.getColor()); paint.setTextSize(20 * scale); paint.setTypeface(Typeface.createFromAsset(recyclerView.getContext().getAssets(), "font/Roboto-Thin.ttf")); paint.setTextAlign(Paint.Align.RIGHT); c.drawText(VBtracker.getInstance().getString(R.string.undone).toUpperCase(), itemView.getRight() - 10 * scale, itemView.getBottom() - (itemView.getBottom() - itemView.getTop()) / 2 + 7 * scale, paint); c.drawLine(itemView.getRight(), (float) itemView.getBottom() - 1, 0, (float) itemView.getBottom() - 1, paint); } } super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive); } @Override public void onSelectedChanged(RecyclerView.ViewHolder viewHolder, int actionState) { if (actionState != ItemTouchHelper.ACTION_STATE_IDLE) { if (viewHolder instanceof ItemTouchHelperViewHolder) { ItemTouchHelperViewHolder itemViewHolder = (ItemTouchHelperViewHolder) viewHolder; itemViewHolder.onItemSelected(); } } super.onSelectedChanged(viewHolder, actionState); } @Override public void clearView(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) { super.clearView(recyclerView, viewHolder); viewHolder.itemView.setAlpha(ALPHA_FULL); if (viewHolder instanceof ItemTouchHelperViewHolder) { ItemTouchHelperViewHolder itemViewHolder = (ItemTouchHelperViewHolder) viewHolder; itemViewHolder.onItemClear(); } } }
fbad01d21840d5aeb1d1b3f052ac2f3db4273f49
f2a331fccc82176756ef33612d039e1e61fad125
/src/main/java/ru/lang/tuto/lex/em/PlusLexem.java
37a07c458f1f02462c8b2dcfbc227ec2426f1bf5
[]
no_license
aamatveev/lex
7ac725406c3fb4096efe15d2cd37ee7d4b941f72
c57e391e0a4b84b3fa65c849f2c41519ea4afded
refs/heads/master
2023-07-08T09:13:57.080668
2021-08-19T13:42:21
2021-08-19T13:42:21
397,943,403
0
0
null
null
null
null
UTF-8
Java
false
false
294
java
package ru.lang.tuto.lex.em; import ru.lang.tuto.poi.Pointer; public class PlusLexem extends Lexem { public PlusLexem(Pointer<Character> begin, Pointer<Character> end) { super(begin, end); } @Override public String toString() { return "PlusLexem{}"; } }
320087123d8827cc3e68bf3279b35061e32a0bdc
1a18ec7448119e3865cc3745e9c6e1c986adad46
/bouncyrightangleview/src/test/java/com/anwesh/uiprojects/bouncyrightangleview/ExampleUnitTest.java
eba0b166369204eb6c9282a12f513af186998e1c
[]
no_license
Anwesh43/LinkedBouncyRightAngleView-
0bcd4cb76d7f20da37666396f8da57d7ba07c355
4db0fba0f36ea7a263fbedf41e8d66e9d98a7202
refs/heads/master
2020-09-30T06:20:28.119335
2019-12-10T22:18:42
2019-12-10T22:18:42
227,226,521
0
0
null
null
null
null
UTF-8
Java
false
false
420
java
package com.anwesh.uiprojects.bouncyrightangleview; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
8d874f27cbab6f9cb2cb26a71bde043950014f8d
889e1cc6ff5a13fc42fe41e49b8a22de56fac36d
/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/AysOrg.java
9bfe8981434e863bfbe4d2a8c8f1e89e655cb1b5
[ "MIT" ]
permissive
tea-tea-wyr/Background-management-system-of-campus-activities
e52facc213cf7087e8dabde05380ae7388a85d7f
d89bb303ebbaad847b565c6ce612c0ec959c7d0d
refs/heads/main
2023-02-10T06:35:02.977927
2021-01-10T12:35:23
2021-01-10T12:35:23
325,523,377
0
1
null
2021-01-10T12:35:24
2020-12-30T10:39:56
null
UTF-8
Java
false
false
4,298
java
package com.ruoyi.common.core.domain.entity; import com.ruoyi.common.core.domain.BaseEntity; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import javax.validation.constraints.Email; import javax.validation.constraints.NotBlank; import javax.validation.constraints.Size; import java.util.ArrayList; import java.util.List; /** * 部门表 sys_org * * @author ruoyi */ public class AysOrg extends BaseEntity { private static final long serialVersionUID = 1L; /** 部门ID */ private Long orgId; /** 父部门ID */ private Long parentId; /** 祖级列表 */ private String ancestors; /** 部门名称 */ private String orgName; /** 显示顺序 */ private String orderNum; /** 负责人 */ private String leader; /** 联系电话 */ private String phone; /** 邮箱 */ private String email; /** 部门状态:0正常,1停用 */ private String status; /** 删除标志(0代表存在 2代表删除) */ private String delFlag; /** 父部门名称 */ private String parentName; /** 子部门 */ private List<AysOrg> children = new ArrayList<AysOrg>(); public Long getOrgId() { return orgId; } public void setOrgId(Long orgId) { this.orgId = orgId; } public Long getParentId() { return parentId; } public void setParentId(Long parentId) { this.parentId = parentId; } public String getAncestors() { return ancestors; } public void setAncestors(String ancestors) { this.ancestors = ancestors; } @NotBlank(message = "部门名称不能为空") @Size(min = 0, max = 30, message = "部门名称长度不能超过30个字符") public String getOrgName() { return orgName; } public void setOrgName(String orgName) { this.orgName = orgName; } @NotBlank(message = "显示顺序不能为空") public String getOrderNum() { return orderNum; } public void setOrderNum(String orderNum) { this.orderNum = orderNum; } public String getLeader() { return leader; } public void setLeader(String leader) { this.leader = leader; } @Size(min = 0, max = 11, message = "联系电话长度不能超过11个字符") public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } @Email(message = "邮箱格式不正确") @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符") public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public String getDelFlag() { return delFlag; } public void setDelFlag(String delFlag) { this.delFlag = delFlag; } public String getParentName() { return parentName; } public void setParentName(String parentName) { this.parentName = parentName; } public List<AysOrg> getChildren() { return children; } public void setChildren(List<AysOrg> children) { this.children = children; } @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) .append("orgId", getOrgId()) .append("parentId", getParentId()) .append("ancestors", getAncestors()) .append("orgName", getOrgName()) .append("orderNum", getOrderNum()) .append("leader", getLeader()) .append("phone", getPhone()) .append("email", getEmail()) .append("status", getStatus()) .append("delFlag", getDelFlag()) .append("createBy", getCreateBy()) .append("createTime", getCreateTime()) .append("updateBy", getUpdateBy()) .append("updateTime", getUpdateTime()) .toString(); } }
5cc7f76fe1594a7cc91251838f4c23e9cf5913bc
8740341084e41f5b3328490f56d64f61a01fee1b
/isportlibrary/src/main/java/com/isport/isportlibrary/database/DatabaseHelper.java
8c4ce22734a95c7bd84a03cb52f570a2bcf5f3e0
[]
no_license
sengeiou/ISportTracker
ecfee9e8e1fb34219e3711597038234de9dab141
88f7a7bcf2abbd3275b4d539667a396b78746e2d
refs/heads/master
2023-07-08T06:20:15.386196
2021-08-19T02:36:20
2021-08-19T02:36:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,319
java
package com.isport.isportlibrary.database; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; /** * @author Created by Marcos Cheng on 2016/9/23. */ public class DatabaseHelper extends SQLiteOpenHelper { private static int version = 5; private static String databaseName = "isport.db"; private static DatabaseHelper sIntances; private SQLiteDatabase db; public static DatabaseHelper getInstance(Context context) { if (sIntances == null) { synchronized (DatabaseHelper.class) { if (sIntances == null) { sIntances = new DatabaseHelper(context.getApplicationContext()); } } } return sIntances; } private DatabaseHelper(Context context) { super(context, databaseName, null, version); } private void createTables(SQLiteDatabase db) { db.execSQL(DbBaseDevice.TABLE_CREATE_SQL); db.execSQL(DbSprotDayData.TABLE_CREATE_SQL); db.execSQL(DbHistorySport.TABLE_CREATE_SQL); db.execSQL(DbRealTimePedo.TABLE_CREATE_SQL); db.execSQL(DbHistorySportN.TABLE_CREATE_SQL); db.execSQL(DbSportData337B.CREATE_SQL); db.execSQL(DbHeartRateHistory.TABLE_SQL); } @Override public void onCreate(SQLiteDatabase db) { this.db = db; createTables(db); } /** * you can see {@link SQLiteDatabase#replace(String, String, ContentValues)} * * @param table * @param nullColumnHack * @param initialValues */ public void replace(String table, String nullColumnHack, ContentValues initialValues) { SQLiteDatabase db = getWritableDatabase(); db.replace(table, nullColumnHack, initialValues); } /** * you can see {@link SQLiteOpenHelper#onUpgrade(SQLiteDatabase, int, int)} * * @param db * @param oldVersion * @param newVersion */ @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { createTables(db); if (oldVersion == 1) { //alter table **** add **** integer/varchar2 String sql1 = "alter table " + DbBaseDevice.TABLE_NAME + " add " + DbBaseDevice.COLUMN_DEVICE_TYPE + " " + "integer"; //String sql2 = "BEGIN TRANSACTION;"; /*String sql3 = "Create TEMPORARY table 't1_backup'(" + "'" + DbBaseDevice.COLUMN_NAME + "' varchar(50) not null," + "'" + DbBaseDevice.COLUMN_MAC + "' varchar(30) not null," + "'" + DbBaseDevice.COLUMN_DEVICE_TYPE + "' int," + "'" + DbBaseDevice.COLUMN_PROFILE_TYPE + "' int," + "'" + DbBaseDevice.COLUMN_CONNECTED_TIME + "' BIGINT," + "PRIMARY KEY ('name','mac'));";*/ String sql3 = "Create TEMPORARY table 't1_backup'(" + "'" + DbBaseDevice.COLUMN_NAME + "' varchar(50) not null," + "'" + DbBaseDevice.COLUMN_MAC + "' varchar(30) not null," + "'" + DbBaseDevice.COLUMN_DEVICE_TYPE + "' int," + "'" + DbBaseDevice.COLUMN_PROFILE_TYPE + "' int," + "'" + DbBaseDevice.COLUMN_CONNECTED_TIME + "' BIGINT);"; String sql4 = "INSERT INTO t1_backup SELECT '" + DbBaseDevice.COLUMN_NAME + "','" + DbBaseDevice .COLUMN_MAC + "','" + DbBaseDevice.COLUMN_DEVICE_TYPE + "','" + DbBaseDevice.COLUMN_PROFILE_TYPE + "','" + DbBaseDevice .COLUMN_CONNECTED_TIME + "' FROM " + DbBaseDevice.TABLE_NAME + ";"; String sql5 = "DROP TABLE " + DbBaseDevice.TABLE_NAME + ";"; /*String sql6 = "CREATE TABLE " + DbBaseDevice.TABLE_NAME + "('" + DbBaseDevice.COLUMN_NAME + "' varchar (50) not null,'" + DbBaseDevice.COLUMN_MAC + "' varchar(30) not null,'" + DbBaseDevice.COLUMN_DEVICE_TYPE + "' int,'" + DbBaseDevice .COLUMN_PROFILE_TYPE + "' int,'" + DbBaseDevice.COLUMN_CONNECTED_TIME + "' BIGINT,PRIMARY KEY ('" + DbBaseDevice .COLUMN_NAME + "','" + DbBaseDevice.COLUMN_MAC + "'));";*/ String sql6 = "CREATE TABLE " + DbBaseDevice.TABLE_NAME + "('" + DbBaseDevice.COLUMN_NAME + "' varchar" + "(50) not null,'" + DbBaseDevice.COLUMN_MAC + "' varchar(30) not null,'" + DbBaseDevice.COLUMN_DEVICE_TYPE + "' int,'" + DbBaseDevice .COLUMN_PROFILE_TYPE + "' int,'" + DbBaseDevice.COLUMN_CONNECTED_TIME + "' BIGINT);"; String sql7 = "INSERT INTO " + DbBaseDevice.TABLE_NAME + " SELECT '" + DbBaseDevice.COLUMN_NAME + "','" + DbBaseDevice.COLUMN_MAC + "','" + DbBaseDevice.COLUMN_DEVICE_TYPE + "','" + DbBaseDevice.COLUMN_PROFILE_TYPE + "','" + DbBaseDevice.COLUMN_CONNECTED_TIME + "' FROM t1_backup;"; String sql8 = "DROP TABLE t1_backup;"; //"COMMIT;"; db.execSQL(sql1); db.beginTransaction(); db.execSQL(sql3); db.execSQL(sql4); db.execSQL(sql5); db.execSQL(sql6); db.execSQL(sql7); db.execSQL(sql8); db.setTransactionSuccessful(); db.endTransaction(); } if (oldVersion == 1 || oldVersion == 2) { db.execSQL(DbSportData337B.CREATE_SQL); } this.db = db; } /** * you can see {@link SQLiteDatabase#insert(String, String, ContentValues)} * * @param table * @param values * @return */ public long insert(String table, ContentValues values) { SQLiteDatabase db = getWritableDatabase(); return db.insert(table, null, values); } /** * delete from table , see {@link SQLiteDatabase#delete(String, String, String[])} * * @param tablename * @param whereClause * @param whereArgs * @return */ public int delete(String tablename, String whereClause, String[] whereArgs) { SQLiteDatabase db = getWritableDatabase(); return db.delete(tablename, whereClause, whereArgs); } /** * update database, see {@link SQLiteDatabase#update(String, ContentValues, String, String[])} * * @param table * @param values * @param whereClause * @param whereArgs */ public void update(String table, ContentValues values, String whereClause, String[] whereArgs) { SQLiteDatabase db = getWritableDatabase(); db.update(table, values, whereClause, whereArgs); } /** * query according selection, see * {@link SQLiteDatabase#query(String, String[], String, String[], String, String, String, String)} * * @param tablename * @param columns * @param selection * @param selectionArgs * @param groupBy * @param orderby * @return */ public Cursor query(String tablename, String[] columns, String selection, String[] selectionArgs, String groupBy, String orderby) { SQLiteDatabase db = getReadableDatabase(); return db.query(tablename, columns, selection, selectionArgs, groupBy, null, orderby, null); } public Cursor query(String table, String[] columns, String selection, String[] selectionArgs, String groupBy, String having, String orderBy){ SQLiteDatabase db = getWritableDatabase(); return db.query(table,columns,selection,selectionArgs,groupBy,having,orderBy); } /** * query according selection, see {@link #query(String, String[], String, String[], String, String)} * * @param tablename * @param columns * @param selection * @param selectionArgs * @param orderby * @return */ public Cursor query(String tablename, String[] columns, String selection, String[] selectionArgs, String orderby) { return query(tablename, columns, selection, selectionArgs, null, orderby); } /** * exec sql, see {@link SQLiteDatabase#execSQL(String)} * * @param sql the sql String that you want to execute */ public void execSql(String sql) { SQLiteDatabase db = getWritableDatabase(); db.execSQL(sql); } /** * begin transaction * see {@link SQLiteDatabase#beginTransaction()} */ public void beginTransaction() { this.db = getWritableDatabase(); db.beginTransaction(); } /** * end transaction * see {@link SQLiteDatabase#endTransaction()} */ public void endTransaction() { this.db = getWritableDatabase(); db.endTransaction(); } /** * set Transaction Successful * see {@link SQLiteDatabase#setTransactionSuccessful()} */ public void setTransactionSuccessful() { this.db = getWritableDatabase(); db.setTransactionSuccessful(); } }
bced95a892232dca9860b9e4461ffbb16732bdac
f88854475b86d115241ff455a52f1e153633da10
/src/SymbolTables/RedBlackBSTTest.java
851de0017c2d6877d4f51359e3446c3d17692607
[]
no_license
firezdog/algorithms-class-2
073d991f99348ca43a21c6ea82d3a905300e1a24
af7ef19d9e7f69ef76b2a1c243a24928b3886506
refs/heads/master
2022-06-23T12:50:09.410518
2020-05-11T04:37:27
2020-05-11T04:37:27
198,314,300
0
0
null
null
null
null
UTF-8
Java
false
false
3,238
java
package SymbolTables; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; class RedBlackBSTTest extends BSTTest { @BeforeEach void setup() { bst = new RedBlackBST<>(null, null, 1, RedBlackBST.BLACK); } @Test void testIsBalancedForUnbalanced() { bst.left = new RedBlackBST<>(null, null, 1, RedBlackBST.BLACK); bst.right = new RedBlackBST<>(null, null, 1, RedBlackBST.BLACK); bst.right.right = new RedBlackBST<>(null, null, 1, RedBlackBST.BLACK); assertFalse(((RedBlackBST) bst).isBalanced()); } @Test void testIsBalancedForBalanced() { bst.left = new RedBlackBST<>(null, null, 1, RedBlackBST.BLACK); bst.right = new RedBlackBST<>(null, null, 1, RedBlackBST.BLACK); assertTrue(((RedBlackBST) bst).isBalanced()); } @Test // case: it would be balanced if it were just path lengths, but there are red links void testIsBalancedForUnbalancedWithRed() { bst.left = new RedBlackBST<>(null, null, 1, RedBlackBST.BLACK); bst.right = new RedBlackBST<>(null, null, 1, RedBlackBST.RED); assertFalse(((RedBlackBST) bst).isBalanced()); } @Test // case: it would unbalanced, but there are red links. void testIsBalancedForBalancedWithRed() { bst.left = new RedBlackBST<>(null, null, 1, RedBlackBST.BLACK); bst.right = new RedBlackBST<>(null, null, 1, RedBlackBST.BLACK); bst.right.right = new RedBlackBST<>(null, null, 1, RedBlackBST.RED); assertTrue(((RedBlackBST) bst).isBalanced()); } @Test void testIs23WhenAllBlack() { bst.left = new RedBlackBST<>(null, null, 1, RedBlackBST.BLACK); bst.right = new RedBlackBST<>(null, null, 1, RedBlackBST.BLACK); bst.left.left = new RedBlackBST<>(null, null, 1, RedBlackBST.BLACK); bst.left.right = new RedBlackBST<>(null, null, 1, RedBlackBST.BLACK); assertTrue(((RedBlackBST) bst).is23()); } @Test void testIs23WhenRedRight() { bst.left = new RedBlackBST<>(null, null, 1, RedBlackBST.BLACK); bst.right = new RedBlackBST<>(null, null, 1, RedBlackBST.BLACK); bst.left.left = new RedBlackBST<>(null, null, 1, RedBlackBST.BLACK); bst.left.right = new RedBlackBST<>(null, null, 1, RedBlackBST.RED); assertFalse(((RedBlackBST) bst).is23()); } @Test void testIs23WhenOneRedLeft() { bst.left = new RedBlackBST<>(null, null, 1, RedBlackBST.BLACK); bst.right = new RedBlackBST<>(null, null, 1, RedBlackBST.BLACK); bst.left.left = new RedBlackBST<>(null, null, 1, RedBlackBST.RED); bst.left.right = new RedBlackBST<>(null, null, 1, RedBlackBST.BLACK); assertTrue(((RedBlackBST) bst).is23()); } @Test void testIs23WhenTwoRedLefts() { bst.left = new RedBlackBST<>(null, null, 1, RedBlackBST.RED); bst.right = new RedBlackBST<>(null, null, 1, RedBlackBST.BLACK); bst.left.left = new RedBlackBST<>(null, null, 1, RedBlackBST.RED); bst.left.right = new RedBlackBST<>(null, null, 1, RedBlackBST.BLACK); assertFalse(((RedBlackBST) bst).is23()); } }
47ba6154140b76e454b5aff157f329cebd263cf4
b4905c9001e84d37c01e715648a1aaa75d75ed61
/src/kr/koreait/Kboard/service/k_InsertService.java
01a0b571a8e8b03345ae14f9a0047cd509a61b19
[]
no_license
kapoki90/BulletinBoard
a1c2ae1e32c01977daf6fd2a62bfb6569cbeb6f4
7e96414a477c1fc89a0a753106cbb7b2f7859ea3
refs/heads/master
2021-01-23T01:26:16.241457
2017-03-23T04:43:28
2017-03-23T04:43:28
85,907,887
0
0
null
null
null
null
UTF-8
Java
false
false
2,402
java
package kr.koreait.Kboard.service; import java.util.HashMap; import org.apache.ibatis.session.SqlSession; import kr.koreait.Kboard.Mybatis.MySession; import kr.koreait.Kboard.dao.KboardCommentDAO; import kr.koreait.Kboard.dao.KboardDAO; import kr.koreait.Kboard.vo.KboardCommentVO; import kr.koreait.Kboard.vo.KboardVO; // 싱글톤 코딩 public class k_InsertService { // 자기 자신의 객체를 정적 멤버로 만든다. private static k_InsertService instance = new k_InsertService(); // 클래스 외부에서 객체를 생성할 수 없도록 기본 생성자의 접근 권한을 private로 변경한다. private k_InsertService() { } // 자기 자신의 객체를 리턴하는 정적 메소드를 만든다. public static k_InsertService getInstance() { return instance; } // 메인글 테이블에 저장할 메인글이 저장된 객체를 넘겨받고 mapper를 얻어오는 메소드 public void insert(KboardVO vo) { SqlSession mapper = MySession.getSession(); // vo.setSubject(vo.getSubject().replace(">", "&gt;").replace("<", // "&lt;")); // vo.setContent(vo.getContent().replace(">", "&gt;").replace("<", // "&lt;").replace("\n", "<br/>")); KboardDAO.getInstance().insert(mapper, vo); mapper.commit(); mapper.close(); } public void reply(KboardVO vo) { SqlSession mapper = MySession.getSession(); KboardDAO dao = KboardDAO.getInstance(); // 서브 카테고리를 저장해야 하므로 레벨(lev)과 카테고리를 출력하는 순서(seq)를 1씩 증가시킨다. vo.setLev(vo.getLev() + 1); // lev 1증가 vo.setSeq(vo.getSeq() + 1); // seq 1증가 // 나중에 입력된 서브 카테고리가 맨 위에 출력되게 하기 위해서 조건에 만족하는 seq를 1씩 증가시킨다. HashMap<String, Integer> hmap = new HashMap<>(); hmap.put("ref", vo.getRef());//ref:어떤글의 답글인가를 알기위한 변수 hmap.put("seq", vo.getSeq());//seq:답글 정렬을 위한 변수 dao.putsubcatogory(mapper, hmap); // 새 서브 카테고리가 삽입될 위치를 정했으므로 테이블에 새 서브 카테고리를 삽입한다. dao.reply(mapper, vo); mapper.commit(); mapper.close(); } public void insertComment(KboardCommentVO vo){ SqlSession mapper = MySession.getSession(); KboardCommentDAO.getInstance().insertComment(mapper, vo); mapper.commit(); mapper.close(); } }
1402d99b0981e0da107d9c29aee6556adab97079
aee55521c12241d953007176f403aca2e842c056
/src/org/omg/PortableServer/POAPackage/ServantNotActiveHelper.java
bf76a02b3757cd15560b9e5fd280c3da28611c0f
[]
no_license
XiaZhouxx/jdk1.8
572988fe007bbdd5aa528945a63005c3cb152ffe
5703d895b91571d41ccdab138aefb9b8774f9401
refs/heads/master
2023-08-30T18:53:23.919988
2021-11-01T07:40:49
2021-11-01T07:40:49
420,957,590
0
0
null
null
null
null
UTF-8
Java
false
false
2,362
java
package org.omg.PortableServer.POAPackage; /** * org/omg/PortableServer/POAPackage/ServantNotActiveHelper.java . * Generated by the IDL-to-Java compiler (portable), version "3.2" * from c:/jenkins/workspace/8-2-build-windows-amd64-cygwin/jdk8u301/1513/corba/src/share/classes/org/omg/PortableServer/poa.idl * Wednesday, June 9, 2021 6:48:04 AM PDT */ abstract public class ServantNotActiveHelper { private static String _id = "IDL:omg.org/PortableServer/POA/ServantNotActive:1.0"; public static void insert (org.omg.CORBA.Any a, org.omg.PortableServer.POAPackage.ServantNotActive 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.PortableServer.POAPackage.ServantNotActive 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.PortableServer.POAPackage.ServantNotActiveHelper.id (), "ServantNotActive", _members0); __active = false; } } } return __typeCode; } public static String id () { return _id; } public static org.omg.PortableServer.POAPackage.ServantNotActive read (org.omg.CORBA.portable.InputStream istream) { org.omg.PortableServer.POAPackage.ServantNotActive value = new org.omg.PortableServer.POAPackage.ServantNotActive (); // read and discard the repository ID istream.read_string (); return value; } public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.PortableServer.POAPackage.ServantNotActive value) { // write the repository ID ostream.write_string (id ()); } }
8fee90ac263aa3c05c469106c7b18c513f6c7390
0b4844d550c8e77cd93940e4a1d8b06d0fbeabf7
/JavaSource/dream/note/daily/dao/sqlImpl/MaWoDailyDetailDAOSqlImpl.java
6fd451a15f992c82b48f2caed539efa5312faf9f
[]
no_license
eMainTec-DREAM/DREAM
bbf928b5c50dd416e1d45db3722f6c9e35d8973c
05e3ea85f9adb6ad6cbe02f4af44d941400a1620
refs/heads/master
2020-12-22T20:44:44.387788
2020-01-29T06:47:47
2020-01-29T06:47:47
236,912,749
0
0
null
null
null
null
UHC
Java
false
false
28,705
java
package dream.note.daily.dao.sqlImpl; import java.util.List; import common.bean.User; import common.spring.BaseJdbcDaoSupportSql; import common.spring.MwareExtractor; import common.util.DateUtil; import common.util.QuerySqlBuffer; import dream.note.daily.dao.MaWoDailyDetailDAO; import dream.note.daily.dto.MaWoDailyCommonDTO; import dream.note.daily.dto.MaWoDailyDetailDTO; import dream.pers.appreq.dto.AppReqDetailDTO; /** * - 상세 dao * * @author kim21017 * @version $Id: $ * @since 1.0 * @spring.bean id="maWoDailyDetailDAOTarget" * @spring.txbn id="maWoDailyDetailDAO" * @spring.property name="dataSource" ref="dataSource" */ public class MaWoDailyDetailDAOSqlImpl extends BaseJdbcDaoSupportSql implements MaWoDailyDetailDAO { /** * detail find * @author kim21017 * @version $Id:$ * @since 1.0 * * @param IfFailureCommonDTO * @param loginUser * @return */ public MaWoDailyDetailDTO findDetail(MaWoDailyCommonDTO maWoDailyCommonDTO, User loginUser) { QuerySqlBuffer query = new QuerySqlBuffer(); query.append("SELECT "); query.append(" a.wodaylist_id woDayListId, "); query.append(" a.wodaylist_id woDayListNo, "); query.append(" a.wodaylist_status wodaylistStatus, "); query.append(" dbo.SFACODE_TO_DESC(a.wodaylist_status,'WODAYLIST_STATUS','SYS','','"+loginUser.getLangId()+"') wodaylistStatusDesc, "); query.append(" a.description title, "); query.append(" a.wo_date woDate, "); query.append(" a.wo_dept woDeptId, "); query.append(" (SELECT description "); query.append(" FROM TADEPT "); query.append(" WHERE comp_no = a.comp_no "); query.append(" AND dept_id = a.wo_dept) woDeptDesc, "); query.append(" a.start_fdate startFdate, "); query.append(" a.start_ftime startFtime, "); query.append(" a.start_edate startEdate, "); query.append(" a.start_etime startEtime, "); query.append(" a.upd_by updById, "); query.append(" (SELECT x.emp_name+'/'+y.description "); query.append(" FROM TAEMP x INNER JOIN TADEPT y "); query.append(" ON x.comp_no = y.comp_no "); query.append(" AND x.dept_id = y.dept_id "); query.append(" WHERE x.comp_no = a.comp_no "); query.append(" AND x.emp_id = a.upd_by) updByDesc, "); query.append(" a.plant plant, "); query.append(" (SELECT description "); query.append(" FROM TAPLANT "); query.append(" WHERE comp_no = a.comp_no "); query.append(" AND plant = a.plant) plantDesc, "); query.append(" a.remark remark "); query.append(" , a.equip_id equipId "); query.append(" , (SELECT b.description "); query.append(" FROM TAEQUIPMENT b "); query.append(" WHERE b.comp_no = a.comp_no "); query.append(" AND b.equip_id = a.equip_id) equipDesc "); query.append(" , a.wkctr_id wkCtrId "); query.append(" , (SELECT b.description "); query.append(" FROM TAWKCTR b "); query.append(" WHERE b.comp_no = a.comp_no "); query.append(" AND b.wkctr_id = a.wkctr_id) wkCtrDesc "); query.append("FROM TAWODAYLIST a "); query.append("WHERE 1 = 1 "); query.getAndQuery("a.comp_no", loginUser.getCompNo()); query.getAndQuery("a.wodaylist_id", maWoDailyCommonDTO.getWoDayListId()); MaWoDailyDetailDTO resultDTO = (MaWoDailyDetailDTO)getJdbcTemplate().query(query.toString(), new MwareExtractor(new MaWoDailyDetailDTO())); return resultDTO; } /** * detail update * @author kim21017 * @version $Id:$ * @since 1.0 * * @param IfFailureDetailDTO * @return */ public int updateDetail(MaWoDailyDetailDTO maWoDailyDetailDTO, User user) { QuerySqlBuffer query = new QuerySqlBuffer(); query.append("UPDATE TAWODAYLIST SET "); query.append(" description = ?, "); query.append(" wo_date = ?, "); query.append(" wo_dept = ?, "); query.append(" start_fdate = ?, "); query.append(" start_ftime = ?, "); query.append(" start_edate = ?, "); query.append(" start_etime = ?, "); query.append(" remark = ? "); query.append(" ,wkctr_id = ? "); query.append(" ,equip_id = ? "); query.append("WHERE wodaylist_id = ? "); query.append("AND comp_no = ? "); Object[] objects = new Object[] { maWoDailyDetailDTO.getTitle(), maWoDailyDetailDTO.getWoDate(), maWoDailyDetailDTO.getWoDeptId(), maWoDailyDetailDTO.getStartFdate(), maWoDailyDetailDTO.getStartFtime(), maWoDailyDetailDTO.getStartEdate(), maWoDailyDetailDTO.getStartEtime(), maWoDailyDetailDTO.getRemark(), maWoDailyDetailDTO.getWkCtrId(), maWoDailyDetailDTO.getEquipId(), maWoDailyDetailDTO.getWoDayListId(), user.getCompNo() }; return this.getJdbcTemplate().update(query.toString(), getObject(objects)); } public int insertDetail(MaWoDailyDetailDTO maWoDailyDetailDTO, User loginUser) { QuerySqlBuffer query = new QuerySqlBuffer(); int rtnValue = 0; query.append("INSERT INTO TAWODAYLIST "); query.append(" (comp_no, wodaylist_id, wodaylist_status,"); query.append(" wo_dept, upd_by, upd_date, "); query.append(" remark, wo_date, plant, "); query.append(" description, start_fdate, start_ftime, "); query.append(" start_edate, start_etime, wkctr_id "); query.append(" ,equip_id "); query.append(" ) VALUES "); query.append(" (?, ?, ?, "); query.append(" ?, ?, ?, "); query.append(" ?, ?, ?, "); query.append(" ?, ?, ?, "); query.append(" ?, ?, ? "); query.append(" ,? "); query.append(" ) "); Object[] objects = new Object[] { loginUser.getCompNo(), maWoDailyDetailDTO.getWoDayListId(), maWoDailyDetailDTO.getWoDayListStatus(), maWoDailyDetailDTO.getWoDeptId(), maWoDailyDetailDTO.getUpdById(), DateUtil.getDate(), maWoDailyDetailDTO.getRemark(), maWoDailyDetailDTO.getWoDate(), maWoDailyDetailDTO.getPlant(), maWoDailyDetailDTO.getTitle(), maWoDailyDetailDTO.getStartFdate(), maWoDailyDetailDTO.getStartFtime(), maWoDailyDetailDTO.getStartEdate(), maWoDailyDetailDTO.getStartEtime(), maWoDailyDetailDTO.getWkCtrId() ,maWoDailyDetailDTO.getEquipId() }; rtnValue = getJdbcTemplate().update(query.toString(), getObject(objects)); return rtnValue; } public int insertBmActivities(MaWoDailyDetailDTO maWoDailyDetailDTO, User loginUser) { QuerySqlBuffer query = new QuerySqlBuffer(); int rtnValue = 0; // query.append("INSERT INTO TAWODAYACT "); // query.append(" (comp_no, wodaylist_id, "); // query.append(" wodayact_id, emp_id, "); // query.append(" eq_name, act_contents, "); // query.append(" action, ord_no "); // query.append(" ) "); // query.append("SELECT ?, ?, "); // query.append(" NEXT VALUE FOR SQAWODAYACT_ID,x.emp_id,"); // query.append(" STUFF((SELECT ',' + CASE b.eqctg_type WHEN 'MD' THEN '('+b.old_eq_no+')'+b.description ELSE b.description END "); // query.append(" FROM TAWOEQUIP a, TAEQUIPMENT b "); // query.append(" WHERE a.comp_no = b.comp_no "); // query.append(" AND a.equip_id = b.equip_id "); // query.append(" AND a.wkor_id = x.wkor_id "); // query.append(" AND a.comp_no = x.comp_no "); // query.append(" FOR XML PATH('')),1,1,''), "); // query.append(" x.description, "); // query.append(" y.re_desc, "); // query.append(" '10' "); // query.append("FROM TAWORKORDER x, TAWOFAIL y "); // query.append("WHERE x.comp_no = y.comp_no "); // query.append("AND x.wkor_id = y.wkor_id "); // query.getStringEqualQuery("x.wo_status","C"); // query.getStringEqualQuery("x.comp_no",loginUser.getCompNo()); // query.getStringEqualQuery("x.wo_status","C"); // query.getStringEqualQuery("x.wo_type","BM"); // query.getStringEqualQuery("x.wkor_date",maWoDailyDetailDTO.getWoDate()); // query.getAndNumKeyQuery("x.dept_id", maWoDailyDetailDTO.getWoDeptId()); // query.append("INSERT INTO TAWODAYACT "); query.append(" (comp_no, wodaylist_id, "); query.append(" wodayact_id, emp_id, "); query.append(" eq_name, act_contents, "); query.append(" action, ord_no "); query.append(" ) "); query.append("SELECT ?, ?, "); query.append(" NEXT VALUE FOR SQAWODAYACT_ID,x.emp_id, "); query.append(" CASE b.eqctg_type WHEN 'MD' "); query.append(" THEN '('+b.old_eq_no+')'+b.description "); query.append(" ELSE b.description "); query.append(" END, "); query.append(" x.description, "); query.append(" y.re_desc, "); query.append(" '10' "); query.append("FROM TAWORKORDER x INNER JOIN TAWOPARTS yy "); query.append("ON x.comp_no = yy.comp_no "); query.append(" AND x.wkor_id = yy.wkor_id "); query.append(" LEFT OUTER JOIN TAWOFAIL y "); query.append(" ON x.wkor_id = y.wkor_id "); query.append(" AND x.comp_no = y.comp_no "); query.append(" INNER JOIN TAWOEQUIP a "); query.append(" ON x.comp_no = a.comp_no "); query.append(" AND x.wkor_id = a.wkor_id "); query.append(" INNER JOIN TAEQUIPMENT b "); query.append(" ON a.comp_no = b.comp_no "); query.append(" AND a.equip_id = b.equip_id "); Object[] objects = new Object[] { loginUser.getCompNo(), maWoDailyDetailDTO.getWoDayListId(), }; rtnValue = getJdbcTemplate().update(query.toString(), objects); return rtnValue; } public String checkList(MaWoDailyDetailDTO maWoDailyDetailDTO) { QuerySqlBuffer query = new QuerySqlBuffer(); query.append("SELECT "); query.append(" wodaylist_id "); query.append("FROM TAWODAYLIST a "); query.append("WHERE 1 = 1 "); query.getAndQuery("a.wo_date", maWoDailyDetailDTO.getWoDate()); query.getAndQuery("a.wo_dept", maWoDailyDetailDTO.getWoDeptId()); List resultList = getJdbcTemplate().queryForList(query.toString()); return QuerySqlBuffer.listToString(resultList); } public int setStatus(AppReqDetailDTO appReqDetailDTO, User user) { QuerySqlBuffer query = new QuerySqlBuffer(); query.append("UPDATE TAWODAYLIST SET "); query.append(" wodaylist_status = ? "); query.append("WHERE wodaylist_id = ? "); query.append("AND comp_no = ? "); Object[] objects = new Object[] { appReqDetailDTO.getParentStatus(), appReqDetailDTO.getObjectId(), user.getCompNo() }; return this.getJdbcTemplate().update(query.toString(), getObject(objects)); } public List findReportWoDetail(MaWoDailyDetailDTO maWoDailyDetailDTO) { QuerySqlBuffer query = new QuerySqlBuffer(); String lang = maWoDailyDetailDTO.getUserLang(); query.append("SELECT "); query.append(" CONVERT(VARCHAR, CONVERT(DATE, x.wo_date), 23) +' ('+ "); query.append("(SELECT key_name FROM TALANG WHERE 1=1 "); query.getAndQuery("lang", lang); query.append("AND key_no = 'week'+(SELECT dow FROM TADAY where tday = x.wo_date) "); query.append(")+')' woToday, "); query.append(" SUBSTRING(x.wo_date,7,2)+' . '+SUBSTRING(x.wo_date,5,2)+' . '+SUBSTRING(x.wo_date,1,4) woToday2, "); query.append(" (SELECT description "); query.append(" FROM TADEPT "); query.append(" WHERE comp_no = x.comp_no "); query.append(" AND dept_id = x.wo_dept) deptDesc, "); query.append(" CONVERT(VARCHAR, GETDATE(), 23) +' '+ LEFT(CONVERT(VARCHAR, GETDATE(), 108),5) TODAY, "); query.append(" (SELECT key_name FROM TALANG WHERE lang='"+lang+"' AND key_no='woDailyList' AND key_type='LABEL') woDailyList, "); query.append(" (SELECT key_name FROM TALANG WHERE lang='"+lang+"' AND key_no='equipName' AND key_type='LABEL') equipName, "); query.append(" (SELECT key_name FROM TALANG WHERE lang='"+lang+"' AND key_no='eqLocName' AND key_type='LABEL') eqLocName, "); query.append(" (SELECT key_name FROM TALANG WHERE lang='"+lang+"' AND key_no='manager' AND key_type='LABEL') manager, "); query.append(" (SELECT key_name FROM TALANG WHERE lang='"+lang+"' AND key_no='woRemark' AND key_type='LABEL') woRemark, "); query.append(" (SELECT key_name FROM TALANG WHERE lang='"+lang+"' AND key_no='workTime' AND key_type='LABEL') workTime, "); query.append(" (SELECT key_name FROM TALANG WHERE lang='"+lang+"' AND key_no='insertParts' AND key_type='LABEL') insertParts "); query.append("FROM TAWODAYLIST x "); query.append("WHERE 1=1 "); query.getAndQuery("x.comp_no", maWoDailyDetailDTO.getCompNo()); query.getAndQuery("x.wodaylist_id", maWoDailyDetailDTO.getWoDayListId()); return getJdbcTemplate().queryForList(query.toString()); } public List findReportWorkList(MaWoDailyDetailDTO maWoDailyDetailDTO) { QuerySqlBuffer query = new QuerySqlBuffer(); query.append("SELECT "); query.append(" CASE WHEN (select count(1) from tawoequip where comp_no = x.comp_no AND wkor_id = y.wkor_id)<=1 "); query.append(" THEN (select (SELECT description FROM TAEQUIPMENT a where a.comp_no = b.comp_no AND a.equip_id = b.equip_id) "); query.append(" FROM tawoequip b where comp_no = x.comp_no AND wkor_id = y.wkor_id) "); query.append(" ELSE (select (SELECT TOP 1 description FROM TAEQUIPMENT a where a.comp_no = b.comp_no AND a.equip_id = b.equip_id) "); query.append(" FROM tawoequip b where comp_no = x.comp_no AND wkor_id = y.wkor_id)+ ' 외 '+ "); query.append(" (select count(1)-1 from tawoequip where comp_no = x.comp_no AND wkor_id = y.wkor_id)+ ' 건 ' "); query.append(" END equipDesc, "); query.append(" (SELECT full_desc FROM TAEQLOC "); query.append(" WHERE comp_no = x.comp_no "); query.append(" AND eqloc_id = y.eqloc_id ) eqLocDesc, "); query.append(" y.perform woDesc, "); query.append(" CONVERT(VARCHAR,CONVERT(DATE,y.start_date),23)+' '+SUBSTRING(y.start_time,1,2)+':'+SUBSTRING(y.start_time,3,2)+':00'+ ' - ' + "); query.append(" CONVERT(VARCHAR,CONVERT(DATE,y.end_date),23)+' '+SUBSTRING(y.end_time,1,2)+':'+SUBSTRING(y.end_time,3,2)+':00' "); query.append(" woTime, "); query.append(" (select emp_name FROM TAEMP WHERE 1=1 AND comp_no = x.comp_no AND emp_id = y.emp_id) "); query.append(" empName, "); query.append(" case when (select count(1) from tawoparts where comp_no=y.comp_no AND wkor_id=y.wkor_id)<=1 "); query.append(" then (select (SELECT description FROM TAPARTS a where a.comp_no = b.comp_no AND a.part_id = b.part_id) "); query.append(" FROM tawoparts b where comp_no = x.comp_no AND wkor_id = y.wkor_id) "); query.append(" ELSE (select (SELECT TOP 1 description FROM TAPARTS a where a.comp_no = b.comp_no AND a.part_id = b.part_id) "); query.append(" FROM tawoparts b where comp_no = x.comp_no AND wkor_id = y.wkor_id )+ ' 외 ' + "); query.append(" (select count(1)-1 from tawoparts where comp_no = x.comp_no AND wkor_id = y.wkor_id)+ ' 건 ' "); query.append(" END woPartDesc "); query.append("FROM TAWODAYLIST x, TAWORKORDER y "); query.append("WHERE 1=1 "); query.append("AND x.comp_no = y.comp_no "); query.append("AND x.wo_date = y.wkor_date "); query.append("AND x.wo_dept = y.dept_id "); query.append("and y.wo_type <> 'PMI' "); query.append("and y.pm_type <> 'INS' "); query.getAndQuery("x.comp_no", maWoDailyDetailDTO.getCompNo()); query.getAndQuery("x.wodaylist_id", maWoDailyDetailDTO.getWoDayListId()); query.append("ORDER BY y.wo_no "); return getJdbcTemplate().queryForList(query.toString()); } public List findReportSLPWorkList1(MaWoDailyDetailDTO maWoDailyDetailDTO, User user) { QuerySqlBuffer query = new QuerySqlBuffer(); int listSize = getListSize(maWoDailyDetailDTO, user).size(); query.append("SELECT ROW_NUMBER() OVER (ORDER BY aa.equipDesc) no "); query.append(" ,aa.equipDesc "); query.append(" ,aa.trouble "); query.append(" ,aa.lineStop "); query.append(" ,aa.repair "); query.append(" ,aa.roa "); query.append(" ,aa.report "); query.append("FROM "); query.append("( "); query.append("SELECT "); query.append(" CASE WHEN (select count(1) from tawoequip where comp_no = x.comp_no AND wkor_id = y.wkor_id)<=1 "); query.append(" THEN (select (SELECT description FROM TAEQUIPMENT a where a.comp_no = b.comp_no AND a.equip_id = b.equip_id) "); query.append(" FROM tawoequip b where comp_no = x.comp_no AND wkor_id = y.wkor_id) "); query.append(" ELSE (select (SELECT TOP 1 description FROM TAEQUIPMENT a where a.comp_no = b.comp_no AND a.equip_id = b.equip_id) "); query.append(" FROM tawoequip b where comp_no = x.comp_no AND wkor_id = y.wkor_id)+ ' And '+ "); query.append(" (select count(1)-1 from tawoequip where comp_no = x.comp_no AND wkor_id = y.wkor_id)+ ' Cnt ' "); query.append(" END equipDesc "); query.append(" ,ISNULL(z.ca_desc,'-') trouble "); query.append(" ,CASE z.lndn_work_time WHEN null THEN '-' ELSE z.lndn_work_time+' MIN' END lineStop "); query.append(" ,CASE z.eqdn_work_time WHEN null THEN '-' ELSE z.eqdn_work_time+' MIN' END repair "); query.append(" ,ISNULL(z.re_desc,'-') roa "); query.append(" ,(SELECT emp_name FROM TAEMP WHERE emp_id = y.emp_id) report "); query.append("FROM TAWODAYLIST x, TAWORKORDER y, TAWOFAIL z "); query.append("WHERE 1=1 "); query.append("AND x.comp_no = y.comp_no "); query.append("AND y.comp_no = z.comp_no "); query.append("AND x.wo_date = y.wkor_date "); query.append("AND x.wo_dept = y.dept_id "); query.append("AND y.wkor_id = z.wkor_id "); query.append("and y.wo_type <> 'PMI' "); query.append("and y.pm_type <> 'INS' "); query.append("AND z.lndn_work_time is not null "); query.getAndQuery("x.comp_no", maWoDailyDetailDTO.getCompNo()); query.getAndQuery("x.wodaylist_id", maWoDailyDetailDTO.getWoDayListId()); for (int i = listSize; i < 5; i++) { query.append("UNION ALL SELECT '','','','','','' "); } query.append(") aa"); return getJdbcTemplate().queryForList(query.toString()); } public List getListSize(MaWoDailyDetailDTO maWoDailyDetailDTO, User user) { QuerySqlBuffer query = new QuerySqlBuffer(); query.append("SELECT "); query.append(" ROW_NUMBER() OVER (ORDER BY 1) no "); query.append(" ,CASE WHEN (select count(1) from tawoequip where comp_no = x.comp_no AND wkor_id = y.wkor_id)<=1 "); query.append(" THEN (select (SELECT description FROM TAEQUIPMENT a where a.comp_no = b.comp_no AND a.equip_id = b.equip_id) "); query.append(" FROM tawoequip b where comp_no = x.comp_no AND wkor_id = y.wkor_id) "); query.append(" ELSE (select (SELECT TOP 1 description FROM TAEQUIPMENT a where a.comp_no = b.comp_no AND a.equip_id = b.equip_id) "); query.append(" FROM tawoequip b where comp_no = x.comp_no AND wkor_id = y.wkor_id)+ ' And '+ "); query.append(" (select count(1)-1 from tawoequip where comp_no = x.comp_no AND wkor_id = y.wkor_id)+ ' Cnt ' "); query.append(" END equipDesc "); query.append(" ,ISNULL(z.ca_desc,'-') trouble "); query.append(" ,CASE z.lndn_work_time WHEN null THEN '-' ELSE z.lndn_work_time+' MIN' END lineStop "); query.append(" ,CASE z.eqdn_work_time WHEN null THEN '-' ELSE z.eqdn_work_time+' MIN' END repair "); query.append(" ,ISNULL(z.re_desc,'-') roa "); query.append(" ,(SELECT emp_name FROM TAEMP WHERE emp_id = y.emp_id) report "); query.append("FROM TAWODAYLIST x, TAWORKORDER y, TAWOFAIL z "); query.append("WHERE 1=1 "); query.append("AND x.comp_no = y.comp_no "); query.append("AND y.comp_no = z.comp_no "); query.append("AND x.wo_date = y.wkor_date "); query.append("AND x.wo_dept = y.dept_id "); query.append("AND y.wkor_id = z.wkor_id "); query.append("AND y.wo_type <> 'PMI' "); query.append("AND y.pm_type <> 'INS' "); query.append("AND z.lndn_work_time is not null "); query.getAndQuery("x.comp_no", maWoDailyDetailDTO.getCompNo()); query.getAndQuery("x.wodaylist_id", maWoDailyDetailDTO.getWoDayListId()); return getJdbcTemplate().queryForList(query.toString()); } public List findReportSLPWorkList2(MaWoDailyDetailDTO maWoDailyDetailDTO, User user) { QuerySqlBuffer query = new QuerySqlBuffer(); query.append("SELECT "); query.append(" ROW_NUMBER() OVER (ORDER BY x.ord_no ) no "); query.append(" ,x.eq_name equipDesc "); query.append(" ,x.act_contents contents "); query.append(" ,x.action action "); query.append(" ,(SELECT emp_name FROM TAEMP WHERE emp_id = x.emp_id) report "); query.append("FROM TAWODAYACT x "); query.append("WHERE 1=1 "); query.getAndQuery("x.comp_no", maWoDailyDetailDTO.getCompNo()); query.getAndQuery("x.wodaylist_id", maWoDailyDetailDTO.getWoDayListId()); query.append("ORDER BY x.ord_no "); return getJdbcTemplate().queryForList(query.toString()); } public int updateStatus(MaWoDailyDetailDTO maWoDailyDetailDTO, User loginUser) { QuerySqlBuffer query = new QuerySqlBuffer(); query.append("UPDATE TAWODAYLIST SET "); query.append(" wodaylist_status = ? "); query.append("WHERE wodaylist_id = ? "); query.append(" AND comp_no = ? "); Object[] objects = new Object[] { "C" ,maWoDailyDetailDTO.getWoDayListId() ,loginUser.getCompNo() }; return this.getJdbcTemplate().update(query.toString(), getObject(objects)); } }
d4ff91ba095c28447fbbb1e0f05e108d151ad898
fc702a18325e6b4baa4ce05663e86dca794a9dd6
/MybatisStudy/src/Mybatis/mapper/orderUserMapper.java
c18ebadeb404a3a2932dbc2666b3dffd5c68859c
[]
no_license
heshengqiang/MyJavaStudy
b977ae9d04cb49dfc12713356609aa61d2e35c9a
e6dc4a98e0073f1e0e5be6ccd22e0d7d499864a0
refs/heads/master
2020-05-02T19:46:55.816608
2019-09-11T12:10:32
2019-09-11T12:10:32
178,168,824
1
0
null
null
null
null
UTF-8
Java
false
false
300
java
package Mybatis.mapper; import Mybatis.pojo.orderUSer; import Mybatis.pojo.orders; import java.util.List; public interface orderUserMapper { public List<orderUSer> SelectOrderAndUser(); public List<orders> SelectOrderAndUserMap(); public List<orders> SelectOrderUserLazingLoading(); }
ae088a0f76b30f2f4605f0de5aaa495bd521daf7
03055789c9c33f7ef5e683906de709e8f23f0a47
/app/src/main/java/com/example/biblioteca/LibroController.java
a72e168e30156cb844fe9a607a8ed1b2c6d33589
[]
no_license
misaelortizdp/BibliotecaAndroid
286739352b0ba8e4669af72aa4a960f00f6e2fbd
27f0fb739be49949acf332cede102619cdbd322e
refs/heads/main
2023-06-03T05:45:40.405310
2021-06-29T00:42:41
2021-06-29T00:42:41
381,189,033
0
0
null
null
null
null
UTF-8
Java
false
false
3,442
java
package com.example.biblioteca; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.widget.Toast; public class LibroController { private BaseDatos bd; private Context c; public LibroController( Context c) { this.bd = new BaseDatos(c,1); this.c = c; } public void agregarLibro(Libro l){ try { SQLiteDatabase sql = bd.getWritableDatabase(); ContentValues valores = new ContentValues(); valores.put(DefBD.col_titulo, l.getTitulo()); valores.put(DefBD.col_autor, l.getAutor()); valores.put(DefBD.col_genero, l.getGenero()); valores.put(DefBD.col_editorial, l.getEditorial()); long id = sql.insert(DefBD.tabla_libros, null, valores); //sql.execSQL("insert into " + DefBD.tabla_est + " values (" + e.getCodigo() + "," + e.getNombre() + "," + e.getPrograma() +");"); Toast.makeText(c, "Libro registrado", Toast.LENGTH_LONG).show(); } catch(Exception ex){ Toast.makeText(c, "Error agregando Libro " + ex.getMessage(), Toast.LENGTH_LONG).show(); } } public boolean buscarLibro(Libro l){ String args[] = new String[] {l.getTitulo()}; String[] columnas = {DefBD.col_titulo,DefBD.col_autor, DefBD.col_genero, DefBD.col_editorial}; String col[] = new String[] {DefBD.col_titulo,DefBD.col_autor, DefBD.col_genero, DefBD.col_editorial}; SQLiteDatabase sql = bd.getReadableDatabase(); Cursor c = sql.query(DefBD.tabla_libros ,null,"titulo=?",args,null,null,null); if (c.getCount()>0){ bd.close(); return true; } else{ bd.close(); return false; } } public Cursor allLibros(){ try{ SQLiteDatabase sql = bd.getReadableDatabase(); Cursor cur = sql.rawQuery("select titulo as _id , autor, genero, editorial from libro", null); return cur; } catch (Exception ex){ Toast.makeText(c, "Error consulta libro " + ex.getMessage(), Toast.LENGTH_LONG).show(); return null; } } public void eliminarLibro(String cod){ try{ SQLiteDatabase sql = bd.getReadableDatabase(); String[] args = {cod}; sql.delete(DefBD.tabla_libros,"titulo=?",args); Toast.makeText(c, "Libro eliminado", Toast.LENGTH_LONG).show(); } catch (Exception ex){ Toast.makeText(c, "Error eliminar Libro " + ex.getMessage(), Toast.LENGTH_LONG).show(); } } public void actualizarLibro(Libro l){ try{ SQLiteDatabase sql = bd.getReadableDatabase(); String[] args = {l.getTitulo()}; ContentValues valores = new ContentValues(); valores.put(DefBD.col_autor, l.getAutor()); valores.put(DefBD.col_genero, l.getGenero()); valores.put(DefBD.col_editorial, l.getEditorial()); sql.update(DefBD.tabla_libros,valores,"titulo=?",args); Toast.makeText(c, "Libro actualizado", Toast.LENGTH_LONG).show(); } catch (Exception ex){ Toast.makeText(c, "Error actualizar libros " + ex.getMessage(), Toast.LENGTH_LONG).show(); } } }
1cb1fd65fa797ed9fff899f6457a5c91a9ae2a0c
2f4929587d8cf6c284980fe7356b332584adaa90
/src/main/java/com/github/shmvanhouten/lesson2/PersonByLastNameComparator.java
7ce1b63b7118680874f6a97f75c4ffa6e68cea63
[]
no_license
SHMvanHouten/javatraining
26232ecbc1ac48f4790630b7a7699d527c0501b2
0eb8ba8b0b0d4a259b3cd604f69f7830263a7efc
refs/heads/master
2021-01-23T02:29:49.107422
2017-06-16T07:58:44
2017-06-16T07:58:44
85,999,751
0
1
null
null
null
null
UTF-8
Java
false
false
441
java
package com.github.shmvanhouten.lesson2; import java.util.Comparator; public class PersonByLastNameComparator implements Comparator<Person> { @Override public int compare(Person first, Person second) { int byLastName = first.getLastName().compareTo(second.getLastName()); if (byLastName != 0) { return byLastName; } return first.getFirstName().compareTo(second.getFirstName()); } }
36649f3289f2808052430f480f86a7b4be21155d
e18964ed03aa0423c60ceb26bec65dc83ba86f95
/WebRoot/WEB-INF/classes/team/ElectricityPatrolSys/action/.svn/text-base/BugAction.java.svn-base
cba38d68d7ffb02f95e49dba8d67d192cfe3b682
[]
no_license
guoyafei224/ElectricityPatrolSys
4d4bd7e7d00e758a38bb0c84ffd5ecd8429611e1
fd09e75386cc74d244e485362916ec35d1d37e15
refs/heads/master
2020-05-20T02:56:14.188004
2015-01-24T14:21:43
2015-01-24T14:21:43
29,778,538
3
3
null
null
null
null
UTF-8
Java
false
false
4,006
package team.ElectricityPatrolSys.action; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import net.sf.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import com.opensymphony.xwork2.ActionContext; import team.ElectricityPatrolSys.entity.BeHeTask; import team.ElectricityPatrolSys.entity.Bug; import team.ElectricityPatrolSys.entity.SysUser; import team.ElectricityPatrolSys.entity.Tower; import team.ElectricityPatrolSys.service.BugService; import team.ElectricityPatrolSys.service.TowerService; @Controller("bugAction") public class BugAction extends ActionBase { @Autowired private BugService bugService; @Autowired private TowerService towerService; private String towerId; private String taskId; private Bug bug; private Map map; private List<Bug> ptList; private JSONObject obj; // 传递到前台的数据 public String queryBugByTowerIdAndTaskId() { bug = bugService.queryBugByTowerIdAndTaskId(towerId, taskId); return "queryBugByTowerIdAndTaskId"; } /** * 得到全部巡检信息 * * @author 杨维强 * @return */ public String getAllPollTask() { ptList = bugService.getAllPollTask((page - 1) * rows, page * rows); for (int i = 0; i < ptList.size(); i++) { ptList.get(i).setCir_tower( ptList.get(i).getPollTask().getCircuit().getCircuit_id() + "(" + ptList.get(i).getPollTask().getCircuit() .getStart_tower_id() + "-" + ptList.get(i).getPollTask().getCircuit() .getEnd_tower_id() + ")"); } sum = bugService.getPollTaskSum(); map = new HashMap(); map.put("total", sum); map.put("rows", ptList); return "getPollTaskOk"; } public String getAllBeHeTask() { try { ptList = bugService.getAllBeHeTask((page - 1) * rows, page * rows); } catch (Exception e) { e.printStackTrace(); } for (int i = 0; i < ptList.size(); i++) { ptList.get(i).setCir_tower( ptList.get(i).getPollTask().getCircuit().getCircuit_id() + "(" + ptList.get(i).getPollTask().getCircuit() .getStart_tower_id() + "-" + ptList.get(i).getPollTask().getCircuit() .getEnd_tower_id() + ")"); } try { sum = bugService.getAllBeHeTaskSum(); } catch (Exception e) { e.printStackTrace(); } map = new HashMap(); map.put("total", sum); map.put("rows", ptList); return "getAllBeHeTask"; } /** * 添加缺陷 * @author 钱文博 * @return */ public String saveBug(){ bug.setSysUser((SysUser) ActionContext.getContext() .getSession().get("loginUser")); bug.setFind_time(new Date()); Tower tower = towerService.queryTowerInfoById(bug.getTower().getTower_id()); tower.setGood_proc(bug.getTower().getGood_proc()); //更新杆塔信息 //towerService.update() bugService.saveBug(bug); return "saveBug"; } /** * 删除缺陷信息 * @return */ public String delBug(){ message = bugService.delBug(towerId, taskId)+""; return "delBug"; } public BugService getBugService() { return bugService; } public void setBugService(BugService bugService) { this.bugService = bugService; } public Bug getBug() { return bug; } public List<Bug> getList() { return ptList; } public void setList(List<Bug> list) { this.ptList = ptList; } public void setBug(Bug bug) { this.bug = bug; } public String getTowerId() { return towerId; } public void setTowerId(String towerId) { this.towerId = towerId; } public String getTaskId() { return taskId; } public void setTaskId(String taskId) { this.taskId = taskId; } public List<Bug> getPtList() { return ptList; } public void setPtList(List<Bug> ptList) { this.ptList = ptList; } public JSONObject getObj() { return obj; } public void setObj(JSONObject obj) { this.obj = obj; } public Map getMap() { return map; } public void setMap(Map map) { this.map = map; } }
9efa3945d618181ee8875c9ae98a35f99e8cba17
68eac04f440c26451ec9abc9c07771638a34dfaf
/chapter04/src/chapter04/Condition03.java
c6365c1fccfb93519cd778e6f104390a9ba82044
[]
no_license
Limhyeongju/two
28e86f9739a0641a732400c2f8f75412247ec784
e281ec588303f234b06d724c5620c27c184d875f
refs/heads/master
2023-06-21T18:51:49.214011
2021-07-23T00:36:54
2021-07-23T00:36:54
384,261,419
1
0
null
null
null
null
UTF-8
Java
false
false
461
java
package chapter04; public class Condition03 { public static void main(String[] args) { int a=10; int b=15; boolean result; result=++a>=b?true:false; System.out.println(result); int n1=10; int n2=20; //n1에 1을 더하면 n2와 같은지 연산? 같으면 o 다르면 x char n3; n3=n1+1==n2?'o':'x'; //n3=++n1==n2?'o':'x'; //n3=(n1 +=n1)==n2?'o':'x'; 같은결과 가독성의 차이 System.out.println(n3); } }
[ "82104@DESKTOP-V485KUB" ]
82104@DESKTOP-V485KUB
e7dc9f7bcbcb654cf829e1874c910a96b51919e4
27f649c606bc2cdf839c175219fcfbf1af9b1f32
/src/main/java/net/bdsc/audit/Audit.java
1be90092952add7fcc83c3f8774808abcd6e262b
[]
no_license
heyewei/block
38717394de805c9205755e7a46f46faa8a097415
849655194551d8c93a61545b959a1e74e99bd7bb
refs/heads/master
2023-01-28T22:25:00.012454
2020-12-10T05:16:15
2020-12-10T05:16:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
563
java
/* * Copyright 2008-2018 shopxx.net. All rights reserved. * Support: localhost * License: localhost/license * FileId: eFRtBNifYk8ygLB911URNCOLWnwQ2Ux5 */ package net.bdsc.audit; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Audit - 审计注解 * * @author 好源++ Team * @version 6.1 */ @Retention(RetentionPolicy.RUNTIME) @Target(value = ElementType.METHOD) public @interface Audit { /** * 动作 */ String action(); }
33f7485fffc680557a9be0c604b072fe3f7f5de1
8b8d620ddc8148410df77dcdc56b7f0ab55a7c47
/app/src/main/java/com/jpstudiosonline/goodgamer/userAppArea/ChatMessages/tabFragments/ContactMemberDividerItemDecoration.java
ab29aa42b86359d0d00237256862feaf0ca77ba2
[ "MIT" ]
permissive
jpstudiosonline/GoodGamer-LFG
ec9a20afbe7c3a4594474038781296f88bce6191
fc4680d6c3aefd6734619e44a23ba8d5a0784405
refs/heads/master
2020-04-05T22:20:56.475946
2018-11-12T17:51:23
2018-11-12T17:51:23
157,253,278
0
0
null
null
null
null
UTF-8
Java
false
false
3,287
java
package com.jpstudiosonline.goodgamer.userAppArea.ChatMessages.tabFragments; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.View; /** * Created by jahnplay on 11/3/2016. */ public class ContactMemberDividerItemDecoration extends RecyclerView.ItemDecoration { private static final int[] ATTRS = new int[]{ android.R.attr.listDivider }; public static final int HORIZONTAL_LIST = LinearLayoutManager.HORIZONTAL; public static final int VERTICAL_LIST = LinearLayoutManager.VERTICAL; private Drawable mDivider; private int mOrientation; public ContactMemberDividerItemDecoration(Context context, int orientation) { final TypedArray a = context.obtainStyledAttributes(ATTRS); mDivider = a.getDrawable(0); a.recycle(); setOrientation(orientation); } public void setOrientation(int orientation) { if (orientation != HORIZONTAL_LIST && orientation != VERTICAL_LIST) { throw new IllegalArgumentException("invalid orientation"); } mOrientation = orientation; } @Override public void onDraw(Canvas c, RecyclerView parent) { if (mOrientation == VERTICAL_LIST) { drawVertical(c, parent); } else { drawHorizontal(c, parent); } } public void drawVertical(Canvas c, RecyclerView parent) { final int left = parent.getPaddingLeft(); final int right = parent.getWidth() - parent.getPaddingRight(); final int childCount = parent.getChildCount(); for (int i = 0; i < childCount; i++) { final View child = parent.getChildAt(i); final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child .getLayoutParams(); final int top = child.getBottom() + params.bottomMargin; final int bottom = top + mDivider.getIntrinsicHeight(); mDivider.setBounds(left, top, right, bottom); mDivider.draw(c); } } public void drawHorizontal(Canvas c, RecyclerView parent) { final int top = parent.getPaddingTop(); final int bottom = parent.getHeight() - parent.getPaddingBottom(); final int childCount = parent.getChildCount(); for (int i = 0; i < childCount; i++) { final View child = parent.getChildAt(i); final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child .getLayoutParams(); final int left = child.getRight() + params.rightMargin; final int right = left + mDivider.getIntrinsicHeight(); mDivider.setBounds(left, top, right, bottom); mDivider.draw(c); } } @Override public void getItemOffsets(Rect outRect, int itemPosition, RecyclerView parent) { if (mOrientation == VERTICAL_LIST) { outRect.set(0, 0, 0, mDivider.getIntrinsicHeight()); } else { outRect.set(0, 0, mDivider.getIntrinsicWidth(), 0); } } }
c85cb14920863d318401eb886fbc3b637ea6eb65
f1af4126f547339c7f9f39d9e751cbd5a9ce90b2
/src/main/java/com/practice/springbootdbexample/model/Users.java
8d146643a2fdbaca98cd608c4525ef0983ec7189
[]
no_license
praveenk1029/springboot-db-example
528c12a30469c20dedd01610b12798cd3a142ac4
f0022c8ba8303b0058b3dc6cda19cbbfe29a5add
refs/heads/master
2022-07-08T20:32:04.212627
2021-04-29T04:05:40
2021-04-29T04:05:40
231,966,594
1
0
null
null
null
null
UTF-8
Java
false
false
2,081
java
package com.practice.springbootdbexample.model; import javax.persistence.*; import java.util.Set; @Entity @Table(name = "user") public class Users { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "user_id") private int id; @Column(name = "email") private String email; @Column(name = "password") private String password; @Column(name = "name") private String name; @Column(name = "last_name") private String lastName; @Column(name = "active") private int active; @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER) @JoinTable(name = "user_role", joinColumns = @JoinColumn(name = "user_id"), inverseJoinColumns = @JoinColumn(name = "role_id")) private Set<Role> roles; public Users() { } public Users(Users users) { this.active = users.getActive(); this.email = users.getEmail(); this.roles = users.getRoles(); this.name = users.getName(); this.lastName =users.getLastName(); this.id = users.getId(); this.password = users.getPassword(); } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public int getActive() { return active; } public void setActive(int active) { this.active = active; } public Set<Role> getRoles() { return roles; } public void setRoles(Set<Role> roles) { this.roles = roles; } }
d4b0304c20841dddf57dbf6e6e4ca70d8d8fdc0f
b3af9bfcb56ae4718fb0b4e1baaae8b87f97e31f
/src/main/java/com/bpfaas/common/web/MsgBase.java
b3387546cc9e5e6156377faaa69f3a15719ed8dd
[ "MIT" ]
permissive
bpfaas/lib-java-bp-common
887d3950b2a5db1fc2b4727004504a6c38442c28
f77423b95c52ec9da5c853b2442d41b0f162799c
refs/heads/master
2023-02-07T22:15:58.931172
2020-12-30T10:09:39
2020-12-30T10:09:39
296,000,451
0
0
null
null
null
null
UTF-8
Java
false
false
2,085
java
/** * Copyright (c) 2020 Copyright bp All Rights Reserved. * Author: lipengxiang * Date: 2020-2020/6/12 15:03 * Desc: */ package com.bpfaas.common.web; import java.util.Date; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Data; import lombok.Getter; /** * * * @author pengxiang.li * @date 2020/6/12 3:03 下午 */ @JsonInclude(JsonInclude.Include.NON_NULL) public class MsgBase { /** * 调用信息. */ @Data @JsonInclude(JsonInclude.Include.NON_NULL) public static class TraceObject { /** * 引起此消息调用链的用户/模块id. */ @JsonProperty("operator") private String operator; /** * 调试模式下的系统名称. */ @JsonProperty("debugSys") private String debugSys; /** * 此消息链发生的时间. */ @JsonProperty("time_at") private Date timeAt; } /** * 消息最原始的发送者. */ @JsonProperty("trace") @Getter private TraceObject trace; /** * 设置trace对象. * @param trace trace 信息 */ public void setTrace(TraceObject trace) { this.trace = trace; } /** * 设置trace对象. * @param operator 操作者 * @param timeAt 发生的时间 * @param debugSys 需要调试的系统名 */ public void setTrace(String operator, Date timeAt, String debugSys) { if (null == this.trace) { this.trace = new TraceObject(); } this.trace.setDebugSys(debugSys); this.trace.setOperator(operator); this.trace.setTimeAt(timeAt); } /** * 设置trace对象. * @param operator 操作者 * @param timeAt 发生的时间 */ public void setTrace(String operator, Date timeAt) { if (null == this.trace) { this.trace = new TraceObject(); } this.trace.setOperator(operator); this.trace.setTimeAt(timeAt); } }
f47e43a40b37819ac84d969c6c687ce66dcb97e3
d0843fd899d40a27508a901a80105d24a92d630d
/1.SpringBoot-JPA/src/test/java/com/example/lock/CountDownTest.java
9f85fd6ef24dde3bc3446e9b1538626535d84876
[]
no_license
KentTain/SpringBootDemo
dc2c4291cab91ee664a683083b19749675bf0e1b
9aaf7ff3be7d886c0b0c472a108de461d959ba4a
refs/heads/master
2022-12-22T12:08:57.636040
2020-01-22T09:01:37
2020-01-22T09:01:37
179,392,518
0
0
null
2022-12-16T07:45:53
2019-04-04T00:36:57
Java
UTF-8
Java
false
false
1,966
java
package com.example.lock; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import org.junit.Before; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class CountDownTest { private Logger logger = LoggerFactory.getLogger(DatabaseDistributedLockTest.class); private CountDownLatch countDownLatch; private ExecutorService service; @Before public void prepareData() { countDownLatch = new CountDownLatch(10); service = Executors.newFixedThreadPool(10); } @Test public void excutorTest() { for (int i = 0; i < 100; i++) { service.execute(() -> { try { Thread.sleep(100); System.out.println(Thread.currentThread().getId() + ", 我阻塞了100ms"); } catch (InterruptedException e) { e.printStackTrace(); } }); } service.shutdown(); try { Thread.currentThread().join(); } catch (InterruptedException e) { e.printStackTrace(); } } @Test public void runCountDown() { for (int i = 0; i < 100; i++) { service.execute(new RunableTask(countDownLatch)); } try { countDownLatch.await(); //logger.info("执行成功"); } catch (InterruptedException e) { e.printStackTrace(); logger.error("抛出中断异常", e); } } public class RunableTask implements Runnable { private CountDownLatch countDownLatch; public RunableTask(CountDownLatch countDownLatch) { this.countDownLatch = countDownLatch; } @Override public void run() { try { Thread.sleep(100); //System.out.println(Thread.currentThread().getId() + ", 我阻塞了100ms"); } catch (InterruptedException e) { e.printStackTrace(); } finally { countDownLatch.countDown(); } } } }
f6ac54242982a11c1a976809b6cd456b32b388b1
9254e7279570ac8ef687c416a79bb472146e9b35
/sofa-20190815/src/main/java/com/aliyun/sofa20190815/models/CountLinkeBahamutMachinesbyaccountResponseBody.java
918e2b9dd3b3cf7d21be6715a8302bee9e5bddf7
[ "Apache-2.0" ]
permissive
lquterqtd/alibabacloud-java-sdk
3eaa17276dd28004dae6f87e763e13eb90c30032
3e5dca8c36398469e10cdaaa34c314ae0bb640b4
refs/heads/master
2023-08-12T13:56:26.379027
2021-10-19T07:22:15
2021-10-19T07:22:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,494
java
// This file is auto-generated, don't edit it. Thanks. package com.aliyun.sofa20190815.models; import com.aliyun.tea.*; public class CountLinkeBahamutMachinesbyaccountResponseBody extends TeaModel { @NameInMap("RequestId") public String requestId; @NameInMap("Message") public String message; @NameInMap("ErrorMessage") public String errorMessage; @NameInMap("ResultMessage") public String resultMessage; @NameInMap("Success") public Boolean success; @NameInMap("ResultCode") public String resultCode; @NameInMap("Result") public String result; public static CountLinkeBahamutMachinesbyaccountResponseBody build(java.util.Map<String, ?> map) throws Exception { CountLinkeBahamutMachinesbyaccountResponseBody self = new CountLinkeBahamutMachinesbyaccountResponseBody(); return TeaModel.build(map, self); } public CountLinkeBahamutMachinesbyaccountResponseBody setRequestId(String requestId) { this.requestId = requestId; return this; } public String getRequestId() { return this.requestId; } public CountLinkeBahamutMachinesbyaccountResponseBody setMessage(String message) { this.message = message; return this; } public String getMessage() { return this.message; } public CountLinkeBahamutMachinesbyaccountResponseBody setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; return this; } public String getErrorMessage() { return this.errorMessage; } public CountLinkeBahamutMachinesbyaccountResponseBody setResultMessage(String resultMessage) { this.resultMessage = resultMessage; return this; } public String getResultMessage() { return this.resultMessage; } public CountLinkeBahamutMachinesbyaccountResponseBody setSuccess(Boolean success) { this.success = success; return this; } public Boolean getSuccess() { return this.success; } public CountLinkeBahamutMachinesbyaccountResponseBody setResultCode(String resultCode) { this.resultCode = resultCode; return this; } public String getResultCode() { return this.resultCode; } public CountLinkeBahamutMachinesbyaccountResponseBody setResult(String result) { this.result = result; return this; } public String getResult() { return this.result; } }
972e16eb047326f38d74ca2eaac711b715db3626
95f51180b7be094ebfa0a93f18625dd6bc7f3b6c
/price-stats/src/main/java/com/amne/homeprice/stats/PriceStatistics.java
a427e812d91b23fb3152b4c93c70a0c14bc9bb2e
[]
no_license
msasidhar007/Challenges
f26aeddc7c7d168cae629cc3c813203b15533115
496986af6a0333dbab9cfbc1eadb797db6e19ecb
refs/heads/master
2020-05-26T18:58:26.043050
2018-06-07T04:46:01
2018-06-07T04:46:01
82,487,828
0
0
null
null
null
null
UTF-8
Java
false
false
3,942
java
package com.amne.homeprice.stats; import java.io.FileOutputStream; import java.io.IOException; import java.io.PrintStream; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; import java.util.stream.Collectors; public class PriceStatistics { public static void main(String[] args) throws IOException { //Declaring required variables Integer n = 0; Integer k = 0; int count = 0; Integer ws = 0; StringTokenizer tokenize = null; String inputFilePath = ""; String outputFilePath = ""; List<Integer> salesPriceList = new ArrayList<Integer>(); //Check for arguments whether two arguments are provided for execution if (args.length > 0 && args.length==2){ inputFilePath = args[0]; outputFilePath = args[1]; PrintStream out = new PrintStream(new FileOutputStream(outputFilePath + "/output.txt")); System.setOut(out); Path input = Paths.get(inputFilePath + "/input.txt"); PriceStatistics ps = new PriceStatistics(); List<String> inputData = Files.lines(input).collect(Collectors.toList()); for(String val : inputData) { tokenize = new StringTokenizer(val, " "); if(inputData.indexOf(val) == 0) { while(tokenize.hasMoreTokens()){ count++; if(count == 1) n = Integer.parseInt(tokenize.nextToken()); else if(count == 2) k = Integer.parseInt(tokenize.nextToken()); } } else if(inputData.indexOf(val) == 1) { while(tokenize.hasMoreTokens()){ salesPriceList.add(Integer.parseInt(tokenize.nextToken())); } } } //Validation check for n & k values if(n<k) { System.out.println("n value is less than k value, please correct the input and resubmit"); } else if(n==0 || k==0) { System.out.println("Invalid Input either n value or k value is zero, please correct the input and resubmit"); } else if(n != salesPriceList.size()) { System.out.println("Number of sales price data given : " + tokenize.countTokens()); System.out.println("Invalid Input Data"); } else { //window size ws = n-k+1; //for each window we will calculate increasing subrange and decreasing subrange // & by subtracting both values we will get desired result for (int i=0; i<= ws-1 ; i++) { List<Integer> subsetSales = new ArrayList<Integer>(); subsetSales = salesPriceList.subList(i, k+i); int incsubrange = ps.getIncreasingSubRange(subsetSales); int decsubrange = ps.getDecreasingSubRange(subsetSales); int result = incsubrange - decsubrange; System.out.println(result); } } } else { System.out.println("Please provide both input & output directory locations"); } } /** * Function will iterate through the subset provided and will calculate for increasing subrange * @param window * @return increasing subrange */ public int getIncreasingSubRange(List<Integer> window) { Integer incseq = 1; int incsubrange = 0; for (Integer i = 0,j=1; i < window.size(); i++,j++) { if(j==window.size()) { j = j-1; } if(window.get(i) < window.get(j)) { incseq++; } else { incsubrange = incsubrange + (incseq * (incseq - 1))/2; incseq = 1; } } return incsubrange ; } /** * Function will iterate through the subset provided and will calculate for decreasing subrange * @param window * @return decreasing subrange */ public int getDecreasingSubRange(List<Integer> window) { Integer decseq = 1; int decsubrange = 0; for (Integer i = 0,j=1; i < window.size(); i++,j++) { if(j==window.size()) { j = j-1; } if(window.get(i) > window.get(j)) { decseq++; } else { decsubrange = decsubrange + (decseq * (decseq - 1))/2; decseq = 1; } } return decsubrange ; } }
[ "Karthikeya@Macbook-Pro" ]
Karthikeya@Macbook-Pro
56de7dccf6e021cbe5f5006ccad8179dc9de3c64
8a0d903d50db38de9e98618419f207f42232b3df
/Covid19Tracker/app/src/main/java/com/example/covid_19tracker/DetailActivity.java
8486ce25340f502b537ff5131eda07f732389784
[]
no_license
harishj13/Covid-19-Tracker
92d93b2c17fe2b6886f5ed88cb41390a62bd6bec
41f251e6b59fcabcd7c3016192bf5ede86525e57
refs/heads/master
2023-05-13T19:21:02.842901
2021-06-07T18:54:45
2021-06-07T18:54:45
374,769,767
0
0
null
null
null
null
UTF-8
Java
false
false
2,433
java
package com.example.covid_19tracker; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.MenuItem; import android.widget.TextView; public class DetailActivity extends AppCompatActivity { private int positionCountry; TextView tvCountry,tvCases1,tvRecovered1,tvCritical1,tvActive1,tvTodayCases1,tvTotalDeaths1,tvTodayDeaths1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_detail); Intent intent = getIntent(); positionCountry = intent.getIntExtra("position",0); getSupportActionBar().setTitle("Details of "+ AffectedCountries.countryModelList.get(positionCountry).getCountryName()); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); tvCountry = findViewById(R.id.tvCountry); tvCases1 = findViewById(R.id.tvCases1); tvRecovered1 = findViewById(R.id.tvRecovered1); tvCritical1 = findViewById(R.id.tvCritical1); tvActive1 = findViewById(R.id.tvActive1); tvTodayCases1 = findViewById(R.id.tvTodayCases1); tvTotalDeaths1 = findViewById(R.id.tvTotalDeaths1); tvTodayDeaths1 = findViewById(R.id.tvTodayDeath1); tvCountry.setText(AffectedCountries.countryModelList.get(positionCountry).getCountryName()); tvCases1.setText(AffectedCountries.countryModelList.get(positionCountry).getCases()); tvRecovered1.setText(AffectedCountries.countryModelList.get(positionCountry).getRecovered()); tvCritical1.setText(AffectedCountries.countryModelList.get(positionCountry).getCritical()); tvActive1.setText(AffectedCountries.countryModelList.get(positionCountry).getActive()); tvTodayCases1.setText(AffectedCountries.countryModelList.get(positionCountry).getTodayCases()); tvTotalDeaths1.setText(AffectedCountries.countryModelList.get(positionCountry).getDeaths()); tvTodayDeaths1.setText(AffectedCountries.countryModelList.get(positionCountry).getTodayDeaths()); } @Override public boolean onOptionsItemSelected(@NonNull MenuItem item) { if (item.getItemId() == android.R.id.home) finish(); return super.onOptionsItemSelected(item); } }
bd0da53f589a7747b8984b3847340eaa7fbca42a
0ee488c20f316bd60c284e6ed7ebdcf52a86dc27
/app/src/main/java/ch/ethz/inf/vs/a3/fabischn/message/MessageIn.java
b301d0fc0eeef72bb6dfe496cdeaba4abcf5fb26
[]
no_license
nerdaliciousCH/VS_fabischn_Chat
4b83f23dd084cecd4d0e390b46574e5c0d19ed57
18335c40bd26737ad28e42a55c1e3a09d074f176
refs/heads/master
2021-05-01T09:21:24.456388
2016-11-03T14:52:46
2016-11-03T14:52:46
72,192,300
0
0
null
null
null
null
UTF-8
Java
false
false
2,454
java
package ch.ethz.inf.vs.a3.fabischn.message; import android.util.Log; import org.json.JSONException; import org.json.JSONObject; import java.net.DatagramPacket; import java.nio.ByteBuffer; import java.util.Arrays; import ch.ethz.inf.vs.a3.fabischn.udpclient.NetworkConsts; /** * Created by fabian on 29.10.16. */ public class MessageIn extends Message { private static final String TAG = MessageIn.class.getSimpleName(); public MessageIn(DatagramPacket packet){ super(); mBuffer = packet.getData().clone(); if (mBuffer.length > NetworkConsts.PAYLOAD_SIZE){ // Should actually prevent this and throw exception Log.e(TAG,"Payload will be trimmed, got more bytes than expected"); } mBuffer = trim(mBuffer.clone()); setMessage(new String(mBuffer)); parseJSON(); Log.d(TAG, toString()); } private void parseJSON(){ try { mJSON = new JSONObject(getMessage()); } catch (JSONException e) { Log.e(TAG, "Couldn't parse the String to JSON", e); mJSON = null; return; } try { JSONObject jsonHeader = mJSON.getJSONObject(JsonFields.HEADER); setUsername(jsonHeader.getString(JsonFields.HEADER_USERNAME)); setUUID(jsonHeader.getString(JsonFields.HEADER_UUID)); setTimestamp(jsonHeader.getString(JsonFields.HEADER_TIMESTAMP)); setType(jsonHeader.getString(JsonFields.HEADER_TYPE)); } catch (JSONException e) { Log.e(TAG, "Couldn't parse the JSON header", e); } try { JSONObject jsonBody = mJSON.getJSONObject(JsonFields.BODY); switch (getType()) { case MessageTypes.CHAT_MESSAGE: case MessageTypes.ERROR_MESSAGE: setContent(jsonBody.getString(JsonFields.BODY_CONTENT)); break; } } catch (JSONException e) { Log.e(TAG, "Couldn't parse the JSON body", e); } Log.d(TAG, "The JSON: " + mJSON.toString()); } // from http://stackoverflow.com/questions/17003164/byte-array-with-padding-of-null-bytes-at-the-end-how-to-efficiently-copy-to-sma static byte[] trim(byte[] bytes) { int i = bytes.length - 1; while (i >= 0 && bytes[i] == 0) { --i; } return Arrays.copyOf(bytes, i + 1); } }
797b1d463c85cad230209ded3b122206dd52e22a
e3a9527ea5f949aad759d38a89d5e6d11e5278a7
/src/main/java/sia/tacocloud/tacos/controllers/DesignTacoController.java
f0778cad04d988772b7f6f25cf2689a2f821c304
[]
no_license
javalenjara/springinaction
cb2cd2ead7741f3f4bb3c2f6cc7d0ebf94552a42
cfc6780f64c8f99d51195ab720058afd12ed1b20
refs/heads/master
2023-02-18T07:24:01.286510
2021-01-15T03:51:53
2021-01-15T03:51:53
324,602,244
1
0
null
2021-01-15T03:51:54
2020-12-26T17:21:57
Java
UTF-8
Java
false
false
2,344
java
package sia.tacocloud.tacos.controllers; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.Errors; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import sia.tacocloud.tacos.domain.Ingredient; import sia.tacocloud.tacos.domain.Ingredient.Type; import sia.tacocloud.tacos.domain.Taco; import javax.validation.Valid; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; @Slf4j @Controller @RequestMapping("/design") public class DesignTacoController { @GetMapping public String showDesignForm(Model model) { List<Ingredient> ingredients = Arrays.asList( new Ingredient("FLTO", "Flour Tortilla", Type.WRAP), new Ingredient("COTO", "Corn Tortilla", Type.WRAP), new Ingredient("GRBF", "Ground Beef", Type.PROTEIN), new Ingredient("CARN", "Carnitas", Type.PROTEIN), new Ingredient("TMTO", "Diced Tomatoes", Type.VEGGIES), new Ingredient("LETC", "Lettuce", Type.VEGGIES), new Ingredient("CHED", "Cheddar", Type.CHEESE), new Ingredient("JACK", "Monterrey Jack", Type.CHEESE), new Ingredient("SLSA", "Salsa", Type.SAUCE), new Ingredient("SRCR", "Sour Cream", Type.SAUCE) ); Type[] types = Ingredient.Type.values(); for (Type type : types){ model.addAttribute(type.toString().toLowerCase(), filterByType(ingredients, type)); } model.addAttribute("design", new Taco()); return "design"; } @PostMapping public String processDesign(@Valid Taco design, Errors errors) { if (errors.hasErrors()){ return "design"; } //ToDo: save the Taco design. log.info("Processing design: " + design); return "redirect:/orders/current"; } private List<Ingredient> filterByType(List<Ingredient> ingredients, Type type) { return ingredients .stream() .filter(x -> x.getType().equals(type)) .collect(Collectors.toList()); } }
[ "Javalen git2016" ]
Javalen git2016
264a17af641bf7f369e4ee8704a50cf1aec246b0
473fc28d466ddbe9758ca49c7d4fb42e7d82586e
/app/src/main/java/com/syd/source/aosp/cts/hostsidetests/net/app2/src/com/android/cts/net/hostside/app2/MyActivity.java
286cc2fb56bce7175ccb2a6140b591646e6e866c
[]
no_license
lz-purple/Source
a7788070623f2965a8caa3264778f48d17372bab
e2745b756317aac3c7a27a4c10bdfe0921a82a1c
refs/heads/master
2020-12-23T17:03:12.412572
2020-01-31T01:54:37
2020-01-31T01:54:37
237,205,127
4
2
null
null
null
null
UTF-8
Java
false
false
2,396
java
/* * Copyright (C) 2016 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.cts.net.hostside.app2; import static com.android.cts.net.hostside.app2.Common.ACTION_FINISH_ACTIVITY; import static com.android.cts.net.hostside.app2.Common.TAG; import static com.android.cts.net.hostside.app2.Common.TEST_PKG; import android.app.Activity; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.AsyncTask; import android.os.Bundle; import android.os.RemoteException; import android.util.Log; import com.android.cts.net.hostside.INetworkStateObserver; /** * Activity used to bring process to foreground. */ public class MyActivity extends Activity { private BroadcastReceiver finishCommandReceiver = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d(TAG, "MyActivity.onCreate()"); Common.notifyNetworkStateObserver(this, getIntent()); finishCommandReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { Log.d(TAG, "Finishing MyActivity"); MyActivity.this.finish(); } }; registerReceiver(finishCommandReceiver, new IntentFilter(ACTION_FINISH_ACTIVITY)); } @Override public void finish() { if (finishCommandReceiver != null) { unregisterReceiver(finishCommandReceiver); } super.finish(); } @Override protected void onStart() { super.onStart(); Log.d(TAG, "MyActivity.onStart()"); } @Override protected void onDestroy() { Log.d(TAG, "MyActivity.onDestroy()"); super.onDestroy(); } }
3c4553f3df6ea519b9744bc86b9ea9db4d88d3da
87f517a7cc2e83630e4dbf8f889bd14168c69f94
/core/src/test/java/net/thucydides/core/webdriver/integration/WhenCheckingVisibilityOnAWebSiteUsingPageObjects.java
249713092eee2f9f0bc408ee1881fd83e6be02da
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
dip56/serenity-core
806071c4120a1d4342660bc380aff77b35372e22
26f09b00e71da04a63faf96106f8ab31b4a060c3
refs/heads/master
2021-01-12T19:22:24.613058
2015-02-16T11:30:09
2015-02-16T11:30:09
29,583,451
0
0
null
2015-01-21T10:00:45
2015-01-21T10:00:45
null
UTF-8
Java
false
false
5,055
java
package net.thucydides.core.webdriver.integration; import net.serenitybdd.core.pages.PageObject; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.TimeoutException; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.phantomjs.PhantomJSDriver; import static net.thucydides.core.webdriver.StaticTestSite.fileInClasspathCalled; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; public class WhenCheckingVisibilityOnAWebSiteUsingPageObjects { public class IndexPage extends PageObject { public WebElement multiselect; public WebElement doesNotExist; public IndexPage(WebDriver driver) { super(driver); } public IndexPage(WebDriver driver, int ajaxTimeout) { super(driver, ajaxTimeout); } } private static WebDriver driver; @BeforeClass public static void openStaticTestSite() { String url = "file://" + fileInClasspathCalled("static-site/index.html").getAbsolutePath(); driver = new PhantomJSDriver(); driver.get(url); } IndexPage indexPage; @Before public void setupPage(){ driver.navigate().refresh(); indexPage = new IndexPage(driver); indexPage.setWaitForTimeout(150); } @AfterClass public static void closeBrowser() { driver.quit(); } @Test public void should_succeed_immediately_if_title_is_as_expected() { indexPage.waitForTitleToAppear("Thucydides Test Site"); } @Test(expected = TimeoutException.class) public void should_fail_if_title_is_as_expected() { indexPage.waitForTitleToAppear("Wrong title"); } @Test public void should_know_when_an_element_is_visible_on_the_page() { assertThat(indexPage.isElementVisible(By.xpath("//h2[.='A visible title']")), is(true)); } @Test public void should_succeed_when_waiting_for_an_element_that_is_already_visible_on_the_page() { indexPage.waitForRenderedElements(By.xpath("//h2[.='A visible title']")); } @Test public void should_know_when_an_element_is_visible_on_the_page_using_should_be() { indexPage.shouldBeVisible(By.xpath("//h2[.='A visible title']")); } @Test public void should_know_when_an_element_is_present_but_not_visible_on_the_page() { assertThat(indexPage.isElementVisible(By.xpath("//h2[.='An invisible title']")), is(false)); } @Test public void an_inexistant_element_should_not_be_considered_visible() { assertThat(indexPage.isElementVisible(By.xpath("//h2[.='An title that does not exist']")), is(false)); } @Test public void should_know_when_an_element_is_present_but_not_visible_on_the_page_using_should_be() { indexPage.shouldNotBeVisible(By.xpath("//h2[.='An invisible title']")); } @Test public void a_non_existant_web_element_should_be_considered_invisible() { indexPage.shouldNotBeVisible(indexPage.doesNotExist); } @Test public void a_non_existant_web_element_should_be_considered_invisible_when_found_by_a_selector() { indexPage.shouldNotBeVisible(By.xpath("//h2[.='Does not exist']")); } @Test(expected = TimeoutException.class) public void should_fail_when_waiting_for_an_invisible_object() { indexPage.waitForRenderedElements(By.xpath("//h2[.='An invisible title']")); } @Test public void can_wait_for_one_of_several_elements_to_be_visible() { indexPage.waitForAnyRenderedElementOf(By.id("color"), By.id("taste"), By.id("sound")); } @Test(expected = TimeoutException.class) public void fails_if_waiting_for_text_to_disappear_too_long() { indexPage.waitForTextToDisappear("A visible title"); } @Test(expected = TimeoutException.class) public void should_fail_when_waiting_for_an_undisplayed_text() { indexPage.waitForTextToAppear("This text never appears"); } @Test public void should_succeed_when_waiting_for_displayed_text() { indexPage.waitForTextToAppear("A visible title"); } @Test public void should_know_when_an_element_is_not_present_on_the_page() { assertThat(indexPage.isElementVisible(By.xpath("//h2[.='Non-existant title']")), is(false)); } @Test public void should_detect_if_a_web_element_contains_a_string() { assertThat(indexPage.containsTextInElement(indexPage.multiselect, "Label 1"), is(true)); } @Test public void should_detect_if_a_web_element_does_not_contain_a_string() { assertThat(indexPage.containsTextInElement(indexPage.multiselect, "Red"), is(false)); } @Test(expected = AssertionError.class) public void should_fail_assert_if_a_web_element_does_not_contain_a_string() { indexPage.shouldContainTextInElement(indexPage.multiselect, "Red"); } }
55a80ce5de1ca39fcd17a74d80124ff02a7925c5
7b4bb27c50d82153a5b2a3b4a5da4e7ca4136d25
/src/main/java/com/springboot/demo/token/constant/TokenConstant.java
26769f7f17385363bac4dfd7a109e3d787aee176
[]
no_license
Mr-zhuyj/token
3c526de44fd9ffeb4dab35dc0f653322bb2a4fa6
1c3ae39778cb3d903afb896affe2ba8728dab815
refs/heads/master
2023-05-01T03:55:17.921109
2021-05-11T09:22:53
2021-05-11T09:22:53
342,226,189
0
0
null
null
null
null
UTF-8
Java
false
false
592
java
package com.springboot.demo.token.constant; /** * 常量类 * @author zhuyj * @date 2020-11-05 */ public class TokenConstant { //缓存类型-redis public static final String REDIS = "redis"; //缓存类型-memcache public static final String MEMCACHE = "memcache"; //token管理类-redis public static final String REDIS_TOKEN_MANAGE = "redisTokenManage"; //token管理类-memcache public static final String MEMCACHE_TOKEN_MANAGE = "memcacheTokenManage"; //tokenModel存储key名称 public static final String TOKEN_MODEL_NAME = "tokenModel"; }
f0e7b738e1500d6d0556b372af3b1d5fff52ccdb
1ce45cc66b58242920fd0199999790407ec4c1e4
/core/src/com/perfectplay/org/serialization/Texture2DSerializer.java
8fa231870b771040ea6e6894a5ce03707285dcae
[]
no_license
HectorMF/EvilEngine
2e094a37890d6d4260129ba1f1bee4e6b5988c3d
8fdd8487fa2ac5eb518fb6121010040d34c83eba
refs/heads/master
2021-01-01T15:18:19.589936
2014-05-26T19:51:33
2014-05-26T19:51:33
10,891,357
1
0
null
null
null
null
UTF-8
Java
false
false
781
java
package com.perfectplay.org.serialization; import com.badlogic.gdx.Files.FileType; import com.esotericsoftware.kryo.Kryo; import com.esotericsoftware.kryo.Serializer; import com.esotericsoftware.kryo.io.Input; import com.esotericsoftware.kryo.io.Output; import com.perfectplay.org.graphics.Texture2D; public class Texture2DSerializer extends Serializer<Texture2D> { @Override public Texture2D read(Kryo kryo, Input input, Class<Texture2D> type) { FileType fType = kryo.readObject(input, FileType.class); String path = input.readString(); return new Texture2D(Texture2D.getFileHandle(path, fType)); } @Override public void write(Kryo kryo, Output output, Texture2D object) { kryo.writeObject(output, object.getType()); output.writeString(object.getPath()); } }
dd57bda1686aed25133a8ba5431c1c05f364238d
eb279e846ca675ea3d0c901584d783a459bad04f
/src/simulator/Main.java
c9172c2706a2aa3148e78745f389367598ce5faf
[]
no_license
Yuhala/placement-simulator
7fde9b811a4c3e00845bc9d6d9f5c115f47bcd40
eee6461531711d46982c2daf84fd1b24f06e3438
refs/heads/master
2021-07-18T20:41:10.466878
2020-07-08T15:22:36
2020-07-08T15:22:36
191,729,667
2
0
null
null
null
null
UTF-8
Java
false
false
8,327
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 simulator; /** * * @author Peterson Yuhala */ import java.util.ArrayList; import java.io.FileNotFoundException; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.util.Collections; import java.util.Scanner; //import Constants.NUM_SERVER; public class Main { public static final double SLOT_SIZE = 100;//Memory slot size in MB static final int NUM_SERVER = 20000; final double NUM_GEN2 = 0.1*NUM_SERVER; final double NUM_GEN3 = 0.2*NUM_SERVER; final double NUM_HPC = 0.2*NUM_SERVER; final double NUM_GEN4 = 0.2*NUM_SERVER; final double NUM_GEN5 = 0.1*NUM_SERVER; final double NUM_GOD = 0.1*NUM_SERVER; final double NUM_GEN6 = 0.1*NUM_SERVER; final int STEP = 300; final int SERVER_MEMORY_SIZE = 1280;//Number of slots ie 128GB final int NUM_CPU = 16; private static ArrayList<VM> vmList = new ArrayList(); private static ArrayList<Event> eventList = new ArrayList(); /*private static ArrayList<Server> hpc = new ArrayList<Server>(); private static ArrayList<Server> gen2 = new ArrayList<Server>(); private static ArrayList<Server> gen3 = new ArrayList(); private static ArrayList<Server> gen4 = new ArrayList(); private static ArrayList<Server> gen5 = new ArrayList(); private static ArrayList<Server> godzilla = new ArrayList(); private static ArrayList<Server> gen6 = new ArrayList();*/ private static ArrayList<Server> svList = new ArrayList(); private static ArrayList<Server> possibleServers = new ArrayList(); //private static ArrayList<ArrayList<Server>> serverTypes = new ArrayList(); private static int minTimestamp = 0; private static int maxTimestamp = 0; private static int contiguousCount = 0; private static int vmCount = 0; private static int serversUsed = 0; private static double percent = 0.0; static StringBuilder sb = new StringBuilder(); static FileWriter pw; /** * @param args the command line arguments */ public static void main(String[] args) throws IOException { /** * Parse arguments: * 1: use contiguity aware placement * 2: use biggest server * 3: use smallest server */ if(args.length != 1){ System.out.println("./program-name #algo"); return; } int algo = Integer.parseInt(args[0]); System.out.println("Algo: "+algo); pw = new FileWriter("sim-results.csv", true); System.out.println("Starting simulation...."); readCSV(); Collections.sort(eventList); // printEvents(eventList); vmCount = vmList.size(); System.out.println("Number of VMs: " + vmCount); createServers(); contiguousCount = 0; //ArrayList<Server> temp = serverTypes.get(i); simulate(svList,algo); serversUsed = count(svList); percent = ((double) contiguousCount / (double) vmCount) * 100; writeResults(vmCount, NUM_SERVER, serversUsed, percent); pw.close(); System.out.println("Ending Simulation....."); System.exit(0); /*for(int i=0;i<serverList.size();i++){ Server temp=serverList.get(i); System.out.println("Server free slots: "+temp.freeSlots.size()); }*/ } public static void readCSV() throws FileNotFoundException { double mem, cpu; int start, stop, cores, max = 0, temp = 0; VM tempVm; try { Scanner vmScan = new Scanner(new File("vmtable.csv")); vmScan.useDelimiter(","); while (vmScan.hasNext()) { String[] inputArr = vmScan.nextLine().split(","); mem = Double.parseDouble(inputArr[10]); start = Integer.parseInt(inputArr[3]); stop = Integer.parseInt(inputArr[4]); cores = Integer.parseInt(inputArr[9]); temp = stop; max = (temp > max) ? temp : max; tempVm = new VM(mem, cores, start, stop, cores); vmList.add(tempVm); eventList.add(new Event(tempVm.id, 1, tempVm.created)); eventList.add(new Event(tempVm.id, 0, tempVm.deleted)); // System.out.println(mem + " " + cpu + " " + start + " " + stop + " " + cores); } maxTimestamp = max; vmScan.close(); //serverScan.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } } public static void createServers() { for (int i = 0; i < NUM_SERVER; i++) { svList.add(new Server(1920, 24)); } /*for (int i = 0; i < NUM_GEN3; i++) { svList.add(new Server(1280, 16)); } for (int i = 0; i < NUM_HPC; i++) { svList.add(new Server(1280, 24)); } for (int i = 0; i < NUM_GEN4; i++) { svList.add(new Server(1920, 24)); } for (int i = 0; i < NUM_GEN5; i++) { svList.add(new Server(2560, 40)); } for (int i = 0; i < NUM_GEN6; i++) { svList.add(new Server(1920, 48)); } for (int i = 0; i < NUM_GOD; i++) { svList.add(new Server(5120, 32)); }*/ } public static void checkServers(VM vm, ArrayList<Server> serverList) { possibleServers.clear(); for (int i = 0; i < serverList.size(); i++) { Server temp = serverList.get(i); if (temp.availableCPU >= vm.core_count && temp.availableMem >= vm.totalMem) { possibleServers.add(temp); } } } public static void simulate(ArrayList<Server> serverList, int algo) { VM tempVm=null; for (Event tempEvent: eventList) { if (tempEvent.eventType == 0) { //VM destroyed tempVm = vmList.get(tempEvent.vmId); tempVm.hostingServer.removeVM(tempVm); } else {//VM created tempVm = vmList.get(tempEvent.vmId);//Get VM corresponding to the event...O(1) checkServers(tempVm, serverList); switch(algo){ case 1: System.out.println("---Contiguity aware placement---"); tempVm.chooseServer(possibleServers); break; case 2: System.out.println("---Choose server with max resources---"); tempVm.chooseBiggest(possibleServers); break; case 3: System.out.println("---Choose server with min resources---"); tempVm.chooseSmallest(possibleServers); break; } if (tempVm.contiguousMem) { contiguousCount++; }// serverTypes.add(gen5); } } } public static int count(ArrayList<Server> list) { int count = 0; for (int i = 0; i < list.size(); i++) { if (list.get(i).vmCount != 0) { count++; } } return count; } public static void writeResults(int numVms, int numServers, int serversUsed, double percent) throws FileNotFoundException, IOException { sb.append(numVms); sb.append(','); sb.append(numServers); sb.append(','); sb.append(serversUsed); sb.append(','); sb.append(percent); sb.append('\n'); pw.write(sb.toString()); } public static void printEvents(ArrayList<Event>events){ for(Event temp : events) System.out.println(temp.vmId+" , "+temp.eventType+" , "+temp.timeStamp); } }
65cb9185fbc86f1868cdf8c8756a69a60c7d9c60
c69e2318b02de922a51a82045d6f78c3f4d1b11a
/src/main/java/com/marksoft/logger/domain/PersistentAuditEvent.java
d25688a79420a2cb113c7a6632e15e182c3956db
[]
no_license
beving/inetLogger
73c1949ca6edb08f24c60dbcdc59a91d5cae0c04
4e43c6311690621cb02cd028122b8f1e4c081553
refs/heads/master
2021-01-10T14:10:18.434811
2015-11-11T00:28:17
2015-11-11T00:28:17
45,286,371
0
0
null
null
null
null
UTF-8
Java
false
false
1,923
java
package com.marksoft.logger.domain; import org.hibernate.annotations.Type; import org.joda.time.LocalDateTime; import javax.persistence.*; import javax.validation.constraints.NotNull; import java.util.HashMap; import java.util.Map; /** * Persist AuditEvent managed by the Spring Boot actuator * @see org.springframework.boot.actuate.audit.AuditEvent */ @Entity @Table(name = "jhi_persistent_audit_event") public class PersistentAuditEvent { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "event_id") private Long id; @NotNull @Column(nullable = false) private String principal; @Column(name = "event_date") @Type(type = "org.jadira.usertype.dateandtime.joda.PersistentLocalDateTime") private LocalDateTime auditEventDate; @Column(name = "event_type") private String auditEventType; @ElementCollection @MapKeyColumn(name="name") @Column(name="value") @CollectionTable(name="jhi_persistent_audit_evt_data", joinColumns=@JoinColumn(name="event_id")) private Map<String, String> data = new HashMap<>(); public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getPrincipal() { return principal; } public void setPrincipal(String principal) { this.principal = principal; } public LocalDateTime getAuditEventDate() { return auditEventDate; } public void setAuditEventDate(LocalDateTime auditEventDate) { this.auditEventDate = auditEventDate; } public String getAuditEventType() { return auditEventType; } public void setAuditEventType(String auditEventType) { this.auditEventType = auditEventType; } public Map<String, String> getData() { return data; } public void setData(Map<String, String> data) { this.data = data; } }
f468b0da74d0b97e73f28d90ff1a349e4231c725
abb2c67b123cc1a33077d1e4a949506994c9ad61
/src/main/java/com/jykj/controller/fix/VehicleController.java
b56d1b4b9857e28f7ac1e3b6038e8ae9d0fce718
[]
no_license
liuhnew/-
36737fc4d0a296c5f5215204662f5f25b0a7e6f5
2f0a1feaf7d68c7e5df8ea5621296ff65e55e678
refs/heads/master
2020-06-10T19:34:06.953050
2019-07-03T13:07:18
2019-07-03T13:07:18
193,723,450
0
0
null
null
null
null
UTF-8
Java
false
false
1,563
java
package com.jykj.controller.fix; import com.jykj.entity.Result; import com.jykj.service.VehicleService; import com.mongodb.DBObject; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import java.util.List; /** * 车辆接口 */ @Slf4j @RestController @RequestMapping("/service/vehicle") public class VehicleController { @Autowired private VehicleService vehicleService; @ApiImplicitParams({ @ApiImplicitParam(paramType = "query", defaultValue = "", dataType = "string", name = "vehicleNum"), @ApiImplicitParam(paramType = "query", defaultValue = "", dataType = "string", name = "pageIndex"), @ApiImplicitParam(paramType = "query", defaultValue = "", dataType = "string", name = "pageSize"), }) @RequestMapping(value = "list", method = RequestMethod.POST) public Result list(String vehicleNum, @RequestParam(defaultValue = "1") Integer pageIndex, @RequestParam(defaultValue = "10")Integer pageSize) { List<DBObject> result = vehicleService.list(vehicleNum, pageIndex, pageSize); return Result.createSuccess("查询成功", result); } }
32d9380a92cbf432740a714fa1fd735f1418f67a
c45b7188be2a7eaf6917082b55a06ab910af8a3d
/src/com/briup/web/filter/LoginFilter.java
26576bcc694ba060c69320357a603c2ba2ba5d3d
[]
no_license
songguoguo927/E-Store
20692d2b5e063c933dfbfd1577185ba2fe559dd9
291de45fa1233d473b20153f25cc042d24287354
refs/heads/master
2020-03-22T14:20:11.564720
2018-07-12T09:17:32
2018-07-12T09:17:32
140,171,228
0
0
null
null
null
null
UTF-8
Java
false
false
1,682
java
package com.briup.web.filter; import java.io.IOException; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.annotation.WebFilter; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; //规定拦截资源的位置 //项目名字后跟了user的全部拦截 //拦截的资源全部交给doFilter去处理 @WebFilter("/user/*") public class LoginFilter implements Filter { public void destroy() { // TODO Auto-generated method stub } public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { // TODO Auto-generated method stub // 验证合法性 HttpServletRequest req=(HttpServletRequest) request; HttpServletResponse res=(HttpServletResponse) response; //判断用户有没有登录,判断的依据是session中是否有user //有放行,没有拦截 HttpSession session=req.getSession(); Object obj=session.getAttribute("user"); if(obj==null) { //表明没有登陆过,则提示 req.setAttribute("msg", "亲!请先登录"); req.getRequestDispatcher("/login.jsp").forward(req, res); }else { chain.doFilter(request, response);//放行操作,原来执行什么请求还执行什么请求 } // pass the request along the filter chain } /** * @see Filter#init(FilterConfig) */ public void init(FilterConfig fConfig) throws ServletException { // TODO Auto-generated method stub } }
1273f6176f50ecf62b533c8967f2c8dbf2ed737e
d83e388d1bb206775e5efeb056f4bb4eb2177eb5
/src/test/java/xyz/scantag/dev/api/ApiApplicationTests.java
0a6952f4c885515802a2ebed9b60ee3208c899a6
[]
no_license
KavikaPalletenne/scantag-api
4fc1f02c2f986e8be775d5bfb77556f4c5d6d64b
cfb0f70227b579144f72a44eb22ce5dfa41df8f0
refs/heads/master
2023-05-28T20:37:47.627764
2021-06-13T08:20:00
2021-06-13T08:20:00
346,605,274
0
0
null
null
null
null
UTF-8
Java
false
false
217
java
package xyz.scantag.dev.api; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class ApiApplicationTests { @Test void contextLoads() { } }
4e236c1fa1f58f84f0f116ae16afc6821db38db2
2ab98f8f0f510738144c74d2e4171828e4f245e5
/tinder-evolution/src/main/java/br/com/cwi/tinderevolution/collection/FilmCollection.java
94f92fb2690a09af8243cbe70505a571f46131ee
[ "MIT" ]
permissive
rbkrebs/reset-01
e0d9c7359d6110e1b48ca7694856d928b283ce11
407a3cbfa1de575c7cc62ddf0b4eb6a91c81c3e4
refs/heads/master
2021-02-27T20:05:10.644612
2020-04-26T22:56:35
2020-04-26T22:56:35
245,632,568
0
0
null
null
null
null
UTF-8
Java
false
false
1,374
java
package br.com.cwi.tinderevolution.collection; import br.com.cwi.tinderevolution.domain.Film; import java.util.ArrayList; import java.util.List; import java.util.Optional; public class FilmCollection { private static int counter = 1; private static final List<Film> listFilm = new ArrayList<>(); public Film save(Film film) { film.setId(counter++); listFilm.add(film); return film; } public List<Film> listAll() { return listFilm; } public Film findById(Integer id) { return this.listFilm.stream().filter(film-> film.getId() == id).findFirst().get(); } public Film findByName(String nomeFilm) { return this.listFilm.stream().filter(film-> film.getNome().equals(nomeFilm)).findFirst().get(); } public boolean delete(Integer id) { Film toDelete = this.findById(id); if (!toDelete.equals(null)){ return listFilm.remove(toDelete); } return false; } public Film update(Integer id, Film newFilm){ Film film = findById(id); film.setDiretor(newFilm.getDiretor()); film.setDataDeLancamento(newFilm.getDataDeLancamento()); film.setNome(newFilm.getNome()); film.setCategory(newFilm.getCategory()); film.setSinopse(newFilm.getSinopse()); return film; } }
f803fba3c001bbd77424cfb1fc1ee96f359af599
b0f2f619f1f6257fcaa7d97a3b3cb4e5843239f1
/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/TurnerHardware2858.java
7ec6be6ddfdf8cd93478906616c3705715235478
[]
no_license
cchance19/TeamCode2858
d4caeefcc327657951e5a47e876c24098fb26004
de9e1975c495ab6f179f9d4dc09218443bc17052
refs/heads/master
2021-05-11T15:05:48.382846
2018-05-04T16:38:51
2018-05-04T16:38:51
117,718,244
0
1
null
null
null
null
UTF-8
Java
false
false
3,901
java
/* Copyright (c) 2017 FIRST. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted (subject to the limitations in the disclaimer below) provided that * the following conditions are met: * * Redistributions of source code must retain the above copyright notice, this list * of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, this * list of conditions and the following disclaimer in the documentation and/or * other materials provided with the distribution. * * Neither the name of FIRST nor the names of its contributors may be used to endorse or * promote products derived from this software without specific prior written permission. * * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS * LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.firstinspires.ftc.teamcode; import com.qualcomm.robotcore.hardware.DcMotor; import com.qualcomm.robotcore.hardware.HardwareMap; import com.qualcomm.robotcore.hardware.Servo; /** * This is NOT an opmode. * * This class can be used to define all the specific hardware for a single robot. * In this case that robot is a K9 robot. * * This hardware class assumes the following device names have been configured on the robot: * Note: All names are lower case and some have single spaces between words. * */ public class TurnerHardware2858 { // Public OpMode members. //Arm public Servo armTT = null; public final static double ARMTT_HOME = 1.00; //Mecanum Wheels public DcMotor LeftDrive = null; public DcMotor RightDrive = null; public DcMotor LiftMotor = null; public DcMotor StringMotor = null; /* Local OpMode members. */ HardwareMap ThwMap = null; /* Constructor */ public TurnerHardware2858() { } // Initialize standard Hardware interfaces public void init(HardwareMap TahwMap) { // save reference to HW Map ThwMap = TahwMap; // Define and Initialize Mecanum Motors LeftDrive = ThwMap.get(DcMotor.class, "left_drive"); RightDrive = ThwMap.get(DcMotor.class, "right_drive"); LiftMotor = ThwMap.get(DcMotor.class, "back_left_drive"); StringMotor = ThwMap.get(DcMotor.class, "string_motor"); RightDrive.setDirection(DcMotor.Direction.REVERSE); StringMotor.setDirection(DcMotor.Direction.REVERSE); // Set all mecanum motors to zero power LeftDrive.setPower(0); RightDrive.setPower(0); LiftMotor.setPower(0); StringMotor.setPower(0); // Set all mecanum motors to run without encoders. LeftDrive.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER); RightDrive.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER); LiftMotor.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER); StringMotor.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER); //Define and initialize all installed servos. armTT = ThwMap.get(Servo.class, "armTT"); armTT.setPosition(1.00); } }
238c3df040703f6c23067e11895368f66c9a711c
de1bf31a9c753caccb62cfc1df6b6a88f777562b
/ticket-service/src/test/java/com/epam/training/ticketservice/repository/impl/JpaAdminRepositoryTest.java
2f8c15dafab0c6d6599fa1e4636495c872e64957
[]
no_license
davidhalasz/ticket-service-parent
348375e20a24c1c6a901d738c6c572dd4630d845
bf8b573e182b2236bcc999e69736dfa64a63a99e
refs/heads/master
2023-04-23T06:16:15.920922
2021-05-14T07:30:30
2021-05-14T07:30:30
363,360,933
0
0
null
null
null
null
UTF-8
Java
false
false
1,641
java
package com.epam.training.ticketservice.repository.impl; import com.epam.training.ticketservice.dataaccess.dao.AdminDao; import com.epam.training.ticketservice.dataaccess.entity.AdminEntity; import com.epam.training.ticketservice.domain.Admin; import com.epam.training.ticketservice.exceptions.AdminAccountNotExistsException; import com.epam.training.ticketservice.repository.mapper.Mapper; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.ArgumentMatchers.any; import static org.mockito.BDDMockito.given; @ExtendWith(MockitoExtension.class) class JpaAdminRepositoryTest { @InjectMocks JpaAdminRepository adminRepository; @Mock AdminDao adminDao; @Mock Mapper mapper; private static final String NAME = "admin"; private static final boolean PRIVILIGED = false; private static final String PASSWORD = "pswd"; private static final Admin ADMIN = new Admin(NAME, PASSWORD, false); private static final AdminEntity ADMIN_ENTITY = new AdminEntity(NAME, PASSWORD, false); @Test public void testGetAdminByNameShouldReturnsExceptionWhenAccountNotFound() throws AdminAccountNotExistsException { // Given given(adminDao.findByName(any())).willReturn(null); // Then assertThrows(AdminAccountNotExistsException.class, () -> { // When adminRepository.getAdminByName(NAME); }); } }
93ca8fdf41eddcd4a7350144283d370a59a3d0e8
38da28e4e7ad9e4cbbe29802db344a82e0a83e68
/AAD/AAD 1ª Evaluación/InstitutosCiclosTalleres/src/institutosciclostalleres/InstitutosCiclosTalleres.java
246547809e5c00b6d32c3dedb6dcdea0a3a68959
[]
no_license
LDHugeman/DAM_2
dce491da5d45a3852b7047a4c34caea75dcc7235
b6b0ef528cd33f6aa78afbe974668cd9949b63c9
refs/heads/master
2022-07-08T22:51:38.283590
2020-03-16T20:52:26
2020-03-16T20:52:26
209,628,083
2
0
null
null
null
null
UTF-8
Java
false
false
1,836
java
package institutosciclostalleres; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Statement; /** * * @author a18luisdvp */ public class InstitutosCiclosTalleres { public static void main(String[] args) { Connection conexion = null; Statement sentencia = null; String url = "jdbc:mysql://localhost:3307/?user=root&password=usbw"; try { conexion = DriverManager.getConnection(url); } catch (SQLException excepcion) { System.out.println("No hay ningún Driver registrado que reconozca la URL especificada"); System.out.println(excepcion.getMessage()); } try { sentencia = conexion.createStatement(); Crear.tablas(sentencia); } catch (SQLException excepcion) { System.out.println("Error al conectarse con el driver que maneja la BD"); System.out.println(excepcion.getMessage()); } NewHibernateUtil.getSessionFactory(); byte opcion = 0; do { opcion = Menu.seleccionarOpcionMenuPrincipal(); switch (opcion) { case 1: Menu.menuAltas(sentencia); break; case 2: Menu.menuAñadir(sentencia); break; case 3: Menu.menuBajas(sentencia); break; case 4: Menu.menuVisualizar(sentencia); break; case 0: NewHibernateUtil.getSessionFactory().close(); break; default: System.err.println("No existe esa opción"); } } while (opcion != 0); } }
9b63bb131466356a68e9204a4f536c59a23a9506
c404a39290e9b10494a0bc9f7286c5747a5fbf54
/OOP/src/Static/StaticMainMethodDemo.java
c45e809f2457e39cadcc28b122ae19a0f8e6aae6
[]
no_license
KhairulIslamAzam/Java-Master-Practice
652c0635c1bacb250afaca2dfa7f126c20034afe
ee6461845b33e334bd4ae15ab632d6ba16c847cf
refs/heads/master
2021-05-25T17:14:24.939127
2020-04-07T17:42:36
2020-04-07T17:42:36
253,837,411
0
0
null
2020-04-07T17:42:37
2020-04-07T15:36:00
Java
UTF-8
Java
false
false
964
java
package Static; import java.util.Scanner; public class StaticMainMethodDemo { public static void main(String[] args) { Scanner sc = new Scanner(System.in); //StaticDemo sd = new StaticDemo("Khairul", "CSE"); //sd.DisplayInfo(); /*Accessing static variaable by Static Class name not by object name */ //System.out.println("Static Variable Univeristy "+StaticVariableAccess.universityName); /* StaticCount scc = new StaticCount(); scc.totalCount(); StaticCount scc1 = new StaticCount(); scc1.totalCount(); StaticCount scc2 = new StaticCount(); scc2.totalCount(); */ /* Staticmethod sm = new Staticmethod(); sm.displayOne(); Staticmethod.displayTwo(); */ StaticBlockDemo sbd = new StaticBlockDemo(); sbd.display(); } }
ca8f542d6478b24cb8da8ab75754024978fa5936
f1371a78d07c69d1c9d9b7acb50e8521a438b121
/rest/src/main/java/stream/rest/app/dto/SODto.java
a0d36337b0fbbc5c3af40f508ffb5032bc1d4a51
[]
no_license
Ilya225/kafka-stream-test
4120da6005b64276bf820b41901e52fe9f078f35
54ea30ef6eb9cdd60e3a1046eafb3c5cf88401ce
refs/heads/master
2022-04-24T17:06:54.796618
2020-04-13T06:55:15
2020-04-13T06:55:15
255,253,903
0
0
null
null
null
null
UTF-8
Java
false
false
304
java
package stream.rest.app.dto; import lombok.Getter; import lombok.Setter; @Getter @Setter public class SODto { private Long pMeasurementTime; private Long tMeasurementTime; private String deviceId; private Double latitude; private Double longitude; private Double temperature; }
097e3241a6d82e72d2bca83aec43101649fb83a1
b5f6f95196eade33cc308a6e5bc1eadc7cf295e7
/SmartShopperUser/src/main/java/com/retail/shopper/SmartShopperLogin/controller/UserController.java
d0f674387c445aeab0a93c8e3d34a7e0722d9ad2
[]
no_license
Saveethar/Smartshopper
1a3fe76e24adabbf207abf48f0b4fd053552e817
af556770fb1370166049087fd28ab315b67fa123
refs/heads/master
2020-05-07T17:45:06.182940
2019-04-21T06:13:18
2019-04-21T06:13:18
180,646,742
0
0
null
null
null
null
UTF-8
Java
false
false
1,658
java
package com.retail.shopper.SmartShopperLogin.controller; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.repository.query.Param; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import com.retail.shopper.SmartShopperLogin.exception.ResourceNotFoundException; import com.retail.shopper.SmartShopperLogin.jpa.UserRepository; import com.retail.shopper.SmartShopperLogin.model.User; import com.retail.shopper.SmartShopperLogin.util.Utils; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @RestController @RequestMapping("/api/v1") public class UserController { @Autowired private UserRepository userRepository; @Autowired private Utils utils; /** * Intention of method is to mimic login success post registration with * combination of username and email. Need integration with authentication * and authorization server so that token is generate for API access * for both human and robotic users **/ @RequestMapping(value = "/users", params = { "userName", "email" }, method = RequestMethod.GET) public String getUsersById(@Param("userName") String userName, @Param("email") String email) throws ResourceNotFoundException { // To authenticate and obtain OAuth token from security provider //utils.authenticate(apikey, secret, username, password, areaUuid) // Very simple check using DB that user is present userRepository.findByUserNameAndEmail(userName, email); return "Üser Successfully Logged In"; } }
207860b83cf1375956f92aab93317af96bbaf603
e39b0898ff0c2b56187666dffe2a7b8728836c44
/wsd/.svn/pristine/5f/5fade23d2ccfa369315334c6e18976e8036d1811.svn-base
78b8f5d84e873337a53830ae5da9819cb9db2132
[]
no_license
cloudwafs/wsd
0afd3a3bb459e3e137ae558bf46135a1cdf1967a
6fd496a83d4a605295bc640dcb0b4a3d454f0d86
refs/heads/master
2023-07-12T02:03:57.942025
2021-08-09T08:49:30
2021-08-09T08:49:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
430
package com.qzsoft.tah.controller; import com.qzsoft.tah.service.TaskService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; /** * 控制器 * @author zhw **/ @RestController @RequestMapping("/task") public class TaskController { @Autowired private TaskService service; }
efc83b2d3d79dc364116f4390150452ab13e19ea
08d22ab5bcbadda84596ee1eb12552038ddf0866
/4.VendingMachine2/src/main/java/com/sg/vendingmachine/dao/VendingMachineDaoImpl.java
5aa908817cd4fa0820fafd94997c10de0c1b02cf
[]
no_license
jose-sosa/3.4.6.7-VendingMachine
1b56fe7671183e36a1c9683bc863167655ba638d
5cdf03279a95440c0e35ef60f164125a412807ca
refs/heads/master
2020-03-21T06:43:51.109165
2018-06-22T02:35:55
2018-06-22T02:35:55
138,238,293
0
0
null
null
null
null
UTF-8
Java
false
false
7,574
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.sg.vendingmachine.dao; import com.sg.vendingmachine.dao.exceptions.VendingMachinePersistenceException; import com.sg.vendingmachine.dto.Selection; import com.sg.vendingmachine.dto.VendingMachineDetails; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.math.BigDecimal; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Scanner; import java.util.stream.Collectors; /** * * @author josesosa */ public class VendingMachineDaoImpl implements VendingMachineDao { private final Map<String, Selection> inventory = new HashMap<>(); private VendingMachineDetails inventory2 = new VendingMachineDetails(); public static final String INVENTORY = "inventory.txt"; public static final String VMD = "vendingmachinedetails.txt"; public static final String DELIMITER = "::"; @Override public List<Selection> getAllSelections() throws VendingMachinePersistenceException{ loadInventory(); return new ArrayList<>(inventory.values()); } @Override public VendingMachineDetails getAllVendingMachineDetails() throws VendingMachinePersistenceException{ loadVendingMachineDetails(); return inventory2; } @Override public Selection getSelectionByName(String selectionName) throws VendingMachinePersistenceException{ loadInventory(); return inventory.get(selectionName); } private void loadInventory() throws VendingMachinePersistenceException { Scanner scanner; try { scanner = new Scanner(new BufferedReader(new FileReader(INVENTORY))); } catch (FileNotFoundException e) { throw new VendingMachinePersistenceException("Could not load the inventory into memory", e); } String currentLine; String[] currentTokens; // creates the hashmap with all while(scanner.hasNextLine()) { currentLine = scanner.nextLine(); currentTokens = currentLine.split(DELIMITER); Selection currentSelection = new Selection(currentTokens[0]); currentSelection.setInventory(Integer.parseInt(currentTokens[2])); currentSelection.setCost(new BigDecimal(currentTokens[1])); inventory.put(currentSelection.getSelectionName(), currentSelection); } scanner.close(); } @Override public void writeInventory() throws VendingMachinePersistenceException { PrintWriter out; try { out = new PrintWriter(new FileWriter(INVENTORY)); } catch(IOException e) { throw new VendingMachinePersistenceException("Could not save inventory data.", e); } List<Selection> inventory = this.getAllSelections(); for(Selection selection: inventory) { out.println(selection.getSelectionName() + DELIMITER + selection.getCost() + DELIMITER + selection.getInventory()); out.flush(); } out.close(); } private void loadVendingMachineDetails() throws VendingMachinePersistenceException { Scanner scanner; try { scanner = new Scanner(new BufferedReader(new FileReader(VMD))); } catch (FileNotFoundException e) { throw new VendingMachinePersistenceException("Could not load the vending into memory", e); } String currentLine; String[] currentTokens; while(scanner.hasNextLine()) { currentLine = scanner.nextLine(); currentTokens = currentLine.split(DELIMITER); VendingMachineDetails currentSelection; currentSelection = new VendingMachineDetails(); int[] intArray = currentSelection.getIntArray(); // This integer array represents the quantities of the denominations // in order from largest denomination to smallest for(int i = 0; i <currentTokens.length; i++){ intArray[i] = Integer.parseInt(currentTokens[i]); } currentSelection.setIntArray(intArray); inventory2 = currentSelection; } scanner.close(); } @Override public void writeVendingMachineDetails(VendingMachineDetails vmd) throws VendingMachinePersistenceException { PrintWriter out; try { out = new PrintWriter(new FileWriter(VMD)); } catch(IOException e) { throw new VendingMachinePersistenceException("Could not save vending data.", e); } for (int intMem : vmd.getIntArray()){ out.print(intMem + DELIMITER); } out.flush(); out.close(); } @Override public List<Selection> sortByInput(BigDecimal temp, int alsoTemp) throws VendingMachinePersistenceException { loadInventory(); return inventory.values() .stream() .filter(s -> s.getCost().doubleValue() <= temp.doubleValue()) .filter(s -> s.getInventory() > alsoTemp) .collect(Collectors.toList()); } } // FROM LOADVENDINGMACHINEDETAILS // // // currentSelection.setBalance(Integer.parseInt(currentTokens[0])); // currentSelection.setHundredsQuant(Integer.parseInt(currentTokens[1])); // currentSelection.setFiftiesQuant(Integer.parseInt(currentTokens[2])); // currentSelection.setTwentiesQuant(Integer.parseInt(currentTokens[3])); // currentSelection.setTensQuant(Integer.parseInt(currentTokens[4])); // currentSelection.setFivesQuant(Integer.parseInt(currentTokens[5])); // currentSelection.setSinglesQuant(Integer.parseInt(currentTokens[6])); // currentSelection.setQuartersQuant(Integer.parseInt(currentTokens[7])); // currentSelection.setDimesQuant(Integer.parseInt(currentTokens[8])); // currentSelection.setNickelsQuant(Integer.parseInt(currentTokens[9])); // currentSelection.setPenniesQuant(Integer.parseInt(currentTokens[10])); // // -------------------------------------------------------------------------- // FROM WRITEVENDINGMACHINEDETAILS // VendingMachineDetails vendingmachinedetails = inventory2; // // out.println(vendingmachinedetails.getBalance() + DELIMITER + vendingmachinedetails.getHundredsQuant() + DELIMITER + vendingmachinedetails.getFiftiesQuant() // + DELIMITER + vendingmachinedetails.getTwentiesQuant() + DELIMITER + vendingmachinedetails.getTensQuant() // + DELIMITER + vendingmachinedetails.getFivesQuant() + DELIMITER + vendingmachinedetails.getSinglesQuant() // + DELIMITER + vendingmachinedetails.getQuartersQuant() + DELIMITER + vendingmachinedetails.getDimesQuant() // + DELIMITER + vendingmachinedetails.getNickelsQuant() + DELIMITER + vendingmachinedetails.getPenniesQuant()); // out.flush(); // // out.print((int) vmd.getBalance() + DELIMITER);
7f338c4b3d40c7622d9cd0169ac7c8cf0b82548d
bc37706d39107ad3ca5117f6c9b182e86cf7ffe3
/src/MouseHandler.java
c8b0fcdab26fd99eae2eb69e570a4432ad13695e
[]
no_license
btharding/FishGame
3c7112c37942cce4f7846df475f7fd1eb5671bd0
d24bd0e151cfa6e05b5b3946c47a474e83e633fa
refs/heads/master
2022-11-20T11:06:53.388160
2020-07-22T14:37:05
2020-07-22T14:37:05
281,135,389
0
0
null
null
null
null
UTF-8
Java
false
false
788
java
import java.awt.event.MouseEvent; import javax.swing.SwingUtilities; import javax.swing.event.MouseInputListener; public class MouseHandler implements MouseInputListener { public static int mouseX, mouseY; @Override public void mouseClicked(MouseEvent e) { } @Override public void mousePressed(MouseEvent e) { } @Override public void mouseReleased(MouseEvent e) { if(SwingUtilities.isLeftMouseButton(e)) { Fish.checkClick(); } } @Override public void mouseEntered(MouseEvent e) { } @Override public void mouseExited(MouseEvent e) { } @Override public void mouseDragged(MouseEvent e) { } @Override public void mouseMoved(MouseEvent e) { mouseX = (int) (e.getX()+Camera.getxOffset()); mouseY = (int) (e.getY()+Camera.getyOffset()); } }
8af34965e457902151d894e521967fbbdc73f58a
646654426b30a636d4fad293c5bb7f148118cc01
/common-handbook/core/src/main/java/com/ddf/cloud/handbook/core/exception/BaseException.java
85771ce0154fe813c9f3fb16163342a9eebb91ad
[]
no_license
1214568110/spring-cloud-handbook
2fa10b81214341cf966c973f35d55c02ac0d9702
e7a56535db05475e0513853d9f8beb185b52f5aa
refs/heads/master
2023-01-20T15:48:13.704200
2020-11-30T11:17:26
2020-11-30T11:17:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,835
java
package com.ddf.cloud.handbook.core.exception; /** * <p>基准异常类</p > * * @author Snowball * @version 1.0 * @date 2020/06/17 15:55 */ public abstract class BaseException extends RuntimeException implements BaseCallbackCode { /** * 异常code码 */ private String code; /** * 异常消息 */ private String description; public BaseException() { } public BaseException(Throwable throwable) { super(throwable); initCallback(defaultCallback()); } public BaseException(BaseCallbackCode baseCallbackCode) { super(baseCallbackCode.getDescription()); initCallback(baseCallbackCode); } public BaseException(String description) { super(description); initCallback(defaultCallback()); } public BaseException(String code, String description) { super(description); initCallback(code, description); } private void initCallback(BaseCallbackCode baseCallbackCode) { initCallback(baseCallbackCode.getCode(), baseCallbackCode.getDescription()); } /** * 初始化状态码 * @param code * @param description */ private void initCallback(String code, String description) { this.code = code; this.description = description; } /** * 当前异常默认响应状态码 * @return */ public abstract BaseCallbackCode defaultCallback(); /** * 响应状态码 * * @return */ @Override public String getCode() { return code; } /** * 响应消息 * * @return */ @Override public String getDescription() { return description; } }
7a4760289cdced41e22cb4ba9a572fc77548d7c1
4caaad1e4d2fb6a25dc8622708381d2ddb56b03d
/src/main/java/org/hkijena/misa_imagej/api/MISARuntimeLog.java
8ab250eb1a9841baf3d7fb3607bd6484c4442936
[ "LGPL-2.1-or-later", "OFL-1.1", "MIT", "BSD-2-Clause" ]
permissive
applied-systems-biology/misa-imagej
22830ccec17a62ff455436b309760517f2fe4ddf
60e39171b187cc892881dab31ccdf27a18e49a65
refs/heads/master
2023-07-25T18:51:15.064476
2023-07-07T08:17:32
2023-07-07T08:17:32
181,651,109
0
0
BSD-2-Clause
2023-07-07T08:17:33
2019-04-16T08:48:28
Java
UTF-8
Java
false
false
2,014
java
/* * Copyright by Ruman Gerst * Research Group Applied Systems Biology - Head: Prof. Dr. Marc Thilo Figge * https://www.leibniz-hki.de/en/applied-systems-biology.html * HKI-Center for Systems Biology of Infection * Leibniz Institute for Natural Product Research and Infection Biology - Hans Knöll Insitute (HKI) * Adolf-Reichwein-Straße 23, 07745 Jena, Germany * * This code is licensed under BSD 2-Clause * See the LICENSE file provided with this code for the full license. */ package org.hkijena.misa_imagej.api; import com.google.gson.annotations.SerializedName; import java.util.HashMap; import java.util.List; import java.util.Map; public class MISARuntimeLog extends MISASerializable { @SerializedName("entries") public Map<String, List<Entry>> entries = new HashMap<>(); public static class Entry { @SerializedName("name") public String name; @SerializedName("end-time") public double endTime; @SerializedName("start-time") public double startTime; } /** * Returns the total runtime * @return */ public double getTotalRuntime() { double result = 0; for(List<Entry> list : entries.values()) { for(Entry entry : list) { result = Math.max(entry.endTime, result); } } return result; } /** * Estimates the runtime if no parallelization would be used * @return */ public double getUnparallelizedRuntime() { if(entries.size() <= 1) return getTotalRuntime(); double result = 0; for(List<Entry> list : entries.values()) { for(Entry entry : list) { result += entry.endTime - entry.startTime; } } return result; } /** * Returns the speedup by parallelization * @return */ public double getParallelizationSpeedup() { return getUnparallelizedRuntime() / getTotalRuntime(); } }
321901ad74ba9f00fb808f655a6b84f67a3a46b1
f56e6f8823e046d94f6df1087845bcda2e3332b9
/src/com/Ahtoh/company/Third/Card.java
c1ee95f2a191bd3a3a8b2c915ea8e57811560928
[]
no_license
AntonKalaturnyi/Education
a892fb6658967b66a32292af26938368171b8a0e
92cc8942868421d46c4e88775a357a67ed2c9968
refs/heads/master
2021-07-02T15:31:57.349381
2017-09-23T12:48:34
2017-09-23T12:48:34
104,508,504
0
0
null
null
null
null
UTF-8
Java
false
false
652
java
package com.Ahtoh.company.Third; /** * Task 3 * @author Kalaturnui Anton */ public class Card { private Rank rank; private Suit suit; public Card() { } public Card(Rank rank, Suit suit) { this.rank = rank; this.suit = suit; } public Rank getRank() { return rank; } public void setRank(Rank rank) { this.rank = rank; } public Suit getSuit() { return suit; } public void setSuit(Suit suit) { this.suit = suit; } @Override public String toString() { return "" + getRank() + " " + getSuit() ; } }
7e49df53c07ea9a4091470e3cf965d1a1e804c75
54a8592c8938be4686e0b93fae1ae02307542e11
/app/src/main/java/apandatv/model/entity/VideoPlayerBean.java
397a18f95dd341c6c98c80893c48b1cf4b0e90f5
[]
no_license
799821802/APandaTV
2bc34fdc9b754466edacc561d19512923e9d6f42
b85e24343371ee41f0119fb978010cf2d1882a91
refs/heads/master
2021-01-01T19:52:54.657922
2017-08-02T10:44:24
2017-08-02T10:44:24
98,601,280
0
0
null
null
null
null
UTF-8
Java
false
false
20,626
java
package apandatv.model.entity; import com.google.gson.annotations.SerializedName; import java.io.Serializable; import java.util.List; /** * Created by Administrator on 2017/7/18 0018. */ public class VideoPlayerBean implements Serializable{ /** * play_channel : CCTV-4高清 * f_pgmtime : 2016-10-10 18:43:07 * tag : * cdn_info : {"cdn_vip":"vod.cntv.lxdns.com","cdn_code":"VOD-MP4-CDN-CNC","cdn_name":"3rd网宿"} * editer_name : chenjialei * version : 0.2 * is_fn_hot : false * title : [远方的家]一带一路(28) 厦门:制作同安薄饼 * is_protected : 0 * hls_url : http://asp.cntv.lxdns.com/asp/hls/main/0303000a/3/default/1dbdf1c05d904bf494077b399dc08bf1/main.m3u8?maxbr=4096 * hls_cdn_info : {"cdn_vip":"asp.cntv.lxdns.com","cdn_code":"VOD-HLS-CDN-CNC","cdn_name":"3rd网宿"} * client_sid : 8a5ceb4efca749e581723b9c7db30681 * is_ipad_support : true * video : {"totalLength":"216.00","chapters":[{"image":"http://p5.img.cctvpic.com/fmspic/2016/10/10/1dbdf1c05d904bf494077b399dc08bf1-130.jpg","url":"http://vod.cntv.lxdns.com/flash/mp4video55/TMS/2016/10/10/1dbdf1c05d904bf494077b399dc08bf1_h264418000nero_aac32.mp4","duration":"216"}],"validChapterNum":5,"chapters4":[{"image":"http://p5.img.cctvpic.com/fmspic/2016/10/10/1dbdf1c05d904bf494077b399dc08bf1-130.jpg","url":"http://vod.cntv.lxdns.com/flash/mp4video55/TMS/2016/10/10/1dbdf1c05d904bf494077b399dc08bf1_h2642000000nero_aac16-1.mp4","duration":"119"},{"image":"http://p5.img.cctvpic.com/fmspic/2016/10/10/1dbdf1c05d904bf494077b399dc08bf1-130.jpg","url":"http://vod.cntv.lxdns.com/flash/mp4video55/TMS/2016/10/10/1dbdf1c05d904bf494077b399dc08bf1_h2642000000nero_aac16-2.mp4","duration":"96"}],"lowChapters":[{"image":"http://p5.img.cctvpic.com/fmspic/2016/10/10/1dbdf1c05d904bf494077b399dc08bf1-130.jpg","url":"http://vod.cntv.lxdns.com/flash/mp4video55/TMS/2016/10/10/1dbdf1c05d904bf494077b399dc08bf1_h264200000nero_aac16.mp4","duration":"216"}],"chapters3":[{"image":"http://p5.img.cctvpic.com/fmspic/2016/10/10/1dbdf1c05d904bf494077b399dc08bf1-130.jpg","url":"http://vod.cntv.lxdns.com/flash/mp4video55/TMS/2016/10/10/1dbdf1c05d904bf494077b399dc08bf1_h2641200000nero_aac16-1.mp4","duration":"119"},{"image":"http://p5.img.cctvpic.com/fmspic/2016/10/10/1dbdf1c05d904bf494077b399dc08bf1-130.jpg","url":"http://vod.cntv.lxdns.com/flash/mp4video55/TMS/2016/10/10/1dbdf1c05d904bf494077b399dc08bf1_h2641200000nero_aac16-2.mp4","duration":"96"}],"chapters2":[{"image":"http://p5.img.cctvpic.com/fmspic/2016/10/10/1dbdf1c05d904bf494077b399dc08bf1-130.jpg","url":"http://vod.cntv.lxdns.com/flash/mp4video55/TMS/2016/10/10/1dbdf1c05d904bf494077b399dc08bf1_h264818000nero_aac32-1.mp4","duration":"179"},{"image":"http://p5.img.cctvpic.com/fmspic/2016/10/10/1dbdf1c05d904bf494077b399dc08bf1-130.jpg","url":"http://vod.cntv.lxdns.com/flash/mp4video55/TMS/2016/10/10/1dbdf1c05d904bf494077b399dc08bf1_h264818000nero_aac32-2.mp4","duration":"37"}],"url":""} * is_invalid_copyright : 0 * produce_id : wxsb01 * default_stream : HD * ack : yes * is_fn_multi_stream : false * embed : * asp_error_code : 0 * column : 远方的家高清精切 * lc : {"isp_code":"1","city_code":"","provice_code":"BJ","country_code":"CN","ip":"1.203.191.248"} * public : 1 * is_p2p_use : false * produce : */ private String play_channel; private String f_pgmtime; private String tag; private CdnInfoBean cdn_info; private String editer_name; private String version; private String is_fn_hot; private String title; private String is_protected; private String hls_url; private HlsCdnInfoBean hls_cdn_info; private String client_sid; private String is_ipad_support; private VideoBean video; private String is_invalid_copyright; private String produce_id; private String default_stream; private String ack; private boolean is_fn_multi_stream; private String embed; private int asp_error_code; private String column; private LcBean lc; @SerializedName("public") private String publicX; private boolean is_p2p_use; private String produce; public String getPlay_channel() { return play_channel; } public void setPlay_channel(String play_channel) { this.play_channel = play_channel; } public String getF_pgmtime() { return f_pgmtime; } public void setF_pgmtime(String f_pgmtime) { this.f_pgmtime = f_pgmtime; } public String getTag() { return tag; } public void setTag(String tag) { this.tag = tag; } public CdnInfoBean getCdn_info() { return cdn_info; } public void setCdn_info(CdnInfoBean cdn_info) { this.cdn_info = cdn_info; } public String getEditer_name() { return editer_name; } public void setEditer_name(String editer_name) { this.editer_name = editer_name; } public String getVersion() { return version; } public void setVersion(String version) { this.version = version; } public String getIs_fn_hot() { return is_fn_hot; } public void setIs_fn_hot(String is_fn_hot) { this.is_fn_hot = is_fn_hot; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getIs_protected() { return is_protected; } public void setIs_protected(String is_protected) { this.is_protected = is_protected; } public String getHls_url() { return hls_url; } public void setHls_url(String hls_url) { this.hls_url = hls_url; } public HlsCdnInfoBean getHls_cdn_info() { return hls_cdn_info; } public void setHls_cdn_info(HlsCdnInfoBean hls_cdn_info) { this.hls_cdn_info = hls_cdn_info; } public String getClient_sid() { return client_sid; } public void setClient_sid(String client_sid) { this.client_sid = client_sid; } public String getIs_ipad_support() { return is_ipad_support; } public void setIs_ipad_support(String is_ipad_support) { this.is_ipad_support = is_ipad_support; } public VideoBean getVideo() { return video; } public void setVideo(VideoBean video) { this.video = video; } public String getIs_invalid_copyright() { return is_invalid_copyright; } public void setIs_invalid_copyright(String is_invalid_copyright) { this.is_invalid_copyright = is_invalid_copyright; } public String getProduce_id() { return produce_id; } public void setProduce_id(String produce_id) { this.produce_id = produce_id; } public String getDefault_stream() { return default_stream; } public void setDefault_stream(String default_stream) { this.default_stream = default_stream; } public String getAck() { return ack; } public void setAck(String ack) { this.ack = ack; } public boolean isIs_fn_multi_stream() { return is_fn_multi_stream; } public void setIs_fn_multi_stream(boolean is_fn_multi_stream) { this.is_fn_multi_stream = is_fn_multi_stream; } public String getEmbed() { return embed; } public void setEmbed(String embed) { this.embed = embed; } public int getAsp_error_code() { return asp_error_code; } public void setAsp_error_code(int asp_error_code) { this.asp_error_code = asp_error_code; } public String getColumn() { return column; } public void setColumn(String column) { this.column = column; } public LcBean getLc() { return lc; } public void setLc(LcBean lc) { this.lc = lc; } public String getPublicX() { return publicX; } public void setPublicX(String publicX) { this.publicX = publicX; } public boolean isIs_p2p_use() { return is_p2p_use; } public void setIs_p2p_use(boolean is_p2p_use) { this.is_p2p_use = is_p2p_use; } public String getProduce() { return produce; } public void setProduce(String produce) { this.produce = produce; } public static class CdnInfoBean { /** * cdn_vip : vod.cntv.lxdns.com * cdn_code : VOD-MP4-CDN-CNC * cdn_name : 3rd网宿 */ private String cdn_vip; private String cdn_code; private String cdn_name; public String getCdn_vip() { return cdn_vip; } public void setCdn_vip(String cdn_vip) { this.cdn_vip = cdn_vip; } public String getCdn_code() { return cdn_code; } public void setCdn_code(String cdn_code) { this.cdn_code = cdn_code; } public String getCdn_name() { return cdn_name; } public void setCdn_name(String cdn_name) { this.cdn_name = cdn_name; } } public static class HlsCdnInfoBean { /** * cdn_vip : asp.cntv.lxdns.com * cdn_code : VOD-HLS-CDN-CNC * cdn_name : 3rd网宿 */ private String cdn_vip; private String cdn_code; private String cdn_name; public String getCdn_vip() { return cdn_vip; } public void setCdn_vip(String cdn_vip) { this.cdn_vip = cdn_vip; } public String getCdn_code() { return cdn_code; } public void setCdn_code(String cdn_code) { this.cdn_code = cdn_code; } public String getCdn_name() { return cdn_name; } public void setCdn_name(String cdn_name) { this.cdn_name = cdn_name; } } public static class VideoBean { /** * totalLength : 216.00 * chapters : [{"image":"http://p5.img.cctvpic.com/fmspic/2016/10/10/1dbdf1c05d904bf494077b399dc08bf1-130.jpg","url":"http://vod.cntv.lxdns.com/flash/mp4video55/TMS/2016/10/10/1dbdf1c05d904bf494077b399dc08bf1_h264418000nero_aac32.mp4","duration":"216"}] * validChapterNum : 5 * chapters4 : [{"image":"http://p5.img.cctvpic.com/fmspic/2016/10/10/1dbdf1c05d904bf494077b399dc08bf1-130.jpg","url":"http://vod.cntv.lxdns.com/flash/mp4video55/TMS/2016/10/10/1dbdf1c05d904bf494077b399dc08bf1_h2642000000nero_aac16-1.mp4","duration":"119"},{"image":"http://p5.img.cctvpic.com/fmspic/2016/10/10/1dbdf1c05d904bf494077b399dc08bf1-130.jpg","url":"http://vod.cntv.lxdns.com/flash/mp4video55/TMS/2016/10/10/1dbdf1c05d904bf494077b399dc08bf1_h2642000000nero_aac16-2.mp4","duration":"96"}] * lowChapters : [{"image":"http://p5.img.cctvpic.com/fmspic/2016/10/10/1dbdf1c05d904bf494077b399dc08bf1-130.jpg","url":"http://vod.cntv.lxdns.com/flash/mp4video55/TMS/2016/10/10/1dbdf1c05d904bf494077b399dc08bf1_h264200000nero_aac16.mp4","duration":"216"}] * chapters3 : [{"image":"http://p5.img.cctvpic.com/fmspic/2016/10/10/1dbdf1c05d904bf494077b399dc08bf1-130.jpg","url":"http://vod.cntv.lxdns.com/flash/mp4video55/TMS/2016/10/10/1dbdf1c05d904bf494077b399dc08bf1_h2641200000nero_aac16-1.mp4","duration":"119"},{"image":"http://p5.img.cctvpic.com/fmspic/2016/10/10/1dbdf1c05d904bf494077b399dc08bf1-130.jpg","url":"http://vod.cntv.lxdns.com/flash/mp4video55/TMS/2016/10/10/1dbdf1c05d904bf494077b399dc08bf1_h2641200000nero_aac16-2.mp4","duration":"96"}] * chapters2 : [{"image":"http://p5.img.cctvpic.com/fmspic/2016/10/10/1dbdf1c05d904bf494077b399dc08bf1-130.jpg","url":"http://vod.cntv.lxdns.com/flash/mp4video55/TMS/2016/10/10/1dbdf1c05d904bf494077b399dc08bf1_h264818000nero_aac32-1.mp4","duration":"179"},{"image":"http://p5.img.cctvpic.com/fmspic/2016/10/10/1dbdf1c05d904bf494077b399dc08bf1-130.jpg","url":"http://vod.cntv.lxdns.com/flash/mp4video55/TMS/2016/10/10/1dbdf1c05d904bf494077b399dc08bf1_h264818000nero_aac32-2.mp4","duration":"37"}] * url : */ private String totalLength; private int validChapterNum; private String url; private List<ChaptersBean> chapters; private List<Chapters4Bean> chapters4; private List<LowChaptersBean> lowChapters; private List<Chapters3Bean> chapters3; private List<Chapters2Bean> chapters2; public String getTotalLength() { return totalLength; } public void setTotalLength(String totalLength) { this.totalLength = totalLength; } public int getValidChapterNum() { return validChapterNum; } public void setValidChapterNum(int validChapterNum) { this.validChapterNum = validChapterNum; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public List<ChaptersBean> getChapters() { return chapters; } public void setChapters(List<ChaptersBean> chapters) { this.chapters = chapters; } public List<Chapters4Bean> getChapters4() { return chapters4; } public void setChapters4(List<Chapters4Bean> chapters4) { this.chapters4 = chapters4; } public List<LowChaptersBean> getLowChapters() { return lowChapters; } public void setLowChapters(List<LowChaptersBean> lowChapters) { this.lowChapters = lowChapters; } public List<Chapters3Bean> getChapters3() { return chapters3; } public void setChapters3(List<Chapters3Bean> chapters3) { this.chapters3 = chapters3; } public List<Chapters2Bean> getChapters2() { return chapters2; } public void setChapters2(List<Chapters2Bean> chapters2) { this.chapters2 = chapters2; } public static class ChaptersBean { /** * image : http://p5.img.cctvpic.com/fmspic/2016/10/10/1dbdf1c05d904bf494077b399dc08bf1-130.jpg * url : http://vod.cntv.lxdns.com/flash/mp4video55/TMS/2016/10/10/1dbdf1c05d904bf494077b399dc08bf1_h264418000nero_aac32.mp4 * duration : 216 */ private String image; private String url; private String duration; public String getImage() { return image; } public void setImage(String image) { this.image = image; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public String getDuration() { return duration; } public void setDuration(String duration) { this.duration = duration; } } public static class Chapters4Bean { /** * image : http://p5.img.cctvpic.com/fmspic/2016/10/10/1dbdf1c05d904bf494077b399dc08bf1-130.jpg * url : http://vod.cntv.lxdns.com/flash/mp4video55/TMS/2016/10/10/1dbdf1c05d904bf494077b399dc08bf1_h2642000000nero_aac16-1.mp4 * duration : 119 */ private String image; private String url; private String duration; public String getImage() { return image; } public void setImage(String image) { this.image = image; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public String getDuration() { return duration; } public void setDuration(String duration) { this.duration = duration; } } public static class LowChaptersBean { /** * image : http://p5.img.cctvpic.com/fmspic/2016/10/10/1dbdf1c05d904bf494077b399dc08bf1-130.jpg * url : http://vod.cntv.lxdns.com/flash/mp4video55/TMS/2016/10/10/1dbdf1c05d904bf494077b399dc08bf1_h264200000nero_aac16.mp4 * duration : 216 */ private String image; private String url; private String duration; public String getImage() { return image; } public void setImage(String image) { this.image = image; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public String getDuration() { return duration; } public void setDuration(String duration) { this.duration = duration; } } public static class Chapters3Bean { /** * image : http://p5.img.cctvpic.com/fmspic/2016/10/10/1dbdf1c05d904bf494077b399dc08bf1-130.jpg * url : http://vod.cntv.lxdns.com/flash/mp4video55/TMS/2016/10/10/1dbdf1c05d904bf494077b399dc08bf1_h2641200000nero_aac16-1.mp4 * duration : 119 */ private String image; private String url; private String duration; public String getImage() { return image; } public void setImage(String image) { this.image = image; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public String getDuration() { return duration; } public void setDuration(String duration) { this.duration = duration; } } public static class Chapters2Bean { /** * image : http://p5.img.cctvpic.com/fmspic/2016/10/10/1dbdf1c05d904bf494077b399dc08bf1-130.jpg * url : http://vod.cntv.lxdns.com/flash/mp4video55/TMS/2016/10/10/1dbdf1c05d904bf494077b399dc08bf1_h264818000nero_aac32-1.mp4 * duration : 179 */ private String image; private String url; private String duration; public String getImage() { return image; } public void setImage(String image) { this.image = image; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public String getDuration() { return duration; } public void setDuration(String duration) { this.duration = duration; } } } public static class LcBean { /** * isp_code : 1 * city_code : * provice_code : BJ * country_code : CN * ip : 1.203.191.248 */ private String isp_code; private String city_code; private String provice_code; private String country_code; private String ip; public String getIsp_code() { return isp_code; } public void setIsp_code(String isp_code) { this.isp_code = isp_code; } public String getCity_code() { return city_code; } public void setCity_code(String city_code) { this.city_code = city_code; } public String getProvice_code() { return provice_code; } public void setProvice_code(String provice_code) { this.provice_code = provice_code; } public String getCountry_code() { return country_code; } public void setCountry_code(String country_code) { this.country_code = country_code; } public String getIp() { return ip; } public void setIp(String ip) { this.ip = ip; } } }
57e9fda62cd7880adcddd428e3d0c49d44a00b1c
745b525c360a2b15b8d73841b36c1e8d6cdc9b03
/jun_springcloud_plugin/manager-dubbo-service/manager-consumer-admin/src/main/java/com/cosmoplat/service/sys/DeptService.java
3a321411d1c1ddf43cb441686c710ae133d997ad
[]
no_license
wujun728/jun_java_plugin
1f3025204ef5da5ad74f8892adead7ee03f3fe4c
e031bc451c817c6d665707852308fc3b31f47cb2
refs/heads/master
2023-09-04T08:23:52.095971
2023-08-18T06:54:29
2023-08-18T06:54:29
62,047,478
117
42
null
2023-08-21T16:02:15
2016-06-27T10:23:58
Java
UTF-8
Java
false
false
417
java
package com.cosmoplat.service.sys; import com.cosmoplat.entity.sys.SysDept; /** * Created with IntelliJ IDEA. * * @author: wenbin * @date: 2020/8/26 * Description: No Description */ public interface DeptService { Object addDept(SysDept vo); void deleted(String id); void updateDept(SysDept vo); Object getById(String id); Object deptTreeList(String deptId); Object selectAll(); }
154a700154f9960efdc9cc7f82b1946f1b142af1
001fa28efc1cfda612f1e9d5b4113622284b5bf8
/tests_extracted/slinkedlist$test_0_orig_no_procyon$SLinkedList$Reverse_With_Bubble.java
089b3f67c7008007cd8b08d7add2d33343e131ef
[]
no_license
cragkhit/es_exp
eaa72b6bde3656977ea9454593ebd12a85a5023c
dc9f29045d0bcdba79cdf5cb48bababb8aa9adba
refs/heads/master
2016-08-11T15:19:18.709889
2016-03-27T02:15:01
2016-03-27T02:15:01
51,704,609
0
0
null
null
null
null
UTF-8
Java
false
false
502
java
public SLinkedList Reverse_With_Bubble(final SLinkedList list){ SLinkedList list2 = null; if (list == null) { return list; } while (true) { SLinkedList next = list; if (next.next == list2) { break; } do { final int data = next.data; next.data = next.next.data; next.next.data = data; next = next.next; } while (next.next != list2); list2 = next; } return list; }
0fbb670004ba7e4dac45ef97561fe23bc5005aee
f2eb5c54e4e973726b9d90b65e5ec13c28f36b55
/gmall-mbg/src/main/java/com/Evil/gmall/cms/mapper/TopicCommentMapper.java
d508cb1eb3594808d205b75f7430f10c00cd24d3
[]
no_license
JNianqi/gmall
03b15f8b20afae52feefe10bcd470cf7ad29e62c
5c92f0ade76f53137204f5d9693c00515063196b
refs/heads/master
2022-06-22T14:10:57.985401
2020-04-05T03:19:14
2020-04-05T03:19:14
252,950,539
0
0
null
2022-06-21T03:08:23
2020-04-04T08:50:05
Java
UTF-8
Java
false
false
310
java
package com.Evil.gmall.cms.mapper; import com.Evil.gmall.cms.entity.TopicComment; import com.baomidou.mybatisplus.core.mapper.BaseMapper; /** * <p> * 专题评论表 Mapper 接口 * </p> * * @author Evil * @since 2020-04-04 */ public interface TopicCommentMapper extends BaseMapper<TopicComment> { }
c1fbc08595edbfb1037070cfb24dd1617c0c3afa
d45aafe9e0181ddd1e82afe11778de58b5f74838
/src/main/java/ocsp/AbstractOcspClient.java
f195b50e277ea51bc665c042b5cebeec2f1b3eb8
[]
no_license
korayguney/tls-handshake
669411ffb41ce5e2f63363b6405b1a6720bcdf82
e9bd2d15d29ab207aedb4376a5280e24d5a5585c
refs/heads/master
2023-02-03T23:17:53.365944
2018-07-05T06:22:10
2018-07-05T06:22:10
135,036,282
0
0
null
null
null
null
UTF-8
Java
false
false
4,714
java
package ocsp; import ocsp.api.OcspFetcher; import ocsp.api.OcspFetcherResponse; import ocsp.builder.Properties; import ocsp.builder.Property; import ocsp.fetcher.UrlOcspFetcher; import org.bouncycastle.asn1.ASN1Sequence; import org.bouncycastle.asn1.DEROctetString; import org.bouncycastle.asn1.DERTaggedObject; import org.bouncycastle.asn1.x509.Extension; import org.bouncycastle.asn1.x509.GeneralName; import org.bouncycastle.asn1.x509.X509ObjectIdentifiers; import org.bouncycastle.x509.extension.X509ExtensionUtil; import java.io.IOException; import java.io.InputStream; import java.net.URI; import java.security.cert.X509Certificate; import java.util.Collections; import java.util.Enumeration; import java.util.List; /** * This abstract class implements common features related to OCSP verification. * * @author erlend */ class AbstractOcspClient { public static final Property<Boolean> EXCEPTION_ON_NO_PATH = Property.create(false); public static final Property<OcspFetcher> FETCHER = Property.create(UrlOcspFetcher.builder().build()); public static final Property<List<X509Certificate>> INTERMEDIATES = Property.create(Collections.<X509Certificate>emptyList()); public static final Property<URI> OVERRIDE_URL = Property.create(); public static final Property<Boolean> NONCE = Property.create(false); /** * Properties provided by the builder. */ protected final Properties properties; /** * Constructor accepting properties provided by the builder. * * @param properties Properties provided by the builder. */ protected AbstractOcspClient(Properties properties) { this.properties = properties; } /** * Method for finding issuer by provided issuers in properties given an issued certificate. * * @param certificate Issued certificate. * @return Issuer of the issued certificate. * @throws OcspException Thrown when no issuer is found. */ protected X509Certificate findIntermediate(X509Certificate certificate) throws OcspException { for (X509Certificate issuer : properties.get(INTERMEDIATES)) if (issuer.getSubjectX500Principal().equals(certificate.getIssuerX500Principal())) return issuer; throw new OcspException("Unable to find issuer '%s'.", certificate.getIssuerX500Principal().getName()); } protected URI detectOcspUri(X509Certificate certificate) throws OcspException { byte[] extensionValue = certificate.getExtensionValue(Extension.authorityInfoAccess.getId()); if (extensionValue == null) { OcspException.trigger(properties.get(EXCEPTION_ON_NO_PATH), "Unable to detect path for OCSP (%s)", Extension.authorityInfoAccess.getId()); return null; } try { ASN1Sequence asn1Seq = (ASN1Sequence) X509ExtensionUtil.fromExtensionValue(extensionValue); Enumeration<?> objects = asn1Seq.getObjects(); while (objects.hasMoreElements()) { ASN1Sequence obj = (ASN1Sequence) objects.nextElement(); if (obj.getObjectAt(0).equals(X509ObjectIdentifiers.id_ad_ocsp)) { DERTaggedObject location = (DERTaggedObject) obj.getObjectAt(1); if (location.getTagNo() == GeneralName.uniformResourceIdentifier) { DEROctetString uri = (DEROctetString) location.getObject(); return URI.create(new String(uri.getOctets())); } } } } catch (Exception e) { throw new OcspException("Exception when reading AIA: '%s'.", e, e.getMessage()); } OcspException.trigger(properties.get(EXCEPTION_ON_NO_PATH), "Unable to detect path for OCSP in AIA (%s)", Extension.authorityInfoAccess.getId()); return null; } protected OcspResponse fetch(OcspRequest ocspReq, URI uri) throws OcspException { try (OcspFetcherResponse response = properties.get(FETCHER).fetch(uri, ocspReq.generateRequest())) { if (response.getStatus() != 200) throw new OcspException("Received HTTP code '%s' from responder.", response.getStatus()); if (!response.getContentType().equalsIgnoreCase("application/ocsp-response")) throw new OcspException("Response was of type '%s'.", response.getContentType()); try (InputStream inputStream = response.getContent()) { return OcspResponse.parse(uri, inputStream); } } catch (IOException e) { throw new OcspException(e.getMessage(), e); } } }
84600d62f2f63f786f026b6de5a266bd16ead568
804312455dda798ad2f5c11c9051db3b93090763
/Java Application/src/exemplo/SistemaConsole.java
6721b41d4a8c5eef619bcae5cf5d4116dffdb64c
[]
no_license
br-okamoto/Projeto-Interdisciplinar-II
929fde75196ff1d630b10b0f5e9119cb81f9df88
b27da10cce60ac0033b50519d3685bf127342b50
refs/heads/master
2020-12-25T19:26:26.322274
2013-06-13T00:06:02
2013-06-13T00:06:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,393
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package exemplo; import exemplo.exceptions.ObjetoNotNullException; import java.io.IOException; import java.util.InputMismatchException; import java.util.Properties; import java.util.Scanner; import javax.naming.InitialContext; import javax.naming.NamingException; /** * * @author Calebe de Paula Bianchini */ public class SistemaConsole { public static void main(String[] args) { boolean ok = false; String s = null; double d = 0; int i = 0; System.out.println("Digite os seguintes valores"); while (!ok) { try { Scanner in = new Scanner(System.in); System.out.println("Int:"); i = in.nextInt(); System.out.println("Double:"); d = in.nextDouble(); System.out.println("String:"); s = in.next(); ok = true; } catch (InputMismatchException e) { System.err.println("Algum número informado é inválido!"); System.out.println("Digite novamente:"); } } try { Properties props = new Properties(); props.load(new java.io.FileInputStream("jndi.properties")); InitialContext ctx = new InitialContext(props); EJBStatelessExemploInterface beanStateless = (EJBStatelessExemploInterface) ctx.lookup("ejb/EJBStatelessExemplo"); System.out.println("\nResultado EJBStatelessExemploInterface:"); System.out.println(beanStateless.metodo(d, i, s)); EJBStatefulExemploInterface beanStateful = (EJBStatefulExemploInterface) ctx.lookup("ejb/EJBStatefulExemplo"); beanStateful.set(new ObjetoExemplo(s, i, d)); System.out.println("\nResultado EJBStatefulExemploInterface:"); System.out.println(beanStateful.get()); } catch (ObjetoNotNullException e) { System.err.println("Objeto no EJBStatefulExemploInterface já está instanciado."); e.printStackTrace(System.err); } catch (Exception e) { System.err.println("Erro ao tentar achar EBJs:"); e.printStackTrace(System.err); } } }
c1b093d0a84ac0ed24367bdb1692c09adf426cec
bf2966abae57885c29e70852243a22abc8ba8eb0
/aws-java-sdk-rekognition/src/main/java/com/amazonaws/services/rekognition/model/transform/ValidationDataJsonUnmarshaller.java
8873f27fcea70a6144254d7410cd618b83a5a4cd
[ "Apache-2.0" ]
permissive
kmbotts/aws-sdk-java
ae20b3244131d52b9687eb026b9c620da8b49935
388f6427e00fb1c2f211abda5bad3a75d29eef62
refs/heads/master
2021-12-23T14:39:26.369661
2021-07-26T20:09:07
2021-07-26T20:09:07
246,296,939
0
0
Apache-2.0
2020-03-10T12:37:34
2020-03-10T12:37:33
null
UTF-8
Java
false
false
2,777
java
/* * Copyright 2016-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.rekognition.model.transform; import java.math.*; import javax.annotation.Generated; import com.amazonaws.services.rekognition.model.*; import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*; import com.amazonaws.transform.*; import com.fasterxml.jackson.core.JsonToken; import static com.fasterxml.jackson.core.JsonToken.*; /** * ValidationData JSON Unmarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class ValidationDataJsonUnmarshaller implements Unmarshaller<ValidationData, JsonUnmarshallerContext> { public ValidationData unmarshall(JsonUnmarshallerContext context) throws Exception { ValidationData validationData = new ValidationData(); int originalDepth = context.getCurrentDepth(); String currentParentElement = context.getCurrentParentElement(); int targetDepth = originalDepth + 1; JsonToken token = context.getCurrentToken(); if (token == null) token = context.nextToken(); if (token == VALUE_NULL) { return null; } while (true) { if (token == null) break; if (token == FIELD_NAME || token == START_OBJECT) { if (context.testExpression("Assets", targetDepth)) { context.nextToken(); validationData.setAssets(new ListUnmarshaller<Asset>(AssetJsonUnmarshaller.getInstance()) .unmarshall(context)); } } else if (token == END_ARRAY || token == END_OBJECT) { if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) { if (context.getCurrentDepth() <= originalDepth) break; } } token = context.nextToken(); } return validationData; } private static ValidationDataJsonUnmarshaller instance; public static ValidationDataJsonUnmarshaller getInstance() { if (instance == null) instance = new ValidationDataJsonUnmarshaller(); return instance; } }
[ "" ]
25758d25e3e23edda118c9fd3980e9b0b73ad584
00e3191151541be58f374b9e93f387fcc276c754
/src/com/csipsimple/ui/dialpad/DialerFragment1.java
4ececd929ba73bd031305e3d9eb4b447d3ab5e63
[]
no_license
nanshihui/Csip
5885a1762294b312be9b48b0a7c71e23b50879d6
d86e981ce38618d7ec6d05f25aecf3dec5d98bfe
refs/heads/master
2021-01-10T21:49:37.453415
2016-01-12T13:29:14
2016-01-12T13:29:14
37,258,240
2
0
null
null
null
null
UTF-8
Java
false
false
33,578
java
package com.csipsimple.ui.dialpad; import android.app.Activity; import android.app.AlertDialog; import android.app.PendingIntent.CanceledException; import android.content.ComponentName; import android.content.ContentUris; import android.content.ContentValues; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.ServiceConnection; import android.net.Uri; import android.os.Bundle; import android.os.IBinder; import android.os.RemoteException; import android.support.v4.app.FragmentTransaction; import android.telephony.PhoneNumberFormattingTextWatcher; import android.telephony.PhoneNumberUtils; import android.telephony.TelephonyManager; import android.text.Editable; import android.text.Selection; import android.text.TextUtils; import android.text.TextWatcher; import android.text.method.DialerKeyListener; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.View.OnKeyListener; import android.view.View.OnLongClickListener; import android.view.ViewGroup; import android.view.WindowManager; import android.view.inputmethod.EditorInfo; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; import android.widget.TextView.OnEditorActionListener; import com.actionbarsherlock.app.SherlockFragment; import com.actionbarsherlock.view.Menu; import com.actionbarsherlock.view.MenuInflater; import com.actionbarsherlock.view.MenuItem; import com.actionbarsherlock.view.MenuItem.OnMenuItemClickListener; import com.csipsimple.R; import com.csipsimple.api.ISipService; import com.csipsimple.api.SipCallSession; import com.csipsimple.api.SipConfigManager; import com.csipsimple.api.SipManager; import com.csipsimple.api.SipProfile; import com.csipsimple.api.SipUri.ParsedSipContactInfos; import com.csipsimple.models.Filter; import com.csipsimple.ui.SipHome.ViewPagerVisibilityListener; import com.csipsimple.ui.dialpad.DialerLayout.OnAutoCompleteListVisibilityChangedListener; import com.csipsimple.utils.CallHandlerPlugin; import com.csipsimple.utils.CallHandlerPlugin.OnLoadListener; import com.csipsimple.utils.DialingFeedback; import com.csipsimple.utils.Log; import com.csipsimple.utils.PreferencesWrapper; import com.csipsimple.utils.contacts.ContactsSearchAdapter; import com.csipsimple.widgets.AccountChooserButton; import com.csipsimple.widgets.AccountChooserButton.OnAccountChangeListener; import com.csipsimple.widgets.DialerCallBar; import com.csipsimple.widgets.DialerCallBar.OnDialActionListener; import com.csipsimple.widgets.Dialpad; import com.csipsimple.widgets.Dialpad.OnDialKeyListener; public class DialerFragment1 extends SherlockFragment implements OnClickListener, OnLongClickListener, OnDialKeyListener, TextWatcher, OnDialActionListener, ViewPagerVisibilityListener, OnKeyListener, OnAutoCompleteListVisibilityChangedListener { private static final String THIS_FILE = "DialerFragment"; protected static final int PICKUP_PHONE = 0; //private Drawable digitsBackground, digitsEmptyBackground; private DigitsEditText digits; private String initText = null; //private ImageButton switchTextView; //private View digitDialer; private AccountChooserButton accountChooserButton; private Boolean isDigit = null; /* , isTablet */ private DialingFeedback dialFeedback; /* private final int[] buttonsToAttach = new int[] { R.id.switchTextView }; */ private final int[] buttonsToLongAttach = new int[] { R.id.button0, R.id.button1 }; // TimingLogger timings = new TimingLogger("SIP_HOME", "test"); private ISipService service; private ServiceConnection connection = new ServiceConnection() { @Override public void onServiceConnected(ComponentName arg0, IBinder arg1) { service = ISipService.Stub.asInterface(arg1); /* * timings.addSplit("Service connected"); if(configurationService != * null) { timings.dumpToLog(); } */ } @Override public void onServiceDisconnected(ComponentName arg0) { service = null; } }; // private GestureDetector gestureDetector; private Dialpad dialPad; private PreferencesWrapper prefsWrapper; private AlertDialog missingVoicemailDialog; // Auto completion for text mode private ListView autoCompleteList; private ContactsSearchAdapter autoCompleteAdapter; private DialerCallBar callBar; private boolean mDualPane; private DialerAutocompleteDetailsFragment autoCompleteFragment; private PhoneNumberFormattingTextWatcher digitFormater; private OnAutoCompleteListItemClicked autoCompleteListItemListener; private DialerLayout dialerLayout; private MenuItem accountChooserFilterItem; private TextView rewriteTextInfo; @Override public void onAutoCompleteListVisibiltyChanged() { applyTextToAutoComplete(); } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mDualPane = getResources().getBoolean(R.bool.use_dual_panes); digitFormater = new PhoneNumberFormattingTextWatcher(); // Auto complete list in case of text autoCompleteAdapter = new ContactsSearchAdapter(getActivity()); autoCompleteListItemListener = new OnAutoCompleteListItemClicked(autoCompleteAdapter); if(isDigit == null) { isDigit = !prefsWrapper.getPreferenceBooleanValue(SipConfigManager.START_WITH_TEXT_DIALER); } setHasOptionsMenu(true); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.dialer_digit, container, false); // Store the backgrounds objects that will be in use later /* Resources r = getResources(); digitsBackground = r.getDrawable(R.drawable.btn_dial_textfield_active); digitsEmptyBackground = r.getDrawable(R.drawable.btn_dial_textfield_normal); */ // Store some object that could be useful later digits = (DigitsEditText) v.findViewById(R.id.digitsText); dialPad = (Dialpad) v.findViewById(R.id.dialPad); callBar = (DialerCallBar) v.findViewById(R.id.dialerCallBar); autoCompleteList = (ListView) v.findViewById(R.id.autoCompleteList); rewriteTextInfo = (TextView) v.findViewById(R.id.rewriteTextInfo); accountChooserButton = (AccountChooserButton) v.findViewById(R.id.accountChooserButton); accountChooserFilterItem = accountChooserButton.addExtraMenuItem(R.string.apply_rewrite); accountChooserFilterItem.setCheckable(true); accountChooserFilterItem.setOnMenuItemClickListener(new OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { setRewritingFeature(!accountChooserFilterItem.isChecked()); return true; } }); setRewritingFeature(prefsWrapper.getPreferenceBooleanValue(SipConfigManager.REWRITE_RULES_DIALER)); dialerLayout = (DialerLayout) v.findViewById(R.id.top_digit_dialer); //switchTextView = (ImageButton) v.findViewById(R.id.switchTextView); // isTablet = Compatibility.isTabletScreen(getActivity()); // Digits field setup if(savedInstanceState != null) { isDigit = savedInstanceState.getBoolean(TEXT_MODE_KEY, isDigit); } digits.setOnEditorActionListener(keyboardActionListener); // Layout dialerLayout.setForceNoList(mDualPane); dialerLayout.setAutoCompleteListVisibiltyChangedListener(this); // Account chooser button setup accountChooserButton.setShowExternals(true); accountChooserButton.setOnAccountChangeListener(accountButtonChangeListener); // Dialpad dialPad.setOnDialKeyListener(this); // We only need to add the autocomplete list if we autoCompleteList.setAdapter(autoCompleteAdapter); autoCompleteList.setOnItemClickListener(autoCompleteListItemListener); autoCompleteList.setFastScrollEnabled(true); // Bottom bar setup callBar.setOnDialActionListener(this); callBar.setVideoEnabled(prefsWrapper.getPreferenceBooleanValue(SipConfigManager.USE_VIDEO)); //switchTextView.setVisibility(Compatibility.isCompatible(11) ? View.GONE : View.VISIBLE); // Init other buttons initButtons(v); // Ensure that current mode (text/digit) is applied setTextDialing(!isDigit, true); if(initText != null) { digits.setText(initText); initText = null; } // Apply third party theme if any // applyTheme(v); v.setOnKeyListener(this); applyTextToAutoComplete(); return v; } @Override public void onResume() { super.onResume(); if(callBar != null) { callBar.setVideoEnabled(prefsWrapper.getPreferenceBooleanValue(SipConfigManager.USE_VIDEO)); } } /* private void applyTheme(View v) { Theme t = Theme.getCurrentTheme(getActivity()); if (t != null) { dialPad.applyTheme(t); View subV; // Delete button subV = v.findViewById(R.id.deleteButton); if(subV != null) { t.applyBackgroundDrawable(subV, "btn_dial_delete"); t.applyLayoutMargin(subV, "btn_dial_delete_margin"); t.applyImageDrawable((ImageView) subV, "ic_dial_action_delete"); } // Dial button subV = v.findViewById(R.id.dialButton); if(subV != null) { t.applyBackgroundDrawable(subV, "btn_dial_action"); t.applyLayoutMargin(subV, "btn_dial_action_margin"); t.applyImageDrawable((ImageView) subV, "ic_dial_action_call"); } // Additional button subV = v.findViewById(R.id.dialVideoButton); if(subV != null) { t.applyBackgroundDrawable(subV, "btn_add_action"); t.applyLayoutMargin(subV, "btn_dial_add_margin"); } // Action dividers subV = v.findViewById(R.id.divider1); if(subV != null) { t.applyBackgroundDrawable(subV, "btn_bar_divider"); t.applyLayoutSize(subV, "btn_dial_divider"); } subV = v.findViewById(R.id.divider2); if(subV != null) { t.applyBackgroundDrawable(subV, "btn_bar_divider"); t.applyLayoutSize(subV, "btn_dial_divider"); } // Dialpad background subV = v.findViewById(R.id.dialPad); if(subV != null) { t.applyBackgroundDrawable(subV, "dialpad_background"); } // Callbar background subV = v.findViewById(R.id.dialerCallBar); if(subV != null) { t.applyBackgroundDrawable(subV, "dialer_callbar_background"); } // Top field background subV = v.findViewById(R.id.topField); if(subV != null) { t.applyBackgroundDrawable(subV, "dialer_textfield_background"); } subV = v.findViewById(R.id.digitsText); if(subV != null) { t.applyTextColor((TextView) subV, "textColorPrimary"); } } // Fix dialer background if(callBar != null) { Theme.fixRepeatableBackground(callBar); } } */ @Override public void onAttach(Activity activity) { super.onAttach(activity); Intent serviceIntent = new Intent(SipManager.INTENT_SIP_SERVICE); // Optional, but here we bundle so just ensure we are using csipsimple package serviceIntent.setPackage(activity.getPackageName()); getActivity().bindService(serviceIntent, connection, Context.BIND_AUTO_CREATE); // timings.addSplit("Bind asked for two"); if (prefsWrapper == null) { prefsWrapper = new PreferencesWrapper(getActivity()); } if (dialFeedback == null) { dialFeedback = new DialingFeedback(getActivity(), false); } dialFeedback.resume(); } @Override public void onDetach() { try { getActivity().unbindService(connection); } catch (Exception e) { // Just ignore that Log.w(THIS_FILE, "Unable to un bind", e); } dialFeedback.pause(); super.onDetach(); } private final static String TEXT_MODE_KEY = "text_mode"; @Override public void onSaveInstanceState(Bundle outState) { outState.putBoolean(TEXT_MODE_KEY, isDigit); super.onSaveInstanceState(outState); } private OnEditorActionListener keyboardActionListener = new OnEditorActionListener() { @Override public boolean onEditorAction(TextView tv, int action, KeyEvent arg2) { if (action == EditorInfo.IME_ACTION_GO) { placeCall(); return true; } return false; } }; OnAccountChangeListener accountButtonChangeListener = new OnAccountChangeListener() { @Override public void onChooseAccount(SipProfile account) { long accId = SipProfile.INVALID_ID; if (account != null) { accId = account.id; } autoCompleteAdapter.setSelectedAccount(accId); applyRewritingInfo(); } }; private void attachButtonListener(View v, int id, boolean longAttach) { ImageButton button = (ImageButton) v.findViewById(id); if(button == null) { Log.w(THIS_FILE, "Not found button " + id); return; } if(longAttach) { button.setOnLongClickListener(this); }else { button.setOnClickListener(this); } } private void initButtons(View v) { /* for (int buttonId : buttonsToAttach) { attachButtonListener(v, buttonId, false); } */ for (int buttonId : buttonsToLongAttach) { attachButtonListener(v, buttonId, true); } digits.setOnClickListener(this); digits.setKeyListener(DialerKeyListener.getInstance()); digits.addTextChangedListener(this); digits.setCursorVisible(false); afterTextChanged(digits.getText()); } private void keyPressed(int keyCode) { KeyEvent event = new KeyEvent(KeyEvent.ACTION_DOWN, keyCode); digits.onKeyDown(keyCode, event); } private class OnAutoCompleteListItemClicked implements OnItemClickListener { private ContactsSearchAdapter searchAdapter; /** * Instanciate with a ContactsSearchAdapter adapter to search in when a * contact entry is clicked * * @param adapter the adapter to use */ public OnAutoCompleteListItemClicked(ContactsSearchAdapter adapter) { searchAdapter = adapter; } @Override public void onItemClick(AdapterView<?> list, View v, int position, long id) { Object selectedItem = searchAdapter.getItem(position); if (selectedItem != null) { CharSequence newValue = searchAdapter.getFilter().convertResultToString( selectedItem); setTextFieldValue(newValue); } } } public void onClick(View view) { // ImageButton b = null; int viewId = view.getId(); /* if (view_id == R.id.switchTextView) { // Set as text dialing if we are currently digit dialing setTextDialing(isDigit); } else */ if (viewId == digits.getId()) { if (digits.length() != 0) { digits.setCursorVisible(true); } } } public boolean onLongClick(View view) { // ImageButton b = (ImageButton)view; int vId = view.getId(); if (vId == R.id.button0) { dialFeedback.hapticFeedback(); keyPressed(KeyEvent.KEYCODE_PLUS); return true; }else if(vId == R.id.button1) { if(digits.length() == 0) { placeVMCall(); return true; } } return false; } public void afterTextChanged(Editable input) { // Change state of digit dialer final boolean notEmpty = digits.length() != 0; //digitsWrapper.setBackgroundDrawable(notEmpty ? digitsBackground : digitsEmptyBackground); callBar.setEnabled(notEmpty); if (!notEmpty && isDigit) { digits.setCursorVisible(false); } applyTextToAutoComplete(); } private void applyTextToAutoComplete() { // If single pane for smartphone use autocomplete list if (hasAutocompleteList()) { String filter = digits.getText().toString(); autoCompleteAdapter.setSelectedText(filter); //else { // autoCompleteAdapter.swapCursor(null); //} } // Dual pane : always use autocomplete list if (mDualPane && autoCompleteFragment != null) { autoCompleteFragment.filter(digits.getText().toString()); } } /** * Set the mode of the text/digit input. * * @param textMode True if text mode. False if digit mode */ public void setTextDialing(boolean textMode) { Log.d(THIS_FILE, "Switch to mode " + textMode); setTextDialing(textMode, false); } /** * Set the mode of the text/digit input. * * @param textMode True if text mode. False if digit mode */ public void setTextDialing(boolean textMode, boolean forceRefresh) { if(!forceRefresh && (isDigit != null && isDigit == !textMode)) { // Nothing to do return; } isDigit = !textMode; if(digits == null) { return; } if(isDigit) { // We need to clear the field because the formatter will now // apply and unapply to this field which could lead to wrong values when unapplied digits.getText().clear(); digits.addTextChangedListener(digitFormater); }else { digits.removeTextChangedListener(digitFormater); } digits.setCursorVisible(!isDigit); digits.setIsDigit(isDigit, true); // Update views visibility dialPad.setVisibility(isDigit ? View.VISIBLE : View.GONE); autoCompleteList.setVisibility(hasAutocompleteList() ? View.VISIBLE : View.GONE); //switchTextView.setImageResource(isDigit ? R.drawable.ic_menu_switch_txt // : R.drawable.ic_menu_switch_digit); // Invalidate to ask to require the text button to a digit button getSherlockActivity().supportInvalidateOptionsMenu(); } private boolean hasAutocompleteList() { if(!isDigit) { return true; } return dialerLayout.canShowList(); } /** * Set the value of the text field and put caret at the end * * @param value the new text to see in the text field */ public void setTextFieldValue(CharSequence value) { if(digits == null) { initText = value.toString(); return; } digits.setText(value); // make sure we keep the caret at the end of the text view Editable spannable = digits.getText(); Selection.setSelection(spannable, spannable.length()); } // @Override public void onTrigger(int keyCode, int dialTone) { dialFeedback.giveFeedback(dialTone); keyPressed(keyCode); } @Override public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) { // Nothing to do here } @Override public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) { afterTextChanged(digits.getText()); String newText = digits.getText().toString(); // Allow account chooser button to automatically change again as we have clear field accountChooserButton.setChangeable(TextUtils.isEmpty(newText)); applyRewritingInfo(); } // Options @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); int action = getResources().getBoolean(R.bool.menu_in_bar) ? MenuItem.SHOW_AS_ACTION_IF_ROOM : MenuItem.SHOW_AS_ACTION_NEVER; MenuItem delMenu = menu.add(isDigit ? R.string.switch_to_text : R.string.switch_to_digit); delMenu.setIcon( isDigit ? R.drawable.ic_menu_switch_txt : R.drawable.ic_menu_switch_digit).setShowAsAction( action ); delMenu.setOnMenuItemClickListener(new OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { setTextDialing(isDigit); return true; } }); } @Override public void placeCall() { placeCallWithOption(null); } @Override public void placeVideoCall() { Bundle b = new Bundle(); b.putBoolean(SipCallSession.OPT_CALL_VIDEO, true); placeCallWithOption(b ); } private void placeCallWithOption(Bundle b) { if (service == null) { return; } String toCall = ""; Long accountToUse = SipProfile.INVALID_ID; // Find account to use SipProfile acc = accountChooserButton.getSelectedAccount(); if(acc == null) { return; } accountToUse = acc.id; // Find number to dial toCall = digits.getText().toString(); if(isDigit) { toCall = PhoneNumberUtils.stripSeparators(toCall); } if(accountChooserFilterItem != null && accountChooserFilterItem.isChecked()) { toCall = rewriteNumber(toCall); } if (TextUtils.isEmpty(toCall)) { return; } // Well we have now the fields, clear theses fields digits.getText().clear(); // -- MAKE THE CALL --// if (accountToUse >= 0) { // It is a SIP account, try to call service for that try { service.makeCallWithOptions(toCall, accountToUse.intValue(), b); } catch (RemoteException e) { Log.e(THIS_FILE, "Service can't be called to make the call"); } } else if (accountToUse != SipProfile.INVALID_ID) { // It's an external account, find correct external account CallHandlerPlugin ch = new CallHandlerPlugin(getActivity()); ch.loadFrom(accountToUse, toCall, new OnLoadListener() { @Override public void onLoad(CallHandlerPlugin ch) { placePluginCall(ch); } }); } } public void placeVMCall() { Long accountToUse = SipProfile.INVALID_ID; SipProfile acc = null; acc = accountChooserButton.getSelectedAccount(); if (acc == null) { // Maybe we could inform user nothing will happen here? return; } accountToUse = acc.id; if (accountToUse >= 0) { SipProfile vmAcc = SipProfile.getProfileFromDbId(getActivity(), acc.id, new String[] { SipProfile.FIELD_VOICE_MAIL_NBR }); if (!TextUtils.isEmpty(vmAcc.vm_nbr)) { // Account already have a VM number try { service.makeCall(vmAcc.vm_nbr, (int) acc.id); } catch (RemoteException e) { Log.e(THIS_FILE, "Service can't be called to make the call"); } } else { // Account has no VM number, propose to create one final long editedAccId = acc.id; LayoutInflater factory = LayoutInflater.from(getActivity()); final View textEntryView = factory.inflate(R.layout.alert_dialog_text_entry, null); missingVoicemailDialog = new AlertDialog.Builder(getActivity()) .setTitle(acc.display_name) .setView(textEntryView) .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { if (missingVoicemailDialog != null) { TextView tf = (TextView) missingVoicemailDialog .findViewById(R.id.vmfield); if (tf != null) { String vmNumber = tf.getText().toString(); if (!TextUtils.isEmpty(vmNumber)) { ContentValues cv = new ContentValues(); cv.put(SipProfile.FIELD_VOICE_MAIL_NBR, vmNumber); int updated = getActivity().getContentResolver() .update(ContentUris.withAppendedId( SipProfile.ACCOUNT_ID_URI_BASE, editedAccId), cv, null, null); Log.d(THIS_FILE, "Updated accounts " + updated); } } missingVoicemailDialog.hide(); } } }) .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (missingVoicemailDialog != null) { missingVoicemailDialog.hide(); } } }) .create(); // When the dialog is up, completely hide the in-call UI // underneath (which is in a partially-constructed state). missingVoicemailDialog.getWindow().addFlags( WindowManager.LayoutParams.FLAG_DIM_BEHIND); missingVoicemailDialog.show(); } } else if (accountToUse == CallHandlerPlugin.getAccountIdForCallHandler(getActivity(), (new ComponentName(getActivity(), com.csipsimple.plugins.telephony.CallHandler.class).flattenToString()))) { // Case gsm voice mail TelephonyManager tm = (TelephonyManager) getActivity().getSystemService( Context.TELEPHONY_SERVICE); String vmNumber = tm.getVoiceMailNumber(); if (!TextUtils.isEmpty(vmNumber)) { if(service != null) { try { service.ignoreNextOutgoingCallFor(vmNumber); } catch (RemoteException e) { Log.e(THIS_FILE, "Not possible to ignore next"); } } Intent intent = new Intent(Intent.ACTION_CALL, Uri.fromParts("tel", vmNumber, null)); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } else { missingVoicemailDialog = new AlertDialog.Builder(getActivity()) .setTitle(R.string.gsm) .setMessage(R.string.no_voice_mail_configured) .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { if (missingVoicemailDialog != null) { missingVoicemailDialog.hide(); } } }) .create(); // When the dialog is up, completely hide the in-call UI // underneath (which is in a partially-constructed state). missingVoicemailDialog.getWindow().addFlags( WindowManager.LayoutParams.FLAG_DIM_BEHIND); missingVoicemailDialog.show(); } } // TODO : manage others ?... for now, no way to do so cause no vm stored } private void placePluginCall(CallHandlerPlugin ch) { try { String nextExclude = ch.getNextExcludeTelNumber(); if (service != null && nextExclude != null) { try { service.ignoreNextOutgoingCallFor(nextExclude); } catch (RemoteException e) { Log.e(THIS_FILE, "Impossible to ignore next outgoing call", e); } } ch.getIntent().send(); } catch (CanceledException e) { Log.e(THIS_FILE, "Pending intent cancelled", e); } } @Override public void deleteChar() { keyPressed(KeyEvent.KEYCODE_DEL); } @Override public void deleteAll() { digits.getText().clear(); } private final static String TAG_AUTOCOMPLETE_SIDE_FRAG = "autocomplete_dial_side_frag"; @Override public void onVisibilityChanged(boolean visible) { if (visible && getResources().getBoolean(R.bool.use_dual_panes)) { // That's far to be optimal we should consider uncomment tests for reusing fragment // if (autoCompleteFragment == null) { autoCompleteFragment = new DialerAutocompleteDetailsFragment(); if (digits != null) { Bundle bundle = new Bundle(); bundle.putCharSequence(DialerAutocompleteDetailsFragment.EXTRA_FILTER_CONSTRAINT, digits.getText().toString()); autoCompleteFragment.setArguments(bundle); } // } // if // (getFragmentManager().findFragmentByTag(TAG_AUTOCOMPLETE_SIDE_FRAG) // != autoCompleteFragment) { // Execute a transaction, replacing any existing fragment // with this one inside the frame. FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.replace(R.id.details, autoCompleteFragment, TAG_AUTOCOMPLETE_SIDE_FRAG); ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); ft.commitAllowingStateLoss(); // } } } @Override public boolean onKey(View arg0, int keyCode, KeyEvent arg2) { KeyEvent event = new KeyEvent(KeyEvent.ACTION_DOWN, keyCode); return digits.onKeyDown(keyCode, event); } // In dialer rewriting feature private void setRewritingFeature(boolean active) { accountChooserFilterItem.setChecked(active); rewriteTextInfo.setVisibility(active?View.VISIBLE:View.GONE); if(active) { applyRewritingInfo(); } prefsWrapper.setPreferenceBooleanValue(SipConfigManager.REWRITE_RULES_DIALER, active); } private String rewriteNumber(String number) { SipProfile acc = accountChooserButton.getSelectedAccount(); if (acc == null) { return number; } String numberRewrite = Filter.rewritePhoneNumber(getActivity(), acc.id, number); if(TextUtils.isEmpty(numberRewrite)) { return ""; } ParsedSipContactInfos finalCallee = acc.formatCalleeNumber(numberRewrite); if(!TextUtils.isEmpty(finalCallee.displayName)) { return finalCallee.toString(); } return finalCallee.getReadableSipUri(); } private void applyRewritingInfo() { // Rewrite information textView update String newText = digits.getText().toString(); if(accountChooserFilterItem != null && accountChooserFilterItem.isChecked()) { if(isDigit) { newText = PhoneNumberUtils.stripSeparators(newText); } rewriteTextInfo.setText(rewriteNumber(newText)); }else { rewriteTextInfo.setText(""); } } }
7054a98da9d64646ff04e0f3f30613cb8395cb91
5d4e910e7456b7b360137bb75597d918082ea1d2
/app/src/main/java/com/my/zx/Constant.java
f53ea11ddcace22f49a9174b31566964a86887ce
[]
no_license
lvhailing/zx_my
72d4f8bbb18186ce43b4e051463876abb6ec96a5
d8a57c5bcc38c94d91878839967e16b366878b43
refs/heads/master
2021-09-14T07:13:01.567966
2018-05-09T10:53:46
2018-05-09T10:53:46
107,968,838
0
0
null
null
null
null
UTF-8
Java
false
false
3,468
java
package com.my.zx; public class Constant { public static final int PHONE = 11000; //通讯录 public static final int DAIBAN = 12000; //待办 public static final int YIBAN = 12100; //已办 public static final int DAIYUE = 13000; //待阅 public static final int YIYUE = 13100; //已阅 public static final int INFO = 14000; //通知公告 public static final int ZICHAN_GONGSI_DONGTAI = 15000; //资产动态 public static final int BOSS = 16000; //领导动态 public static final int CHANGE = 17000; //修改密码 public static final int ZIGOGNSI_DONGTAI = 18000; //子公司动态(原工资查询) public static final int EMAIL = 19000; //邮件 public static final int FENGOGNSI_DONGTAI = 20000; //分公司动态 public static final int QIANG = 21000; //强哥心语 public static final int COFFE = 22000; //Coffe Time public static final int ZHINENG = 23000; //职能部门动态 public static final int TUPIAN_NEWS = 24000; //图片新闻 public static final int DANGWEI_JIYAO = 25100; //党委会议纪要 public static final int BANGONG_JIYAO = 25000; //办公会议纪要 public static final int ZHUANTI_JIYAO = 26000; //专题会议纪要 public static final int GONGZUO_JIANBAO = 27000; //工作简报 public static final int DANGJIAN_GONGZUO = 28000; //党建工作 public static final int JIJIAN_JIANCHA = 29000; //纪检监察 public static final int GONGHUI_TUANWEI = 30000; //工会团委 public static final int TUANWEI_DONGTAI = 31000; //团委动态 public static final int RENSHI_XINXI = 32000; //人事信息 public static final int QINGJIA_SHENQING = 33000; //请假申请 public static final int LINGDAO_QINGJIA = 34000; //领导请假 public static final int YINGONG_CHUCHAI = 35000; //因公出差 public static final int ZICHAN_LINGDAO_CHUCHAI = 36000; //资产领导出差 public static final int YINGONG_CHURUJING = 37000; //因公出入境 public static final int YINSI_CHURUJING = 38000; //因私出入境 public static final int IT_SHENQING = 39000; //IT申请 public static final int WEITUO_SHOUQUAN = 40000; //授权委托 public static final int DB_VERSION = 6; //支持商圈搜索 public static final boolean DB_DEBUG = true; public static final long SESSION_TIME_DIFF = 30 * 60 * 1000; //session过期时间设置 public static final String NO_SERVER_DATA = "没获取到数据,请退出重试"; //没获取到数据的提示 public static final String NO_LOGIN = "请先登录再访问"; //未登录的提示 public static final String NO_SAVE_EDIT = "编辑未完成,请先保存您的编辑"; //编辑未完成时,即去登录提示 public static final String NO_LOGIN_OR_SESSION = "未登陆或session已过期,请先登录"; //未登录或session过期的提示 public static final String NO_SESSION = "session过期,请重新登录"; //session过期,请重新登录的提示 public static final String BROADCAST_LOGIN_IN = "com.my.zx.login_in"; //登录广播 public static final String BROADCAST_LOGIN_OUT = "com.my.zx.login_out"; //退出登陆广播 }
f4d97d514fe7b02bcbd417306144f4373ea44965
87bfa09fd29fabee255f83e95d2833c6eae2d40f
/USACO Bronze Problems/src/algorithms/strategies/search/Unbounded_Binary_Search_Example.java
b7655094759d0b349465dd724bfec9640245d2fb
[ "MIT" ]
permissive
PulseBeat02/Competitive-Programming
a1e3ff686acb47898ec9c2ce04be31fa5049657b
b9d1521738ee33f618a77c8660e67df7caf2ede9
refs/heads/main
2023-03-08T05:27:36.453646
2021-02-18T02:25:16
2021-02-18T02:25:16
301,905,955
1
0
null
null
null
null
UTF-8
Java
false
false
1,787
java
package algorithms.strategies.search; public class Unbounded_Binary_Search_Example { public static int f(int x) { return (x*x - 10*x - 20); } // Returns the value x where above // function f() becomes positive // first time. public static int findFirstPositive() { // When first value itself is positive if (f(0) > 0) return 0; // Find 'high' for binary search // by repeated doubling int i = 1; while (f(i) <= 0) i = i * 2; // Call binary search return binarySearch(i / 2, i); } // Searches first positive value of // f(i) where low <= i <= high public static int binarySearch(int low, int high) { if (high >= low) { /* mid = (low + high)/2 */ int mid = low + (high - low)/2; // If f(mid) is greater than 0 and // one of the following two // conditions is true: // a) mid is equal to low // b) f(mid-1) is negative if (f(mid) > 0 && (mid == low || f(mid-1) <= 0)) return mid; // If f(mid) is smaller than or equal to 0 if (f(mid) <= 0) return binarySearch((mid + 1), high); else // f(mid) > 0 return binarySearch(low, (mid -1)); } /* Return -1 if there is no positive value in given range */ return -1; } // driver code public static void main(String[] args) { System.out.print ("The value n where f() "+ "becomes positive first is "+ findFirstPositive()); } }
70f73748244f0c1f9cefa644b0083b83c70c0c81
4d7107e4c8192fe8079c27e42bcf1282aae1462a
/src/main/java/com/algorithm/study/demo/mode/strategy/IntermediateMemberStrategy.java
589c52988d047fc34eda7f6f77f8e999c583d5bc
[]
no_license
wuxingzhiren/algorithm-study
0389158697610cd1b22ba7b3672486b6bf6c8fdb
64a5e955c07e65154f8cf889788b6be0dd8bc94a
refs/heads/master
2022-11-16T07:58:11.808321
2020-06-30T12:55:33
2020-06-30T12:55:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
341
java
package com.algorithm.study.demo.mode.strategy; /** * 中级会员价格-策略 * Created by LiuXun on 2017/7/13. */ public class IntermediateMemberStrategy implements MemberStrategy { public double calcPrice(double bookePrice) { System.out.println("中级会员价格为:"+bookePrice); return bookePrice; } }
cea51fefc93414ddb0f68fc8359925da0d9b0a52
5c54e0ab4605379865feb2789a506838cdb425c6
/src/main/java/com/chargebee/RequestWrap.java
1d8e32dc9eec030bb808358e503608dcaee44d8c
[ "MIT" ]
permissive
cb-vivek/chargebee-java
0faf11d6dc6ac4fd28047d7dd4daf8ff0cde41a5
05f11f32693a1152435b0d76213c86e99ab9cf5d
refs/heads/master
2020-04-25T03:43:51.486515
2019-01-10T12:16:19
2019-01-10T12:16:19
172,486,898
0
1
MIT
2019-02-25T10:42:12
2019-02-25T10:42:11
null
UTF-8
Java
false
false
563
java
/* * Copyright (c) 2017 ChargeBee Inc * All Rights Reserved. */ package com.chargebee; import com.chargebee.internal.RequestBase; import java.util.concurrent.Callable; /** * * @author cb-ajit * @param <T> * @param <U> */ public abstract class RequestWrap<T extends RequestBase> implements Callable<ApiResponse> { public final Environment env; public final T request; public RequestWrap(Environment env, T request) { this.env = env; this.request = request; } public abstract ApiResponse call() throws Exception; }
64cea785a3f58ba4460103c54cbeca3cfae3871b
7b73756ba240202ea92f8f0c5c51c8343c0efa5f
/classes/nvi.java
62f1eacef453bb3fc24bbd7250c66cfa8708aeab
[]
no_license
meeidol-luo/qooq
588a4ca6d8ad579b28dec66ec8084399fb0991ef
e723920ac555e99d5325b1d4024552383713c28d
refs/heads/master
2020-03-27T03:16:06.616300
2016-10-08T07:33:58
2016-10-08T07:33:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,062
java
import android.content.res.Resources; import android.view.View; import android.view.View.OnClickListener; import android.widget.CheckBox; import android.widget.ImageView; import com.tencent.mobileqq.activity.aio.SessionInfo; import com.tencent.mobileqq.activity.aio.photo.PhotoListPanel; import com.tencent.mobileqq.activity.aio.photo.PhotoListPanel.MyAdapter; import com.tencent.mobileqq.activity.photo.LocalMediaInfo; import com.tencent.mobileqq.hotpatch.NotVerifyClass; import com.tencent.mobileqq.statistics.ReportController; import com.tencent.mobileqq.utils.DialogUtil; import com.tencent.mobileqq.utils.DialogUtil.DialogOnClickAdapter; import com.tencent.mobileqq.utils.QQCustomDialog; import com.tencent.mobileqq.widget.NumberCheckBox; import com.tencent.mobileqq.widget.QQToast; import java.util.ArrayList; import java.util.LinkedList; public class nvi implements View.OnClickListener { int jdField_a_of_type_Int; CheckBox jdField_a_of_type_AndroidWidgetCheckBox; ImageView jdField_a_of_type_AndroidWidgetImageView; public nvi(PhotoListPanel paramPhotoListPanel) { boolean bool = NotVerifyClass.DO_VERIFY_CLASS; } public void a(int paramInt) { this.jdField_a_of_type_Int = paramInt; } public void a(CheckBox paramCheckBox) { this.jdField_a_of_type_AndroidWidgetCheckBox = paramCheckBox; } public void onClick(View paramView) { if (this.jdField_a_of_type_ComTencentMobileqqActivityAioPhotoPhotoListPanel.jdField_a_of_type_ComTencentMobileqqActivityAioPhotoPhotoListPanel$MyAdapter == null) {} while (this.jdField_a_of_type_ComTencentMobileqqActivityAioPhotoPhotoListPanel.jdField_a_of_type_ComTencentMobileqqActivityAioPhotoPhotoListPanel$MyAdapter.getCount() <= 0) { return; } LocalMediaInfo localLocalMediaInfo = this.jdField_a_of_type_ComTencentMobileqqActivityAioPhotoPhotoListPanel.jdField_a_of_type_ComTencentMobileqqActivityAioPhotoPhotoListPanel$MyAdapter.a(this.jdField_a_of_type_Int); int i = this.jdField_a_of_type_ComTencentMobileqqActivityAioPhotoPhotoListPanel.jdField_a_of_type_ComTencentMobileqqActivityAioPhotoPhotoListPanel$MyAdapter.getItemViewType(this.jdField_a_of_type_Int); if ((!localLocalMediaInfo.jdField_a_of_type_Boolean) && (!this.jdField_a_of_type_ComTencentMobileqqActivityAioPhotoPhotoListPanel.jdField_a_of_type_JavaUtilLinkedList.isEmpty())) { if (this.jdField_a_of_type_ComTencentMobileqqActivityAioPhotoPhotoListPanel.jdField_a_of_type_JavaUtilLinkedList.size() >= this.jdField_a_of_type_ComTencentMobileqqActivityAioPhotoPhotoListPanel.d) { paramView = String.format(this.jdField_a_of_type_ComTencentMobileqqActivityAioPhotoPhotoListPanel.getResources().getString(2131367229), new Object[] { Integer.valueOf(this.jdField_a_of_type_ComTencentMobileqqActivityAioPhotoPhotoListPanel.jdField_a_of_type_JavaUtilLinkedList.size()) }); paramView = DialogUtil.a(this.jdField_a_of_type_ComTencentMobileqqActivityAioPhotoPhotoListPanel.jdField_a_of_type_AndroidAppActivity, paramView); paramView.setPositiveButton(2131367263, new DialogUtil.DialogOnClickAdapter()); paramView.show(); this.jdField_a_of_type_AndroidWidgetCheckBox.setChecked(localLocalMediaInfo.jdField_a_of_type_Boolean); return; } int j = this.jdField_a_of_type_ComTencentMobileqqActivityAioPhotoPhotoListPanel.jdField_a_of_type_ComTencentMobileqqActivityAioPhotoPhotoListPanel$MyAdapter.a((String)this.jdField_a_of_type_ComTencentMobileqqActivityAioPhotoPhotoListPanel.jdField_a_of_type_JavaUtilLinkedList.peek()); if ((!this.jdField_a_of_type_ComTencentMobileqqActivityAioPhotoPhotoListPanel.h) && (j != -1) && (j != i)) { paramView = DialogUtil.a(this.jdField_a_of_type_ComTencentMobileqqActivityAioPhotoPhotoListPanel.jdField_a_of_type_AndroidAppActivity, 2131367232); paramView.setPositiveButton(2131367263, new DialogUtil.DialogOnClickAdapter()); paramView.show(); this.jdField_a_of_type_AndroidWidgetCheckBox.setChecked(localLocalMediaInfo.jdField_a_of_type_Boolean); return; } if ((j == 1) && (i == 1) && (this.jdField_a_of_type_ComTencentMobileqqActivityAioPhotoPhotoListPanel.jdField_a_of_type_JavaUtilLinkedList.size() >= this.jdField_a_of_type_ComTencentMobileqqActivityAioPhotoPhotoListPanel.e)) { if (this.jdField_a_of_type_ComTencentMobileqqActivityAioPhotoPhotoListPanel.e > 1) {} for (paramView = String.format(this.jdField_a_of_type_ComTencentMobileqqActivityAioPhotoPhotoListPanel.getResources().getString(2131367230), new Object[] { Integer.valueOf(this.jdField_a_of_type_ComTencentMobileqqActivityAioPhotoPhotoListPanel.jdField_a_of_type_JavaUtilLinkedList.size()) });; paramView = this.jdField_a_of_type_ComTencentMobileqqActivityAioPhotoPhotoListPanel.getResources().getString(2131367233)) { paramView = DialogUtil.a(this.jdField_a_of_type_ComTencentMobileqqActivityAioPhotoPhotoListPanel.jdField_a_of_type_AndroidAppActivity, paramView); paramView.setPositiveButton(2131367263, new DialogUtil.DialogOnClickAdapter()); paramView.show(); this.jdField_a_of_type_AndroidWidgetCheckBox.setChecked(localLocalMediaInfo.jdField_a_of_type_Boolean); return; } } } if ((i == 1) && (localLocalMediaInfo.b > this.jdField_a_of_type_ComTencentMobileqqActivityAioPhotoPhotoListPanel.jdField_a_of_type_Long)) { paramView = DialogUtil.a(this.jdField_a_of_type_ComTencentMobileqqActivityAioPhotoPhotoListPanel.jdField_a_of_type_AndroidAppActivity, 2131367231); paramView.setPositiveButton(2131367263, new DialogUtil.DialogOnClickAdapter()); paramView.show(); this.jdField_a_of_type_AndroidWidgetCheckBox.setChecked(localLocalMediaInfo.jdField_a_of_type_Boolean); return; } if ((i == 0) && (this.jdField_a_of_type_ComTencentMobileqqActivityAioPhotoPhotoListPanel.jdField_a_of_type_AndroidWidgetCheckBox.isChecked()) && (localLocalMediaInfo.b > PhotoListPanel.jdField_a_of_type_Int)) { QQToast.a(this.jdField_a_of_type_ComTencentMobileqqActivityAioPhotoPhotoListPanel.jdField_a_of_type_AndroidAppActivity, this.jdField_a_of_type_ComTencentMobileqqActivityAioPhotoPhotoListPanel.getResources().getString(2131370138), 0).b(this.jdField_a_of_type_ComTencentMobileqqActivityAioPhotoPhotoListPanel.getResources().getDimensionPixelSize(2131492908)); this.jdField_a_of_type_AndroidWidgetCheckBox.setChecked(localLocalMediaInfo.jdField_a_of_type_Boolean); return; } boolean bool; if (!localLocalMediaInfo.jdField_a_of_type_Boolean) { bool = true; localLocalMediaInfo.jdField_a_of_type_Boolean = bool; this.jdField_a_of_type_AndroidWidgetCheckBox.setChecked(localLocalMediaInfo.jdField_a_of_type_Boolean); if (!localLocalMediaInfo.jdField_a_of_type_Boolean) { break label710; } if (i == 0) { this.jdField_a_of_type_ComTencentMobileqqActivityAioPhotoPhotoListPanel.a(localLocalMediaInfo.jdField_a_of_type_JavaLangString, this.jdField_a_of_type_ComTencentMobileqqActivityAioPhotoPhotoListPanel.jdField_a_of_type_ComTencentMobileqqActivityAioSessionInfo.c); } this.jdField_a_of_type_ComTencentMobileqqActivityAioPhotoPhotoListPanel.jdField_a_of_type_JavaUtilLinkedList.add(localLocalMediaInfo.jdField_a_of_type_JavaLangString); this.jdField_a_of_type_ComTencentMobileqqActivityAioPhotoPhotoListPanel.jdField_a_of_type_JavaUtilArrayList.add(localLocalMediaInfo.jdField_a_of_type_JavaLangInteger); i = this.jdField_a_of_type_ComTencentMobileqqActivityAioPhotoPhotoListPanel.jdField_a_of_type_JavaUtilLinkedList.indexOf(localLocalMediaInfo.jdField_a_of_type_JavaLangString); ((NumberCheckBox)this.jdField_a_of_type_AndroidWidgetCheckBox).setCheckedNumber(i + 1); PhotoListPanel.a(this.jdField_a_of_type_ComTencentMobileqqActivityAioPhotoPhotoListPanel); ReportController.b(null, "CliOper", "", "", "0X8005E08", "0X8005E08", 0, 0, "", "", "", ""); } for (;;) { this.jdField_a_of_type_ComTencentMobileqqActivityAioPhotoPhotoListPanel.c(); this.jdField_a_of_type_ComTencentMobileqqActivityAioPhotoPhotoListPanel.h(); return; bool = false; break; label710: if (i == 0) { this.jdField_a_of_type_ComTencentMobileqqActivityAioPhotoPhotoListPanel.a(localLocalMediaInfo.jdField_a_of_type_JavaLangString); } this.jdField_a_of_type_ComTencentMobileqqActivityAioPhotoPhotoListPanel.jdField_a_of_type_JavaUtilLinkedList.remove(localLocalMediaInfo.jdField_a_of_type_JavaLangString); this.jdField_a_of_type_ComTencentMobileqqActivityAioPhotoPhotoListPanel.jdField_a_of_type_JavaUtilArrayList.remove(localLocalMediaInfo.jdField_a_of_type_JavaLangInteger); PhotoListPanel.a(this.jdField_a_of_type_ComTencentMobileqqActivityAioPhotoPhotoListPanel); } } } /* Location: E:\apk\QQ_91\classes-dex2jar.jar!\nvi.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */
d3d65481dc68b11c36fc5a75d421d88149b6148d
b5b2a7862ef160484f9c1285c552dcf04a50f2e0
/TestThread/src/test/java/com/XuanLi/Thread/TestThread02Runable.java
6d2bd05d7e6d6ebc6f6d9b360ab249bdb23c48f5
[]
no_license
15201215759/StudyJava
6de2e09f79b47036cd05534552b7a239577c957e
33aaeeda37eef2eddf20fdd586c3b6db3c73795c
refs/heads/master
2023-04-01T18:00:48.529191
2021-04-09T07:59:02
2021-04-09T07:59:02
332,995,489
0
0
null
null
null
null
UTF-8
Java
false
false
624
java
package com.XuanLi.Thread; //实现Runable 接口 重写run的方法 public class TestThread02Runable implements Runnable { public void run() { for (int i = 0; i <50 ; i++) { System.out.println("子线程 i="+i); } } public static void main(String[] args) { //创建多线程实现类 TestThread02Runable t1 = new TestThread02Runable(); //创建线程类Thread Thread thread = new Thread(t1); //调用Start方法 thread.start(); for (int i = 0; i <50 ; i++) { System.out.println("主线程 i="+i); } } }
86e9015d7967db730200d3afbc9f620815596ed3
41027f68ddf54caadd7da277b7c395ffaee8e261
/app/src/androidTest/java/com/example/bitirme/ExampleInstrumentedTest.java
e302536270aa77a6dab350864df07488fb9bac38
[]
no_license
Mustecep/Bitirme
0e53a4bede1ce2d3557824bdd9cad38bc13196d9
3b06f241b822f69895b694b3b26f3558bb7246f8
refs/heads/master
2023-04-17T06:27:12.814884
2021-04-29T21:02:41
2021-04-29T21:02:41
362,946,046
0
0
null
null
null
null
UTF-8
Java
false
false
754
java
package com.example.bitirme; import android.content.Context; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.ext.junit.runners.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.getInstrumentation().getTargetContext(); assertEquals("com.example.bitirme", appContext.getPackageName()); } }
d6358782bab9f82d276029875d3f622dc69a4350
bc1039faa2fa185085e1f896fbcc939580a0aa91
/src/com/xuni/chat/common/ServerRefreshFriendsMessage.java
05b05d525dd843c3871a051735fd5d7c80dc98c1
[]
no_license
super3ben/knowledgeforums
474c2db6df73f5c38c3721beb157528bc042a70c
0805e3f3ed17d3a7ac21cc90b6b72fdb2b4df9ab
refs/heads/master
2020-07-18T08:07:08.074858
2019-09-04T02:26:16
2019-09-04T02:26:16
206,211,070
0
0
null
null
null
null
GB18030
Java
false
false
393
java
package com.xuni.chat.common; /** * 服务器刷新列表 */ public class ServerRefreshFriendsMessage extends Message { private byte[] friendsBytes ; public byte[] getFriendsBytes() { return friendsBytes; } public void setFriendsBytes(byte[] friendsBytes) { this.friendsBytes = friendsBytes; } public int getMessageType() { return SERVER_TO_CLIENT_REFRESH_FRIENTS; } }
314d00cc40cbc96750991c8337f74ddf0a3b68d1
87d4c06ed37e60f5f3244a5e8e104c803e1f72e3
/core/src/main/java/org/sql2o/converters/joda/DateTimeConverter.java
91f6e01b9c5e6972c16f4ad0a3c546483e49d6f9
[ "MIT" ]
permissive
shahan-am/sql2o
1f2aa1a5b029309cd1a08d2b5780e2e1f59dbdfd
06c690b11871a6ba9074ac3d5b6a16d18119f69e
refs/heads/master
2020-12-28T22:34:46.995748
2014-04-12T10:36:51
2014-04-12T10:36:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
920
java
package org.sql2o.converters.joda; import org.joda.time.DateTime; import org.joda.time.DateTimeZone; import org.joda.time.LocalDateTime; import org.sql2o.converters.Converter; import org.sql2o.converters.ConverterException; import java.sql.Timestamp; /** * Used by sql2o to convert a value from the database into a {@link DateTime} instance. */ public class DateTimeConverter implements Converter<DateTime> { public DateTime convert(Object val) throws ConverterException { if (val == null){ return null; } try{ return new LocalDateTime(val).toDateTime(DateTimeZone.UTC); } catch(Throwable t){ throw new ConverterException("Error while converting type " + val.getClass().toString() + " to jodatime", t); } } public Object toDatabaseParam(DateTime val) { return new Timestamp(val.getMillis()); } }