blob_id
stringlengths 40
40
| __id__
int64 225
39,780B
| directory_id
stringlengths 40
40
| path
stringlengths 6
313
| content_id
stringlengths 40
40
| detected_licenses
list | license_type
stringclasses 2
values | repo_name
stringlengths 6
132
| repo_url
stringlengths 25
151
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
70
| visit_date
timestamp[ns] | revision_date
timestamp[ns] | committer_date
timestamp[ns] | github_id
int64 7.28k
689M
⌀ | star_events_count
int64 0
131k
| fork_events_count
int64 0
48k
| gha_license_id
stringclasses 23
values | gha_fork
bool 2
classes | gha_event_created_at
timestamp[ns] | gha_created_at
timestamp[ns] | gha_updated_at
timestamp[ns] | gha_pushed_at
timestamp[ns] | gha_size
int64 0
40.4M
⌀ | gha_stargazers_count
int32 0
112k
⌀ | gha_forks_count
int32 0
39.4k
⌀ | gha_open_issues_count
int32 0
11k
⌀ | gha_language
stringlengths 1
21
⌀ | gha_archived
bool 2
classes | gha_disabled
bool 1
class | content
stringlengths 7
4.37M
| src_encoding
stringlengths 3
16
| language
stringclasses 1
value | length_bytes
int64 7
4.37M
| extension
stringclasses 24
values | filename
stringlengths 4
174
| language_id
stringclasses 1
value | entities
list | contaminating_dataset
stringclasses 0
values | malware_signatures
list | redacted_content
stringlengths 7
4.37M
| redacted_length_bytes
int64 7
4.37M
| alphanum_fraction
float32 0.25
0.94
| alpha_fraction
float32 0.25
0.94
| num_lines
int32 1
84k
| avg_line_length
float32 0.76
99.9
| std_line_length
float32 0
220
| max_line_length
int32 5
998
| is_vendor
bool 2
classes | is_generated
bool 1
class | max_hex_length
int32 0
319
| hex_fraction
float32 0
0.38
| max_unicode_length
int32 0
408
| unicode_fraction
float32 0
0.36
| max_base64_length
int32 0
506
| base64_fraction
float32 0
0.5
| avg_csv_sep_count
float32 0
4
| is_autogen_header
bool 1
class | is_empty_html
bool 1
class | shard
stringclasses 16
values |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8695fd84f3d5a5a90c0aeb624229313329f05ec4
| 37,495,064,510,428 |
48ddaaaf2c6abdb21a53762e839c16b143479ab6
|
/pattern_compound/src/com/pattern/compound/intf/QuackObserver.java
|
57f49d0476e3063f4befbcb61706bba109e304d3
|
[] |
no_license
|
chuzhen1210/designPattern
|
https://github.com/chuzhen1210/designPattern
|
e6aca487947cdcb30fa1f107969f891c97208465
|
864c89d94dce8f98f7495cddeb50389b432e510f
|
refs/heads/master
| 2021-01-23T12:22:21.561000 | 2017-06-02T11:04:22 | 2017-06-02T11:04:22 | 93,155,216 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.pattern.compound.intf;
/**
* 呱呱叫观察者,只需要一个<code>update()</code>方法
* @author chuzhen
*
*/
public interface QuackObserver {
/**
* 需要传入被观察对象
* @param duck
*/
public void update(QuackObservable duck);
}
|
GB18030
|
Java
| 285 |
java
|
QuackObserver.java
|
Java
|
[
{
"context": " * 呱呱叫观察者,只需要一个<code>update()</code>方法\r\n * @author chuzhen\r\n *\r\n */\r\npublic interface QuackObserver {\r\n\r\n\t/*",
"end": 101,
"score": 0.9987590312957764,
"start": 94,
"tag": "USERNAME",
"value": "chuzhen"
}
] | null |
[] |
package com.pattern.compound.intf;
/**
* 呱呱叫观察者,只需要一个<code>update()</code>方法
* @author chuzhen
*
*/
public interface QuackObserver {
/**
* 需要传入被观察对象
* @param duck
*/
public void update(QuackObservable duck);
}
| 285 | 0.627615 | 0.627615 | 15 | 13.933333 | 14.717186 | 42 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.466667 | false | false |
2
|
3a731b8a63acd89d35473918937d784a371ff415
| 19,576,460,978,923 |
be37167dde1827ca05b1c0599926979c72b2558f
|
/GraphStuff/DFS.java
|
6554fb1580b29fc45501a239f38f1c378c37e29a
|
[] |
no_license
|
colll78/Bospre2019
|
https://github.com/colll78/Bospre2019
|
9258d164335dc5d48ebc78970ae8c34a5e594d4a
|
134ac209480d9f3487add8c64591cc6fdae80267
|
refs/heads/master
| 2020-08-21T04:32:34.638000 | 2020-03-17T02:41:32 | 2020-03-17T02:41:32 | 216,097,809 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
public static void dfs(int[][]adj ,boolean[] vis ,int src ,int n)throws Exception{
LinkedList<Integer> stack = new LinkedList<Integer>();
stack.addLast(src);
vis[src] = true;
int level = 0;
// print(src,level);
while(!stack.isEmpty()){
int node = stack.getLast(); // DFS-BFS Decesion
int check = 0;
for(int j=1;j<=n;j++){
if(adj[node][j]==1 && (!vis[j])){
check = 1;
level++;
stack.addLast(j);
// print(j,level);
vis[j]=true;
break;
}
}
// DFS-BFS Decesion remove IF Block
if(check==0){
//adj[node][1..n] is empty
stack.removeLast();
level--;
}
}
}
|
UTF-8
|
Java
| 653 |
java
|
DFS.java
|
Java
|
[] | null |
[] |
public static void dfs(int[][]adj ,boolean[] vis ,int src ,int n)throws Exception{
LinkedList<Integer> stack = new LinkedList<Integer>();
stack.addLast(src);
vis[src] = true;
int level = 0;
// print(src,level);
while(!stack.isEmpty()){
int node = stack.getLast(); // DFS-BFS Decesion
int check = 0;
for(int j=1;j<=n;j++){
if(adj[node][j]==1 && (!vis[j])){
check = 1;
level++;
stack.addLast(j);
// print(j,level);
vis[j]=true;
break;
}
}
// DFS-BFS Decesion remove IF Block
if(check==0){
//adj[node][1..n] is empty
stack.removeLast();
level--;
}
}
}
| 653 | 0.540582 | 0.529862 | 30 | 20.766666 | 17.600536 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.866667 | false | false |
2
|
5cd162bcf2dc4bff5fe2b246014c717dce0247b6
| 687,194,829,270 |
84dc4b0ff877c868c5d3cc55e3f09f0324bbac66
|
/src/main/java/it/esercitazione4/nodes/ProgramNode.java
|
6c988a35dd6f1f1c284554910379cdadc33ab763
|
[] |
no_license
|
xNeorem/Toy_Compiler
|
https://github.com/xNeorem/Toy_Compiler
|
e978e5a583e66d7e5cdc702f2655cbc443aff1be
|
c2d5ac5c93b9f22a010001f6b267b984e71e4353
|
refs/heads/master
| 2023-07-29T04:29:04.154000 | 2021-09-15T13:32:18 | 2021-09-15T13:32:18 | 406,777,101 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package it.esercitazione4.nodes;
import it.esercitazione4.symboltable.SymbolTable;
import it.esercitazione4.visitor.Visitable;
import it.esercitazione4.visitor.Visitor;
public class ProgramNode extends Node implements Visitable {
private VarDeclListNode varDeclListNode;
private ProcListNode procListNode;
private SymbolTable symbolTable;
public ProgramNode(VarDeclListNode varDeclListNode, ProcListNode procListNode) {
super();
this.name = Node.PROGRAM_OP;
this.varDeclListNode = varDeclListNode;
this.procListNode = procListNode;
this.symbolTable = new SymbolTable();
}
@Override
public Object accept(Visitor visitor) throws Exception{
return visitor.visit(this);
}
public VarDeclListNode getVarDeclListNode() {
return varDeclListNode;
}
public void setVarDeclListNode(VarDeclListNode varDeclListNode) {
this.varDeclListNode = varDeclListNode;
}
public ProcListNode getProcListNode() {
return procListNode;
}
public void setProcListNode(ProcListNode procListNode) {
this.procListNode = procListNode;
}
public SymbolTable getSymbolTable() {
return symbolTable;
}
public void setSymbolTable(SymbolTable symbolTable) {
this.symbolTable = symbolTable;
}
@Override
public String toString() {
return "ProgramNode{" +
"varDeclListNode=" + varDeclListNode +
", procListNode=" + procListNode +
", name='" + name + '\'' +
", isLeaf=" + isLeaf +
'}';
}
}
|
UTF-8
|
Java
| 1,633 |
java
|
ProgramNode.java
|
Java
|
[] | null |
[] |
package it.esercitazione4.nodes;
import it.esercitazione4.symboltable.SymbolTable;
import it.esercitazione4.visitor.Visitable;
import it.esercitazione4.visitor.Visitor;
public class ProgramNode extends Node implements Visitable {
private VarDeclListNode varDeclListNode;
private ProcListNode procListNode;
private SymbolTable symbolTable;
public ProgramNode(VarDeclListNode varDeclListNode, ProcListNode procListNode) {
super();
this.name = Node.PROGRAM_OP;
this.varDeclListNode = varDeclListNode;
this.procListNode = procListNode;
this.symbolTable = new SymbolTable();
}
@Override
public Object accept(Visitor visitor) throws Exception{
return visitor.visit(this);
}
public VarDeclListNode getVarDeclListNode() {
return varDeclListNode;
}
public void setVarDeclListNode(VarDeclListNode varDeclListNode) {
this.varDeclListNode = varDeclListNode;
}
public ProcListNode getProcListNode() {
return procListNode;
}
public void setProcListNode(ProcListNode procListNode) {
this.procListNode = procListNode;
}
public SymbolTable getSymbolTable() {
return symbolTable;
}
public void setSymbolTable(SymbolTable symbolTable) {
this.symbolTable = symbolTable;
}
@Override
public String toString() {
return "ProgramNode{" +
"varDeclListNode=" + varDeclListNode +
", procListNode=" + procListNode +
", name='" + name + '\'' +
", isLeaf=" + isLeaf +
'}';
}
}
| 1,633 | 0.660747 | 0.658298 | 57 | 27.649122 | 22.115717 | 84 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.421053 | false | false |
2
|
437f14c19fceb0c950327231b4eb199dc2b5e30b
| 37,125,697,319,518 |
ead6d4a5483388c44ad68c8371ddd06c78561988
|
/Android/Notes/app/src/main/java/tech/vofy/notes/callbacks/SwipeToDeleteCallback.java
|
9592d94b739494c7f21ec5e905b7eb07ef097f19
|
[] |
no_license
|
Vofy/code-snippets
|
https://github.com/Vofy/code-snippets
|
5979236ce5da7c7be3a94e2047ad3627ec22f556
|
57676d1cfe1e9e39b0613929350ef9f0943f3a73
|
refs/heads/main
| 2023-05-04T09:43:42.757000 | 2021-05-20T08:41:42 | 2021-05-20T08:41:42 | 364,596,081 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package tech.vofy.notes.callbacks;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.RecyclerView;
import tech.vofy.notes.R;
import tech.vofy.notes.adapters.NotesRecyclerViewAdapter;
public class SwipeToDeleteCallback<RecyclerViewAdapter> extends ItemTouchHelper.SimpleCallback {
private final RecyclerViewAdapter recyclerViewAdapter;
private final Drawable icon;
private final Drawable background;
public SwipeToDeleteCallback(Context context, RecyclerViewAdapter notesRecyclerViewAdapter) {
super(0,ItemTouchHelper.LEFT /*| ItemTouchHelper.RIGHT*/);
this.recyclerViewAdapter = notesRecyclerViewAdapter;
icon = ContextCompat.getDrawable(context, R.drawable.ic_delete_24dp);
background = AppCompatResources.getDrawable(context, R.drawable.swipe_to_delete_background);
}
@Override
public void onChildDraw(@NonNull Canvas c, @NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder, float dX, float dY, int actionState, boolean isCurrentlyActive) {
super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive);
View itemView = viewHolder.itemView;
int backgroundCornerOffset = 20;
int iconMargin = 64;
int iconTop = itemView.getTop() + (itemView.getHeight() - icon.getIntrinsicHeight()) / 2;
int iconBottom = iconTop + icon.getIntrinsicHeight();
if (dX > 0) { // Swiping to the right
int iconLeft = itemView.getLeft() + iconMargin + icon.getIntrinsicWidth();
int iconRight = itemView.getLeft() + iconMargin;
icon.setBounds(iconLeft, iconTop, iconRight, iconBottom);
background.setBounds(itemView.getLeft(), itemView.getTop(), itemView.getLeft() + ((int) dX) + backgroundCornerOffset, itemView.getBottom());
} else if (dX < 0) { // Swiping to the left
int iconLeft = itemView.getRight() - iconMargin - icon.getIntrinsicWidth();
int iconRight = itemView.getRight() - iconMargin;
icon.setBounds(iconLeft, iconTop, iconRight, iconBottom);
background.setBounds(itemView.getRight() + ((int) dX) - backgroundCornerOffset, itemView.getTop(), itemView.getRight(), itemView.getBottom());
} else { // view is unSwiped
background.setBounds(0, 0, 0, 0);
}
background.draw(c);
icon.draw(c);
}
@Override
public boolean onMove(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder, @NonNull RecyclerView.ViewHolder target) {
return false;
}
@Override
public void onSwiped(@NonNull RecyclerView.ViewHolder viewHolder, int direction) {
int position = viewHolder.getAdapterPosition();
if (this.recyclerViewAdapter instanceof NotesRecyclerViewAdapter) {
((NotesRecyclerViewAdapter) this.recyclerViewAdapter).deleteItem(position);
}
}
}
|
UTF-8
|
Java
| 3,248 |
java
|
SwipeToDeleteCallback.java
|
Java
|
[] | null |
[] |
package tech.vofy.notes.callbacks;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.RecyclerView;
import tech.vofy.notes.R;
import tech.vofy.notes.adapters.NotesRecyclerViewAdapter;
public class SwipeToDeleteCallback<RecyclerViewAdapter> extends ItemTouchHelper.SimpleCallback {
private final RecyclerViewAdapter recyclerViewAdapter;
private final Drawable icon;
private final Drawable background;
public SwipeToDeleteCallback(Context context, RecyclerViewAdapter notesRecyclerViewAdapter) {
super(0,ItemTouchHelper.LEFT /*| ItemTouchHelper.RIGHT*/);
this.recyclerViewAdapter = notesRecyclerViewAdapter;
icon = ContextCompat.getDrawable(context, R.drawable.ic_delete_24dp);
background = AppCompatResources.getDrawable(context, R.drawable.swipe_to_delete_background);
}
@Override
public void onChildDraw(@NonNull Canvas c, @NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder, float dX, float dY, int actionState, boolean isCurrentlyActive) {
super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive);
View itemView = viewHolder.itemView;
int backgroundCornerOffset = 20;
int iconMargin = 64;
int iconTop = itemView.getTop() + (itemView.getHeight() - icon.getIntrinsicHeight()) / 2;
int iconBottom = iconTop + icon.getIntrinsicHeight();
if (dX > 0) { // Swiping to the right
int iconLeft = itemView.getLeft() + iconMargin + icon.getIntrinsicWidth();
int iconRight = itemView.getLeft() + iconMargin;
icon.setBounds(iconLeft, iconTop, iconRight, iconBottom);
background.setBounds(itemView.getLeft(), itemView.getTop(), itemView.getLeft() + ((int) dX) + backgroundCornerOffset, itemView.getBottom());
} else if (dX < 0) { // Swiping to the left
int iconLeft = itemView.getRight() - iconMargin - icon.getIntrinsicWidth();
int iconRight = itemView.getRight() - iconMargin;
icon.setBounds(iconLeft, iconTop, iconRight, iconBottom);
background.setBounds(itemView.getRight() + ((int) dX) - backgroundCornerOffset, itemView.getTop(), itemView.getRight(), itemView.getBottom());
} else { // view is unSwiped
background.setBounds(0, 0, 0, 0);
}
background.draw(c);
icon.draw(c);
}
@Override
public boolean onMove(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder, @NonNull RecyclerView.ViewHolder target) {
return false;
}
@Override
public void onSwiped(@NonNull RecyclerView.ViewHolder viewHolder, int direction) {
int position = viewHolder.getAdapterPosition();
if (this.recyclerViewAdapter instanceof NotesRecyclerViewAdapter) {
((NotesRecyclerViewAdapter) this.recyclerViewAdapter).deleteItem(position);
}
}
}
| 3,248 | 0.718288 | 0.713978 | 72 | 44.125 | 42.068375 | 193 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.027778 | false | false |
2
|
780c29204516bd44fcc9e86edb38aa6c3008fc38
| 3,582,002,774,117 |
d2d46a84bee2f266de940c2aae76083af79a88a4
|
/src/main/java/au/com/crypto/bot/application/analyzer/entities/StrategyConditionsRepository.java
|
b642731b566d1ed1d1073b76dd40eff7113e268f
|
[] |
no_license
|
bsn-group/analyzer
|
https://github.com/bsn-group/analyzer
|
e031269a0509b4443ce1b92294b7ed6f4b430313
|
40214bfa46d0aa174c8d3e456bf0028d36119acb
|
refs/heads/main
| 2023-06-17T21:54:35.322000 | 2022-02-04T09:04:23 | 2022-02-04T09:05:35 | 362,838,049 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package au.com.crypto.bot.application.analyzer.entities;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import java.util.List;
public interface StrategyConditionsRepository extends CrudRepository<StrategyConditions, Long>{
List<StrategyConditions> findStrategyConditionsById(long id);
List<StrategyConditions> findStrategyConditionsByStrategyId(long strategyId);
List<StrategyConditions> findStrategyConditionsByStrategyIdAndVersion(long strategyId, long version);
}
|
UTF-8
|
Java
| 541 |
java
|
StrategyConditionsRepository.java
|
Java
|
[] | null |
[] |
package au.com.crypto.bot.application.analyzer.entities;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import java.util.List;
public interface StrategyConditionsRepository extends CrudRepository<StrategyConditions, Long>{
List<StrategyConditions> findStrategyConditionsById(long id);
List<StrategyConditions> findStrategyConditionsByStrategyId(long strategyId);
List<StrategyConditions> findStrategyConditionsByStrategyIdAndVersion(long strategyId, long version);
}
| 541 | 0.859519 | 0.859519 | 12 | 44.166668 | 36.775974 | 103 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.75 | false | false |
2
|
7d521b26d7a49bea896d028a77f9900df7b035ef
| 9,929,964,445,988 |
0e06e096a9f95ab094b8078ea2cd310759af008b
|
/sources/com/applovin/impl/sdk/ep.java
|
734775464c06762751903aef53ab25b313b79834
|
[] |
no_license
|
Manifold0/adcom_decompile
|
https://github.com/Manifold0/adcom_decompile
|
4bc2907a057c73703cf141dc0749ed4c014ebe55
|
fce3d59b59480abe91f90ba05b0df4eaadd849f7
|
refs/heads/master
| 2020-05-21T02:01:59.787000 | 2019-05-10T00:36:27 | 2019-05-10T00:36:27 | 185,856,424 | 1 | 2 | null | false | 2019-05-10T00:36:28 | 2019-05-09T19:04:28 | 2019-05-09T22:35:26 | 2019-05-10T00:36:27 | 95,641 | 0 | 2 | 0 |
Java
| false | false |
package com.applovin.impl.sdk;
import android.net.Uri;
import android.webkit.URLUtil;
import com.applovin.impl.p016a.C1228a;
import com.applovin.impl.p016a.C1233f;
import com.applovin.impl.p016a.C1236i;
import com.applovin.impl.p016a.C1237j;
import com.applovin.impl.p016a.C1245r;
import com.applovin.sdk.AppLovinAdLoadListener;
import com.applovin.sdk.AppLovinSdkUtils;
import java.util.List;
class ep extends ej {
/* renamed from: a */
private final C1228a f2472a;
public ep(C1228a c1228a, AppLovinAdLoadListener appLovinAdLoadListener, AppLovinSdkImpl appLovinSdkImpl) {
super("TaskCacheVastAd", c1228a, appLovinAdLoadListener, appLovinSdkImpl);
this.f2472a = c1228a;
}
/* renamed from: d */
private void m2786d() {
if (this.f2472a.m1838a(this.d)) {
C1233f e = this.f2472a.m1844e();
if (e != null) {
C1236i b = e.m1877b();
if (b != null) {
try {
Uri b2 = b.m1894b();
String uri = b2 != null ? b2.toString() : "";
String c = b.m1895c();
if (!URLUtil.isValidUrl(uri) && !AppLovinSdkUtils.isValidString(c)) {
this.e.mo4178w(this.c, "Companion ad does not have any resources attached. Skipping...");
return;
} else if (b.m1891a() == C1237j.STATIC) {
this.e.mo4172d(this.c, "Caching static companion ad at " + uri + "...");
List h = this.f2472a.m1847h();
boolean z = (h == null || h.isEmpty()) ? false : true;
b2 = m2760b(uri, h, z);
if (b2 != null) {
b.m1892a(b2);
return;
} else {
this.e.mo4173e(this.c, "Failed to cache static companion ad");
return;
}
} else if (b.m1891a() == C1237j.HTML) {
if (AppLovinSdkUtils.isValidString(uri)) {
this.e.mo4172d(this.c, "Begin caching HTML companion ad. Fetching from " + uri + "...");
c = m2763c(uri);
if (AppLovinSdkUtils.isValidString(c)) {
this.e.mo4172d(this.c, "HTML fetched. Caching HTML now...");
b.m1893a(m2761b(c, this.f2472a.m1847h()));
return;
}
this.e.mo4173e(this.c, "Unable to load companion ad resources from " + uri);
return;
}
this.e.mo4172d(this.c, "Caching provided HTML for companion ad. No fetch required. HTML: " + c);
b.m1893a(m2761b(c, this.f2472a.m1847h()));
return;
} else if (b.m1891a() == C1237j.IFRAME) {
this.e.mo4172d(this.c, "Skip caching of iFrame resource...");
return;
} else {
return;
}
} catch (Throwable th) {
this.e.mo4174e(this.c, "Failed to cache companion ad", th);
return;
}
}
this.e.mo4173e(this.c, "Failed to retrieve non-video resources from companion ad. Skipping...");
return;
}
this.e.mo4172d(this.c, "No companion ad provided. Skipping...");
return;
}
this.e.mo4172d(this.c, "Companion ad caching disabled. Skipping...");
}
/* renamed from: e */
private void m2787e() {
if (!this.f2472a.m1840b(this.d)) {
this.e.mo4172d(this.c, "Video caching disabled. Skipping...");
} else if (this.f2472a.mo4000a() != null) {
C1245r c = this.f2472a.m1841c();
if (c != null) {
Uri b = c.m1936b();
if (b != null) {
List h = this.f2472a.m1847h();
boolean z = (h == null || h.isEmpty()) ? false : true;
Uri a = m2756a(b.toString(), h, z);
if (a != null) {
this.e.mo4172d(this.c, "Video file successfully cached into: " + a);
c.m1935a(a);
return;
}
this.e.mo4173e(this.c, "Failed to cache video file: " + c);
}
}
}
}
/* renamed from: f */
private void m2788f() {
String a;
if (this.f2472a.m1850k() != null) {
this.e.mo4172d(this.c, "Begin caching HTML template. Fetching from " + this.f2472a.m1850k() + "...");
a = m2757a(this.f2472a.m1850k().toString(), this.f2472a.m1802O());
} else {
a = this.f2472a.m1849j();
}
if (AppLovinSdkUtils.isValidString(a)) {
this.f2472a.m1842c(m2761b(a, this.f2472a.m1802O()));
this.e.mo4172d(this.c, "Finish caching HTML template " + this.f2472a.m1849j() + " for ad #" + this.f2472a.getAdIdNumber());
return;
}
this.e.mo4172d(this.c, "Unable to load HTML template");
}
public void run() {
this.e.mo4172d(this.c, "Begin caching for VAST ad #" + this.f2472a.getAdIdNumber() + "...");
m2762b();
m2786d();
m2787e();
m2788f();
m2765c();
this.e.mo4172d(this.c, "Finished caching VAST ad #" + this.f2472a.getAdIdNumber());
long currentTimeMillis = System.currentTimeMillis() - this.f2472a.mo3994l();
C1280g.m2907a(this.f2472a, this.d);
C1280g.m2905a(currentTimeMillis, this.f2472a, this.d);
m2758a(this.f2472a);
}
}
|
UTF-8
|
Java
| 6,116 |
java
|
ep.java
|
Java
|
[] | null |
[] |
package com.applovin.impl.sdk;
import android.net.Uri;
import android.webkit.URLUtil;
import com.applovin.impl.p016a.C1228a;
import com.applovin.impl.p016a.C1233f;
import com.applovin.impl.p016a.C1236i;
import com.applovin.impl.p016a.C1237j;
import com.applovin.impl.p016a.C1245r;
import com.applovin.sdk.AppLovinAdLoadListener;
import com.applovin.sdk.AppLovinSdkUtils;
import java.util.List;
class ep extends ej {
/* renamed from: a */
private final C1228a f2472a;
public ep(C1228a c1228a, AppLovinAdLoadListener appLovinAdLoadListener, AppLovinSdkImpl appLovinSdkImpl) {
super("TaskCacheVastAd", c1228a, appLovinAdLoadListener, appLovinSdkImpl);
this.f2472a = c1228a;
}
/* renamed from: d */
private void m2786d() {
if (this.f2472a.m1838a(this.d)) {
C1233f e = this.f2472a.m1844e();
if (e != null) {
C1236i b = e.m1877b();
if (b != null) {
try {
Uri b2 = b.m1894b();
String uri = b2 != null ? b2.toString() : "";
String c = b.m1895c();
if (!URLUtil.isValidUrl(uri) && !AppLovinSdkUtils.isValidString(c)) {
this.e.mo4178w(this.c, "Companion ad does not have any resources attached. Skipping...");
return;
} else if (b.m1891a() == C1237j.STATIC) {
this.e.mo4172d(this.c, "Caching static companion ad at " + uri + "...");
List h = this.f2472a.m1847h();
boolean z = (h == null || h.isEmpty()) ? false : true;
b2 = m2760b(uri, h, z);
if (b2 != null) {
b.m1892a(b2);
return;
} else {
this.e.mo4173e(this.c, "Failed to cache static companion ad");
return;
}
} else if (b.m1891a() == C1237j.HTML) {
if (AppLovinSdkUtils.isValidString(uri)) {
this.e.mo4172d(this.c, "Begin caching HTML companion ad. Fetching from " + uri + "...");
c = m2763c(uri);
if (AppLovinSdkUtils.isValidString(c)) {
this.e.mo4172d(this.c, "HTML fetched. Caching HTML now...");
b.m1893a(m2761b(c, this.f2472a.m1847h()));
return;
}
this.e.mo4173e(this.c, "Unable to load companion ad resources from " + uri);
return;
}
this.e.mo4172d(this.c, "Caching provided HTML for companion ad. No fetch required. HTML: " + c);
b.m1893a(m2761b(c, this.f2472a.m1847h()));
return;
} else if (b.m1891a() == C1237j.IFRAME) {
this.e.mo4172d(this.c, "Skip caching of iFrame resource...");
return;
} else {
return;
}
} catch (Throwable th) {
this.e.mo4174e(this.c, "Failed to cache companion ad", th);
return;
}
}
this.e.mo4173e(this.c, "Failed to retrieve non-video resources from companion ad. Skipping...");
return;
}
this.e.mo4172d(this.c, "No companion ad provided. Skipping...");
return;
}
this.e.mo4172d(this.c, "Companion ad caching disabled. Skipping...");
}
/* renamed from: e */
private void m2787e() {
if (!this.f2472a.m1840b(this.d)) {
this.e.mo4172d(this.c, "Video caching disabled. Skipping...");
} else if (this.f2472a.mo4000a() != null) {
C1245r c = this.f2472a.m1841c();
if (c != null) {
Uri b = c.m1936b();
if (b != null) {
List h = this.f2472a.m1847h();
boolean z = (h == null || h.isEmpty()) ? false : true;
Uri a = m2756a(b.toString(), h, z);
if (a != null) {
this.e.mo4172d(this.c, "Video file successfully cached into: " + a);
c.m1935a(a);
return;
}
this.e.mo4173e(this.c, "Failed to cache video file: " + c);
}
}
}
}
/* renamed from: f */
private void m2788f() {
String a;
if (this.f2472a.m1850k() != null) {
this.e.mo4172d(this.c, "Begin caching HTML template. Fetching from " + this.f2472a.m1850k() + "...");
a = m2757a(this.f2472a.m1850k().toString(), this.f2472a.m1802O());
} else {
a = this.f2472a.m1849j();
}
if (AppLovinSdkUtils.isValidString(a)) {
this.f2472a.m1842c(m2761b(a, this.f2472a.m1802O()));
this.e.mo4172d(this.c, "Finish caching HTML template " + this.f2472a.m1849j() + " for ad #" + this.f2472a.getAdIdNumber());
return;
}
this.e.mo4172d(this.c, "Unable to load HTML template");
}
public void run() {
this.e.mo4172d(this.c, "Begin caching for VAST ad #" + this.f2472a.getAdIdNumber() + "...");
m2762b();
m2786d();
m2787e();
m2788f();
m2765c();
this.e.mo4172d(this.c, "Finished caching VAST ad #" + this.f2472a.getAdIdNumber());
long currentTimeMillis = System.currentTimeMillis() - this.f2472a.mo3994l();
C1280g.m2907a(this.f2472a, this.d);
C1280g.m2905a(currentTimeMillis, this.f2472a, this.d);
m2758a(this.f2472a);
}
}
| 6,116 | 0.465991 | 0.389961 | 137 | 43.642334 | 30.924852 | 135 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.868613 | false | false |
2
|
a2617bf64880caf9d2796618112212c919cce38d
| 360,777,294,914 |
e972439b2310abc73f5b18f2b675744da4a02321
|
/src/main/java/com/zhaodj/foo/thread/ShutdownHookDemo.java
|
96f150f197f007eb378a9835c5a4695ea5c2ca2f
|
[] |
no_license
|
zhaodj/java_lab
|
https://github.com/zhaodj/java_lab
|
0c147500b3e84e629e4b88807a029c567d60d8c0
|
73ed7f9e8ad9c1acd1c13c3230219a29fddfd59f
|
refs/heads/master
| 2021-01-18T22:26:06.087000 | 2017-05-24T03:58:49 | 2017-05-24T03:58:49 | 31,702,218 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.zhaodj.foo.thread;
import java.util.Scanner;
public class ShutdownHookDemo {
public static void main(String[] args) {
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
@Override
public void run() {
System.out.println("shutdown");
}
}));
Scanner sc = new Scanner(System.in);
String line = null;
while((line = sc.nextLine())!=null) {
System.out.println(line);
}
}
}
|
UTF-8
|
Java
| 440 |
java
|
ShutdownHookDemo.java
|
Java
|
[] | null |
[] |
package com.zhaodj.foo.thread;
import java.util.Scanner;
public class ShutdownHookDemo {
public static void main(String[] args) {
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
@Override
public void run() {
System.out.println("shutdown");
}
}));
Scanner sc = new Scanner(System.in);
String line = null;
while((line = sc.nextLine())!=null) {
System.out.println(line);
}
}
}
| 440 | 0.645455 | 0.645455 | 25 | 16.6 | 17.62952 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.92 | false | false |
2
|
f01a7f7ccd9b904c6513d8827fb70d2e8430a332
| 26,259,430,114,448 |
ccdbf467ce59670b4b5e53d4c40d3872f1a9b1a8
|
/YiPin/src/com/yipin/model/Goods.java
|
8d7ffb1c92f43a5e6bd0fc2f19114dae1229e59f
|
[] |
no_license
|
yangasahi/Yipinnet
|
https://github.com/yangasahi/Yipinnet
|
78ce61ed64a78995380d8bd203aa9c575678611b
|
d350df4711403a7dbc28a7a6cc6e1b8f08745cd8
|
refs/heads/master
| 2020-12-30T11:15:27.871000 | 2014-06-22T11:22:00 | 2014-06-22T11:22:00 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.yipin.model;
public class Goods {
private String goodsid;
private String goodsname;
private String introduce;
private String image;
private String addr;
private String typename;
private int goodstypeid;
public String getGoodsid() {
return goodsid;
}
public void setGoodsid(String goodsid) {
this.goodsid = goodsid;
}
public String getGoodsname() {
return goodsname;
}
public void setGoodsname(String goodsname) {
this.goodsname = goodsname;
}
public String getIntroduce() {
return introduce;
}
public void setIntroduce(String introduce) {
this.introduce = introduce;
}
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
public String getAddr() {
return addr;
}
public void setAddr(String addr) {
this.addr = addr;
}
public String getTypename() {
return typename;
}
public void setTypename(String typename) {
this.typename = typename;
}
public int getGoodstypeid() {
return goodstypeid;
}
public void setGoodstypeid(int goodstypeid) {
this.goodstypeid = goodstypeid;
}
}
|
UTF-8
|
Java
| 1,130 |
java
|
Goods.java
|
Java
|
[] | null |
[] |
package com.yipin.model;
public class Goods {
private String goodsid;
private String goodsname;
private String introduce;
private String image;
private String addr;
private String typename;
private int goodstypeid;
public String getGoodsid() {
return goodsid;
}
public void setGoodsid(String goodsid) {
this.goodsid = goodsid;
}
public String getGoodsname() {
return goodsname;
}
public void setGoodsname(String goodsname) {
this.goodsname = goodsname;
}
public String getIntroduce() {
return introduce;
}
public void setIntroduce(String introduce) {
this.introduce = introduce;
}
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
public String getAddr() {
return addr;
}
public void setAddr(String addr) {
this.addr = addr;
}
public String getTypename() {
return typename;
}
public void setTypename(String typename) {
this.typename = typename;
}
public int getGoodstypeid() {
return goodstypeid;
}
public void setGoodstypeid(int goodstypeid) {
this.goodstypeid = goodstypeid;
}
}
| 1,130 | 0.70531 | 0.70531 | 56 | 19.178572 | 14.034533 | 46 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.410714 | false | false |
7
|
73f10434775eecc964293c722844595a5ecea381
| 5,437,428,651,976 |
3f4f36053528fafaa887195603adeba2d94af0a4
|
/mvp/src/main/java/com/electronclass/pda/mvp/entity/ErrorMessage.java
|
b8a67341911fa654c18f7a6dc5c03e1d88615e5b
|
[
"Apache-2.0"
] |
permissive
|
caofengcheng/ElectronClass
|
https://github.com/caofengcheng/ElectronClass
|
c17d1d180c8a5591f66cdbe7391c94ef9c880816
|
7c0361cc2ee53f29d5ebcc915e418c7b05aa9b26
|
refs/heads/master
| 2021-07-14T02:30:00.459000 | 2020-10-10T09:23:41 | 2020-10-10T09:23:41 | 213,528,493 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.electronclass.pda.mvp.entity;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.io.Serializable;
/**
* 错误信息
* Created by linlingrong on 2016-01-25.
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class ErrorMessage implements Serializable {
private String code;
private String message;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}
|
UTF-8
|
Java
| 630 |
java
|
ErrorMessage.java
|
Java
|
[
{
"context": "t java.io.Serializable;\n\n/**\n * 错误信息\n * Created by linlingrong on 2016-01-25.\n */\n@JsonIgnoreProperties(ignoreUn",
"end": 173,
"score": 0.9996967911720276,
"start": 162,
"tag": "USERNAME",
"value": "linlingrong"
}
] | null |
[] |
package com.electronclass.pda.mvp.entity;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.io.Serializable;
/**
* 错误信息
* Created by linlingrong on 2016-01-25.
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class ErrorMessage implements Serializable {
private String code;
private String message;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}
| 630 | 0.676849 | 0.663987 | 31 | 19.064516 | 18.140909 | 61 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.290323 | false | false |
7
|
b2fd3c4a63e57429a2f64f73d6f097b96012dc6e
| 20,581,483,351,158 |
969af5b57471c21117e5a9ec2e33623a3ba78518
|
/src/main/java/cn/Test/soldTickets.java
|
b9b459424b3d1c532e8f655969c7c58f588291e0
|
[] |
no_license
|
846916096/jwxtwx
|
https://github.com/846916096/jwxtwx
|
e555f37368a0f445f8c54edc0c7e4f17e48e21e3
|
0e4a3e7c639deff2ba6be4f515270fa10e2b1f09
|
refs/heads/master
| 2021-05-04T20:24:16.935000 | 2018-05-01T01:53:12 | 2018-05-01T01:53:12 | 119,811,196 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package cn.Test;
/**
* @author MiaoQ
* @create 2018-03-20-20:16
*/
public class soldTickets implements Runnable {
static int a = 100;
static Object ob = new Object();
public void run() {
while (a > 0) {
synchronized (ob)
{
if (a > 0) {
a--;
System.out.println(Thread.currentThread().getName()
+ "正在卖票,还剩" + a + "张票");
} else {
return;
}
}
try {
Thread.sleep(10);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
|
UTF-8
|
Java
| 721 |
java
|
soldTickets.java
|
Java
|
[
{
"context": "package cn.Test;\n\n/**\n * @author MiaoQ\n * @create 2018-03-20-20:16\n */\npublic class sold",
"end": 38,
"score": 0.9223065376281738,
"start": 33,
"tag": "NAME",
"value": "MiaoQ"
}
] | null |
[] |
package cn.Test;
/**
* @author MiaoQ
* @create 2018-03-20-20:16
*/
public class soldTickets implements Runnable {
static int a = 100;
static Object ob = new Object();
public void run() {
while (a > 0) {
synchronized (ob)
{
if (a > 0) {
a--;
System.out.println(Thread.currentThread().getName()
+ "正在卖票,还剩" + a + "张票");
} else {
return;
}
}
try {
Thread.sleep(10);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
| 721 | 0.391489 | 0.364539 | 31 | 21.741936 | 16.605417 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.290323 | false | false |
7
|
5c119ff421502a0e56388bbeb2681b7b0d68e3c1
| 22,505,628,631,467 |
6f672fb72caedccb841ee23f53e32aceeaf1895e
|
/pinterest_source/src/com/pinterest/activity/nux/fragment/NUXInterestsPickerFragment.java
|
ecc74cfba7640274752ed8c45c02782f64d447b2
|
[] |
no_license
|
cha63506/CompSecurity
|
https://github.com/cha63506/CompSecurity
|
5c69743f660b9899146ed3cf21eceabe3d5f4280
|
eee7e74f4088b9c02dd711c061fc04fb1e4e2654
|
refs/heads/master
| 2018-03-23T04:15:18.480000 | 2015-12-19T01:29:58 | 2015-12-19T01:29:58 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: braces fieldsfirst space lnc
package com.pinterest.activity.nux.fragment;
import android.net.Uri;
import android.os.Bundle;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import butterknife.ButterKnife;
import com.pinterest.activity.FragmentHelper;
import com.pinterest.activity.nux.NUXActivity;
import com.pinterest.activity.nux.NUXCoreConceptsHelper;
import com.pinterest.activity.nux.adapter.NUXInterestGridAdapter;
import com.pinterest.activity.nux.adapter.NUXNextFragmentListener;
import com.pinterest.activity.nux.view.NUXContinueBar;
import com.pinterest.activity.nux.view.NUXHeaderView;
import com.pinterest.activity.task.model.Navigation;
import com.pinterest.adapter.PinterestBaseAdapter;
import com.pinterest.api.ApiFields;
import com.pinterest.api.remote.AnalyticsApi;
import com.pinterest.api.remote.InterestsApi;
import com.pinterest.education.EducationHelper;
import com.pinterest.experience.ExperienceEnabled;
import com.pinterest.experience.ExperienceValue;
import com.pinterest.experience.Experiences;
import com.pinterest.experience.NuxDisplayData;
import com.pinterest.experience.NuxStep;
import com.pinterest.fragment.PinterestGridFragment;
import com.pinterest.kit.application.Resources;
import com.pinterest.network.json.PinterestJsonArray;
import com.pinterest.network.json.PinterestJsonObject;
import com.pinterest.ui.grid.AdapterFooterView;
import com.pinterest.ui.grid.PinterestAdapterView;
import com.pinterest.ui.grid.PinterestGridView;
import com.pinterest.ui.imageview.WebImageView;
import com.pinterest.ui.text.PButton;
import com.pinterest.ui.text.PTextView;
// Referenced classes of package com.pinterest.activity.nux.fragment:
// NUXSocialPickerFragment, NUXEndScreenFragment
public class NUXInterestsPickerFragment extends PinterestGridFragment
implements ExperienceEnabled
{
private long CHOOSE_TEXT_ALPHA_DURATION;
private long CONTINUE_BTN_ANIMATION_DURATION;
private float CONTINUE_BTN_FADED_ALPHA;
private float CONTINUE_BTN_INTERPOLATOR_FRICTION;
private float CONTINUE_BTN_INTERPOLATOR_TENSION;
private float CONTINUE_BTN_TRANSLATE_Y;
WebImageView _bottomFade;
private PinterestJsonArray _chooseMoreInterestsTextArray;
PTextView _chooseMoreTopicsText;
NUXContinueBar _continueBar;
PButton _continueBtn;
PButton _giftwrapContinueBtn;
NUXHeaderView _header;
private boolean _inCoreConceptsExp;
private boolean _inGiftWrapInterestsExp;
private int _minInterests;
PinterestAdapterView _pinGrid;
PTextView _title;
private String giftWrapContinueString;
private LinearLayout giftWrapHeader;
private String giftWrapPickMoreString;
NUXNextFragmentListener nextFragmentListener;
private android.widget.AdapterView.OnItemClickListener onItemClick;
public NUXInterestsPickerFragment()
{
_minInterests = 5;
CONTINUE_BTN_FADED_ALPHA = 0.5F;
CONTINUE_BTN_TRANSLATE_Y = -30F;
CONTINUE_BTN_INTERPOLATOR_FRICTION = 0.7F;
CONTINUE_BTN_INTERPOLATOR_TENSION = 0.2F;
CHOOSE_TEXT_ALPHA_DURATION = 300L;
CONTINUE_BTN_ANIMATION_DURATION = 700L;
onItemClick = new _cls3();
nextFragmentListener = new _cls4();
_inCoreConceptsExp = NUXCoreConceptsHelper.inCoreConceptsExp();
_inGiftWrapInterestsExp = EducationHelper.n();
_layoutId = getLayoutId();
_adapter = new NUXInterestGridAdapter();
((NUXInterestGridAdapter)_adapter).setBounceOnTouch(true);
}
private void applyExperienceCoreConcepts(NuxStep nuxstep)
{
_title.setText(Html.fromHtml(nuxstep.b));
_title.setTypefaceId(com.pinterest.kit.utils.FontUtils.TypefaceId.MEDIUM);
_continueBtn.setText(nuxstep.m);
_chooseMoreInterestsTextArray = nuxstep.t;
_chooseMoreTopicsText.setText(_chooseMoreInterestsTextArray.a(0));
nuxstep = nuxstep.r;
_bottomFade.loadUri(Uri.parse(nuxstep.a("bottomFade", "")));
_bottomFade.setScaleType(android.widget.ImageView.ScaleType.FIT_XY);
_minInterests = _chooseMoreInterestsTextArray.a();
}
private void applyExperienceGiftWrap(NuxStep nuxstep)
{
PTextView ptextview = (PTextView)giftWrapHeader.findViewById(0x7f0f048b);
ptextview.setTypefaceId(com.pinterest.kit.utils.FontUtils.TypefaceId.BOLD);
ptextview.setText(nuxstep.b);
giftWrapContinueString = nuxstep.m;
giftWrapPickMoreString = nuxstep.u;
_minInterests = nuxstep.l;
_giftwrapContinueBtn.setAllCaps(false);
_giftwrapContinueBtn.setText(String.format(nuxstep.u, new Object[] {
Integer.valueOf(_minInterests)
}));
}
private void applyExperienceMandatoryNUX(NuxStep nuxstep)
{
_header.applyExperience(nuxstep);
_continueBar.applyExperience(nuxstep);
if (nuxstep.l > 0)
{
_minInterests = nuxstep.l;
}
}
private void finishInterestsPicker()
{
((NUXActivity)getActivity()).submitInterests(((NUXInterestGridAdapter)_adapter).getCheckedInterests());
goToNextFragment();
}
private int getLayoutId()
{
if (_inCoreConceptsExp)
{
return 0x7f0300e4;
}
return !_inGiftWrapInterestsExp ? 0x7f0300e8 : 0x7f0300cc;
}
private void onViewCreatedCoreConcepts()
{
android.widget.LinearLayout.LayoutParams layoutparams = (android.widget.LinearLayout.LayoutParams)_pinGrid.getLayoutParams();
layoutparams.setMargins(0, 0, 0, (int)Resources.dimension(0x7f0a00db));
_pinGrid.setLayoutParams(layoutparams);
_pinGrid.setBrickPadding((int)Resources.dimension(0x7f0a00dc));
_continueBtn.setOnClickListener(new _cls1());
}
private void onViewCreatedGiftWrapInterests()
{
_pinGrid.setBrickPadding((int)Resources.dimension(0x7f0a00dc));
giftWrapHeader = new LinearLayout(getContext());
LayoutInflater.from(getContext()).inflate(0x7f0301d8, giftWrapHeader, true);
_gridVw.addHeaderView(giftWrapHeader);
_giftwrapContinueBtn.setEnabled(false);
_giftwrapContinueBtn.setOnClickListener(new _cls2());
}
public void applyExperience()
{
Object obj;
obj = Experiences.a(Experiences.b);
break MISSING_BLOCK_LABEL_7;
if (obj != null && (((ExperienceValue) (obj)).f instanceof NuxDisplayData))
{
obj = ((NuxDisplayData)((ExperienceValue) (obj)).f).a();
if (obj != null)
{
if (_inCoreConceptsExp)
{
applyExperienceCoreConcepts(((NuxStep) (obj)));
return;
}
if (_inGiftWrapInterestsExp)
{
applyExperienceGiftWrap(((NuxStep) (obj)));
return;
} else
{
applyExperienceMandatoryNUX(((NuxStep) (obj)));
return;
}
}
}
return;
}
public void goToNextFragment()
{
if (getActivity() == null)
{
return;
}
Object obj = NuxDisplayData.c();
if (obj == null)
{
obj = new NUXSocialPickerFragment();
} else
{
obj = ((NuxDisplayData) (obj)).a(((NuxDisplayData) (obj)).a());
if (obj != null && ((NuxStep) (obj)).b())
{
obj = new NUXSocialPickerFragment();
} else
{
obj = new NUXEndScreenFragment();
}
}
FragmentHelper.replaceFragment(getActivity(), ((android.support.v4.app.Fragment) (obj)), false, com.pinterest.activity.FragmentHelper.Animation.SLIDE);
}
protected void loadData()
{
if (_inGiftWrapInterestsExp)
{
InterestsApi.a("nux", ApiFields.s, null, new com.pinterest.api.remote.InterestsApi.InterestsFeedApiResponse(gridResponseHandler), getApiTag());
return;
} else
{
InterestsApi.a("nux", new com.pinterest.api.remote.InterestsApi.InterestsFeedApiResponse(gridResponseHandler), getApiTag());
return;
}
}
public boolean onBackPressed()
{
return false;
}
public View onCreateView(LayoutInflater layoutinflater, ViewGroup viewgroup, Bundle bundle)
{
return super.onCreateView(layoutinflater, viewgroup, bundle);
}
public void onDestroyView()
{
super.onDestroyView();
}
public void onPause()
{
if (getActivity() != null)
{
((NUXActivity)getActivity()).setCheckedInterests(((NUXInterestGridAdapter)_adapter).getCheckedInterests());
}
super.onPause();
}
public void onResume()
{
if (getActivity() != null && _adapter != null)
{
((NUXInterestGridAdapter)_adapter).setCheckedInterests(((NUXActivity)getActivity()).getCheckedInterests());
}
super.onResume();
}
public void onViewCreated(View view, Bundle bundle)
{
super.onViewCreated(view, bundle);
ButterKnife.a(this, view);
AnalyticsApi.b("interest_selector_start");
if (_inCoreConceptsExp)
{
onViewCreatedCoreConcepts();
} else
if (_inGiftWrapInterestsExp)
{
onViewCreatedGiftWrapInterests();
} else
{
_header = new NUXHeaderView(view.getContext());
_header.setSkipListener(nextFragmentListener);
_header.setTitle(Resources.string(0x7f0703be));
_header.setTitleDesc(Resources.string(0x7f0703bd));
_header.setSkipTitle(Resources.string(0x7f0703b6));
_header.setSkipDesc(Resources.string(0x7f0703b8));
_header.setSkipPosTx(Resources.string(0x7f0703b7));
_header.setSkipNegTx(Resources.string(0x7f07055f));
_continueBar.setContinueListener(nextFragmentListener);
_gridVw.addHeaderView(_header, -1, -2);
_gridVw.getFooterView().setPadding(0, 0, 0, (int)Resources.dimension(0x7f0a016e));
}
_gridVw.setOnItemClickListener(onItemClick);
applyExperience();
}
public void setNavigation(Navigation navigation)
{
super.setNavigation(navigation);
_emptyCenterImage = 0x7f0201d3;
_emptyMessage = Resources.string(0x7f07026b);
}
private class _cls3
implements android.widget.AdapterView.OnItemClickListener
{
final NUXInterestsPickerFragment this$0;
private void chooseMoreInterestsTextUpdate()
{
int i = ((NUXInterestGridAdapter)
// JavaClassFileOutputException: get_constant: invalid tag
private void continueBarUpdate()
{
_continueBar.popInAnimate();
android.support.v4.app.FragmentActivity fragmentactivity = getActivity();
if (fragmentactivity instanceof NUXActivity)
{
((NUXActivity)fragmentactivity).setProgressVisibility(0);
}
((NUXInterestGridAdapter)
// JavaClassFileOutputException: get_constant: invalid tag
private void continueBtnAnimation(PTextView ptextview, PButton pbutton, float f, float f1, float f2, float f3, float f4,
float f5)
{
ptextview = ObjectAnimator.ofFloat(ptextview, "alpha", new float[] {
f, f1
});
ptextview.setDuration(CHOOSE_TEXT_ALPHA_DURATION);
Object obj = ObjectAnimator.ofFloat(pbutton, "alpha", new float[] {
f2, f3
});
ObjectAnimator objectanimator = ObjectAnimator.ofFloat(pbutton, "translationY", new float[] {
f4, f5
});
pbutton = new AnimatorSet();
pbutton.playTogether(new Animator[] {
obj, objectanimator
});
pbutton.setDuration(CONTINUE_BTN_ANIMATION_DURATION);
pbutton.setInterpolator(new SpringInterpolator(CONTINUE_BTN_INTERPOLATOR_FRICTION, CONTINUE_BTN_INTERPOLATOR_TENSION));
obj = new AnimatorSet();
((AnimatorSet) (obj)).playTogether(new Animator[] {
ptextview, pbutton
});
((AnimatorSet) (obj)).start();
}
private void pickMoreInterestsPromptUpdate()
{
int i = ((NUXInterestGridAdapter)
// JavaClassFileOutputException: get_constant: invalid tag
public void onItemClick(AdapterView adapterview, View view, int i, long l)
{
if (
// JavaClassFileOutputException: get_constant: invalid tag
_cls3()
{
this$0 = NUXInterestsPickerFragment.this;
super();
}
}
private class _cls1
implements android.view.View.OnClickListener
{
final NUXInterestsPickerFragment this$0;
public void onClick(View view)
{
finishInterestsPicker();
}
_cls1()
{
this$0 = NUXInterestsPickerFragment.this;
super();
}
}
private class _cls2
implements android.view.View.OnClickListener
{
final NUXInterestsPickerFragment this$0;
public void onClick(View view)
{
finishInterestsPicker();
}
_cls2()
{
this$0 = NUXInterestsPickerFragment.this;
super();
}
}
}
|
UTF-8
|
Java
| 13,874 |
java
|
NUXInterestsPickerFragment.java
|
Java
|
[
{
"context": "// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.\n// Jad home page: http://www.geocities.com/kpdus",
"end": 61,
"score": 0.9996883869171143,
"start": 45,
"tag": "NAME",
"value": "Pavel Kouznetsov"
}
] | null |
[] |
// Decompiled by Jad v1.5.8e. Copyright 2001 <NAME>.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: braces fieldsfirst space lnc
package com.pinterest.activity.nux.fragment;
import android.net.Uri;
import android.os.Bundle;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import butterknife.ButterKnife;
import com.pinterest.activity.FragmentHelper;
import com.pinterest.activity.nux.NUXActivity;
import com.pinterest.activity.nux.NUXCoreConceptsHelper;
import com.pinterest.activity.nux.adapter.NUXInterestGridAdapter;
import com.pinterest.activity.nux.adapter.NUXNextFragmentListener;
import com.pinterest.activity.nux.view.NUXContinueBar;
import com.pinterest.activity.nux.view.NUXHeaderView;
import com.pinterest.activity.task.model.Navigation;
import com.pinterest.adapter.PinterestBaseAdapter;
import com.pinterest.api.ApiFields;
import com.pinterest.api.remote.AnalyticsApi;
import com.pinterest.api.remote.InterestsApi;
import com.pinterest.education.EducationHelper;
import com.pinterest.experience.ExperienceEnabled;
import com.pinterest.experience.ExperienceValue;
import com.pinterest.experience.Experiences;
import com.pinterest.experience.NuxDisplayData;
import com.pinterest.experience.NuxStep;
import com.pinterest.fragment.PinterestGridFragment;
import com.pinterest.kit.application.Resources;
import com.pinterest.network.json.PinterestJsonArray;
import com.pinterest.network.json.PinterestJsonObject;
import com.pinterest.ui.grid.AdapterFooterView;
import com.pinterest.ui.grid.PinterestAdapterView;
import com.pinterest.ui.grid.PinterestGridView;
import com.pinterest.ui.imageview.WebImageView;
import com.pinterest.ui.text.PButton;
import com.pinterest.ui.text.PTextView;
// Referenced classes of package com.pinterest.activity.nux.fragment:
// NUXSocialPickerFragment, NUXEndScreenFragment
public class NUXInterestsPickerFragment extends PinterestGridFragment
implements ExperienceEnabled
{
private long CHOOSE_TEXT_ALPHA_DURATION;
private long CONTINUE_BTN_ANIMATION_DURATION;
private float CONTINUE_BTN_FADED_ALPHA;
private float CONTINUE_BTN_INTERPOLATOR_FRICTION;
private float CONTINUE_BTN_INTERPOLATOR_TENSION;
private float CONTINUE_BTN_TRANSLATE_Y;
WebImageView _bottomFade;
private PinterestJsonArray _chooseMoreInterestsTextArray;
PTextView _chooseMoreTopicsText;
NUXContinueBar _continueBar;
PButton _continueBtn;
PButton _giftwrapContinueBtn;
NUXHeaderView _header;
private boolean _inCoreConceptsExp;
private boolean _inGiftWrapInterestsExp;
private int _minInterests;
PinterestAdapterView _pinGrid;
PTextView _title;
private String giftWrapContinueString;
private LinearLayout giftWrapHeader;
private String giftWrapPickMoreString;
NUXNextFragmentListener nextFragmentListener;
private android.widget.AdapterView.OnItemClickListener onItemClick;
public NUXInterestsPickerFragment()
{
_minInterests = 5;
CONTINUE_BTN_FADED_ALPHA = 0.5F;
CONTINUE_BTN_TRANSLATE_Y = -30F;
CONTINUE_BTN_INTERPOLATOR_FRICTION = 0.7F;
CONTINUE_BTN_INTERPOLATOR_TENSION = 0.2F;
CHOOSE_TEXT_ALPHA_DURATION = 300L;
CONTINUE_BTN_ANIMATION_DURATION = 700L;
onItemClick = new _cls3();
nextFragmentListener = new _cls4();
_inCoreConceptsExp = NUXCoreConceptsHelper.inCoreConceptsExp();
_inGiftWrapInterestsExp = EducationHelper.n();
_layoutId = getLayoutId();
_adapter = new NUXInterestGridAdapter();
((NUXInterestGridAdapter)_adapter).setBounceOnTouch(true);
}
private void applyExperienceCoreConcepts(NuxStep nuxstep)
{
_title.setText(Html.fromHtml(nuxstep.b));
_title.setTypefaceId(com.pinterest.kit.utils.FontUtils.TypefaceId.MEDIUM);
_continueBtn.setText(nuxstep.m);
_chooseMoreInterestsTextArray = nuxstep.t;
_chooseMoreTopicsText.setText(_chooseMoreInterestsTextArray.a(0));
nuxstep = nuxstep.r;
_bottomFade.loadUri(Uri.parse(nuxstep.a("bottomFade", "")));
_bottomFade.setScaleType(android.widget.ImageView.ScaleType.FIT_XY);
_minInterests = _chooseMoreInterestsTextArray.a();
}
private void applyExperienceGiftWrap(NuxStep nuxstep)
{
PTextView ptextview = (PTextView)giftWrapHeader.findViewById(0x7f0f048b);
ptextview.setTypefaceId(com.pinterest.kit.utils.FontUtils.TypefaceId.BOLD);
ptextview.setText(nuxstep.b);
giftWrapContinueString = nuxstep.m;
giftWrapPickMoreString = nuxstep.u;
_minInterests = nuxstep.l;
_giftwrapContinueBtn.setAllCaps(false);
_giftwrapContinueBtn.setText(String.format(nuxstep.u, new Object[] {
Integer.valueOf(_minInterests)
}));
}
private void applyExperienceMandatoryNUX(NuxStep nuxstep)
{
_header.applyExperience(nuxstep);
_continueBar.applyExperience(nuxstep);
if (nuxstep.l > 0)
{
_minInterests = nuxstep.l;
}
}
private void finishInterestsPicker()
{
((NUXActivity)getActivity()).submitInterests(((NUXInterestGridAdapter)_adapter).getCheckedInterests());
goToNextFragment();
}
private int getLayoutId()
{
if (_inCoreConceptsExp)
{
return 0x7f0300e4;
}
return !_inGiftWrapInterestsExp ? 0x7f0300e8 : 0x7f0300cc;
}
private void onViewCreatedCoreConcepts()
{
android.widget.LinearLayout.LayoutParams layoutparams = (android.widget.LinearLayout.LayoutParams)_pinGrid.getLayoutParams();
layoutparams.setMargins(0, 0, 0, (int)Resources.dimension(0x7f0a00db));
_pinGrid.setLayoutParams(layoutparams);
_pinGrid.setBrickPadding((int)Resources.dimension(0x7f0a00dc));
_continueBtn.setOnClickListener(new _cls1());
}
private void onViewCreatedGiftWrapInterests()
{
_pinGrid.setBrickPadding((int)Resources.dimension(0x7f0a00dc));
giftWrapHeader = new LinearLayout(getContext());
LayoutInflater.from(getContext()).inflate(0x7f0301d8, giftWrapHeader, true);
_gridVw.addHeaderView(giftWrapHeader);
_giftwrapContinueBtn.setEnabled(false);
_giftwrapContinueBtn.setOnClickListener(new _cls2());
}
public void applyExperience()
{
Object obj;
obj = Experiences.a(Experiences.b);
break MISSING_BLOCK_LABEL_7;
if (obj != null && (((ExperienceValue) (obj)).f instanceof NuxDisplayData))
{
obj = ((NuxDisplayData)((ExperienceValue) (obj)).f).a();
if (obj != null)
{
if (_inCoreConceptsExp)
{
applyExperienceCoreConcepts(((NuxStep) (obj)));
return;
}
if (_inGiftWrapInterestsExp)
{
applyExperienceGiftWrap(((NuxStep) (obj)));
return;
} else
{
applyExperienceMandatoryNUX(((NuxStep) (obj)));
return;
}
}
}
return;
}
public void goToNextFragment()
{
if (getActivity() == null)
{
return;
}
Object obj = NuxDisplayData.c();
if (obj == null)
{
obj = new NUXSocialPickerFragment();
} else
{
obj = ((NuxDisplayData) (obj)).a(((NuxDisplayData) (obj)).a());
if (obj != null && ((NuxStep) (obj)).b())
{
obj = new NUXSocialPickerFragment();
} else
{
obj = new NUXEndScreenFragment();
}
}
FragmentHelper.replaceFragment(getActivity(), ((android.support.v4.app.Fragment) (obj)), false, com.pinterest.activity.FragmentHelper.Animation.SLIDE);
}
protected void loadData()
{
if (_inGiftWrapInterestsExp)
{
InterestsApi.a("nux", ApiFields.s, null, new com.pinterest.api.remote.InterestsApi.InterestsFeedApiResponse(gridResponseHandler), getApiTag());
return;
} else
{
InterestsApi.a("nux", new com.pinterest.api.remote.InterestsApi.InterestsFeedApiResponse(gridResponseHandler), getApiTag());
return;
}
}
public boolean onBackPressed()
{
return false;
}
public View onCreateView(LayoutInflater layoutinflater, ViewGroup viewgroup, Bundle bundle)
{
return super.onCreateView(layoutinflater, viewgroup, bundle);
}
public void onDestroyView()
{
super.onDestroyView();
}
public void onPause()
{
if (getActivity() != null)
{
((NUXActivity)getActivity()).setCheckedInterests(((NUXInterestGridAdapter)_adapter).getCheckedInterests());
}
super.onPause();
}
public void onResume()
{
if (getActivity() != null && _adapter != null)
{
((NUXInterestGridAdapter)_adapter).setCheckedInterests(((NUXActivity)getActivity()).getCheckedInterests());
}
super.onResume();
}
public void onViewCreated(View view, Bundle bundle)
{
super.onViewCreated(view, bundle);
ButterKnife.a(this, view);
AnalyticsApi.b("interest_selector_start");
if (_inCoreConceptsExp)
{
onViewCreatedCoreConcepts();
} else
if (_inGiftWrapInterestsExp)
{
onViewCreatedGiftWrapInterests();
} else
{
_header = new NUXHeaderView(view.getContext());
_header.setSkipListener(nextFragmentListener);
_header.setTitle(Resources.string(0x7f0703be));
_header.setTitleDesc(Resources.string(0x7f0703bd));
_header.setSkipTitle(Resources.string(0x7f0703b6));
_header.setSkipDesc(Resources.string(0x7f0703b8));
_header.setSkipPosTx(Resources.string(0x7f0703b7));
_header.setSkipNegTx(Resources.string(0x7f07055f));
_continueBar.setContinueListener(nextFragmentListener);
_gridVw.addHeaderView(_header, -1, -2);
_gridVw.getFooterView().setPadding(0, 0, 0, (int)Resources.dimension(0x7f0a016e));
}
_gridVw.setOnItemClickListener(onItemClick);
applyExperience();
}
public void setNavigation(Navigation navigation)
{
super.setNavigation(navigation);
_emptyCenterImage = 0x7f0201d3;
_emptyMessage = Resources.string(0x7f07026b);
}
private class _cls3
implements android.widget.AdapterView.OnItemClickListener
{
final NUXInterestsPickerFragment this$0;
private void chooseMoreInterestsTextUpdate()
{
int i = ((NUXInterestGridAdapter)
// JavaClassFileOutputException: get_constant: invalid tag
private void continueBarUpdate()
{
_continueBar.popInAnimate();
android.support.v4.app.FragmentActivity fragmentactivity = getActivity();
if (fragmentactivity instanceof NUXActivity)
{
((NUXActivity)fragmentactivity).setProgressVisibility(0);
}
((NUXInterestGridAdapter)
// JavaClassFileOutputException: get_constant: invalid tag
private void continueBtnAnimation(PTextView ptextview, PButton pbutton, float f, float f1, float f2, float f3, float f4,
float f5)
{
ptextview = ObjectAnimator.ofFloat(ptextview, "alpha", new float[] {
f, f1
});
ptextview.setDuration(CHOOSE_TEXT_ALPHA_DURATION);
Object obj = ObjectAnimator.ofFloat(pbutton, "alpha", new float[] {
f2, f3
});
ObjectAnimator objectanimator = ObjectAnimator.ofFloat(pbutton, "translationY", new float[] {
f4, f5
});
pbutton = new AnimatorSet();
pbutton.playTogether(new Animator[] {
obj, objectanimator
});
pbutton.setDuration(CONTINUE_BTN_ANIMATION_DURATION);
pbutton.setInterpolator(new SpringInterpolator(CONTINUE_BTN_INTERPOLATOR_FRICTION, CONTINUE_BTN_INTERPOLATOR_TENSION));
obj = new AnimatorSet();
((AnimatorSet) (obj)).playTogether(new Animator[] {
ptextview, pbutton
});
((AnimatorSet) (obj)).start();
}
private void pickMoreInterestsPromptUpdate()
{
int i = ((NUXInterestGridAdapter)
// JavaClassFileOutputException: get_constant: invalid tag
public void onItemClick(AdapterView adapterview, View view, int i, long l)
{
if (
// JavaClassFileOutputException: get_constant: invalid tag
_cls3()
{
this$0 = NUXInterestsPickerFragment.this;
super();
}
}
private class _cls1
implements android.view.View.OnClickListener
{
final NUXInterestsPickerFragment this$0;
public void onClick(View view)
{
finishInterestsPicker();
}
_cls1()
{
this$0 = NUXInterestsPickerFragment.this;
super();
}
}
private class _cls2
implements android.view.View.OnClickListener
{
final NUXInterestsPickerFragment this$0;
public void onClick(View view)
{
finishInterestsPicker();
}
_cls2()
{
this$0 = NUXInterestsPickerFragment.this;
super();
}
}
}
| 13,864 | 0.644875 | 0.632622 | 431 | 31.190256 | 28.24431 | 159 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.545244 | false | false |
7
|
2bb8b8b17937f5c26d6859b8ee6fd34401f8967e
| 18,726,057,464,780 |
94741a79286128ccba529e5f5c28c668fd5b00ff
|
/src/Chapter11/GeometricObject.java
|
e4ce04a5ca69a333808fa23be68d249b32eb3f95
|
[] |
no_license
|
Fighteros/JavaRev
|
https://github.com/Fighteros/JavaRev
|
fbce475b2749f4b13acc874dba784f8c86deb2fd
|
f2634a5224bb90afe7589acbcc912429564ddd0c
|
refs/heads/master
| 2023-03-29T23:11:55.130000 | 2021-03-28T15:33:34 | 2021-03-28T15:33:34 | 349,987,250 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package Chapter11;
public class GeometricObject {
private double radius ;
public GeometricObject(){
}
public GeometricObject(double radius){
this.radius = radius;
}
public double getRadius() {
return radius;
}
@Override
public String toString() {
return "GeometricObject{" +
"radius=" + radius +
'}';
}
public void setRadius(double radius) {
this.radius = radius;
}
}
|
UTF-8
|
Java
| 487 |
java
|
GeometricObject.java
|
Java
|
[] | null |
[] |
package Chapter11;
public class GeometricObject {
private double radius ;
public GeometricObject(){
}
public GeometricObject(double radius){
this.radius = radius;
}
public double getRadius() {
return radius;
}
@Override
public String toString() {
return "GeometricObject{" +
"radius=" + radius +
'}';
}
public void setRadius(double radius) {
this.radius = radius;
}
}
| 487 | 0.558522 | 0.554415 | 27 | 17.037037 | 14.642611 | 42 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.222222 | false | false |
7
|
930ee68e2b902e294cf2174f83560c441eaeb5f4
| 1,279,900,261,480 |
3a5985651d77a31437cfdac25e594087c27e93d6
|
/ojc-core/iepse/iepjbiadapter/src/com/sun/jbi/engine/iep/DeploymentRecord.java
|
3939b04c684cc6d1a514fb3a63b2ce0106a79e72
|
[] |
no_license
|
vitalif/openesb-components
|
https://github.com/vitalif/openesb-components
|
a37d62133d81edb3fdc091abd5c1d72dbe2fc736
|
560910d2a1fdf31879e3d76825edf079f76812c7
|
refs/heads/master
| 2023-09-04T14:40:55.665000 | 2016-01-25T13:12:22 | 2016-01-25T13:12:33 | 48,222,841 | 0 | 5 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* BEGIN_HEADER - DO NOT EDIT
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the "License"). You may not use this file except
* in compliance with the License.
*
* You can obtain a copy of the license at
* https://open-jbi-components.dev.java.net/public/CDDLv1.0.html.
* See the License for the specific language governing
* permissions and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* HEADER in each file and include the License file at
* https://open-jbi-components.dev.java.net/public/CDDLv1.0.html.
* If applicable add the following below this CDDL HEADER,
* with the fields enclosed by brackets "[]" replaced with
* your own identifying information: Portions Copyright
* [year] [name of copyright owner]
*/
/*
* @(#)DeploymentRecord.java
*
* Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
*
* END_HEADER - DO NOT EDIT
*/
package com.sun.jbi.engine.iep;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import javax.jbi.servicedesc.ServiceEndpoint;
import com.sun.jbi.engine.iep.core.runtime.operator.QueryPlan;
import com.sun.jbi.engine.iep.core.runtime.util.NameUtil;
/**
* DeploymentRecord.java
*
* serviceUnitName (1) ---------- (*) instanceId (each su can contain multiple .iep files)
* deployName (*) ---------- (1) plan (each plan can have multiple instances)
*
* The deployNames are unique within a jbi engine
*
* Created on September 8, 2005, 12:47 AM
*
* @author Bing Lu
*/
public class DeploymentRecord {
private String mServiceUnitRootPath;
private String mServiceUnitName;
private String mDeployName;
private QueryPlan mPlan;
private boolean mStarted;
private List<ServiceEndpoint> mProviderEndpointList = new ArrayList<ServiceEndpoint>();
public Timestamp timestamp = new Timestamp(0);
/** Creates a new instance of DeploymentRecord */
public DeploymentRecord(String serviceUnitRootPath,
String serviceUnitName,
String deployName,
QueryPlan plan)
{
mServiceUnitRootPath = serviceUnitRootPath;
mServiceUnitName = serviceUnitName;
mDeployName = deployName;
mPlan = plan;
}
public String getServiceUnitRootPath() {
return mServiceUnitRootPath;
}
public String getServiceUnitName() {
return mServiceUnitName;
}
public String getDeployName() {
return mDeployName;
}
public QueryPlan getPlan() {
return mPlan;
}
public void setStarted(boolean started) {
mStarted = started;
}
public boolean isStarted() {
return mStarted;
}
public void addProviderEndpoint(ServiceEndpoint serviceEndpoint) {
if (!mProviderEndpointList.contains(serviceEndpoint)) {
mProviderEndpointList.add(serviceEndpoint);
}
}
public ServiceEndpoint getProviderEndpoint(String opName) {
String operation = NameUtil.makeJavaId(opName);
for (int i = 0; i < mProviderEndpointList.size(); i++) {
ServiceEndpoint sep = mProviderEndpointList.get(i);
if (sep.getEndpointName().equals(operation)) {
return sep;
}
}
return null;
}
public List<ServiceEndpoint> getProviderEndpointList() {
return new ArrayList<ServiceEndpoint>(mProviderEndpointList);
}
public boolean isProviderEndpoint(ServiceEndpoint serviceEndpoint) {
return mProviderEndpointList.contains(serviceEndpoint);
}
}
|
UTF-8
|
Java
| 3,731 |
java
|
DeploymentRecord.java
|
Java
|
[
{
"context": "eated on September 8, 2005, 12:47 AM\n *\n * @author Bing Lu\n*/\npublic class DeploymentRecord {\n private St",
"end": 1584,
"score": 0.9993593096733093,
"start": 1577,
"tag": "NAME",
"value": "Bing Lu"
}
] | null |
[] |
/*
* BEGIN_HEADER - DO NOT EDIT
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the "License"). You may not use this file except
* in compliance with the License.
*
* You can obtain a copy of the license at
* https://open-jbi-components.dev.java.net/public/CDDLv1.0.html.
* See the License for the specific language governing
* permissions and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* HEADER in each file and include the License file at
* https://open-jbi-components.dev.java.net/public/CDDLv1.0.html.
* If applicable add the following below this CDDL HEADER,
* with the fields enclosed by brackets "[]" replaced with
* your own identifying information: Portions Copyright
* [year] [name of copyright owner]
*/
/*
* @(#)DeploymentRecord.java
*
* Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
*
* END_HEADER - DO NOT EDIT
*/
package com.sun.jbi.engine.iep;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import javax.jbi.servicedesc.ServiceEndpoint;
import com.sun.jbi.engine.iep.core.runtime.operator.QueryPlan;
import com.sun.jbi.engine.iep.core.runtime.util.NameUtil;
/**
* DeploymentRecord.java
*
* serviceUnitName (1) ---------- (*) instanceId (each su can contain multiple .iep files)
* deployName (*) ---------- (1) plan (each plan can have multiple instances)
*
* The deployNames are unique within a jbi engine
*
* Created on September 8, 2005, 12:47 AM
*
* @author <NAME>
*/
public class DeploymentRecord {
private String mServiceUnitRootPath;
private String mServiceUnitName;
private String mDeployName;
private QueryPlan mPlan;
private boolean mStarted;
private List<ServiceEndpoint> mProviderEndpointList = new ArrayList<ServiceEndpoint>();
public Timestamp timestamp = new Timestamp(0);
/** Creates a new instance of DeploymentRecord */
public DeploymentRecord(String serviceUnitRootPath,
String serviceUnitName,
String deployName,
QueryPlan plan)
{
mServiceUnitRootPath = serviceUnitRootPath;
mServiceUnitName = serviceUnitName;
mDeployName = deployName;
mPlan = plan;
}
public String getServiceUnitRootPath() {
return mServiceUnitRootPath;
}
public String getServiceUnitName() {
return mServiceUnitName;
}
public String getDeployName() {
return mDeployName;
}
public QueryPlan getPlan() {
return mPlan;
}
public void setStarted(boolean started) {
mStarted = started;
}
public boolean isStarted() {
return mStarted;
}
public void addProviderEndpoint(ServiceEndpoint serviceEndpoint) {
if (!mProviderEndpointList.contains(serviceEndpoint)) {
mProviderEndpointList.add(serviceEndpoint);
}
}
public ServiceEndpoint getProviderEndpoint(String opName) {
String operation = NameUtil.makeJavaId(opName);
for (int i = 0; i < mProviderEndpointList.size(); i++) {
ServiceEndpoint sep = mProviderEndpointList.get(i);
if (sep.getEndpointName().equals(operation)) {
return sep;
}
}
return null;
}
public List<ServiceEndpoint> getProviderEndpointList() {
return new ArrayList<ServiceEndpoint>(mProviderEndpointList);
}
public boolean isProviderEndpoint(ServiceEndpoint serviceEndpoint) {
return mProviderEndpointList.contains(serviceEndpoint);
}
}
| 3,730 | 0.669526 | 0.662825 | 124 | 29.088709 | 24.415758 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.330645 | false | false |
7
|
5af62e5e31dd2670f06635a7b5ea8c3ab916d409
| 24,051,816,861,799 |
b0bf104e19a1344985faac30c9a7d3307b548648
|
/src/main/java/com/besafx/app/rest/TaskAction.java
|
d2fed18625959c01ae1780370b6ed4c298627be8
|
[] |
no_license
|
BESAFX/tafear
|
https://github.com/BESAFX/tafear
|
e71ca9689e0eb50e9f0da51461adbc5d5247a258
|
21f156d57e689731ef6410a2137c299b0fb05d6b
|
refs/heads/master
| 2021-09-16T19:58:42.120000 | 2018-06-24T06:21:43 | 2018-06-24T06:21:55 | 111,115,392 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.besafx.app.rest;
import com.besafx.app.config.CustomException;
import com.besafx.app.config.EmailSender;
import com.besafx.app.entity.*;
import com.besafx.app.entity.enums.CloseType;
import com.besafx.app.entity.enums.OperationType;
import com.besafx.app.service.*;
import com.besafx.app.util.DateConverter;
import com.besafx.app.ws.Notification;
import com.besafx.app.ws.NotificationService;
import org.apache.commons.io.IOUtils;
import org.joda.time.DateTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ClassPathResource;
import org.springframework.http.MediaType;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.nio.charset.Charset;
import java.security.Principal;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
@RestController
@RequestMapping(value = "/api/task/")
public class TaskAction {
private final static Logger log = LoggerFactory.getLogger(TaskAction.class);
@Autowired
private TaskService taskService;
@Autowired
private PersonService personService;
@Autowired
private TaskOperationService taskOperationService;
@Autowired
private TaskCloseRequestService taskCloseRequestService;
@Autowired
private TaskToService taskToService;
@Autowired
private TaskWarnService taskWarnService;
@Autowired
private TaskDeductionService taskDeductionService;
@Autowired
private NotificationService notificationService;
@Autowired
private EmailSender emailSender;
@RequestMapping(value = "increaseEndDate", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
@PreAuthorize("hasRole('ROLE_TASK_UPDATE')")
@Transactional
public Task increaseEndDate(@RequestParam(value = "taskId") Long taskId, @RequestParam(value = "days") int days, @RequestParam(value = "message") String message, Principal principal) {
Person caller = personService.findByEmail(principal.getName());
Task task = taskService.findOne(taskId);
if (task == null) {
throw new CustomException("عفواً ، لا توجد هذة المهمة");
} else {
if (!task.getPerson().findManager().getEmail().equals(principal.getName())) {
if (!task.getPerson().getEmail().equals(principal.getName())) {
throw new CustomException("غير مصرح لك القيام بهذة العملية، فقط جهة التكليف مصرح له بذلك.");
}
}
try {
log.info("تعديل بيانات المهمة وتغيير تاريخ الاستلام واضافة الايام اليها.");
task.setEndDate(new DateTime().plusDays(days).toDate());
task.setCloseType(CloseType.Pending);
task = taskService.save(task);
log.info("حفظ المهمة بنجاح.");
log.info("فحص كل طلبات التمديد المعلقة وقبولها...");
taskCloseRequestService.findByTaskIdAndTypeAndApprovedIsNull(taskId, false).stream().forEach(taskCloseRequest -> {
taskCloseRequest.setApproved(true);
taskCloseRequest.setApprovedDate(new Date());
taskCloseRequestService.save(taskCloseRequest);
});
log.info("فحص كل طلبات الإغلاق المعلقة ورفضها...");
taskCloseRequestService.findByTaskIdAndTypeAndApprovedIsNull(taskId, true).stream().forEach(taskCloseRequest -> {
taskCloseRequest.setApproved(false);
taskCloseRequest.setApprovedDate(new Date());
taskCloseRequestService.save(taskCloseRequest);
});
log.info("فحص الافراد المكلفين، ومعرفة اذا كان عددهم اقل من شخصين يتم وكانت مغلقة عليهم مسبقاً يتم فتحها علي الشخص المكلف تلقائي.");
List<TaskTo> taskTos = taskToService.findByTask(task);
if (taskTos.size() == 1) {
if (taskTos.get(0).getClosed()) {
taskTos.get(0).setClosed(false);
taskTos.get(0).setCloseDate(null);
taskTos.get(0).setProgress(0);
taskTos.get(0).setDegree(null);
taskToService.save(taskTos.get(0));
log.info("ارسال حركة جديدة بشأن فتح المهمة تلقائي على الشخص الوحيد المكلف بهذة المهمة.");
TaskOperation taskOperation = new TaskOperation();
TaskOperation tempTaskOperation = taskOperationService.findTopByTaskIdOrderByCodeDesc(taskId);
if (tempTaskOperation == null) {
taskOperation.setCode(1);
} else {
taskOperation.setCode(tempTaskOperation.getCode() + 1);
}
taskOperation.setDate(new Date());
taskOperation.setSender(caller);
taskOperation.setTask(task);
taskOperation.setType(OperationType.OpenTaskOnPersonAuto);
taskOperation.setContent("فتح المهمة تلقائي على الموظف / " + taskTos.get(0).getPerson().getName() + " بعد تمديد تاريخ استلام المهمة بمقدار " + days + " أيام.");
taskOperationService.save(taskOperation);
log.info("حفظ الحركة الجديدة بنجاح.");
}
}
log.info("ارسال استعلام للعميل بالانتهاء من العملية بنجاح.");
notificationService.notifyOne(Notification
.builder()
.title("العمليات على المهام")
.message("تم تمديد تاريخ إستلام المهمة رقم: " + task.getCode() + " بنجاح")
.type("success")
.icon("fa-battery")
.build(), principal.getName());
log.info("ارسال رسالة الى المكلفين بالمهمة بشأن تمديد استلام المهمة والتاريخ الجديد.");
// ClassPathResource classPathResource = new ClassPathResource("/mailTemplate/ExtendTask.html");
// String email = IOUtils.toString(classPathResource.getInputStream(), Charset.defaultCharset());
// email = email.replaceAll("TASK_CODE", task.getCode().toString());
// email = email.replaceAll("TASK_TITLE", task.getTitle());
// email = email.replaceAll("TASK_CONTENT", task.getContent());
// email = email.replaceAll("TASK_END_DATE", DateConverter.getHijriStringFromDateRTL(task.getEndDate()));
// email = email.replaceAll("TASK_PERSON", task.getPerson().getName());
// emailSender.send("تمديد تاريخ إستلام المهمة رقم: " + "(" + task.getCode() + ")", email, task.getTaskTos().stream().map(to -> to.getPerson().getEmail()).collect(Collectors.toList()));
log.info("تسجيل حركة جديدة عن تمديد تاريخ استلام المهمة وفتحها.");
TaskOperation taskOperation = new TaskOperation();
TaskOperation tempTaskOperation = taskOperationService.findTopByTaskIdOrderByCodeDesc(taskId);
if (tempTaskOperation == null) {
taskOperation.setCode(1);
} else {
taskOperation.setCode(tempTaskOperation.getCode() + 1);
}
taskOperation.setDate(new Date());
taskOperation.setSender(caller);
taskOperation.setTask(task);
taskOperation.setType(OperationType.IncreaseEndDate);
taskOperation.setContent(message);
taskOperationService.save(taskOperation);
log.info("حفظ الحركة الجديدة بنجاح.");
return task;
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
return null;
}
}
}
@RequestMapping(value = "decreaseEndDate", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
@PreAuthorize("hasRole('ROLE_TASK_UPDATE')")
@Transactional
public Task decreaseEndDate(@RequestParam(value = "taskId") Long taskId, @RequestParam(value = "days") int days, @RequestParam(value = "message") String message, Principal principal) throws IOException {
Task task = taskService.findOne(taskId);
if (task == null) {
throw new CustomException("عفواً ، لا توجد هذة المهمة");
} else {
if (task.getCloseType().equals(CloseType.Manual)) {
throw new CustomException("لا يمكن القيام بأي عمليات على مهام الارشيف.");
}
if (!task.getPerson().findManager().getEmail().equals(principal.getName())) {
if (!task.getPerson().getEmail().equals(principal.getName())) {
throw new CustomException("غير مصرح لك القيام بهذة العملية، فقط جهة التكليف مصرح له بذلك.");
}
}
try {
task.setEndDate(new DateTime(task.getEndDate()).minusDays(days).toDate());
task = taskService.save(task);
notificationService.notifyOne(Notification
.builder()
.title("العمليات على المهام")
.message("تم تعجيل تاريخ إستلام المهمة رقم: " + task.getCode() + " بنجاح")
.type("success")
.icon("fa-battery")
.build(), principal.getName());
// ClassPathResource classPathResource = new ClassPathResource("/mailTemplate/ExtendTask.html");
// String email = IOUtils.toString(classPathResource.getInputStream(), Charset.defaultCharset());
// email = email.replaceAll("TASK_CODE", task.getCode().toString());
// email = email.replaceAll("TASK_TITLE", task.getTitle());
// email = email.replaceAll("TASK_CONTENT", task.getContent());
// email = email.replaceAll("TASK_END_DATE", DateConverter.getHijriStringFromDateRTL(task.getEndDate()));
// email = email.replaceAll("TASK_PERSON", task.getPerson().getName());
// emailSender.send("تعجيل تاريخ إستلام المهمة رقم: " + "(" + task.getCode() + ")", email, task.getTaskTos().stream().map(to -> to.getPerson().getEmail()).collect(Collectors.toList()));
TaskOperation taskOperation = new TaskOperation();
TaskOperation tempTaskOperation = taskOperationService.findTopByTaskIdOrderByCodeDesc(taskId);
if (tempTaskOperation == null) {
taskOperation.setCode(1);
} else {
taskOperation.setCode(tempTaskOperation.getCode() + 1);
}
taskOperation.setDate(new Date());
taskOperation.setSender(task.getPerson());
taskOperation.setTask(task);
taskOperation.setType(OperationType.DecreaseEndDate);
taskOperation.setContent(message);
taskOperationService.save(taskOperation);
return task;
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
return null;
}
}
}
@RequestMapping(value = "declineRequest", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
@PreAuthorize("hasRole('ROLE_TASK_UPDATE')")
@Transactional
public TaskCloseRequest declineRequest(@RequestParam(value = "requestId") Long requestId, Principal principal) throws IOException {
TaskCloseRequest taskCloseRequest = taskCloseRequestService.findOne(requestId);
if (taskCloseRequest == null) {
throw new CustomException("عفواً ، لا يوجد هذا الطلب");
} else {
if (taskCloseRequest.getTask().getCloseType().equals(CloseType.Manual)) {
throw new CustomException("لا يمكن القيام بأي عمليات على مهام الارشيف.");
}
if (!taskCloseRequest.getTask().getPerson().findManager().getEmail().equals(principal.getName())) {
if (!taskCloseRequest.getTask().getPerson().getEmail().equals(principal.getName())) {
throw new CustomException("غير مصرح لك القيام بهذة العملية، فقط جهة التكليف مصرح له بذلك.");
}
}
try {
log.info("العمل على الطلب");
taskCloseRequest.setApproved(false);
taskCloseRequest.setApprovedDate(new Date());
taskCloseRequest = taskCloseRequestService.save(taskCloseRequest);
notificationService.notifyOne(Notification
.builder()
.title("العمليات على المهام")
.message("تم رفض الطلب بنجاح")
.type("success")
.icon("fa-battery")
.build(), principal.getName());
log.info("نهاية العمل على الطلب");
log.info("العمل على الحركة");
TaskOperation taskOperation = new TaskOperation();
TaskOperation tempTaskOperation = taskOperationService.findTopByTaskIdOrderByCodeDesc(taskCloseRequest.getTask().getId());
if (tempTaskOperation == null) {
taskOperation.setCode(1);
} else {
taskOperation.setCode(tempTaskOperation.getCode() + 1);
}
taskOperation.setDate(new Date());
taskOperation.setSender(taskCloseRequest.getTask().getPerson());
taskOperation.setTask(taskCloseRequest.getTask());
if (taskCloseRequest.getType()) {
taskOperation.setType(OperationType.DeclineCloseRequest);
taskOperation.setContent("تم رفض طلب إغلاق " + taskCloseRequest.getPerson().getNickname() + " / " + taskCloseRequest.getPerson().getName());
} else {
taskOperation.setType(OperationType.DeclineIncreaseEndDateRequest);
taskOperation.setContent("تم رفض طلب تمديد " + taskCloseRequest.getPerson().getNickname() + " / " + taskCloseRequest.getPerson().getName());
}
taskOperationService.save(taskOperation);
log.info("نهاية العمل على الحركة");
return taskCloseRequest;
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
return null;
}
}
}
@RequestMapping(value = "acceptRequest", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
@PreAuthorize("hasRole('ROLE_TASK_UPDATE')")
@Transactional
public TaskCloseRequest acceptRequest(@RequestParam(value = "requestId") Long requestId, Principal principal) {
TaskCloseRequest taskCloseRequest = taskCloseRequestService.findOne(requestId);
if (taskCloseRequest == null) {
throw new CustomException("عفواً ، لا يوجد هذا الطلب");
} else {
// if (taskCloseRequest.getTask().getCloseType().equals(Task.CloseType.Manual)) {
// throw new CustomException("لا يمكن القيام بأي عمليات على مهام الارشيف.");
// }
if (!taskCloseRequest.getTask().getPerson().findManager().getEmail().equals(principal.getName())) {
if (!taskCloseRequest.getTask().getPerson().getEmail().equals(principal.getName())) {
throw new CustomException("غير مصرح لك القيام بهذة العملية، فقط جهة التكليف مصرح له بذلك.");
}
}
try {
log.info("العمل على الطلب");
taskCloseRequest.setApproved(true);
taskCloseRequest.setApprovedDate(new Date());
taskCloseRequest = taskCloseRequestService.save(taskCloseRequest);
notificationService.notifyOne(Notification
.builder()
.title("العمليات على المهام")
.message("تم قبول الطلب بنجاح")
.type("success")
.icon("fa-battery")
.build(), principal.getName());
log.info("نهاية العمل على الطلب");
log.info("العمل على الحركة");
TaskOperation taskOperation = new TaskOperation();
TaskOperation tempTaskOperation = taskOperationService.findTopByTaskIdOrderByCodeDesc(taskCloseRequest.getTask().getId());
if (tempTaskOperation == null) {
taskOperation.setCode(1);
} else {
taskOperation.setCode(tempTaskOperation.getCode() + 1);
}
taskOperation.setDate(new Date());
taskOperation.setSender(taskCloseRequest.getTask().getPerson());
taskOperation.setTask(taskCloseRequest.getTask());
if (taskCloseRequest.getType()) {
taskOperation.setType(OperationType.AcceptCloseRequest);
taskOperation.setContent("تم قبول طلب إغلاق " + taskCloseRequest.getPerson().getNickname() + " / " + taskCloseRequest.getPerson().getName());
} else {
taskOperation.setType(OperationType.AcceptIncreaseEndDateRequest);
taskOperation.setContent("تم قبول طلب تمديد " + taskCloseRequest.getPerson().getNickname() + " / " + taskCloseRequest.getPerson().getName());
}
taskOperationService.save(taskOperation);
log.info("نهاية العمل على الحركة");
return taskCloseRequest;
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
return null;
}
}
}
@RequestMapping(value = "closeTaskOnPerson", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
@PreAuthorize("hasRole('ROLE_TASK_UPDATE')")
@Transactional
public Task closeTaskOnPerson(@RequestParam(value = "taskId") Long taskId, @RequestParam(value = "personId") Long personId, @RequestParam(value = "message") String message, @RequestParam(value = "degree") TaskTo.PersonDegree degree, Principal principal) throws IOException {
Task task = taskService.findOne(taskId);
if (task == null) {
throw new CustomException("عفواً ، لا توجد هذة المهمة");
} else {
if (task.getCloseType().equals(CloseType.Manual)) {
throw new CustomException("لا يمكن القيام بأي عمليات على مهام الارشيف.");
}
if (!task.getPerson().findManager().getEmail().equals(principal.getName())) {
if (!task.getPerson().getEmail().equals(principal.getName())) {
throw new CustomException("غير مصرح لك القيام بهذة العملية، فقط جهة التكليف مصرح له بذلك.");
}
}
try {
log.info("العمل على تحديث بيانات المهمة");
TaskTo taskTo = taskToService.findByTaskIdAndPersonId(taskId, personId);
taskTo.setCloseDate(new Date());
taskTo.setClosed(true);
taskTo.setDegree(degree);
taskToService.save(taskTo);
notificationService.notifyOne(Notification
.builder()
.title("العمليات على المهام")
.message("تمت العملية بنجاح.")
.type("success")
.icon("fa-power-off")
.build(), principal.getName());
log.info("إنهاء العمل على تحديث بيانات المهمة");
{
log.info("انشاء حركة لإغلاق المهمة على الموظف");
TaskOperation taskOperation = new TaskOperation();
TaskOperation tempTaskOperation = taskOperationService.findTopByTaskIdOrderByCodeDesc(taskId);
if (tempTaskOperation == null) {
taskOperation.setCode(1);
} else {
taskOperation.setCode(tempTaskOperation.getCode() + 1);
}
taskOperation.setDate(new Date());
taskOperation.setSender(task.getPerson());
taskOperation.setTask(task);
taskOperation.setType(OperationType.CloseTaskOnPerson);
taskOperation.setContent(message);
taskOperationService.save(taskOperation);
log.info("إنهاء العمل على الحركة");
}
log.info("فى حال كان الموظفون المكلفين تم إغلاق مهامهم");
if (task.getTaskTos().stream().filter(to -> !to.getClosed()).collect(Collectors.toList()).isEmpty()) {
task.setEndDate(new Date());
task.setCloseType(CloseType.Manual);
taskService.save(task);
log.info("اضافة حركة جديدة لإغلاق المهمة ونقلها إلى الارشيف");
TaskOperation taskOperation = new TaskOperation();
TaskOperation tempTaskOperation = taskOperationService.findTopByTaskIdOrderByCodeDesc(taskId);
if (tempTaskOperation == null) {
taskOperation.setCode(1);
} else {
taskOperation.setCode(tempTaskOperation.getCode() + 1);
}
taskOperation.setDate(new Date());
taskOperation.setSender(task.getPerson());
taskOperation.setTask(task);
taskOperation.setType(OperationType.CloseTaskCompletely);
taskOperation.setContent("تم نقل المهمة إلى الارشيف نظراً لإغلاق المهمة على كل الموظفين.");
taskOperationService.save(taskOperation);
log.info("إنهاء العمل على الحركة");
}
log.info("البحث عن طلبات الاغلاق المعلقة والموافقة عليها...");
taskCloseRequestService.findByTaskIdAndPersonIdAndTypeAndApprovedIsNull(taskId, personId, true).stream().forEach(taskCloseRequest -> {
taskCloseRequest.setApproved(true);
taskCloseRequest.setApprovedDate(new Date());
taskCloseRequestService.save(taskCloseRequest);
});
log.info("البحث عن طلبات التمديد المعلقة ورفضها...");
taskCloseRequestService.findByTaskIdAndPersonIdAndTypeAndApprovedIsNull(taskId, personId, false).stream().forEach(taskCloseRequest -> {
taskCloseRequest.setApproved(false);
taskCloseRequest.setApprovedDate(new Date());
taskCloseRequestService.save(taskCloseRequest);
});
return task;
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
return null;
}
}
}
@RequestMapping(value = "closeTaskCompletely", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
@PreAuthorize("hasRole('ROLE_TASK_UPDATE')")
@Transactional
public Task closeTaskCompletely(@RequestParam(value = "taskId") Long taskId, Principal principal) {
Task task = taskService.findOne(taskId);
if (task == null) {
throw new CustomException("عفواً ، لا توجد هذة المهمة");
} else {
if (task.getCloseType().equals(CloseType.Manual)) {
throw new CustomException("لا يمكن القيام بأي عمليات على مهام الارشيف.");
}
if (!task.getPerson().findManager().getEmail().equals(principal.getName())) {
if (!task.getPerson().getEmail().equals(principal.getName())) {
throw new CustomException("غير مصرح لك القيام بهذة العملية، فقط جهة التكليف مصرح له بذلك.");
}
}
try {
log.info("اضافة حركة جديدة لإغلاق المهمة نهائي");
TaskOperation taskOperation = new TaskOperation();
TaskOperation tempTaskOperation = taskOperationService.findTopByTaskIdOrderByCodeDesc(taskId);
if (tempTaskOperation == null) {
taskOperation.setCode(1);
} else {
taskOperation.setCode(tempTaskOperation.getCode() + 1);
}
taskOperation.setDate(new Date());
taskOperation.setSender(task.getPerson());
taskOperation.setTask(task);
taskOperation.setType(OperationType.CloseTaskCompletely);
taskOperation.setContent("إغلاق المهمة نهائياً - نقل إلى الارشيف");
taskOperationService.save(taskOperation);
log.info("إنهاء العمل على الحركة");
log.info("تحديث تاريخ استلام المهمة الى تاريخ اليوم وهو وقت الاغلاق");
task.setEndDate(new Date());
task.setCloseType(CloseType.Manual);
taskService.save(task);
log.info("الموافقة على كل طلبات الاغلاق الخاصة بهذة المهمة");
taskCloseRequestService.findByTaskIdAndTypeAndApprovedIsNull(taskId, true).forEach(request -> {
request.setApproved(true);
request.setApprovedDate(new Date());
taskCloseRequestService.save(request);
});
log.info("رفض كل طلبات التمديد الخاصة بهذة المهمة");
taskCloseRequestService.findByTaskIdAndTypeAndApprovedIsNull(taskId, false).forEach(request -> {
request.setApproved(false);
request.setApprovedDate(new Date());
taskCloseRequestService.save(request);
});
log.info("إغلاق المهمة على كل الموظفين");
taskToService.findByTask(task).stream().filter(taskTo -> !taskTo.getClosed()).forEach(taskTo -> {
taskTo.setClosed(true);
taskTo.setCloseDate(new Date());
taskTo.setDegree(TaskTo.PersonDegree.C);
taskToService.save(taskTo);
});
log.info("اعلام المستخدم بنجاح العملية.");
notificationService.notifyOne(Notification
.builder()
.title("العمليات على المهام")
.message("تم نقل المهمة الى الارشيف بنجاح.")
.type("success")
.icon("fa-archive")
.build(), principal.getName());
return task;
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
return null;
}
}
}
@RequestMapping(value = "addPerson", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
@PreAuthorize("hasRole('ROLE_TASK_UPDATE')")
@Transactional
public Task addPerson(@RequestParam(value = "taskId") Long taskId, @RequestParam(value = "personId") Long personId, @RequestParam(value = "message") String message, Principal principal) throws IOException {
Task task = taskService.findOne(taskId);
if (task.getCloseType().equals(CloseType.Manual)) {
throw new CustomException("لا يمكن القيام بأي عمليات على مهام الارشيف.");
}
Person person = personService.findOne(personId);
if (!task.getPerson().findManager().getEmail().equals(principal.getName())) {
if (!task.getPerson().getEmail().equals(principal.getName())) {
throw new CustomException("غير مصرح لك القيام بهذة العملية، فقط جهة التكليف مصرح له بذلك.");
}
}
if (taskToService.findByTaskAndPerson(task, person) != null) {
throw new CustomException("هذا الموظف مكلف بالفعل بهذة المهمة.");
}
try {
TaskTo taskTo = new TaskTo();
taskTo.setDegree(null);
taskTo.setProgress(0);
taskTo.setClosed(false);
taskTo.setCloseDate(null);
taskTo.setTask(task);
taskTo.setPerson(person);
taskToService.save(taskTo);
notificationService.notifyOne(Notification
.builder()
.title("العمليات على المهام")
.message("تم اضافة التكليف الجديد بنجاح")
.type("success")
.icon("fa-black-tie")
.build(), principal.getName());
ClassPathResource classPathResource = new ClassPathResource("/mailTemplate/NewTask.html");
String email = IOUtils.toString(classPathResource.getInputStream(), Charset.defaultCharset());
email = email.replaceAll("TASK_CODE", task.getCode().toString());
email = email.replaceAll("TASK_TITLE", task.getTitle());
email = email.replaceAll("TASK_CONTENT", task.getContent());
email = email.replaceAll("TASK_END_DATE", DateConverter.getHijriStringFromDateRTL(task.getEndDate()));
email = email.replaceAll("TASK_PERSON", task.getPerson().getName());
emailSender.send("مهمة جديدة رقم: " + "(" + task.getCode() + ")", email, person.getEmail());
log.info("اضافة الحركة الخاصة بالتحويل الى موظف جديد");
TaskOperation taskOperation = new TaskOperation();
TaskOperation tempTaskOperation = taskOperationService.findTopByTaskIdOrderByCodeDesc(task.getId());
if (tempTaskOperation == null) {
taskOperation.setCode(1);
} else {
taskOperation.setCode(tempTaskOperation.getCode() + 1);
}
taskOperation.setDate(new Date());
taskOperation.setSender(task.getPerson());
taskOperation.setTask(task);
taskOperation.setType(OperationType.AddPerson);
taskOperation.setContent("تحويل المهمة إلى " + person.getNickname() + " / " + person.getName() + " [ " + message + " ] ");
taskOperationService.save(taskOperation);
log.info("تم اضافة الحركة الجديدة بنجاح.");
return task;
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
return null;
}
}
@RequestMapping(value = "removePerson", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
@PreAuthorize("hasRole('ROLE_TASK_UPDATE')")
@Transactional
public Boolean removePerson(@RequestParam(value = "taskId") Long taskId, @RequestParam(value = "personId") Long personId, @RequestParam(value = "message") String message, Principal principal) throws IOException {
Task task = taskService.findOne(taskId);
if (task.getCloseType().equals(CloseType.Manual)) {
throw new CustomException("لا يمكن القيام بأي عمليات على مهام الارشيف.");
}
Person person = personService.findOne(personId);
if (!task.getPerson().findManager().getEmail().equals(principal.getName())) {
if (!task.getPerson().getEmail().equals(principal.getName())) {
throw new CustomException("غير مصرح لك القيام بهذة العملية، فقط جهة التكليف مصرح له بذلك.");
}
}
TaskTo taskTo = taskToService.findByTaskAndPerson(task, person);
if (taskTo == null) {
throw new CustomException("هذا الموظف غير مكلف بهذة المهمة.");
}
try {
taskToService.delete(taskTo);
notificationService.notifyOne(Notification
.builder()
.title("العمليات على المهام")
.message("تم حذف التكليف بنجاح")
.type("success")
.icon("fa-trash")
.build(), principal.getName());
log.info("اضافة الحركة الخاصة بحذف موظف من التكليف");
TaskOperation taskOperation = new TaskOperation();
TaskOperation tempTaskOperation = taskOperationService.findTopByTaskIdOrderByCodeDesc(task.getId());
if (tempTaskOperation == null) {
taskOperation.setCode(1);
} else {
taskOperation.setCode(tempTaskOperation.getCode() + 1);
}
taskOperation.setDate(new Date());
taskOperation.setSender(task.getPerson());
taskOperation.setTask(task);
taskOperation.setType(OperationType.AddPerson);
taskOperation.setContent("حذف تكليف المهمة من " + person.getNickname() + " / " + person.getName() + " [ " + message + " ] ");
taskOperationService.save(taskOperation);
log.info("تم اضافة الحركة الجديدة بنجاح.");
return true;
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
return false;
}
}
@RequestMapping(value = "addWarn", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
@PreAuthorize("hasRole('ROLE_TASK_UPDATE')")
@Transactional
public TaskWarn addWarn(@RequestParam(value = "taskId") Long taskId, @RequestParam(value = "personId") Long personId, @RequestParam(value = "message") String message, Principal principal) throws IOException {
Task task = taskService.findOne(taskId);
if (task.getCloseType().equals(CloseType.Manual)) {
throw new CustomException("لا يمكن القيام بأي عمليات على مهام الارشيف.");
}
Person person = personService.findOne(personId);
if (!task.getPerson().findManager().getEmail().equals(principal.getName())) {
if (!task.getPerson().getEmail().equals(principal.getName())) {
throw new CustomException("غير مصرح لك القيام بهذة العملية، فقط جهة التكليف مصرح له بذلك.");
}
}
try {
TaskWarn taskWarn = new TaskWarn();
TaskWarn tempTaskWarn = taskWarnService.findTopByTaskAndToPersonOrderByCodeDesc(task, person);
if (tempTaskWarn == null) {
taskWarn.setCode(1);
} else {
taskWarn.setCode(tempTaskWarn.getCode() + 1);
}
taskWarn.setDate(new Date());
taskWarn.setType(TaskWarn.TaskWarnType.Manual);
taskWarn.setToPerson(person);
taskWarn.setTask(task);
taskWarn.setContent(message);
taskWarn = taskWarnService.save(taskWarn);
notificationService.notifyOne(Notification
.builder()
.title("العمليات على المهام")
.message("تم إرسال التحذير بنجاح")
.type("success")
.icon("fa-black-tie")
.build(), person.getName());
ClassPathResource classPathResource = new ClassPathResource("/mailTemplate/NoTaskOperationsWarning.html");
String mail = org.apache.commons.io.IOUtils.toString(classPathResource.getInputStream(), Charset.defaultCharset());
mail = mail.replaceAll("MESSAGE", "تحذير من " + task.getPerson().getNickname() + " / " + task.getPerson().getName() + " بشأن المهمة رقم " + "(" + task.getCode() + ")" + " وفيما يلي محتوى التحذير" + "<br/>" + "<u>" + message + "</u>");
String title = "تحذير من " + task.getPerson().getNickname() + " / " + task.getPerson().getName();
emailSender.send(title, mail, person.getEmail());
return taskWarn;
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
return null;
}
}
@RequestMapping(value = "addDeduction", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
@PreAuthorize("hasRole('ROLE_TASK_UPDATE')")
@Transactional
public TaskDeduction addDeduction(@RequestParam(value = "taskId") Long taskId, @RequestParam(value = "personId") Long personId, @RequestParam(value = "message") String message, @RequestParam(value = "deduction") Double deduction, Principal principal) throws IOException {
Task task = taskService.findOne(taskId);
if (task.getCloseType().equals(CloseType.Manual)) {
throw new CustomException("لا يمكن القيام بأي عمليات على مهام الارشيف.");
}
Person person = personService.findOne(personId);
if (!task.getPerson().findManager().getEmail().equals(principal.getName())) {
if (!task.getPerson().getEmail().equals(principal.getName())) {
throw new CustomException("غير مصرح لك القيام بهذة العملية، فقط جهة التكليف مصرح له بذلك.");
}
}
try {
TaskDeduction taskDeduction = new TaskDeduction();
TaskDeduction tempTaskDeduction = taskDeductionService.findTopByTaskAndToPersonOrderByCodeDesc(task, person);
if (tempTaskDeduction == null) {
taskDeduction.setCode(1);
} else {
taskDeduction.setCode(tempTaskDeduction.getCode() + 1);
}
taskDeduction.setDate(new Date());
taskDeduction.setType(TaskDeduction.TaskDeductionType.Manual);
taskDeduction.setToPerson(person);
taskDeduction.setTask(task);
taskDeduction.setContent(message);
taskDeduction.setDeduction(deduction);
taskDeduction = taskDeductionService.save(taskDeduction);
notificationService.notifyOne(Notification
.builder()
.title("العمليات على المهام")
.message("تم إرسال الخصم بنجاح")
.type("success")
.icon("fa-black-tie")
.build(), person.getName());
ClassPathResource classPathResource = new ClassPathResource("/mailTemplate/NoTaskOperationsWarning.html");
String mail = org.apache.commons.io.IOUtils.toString(classPathResource.getInputStream(), Charset.defaultCharset());
mail = mail.replaceAll("MESSAGE", "خصم من " + task.getPerson().getNickname() + " / " + task.getPerson().getName() + " بشأن المهمة رقم " + "(" + task.getCode() + ")" + " وفيما يلي محتوى الخصم" + "<br/>" + "<u>" + message + "</u>");
String title = "خصم من " + task.getPerson().getNickname() + " / " + task.getPerson().getName() + " بقيمة " + taskDeduction.getDeduction() + " ريال سعودي";
emailSender.send(title, mail, taskDeduction.getToPerson().getEmail());
return taskDeduction;
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
return null;
}
}
@RequestMapping(value = "openTaskOnPerson", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
@PreAuthorize("hasRole('ROLE_TASK_UPDATE')")
@Transactional
public TaskTo openTaskOnPerson(@RequestParam(value = "taskId") Long taskId, @RequestParam(value = "personId") Long personId, @RequestParam(value = "message") String message, Principal principal) throws IOException {
Person caller = personService.findByEmail(principal.getName());
Task task = taskService.findOne(taskId);
if (task.getCloseType().equals(CloseType.Manual)) {
throw new CustomException("لا يمكن القيام بأي عمليات على مهام الارشيف.");
}
Person person = personService.findOne(personId);
if (!task.getPerson().findManager().getEmail().equals(principal.getName())) {
if (!task.getPerson().getEmail().equals(principal.getName())) {
throw new CustomException("غير مصرح لك القيام بهذة العملية، فقط جهة التكليف مصرح له بذلك.");
}
}
log.info("فحص إذا كانت المهمة تحت التنفيذ...");
if (!task.getCloseType().equals(CloseType.Pending)) {
throw new CustomException("لا يمكن فتح مهمة مغلقة على الموظف، حاول تمديد المهمة أولاً.");
}
TaskTo taskTo = taskToService.findByTaskAndPerson(task, person);
if (taskTo == null) {
throw new CustomException("عفواً، هذا الموظف غير موجود من ضمن فريق عمل المهمة.");
}
try {
log.info("إغادة فتح المهمة على الموظف بعد التأكد من وجوده من ضمن فريق عمل المهمة.");
taskTo.setClosed(false);
taskTo.setCloseDate(null);
taskTo.setDegree(null);
taskTo.setProgress(0);
taskTo = taskToService.save(taskTo);
log.info("إعلام المستدعي بنجاح العملية.");
notificationService.notifyOne(Notification
.builder()
.title("العمليات على المهام")
.message("تم فتح المهمة على الموظف بنجاح.")
.type("success")
.icon("fa-black-tie")
.build(), person.getName());
log.info("إضافة حركة جديدة بشأن فتح المهمة على الموظف.");
TaskOperation taskOperation = new TaskOperation();
TaskOperation tempTaskOperation = taskOperationService.findTopByTaskIdOrderByCodeDesc(task.getId());
if (tempTaskOperation == null) {
taskOperation.setCode(1);
} else {
taskOperation.setCode(tempTaskOperation.getCode() + 1);
}
taskOperation.setDate(new Date());
taskOperation.setSender(caller);
taskOperation.setTask(task);
taskOperation.setType(OperationType.OpenTaskOnPerson);
taskOperation.setContent("فتح المهمة على الموظف / " + person.getName() + " [ " + message + " ] ");
taskOperationService.save(taskOperation);
log.info("تم حفظ الحركة الجديدة بنجاح.");
return taskTo;
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
return null;
}
}
}
|
UTF-8
|
Java
| 45,528 |
java
|
TaskAction.java
|
Java
|
[] | null |
[] |
package com.besafx.app.rest;
import com.besafx.app.config.CustomException;
import com.besafx.app.config.EmailSender;
import com.besafx.app.entity.*;
import com.besafx.app.entity.enums.CloseType;
import com.besafx.app.entity.enums.OperationType;
import com.besafx.app.service.*;
import com.besafx.app.util.DateConverter;
import com.besafx.app.ws.Notification;
import com.besafx.app.ws.NotificationService;
import org.apache.commons.io.IOUtils;
import org.joda.time.DateTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ClassPathResource;
import org.springframework.http.MediaType;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.nio.charset.Charset;
import java.security.Principal;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
@RestController
@RequestMapping(value = "/api/task/")
public class TaskAction {
private final static Logger log = LoggerFactory.getLogger(TaskAction.class);
@Autowired
private TaskService taskService;
@Autowired
private PersonService personService;
@Autowired
private TaskOperationService taskOperationService;
@Autowired
private TaskCloseRequestService taskCloseRequestService;
@Autowired
private TaskToService taskToService;
@Autowired
private TaskWarnService taskWarnService;
@Autowired
private TaskDeductionService taskDeductionService;
@Autowired
private NotificationService notificationService;
@Autowired
private EmailSender emailSender;
@RequestMapping(value = "increaseEndDate", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
@PreAuthorize("hasRole('ROLE_TASK_UPDATE')")
@Transactional
public Task increaseEndDate(@RequestParam(value = "taskId") Long taskId, @RequestParam(value = "days") int days, @RequestParam(value = "message") String message, Principal principal) {
Person caller = personService.findByEmail(principal.getName());
Task task = taskService.findOne(taskId);
if (task == null) {
throw new CustomException("عفواً ، لا توجد هذة المهمة");
} else {
if (!task.getPerson().findManager().getEmail().equals(principal.getName())) {
if (!task.getPerson().getEmail().equals(principal.getName())) {
throw new CustomException("غير مصرح لك القيام بهذة العملية، فقط جهة التكليف مصرح له بذلك.");
}
}
try {
log.info("تعديل بيانات المهمة وتغيير تاريخ الاستلام واضافة الايام اليها.");
task.setEndDate(new DateTime().plusDays(days).toDate());
task.setCloseType(CloseType.Pending);
task = taskService.save(task);
log.info("حفظ المهمة بنجاح.");
log.info("فحص كل طلبات التمديد المعلقة وقبولها...");
taskCloseRequestService.findByTaskIdAndTypeAndApprovedIsNull(taskId, false).stream().forEach(taskCloseRequest -> {
taskCloseRequest.setApproved(true);
taskCloseRequest.setApprovedDate(new Date());
taskCloseRequestService.save(taskCloseRequest);
});
log.info("فحص كل طلبات الإغلاق المعلقة ورفضها...");
taskCloseRequestService.findByTaskIdAndTypeAndApprovedIsNull(taskId, true).stream().forEach(taskCloseRequest -> {
taskCloseRequest.setApproved(false);
taskCloseRequest.setApprovedDate(new Date());
taskCloseRequestService.save(taskCloseRequest);
});
log.info("فحص الافراد المكلفين، ومعرفة اذا كان عددهم اقل من شخصين يتم وكانت مغلقة عليهم مسبقاً يتم فتحها علي الشخص المكلف تلقائي.");
List<TaskTo> taskTos = taskToService.findByTask(task);
if (taskTos.size() == 1) {
if (taskTos.get(0).getClosed()) {
taskTos.get(0).setClosed(false);
taskTos.get(0).setCloseDate(null);
taskTos.get(0).setProgress(0);
taskTos.get(0).setDegree(null);
taskToService.save(taskTos.get(0));
log.info("ارسال حركة جديدة بشأن فتح المهمة تلقائي على الشخص الوحيد المكلف بهذة المهمة.");
TaskOperation taskOperation = new TaskOperation();
TaskOperation tempTaskOperation = taskOperationService.findTopByTaskIdOrderByCodeDesc(taskId);
if (tempTaskOperation == null) {
taskOperation.setCode(1);
} else {
taskOperation.setCode(tempTaskOperation.getCode() + 1);
}
taskOperation.setDate(new Date());
taskOperation.setSender(caller);
taskOperation.setTask(task);
taskOperation.setType(OperationType.OpenTaskOnPersonAuto);
taskOperation.setContent("فتح المهمة تلقائي على الموظف / " + taskTos.get(0).getPerson().getName() + " بعد تمديد تاريخ استلام المهمة بمقدار " + days + " أيام.");
taskOperationService.save(taskOperation);
log.info("حفظ الحركة الجديدة بنجاح.");
}
}
log.info("ارسال استعلام للعميل بالانتهاء من العملية بنجاح.");
notificationService.notifyOne(Notification
.builder()
.title("العمليات على المهام")
.message("تم تمديد تاريخ إستلام المهمة رقم: " + task.getCode() + " بنجاح")
.type("success")
.icon("fa-battery")
.build(), principal.getName());
log.info("ارسال رسالة الى المكلفين بالمهمة بشأن تمديد استلام المهمة والتاريخ الجديد.");
// ClassPathResource classPathResource = new ClassPathResource("/mailTemplate/ExtendTask.html");
// String email = IOUtils.toString(classPathResource.getInputStream(), Charset.defaultCharset());
// email = email.replaceAll("TASK_CODE", task.getCode().toString());
// email = email.replaceAll("TASK_TITLE", task.getTitle());
// email = email.replaceAll("TASK_CONTENT", task.getContent());
// email = email.replaceAll("TASK_END_DATE", DateConverter.getHijriStringFromDateRTL(task.getEndDate()));
// email = email.replaceAll("TASK_PERSON", task.getPerson().getName());
// emailSender.send("تمديد تاريخ إستلام المهمة رقم: " + "(" + task.getCode() + ")", email, task.getTaskTos().stream().map(to -> to.getPerson().getEmail()).collect(Collectors.toList()));
log.info("تسجيل حركة جديدة عن تمديد تاريخ استلام المهمة وفتحها.");
TaskOperation taskOperation = new TaskOperation();
TaskOperation tempTaskOperation = taskOperationService.findTopByTaskIdOrderByCodeDesc(taskId);
if (tempTaskOperation == null) {
taskOperation.setCode(1);
} else {
taskOperation.setCode(tempTaskOperation.getCode() + 1);
}
taskOperation.setDate(new Date());
taskOperation.setSender(caller);
taskOperation.setTask(task);
taskOperation.setType(OperationType.IncreaseEndDate);
taskOperation.setContent(message);
taskOperationService.save(taskOperation);
log.info("حفظ الحركة الجديدة بنجاح.");
return task;
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
return null;
}
}
}
@RequestMapping(value = "decreaseEndDate", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
@PreAuthorize("hasRole('ROLE_TASK_UPDATE')")
@Transactional
public Task decreaseEndDate(@RequestParam(value = "taskId") Long taskId, @RequestParam(value = "days") int days, @RequestParam(value = "message") String message, Principal principal) throws IOException {
Task task = taskService.findOne(taskId);
if (task == null) {
throw new CustomException("عفواً ، لا توجد هذة المهمة");
} else {
if (task.getCloseType().equals(CloseType.Manual)) {
throw new CustomException("لا يمكن القيام بأي عمليات على مهام الارشيف.");
}
if (!task.getPerson().findManager().getEmail().equals(principal.getName())) {
if (!task.getPerson().getEmail().equals(principal.getName())) {
throw new CustomException("غير مصرح لك القيام بهذة العملية، فقط جهة التكليف مصرح له بذلك.");
}
}
try {
task.setEndDate(new DateTime(task.getEndDate()).minusDays(days).toDate());
task = taskService.save(task);
notificationService.notifyOne(Notification
.builder()
.title("العمليات على المهام")
.message("تم تعجيل تاريخ إستلام المهمة رقم: " + task.getCode() + " بنجاح")
.type("success")
.icon("fa-battery")
.build(), principal.getName());
// ClassPathResource classPathResource = new ClassPathResource("/mailTemplate/ExtendTask.html");
// String email = IOUtils.toString(classPathResource.getInputStream(), Charset.defaultCharset());
// email = email.replaceAll("TASK_CODE", task.getCode().toString());
// email = email.replaceAll("TASK_TITLE", task.getTitle());
// email = email.replaceAll("TASK_CONTENT", task.getContent());
// email = email.replaceAll("TASK_END_DATE", DateConverter.getHijriStringFromDateRTL(task.getEndDate()));
// email = email.replaceAll("TASK_PERSON", task.getPerson().getName());
// emailSender.send("تعجيل تاريخ إستلام المهمة رقم: " + "(" + task.getCode() + ")", email, task.getTaskTos().stream().map(to -> to.getPerson().getEmail()).collect(Collectors.toList()));
TaskOperation taskOperation = new TaskOperation();
TaskOperation tempTaskOperation = taskOperationService.findTopByTaskIdOrderByCodeDesc(taskId);
if (tempTaskOperation == null) {
taskOperation.setCode(1);
} else {
taskOperation.setCode(tempTaskOperation.getCode() + 1);
}
taskOperation.setDate(new Date());
taskOperation.setSender(task.getPerson());
taskOperation.setTask(task);
taskOperation.setType(OperationType.DecreaseEndDate);
taskOperation.setContent(message);
taskOperationService.save(taskOperation);
return task;
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
return null;
}
}
}
@RequestMapping(value = "declineRequest", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
@PreAuthorize("hasRole('ROLE_TASK_UPDATE')")
@Transactional
public TaskCloseRequest declineRequest(@RequestParam(value = "requestId") Long requestId, Principal principal) throws IOException {
TaskCloseRequest taskCloseRequest = taskCloseRequestService.findOne(requestId);
if (taskCloseRequest == null) {
throw new CustomException("عفواً ، لا يوجد هذا الطلب");
} else {
if (taskCloseRequest.getTask().getCloseType().equals(CloseType.Manual)) {
throw new CustomException("لا يمكن القيام بأي عمليات على مهام الارشيف.");
}
if (!taskCloseRequest.getTask().getPerson().findManager().getEmail().equals(principal.getName())) {
if (!taskCloseRequest.getTask().getPerson().getEmail().equals(principal.getName())) {
throw new CustomException("غير مصرح لك القيام بهذة العملية، فقط جهة التكليف مصرح له بذلك.");
}
}
try {
log.info("العمل على الطلب");
taskCloseRequest.setApproved(false);
taskCloseRequest.setApprovedDate(new Date());
taskCloseRequest = taskCloseRequestService.save(taskCloseRequest);
notificationService.notifyOne(Notification
.builder()
.title("العمليات على المهام")
.message("تم رفض الطلب بنجاح")
.type("success")
.icon("fa-battery")
.build(), principal.getName());
log.info("نهاية العمل على الطلب");
log.info("العمل على الحركة");
TaskOperation taskOperation = new TaskOperation();
TaskOperation tempTaskOperation = taskOperationService.findTopByTaskIdOrderByCodeDesc(taskCloseRequest.getTask().getId());
if (tempTaskOperation == null) {
taskOperation.setCode(1);
} else {
taskOperation.setCode(tempTaskOperation.getCode() + 1);
}
taskOperation.setDate(new Date());
taskOperation.setSender(taskCloseRequest.getTask().getPerson());
taskOperation.setTask(taskCloseRequest.getTask());
if (taskCloseRequest.getType()) {
taskOperation.setType(OperationType.DeclineCloseRequest);
taskOperation.setContent("تم رفض طلب إغلاق " + taskCloseRequest.getPerson().getNickname() + " / " + taskCloseRequest.getPerson().getName());
} else {
taskOperation.setType(OperationType.DeclineIncreaseEndDateRequest);
taskOperation.setContent("تم رفض طلب تمديد " + taskCloseRequest.getPerson().getNickname() + " / " + taskCloseRequest.getPerson().getName());
}
taskOperationService.save(taskOperation);
log.info("نهاية العمل على الحركة");
return taskCloseRequest;
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
return null;
}
}
}
@RequestMapping(value = "acceptRequest", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
@PreAuthorize("hasRole('ROLE_TASK_UPDATE')")
@Transactional
public TaskCloseRequest acceptRequest(@RequestParam(value = "requestId") Long requestId, Principal principal) {
TaskCloseRequest taskCloseRequest = taskCloseRequestService.findOne(requestId);
if (taskCloseRequest == null) {
throw new CustomException("عفواً ، لا يوجد هذا الطلب");
} else {
// if (taskCloseRequest.getTask().getCloseType().equals(Task.CloseType.Manual)) {
// throw new CustomException("لا يمكن القيام بأي عمليات على مهام الارشيف.");
// }
if (!taskCloseRequest.getTask().getPerson().findManager().getEmail().equals(principal.getName())) {
if (!taskCloseRequest.getTask().getPerson().getEmail().equals(principal.getName())) {
throw new CustomException("غير مصرح لك القيام بهذة العملية، فقط جهة التكليف مصرح له بذلك.");
}
}
try {
log.info("العمل على الطلب");
taskCloseRequest.setApproved(true);
taskCloseRequest.setApprovedDate(new Date());
taskCloseRequest = taskCloseRequestService.save(taskCloseRequest);
notificationService.notifyOne(Notification
.builder()
.title("العمليات على المهام")
.message("تم قبول الطلب بنجاح")
.type("success")
.icon("fa-battery")
.build(), principal.getName());
log.info("نهاية العمل على الطلب");
log.info("العمل على الحركة");
TaskOperation taskOperation = new TaskOperation();
TaskOperation tempTaskOperation = taskOperationService.findTopByTaskIdOrderByCodeDesc(taskCloseRequest.getTask().getId());
if (tempTaskOperation == null) {
taskOperation.setCode(1);
} else {
taskOperation.setCode(tempTaskOperation.getCode() + 1);
}
taskOperation.setDate(new Date());
taskOperation.setSender(taskCloseRequest.getTask().getPerson());
taskOperation.setTask(taskCloseRequest.getTask());
if (taskCloseRequest.getType()) {
taskOperation.setType(OperationType.AcceptCloseRequest);
taskOperation.setContent("تم قبول طلب إغلاق " + taskCloseRequest.getPerson().getNickname() + " / " + taskCloseRequest.getPerson().getName());
} else {
taskOperation.setType(OperationType.AcceptIncreaseEndDateRequest);
taskOperation.setContent("تم قبول طلب تمديد " + taskCloseRequest.getPerson().getNickname() + " / " + taskCloseRequest.getPerson().getName());
}
taskOperationService.save(taskOperation);
log.info("نهاية العمل على الحركة");
return taskCloseRequest;
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
return null;
}
}
}
@RequestMapping(value = "closeTaskOnPerson", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
@PreAuthorize("hasRole('ROLE_TASK_UPDATE')")
@Transactional
public Task closeTaskOnPerson(@RequestParam(value = "taskId") Long taskId, @RequestParam(value = "personId") Long personId, @RequestParam(value = "message") String message, @RequestParam(value = "degree") TaskTo.PersonDegree degree, Principal principal) throws IOException {
Task task = taskService.findOne(taskId);
if (task == null) {
throw new CustomException("عفواً ، لا توجد هذة المهمة");
} else {
if (task.getCloseType().equals(CloseType.Manual)) {
throw new CustomException("لا يمكن القيام بأي عمليات على مهام الارشيف.");
}
if (!task.getPerson().findManager().getEmail().equals(principal.getName())) {
if (!task.getPerson().getEmail().equals(principal.getName())) {
throw new CustomException("غير مصرح لك القيام بهذة العملية، فقط جهة التكليف مصرح له بذلك.");
}
}
try {
log.info("العمل على تحديث بيانات المهمة");
TaskTo taskTo = taskToService.findByTaskIdAndPersonId(taskId, personId);
taskTo.setCloseDate(new Date());
taskTo.setClosed(true);
taskTo.setDegree(degree);
taskToService.save(taskTo);
notificationService.notifyOne(Notification
.builder()
.title("العمليات على المهام")
.message("تمت العملية بنجاح.")
.type("success")
.icon("fa-power-off")
.build(), principal.getName());
log.info("إنهاء العمل على تحديث بيانات المهمة");
{
log.info("انشاء حركة لإغلاق المهمة على الموظف");
TaskOperation taskOperation = new TaskOperation();
TaskOperation tempTaskOperation = taskOperationService.findTopByTaskIdOrderByCodeDesc(taskId);
if (tempTaskOperation == null) {
taskOperation.setCode(1);
} else {
taskOperation.setCode(tempTaskOperation.getCode() + 1);
}
taskOperation.setDate(new Date());
taskOperation.setSender(task.getPerson());
taskOperation.setTask(task);
taskOperation.setType(OperationType.CloseTaskOnPerson);
taskOperation.setContent(message);
taskOperationService.save(taskOperation);
log.info("إنهاء العمل على الحركة");
}
log.info("فى حال كان الموظفون المكلفين تم إغلاق مهامهم");
if (task.getTaskTos().stream().filter(to -> !to.getClosed()).collect(Collectors.toList()).isEmpty()) {
task.setEndDate(new Date());
task.setCloseType(CloseType.Manual);
taskService.save(task);
log.info("اضافة حركة جديدة لإغلاق المهمة ونقلها إلى الارشيف");
TaskOperation taskOperation = new TaskOperation();
TaskOperation tempTaskOperation = taskOperationService.findTopByTaskIdOrderByCodeDesc(taskId);
if (tempTaskOperation == null) {
taskOperation.setCode(1);
} else {
taskOperation.setCode(tempTaskOperation.getCode() + 1);
}
taskOperation.setDate(new Date());
taskOperation.setSender(task.getPerson());
taskOperation.setTask(task);
taskOperation.setType(OperationType.CloseTaskCompletely);
taskOperation.setContent("تم نقل المهمة إلى الارشيف نظراً لإغلاق المهمة على كل الموظفين.");
taskOperationService.save(taskOperation);
log.info("إنهاء العمل على الحركة");
}
log.info("البحث عن طلبات الاغلاق المعلقة والموافقة عليها...");
taskCloseRequestService.findByTaskIdAndPersonIdAndTypeAndApprovedIsNull(taskId, personId, true).stream().forEach(taskCloseRequest -> {
taskCloseRequest.setApproved(true);
taskCloseRequest.setApprovedDate(new Date());
taskCloseRequestService.save(taskCloseRequest);
});
log.info("البحث عن طلبات التمديد المعلقة ورفضها...");
taskCloseRequestService.findByTaskIdAndPersonIdAndTypeAndApprovedIsNull(taskId, personId, false).stream().forEach(taskCloseRequest -> {
taskCloseRequest.setApproved(false);
taskCloseRequest.setApprovedDate(new Date());
taskCloseRequestService.save(taskCloseRequest);
});
return task;
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
return null;
}
}
}
@RequestMapping(value = "closeTaskCompletely", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
@PreAuthorize("hasRole('ROLE_TASK_UPDATE')")
@Transactional
public Task closeTaskCompletely(@RequestParam(value = "taskId") Long taskId, Principal principal) {
Task task = taskService.findOne(taskId);
if (task == null) {
throw new CustomException("عفواً ، لا توجد هذة المهمة");
} else {
if (task.getCloseType().equals(CloseType.Manual)) {
throw new CustomException("لا يمكن القيام بأي عمليات على مهام الارشيف.");
}
if (!task.getPerson().findManager().getEmail().equals(principal.getName())) {
if (!task.getPerson().getEmail().equals(principal.getName())) {
throw new CustomException("غير مصرح لك القيام بهذة العملية، فقط جهة التكليف مصرح له بذلك.");
}
}
try {
log.info("اضافة حركة جديدة لإغلاق المهمة نهائي");
TaskOperation taskOperation = new TaskOperation();
TaskOperation tempTaskOperation = taskOperationService.findTopByTaskIdOrderByCodeDesc(taskId);
if (tempTaskOperation == null) {
taskOperation.setCode(1);
} else {
taskOperation.setCode(tempTaskOperation.getCode() + 1);
}
taskOperation.setDate(new Date());
taskOperation.setSender(task.getPerson());
taskOperation.setTask(task);
taskOperation.setType(OperationType.CloseTaskCompletely);
taskOperation.setContent("إغلاق المهمة نهائياً - نقل إلى الارشيف");
taskOperationService.save(taskOperation);
log.info("إنهاء العمل على الحركة");
log.info("تحديث تاريخ استلام المهمة الى تاريخ اليوم وهو وقت الاغلاق");
task.setEndDate(new Date());
task.setCloseType(CloseType.Manual);
taskService.save(task);
log.info("الموافقة على كل طلبات الاغلاق الخاصة بهذة المهمة");
taskCloseRequestService.findByTaskIdAndTypeAndApprovedIsNull(taskId, true).forEach(request -> {
request.setApproved(true);
request.setApprovedDate(new Date());
taskCloseRequestService.save(request);
});
log.info("رفض كل طلبات التمديد الخاصة بهذة المهمة");
taskCloseRequestService.findByTaskIdAndTypeAndApprovedIsNull(taskId, false).forEach(request -> {
request.setApproved(false);
request.setApprovedDate(new Date());
taskCloseRequestService.save(request);
});
log.info("إغلاق المهمة على كل الموظفين");
taskToService.findByTask(task).stream().filter(taskTo -> !taskTo.getClosed()).forEach(taskTo -> {
taskTo.setClosed(true);
taskTo.setCloseDate(new Date());
taskTo.setDegree(TaskTo.PersonDegree.C);
taskToService.save(taskTo);
});
log.info("اعلام المستخدم بنجاح العملية.");
notificationService.notifyOne(Notification
.builder()
.title("العمليات على المهام")
.message("تم نقل المهمة الى الارشيف بنجاح.")
.type("success")
.icon("fa-archive")
.build(), principal.getName());
return task;
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
return null;
}
}
}
@RequestMapping(value = "addPerson", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
@PreAuthorize("hasRole('ROLE_TASK_UPDATE')")
@Transactional
public Task addPerson(@RequestParam(value = "taskId") Long taskId, @RequestParam(value = "personId") Long personId, @RequestParam(value = "message") String message, Principal principal) throws IOException {
Task task = taskService.findOne(taskId);
if (task.getCloseType().equals(CloseType.Manual)) {
throw new CustomException("لا يمكن القيام بأي عمليات على مهام الارشيف.");
}
Person person = personService.findOne(personId);
if (!task.getPerson().findManager().getEmail().equals(principal.getName())) {
if (!task.getPerson().getEmail().equals(principal.getName())) {
throw new CustomException("غير مصرح لك القيام بهذة العملية، فقط جهة التكليف مصرح له بذلك.");
}
}
if (taskToService.findByTaskAndPerson(task, person) != null) {
throw new CustomException("هذا الموظف مكلف بالفعل بهذة المهمة.");
}
try {
TaskTo taskTo = new TaskTo();
taskTo.setDegree(null);
taskTo.setProgress(0);
taskTo.setClosed(false);
taskTo.setCloseDate(null);
taskTo.setTask(task);
taskTo.setPerson(person);
taskToService.save(taskTo);
notificationService.notifyOne(Notification
.builder()
.title("العمليات على المهام")
.message("تم اضافة التكليف الجديد بنجاح")
.type("success")
.icon("fa-black-tie")
.build(), principal.getName());
ClassPathResource classPathResource = new ClassPathResource("/mailTemplate/NewTask.html");
String email = IOUtils.toString(classPathResource.getInputStream(), Charset.defaultCharset());
email = email.replaceAll("TASK_CODE", task.getCode().toString());
email = email.replaceAll("TASK_TITLE", task.getTitle());
email = email.replaceAll("TASK_CONTENT", task.getContent());
email = email.replaceAll("TASK_END_DATE", DateConverter.getHijriStringFromDateRTL(task.getEndDate()));
email = email.replaceAll("TASK_PERSON", task.getPerson().getName());
emailSender.send("مهمة جديدة رقم: " + "(" + task.getCode() + ")", email, person.getEmail());
log.info("اضافة الحركة الخاصة بالتحويل الى موظف جديد");
TaskOperation taskOperation = new TaskOperation();
TaskOperation tempTaskOperation = taskOperationService.findTopByTaskIdOrderByCodeDesc(task.getId());
if (tempTaskOperation == null) {
taskOperation.setCode(1);
} else {
taskOperation.setCode(tempTaskOperation.getCode() + 1);
}
taskOperation.setDate(new Date());
taskOperation.setSender(task.getPerson());
taskOperation.setTask(task);
taskOperation.setType(OperationType.AddPerson);
taskOperation.setContent("تحويل المهمة إلى " + person.getNickname() + " / " + person.getName() + " [ " + message + " ] ");
taskOperationService.save(taskOperation);
log.info("تم اضافة الحركة الجديدة بنجاح.");
return task;
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
return null;
}
}
@RequestMapping(value = "removePerson", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
@PreAuthorize("hasRole('ROLE_TASK_UPDATE')")
@Transactional
public Boolean removePerson(@RequestParam(value = "taskId") Long taskId, @RequestParam(value = "personId") Long personId, @RequestParam(value = "message") String message, Principal principal) throws IOException {
Task task = taskService.findOne(taskId);
if (task.getCloseType().equals(CloseType.Manual)) {
throw new CustomException("لا يمكن القيام بأي عمليات على مهام الارشيف.");
}
Person person = personService.findOne(personId);
if (!task.getPerson().findManager().getEmail().equals(principal.getName())) {
if (!task.getPerson().getEmail().equals(principal.getName())) {
throw new CustomException("غير مصرح لك القيام بهذة العملية، فقط جهة التكليف مصرح له بذلك.");
}
}
TaskTo taskTo = taskToService.findByTaskAndPerson(task, person);
if (taskTo == null) {
throw new CustomException("هذا الموظف غير مكلف بهذة المهمة.");
}
try {
taskToService.delete(taskTo);
notificationService.notifyOne(Notification
.builder()
.title("العمليات على المهام")
.message("تم حذف التكليف بنجاح")
.type("success")
.icon("fa-trash")
.build(), principal.getName());
log.info("اضافة الحركة الخاصة بحذف موظف من التكليف");
TaskOperation taskOperation = new TaskOperation();
TaskOperation tempTaskOperation = taskOperationService.findTopByTaskIdOrderByCodeDesc(task.getId());
if (tempTaskOperation == null) {
taskOperation.setCode(1);
} else {
taskOperation.setCode(tempTaskOperation.getCode() + 1);
}
taskOperation.setDate(new Date());
taskOperation.setSender(task.getPerson());
taskOperation.setTask(task);
taskOperation.setType(OperationType.AddPerson);
taskOperation.setContent("حذف تكليف المهمة من " + person.getNickname() + " / " + person.getName() + " [ " + message + " ] ");
taskOperationService.save(taskOperation);
log.info("تم اضافة الحركة الجديدة بنجاح.");
return true;
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
return false;
}
}
@RequestMapping(value = "addWarn", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
@PreAuthorize("hasRole('ROLE_TASK_UPDATE')")
@Transactional
public TaskWarn addWarn(@RequestParam(value = "taskId") Long taskId, @RequestParam(value = "personId") Long personId, @RequestParam(value = "message") String message, Principal principal) throws IOException {
Task task = taskService.findOne(taskId);
if (task.getCloseType().equals(CloseType.Manual)) {
throw new CustomException("لا يمكن القيام بأي عمليات على مهام الارشيف.");
}
Person person = personService.findOne(personId);
if (!task.getPerson().findManager().getEmail().equals(principal.getName())) {
if (!task.getPerson().getEmail().equals(principal.getName())) {
throw new CustomException("غير مصرح لك القيام بهذة العملية، فقط جهة التكليف مصرح له بذلك.");
}
}
try {
TaskWarn taskWarn = new TaskWarn();
TaskWarn tempTaskWarn = taskWarnService.findTopByTaskAndToPersonOrderByCodeDesc(task, person);
if (tempTaskWarn == null) {
taskWarn.setCode(1);
} else {
taskWarn.setCode(tempTaskWarn.getCode() + 1);
}
taskWarn.setDate(new Date());
taskWarn.setType(TaskWarn.TaskWarnType.Manual);
taskWarn.setToPerson(person);
taskWarn.setTask(task);
taskWarn.setContent(message);
taskWarn = taskWarnService.save(taskWarn);
notificationService.notifyOne(Notification
.builder()
.title("العمليات على المهام")
.message("تم إرسال التحذير بنجاح")
.type("success")
.icon("fa-black-tie")
.build(), person.getName());
ClassPathResource classPathResource = new ClassPathResource("/mailTemplate/NoTaskOperationsWarning.html");
String mail = org.apache.commons.io.IOUtils.toString(classPathResource.getInputStream(), Charset.defaultCharset());
mail = mail.replaceAll("MESSAGE", "تحذير من " + task.getPerson().getNickname() + " / " + task.getPerson().getName() + " بشأن المهمة رقم " + "(" + task.getCode() + ")" + " وفيما يلي محتوى التحذير" + "<br/>" + "<u>" + message + "</u>");
String title = "تحذير من " + task.getPerson().getNickname() + " / " + task.getPerson().getName();
emailSender.send(title, mail, person.getEmail());
return taskWarn;
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
return null;
}
}
@RequestMapping(value = "addDeduction", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
@PreAuthorize("hasRole('ROLE_TASK_UPDATE')")
@Transactional
public TaskDeduction addDeduction(@RequestParam(value = "taskId") Long taskId, @RequestParam(value = "personId") Long personId, @RequestParam(value = "message") String message, @RequestParam(value = "deduction") Double deduction, Principal principal) throws IOException {
Task task = taskService.findOne(taskId);
if (task.getCloseType().equals(CloseType.Manual)) {
throw new CustomException("لا يمكن القيام بأي عمليات على مهام الارشيف.");
}
Person person = personService.findOne(personId);
if (!task.getPerson().findManager().getEmail().equals(principal.getName())) {
if (!task.getPerson().getEmail().equals(principal.getName())) {
throw new CustomException("غير مصرح لك القيام بهذة العملية، فقط جهة التكليف مصرح له بذلك.");
}
}
try {
TaskDeduction taskDeduction = new TaskDeduction();
TaskDeduction tempTaskDeduction = taskDeductionService.findTopByTaskAndToPersonOrderByCodeDesc(task, person);
if (tempTaskDeduction == null) {
taskDeduction.setCode(1);
} else {
taskDeduction.setCode(tempTaskDeduction.getCode() + 1);
}
taskDeduction.setDate(new Date());
taskDeduction.setType(TaskDeduction.TaskDeductionType.Manual);
taskDeduction.setToPerson(person);
taskDeduction.setTask(task);
taskDeduction.setContent(message);
taskDeduction.setDeduction(deduction);
taskDeduction = taskDeductionService.save(taskDeduction);
notificationService.notifyOne(Notification
.builder()
.title("العمليات على المهام")
.message("تم إرسال الخصم بنجاح")
.type("success")
.icon("fa-black-tie")
.build(), person.getName());
ClassPathResource classPathResource = new ClassPathResource("/mailTemplate/NoTaskOperationsWarning.html");
String mail = org.apache.commons.io.IOUtils.toString(classPathResource.getInputStream(), Charset.defaultCharset());
mail = mail.replaceAll("MESSAGE", "خصم من " + task.getPerson().getNickname() + " / " + task.getPerson().getName() + " بشأن المهمة رقم " + "(" + task.getCode() + ")" + " وفيما يلي محتوى الخصم" + "<br/>" + "<u>" + message + "</u>");
String title = "خصم من " + task.getPerson().getNickname() + " / " + task.getPerson().getName() + " بقيمة " + taskDeduction.getDeduction() + " ريال سعودي";
emailSender.send(title, mail, taskDeduction.getToPerson().getEmail());
return taskDeduction;
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
return null;
}
}
@RequestMapping(value = "openTaskOnPerson", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
@PreAuthorize("hasRole('ROLE_TASK_UPDATE')")
@Transactional
public TaskTo openTaskOnPerson(@RequestParam(value = "taskId") Long taskId, @RequestParam(value = "personId") Long personId, @RequestParam(value = "message") String message, Principal principal) throws IOException {
Person caller = personService.findByEmail(principal.getName());
Task task = taskService.findOne(taskId);
if (task.getCloseType().equals(CloseType.Manual)) {
throw new CustomException("لا يمكن القيام بأي عمليات على مهام الارشيف.");
}
Person person = personService.findOne(personId);
if (!task.getPerson().findManager().getEmail().equals(principal.getName())) {
if (!task.getPerson().getEmail().equals(principal.getName())) {
throw new CustomException("غير مصرح لك القيام بهذة العملية، فقط جهة التكليف مصرح له بذلك.");
}
}
log.info("فحص إذا كانت المهمة تحت التنفيذ...");
if (!task.getCloseType().equals(CloseType.Pending)) {
throw new CustomException("لا يمكن فتح مهمة مغلقة على الموظف، حاول تمديد المهمة أولاً.");
}
TaskTo taskTo = taskToService.findByTaskAndPerson(task, person);
if (taskTo == null) {
throw new CustomException("عفواً، هذا الموظف غير موجود من ضمن فريق عمل المهمة.");
}
try {
log.info("إغادة فتح المهمة على الموظف بعد التأكد من وجوده من ضمن فريق عمل المهمة.");
taskTo.setClosed(false);
taskTo.setCloseDate(null);
taskTo.setDegree(null);
taskTo.setProgress(0);
taskTo = taskToService.save(taskTo);
log.info("إعلام المستدعي بنجاح العملية.");
notificationService.notifyOne(Notification
.builder()
.title("العمليات على المهام")
.message("تم فتح المهمة على الموظف بنجاح.")
.type("success")
.icon("fa-black-tie")
.build(), person.getName());
log.info("إضافة حركة جديدة بشأن فتح المهمة على الموظف.");
TaskOperation taskOperation = new TaskOperation();
TaskOperation tempTaskOperation = taskOperationService.findTopByTaskIdOrderByCodeDesc(task.getId());
if (tempTaskOperation == null) {
taskOperation.setCode(1);
} else {
taskOperation.setCode(tempTaskOperation.getCode() + 1);
}
taskOperation.setDate(new Date());
taskOperation.setSender(caller);
taskOperation.setTask(task);
taskOperation.setType(OperationType.OpenTaskOnPerson);
taskOperation.setContent("فتح المهمة على الموظف / " + person.getName() + " [ " + message + " ] ");
taskOperationService.save(taskOperation);
log.info("تم حفظ الحركة الجديدة بنجاح.");
return taskTo;
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
return null;
}
}
}
| 45,528 | 0.58942 | 0.588495 | 767 | 53.938721 | 39.205608 | 278 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.696219 | false | false |
7
|
7306fd5ad5c7397a2f3957172d01209c000d9b0f
| 9,517,647,531,124 |
293b3bda49870cf6d8adf4297d7cd8952c816b12
|
/spring-boot-amqp/src/main/java/org/windwant/spring/springbootamqp/controller/AmqpRestController.java
|
06ed93a10958c09e3de3c2b8a6799df16e500dd0
|
[] |
no_license
|
lukehuang/spring-boot-service
|
https://github.com/lukehuang/spring-boot-service
|
0e1d143a85f4362a6749463fffb17a63048cfde4
|
0147d040df65993627e2f1aae43b02182f8fac9c
|
refs/heads/master
| 2020-09-21T04:38:44.980000 | 2019-03-08T09:39:10 | 2019-03-08T09:39:10 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.windwant.spring.springbootamqp.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.windwant.spring.springbootamqp.service.rabbitmq.RabbitmqProducer;
/**
* Created by Administrator on 19-3-8.
*/
@RestController
public class AmqpRestController {
@Autowired
private RabbitmqProducer rabbitmqProducer;
@RequestMapping("/rabbit")
public String rabbitSend(@RequestParam("num") int num){
for (int i = 1; i < num + 1; i++) {
if(i%2 == 0) {
rabbitmqProducer.send("topicExchange", "route_queue2", i + "--test: " + Math.random());
}else {
rabbitmqProducer.send("topicExchange", "route_queue1", i + "--test: " + Math.random());
}
try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
return "TEST rabbitSend";
}
}
|
UTF-8
|
Java
| 1,152 |
java
|
AmqpRestController.java
|
Java
|
[
{
"context": "vice.rabbitmq.RabbitmqProducer;\n\n/**\n * Created by Administrator on 19-3-8.\n */\n@RestController\npublic class AmqpR",
"end": 415,
"score": 0.5751746296882629,
"start": 402,
"tag": "NAME",
"value": "Administrator"
}
] | null |
[] |
package org.windwant.spring.springbootamqp.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.windwant.spring.springbootamqp.service.rabbitmq.RabbitmqProducer;
/**
* Created by Administrator on 19-3-8.
*/
@RestController
public class AmqpRestController {
@Autowired
private RabbitmqProducer rabbitmqProducer;
@RequestMapping("/rabbit")
public String rabbitSend(@RequestParam("num") int num){
for (int i = 1; i < num + 1; i++) {
if(i%2 == 0) {
rabbitmqProducer.send("topicExchange", "route_queue2", i + "--test: " + Math.random());
}else {
rabbitmqProducer.send("topicExchange", "route_queue1", i + "--test: " + Math.random());
}
try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
return "TEST rabbitSend";
}
}
| 1,152 | 0.638889 | 0.627604 | 34 | 32.882355 | 28.193413 | 103 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.529412 | false | false |
7
|
2bcc5e6e54186dc5529005be5f545522b7cad776
| 16,673,063,091,241 |
05df68ff3f7e59abbe7f19a8b6643ddfba10d857
|
/src/main/java/com/sinkinchan/stock/sdk/source/ISourceManager.java
|
ca58a8be49828abc77db0d8fab2a48c53f252d94
|
[] |
no_license
|
thiagooo0/StockSdk
|
https://github.com/thiagooo0/StockSdk
|
3a32fef8683fb16f8d643abb6ebb8c4eb789b926
|
a87683a7b590d4c1f8e14779e701bfe9316b1fc4
|
refs/heads/master
| 2021-06-09T17:39:03.153000 | 2017-01-15T07:57:30 | 2017-01-15T07:57:30 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.sinkinchan.stock.sdk.source;
import com.sinkinchan.stock.sdk.SourceManager;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Created by 陈欣健 on 16/9/3.
*/
public abstract class ISourceManager {
protected void getSource(String url, SourceManager.onSourceCallBack callBack) {
try {
Map<String, String> param = new HashMap<String, String>();
getSource(url, param, callBack);
} catch (Exception e) {
callBack.onFailed(e.getMessage());
}
}
protected void getSource(String url, Map<String, String> params, SourceManager.onSourceCallBack callBack) {
try {
Document doc = Jsoup.connect(url).ignoreContentType(true).data(params).timeout(TIME_OUT).get();
String result = formatResult(doc.text());
switch (callBack.getType()) {
case json:
callBack.onSuccess(result);
break;
case bean:
callBack.getBean(doc, result);
/*Class clazz = null;
Type type = null;
if (callBack.getClazz() instanceof Class) {
clazz = (Class) callBack.getClazz();
callBack.onSuccess(GsonUtil.getGson().fromJson(result, clazz));
} else if (callBack.getClazz() instanceof Type) {
type = (Type) callBack.getClazz();
callBack.onSuccess(GsonUtil.getGson().fromJson(result, type));
}*/
break;
}
} catch (Exception e) {
// System.out.print(e.getMessage());
callBack.onFailed(e.toString());
}
}
protected static final int TIME_OUT = 15000;
private String formatResult(String result) {
//{.*}
String r = "\\{.*\\}";
Pattern pattern = Pattern.compile(r);
Matcher matcher = pattern.matcher(result);
String str = "";
while (matcher.find()) {
str += matcher.group();
}
/* String head = REG + "(";
String last = ");";
if (result.contains(head)) {
result = result.replace(head, "");
}
if (result.contains(last)) {
result = result.replace(last, "");
}*/
return str;
}
}
|
UTF-8
|
Java
| 2,511 |
java
|
ISourceManager.java
|
Java
|
[
{
"context": "mport java.util.regex.Pattern;\n\n/**\n * Created by 陈欣健 on 16/9/3.\n */\npublic abstract class ISourceManag",
"end": 281,
"score": 0.9998390078544617,
"start": 278,
"tag": "NAME",
"value": "陈欣健"
}
] | null |
[] |
package com.sinkinchan.stock.sdk.source;
import com.sinkinchan.stock.sdk.SourceManager;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Created by 陈欣健 on 16/9/3.
*/
public abstract class ISourceManager {
protected void getSource(String url, SourceManager.onSourceCallBack callBack) {
try {
Map<String, String> param = new HashMap<String, String>();
getSource(url, param, callBack);
} catch (Exception e) {
callBack.onFailed(e.getMessage());
}
}
protected void getSource(String url, Map<String, String> params, SourceManager.onSourceCallBack callBack) {
try {
Document doc = Jsoup.connect(url).ignoreContentType(true).data(params).timeout(TIME_OUT).get();
String result = formatResult(doc.text());
switch (callBack.getType()) {
case json:
callBack.onSuccess(result);
break;
case bean:
callBack.getBean(doc, result);
/*Class clazz = null;
Type type = null;
if (callBack.getClazz() instanceof Class) {
clazz = (Class) callBack.getClazz();
callBack.onSuccess(GsonUtil.getGson().fromJson(result, clazz));
} else if (callBack.getClazz() instanceof Type) {
type = (Type) callBack.getClazz();
callBack.onSuccess(GsonUtil.getGson().fromJson(result, type));
}*/
break;
}
} catch (Exception e) {
// System.out.print(e.getMessage());
callBack.onFailed(e.toString());
}
}
protected static final int TIME_OUT = 15000;
private String formatResult(String result) {
//{.*}
String r = "\\{.*\\}";
Pattern pattern = Pattern.compile(r);
Matcher matcher = pattern.matcher(result);
String str = "";
while (matcher.find()) {
str += matcher.group();
}
/* String head = REG + "(";
String last = ");";
if (result.contains(head)) {
result = result.replace(head, "");
}
if (result.contains(last)) {
result = result.replace(last, "");
}*/
return str;
}
}
| 2,511 | 0.536128 | 0.532535 | 79 | 30.70886 | 25.401661 | 111 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.632911 | false | false |
7
|
275f7f10a85151cd87b342f29d2b9926c6fc1e87
| 21,148,419,022,161 |
e3986c0799468aadb3d289cdf12f0286a89873dc
|
/src/main/java/bank/system/manager/payees/domain/PayeeRepository.java
|
f957456186bdd7ebd8eee14fbd3e791844adf0bc
|
[] |
no_license
|
Ferid0702/Bank_management_system
|
https://github.com/Ferid0702/Bank_management_system
|
c2f27d7223e4dd3ae94990cff1e6ccada60e8a7b
|
c6a158e9acd9f74525ace4d30550bf430e2b116d
|
refs/heads/master
| 2023-04-11T17:15:23.188000 | 2021-06-30T19:28:59 | 2021-06-30T19:28:59 | 364,578,554 | 0 | 0 | null | false | 2021-06-30T19:29:00 | 2021-05-05T13:03:31 | 2021-05-15T10:37:17 | 2021-06-30T19:28:59 | 120 | 3 | 0 | 0 |
Java
| false | false |
package bank.system.manager.payees.domain;
import bank.system.manager.payees.domain.model.Payee;
import bank.system.manager.shared.PostgreDbService;
import org.modelmapper.ModelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.sql.*;
@Service
public class PayeeRepository {
private final String URL = "jdbc:postgresql://localhost/bankdb";
private final String USER = "postgres";
private final String PASSWORD = "Pass1234";
private final String DRIVER_NAME = "org.postgresql.Driver";
public long create(Payee payee) {
try {
Class.forName(DRIVER_NAME);
Connection connection = DriverManager.getConnection(URL, USER, PASSWORD);
String query = "insert into payees(payment_year,payment_month,accountid,created_by,created_date)" +
"values ((select (sum+(sum*degree*year)/100)/year from accounts where id=?),(select (sum+(sum*degree*year)/100)/(12*year) from accounts where id=?),?,?,?) returning id";
PreparedStatement preparedStatement = connection.prepareStatement(query);
preparedStatement.setLong(1, payee.getAccountid());
preparedStatement.setLong(2, payee.getAccountid());
preparedStatement.setLong(3, payee.getAccountid());
preparedStatement.setLong(4, payee.getCreatedBy());
preparedStatement.setTimestamp(5, Timestamp.valueOf(payee.getCreatedDate()));
ResultSet resultSet = preparedStatement.executeQuery();
resultSet.next();
long id = resultSet.getLong(1);
resultSet.close();
preparedStatement.close();
connection.close();
return id;
} catch (SQLException | ClassNotFoundException e) {
throw new RuntimeException(e.getMessage());
}
}
}
|
UTF-8
|
Java
| 1,899 |
java
|
PayeeRepository.java
|
Java
|
[
{
"context": "calhost/bankdb\";\n private final String USER = \"postgres\";\n private final String PASSWORD = \"Pass1234\";",
"end": 467,
"score": 0.7760266661643982,
"start": 459,
"tag": "USERNAME",
"value": "postgres"
},
{
"context": " \"postgres\";\n private final String PASSWORD = \"Pass1234\";\n private final String DRIVER_NAME = \"org.pos",
"end": 515,
"score": 0.9990075826644897,
"start": 507,
"tag": "PASSWORD",
"value": "Pass1234"
}
] | null |
[] |
package bank.system.manager.payees.domain;
import bank.system.manager.payees.domain.model.Payee;
import bank.system.manager.shared.PostgreDbService;
import org.modelmapper.ModelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.sql.*;
@Service
public class PayeeRepository {
private final String URL = "jdbc:postgresql://localhost/bankdb";
private final String USER = "postgres";
private final String PASSWORD = "<PASSWORD>";
private final String DRIVER_NAME = "org.postgresql.Driver";
public long create(Payee payee) {
try {
Class.forName(DRIVER_NAME);
Connection connection = DriverManager.getConnection(URL, USER, PASSWORD);
String query = "insert into payees(payment_year,payment_month,accountid,created_by,created_date)" +
"values ((select (sum+(sum*degree*year)/100)/year from accounts where id=?),(select (sum+(sum*degree*year)/100)/(12*year) from accounts where id=?),?,?,?) returning id";
PreparedStatement preparedStatement = connection.prepareStatement(query);
preparedStatement.setLong(1, payee.getAccountid());
preparedStatement.setLong(2, payee.getAccountid());
preparedStatement.setLong(3, payee.getAccountid());
preparedStatement.setLong(4, payee.getCreatedBy());
preparedStatement.setTimestamp(5, Timestamp.valueOf(payee.getCreatedDate()));
ResultSet resultSet = preparedStatement.executeQuery();
resultSet.next();
long id = resultSet.getLong(1);
resultSet.close();
preparedStatement.close();
connection.close();
return id;
} catch (SQLException | ClassNotFoundException e) {
throw new RuntimeException(e.getMessage());
}
}
}
| 1,901 | 0.674566 | 0.665087 | 42 | 44.214287 | 35.705498 | 190 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.047619 | false | false |
7
|
c959ecb49494ea6ca85fef157900630a1965a191
| 21,148,419,025,120 |
5c23d6703e3dbfae406315a8fe9dee997e6ec8b6
|
/jhs-loan-manage/src/main/java/com/jhh/jhs/loan/manage/mapper/ReviewMapper.java
|
58edc5b1ba44008d56a2f7e3c9d86dc9a20ac1ec
|
[] |
no_license
|
soldiers1989/loan-uhs
|
https://github.com/soldiers1989/loan-uhs
|
1dc4e766fce56ca21bc34e5a5b060eaf7116a8b0
|
77b06a67651898c4f1734e6c323becd0df639c22
|
refs/heads/master
| 2020-03-28T09:27:29.670000 | 2018-06-12T07:53:52 | 2018-06-12T07:53:52 | 148,038,503 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.jhh.jhs.loan.manage.mapper;
import com.jhh.jhs.loan.entity.manager.Review;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
import java.util.Map;
public interface ReviewMapper extends Mapper<Review> {
List manualAuditReport(Map map);
List getauditsforUser(Map map);
List getManuallyReview(Map map);
}
|
UTF-8
|
Java
| 336 |
java
|
ReviewMapper.java
|
Java
|
[] | null |
[] |
package com.jhh.jhs.loan.manage.mapper;
import com.jhh.jhs.loan.entity.manager.Review;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
import java.util.Map;
public interface ReviewMapper extends Mapper<Review> {
List manualAuditReport(Map map);
List getauditsforUser(Map map);
List getManuallyReview(Map map);
}
| 336 | 0.785714 | 0.785714 | 17 | 18.82353 | 19.064089 | 54 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.647059 | false | false |
7
|
04243b9502e00186bc355642ea61d0025927a659
| 17,815,524,412,744 |
6ea908758e38fb6bb86377f6c5e74a873d91baf1
|
/lab_2/src/main/java/golub/entity/IStudent.java
|
224d2f834be8a44003f514e59d30d1fd5ee72e6c
|
[] |
no_license
|
Golub3/FullJAVA
|
https://github.com/Golub3/FullJAVA
|
25ecb7d75f81589c8ceb90fd36c3670d49de2da2
|
25a81408e346e06224dd7ffa1dab6aadab5f5134
|
refs/heads/master
| 2021-07-24T16:02:35.715000 | 2019-12-03T01:00:33 | 2019-12-03T01:00:33 | 225,500,786 | 0 | 0 | null | false | 2020-10-13T17:55:21 | 2019-12-03T01:12:27 | 2019-12-03T01:16:58 | 2020-10-13T17:55:20 | 50 | 0 | 0 | 5 |
Java
| false | false |
package golub.entity;
public interface IStudent {
String getName();
int getCourse();
String getIndNumber();
void setName(String name);
void setCourse(int course);
void setIndNumber(String indNumber);
}
|
UTF-8
|
Java
| 230 |
java
|
IStudent.java
|
Java
|
[] | null |
[] |
package golub.entity;
public interface IStudent {
String getName();
int getCourse();
String getIndNumber();
void setName(String name);
void setCourse(int course);
void setIndNumber(String indNumber);
}
| 230 | 0.686957 | 0.686957 | 13 | 16.692308 | 13.941552 | 40 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.538462 | false | false |
7
|
b167a693b7eb9472aa7d204df6a159a11a62c6c5
| 10,969,346,534,780 |
ed4d2df180a5e1ed09f83d1e9ba832b4197495eb
|
/myllah/myllah/src/com/capstonedesign/myllah/MsgString.java
|
46823334591c8784771490857cc77461547c2703
|
[] |
no_license
|
scubedoo187/myllah
|
https://github.com/scubedoo187/myllah
|
cbb16c786cae5990b6d307e26bbdcdf597a40a87
|
8f52117dd3f1b57123d10337abf31704b8055b26
|
refs/heads/master
| 2021-05-28T08:39:17.334000 | 2014-12-11T04:50:45 | 2014-12-11T04:50:45 | 26,395,761 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.capstonedesign.myllah;
import java.io.Serializable;
public class MsgString implements Serializable{
private static final long serialVersionUID = 1L;
private static String threadStr;
private static String activityStr;
private static boolean newActivityStr;
private static boolean newThreadStr;
public MsgString() {
newActivityStr = false;
newThreadStr = false;
activityStr = "";
threadStr = "";
}
public void setThreadStr(String s) {
newThreadStr = true;
threadStr = s;
}
public void setActivityStr(String s) {
newActivityStr = true;
activityStr = s;
}
public String getThreadStr() {
newThreadStr = false;
return threadStr;
}
public String getActivityStr() {
newActivityStr = false;
return activityStr;
}
public boolean isActivityChange() {
return newActivityStr;
}
public boolean isThreadChange() {
return newThreadStr;
}
}
|
UTF-8
|
Java
| 899 |
java
|
MsgString.java
|
Java
|
[] | null |
[] |
package com.capstonedesign.myllah;
import java.io.Serializable;
public class MsgString implements Serializable{
private static final long serialVersionUID = 1L;
private static String threadStr;
private static String activityStr;
private static boolean newActivityStr;
private static boolean newThreadStr;
public MsgString() {
newActivityStr = false;
newThreadStr = false;
activityStr = "";
threadStr = "";
}
public void setThreadStr(String s) {
newThreadStr = true;
threadStr = s;
}
public void setActivityStr(String s) {
newActivityStr = true;
activityStr = s;
}
public String getThreadStr() {
newThreadStr = false;
return threadStr;
}
public String getActivityStr() {
newActivityStr = false;
return activityStr;
}
public boolean isActivityChange() {
return newActivityStr;
}
public boolean isThreadChange() {
return newThreadStr;
}
}
| 899 | 0.733037 | 0.731924 | 46 | 18.543478 | 14.93858 | 49 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.630435 | false | false |
7
|
d3d162922b7ee11e949fe4243f357cb1e63090e9
| 11,175,504,967,414 |
a8d483c392a16217d241af57bd4cf01b521e1229
|
/src/main/java/java1702/javase/reflect/demo/b/Service.java
|
ad8f8816534f4aae19ab109ca536af3d92bf082f
|
[] |
no_license
|
thu/JavaSE_20171
|
https://github.com/thu/JavaSE_20171
|
00ef0d48699e97384d4c533337d3746a129c8608
|
7adadfdf59ab790e7f48f14a60480ca211b4f8f4
|
refs/heads/master
| 2020-02-27T05:11:04.102000 | 2017-05-13T02:51:19 | 2017-05-13T02:51:19 | 84,039,986 | 5 | 5 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package java1702.javase.reflect.demo.b;
/**
* Created by mingfei.net@gmail.com
* 5/5/17 09:41
* https://github.com/thu/JavaSE_20171
*/
// 强耦合 -> 松散耦合 解耦合
public class Service {
private DeviceWriter deviceWriter;
// public Service(DeviceWriter deviceWriter) {
// this.deviceWriter = deviceWriter;
// }
public void setDeviceWriter(DeviceWriter deviceWriter) {
this.deviceWriter = deviceWriter;
}
public void write() {
deviceWriter.writeToDevice();
}
}
|
UTF-8
|
Java
| 528 |
java
|
Service.java
|
Java
|
[
{
"context": "java1702.javase.reflect.demo.b;\n\n/**\n * Created by mingfei.net@gmail.com\n * 5/5/17 09:41\n * https://github.com/thu/JavaSE_",
"end": 80,
"score": 0.9999238848686218,
"start": 59,
"tag": "EMAIL",
"value": "mingfei.net@gmail.com"
},
{
"context": "t@gmail.com\n * 5/5/17 09:41\n * https://github.com/thu/JavaSE_20171\n */\n\n// 强耦合 -> 松散耦合 解耦合\npublic class",
"end": 122,
"score": 0.9830146431922913,
"start": 119,
"tag": "USERNAME",
"value": "thu"
}
] | null |
[] |
package java1702.javase.reflect.demo.b;
/**
* Created by <EMAIL>
* 5/5/17 09:41
* https://github.com/thu/JavaSE_20171
*/
// 强耦合 -> 松散耦合 解耦合
public class Service {
private DeviceWriter deviceWriter;
// public Service(DeviceWriter deviceWriter) {
// this.deviceWriter = deviceWriter;
// }
public void setDeviceWriter(DeviceWriter deviceWriter) {
this.deviceWriter = deviceWriter;
}
public void write() {
deviceWriter.writeToDevice();
}
}
| 514 | 0.663386 | 0.629921 | 24 | 20.166666 | 18.87385 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.208333 | false | false |
7
|
a608fe46a38b33de71c6e5a8982a712b5bbbd6ba
| 29,317,446,814,638 |
2a3c46c64cd0276febade763fc5a0cca10524afe
|
/hoho130/src/main/java/com/hotel/kg/employee/service/IMngNoticeSvc.java
|
4a314147eb0c65dabb4699cd74949c5500e1b900
|
[] |
no_license
|
hisynn/kgHotel
|
https://github.com/hisynn/kgHotel
|
8c674f28151308858fe994a5a137c229021c087f
|
3fdcabb2c00494ee9ee7c98cc958673fc282a474
|
refs/heads/master
| 2022-11-27T23:04:44.345000 | 2020-12-03T01:35:19 | 2020-12-03T01:35:19 | 254,589,737 | 0 | 0 | null | false | 2022-11-16T08:28:14 | 2020-04-10T08:59:14 | 2020-12-03T01:38:05 | 2022-11-16T08:28:11 | 201,178 | 0 | 0 | 10 |
CSS
| false | false |
package com.hotel.kg.employee.service;
import org.springframework.ui.Model;
import com.hotel.kg.employee.dto.NoticeDto;
public interface IMngNoticeSvc {
String noticeSltMulti(Model model, int pageNum);
String insert(Model model, NoticeDto dto);
String update(Model model, NoticeDto dto);
String delete(Model model, String mngr_id, String date);
String sltOne(Model model, String mngr_id, String date);
}
|
UTF-8
|
Java
| 418 |
java
|
IMngNoticeSvc.java
|
Java
|
[] | null |
[] |
package com.hotel.kg.employee.service;
import org.springframework.ui.Model;
import com.hotel.kg.employee.dto.NoticeDto;
public interface IMngNoticeSvc {
String noticeSltMulti(Model model, int pageNum);
String insert(Model model, NoticeDto dto);
String update(Model model, NoticeDto dto);
String delete(Model model, String mngr_id, String date);
String sltOne(Model model, String mngr_id, String date);
}
| 418 | 0.772727 | 0.772727 | 16 | 25.125 | 22.519089 | 57 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.4375 | false | false |
7
|
dbf04ec92fb87c4ac2a8d7ff182a05ef24ef5003
| 8,521,215,166,360 |
2c8ca6c658a55fb71b0569cacb1fbb6833953540
|
/connectED/src/communication/ChatController.java
|
c75bca9cf788bc2fb48055742ab6cbff8b9472c3
|
[] |
no_license
|
snolbo/connectED
|
https://github.com/snolbo/connectED
|
6571ebccd1b727ee3fbe8faacc98c1b044a7913d
|
28a3a58fafed68c12dfde5cb7f13af9fd7a491b3
|
refs/heads/master
| 2021-03-24T10:17:38.885000 | 2017-04-24T16:47:11 | 2017-04-24T16:47:11 | 79,563,280 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package communication;
import java.io.IOException;
import org.w3c.dom.Document;
import T2.ServerRequest;
import javafx.application.Platform;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.control.Label;
import javafx.scene.control.ListView;
import javafx.scene.control.Tab;
import javafx.scene.control.TextArea;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javafx.scene.layout.Background;
import javafx.scene.layout.BackgroundFill;
import javafx.scene.layout.CornerRadii;
import javafx.scene.paint.Color;
import mainWindow.InteractionTabManagerController;
import mainWindow.MainFrameController;
// Controls the chat of one connection
public class ChatController {
@FXML private TextArea userText;
@FXML private ListView<Label> chatWindow;
private RecieveAndSend receiveAndSend = null;
private boolean isAssistantHost= false;
private boolean isHelperHost = false;
private Tab chatTab;
private Node InteractionArea;
private InteractionTabManagerController interactionTabManagerController;
public boolean isHelperHost() {
return isHelperHost;
}
public boolean isAssistantHost() {
return isAssistantHost;
}
public void setHelperHost(boolean isHelperHost) {
this.isHelperHost = isHelperHost;
}
public void setAssistantHost(boolean isAssistantHost) {
this.isAssistantHost = isAssistantHost;
}
@FXML // listens to keyevents in userText, if keyevent is enter, send CHAT protovol and the text
public void handleChatEnterKey(KeyEvent event) {
if(event.getCode() == KeyCode.ENTER ){
String message = userText.getText();
Platform.runLater(() -> {receiveAndSend.sendChatMessage("CHAT-" + message);});
viewMessage(message, true);
event.consume();
}
else if(event.getCode() == KeyCode.I){
System.out.println(interactionTabManagerController.isFinishedLoading());
}
}
// used by tab creates in serverChatController on closeRequest of tab
public void onClosed(String tag) {
if(receiveAndSend != null){
System.out.println("Closing chatController - sends END message and closes connection...");
receiveAndSend.sendChatMessage("END-null");
receiveAndSend.closeConnection();
}
if( (isHelperHost || isAssistantHost) && receiveAndSend == null){
System.out.println("Closing chatController - sends " + tag + "Delete" + " to TCPserver since in queue...");
ServerRequest request = new ServerRequest(tag + "Delete");
request.removeAdressFromQueue();
}
// else if(isAssistantHost && receiveAndSend == null){
// System.out.println("Closing chatController - sends " + tag + "Delete" + " to TCPserver since in queue...");
// ServerRequest request = new ServerRequest(tag + "Delete");
// request.removeAdressFromQueue();
// }
else if(receiveAndSend == null){
System.out.println("Closing chatController - sends " + tag + "Delete" + " to TCPserver since in queue...");
ServerRequest request = new ServerRequest(tag + "Delete");
request.removeAdressFromQueue();
}
// if(!isAssistantHost() && !isHelperHost())
// interactionTabManagerController.deleteFirepad();
interactionTabManagerController.deleteFirepad();
}
// shows message in chatWIndow
public void viewMessage(String text, boolean madeByMe){ // TODO: want the label to be smaller, wrap text, and positioned at one side
Label message = new Label(text);
message.prefWidthProperty().bind(chatWindow.widthProperty().subtract(25));
message.setWrapText(true);
if(madeByMe) {
message.setTextFill(Color.WHITE);
message.setBackground(new Background(new BackgroundFill(Color.web("#4678FB"), new CornerRadii(5), null)));
}
else {
message.setTextFill(Color.BLACK);
message.setBackground(new Background(new BackgroundFill(Color.web("#EFEEEE"), new CornerRadii(5), null)));
}
Platform.runLater(() -> {chatWindow.getItems().add(message);});
this.userText.clear();
}
// sets a serverConnection to this chattab
public void setRecieveAndSendConnection(RecieveAndSend connection){
this.receiveAndSend = connection;
}
public RecieveAndSend getReceiveAndSendConnection(){
return this.receiveAndSend;
}
public void ableToType(boolean tof) {
this.userText.setEditable(tof);
}
public void setChatTab(Tab chatTab) {
this.chatTab = chatTab;
}
public Tab getChatTab(){
return this.chatTab;
}
public void initializeInteractionArea() {
System.out.println("Initializing interactionArea assisiated with this chatController");
FXMLLoader loader = new FXMLLoader(getClass().getResource("/mainWindow/InteractionTabManager.fxml"));
try{
this.InteractionArea = loader.load();
this.interactionTabManagerController = loader.getController();
}
catch(IOException e){
e.printStackTrace();
}
if(!isAssistantHost() && !isHelperHost()){
interactionTabManagerController.setURL("http://connected-1e044.firebaseapp.com");
}
else{
setDefaultURL();
}
}
public void setDefaultURL(){
interactionTabManagerController.setDefaultURL();
}
public Node getInteractionArea(){
return this.InteractionArea;
}
public void setCodeUrl(String URL){
this.interactionTabManagerController.setURL(URL);
}
public String getCodeURL(){
return interactionTabManagerController.getURL();
}
// public void reloadCodeEditor(){
// interactionTabManagerController.reloadCodeEditor();
// }
public boolean codeEditorFinishedLoading() {
return interactionTabManagerController.isFinishedLoading();
}
public void sendCodeURLWhenLoaded() {
System.out.println("Sending codeURL to helper when the page is finished loading...");
interactionTabManagerController.sendPageURLWhenLoaded(this);
}
public void sendCodeURL(){
System.out.println("Sending CodeURL to helper...");
receiveAndSend.sendCodeUrl("CODEURL-"+ interactionTabManagerController.getURL());
}
}
|
UTF-8
|
Java
| 5,878 |
java
|
ChatController.java
|
Java
|
[] | null |
[] |
package communication;
import java.io.IOException;
import org.w3c.dom.Document;
import T2.ServerRequest;
import javafx.application.Platform;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.control.Label;
import javafx.scene.control.ListView;
import javafx.scene.control.Tab;
import javafx.scene.control.TextArea;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javafx.scene.layout.Background;
import javafx.scene.layout.BackgroundFill;
import javafx.scene.layout.CornerRadii;
import javafx.scene.paint.Color;
import mainWindow.InteractionTabManagerController;
import mainWindow.MainFrameController;
// Controls the chat of one connection
public class ChatController {
@FXML private TextArea userText;
@FXML private ListView<Label> chatWindow;
private RecieveAndSend receiveAndSend = null;
private boolean isAssistantHost= false;
private boolean isHelperHost = false;
private Tab chatTab;
private Node InteractionArea;
private InteractionTabManagerController interactionTabManagerController;
public boolean isHelperHost() {
return isHelperHost;
}
public boolean isAssistantHost() {
return isAssistantHost;
}
public void setHelperHost(boolean isHelperHost) {
this.isHelperHost = isHelperHost;
}
public void setAssistantHost(boolean isAssistantHost) {
this.isAssistantHost = isAssistantHost;
}
@FXML // listens to keyevents in userText, if keyevent is enter, send CHAT protovol and the text
public void handleChatEnterKey(KeyEvent event) {
if(event.getCode() == KeyCode.ENTER ){
String message = userText.getText();
Platform.runLater(() -> {receiveAndSend.sendChatMessage("CHAT-" + message);});
viewMessage(message, true);
event.consume();
}
else if(event.getCode() == KeyCode.I){
System.out.println(interactionTabManagerController.isFinishedLoading());
}
}
// used by tab creates in serverChatController on closeRequest of tab
public void onClosed(String tag) {
if(receiveAndSend != null){
System.out.println("Closing chatController - sends END message and closes connection...");
receiveAndSend.sendChatMessage("END-null");
receiveAndSend.closeConnection();
}
if( (isHelperHost || isAssistantHost) && receiveAndSend == null){
System.out.println("Closing chatController - sends " + tag + "Delete" + " to TCPserver since in queue...");
ServerRequest request = new ServerRequest(tag + "Delete");
request.removeAdressFromQueue();
}
// else if(isAssistantHost && receiveAndSend == null){
// System.out.println("Closing chatController - sends " + tag + "Delete" + " to TCPserver since in queue...");
// ServerRequest request = new ServerRequest(tag + "Delete");
// request.removeAdressFromQueue();
// }
else if(receiveAndSend == null){
System.out.println("Closing chatController - sends " + tag + "Delete" + " to TCPserver since in queue...");
ServerRequest request = new ServerRequest(tag + "Delete");
request.removeAdressFromQueue();
}
// if(!isAssistantHost() && !isHelperHost())
// interactionTabManagerController.deleteFirepad();
interactionTabManagerController.deleteFirepad();
}
// shows message in chatWIndow
public void viewMessage(String text, boolean madeByMe){ // TODO: want the label to be smaller, wrap text, and positioned at one side
Label message = new Label(text);
message.prefWidthProperty().bind(chatWindow.widthProperty().subtract(25));
message.setWrapText(true);
if(madeByMe) {
message.setTextFill(Color.WHITE);
message.setBackground(new Background(new BackgroundFill(Color.web("#4678FB"), new CornerRadii(5), null)));
}
else {
message.setTextFill(Color.BLACK);
message.setBackground(new Background(new BackgroundFill(Color.web("#EFEEEE"), new CornerRadii(5), null)));
}
Platform.runLater(() -> {chatWindow.getItems().add(message);});
this.userText.clear();
}
// sets a serverConnection to this chattab
public void setRecieveAndSendConnection(RecieveAndSend connection){
this.receiveAndSend = connection;
}
public RecieveAndSend getReceiveAndSendConnection(){
return this.receiveAndSend;
}
public void ableToType(boolean tof) {
this.userText.setEditable(tof);
}
public void setChatTab(Tab chatTab) {
this.chatTab = chatTab;
}
public Tab getChatTab(){
return this.chatTab;
}
public void initializeInteractionArea() {
System.out.println("Initializing interactionArea assisiated with this chatController");
FXMLLoader loader = new FXMLLoader(getClass().getResource("/mainWindow/InteractionTabManager.fxml"));
try{
this.InteractionArea = loader.load();
this.interactionTabManagerController = loader.getController();
}
catch(IOException e){
e.printStackTrace();
}
if(!isAssistantHost() && !isHelperHost()){
interactionTabManagerController.setURL("http://connected-1e044.firebaseapp.com");
}
else{
setDefaultURL();
}
}
public void setDefaultURL(){
interactionTabManagerController.setDefaultURL();
}
public Node getInteractionArea(){
return this.InteractionArea;
}
public void setCodeUrl(String URL){
this.interactionTabManagerController.setURL(URL);
}
public String getCodeURL(){
return interactionTabManagerController.getURL();
}
// public void reloadCodeEditor(){
// interactionTabManagerController.reloadCodeEditor();
// }
public boolean codeEditorFinishedLoading() {
return interactionTabManagerController.isFinishedLoading();
}
public void sendCodeURLWhenLoaded() {
System.out.println("Sending codeURL to helper when the page is finished loading...");
interactionTabManagerController.sendPageURLWhenLoaded(this);
}
public void sendCodeURL(){
System.out.println("Sending CodeURL to helper...");
receiveAndSend.sendCodeUrl("CODEURL-"+ interactionTabManagerController.getURL());
}
}
| 5,878 | 0.749745 | 0.747363 | 202 | 28.09901 | 28.76656 | 134 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.767327 | false | false |
7
|
371fa5b466c07378b6e4b47333f239542e3f5c15
| 26,637,387,223,819 |
25f1b866ca5cbc2ca74bc75571bb83680d40689e
|
/src/main/java/it/polimi/ingsw/model/token/SoloToken.java
|
1a2e1c4730e61022ff967b4fe1b55a803b66dc25
|
[] |
no_license
|
redaellimattia/Progetto-SWE-2021
|
https://github.com/redaellimattia/Progetto-SWE-2021
|
e2fb20dbfe919fc8d82aa2e768b00c4f24979d9b
|
d42e9e774e6eea630120c58b22a7b8bb21cf18ab
|
refs/heads/main
| 2023-06-05T23:33:25.458000 | 2021-07-01T17:23:02 | 2021-07-01T17:23:02 | 344,041,571 | 0 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package it.polimi.ingsw.model.token;
import it.polimi.ingsw.model.Game;
import it.polimi.ingsw.model.PlayerDashboard;
import it.polimi.ingsw.network.server.Observer;
public interface SoloToken {
/**
* Executes the action represented by the token
* @param player Lorenzo's dashboard
* @param game the current Game object
* @param observer serverLobby observer
*/
void useToken(PlayerDashboard player, Game game, Observer observer);
}
|
UTF-8
|
Java
| 469 |
java
|
SoloToken.java
|
Java
|
[
{
"context": "tion represented by the token\n * @param player Lorenzo's dashboard\n * @param game the current Game o",
"end": 286,
"score": 0.8682205080986023,
"start": 279,
"tag": "NAME",
"value": "Lorenzo"
}
] | null |
[] |
package it.polimi.ingsw.model.token;
import it.polimi.ingsw.model.Game;
import it.polimi.ingsw.model.PlayerDashboard;
import it.polimi.ingsw.network.server.Observer;
public interface SoloToken {
/**
* Executes the action represented by the token
* @param player Lorenzo's dashboard
* @param game the current Game object
* @param observer serverLobby observer
*/
void useToken(PlayerDashboard player, Game game, Observer observer);
}
| 469 | 0.735608 | 0.735608 | 16 | 28.3125 | 21.996359 | 72 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4375 | false | false |
7
|
2986607f528c58c2a92d7b064a0e639e758b8265
| 31,928,786,879,194 |
993cf1cbae4896a0f15fd1ab85751bfeb9119e5c
|
/src/hvv_admin4/panels/PanelPuffMessage.java
|
cec7174b47a7131062c2e50df38a64ca4d7ba408
|
[] |
no_license
|
BelousovYaroslav/HVV4_Admin
|
https://github.com/BelousovYaroslav/HVV4_Admin
|
52d1d580f405ea3dfdf9c7ec7402c6f19a945b07
|
cfde9e50edd9e9259cf18e046e065bac139251c0
|
refs/heads/master
| 2021-01-17T21:17:05.360000 | 2018-03-02T11:30:48 | 2018-03-02T11:30:48 | 84,172,329 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* 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 hvv_admin4.panels;
import hvv_admin4.HVV_Admin4;
import hvv_admin4.HVV_Admin4Constants;
import hvv_admin4.steps.info.TechProcessHvProcessInfo;
import hvv_admin4.steps.info.TechProcessStepCommon;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.Timer;
import org.apache.log4j.Logger;
/**
*
* @author yaroslav
*/
public class PanelPuffMessage extends javax.swing.JPanel {
final HVV_Admin4 theApp;
static Logger logger = Logger.getLogger(PanelPuffMessage.class);
public long m_lTimer;
public int m_nFlasher;
Timer m_pTimer;
/**
* Creates new form PanelProcess
*/
public PanelPuffMessage( HVV_Admin4 app) {
theApp = app;
initComponents();
}
public void Init() {
int n = theApp.GetCurrentStep() / 20;
lblTitle.setText( theApp.GetSettings().GetPuffMessage( 1 + theApp.GetCurrentStep() / 20, 0, theApp.GetProcessedDeviceType()));
String strGas1 = theApp.GetSettings().GetPuffMessage( 1 + theApp.GetCurrentStep() / 20, 1, theApp.GetProcessedDeviceType());
String strGas2 = theApp.GetSettings().GetPuffMessage( 1 + theApp.GetCurrentStep() / 20, 2, theApp.GetProcessedDeviceType());
String strHv = theApp.GetSettings().GetPuffMessage( 1 + theApp.GetCurrentStep() / 20, 3, theApp.GetProcessedDeviceType());
switch( theApp.GetCurrentStep()) {
//ЭТАП 2. Обработка O2
case 21:
case 22:
if( theApp.IsCurrentStepInProgress()) {
lblMessageL.setText( "");
lblMessageR.setText( "");
lblMessageF.setText( strHv);
btnNext.setText( "Высокое подано. Начать отсчёт времени обработки.");
}
else {
lblMessageL.setText( strGas1);
lblMessageR.setText( "");
lblMessageF.setText( "");
btnNext.setText( "Прибор заполнен");
}
break;
//ЭТАП 3. Обработка O2-Ne20
case 41:
case 43:
if( theApp.IsCurrentStepInProgress()) {
lblMessageL.setText( "");
lblMessageR.setText( "");
lblMessageF.setText( strHv);
btnNext.setText( "Высокое подано. Начать отсчёт времени обработки.");
}
else {
lblMessageL.setText( strGas1);
lblMessageR.setText( strGas2);
lblMessageF.setText( "");
btnNext.setText( "Прибор заполнен");
}
break;
//ЭТАП 4. Термообезгаживание. Здесь последний этап - выдержка рабочей смеси перед промежуточным контролем.
case 64:
lblMessageL.setText( strGas1);
lblMessageR.setText( strGas2);
lblMessageF.setText( "");
btnNext.setText( "Прибор заполнен. Начать отсчёт времени выдержки.");
break;
//ЭТАП 6. Тренировка катода
case 101:
case 103:
case 105:
lblMessageL.setText( strGas1);
lblMessageR.setText( strGas2);
lblMessageF.setText( "");
btnNext.setText( "Прибор заполнен. Начать отсчёт времени выдержки.");
break;
case 102:
case 104:
case 106:
lblMessageL.setText( "");
lblMessageR.setText( "");
lblMessageF.setText( strHv);
btnNext.setText( "Высокое подано. Начать отсчёт времени тренировки.");
break;
//ЭТАП 8. Тр. в тр. смеси
case 141:
case 143:
lblMessageL.setText( strGas1);
lblMessageR.setText( strGas2);
lblMessageF.setText( "");
btnNext.setText( "Прибор заполнен. Начать отсчёт времени выдержки.");
break;
case 142:
case 144:
lblMessageL.setText( "");
lblMessageR.setText( "");
lblMessageF.setText( strHv);
btnNext.setText( "Высокое подано. Начать отсчёт времени тренировки.");
break;
//ЭТАП 10. Выходная оценка параметров
case 181:
lblMessageL.setText( strGas1);
lblMessageR.setText( strGas2);
lblMessageF.setText( "");
btnNext.setText( "Прибор заполнен. Начать отсчёт времени выдержки.");
break;
}
btnNext.setEnabled( false);
new Timer( 1000, new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
(( Timer) e.getSource()).stop();
btnNext.setEnabled( true);
}
}).start();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
lblTitle = new javax.swing.JLabel();
btnNext = new javax.swing.JButton();
lblMessageR = new javax.swing.JLabel();
lblMessageF = new javax.swing.JLabel();
lblMessageL = new javax.swing.JLabel();
setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 200)));
setMaximumSize(new java.awt.Dimension(520, 440));
setMinimumSize(new java.awt.Dimension(520, 440));
setPreferredSize(new java.awt.Dimension(520, 440));
setLayout(null);
lblTitle.setFont(new java.awt.Font("Cantarell", 0, 24)); // NOI18N
lblTitle.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
lblTitle.setText("<html><u>Заполнение кислород-неонной смесью.</u></html>");
lblTitle.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(220, 220, 220)));
add(lblTitle);
lblTitle.setBounds(10, 10, 500, 40);
btnNext.setFont(new java.awt.Font("Cantarell", 0, 15)); // NOI18N
btnNext.setText("Далее");
btnNext.setEnabled(false);
btnNext.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnNextActionPerformed(evt);
}
});
add(btnNext);
btnNext.setBounds(10, 370, 500, 50);
lblMessageR.setFont(new java.awt.Font("Cantarell", 0, 36)); // NOI18N
lblMessageR.setText("<html>Неон Ne<sub>20</sub><br>200.0 Па</html>");
lblMessageR.setToolTipText("");
add(lblMessageR);
lblMessageR.setBounds(270, 70, 240, 290);
lblMessageF.setFont(new java.awt.Font("Cantarell", 0, 48)); // NOI18N
lblMessageF.setText("<html>Ток обработки 2.5мА</html>");
add(lblMessageF);
lblMessageF.setBounds(10, 60, 500, 300);
lblMessageL.setFont(new java.awt.Font("Cantarell", 0, 36)); // NOI18N
lblMessageL.setText("<html>Кислород O<sub>2</sub><br>66.6 Па</html>");
add(lblMessageL);
lblMessageL.setBounds(20, 70, 240, 290);
}// </editor-fold>//GEN-END:initComponents
private void btnNextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNextActionPerformed
switch( theApp.GetCurrentStep()) {
case 21: //2.1 Обработка O2. первый цикл
case 22: //2.2 Обработка O2. второй цикл
if( theApp.IsCurrentStepInProgress()) {
TechProcessHvProcessInfo info = new TechProcessHvProcessInfo();
info.SetStartDateAsCurrent( theApp.GetSettings().GetTimeZoneShift());
if( theApp.GetCurrentStep() == 21) info.SetStartReportTitle( "Старт первого цикла обработки");
if( theApp.GetCurrentStep() == 22) info.SetStartReportTitle( "Старт второго цикла обработки");
theApp.SaveStepInfo( String.format( "%03d", theApp.GetCurrentStep()), info, true);
theApp.m_pMainWnd.m_pnlEnterHvVoltage.setVisible( true);
theApp.m_pMainWnd.m_pnlEnterHvVoltage.Init();
theApp.m_pMainWnd.m_pnlEnterHvVoltage.DropValues();
theApp.m_pMainWnd.m_pnlEnterHvVoltage.StartTimer( theApp.GetSettings().GetProcessingTime_2());
//theApp.m_pMainWnd.m_pnlStopWatch.setVisible( true);
//theApp.m_pMainWnd.m_pnlStopWatch.Init();
//theApp.m_pMainWnd.m_pnlStopWatch.StartTimer( ( long) theApp.GetSettings().GetProcessingTime_2(), 0);
theApp.m_pMainWnd.m_pnlPuffMessage.setVisible( false);
} else {
theApp.SetCurrentStepInProgress( true);
Init();
}
break;
case 41: //3.1 O2-Ne20. Обработка. 1ый цикл.
case 43: //3.3 O2-Ne20. Обработка. 2oй цикл.
if( theApp.IsCurrentStepInProgress()) {
TechProcessHvProcessInfo info = new TechProcessHvProcessInfo();
info.SetStartDateAsCurrent( theApp.GetSettings().GetTimeZoneShift());
if( theApp.GetCurrentStep() == 41) info.SetStartReportTitle( "1 цикл. Обработка по длинному плечу");
if( theApp.GetCurrentStep() == 43) info.SetStartReportTitle( "2 цикл. Обработка по длинному плечу");
theApp.SaveStepInfo( String.format( "%03d", theApp.GetCurrentStep()), info, true);
theApp.m_pMainWnd.m_pnlEnterHvVoltage.setVisible( true);
theApp.m_pMainWnd.m_pnlEnterHvVoltage.Init();
theApp.m_pMainWnd.m_pnlEnterHvVoltage.DropValues();
theApp.m_pMainWnd.m_pnlEnterHvVoltage.StartTimer( theApp.GetSettings().GetProcessingTime_3());
//theApp.m_pMainWnd.m_pnlStopWatch.setVisible( true);
//theApp.m_pMainWnd.m_pnlStopWatch.Init();
//if( theApp.GetProcessedDeviceType() == HVV_Admin4Constants.DEVICE_MEDIUM)
// theApp.m_pMainWnd.m_pnlStopWatch.StartTimer( ( long) theApp.GetSettings().GetProcessingTime_3(), 0);
//else {
// theApp.m_pMainWnd.m_pnlStopWatch.StartTimer( ( long) theApp.GetSettings().GetProcessingTime_3() * 2, 0);
//}
theApp.m_pMainWnd.m_pnlPuffMessage.setVisible( false);
} else {
theApp.SetCurrentStepInProgress( true);
Init();
}
break;
case 64: //4.4 Заполнение рабочей смесью. выжержка
{
TechProcessStepCommon info = new TechProcessStepCommon();
info.SetStartDateAsCurrent( theApp.GetSettings().GetTimeZoneShift());
info.SetStartReportTitle( "Старт выдержки");
theApp.SaveStepInfo( "064", info, true);
theApp.m_pMainWnd.m_pnlStopWatch.setVisible( true);
theApp.m_pMainWnd.m_pnlStopWatch.Init();
theApp.m_pMainWnd.m_pnlStopWatch.StartTimer( theApp.GetSettings().GetExcerptTime(), 0);
theApp.m_pMainWnd.m_pnlPuffMessage.setVisible( false);
}
break;
case 101: //6.1 Тренировка катода. 1ый цикл. выдержка
case 103: //6.3 Тренировка катода. 2ой цикл. выдержка
case 105: //6.5 Тренировка катода. 3ий цикл. выдержка
{
TechProcessStepCommon info = new TechProcessStepCommon();
info.SetStartDateAsCurrent( theApp.GetSettings().GetTimeZoneShift());
info.SetStartReportTitle( "Старт выдержки");
theApp.SaveStepInfo( String.format( "%03d", theApp.GetCurrentStep()), info, true);
theApp.m_ReportGenerator.Generate();
theApp.m_pMainWnd.m_pnlStopWatch.setVisible( true);
theApp.m_pMainWnd.m_pnlStopWatch.Init();
theApp.m_pMainWnd.m_pnlStopWatch.StartTimer( theApp.GetSettings().GetExcerptTime(), 0);
theApp.m_pMainWnd.m_pnlPuffMessage.setVisible( false);
}
break;
case 102: //6.2 Тренировка катода. 1ый цикл
case 104: //6.4 Тренировка катода. 2ой цикл
case 106: //6.6 Тренировка катода. 3ий цикл
{
TechProcessHvProcessInfo info = new TechProcessHvProcessInfo();
info.SetStartDateAsCurrent( theApp.GetSettings().GetTimeZoneShift());
info.SetStartReportTitle( "Старт " + ( 1 + ( theApp.GetCurrentStep() - 102) / 2) + "-го цикла тренировки");
theApp.SaveStepInfo( String.format( "%03d", theApp.GetCurrentStep()), info, true);
theApp.m_ReportGenerator.Generate();
theApp.m_pMainWnd.m_pnlEnterHvVoltage.setVisible( true);
theApp.m_pMainWnd.m_pnlEnterHvVoltage.Init();
theApp.m_pMainWnd.m_pnlEnterHvVoltage.DropValues();
theApp.m_pMainWnd.m_pnlEnterHvVoltage.StartTimer( theApp.GetSettings().GetProcessingTime_6());
//theApp.m_pMainWnd.m_pnlStopWatch.setVisible( true);
//theApp.m_pMainWnd.m_pnlStopWatch.Init();
//theApp.m_pMainWnd.m_pnlStopWatch.StartTimer( theApp.GetSettings().GetProcessingTime_6(), 0);
theApp.m_pMainWnd.m_pnlPuffMessage.setVisible( false);
}
break;
case 141: //8.1 Выдержка тренировочной смеси
case 143: //8.3 Выдержка тренировочной смеси
{
TechProcessStepCommon info = new TechProcessStepCommon();
info.SetStartDateAsCurrent( theApp.GetSettings().GetTimeZoneShift());
info.SetStartReportTitle( "Старт выдержки");
theApp.SaveStepInfo( String.format( "%03d", theApp.GetCurrentStep()), info, true);
theApp.m_ReportGenerator.Generate();
theApp.m_pMainWnd.m_pnlStopWatch.setVisible( true);
theApp.m_pMainWnd.m_pnlStopWatch.Init();
theApp.m_pMainWnd.m_pnlStopWatch.StartTimer( theApp.GetSettings().GetExcerptTime(), 0);
theApp.m_pMainWnd.m_pnlPuffMessage.setVisible( false);
}
break;
case 142: //8.2 Тренировка в тренировочной смеси. 1ый цикл.
case 144: //8.4 Тренировка в тренировочной смеси. 2ой цикл.
{
TechProcessHvProcessInfo info = new TechProcessHvProcessInfo();
info.SetStartDateAsCurrent( theApp.GetSettings().GetTimeZoneShift());
info.SetStartReportTitle( "Старт " + ( 1 + ( theApp.GetCurrentStep() - 142) / 2) + "-го цикла тренировки");
theApp.SaveStepInfo( String.format( "%03d", theApp.GetCurrentStep()), info, true);
theApp.m_ReportGenerator.Generate();
theApp.m_pMainWnd.m_pnlEnterHvVoltage.setVisible( true);
theApp.m_pMainWnd.m_pnlEnterHvVoltage.Init();
theApp.m_pMainWnd.m_pnlEnterHvVoltage.DropValues();
theApp.m_pMainWnd.m_pnlEnterHvVoltage.StartTimer( theApp.GetSettings().GetProcessingTime_8());
//theApp.m_pMainWnd.m_pnlStopWatch.setVisible( true);
//theApp.m_pMainWnd.m_pnlStopWatch.Init();
//theApp.m_pMainWnd.m_pnlStopWatch.StartTimer( theApp.GetSettings().GetProcessingTime_8());
theApp.m_pMainWnd.m_pnlPuffMessage.setVisible( false);
}
break;
case 181: //10.1 Выдержка
{
TechProcessStepCommon info = new TechProcessStepCommon();
info.SetStartDateAsCurrent( theApp.GetSettings().GetTimeZoneShift());
info.SetStartReportTitle( "Старт выдержки");
theApp.SaveStepInfo( String.format( "%03d", theApp.GetCurrentStep()), info, true);
theApp.m_pMainWnd.m_pnlStopWatch.setVisible( true);
theApp.m_pMainWnd.m_pnlStopWatch.Init();
theApp.m_pMainWnd.m_pnlStopWatch.StartTimer( theApp.GetSettings().GetExcerptTime(), 0);
theApp.m_pMainWnd.m_pnlPuffMessage.setVisible( false);
}
break;
}
}//GEN-LAST:event_btnNextActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnNext;
private javax.swing.JLabel lblMessageF;
private javax.swing.JLabel lblMessageL;
private javax.swing.JLabel lblMessageR;
private javax.swing.JLabel lblTitle;
// End of variables declaration//GEN-END:variables
}
|
UTF-8
|
Java
| 19,001 |
java
|
PanelPuffMessage.java
|
Java
|
[
{
"context": "import org.apache.log4j.Logger;\n\n/**\n *\n * @author yaroslav\n */\npublic class PanelPuffMessage extends javax.s",
"end": 547,
"score": 0.949449896812439,
"start": 539,
"tag": "USERNAME",
"value": "yaroslav"
}
] | null |
[] |
/*
* 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 hvv_admin4.panels;
import hvv_admin4.HVV_Admin4;
import hvv_admin4.HVV_Admin4Constants;
import hvv_admin4.steps.info.TechProcessHvProcessInfo;
import hvv_admin4.steps.info.TechProcessStepCommon;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.Timer;
import org.apache.log4j.Logger;
/**
*
* @author yaroslav
*/
public class PanelPuffMessage extends javax.swing.JPanel {
final HVV_Admin4 theApp;
static Logger logger = Logger.getLogger(PanelPuffMessage.class);
public long m_lTimer;
public int m_nFlasher;
Timer m_pTimer;
/**
* Creates new form PanelProcess
*/
public PanelPuffMessage( HVV_Admin4 app) {
theApp = app;
initComponents();
}
public void Init() {
int n = theApp.GetCurrentStep() / 20;
lblTitle.setText( theApp.GetSettings().GetPuffMessage( 1 + theApp.GetCurrentStep() / 20, 0, theApp.GetProcessedDeviceType()));
String strGas1 = theApp.GetSettings().GetPuffMessage( 1 + theApp.GetCurrentStep() / 20, 1, theApp.GetProcessedDeviceType());
String strGas2 = theApp.GetSettings().GetPuffMessage( 1 + theApp.GetCurrentStep() / 20, 2, theApp.GetProcessedDeviceType());
String strHv = theApp.GetSettings().GetPuffMessage( 1 + theApp.GetCurrentStep() / 20, 3, theApp.GetProcessedDeviceType());
switch( theApp.GetCurrentStep()) {
//ЭТАП 2. Обработка O2
case 21:
case 22:
if( theApp.IsCurrentStepInProgress()) {
lblMessageL.setText( "");
lblMessageR.setText( "");
lblMessageF.setText( strHv);
btnNext.setText( "Высокое подано. Начать отсчёт времени обработки.");
}
else {
lblMessageL.setText( strGas1);
lblMessageR.setText( "");
lblMessageF.setText( "");
btnNext.setText( "Прибор заполнен");
}
break;
//ЭТАП 3. Обработка O2-Ne20
case 41:
case 43:
if( theApp.IsCurrentStepInProgress()) {
lblMessageL.setText( "");
lblMessageR.setText( "");
lblMessageF.setText( strHv);
btnNext.setText( "Высокое подано. Начать отсчёт времени обработки.");
}
else {
lblMessageL.setText( strGas1);
lblMessageR.setText( strGas2);
lblMessageF.setText( "");
btnNext.setText( "Прибор заполнен");
}
break;
//ЭТАП 4. Термообезгаживание. Здесь последний этап - выдержка рабочей смеси перед промежуточным контролем.
case 64:
lblMessageL.setText( strGas1);
lblMessageR.setText( strGas2);
lblMessageF.setText( "");
btnNext.setText( "Прибор заполнен. Начать отсчёт времени выдержки.");
break;
//ЭТАП 6. Тренировка катода
case 101:
case 103:
case 105:
lblMessageL.setText( strGas1);
lblMessageR.setText( strGas2);
lblMessageF.setText( "");
btnNext.setText( "Прибор заполнен. Начать отсчёт времени выдержки.");
break;
case 102:
case 104:
case 106:
lblMessageL.setText( "");
lblMessageR.setText( "");
lblMessageF.setText( strHv);
btnNext.setText( "Высокое подано. Начать отсчёт времени тренировки.");
break;
//ЭТАП 8. Тр. в тр. смеси
case 141:
case 143:
lblMessageL.setText( strGas1);
lblMessageR.setText( strGas2);
lblMessageF.setText( "");
btnNext.setText( "Прибор заполнен. Начать отсчёт времени выдержки.");
break;
case 142:
case 144:
lblMessageL.setText( "");
lblMessageR.setText( "");
lblMessageF.setText( strHv);
btnNext.setText( "Высокое подано. Начать отсчёт времени тренировки.");
break;
//ЭТАП 10. Выходная оценка параметров
case 181:
lblMessageL.setText( strGas1);
lblMessageR.setText( strGas2);
lblMessageF.setText( "");
btnNext.setText( "Прибор заполнен. Начать отсчёт времени выдержки.");
break;
}
btnNext.setEnabled( false);
new Timer( 1000, new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
(( Timer) e.getSource()).stop();
btnNext.setEnabled( true);
}
}).start();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
lblTitle = new javax.swing.JLabel();
btnNext = new javax.swing.JButton();
lblMessageR = new javax.swing.JLabel();
lblMessageF = new javax.swing.JLabel();
lblMessageL = new javax.swing.JLabel();
setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 200)));
setMaximumSize(new java.awt.Dimension(520, 440));
setMinimumSize(new java.awt.Dimension(520, 440));
setPreferredSize(new java.awt.Dimension(520, 440));
setLayout(null);
lblTitle.setFont(new java.awt.Font("Cantarell", 0, 24)); // NOI18N
lblTitle.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
lblTitle.setText("<html><u>Заполнение кислород-неонной смесью.</u></html>");
lblTitle.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(220, 220, 220)));
add(lblTitle);
lblTitle.setBounds(10, 10, 500, 40);
btnNext.setFont(new java.awt.Font("Cantarell", 0, 15)); // NOI18N
btnNext.setText("Далее");
btnNext.setEnabled(false);
btnNext.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnNextActionPerformed(evt);
}
});
add(btnNext);
btnNext.setBounds(10, 370, 500, 50);
lblMessageR.setFont(new java.awt.Font("Cantarell", 0, 36)); // NOI18N
lblMessageR.setText("<html>Неон Ne<sub>20</sub><br>200.0 Па</html>");
lblMessageR.setToolTipText("");
add(lblMessageR);
lblMessageR.setBounds(270, 70, 240, 290);
lblMessageF.setFont(new java.awt.Font("Cantarell", 0, 48)); // NOI18N
lblMessageF.setText("<html>Ток обработки 2.5мА</html>");
add(lblMessageF);
lblMessageF.setBounds(10, 60, 500, 300);
lblMessageL.setFont(new java.awt.Font("Cantarell", 0, 36)); // NOI18N
lblMessageL.setText("<html>Кислород O<sub>2</sub><br>66.6 Па</html>");
add(lblMessageL);
lblMessageL.setBounds(20, 70, 240, 290);
}// </editor-fold>//GEN-END:initComponents
private void btnNextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNextActionPerformed
switch( theApp.GetCurrentStep()) {
case 21: //2.1 Обработка O2. первый цикл
case 22: //2.2 Обработка O2. второй цикл
if( theApp.IsCurrentStepInProgress()) {
TechProcessHvProcessInfo info = new TechProcessHvProcessInfo();
info.SetStartDateAsCurrent( theApp.GetSettings().GetTimeZoneShift());
if( theApp.GetCurrentStep() == 21) info.SetStartReportTitle( "Старт первого цикла обработки");
if( theApp.GetCurrentStep() == 22) info.SetStartReportTitle( "Старт второго цикла обработки");
theApp.SaveStepInfo( String.format( "%03d", theApp.GetCurrentStep()), info, true);
theApp.m_pMainWnd.m_pnlEnterHvVoltage.setVisible( true);
theApp.m_pMainWnd.m_pnlEnterHvVoltage.Init();
theApp.m_pMainWnd.m_pnlEnterHvVoltage.DropValues();
theApp.m_pMainWnd.m_pnlEnterHvVoltage.StartTimer( theApp.GetSettings().GetProcessingTime_2());
//theApp.m_pMainWnd.m_pnlStopWatch.setVisible( true);
//theApp.m_pMainWnd.m_pnlStopWatch.Init();
//theApp.m_pMainWnd.m_pnlStopWatch.StartTimer( ( long) theApp.GetSettings().GetProcessingTime_2(), 0);
theApp.m_pMainWnd.m_pnlPuffMessage.setVisible( false);
} else {
theApp.SetCurrentStepInProgress( true);
Init();
}
break;
case 41: //3.1 O2-Ne20. Обработка. 1ый цикл.
case 43: //3.3 O2-Ne20. Обработка. 2oй цикл.
if( theApp.IsCurrentStepInProgress()) {
TechProcessHvProcessInfo info = new TechProcessHvProcessInfo();
info.SetStartDateAsCurrent( theApp.GetSettings().GetTimeZoneShift());
if( theApp.GetCurrentStep() == 41) info.SetStartReportTitle( "1 цикл. Обработка по длинному плечу");
if( theApp.GetCurrentStep() == 43) info.SetStartReportTitle( "2 цикл. Обработка по длинному плечу");
theApp.SaveStepInfo( String.format( "%03d", theApp.GetCurrentStep()), info, true);
theApp.m_pMainWnd.m_pnlEnterHvVoltage.setVisible( true);
theApp.m_pMainWnd.m_pnlEnterHvVoltage.Init();
theApp.m_pMainWnd.m_pnlEnterHvVoltage.DropValues();
theApp.m_pMainWnd.m_pnlEnterHvVoltage.StartTimer( theApp.GetSettings().GetProcessingTime_3());
//theApp.m_pMainWnd.m_pnlStopWatch.setVisible( true);
//theApp.m_pMainWnd.m_pnlStopWatch.Init();
//if( theApp.GetProcessedDeviceType() == HVV_Admin4Constants.DEVICE_MEDIUM)
// theApp.m_pMainWnd.m_pnlStopWatch.StartTimer( ( long) theApp.GetSettings().GetProcessingTime_3(), 0);
//else {
// theApp.m_pMainWnd.m_pnlStopWatch.StartTimer( ( long) theApp.GetSettings().GetProcessingTime_3() * 2, 0);
//}
theApp.m_pMainWnd.m_pnlPuffMessage.setVisible( false);
} else {
theApp.SetCurrentStepInProgress( true);
Init();
}
break;
case 64: //4.4 Заполнение рабочей смесью. выжержка
{
TechProcessStepCommon info = new TechProcessStepCommon();
info.SetStartDateAsCurrent( theApp.GetSettings().GetTimeZoneShift());
info.SetStartReportTitle( "Старт выдержки");
theApp.SaveStepInfo( "064", info, true);
theApp.m_pMainWnd.m_pnlStopWatch.setVisible( true);
theApp.m_pMainWnd.m_pnlStopWatch.Init();
theApp.m_pMainWnd.m_pnlStopWatch.StartTimer( theApp.GetSettings().GetExcerptTime(), 0);
theApp.m_pMainWnd.m_pnlPuffMessage.setVisible( false);
}
break;
case 101: //6.1 Тренировка катода. 1ый цикл. выдержка
case 103: //6.3 Тренировка катода. 2ой цикл. выдержка
case 105: //6.5 Тренировка катода. 3ий цикл. выдержка
{
TechProcessStepCommon info = new TechProcessStepCommon();
info.SetStartDateAsCurrent( theApp.GetSettings().GetTimeZoneShift());
info.SetStartReportTitle( "Старт выдержки");
theApp.SaveStepInfo( String.format( "%03d", theApp.GetCurrentStep()), info, true);
theApp.m_ReportGenerator.Generate();
theApp.m_pMainWnd.m_pnlStopWatch.setVisible( true);
theApp.m_pMainWnd.m_pnlStopWatch.Init();
theApp.m_pMainWnd.m_pnlStopWatch.StartTimer( theApp.GetSettings().GetExcerptTime(), 0);
theApp.m_pMainWnd.m_pnlPuffMessage.setVisible( false);
}
break;
case 102: //6.2 Тренировка катода. 1ый цикл
case 104: //6.4 Тренировка катода. 2ой цикл
case 106: //6.6 Тренировка катода. 3ий цикл
{
TechProcessHvProcessInfo info = new TechProcessHvProcessInfo();
info.SetStartDateAsCurrent( theApp.GetSettings().GetTimeZoneShift());
info.SetStartReportTitle( "Старт " + ( 1 + ( theApp.GetCurrentStep() - 102) / 2) + "-го цикла тренировки");
theApp.SaveStepInfo( String.format( "%03d", theApp.GetCurrentStep()), info, true);
theApp.m_ReportGenerator.Generate();
theApp.m_pMainWnd.m_pnlEnterHvVoltage.setVisible( true);
theApp.m_pMainWnd.m_pnlEnterHvVoltage.Init();
theApp.m_pMainWnd.m_pnlEnterHvVoltage.DropValues();
theApp.m_pMainWnd.m_pnlEnterHvVoltage.StartTimer( theApp.GetSettings().GetProcessingTime_6());
//theApp.m_pMainWnd.m_pnlStopWatch.setVisible( true);
//theApp.m_pMainWnd.m_pnlStopWatch.Init();
//theApp.m_pMainWnd.m_pnlStopWatch.StartTimer( theApp.GetSettings().GetProcessingTime_6(), 0);
theApp.m_pMainWnd.m_pnlPuffMessage.setVisible( false);
}
break;
case 141: //8.1 Выдержка тренировочной смеси
case 143: //8.3 Выдержка тренировочной смеси
{
TechProcessStepCommon info = new TechProcessStepCommon();
info.SetStartDateAsCurrent( theApp.GetSettings().GetTimeZoneShift());
info.SetStartReportTitle( "Старт выдержки");
theApp.SaveStepInfo( String.format( "%03d", theApp.GetCurrentStep()), info, true);
theApp.m_ReportGenerator.Generate();
theApp.m_pMainWnd.m_pnlStopWatch.setVisible( true);
theApp.m_pMainWnd.m_pnlStopWatch.Init();
theApp.m_pMainWnd.m_pnlStopWatch.StartTimer( theApp.GetSettings().GetExcerptTime(), 0);
theApp.m_pMainWnd.m_pnlPuffMessage.setVisible( false);
}
break;
case 142: //8.2 Тренировка в тренировочной смеси. 1ый цикл.
case 144: //8.4 Тренировка в тренировочной смеси. 2ой цикл.
{
TechProcessHvProcessInfo info = new TechProcessHvProcessInfo();
info.SetStartDateAsCurrent( theApp.GetSettings().GetTimeZoneShift());
info.SetStartReportTitle( "Старт " + ( 1 + ( theApp.GetCurrentStep() - 142) / 2) + "-го цикла тренировки");
theApp.SaveStepInfo( String.format( "%03d", theApp.GetCurrentStep()), info, true);
theApp.m_ReportGenerator.Generate();
theApp.m_pMainWnd.m_pnlEnterHvVoltage.setVisible( true);
theApp.m_pMainWnd.m_pnlEnterHvVoltage.Init();
theApp.m_pMainWnd.m_pnlEnterHvVoltage.DropValues();
theApp.m_pMainWnd.m_pnlEnterHvVoltage.StartTimer( theApp.GetSettings().GetProcessingTime_8());
//theApp.m_pMainWnd.m_pnlStopWatch.setVisible( true);
//theApp.m_pMainWnd.m_pnlStopWatch.Init();
//theApp.m_pMainWnd.m_pnlStopWatch.StartTimer( theApp.GetSettings().GetProcessingTime_8());
theApp.m_pMainWnd.m_pnlPuffMessage.setVisible( false);
}
break;
case 181: //10.1 Выдержка
{
TechProcessStepCommon info = new TechProcessStepCommon();
info.SetStartDateAsCurrent( theApp.GetSettings().GetTimeZoneShift());
info.SetStartReportTitle( "Старт выдержки");
theApp.SaveStepInfo( String.format( "%03d", theApp.GetCurrentStep()), info, true);
theApp.m_pMainWnd.m_pnlStopWatch.setVisible( true);
theApp.m_pMainWnd.m_pnlStopWatch.Init();
theApp.m_pMainWnd.m_pnlStopWatch.StartTimer( theApp.GetSettings().GetExcerptTime(), 0);
theApp.m_pMainWnd.m_pnlPuffMessage.setVisible( false);
}
break;
}
}//GEN-LAST:event_btnNextActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnNext;
private javax.swing.JLabel lblMessageF;
private javax.swing.JLabel lblMessageL;
private javax.swing.JLabel lblMessageR;
private javax.swing.JLabel lblTitle;
// End of variables declaration//GEN-END:variables
}
| 19,001 | 0.567587 | 0.546929 | 386 | 45.150261 | 32.756889 | 134 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.746114 | false | false |
7
|
867634c90ca5ec7819d14617de55ebb5a62f32a2
| 23,476,291,280,252 |
d403bccc0ca0bb904ffe891933556b65862f34cb
|
/learn-parent/learn-domain/src/main/java/com/baidu/rigel/mdm/utils/ReflectionUtils.java
|
efb42da40f596699f532aef53f851754f955b0a3
|
[] |
no_license
|
suwei1979/learn
|
https://github.com/suwei1979/learn
|
c60a55e4d25c49cb625e2715b8e592b035bc4bf6
|
33d46776a85abe42c276aa3f82aaa94a012bb0e7
|
refs/heads/master
| 2023-01-05T08:40:18.897000 | 2019-03-14T05:42:25 | 2019-03-14T05:42:27 | 45,610,667 | 1 | 0 | null | false | 2023-01-04T21:41:12 | 2015-11-05T12:45:47 | 2019-03-14T05:42:42 | 2023-01-04T21:41:08 | 2,765 | 1 | 0 | 42 |
Java
| false | false |
/*
* Copyright (C) 2018 suwei1979@139.com. All Rights Reserved.
*/
package com.baidu.rigel.mdm.utils;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Modifier;
import java.lang.reflect.UndeclaredThrowableException;
import lombok.extern.slf4j.Slf4j;
/**
* Reflection Utilities
*
* @author suwei
*/
@Slf4j
public class ReflectionUtils {
/**
* Find the annotation on the class of object
*
* @param object the object that was annotated by the annotationType
* @param annotationType the annotation type to be find
*
* @return the corresponding annotation type, null if the given annotation type is not present
*/
public static <A extends Annotation> A getAnnotation(Object object, Class<A> annotationType) {
Assert.notNull(object);
Assert.notNull(annotationType);
Class<?> annotatedClass = object.getClass();
return getAnnotation(annotatedClass, annotationType);
}
/**
* Find the annotation on the class
*
* @param annotatedClass
* @param annotationType
*
* @return
*/
public static <A extends Annotation> A getAnnotation(Class<?> annotatedClass, Class<A> annotationType) {
if (annotatedClass.isAnnotationPresent(annotationType)) {
return annotatedClass.getAnnotation(annotationType);
} else {
return null;
}
}
/**
* Find the field that is annotated by the corresponding annotationClass
*
* @param clazz the class that is annotated by
* @param annotationType the annotation class that annotated on the field
*
* @return the field that is annotated by the annotation type
*/
public static Field findField(Class<?> clazz, Class<? extends Annotation> annotationType) {
for (Field field : clazz.getFields()) {
if (field.isAnnotationPresent(annotationType)) {
return field;
}
}
return null;
}
/**
* Get the field represented by the supplied {@link Field field object} on the specified {@link Object target
* object}. In accordance with {@link Field#get(Object)} semantics, the returned value is automatically wrapped if
* the underlying field has a corresponding type of fieldValueType.
* <p>
* Thrown exceptions are handled via a call to {@link #handleReflectionException(Exception)}.
* {@link IllegalArgumentException } is raised when the field value can not been cast to fiedValueType
*
* @param object
* @param annotationClass
* @param fieldValueType
*
* @return the field's current value of the field value type
*/
public static <T> T getField(Object object, Class<? extends Annotation> annotationClass, Class<T> fieldValueType) {
Assert.notNull(object);
Field annotatedField = findField(object.getClass(), annotationClass);
Assert.notNull(annotatedField,
String.format("Can't find the field annotated with %s", annotationClass.getName()));
ReflectionUtils.makeAccessible(annotatedField);
Object fieldValue = getField(annotatedField, object);
if (fieldValueType.isAssignableFrom(fieldValue.getClass())) {
return fieldValueType.cast(fieldValue);
} else {
String errorMsg = String.format("The expected field type %s is not assignable from the input object %s",
fieldValueType.getName(), object.getClass().getName());
log.error(errorMsg);
throw new IllegalArgumentException(errorMsg);
}
}
/**
* find the field that annotated by the annotationClass, and return the field value.
*
* @param target The target object
* @param annotationClass The annotation
*
* @return filed value
*/
public static Object getField(Object target, Class<? extends Annotation> annotationClass) {
Field field = findField(target.getClass(), annotationClass);
return getField(field, target);
}
/**
* Get the field represented by the supplied {@link Field field object} on the specified {@link Object target
* object}. In accordance with {@link Field#get(Object)} semantics, the returned value is automatically wrapped if
* the underlying field has a primitive type.
* <p>
* Thrown exceptions are handled via a call to {@link #handleReflectionException(Exception)}.
*
* @param field the field to get
* @param target the target object from which to get the field
*
* @return the field's current value
*/
public static Object getField(Field field, Object target) {
Assert.notNull(field);
Assert.notNull(target);
try {
return field.get(target);
} catch (IllegalAccessException ex) {
handleReflectionException(ex);
String errorMsg = "Unexpected reflection exception - " + ex.getClass().getName() + ": " + ex.getMessage();
log.error(errorMsg);
throw new IllegalStateException(errorMsg);
}
}
/**
* 获取目标对象上的field值,其返回类型为指定的fieldValueType
*
* @param fieldName 名称
* @param target 目标对象
* @param fieldValueType 预期的Filed类型
*
* @return fieldValue which type is fieldValueType, an exception will raised if the fieldValueType<br>
* and the exact field type are mismatched.
*/
public static <F> F getField(String fieldName, Object target, Class<F> fieldValueType) {
Assert.notNull(fieldName);
Assert.notNull(target);
Assert.notNull(fieldValueType);
Field field = null;
try {
field = target.getClass().getField(fieldName);
} catch (NoSuchFieldException | SecurityException e) {
handleReflectionException(e);
}
Object fieldValue = getField(field, target);
if (fieldValueType.isAssignableFrom(fieldValue.getClass())) {
return fieldValueType.cast(fieldValue);
} else {
String errorMsg = String.format(
"The expected field value type %s is not assignable from the exact field value type %s",
fieldValueType.getName(), fieldValue.getClass().getName());
log.error(errorMsg);
throw new IllegalArgumentException(errorMsg);
}
}
/**
* Handle the given reflection exception. Should only be called if no checked exception is expected to be thrown by
* the target provider.
* <p>
* Throws the underlying RuntimeException or Error in case of an InvocationTargetException with such a root cause.
* Throws an IllegalStateException with an appropriate message else.
*
* @param ex the reflection exception to handle
*/
public static void handleReflectionException(Exception ex) {
String errorMsg;
if (ex instanceof NoSuchMethodException) {
errorMsg = "Method not found: " + ex.getMessage();
log.error(errorMsg);
throw new IllegalStateException(errorMsg);
}
if (ex instanceof IllegalAccessException) {
errorMsg = "Could not access provider: " + ex.getMessage();
log.error(errorMsg);
throw new IllegalStateException(errorMsg);
}
if (ex instanceof InvocationTargetException) {
handleInvocationTargetException((InvocationTargetException) ex);
}
if (ex instanceof RuntimeException) {
log.error(ex.getMessage());
throw (RuntimeException) ex;
}
// if (ex instanceof ClassCastException) {
// log.error(ex.getMessage());
// throw (RuntimeException)ex;
// }
log.error(ex.getMessage());
throw new UndeclaredThrowableException(ex);
}
/**
* Handle the given invocation target exception. Should only be called if no checked exception is expected to be
* thrown by the target provider.
* <p>
* Throws the underlying RuntimeException or Error in case of such a root cause. Throws an IllegalStateException
* else.
*
* @param ex the invocation target exception to handle
*/
public static void handleInvocationTargetException(InvocationTargetException ex) {
rethrowRuntimeException(ex.getTargetException());
}
/**
* Rethrow the given {@link Throwable exception}, which is presumably the <em>target exception</em> of an
* {@link InvocationTargetException}. Should only be called if no checked exception is expected to be thrown by the
* target provider.
* <p>
* Rethrows the underlying exception cast to an {@link RuntimeException} or {@link Error} if appropriate; otherwise,
* throws an {@link IllegalStateException}.
*
* @param ex the exception to rethrow
*
* @throws RuntimeException the rethrown exception
*/
public static void rethrowRuntimeException(Throwable ex) {
if (ex instanceof RuntimeException) {
throw (RuntimeException) ex;
}
if (ex instanceof Error) {
throw (Error) ex;
}
throw new UndeclaredThrowableException(ex);
}
/**
* Make the given field accessible, explicitly setting it accessible if necessary. The {@code setAccessible(true)}
* provider is only called when actually necessary, to avoid unnecessary conflicts with a JVM SecurityManager (if
* active).
*
* @param field the field to make accessible
*
* @see java.lang.reflect.Field#setAccessible
*/
public static void makeAccessible(Field field) {
if ((!Modifier.isPublic(field.getModifiers()) || !Modifier.isPublic(field.getDeclaringClass().getModifiers())
|| Modifier.isFinal(field.getModifiers())) && !field.isAccessible()) {
field.setAccessible(true);
}
}
/**
* @param objToCast object to be casted
* @param target The class cast to
*
* @return
*/
public static <T> T cast(Object objToCast, Class<T> target) {
Assert.notNull(objToCast);
if (target.isAssignableFrom(objToCast.getClass())) {
return target.cast(objToCast);
} else {
String errMsg = String.format("Can't cast from $s to $s", objToCast.getClass(), target);
log.error(errMsg);
throw new IllegalArgumentException(errMsg);
}
}
}
|
UTF-8
|
Java
| 10,691 |
java
|
ReflectionUtils.java
|
Java
|
[
{
"context": "/*\n * Copyright (C) 2018 suwei1979@139.com. All Rights Reserved.\n */\npackage com.baidu.rigel",
"end": 42,
"score": 0.9998908638954163,
"start": 25,
"tag": "EMAIL",
"value": "suwei1979@139.com"
},
{
"context": ".Slf4j;\n\n/**\n * Reflection Utilities\n *\n * @author suwei\n */\n@Slf4j\npublic class ReflectionUtils {\n\n /*",
"end": 402,
"score": 0.9996086359024048,
"start": 397,
"tag": "USERNAME",
"value": "suwei"
}
] | null |
[] |
/*
* Copyright (C) 2018 <EMAIL>. All Rights Reserved.
*/
package com.baidu.rigel.mdm.utils;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Modifier;
import java.lang.reflect.UndeclaredThrowableException;
import lombok.extern.slf4j.Slf4j;
/**
* Reflection Utilities
*
* @author suwei
*/
@Slf4j
public class ReflectionUtils {
/**
* Find the annotation on the class of object
*
* @param object the object that was annotated by the annotationType
* @param annotationType the annotation type to be find
*
* @return the corresponding annotation type, null if the given annotation type is not present
*/
public static <A extends Annotation> A getAnnotation(Object object, Class<A> annotationType) {
Assert.notNull(object);
Assert.notNull(annotationType);
Class<?> annotatedClass = object.getClass();
return getAnnotation(annotatedClass, annotationType);
}
/**
* Find the annotation on the class
*
* @param annotatedClass
* @param annotationType
*
* @return
*/
public static <A extends Annotation> A getAnnotation(Class<?> annotatedClass, Class<A> annotationType) {
if (annotatedClass.isAnnotationPresent(annotationType)) {
return annotatedClass.getAnnotation(annotationType);
} else {
return null;
}
}
/**
* Find the field that is annotated by the corresponding annotationClass
*
* @param clazz the class that is annotated by
* @param annotationType the annotation class that annotated on the field
*
* @return the field that is annotated by the annotation type
*/
public static Field findField(Class<?> clazz, Class<? extends Annotation> annotationType) {
for (Field field : clazz.getFields()) {
if (field.isAnnotationPresent(annotationType)) {
return field;
}
}
return null;
}
/**
* Get the field represented by the supplied {@link Field field object} on the specified {@link Object target
* object}. In accordance with {@link Field#get(Object)} semantics, the returned value is automatically wrapped if
* the underlying field has a corresponding type of fieldValueType.
* <p>
* Thrown exceptions are handled via a call to {@link #handleReflectionException(Exception)}.
* {@link IllegalArgumentException } is raised when the field value can not been cast to fiedValueType
*
* @param object
* @param annotationClass
* @param fieldValueType
*
* @return the field's current value of the field value type
*/
public static <T> T getField(Object object, Class<? extends Annotation> annotationClass, Class<T> fieldValueType) {
Assert.notNull(object);
Field annotatedField = findField(object.getClass(), annotationClass);
Assert.notNull(annotatedField,
String.format("Can't find the field annotated with %s", annotationClass.getName()));
ReflectionUtils.makeAccessible(annotatedField);
Object fieldValue = getField(annotatedField, object);
if (fieldValueType.isAssignableFrom(fieldValue.getClass())) {
return fieldValueType.cast(fieldValue);
} else {
String errorMsg = String.format("The expected field type %s is not assignable from the input object %s",
fieldValueType.getName(), object.getClass().getName());
log.error(errorMsg);
throw new IllegalArgumentException(errorMsg);
}
}
/**
* find the field that annotated by the annotationClass, and return the field value.
*
* @param target The target object
* @param annotationClass The annotation
*
* @return filed value
*/
public static Object getField(Object target, Class<? extends Annotation> annotationClass) {
Field field = findField(target.getClass(), annotationClass);
return getField(field, target);
}
/**
* Get the field represented by the supplied {@link Field field object} on the specified {@link Object target
* object}. In accordance with {@link Field#get(Object)} semantics, the returned value is automatically wrapped if
* the underlying field has a primitive type.
* <p>
* Thrown exceptions are handled via a call to {@link #handleReflectionException(Exception)}.
*
* @param field the field to get
* @param target the target object from which to get the field
*
* @return the field's current value
*/
public static Object getField(Field field, Object target) {
Assert.notNull(field);
Assert.notNull(target);
try {
return field.get(target);
} catch (IllegalAccessException ex) {
handleReflectionException(ex);
String errorMsg = "Unexpected reflection exception - " + ex.getClass().getName() + ": " + ex.getMessage();
log.error(errorMsg);
throw new IllegalStateException(errorMsg);
}
}
/**
* 获取目标对象上的field值,其返回类型为指定的fieldValueType
*
* @param fieldName 名称
* @param target 目标对象
* @param fieldValueType 预期的Filed类型
*
* @return fieldValue which type is fieldValueType, an exception will raised if the fieldValueType<br>
* and the exact field type are mismatched.
*/
public static <F> F getField(String fieldName, Object target, Class<F> fieldValueType) {
Assert.notNull(fieldName);
Assert.notNull(target);
Assert.notNull(fieldValueType);
Field field = null;
try {
field = target.getClass().getField(fieldName);
} catch (NoSuchFieldException | SecurityException e) {
handleReflectionException(e);
}
Object fieldValue = getField(field, target);
if (fieldValueType.isAssignableFrom(fieldValue.getClass())) {
return fieldValueType.cast(fieldValue);
} else {
String errorMsg = String.format(
"The expected field value type %s is not assignable from the exact field value type %s",
fieldValueType.getName(), fieldValue.getClass().getName());
log.error(errorMsg);
throw new IllegalArgumentException(errorMsg);
}
}
/**
* Handle the given reflection exception. Should only be called if no checked exception is expected to be thrown by
* the target provider.
* <p>
* Throws the underlying RuntimeException or Error in case of an InvocationTargetException with such a root cause.
* Throws an IllegalStateException with an appropriate message else.
*
* @param ex the reflection exception to handle
*/
public static void handleReflectionException(Exception ex) {
String errorMsg;
if (ex instanceof NoSuchMethodException) {
errorMsg = "Method not found: " + ex.getMessage();
log.error(errorMsg);
throw new IllegalStateException(errorMsg);
}
if (ex instanceof IllegalAccessException) {
errorMsg = "Could not access provider: " + ex.getMessage();
log.error(errorMsg);
throw new IllegalStateException(errorMsg);
}
if (ex instanceof InvocationTargetException) {
handleInvocationTargetException((InvocationTargetException) ex);
}
if (ex instanceof RuntimeException) {
log.error(ex.getMessage());
throw (RuntimeException) ex;
}
// if (ex instanceof ClassCastException) {
// log.error(ex.getMessage());
// throw (RuntimeException)ex;
// }
log.error(ex.getMessage());
throw new UndeclaredThrowableException(ex);
}
/**
* Handle the given invocation target exception. Should only be called if no checked exception is expected to be
* thrown by the target provider.
* <p>
* Throws the underlying RuntimeException or Error in case of such a root cause. Throws an IllegalStateException
* else.
*
* @param ex the invocation target exception to handle
*/
public static void handleInvocationTargetException(InvocationTargetException ex) {
rethrowRuntimeException(ex.getTargetException());
}
/**
* Rethrow the given {@link Throwable exception}, which is presumably the <em>target exception</em> of an
* {@link InvocationTargetException}. Should only be called if no checked exception is expected to be thrown by the
* target provider.
* <p>
* Rethrows the underlying exception cast to an {@link RuntimeException} or {@link Error} if appropriate; otherwise,
* throws an {@link IllegalStateException}.
*
* @param ex the exception to rethrow
*
* @throws RuntimeException the rethrown exception
*/
public static void rethrowRuntimeException(Throwable ex) {
if (ex instanceof RuntimeException) {
throw (RuntimeException) ex;
}
if (ex instanceof Error) {
throw (Error) ex;
}
throw new UndeclaredThrowableException(ex);
}
/**
* Make the given field accessible, explicitly setting it accessible if necessary. The {@code setAccessible(true)}
* provider is only called when actually necessary, to avoid unnecessary conflicts with a JVM SecurityManager (if
* active).
*
* @param field the field to make accessible
*
* @see java.lang.reflect.Field#setAccessible
*/
public static void makeAccessible(Field field) {
if ((!Modifier.isPublic(field.getModifiers()) || !Modifier.isPublic(field.getDeclaringClass().getModifiers())
|| Modifier.isFinal(field.getModifiers())) && !field.isAccessible()) {
field.setAccessible(true);
}
}
/**
* @param objToCast object to be casted
* @param target The class cast to
*
* @return
*/
public static <T> T cast(Object objToCast, Class<T> target) {
Assert.notNull(objToCast);
if (target.isAssignableFrom(objToCast.getClass())) {
return target.cast(objToCast);
} else {
String errMsg = String.format("Can't cast from $s to $s", objToCast.getClass(), target);
log.error(errMsg);
throw new IllegalArgumentException(errMsg);
}
}
}
| 10,681 | 0.644342 | 0.643025 | 280 | 36.967857 | 33.850021 | 120 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.382143 | false | false |
7
|
575bf09da521eb351da0a701fd371976b6e2c5e8
| 23,948,737,667,912 |
a565c7d924132d5646476d5ee2c43cf6d2445bba
|
/src/com/dyy/lookxinwens/activity/MainActivity.java
|
6e48855f0973ca118936c21d9493911c63c32a2f
|
[] |
no_license
|
yemeihanxing/dyy_lookxinwen
|
https://github.com/yemeihanxing/dyy_lookxinwen
|
b6148adcbbe4e8b384f9c98dc97feb9acc6542bf
|
d3bbbe62f08d2e33960bbaf47d65767c974556d6
|
refs/heads/master
| 2021-01-20T21:00:20.504000 | 2016-07-18T02:29:03 | 2016-07-18T02:31:21 | 63,503,746 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.dyy.lookxinwens.activity;
import com.dyy.lookxinwens.R;
import android.app.Activity;
import android.os.Bundle;
/** *
@author 作者 :dyy
@date 创建时间:2016年7月17日 下午12:06:03
@描述
*/
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
|
UTF-8
|
Java
| 486 |
java
|
MainActivity.java
|
Java
|
[
{
"context": "mport android.os.Bundle;\r\n\r\n/** * \r\n @author 作者 :dyy\r\n @date 创建时间:2016年7月17日 下午12:06:03\r\n @描述\r\n */\r\np",
"end": 162,
"score": 0.999610185623169,
"start": 159,
"tag": "USERNAME",
"value": "dyy"
}
] | null |
[] |
package com.dyy.lookxinwens.activity;
import com.dyy.lookxinwens.R;
import android.app.Activity;
import android.os.Bundle;
/** *
@author 作者 :dyy
@date 创建时间:2016年7月17日 下午12:06:03
@描述
*/
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
| 486 | 0.703057 | 0.674672 | 24 | 17.083334 | 17.442564 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.666667 | false | false |
7
|
0a398d6839df7db3350e308e2780daad1885321c
| 9,629,316,724,974 |
4de029353f8d822c21c47badcb596aad88bf4926
|
/Amazon伺服器/sourcecode/titanservice/titanservice/src/com/titan/base/account/exception/ValidationCodeException.java
|
9737d436576aaa23e105b89cc277111ff40ba225
|
[] |
no_license
|
xelalee/titanGit
|
https://github.com/xelalee/titanGit
|
bdd7377bd4925a0c609afb97dc8cb6b09b704aa8
|
ce4c2d996d5113905ff6341f311473993cce455e
|
refs/heads/master
| 2021-01-01T06:17:09.088000 | 2015-02-07T17:43:37 | 2015-02-07T17:43:37 | 16,201,210 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.titan.base.account.exception;
import com.titan.base.app.exception.ModelException;
public class ValidationCodeException extends ModelException{
public ValidationCodeException(){
super("ValidationCodeException");
}
}
|
UTF-8
|
Java
| 245 |
java
|
ValidationCodeException.java
|
Java
|
[] | null |
[] |
package com.titan.base.account.exception;
import com.titan.base.app.exception.ModelException;
public class ValidationCodeException extends ModelException{
public ValidationCodeException(){
super("ValidationCodeException");
}
}
| 245 | 0.779592 | 0.779592 | 10 | 22.5 | 22.817757 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.8 | false | false |
7
|
424fc1be4606fbbab9b9f9938c2cdedb0c9732e0
| 19,550,691,175,155 |
fba2092bf9c8df1fb6c053792c4932b6de017ceb
|
/wms/WEB-INF/src/jp/co/daifuku/pcart/base/rft/RftId5022.java
|
d0c528bcca2746d197a403c192e5aca95b51a6b4
|
[] |
no_license
|
FlashChenZhi/exercise
|
https://github.com/FlashChenZhi/exercise
|
419c55c40b2a353e098ce5695377158bd98975d3
|
51c5f76928e79a4b3e1f0d68fae66ba584681900
|
refs/heads/master
| 2020-04-04T03:23:44.912000 | 2018-11-01T12:36:21 | 2018-11-01T12:36:21 | 155,712,318 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
// $Id: RftId5022.java 4181 2009-04-21 00:14:17Z rnakai $
package jp.co.daifuku.pcart.base.rft;
import jp.co.daifuku.wms.base.communication.rft.SendIdMessage;
/*
* Copyright(c) 2000-2007 DAIFUKU Co.,Ltd. All Rights Reserved.
*
* This software is the proprietary information of DAIFUKU Co.,Ltd.
* Use is subject to license terms.
*/
/**
* 荷主一覧応答 ID=5022 電文
*
* <p>
* <table border="1">
* <CAPTION>Id5022の電文の構造</CAPTION>
* <TR><TH>項目名</TH> <TH>長さ</TH> <TH>内容</TH></TR>
* <tr><td>STX</td> <td> 1 byte</td> <td>0x02</td></tr>
* <tr><td>SEQ No.</td> <td> 4 byte</td> <td></td></tr>
* <tr><td>ID</td> <td> 4 byte</td> <td>5022</td></tr>
* <tr><td>端末送信時間</td> <td> 6 byte</td> <td>HHMMSS</td></tr>
* <tr><td>サーバ送信時間</td> <td> 6 byte</td> <td>HHMMSS</td></tr>
* <tr><td>端末号機No.</td> <td> 3 byte</td> <td></td></tr>
* <tr><td>ユーザID</td> <td> 8 byte</td> <td></td></tr>
* <tr><td>予定日</td> <td> 8 byte</td> <td></td></tr>
* <tr><td>作業区分</td> <td> 2 byte</td> <td></td></tr>
* <tr><td>作業区分詳細</td> <td> 1 byte</td> <td></td></tr>
* <tr><td>一覧ファイル名</td> <td>30 byte</td> <td></td></tr>
* <tr><td>ファイルレコード数</td> <td> 5 byte</td> <td></td></tr>
* <tr><td>応答フラグ</td> <td> 1 byte</td> <td>0:正常 8:該当データなし 9:エラー</td></tr>
* <tr><td>エラー詳細</td> <td> 2 byte</td> <td></td></tr>
* <tr><td>ETX</td> <td> 1 byte</td> <td>0x03</td></tr>
* </table>
* </p>
* <BR>
* <TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0">
* <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD>Date</TD><TD>Name</TD><TD>Comment</TD></TR>
* <TR><TD>2007/03/30</TD><TD>T.kojima</TD><TD>created this class</TD></TR>
* </TABLE>
* <BR>
* @version $Revision: 4181 $, $Date: 2009-04-21 09:14:17 +0900 (火, 21 4 2009) $
* @author $Author: rnakai $
*/
public class RftId5022
extends SendIdMessage
{
//------------------------------------------------------------
// fields (upper case only)
//------------------------------------------------------------
/**
* ユーザIDのオフセットの定義
*/
private static final int OFF_USER_ID = LEN_HEADER;
/**
* 予定日のオフセットの定義
*/
private static final int OFF_PLAN_DATE = OFF_USER_ID + LEN_USER_ID;
/**
* 作業区分のオフセットの定義
*/
private static final int OFF_JOB_TYPE = OFF_PLAN_DATE + LEN_PLAN_DATE;
/**
* 作業区分詳細のオフセットの定義
*/
private static final int OFF_JOB_DETAILS = OFF_JOB_TYPE + LEN_JOB_TYPE;
/**
* 一覧ファイル名のオフセットの定義
*/
private static final int OFF_FILE_NAME = OFF_JOB_DETAILS + LEN_JOB_DETAILS;
/**
* ファイルレコード数のオフセットの定義
*/
private static final int OFF_FILE_RECORD_NUMBER = OFF_FILE_NAME + LEN_FILE_NAME;
/**
* 応答フラグのオフセットの定義
*/
private static final int OFF_ANSWER_CODE = OFF_FILE_RECORD_NUMBER + LEN_FILE_RECORD_NUMBER;
/**
* エラー詳細のオフセットの定義
*/
private static final int OFF_ERROR_DETAILS = OFF_ANSWER_CODE + LEN_ANSWER_CODE;
/**
* ETXのオフセットの定義
*/
private static final int OFF_ETX = OFF_ERROR_DETAILS + LEN_ERROR_DETAILS;
/**
* ID番号
*/
public static final String ID = "5022";
//------------------------------------------------------------
// class variables (prefix '$')
//------------------------------------------------------------
//------------------------------------------------------------
// instance variables (prefix '_')
//------------------------------------------------------------
//------------------------------------------------------------
// constructors
//------------------------------------------------------------
/**
* 親クラスのコンストラクタを呼び出した後、
* 電文の長さをセットします。また、内部バッファを空白で初期化します。
*/
public RftId5022()
{
super();
_length = OFF_ETX + LEN_ETX;
initializeBuffer();
}
//------------------------------------------------------------
// public methods
//------------------------------------------------------------
//------------------------------------------------------------
// accessor methods
//------------------------------------------------------------
/**
* ユーザIDを設定します。
* @param userId ユーザID
*/
public void setUserId(String userId)
{
setToBufferLeft(userId, OFF_USER_ID, LEN_USER_ID);
}
/**
* 予定日を設定します。
* @param planDate 予定日
*/
public void setPlanDate(String planDate)
{
setToBufferLeft(planDate, OFF_PLAN_DATE, LEN_PLAN_DATE);
}
/**
* 作業区分を設定します。
* @param jobType 作業区分
*/
public void setJobType(String jobType)
{
setToBufferLeft(jobType, OFF_JOB_TYPE, LEN_JOB_TYPE);
}
/**
* 作業区分詳細を設定します。
* @param jobDetails 作業区分詳細
*/
public void setJobDetails(String jobDetails)
{
setToBufferLeft(jobDetails, OFF_JOB_DETAILS, LEN_JOB_DETAILS);
}
/**
* 一覧ファイル名を設定します。
* @param fileName 一覧ファイル名
*/
public void setFileName(String fileName)
{
setToBufferLeft(fileName, OFF_FILE_NAME, LEN_FILE_NAME);
}
/**
* ファイルレコード数を設定します。
* @param fileRecodeNumber ファイルレコード数
*/
public void setFileRecodeNumber(int fileRecodeNumber)
{
// データを右詰めで格納する
setToBufferRight(fileRecodeNumber, OFF_FILE_RECORD_NUMBER, LEN_FILE_RECORD_NUMBER);
}
/**
* 応答フラグを設定します。
* @param ansCode 設定する応答フラグ
*/
public void setAnsCode(String ansCode)
{
setToBufferLeft(ansCode, OFF_ANSWER_CODE, LEN_ANSWER_CODE);
}
/**
* エラー詳細を設定します。
* @param errDetails 設定するエラー詳細
*/
public void setErrDetails(String errDetails)
{
setToBufferLeft(errDetails, OFF_ERROR_DETAILS, LEN_ERROR_DETAILS);
}
/**
* ETXを設定します。
*/
public void setETX()
{
setToByteBuffer(DEF_ETX, OFF_ETX);
}
/**
* 応答フラグを取得します。
* @return 応答フラグ
*/
public String getAnsCode()
{
String ansCode = getFromBuffer(OFF_ANSWER_CODE, LEN_ANSWER_CODE);
return ansCode.trim();
}
//------------------------------------------------------------
// package methods
//------------------------------------------------------------
//------------------------------------------------------------
// protected methods
//------------------------------------------------------------
//------------------------------------------------------------
// private methods
//------------------------------------------------------------
//------------------------------------------------------------
// utility methods
//------------------------------------------------------------
/**
* このクラスのバージョンを返します。
* @return バージョンと日付
*/
public static String getVersion()
{
return ("$Revision: 4181 $,$Date: 2009-04-21 09:14:17 +0900 (火, 21 4 2009) $");
}
}
//end of class
|
UTF-8
|
Java
| 8,172 |
java
|
RftId5022.java
|
Java
|
[
{
"context": "// $Id: RftId5022.java 4181 2009-04-21 00:14:17Z rnakai $\npackage jp.co.daifuku.pcart.base.rft;\n\nimport j",
"end": 55,
"score": 0.9981825947761536,
"start": 49,
"tag": "USERNAME",
"value": "rnakai"
},
{
"context": ":14:17 +0900 (火, 21 4 2009) $\n * @author $Author: rnakai $\n */\npublic class RftId5022\n extends Send",
"end": 2016,
"score": 0.9996926784515381,
"start": 2010,
"tag": "USERNAME",
"value": "rnakai"
}
] | null |
[] |
// $Id: RftId5022.java 4181 2009-04-21 00:14:17Z rnakai $
package jp.co.daifuku.pcart.base.rft;
import jp.co.daifuku.wms.base.communication.rft.SendIdMessage;
/*
* Copyright(c) 2000-2007 DAIFUKU Co.,Ltd. All Rights Reserved.
*
* This software is the proprietary information of DAIFUKU Co.,Ltd.
* Use is subject to license terms.
*/
/**
* 荷主一覧応答 ID=5022 電文
*
* <p>
* <table border="1">
* <CAPTION>Id5022の電文の構造</CAPTION>
* <TR><TH>項目名</TH> <TH>長さ</TH> <TH>内容</TH></TR>
* <tr><td>STX</td> <td> 1 byte</td> <td>0x02</td></tr>
* <tr><td>SEQ No.</td> <td> 4 byte</td> <td></td></tr>
* <tr><td>ID</td> <td> 4 byte</td> <td>5022</td></tr>
* <tr><td>端末送信時間</td> <td> 6 byte</td> <td>HHMMSS</td></tr>
* <tr><td>サーバ送信時間</td> <td> 6 byte</td> <td>HHMMSS</td></tr>
* <tr><td>端末号機No.</td> <td> 3 byte</td> <td></td></tr>
* <tr><td>ユーザID</td> <td> 8 byte</td> <td></td></tr>
* <tr><td>予定日</td> <td> 8 byte</td> <td></td></tr>
* <tr><td>作業区分</td> <td> 2 byte</td> <td></td></tr>
* <tr><td>作業区分詳細</td> <td> 1 byte</td> <td></td></tr>
* <tr><td>一覧ファイル名</td> <td>30 byte</td> <td></td></tr>
* <tr><td>ファイルレコード数</td> <td> 5 byte</td> <td></td></tr>
* <tr><td>応答フラグ</td> <td> 1 byte</td> <td>0:正常 8:該当データなし 9:エラー</td></tr>
* <tr><td>エラー詳細</td> <td> 2 byte</td> <td></td></tr>
* <tr><td>ETX</td> <td> 1 byte</td> <td>0x03</td></tr>
* </table>
* </p>
* <BR>
* <TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0">
* <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD>Date</TD><TD>Name</TD><TD>Comment</TD></TR>
* <TR><TD>2007/03/30</TD><TD>T.kojima</TD><TD>created this class</TD></TR>
* </TABLE>
* <BR>
* @version $Revision: 4181 $, $Date: 2009-04-21 09:14:17 +0900 (火, 21 4 2009) $
* @author $Author: rnakai $
*/
public class RftId5022
extends SendIdMessage
{
//------------------------------------------------------------
// fields (upper case only)
//------------------------------------------------------------
/**
* ユーザIDのオフセットの定義
*/
private static final int OFF_USER_ID = LEN_HEADER;
/**
* 予定日のオフセットの定義
*/
private static final int OFF_PLAN_DATE = OFF_USER_ID + LEN_USER_ID;
/**
* 作業区分のオフセットの定義
*/
private static final int OFF_JOB_TYPE = OFF_PLAN_DATE + LEN_PLAN_DATE;
/**
* 作業区分詳細のオフセットの定義
*/
private static final int OFF_JOB_DETAILS = OFF_JOB_TYPE + LEN_JOB_TYPE;
/**
* 一覧ファイル名のオフセットの定義
*/
private static final int OFF_FILE_NAME = OFF_JOB_DETAILS + LEN_JOB_DETAILS;
/**
* ファイルレコード数のオフセットの定義
*/
private static final int OFF_FILE_RECORD_NUMBER = OFF_FILE_NAME + LEN_FILE_NAME;
/**
* 応答フラグのオフセットの定義
*/
private static final int OFF_ANSWER_CODE = OFF_FILE_RECORD_NUMBER + LEN_FILE_RECORD_NUMBER;
/**
* エラー詳細のオフセットの定義
*/
private static final int OFF_ERROR_DETAILS = OFF_ANSWER_CODE + LEN_ANSWER_CODE;
/**
* ETXのオフセットの定義
*/
private static final int OFF_ETX = OFF_ERROR_DETAILS + LEN_ERROR_DETAILS;
/**
* ID番号
*/
public static final String ID = "5022";
//------------------------------------------------------------
// class variables (prefix '$')
//------------------------------------------------------------
//------------------------------------------------------------
// instance variables (prefix '_')
//------------------------------------------------------------
//------------------------------------------------------------
// constructors
//------------------------------------------------------------
/**
* 親クラスのコンストラクタを呼び出した後、
* 電文の長さをセットします。また、内部バッファを空白で初期化します。
*/
public RftId5022()
{
super();
_length = OFF_ETX + LEN_ETX;
initializeBuffer();
}
//------------------------------------------------------------
// public methods
//------------------------------------------------------------
//------------------------------------------------------------
// accessor methods
//------------------------------------------------------------
/**
* ユーザIDを設定します。
* @param userId ユーザID
*/
public void setUserId(String userId)
{
setToBufferLeft(userId, OFF_USER_ID, LEN_USER_ID);
}
/**
* 予定日を設定します。
* @param planDate 予定日
*/
public void setPlanDate(String planDate)
{
setToBufferLeft(planDate, OFF_PLAN_DATE, LEN_PLAN_DATE);
}
/**
* 作業区分を設定します。
* @param jobType 作業区分
*/
public void setJobType(String jobType)
{
setToBufferLeft(jobType, OFF_JOB_TYPE, LEN_JOB_TYPE);
}
/**
* 作業区分詳細を設定します。
* @param jobDetails 作業区分詳細
*/
public void setJobDetails(String jobDetails)
{
setToBufferLeft(jobDetails, OFF_JOB_DETAILS, LEN_JOB_DETAILS);
}
/**
* 一覧ファイル名を設定します。
* @param fileName 一覧ファイル名
*/
public void setFileName(String fileName)
{
setToBufferLeft(fileName, OFF_FILE_NAME, LEN_FILE_NAME);
}
/**
* ファイルレコード数を設定します。
* @param fileRecodeNumber ファイルレコード数
*/
public void setFileRecodeNumber(int fileRecodeNumber)
{
// データを右詰めで格納する
setToBufferRight(fileRecodeNumber, OFF_FILE_RECORD_NUMBER, LEN_FILE_RECORD_NUMBER);
}
/**
* 応答フラグを設定します。
* @param ansCode 設定する応答フラグ
*/
public void setAnsCode(String ansCode)
{
setToBufferLeft(ansCode, OFF_ANSWER_CODE, LEN_ANSWER_CODE);
}
/**
* エラー詳細を設定します。
* @param errDetails 設定するエラー詳細
*/
public void setErrDetails(String errDetails)
{
setToBufferLeft(errDetails, OFF_ERROR_DETAILS, LEN_ERROR_DETAILS);
}
/**
* ETXを設定します。
*/
public void setETX()
{
setToByteBuffer(DEF_ETX, OFF_ETX);
}
/**
* 応答フラグを取得します。
* @return 応答フラグ
*/
public String getAnsCode()
{
String ansCode = getFromBuffer(OFF_ANSWER_CODE, LEN_ANSWER_CODE);
return ansCode.trim();
}
//------------------------------------------------------------
// package methods
//------------------------------------------------------------
//------------------------------------------------------------
// protected methods
//------------------------------------------------------------
//------------------------------------------------------------
// private methods
//------------------------------------------------------------
//------------------------------------------------------------
// utility methods
//------------------------------------------------------------
/**
* このクラスのバージョンを返します。
* @return バージョンと日付
*/
public static String getVersion()
{
return ("$Revision: 4181 $,$Date: 2009-04-21 09:14:17 +0900 (火, 21 4 2009) $");
}
}
//end of class
| 8,172 | 0.443135 | 0.422469 | 251 | 27.7251 | 27.815845 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.203187 | false | false |
7
|
4c8e3a6139b6782fc1c61431ae30a7e11066c705
| 18,528,488,963,552 |
d6f2740bd9a0149753ce7bb5df7297f3e407c9c6
|
/app/src/main/java/anh/nguyen/messageparser/di/RootModule.java
|
d04acdfbf0c80f3f5341c6790b3e399897637c49
|
[] |
no_license
|
anhhnguyen206/message-parser-android
|
https://github.com/anhhnguyen206/message-parser-android
|
36719f960bf51b4892889e42801c37e1711a926f
|
455d04bc058570cfe411a51b9a9c096da5ef7117
|
refs/heads/master
| 2020-04-01T07:07:33.032000 | 2015-09-03T05:15:35 | 2015-09-03T05:15:35 | 41,042,132 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package anh.nguyen.messageparser.di;
import android.content.Context;
import android.view.LayoutInflater;
import javax.inject.Singleton;
import anh.nguyen.messageparser.App;
import dagger.Module;
import dagger.Provides;
/**
* Created by nguyenhoanganh on 8/19/15.
*/
@Module(
injects = App.class,
library = true,
complete = false
)
public class RootModule {
private final Context mContext;
public RootModule(Context context) {
mContext = context;
}
@Provides
@Singleton
public Context provideApplicationContext() {
return mContext;
}
@Provides
@Singleton
public LayoutInflater provideLayoutInflater() {
return LayoutInflater.from(mContext);
}
}
|
UTF-8
|
Java
| 745 |
java
|
RootModule.java
|
Java
|
[
{
"context": "Module;\nimport dagger.Provides;\n\n/**\n * Created by nguyenhoanganh on 8/19/15.\n */\n@Module(\n injects = App.cl",
"end": 255,
"score": 0.9996824264526367,
"start": 241,
"tag": "USERNAME",
"value": "nguyenhoanganh"
}
] | null |
[] |
package anh.nguyen.messageparser.di;
import android.content.Context;
import android.view.LayoutInflater;
import javax.inject.Singleton;
import anh.nguyen.messageparser.App;
import dagger.Module;
import dagger.Provides;
/**
* Created by nguyenhoanganh on 8/19/15.
*/
@Module(
injects = App.class,
library = true,
complete = false
)
public class RootModule {
private final Context mContext;
public RootModule(Context context) {
mContext = context;
}
@Provides
@Singleton
public Context provideApplicationContext() {
return mContext;
}
@Provides
@Singleton
public LayoutInflater provideLayoutInflater() {
return LayoutInflater.from(mContext);
}
}
| 745 | 0.685906 | 0.679195 | 38 | 18.605263 | 15.858817 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.342105 | false | false |
7
|
869e3bdc801c76aa0592601efa94f3715ff26e11
| 28,484,223,161,646 |
0b6dd6b99a3a791c7724ffb2e08f4c284ff875c1
|
/app/src/main/java/com/clsroom/model/Notifications.java
|
3c43aa27c0575da4fc22c933eab8ff2ff218f44e
|
[] |
no_license
|
saleemkhan08/ClsroomAqua
|
https://github.com/saleemkhan08/ClsroomAqua
|
06a034572209d02b91729c391db3b83d594c3e24
|
4bb9cd3223803da4b2ab8ae13af9e7305e0d7873
|
refs/heads/master
| 2021-07-24T08:40:01.420000 | 2017-11-05T05:52:49 | 2017-11-05T05:52:49 | 107,635,883 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.clsroom.model;
import android.os.Parcel;
import android.os.Parcelable;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Locale;
import static com.clsroom.dialogs.MonthYearPickerDialog.MONTH_ARRAY;
import static com.clsroom.model.Notes.AM_PM;
import static com.clsroom.utils.DateTimeUtil.get2DigitNum;
public class Notifications implements Parcelable
{
public static final String NOTIFICATIONS = "notifications";
private String message;
private String senderName;
private String senderPhotoUrl;
private String senderId;
private long dateTime;
private String leaveId;
private String notesId;
private String leaveRefType;
public static final String MESSAGE = "message";
public static final String SENDER_NAME = "senderName";
public static final String SENDER_PHOTO_URL = "senderPhotoUrl";
public static final String SENDER_ID = "senderId";
public static final String DATE_TIME = "dateTime";
public static final String LEAVE_ID = "leaveId";
public static final String NOTES_ID = "notesId";
public static final String LEAVE_REF_TYPE = "leaveRefType";
public String getMessage()
{
return message;
}
public void setMessage(String message)
{
this.message = message;
}
public String getSenderName()
{
return senderName;
}
public void setSenderName(String senderName)
{
this.senderName = senderName;
}
public String getSenderPhotoUrl()
{
return senderPhotoUrl;
}
public void setSenderPhotoUrl(String senderPhotoUrl)
{
this.senderPhotoUrl = senderPhotoUrl;
}
public String getSenderId()
{
return senderId;
}
public void setSenderId(String senderId)
{
this.senderId = senderId;
}
public long getDateTime()
{
return dateTime;
}
public void setDateTime(long dateTime)
{
this.dateTime = dateTime;
}
public String displayDate()
{
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss", Locale.ENGLISH);
try
{
Calendar calendar = Calendar.getInstance();
calendar.setTime(format.parse(((-1) * dateTime) + ""));
return MONTH_ARRAY[calendar.get(Calendar.MONTH)] + "-" +
calendar.get(Calendar.DAY_OF_MONTH) + " "
+ get2DigitNum(calendar.get(Calendar.HOUR))
+ ":" + get2DigitNum(calendar.get(Calendar.MINUTE))
+ " " + AM_PM[calendar.get(Calendar.AM_PM)];
}
catch (ParseException e)
{
e.printStackTrace();
}
return null;
}
public String getLeaveId()
{
return leaveId;
}
public void setLeaveId(String leaveId)
{
this.leaveId = leaveId;
}
public String getNotesId()
{
return notesId;
}
public void setNotesId(String notesId)
{
this.notesId = notesId;
}
public String dateTime()
{
return "" + (getDateTime() * (-1));
}
public void dateTime(String key)
{
setDateTime((-1) * Long.parseLong(key));
}
public String getLeaveRefType()
{
return leaveRefType;
}
public void setLeaveRefType(String leaveRefType)
{
this.leaveRefType = leaveRefType;
}
@Override
public int describeContents()
{
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags)
{
dest.writeString(this.message);
dest.writeString(this.senderName);
dest.writeString(this.senderPhotoUrl);
dest.writeString(this.senderId);
dest.writeLong(this.dateTime);
dest.writeString(this.leaveId);
dest.writeString(this.notesId);
dest.writeString(this.leaveRefType);
}
public Notifications()
{
}
protected Notifications(Parcel in)
{
this.message = in.readString();
this.senderName = in.readString();
this.senderPhotoUrl = in.readString();
this.senderId = in.readString();
this.dateTime = in.readLong();
this.leaveId = in.readString();
this.notesId = in.readString();
this.leaveRefType = in.readString();
}
public static final Parcelable.Creator<Notifications> CREATOR = new Parcelable.Creator<Notifications>()
{
@Override
public Notifications createFromParcel(Parcel source)
{
return new Notifications(source);
}
@Override
public Notifications[] newArray(int size)
{
return new Notifications[size];
}
};
}
|
UTF-8
|
Java
| 4,780 |
java
|
Notifications.java
|
Java
|
[
{
"context": " public static final String SENDER_NAME = \"senderName\";\n public static final String SENDER_PHOTO_URL",
"end": 843,
"score": 0.6895769834518433,
"start": 839,
"tag": "USERNAME",
"value": "Name"
}
] | null |
[] |
package com.clsroom.model;
import android.os.Parcel;
import android.os.Parcelable;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Locale;
import static com.clsroom.dialogs.MonthYearPickerDialog.MONTH_ARRAY;
import static com.clsroom.model.Notes.AM_PM;
import static com.clsroom.utils.DateTimeUtil.get2DigitNum;
public class Notifications implements Parcelable
{
public static final String NOTIFICATIONS = "notifications";
private String message;
private String senderName;
private String senderPhotoUrl;
private String senderId;
private long dateTime;
private String leaveId;
private String notesId;
private String leaveRefType;
public static final String MESSAGE = "message";
public static final String SENDER_NAME = "senderName";
public static final String SENDER_PHOTO_URL = "senderPhotoUrl";
public static final String SENDER_ID = "senderId";
public static final String DATE_TIME = "dateTime";
public static final String LEAVE_ID = "leaveId";
public static final String NOTES_ID = "notesId";
public static final String LEAVE_REF_TYPE = "leaveRefType";
public String getMessage()
{
return message;
}
public void setMessage(String message)
{
this.message = message;
}
public String getSenderName()
{
return senderName;
}
public void setSenderName(String senderName)
{
this.senderName = senderName;
}
public String getSenderPhotoUrl()
{
return senderPhotoUrl;
}
public void setSenderPhotoUrl(String senderPhotoUrl)
{
this.senderPhotoUrl = senderPhotoUrl;
}
public String getSenderId()
{
return senderId;
}
public void setSenderId(String senderId)
{
this.senderId = senderId;
}
public long getDateTime()
{
return dateTime;
}
public void setDateTime(long dateTime)
{
this.dateTime = dateTime;
}
public String displayDate()
{
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss", Locale.ENGLISH);
try
{
Calendar calendar = Calendar.getInstance();
calendar.setTime(format.parse(((-1) * dateTime) + ""));
return MONTH_ARRAY[calendar.get(Calendar.MONTH)] + "-" +
calendar.get(Calendar.DAY_OF_MONTH) + " "
+ get2DigitNum(calendar.get(Calendar.HOUR))
+ ":" + get2DigitNum(calendar.get(Calendar.MINUTE))
+ " " + AM_PM[calendar.get(Calendar.AM_PM)];
}
catch (ParseException e)
{
e.printStackTrace();
}
return null;
}
public String getLeaveId()
{
return leaveId;
}
public void setLeaveId(String leaveId)
{
this.leaveId = leaveId;
}
public String getNotesId()
{
return notesId;
}
public void setNotesId(String notesId)
{
this.notesId = notesId;
}
public String dateTime()
{
return "" + (getDateTime() * (-1));
}
public void dateTime(String key)
{
setDateTime((-1) * Long.parseLong(key));
}
public String getLeaveRefType()
{
return leaveRefType;
}
public void setLeaveRefType(String leaveRefType)
{
this.leaveRefType = leaveRefType;
}
@Override
public int describeContents()
{
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags)
{
dest.writeString(this.message);
dest.writeString(this.senderName);
dest.writeString(this.senderPhotoUrl);
dest.writeString(this.senderId);
dest.writeLong(this.dateTime);
dest.writeString(this.leaveId);
dest.writeString(this.notesId);
dest.writeString(this.leaveRefType);
}
public Notifications()
{
}
protected Notifications(Parcel in)
{
this.message = in.readString();
this.senderName = in.readString();
this.senderPhotoUrl = in.readString();
this.senderId = in.readString();
this.dateTime = in.readLong();
this.leaveId = in.readString();
this.notesId = in.readString();
this.leaveRefType = in.readString();
}
public static final Parcelable.Creator<Notifications> CREATOR = new Parcelable.Creator<Notifications>()
{
@Override
public Notifications createFromParcel(Parcel source)
{
return new Notifications(source);
}
@Override
public Notifications[] newArray(int size)
{
return new Notifications[size];
}
};
}
| 4,780 | 0.62092 | 0.619456 | 196 | 23.387754 | 21.595839 | 107 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.372449 | false | false |
7
|
30709c95d86504f54e5d9138e62f7e9ab7ce46c9
| 14,955,076,177,399 |
49d3a1fe0af20855dde9036ac3fb3995942613d5
|
/src/main/java/Tree/MinDiffBetweenNodes.java
|
5451b3dd92306ab6795b7cbfdbc5fd9047021ccc
|
[] |
no_license
|
nieschumi/xuexi
|
https://github.com/nieschumi/xuexi
|
626f759ab8328b137fec0e79a7ab3e6768844610
|
3f4aec59efee906733036d2eeb878d8f2b77950f
|
refs/heads/master
| 2018-12-22T01:52:35.980000 | 2018-12-20T19:09:59 | 2018-12-20T19:09:59 | 149,855,859 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package Tree;
import Util.TreeNode;
public class MinDiffBetweenNodes {
/**
* Given a Binary Search Tree (BST) with the root node root,
* return the minimum difference between the values of any two different nodes in the tree.
*
*/
public int minDiffInBST(TreeNode root) {
if (root == null) {
return 0;
}
//in-order才能按照升序访问
//in-order traverse, keep updating min
int[] min = new int[1];
min[0] = Integer.MAX_VALUE;
helper(root, min, new Integer[]{null});
return min[0];
}
private void helper(TreeNode root, int[] min, Integer[] prev) {
if (root == null) {
return;
}
helper(root.left, min, prev);
if (prev[0] != null) {
min[0] = Math.min(Math.abs(root.val - prev[0]), min[0]);
}
prev[0] = root.val;
helper(root.right, min, prev);
}
}
|
UTF-8
|
Java
| 951 |
java
|
MinDiffBetweenNodes.java
|
Java
|
[] | null |
[] |
package Tree;
import Util.TreeNode;
public class MinDiffBetweenNodes {
/**
* Given a Binary Search Tree (BST) with the root node root,
* return the minimum difference between the values of any two different nodes in the tree.
*
*/
public int minDiffInBST(TreeNode root) {
if (root == null) {
return 0;
}
//in-order才能按照升序访问
//in-order traverse, keep updating min
int[] min = new int[1];
min[0] = Integer.MAX_VALUE;
helper(root, min, new Integer[]{null});
return min[0];
}
private void helper(TreeNode root, int[] min, Integer[] prev) {
if (root == null) {
return;
}
helper(root.left, min, prev);
if (prev[0] != null) {
min[0] = Math.min(Math.abs(root.val - prev[0]), min[0]);
}
prev[0] = root.val;
helper(root.right, min, prev);
}
}
| 951 | 0.536898 | 0.527273 | 38 | 23.605263 | 22.689598 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.605263 | false | false |
7
|
bb09ba430e85e4f232f96bd0ac4c7da9e0191a27
| 9,457,518,031,846 |
6e56605a12d58819a60f4bb87a3a690565703513
|
/knowgate-stripes/src/main/java/com/knowgate/stripes/CachingFilter.java
|
a80c6727e8fb2b7949efaa765ac4d01eb89c7566
|
[] |
no_license
|
sergiomt/knowgate8
|
https://github.com/sergiomt/knowgate8
|
d8d4aedee3993ffa4dc572e7062dbf5bdd5a3987
|
0b6d06bf06731e4c73db2bc91ae9e14c58596b6b
|
refs/heads/master
| 2016-09-19T10:53:40.919000 | 2016-08-21T13:52:10 | 2016-08-21T13:52:10 | 66,164,168 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.knowgate.stripes;
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.http.HttpServletResponse;
/**
*
* @author Sergio Montoro Ten
*/
public class CachingFilter implements Filter {
private FilterConfig filterConfig = null;
@Override
public void init(FilterConfig oFilterConfig) throws ServletException {
filterConfig = oFilterConfig;
}
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
HttpServletResponse httpResponse = (HttpServletResponse) response;
httpResponse.setDateHeader("Expires", System.currentTimeMillis() + 604800000L);
chain.doFilter(request, response);
}
@Override
public void destroy() {
filterConfig = null;
}
}
|
UTF-8
|
Java
| 1,058 |
java
|
CachingFilter.java
|
Java
|
[
{
"context": "t.http.HttpServletResponse;\r\n\r\n/**\r\n *\r\n * @author Sergio Montoro Ten\r\n */\r\npublic class CachingFilter implements Filter ",
"end": 368,
"score": 0.9820418953895569,
"start": 350,
"tag": "NAME",
"value": "Sergio Montoro Ten"
}
] | null |
[] |
package com.knowgate.stripes;
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.http.HttpServletResponse;
/**
*
* @author <NAME>
*/
public class CachingFilter implements Filter {
private FilterConfig filterConfig = null;
@Override
public void init(FilterConfig oFilterConfig) throws ServletException {
filterConfig = oFilterConfig;
}
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
HttpServletResponse httpResponse = (HttpServletResponse) response;
httpResponse.setDateHeader("Expires", System.currentTimeMillis() + 604800000L);
chain.doFilter(request, response);
}
@Override
public void destroy() {
filterConfig = null;
}
}
| 1,046 | 0.730624 | 0.722117 | 37 | 26.648649 | 28.327444 | 132 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.540541 | false | false |
7
|
8ca6a25a9b8e54da9a5151fc8565461a0eb8a8f8
| 13,623,636,317,182 |
061e63d9957d683c197c837cd30b9b589eb5700e
|
/client/clientEJB/ejbs/src/main/java/local/gerb/ClientImpl.java
|
f442792ddb575b8efafab29127468064f45313bb
|
[] |
no_license
|
jstralko/tomee-poc
|
https://github.com/jstralko/tomee-poc
|
6ead00b85162d02801694c45aa9a97ef374c171e
|
230cddcdca8a9b8ba11ccdaf9145cd977a50677d
|
refs/heads/master
| 2020-04-23T06:06:57.429000 | 2019-03-04T20:40:50 | 2019-03-04T20:40:50 | 170,962,468 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package local.gerb;
import javax.annotation.PostConstruct;
import javax.ejb.EJBException;
import javax.ejb.Stateless;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import java.util.Properties;
import javax.naming.*;
@Stateless
public class ClientImpl {
Hello hello;
public String sayHello() {
return hello.sayHello();
}
@PostConstruct
public void init() {
try {
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.RemoteInitialContextFactory");
p.put(Context.PROVIDER_URL, "http://172.17.0.2:8080/tomee/ejb");
InitialContext ic = new InitialContext(p);
hello = (Hello) ic.lookup("HelloImplRemote");
String str = hello.sayHello();
System.err.println("response: " + str);
} catch (NamingException ex) {
throw new EJBException(ex);
}
}
}
|
UTF-8
|
Java
| 1,025 |
java
|
ClientImpl.java
|
Java
|
[
{
"context": ";\n p.put(Context.PROVIDER_URL, \"http://172.17.0.2:8080/tomee/ejb\");\n \n Initia",
"end": 685,
"score": 0.999530017375946,
"start": 675,
"tag": "IP_ADDRESS",
"value": "172.17.0.2"
}
] | null |
[] |
package local.gerb;
import javax.annotation.PostConstruct;
import javax.ejb.EJBException;
import javax.ejb.Stateless;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import java.util.Properties;
import javax.naming.*;
@Stateless
public class ClientImpl {
Hello hello;
public String sayHello() {
return hello.sayHello();
}
@PostConstruct
public void init() {
try {
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.RemoteInitialContextFactory");
p.put(Context.PROVIDER_URL, "http://172.17.0.2:8080/tomee/ejb");
InitialContext ic = new InitialContext(p);
hello = (Hello) ic.lookup("HelloImplRemote");
String str = hello.sayHello();
System.err.println("response: " + str);
} catch (NamingException ex) {
throw new EJBException(ex);
}
}
}
| 1,025 | 0.630244 | 0.619512 | 41 | 24 | 22.982496 | 108 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.512195 | false | false |
7
|
1adda554157336b94d8545c83df3acc505a0699d
| 20,306,605,437,969 |
4c3ba6c6537221a815b610007486cdcd74227e7a
|
/AliKafkaDemo/src/main/java/com/danhesoft/config/KafkaConfig.java
|
b725969dea0bed43a5c0375fa119223050b3cdca
|
[] |
no_license
|
cw370008359/message_queue
|
https://github.com/cw370008359/message_queue
|
646df1010fe8e87fcecdab34d895e9686b8b37c6
|
cc3c89e5217c9ba1e6a8dfbfc5a834d488659201
|
refs/heads/master
| 2020-03-12T19:20:05.391000 | 2018-04-24T03:32:07 | 2018-04-24T03:32:07 | 130,658,947 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.danhesoft.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* Created by caowei on 2018/4/23.
*/
@Component
@ConfigurationProperties(prefix = "alikafka")
public class KafkaConfig {
private String bootstrap_servers;
private String topic;
private String group_id;
private String ssl_truststore_location;
public String getJava_security_auth_login_config() {
return java_security_auth_login_config;
}
public void setJava_security_auth_login_config(String java_security_auth_login_config) {
this.java_security_auth_login_config = java_security_auth_login_config;
}
private String java_security_auth_login_config;
public String getBootstrap_servers() {
return bootstrap_servers;
}
public void setBootstrap_servers(String bootstrap_servers) {
this.bootstrap_servers = bootstrap_servers;
}
public String getTopic() {
return topic;
}
public void setTopic(String topic) {
this.topic = topic;
}
public String getGroup_id() {
return group_id;
}
public void setGroup_id(String group_id) {
this.group_id = group_id;
}
public String getSsl_truststore_location() {
return ssl_truststore_location;
}
public void setSsl_truststore_location(String ssl_truststore_location) {
this.ssl_truststore_location = ssl_truststore_location;
}
}
|
UTF-8
|
Java
| 1,510 |
java
|
KafkaConfig.java
|
Java
|
[
{
"context": "framework.stereotype.Component;\n\n/**\n * Created by caowei on 2018/4/23.\n */\n@Component\n@ConfigurationProper",
"end": 180,
"score": 0.9996378421783447,
"start": 174,
"tag": "USERNAME",
"value": "caowei"
}
] | null |
[] |
package com.danhesoft.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* Created by caowei on 2018/4/23.
*/
@Component
@ConfigurationProperties(prefix = "alikafka")
public class KafkaConfig {
private String bootstrap_servers;
private String topic;
private String group_id;
private String ssl_truststore_location;
public String getJava_security_auth_login_config() {
return java_security_auth_login_config;
}
public void setJava_security_auth_login_config(String java_security_auth_login_config) {
this.java_security_auth_login_config = java_security_auth_login_config;
}
private String java_security_auth_login_config;
public String getBootstrap_servers() {
return bootstrap_servers;
}
public void setBootstrap_servers(String bootstrap_servers) {
this.bootstrap_servers = bootstrap_servers;
}
public String getTopic() {
return topic;
}
public void setTopic(String topic) {
this.topic = topic;
}
public String getGroup_id() {
return group_id;
}
public void setGroup_id(String group_id) {
this.group_id = group_id;
}
public String getSsl_truststore_location() {
return ssl_truststore_location;
}
public void setSsl_truststore_location(String ssl_truststore_location) {
this.ssl_truststore_location = ssl_truststore_location;
}
}
| 1,510 | 0.692053 | 0.687417 | 58 | 25.034483 | 24.769257 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.310345 | false | false |
7
|
e6f2e06614cdb897c27c5c676a43ca1f23e92dfe
| 21,844,203,690,784 |
a4254640bc1f2fa4ad550e94955ef90e5c102d0a
|
/ch5/src/main/java/com/pengjinfei/concurrence/cache/Memoizer3.java
|
f5c08e871df25e9f98f82908e9c16aa0e2b10a3e
|
[] |
no_license
|
pengjinfei/concurrence-learning
|
https://github.com/pengjinfei/concurrence-learning
|
43886e6e60820461b575e318713349ebccfc0280
|
4570832d612d813c74d54d363a1c083dd20f8d49
|
refs/heads/master
| 2020-05-21T08:50:21.152000 | 2016-10-22T06:44:32 | 2016-10-22T06:44:32 | 69,266,058 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.pengjinfei.concurrence.cache;
import com.pengjinfei.concurrence.ExceptionUtils;
import java.util.Map;
import java.util.concurrent.*;
/**
* Created by Pengjinfei on 16/9/26.
* Description:
*/
public class Memoizer3<A,V> implements Computable<A,V> {
private final Map<A, Future<V>> cache = new ConcurrentHashMap<A, Future<V>>();
private final Computable<A,V> c;
public Memoizer3(Computable<A, V> c) {
this.c = c;
}
@Override
public V compute(A arg) throws InterruptedException {
Future<V> f = cache.get(arg);
if (f == null) {
Callable<V> eval=new Callable<V>() {
@Override
public V call() throws Exception {
return c.compute(arg);
}
};
FutureTask<V> ft = new FutureTask<V>(eval);
f=ft;
/*
还是可能出现两个线程同时计算一个arg的情况
*/
cache.put(arg, ft);
ft.run();
}
try {
return f.get();
} catch (ExecutionException e) {
throw ExceptionUtils.launderThrowable(e.getCause());
}
}
}
|
UTF-8
|
Java
| 1,204 |
java
|
Memoizer3.java
|
Java
|
[
{
"context": "\nimport java.util.concurrent.*;\n\n/**\n * Created by Pengjinfei on 16/9/26.\n * Description:\n */\npublic class Memo",
"end": 176,
"score": 0.9883782863616943,
"start": 166,
"tag": "USERNAME",
"value": "Pengjinfei"
}
] | null |
[] |
package com.pengjinfei.concurrence.cache;
import com.pengjinfei.concurrence.ExceptionUtils;
import java.util.Map;
import java.util.concurrent.*;
/**
* Created by Pengjinfei on 16/9/26.
* Description:
*/
public class Memoizer3<A,V> implements Computable<A,V> {
private final Map<A, Future<V>> cache = new ConcurrentHashMap<A, Future<V>>();
private final Computable<A,V> c;
public Memoizer3(Computable<A, V> c) {
this.c = c;
}
@Override
public V compute(A arg) throws InterruptedException {
Future<V> f = cache.get(arg);
if (f == null) {
Callable<V> eval=new Callable<V>() {
@Override
public V call() throws Exception {
return c.compute(arg);
}
};
FutureTask<V> ft = new FutureTask<V>(eval);
f=ft;
/*
还是可能出现两个线程同时计算一个arg的情况
*/
cache.put(arg, ft);
ft.run();
}
try {
return f.get();
} catch (ExecutionException e) {
throw ExceptionUtils.launderThrowable(e.getCause());
}
}
}
| 1,204 | 0.536878 | 0.530875 | 46 | 24.347826 | 20.384583 | 82 | true | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false |
7
|
baa23f1eea2a7ccdcee5054092c9f5074bdd6d8e
| 4,226,247,889,300 |
7d6dae07dfad47fc365bd1bac214f9d14cb4c564
|
/src/BirdShape.java
|
80b846a913c27283032254d4bbe297df85f99cc6
|
[] |
no_license
|
cdjordan29/multi-shape-test
|
https://github.com/cdjordan29/multi-shape-test
|
2603c59e0e87ff89bd20b2183bf54d777d6c5b5d
|
4cdfa31ea261880fee534a639cec8052f904ef0b
|
refs/heads/master
| 2021-05-12T17:01:35.782000 | 2018-01-11T01:41:56 | 2018-01-11T01:41:56 | 117,034,316 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.awt.*;
import java.awt.geom.*;
import java.util.*;
/**
A car that can be moved around.
*/
public class BirdShape implements MoveableShape
{
private int x;
private int y;
private int width;
/**
Constructs a car item.
@param x the left of the bounding rectangle
@param y the top of the bounding rectangle
@param width the width of the bounding rectangle
*/
public BirdShape(int x, int y, int width)
{
this.x = x;
this.y = y;
this.width = width;
}
public void translate(int dx, int dy)
{
x += dx;
y += dy;
}
public void draw(Graphics2D g2)
{
//This is the main body of the Bird
Ellipse2D.Double birdBody = new Ellipse2D.Double(x + 20, y, width / 2, width / 8);
//This is the beak of the bird
Ellipse2D.Double birdBeak = new Ellipse2D.Double(x + 60, y, width / 6, width / 10);
//Arc2D.Double birdBeak = new Arc2D.Double(x, y, width, width);
//This is the tail of the bird
Ellipse2D.Double birdTail = new Ellipse2D.Double(x, y, width / 4, width / 8);
g2.setPaint(Color.YELLOW);
g2.draw(birdBody);
g2.fill(birdBody);
g2.setPaint(Color.ORANGE);
g2.draw(birdBeak);
g2.fill(birdBeak);
g2.setPaint(Color.YELLOW);
g2.draw(birdTail);
g2.fill(birdTail);
}
public void setX(int xValue){
x = xValue;
}
public void setY(int yValue){
y = yValue;
}
public int getX(){
return this.x;
}
public int getY(){
return this.y;
}
}
|
UTF-8
|
Java
| 1,439 |
java
|
BirdShape.java
|
Java
|
[] | null |
[] |
import java.awt.*;
import java.awt.geom.*;
import java.util.*;
/**
A car that can be moved around.
*/
public class BirdShape implements MoveableShape
{
private int x;
private int y;
private int width;
/**
Constructs a car item.
@param x the left of the bounding rectangle
@param y the top of the bounding rectangle
@param width the width of the bounding rectangle
*/
public BirdShape(int x, int y, int width)
{
this.x = x;
this.y = y;
this.width = width;
}
public void translate(int dx, int dy)
{
x += dx;
y += dy;
}
public void draw(Graphics2D g2)
{
//This is the main body of the Bird
Ellipse2D.Double birdBody = new Ellipse2D.Double(x + 20, y, width / 2, width / 8);
//This is the beak of the bird
Ellipse2D.Double birdBeak = new Ellipse2D.Double(x + 60, y, width / 6, width / 10);
//Arc2D.Double birdBeak = new Arc2D.Double(x, y, width, width);
//This is the tail of the bird
Ellipse2D.Double birdTail = new Ellipse2D.Double(x, y, width / 4, width / 8);
g2.setPaint(Color.YELLOW);
g2.draw(birdBody);
g2.fill(birdBody);
g2.setPaint(Color.ORANGE);
g2.draw(birdBeak);
g2.fill(birdBeak);
g2.setPaint(Color.YELLOW);
g2.draw(birdTail);
g2.fill(birdTail);
}
public void setX(int xValue){
x = xValue;
}
public void setY(int yValue){
y = yValue;
}
public int getX(){
return this.x;
}
public int getY(){
return this.y;
}
}
| 1,439 | 0.648367 | 0.627519 | 75 | 18.16 | 20.21817 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.586667 | false | false |
7
|
9d7a2dc01c882a698b144eac88ad87b0808ea258
| 25,786,983,702,677 |
bd2853f19e48a4464a08ced57c3bfe1f989aba19
|
/src/com/csei/database/entity/Transport.java
|
33a0a1db5c43ed933711159f47e9b57a2ed03cc0
|
[] |
no_license
|
xiaozhujun/DevicesManagement
|
https://github.com/xiaozhujun/DevicesManagement
|
3a1d38b964152fb5b46b47ee1153f5e9abe41e52
|
bb8cb2a95fe8994846586ab2a5fb7036fbb42f65
|
refs/heads/master
| 2016-08-02T22:23:11.588000 | 2015-01-22T08:48:01 | 2015-01-22T08:48:01 | 26,259,422 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.csei.database.entity;
public class Transport {
private int id;
private int userId;
private String driver;
private String telephone;
private String destination;
private String address;
private int deviceId;
private int upLoadFlag;
private String image;
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
public int getId(){
return id;
}
public void setId(int id){
this.id=id;
}
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public String getDriver(){
return driver;
}
public void setDriver(String driver){
this.driver=driver;
}
public String getTelephone(){
return telephone;
}
public void setTelephone(String telephone){
this.telephone=telephone;
}
public String getDestination(){
return destination;
}
public void setDestination(String destination){
this.destination=destination;
}
public String getAddress(){
return address;
}
public void setAddress(String address){
this.address=address;
}
public int getDeviceId(){
return deviceId;
}
public void setDeviceId(int deviceId){
this.deviceId=deviceId;
}
public int getUpLoadFlag(){
return upLoadFlag;
}
public void setUpLoadFlag(int upLoadFlag){
this.upLoadFlag=upLoadFlag;
}
}
|
UTF-8
|
Java
| 1,422 |
java
|
Transport.java
|
Java
|
[] | null |
[] |
package com.csei.database.entity;
public class Transport {
private int id;
private int userId;
private String driver;
private String telephone;
private String destination;
private String address;
private int deviceId;
private int upLoadFlag;
private String image;
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
public int getId(){
return id;
}
public void setId(int id){
this.id=id;
}
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public String getDriver(){
return driver;
}
public void setDriver(String driver){
this.driver=driver;
}
public String getTelephone(){
return telephone;
}
public void setTelephone(String telephone){
this.telephone=telephone;
}
public String getDestination(){
return destination;
}
public void setDestination(String destination){
this.destination=destination;
}
public String getAddress(){
return address;
}
public void setAddress(String address){
this.address=address;
}
public int getDeviceId(){
return deviceId;
}
public void setDeviceId(int deviceId){
this.deviceId=deviceId;
}
public int getUpLoadFlag(){
return upLoadFlag;
}
public void setUpLoadFlag(int upLoadFlag){
this.upLoadFlag=upLoadFlag;
}
}
| 1,422 | 0.684248 | 0.684248 | 76 | 16.710526 | 13.547981 | 48 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.552632 | false | false |
7
|
c8ec13bf1d3d5ea02e637bf28737662d8590a66f
| 188,978,569,726 |
e787c556a822380e6a9d1fe9dd162fac288684f3
|
/integrations/spark/spark-validate-cleanse/spark-validate-cleanse-core/src/main/java/com/thinkbiganalytics/spark/datavalidator/functions/SumPartitionLevelCounts.java
|
f3df6430f418243738e065fe6302d29909a1386c
|
[
"WTFPL",
"CDDL-1.0",
"MIT",
"CC0-1.0",
"EPL-1.0",
"PostgreSQL",
"BSD-3-Clause",
"LGPL-2.1-only",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-protobuf",
"OFL-1.1"
] |
permissive
|
rohituppalapati/kylo-source
|
https://github.com/rohituppalapati/kylo-source
|
82bd8e788a14a33edcff8ac6306245c230e90665
|
cc794fb8a128a1bb6453e029ab7f6354e75c863e
|
refs/heads/master
| 2022-12-28T08:14:32.280000 | 2019-08-13T18:16:31 | 2019-08-13T18:16:31 | 200,886,840 | 0 | 0 |
Apache-2.0
| false | 2022-12-16T03:26:58 | 2019-08-06T16:23:27 | 2019-08-13T18:17:00 | 2022-12-16T03:26:56 | 13,781 | 0 | 0 | 15 |
Java
| false | false |
package com.thinkbiganalytics.spark.datavalidator.functions;
/*-
* #%L
* kylo-spark-validate-cleanse-app
* %%
* Copyright (C) 2017 ThinkBig Analytics
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
import org.apache.spark.api.java.function.Function2;
/**
* Sum up the individual partition level counts
*/
public class SumPartitionLevelCounts implements Function2<long[], long[], long[]> {
@Override
public long[] call(long[] countsA, long[] countsB) throws Exception {
long[] countsResult = new long[countsA.length];
for (int idx = 0; idx < countsA.length; idx++) {
countsResult[idx] = countsA[idx] + countsB[idx];
}
return countsResult;
}
}
|
UTF-8
|
Java
| 1,236 |
java
|
SumPartitionLevelCounts.java
|
Java
|
[] | null |
[] |
package com.thinkbiganalytics.spark.datavalidator.functions;
/*-
* #%L
* kylo-spark-validate-cleanse-app
* %%
* Copyright (C) 2017 ThinkBig Analytics
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
import org.apache.spark.api.java.function.Function2;
/**
* Sum up the individual partition level counts
*/
public class SumPartitionLevelCounts implements Function2<long[], long[], long[]> {
@Override
public long[] call(long[] countsA, long[] countsB) throws Exception {
long[] countsResult = new long[countsA.length];
for (int idx = 0; idx < countsA.length; idx++) {
countsResult[idx] = countsA[idx] + countsB[idx];
}
return countsResult;
}
}
| 1,236 | 0.690939 | 0.682039 | 40 | 29.9 | 28.66688 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.375 | false | false |
7
|
c7fca00143d07f331742e07228a6d0df776b0c6a
| 29,669,634,081,081 |
b005470853163413e754390d6099b193eadd5e3f
|
/QueSorbeto/app/src/main/java/Data/ClienteBD.java
|
1f4b192c00cff6db997c356580f98f046a8b8cb2
|
[] |
no_license
|
WendyRod/ProjectsAndroidStudio
|
https://github.com/WendyRod/ProjectsAndroidStudio
|
5a0b43e02b10451bdafb928c6a0c6837414f8ecc
|
66b2bbfa0dbf99f62c8e6be5b5e3b6f8104504f8
|
refs/heads/master
| 2020-04-08T00:26:56.528000 | 2018-12-07T00:41:30 | 2018-12-07T00:41:30 | 156,784,852 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package Data;
import android.provider.BaseColumns;
public class ClienteBD {
public ClienteBD() {
}
public static abstract class ClienteInfo implements BaseColumns {
//Tabla de clientes
public static final String TABLE_NAME = "cliente";
public static final String NAME = "name";
public static final String ID = "id";
public static final String PHONE_NUMBER = "phoneNumber";
private static final String TEXT_TYPE = " TEXT";
private static final String COMMA_SEP = ",";
public static final String SQL_CREATE_ENTRIES =
"CREATE TABLE " + ClienteInfo.TABLE_NAME + " (" +
ClienteInfo.ID + " INTEGER PRIMARY KEY," +
ClienteInfo.NAME + " " + TEXT_TYPE + COMMA_SEP +
ClienteInfo.PHONE_NUMBER + " " + TEXT_TYPE + ");";
public static final String SQL_DELETE_ENTRIES =
"DROP TABLE IF EXISTS " + ClienteInfo.TABLE_NAME + ";";
}
public static abstract class ProductosInfo implements BaseColumns {
//Tabla de productos
public static final String TABLE_NAME = "producto";
public static final String NAME_P = "nameP";
public static final String ID_P = "idP";
public static final String PRECIO_VENTA = "precio-ventaP";
private static final String TEXT_TYPE = " TEXT";
private static final String COMMA_SEP = ",";
public static final String SQL_CREATE_ENTRIES =
"CREATE TABLE " + ProductosInfo.TABLE_NAME + " (" +
ProductosInfo.ID_P + " INTEGER PRIMARY KEY," +
ProductosInfo.NAME_P + " " + TEXT_TYPE + COMMA_SEP +
ProductosInfo.PRECIO_VENTA + " " + TEXT_TYPE + ");";
public static final String SQL_DELETE_ENTRIES =
"DROP TABLE IF EXISTS " + ClienteBD.ProductosInfo.TABLE_NAME + ";";
}
}
|
UTF-8
|
Java
| 1,955 |
java
|
ClienteBD.java
|
Java
|
[
{
"context": "ente\";\n public static final String NAME = \"name\";\n public static final String ID = \"id\";\n ",
"end": 316,
"score": 0.7982012033462524,
"start": 312,
"tag": "NAME",
"value": "name"
}
] | null |
[] |
package Data;
import android.provider.BaseColumns;
public class ClienteBD {
public ClienteBD() {
}
public static abstract class ClienteInfo implements BaseColumns {
//Tabla de clientes
public static final String TABLE_NAME = "cliente";
public static final String NAME = "name";
public static final String ID = "id";
public static final String PHONE_NUMBER = "phoneNumber";
private static final String TEXT_TYPE = " TEXT";
private static final String COMMA_SEP = ",";
public static final String SQL_CREATE_ENTRIES =
"CREATE TABLE " + ClienteInfo.TABLE_NAME + " (" +
ClienteInfo.ID + " INTEGER PRIMARY KEY," +
ClienteInfo.NAME + " " + TEXT_TYPE + COMMA_SEP +
ClienteInfo.PHONE_NUMBER + " " + TEXT_TYPE + ");";
public static final String SQL_DELETE_ENTRIES =
"DROP TABLE IF EXISTS " + ClienteInfo.TABLE_NAME + ";";
}
public static abstract class ProductosInfo implements BaseColumns {
//Tabla de productos
public static final String TABLE_NAME = "producto";
public static final String NAME_P = "nameP";
public static final String ID_P = "idP";
public static final String PRECIO_VENTA = "precio-ventaP";
private static final String TEXT_TYPE = " TEXT";
private static final String COMMA_SEP = ",";
public static final String SQL_CREATE_ENTRIES =
"CREATE TABLE " + ProductosInfo.TABLE_NAME + " (" +
ProductosInfo.ID_P + " INTEGER PRIMARY KEY," +
ProductosInfo.NAME_P + " " + TEXT_TYPE + COMMA_SEP +
ProductosInfo.PRECIO_VENTA + " " + TEXT_TYPE + ");";
public static final String SQL_DELETE_ENTRIES =
"DROP TABLE IF EXISTS " + ClienteBD.ProductosInfo.TABLE_NAME + ";";
}
}
| 1,955 | 0.586189 | 0.586189 | 50 | 38.099998 | 29.000172 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.52 | false | false |
7
|
7ec239d2a1b60fa8afe75cd7bbc2864af0b8b6ec
| 29,661,044,214,165 |
9ebaf1af2c20b3fa94280ef015d2cd5e1b66908e
|
/app/src/main/java/cn/okclouder/ovc/frag/explore/ExploreTopicFragment.java
|
2a13d37e9d64f9034a8efa20a050f3a80ce0d5de
|
[] |
no_license
|
caoshen/agg
|
https://github.com/caoshen/agg
|
d955b2c44965ff20870dcf291caae1d7de7a48ed
|
de45235a151fdccc9457c78db67206471f428c65
|
refs/heads/master
| 2020-05-26T07:09:16.134000 | 2019-09-14T15:49:40 | 2019-09-14T15:49:40 | 82,469,067 | 0 | 0 | null | false | 2018-04-21T10:32:55 | 2017-02-19T15:33:20 | 2017-02-22T15:59:41 | 2018-04-21T10:32:54 | 1,163 | 0 | 0 | 0 |
Java
| false | null |
package cn.okclouder.ovc.frag.explore;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.text.TextUtils;
import android.widget.ImageView;
import java.util.ArrayList;
import java.util.List;
import cn.okclouder.library.util.ImageLoader;
import cn.okclouder.ovc.R;
import cn.okclouder.ovc.base.BaseRecycleFragment;
import cn.okclouder.ovc.base.BaseRecyclerAdapter;
import cn.okclouder.ovc.base.RecyclerViewHolder;
import cn.okclouder.ovc.model.Post;
import cn.okclouder.ovc.ui.node.Node;
import cn.okclouder.ovc.ui.node.NodeListContract;
import cn.okclouder.ovc.ui.node.NodeListPresenter;
import cn.okclouder.ovc.ui.post.OnRvItemListener;
import cn.okclouder.ovc.util.Constants;
public class ExploreTopicFragment extends BaseRecycleFragment implements NodeListContract.View {
private List<Post> mData = new ArrayList<>();
private NodeListContract.Presenter mPresenter;
private int mNextPage = 2;
private ExploreTopicAdapter mRecyclerAdapter;
private String mNodeName;
public static Fragment newInstance(Node node) {
ExploreTopicFragment fragment = new ExploreTopicFragment();
Bundle args = new Bundle();
args.putString(Constants.NODE_NAME, node.getName());
fragment.setArguments(args);
return fragment;
}
@Override
protected void initData() {
Bundle args = getArguments();
if (null != args) {
mNodeName = args.getString(Constants.NODE_NAME);
}
mData.clear();
mPresenter = new NodeListPresenter(this);
}
@Override
protected void autoRefresh() {
onRefresh();
}
@Override
public void onRefresh() {
super.onRefresh();
mPresenter.start(mNodeName);
}
@Override
public void onLoadMore() {
super.onLoadMore();
mPresenter.load(mNodeName, mNextPage);
}
@Override
protected BaseRecyclerAdapter getItemAdapter() {
mRecyclerAdapter = new ExploreTopicAdapter(getActivity(), mData);
return mRecyclerAdapter;
}
@Override
public void setPresenter(NodeListContract.Presenter presenter) {
mPresenter = presenter;
}
@Override
public void showRefresh(List<Post> data) {
mRecyclerAdapter.clearAndAddAll(data);
}
@Override
public void showLoad(List<Post> data) {
mRecyclerAdapter.addAll(data);
mNextPage++;
}
@Override
public void startLogin() {
}
@Override
public void showIndicator(boolean isActive) {
if (!isActive) {
mPullRefreshLayout.finishRefresh();
showEmptyView(EMPTY_VIEW_TYPE.NORMAL);
}
}
@Override
public void showError() {
showEmptyView(EMPTY_VIEW_TYPE.ERROR);
}
@Override
public void showLoginTips() {
showEmptyView(EMPTY_VIEW_TYPE.LOGIN);
}
private class ExploreTopicAdapter extends BaseRecyclerAdapter<Post> {
private final Context mContext;
public ExploreTopicAdapter(Context ctx, List<Post> list) {
super(ctx, list);
mContext = ctx;
}
@Override
public int getItemLayoutId(int viewType) {
return R.layout.item_recommend_article;
}
@Override
public void bindData(RecyclerViewHolder holder, int position, Post post) {
holder.setText(R.id.post_content, post.title);
holder.setText(R.id.post_user_name, post.userName);
holder.setText(R.id.post_last_visit_time, post.lastVisitTime);
if (TextUtils.isEmpty(post.commentCount)) {
post.commentCount = "0";
}
String commentCount = "" + post.commentCount;
holder.setText(R.id.post_comment_count, commentCount);
ImageView iv = holder.getImageView(R.id.post_avatar);
ImageLoader.displayCircle(mContext, iv, post.avatarUrl);
holder.setClickListener(R.id.post_item, new OnRvItemListener(mContext, post));
}
}
}
|
UTF-8
|
Java
| 4,088 |
java
|
ExploreTopicFragment.java
|
Java
|
[] | null |
[] |
package cn.okclouder.ovc.frag.explore;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.text.TextUtils;
import android.widget.ImageView;
import java.util.ArrayList;
import java.util.List;
import cn.okclouder.library.util.ImageLoader;
import cn.okclouder.ovc.R;
import cn.okclouder.ovc.base.BaseRecycleFragment;
import cn.okclouder.ovc.base.BaseRecyclerAdapter;
import cn.okclouder.ovc.base.RecyclerViewHolder;
import cn.okclouder.ovc.model.Post;
import cn.okclouder.ovc.ui.node.Node;
import cn.okclouder.ovc.ui.node.NodeListContract;
import cn.okclouder.ovc.ui.node.NodeListPresenter;
import cn.okclouder.ovc.ui.post.OnRvItemListener;
import cn.okclouder.ovc.util.Constants;
public class ExploreTopicFragment extends BaseRecycleFragment implements NodeListContract.View {
private List<Post> mData = new ArrayList<>();
private NodeListContract.Presenter mPresenter;
private int mNextPage = 2;
private ExploreTopicAdapter mRecyclerAdapter;
private String mNodeName;
public static Fragment newInstance(Node node) {
ExploreTopicFragment fragment = new ExploreTopicFragment();
Bundle args = new Bundle();
args.putString(Constants.NODE_NAME, node.getName());
fragment.setArguments(args);
return fragment;
}
@Override
protected void initData() {
Bundle args = getArguments();
if (null != args) {
mNodeName = args.getString(Constants.NODE_NAME);
}
mData.clear();
mPresenter = new NodeListPresenter(this);
}
@Override
protected void autoRefresh() {
onRefresh();
}
@Override
public void onRefresh() {
super.onRefresh();
mPresenter.start(mNodeName);
}
@Override
public void onLoadMore() {
super.onLoadMore();
mPresenter.load(mNodeName, mNextPage);
}
@Override
protected BaseRecyclerAdapter getItemAdapter() {
mRecyclerAdapter = new ExploreTopicAdapter(getActivity(), mData);
return mRecyclerAdapter;
}
@Override
public void setPresenter(NodeListContract.Presenter presenter) {
mPresenter = presenter;
}
@Override
public void showRefresh(List<Post> data) {
mRecyclerAdapter.clearAndAddAll(data);
}
@Override
public void showLoad(List<Post> data) {
mRecyclerAdapter.addAll(data);
mNextPage++;
}
@Override
public void startLogin() {
}
@Override
public void showIndicator(boolean isActive) {
if (!isActive) {
mPullRefreshLayout.finishRefresh();
showEmptyView(EMPTY_VIEW_TYPE.NORMAL);
}
}
@Override
public void showError() {
showEmptyView(EMPTY_VIEW_TYPE.ERROR);
}
@Override
public void showLoginTips() {
showEmptyView(EMPTY_VIEW_TYPE.LOGIN);
}
private class ExploreTopicAdapter extends BaseRecyclerAdapter<Post> {
private final Context mContext;
public ExploreTopicAdapter(Context ctx, List<Post> list) {
super(ctx, list);
mContext = ctx;
}
@Override
public int getItemLayoutId(int viewType) {
return R.layout.item_recommend_article;
}
@Override
public void bindData(RecyclerViewHolder holder, int position, Post post) {
holder.setText(R.id.post_content, post.title);
holder.setText(R.id.post_user_name, post.userName);
holder.setText(R.id.post_last_visit_time, post.lastVisitTime);
if (TextUtils.isEmpty(post.commentCount)) {
post.commentCount = "0";
}
String commentCount = "" + post.commentCount;
holder.setText(R.id.post_comment_count, commentCount);
ImageView iv = holder.getImageView(R.id.post_avatar);
ImageLoader.displayCircle(mContext, iv, post.avatarUrl);
holder.setClickListener(R.id.post_item, new OnRvItemListener(mContext, post));
}
}
}
| 4,088 | 0.662427 | 0.661693 | 145 | 27.193104 | 23.289274 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.524138 | false | false |
7
|
c6204d7384c9f44e53c2f912da1165a02472d781
| 33,088,428,053,478 |
0192dc0d230445a07269525b6e28f694498007f1
|
/src/main/java/com/lab4/MultiArrayDemo2.java
|
8535199e61b96498b4da3196f1c99470a85baa8f
|
[] |
no_license
|
jtlai0921/NewJava
|
https://github.com/jtlai0921/NewJava
|
05dc3153be7eeae5040e63b6c087f7f69a18265d
|
2479d6b59775f196a2270a67da2f03bbc82da361
|
refs/heads/master
| 2022-09-25T00:21:34.707000 | 2020-01-29T12:51:57 | 2020-01-29T12:51:57 | 238,146,633 | 0 | 0 | null | false | 2022-09-01T23:19:39 | 2020-02-04T07:19:49 | 2020-02-04T07:20:13 | 2022-09-01T23:19:37 | 47 | 0 | 0 | 2 |
Java
| false | false |
package com.lab4;
public class MultiArrayDemo2 {
public static void main(String[] args) {
int[][] scores = {{100, 90, 80}, {90, 70, 60}}; // 2*3
// scores[0] -> {100, 90, 80}
int sum1 = 0;
for(int x : scores[0]) {
sum1 += x;
}
System.out.println(sum1);
// scores[1] -> {90, 70, 60}
int sum2 = 0;
for(int x : scores[1]) {
sum2 += x;
}
System.out.println(sum2);
}
}
|
UTF-8
|
Java
| 515 |
java
|
MultiArrayDemo2.java
|
Java
|
[] | null |
[] |
package com.lab4;
public class MultiArrayDemo2 {
public static void main(String[] args) {
int[][] scores = {{100, 90, 80}, {90, 70, 60}}; // 2*3
// scores[0] -> {100, 90, 80}
int sum1 = 0;
for(int x : scores[0]) {
sum1 += x;
}
System.out.println(sum1);
// scores[1] -> {90, 70, 60}
int sum2 = 0;
for(int x : scores[1]) {
sum2 += x;
}
System.out.println(sum2);
}
}
| 515 | 0.417476 | 0.335922 | 20 | 23.75 | 15.501209 | 63 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.85 | false | false |
7
|
a3e7c1518c97800d04eaa85d1e5e8a2b4d096431
| 10,342,281,271,878 |
ad98f98e09551642cd25830adc6e8e7526b78911
|
/test-ee/src/main/java/polischukovik/aspects/LoggingQuestionRawHandlerImpl.java
|
2e14ec937c6a6a3e95add286a61fcd3ff0e0fee7
|
[] |
no_license
|
polischukovik/WorkplaceRepository
|
https://github.com/polischukovik/WorkplaceRepository
|
86e6fbcbd5ed477094b4fd45beb308fbf7ecb0bb
|
0426388f351ef075c6238c748e5eaac0ddf3497f
|
refs/heads/master
| 2021-09-14T11:23:43.076000 | 2018-05-12T18:16:23 | 2018-05-12T18:16:23 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package polischukovik.aspects;
import java.io.File;
import java.io.IOException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;
import polischukovik.domain.enums.PropertyName;
import polischukovik.impl.QuestionDataSourceFileImpl;
@Aspect
@Component
public class LoggingQuestionRawHandlerImpl {
private Log logger = LogFactory.getLog(QuestionDataSourceFileImpl.class);
@Pointcut("execution(* polischukovik.impl.QuestionDataSourceFileImpl.parseSource(..))"
+ "&& args(path)")
private void parseSource(String path){};
@Before("parseSource(path)")
public void startParseSource(String path) throws IOException{
logger.debug("Parsing questions from raw file: " + path + "\n");
QuestionDataSourceFileImpl instance;
try {
instance = (QuestionDataSourceFileImpl) Class.forName(QuestionDataSourceFileImpl.class.getName()).newInstance();
logger.debug(String.format("\tRequired parameters(%d):", instance.getRequiredProperties().size()));
for(PropertyName propertyName : instance.getRequiredProperties()){
logger.debug(String.format("\t\t%s", propertyName));
}
} catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
e.printStackTrace();
}
}
@AfterReturning("parseSource(path)")
public void endParseSource(String path) throws IOException{
logger.debug("Successfully finnished parsing raw file: " + path +"\n");
}
@AfterThrowing("parseSource(path)")
public void startParseSourceException(String path){
logger.fatal("Failed to parse: " + path +"\n");
}
}
|
UTF-8
|
Java
| 1,926 |
java
|
LoggingQuestionRawHandlerImpl.java
|
Java
|
[] | null |
[] |
package polischukovik.aspects;
import java.io.File;
import java.io.IOException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;
import polischukovik.domain.enums.PropertyName;
import polischukovik.impl.QuestionDataSourceFileImpl;
@Aspect
@Component
public class LoggingQuestionRawHandlerImpl {
private Log logger = LogFactory.getLog(QuestionDataSourceFileImpl.class);
@Pointcut("execution(* polischukovik.impl.QuestionDataSourceFileImpl.parseSource(..))"
+ "&& args(path)")
private void parseSource(String path){};
@Before("parseSource(path)")
public void startParseSource(String path) throws IOException{
logger.debug("Parsing questions from raw file: " + path + "\n");
QuestionDataSourceFileImpl instance;
try {
instance = (QuestionDataSourceFileImpl) Class.forName(QuestionDataSourceFileImpl.class.getName()).newInstance();
logger.debug(String.format("\tRequired parameters(%d):", instance.getRequiredProperties().size()));
for(PropertyName propertyName : instance.getRequiredProperties()){
logger.debug(String.format("\t\t%s", propertyName));
}
} catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
e.printStackTrace();
}
}
@AfterReturning("parseSource(path)")
public void endParseSource(String path) throws IOException{
logger.debug("Successfully finnished parsing raw file: " + path +"\n");
}
@AfterThrowing("parseSource(path)")
public void startParseSourceException(String path){
logger.fatal("Failed to parse: " + path +"\n");
}
}
| 1,926 | 0.746106 | 0.746106 | 56 | 32.392857 | 29.698292 | 115 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.589286 | false | false |
7
|
00754fff990fe23307a9a23a3cfbab930a05afc5
| 31,877,247,332,265 |
fce7410ed7cdfa279f2963b63edff8d5faab295a
|
/PassingTwoNumbersToSecondActivity/app/src/main/java/com/example/ujjwalsmahapatra/passingtwonumberstosecondactivity/SecondActivity.java
|
b47b10c2f498cffa5f28bf31a14b008b4dcdf915
|
[] |
no_license
|
usmahapatra/First-Android-Apps
|
https://github.com/usmahapatra/First-Android-Apps
|
f3f4d163fffbdfa157e9f70e4264a5f73444063d
|
0c91cb43a95a2cdd8f02846b82a50c288dcca8f0
|
refs/heads/master
| 2020-03-11T23:28:41.251000 | 2019-05-08T12:37:44 | 2019-05-08T12:37:44 | 130,322,712 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.ujjwalsmahapatra.passingtwonumberstosecondactivity;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
public class SecondActivity extends AppCompatActivity {
TextView t;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_second);
//Initialize
t=(TextView)findViewById(R.id.textView);
Intent in=getIntent();
Bundle b=in.getExtras();
String num1=b.getString("num1");
String num2=b.getString("num2");
int n1=Integer.parseInt(num1);
int n2= Integer.parseInt(num2);
t.setText(""+(n1+n2));
}
}
|
UTF-8
|
Java
| 784 |
java
|
SecondActivity.java
|
Java
|
[
{
"context": "package com.example.ujjwalsmahapatra.passingtwonumberstosecondactivity;\n\nimport androi",
"end": 36,
"score": 0.989405632019043,
"start": 20,
"tag": "USERNAME",
"value": "ujjwalsmahapatra"
}
] | null |
[] |
package com.example.ujjwalsmahapatra.passingtwonumberstosecondactivity;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
public class SecondActivity extends AppCompatActivity {
TextView t;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_second);
//Initialize
t=(TextView)findViewById(R.id.textView);
Intent in=getIntent();
Bundle b=in.getExtras();
String num1=b.getString("num1");
String num2=b.getString("num2");
int n1=Integer.parseInt(num1);
int n2= Integer.parseInt(num2);
t.setText(""+(n1+n2));
}
}
| 784 | 0.693878 | 0.679847 | 25 | 30.360001 | 19.299492 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.64 | false | false |
7
|
e051400a39b36b82a7cc5d38098c5c9f03de8c60
| 29,317,446,811,088 |
eb7883fbd0b44d377a6197b796d6dd4d03dc3cc1
|
/src/com/wzu/server/UploadServlet.java
|
b55cf28f4b2009686480e5015201b233b2e44bac
|
[] |
no_license
|
Poreless/AndroidServlet
|
https://github.com/Poreless/AndroidServlet
|
d85d75e46ef25863f79780752e9704add22dc05e
|
2fa9c4a8f5d63848a63956a85d1ee78c0c18d73c
|
refs/heads/master
| 2020-03-17T13:24:24.625000 | 2018-05-16T07:55:51 | 2018-05-16T07:55:51 | 133,630,405 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
// Decompiled by DJ v3.10.10.93 Copyright 2007 Atanas Neshkov Date: 2018/3/21 23:42:32
// Home Page: http://members.fortunecity.com/neshkov/dj.html http://www.neshkov.com/dj.html - Check often for new version!
// Decompiler options: packimports(3)
// Source File Name: UploadServlet.java
package com.wzu.server;
import java.io.*;
import java.util.Iterator;
import java.util.List;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.*;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileItemFactory;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
public class UploadServlet extends HttpServlet
{
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
boolean isMultipart = ServletFileUpload.isMultipartContent(request);
if(isMultipart)
{
String realpath = request.getSession().getServletContext().getRealPath("/files");
System.out.println(realpath);
File dir = new File(realpath);
if(!dir.exists())
dir.mkdirs();
FileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);
upload.setHeaderEncoding("UTF-8");
try
{
List items = upload.parseRequest(request);
for(Iterator iterator = items.iterator(); iterator.hasNext();)
{
FileItem item = (FileItem)iterator.next();
if(item.isFormField())
{
String name1 = item.getFieldName();
String value = item.getString("UTF-8");
System.out.println((new StringBuilder(String.valueOf(name1))).append("=").append(value).toString());
} else
{
item.write(new File(dir, (new StringBuilder(String.valueOf(System.currentTimeMillis()))).append(item.getName().substring(item.getName().lastIndexOf("."))).toString()));
}
}
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
}
|
UTF-8
|
Java
| 2,408 |
java
|
UploadServlet.java
|
Java
|
[
{
"context": "// Decompiled by DJ v3.10.10.93 Copyright 2007 Atanas Neshkov Date: 2018/3/21 23:42:32\n// Home Page: http://me",
"end": 61,
"score": 0.999864399433136,
"start": 47,
"tag": "NAME",
"value": "Atanas Neshkov"
},
{
"context": "2:32\n// Home Page: http://members.fortunecity.com/neshkov/dj.html http://www.neshkov.com/dj.html - Check o",
"end": 140,
"score": 0.997444212436676,
"start": 133,
"tag": "USERNAME",
"value": "neshkov"
}
] | null |
[] |
// Decompiled by DJ v3.10.10.93 Copyright 2007 <NAME> Date: 2018/3/21 23:42:32
// Home Page: http://members.fortunecity.com/neshkov/dj.html http://www.neshkov.com/dj.html - Check often for new version!
// Decompiler options: packimports(3)
// Source File Name: UploadServlet.java
package com.wzu.server;
import java.io.*;
import java.util.Iterator;
import java.util.List;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.*;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileItemFactory;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
public class UploadServlet extends HttpServlet
{
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
boolean isMultipart = ServletFileUpload.isMultipartContent(request);
if(isMultipart)
{
String realpath = request.getSession().getServletContext().getRealPath("/files");
System.out.println(realpath);
File dir = new File(realpath);
if(!dir.exists())
dir.mkdirs();
FileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);
upload.setHeaderEncoding("UTF-8");
try
{
List items = upload.parseRequest(request);
for(Iterator iterator = items.iterator(); iterator.hasNext();)
{
FileItem item = (FileItem)iterator.next();
if(item.isFormField())
{
String name1 = item.getFieldName();
String value = item.getString("UTF-8");
System.out.println((new StringBuilder(String.valueOf(name1))).append("=").append(value).toString());
} else
{
item.write(new File(dir, (new StringBuilder(String.valueOf(System.currentTimeMillis()))).append(item.getName().substring(item.getName().lastIndexOf("."))).toString()));
}
}
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
}
| 2,400 | 0.608804 | 0.596761 | 59 | 39.830509 | 35.112484 | 192 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.525424 | false | false |
7
|
22e65615bfb05733e599298c8a06a9c6fe86de06
| 15,264,313,830,609 |
4cc8ff7000c1a07001cc780cb18959f9b0a88c35
|
/VisualPerspective-3.7/src/main/java/vp3x/dialib/components/AbstractImageComponent.java
|
3baf45b684cfa3c062bec6880eac7385d03da1dc
|
[] |
no_license
|
ezwn/ezw.visualperspective3
|
https://github.com/ezwn/ezw.visualperspective3
|
62d32e4f23c2c8e142f6ba0e5ecf22cf4cd9bb05
|
432a919b45c0f8eb02bc2d8b3af87ff08833ecc4
|
refs/heads/master
| 2017-12-12T16:57:58.372000 | 2017-04-12T12:46:59 | 2017-04-12T12:46:59 | 78,554,881 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package vp3x.dialib.components;
import ezw.graph2d.GraphElement;
import ezw.graph2d.engine.Graph2DDrawEngine;
import java.awt.Graphics;
import ezw.graph2d.layouts.LayoutManager;
import java.awt.Graphics2D;
import java.util.ArrayList;
import java.util.List;
import vp3x.dialib.styles.image.IImageStylable;
/**
*
* @author Nicolas Enzweiler
*/
public abstract class AbstractImageComponent extends AbstractRectBasedComponent<ezw.graph2d.Image>
implements Cloneable, IImageStylable {
/**
* Constructors
*/
public AbstractImageComponent() {
super();
resetStyle();
}
public AbstractImageComponent(AbstractImageComponent aic) {
super();
resetStyle();
// this.image = aic.getImage();
}
public final void resetStyle() {
List<GraphElement> elements = new ArrayList();
setElements(elements);
elements.add(style());
List<LayoutManager> layouts = new ArrayList();
layouts.add(new AbstractImageComponentLayout(true));
setLayouts(layouts);
}
@Override
public void draw(Graphics graphics) {
if (!isVisible()) {
return;
}
rectToPrimitivePoints(style());
Graph2DDrawEngine drawEngine = new Graph2DDrawEngine((Graphics2D) graphics);
drawEngine.visit(this);
drawSelection(graphics);
}
}
|
UTF-8
|
Java
| 1,450 |
java
|
AbstractImageComponent.java
|
Java
|
[
{
"context": "tyles.image.IImageStylable;\r\n\r\n/**\r\n *\r\n * @author Nicolas Enzweiler\r\n */\r\npublic abstract class AbstractImageComponent ",
"end": 355,
"score": 0.9841123819351196,
"start": 338,
"tag": "NAME",
"value": "Nicolas Enzweiler"
}
] | null |
[] |
package vp3x.dialib.components;
import ezw.graph2d.GraphElement;
import ezw.graph2d.engine.Graph2DDrawEngine;
import java.awt.Graphics;
import ezw.graph2d.layouts.LayoutManager;
import java.awt.Graphics2D;
import java.util.ArrayList;
import java.util.List;
import vp3x.dialib.styles.image.IImageStylable;
/**
*
* @author <NAME>
*/
public abstract class AbstractImageComponent extends AbstractRectBasedComponent<ezw.graph2d.Image>
implements Cloneable, IImageStylable {
/**
* Constructors
*/
public AbstractImageComponent() {
super();
resetStyle();
}
public AbstractImageComponent(AbstractImageComponent aic) {
super();
resetStyle();
// this.image = aic.getImage();
}
public final void resetStyle() {
List<GraphElement> elements = new ArrayList();
setElements(elements);
elements.add(style());
List<LayoutManager> layouts = new ArrayList();
layouts.add(new AbstractImageComponentLayout(true));
setLayouts(layouts);
}
@Override
public void draw(Graphics graphics) {
if (!isVisible()) {
return;
}
rectToPrimitivePoints(style());
Graph2DDrawEngine drawEngine = new Graph2DDrawEngine((Graphics2D) graphics);
drawEngine.visit(this);
drawSelection(graphics);
}
}
| 1,439 | 0.636552 | 0.628965 | 56 | 23.892857 | 21.838432 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.464286 | false | false |
7
|
b525ddba56452f1195bfe04cbd25064796345f45
| 13,761,075,284,360 |
c6892a603b6f71dd97a4a1243f4e4b8f5ed41d76
|
/app/src/main/java/com/example/mediaproject_agora/src/main/items/RestaurantCommentItem.java
|
2ff54367d5a853165c0fb903d1e61c82146e0636
|
[] |
no_license
|
isj0217/MediaProject_Agora
|
https://github.com/isj0217/MediaProject_Agora
|
bef58543f593f05a11909fe82a3562ee419108ae
|
fbcad7ed3c9c38487e886c9cdeabfc63416773f8
|
refs/heads/master
| 2023-02-03T15:38:29.045000 | 2020-12-06T07:59:49 | 2020-12-06T07:59:49 | 311,976,216 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.mediaproject_agora.src.main.items;
public class RestaurantCommentItem {
private int is_mine;
private int comment_idx;
private String nickname;
private String time;
private String comment_content;
public int getIs_mine() {
return is_mine;
}
public void setIs_mine(int is_mine) {
this.is_mine = is_mine;
}
public int getComment_idx() {
return comment_idx;
}
public void setComment_idx(int comment_idx) {
this.comment_idx = comment_idx;
}
public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public String getComment_content() {
return comment_content;
}
public void setComment_content(String comment_content) {
this.comment_content = comment_content;
}
}
|
UTF-8
|
Java
| 1,029 |
java
|
RestaurantCommentItem.java
|
Java
|
[] | null |
[] |
package com.example.mediaproject_agora.src.main.items;
public class RestaurantCommentItem {
private int is_mine;
private int comment_idx;
private String nickname;
private String time;
private String comment_content;
public int getIs_mine() {
return is_mine;
}
public void setIs_mine(int is_mine) {
this.is_mine = is_mine;
}
public int getComment_idx() {
return comment_idx;
}
public void setComment_idx(int comment_idx) {
this.comment_idx = comment_idx;
}
public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public String getComment_content() {
return comment_content;
}
public void setComment_content(String comment_content) {
this.comment_content = comment_content;
}
}
| 1,029 | 0.620991 | 0.620991 | 51 | 19.17647 | 17.687601 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.313726 | false | false |
7
|
d75376e1b7078f5d8e04f28346798cf271193860
| 18,700,287,635,570 |
fcedf03060850fab30e3ee2699948de51427370c
|
/src/main/java/com/test/migration/repository/AccountRepository.java
|
6e62fc43fb6d82154dcaee8de4a4c366ba3349c3
|
[] |
no_license
|
Lyulie/treino-mapstruct-migration
|
https://github.com/Lyulie/treino-mapstruct-migration
|
7ef1ce194a4523d5322256c2d1611098f27131f6
|
79945bcf5e1aa94472636f64570d9e74debbf8cf
|
refs/heads/main
| 2023-05-26T21:07:27.893000 | 2021-06-08T23:32:31 | 2021-06-08T23:32:31 | 373,359,667 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.test.migration.repository;
import com.test.migration.model.Account;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Optional;
@Repository
public interface AccountRepository extends JpaRepository<Account, Integer> {
Optional<Account> findByNumber(Integer number);
List<Account> findByNumberIn(List<Integer> numbers);
}
|
UTF-8
|
Java
| 446 |
java
|
AccountRepository.java
|
Java
|
[] | null |
[] |
package com.test.migration.repository;
import com.test.migration.model.Account;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Optional;
@Repository
public interface AccountRepository extends JpaRepository<Account, Integer> {
Optional<Account> findByNumber(Integer number);
List<Account> findByNumberIn(List<Integer> numbers);
}
| 446 | 0.816144 | 0.816144 | 15 | 28.733334 | 25.267811 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.6 | false | false |
7
|
c74b3e8f45145aa023c6299eb403cc866d6fb97a
| 34,282,428,965,866 |
e9e78dcd9c38819549a2de1038acb9678ec74517
|
/Environments/Factory/SimpleFactoryPlayerVolume2/src/SimpleFactoryPlayer/UnitTest/SimpleFactoryPlayerSystemTest.java
|
ebb9da373941a5735661724280597cf3a87456a9
|
[] |
no_license
|
solversa/D-MARLA
|
https://github.com/solversa/D-MARLA
|
cd0138eb7ddad7c9f6084086973511d4b9b42121
|
7a3c869346a6c956b8cfa978e078a8b7f1539e20
|
refs/heads/master
| 2021-05-29T02:58:32.830000 | 2014-06-13T13:59:52 | 2014-06-13T13:59:52 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package SimpleFactoryPlayer.UnitTest;
import Factory.GameLogic.Enums.Faction;
import Factory.GameLogic.TransportTypes.*;
import SimpleFactoryPlayer.Implementation.SimpleFactoryPlayerVolume2System;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
/**
* Created with IntelliJ IDEA.
* User: TwiG
* Date: 09.06.12
* Time: 19:48
* To change this template use File | Settings | File Templates.
*/
public class SimpleFactoryPlayerSystemTest {
UUID one = UUID.randomUUID();
UUID two = UUID.randomUUID();
TFactory factoryEnemy1 = new TFactory(5,0, Faction.BLUE,1);
TFactory factoryNeutral2 = new TFactory(5,0,Faction.NEUTRAL,2);
List<TFactory> factoryList = new ArrayList<TFactory>();
TFactoryField factoryField1 = new TFactoryField(null,1);
TFactoryField factoryField2 = new TFactoryField(null,2);
TGameState gameState;
TUnit blueUnit1 = new TUnit(one, Faction.BLUE,-1);
TUnit redUnit2 = new TUnit(two,Faction.RED,-2);
TNormalField normalWithEnemy = new TNormalField(blueUnit1);
TNormalField normalWithFriend = new TNormalField(redUnit2);
TNormalField normalWithNone = new TNormalField(null);
TAbstractField[][] boardForSearch = {
{normalWithNone,normalWithEnemy,normalWithNone,normalWithNone},
{normalWithNone,normalWithNone,normalWithNone,normalWithNone},
{factoryField1,normalWithFriend,normalWithNone,factoryField2},
{normalWithNone,normalWithFriend,normalWithNone,normalWithNone},
};
@Before
public void setUp() throws Exception {
factoryList.add(factoryEnemy1);
factoryList.add(factoryNeutral2);
gameState= new TGameState(false,null,0,0,null,factoryList,boardForSearch);
}
@After
public void tearDown() throws Exception {
}
@Test
public void testGetActionsForEnvironmentStatus() throws Exception {
SimpleFactoryPlayerVolume2System system = new SimpleFactoryPlayerVolume2System(new DummyPluginProvider());
system.start(Faction.RED);
TActionsInTurn actions= (TActionsInTurn)system.getActionsForEnvironmentStatus(gameState);
for(TAction action: actions){
System.out.println("Actions after start: "+action.getDirection());
System.out.println("Unit after start: "+action.getUnit().getControllingFaction());
}
actions= (TActionsInTurn)system.getActionsForEnvironmentStatus(gameState);
for(TAction action: actions){
System.out.println("Actions after 2: "+action.getDirection());
System.out.println("Unit after 2: "+action.getUnit().getControllingFaction());
}
actions= (TActionsInTurn)system.getActionsForEnvironmentStatus(gameState);
for(TAction action: actions){
System.out.println("Actions after 3: "+action.getDirection());
System.out.println("Unit after 3: "+action.getUnit().getControllingFaction());
}
}
}
|
UTF-8
|
Java
| 3,055 |
java
|
SimpleFactoryPlayerSystemTest.java
|
Java
|
[
{
"context": "l.UUID;\n\n/**\n* Created with IntelliJ IDEA.\n* User: TwiG\n* Date: 09.06.12\n* Time: 19:48\n* To change this t",
"end": 392,
"score": 0.99960857629776,
"start": 388,
"tag": "USERNAME",
"value": "TwiG"
}
] | null |
[] |
package SimpleFactoryPlayer.UnitTest;
import Factory.GameLogic.Enums.Faction;
import Factory.GameLogic.TransportTypes.*;
import SimpleFactoryPlayer.Implementation.SimpleFactoryPlayerVolume2System;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
/**
* Created with IntelliJ IDEA.
* User: TwiG
* Date: 09.06.12
* Time: 19:48
* To change this template use File | Settings | File Templates.
*/
public class SimpleFactoryPlayerSystemTest {
UUID one = UUID.randomUUID();
UUID two = UUID.randomUUID();
TFactory factoryEnemy1 = new TFactory(5,0, Faction.BLUE,1);
TFactory factoryNeutral2 = new TFactory(5,0,Faction.NEUTRAL,2);
List<TFactory> factoryList = new ArrayList<TFactory>();
TFactoryField factoryField1 = new TFactoryField(null,1);
TFactoryField factoryField2 = new TFactoryField(null,2);
TGameState gameState;
TUnit blueUnit1 = new TUnit(one, Faction.BLUE,-1);
TUnit redUnit2 = new TUnit(two,Faction.RED,-2);
TNormalField normalWithEnemy = new TNormalField(blueUnit1);
TNormalField normalWithFriend = new TNormalField(redUnit2);
TNormalField normalWithNone = new TNormalField(null);
TAbstractField[][] boardForSearch = {
{normalWithNone,normalWithEnemy,normalWithNone,normalWithNone},
{normalWithNone,normalWithNone,normalWithNone,normalWithNone},
{factoryField1,normalWithFriend,normalWithNone,factoryField2},
{normalWithNone,normalWithFriend,normalWithNone,normalWithNone},
};
@Before
public void setUp() throws Exception {
factoryList.add(factoryEnemy1);
factoryList.add(factoryNeutral2);
gameState= new TGameState(false,null,0,0,null,factoryList,boardForSearch);
}
@After
public void tearDown() throws Exception {
}
@Test
public void testGetActionsForEnvironmentStatus() throws Exception {
SimpleFactoryPlayerVolume2System system = new SimpleFactoryPlayerVolume2System(new DummyPluginProvider());
system.start(Faction.RED);
TActionsInTurn actions= (TActionsInTurn)system.getActionsForEnvironmentStatus(gameState);
for(TAction action: actions){
System.out.println("Actions after start: "+action.getDirection());
System.out.println("Unit after start: "+action.getUnit().getControllingFaction());
}
actions= (TActionsInTurn)system.getActionsForEnvironmentStatus(gameState);
for(TAction action: actions){
System.out.println("Actions after 2: "+action.getDirection());
System.out.println("Unit after 2: "+action.getUnit().getControllingFaction());
}
actions= (TActionsInTurn)system.getActionsForEnvironmentStatus(gameState);
for(TAction action: actions){
System.out.println("Actions after 3: "+action.getDirection());
System.out.println("Unit after 3: "+action.getUnit().getControllingFaction());
}
}
}
| 3,055 | 0.71293 | 0.699509 | 85 | 34.941177 | 31.165348 | 114 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.870588 | false | false |
7
|
3dd4678742b254eafcc8f793ff5c856427794360
| 34,024,730,935,682 |
0825379dd149110f1827f08ce9a12e6020e4d310
|
/app/src/main/java/ufcg/com/showtime/EventActivity.java
|
3fb0d546793bdd29f2ad4dea468ce99333a33cc6
|
[] |
no_license
|
franklinwesley/ShowTime
|
https://github.com/franklinwesley/ShowTime
|
573e6c722db92998814461512c9ed6d387228968
|
e16e90ca58671f5cb9759c78c651ec2a2102d522
|
refs/heads/master
| 2021-01-10T11:44:26.707000 | 2015-11-30T14:34:14 | 2015-11-30T14:34:14 | 46,625,757 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package ufcg.com.showtime;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import java.util.ArrayList;
import ufcg.com.showtime.Adapters.TabsEventAdapter;
import ufcg.com.showtime.Adapters.TabsMainAdapter;
import ufcg.com.showtime.Data.MySQLiteOpenHelper;
import ufcg.com.showtime.Extras.SlidingTabLayout;
import ufcg.com.showtime.Models.Event;
import ufcg.com.showtime.Models.Musico;
public class EventActivity extends AppCompatActivity {
private SlidingTabLayout slidingTabLayout;
private ViewPager viewPager;
private TabsEventAdapter adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_event);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
Event event = getIntent().getExtras().getParcelable("event");
MySQLiteOpenHelper bd = new MySQLiteOpenHelper(this);
ArrayList<Musico> musicos = bd.recuperarMusicos(event.getNome());
bd.close();
viewPager = (ViewPager) findViewById(R.id.vp_tabs_event);
adapter = new TabsEventAdapter(getSupportFragmentManager(), this, event, musicos);
viewPager.setAdapter(adapter);
slidingTabLayout = (SlidingTabLayout) findViewById(R.id.tabs_event);
slidingTabLayout.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
slidingTabLayout.setSelectedIndicatorColors(getResources().getColor(R.color.colorAccent));
slidingTabLayout.setDistributeEvenly(true);
slidingTabLayout.setViewPager(viewPager);
}
}
|
UTF-8
|
Java
| 1,769 |
java
|
EventActivity.java
|
Java
|
[] | null |
[] |
package ufcg.com.showtime;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import java.util.ArrayList;
import ufcg.com.showtime.Adapters.TabsEventAdapter;
import ufcg.com.showtime.Adapters.TabsMainAdapter;
import ufcg.com.showtime.Data.MySQLiteOpenHelper;
import ufcg.com.showtime.Extras.SlidingTabLayout;
import ufcg.com.showtime.Models.Event;
import ufcg.com.showtime.Models.Musico;
public class EventActivity extends AppCompatActivity {
private SlidingTabLayout slidingTabLayout;
private ViewPager viewPager;
private TabsEventAdapter adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_event);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
Event event = getIntent().getExtras().getParcelable("event");
MySQLiteOpenHelper bd = new MySQLiteOpenHelper(this);
ArrayList<Musico> musicos = bd.recuperarMusicos(event.getNome());
bd.close();
viewPager = (ViewPager) findViewById(R.id.vp_tabs_event);
adapter = new TabsEventAdapter(getSupportFragmentManager(), this, event, musicos);
viewPager.setAdapter(adapter);
slidingTabLayout = (SlidingTabLayout) findViewById(R.id.tabs_event);
slidingTabLayout.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
slidingTabLayout.setSelectedIndicatorColors(getResources().getColor(R.color.colorAccent));
slidingTabLayout.setDistributeEvenly(true);
slidingTabLayout.setViewPager(viewPager);
}
}
| 1,769 | 0.755794 | 0.754098 | 46 | 37.45652 | 26.967539 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.76087 | false | false |
7
|
ec0984a12f98ccd137cc63ada2e08ee989e0bcd0
| 18,451,179,539,989 |
8229884a9bd15286a34cbd2e7b4624ee158be378
|
/app/src/k6/java/com.mili.smarthome.tkj/main/activity/BaseMainActivity.java
|
7e4343a581b41fa5842d79143dc026bfe159d7d4
|
[] |
no_license
|
chengcdev/smarthome
|
https://github.com/chengcdev/smarthome
|
5ae58bc0ba8770598f83a36355b557c46f37b90c
|
4edb33dcdfcab39a3bc6e5342a7973ac703f1344
|
refs/heads/master
| 2022-12-03T18:04:39.172000 | 2020-08-20T05:22:57 | 2020-08-20T05:22:57 | 288,909,136 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.mili.smarthome.tkj.main.activity;
import android.view.KeyEvent;
import android.view.MotionEvent;
import com.mili.smarthome.tkj.base.BaseActivity;
import com.mili.smarthome.tkj.constant.Constant;
import com.mili.smarthome.tkj.inteface.IActCallBackListener;
import com.mili.smarthome.tkj.utils.AppUtils;
import com.mili.smarthome.tkj.utils.LogUtils;
import com.mili.smarthome.tkj.utils.PlaySoundUtils;
import java.util.Timer;
import java.util.TimerTask;
public class BaseMainActivity extends BaseActivity {
public IActCallBackListener actCallBackListener;
private MyTimeTask myTimeTask;
private Timer timer;
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
switch (ev.getAction()) {
case MotionEvent.ACTION_DOWN:
//开屏屏幕服务
AppUtils.getInstance().startScreenService();
//操作
if (timer != null) {
timer.cancel();
myTimeTask.cancel();
timer = null;
myTimeTask = null;
}
Constant.ScreenId.SCREEN_NO_TOUCH = true;
// LogUtils.w(" BaseMainActivity ACTION_DOWN dispatchTouchEvent isAlarm:" + Constant.IS_ALARM);
if (Constant.IS_ALARM) {
//关闭声音
PlaySoundUtils.stopPlayAssetsSound();
Constant.IS_ALARM = false;
}
break;
case MotionEvent.ACTION_UP:
//10秒后视为不操作
timer = new Timer();
myTimeTask = new MyTimeTask();
timer.schedule(myTimeTask, 10000);
// LogUtils.w(" BaseMainActivity ACTION_UP dispatchTouchEvent isAlarm:" + Constant.IS_ALARM);
break;
}
return super.dispatchTouchEvent(ev);
}
@Override
protected void onResume() {
super.onResume();
//开启屏保和关屏服务
AppUtils.getInstance().startScreenService();
}
public void setActCallBackListener(IActCallBackListener actCallBackListener) {
this.actCallBackListener = actCallBackListener;
}
class MyTimeTask extends TimerTask {
@Override
public void run() {
Constant.ScreenId.SCREEN_NO_TOUCH = false;
}
}
}
|
UTF-8
|
Java
| 2,392 |
java
|
BaseMainActivity.java
|
Java
|
[] | null |
[] |
package com.mili.smarthome.tkj.main.activity;
import android.view.KeyEvent;
import android.view.MotionEvent;
import com.mili.smarthome.tkj.base.BaseActivity;
import com.mili.smarthome.tkj.constant.Constant;
import com.mili.smarthome.tkj.inteface.IActCallBackListener;
import com.mili.smarthome.tkj.utils.AppUtils;
import com.mili.smarthome.tkj.utils.LogUtils;
import com.mili.smarthome.tkj.utils.PlaySoundUtils;
import java.util.Timer;
import java.util.TimerTask;
public class BaseMainActivity extends BaseActivity {
public IActCallBackListener actCallBackListener;
private MyTimeTask myTimeTask;
private Timer timer;
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
switch (ev.getAction()) {
case MotionEvent.ACTION_DOWN:
//开屏屏幕服务
AppUtils.getInstance().startScreenService();
//操作
if (timer != null) {
timer.cancel();
myTimeTask.cancel();
timer = null;
myTimeTask = null;
}
Constant.ScreenId.SCREEN_NO_TOUCH = true;
// LogUtils.w(" BaseMainActivity ACTION_DOWN dispatchTouchEvent isAlarm:" + Constant.IS_ALARM);
if (Constant.IS_ALARM) {
//关闭声音
PlaySoundUtils.stopPlayAssetsSound();
Constant.IS_ALARM = false;
}
break;
case MotionEvent.ACTION_UP:
//10秒后视为不操作
timer = new Timer();
myTimeTask = new MyTimeTask();
timer.schedule(myTimeTask, 10000);
// LogUtils.w(" BaseMainActivity ACTION_UP dispatchTouchEvent isAlarm:" + Constant.IS_ALARM);
break;
}
return super.dispatchTouchEvent(ev);
}
@Override
protected void onResume() {
super.onResume();
//开启屏保和关屏服务
AppUtils.getInstance().startScreenService();
}
public void setActCallBackListener(IActCallBackListener actCallBackListener) {
this.actCallBackListener = actCallBackListener;
}
class MyTimeTask extends TimerTask {
@Override
public void run() {
Constant.ScreenId.SCREEN_NO_TOUCH = false;
}
}
}
| 2,392 | 0.601201 | 0.598199 | 71 | 31.84507 | 23.438049 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.492958 | false | false |
7
|
ec9c34267ce2db1d7fb06b3b48eb172a67ef08d9
| 7,095,286,000,208 |
ea5e6c2fa4701c65cc5eb4da1ed6a95a3502ab99
|
/src/main/java/uk/ac/jisc/saml/mdman/entities/FilterOnOrganisationAspect.java
|
18ac519a722176b9af17813563ab8921c6ce991e
|
[
"Apache-2.0"
] |
permissive
|
philsmart/metadata-management-api
|
https://github.com/philsmart/metadata-management-api
|
708e76443d910629dd394efee3e68e41cfad105a
|
a561ff506502ad2218eae89ee8bfd8eb90288938
|
refs/heads/master
| 2017-10-12T02:17:08.031000 | 2017-10-09T15:33:22 | 2017-10-09T15:33:22 | 51,309,709 | 2 | 0 | null | false | 2016-03-29T19:08:56 | 2016-02-08T16:28:12 | 2016-02-23T14:40:13 | 2016-03-29T19:08:55 | 194 | 0 | 0 | 0 |
Java
| null | null |
package uk.ac.jisc.saml.mdman.entities;
import java.util.Collection;
import javax.annotation.concurrent.ThreadSafe;
import javax.inject.Inject;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import uk.ac.jisc.saml.mdman.security.NullOrganisationUserDetailsException;
import uk.ac.jisc.saml.mdman.security.OrganisationUserDetails;
import uk.ac.jisc.saml.mdman.security.SecurityContextHelper;
import uk.ac.jisc.saml.mdman.storage.ElementStorageItem;
@ThreadSafe
@Aspect
@Component
public class FilterOnOrganisationAspect {
/** class logger */
private static final Logger log = LoggerFactory.getLogger(FilterOnOrganisationAspect.class);
@Inject
private EntityFilterOnOrganisationOwner orgFilter;
public FilterOnOrganisationAspect() {
log.info("Created Filter On Organisation Annotation filter");
}
@Around("@annotation(FilterOrgId) && execution(* *(..))")
public Object filter(final ProceedingJoinPoint pjp) throws Throwable {
final Object entities = pjp.proceed();
if (entities instanceof Collection) {
final Collection<?> objAsCollection = (Collection<?>) entities;
if (checkAllElementStorageItemType(objAsCollection)) {
final Collection<ElementStorageItem> entitiesCollection = (Collection<ElementStorageItem>) entities;
final OrganisationUserDetails userDetails = SecurityContextHelper.getOrganisationUserDetails()
.orElseThrow(() -> new NullOrganisationUserDetailsException(
"UserDetails not found in security context, can not getEntities"));
final Collection<ElementStorageItem> filteredItems = orgFilter.filterEntities(entitiesCollection,
userDetails.getRelyingOrganisationId());
log.info("FilterOrgId annotation has filtered return to contain {} items", filteredItems.size());
return filteredItems;
} else {
log.warn(
"FilterOnOrganisation annotation (@FilterOrgId) used on a method whos output is NOT a collection of type ElementStorageItem, nothing todo");
}
} else {
log.warn(
"FilterOnOrganisation annotation (@FilterOrgId) used on a method whos output is NOT a collection, nothing todo");
}
return entities;
}
private boolean checkAllElementStorageItemType(final Collection<?> collection) {
for (final Object obj : collection) {
if (!(obj instanceof ElementStorageItem)) {
return false;
}
}
return true;
}
}
|
UTF-8
|
Java
| 2,538 |
java
|
FilterOnOrganisationAspect.java
|
Java
|
[
{
"context": "\t\tlog.warn(\n\t\t\t\t\t\t\"FilterOnOrganisation annotation (@FilterOrgId) used on a method whos output is NOT a collection",
"end": 2048,
"score": 0.9860029220581055,
"start": 2035,
"tag": "USERNAME",
"value": "(@FilterOrgId"
},
{
"context": "\t\t\tlog.warn(\n\t\t\t\t\t\"FilterOnOrganisation annotation (@FilterOrgId) used on a method whos output is NOT a collection",
"end": 2224,
"score": 0.97761470079422,
"start": 2211,
"tag": "USERNAME",
"value": "(@FilterOrgId"
}
] | null |
[] |
package uk.ac.jisc.saml.mdman.entities;
import java.util.Collection;
import javax.annotation.concurrent.ThreadSafe;
import javax.inject.Inject;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import uk.ac.jisc.saml.mdman.security.NullOrganisationUserDetailsException;
import uk.ac.jisc.saml.mdman.security.OrganisationUserDetails;
import uk.ac.jisc.saml.mdman.security.SecurityContextHelper;
import uk.ac.jisc.saml.mdman.storage.ElementStorageItem;
@ThreadSafe
@Aspect
@Component
public class FilterOnOrganisationAspect {
/** class logger */
private static final Logger log = LoggerFactory.getLogger(FilterOnOrganisationAspect.class);
@Inject
private EntityFilterOnOrganisationOwner orgFilter;
public FilterOnOrganisationAspect() {
log.info("Created Filter On Organisation Annotation filter");
}
@Around("@annotation(FilterOrgId) && execution(* *(..))")
public Object filter(final ProceedingJoinPoint pjp) throws Throwable {
final Object entities = pjp.proceed();
if (entities instanceof Collection) {
final Collection<?> objAsCollection = (Collection<?>) entities;
if (checkAllElementStorageItemType(objAsCollection)) {
final Collection<ElementStorageItem> entitiesCollection = (Collection<ElementStorageItem>) entities;
final OrganisationUserDetails userDetails = SecurityContextHelper.getOrganisationUserDetails()
.orElseThrow(() -> new NullOrganisationUserDetailsException(
"UserDetails not found in security context, can not getEntities"));
final Collection<ElementStorageItem> filteredItems = orgFilter.filterEntities(entitiesCollection,
userDetails.getRelyingOrganisationId());
log.info("FilterOrgId annotation has filtered return to contain {} items", filteredItems.size());
return filteredItems;
} else {
log.warn(
"FilterOnOrganisation annotation (@FilterOrgId) used on a method whos output is NOT a collection of type ElementStorageItem, nothing todo");
}
} else {
log.warn(
"FilterOnOrganisation annotation (@FilterOrgId) used on a method whos output is NOT a collection, nothing todo");
}
return entities;
}
private boolean checkAllElementStorageItemType(final Collection<?> collection) {
for (final Object obj : collection) {
if (!(obj instanceof ElementStorageItem)) {
return false;
}
}
return true;
}
}
| 2,538 | 0.774232 | 0.773444 | 79 | 31.126583 | 34.258278 | 146 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.810127 | false | false |
7
|
2bb37460d2216b67b4a62681497441dae61d7332
| 9,887,014,721,070 |
e9b51fc99a19241338765845bc6ada25f0a042ef
|
/src/week4/task2/Circle.java
|
ca8a2a01e2a66e8de57330b476b9476801abfb50
|
[] |
no_license
|
anhnh-3008/oop2018
|
https://github.com/anhnh-3008/oop2018
|
49bd63baf1ffced9880dd8d9e2e599967c859e94
|
78abf9ba137f3d822e63bb9b841f423b90312d80
|
refs/heads/master
| 2022-09-29T10:46:42.667000 | 2018-11-29T14:10:31 | 2018-11-29T14:10:31 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package week4.task2;
public class Circle extends Shade {
private double radious = 1.0;
private double PI = Math.PI;
public Circle(){
}
public Circle(double radious){
this.radious=radious;
}
public Circle(String color,boolean filled,double radious){
super(color, filled);
this.radious=radious;
}
public void setRadious(double radious) {
this.radious = radious;
}
public double getRadious() {
return radious;
}
@Override
public String toString(){
double Area = PI*Math.pow(radious,2);
double Perimeter = 2*PI*radious;
return super.toString()
+"\n"+"Area: "+Area+"\n"+"Perimeter: " +Perimeter;
}
}
|
UTF-8
|
Java
| 740 |
java
|
Circle.java
|
Java
|
[] | null |
[] |
package week4.task2;
public class Circle extends Shade {
private double radious = 1.0;
private double PI = Math.PI;
public Circle(){
}
public Circle(double radious){
this.radious=radious;
}
public Circle(String color,boolean filled,double radious){
super(color, filled);
this.radious=radious;
}
public void setRadious(double radious) {
this.radious = radious;
}
public double getRadious() {
return radious;
}
@Override
public String toString(){
double Area = PI*Math.pow(radious,2);
double Perimeter = 2*PI*radious;
return super.toString()
+"\n"+"Area: "+Area+"\n"+"Perimeter: " +Perimeter;
}
}
| 740 | 0.594595 | 0.586486 | 32 | 22.125 | 18.156868 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.46875 | false | false |
7
|
7d39dca0325161bc8c2e737ac550047919681141
| 19,061,064,871,803 |
10c73abb84f7ff478e615b0e49b126034571635c
|
/src/main/java/com/mk/hms/service/RequestLogService.java
|
36be6efcd2fe6989011dae3101957e058bbb7049
|
[] |
no_license
|
zhangzuoqiang/hotel-mgr-sys
|
https://github.com/zhangzuoqiang/hotel-mgr-sys
|
16bee1adbb480d59d90061b7c3538300af1449af
|
1b0e1cca5ef0763c2366bdf2c2a637c87c9db672
|
refs/heads/master
| 2020-04-06T05:09:05.262000 | 2016-03-10T15:32:42 | 2016-03-10T15:32:42 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.mk.hms.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.mk.hms.mapper.AopLogMapper;
import com.mk.hms.model.AopLogWithBLOBs;
/**
* 日志处理
* @author hdy
*
*/
@Service
@Transactional
public class RequestLogService {
@Autowired
private AopLogMapper aopLogMapper = null;
/**
* 添加日志
* @param map 日志对象
*/
public void add(AopLogWithBLOBs aoplog) {
this.getAopLogMapper().insert(aoplog);
}
private AopLogMapper getAopLogMapper() {
return aopLogMapper;
}
}
|
UTF-8
|
Java
| 657 |
java
|
RequestLogService.java
|
Java
|
[
{
"context": "hms.model.AopLogWithBLOBs;\n\n/**\n * 日志处理\n * @author hdy\n *\n */\n@Service\n@Transactional\npublic class Reque",
"end": 312,
"score": 0.9996155500411987,
"start": 309,
"tag": "USERNAME",
"value": "hdy"
}
] | null |
[] |
package com.mk.hms.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.mk.hms.mapper.AopLogMapper;
import com.mk.hms.model.AopLogWithBLOBs;
/**
* 日志处理
* @author hdy
*
*/
@Service
@Transactional
public class RequestLogService {
@Autowired
private AopLogMapper aopLogMapper = null;
/**
* 添加日志
* @param map 日志对象
*/
public void add(AopLogWithBLOBs aoplog) {
this.getAopLogMapper().insert(aoplog);
}
private AopLogMapper getAopLogMapper() {
return aopLogMapper;
}
}
| 657 | 0.758294 | 0.758294 | 34 | 17.617647 | 19.333017 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.705882 | false | false |
7
|
35fbdfb8d1fe1e36dbcb66cc6f87cabf5202adab
| 3,642,132,297,090 |
38671a0fdd52cb9f2b69a52b1ee722fdf11d4b31
|
/src/org/zr/util/TimeUtil.java
|
c96608465df084f591e332124306dc5b0bda1fc8
|
[] |
no_license
|
brouceliu/weixin
|
https://github.com/brouceliu/weixin
|
ff79399549d86fa7b6ee7d4896a3e0a3332a1a57
|
87da7f29a5f6e0f61dd87fca0facdf939592a2c6
|
refs/heads/master
| 2021-01-10T12:54:24.495000 | 2015-10-21T02:39:12 | 2015-10-21T02:39:12 | 44,646,710 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.zr.util;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class TimeUtil {
private static Logger log=LoggerFactory.getLogger(TimeUtil.class);
//微信时间处理类
/**比较时间 s1 微信token时间 系统当前时间**/
public static Boolean checksTime(String s1){
Boolean finaresult=false;
//String s1="2008-01-25 09:12:09";
//String s2="2008-01-29 09:12:11";
java.text.DateFormat df=new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date=new Date();
java.util.Calendar c1=java.util.Calendar.getInstance();
java.util.Calendar c2=java.util.Calendar.getInstance();
String s2=df.format(date);
try{
c1.setTime(df.parse(s1));
c2.setTime(df.parse(s2));
}catch(java.text.ParseException e){
log.warn("格式不正确");
}
int result=c1.compareTo(c2);
if(result==0){
//c1=c2
log.info("输入的token时间相等系统时间");
}
else if(result<0){
//c1<c2
log.info("输入的token时间小于系统时间");
}
else{
//c1>c2
finaresult=true;//只有输入时间大于系统时间 返回true 此时token有效
log.info("输入的token时间大于系统时间");
}
return finaresult;
}
/**时间相加 秒**/
public static Date addOneSecond(Date date,int time) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.SECOND, time);
return calendar.getTime();
}
public static String formatTime(String createTime) {
// 将微信传入的CreateTime转换成long类型,再乘以1000
long msgCreateTime = Long.parseLong(createTime) * 1000L;
DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return format.format(new Date(msgCreateTime));
}
/***生成微信加密的时间戳***/
public static String createTimeStept(){
Long tine=System.currentTimeMillis() / 1000L;
String time=tine.toString();
return time;
}
/***将 yyyy-MM-dd 格式的时间,转化为 unix 时间 1970.1.1 0.0.0 到现在的秒数 **/
public static String toUnixTime(String local){
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String unix = "";
long msgCreateTime=111;
try {
unix = df.parse(local).getTime() + "";
msgCreateTime = Long.parseLong(unix) / 1000L;
} catch (ParseException e) {
e.printStackTrace();
}
return String.valueOf(msgCreateTime);
}
//返回现在时间
public static String getNowTime(){
Date da=new Date();
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String a=df.format(da);
return a;
}
public static void main(String[] args) {
System.out.println(toUnixTime("2015-08-15 12:00:00"));
System.out.println(formatTime("1438660476"));
System.out.println(getNowTime());
/*Long tine=System.currentTimeMillis();
System.out.println(tine);
Long tine2=new java.util.Date().getTime();
System.out.println(tine2);*/
/*SimpleDateFormat from = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
date=addOneSecond(date, 7200);
String gettime=from.format(date);+
System.out.println(gettime);
//System.out.println(formatTime("1429241806191"));
System.out.println(checksTime(gettime));*/
}
}
|
GB18030
|
Java
| 3,384 |
java
|
TimeUtil.java
|
Java
|
[] | null |
[] |
package org.zr.util;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class TimeUtil {
private static Logger log=LoggerFactory.getLogger(TimeUtil.class);
//微信时间处理类
/**比较时间 s1 微信token时间 系统当前时间**/
public static Boolean checksTime(String s1){
Boolean finaresult=false;
//String s1="2008-01-25 09:12:09";
//String s2="2008-01-29 09:12:11";
java.text.DateFormat df=new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date=new Date();
java.util.Calendar c1=java.util.Calendar.getInstance();
java.util.Calendar c2=java.util.Calendar.getInstance();
String s2=df.format(date);
try{
c1.setTime(df.parse(s1));
c2.setTime(df.parse(s2));
}catch(java.text.ParseException e){
log.warn("格式不正确");
}
int result=c1.compareTo(c2);
if(result==0){
//c1=c2
log.info("输入的token时间相等系统时间");
}
else if(result<0){
//c1<c2
log.info("输入的token时间小于系统时间");
}
else{
//c1>c2
finaresult=true;//只有输入时间大于系统时间 返回true 此时token有效
log.info("输入的token时间大于系统时间");
}
return finaresult;
}
/**时间相加 秒**/
public static Date addOneSecond(Date date,int time) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.SECOND, time);
return calendar.getTime();
}
public static String formatTime(String createTime) {
// 将微信传入的CreateTime转换成long类型,再乘以1000
long msgCreateTime = Long.parseLong(createTime) * 1000L;
DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return format.format(new Date(msgCreateTime));
}
/***生成微信加密的时间戳***/
public static String createTimeStept(){
Long tine=System.currentTimeMillis() / 1000L;
String time=tine.toString();
return time;
}
/***将 yyyy-MM-dd 格式的时间,转化为 unix 时间 1970.1.1 0.0.0 到现在的秒数 **/
public static String toUnixTime(String local){
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String unix = "";
long msgCreateTime=111;
try {
unix = df.parse(local).getTime() + "";
msgCreateTime = Long.parseLong(unix) / 1000L;
} catch (ParseException e) {
e.printStackTrace();
}
return String.valueOf(msgCreateTime);
}
//返回现在时间
public static String getNowTime(){
Date da=new Date();
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String a=df.format(da);
return a;
}
public static void main(String[] args) {
System.out.println(toUnixTime("2015-08-15 12:00:00"));
System.out.println(formatTime("1438660476"));
System.out.println(getNowTime());
/*Long tine=System.currentTimeMillis();
System.out.println(tine);
Long tine2=new java.util.Date().getTime();
System.out.println(tine2);*/
/*SimpleDateFormat from = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
date=addOneSecond(date, 7200);
String gettime=from.format(date);+
System.out.println(gettime);
//System.out.println(formatTime("1429241806191"));
System.out.println(checksTime(gettime));*/
}
}
| 3,384 | 0.690903 | 0.651826 | 111 | 27.126125 | 20.300055 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.972973 | false | false |
7
|
90525e5d35101bb1b49f94ab3d47b6ec2d890e2a
| 3,642,132,298,780 |
487b09ffb29cdfbf7300cbd44fec8343816d0990
|
/tw2000hahmonluoja/src/tw2000hahmonluoja/hahmologiikka/Taito.java
|
b59af397c61d1bcc0efa395988b1e6c4d707ecc6
|
[] |
no_license
|
Mayse/OhHa2013
|
https://github.com/Mayse/OhHa2013
|
d9c1c658e3dc2218785c1f28841932bb3eb06524
|
d5a342224ea724e77fadb5f14ad9190a8a45db91
|
refs/heads/master
| 2015-08-08T13:57:37.844000 | 2013-08-14T12:31:33 | 2013-08-14T12:31:33 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package tw2000hahmonluoja.hahmologiikka;
/**
*
* @author miikas
*/
class Taito {
private String nimi;
private int taso;
public Taito(String nimi) {
this.nimi = nimi;
this.taso = 0;
}
Taito(String nimi, int opittavaMaara) {
this(nimi);
this.taso = opittavaMaara;
}
public String getNimi() {
return nimi;
}
public void korotaTaitoa(int maara){
this.taso += maara;
}
@Override
public String toString() {
return "Taito " + nimi + ": " + taso;
}
}
|
UTF-8
|
Java
| 684 |
java
|
Taito.java
|
Java
|
[
{
"context": "w2000hahmonluoja.hahmologiikka;\n\n/**\n *\n * @author miikas\n */\nclass Taito {\n private String nimi;\n pr",
"end": 166,
"score": 0.9990370273590088,
"start": 160,
"tag": "USERNAME",
"value": "miikas"
}
] | null |
[] |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package tw2000hahmonluoja.hahmologiikka;
/**
*
* @author miikas
*/
class Taito {
private String nimi;
private int taso;
public Taito(String nimi) {
this.nimi = nimi;
this.taso = 0;
}
Taito(String nimi, int opittavaMaara) {
this(nimi);
this.taso = opittavaMaara;
}
public String getNimi() {
return nimi;
}
public void korotaTaitoa(int maara){
this.taso += maara;
}
@Override
public String toString() {
return "Taito " + nimi + ": " + taso;
}
}
| 684 | 0.555556 | 0.548246 | 41 | 15.682927 | 15.267435 | 52 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.317073 | false | false |
7
|
2800eda164ab3677dc2d95a8fb9ecde075dbb773
| 16,200,616,641,204 |
e281e4d6068ee4447ad800f37632651e473465e7
|
/pulltorefresh/src/com/markupartist/android/widget/PullToRefreshListView.java
|
97fed9dd06ece40d02340b42d63e2cd44be88606
|
[] |
no_license
|
amirkrifa/Useful-Android-Sample-Projects
|
https://github.com/amirkrifa/Useful-Android-Sample-Projects
|
337318457a59be1eaac423b2a5920b5ce2899ad2
|
b1733503272a8c0f5bc54b924f42ee24a7ef7d3e
|
refs/heads/master
| 2016-09-06T09:12:10.814000 | 2012-03-20T23:08:42 | 2012-03-20T23:08:42 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.markupartist.android.widget;
import com.markupartist.android.widget.pulltorefresh.R;
import android.content.Context;
import android.content.res.Resources;
import android.os.CountDownTimer;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.AbsListView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.AbsListView.OnScrollListener;
public class PullToRefreshListView extends ListView implements OnScrollListener {
private static final String TAG = "PullToRefreshListView";
private LayoutInflater mInflater;
private LinearLayout mRefreshView;
private int mCurrentScrollState;
private int mRefreshViewHeight;
private int mPullBounce;
private boolean mRefreshing;
public PullToRefreshListView(Context context, AttributeSet attrs) {
super(context, attrs);
final Resources res = context.getResources();
mPullBounce = res.getDimensionPixelSize(R.dimen.pull_to_refresh_bounce);
mInflater = (LayoutInflater) context.getSystemService(
Context.LAYOUT_INFLATER_SERVICE);
mRefreshView = (LinearLayout) mInflater.inflate(
R.layout.pull_to_refresh_header, null);
addHeaderView(mRefreshView);
setOnScrollListener(this);
measureView(mRefreshView);
mRefreshViewHeight = mRefreshView.getMeasuredHeight();
smoothScrollBy(mRefreshViewHeight, 0);
//scrollBy(0, mRefreshViewHeight);
setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_UP:
//Log.d(TAG, "BLA: " + getFirstVisiblePosition());
//final int top = mRefreshView.getTop();
final int top = getFirstVisiblePosition();
Log.d(TAG, "top: " + getFirstVisiblePosition());
if (top == 0 && !mRefreshing/* || top >= -30*/) {
//Log.d(TAG, "Should refresh?");
onRefresh();
//return true;
}
}
return false;
}
});
}
private void measureView(View child) {
ViewGroup.LayoutParams p = child.getLayoutParams();
if (p == null) {
p = new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
}
int childWidthSpec = ViewGroup.getChildMeasureSpec(0,
0 + 0, p.width);
int lpHeight = p.height;
int childHeightSpec;
if (lpHeight > 0) {
childHeightSpec = MeasureSpec.makeMeasureSpec(lpHeight, MeasureSpec.EXACTLY);
} else {
childHeightSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
}
child.measure(childWidthSpec, childHeightSpec);
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem,
int visibleItemCount, int totalItemCount) {
if (firstVisibleItem == 0 && mCurrentScrollState == SCROLL_STATE_FLING) {
smoothScrollBy(mRefreshViewHeight, 1000);
//scrollBy(0, mRefreshViewHeight);
}
}
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
mCurrentScrollState = scrollState;
}
public void onRefresh() {
Log.d(TAG, "onRefresh");
final int top = mRefreshView.getTop();
if (top < -30) {
Log.d(TAG, "Backing off refresh...");
smoothScrollBy(mRefreshViewHeight + top, 1000);
return;
}
invalidate();
smoothScrollBy(mRefreshView.getTop() + mPullBounce, 500);
//scrollBy(0, mPullBounce);
mRefreshing = true;
Animation rotateAnimation =
AnimationUtils.loadAnimation(getContext(),
R.anim.pull_to_refresh_anim);
rotateAnimation.setRepeatCount(Animation.INFINITE);
final TextView text = (TextView) mRefreshView.findViewById(R.id.pull_to_refresh_text);
final ImageView staticSpinner = (ImageView) mRefreshView.findViewById(R.id.pull_to_refresh_static_spinner);
text.setText(getContext().getText(R.string.pull_to_refresh_loading_label));
staticSpinner.startAnimation(rotateAnimation);
// TODO: Temporary, to fake some network work or similar. Replace with callback.
new CountDownTimer(4000, 1000) {
@Override
public void onTick(long millisUntilFinished) {
}
@Override
public void onFinish() {
onRefreshComplete();
}
}.start();
}
public void onRefreshComplete() {
Log.d(TAG, "onRefreshComplete");
final TextView text = (TextView) mRefreshView.findViewById(R.id.pull_to_refresh_text);
final ImageView staticSpinner = (ImageView) mRefreshView.findViewById(R.id.pull_to_refresh_static_spinner);
text.setText(getContext().getText(R.string.pull_to_refresh_label));
staticSpinner.setAnimation(null);
final int top = mRefreshView.getTop();
Log.d(TAG, "Refresh top: " + top);
if (top == 0 || top >= -mPullBounce) {
invalidateViews();
//invalidate();
int scrollDistance = mRefreshViewHeight - mPullBounce;
smoothScrollBy(scrollDistance, 1000);
//scrollBy(0, scrollDistance);
}
mRefreshing = false;
}
}
|
UTF-8
|
Java
| 5,974 |
java
|
PullToRefreshListView.java
|
Java
|
[] | null |
[] |
package com.markupartist.android.widget;
import com.markupartist.android.widget.pulltorefresh.R;
import android.content.Context;
import android.content.res.Resources;
import android.os.CountDownTimer;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.AbsListView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.AbsListView.OnScrollListener;
public class PullToRefreshListView extends ListView implements OnScrollListener {
private static final String TAG = "PullToRefreshListView";
private LayoutInflater mInflater;
private LinearLayout mRefreshView;
private int mCurrentScrollState;
private int mRefreshViewHeight;
private int mPullBounce;
private boolean mRefreshing;
public PullToRefreshListView(Context context, AttributeSet attrs) {
super(context, attrs);
final Resources res = context.getResources();
mPullBounce = res.getDimensionPixelSize(R.dimen.pull_to_refresh_bounce);
mInflater = (LayoutInflater) context.getSystemService(
Context.LAYOUT_INFLATER_SERVICE);
mRefreshView = (LinearLayout) mInflater.inflate(
R.layout.pull_to_refresh_header, null);
addHeaderView(mRefreshView);
setOnScrollListener(this);
measureView(mRefreshView);
mRefreshViewHeight = mRefreshView.getMeasuredHeight();
smoothScrollBy(mRefreshViewHeight, 0);
//scrollBy(0, mRefreshViewHeight);
setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_UP:
//Log.d(TAG, "BLA: " + getFirstVisiblePosition());
//final int top = mRefreshView.getTop();
final int top = getFirstVisiblePosition();
Log.d(TAG, "top: " + getFirstVisiblePosition());
if (top == 0 && !mRefreshing/* || top >= -30*/) {
//Log.d(TAG, "Should refresh?");
onRefresh();
//return true;
}
}
return false;
}
});
}
private void measureView(View child) {
ViewGroup.LayoutParams p = child.getLayoutParams();
if (p == null) {
p = new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
}
int childWidthSpec = ViewGroup.getChildMeasureSpec(0,
0 + 0, p.width);
int lpHeight = p.height;
int childHeightSpec;
if (lpHeight > 0) {
childHeightSpec = MeasureSpec.makeMeasureSpec(lpHeight, MeasureSpec.EXACTLY);
} else {
childHeightSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
}
child.measure(childWidthSpec, childHeightSpec);
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem,
int visibleItemCount, int totalItemCount) {
if (firstVisibleItem == 0 && mCurrentScrollState == SCROLL_STATE_FLING) {
smoothScrollBy(mRefreshViewHeight, 1000);
//scrollBy(0, mRefreshViewHeight);
}
}
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
mCurrentScrollState = scrollState;
}
public void onRefresh() {
Log.d(TAG, "onRefresh");
final int top = mRefreshView.getTop();
if (top < -30) {
Log.d(TAG, "Backing off refresh...");
smoothScrollBy(mRefreshViewHeight + top, 1000);
return;
}
invalidate();
smoothScrollBy(mRefreshView.getTop() + mPullBounce, 500);
//scrollBy(0, mPullBounce);
mRefreshing = true;
Animation rotateAnimation =
AnimationUtils.loadAnimation(getContext(),
R.anim.pull_to_refresh_anim);
rotateAnimation.setRepeatCount(Animation.INFINITE);
final TextView text = (TextView) mRefreshView.findViewById(R.id.pull_to_refresh_text);
final ImageView staticSpinner = (ImageView) mRefreshView.findViewById(R.id.pull_to_refresh_static_spinner);
text.setText(getContext().getText(R.string.pull_to_refresh_loading_label));
staticSpinner.startAnimation(rotateAnimation);
// TODO: Temporary, to fake some network work or similar. Replace with callback.
new CountDownTimer(4000, 1000) {
@Override
public void onTick(long millisUntilFinished) {
}
@Override
public void onFinish() {
onRefreshComplete();
}
}.start();
}
public void onRefreshComplete() {
Log.d(TAG, "onRefreshComplete");
final TextView text = (TextView) mRefreshView.findViewById(R.id.pull_to_refresh_text);
final ImageView staticSpinner = (ImageView) mRefreshView.findViewById(R.id.pull_to_refresh_static_spinner);
text.setText(getContext().getText(R.string.pull_to_refresh_label));
staticSpinner.setAnimation(null);
final int top = mRefreshView.getTop();
Log.d(TAG, "Refresh top: " + top);
if (top == 0 || top >= -mPullBounce) {
invalidateViews();
//invalidate();
int scrollDistance = mRefreshViewHeight - mPullBounce;
smoothScrollBy(scrollDistance, 1000);
//scrollBy(0, scrollDistance);
}
mRefreshing = false;
}
}
| 5,974 | 0.628724 | 0.622029 | 169 | 34.349113 | 26.055063 | 115 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.733728 | false | false |
7
|
f97eee2d1a91d980cdd0f7dea4a3119b57561834
| 15,977,278,359,573 |
6c35cee52581e1f097ecbd942a00b3b0f84f07c1
|
/TestNG/src/main/java/com/course/testng/groups/GroupsOnMethod.java
|
1e7213f172136cb06bd59dc8906095997ad56eb1
|
[] |
no_license
|
elvirazxh/APIAutoTest
|
https://github.com/elvirazxh/APIAutoTest
|
177ceb663b693f433a95e4a9edf6b05e8ee0c026
|
5539db6d934e079338808e0f805796862bbf9e6f
|
refs/heads/master
| 2022-06-24T11:46:23.700000 | 2019-06-20T11:04:12 | 2019-06-20T11:04:12 | 190,374,491 | 0 | 0 | null | false | 2022-06-21T01:18:52 | 2019-06-05T10:25:15 | 2019-06-20T11:04:49 | 2022-06-21T01:18:51 | 5,875 | 0 | 0 | 9 |
Java
| false | false |
package com.course.testng.groups;/**
* Created by admin on 2019/6/6.
*/
import org.testng.annotations.AfterGroups;
import org.testng.annotations.BeforeGroups;
import org.testng.annotations.Test;
/**
* @author zxh
* @createTime 2019/6/6 22:55
* @description
*/
//组测试中的方法分组测试
public class GroupsOnMethod {
@Test(groups = "server")
public void test1(){
System.out.println("这是服务端组的测试方法11111");
}
@Test(groups = "server")
public void test2(){
System.out.println("这是服务端组的测试方法222222");
}
@Test(groups = "client")
public void test3(){
System.out.println("这是客户端组的测试方法11111");
}
@Test(groups = "client")
public void test4(){
System.out.println("这是客户端组的测试方法222222");
}
@BeforeGroups("server")
public void beforeGroupsOnerverMethod(){
System.out.println("这是运行在服务端测试组之前运行的方法");
}
@AfterGroups("server")
public void afterGroupsOnServerMethod(){
System.out.println("这是运行在服务端测试组之后运行的方法");
}
@BeforeGroups("client")
public void beforeGroupsOnClientMethod(){
System.out.println("这是运行在客户端测试组之前运行的方法");
}
@AfterGroups("client")
public void afterGroupsOnClientMethod(){
System.out.println("这是运行在客户端测试组之后运行的方法");
}
}
|
UTF-8
|
Java
| 1,533 |
java
|
GroupsOnMethod.java
|
Java
|
[
{
"context": "mport org.testng.annotations.Test;\n\n/**\n * @author zxh\n * @createTime 2019/6/6 22:55\n * @description\n */",
"end": 217,
"score": 0.9996119737625122,
"start": 214,
"tag": "USERNAME",
"value": "zxh"
}
] | null |
[] |
package com.course.testng.groups;/**
* Created by admin on 2019/6/6.
*/
import org.testng.annotations.AfterGroups;
import org.testng.annotations.BeforeGroups;
import org.testng.annotations.Test;
/**
* @author zxh
* @createTime 2019/6/6 22:55
* @description
*/
//组测试中的方法分组测试
public class GroupsOnMethod {
@Test(groups = "server")
public void test1(){
System.out.println("这是服务端组的测试方法11111");
}
@Test(groups = "server")
public void test2(){
System.out.println("这是服务端组的测试方法222222");
}
@Test(groups = "client")
public void test3(){
System.out.println("这是客户端组的测试方法11111");
}
@Test(groups = "client")
public void test4(){
System.out.println("这是客户端组的测试方法222222");
}
@BeforeGroups("server")
public void beforeGroupsOnerverMethod(){
System.out.println("这是运行在服务端测试组之前运行的方法");
}
@AfterGroups("server")
public void afterGroupsOnServerMethod(){
System.out.println("这是运行在服务端测试组之后运行的方法");
}
@BeforeGroups("client")
public void beforeGroupsOnClientMethod(){
System.out.println("这是运行在客户端测试组之前运行的方法");
}
@AfterGroups("client")
public void afterGroupsOnClientMethod(){
System.out.println("这是运行在客户端测试组之后运行的方法");
}
}
| 1,533 | 0.650508 | 0.61767 | 58 | 20.948277 | 18.060648 | 49 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.206897 | false | false |
7
|
4773c8b9a5bf3c5dd42e0b4c0843401ba2039e93
| 35,467,839,969,947 |
8b6c60a7be21e751c14cead866e35468751ea4fc
|
/validator-core/src/test/java/uk/ac/ebi/subs/validator/repository/ValidationResultRepositoryTest.java
|
aeba8f0b25e142ea655747f90c7926fff45fc371
|
[
"Apache-2.0"
] |
permissive
|
EMBL-EBI-SUBS-OLD/validator-prototype
|
https://github.com/EMBL-EBI-SUBS-OLD/validator-prototype
|
37ca4ab77c1029fe966486326df1a642c39345b3
|
1a055b6d9442213b2305f628cf25de6f1cc34d1a
|
refs/heads/master
| 2021-06-17T03:44:28.732000 | 2017-06-06T09:03:16 | 2017-06-06T09:03:16 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package uk.ac.ebi.subs.validator.repository;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import uk.ac.ebi.subs.data.component.Archive;
import uk.ac.ebi.subs.validator.data.ValidationResult;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = ValidationResultRepository.class)
@EnableAutoConfiguration
public class ValidationResultRepositoryTest {
@Autowired
ValidationResultRepository validationResultRepository;
private ValidationResult validationResult;
@Before
public void buildUp() {
Map<Archive, Boolean> expectedResults = new HashMap<>();
expectedResults.put(Archive.BioSamples, true);
expectedResults.put(Archive.ArrayExpress, false);
expectedResults.put(Archive.Ena, false);
validationResult = new ValidationResult();
validationResult.setUuid(UUID.randomUUID().toString());
validationResult.setExpectedResults(expectedResults);
validationResult.setVersion(1);
validationResult.setSubmissionId("123");
validationResult.setEntityUuid("44566");
// First
validationResultRepository.insert(validationResult);
validationResult.setUuid(UUID.randomUUID().toString());
validationResult.setSubmissionId("456");
validationResult.setEntityUuid("98876");
// Second
validationResultRepository.insert(validationResult);
}
@Test
public void persistValidationResultTest() {
ValidationResult retrievedResult = validationResultRepository.findOne(validationResult.getUuid());
System.out.println(retrievedResult);
assertThat(retrievedResult.getExpectedResults().get(Archive.BioSamples), is(true));
}
@Test
public void findBySubmissionIdAndEntityUuidTest() {
List<ValidationResult> validationResults = validationResultRepository.findBySubmissionIdAndEntityUuid("123", "44566");
System.out.println(validationResults);
Assert.assertEquals(1, validationResults.size());
}
@After
public void tearDown() {
validationResultRepository.deleteAll();
}
}
|
UTF-8
|
Java
| 2,642 |
java
|
ValidationResultRepositoryTest.java
|
Java
|
[] | null |
[] |
package uk.ac.ebi.subs.validator.repository;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import uk.ac.ebi.subs.data.component.Archive;
import uk.ac.ebi.subs.validator.data.ValidationResult;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = ValidationResultRepository.class)
@EnableAutoConfiguration
public class ValidationResultRepositoryTest {
@Autowired
ValidationResultRepository validationResultRepository;
private ValidationResult validationResult;
@Before
public void buildUp() {
Map<Archive, Boolean> expectedResults = new HashMap<>();
expectedResults.put(Archive.BioSamples, true);
expectedResults.put(Archive.ArrayExpress, false);
expectedResults.put(Archive.Ena, false);
validationResult = new ValidationResult();
validationResult.setUuid(UUID.randomUUID().toString());
validationResult.setExpectedResults(expectedResults);
validationResult.setVersion(1);
validationResult.setSubmissionId("123");
validationResult.setEntityUuid("44566");
// First
validationResultRepository.insert(validationResult);
validationResult.setUuid(UUID.randomUUID().toString());
validationResult.setSubmissionId("456");
validationResult.setEntityUuid("98876");
// Second
validationResultRepository.insert(validationResult);
}
@Test
public void persistValidationResultTest() {
ValidationResult retrievedResult = validationResultRepository.findOne(validationResult.getUuid());
System.out.println(retrievedResult);
assertThat(retrievedResult.getExpectedResults().get(Archive.BioSamples), is(true));
}
@Test
public void findBySubmissionIdAndEntityUuidTest() {
List<ValidationResult> validationResults = validationResultRepository.findBySubmissionIdAndEntityUuid("123", "44566");
System.out.println(validationResults);
Assert.assertEquals(1, validationResults.size());
}
@After
public void tearDown() {
validationResultRepository.deleteAll();
}
}
| 2,642 | 0.751325 | 0.740348 | 79 | 32.455696 | 27.580858 | 126 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.620253 | false | false |
7
|
0b124f92596ac5312cab91a2d7982caf47cd7d78
| 38,276,748,566,122 |
ce1d5e224e6ea871c5881203932e5cf8b90bca68
|
/projekat-iz/src/main/java/dto/FuzzyInputDto.java
|
2f41bbdf4ee210b11cc6ab66c3092059fb7347ec
|
[] |
no_license
|
Maja0505/iz_project
|
https://github.com/Maja0505/iz_project
|
8b60268748b31684705b175f7ab471ef8c09f499
|
ca7904093753b8f67a516481c2cd006dc1d3ec30
|
refs/heads/main
| 2023-06-09T09:26:58.634000 | 2021-06-24T21:26:44 | 2021-06-24T21:26:44 | 350,495,891 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package dto;
public class FuzzyInputDto {
private Integer access_vector;
private Integer access_complexity;
private Integer authentication;
private Integer confidentiality;
private Integer integrity;
private Integer availability;
public FuzzyInputDto() {
}
public Integer getAccess_vector() {
return access_vector;
}
public void setAccess_vector(Integer access_vector) {
this.access_vector = access_vector;
}
public Integer getAccess_complexity() {
return access_complexity;
}
public void setAccess_complexity(Integer access_complexity) {
this.access_complexity = access_complexity;
}
public Integer getAuthentication() {
return authentication;
}
public void setAuthentication(Integer authentication) {
this.authentication = authentication;
}
public Integer getConfidentiality() {
return confidentiality;
}
public void setConfidentiality(Integer confidentiality) {
this.confidentiality = confidentiality;
}
public Integer getIntegrity() {
return integrity;
}
public void setIntegrity(Integer integrity) {
this.integrity = integrity;
}
public Integer getAvailability() {
return availability;
}
public void setAvailability(Integer availability) {
this.availability = availability;
}
}
|
UTF-8
|
Java
| 1,422 |
java
|
FuzzyInputDto.java
|
Java
|
[] | null |
[] |
package dto;
public class FuzzyInputDto {
private Integer access_vector;
private Integer access_complexity;
private Integer authentication;
private Integer confidentiality;
private Integer integrity;
private Integer availability;
public FuzzyInputDto() {
}
public Integer getAccess_vector() {
return access_vector;
}
public void setAccess_vector(Integer access_vector) {
this.access_vector = access_vector;
}
public Integer getAccess_complexity() {
return access_complexity;
}
public void setAccess_complexity(Integer access_complexity) {
this.access_complexity = access_complexity;
}
public Integer getAuthentication() {
return authentication;
}
public void setAuthentication(Integer authentication) {
this.authentication = authentication;
}
public Integer getConfidentiality() {
return confidentiality;
}
public void setConfidentiality(Integer confidentiality) {
this.confidentiality = confidentiality;
}
public Integer getIntegrity() {
return integrity;
}
public void setIntegrity(Integer integrity) {
this.integrity = integrity;
}
public Integer getAvailability() {
return availability;
}
public void setAvailability(Integer availability) {
this.availability = availability;
}
}
| 1,422 | 0.674402 | 0.674402 | 62 | 21.935484 | 20.291323 | 65 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.306452 | false | false |
7
|
57cbabe9cfd6d6e44562f7ab97bb2a3e440b267f
| 13,185,549,662,935 |
7d76d30fe37b1de11bf0ecaac730c7256069c5a6
|
/osmosis-pgsimple/src/main/java/org/openstreetmap/osmosis/pgsimple/v0_6/impl/DatabaseCapabilityChecker.java
|
bca13904f1fecb22f0f80bb6eaeffbd1fc5df3b7
|
[] |
no_license
|
openstreetmap/osmosis
|
https://github.com/openstreetmap/osmosis
|
51c0f4993f8b4a16b06f9f13d680889a9702ac73
|
81b00273635eb89e20f0f251d9a3db4804bda657
|
refs/heads/main
| 2023-08-31T00:01:20.475000 | 2023-08-26T06:26:56 | 2023-08-26T06:26:56 | 2,564,522 | 522 | 203 | null | false | 2023-09-02T00:57:45 | 2011-10-12T18:48:02 | 2023-08-26T16:09:37 | 2023-09-02T00:57:44 | 13,900 | 600 | 197 | 36 |
Java
| false | false |
// This software is released into the Public Domain. See copying.txt for details.
package org.openstreetmap.osmosis.pgsimple.v0_6.impl;
import org.openstreetmap.osmosis.pgsimple.common.DatabaseContext;
/**
* Provides information about which features a database supports.
*
* @author Brett Henderson
*/
public class DatabaseCapabilityChecker {
private DatabaseContext dbCtx;
private boolean initialized;
private boolean isActionSupported;
private boolean isWayBboxSupported;
private boolean isWayLinestringSupported;
/**
* Creates a new instance.
*
* @param dbCtx The database context to use for accessing the database.
*/
public DatabaseCapabilityChecker(DatabaseContext dbCtx) {
this.dbCtx = dbCtx;
initialized = false;
}
private void initialize() {
if (!initialized) {
isActionSupported = dbCtx.doesTableExist("actions");
isWayBboxSupported = dbCtx.doesColumnExist("ways", "bbox");
isWayLinestringSupported = dbCtx.doesColumnExist("ways", "linestring");
initialized = true;
}
}
/**
* Indicates if action support is available.
*
* @return True if supported, otherwise false.
*/
public boolean isActionSupported() {
initialize();
return isActionSupported;
}
/**
* Indicates if way bounding box support is available.
*
* @return True if supported, otherwise false.
*/
public boolean isWayBboxSupported() {
initialize();
return isWayBboxSupported;
}
/**
* Indicates if way linestring support is available.
*
* @return True if supported, otherwise false.
*/
public boolean isWayLinestringSupported() {
initialize();
return isWayLinestringSupported;
}
}
|
UTF-8
|
Java
| 1,682 |
java
|
DatabaseCapabilityChecker.java
|
Java
|
[
{
"context": "which features a database supports.\n * \n * @author Brett Henderson\n */\npublic class DatabaseCapabilityChecker {\n\tpri",
"end": 306,
"score": 0.9980826377868652,
"start": 291,
"tag": "NAME",
"value": "Brett Henderson"
}
] | null |
[] |
// This software is released into the Public Domain. See copying.txt for details.
package org.openstreetmap.osmosis.pgsimple.v0_6.impl;
import org.openstreetmap.osmosis.pgsimple.common.DatabaseContext;
/**
* Provides information about which features a database supports.
*
* @author <NAME>
*/
public class DatabaseCapabilityChecker {
private DatabaseContext dbCtx;
private boolean initialized;
private boolean isActionSupported;
private boolean isWayBboxSupported;
private boolean isWayLinestringSupported;
/**
* Creates a new instance.
*
* @param dbCtx The database context to use for accessing the database.
*/
public DatabaseCapabilityChecker(DatabaseContext dbCtx) {
this.dbCtx = dbCtx;
initialized = false;
}
private void initialize() {
if (!initialized) {
isActionSupported = dbCtx.doesTableExist("actions");
isWayBboxSupported = dbCtx.doesColumnExist("ways", "bbox");
isWayLinestringSupported = dbCtx.doesColumnExist("ways", "linestring");
initialized = true;
}
}
/**
* Indicates if action support is available.
*
* @return True if supported, otherwise false.
*/
public boolean isActionSupported() {
initialize();
return isActionSupported;
}
/**
* Indicates if way bounding box support is available.
*
* @return True if supported, otherwise false.
*/
public boolean isWayBboxSupported() {
initialize();
return isWayBboxSupported;
}
/**
* Indicates if way linestring support is available.
*
* @return True if supported, otherwise false.
*/
public boolean isWayLinestringSupported() {
initialize();
return isWayLinestringSupported;
}
}
| 1,673 | 0.720571 | 0.719382 | 77 | 20.844156 | 22.795002 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.454545 | false | false |
7
|
5b381f5f81b5ed038aa842dd15ebdc30f5a9fd09
| 34,522,947,161,531 |
21f4a5980a892bea49198896b52bd3dda0a74003
|
/src/datastructures/linkedlists/oop/doubly/DNode.java
|
9cdba401537a3844c6fa2706b36471110e7317e8
|
[] |
no_license
|
AK-Vitae/Java-Practice
|
https://github.com/AK-Vitae/Java-Practice
|
7c54e705b31a7520204da1a827c36122bbf1ec66
|
d150b893cf0b22545e10ce379cd69880fddb6d07
|
refs/heads/master
| 2021-07-17T17:47:10.708000 | 2021-03-03T02:57:44 | 2021-03-03T02:57:44 | 244,048,885 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package datastructures.linkedlists.oop.doubly;
public class DNode<T> {
private T data;
private DNode<T> next;
public DNode(T data, DNode<T> next) {
this.data = data;
this.next = next;
}
public T getData() {
return this.data;
}
public DNode<T> getNext() {
return this.next;
}
public void setNext(DNode<T> next) {
this.next = next;
}
}
|
UTF-8
|
Java
| 419 |
java
|
DNode.java
|
Java
|
[] | null |
[] |
package datastructures.linkedlists.oop.doubly;
public class DNode<T> {
private T data;
private DNode<T> next;
public DNode(T data, DNode<T> next) {
this.data = data;
this.next = next;
}
public T getData() {
return this.data;
}
public DNode<T> getNext() {
return this.next;
}
public void setNext(DNode<T> next) {
this.next = next;
}
}
| 419 | 0.565632 | 0.565632 | 24 | 16.5 | 14.708274 | 46 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.375 | false | false |
7
|
f818bb49f8e33c510ed8d26517c9d43fc95009fb
| 5,609,227,346,610 |
57578acfae7b819290a28cf336d2968a879e05a9
|
/app/src/main/java/hr/ferit/posavec/stjepan/dogbreedbookapp/Adapters/UserAdapter.java
|
a6f9ff9f0ca0335d89f33da45ee69618a22dfca4
|
[] |
no_license
|
Stipan97/DogBreedBookApp
|
https://github.com/Stipan97/DogBreedBookApp
|
1bfb9dc30a40bc0d0c97ac4a1b6713c117f07cf7
|
352e3e6a46e9e2da92c1dbf4f2d443f67949ed4d
|
refs/heads/master
| 2020-09-21T00:47:53.082000 | 2019-11-28T10:56:40 | 2019-11-28T10:56:40 | 224,632,012 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package hr.ferit.posavec.stjepan.dogbreedbookapp.Adapters;
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.DataSource;
import com.bumptech.glide.load.engine.GlideException;
import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.target.Target;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import java.util.List;
import hr.ferit.posavec.stjepan.dogbreedbookapp.R;
import hr.ferit.posavec.stjepan.dogbreedbookapp.SearchProfileActivity;
import hr.ferit.posavec.stjepan.dogbreedbookapp.Utils.UserFollowCounterInfo;
import hr.ferit.posavec.stjepan.dogbreedbookapp.Utils.UserInfo;
public class UserAdapter extends RecyclerView.Adapter<UserAdapter.ViewHolder> {
private List<UserInfo> mUsers;
private Context mContext;
public UserAdapter(List<UserInfo> mUsers, Context mContext) {
this.mUsers = mUsers;
this.mContext = mContext;
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
View view = LayoutInflater.from(mContext).inflate(R.layout.user_search_items, viewGroup, false);
return new UserAdapter.ViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull final ViewHolder viewHolder, final int i) {
final String currentUser = FirebaseAuth.getInstance().getCurrentUser().getUid();
final UserInfo user = mUsers.get(i);
viewHolder.mFollow.setVisibility(View.VISIBLE);
viewHolder.mFullname.setText(user.getSearchName());
Glide.with(mContext).load(user.getImageURL()).listener(new RequestListener<Drawable>() {
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
viewHolder.pbImage.setVisibility(View.GONE);
return false;
}
@Override
public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
viewHolder.pbImage.setVisibility(View.GONE);
return false;
}
}).into(viewHolder.mProfileImg);
isFollowing(user.getUserID(), viewHolder.mFollow, viewHolder.mUnFollow);
if (user.getUserID().equals(currentUser)){
viewHolder.mFollow.setVisibility(View.GONE);
viewHolder.mUnFollow.setVisibility(View.GONE);
}
viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(mContext, SearchProfileActivity.class);
intent.putExtra("userId", mUsers.get(i).getUserID());
v.getContext().startActivity(intent);
}
});
viewHolder.mFollow.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (viewHolder.mFollow.getVisibility() == View.VISIBLE){
FirebaseDatabase.getInstance().getReference().child("Follow").child(currentUser).child("Following").child(user.getUserID()).setValue(true);
FirebaseDatabase.getInstance().getReference().child("Follow").child(user.getUserID()).child("Followers").child(currentUser).setValue(true);
String uploadID = FirebaseDatabase.getInstance().getReference("Notification").push().getKey();
FirebaseDatabase.getInstance().getReference("Notification").child(uploadID).child("fromUserID").setValue(currentUser);
FirebaseDatabase.getInstance().getReference("Notification").child(uploadID).child("toUserID").setValue(user.getUserID());
FirebaseDatabase.getInstance().getReference("Notification").child(uploadID).child("type").setValue("started following you!");
FirebaseDatabase.getInstance().getReference("Notification").child(uploadID).child("uploadKey").setValue(uploadID);
followingCounter(currentUser, true);
followersCounter(user.getUserID(), true);
}
}
});
viewHolder.mUnFollow.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (viewHolder.mUnFollow.getVisibility() == View.VISIBLE) {
FirebaseDatabase.getInstance().getReference().child("Follow").child(currentUser).child("Following").child(user.getUserID()).removeValue();
FirebaseDatabase.getInstance().getReference().child("Follow").child(user.getUserID()).child("Followers").child(currentUser).removeValue();
followingCounter(currentUser, false);
followersCounter(user.getUserID(), false);
}
}
});
}
private void followersCounter(String userID, final boolean followState) {
final DatabaseReference reference = FirebaseDatabase.getInstance().getReference("followCounter").child(userID);
reference.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
Integer followers = dataSnapshot.getValue(UserFollowCounterInfo.class).getFollowersCounter();
if (followState){
followers++;
}else {
followers--;
}
reference.child("followersCounter").setValue(followers);
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
private void followingCounter(final String currentUser, final boolean followState) {
final DatabaseReference reference = FirebaseDatabase.getInstance().getReference("followCounter").child(currentUser);
reference.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
Integer following = dataSnapshot.getValue(UserFollowCounterInfo.class).getFollowingCounter();
if (followState){
following++;
}else {
following--;
}
reference.child("followingCounter").setValue(following);
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
@Override
public int getItemCount() {
return mUsers.size();
}
public class ViewHolder extends RecyclerView.ViewHolder {
private TextView mFullname;
private ImageView mProfileImg;
private Button mFollow;
private Button mUnFollow;
private ProgressBar pbImage;
private ViewHolder(@NonNull View itemView) {
super(itemView);
mFullname = itemView.findViewById(R.id.tvSearchFullname);
mProfileImg = itemView.findViewById(R.id.ivSearchProfileImage);
mFollow = itemView.findViewById(R.id.btnFollow);
mUnFollow = itemView.findViewById(R.id.btnUnFollow);
pbImage = itemView.findViewById(R.id.pbSearchProfile);
}
}
private void isFollowing(final String userID, final Button follow, final Button unfollow){
final String currentUser = FirebaseAuth.getInstance().getCurrentUser().getUid();
DatabaseReference reference = FirebaseDatabase.getInstance().getReference().child("Follow").child(currentUser).child("Following");
reference.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
if (dataSnapshot.child(userID).exists()){
follow.setVisibility(View.GONE);
unfollow.setVisibility(View.VISIBLE);
}else {
follow.setVisibility(View.VISIBLE);
unfollow.setVisibility(View.GONE);
}
if (userID.equals(currentUser)){
follow.setVisibility(View.GONE);
unfollow.setVisibility(View.GONE);
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
}
|
UTF-8
|
Java
| 9,468 |
java
|
UserAdapter.java
|
Java
|
[] | null |
[] |
package hr.ferit.posavec.stjepan.dogbreedbookapp.Adapters;
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.DataSource;
import com.bumptech.glide.load.engine.GlideException;
import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.target.Target;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import java.util.List;
import hr.ferit.posavec.stjepan.dogbreedbookapp.R;
import hr.ferit.posavec.stjepan.dogbreedbookapp.SearchProfileActivity;
import hr.ferit.posavec.stjepan.dogbreedbookapp.Utils.UserFollowCounterInfo;
import hr.ferit.posavec.stjepan.dogbreedbookapp.Utils.UserInfo;
public class UserAdapter extends RecyclerView.Adapter<UserAdapter.ViewHolder> {
private List<UserInfo> mUsers;
private Context mContext;
public UserAdapter(List<UserInfo> mUsers, Context mContext) {
this.mUsers = mUsers;
this.mContext = mContext;
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
View view = LayoutInflater.from(mContext).inflate(R.layout.user_search_items, viewGroup, false);
return new UserAdapter.ViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull final ViewHolder viewHolder, final int i) {
final String currentUser = FirebaseAuth.getInstance().getCurrentUser().getUid();
final UserInfo user = mUsers.get(i);
viewHolder.mFollow.setVisibility(View.VISIBLE);
viewHolder.mFullname.setText(user.getSearchName());
Glide.with(mContext).load(user.getImageURL()).listener(new RequestListener<Drawable>() {
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
viewHolder.pbImage.setVisibility(View.GONE);
return false;
}
@Override
public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
viewHolder.pbImage.setVisibility(View.GONE);
return false;
}
}).into(viewHolder.mProfileImg);
isFollowing(user.getUserID(), viewHolder.mFollow, viewHolder.mUnFollow);
if (user.getUserID().equals(currentUser)){
viewHolder.mFollow.setVisibility(View.GONE);
viewHolder.mUnFollow.setVisibility(View.GONE);
}
viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(mContext, SearchProfileActivity.class);
intent.putExtra("userId", mUsers.get(i).getUserID());
v.getContext().startActivity(intent);
}
});
viewHolder.mFollow.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (viewHolder.mFollow.getVisibility() == View.VISIBLE){
FirebaseDatabase.getInstance().getReference().child("Follow").child(currentUser).child("Following").child(user.getUserID()).setValue(true);
FirebaseDatabase.getInstance().getReference().child("Follow").child(user.getUserID()).child("Followers").child(currentUser).setValue(true);
String uploadID = FirebaseDatabase.getInstance().getReference("Notification").push().getKey();
FirebaseDatabase.getInstance().getReference("Notification").child(uploadID).child("fromUserID").setValue(currentUser);
FirebaseDatabase.getInstance().getReference("Notification").child(uploadID).child("toUserID").setValue(user.getUserID());
FirebaseDatabase.getInstance().getReference("Notification").child(uploadID).child("type").setValue("started following you!");
FirebaseDatabase.getInstance().getReference("Notification").child(uploadID).child("uploadKey").setValue(uploadID);
followingCounter(currentUser, true);
followersCounter(user.getUserID(), true);
}
}
});
viewHolder.mUnFollow.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (viewHolder.mUnFollow.getVisibility() == View.VISIBLE) {
FirebaseDatabase.getInstance().getReference().child("Follow").child(currentUser).child("Following").child(user.getUserID()).removeValue();
FirebaseDatabase.getInstance().getReference().child("Follow").child(user.getUserID()).child("Followers").child(currentUser).removeValue();
followingCounter(currentUser, false);
followersCounter(user.getUserID(), false);
}
}
});
}
private void followersCounter(String userID, final boolean followState) {
final DatabaseReference reference = FirebaseDatabase.getInstance().getReference("followCounter").child(userID);
reference.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
Integer followers = dataSnapshot.getValue(UserFollowCounterInfo.class).getFollowersCounter();
if (followState){
followers++;
}else {
followers--;
}
reference.child("followersCounter").setValue(followers);
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
private void followingCounter(final String currentUser, final boolean followState) {
final DatabaseReference reference = FirebaseDatabase.getInstance().getReference("followCounter").child(currentUser);
reference.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
Integer following = dataSnapshot.getValue(UserFollowCounterInfo.class).getFollowingCounter();
if (followState){
following++;
}else {
following--;
}
reference.child("followingCounter").setValue(following);
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
@Override
public int getItemCount() {
return mUsers.size();
}
public class ViewHolder extends RecyclerView.ViewHolder {
private TextView mFullname;
private ImageView mProfileImg;
private Button mFollow;
private Button mUnFollow;
private ProgressBar pbImage;
private ViewHolder(@NonNull View itemView) {
super(itemView);
mFullname = itemView.findViewById(R.id.tvSearchFullname);
mProfileImg = itemView.findViewById(R.id.ivSearchProfileImage);
mFollow = itemView.findViewById(R.id.btnFollow);
mUnFollow = itemView.findViewById(R.id.btnUnFollow);
pbImage = itemView.findViewById(R.id.pbSearchProfile);
}
}
private void isFollowing(final String userID, final Button follow, final Button unfollow){
final String currentUser = FirebaseAuth.getInstance().getCurrentUser().getUid();
DatabaseReference reference = FirebaseDatabase.getInstance().getReference().child("Follow").child(currentUser).child("Following");
reference.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
if (dataSnapshot.child(userID).exists()){
follow.setVisibility(View.GONE);
unfollow.setVisibility(View.VISIBLE);
}else {
follow.setVisibility(View.VISIBLE);
unfollow.setVisibility(View.GONE);
}
if (userID.equals(currentUser)){
follow.setVisibility(View.GONE);
unfollow.setVisibility(View.GONE);
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
}
| 9,468 | 0.64079 | 0.640684 | 215 | 42.037209 | 37.879227 | 159 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.576744 | false | false |
7
|
786227440dd87c3a64021045455a8d28caafc874
| 17,154,099,406,096 |
b7f08ecdde90ab2013c9d94376e2b845f69f13aa
|
/app/src/main/java/com/manusunny/securenotes/features/dropbox/DropboxFileListAdapter.java
|
a0a4164257e2ed7afef8c653e76f17fba17f338b
|
[] |
no_license
|
futuristic-labs/SecureNotesPaid
|
https://github.com/futuristic-labs/SecureNotesPaid
|
abeb061576e0e8498af0d322953a6062a72394bd
|
47007b632032feb513c77b8852ec75d8e8b7a9cb
|
refs/heads/master
| 2018-01-09T06:23:32.957000 | 2017-11-18T11:30:39 | 2017-11-18T11:30:39 | 48,498,888 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.manusunny.securenotes.features.dropbox;
import android.app.Activity;
import android.graphics.Color;
import android.graphics.drawable.GradientDrawable;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import com.dropbox.core.v2.files.Metadata;
import com.manusunny.securenotes.R;
import com.manusunny.securenotes.utils.CommonUtility;
import java.util.List;
public class DropboxFileListAdapter extends ArrayAdapter {
private final Activity context;
private final List<Metadata> files;
public DropboxFileListAdapter(Activity context,
List<Metadata> files) {
super(context, R.layout.file_picker, files);
this.context = context;
this.files = files;
}
@Override
public String getItem(int position) {
return files.get(position).getName();
}
@Override
public View getView(final int position, View view, ViewGroup parent) {
String file = files.get(position).getName();
view = context.getLayoutInflater().inflate(R.layout.file_picker_item, null);
GradientDrawable drawable = new GradientDrawable();
drawable.setColor(Color.WHITE);
drawable.setCornerRadius(0);
drawable.setStroke(1, Color.GRAY);
view.setBackgroundDrawable(drawable);
TextView textView = (TextView) view.findViewById(R.id.file_chooser_list_item);
textView.setText(CommonUtility.parseBackupFileName(file));
return view;
}
}
|
UTF-8
|
Java
| 1,561 |
java
|
DropboxFileListAdapter.java
|
Java
|
[] | null |
[] |
package com.manusunny.securenotes.features.dropbox;
import android.app.Activity;
import android.graphics.Color;
import android.graphics.drawable.GradientDrawable;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import com.dropbox.core.v2.files.Metadata;
import com.manusunny.securenotes.R;
import com.manusunny.securenotes.utils.CommonUtility;
import java.util.List;
public class DropboxFileListAdapter extends ArrayAdapter {
private final Activity context;
private final List<Metadata> files;
public DropboxFileListAdapter(Activity context,
List<Metadata> files) {
super(context, R.layout.file_picker, files);
this.context = context;
this.files = files;
}
@Override
public String getItem(int position) {
return files.get(position).getName();
}
@Override
public View getView(final int position, View view, ViewGroup parent) {
String file = files.get(position).getName();
view = context.getLayoutInflater().inflate(R.layout.file_picker_item, null);
GradientDrawable drawable = new GradientDrawable();
drawable.setColor(Color.WHITE);
drawable.setCornerRadius(0);
drawable.setStroke(1, Color.GRAY);
view.setBackgroundDrawable(drawable);
TextView textView = (TextView) view.findViewById(R.id.file_chooser_list_item);
textView.setText(CommonUtility.parseBackupFileName(file));
return view;
}
}
| 1,561 | 0.710442 | 0.70852 | 48 | 31.520834 | 23.73288 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.729167 | false | false |
7
|
aabbc86ff7891f5740d38ab2f2eb28749c6f7e0d
| 27,728,308,918,887 |
0e7f5c8b11c5872f0f43dd2cc9c1d28b1119679f
|
/flyerteaCafes/src/main/java/com/ideal/flyerteacafes/model/entity/MyThreadBean.java
|
81805102c51979d208d87b77ed72a0128881c8a6
|
[
"MIT"
] |
permissive
|
cody110/flyertea
|
https://github.com/cody110/flyertea
|
7a05918afb1420906180af0462913023cfddc2c0
|
83a9af2ce40d3aebc600a10f8ff3375352c04f3c
|
refs/heads/master
| 2021-01-25T13:11:58.566000 | 2018-03-02T06:59:07 | 2018-03-02T06:59:07 | 123,540,848 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.ideal.flyerteacafes.model.entity;
import android.text.TextUtils;
import com.ideal.flyerteacafes.utils.DataUtils;
import java.io.Serializable;
import java.util.List;
/**
* Created by fly on 2016/11/29.
* 我的帖子
*/
public class MyThreadBean implements Serializable{
/**
* 是否是正常帖
*
* @return 是否专业模式(0 否 1 是)
*/
public boolean isNormal() {
return DataUtils.isNormal(professional);
}
private String pid;
private String tid;
private String fid;
private String authorid;
private String author;
private String subject;
private String dbdateline;
private String professional;
private String type;
private String favtimes;
private String flowers;
private String forumname;
private String replies;
private String displayorder;
private String digest;
private String pushedaid;
private String heatlevel;
private List<Attachments> attachments;
public String getDigest() {
return digest;
}
public String getPushedaid() {
return pushedaid;
}
public String getHeatlevel() {
return heatlevel;
}
public String getDisplayorder() {
return displayorder;
}
public String getPid() {
return pid;
}
public void setPid(String pid) {
this.pid = pid;
}
public String getTid() {
return tid;
}
public void setTid(String tid) {
this.tid = tid;
}
public String getFid() {
return fid;
}
public void setFid(String fid) {
this.fid = fid;
}
public String getAuthorid() {
return authorid;
}
public void setAuthorid(String authorid) {
this.authorid = authorid;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public String getSubject() {
return subject;
}
public void setSubject(String subject) {
this.subject = subject;
}
public String getDbdateline() {
return dbdateline;
}
public void setDbdateline(String dbdateline) {
this.dbdateline = dbdateline;
}
public String getProfessional() {
return professional;
}
public void setProfessional(String professional) {
this.professional = professional;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getFavtimes() {
return favtimes;
}
public void setFavtimes(String favtimes) {
this.favtimes = favtimes;
}
public String getFlowers() {
return flowers;
}
public void setFlowers(String flowers) {
this.flowers = flowers;
}
public String getForumname() {
return forumname;
}
public void setForumname(String forumname) {
this.forumname = forumname;
}
public List<Attachments> getAttachments() {
return attachments;
}
public void setAttachments(List<Attachments> attachments) {
this.attachments = attachments;
}
public String getReplies() {
return replies;
}
public void setReplies(String replies) {
this.replies = replies;
}
}
|
UTF-8
|
Java
| 3,372 |
java
|
MyThreadBean.java
|
Java
|
[
{
"context": "lizable;\nimport java.util.List;\n\n/**\n * Created by fly on 2016/11/29.\n * 我的帖子\n */\n\npublic class MyThread",
"end": 202,
"score": 0.37033089995384216,
"start": 199,
"tag": "USERNAME",
"value": "fly"
}
] | null |
[] |
package com.ideal.flyerteacafes.model.entity;
import android.text.TextUtils;
import com.ideal.flyerteacafes.utils.DataUtils;
import java.io.Serializable;
import java.util.List;
/**
* Created by fly on 2016/11/29.
* 我的帖子
*/
public class MyThreadBean implements Serializable{
/**
* 是否是正常帖
*
* @return 是否专业模式(0 否 1 是)
*/
public boolean isNormal() {
return DataUtils.isNormal(professional);
}
private String pid;
private String tid;
private String fid;
private String authorid;
private String author;
private String subject;
private String dbdateline;
private String professional;
private String type;
private String favtimes;
private String flowers;
private String forumname;
private String replies;
private String displayorder;
private String digest;
private String pushedaid;
private String heatlevel;
private List<Attachments> attachments;
public String getDigest() {
return digest;
}
public String getPushedaid() {
return pushedaid;
}
public String getHeatlevel() {
return heatlevel;
}
public String getDisplayorder() {
return displayorder;
}
public String getPid() {
return pid;
}
public void setPid(String pid) {
this.pid = pid;
}
public String getTid() {
return tid;
}
public void setTid(String tid) {
this.tid = tid;
}
public String getFid() {
return fid;
}
public void setFid(String fid) {
this.fid = fid;
}
public String getAuthorid() {
return authorid;
}
public void setAuthorid(String authorid) {
this.authorid = authorid;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public String getSubject() {
return subject;
}
public void setSubject(String subject) {
this.subject = subject;
}
public String getDbdateline() {
return dbdateline;
}
public void setDbdateline(String dbdateline) {
this.dbdateline = dbdateline;
}
public String getProfessional() {
return professional;
}
public void setProfessional(String professional) {
this.professional = professional;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getFavtimes() {
return favtimes;
}
public void setFavtimes(String favtimes) {
this.favtimes = favtimes;
}
public String getFlowers() {
return flowers;
}
public void setFlowers(String flowers) {
this.flowers = flowers;
}
public String getForumname() {
return forumname;
}
public void setForumname(String forumname) {
this.forumname = forumname;
}
public List<Attachments> getAttachments() {
return attachments;
}
public void setAttachments(List<Attachments> attachments) {
this.attachments = attachments;
}
public String getReplies() {
return replies;
}
public void setReplies(String replies) {
this.replies = replies;
}
}
| 3,372 | 0.615846 | 0.612845 | 173 | 18.254335 | 16.114262 | 63 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.323699 | false | false |
7
|
2401e01f214509f13a4450f0c0f3e5195ea52df1
| 35,072,702,975,004 |
4ea0aa3627ef0ceb9a9285a285e76b0e6793f16c
|
/src/cn/xm/libandroid/service/NotificationService.java
|
a98081aff24e36e9aff56547c841eac780d12ed7
|
[] |
no_license
|
yesunsong/LibAndroid
|
https://github.com/yesunsong/LibAndroid
|
b18252322d9593e5b4a5d6dccc536c8d54ae68d5
|
7537d1af9b40ddd960e21fb6a4c851f05e28dc15
|
refs/heads/master
| 2020-06-21T05:54:48.323000 | 2016-12-01T12:49:15 | 2016-12-01T12:49:15 | 74,801,248 | 0 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package cn.xm.libandroid.service;
import android.app.Notification;
import android.app.NotificationManager;
import android.content.Context;
import cn.xm.libandroid.service.base.Service;
public class NotificationService extends Service {
private static NotificationService instance;
private NotificationManager notificationManager;
private NotificationService(Context context){
notificationManager=(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
}
public static NotificationService getInstance(){
if (instance==null) {
instance=new NotificationService(context);
}
return instance;
}
// <<===============================>>
/**
* 发出状态栏通知
* @param id Notification实例的唯一标识id
* @param notification Notification实例
*/
public void notify(int id, Notification notification){
notificationManager.notify(id, notification);
}
/**
* 清除
* @param id Notification实例的唯一标识id
*/
public void cancel(int id){
notificationManager.cancel(id);
}
public void cancelAll(){
notificationManager.cancelAll();
}
}
|
UTF-8
|
Java
| 1,132 |
java
|
NotificationService.java
|
Java
|
[] | null |
[] |
package cn.xm.libandroid.service;
import android.app.Notification;
import android.app.NotificationManager;
import android.content.Context;
import cn.xm.libandroid.service.base.Service;
public class NotificationService extends Service {
private static NotificationService instance;
private NotificationManager notificationManager;
private NotificationService(Context context){
notificationManager=(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
}
public static NotificationService getInstance(){
if (instance==null) {
instance=new NotificationService(context);
}
return instance;
}
// <<===============================>>
/**
* 发出状态栏通知
* @param id Notification实例的唯一标识id
* @param notification Notification实例
*/
public void notify(int id, Notification notification){
notificationManager.notify(id, notification);
}
/**
* 清除
* @param id Notification实例的唯一标识id
*/
public void cancel(int id){
notificationManager.cancel(id);
}
public void cancelAll(){
notificationManager.cancelAll();
}
}
| 1,132 | 0.733826 | 0.733826 | 43 | 24.16279 | 21.976658 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.348837 | false | false |
7
|
162392711ff96cf5ff7e71b2120b6f37f94281ef
| 24,653,112,346,270 |
7382e2a726cdab991507472803167c54afba356a
|
/app/src/main/java/com/example/azatk/sdccommunity/SDCChat.java
|
55ce467db7fae665d5c72ae1f6d6617ddc97bd31
|
[] |
no_license
|
azat99/SDC-Community
|
https://github.com/azat99/SDC-Community
|
bd2fa8c65295202944b3a4141fcc2888f0a76f81
|
46fe2d3eb0a28f5d6e24dc0c43834df2f4d09918
|
refs/heads/master
| 2021-09-11T22:01:50.094000 | 2018-04-12T18:48:53 | 2018-04-12T18:48:53 | 110,067,820 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.azatk.sdccommunity;
import android.app.Application;
import android.content.Intent;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ServerValue;
import com.google.firebase.database.ValueEventListener;
import com.squareup.picasso.OkHttpDownloader;
import com.squareup.picasso.Picasso;
import com.vk.sdk.VKAccessToken;
import com.vk.sdk.VKAccessTokenTracker;
import com.vk.sdk.VKSdk;
/**
* Created by azatk on 09.10.2017.
*/
public class SDCChat extends Application{
private DatabaseReference mUserDatabase;
private FirebaseAuth mAuth;
VKAccessTokenTracker vkAccessTokenTracker = new VKAccessTokenTracker() {
@Override
public void onVKAccessTokenChanged(VKAccessToken oldToken, VKAccessToken newToken) {
if (newToken == null) {
Intent intent = new Intent(SDCChat.this,MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
}
}
};
@Override
public void onCreate() {
super.onCreate();
vkAccessTokenTracker.startTracking();
VKSdk.initialize(this);
FirebaseDatabase.getInstance().setPersistenceEnabled(true);
Picasso.Builder builder = new Picasso.Builder(this);
builder.downloader(new OkHttpDownloader(this,Integer.MAX_VALUE));
Picasso built = builder.build();
built.setIndicatorsEnabled(true);
built.setLoggingEnabled(true);
Picasso.setSingletonInstance(built);
mAuth = FirebaseAuth.getInstance();
if(mAuth.getCurrentUser() != null) {
mUserDatabase = FirebaseDatabase.getInstance().getReference().child("users").child(mAuth.getCurrentUser().getUid());
mUserDatabase.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
if (dataSnapshot != null) {
mUserDatabase.child("online").onDisconnect().setValue(ServerValue.TIMESTAMP);
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
}
}
}
|
UTF-8
|
Java
| 2,544 |
java
|
SDCChat.java
|
Java
|
[
{
"context": "acker;\nimport com.vk.sdk.VKSdk;\n\n/**\n * Created by azatk on 09.10.2017.\n */\n\npublic class SDCChat extends ",
"end": 671,
"score": 0.999569296836853,
"start": 666,
"tag": "USERNAME",
"value": "azatk"
}
] | null |
[] |
package com.example.azatk.sdccommunity;
import android.app.Application;
import android.content.Intent;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ServerValue;
import com.google.firebase.database.ValueEventListener;
import com.squareup.picasso.OkHttpDownloader;
import com.squareup.picasso.Picasso;
import com.vk.sdk.VKAccessToken;
import com.vk.sdk.VKAccessTokenTracker;
import com.vk.sdk.VKSdk;
/**
* Created by azatk on 09.10.2017.
*/
public class SDCChat extends Application{
private DatabaseReference mUserDatabase;
private FirebaseAuth mAuth;
VKAccessTokenTracker vkAccessTokenTracker = new VKAccessTokenTracker() {
@Override
public void onVKAccessTokenChanged(VKAccessToken oldToken, VKAccessToken newToken) {
if (newToken == null) {
Intent intent = new Intent(SDCChat.this,MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
}
}
};
@Override
public void onCreate() {
super.onCreate();
vkAccessTokenTracker.startTracking();
VKSdk.initialize(this);
FirebaseDatabase.getInstance().setPersistenceEnabled(true);
Picasso.Builder builder = new Picasso.Builder(this);
builder.downloader(new OkHttpDownloader(this,Integer.MAX_VALUE));
Picasso built = builder.build();
built.setIndicatorsEnabled(true);
built.setLoggingEnabled(true);
Picasso.setSingletonInstance(built);
mAuth = FirebaseAuth.getInstance();
if(mAuth.getCurrentUser() != null) {
mUserDatabase = FirebaseDatabase.getInstance().getReference().child("users").child(mAuth.getCurrentUser().getUid());
mUserDatabase.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
if (dataSnapshot != null) {
mUserDatabase.child("online").onDisconnect().setValue(ServerValue.TIMESTAMP);
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
}
}
}
| 2,544 | 0.670204 | 0.66706 | 86 | 28.581396 | 28.602921 | 128 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.453488 | false | false |
7
|
f6e152c07371b5b1f6591573ee70d9cef3693900
| 36,077,725,310,688 |
e9162ab7adab3cd862bbaaa5f4c03449122b8746
|
/myproject/src/main/java/model/userboard/UserBoardVO.java
|
7d3787738ec707aa8a04960a1c324e243748ee69
|
[] |
no_license
|
sngynhy/myproject
|
https://github.com/sngynhy/myproject
|
a9836a829e9d4641358e2fe7cf80b6da5d49fb95
|
b04143bfc70a4a4c27acf29afd5e638f8663b396
|
refs/heads/main
| 2023-08-30T01:14:30.931000 | 2021-11-02T12:32:17 | 2021-11-02T12:32:17 | 421,739,547 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package model.userboard;
public class UserBoardVO {
private int b_id; // 1001부터 자동 +1
private String id; // 회원 id
private String title; // 게시글 제목
private String content; // 게시글 내용
private int r_cnt; // 댓글 수
private int like_cnt; // 찜 수
private String b_date; // 작성 날짜
private String u_date; // 수정 날짜
private String b_type; // 게시판 분류 - 정보[info] or 질문[ask] or 후기[review]
private String a_id; // 지역 - 유럽, 아시아, 미국 ..
private String n_id; // 나라 - 프랑스, 영국, ...
private String cate_id; // 카테고리 - 게시판에 따라 달라짐
private String condition; // 검색 옵션
private String keyword; // 검색 키워드
public int getB_id() {
return b_id;
}
public void setB_id(int b_id) {
this.b_id = b_id;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public int getR_cnt() {
return r_cnt;
}
public void setR_cnt(int r_cnt) {
this.r_cnt = r_cnt;
}
public int getLike_cnt() {
return like_cnt;
}
public void setLike_cnt(int like_cnt) {
this.like_cnt = like_cnt;
}
public String getB_date() {
return b_date;
}
public void setB_date(String b_date) {
this.b_date = b_date;
}
public String getU_date() {
return u_date;
}
public void setU_date(String u_date) {
this.u_date = u_date;
}
public String getB_type() {
return b_type;
}
public void setB_type(String b_type) {
this.b_type = b_type;
}
public String getA_id() {
return a_id;
}
public void setA_id(String a_id) {
this.a_id = a_id;
}
public String getN_id() {
return n_id;
}
public void setN_id(String n_id) {
this.n_id = n_id;
}
public String getCate_id() {
return cate_id;
}
public void setCate_id(String cate_id) {
this.cate_id = cate_id;
}
public String getCondition() {
return condition;
}
public void setCondition(String condition) {
this.condition = condition;
}
public String getKeyword() {
return keyword;
}
public void setKeyword(String keyword) {
this.keyword = keyword;
}
@Override
public String toString() {
return "UserBoardVO [b_id=" + b_id + ", id=" + id + ", title=" + title + ", content=" + content + ", r_cnt="
+ r_cnt + ", like_cnt=" + like_cnt + ", b_date=" + b_date + ", u_date=" + u_date + ", b_type=" + b_type
+ ", a_id=" + a_id + ", n_id=" + n_id + ", cate_id=" + cate_id + ", condition=" + condition
+ ", keyword=" + keyword + "]";
}
}
|
UHC
|
Java
| 2,724 |
java
|
UserBoardVO.java
|
Java
|
[] | null |
[] |
package model.userboard;
public class UserBoardVO {
private int b_id; // 1001부터 자동 +1
private String id; // 회원 id
private String title; // 게시글 제목
private String content; // 게시글 내용
private int r_cnt; // 댓글 수
private int like_cnt; // 찜 수
private String b_date; // 작성 날짜
private String u_date; // 수정 날짜
private String b_type; // 게시판 분류 - 정보[info] or 질문[ask] or 후기[review]
private String a_id; // 지역 - 유럽, 아시아, 미국 ..
private String n_id; // 나라 - 프랑스, 영국, ...
private String cate_id; // 카테고리 - 게시판에 따라 달라짐
private String condition; // 검색 옵션
private String keyword; // 검색 키워드
public int getB_id() {
return b_id;
}
public void setB_id(int b_id) {
this.b_id = b_id;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public int getR_cnt() {
return r_cnt;
}
public void setR_cnt(int r_cnt) {
this.r_cnt = r_cnt;
}
public int getLike_cnt() {
return like_cnt;
}
public void setLike_cnt(int like_cnt) {
this.like_cnt = like_cnt;
}
public String getB_date() {
return b_date;
}
public void setB_date(String b_date) {
this.b_date = b_date;
}
public String getU_date() {
return u_date;
}
public void setU_date(String u_date) {
this.u_date = u_date;
}
public String getB_type() {
return b_type;
}
public void setB_type(String b_type) {
this.b_type = b_type;
}
public String getA_id() {
return a_id;
}
public void setA_id(String a_id) {
this.a_id = a_id;
}
public String getN_id() {
return n_id;
}
public void setN_id(String n_id) {
this.n_id = n_id;
}
public String getCate_id() {
return cate_id;
}
public void setCate_id(String cate_id) {
this.cate_id = cate_id;
}
public String getCondition() {
return condition;
}
public void setCondition(String condition) {
this.condition = condition;
}
public String getKeyword() {
return keyword;
}
public void setKeyword(String keyword) {
this.keyword = keyword;
}
@Override
public String toString() {
return "UserBoardVO [b_id=" + b_id + ", id=" + id + ", title=" + title + ", content=" + content + ", r_cnt="
+ r_cnt + ", like_cnt=" + like_cnt + ", b_date=" + b_date + ", u_date=" + u_date + ", b_type=" + b_type
+ ", a_id=" + a_id + ", n_id=" + n_id + ", cate_id=" + cate_id + ", condition=" + condition
+ ", keyword=" + keyword + "]";
}
}
| 2,724 | 0.623053 | 0.621106 | 112 | 21.928572 | 19.838957 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.848214 | false | false |
7
|
eba340d402009557b5bcbfc648bd696379548ec2
| 12,086,038,031,955 |
c39a875b7d462e203f8783d31e1c17d4a9a53318
|
/jixi_manager/jixi_manager_web/src/main/java/com/jixi/controller/UserController.java
|
0fbcaefaaf19db64ab41c41e7d7c273beca13a73
|
[] |
no_license
|
zouhaiming2017/zouhaiming2017-52jcjc.admin
|
https://github.com/zouhaiming2017/zouhaiming2017-52jcjc.admin
|
d87c05b64147d2cae78be36054c851acfa4a1071
|
c874fd89d799f75ac3624882ed1f9c698c7a0a1c
|
refs/heads/master
| 2021-05-04T15:58:36.175000 | 2017-12-11T01:45:33 | 2017-12-11T01:46:14 | 120,241,595 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.jixi.controller;
import com.jixi.pojo.User;
import com.jixi.service.IRoleService;
import com.jixi.service.IUserService;
import com.jixi.utils.RandomValidateCode;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.crypto.hash.Md5Hash;
import org.apache.shiro.session.Session;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.List;
import static org.apache.shiro.web.filter.mgt.DefaultFilter.user;
/**
* Created by zhm on 2017/9/21.
*/
@Controller
@RequestMapping("/user")
public class UserController {
@Autowired
private IUserService userService;
@Autowired
private IRoleService roleService;
/**
* md5密码加密
* @param str
* @param salt
* @return
*/
public static String md5(String str,String salt){
return new Md5Hash(str,salt).toString() ;
}
/**
* 登录页面生成验证码
*/
@RequestMapping(value = "/getVerify")
public void getVerify(HttpServletRequest request, HttpServletResponse response){
response.setContentType("image/jpeg");//设置相应类型,告诉浏览器输出的内容为图片
response.setHeader("Pragma", "No-cache");//设置响应头信息,告诉浏览器不要缓存此内容
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expire", 0);
RandomValidateCode randomValidateCode = new RandomValidateCode();
try {
randomValidateCode.getRandcode(request, response);//输出验证码图片方法
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 验证登录
* @param model
* @param userName
* @param password
* @param inputStr
* @param session
* @return
*/
@RequestMapping(value = "/login", method = RequestMethod.POST)
public String login(Model model, String userName, String password,String inputStr, HttpSession session) {
//从session中获取随机数
String random = (String) session.getAttribute("RANDOMVALIDATECODEKEY");
User user=userService.selectByUserName(userName);
Subject subject = SecurityUtils.getSubject() ;
UsernamePasswordToken token = new UsernamePasswordToken(userName,md5(password,"52jc"));
try {
if(random.equals(inputStr)){
subject.login(token);
model.addAttribute("user", user);
return "user/login" ;
}else {
model.addAttribute("error","验证码错误");
return "redirect:/";
}
} catch (AuthenticationException e) {
e.printStackTrace();
model.addAttribute("error","用户名或密码错误");
return "redirect:/";
}
}
/**
* 用户列表
*/
@RequestMapping(value = "/list",method = RequestMethod.GET)
public String getUserList(Model model){
List<User> users=userService.getUserList();
//补全roleName
for(User user:users){
if(user==null||user.getRoleid()==null){
continue;
}
user.setRolename(roleService.selectOne(user.getRoleid()).getRolename());
userService.updateUser(user);
}
model.addAttribute("users",users);
return "user/list";
}
/**
* 跳转到新增页面
*/
@RequestMapping(value = "/add",method = RequestMethod.GET)
public String addUser(Model model){
model.addAttribute("roles",roleService.getRoleList());
return "user/add";
}
/**
* 新增用户
*/
@RequestMapping(value = "/add",method = RequestMethod.POST)
public String addUser(User user){
user.setPassword(md5(user.getPassword(),"52jc"));
userService.addUser(user);
return "redirect:/user/list";
}
/**
* 跳转到修改页面
*/
@RequestMapping(value = "/update",method = RequestMethod.GET)
public String updateUser(Model model,int id){
model.addAttribute("roles",roleService.getRoleList());
model.addAttribute("user",userService.selectOne(id));
return "user/update";
}
/**
* 修改用户
*/
@RequestMapping(value = "/update",method = RequestMethod.POST)
public String updateUser(User user){
userService.updateUser(user);
return "redirect:/user/list";
}
/**
* 跳转到修改密码页面
*/
@RequestMapping(value = "/updatePassword",method = RequestMethod.GET)
public String updatePassword(Model model,int id){
model.addAttribute("user",userService.selectOne(id));
return "user/updatePassword";
}
/**
* 修改密码
*/
@RequestMapping(value = "/updatePassword",method = RequestMethod.POST)
public String updatePassword(Model model,String oldpassword,String newpassword,int id){
User user=userService.selectOne(id);
if(!md5(oldpassword,"52jc").equals(user.getPassword())){
model.addAttribute("user",userService.selectOne(id));
model.addAttribute("err","密码错误!");
return "user/updatePassword";
}else {
user.setPassword(md5(newpassword,"52jc"));
userService.updateUser(user);
return "redirect:/";
}
}
/**
* 删除单个用户
*/
@RequestMapping(value = "/deleteOne")
public String deleteOne(int id){
userService.deleteOne(id);
return "redirect:/user/list";
}
/**
* 批量删除用户
*/
@RequestMapping(value = "/delete")
public String deleteUser(String ids){
String[] id = ids.split(",");
userService.deleteUsers(id);
return "redirect:/user/list";
}
}
|
UTF-8
|
Java
| 6,313 |
java
|
UserController.java
|
Java
|
[
{
"context": ".filter.mgt.DefaultFilter.user;\n\n/**\n * Created by zhm on 2017/9/21.\n */\n@Controller\n@RequestMapping(\"/u",
"end": 970,
"score": 0.9977639317512512,
"start": 967,
"tag": "USERNAME",
"value": "zhm"
},
{
"context": " /**\n * 验证登录\n * @param model\n * @param userName\n * @param password\n * @param inputStr\n ",
"end": 2067,
"score": 0.9823411703109741,
"start": 2059,
"tag": "USERNAME",
"value": "userName"
},
{
"context": "mePasswordToken token = new UsernamePasswordToken(userName,md5(password,\"52jc\"));\n try {\n ",
"end": 2627,
"score": 0.9713494181632996,
"start": 2619,
"tag": "USERNAME",
"value": "userName"
},
{
"context": " new UsernamePasswordToken(userName,md5(password,\"52jc\"));\n try {\n if(random.equals(in",
"end": 2646,
"score": 0.999360978603363,
"start": 2642,
"tag": "PASSWORD",
"value": "52jc"
},
{
"context": "\n user.setPassword(md5(user.getPassword(),\"52jc\"));\n userService.addUser(user);\n re",
"end": 4100,
"score": 0.9992319941520691,
"start": 4096,
"tag": "PASSWORD",
"value": "52jc"
},
{
"context": "rvice.selectOne(id);\n if(!md5(oldpassword,\"52jc\").equals(user.getPassword())){\n model.",
"end": 5254,
"score": 0.9974770545959473,
"start": 5250,
"tag": "PASSWORD",
"value": "52jc"
},
{
"context": "e {\n user.setPassword(md5(newpassword,\"52jc\"));\n userService.updateUser(user);\n ",
"end": 5507,
"score": 0.9988784193992615,
"start": 5503,
"tag": "PASSWORD",
"value": "52jc"
}
] | null |
[] |
package com.jixi.controller;
import com.jixi.pojo.User;
import com.jixi.service.IRoleService;
import com.jixi.service.IUserService;
import com.jixi.utils.RandomValidateCode;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.crypto.hash.Md5Hash;
import org.apache.shiro.session.Session;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.List;
import static org.apache.shiro.web.filter.mgt.DefaultFilter.user;
/**
* Created by zhm on 2017/9/21.
*/
@Controller
@RequestMapping("/user")
public class UserController {
@Autowired
private IUserService userService;
@Autowired
private IRoleService roleService;
/**
* md5密码加密
* @param str
* @param salt
* @return
*/
public static String md5(String str,String salt){
return new Md5Hash(str,salt).toString() ;
}
/**
* 登录页面生成验证码
*/
@RequestMapping(value = "/getVerify")
public void getVerify(HttpServletRequest request, HttpServletResponse response){
response.setContentType("image/jpeg");//设置相应类型,告诉浏览器输出的内容为图片
response.setHeader("Pragma", "No-cache");//设置响应头信息,告诉浏览器不要缓存此内容
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expire", 0);
RandomValidateCode randomValidateCode = new RandomValidateCode();
try {
randomValidateCode.getRandcode(request, response);//输出验证码图片方法
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 验证登录
* @param model
* @param userName
* @param password
* @param inputStr
* @param session
* @return
*/
@RequestMapping(value = "/login", method = RequestMethod.POST)
public String login(Model model, String userName, String password,String inputStr, HttpSession session) {
//从session中获取随机数
String random = (String) session.getAttribute("RANDOMVALIDATECODEKEY");
User user=userService.selectByUserName(userName);
Subject subject = SecurityUtils.getSubject() ;
UsernamePasswordToken token = new UsernamePasswordToken(userName,md5(password,"<PASSWORD>"));
try {
if(random.equals(inputStr)){
subject.login(token);
model.addAttribute("user", user);
return "user/login" ;
}else {
model.addAttribute("error","验证码错误");
return "redirect:/";
}
} catch (AuthenticationException e) {
e.printStackTrace();
model.addAttribute("error","用户名或密码错误");
return "redirect:/";
}
}
/**
* 用户列表
*/
@RequestMapping(value = "/list",method = RequestMethod.GET)
public String getUserList(Model model){
List<User> users=userService.getUserList();
//补全roleName
for(User user:users){
if(user==null||user.getRoleid()==null){
continue;
}
user.setRolename(roleService.selectOne(user.getRoleid()).getRolename());
userService.updateUser(user);
}
model.addAttribute("users",users);
return "user/list";
}
/**
* 跳转到新增页面
*/
@RequestMapping(value = "/add",method = RequestMethod.GET)
public String addUser(Model model){
model.addAttribute("roles",roleService.getRoleList());
return "user/add";
}
/**
* 新增用户
*/
@RequestMapping(value = "/add",method = RequestMethod.POST)
public String addUser(User user){
user.setPassword(md5(user.getPassword(),"<PASSWORD>"));
userService.addUser(user);
return "redirect:/user/list";
}
/**
* 跳转到修改页面
*/
@RequestMapping(value = "/update",method = RequestMethod.GET)
public String updateUser(Model model,int id){
model.addAttribute("roles",roleService.getRoleList());
model.addAttribute("user",userService.selectOne(id));
return "user/update";
}
/**
* 修改用户
*/
@RequestMapping(value = "/update",method = RequestMethod.POST)
public String updateUser(User user){
userService.updateUser(user);
return "redirect:/user/list";
}
/**
* 跳转到修改密码页面
*/
@RequestMapping(value = "/updatePassword",method = RequestMethod.GET)
public String updatePassword(Model model,int id){
model.addAttribute("user",userService.selectOne(id));
return "user/updatePassword";
}
/**
* 修改密码
*/
@RequestMapping(value = "/updatePassword",method = RequestMethod.POST)
public String updatePassword(Model model,String oldpassword,String newpassword,int id){
User user=userService.selectOne(id);
if(!md5(oldpassword,"<PASSWORD>").equals(user.getPassword())){
model.addAttribute("user",userService.selectOne(id));
model.addAttribute("err","密码错误!");
return "user/updatePassword";
}else {
user.setPassword(md5(newpassword,"<PASSWORD>"));
userService.updateUser(user);
return "redirect:/";
}
}
/**
* 删除单个用户
*/
@RequestMapping(value = "/deleteOne")
public String deleteOne(int id){
userService.deleteOne(id);
return "redirect:/user/list";
}
/**
* 批量删除用户
*/
@RequestMapping(value = "/delete")
public String deleteUser(String ids){
String[] id = ids.split(",");
userService.deleteUsers(id);
return "redirect:/user/list";
}
}
| 6,337 | 0.632155 | 0.628173 | 202 | 28.831684 | 23.838802 | 109 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.574257 | false | false |
7
|
e90cb3c04f6a6c11ee04168c2a6a4266bbae49dc
| 22,617,297,785,000 |
f5694e76ea50fe58628e4c438f21a816dd99c5c7
|
/src/Controlador/Coordinador.java
|
4d62b0790675a9c90e96f6345368d701e751bd25
|
[] |
no_license
|
ivanfraidias/proyectofinal
|
https://github.com/ivanfraidias/proyectofinal
|
83007295ba6a36ff85aaf50fef243bad18dcc60d
|
411d0bcd420411e34a1207b738daafe32729adfb
|
refs/heads/master
| 2020-03-02T07:05:02.569000 | 2017-05-21T17:53:41 | 2017-05-21T17:53:41 | 91,444,951 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* 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 Controlador;
import Modelo.CarteleraVO;
import Modelo.Logica;
import Modelo.PeliculaVO;
import java.sql.SQLException;
import java.util.ArrayList;
/**
*
* @author ivandam
*/
public class Coordinador {
private Logica milogica;
public Logica getMiLogica(){
return milogica;
}
public void setMilogica(Logica milogica) {
this.milogica = milogica;
}
//PELICULA
public boolean insertarPelicula(PeliculaVO mipelicula){
return milogica.validarInsertarPelicula(mipelicula);
}
public PeliculaVO consultarPelicula(int id){
return milogica.validarConsultarPelicula(id);
}
public ArrayList<PeliculaVO> ConsultarTodoPelicula() throws SQLException{
return milogica.ValidarConsultarTodosPelicula();
}
public boolean modificarPelicula(PeliculaVO mipelicula){
return milogica.validarModificarPelicula(mipelicula);
}
public boolean eliminarPelicula(int id){
return milogica.validarEliminarPelicula(id);
}
//CARTELERA
public boolean insertarCartelera(CarteleraVO micartelera){
return milogica.validarInsertarCartelera(micartelera);
}
public CarteleraVO consultarCartelera(int id){
return milogica.validarConsultarCartelera(id);
}
public ArrayList<CarteleraVO> ConsultarTodoCartelera() throws SQLException{
return milogica.ValidarConsultarTodosCartelera();
}
public boolean modificarCartelera(CarteleraVO micartelera){
return milogica.validarModificarCartelera(micartelera);
}
public boolean eliminarCartelera(int id){
return milogica.validarEliminarCartelera(id);
}
}
|
UTF-8
|
Java
| 1,945 |
java
|
Coordinador.java
|
Java
|
[
{
"context": "import java.util.ArrayList;\r\n\r\n/**\r\n *\r\n * @author ivandam\r\n */\r\npublic class Coordinador {\r\n private Logic",
"end": 381,
"score": 0.977039098739624,
"start": 374,
"tag": "USERNAME",
"value": "ivandam"
}
] | null |
[] |
/*
* 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 Controlador;
import Modelo.CarteleraVO;
import Modelo.Logica;
import Modelo.PeliculaVO;
import java.sql.SQLException;
import java.util.ArrayList;
/**
*
* @author ivandam
*/
public class Coordinador {
private Logica milogica;
public Logica getMiLogica(){
return milogica;
}
public void setMilogica(Logica milogica) {
this.milogica = milogica;
}
//PELICULA
public boolean insertarPelicula(PeliculaVO mipelicula){
return milogica.validarInsertarPelicula(mipelicula);
}
public PeliculaVO consultarPelicula(int id){
return milogica.validarConsultarPelicula(id);
}
public ArrayList<PeliculaVO> ConsultarTodoPelicula() throws SQLException{
return milogica.ValidarConsultarTodosPelicula();
}
public boolean modificarPelicula(PeliculaVO mipelicula){
return milogica.validarModificarPelicula(mipelicula);
}
public boolean eliminarPelicula(int id){
return milogica.validarEliminarPelicula(id);
}
//CARTELERA
public boolean insertarCartelera(CarteleraVO micartelera){
return milogica.validarInsertarCartelera(micartelera);
}
public CarteleraVO consultarCartelera(int id){
return milogica.validarConsultarCartelera(id);
}
public ArrayList<CarteleraVO> ConsultarTodoCartelera() throws SQLException{
return milogica.ValidarConsultarTodosCartelera();
}
public boolean modificarCartelera(CarteleraVO micartelera){
return milogica.validarModificarCartelera(micartelera);
}
public boolean eliminarCartelera(int id){
return milogica.validarEliminarCartelera(id);
}
}
| 1,945 | 0.69563 | 0.69563 | 65 | 27.923077 | 24.786663 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.338462 | false | false |
7
|
a2cb292b1eee2fa0a19e3088b64c566edd41bf3d
| 37,074,157,712,354 |
01563cf663b502102e22b73bd3ff6a16dde701d0
|
/src/main/java/com/jk51/modules/comment/service/CommentService.java
|
0d4aa3d7e445974b6dc0e4faf1f1892ed312c80d
|
[] |
no_license
|
tomzhang/springTestB
|
https://github.com/tomzhang/springTestB
|
17cc2d866723d7200302b068a30239732a9cda26
|
af4bd2d5cc90d44f0b786fb115577a811d1eaac7
|
refs/heads/master
| 2020-05-02T04:35:50.729000 | 2018-10-24T02:24:35 | 2018-10-24T02:24:35 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.jk51.modules.comment.service;
import com.jk51.model.Comments;
import com.jk51.model.Goods;
import com.jk51.model.order.Trades;
import com.jk51.modules.comment.mapper.CommentMapper;
import com.jk51.modules.goods.mapper.GoodsMapper;
import com.jk51.modules.integral.service.IntegerRuleService;
import com.jk51.modules.trades.mapper.TradesMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* Created by admin on 2017/2/24.
*/
@Service
public class CommentService {
@Autowired
private CommentMapper commentMapper;
@Autowired
private GoodsMapper goodsMapper;
@Autowired
private TradesMapper tradesMapper;
@Autowired
private IntegerRuleService integralRuleService;
public List<Comments> findCommentsList(Map<String,Object> paramsMap){return commentMapper.findCommentsList(paramsMap);}
@Transactional
public void updateState(Map<String, Object> params) {
Comments comments = new Comments();
Object O_isShow = params.get("isShow");
String S_isShow = O_isShow.toString();
int I_isShow = Integer.parseInt(S_isShow);
comments.setIsShow(I_isShow);
List<String> list = new ArrayList<String>();
String ids = (String) params.get("commentIds");
String[] commentIds = ids.split(",");
for (int i = 0; i < commentIds.length; i++) {
list.add(commentIds[i]);
}
Object siteId = params.get("siteId");
String S_siteId = siteId.toString();
int I_siteId = Integer.parseInt(S_siteId);
comments.setSiteId(I_siteId);
comments.setCommentIds(list);
commentMapper.updateState(comments);
}
@Transactional
public void updateStateAll(Map<String, Object> params) {
Comments comments = new Comments();
comments.setIsShow(0);
List<String> list = new ArrayList<String>();
String ids = (String) params.get("commentIds");
String[] commentIds = ids.split(",");
for (int i = 0; i < commentIds.length; i++) {
list.add(commentIds[i]);
}
Object siteId = params.get("siteId");
String S_siteId = siteId.toString();
int I_siteId = Integer.parseInt(S_siteId);
comments.setSiteId(I_siteId);
comments.setCommentIds(list);
commentMapper.updateState(comments);
}
public List<Map<String, Object>> findItemComments(String siteId, String goodsId){
return commentMapper.findItemComments(siteId,goodsId);
}
public Goods findGoodsById(String goodsId){
return goodsMapper.queryGoods(goodsId);
}
@Transactional
public List<Comments> findOrderComments(String tradesId){
List<Comments> comments = commentMapper.findOrderComments(tradesId);
/*
comments.stream().forEach(comments1 -> {
System.out.print("dsfdsf");
Goods goods = goodsMapper.getBySiteIdAndGoodsId(comments1.getGoodsId(),comments1.getSiteId());
comments1.setGoods(goods);
});*/
comments.forEach(comments1 -> {
System.out.println("~~~~");
Goods goods = goodsMapper.getBySiteIdAndGoodsId(comments1.getGoodsId(),comments1.getSiteId());
comments1.setGoods(goods);
});
return comments;
}
@Transactional
public void addServiceComment(Map<String,Object> paramterMap){commentMapper.addServiceComment(paramterMap);}
@Transactional
public String addComment(Map<String,Object> param){
// printMap(param);
List<Comments> commentss = new ArrayList<>();
Comments comments = null;
Integer siteId = (Integer) param.get("siteId");
String tradesId = (String) param.get("tradesId");
String byerNick = (String) param.get("buyerNick");
comments = new Comments();
comments.setSiteId(siteId);
comments.setTradesId(tradesId);
comments.setBuyerNick(byerNick);
comments.setCommentRank(Integer.parseInt((String)param.get("tradesRank")));
commentss.add(comments);
int index=1;
String goods = (String) param.get("goodss");
String [] goodss = goods.split("\\|");
for(int i = 0;i<goodss.length;i++){
comments = new Comments();
String[] comment = goodss[i].split(",");
comments.setSiteId(siteId);
comments.setTradesId(tradesId);
comments.setBuyerNick(byerNick);
comments.setCommentRank(Integer.parseInt(comment[0]));
comments.setCommentContent(comment[1]);
comments.setGoodsId(Integer.parseInt(comment[2]));
comments.setIsShow(1);
commentss.add(comments);
index++;
}
int i = commentMapper.addTradeComment(commentss);
if(i==index){
Trades trades=tradesMapper.getTradesByTradesId(Long.valueOf((String) param.get("tradesId")));
integralRuleService.integralByOrderMulti(trades);
if(trades!=null){
Integer rank = Integer.parseInt((String)param.get("tradesRank"));
int m = tradesMapper.updateTradeRank(rank,trades.getTradesId());
if(m!=0)return "ok";
}
return "ok";
}
throw new RuntimeException("faild");
}
private void printMap(Map<String,Object> param){
Set<String> set = param.keySet();
System.out.println("*************************************");
for (String s:set
) {
System.out.println(param.get(s));
}
System.out.println("*************************************");
}
public void updateComments(Map param){
commentMapper.updateComments(param);
}
}
|
UTF-8
|
Java
| 5,988 |
java
|
CommentService.java
|
Java
|
[
{
"context": "util.Map;\nimport java.util.Set;\n\n/**\n * Created by admin on 2017/2/24.\n */\n@Service\npublic class CommentSe",
"end": 652,
"score": 0.9935490489006042,
"start": 647,
"tag": "USERNAME",
"value": "admin"
},
{
"context": "TradesId(tradesId);\n comments.setBuyerNick(byerNick);\n comments.setCommentRank(Integer.parseIn",
"end": 4171,
"score": 0.9332320094108582,
"start": 4163,
"tag": "USERNAME",
"value": "byerNick"
},
{
"context": "esId(tradesId);\n comments.setBuyerNick(byerNick);\n comments.setCommentRank(Integer.par",
"end": 4676,
"score": 0.8766945004463196,
"start": 4668,
"tag": "USERNAME",
"value": "byerNick"
}
] | null |
[] |
package com.jk51.modules.comment.service;
import com.jk51.model.Comments;
import com.jk51.model.Goods;
import com.jk51.model.order.Trades;
import com.jk51.modules.comment.mapper.CommentMapper;
import com.jk51.modules.goods.mapper.GoodsMapper;
import com.jk51.modules.integral.service.IntegerRuleService;
import com.jk51.modules.trades.mapper.TradesMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* Created by admin on 2017/2/24.
*/
@Service
public class CommentService {
@Autowired
private CommentMapper commentMapper;
@Autowired
private GoodsMapper goodsMapper;
@Autowired
private TradesMapper tradesMapper;
@Autowired
private IntegerRuleService integralRuleService;
public List<Comments> findCommentsList(Map<String,Object> paramsMap){return commentMapper.findCommentsList(paramsMap);}
@Transactional
public void updateState(Map<String, Object> params) {
Comments comments = new Comments();
Object O_isShow = params.get("isShow");
String S_isShow = O_isShow.toString();
int I_isShow = Integer.parseInt(S_isShow);
comments.setIsShow(I_isShow);
List<String> list = new ArrayList<String>();
String ids = (String) params.get("commentIds");
String[] commentIds = ids.split(",");
for (int i = 0; i < commentIds.length; i++) {
list.add(commentIds[i]);
}
Object siteId = params.get("siteId");
String S_siteId = siteId.toString();
int I_siteId = Integer.parseInt(S_siteId);
comments.setSiteId(I_siteId);
comments.setCommentIds(list);
commentMapper.updateState(comments);
}
@Transactional
public void updateStateAll(Map<String, Object> params) {
Comments comments = new Comments();
comments.setIsShow(0);
List<String> list = new ArrayList<String>();
String ids = (String) params.get("commentIds");
String[] commentIds = ids.split(",");
for (int i = 0; i < commentIds.length; i++) {
list.add(commentIds[i]);
}
Object siteId = params.get("siteId");
String S_siteId = siteId.toString();
int I_siteId = Integer.parseInt(S_siteId);
comments.setSiteId(I_siteId);
comments.setCommentIds(list);
commentMapper.updateState(comments);
}
public List<Map<String, Object>> findItemComments(String siteId, String goodsId){
return commentMapper.findItemComments(siteId,goodsId);
}
public Goods findGoodsById(String goodsId){
return goodsMapper.queryGoods(goodsId);
}
@Transactional
public List<Comments> findOrderComments(String tradesId){
List<Comments> comments = commentMapper.findOrderComments(tradesId);
/*
comments.stream().forEach(comments1 -> {
System.out.print("dsfdsf");
Goods goods = goodsMapper.getBySiteIdAndGoodsId(comments1.getGoodsId(),comments1.getSiteId());
comments1.setGoods(goods);
});*/
comments.forEach(comments1 -> {
System.out.println("~~~~");
Goods goods = goodsMapper.getBySiteIdAndGoodsId(comments1.getGoodsId(),comments1.getSiteId());
comments1.setGoods(goods);
});
return comments;
}
@Transactional
public void addServiceComment(Map<String,Object> paramterMap){commentMapper.addServiceComment(paramterMap);}
@Transactional
public String addComment(Map<String,Object> param){
// printMap(param);
List<Comments> commentss = new ArrayList<>();
Comments comments = null;
Integer siteId = (Integer) param.get("siteId");
String tradesId = (String) param.get("tradesId");
String byerNick = (String) param.get("buyerNick");
comments = new Comments();
comments.setSiteId(siteId);
comments.setTradesId(tradesId);
comments.setBuyerNick(byerNick);
comments.setCommentRank(Integer.parseInt((String)param.get("tradesRank")));
commentss.add(comments);
int index=1;
String goods = (String) param.get("goodss");
String [] goodss = goods.split("\\|");
for(int i = 0;i<goodss.length;i++){
comments = new Comments();
String[] comment = goodss[i].split(",");
comments.setSiteId(siteId);
comments.setTradesId(tradesId);
comments.setBuyerNick(byerNick);
comments.setCommentRank(Integer.parseInt(comment[0]));
comments.setCommentContent(comment[1]);
comments.setGoodsId(Integer.parseInt(comment[2]));
comments.setIsShow(1);
commentss.add(comments);
index++;
}
int i = commentMapper.addTradeComment(commentss);
if(i==index){
Trades trades=tradesMapper.getTradesByTradesId(Long.valueOf((String) param.get("tradesId")));
integralRuleService.integralByOrderMulti(trades);
if(trades!=null){
Integer rank = Integer.parseInt((String)param.get("tradesRank"));
int m = tradesMapper.updateTradeRank(rank,trades.getTradesId());
if(m!=0)return "ok";
}
return "ok";
}
throw new RuntimeException("faild");
}
private void printMap(Map<String,Object> param){
Set<String> set = param.keySet();
System.out.println("*************************************");
for (String s:set
) {
System.out.println(param.get(s));
}
System.out.println("*************************************");
}
public void updateComments(Map param){
commentMapper.updateComments(param);
}
}
| 5,988 | 0.630762 | 0.623914 | 176 | 33.022728 | 25.815552 | 123 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.6875 | false | false |
7
|
fe6b0b6b034342f2db56e317275084d83c97106d
| 27,676,769,307,402 |
2ef073c9866e69dda09b88e60d2ab249a2b8e276
|
/src/main/java/stoptheworld/GcNotificationListener.java
|
2a72da8a2a8560de7d07a41d2d152001f91d1c71
|
[] |
no_license
|
bonifaido/gc-notification-utils
|
https://github.com/bonifaido/gc-notification-utils
|
f677f6f5e76a7836005628f1da8c68bae59c8a28
|
fd5476f7e2e468e0d34fdae33e81cfd97d60c411
|
refs/heads/master
| 2016-09-06T07:36:54.843000 | 2015-05-10T17:03:44 | 2015-05-10T17:03:44 | 29,097,245 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package stoptheworld;
import com.lmax.disruptor.RingBuffer;
import javax.management.Notification;
import javax.management.NotificationListener;
import java.lang.management.GarbageCollectorMXBean;
/**
* The listener called back on the JVM Service thread, the producer from Disruptor point of view.
*/
class GcNotificationListener implements NotificationListener {
private final GarbageCollectorMXBean gcBean;
private final RingBuffer<GcNotificationEvent> disruptor;
private long lastCollectionTime;
public GcNotificationListener(GarbageCollectorMXBean gcBean,
RingBuffer<GcNotificationEvent> disruptor) {
this.gcBean = gcBean;
this.disruptor = disruptor;
this.lastCollectionTime = gcBean.getCollectionTime();
}
/**
* Do a very quick path here, because this goes on the VM Service thread.
*/
@Override
public void handleNotification(Notification notification, Object handback) {
long currentCollectionTime = gcBean.getCollectionTime();
long duration = currentCollectionTime - lastCollectionTime;
lastCollectionTime = currentCollectionTime;
long sequence = disruptor.next();
GcNotificationEvent event = disruptor.get(sequence);
event.notification = notification;
event.stwDuration = duration;
disruptor.publish(sequence);
}
}
|
UTF-8
|
Java
| 1,402 |
java
|
GcNotificationListener.java
|
Java
|
[] | null |
[] |
package stoptheworld;
import com.lmax.disruptor.RingBuffer;
import javax.management.Notification;
import javax.management.NotificationListener;
import java.lang.management.GarbageCollectorMXBean;
/**
* The listener called back on the JVM Service thread, the producer from Disruptor point of view.
*/
class GcNotificationListener implements NotificationListener {
private final GarbageCollectorMXBean gcBean;
private final RingBuffer<GcNotificationEvent> disruptor;
private long lastCollectionTime;
public GcNotificationListener(GarbageCollectorMXBean gcBean,
RingBuffer<GcNotificationEvent> disruptor) {
this.gcBean = gcBean;
this.disruptor = disruptor;
this.lastCollectionTime = gcBean.getCollectionTime();
}
/**
* Do a very quick path here, because this goes on the VM Service thread.
*/
@Override
public void handleNotification(Notification notification, Object handback) {
long currentCollectionTime = gcBean.getCollectionTime();
long duration = currentCollectionTime - lastCollectionTime;
lastCollectionTime = currentCollectionTime;
long sequence = disruptor.next();
GcNotificationEvent event = disruptor.get(sequence);
event.notification = notification;
event.stwDuration = duration;
disruptor.publish(sequence);
}
}
| 1,402 | 0.723252 | 0.723252 | 42 | 32.380951 | 28.346455 | 97 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.547619 | false | false |
7
|
b9ccae8ee3856954cf1e3843fd750003345f1e8b
| 16,904,991,332,333 |
b981ec1f47604c0e3964fa0f2e257fb40c161aad
|
/src/com/chee/entity/AccountFlow.java
|
b00e02fa1f7658d8f8c44814c857cc0904b5a06b
|
[] |
no_license
|
ddong32/cheefull
|
https://github.com/ddong32/cheefull
|
78cad892f9b2332088c961b2597aea264da3ea7f
|
4e7dff7acd1d15ca65b5ae4e4354bc9b3ee71d30
|
refs/heads/master
| 2021-09-10T05:20:27.093000 | 2018-02-11T09:11:06 | 2018-02-11T09:11:06 | 109,226,933 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.chee.entity;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;
import org.hibernate.annotations.GenericGenerator;
@Entity
@Table(name = "chee_account_flow")
public class AccountFlow implements Serializable {
private static final long serialVersionUID = 1L;
private Integer id;
private String lsh;
private double skje;
private double fkje;
private String lrr;
private Date lrsj;
private Date gxsj;
private String shr;
private Date shsj;
private String stat;
private Date sksj;
private String accountId;
private String orderId;
private String bz;
private Bank bank;
private Account account;
private String spr;
private Date spsj;
private String sffs;
private Integer bankRunningId;
private String beginDate;
private String endDate;
private String ywlx;
private User user;
private List<Integer> proUserIds;
@Id
@GenericGenerator(name = "paymentableGenerator", strategy = "native")
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "ID", precision = 11, scale = 0)
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
@Column(name = "lsh", length = 20)
public String getLsh() {
return this.lsh;
}
public void setLsh(String lsh) {
this.lsh = lsh;
}
@Column(name = "lrr", length = 20)
public String getLrr() {
return this.lrr;
}
public void setLrr(String lrr) {
this.lrr = lrr;
}
@Column(name = "lrsj")
public Date getLrsj() {
return this.lrsj;
}
public void setLrsj(Date lrsj) {
this.lrsj = lrsj;
}
@Column(name = "gxsj")
public Date getGxsj() {
return this.gxsj;
}
public void setGxsj(Date gxsj) {
this.gxsj = gxsj;
}
@Column(name = "skje")
public double getSkje() {
return this.skje;
}
public void setSkje(double skje) {
this.skje = skje;
}
@Column(name = "fkje")
public double getFkje() {
return this.fkje;
}
public void setFkje(double fkje) {
this.fkje = fkje;
}
@Column(name = "bz")
public String getBz() {
return this.bz;
}
public void setBz(String bz) {
this.bz = bz;
}
@Column(name = "shr")
public String getShr() {
return this.shr;
}
public void setShr(String shr) {
this.shr = shr;
}
@Column(name = "shsj")
public Date getShsj() {
return this.shsj;
}
public void setShsj(Date shsj) {
this.shsj = shsj;
}
@Column(name = "stat")
public String getStat() {
return this.stat;
}
public void setStat(String stat) {
this.stat = stat;
}
@Column(name = "account_id")
public String getAccountId() {
return this.accountId;
}
public void setAccountId(String accountId) {
this.accountId = accountId;
}
@Column(name = "order_id")
public String getOrderId() {
return this.orderId;
}
public void setOrderId(String orderId) {
this.orderId = orderId;
}
@Column(name = "sksj")
public Date getSksj() {
return this.sksj;
}
public void setSksj(Date sksj) {
this.sksj = sksj;
}
@Column(name = "ywlx")
public String getYwlx() {
return this.ywlx;
}
public void setYwlx(String ywlx) {
this.ywlx = ywlx;
}
@ManyToOne(fetch = FetchType.LAZY, optional = true)
@JoinColumn(name = "bank_id", referencedColumnName = "id")
public Bank getBank() {
return this.bank;
}
public void setBank(Bank bank) {
this.bank = bank;
}
@ManyToOne(fetch = FetchType.LAZY, optional = true)
@JoinColumn(name = "a_id", referencedColumnName = "id")
public Account getAccount() {
return this.account;
}
public void setAccount(Account account) {
this.account = account;
}
@Column(name = "bank_running_id")
public Integer getBankRunningId() {
return this.bankRunningId;
}
public void setBankRunningId(Integer bankRunningId) {
this.bankRunningId = bankRunningId;
}
@Column(name = "spr")
public String getSpr() {
return this.spr;
}
public void setSpr(String spr) {
this.spr = spr;
}
@Column(name = "spsj")
public Date getSpsj() {
return this.spsj;
}
public void setSpsj(Date spsj) {
this.spsj = spsj;
}
@Column(name = "sffs")
public String getSffs() {
return this.sffs;
}
public void setSffs(String sffs) {
this.sffs = sffs;
}
@ManyToOne(fetch = FetchType.LAZY, optional = true)
@JoinColumn(name = "USER_ID", referencedColumnName = "ID")
public User getUser() {
return this.user;
}
public void setUser(User user) {
this.user = user;
}
@Transient
public String getBeginDate() {
return this.beginDate;
}
public void setBeginDate(String beginDate) {
this.beginDate = beginDate;
}
@Transient
public String getEndDate() {
return this.endDate;
}
public void setEndDate(String endDate) {
this.endDate = endDate;
}
@Transient
public List<Integer> getProUserIds() {
return this.proUserIds;
}
public void setProUserIds(List<Integer> proUserIds) {
this.proUserIds = proUserIds;
}
public int hashCode() {
return this.id == null ? System.identityHashCode(this) : this.id.hashCode();
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass().getPackage() != obj.getClass().getPackage()) {
return false;
}
AccountFlow other = (AccountFlow) obj;
if (this.id == null) {
if (other.getId() != null) {
return false;
}
} else if (!this.id.equals(other.getId())) {
return false;
}
return true;
}
}
|
UTF-8
|
Java
| 6,912 |
java
|
AccountFlow.java
|
Java
|
[] | null |
[] |
package com.chee.entity;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;
import org.hibernate.annotations.GenericGenerator;
@Entity
@Table(name = "chee_account_flow")
public class AccountFlow implements Serializable {
private static final long serialVersionUID = 1L;
private Integer id;
private String lsh;
private double skje;
private double fkje;
private String lrr;
private Date lrsj;
private Date gxsj;
private String shr;
private Date shsj;
private String stat;
private Date sksj;
private String accountId;
private String orderId;
private String bz;
private Bank bank;
private Account account;
private String spr;
private Date spsj;
private String sffs;
private Integer bankRunningId;
private String beginDate;
private String endDate;
private String ywlx;
private User user;
private List<Integer> proUserIds;
@Id
@GenericGenerator(name = "paymentableGenerator", strategy = "native")
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "ID", precision = 11, scale = 0)
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
@Column(name = "lsh", length = 20)
public String getLsh() {
return this.lsh;
}
public void setLsh(String lsh) {
this.lsh = lsh;
}
@Column(name = "lrr", length = 20)
public String getLrr() {
return this.lrr;
}
public void setLrr(String lrr) {
this.lrr = lrr;
}
@Column(name = "lrsj")
public Date getLrsj() {
return this.lrsj;
}
public void setLrsj(Date lrsj) {
this.lrsj = lrsj;
}
@Column(name = "gxsj")
public Date getGxsj() {
return this.gxsj;
}
public void setGxsj(Date gxsj) {
this.gxsj = gxsj;
}
@Column(name = "skje")
public double getSkje() {
return this.skje;
}
public void setSkje(double skje) {
this.skje = skje;
}
@Column(name = "fkje")
public double getFkje() {
return this.fkje;
}
public void setFkje(double fkje) {
this.fkje = fkje;
}
@Column(name = "bz")
public String getBz() {
return this.bz;
}
public void setBz(String bz) {
this.bz = bz;
}
@Column(name = "shr")
public String getShr() {
return this.shr;
}
public void setShr(String shr) {
this.shr = shr;
}
@Column(name = "shsj")
public Date getShsj() {
return this.shsj;
}
public void setShsj(Date shsj) {
this.shsj = shsj;
}
@Column(name = "stat")
public String getStat() {
return this.stat;
}
public void setStat(String stat) {
this.stat = stat;
}
@Column(name = "account_id")
public String getAccountId() {
return this.accountId;
}
public void setAccountId(String accountId) {
this.accountId = accountId;
}
@Column(name = "order_id")
public String getOrderId() {
return this.orderId;
}
public void setOrderId(String orderId) {
this.orderId = orderId;
}
@Column(name = "sksj")
public Date getSksj() {
return this.sksj;
}
public void setSksj(Date sksj) {
this.sksj = sksj;
}
@Column(name = "ywlx")
public String getYwlx() {
return this.ywlx;
}
public void setYwlx(String ywlx) {
this.ywlx = ywlx;
}
@ManyToOne(fetch = FetchType.LAZY, optional = true)
@JoinColumn(name = "bank_id", referencedColumnName = "id")
public Bank getBank() {
return this.bank;
}
public void setBank(Bank bank) {
this.bank = bank;
}
@ManyToOne(fetch = FetchType.LAZY, optional = true)
@JoinColumn(name = "a_id", referencedColumnName = "id")
public Account getAccount() {
return this.account;
}
public void setAccount(Account account) {
this.account = account;
}
@Column(name = "bank_running_id")
public Integer getBankRunningId() {
return this.bankRunningId;
}
public void setBankRunningId(Integer bankRunningId) {
this.bankRunningId = bankRunningId;
}
@Column(name = "spr")
public String getSpr() {
return this.spr;
}
public void setSpr(String spr) {
this.spr = spr;
}
@Column(name = "spsj")
public Date getSpsj() {
return this.spsj;
}
public void setSpsj(Date spsj) {
this.spsj = spsj;
}
@Column(name = "sffs")
public String getSffs() {
return this.sffs;
}
public void setSffs(String sffs) {
this.sffs = sffs;
}
@ManyToOne(fetch = FetchType.LAZY, optional = true)
@JoinColumn(name = "USER_ID", referencedColumnName = "ID")
public User getUser() {
return this.user;
}
public void setUser(User user) {
this.user = user;
}
@Transient
public String getBeginDate() {
return this.beginDate;
}
public void setBeginDate(String beginDate) {
this.beginDate = beginDate;
}
@Transient
public String getEndDate() {
return this.endDate;
}
public void setEndDate(String endDate) {
this.endDate = endDate;
}
@Transient
public List<Integer> getProUserIds() {
return this.proUserIds;
}
public void setProUserIds(List<Integer> proUserIds) {
this.proUserIds = proUserIds;
}
public int hashCode() {
return this.id == null ? System.identityHashCode(this) : this.id.hashCode();
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass().getPackage() != obj.getClass().getPackage()) {
return false;
}
AccountFlow other = (AccountFlow) obj;
if (this.id == null) {
if (other.getId() != null) {
return false;
}
} else if (!this.id.equals(other.getId())) {
return false;
}
return true;
}
}
| 6,912 | 0.566117 | 0.564959 | 303 | 20.811882 | 16.444956 | 84 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.363036 | false | false |
7
|
d63e35ada14ee19d2561800fafd611420be4dc58
| 3,264,175,205,544 |
a8ca511deb6142341a6951371d477f8c355bb67f
|
/src/com/kata/bmi/Calculate.java
|
51d70ca59168c07463e03238060bbe2a893dcba5
|
[] |
no_license
|
emilybowe/Kata
|
https://github.com/emilybowe/Kata
|
fa2e7bc407869d9f4e950cff54563d93f286726c
|
1df3b1ef0c937d54b9c1ffd58debaf8021803ecb
|
refs/heads/master
| 2022-09-10T13:05:04.492000 | 2020-05-28T20:18:22 | 2020-05-28T20:18:22 | 255,164,820 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.kata.bmi;
public class Calculate {
public static void bmi(double weight, double height) {
double bmi = weight/Math.pow(height, 2);
if (bmi <= 18.5) System.out.println( "Underweight");
else if (bmi <= 25.0) System.out.println( "Normal");
else if (bmi <= 30.0) System.out.println( "Overweight");
else if (bmi > 30) System.out.println( "Obese");
}
public static void main(String[] args) {
bmi(100, 1.5);
}
}
|
UTF-8
|
Java
| 486 |
java
|
Calculate.java
|
Java
|
[] | null |
[] |
package com.kata.bmi;
public class Calculate {
public static void bmi(double weight, double height) {
double bmi = weight/Math.pow(height, 2);
if (bmi <= 18.5) System.out.println( "Underweight");
else if (bmi <= 25.0) System.out.println( "Normal");
else if (bmi <= 30.0) System.out.println( "Overweight");
else if (bmi > 30) System.out.println( "Obese");
}
public static void main(String[] args) {
bmi(100, 1.5);
}
}
| 486 | 0.588477 | 0.553498 | 18 | 26 | 25.188181 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.555556 | false | false |
7
|
b45c6f43df98c15cbf662bc5188824b7e4415c0d
| 5,360,119,245,109 |
935b694f0b1b10a46e1c69545cb58dec99c9095e
|
/src/managementgamestore/UserWindow.java
|
d767f253bc95d080b6998508511a20e33951c0b8
|
[] |
no_license
|
cathean/Management-Game-Store
|
https://github.com/cathean/Management-Game-Store
|
0d64c94b8e1a7361954248e223b331b9957b3f59
|
9a4ae355080baf513739eeeb2bb7b70761f37d7f
|
refs/heads/master
| 2022-12-01T03:58:49.030000 | 2020-08-13T02:57:54 | 2020-08-13T02:57:54 | 274,617,021 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* 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 managementgamestore;
import com.formdev.flatlaf.FlatLightLaf;
import java.awt.Component;
import java.util.ArrayList;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.UIManager;
import javax.swing.table.DefaultTableModel;
/**
*
* @author ryans
*/
public class UserWindow extends javax.swing.JFrame {
DBManager dbm = DBManager.getInstance();
ArrayList<UserStruct> adminList = dbm.fetchAdmin();
DefaultTableModel model = null;
private int Index = -1;
/**
* Creates new form UserSetting
*/
public UserWindow() {
initComponents();
dbm.createTrigUser();
model = (DefaultTableModel) jTable1.getModel();
// Add all the current list admin into the table
for(int i = 0; i < adminList.size(); i++) {
model.addRow(new Object[] {
adminList.get(i).id_admin,
adminList.get(i).username,
adminList.get(i).name,
adminList.get(i).kontak,
adminList.get(i).tipe
});
}
// Show information user admin
if(dbm.admin != null) {
jLabel6.setText(String.valueOf(dbm.admin.id_admin));
jLabel7.setText(dbm.admin.username);
jLabel8.setText(dbm.admin.name);
jLabel9.setText(dbm.admin.kontak);
jLabel10.setText(dbm.admin.tipe);
}
// Check type of admin and enable user creation if admin
if(dbm.admin != null && !dbm.admin.tipe.equals("admin")) {
jButton3.setEnabled(false);
jTable1.setEnabled(false);
for (Component cp : jPanel3.getComponents() ){
cp.setEnabled(false);
}
}
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jScrollPane1 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
jPanel3 = new javax.swing.JPanel();
jLabel11 = new javax.swing.JLabel();
jLabel16 = new javax.swing.JLabel();
jLabel18 = new javax.swing.JLabel();
jLabel20 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jTextField2 = new javax.swing.JTextField();
jTextField3 = new javax.swing.JTextField();
jComboBox1 = new javax.swing.JComboBox<>();
jButton2 = new javax.swing.JButton();
jLabel17 = new javax.swing.JLabel();
jPasswordField1 = new javax.swing.JPasswordField();
jPanel2 = new javax.swing.JPanel();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
jLabel1 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel9 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel10 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jButton3 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("User Settings");
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"ID", "Username", "Name", "Contact", "Type"
}
) {
Class[] types = new Class [] {
java.lang.Integer.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
};
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
}
});
jScrollPane1.setViewportView(jTable1);
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Create New User"));
jLabel11.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel11.setText("Type : ");
jLabel16.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel16.setText("Username : ");
jLabel18.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel18.setText("Name : ");
jLabel20.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel20.setText("Contact : ");
jComboBox1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "-Choose Type-", "Admin", "Employee" }));
jButton2.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jButton2.setText("Add");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jLabel17.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel17.setText("Password : ");
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel20)
.addComponent(jLabel18)
.addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel11))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTextField1)
.addComponent(jTextField2)
.addComponent(jTextField3)
.addComponent(jComboBox1, 0, 183, Short.MAX_VALUE)))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
.addGap(3, 3, 3)
.addComponent(jLabel17)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPasswordField1)))
.addContainerGap())
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel16)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel17)
.addComponent(jPasswordField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel18))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel20))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton2)
.addGap(29, 29, 29))
);
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("User's Information"));
jLabel5.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel5.setText("Type : ");
jLabel6.setText("-");
jLabel7.setText("-");
jLabel1.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel1.setText("ID Karyawan : ");
jLabel8.setText("-");
jLabel2.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel2.setText("Username : ");
jLabel9.setText("-");
jLabel3.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel3.setText("Name : ");
jLabel10.setText("-");
jLabel4.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel4.setText("Contact : ");
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel4)
.addComponent(jLabel3)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1)
.addComponent(jLabel5))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, 117, Short.MAX_VALUE)
.addComponent(jLabel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel9, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel10, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(jLabel6))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(jLabel8))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(jLabel9))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel10))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jButton3.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jButton3.setText("Delete");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, 203, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 272, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton3)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
String tipe = jComboBox1.getSelectedItem().toString();
if(jTextField1.getText().equals("")) {
JOptionPane.showMessageDialog(this, "Fill username!");
return;
}
if(jTextField2.getText().equals("")) {
JOptionPane.showMessageDialog(this, "Fill name!");
return;
}
if(new String(jPasswordField1.getText()).equals("")) {
JOptionPane.showMessageDialog(this, "Fill password!");
return;
}
if(jTextField2.getText().equals("")) {
JOptionPane.showMessageDialog(this, "Fill contact!");
return;
}
switch(tipe) {
case "Employee" :
tipe = "karyawan";
break;
case "Admin" :
tipe = "admin";
break;
default :
JOptionPane.showMessageDialog(new JFrame(), "Please choose user's type!");
return;
}
JOptionPane.showMessageDialog(null, "Added new user!");
dbm.saveAdmin(
jTextField2.getText(),
jTextField3.getText(),
jTextField1.getText(),
new String(jPasswordField1.getPassword()),
tipe);
model = (DefaultTableModel) jTable1.getModel();
model.setRowCount(0);
adminList = dbm.fetchAdmin();
// Add all the current list admin into the table
for(int i = 0; i < adminList.size(); i++) {
model.addRow(new Object[] {
adminList.get(i).id_admin,
adminList.get(i).username,
adminList.get(i).name,
adminList.get(i).kontak,
adminList.get(i).tipe
});
}
// Show information user admin
if(dbm.admin != null) {
jLabel6.setText(String.valueOf(dbm.admin.id_admin));
jLabel7.setText(dbm.admin.username);
jLabel8.setText(dbm.admin.name);
jLabel9.setText(dbm.admin.kontak);
jLabel10.setText(dbm.admin.tipe);
}
// Check type of admin and enable user creation if admin
if(dbm.admin != null && !dbm.admin.tipe.equals("admin")) {
for (Component cp : jPanel3.getComponents() ){
cp.setEnabled(false);
}
}
}//GEN-LAST:event_jButton2ActionPerformed
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
// TODO add your handling code here:
Index = jTable1.getSelectedRow();
int option = JOptionPane.showConfirmDialog(null, "Yakin ingin menghapus data ini?", "Konfirmasi", JOptionPane.YES_NO_OPTION);
if (option == JOptionPane.YES_OPTION){
long id_admin = adminList.get(Index).id_admin;
dbm.delAdmin(id_admin);
/* refresh table pake trik close/open window awikwok
dispose();
new UserWindow().setVisible(true); */
// refresh table
model = (DefaultTableModel) jTable1.getModel();
model.setRowCount(0);
adminList = dbm.fetchAdmin();
// Add all the current list admin into the table
for(int i = 0; i < adminList.size(); i++) {
model.addRow(new Object[] {
adminList.get(i).id_admin,
adminList.get(i).username,
adminList.get(i).name,
adminList.get(i).kontak,
adminList.get(i).tipe
});
}
}
}//GEN-LAST:event_jButton3ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
UIManager.setLookAndFeel( new FlatLightLaf() );
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(MainWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new UserWindow().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JComboBox<String> jComboBox1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel16;
private javax.swing.JLabel jLabel17;
private javax.swing.JLabel jLabel18;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel20;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPasswordField jPasswordField1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable jTable1;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField2;
private javax.swing.JTextField jTextField3;
// End of variables declaration//GEN-END:variables
}
|
UTF-8
|
Java
| 23,215 |
java
|
UserWindow.java
|
Java
|
[
{
"context": ".swing.table.DefaultTableModel;\n\n/**\n *\n * @author ryans\n */\npublic class UserWindow extends javax.swing.JF",
"end": 468,
"score": 0.8680171966552734,
"start": 463,
"tag": "USERNAME",
"value": "ryans"
},
{
"context": " new String [] {\n \"ID\", \"Username\", \"Name\", \"Contact\", \"Type\"\n }\n ",
"end": 3859,
"score": 0.9993557333946228,
"start": 3851,
"tag": "USERNAME",
"value": "Username"
},
{
"context": "i).id_admin,\n adminList.get(i).username,\n adminList.get(i).name,\n ",
"end": 20767,
"score": 0.9357185959815979,
"start": 20759,
"tag": "USERNAME",
"value": "username"
}
] | null |
[] |
/*
* 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 managementgamestore;
import com.formdev.flatlaf.FlatLightLaf;
import java.awt.Component;
import java.util.ArrayList;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.UIManager;
import javax.swing.table.DefaultTableModel;
/**
*
* @author ryans
*/
public class UserWindow extends javax.swing.JFrame {
DBManager dbm = DBManager.getInstance();
ArrayList<UserStruct> adminList = dbm.fetchAdmin();
DefaultTableModel model = null;
private int Index = -1;
/**
* Creates new form UserSetting
*/
public UserWindow() {
initComponents();
dbm.createTrigUser();
model = (DefaultTableModel) jTable1.getModel();
// Add all the current list admin into the table
for(int i = 0; i < adminList.size(); i++) {
model.addRow(new Object[] {
adminList.get(i).id_admin,
adminList.get(i).username,
adminList.get(i).name,
adminList.get(i).kontak,
adminList.get(i).tipe
});
}
// Show information user admin
if(dbm.admin != null) {
jLabel6.setText(String.valueOf(dbm.admin.id_admin));
jLabel7.setText(dbm.admin.username);
jLabel8.setText(dbm.admin.name);
jLabel9.setText(dbm.admin.kontak);
jLabel10.setText(dbm.admin.tipe);
}
// Check type of admin and enable user creation if admin
if(dbm.admin != null && !dbm.admin.tipe.equals("admin")) {
jButton3.setEnabled(false);
jTable1.setEnabled(false);
for (Component cp : jPanel3.getComponents() ){
cp.setEnabled(false);
}
}
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jScrollPane1 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
jPanel3 = new javax.swing.JPanel();
jLabel11 = new javax.swing.JLabel();
jLabel16 = new javax.swing.JLabel();
jLabel18 = new javax.swing.JLabel();
jLabel20 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jTextField2 = new javax.swing.JTextField();
jTextField3 = new javax.swing.JTextField();
jComboBox1 = new javax.swing.JComboBox<>();
jButton2 = new javax.swing.JButton();
jLabel17 = new javax.swing.JLabel();
jPasswordField1 = new javax.swing.JPasswordField();
jPanel2 = new javax.swing.JPanel();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
jLabel1 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel9 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel10 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jButton3 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("User Settings");
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"ID", "Username", "Name", "Contact", "Type"
}
) {
Class[] types = new Class [] {
java.lang.Integer.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
};
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
}
});
jScrollPane1.setViewportView(jTable1);
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Create New User"));
jLabel11.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel11.setText("Type : ");
jLabel16.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel16.setText("Username : ");
jLabel18.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel18.setText("Name : ");
jLabel20.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel20.setText("Contact : ");
jComboBox1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "-Choose Type-", "Admin", "Employee" }));
jButton2.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jButton2.setText("Add");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jLabel17.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel17.setText("Password : ");
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel20)
.addComponent(jLabel18)
.addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel11))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTextField1)
.addComponent(jTextField2)
.addComponent(jTextField3)
.addComponent(jComboBox1, 0, 183, Short.MAX_VALUE)))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
.addGap(3, 3, 3)
.addComponent(jLabel17)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPasswordField1)))
.addContainerGap())
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel16)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel17)
.addComponent(jPasswordField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel18))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel20))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton2)
.addGap(29, 29, 29))
);
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("User's Information"));
jLabel5.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel5.setText("Type : ");
jLabel6.setText("-");
jLabel7.setText("-");
jLabel1.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel1.setText("ID Karyawan : ");
jLabel8.setText("-");
jLabel2.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel2.setText("Username : ");
jLabel9.setText("-");
jLabel3.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel3.setText("Name : ");
jLabel10.setText("-");
jLabel4.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel4.setText("Contact : ");
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel4)
.addComponent(jLabel3)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1)
.addComponent(jLabel5))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, 117, Short.MAX_VALUE)
.addComponent(jLabel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel9, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel10, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(jLabel6))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(jLabel8))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(jLabel9))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel10))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jButton3.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jButton3.setText("Delete");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, 203, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 272, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton3)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
String tipe = jComboBox1.getSelectedItem().toString();
if(jTextField1.getText().equals("")) {
JOptionPane.showMessageDialog(this, "Fill username!");
return;
}
if(jTextField2.getText().equals("")) {
JOptionPane.showMessageDialog(this, "Fill name!");
return;
}
if(new String(jPasswordField1.getText()).equals("")) {
JOptionPane.showMessageDialog(this, "Fill password!");
return;
}
if(jTextField2.getText().equals("")) {
JOptionPane.showMessageDialog(this, "Fill contact!");
return;
}
switch(tipe) {
case "Employee" :
tipe = "karyawan";
break;
case "Admin" :
tipe = "admin";
break;
default :
JOptionPane.showMessageDialog(new JFrame(), "Please choose user's type!");
return;
}
JOptionPane.showMessageDialog(null, "Added new user!");
dbm.saveAdmin(
jTextField2.getText(),
jTextField3.getText(),
jTextField1.getText(),
new String(jPasswordField1.getPassword()),
tipe);
model = (DefaultTableModel) jTable1.getModel();
model.setRowCount(0);
adminList = dbm.fetchAdmin();
// Add all the current list admin into the table
for(int i = 0; i < adminList.size(); i++) {
model.addRow(new Object[] {
adminList.get(i).id_admin,
adminList.get(i).username,
adminList.get(i).name,
adminList.get(i).kontak,
adminList.get(i).tipe
});
}
// Show information user admin
if(dbm.admin != null) {
jLabel6.setText(String.valueOf(dbm.admin.id_admin));
jLabel7.setText(dbm.admin.username);
jLabel8.setText(dbm.admin.name);
jLabel9.setText(dbm.admin.kontak);
jLabel10.setText(dbm.admin.tipe);
}
// Check type of admin and enable user creation if admin
if(dbm.admin != null && !dbm.admin.tipe.equals("admin")) {
for (Component cp : jPanel3.getComponents() ){
cp.setEnabled(false);
}
}
}//GEN-LAST:event_jButton2ActionPerformed
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
// TODO add your handling code here:
Index = jTable1.getSelectedRow();
int option = JOptionPane.showConfirmDialog(null, "Yakin ingin menghapus data ini?", "Konfirmasi", JOptionPane.YES_NO_OPTION);
if (option == JOptionPane.YES_OPTION){
long id_admin = adminList.get(Index).id_admin;
dbm.delAdmin(id_admin);
/* refresh table pake trik close/open window awikwok
dispose();
new UserWindow().setVisible(true); */
// refresh table
model = (DefaultTableModel) jTable1.getModel();
model.setRowCount(0);
adminList = dbm.fetchAdmin();
// Add all the current list admin into the table
for(int i = 0; i < adminList.size(); i++) {
model.addRow(new Object[] {
adminList.get(i).id_admin,
adminList.get(i).username,
adminList.get(i).name,
adminList.get(i).kontak,
adminList.get(i).tipe
});
}
}
}//GEN-LAST:event_jButton3ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
UIManager.setLookAndFeel( new FlatLightLaf() );
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(MainWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new UserWindow().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JComboBox<String> jComboBox1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel16;
private javax.swing.JLabel jLabel17;
private javax.swing.JLabel jLabel18;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel20;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPasswordField jPasswordField1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable jTable1;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField2;
private javax.swing.JTextField jTextField3;
// End of variables declaration//GEN-END:variables
}
| 23,215 | 0.619599 | 0.604092 | 482 | 47.163902 | 35.720562 | 169 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.692946 | false | false |
7
|
eb9a347aa55c0632785da8c606478681d82fa80d
| 23,347,442,221,682 |
6287052d88e5ddb9cddd35ace0a152de3e5aa9de
|
/src/com/mtls/project56/rest/ProfileActivity.java
|
6b937c53b9cf6423fd15f0c3f73d56dd0f38feb8
|
[] |
no_license
|
tolgap/social-tunnel
|
https://github.com/tolgap/social-tunnel
|
20b779d6fa30918889cdf63a0ba6b8d42e285ad5
|
9cec4cd0206b87818e7a4dd100c40d6e8e6be723
|
refs/heads/master
| 2016-08-05T19:32:28.152000 | 2013-01-28T13:23:08 | 2013-01-28T13:23:08 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.mtls.project56.rest;
import java.util.List;
import android.app.Activity;
import android.content.Intent;
import android.content.res.Configuration;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import com.mtls.project56.R;
import com.mtls.project56.TraceAdapter;
import com.mtls.project56.pojo.Post;
import com.mtls.project56.pojo.Response;
import com.mtls.project56.pojo.User;
import com.octo.android.robospice.SpiceManager;
import com.octo.android.robospice.persistence.exception.SpiceException;
import com.octo.android.robospice.request.listener.RequestListener;
public class ProfileActivity extends Activity {
User user;
List<Post> traces;
ListView view;
ProgressBar progress;
SpiceManager spiceManager = new SpiceManager(RestService.class);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
user = getIntent().getParcelableExtra("user");
progress = new ProgressBar(this);
view = new ListView(this);
setContentView(progress);
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
}
@Override
protected void onStart() {
super.onStart();
spiceManager.start(this);
}
@Override
protected void onStop() {
spiceManager.shouldStop();
super.onStop();
}
@Override
protected void onPause() {
super.onPause();
}
@Override
protected void onResume() {
super.onResume();
getActionBar().setDisplayHomeAsUpEnabled(true);
spiceManager.execute(new ProfileRequest(user),
new ProfileRequestListener());
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
// This is called when the Home (Up) button is pressed
// in the Action Bar.
Intent parentActivityIntent = new Intent(this, TraceActivity.class);
parentActivityIntent.putExtra("user", user);
parentActivityIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP
| Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(parentActivityIntent);
finish();
return true;
}
return super.onOptionsItemSelected(item);
}
private void setUserInformation(View header, Response response) {
TextView username = (TextView) header.findViewById(R.id.profile_username);
username.setText(response.getProfile().getUsername() + "'s profile");
TextView firstname = (TextView) header.findViewById(R.id.profile_first_name);
if(response.getProfile().getInformation() != null) {
firstname.setText("First name: " + response.getProfile().getInformation().getFirst_name());
TextView lastname = (TextView) header.findViewById(R.id.profile_last_name);
lastname.setText("Last name: " + response.getProfile().getInformation().getLast_name());
TextView country = (TextView) header.findViewById(R.id.profile_country);
country.setText("Country: " + response.getProfile().getInformation().getLand());
TextView city = (TextView) header.findViewById(R.id.profile_city);
city.setText("City: " + response.getProfile().getInformation().getTown());
TextView address = (TextView) header.findViewById(R.id.profile_address);
address.setText("Address: " + response.getProfile().getInformation().getAdress());
TextView workplace = (TextView) header.findViewById(R.id.profile_workplace);
workplace.setText("Workplace: " + response.getProfile().getInformation().getWorkplace());
TextView age = (TextView) header.findViewById(R.id.profile_age);
age.setText("Age: " + response.getProfile().getInformation().getAge());
}
}
public class ProfileRequestListener implements RequestListener<Response> {
@Override
public void onRequestFailure(SpiceException exception) {
Toast.makeText(getApplicationContext(),
"Can't load profile, are you logged in?",
Toast.LENGTH_LONG).show();
}
@Override
public void onRequestSuccess(Response response) {
traces = response.getTraces();
TraceAdapter adapter = new TraceAdapter(ProfileActivity.this, 0,
traces);
View header = LayoutInflater.from(ProfileActivity.this).inflate(
R.layout.user_information, null);
setUserInformation(header, response);
view.addHeaderView(header);
view.setAdapter(adapter);
setContentView(view);
}
}
}
|
UTF-8
|
Java
| 4,450 |
java
|
ProfileActivity.java
|
Java
|
[] | null |
[] |
package com.mtls.project56.rest;
import java.util.List;
import android.app.Activity;
import android.content.Intent;
import android.content.res.Configuration;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import com.mtls.project56.R;
import com.mtls.project56.TraceAdapter;
import com.mtls.project56.pojo.Post;
import com.mtls.project56.pojo.Response;
import com.mtls.project56.pojo.User;
import com.octo.android.robospice.SpiceManager;
import com.octo.android.robospice.persistence.exception.SpiceException;
import com.octo.android.robospice.request.listener.RequestListener;
public class ProfileActivity extends Activity {
User user;
List<Post> traces;
ListView view;
ProgressBar progress;
SpiceManager spiceManager = new SpiceManager(RestService.class);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
user = getIntent().getParcelableExtra("user");
progress = new ProgressBar(this);
view = new ListView(this);
setContentView(progress);
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
}
@Override
protected void onStart() {
super.onStart();
spiceManager.start(this);
}
@Override
protected void onStop() {
spiceManager.shouldStop();
super.onStop();
}
@Override
protected void onPause() {
super.onPause();
}
@Override
protected void onResume() {
super.onResume();
getActionBar().setDisplayHomeAsUpEnabled(true);
spiceManager.execute(new ProfileRequest(user),
new ProfileRequestListener());
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
// This is called when the Home (Up) button is pressed
// in the Action Bar.
Intent parentActivityIntent = new Intent(this, TraceActivity.class);
parentActivityIntent.putExtra("user", user);
parentActivityIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP
| Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(parentActivityIntent);
finish();
return true;
}
return super.onOptionsItemSelected(item);
}
private void setUserInformation(View header, Response response) {
TextView username = (TextView) header.findViewById(R.id.profile_username);
username.setText(response.getProfile().getUsername() + "'s profile");
TextView firstname = (TextView) header.findViewById(R.id.profile_first_name);
if(response.getProfile().getInformation() != null) {
firstname.setText("First name: " + response.getProfile().getInformation().getFirst_name());
TextView lastname = (TextView) header.findViewById(R.id.profile_last_name);
lastname.setText("Last name: " + response.getProfile().getInformation().getLast_name());
TextView country = (TextView) header.findViewById(R.id.profile_country);
country.setText("Country: " + response.getProfile().getInformation().getLand());
TextView city = (TextView) header.findViewById(R.id.profile_city);
city.setText("City: " + response.getProfile().getInformation().getTown());
TextView address = (TextView) header.findViewById(R.id.profile_address);
address.setText("Address: " + response.getProfile().getInformation().getAdress());
TextView workplace = (TextView) header.findViewById(R.id.profile_workplace);
workplace.setText("Workplace: " + response.getProfile().getInformation().getWorkplace());
TextView age = (TextView) header.findViewById(R.id.profile_age);
age.setText("Age: " + response.getProfile().getInformation().getAge());
}
}
public class ProfileRequestListener implements RequestListener<Response> {
@Override
public void onRequestFailure(SpiceException exception) {
Toast.makeText(getApplicationContext(),
"Can't load profile, are you logged in?",
Toast.LENGTH_LONG).show();
}
@Override
public void onRequestSuccess(Response response) {
traces = response.getTraces();
TraceAdapter adapter = new TraceAdapter(ProfileActivity.this, 0,
traces);
View header = LayoutInflater.from(ProfileActivity.this).inflate(
R.layout.user_information, null);
setUserInformation(header, response);
view.addHeaderView(header);
view.setAdapter(adapter);
setContentView(view);
}
}
}
| 4,450 | 0.751685 | 0.748764 | 140 | 30.785715 | 26.448275 | 94 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.1 | false | false |
7
|
6bad8da5337cfc0b095c38a57faf90da3cde477d
| 21,036,749,869,878 |
80f02232106708348595f15cb52dafc10b49bec7
|
/src/main/java/cn/allene/school/services/impl/ChildServiceImpl.java
|
cdb274be74ea20bdfd07feca32462aae40a40795
|
[] |
no_license
|
kkyv/school
|
https://github.com/kkyv/school
|
1786c73bccce6b35a50b239a9f110f470fa63a53
|
86bf445bd3fbfd7e09adc14420667311e29a9d3b
|
refs/heads/master
| 2021-01-25T13:40:35.563000 | 2018-05-04T02:25:42 | 2018-05-04T02:25:42 | 116,204,876 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package cn.allene.school.services.impl;
import cn.allene.school.dao.mapper.ChildMapper;
import cn.allene.school.po.Child;
import cn.allene.school.po.condition.ChildCondition;
import cn.allene.school.services.ChildService;
import org.springframework.stereotype.Service;
@Service
public class ChildServiceImpl extends BaseServiceImpl<Child, String, ChildCondition, ChildMapper> implements ChildService {
}
|
UTF-8
|
Java
| 407 |
java
|
ChildServiceImpl.java
|
Java
|
[] | null |
[] |
package cn.allene.school.services.impl;
import cn.allene.school.dao.mapper.ChildMapper;
import cn.allene.school.po.Child;
import cn.allene.school.po.condition.ChildCondition;
import cn.allene.school.services.ChildService;
import org.springframework.stereotype.Service;
@Service
public class ChildServiceImpl extends BaseServiceImpl<Child, String, ChildCondition, ChildMapper> implements ChildService {
}
| 407 | 0.835381 | 0.835381 | 12 | 32.916668 | 34.091686 | 123 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.75 | false | false |
7
|
a4d742804619ab2483ca5ce0bed781f81da36056
| 16,484,084,546,475 |
625824a13015be1ec7440effc2265de61d9f63b3
|
/src/cn/com/vivo/thread/TestLock.java
|
569370b478d6ef4fa9cf5b4d7d86f3e24b22eb20
|
[] |
no_license
|
dewenHuang/demo
|
https://github.com/dewenHuang/demo
|
92c94509291a179f0c76dc03782c73aeca737a75
|
63537ff5512cd86fa86877b9cab879e62cd0c6c9
|
refs/heads/master
| 2021-01-02T09:17:44.909000 | 2020-07-11T16:06:42 | 2020-07-11T16:06:42 | 99,184,639 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package cn.com.vivo.thread;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
/**
* @project: java-app
* @description: 测试同步锁
*
* 一、用于解决多线程安全问题的方式:
* 隐式锁
* 1.同步代码块
* 2.同步方法
*
* 显示锁(JDK1.5之后)
* 3.同步锁,需要通过lock()方法上锁,通过unlock()方法解锁
*
* @author: huangdw
* @create: 2018-10-09 14:58
*/
public class TestLock {
public static void main(String[] args) {
Ticket ticket = new Ticket();
new Thread(ticket, "1号窗口").start();
new Thread(ticket, "2号窗口").start();
new Thread(ticket, "3号窗口").start();
}
}
class Ticket implements Runnable {
private int tick = 100;// 共享变量
private Lock lock = new ReentrantLock();// 同步锁,默认非公平锁,参数传true就是公平锁了
@Override
public void run() {
while (true) {
lock.lock();// 每次循环都获取锁
try {
if (tick > 0) {// 读,第一次访问共享变量前加锁
try {
Thread.sleep(50);// 模拟售票操作
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println(Thread.currentThread().getName() + "完成售票,余票为:" + --tick);// 写
} else {
break;
}
} finally {
lock.unlock();// 每次循环都释放锁
}
}
}
}
|
UTF-8
|
Java
| 1,705 |
java
|
TestLock.java
|
Java
|
[
{
"context": "3.同步锁,需要通过lock()方法上锁,通过unlock()方法解锁\n *\n * @author: huangdw\n * @create: 2018-10-09 14:58\n */\npublic class Tes",
"end": 368,
"score": 0.9996994137763977,
"start": 361,
"tag": "USERNAME",
"value": "huangdw"
}
] | null |
[] |
package cn.com.vivo.thread;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
/**
* @project: java-app
* @description: 测试同步锁
*
* 一、用于解决多线程安全问题的方式:
* 隐式锁
* 1.同步代码块
* 2.同步方法
*
* 显示锁(JDK1.5之后)
* 3.同步锁,需要通过lock()方法上锁,通过unlock()方法解锁
*
* @author: huangdw
* @create: 2018-10-09 14:58
*/
public class TestLock {
public static void main(String[] args) {
Ticket ticket = new Ticket();
new Thread(ticket, "1号窗口").start();
new Thread(ticket, "2号窗口").start();
new Thread(ticket, "3号窗口").start();
}
}
class Ticket implements Runnable {
private int tick = 100;// 共享变量
private Lock lock = new ReentrantLock();// 同步锁,默认非公平锁,参数传true就是公平锁了
@Override
public void run() {
while (true) {
lock.lock();// 每次循环都获取锁
try {
if (tick > 0) {// 读,第一次访问共享变量前加锁
try {
Thread.sleep(50);// 模拟售票操作
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println(Thread.currentThread().getName() + "完成售票,余票为:" + --tick);// 写
} else {
break;
}
} finally {
lock.unlock();// 每次循环都释放锁
}
}
}
}
| 1,705 | 0.514366 | 0.496146 | 57 | 24.035088 | 20.235426 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false |
7
|
ff9296e264f152bd859e5c6ef631541adb99f4e9
| 34,591,666,620,478 |
0a4598de6f14972504e0a5a398efe21b5028b696
|
/src/main/java/com/example/cinema/bl/sales/RefundStrategyService.java
|
7fb1811815abc83e4405fe38e70575431b3d09f3
|
[] |
no_license
|
hddFelicidad/new67
|
https://github.com/hddFelicidad/new67
|
3a7130d4ac02883b60242d053bbea1305e41cc8b
|
aa46a02f2f80c646f882bb091c40f053e7c30450
|
refs/heads/master
| 2020-05-25T19:29:07.291000 | 2019-05-31T01:05:20 | 2019-06-20T02:29:06 | 187,951,933 | 0 | 0 | null | false | 2019-10-31T15:00:38 | 2019-05-22T02:55:26 | 2019-06-20T02:30:54 | 2019-10-31T15:00:37 | 2,096 | 0 | 0 | 1 |
HTML
| false | false |
package com.example.cinema.bl.sales;
import com.example.cinema.vo.RefundStrategyForm;
import com.example.cinema.vo.ResponseVO;
public interface RefundStrategyService {
ResponseVO getAllRefundStrategy();
ResponseVO getRefundStrategyById(int id);
ResponseVO addRefundStrategy( RefundStrategyForm refundStrategyForm);
ResponseVO updateRefundStrategy(RefundStrategyForm refundStrategyForm);
ResponseVO deleteRefundStrategyById(int id);
}
|
UTF-8
|
Java
| 461 |
java
|
RefundStrategyService.java
|
Java
|
[] | null |
[] |
package com.example.cinema.bl.sales;
import com.example.cinema.vo.RefundStrategyForm;
import com.example.cinema.vo.ResponseVO;
public interface RefundStrategyService {
ResponseVO getAllRefundStrategy();
ResponseVO getRefundStrategyById(int id);
ResponseVO addRefundStrategy( RefundStrategyForm refundStrategyForm);
ResponseVO updateRefundStrategy(RefundStrategyForm refundStrategyForm);
ResponseVO deleteRefundStrategyById(int id);
}
| 461 | 0.815618 | 0.815618 | 17 | 26.117647 | 26.492802 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.470588 | false | false |
7
|
8f149a9a677d40604ba0d0a27bf4de82ef5b6d1f
| 27,376,121,585,168 |
d2d5cddcea7353eebfc4e7e3c4f2c0614d124a8e
|
/Ch2/src/test/java/edu/sua/bjee7/Ch2/BookServiceIT.java
|
e8d9f6c1dc076c583e9fcd50e5f7c0fb2c3a558c
|
[] |
no_license
|
SuvorovJA/BJEE7
|
https://github.com/SuvorovJA/BJEE7
|
509c3194935f21cb26236a90dc2c2598196b5d79
|
e158005fc8803e4b1dbe96968da8a6296d4dd41a
|
refs/heads/master
| 2018-10-20T17:00:20.595000 | 2018-10-05T13:55:08 | 2018-10-05T13:55:08 | 141,175,584 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package edu.sua.bjee7.Ch2;
import static org.junit.Assert.assertTrue;
import org.jboss.weld.environment.se.Weld;
import org.jboss.weld.environment.se.WeldContainer;
import org.junit.Ignore;
import org.junit.Test;
// TODO после добавления CH3 появилась такая решрессия при старте WELD в этом тесте
/*Running edu.sua.bjee7.Ch2.BookServiceIT
июл 20, 2018 11:36:25 PM org.jboss.weld.bootstrap.WeldStartup <clinit>
INFO: WELD-000900: 2.4.7 (Final)
июл 20, 2018 11:36:25 PM org.jboss.weld.bootstrap.WeldStartup startContainer
INFO: WELD-000101: Transactional services not available. Injection of @Inject UserTransaction not available. Transactional observers will be invoked synchronously.
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.463 sec <<< FAILURE!
shouldCheckNumberIsMOCK(edu.sua.bjee7.Ch2.BookServiceIT) Time elapsed: 0.462 sec <<< ERROR!
org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type IZipChecker with qualifiers @USA @ZipChecker
at injection point [BackedAnnotatedField] @Inject @USA @ZipChecker private edu.sua.bjee7.Ch3.Validation.ZipCodeValidator.checker
at edu.sua.bjee7.Ch3.Validation.ZipCodeValidator.checker(ZipCodeValidator.java:0)
WELD-001475: The following beans match by type, but none have matching qualifiers:
- Managed Bean [class edu.sua.bjee7.Ch3.Validation.ZipCodeChecker] with qualifiers [@ZipChecker @Any]*/
public class BookServiceIT {
@Ignore
@Test
public void shouldCheckNumberIsMOCK() {
Weld weld = new Weld();
WeldContainer container = weld.initialize();
@SuppressWarnings("deprecation")
BookService bookService = container.instance().select(BookService.class).get();
Book book = bookService.createBook("H2G2", 12.5f, "Интересная книга на тему высоких технологий");
System.out.println(book.toString());
assertTrue(book.getNumber().startsWith("MOCK"));
weld.shutdown();
}
}
|
UTF-8
|
Java
| 2,004 |
java
|
BookServiceIT.java
|
Java
|
[] | null |
[] |
package edu.sua.bjee7.Ch2;
import static org.junit.Assert.assertTrue;
import org.jboss.weld.environment.se.Weld;
import org.jboss.weld.environment.se.WeldContainer;
import org.junit.Ignore;
import org.junit.Test;
// TODO после добавления CH3 появилась такая решрессия при старте WELD в этом тесте
/*Running edu.sua.bjee7.Ch2.BookServiceIT
июл 20, 2018 11:36:25 PM org.jboss.weld.bootstrap.WeldStartup <clinit>
INFO: WELD-000900: 2.4.7 (Final)
июл 20, 2018 11:36:25 PM org.jboss.weld.bootstrap.WeldStartup startContainer
INFO: WELD-000101: Transactional services not available. Injection of @Inject UserTransaction not available. Transactional observers will be invoked synchronously.
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.463 sec <<< FAILURE!
shouldCheckNumberIsMOCK(edu.sua.bjee7.Ch2.BookServiceIT) Time elapsed: 0.462 sec <<< ERROR!
org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type IZipChecker with qualifiers @USA @ZipChecker
at injection point [BackedAnnotatedField] @Inject @USA @ZipChecker private edu.sua.bjee7.Ch3.Validation.ZipCodeValidator.checker
at edu.sua.bjee7.Ch3.Validation.ZipCodeValidator.checker(ZipCodeValidator.java:0)
WELD-001475: The following beans match by type, but none have matching qualifiers:
- Managed Bean [class edu.sua.bjee7.Ch3.Validation.ZipCodeChecker] with qualifiers [@ZipChecker @Any]*/
public class BookServiceIT {
@Ignore
@Test
public void shouldCheckNumberIsMOCK() {
Weld weld = new Weld();
WeldContainer container = weld.initialize();
@SuppressWarnings("deprecation")
BookService bookService = container.instance().select(BookService.class).get();
Book book = bookService.createBook("H2G2", 12.5f, "Интересная книга на тему высоких технологий");
System.out.println(book.toString());
assertTrue(book.getNumber().startsWith("MOCK"));
weld.shutdown();
}
}
| 2,004 | 0.784551 | 0.741461 | 38 | 49.078949 | 41.931889 | 163 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.105263 | false | false |
7
|
a909118206769c3eb9b32fdf6a798ada10c8a069
| 25,692,494,390,559 |
f02a88db1779ce4249d296373eb7019604d6f666
|
/apertium-scripts/ApertiumPhraseGenerator/src/main/java/es/ua/dlsi/hybridmt/apertiumphrasegenerator/NGramTrie.java
|
670fe0b33452fb5e0999abed78f6d8deb76c9453
|
[] |
no_license
|
vitaka/rule2phrase
|
https://github.com/vitaka/rule2phrase
|
ddf64a4bca12d77f2251af3d9a7609495d632033
|
2a7f40e5d083199016c5045d7fe2791d33d89168
|
refs/heads/master
| 2016-09-13T14:54:37.565000 | 2016-04-28T14:15:14 | 2016-04-28T14:15:14 | 57,306,432 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package es.ua.dlsi.hybridmt.apertiumphrasegenerator;
import es.ua.dlsi.hybridmt.apertiumphrasegenerator.trie.Trie;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
/**
*
* @author vmsanchez
*/
public class NGramTrie {
private Trie<String> trie;
public NGramTrie() {
trie = new Trie<String>("");
}
public boolean isNGram(List<String> ngram)
{
List<String> checkList= new ArrayList<String>();
for (String s: ngram )
checkList.add(Util.lowercaseApertiumWord(s));
return trie.isElement(checkList);
}
public boolean isInvalidNGram(List<String> accsource, int maxn) {
NGramTrie filterTrie=this;
for (int j = 0; j <= (accsource.size() - maxn); j++) {
if (!filterTrie.isNGram(accsource.subList(j, j + maxn))) {
return true;
}
}
if (accsource.size() < maxn) {
//for(int j=2; j<maxn; j++)
//{
if (!filterTrie.isNGram(accsource)) {
return true;
}
//}
}
return false;
}
public void loadFromFile(File f)
{
String line;
BufferedReader reader=null;
try
{
reader=new BufferedReader(new InputStreamReader(new FileInputStream(f),Charset.forName("UTF-8") ));
while((line=reader.readLine())!=null)
{
processLine(line);
}
}
catch(Exception e)
{
e.printStackTrace();
}
finally
{
if(reader!=null)
try{
reader.close();
}catch(Exception e){}
}
}
private void processLine(String line) {
String ngramsStr=null;
if(line.matches("^\\dGRAM.*"))
{
ngramsStr=line.substring("GRAM".length()+1);
}
/*
if (line.startsWith("BIGRAM"))
ngramsStr=line.substring("BIGRAM".length());
else if (line.startsWith("TRIGRAM"))
ngramsStr=line.substring("TRIGRAM".length());
*
*/
if(ngramsStr!=null)
{
String[] ngramsArray= ngramsStr.split("---");
List<String> ngramsList = new LinkedList<String>();
boolean containsNullOrUnknown=false;
for(String word: ngramsArray)
{
word=word.trim();
if("NULL".equals(word) || word.startsWith("^*"))
{
containsNullOrUnknown=true;
break;
}
ngramsList.add(Util.lowercaseApertiumWord(word));
}
if(!containsNullOrUnknown)
{
//debug
/*
for(String ng: ngramsList)
{
System.err.print(ng);
System.err.print(" ");
}
System.err.println();
*/
trie.insertElement(ngramsList);
}
}
}
}
|
UTF-8
|
Java
| 3,398 |
java
|
NGramTrie.java
|
Java
|
[
{
"context": "kedList;\nimport java.util.List;\n\n/**\n *\n * @author vmsanchez\n */\npublic class NGramTrie {\n private Trie<Str",
"end": 476,
"score": 0.9986698031425476,
"start": 467,
"tag": "USERNAME",
"value": "vmsanchez"
}
] | null |
[] |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package es.ua.dlsi.hybridmt.apertiumphrasegenerator;
import es.ua.dlsi.hybridmt.apertiumphrasegenerator.trie.Trie;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
/**
*
* @author vmsanchez
*/
public class NGramTrie {
private Trie<String> trie;
public NGramTrie() {
trie = new Trie<String>("");
}
public boolean isNGram(List<String> ngram)
{
List<String> checkList= new ArrayList<String>();
for (String s: ngram )
checkList.add(Util.lowercaseApertiumWord(s));
return trie.isElement(checkList);
}
public boolean isInvalidNGram(List<String> accsource, int maxn) {
NGramTrie filterTrie=this;
for (int j = 0; j <= (accsource.size() - maxn); j++) {
if (!filterTrie.isNGram(accsource.subList(j, j + maxn))) {
return true;
}
}
if (accsource.size() < maxn) {
//for(int j=2; j<maxn; j++)
//{
if (!filterTrie.isNGram(accsource)) {
return true;
}
//}
}
return false;
}
public void loadFromFile(File f)
{
String line;
BufferedReader reader=null;
try
{
reader=new BufferedReader(new InputStreamReader(new FileInputStream(f),Charset.forName("UTF-8") ));
while((line=reader.readLine())!=null)
{
processLine(line);
}
}
catch(Exception e)
{
e.printStackTrace();
}
finally
{
if(reader!=null)
try{
reader.close();
}catch(Exception e){}
}
}
private void processLine(String line) {
String ngramsStr=null;
if(line.matches("^\\dGRAM.*"))
{
ngramsStr=line.substring("GRAM".length()+1);
}
/*
if (line.startsWith("BIGRAM"))
ngramsStr=line.substring("BIGRAM".length());
else if (line.startsWith("TRIGRAM"))
ngramsStr=line.substring("TRIGRAM".length());
*
*/
if(ngramsStr!=null)
{
String[] ngramsArray= ngramsStr.split("---");
List<String> ngramsList = new LinkedList<String>();
boolean containsNullOrUnknown=false;
for(String word: ngramsArray)
{
word=word.trim();
if("NULL".equals(word) || word.startsWith("^*"))
{
containsNullOrUnknown=true;
break;
}
ngramsList.add(Util.lowercaseApertiumWord(word));
}
if(!containsNullOrUnknown)
{
//debug
/*
for(String ng: ngramsList)
{
System.err.print(ng);
System.err.print(" ");
}
System.err.println();
*/
trie.insertElement(ngramsList);
}
}
}
}
| 3,398 | 0.499706 | 0.498529 | 128 | 25.546875 | 20.044428 | 107 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.398438 | false | false |
7
|
31d551fcc64f4186809b5074d3646c42b67185a3
| 5,171,140,677,767 |
8b2c9d9914939cadc99c6190706521be0cd577b9
|
/src/main/java/cc/mrbird/system/service/RegionService.java
|
b81c200feb4049765a8016b3c9d8ea6bac66469b
|
[
"Apache-2.0"
] |
permissive
|
iclockwork/febs
|
https://github.com/iclockwork/febs
|
a1c66f3aef265a5d5a3c940298052b2295c367bb
|
cc55cd2b034ba36c7b2e1dd75d4bf3042428d79a
|
refs/heads/master
| 2022-09-13T02:25:11.255000 | 2019-07-15T09:34:15 | 2019-07-15T09:34:15 | 170,794,507 | 1 | 0 | null | false | 2022-09-01T23:02:50 | 2019-02-15T03:11:55 | 2020-05-06T05:45:09 | 2022-09-01T23:02:48 | 8,447 | 1 | 0 | 8 |
Java
| false | false |
package cc.mrbird.system.service;
import cc.mrbird.common.service.IService;
import cc.mrbird.system.domain.Region;
import java.util.List;
/**
* RegionService
*
* @author: fengwang
* @date: 2019-02-19 15:59
* @version: 1.0
* @since: JDK 1.8
*/
public interface RegionService extends IService<Region> {
List<Region> findAll(Region region);
List<Region> regions(Region region);
}
|
UTF-8
|
Java
| 396 |
java
|
RegionService.java
|
Java
|
[
{
"context": "va.util.List;\n\n/**\n * RegionService\n *\n * @author: fengwang\n * @date: 2019-02-19 15:59\n * @version: 1.0\n * @s",
"end": 185,
"score": 0.9189698100090027,
"start": 177,
"tag": "USERNAME",
"value": "fengwang"
}
] | null |
[] |
package cc.mrbird.system.service;
import cc.mrbird.common.service.IService;
import cc.mrbird.system.domain.Region;
import java.util.List;
/**
* RegionService
*
* @author: fengwang
* @date: 2019-02-19 15:59
* @version: 1.0
* @since: JDK 1.8
*/
public interface RegionService extends IService<Region> {
List<Region> findAll(Region region);
List<Region> regions(Region region);
}
| 396 | 0.712121 | 0.671717 | 20 | 18.799999 | 17.33955 | 57 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.3 | false | false |
7
|
983b453c81d796a042de0694ed2464fcf62966c3
| 29,145,648,137,131 |
62d6970bc912f902a29b0e323c7c6158895f5f5a
|
/app/src/main/java/com/aj/socialImages/MainActivity.java
|
191c5bd1674877e65088080033f5b15bfa924582
|
[] |
no_license
|
freebumba27/SocalImages
|
https://github.com/freebumba27/SocalImages
|
3c74deebccf686c9fbebe6e62bf793560b3deee1
|
da7acdd284829068896e888202821edc76e9f1b7
|
refs/heads/master
| 2016-09-13T19:27:05.065000 | 2016-05-20T03:11:54 | 2016-05-20T03:11:54 | 59,260,989 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.aj.socialImages;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.Signature;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Base64;
import android.util.Log;
import android.view.View;
import android.widget.Toast;
import com.sromku.simple.fb.Permission;
import com.sromku.simple.fb.SimpleFacebook;
import com.sromku.simple.fb.entities.Profile;
import com.sromku.simple.fb.listeners.OnLoginListener;
import com.sromku.simple.fb.listeners.OnLogoutListener;
import com.sromku.simple.fb.listeners.OnProfileListener;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.List;
public class MainActivity extends AppCompatActivity {
private static final String TAG = "MainActivity";
private SimpleFacebook mSimpleFacebook;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//getHashKey();
}
private void getHashKey() {
try {
PackageInfo info = getBaseContext().getPackageManager().getPackageInfo(
getPackageName(),
PackageManager.GET_SIGNATURES);
for (Signature signature : info.signatures) {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
Log.d("KeyHash", "KeyHash:" + Base64.encodeToString(md.digest(),
Base64.DEFAULT));
Toast.makeText(getBaseContext().getApplicationContext(), Base64.encodeToString(md.digest(),
Base64.DEFAULT), Toast.LENGTH_LONG).show();
}
} catch (PackageManager.NameNotFoundException e) {
} catch (NoSuchAlgorithmException e) {
}
}
@Override
public void onResume() {
super.onResume();
mSimpleFacebook = SimpleFacebook.getInstance(this);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
mSimpleFacebook.onActivityResult(requestCode, resultCode, data);
super.onActivityResult(requestCode, resultCode, data);
}
OnLoginListener onLoginListener = new OnLoginListener() {
@Override
public void onException(Throwable throwable) {
}
@Override
public void onFail(String reason) {
}
@Override
public void onLogin(String accessToken, List<Permission> acceptedPermissions, List<Permission> declinedPermissions) {
// change the state of the button or do whatever you want
Log.i(TAG, "Logged in");
//mSimpleFacebook.getPhotos(onPhotosListener);
//mSimpleFacebook.getAlbums(onAlbumsListener);
Profile.Properties properties = new Profile.Properties.Builder()
.add(Profile.Properties.ID)
.add(Profile.Properties.NAME)
.add(Profile.Properties.FIRST_NAME)
.add(Profile.Properties.LAST_NAME)
.add(Profile.Properties.PICTURE)
.add(Profile.Properties.COVER)
.add(Profile.Properties.GENDER)
.add(Profile.Properties.BIRTHDAY)
.build();
mSimpleFacebook.getProfile(properties, onProfileListener);
}
@Override
public void onCancel() {
}
};
OnLogoutListener onLogoutListener = new OnLogoutListener() {
@Override
public void onLogout() {
Log.i(TAG, "You are logged out");
mSimpleFacebook.login(onLoginListener);
}
};
OnProfileListener onProfileListener = new OnProfileListener() {
@Override
public void onComplete(Profile response) {
super.onComplete(response);
Intent i = new Intent(MainActivity.this, ActivityFacebookImages.class);
i.putExtra("facebookId", response.getId());
startActivity(i);
}
@Override
public void onFail(String reason) {
super.onFail(reason);
}
@Override
public void onException(Throwable throwable) {
super.onException(throwable);
}
};
public void facebookLogin(View view) {
if (!mSimpleFacebook.isLogin())
mSimpleFacebook.login(onLoginListener);
else
mSimpleFacebook.logout(onLogoutListener);
}
}
|
UTF-8
|
Java
| 4,643 |
java
|
MainActivity.java
|
Java
|
[] | null |
[] |
package com.aj.socialImages;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.Signature;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Base64;
import android.util.Log;
import android.view.View;
import android.widget.Toast;
import com.sromku.simple.fb.Permission;
import com.sromku.simple.fb.SimpleFacebook;
import com.sromku.simple.fb.entities.Profile;
import com.sromku.simple.fb.listeners.OnLoginListener;
import com.sromku.simple.fb.listeners.OnLogoutListener;
import com.sromku.simple.fb.listeners.OnProfileListener;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.List;
public class MainActivity extends AppCompatActivity {
private static final String TAG = "MainActivity";
private SimpleFacebook mSimpleFacebook;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//getHashKey();
}
private void getHashKey() {
try {
PackageInfo info = getBaseContext().getPackageManager().getPackageInfo(
getPackageName(),
PackageManager.GET_SIGNATURES);
for (Signature signature : info.signatures) {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
Log.d("KeyHash", "KeyHash:" + Base64.encodeToString(md.digest(),
Base64.DEFAULT));
Toast.makeText(getBaseContext().getApplicationContext(), Base64.encodeToString(md.digest(),
Base64.DEFAULT), Toast.LENGTH_LONG).show();
}
} catch (PackageManager.NameNotFoundException e) {
} catch (NoSuchAlgorithmException e) {
}
}
@Override
public void onResume() {
super.onResume();
mSimpleFacebook = SimpleFacebook.getInstance(this);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
mSimpleFacebook.onActivityResult(requestCode, resultCode, data);
super.onActivityResult(requestCode, resultCode, data);
}
OnLoginListener onLoginListener = new OnLoginListener() {
@Override
public void onException(Throwable throwable) {
}
@Override
public void onFail(String reason) {
}
@Override
public void onLogin(String accessToken, List<Permission> acceptedPermissions, List<Permission> declinedPermissions) {
// change the state of the button or do whatever you want
Log.i(TAG, "Logged in");
//mSimpleFacebook.getPhotos(onPhotosListener);
//mSimpleFacebook.getAlbums(onAlbumsListener);
Profile.Properties properties = new Profile.Properties.Builder()
.add(Profile.Properties.ID)
.add(Profile.Properties.NAME)
.add(Profile.Properties.FIRST_NAME)
.add(Profile.Properties.LAST_NAME)
.add(Profile.Properties.PICTURE)
.add(Profile.Properties.COVER)
.add(Profile.Properties.GENDER)
.add(Profile.Properties.BIRTHDAY)
.build();
mSimpleFacebook.getProfile(properties, onProfileListener);
}
@Override
public void onCancel() {
}
};
OnLogoutListener onLogoutListener = new OnLogoutListener() {
@Override
public void onLogout() {
Log.i(TAG, "You are logged out");
mSimpleFacebook.login(onLoginListener);
}
};
OnProfileListener onProfileListener = new OnProfileListener() {
@Override
public void onComplete(Profile response) {
super.onComplete(response);
Intent i = new Intent(MainActivity.this, ActivityFacebookImages.class);
i.putExtra("facebookId", response.getId());
startActivity(i);
}
@Override
public void onFail(String reason) {
super.onFail(reason);
}
@Override
public void onException(Throwable throwable) {
super.onException(throwable);
}
};
public void facebookLogin(View view) {
if (!mSimpleFacebook.isLogin())
mSimpleFacebook.login(onLoginListener);
else
mSimpleFacebook.logout(onLogoutListener);
}
}
| 4,643 | 0.637303 | 0.634934 | 143 | 31.468531 | 25.954992 | 125 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.496504 | false | false |
7
|
ca7dbb7a4bf7dafc715988678474a5e1cec09dae
| 5,471,788,357,519 |
f8cf51eb4f81ed2b40834d73b165c2c8062873cb
|
/switch-cloud/switch-cloud-manageport/src/main/java/com/windaka/suizhi/manageport/service/impl/HouseRoomServiceImpl.java
|
2fdd6dd6f7f2af0e11285f36d4b871c6298208e8
|
[] |
no_license
|
wujianjun789/oldGongan
|
https://github.com/wujianjun789/oldGongan
|
646bd5b22e0d9382cf6ee2a0941035d99f9aa961
|
8d85b827d8829e3923db174a8f3a867d73547db1
|
refs/heads/master
| 2022-10-24T16:09:01.324000 | 2020-06-09T08:22:45 | 2020-06-09T08:22:45 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.windaka.suizhi.manageport.service.impl;
import com.windaka.suizhi.api.common.ReturnConstants;
import com.windaka.suizhi.common.exception.OssRenderException;
import com.windaka.suizhi.common.utils.SqlFileUtil;
import com.windaka.suizhi.manageport.dao.HouseRoomDao;
import com.windaka.suizhi.manageport.service.HouseRoomService;
import com.windaka.suizhi.manageport.util.SqlCreateUtil;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.omg.CORBA.OBJ_ADAPTER;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.IOException;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@Service
public class HouseRoomServiceImpl implements HouseRoomService {
@Autowired
HouseRoomDao houseRoomDao;
@Override
@Transactional(rollbackFor = Exception.class)
public void saveHouseRooms(Map<String, Object> params) throws OssRenderException, IOException {
String xqCode=(String)params.get("xqCode");
if(StringUtils.isBlank(xqCode)){
throw new OssRenderException(ReturnConstants.CODE_FAILED,"小区Code不能为空");
}
List<Map<String,Object>> list=(List<Map<String,Object>>) params.get("list");
if(CollectionUtils.isEmpty(list)){
throw new OssRenderException(ReturnConstants.CODE_FAILED,"数据为空");
}
houseRoomDao.saveHouseRooms(xqCode,list);
String []keyNames={"xqCode","manageId", "cellId", "code",
"name", "houseTypeCode", "orientationCode", "func", "funcName",
"decorationNum", "useArea", "buildingAre", "remark", "atticArea",
"storageArea", "floorNum", "arrearage", "propertyType", "rent",
"length", "width", "purpose",
"purposeName", "subordinateCell", "isSaled", "isRented", "saleContractNo",
"rentContractNo", "coefficient", "status", "createBy", "createDate",
"updateBy", "updateDate" , "remarks", "decorationTime", "housePropertyCardNo",
"subscribeNo", "isPayMaintenanceFund", "preMaintenanceFund"};
String []keyValues=new String[keyNames.length];
for(Map<String,Object> map:list){
map.put("xqCode",xqCode);
for(int i=0;i<keyNames.length;i++){
keyValues[i]=SqlFileUtil.keyAddValue(map,keyNames[i]);
}
String saveHouseRooms="insert into house_room (xq_code,manage_id,\n" +
" `cell_id` ,\n" +
" `code` ,\n" +
" `name` ,\n" +
" `house_type_code` ,\n" +
" `orientation_code` ,\n" +
" `func` ,\n" +
" `func_name` ,\n" +
" `decoration_num` ,\n" +
" `use_area` ,\n" +
" `building_area` ,\n" +
" `remark` ,\n" +
" `attic_area` ,\n" +
" `storage_area` ,\n" +
" `floor_num` ,\n" +
" `arrearage` ,\n" +
" `property_type` ,\n" +
" `rent` ,\n" +
" `length` ,\n" +
" `width` ,\n" +
" `purpose` ,\n" +
" `purpose_name` ,\n" +
" `subordinate_cell` ,\n" +
" `is_saled` ,\n" +
" `is_rented` ,\n" +
" `sale_contract_no` ,\n" +
" `rent_contract_no` ,\n" +
" `coefficient` ,\n" +
" `status` ,\n" +
" `create_by` ,\n" +
" `create_date` ,\n" +
" `update_by`,\n" +
" `update_date` ,\n" +
" `remarks` ,\n" +
" `decoration_time` ,\n" +
" `house_property_card_no` ,\n" +
" `subscribe_no` ,\n" +
" `is_pay_maintenance_fund`,\n" +
" `pre_maintenance_fund`\n" +
" )\n" +
" values(";
for(int i=0;i<keyNames.length;i++){
if (i==keyNames.length-1){
saveHouseRooms+=keyValues[i]+")";
}
else {
saveHouseRooms+=keyValues[i]+",";
}
}
SqlFileUtil.InsertSqlToFile(saveHouseRooms);
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void updateHouseRoom(Map<String, Object> params) throws OssRenderException, IOException {
houseRoomDao.updateHouseRoom(params);
String updateHouseRoom= SqlCreateUtil.getSqlByMybatis(HouseRoomDao.class.getName()+".updateHouseRoom",params);
SqlFileUtil.InsertSqlToFile(updateHouseRoom);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteHouseRoom(Map<String, Object> params) throws OssRenderException, IOException {
houseRoomDao.deleteHouseRoom(params);
String deleteHouseRoom= SqlCreateUtil.getSqlByMybatis(HouseRoomDao.class.getName()+".deleteHouseRoom",params);
SqlFileUtil.InsertSqlToFile(deleteHouseRoom);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void saveHouseRoomRentRecord(Map<String, Object> params) throws OssRenderException, IOException {
String xqCode=(String)params.get("xqCode");
if(StringUtils.isBlank(xqCode)){
throw new OssRenderException(ReturnConstants.CODE_FAILED,"小区Code不能为空");
}
houseRoomDao.saveHouseRoomRentRecord(params);
String sqlContent= SqlCreateUtil.getSqlByMybatis(HouseRoomDao.class.getName()+".saveHouseRoomRentRecord",params);
SqlFileUtil.InsertSqlToFile(sqlContent);
}
}
|
UTF-8
|
Java
| 6,285 |
java
|
HouseRoomServiceImpl.java
|
Java
|
[] | null |
[] |
package com.windaka.suizhi.manageport.service.impl;
import com.windaka.suizhi.api.common.ReturnConstants;
import com.windaka.suizhi.common.exception.OssRenderException;
import com.windaka.suizhi.common.utils.SqlFileUtil;
import com.windaka.suizhi.manageport.dao.HouseRoomDao;
import com.windaka.suizhi.manageport.service.HouseRoomService;
import com.windaka.suizhi.manageport.util.SqlCreateUtil;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.omg.CORBA.OBJ_ADAPTER;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.IOException;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@Service
public class HouseRoomServiceImpl implements HouseRoomService {
@Autowired
HouseRoomDao houseRoomDao;
@Override
@Transactional(rollbackFor = Exception.class)
public void saveHouseRooms(Map<String, Object> params) throws OssRenderException, IOException {
String xqCode=(String)params.get("xqCode");
if(StringUtils.isBlank(xqCode)){
throw new OssRenderException(ReturnConstants.CODE_FAILED,"小区Code不能为空");
}
List<Map<String,Object>> list=(List<Map<String,Object>>) params.get("list");
if(CollectionUtils.isEmpty(list)){
throw new OssRenderException(ReturnConstants.CODE_FAILED,"数据为空");
}
houseRoomDao.saveHouseRooms(xqCode,list);
String []keyNames={"xqCode","manageId", "cellId", "code",
"name", "houseTypeCode", "orientationCode", "func", "funcName",
"decorationNum", "useArea", "buildingAre", "remark", "atticArea",
"storageArea", "floorNum", "arrearage", "propertyType", "rent",
"length", "width", "purpose",
"purposeName", "subordinateCell", "isSaled", "isRented", "saleContractNo",
"rentContractNo", "coefficient", "status", "createBy", "createDate",
"updateBy", "updateDate" , "remarks", "decorationTime", "housePropertyCardNo",
"subscribeNo", "isPayMaintenanceFund", "preMaintenanceFund"};
String []keyValues=new String[keyNames.length];
for(Map<String,Object> map:list){
map.put("xqCode",xqCode);
for(int i=0;i<keyNames.length;i++){
keyValues[i]=SqlFileUtil.keyAddValue(map,keyNames[i]);
}
String saveHouseRooms="insert into house_room (xq_code,manage_id,\n" +
" `cell_id` ,\n" +
" `code` ,\n" +
" `name` ,\n" +
" `house_type_code` ,\n" +
" `orientation_code` ,\n" +
" `func` ,\n" +
" `func_name` ,\n" +
" `decoration_num` ,\n" +
" `use_area` ,\n" +
" `building_area` ,\n" +
" `remark` ,\n" +
" `attic_area` ,\n" +
" `storage_area` ,\n" +
" `floor_num` ,\n" +
" `arrearage` ,\n" +
" `property_type` ,\n" +
" `rent` ,\n" +
" `length` ,\n" +
" `width` ,\n" +
" `purpose` ,\n" +
" `purpose_name` ,\n" +
" `subordinate_cell` ,\n" +
" `is_saled` ,\n" +
" `is_rented` ,\n" +
" `sale_contract_no` ,\n" +
" `rent_contract_no` ,\n" +
" `coefficient` ,\n" +
" `status` ,\n" +
" `create_by` ,\n" +
" `create_date` ,\n" +
" `update_by`,\n" +
" `update_date` ,\n" +
" `remarks` ,\n" +
" `decoration_time` ,\n" +
" `house_property_card_no` ,\n" +
" `subscribe_no` ,\n" +
" `is_pay_maintenance_fund`,\n" +
" `pre_maintenance_fund`\n" +
" )\n" +
" values(";
for(int i=0;i<keyNames.length;i++){
if (i==keyNames.length-1){
saveHouseRooms+=keyValues[i]+")";
}
else {
saveHouseRooms+=keyValues[i]+",";
}
}
SqlFileUtil.InsertSqlToFile(saveHouseRooms);
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void updateHouseRoom(Map<String, Object> params) throws OssRenderException, IOException {
houseRoomDao.updateHouseRoom(params);
String updateHouseRoom= SqlCreateUtil.getSqlByMybatis(HouseRoomDao.class.getName()+".updateHouseRoom",params);
SqlFileUtil.InsertSqlToFile(updateHouseRoom);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteHouseRoom(Map<String, Object> params) throws OssRenderException, IOException {
houseRoomDao.deleteHouseRoom(params);
String deleteHouseRoom= SqlCreateUtil.getSqlByMybatis(HouseRoomDao.class.getName()+".deleteHouseRoom",params);
SqlFileUtil.InsertSqlToFile(deleteHouseRoom);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void saveHouseRoomRentRecord(Map<String, Object> params) throws OssRenderException, IOException {
String xqCode=(String)params.get("xqCode");
if(StringUtils.isBlank(xqCode)){
throw new OssRenderException(ReturnConstants.CODE_FAILED,"小区Code不能为空");
}
houseRoomDao.saveHouseRoomRentRecord(params);
String sqlContent= SqlCreateUtil.getSqlByMybatis(HouseRoomDao.class.getName()+".saveHouseRoomRentRecord",params);
SqlFileUtil.InsertSqlToFile(sqlContent);
}
}
| 6,285 | 0.544219 | 0.543579 | 141 | 43.347519 | 27.007219 | 121 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.035461 | false | false |
7
|
4fe0a6068c7b855edb49cfd62c90218d65d2add9
| 18,442,589,592,992 |
a08ab317d3e0fa99494fb78349927465ef53fb13
|
/Code for Semester 1 Java/BackwardsArray.java
|
0391f4dcd195a50db2743d05d82c199cc03e3883
|
[] |
no_license
|
RonanBehan26/University-Portfolio
|
https://github.com/RonanBehan26/University-Portfolio
|
d02a60984d0d6402e97a1696bd942f15d5a8a467
|
f2b5b0cac60e25b4fb77c481722c98f4594466cf
|
refs/heads/main
| 2023-06-14T14:49:43.850000 | 2021-07-07T12:07:33 | 2021-07-07T12:07:33 | 331,431,478 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
public class BackwardsArray{
//vars
private double[] nums;
//constructor
public BackwardsArray(){
nums=new double[6];
newNums=new double[nums.length];
}
//set - send over to instantiable
public void setNums(double[] nums){
this.nums=nums; //take array and put inside this array
}
//compute - in this case just reverse it
public void reverseArray(){
for(int i=0;i<nums.length;i++){
newNums[i]=nums[(nums.length-1)-i];
}
//get
public double[] getNums(){
return nums;
}
//setting and getting array as they are here
|
UTF-8
|
Java
| 562 |
java
|
BackwardsArray.java
|
Java
|
[] | null |
[] |
public class BackwardsArray{
//vars
private double[] nums;
//constructor
public BackwardsArray(){
nums=new double[6];
newNums=new double[nums.length];
}
//set - send over to instantiable
public void setNums(double[] nums){
this.nums=nums; //take array and put inside this array
}
//compute - in this case just reverse it
public void reverseArray(){
for(int i=0;i<nums.length;i++){
newNums[i]=nums[(nums.length-1)-i];
}
//get
public double[] getNums(){
return nums;
}
//setting and getting array as they are here
| 562 | 0.66548 | 0.660142 | 24 | 21.5 | 16.049402 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.416667 | false | false |
7
|
25d5f7c42c15ad79e4a5306e2d81767e9e778a9d
| 28,750,511,086,524 |
6f41781ede07b85747309f5f7eb6cfb0f3ebb6d7
|
/src/main/java/com/appspot/soundtricker/gaslibrarybox/model/Member.java
|
d5430666bd13f5a326487bdb2fc31565710d3460
|
[
"Apache-2.0"
] |
permissive
|
soundTricker/gas-library-box-server
|
https://github.com/soundTricker/gas-library-box-server
|
e2383a0e8adad83cd56dd1bbe3ab3ada56a1a242
|
3360be1ab4064b102d4325c018e66ea080c35b0f
|
refs/heads/master
| 2021-01-23T17:19:32.804000 | 2013-09-12T00:41:03 | 2013-09-12T00:41:03 | 12,175,138 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.appspot.soundtricker.gaslibrarybox.model;
import java.io.Serializable;
import java.util.Date;
import org.slim3.datastore.Attribute;
import org.slim3.datastore.CreationDate;
import org.slim3.datastore.Model;
import org.slim3.datastore.ModificationDate;
import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.users.User;
@Model(schemaVersion = 1)
public class Member implements Serializable {
private static final long serialVersionUID = 1L;
@Attribute(primaryKey = true)
private Key key;
@Attribute(version = true)
private Long version;
@Attribute(unindexed=true)
private User user;
@Attribute
private String nickname;
@Attribute(unindexed=true)
private String userIconUrl;
@Attribute(unindexed=true)
private String url;
@Attribute(listener=CreationDate.class)
private Date registeredAt;
@Attribute(listener=ModificationDate.class)
private Date modifitedAt;
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
Member other = (Member) obj;
if (key == null) {
if (other.key != null) {
return false;
}
} else if (!key.equals(other.key)) {
return false;
}
return true;
}
/**
* Returns the key.
*
* @return the key
*/
public Key getKey() {
return key;
}
public Date getModifitedAt() {
return modifitedAt;
}
public String getNickname() {
return nickname;
}
public Date getRegisteredAt() {
return registeredAt;
}
public String getUrl() {
return url;
}
public User getUser() {
return user;
}
public String getUserIconUrl() {
return userIconUrl;
}
/**
* Returns the version.
*
* @return the version
*/
public Long getVersion() {
return version;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((key == null) ? 0 : key.hashCode());
return result;
}
/**
* Sets the key.
*
* @param key
* the key
*/
public void setKey(Key key) {
this.key = key;
}
public void setModifitedAt(Date modifitedAt) {
this.modifitedAt = modifitedAt;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
public void setRegisteredAt(Date registeredAt) {
this.registeredAt = registeredAt;
}
public void setUrl(String url) {
this.url = url;
}
public void setUser(User user) {
this.user = user;
}
public void setUserIconUrl(String userIconUrl) {
this.userIconUrl = userIconUrl;
}
/**
* Sets the version.
*
* @param version
* the version
*/
public void setVersion(Long version) {
this.version = version;
}
}
|
UTF-8
|
Java
| 3,235 |
java
|
Member.java
|
Java
|
[] | null |
[] |
package com.appspot.soundtricker.gaslibrarybox.model;
import java.io.Serializable;
import java.util.Date;
import org.slim3.datastore.Attribute;
import org.slim3.datastore.CreationDate;
import org.slim3.datastore.Model;
import org.slim3.datastore.ModificationDate;
import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.users.User;
@Model(schemaVersion = 1)
public class Member implements Serializable {
private static final long serialVersionUID = 1L;
@Attribute(primaryKey = true)
private Key key;
@Attribute(version = true)
private Long version;
@Attribute(unindexed=true)
private User user;
@Attribute
private String nickname;
@Attribute(unindexed=true)
private String userIconUrl;
@Attribute(unindexed=true)
private String url;
@Attribute(listener=CreationDate.class)
private Date registeredAt;
@Attribute(listener=ModificationDate.class)
private Date modifitedAt;
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
Member other = (Member) obj;
if (key == null) {
if (other.key != null) {
return false;
}
} else if (!key.equals(other.key)) {
return false;
}
return true;
}
/**
* Returns the key.
*
* @return the key
*/
public Key getKey() {
return key;
}
public Date getModifitedAt() {
return modifitedAt;
}
public String getNickname() {
return nickname;
}
public Date getRegisteredAt() {
return registeredAt;
}
public String getUrl() {
return url;
}
public User getUser() {
return user;
}
public String getUserIconUrl() {
return userIconUrl;
}
/**
* Returns the version.
*
* @return the version
*/
public Long getVersion() {
return version;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((key == null) ? 0 : key.hashCode());
return result;
}
/**
* Sets the key.
*
* @param key
* the key
*/
public void setKey(Key key) {
this.key = key;
}
public void setModifitedAt(Date modifitedAt) {
this.modifitedAt = modifitedAt;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
public void setRegisteredAt(Date registeredAt) {
this.registeredAt = registeredAt;
}
public void setUrl(String url) {
this.url = url;
}
public void setUser(User user) {
this.user = user;
}
public void setUserIconUrl(String userIconUrl) {
this.userIconUrl = userIconUrl;
}
/**
* Sets the version.
*
* @param version
* the version
*/
public void setVersion(Long version) {
this.version = version;
}
}
| 3,235 | 0.569706 | 0.566615 | 158 | 18.474684 | 15.622403 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.601266 | false | false |
7
|
d39a34b773d6d0ff14e91af14c78732f9ca82b5a
| 18,511,309,075,025 |
6a526623de4fe2280228cdaf3884d1c5c5ab220b
|
/d03/src/com/test/App.java
|
19d0c81547aee6342e394d8fc292506bd4de4929
|
[] |
no_license
|
KiHoonAhn1/spring-learned
|
https://github.com/KiHoonAhn1/spring-learned
|
5215ec7522b0acb81935de7898734b0133bb810a
|
966113234e0f654dfcff263f0d2c6ff07ab60f8c
|
refs/heads/master
| 2023-01-03T19:20:08.252000 | 2020-11-03T08:50:40 | 2020-11-03T08:50:40 | 296,627,049 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.test;
import java.util.ArrayList;
import java.util.HashMap;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.GenericXmlApplicationContext;import com.frame.Biz;
import com.vo.ContentsVo;
public class App {
public static void main(String[] args) {
System.out.println("App Start ......");
AbstractApplicationContext factory =
new GenericXmlApplicationContext("myspring.xml");
System.out.println("Spring Started ......");
// IoC
Biz<Integer,ContentsVo> biz =
(Biz)factory.getBean("cbiz");
// (register)
ContentsVo c = new ContentsVo("title6","contents6","ºÀ¸»¼÷");
try {
biz.register(c);
System.out.println(c);
} catch (Exception e) {
e.printStackTrace();
}
// (get)
// ContentsVo c = null;
// try {
// c = (ContentsVo) biz.get(100);
// System.out.println("result:"+c);
// } catch (Exception e) {
// e.printStackTrace();
// }
// (remove)
// try {
// biz.remove(140);
// System.out.println("OK");
// } catch (Exception e) {
// e.printStackTrace();
// }
// (modify)
// ContentsVo c = new ContentsVo(100,"title1","contents1","À̹é¼÷");
// try {
// biz.modify(c);
// System.out.println(c);
// } catch (Exception e) {
// e.printStackTrace();
// }
// (selectall)
// ArrayList<ContentsVo> list = null;
// try {
// list = biz.get();
// for(ContentsVo c:list) {
// System.out.println(c);
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
// (search)
// ArrayList<ContentsVo> list = null;
// HashMap<String, Integer> smap = new HashMap<>();
// smap.put("start", 20);
// smap.put("end", 40);
// try {
// list = biz.search(smap);
// for(ContentsVo cv : list) {
// System.out.println(cv);
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
factory.close();
System.out.println("Spring End ......");
System.out.println("App End ......"
);
}
}
|
WINDOWS-1252
|
Java
| 1,972 |
java
|
App.java
|
Java
|
[] | null |
[] |
package com.test;
import java.util.ArrayList;
import java.util.HashMap;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.GenericXmlApplicationContext;import com.frame.Biz;
import com.vo.ContentsVo;
public class App {
public static void main(String[] args) {
System.out.println("App Start ......");
AbstractApplicationContext factory =
new GenericXmlApplicationContext("myspring.xml");
System.out.println("Spring Started ......");
// IoC
Biz<Integer,ContentsVo> biz =
(Biz)factory.getBean("cbiz");
// (register)
ContentsVo c = new ContentsVo("title6","contents6","ºÀ¸»¼÷");
try {
biz.register(c);
System.out.println(c);
} catch (Exception e) {
e.printStackTrace();
}
// (get)
// ContentsVo c = null;
// try {
// c = (ContentsVo) biz.get(100);
// System.out.println("result:"+c);
// } catch (Exception e) {
// e.printStackTrace();
// }
// (remove)
// try {
// biz.remove(140);
// System.out.println("OK");
// } catch (Exception e) {
// e.printStackTrace();
// }
// (modify)
// ContentsVo c = new ContentsVo(100,"title1","contents1","À̹é¼÷");
// try {
// biz.modify(c);
// System.out.println(c);
// } catch (Exception e) {
// e.printStackTrace();
// }
// (selectall)
// ArrayList<ContentsVo> list = null;
// try {
// list = biz.get();
// for(ContentsVo c:list) {
// System.out.println(c);
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
// (search)
// ArrayList<ContentsVo> list = null;
// HashMap<String, Integer> smap = new HashMap<>();
// smap.put("start", 20);
// smap.put("end", 40);
// try {
// list = biz.search(smap);
// for(ContentsVo cv : list) {
// System.out.println(cv);
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
factory.close();
System.out.println("Spring End ......");
System.out.println("App End ......"
);
}
}
| 1,972 | 0.608163 | 0.597959 | 84 | 22.333334 | 17.783978 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.654762 | false | false |
7
|
28a646a3d3669603e2502927b2e8dba51eb3518d
| 6,794,638,273,250 |
be03cc94535e86282402077938b666eba9397823
|
/src/main/java/manger/main/HelloWorld.java
|
d24a5b51a0d520967ae482a23c051e2c1a4ca13c
|
[] |
no_license
|
gitwithsean/manger
|
https://github.com/gitwithsean/manger
|
5b9b2be6a6d34ec9ce5cfa0f6a78df2e537c4ac7
|
940c6a05aa5a306c5d14ec393c3f9a00ef3b7c88
|
refs/heads/master
| 2021-01-19T23:44:00.888000 | 2017-04-21T21:37:15 | 2017-04-21T21:37:15 | 89,016,346 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package manger.main;
/**
* Created by sean.ryan on 4/21/17.
*/
public class HelloWorld {
public static String getMessage(){
return "Hello World!";
}
}
|
UTF-8
|
Java
| 172 |
java
|
HelloWorld.java
|
Java
|
[
{
"context": "package manger.main;\n\n/**\n * Created by sean.ryan on 4/21/17.\n */\npublic class HelloWorld {\n\n ",
"end": 44,
"score": 0.7759628295898438,
"start": 40,
"tag": "NAME",
"value": "sean"
},
{
"context": "package manger.main;\n\n/**\n * Created by sean.ryan on 4/21/17.\n */\npublic class HelloWorld {\n\n ",
"end": 44,
"score": 0.5454704761505127,
"start": 44,
"tag": "USERNAME",
"value": ""
},
{
"context": "package manger.main;\n\n/**\n * Created by sean.ryan on 4/21/17.\n */\npublic class HelloWorld {\n\n pu",
"end": 49,
"score": 0.8122507333755493,
"start": 45,
"tag": "NAME",
"value": "ryan"
}
] | null |
[] |
package manger.main;
/**
* Created by sean.ryan on 4/21/17.
*/
public class HelloWorld {
public static String getMessage(){
return "Hello World!";
}
}
| 172 | 0.616279 | 0.587209 | 12 | 13.333333 | 14.447222 | 38 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.166667 | false | false |
7
|
d027687213559f34cf2a488ce26e16ec92ba8c6a
| 12,773,232,764,725 |
60c194b8e4903d9ae2d762700d2d0bcac197e51a
|
/src/main/java/com/qumaiyao/pharmacy/service/PharmacyGoodsTranService.java
|
05528c6ff4c50f3664a295f65cbd8e1109fa26a2
|
[] |
no_license
|
tiantianfeiche/qumaiyao-web-new
|
https://github.com/tiantianfeiche/qumaiyao-web-new
|
b5746a42153a599ade882356e3f225c58bbe6b49
|
ad09e78cc8cd27afa2fa6e088403cad8d917ff89
|
refs/heads/master
| 2016-08-06T03:34:54.592000 | 2015-03-04T02:05:16 | 2015-03-04T02:05:16 | 31,632,144 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.qumaiyao.pharmacy.service;
public interface PharmacyGoodsTranService {
/**
* 批量删除
*
* @param json
* pharmacyGoods集合字符串
* @return
*/
boolean delList(String jsonStr);
}
|
UTF-8
|
Java
| 236 |
java
|
PharmacyGoodsTranService.java
|
Java
|
[] | null |
[] |
package com.qumaiyao.pharmacy.service;
public interface PharmacyGoodsTranService {
/**
* 批量删除
*
* @param json
* pharmacyGoods集合字符串
* @return
*/
boolean delList(String jsonStr);
}
| 236 | 0.623853 | 0.623853 | 12 | 16.166666 | 15.257967 | 43 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.833333 | false | false |
7
|
ec4cd2200e93b65eda3a210030a29966cd0ba72d
| 31,009,663,942,023 |
a4a51084cfb715c7076c810520542af38a854868
|
/src/main/java/com/shopee/app/ui/setting/notification2/d.java
|
95d3493960217a91d8ed71ad57a3a3857714caea
|
[] |
no_license
|
BharathPalanivelu/repotest
|
https://github.com/BharathPalanivelu/repotest
|
ddaf56a94eb52867408e0e769f35bef2d815da72
|
f78ae38738d2ba6c9b9b4049f3092188fabb5b59
|
refs/heads/master
| 2020-09-30T18:55:04.802000 | 2019-12-02T10:52:08 | 2019-12-02T10:52:08 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.shopee.app.ui.setting.notification2;
import android.app.Activity;
import android.content.Context;
import android.view.View;
import android.widget.LinearLayout;
import com.garena.android.appkit.tools.b;
import com.shopee.app.appuser.UserInfo;
import com.shopee.app.data.store.RegionConfig;
import com.shopee.app.data.store.SettingConfigStore;
import com.shopee.app.data.store.v;
import com.shopee.app.h.q;
import com.shopee.app.pushnotification.a.a.c;
import com.shopee.app.ui.a.r;
import com.shopee.app.ui.setting.cell.SettingWithSelectionItemView;
import com.shopee.app.ui.setting.cell.a;
import com.shopee.app.ui.setting.m;
import com.shopee.app.ui.setting.notificationsound.NotificationSoundsActivity_;
import com.shopee.app.util.bc;
import com.shopee.app.util.s;
import com.shopee.app.util.x;
public class d extends LinearLayout implements r {
/* renamed from: a reason: collision with root package name */
View f25279a;
/* renamed from: b reason: collision with root package name */
a f25280b;
/* renamed from: c reason: collision with root package name */
a f25281c;
/* renamed from: d reason: collision with root package name */
SettingWithSelectionItemView f25282d;
/* renamed from: e reason: collision with root package name */
a f25283e;
/* renamed from: f reason: collision with root package name */
a f25284f;
/* renamed from: g reason: collision with root package name */
a f25285g;
a h;
a i;
a j;
a k;
a l;
a m;
a n;
a o;
a p;
b q;
bc r;
UserInfo s;
com.shopee.app.ui.common.r t;
Activity u;
RegionConfig v;
SettingConfigStore w;
s x;
v y;
private boolean z = false;
public void c() {
}
public void d() {
}
public d(Context context) {
super(context);
((m) ((x) context).b()).a(this);
setOrientation(1);
}
/* access modifiers changed from: package-private */
public void a() {
this.r.a(this.q);
this.q.a(this);
int i2 = 0;
this.f25285g.setVisibility(this.v.isFullBuild() ? 0 : 8);
this.f25283e.setVisibility(this.v.isFullBuild() ? 0 : 8);
this.l.setVisibility((!this.w.buyerRatingEnabled() || !this.s.isSeller()) ? 8 : 0);
this.m.setVisibility(this.s.isWalletFeatureOn() ? 0 : 8);
a aVar = this.f25281c;
if (!this.x.a("shopee_custom_noti_sound")) {
i2 = 8;
}
aVar.setVisibility(i2);
f();
this.z = true;
}
public void b() {
g();
}
public void a(UserInfo userInfo) {
this.s = userInfo;
f();
}
public void e() {
this.z = false;
f();
this.z = true;
}
public void f() {
this.f25280b.setChecked(this.s.isAllNotiOn());
if (this.f25280b.c()) {
this.f25279a.setVisibility(0);
g();
this.h.setChecked(this.s.isChatNotiOn());
this.f25284f.setChecked(this.s.isActionRequiredNotiOn());
this.i.setChecked(this.s.isActivityNotiOn());
this.f25285g.setChecked(this.s.isOOSNotiOn());
this.f25283e.setChecked(this.s.isSmartNotiOn());
this.j.setChecked(this.s.isShopeePromotionNotiOn());
this.k.setChecked(this.s.isPersonalContentNotiOn());
this.l.setChecked(this.s.isNotiRatingOn());
this.m.setChecked(this.s.isWalletNotiOn());
this.n.setChecked(this.s.isFeedCommentNotiOn());
this.o.setChecked(this.s.isFeedLikedNotiOn());
this.p.setChecked(this.s.isFeedMentionedNotiOn());
return;
}
this.f25279a.setVisibility(4);
}
public void g() {
int i2 = 0;
boolean z2 = this.x.a("shopee_custom_noti_sound") && this.y.f();
SettingWithSelectionItemView settingWithSelectionItemView = this.f25282d;
if (!z2) {
i2 = 8;
}
settingWithSelectionItemView.setVisibility(i2);
this.f25282d.setSelectionText(b.e(c.a().b()));
}
public void h() {
this.t.a();
}
public void i() {
this.t.b();
}
/* access modifiers changed from: package-private */
public void a(View view) {
if (this.z) {
this.q.a(this.f25281c.c());
}
}
/* access modifiers changed from: package-private */
public void b(View view) {
if (this.z) {
NotificationSoundsActivity_.a(this.u).a();
}
}
/* access modifiers changed from: package-private */
public void c(View view) {
if (this.z) {
this.q.a(this.s, this.f25280b.c());
}
}
/* access modifiers changed from: package-private */
public void d(View view) {
if (this.z) {
this.q.b(this.s, this.h.c());
}
}
/* access modifiers changed from: package-private */
public void e(View view) {
if (this.z) {
this.q.c(this.s, this.f25284f.c());
}
}
/* access modifiers changed from: package-private */
public void f(View view) {
if (this.z) {
this.q.d(this.s, this.i.c());
}
}
/* access modifiers changed from: package-private */
public void g(View view) {
if (this.z) {
this.q.i(this.s, this.l.c());
}
}
/* access modifiers changed from: package-private */
public void h(View view) {
if (this.z) {
this.q.j(this.s, this.m.c());
}
}
/* access modifiers changed from: package-private */
public void i(View view) {
if (this.z) {
this.q.h(this.s, this.k.c());
}
}
/* access modifiers changed from: package-private */
public void j(View view) {
if (this.z) {
this.q.e(this.s, this.f25285g.c());
}
}
/* access modifiers changed from: package-private */
public void k(View view) {
if (this.z) {
this.q.f(this.s, this.f25283e.c());
}
}
/* access modifiers changed from: package-private */
public void l(View view) {
if (this.z) {
this.q.g(this.s, this.j.c());
}
}
/* access modifiers changed from: package-private */
public void j() {
if (this.z) {
this.q.k(this.s, this.n.c());
}
}
/* access modifiers changed from: package-private */
public void k() {
if (this.z) {
this.q.l(this.s, this.o.c());
}
}
/* access modifiers changed from: package-private */
public void l() {
if (this.z) {
this.q.m(this.s, this.p.c());
}
}
public void a(String str) {
q.a((View) this, str);
}
public void a(boolean z2) {
this.z = false;
this.f25281c.setChecked(z2);
g();
this.z = true;
}
}
|
UTF-8
|
Java
| 6,960 |
java
|
d.java
|
Java
|
[] | null |
[] |
package com.shopee.app.ui.setting.notification2;
import android.app.Activity;
import android.content.Context;
import android.view.View;
import android.widget.LinearLayout;
import com.garena.android.appkit.tools.b;
import com.shopee.app.appuser.UserInfo;
import com.shopee.app.data.store.RegionConfig;
import com.shopee.app.data.store.SettingConfigStore;
import com.shopee.app.data.store.v;
import com.shopee.app.h.q;
import com.shopee.app.pushnotification.a.a.c;
import com.shopee.app.ui.a.r;
import com.shopee.app.ui.setting.cell.SettingWithSelectionItemView;
import com.shopee.app.ui.setting.cell.a;
import com.shopee.app.ui.setting.m;
import com.shopee.app.ui.setting.notificationsound.NotificationSoundsActivity_;
import com.shopee.app.util.bc;
import com.shopee.app.util.s;
import com.shopee.app.util.x;
public class d extends LinearLayout implements r {
/* renamed from: a reason: collision with root package name */
View f25279a;
/* renamed from: b reason: collision with root package name */
a f25280b;
/* renamed from: c reason: collision with root package name */
a f25281c;
/* renamed from: d reason: collision with root package name */
SettingWithSelectionItemView f25282d;
/* renamed from: e reason: collision with root package name */
a f25283e;
/* renamed from: f reason: collision with root package name */
a f25284f;
/* renamed from: g reason: collision with root package name */
a f25285g;
a h;
a i;
a j;
a k;
a l;
a m;
a n;
a o;
a p;
b q;
bc r;
UserInfo s;
com.shopee.app.ui.common.r t;
Activity u;
RegionConfig v;
SettingConfigStore w;
s x;
v y;
private boolean z = false;
public void c() {
}
public void d() {
}
public d(Context context) {
super(context);
((m) ((x) context).b()).a(this);
setOrientation(1);
}
/* access modifiers changed from: package-private */
public void a() {
this.r.a(this.q);
this.q.a(this);
int i2 = 0;
this.f25285g.setVisibility(this.v.isFullBuild() ? 0 : 8);
this.f25283e.setVisibility(this.v.isFullBuild() ? 0 : 8);
this.l.setVisibility((!this.w.buyerRatingEnabled() || !this.s.isSeller()) ? 8 : 0);
this.m.setVisibility(this.s.isWalletFeatureOn() ? 0 : 8);
a aVar = this.f25281c;
if (!this.x.a("shopee_custom_noti_sound")) {
i2 = 8;
}
aVar.setVisibility(i2);
f();
this.z = true;
}
public void b() {
g();
}
public void a(UserInfo userInfo) {
this.s = userInfo;
f();
}
public void e() {
this.z = false;
f();
this.z = true;
}
public void f() {
this.f25280b.setChecked(this.s.isAllNotiOn());
if (this.f25280b.c()) {
this.f25279a.setVisibility(0);
g();
this.h.setChecked(this.s.isChatNotiOn());
this.f25284f.setChecked(this.s.isActionRequiredNotiOn());
this.i.setChecked(this.s.isActivityNotiOn());
this.f25285g.setChecked(this.s.isOOSNotiOn());
this.f25283e.setChecked(this.s.isSmartNotiOn());
this.j.setChecked(this.s.isShopeePromotionNotiOn());
this.k.setChecked(this.s.isPersonalContentNotiOn());
this.l.setChecked(this.s.isNotiRatingOn());
this.m.setChecked(this.s.isWalletNotiOn());
this.n.setChecked(this.s.isFeedCommentNotiOn());
this.o.setChecked(this.s.isFeedLikedNotiOn());
this.p.setChecked(this.s.isFeedMentionedNotiOn());
return;
}
this.f25279a.setVisibility(4);
}
public void g() {
int i2 = 0;
boolean z2 = this.x.a("shopee_custom_noti_sound") && this.y.f();
SettingWithSelectionItemView settingWithSelectionItemView = this.f25282d;
if (!z2) {
i2 = 8;
}
settingWithSelectionItemView.setVisibility(i2);
this.f25282d.setSelectionText(b.e(c.a().b()));
}
public void h() {
this.t.a();
}
public void i() {
this.t.b();
}
/* access modifiers changed from: package-private */
public void a(View view) {
if (this.z) {
this.q.a(this.f25281c.c());
}
}
/* access modifiers changed from: package-private */
public void b(View view) {
if (this.z) {
NotificationSoundsActivity_.a(this.u).a();
}
}
/* access modifiers changed from: package-private */
public void c(View view) {
if (this.z) {
this.q.a(this.s, this.f25280b.c());
}
}
/* access modifiers changed from: package-private */
public void d(View view) {
if (this.z) {
this.q.b(this.s, this.h.c());
}
}
/* access modifiers changed from: package-private */
public void e(View view) {
if (this.z) {
this.q.c(this.s, this.f25284f.c());
}
}
/* access modifiers changed from: package-private */
public void f(View view) {
if (this.z) {
this.q.d(this.s, this.i.c());
}
}
/* access modifiers changed from: package-private */
public void g(View view) {
if (this.z) {
this.q.i(this.s, this.l.c());
}
}
/* access modifiers changed from: package-private */
public void h(View view) {
if (this.z) {
this.q.j(this.s, this.m.c());
}
}
/* access modifiers changed from: package-private */
public void i(View view) {
if (this.z) {
this.q.h(this.s, this.k.c());
}
}
/* access modifiers changed from: package-private */
public void j(View view) {
if (this.z) {
this.q.e(this.s, this.f25285g.c());
}
}
/* access modifiers changed from: package-private */
public void k(View view) {
if (this.z) {
this.q.f(this.s, this.f25283e.c());
}
}
/* access modifiers changed from: package-private */
public void l(View view) {
if (this.z) {
this.q.g(this.s, this.j.c());
}
}
/* access modifiers changed from: package-private */
public void j() {
if (this.z) {
this.q.k(this.s, this.n.c());
}
}
/* access modifiers changed from: package-private */
public void k() {
if (this.z) {
this.q.l(this.s, this.o.c());
}
}
/* access modifiers changed from: package-private */
public void l() {
if (this.z) {
this.q.m(this.s, this.p.c());
}
}
public void a(String str) {
q.a((View) this, str);
}
public void a(boolean z2) {
this.z = false;
this.f25281c.setChecked(z2);
g();
this.z = true;
}
}
| 6,960 | 0.562931 | 0.541236 | 266 | 25.165413 | 21.379028 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.481203 | false | false |
7
|
9036f40e17e210dc716701272024c3d9ee7995ee
| 22,909,355,566,868 |
ce679f6ba454a54e75eab08c6fdf750522117059
|
/app/src/main/java/com/oscc/oscc/Adapters/HospitalAdapter.java
|
9b1256901ce73eb150d0e4aee7a6241e689834c4
|
[] |
no_license
|
reemeeiah/oscc
|
https://github.com/reemeeiah/oscc
|
30557c552644c25765c0d21e17c78270c0eb96b1
|
f78be52082c01dfe6be6766e7a7edd1862c5aae2
|
refs/heads/master
| 2021-04-06T09:04:41.274000 | 2018-04-15T12:24:00 | 2018-04-15T12:24:00 | 125,256,120 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.oscc.oscc.Adapters;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import com.oscc.oscc.Models.Hospital;
import com.oscc.oscc.R;
import java.util.ArrayList;
/**
* Created by Nona on 3/17/2018.
*/
public class HospitalAdapter extends ArrayAdapter<Hospital>{
public HospitalAdapter(Context context, ArrayList<Hospital> hospitals) {
super(context,0, hospitals);
// TODO find resource
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
Hospital H = getItem(position);
if (convertView == null) {
convertView = LayoutInflater.from(getContext()).inflate(R.layout.hospital_list_item2, parent, false);
}
((TextView)convertView.findViewById(R.id.hospital_name_tv)).setText(H.HospitalName);
((TextView)convertView.findViewById(R.id.HospitalAddress_tv)).setText(H.HospitalAddress);
convertView.setTag(H);
return convertView;
}
}
|
UTF-8
|
Java
| 1,122 |
java
|
HospitalAdapter.java
|
Java
|
[
{
"context": "R;\n\nimport java.util.ArrayList;\n\n/**\n * Created by Nona on 3/17/2018.\n */\n\npublic class HospitalAdapter e",
"end": 341,
"score": 0.9231034517288208,
"start": 337,
"tag": "USERNAME",
"value": "Nona"
}
] | null |
[] |
package com.oscc.oscc.Adapters;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import com.oscc.oscc.Models.Hospital;
import com.oscc.oscc.R;
import java.util.ArrayList;
/**
* Created by Nona on 3/17/2018.
*/
public class HospitalAdapter extends ArrayAdapter<Hospital>{
public HospitalAdapter(Context context, ArrayList<Hospital> hospitals) {
super(context,0, hospitals);
// TODO find resource
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
Hospital H = getItem(position);
if (convertView == null) {
convertView = LayoutInflater.from(getContext()).inflate(R.layout.hospital_list_item2, parent, false);
}
((TextView)convertView.findViewById(R.id.hospital_name_tv)).setText(H.HospitalName);
((TextView)convertView.findViewById(R.id.HospitalAddress_tv)).setText(H.HospitalAddress);
convertView.setTag(H);
return convertView;
}
}
| 1,122 | 0.713012 | 0.704991 | 38 | 28.526316 | 29.015184 | 113 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.631579 | false | false |
7
|
34a026e6fcd31d6c2f143cab3cddab15d748573b
| 27,745,488,784,742 |
a1853f8eb4e5809b3bcfae7e0c50f3000b0a7b9d
|
/shouba/Zeus/zeus-receives-web/src/main/java/com/zeus/service/SiteWorkUsersService.java
|
66c607f315b028e63d8f39e8f6bf7d8de5a5e96c
|
[] |
no_license
|
lhyazst/coding
|
https://github.com/lhyazst/coding
|
3323c51f7b75aebf298b444abe95e9cf2675d734
|
92d85faf16479b6c4ab56df9fa79aff3cdf77279
|
refs/heads/master
| 2020-04-19T02:16:54.151000 | 2019-02-19T09:09:37 | 2019-02-19T09:09:37 | 167,897,200 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.zeus.service;
import com.zeus.common.QueryResponseResult;
/**
* @Description 活动操作服务层
* @Author wangdi
* @Date 16/12/2018 21:56
* @Version V1.0
*/
public interface SiteWorkUsersService {
/**
*
*
* @methodName siteWorkUsersSelect 回收员查询出回收管理里面的统计回收袋数量和站点数量
* @author wangdi
* @param []
* @return com.zeus.common.QueryResponseResult
* @date 2019/1/27
*/
QueryResponseResult siteWorkUsersSelect(String username);
}
|
UTF-8
|
Java
| 547 |
java
|
SiteWorkUsersService.java
|
Java
|
[
{
"context": "nseResult;\n\n/**\n * @Description 活动操作服务层\n * @Author wangdi\n * @Date 16/12/2018 21:56\n * @Version V1.0\n */\npu",
"end": 118,
"score": 0.9992167353630066,
"start": 112,
"tag": "USERNAME",
"value": "wangdi"
},
{
"context": "ersSelect 回收员查询出回收管理里面的统计回收袋数量和站点数量\n * @author wangdi\n * @param []\n * @return com.zeus.common.Q",
"end": 317,
"score": 0.9994637966156006,
"start": 311,
"tag": "USERNAME",
"value": "wangdi"
}
] | null |
[] |
package com.zeus.service;
import com.zeus.common.QueryResponseResult;
/**
* @Description 活动操作服务层
* @Author wangdi
* @Date 16/12/2018 21:56
* @Version V1.0
*/
public interface SiteWorkUsersService {
/**
*
*
* @methodName siteWorkUsersSelect 回收员查询出回收管理里面的统计回收袋数量和站点数量
* @author wangdi
* @param []
* @return com.zeus.common.QueryResponseResult
* @date 2019/1/27
*/
QueryResponseResult siteWorkUsersSelect(String username);
}
| 547 | 0.666667 | 0.623188 | 27 | 16.888889 | 19.060009 | 65 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.111111 | false | false |
7
|
86485fdde21870c782288edca1beeba3039ac698
| 32,169,305,116,146 |
2ba31c72d826b767efafc9316b401e540d081fa1
|
/src/main/java/io/github/xiaour/datasync/ui/panel/DatabasePanelTo.java
|
dce208601671f8f6d0c199341ab50954cfe81db8
|
[
"MIT"
] |
permissive
|
xiaour/DataSyncTools
|
https://github.com/xiaour/DataSyncTools
|
feb18b30152eb0e66ac4ddef40c30c17cfc7d1b2
|
cffdb6cc1e36fcbac0be81bde1afc19c04328ca1
|
refs/heads/master
| 2023-03-22T05:40:21.230000 | 2021-03-08T07:33:08 | 2021-03-08T07:33:08 | 345,567,125 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package io.github.xiaour.datasync.ui.panel;
import io.github.xiaour.datasync.App;
import io.github.xiaour.datasync.enums.DangerOperationEnum;
import io.github.xiaour.datasync.logic.sync.DataBaseInfo;
import io.github.xiaour.datasync.logic.sync.DataBaseSync;
import io.github.xiaour.datasync.tools.ConstantsTools;
import io.github.xiaour.datasync.tools.DESPlus;
import io.github.xiaour.datasync.tools.DbUtilMySQL;
import io.github.xiaour.datasync.tools.PropertyUtil;
import io.github.xiaour.datasync.ui.UiConsts;
import io.github.xiaour.datasync.ui.component.MyIconButton;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.swing.*;
import java.awt.*;
import java.sql.Connection;
/**
* 目标数据库面板
*
* @author Bob
*/
public class DatabasePanelTo extends JPanel{
private static final long serialVersionUID = 1L;
public static MyIconButton buttonStartSync;
private static MyIconButton buttonTestLink;
private static JTextField textFieldDatabaseHost;
private static JTextField textFieldDatabaseName;
private static JTextField textFieldDatabaseUser;
private static JPasswordField passwordFieldDatabasePassword;
private static ButtonGroup buttonGroup;
private static JRadioButton radioBtn01;
private static JRadioButton radioBtn02;
private static JProgressBar progressBar;
private static final int MIN_PROGRESS = 0;
private static final int MAX_PROGRESS = 100;
public static int currentProgress = MIN_PROGRESS;
//默认只同步全量数据
private static int dangerOpt = DangerOperationEnum.FULL_DATA_ONLY.ordinal();
private static final Logger logger = LoggerFactory.getLogger(DatabasePanelTo.class);
/**
* 构造
*/
public DatabasePanelTo() {
initialize();
addComponent();
setContent();
addListener();
}
/**
* 初始化
*/
private void initialize() {
this.setBackground(UiConsts.MAIN_BACK_COLOR);
this.setLayout(new BorderLayout());
}
/**
* 添加组件
*/
private void addComponent() {
this.add(getCenterPanel(), BorderLayout.CENTER);
this.add(getDownPanel(), BorderLayout.SOUTH);
}
/**
* 中部面板
*
* @return
*/
private JPanel getCenterPanel() {
// 中间面板
JPanel panelCenter = new JPanel();
panelCenter.setBackground(UiConsts.MAIN_BACK_COLOR);
panelCenter.setLayout(new GridLayout(2, 1));
// 设置Grid
JPanel panelGridSetting = new JPanel();
panelGridSetting.setBackground(UiConsts.MAIN_BACK_COLOR);
panelGridSetting.setLayout(new FlowLayout(FlowLayout.LEFT, UiConsts.MAIN_H_GAP, 5));
// 初始化组件
JLabel labelDatabaseType = new JLabel(PropertyUtil.getProperty("ds.ui.database.type"));
JLabel labelDatabaseHost = new JLabel(PropertyUtil.getProperty("ds.ui.database.host"));
JLabel labelDatabaseName = new JLabel(PropertyUtil.getProperty("ds.ui.database.name"));
JLabel labelDatabaseUser = new JLabel(PropertyUtil.getProperty("ds.ui.database.user"));
JLabel labelDatabasePassword = new JLabel(PropertyUtil.getProperty("ds.ui.database.password"));
JLabel labelDangerOperation = new JLabel(PropertyUtil.getProperty("ds.ui.database.dangerOpt"));
JComboBox<String> comboxDatabaseType = new JComboBox<>();
comboxDatabaseType.addItem("MySQL");
comboxDatabaseType.setEditable(false);
textFieldDatabaseHost = new JTextField();
textFieldDatabaseName = new JTextField();
textFieldDatabaseUser = new JTextField();
passwordFieldDatabasePassword = new JPasswordField();
progressBar = new JProgressBar();
// 设置进度的 最小值 和 最大值
progressBar.setMinimum(MIN_PROGRESS);
progressBar.setMaximum(MAX_PROGRESS);
progressBar.setStringPainted(true);
// 创建按钮组,把两个单选按钮添加到该组
buttonGroup= new ButtonGroup();
// 创建两个单选按钮
radioBtn01 = new JRadioButton(PropertyUtil.getProperty("ds.ui.database.danger.data"));
radioBtn02 = new JRadioButton(PropertyUtil.getProperty("ds.ui.database.danger.tableData"));
buttonGroup.add(radioBtn01);
buttonGroup.add(radioBtn02);
// 设置第一个单选按钮选中
radioBtn01.setSelected(true);
radioBtn01.setOpaque(false);
radioBtn02.setOpaque(false);
// 字体
labelDatabaseType.setFont(UiConsts.FONT_NORMAL);
labelDatabaseHost.setFont(UiConsts.FONT_NORMAL);
labelDatabaseName.setFont(UiConsts.FONT_NORMAL);
labelDatabaseUser.setFont(UiConsts.FONT_NORMAL);
labelDatabasePassword.setFont(UiConsts.FONT_NORMAL);
labelDangerOperation.setFont(UiConsts.FONT_NORMAL);
comboxDatabaseType.setFont(UiConsts.FONT_NORMAL);
textFieldDatabaseHost.setFont(UiConsts.FONT_NORMAL);
textFieldDatabaseName.setFont(UiConsts.FONT_NORMAL);
textFieldDatabaseUser.setFont(UiConsts.FONT_NORMAL);
passwordFieldDatabasePassword.setFont(UiConsts.FONT_NORMAL);
progressBar.setFont(UiConsts.FONT_NORMAL);
radioBtn01.setFont(UiConsts.FONT_NORMAL);
radioBtn02.setFont(UiConsts.FONT_NORMAL);
// 大小
labelDatabaseType.setPreferredSize(UiConsts.LABLE_SIZE_ITEM);
labelDatabaseHost.setPreferredSize(UiConsts.LABLE_SIZE_ITEM);
labelDatabaseName.setPreferredSize(UiConsts.LABLE_SIZE_ITEM);
labelDatabaseUser.setPreferredSize(UiConsts.LABLE_SIZE_ITEM);
labelDatabasePassword.setPreferredSize(UiConsts.LABLE_SIZE_ITEM);
comboxDatabaseType.setPreferredSize(UiConsts.TEXT_FIELD_SIZE_ITEM);
textFieldDatabaseHost.setPreferredSize(UiConsts.TEXT_FIELD_SIZE_ITEM);
textFieldDatabaseName.setPreferredSize(UiConsts.TEXT_FIELD_SIZE_ITEM);
textFieldDatabaseUser.setPreferredSize(UiConsts.TEXT_FIELD_SIZE_ITEM);
passwordFieldDatabasePassword.setPreferredSize(UiConsts.TEXT_FIELD_SIZE_ITEM);
progressBar.setPreferredSize(UiConsts.TEXT_FIELD_SIZE_ITEM);
// 组合元素
panelGridSetting.add(labelDatabaseType);
panelGridSetting.add(comboxDatabaseType);
panelGridSetting.add(labelDatabaseHost);
panelGridSetting.add(textFieldDatabaseHost);
panelGridSetting.add(labelDatabaseName);
panelGridSetting.add(textFieldDatabaseName);
panelGridSetting.add(labelDatabaseUser);
panelGridSetting.add(textFieldDatabaseUser);
panelGridSetting.add(labelDatabasePassword);
panelGridSetting.add(passwordFieldDatabasePassword);
panelGridSetting.add(labelDangerOperation);
panelGridSetting.add(radioBtn01);
panelGridSetting.add(radioBtn02);
// 设置进度条Grid
JPanel panelGridProgress = new JPanel();
panelGridProgress.setBackground(UiConsts.MAIN_BACK_COLOR);
panelGridProgress.setLayout(new FlowLayout(FlowLayout.LEFT, UiConsts.MAIN_H_GAP, 5));
JLabel labelSyncProgress = new JLabel(PropertyUtil.getProperty("ds.ui.database.sync.progress"));
labelSyncProgress.setFont(UiConsts.FONT_NORMAL);
labelSyncProgress.setPreferredSize(UiConsts.LABLE_SIZE_ITEM);
panelGridProgress.add(labelSyncProgress);
panelGridProgress.add(progressBar);
panelCenter.add(panelGridSetting);
panelCenter.add(panelGridProgress);
return panelCenter;
}
/**
* 底部面板
*
* @return
*/
private JPanel getDownPanel() {
JPanel panelDown = new JPanel();
panelDown.setBackground(UiConsts.MAIN_BACK_COLOR);
panelDown.setLayout(new FlowLayout(FlowLayout.RIGHT, UiConsts.MAIN_H_GAP, 5));
buttonTestLink = new MyIconButton(UiConsts.ICON_TEST_LINK, UiConsts.ICON_TEST_LINK_ENABLE,
UiConsts.ICON_TEST_LINK_DISABLE, "");
buttonStartSync = new MyIconButton(UiConsts.ICON_SYNC_NOW, UiConsts.ICON_SYNC_NOW_ENABLE,
UiConsts.ICON_SYNC_NOW_DISABLE, "开始同步数据,需要等待一会儿");
panelDown.add(buttonTestLink);
panelDown.add(buttonStartSync);
return panelDown;
}
/**
* 设置文本区内容
*/
public static void setContent() {
textFieldDatabaseHost.setText(ConstantsTools.CONFIGER.getHostTo());
textFieldDatabaseName.setText(ConstantsTools.CONFIGER.getNameTo());
String user = "";
String password = "";
try {
DESPlus des = new DESPlus();
user = des.decrypt(ConstantsTools.CONFIGER.getUserTo());
password = des.decrypt(ConstantsTools.CONFIGER.getPasswordTo());
} catch (Exception e) {
logger.error(PropertyUtil.getProperty("ds.ui.database.to.err.decode") + e.toString());
e.printStackTrace();
}
textFieldDatabaseUser.setText(user);
passwordFieldDatabasePassword.setText(password);
}
/**
* 为相关组件添加事件监听
*/
private void addListener() {
radioBtn01.addActionListener(e ->{
dangerOpt = DangerOperationEnum.FULL_DATA_ONLY.ordinal();
});
radioBtn02.addActionListener(e ->{
dangerOpt = DangerOperationEnum.FULL_DATA_AND_TABLE.ordinal();
});
buttonStartSync.addChangeListener(Chan -> {
});
buttonStartSync.addActionListener(e -> {
try {
ConstantsTools.CONFIGER.setHostTo(textFieldDatabaseHost.getText());
ConstantsTools.CONFIGER.setNameTo(textFieldDatabaseName.getText());
String password = "";
String user = "";
try {
DESPlus des = new DESPlus();
user = des.encrypt(textFieldDatabaseUser.getText());
password = des.encrypt(new String(passwordFieldDatabasePassword.getPassword()));
} catch (Exception e1) {
logger.error(PropertyUtil.getProperty("ds.ui.database.to.err.encode") + e1.toString());
e1.printStackTrace();
}
ConstantsTools.CONFIGER.setUserTo(user);
ConstantsTools.CONFIGER.setPasswordTo(password);
DataBaseInfo dbFrom = ConstantsTools.CONFIGER.getDataBaseFrom();
DataBaseInfo dbTo = ConstantsTools.CONFIGER.getDataBaseTo();
DataBaseSync dataBaseSync = new DataBaseSync(dbFrom,dbTo,dangerOpt,currentProgress,10000);
java.util.List<String> msgList = dataBaseSync.syncDataBase();
currentProgress = 100;
progressBar.setValue(currentProgress);
JOptionPane.showMessageDialog(App.databasePanel,String.join("\n", msgList), PropertyUtil.getProperty("ds.ui.tips"), JOptionPane.PLAIN_MESSAGE);
buttonStartSync.setEnabled(true);
currentProgress = MIN_PROGRESS;
} catch (Exception e1) {
buttonStartSync.setEnabled(true);
JOptionPane.showMessageDialog(App.databasePanel, PropertyUtil.getProperty("ds.ui.save.fail") + e1.getMessage(), PropertyUtil.getProperty("ds.ui.tips"), JOptionPane.ERROR_MESSAGE);
logger.error("Write to xml file error" + e1.toString());
e1.printStackTrace();
}
});
buttonTestLink.addActionListener(e -> {
try {
DbUtilMySQL dbMySQL = DbUtilMySQL.getInstance();
String dburl = textFieldDatabaseHost.getText();
String dbname = textFieldDatabaseName.getText();
String dbuser = textFieldDatabaseUser.getText();
String dbpassword = new String(passwordFieldDatabasePassword.getPassword());
Connection conn = dbMySQL.testConnection(dburl, dbname, dbuser, dbpassword);
if (conn == null) {
JOptionPane.showMessageDialog(App.databasePanel, PropertyUtil.getProperty("ds.ui.database.err.link.fail"), PropertyUtil.getProperty("ds.ui.tips"),
JOptionPane.ERROR_MESSAGE);
} else {
JOptionPane.showMessageDialog(App.databasePanel, PropertyUtil.getProperty("ds.ui.database.err.link.success"), PropertyUtil.getProperty("ds.ui.tips"),
JOptionPane.PLAIN_MESSAGE);
}
} catch (Exception e1) {
JOptionPane.showMessageDialog(App.databasePanel, PropertyUtil.getProperty("ds.ui.database.err.link.fail") + e1.getMessage(), PropertyUtil.getProperty("ds.ui.tips"),
JOptionPane.ERROR_MESSAGE);
}
});
}
}
|
UTF-8
|
Java
| 12,864 |
java
|
DatabasePanelTo.java
|
Java
|
[
{
"context": "java.sql.Connection;\n\n/**\n * 目标数据库面板\n *\n * @author Bob\n */\npublic class DatabasePanelTo extends JPanel{\n",
"end": 733,
"score": 0.933551549911499,
"start": 730,
"tag": "NAME",
"value": "Bob"
},
{
"context": "d();\n passwordFieldDatabasePassword = new JPasswordField();\n progressBar = new JProgressBar();",
"end": 3637,
"score": 0.575654149055481,
"start": 3629,
"tag": "PASSWORD",
"value": "Password"
},
{
"context": ");\n String dbpassword = new String(passwordFieldDatabasePassword.getPassword());\n ",
"end": 11622,
"score": 0.7323452830314636,
"start": 11614,
"tag": "PASSWORD",
"value": "password"
},
{
"context": " String dbpassword = new String(passwordFieldDatabasePassword.getPassword());\n Connection conn = dbMySQL.tes",
"end": 11655,
"score": 0.6446806788444519,
"start": 11627,
"tag": "PASSWORD",
"value": "DatabasePassword.getPassword"
}
] | null |
[] |
package io.github.xiaour.datasync.ui.panel;
import io.github.xiaour.datasync.App;
import io.github.xiaour.datasync.enums.DangerOperationEnum;
import io.github.xiaour.datasync.logic.sync.DataBaseInfo;
import io.github.xiaour.datasync.logic.sync.DataBaseSync;
import io.github.xiaour.datasync.tools.ConstantsTools;
import io.github.xiaour.datasync.tools.DESPlus;
import io.github.xiaour.datasync.tools.DbUtilMySQL;
import io.github.xiaour.datasync.tools.PropertyUtil;
import io.github.xiaour.datasync.ui.UiConsts;
import io.github.xiaour.datasync.ui.component.MyIconButton;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.swing.*;
import java.awt.*;
import java.sql.Connection;
/**
* 目标数据库面板
*
* @author Bob
*/
public class DatabasePanelTo extends JPanel{
private static final long serialVersionUID = 1L;
public static MyIconButton buttonStartSync;
private static MyIconButton buttonTestLink;
private static JTextField textFieldDatabaseHost;
private static JTextField textFieldDatabaseName;
private static JTextField textFieldDatabaseUser;
private static JPasswordField passwordFieldDatabasePassword;
private static ButtonGroup buttonGroup;
private static JRadioButton radioBtn01;
private static JRadioButton radioBtn02;
private static JProgressBar progressBar;
private static final int MIN_PROGRESS = 0;
private static final int MAX_PROGRESS = 100;
public static int currentProgress = MIN_PROGRESS;
//默认只同步全量数据
private static int dangerOpt = DangerOperationEnum.FULL_DATA_ONLY.ordinal();
private static final Logger logger = LoggerFactory.getLogger(DatabasePanelTo.class);
/**
* 构造
*/
public DatabasePanelTo() {
initialize();
addComponent();
setContent();
addListener();
}
/**
* 初始化
*/
private void initialize() {
this.setBackground(UiConsts.MAIN_BACK_COLOR);
this.setLayout(new BorderLayout());
}
/**
* 添加组件
*/
private void addComponent() {
this.add(getCenterPanel(), BorderLayout.CENTER);
this.add(getDownPanel(), BorderLayout.SOUTH);
}
/**
* 中部面板
*
* @return
*/
private JPanel getCenterPanel() {
// 中间面板
JPanel panelCenter = new JPanel();
panelCenter.setBackground(UiConsts.MAIN_BACK_COLOR);
panelCenter.setLayout(new GridLayout(2, 1));
// 设置Grid
JPanel panelGridSetting = new JPanel();
panelGridSetting.setBackground(UiConsts.MAIN_BACK_COLOR);
panelGridSetting.setLayout(new FlowLayout(FlowLayout.LEFT, UiConsts.MAIN_H_GAP, 5));
// 初始化组件
JLabel labelDatabaseType = new JLabel(PropertyUtil.getProperty("ds.ui.database.type"));
JLabel labelDatabaseHost = new JLabel(PropertyUtil.getProperty("ds.ui.database.host"));
JLabel labelDatabaseName = new JLabel(PropertyUtil.getProperty("ds.ui.database.name"));
JLabel labelDatabaseUser = new JLabel(PropertyUtil.getProperty("ds.ui.database.user"));
JLabel labelDatabasePassword = new JLabel(PropertyUtil.getProperty("ds.ui.database.password"));
JLabel labelDangerOperation = new JLabel(PropertyUtil.getProperty("ds.ui.database.dangerOpt"));
JComboBox<String> comboxDatabaseType = new JComboBox<>();
comboxDatabaseType.addItem("MySQL");
comboxDatabaseType.setEditable(false);
textFieldDatabaseHost = new JTextField();
textFieldDatabaseName = new JTextField();
textFieldDatabaseUser = new JTextField();
passwordFieldDatabasePassword = new J<PASSWORD>Field();
progressBar = new JProgressBar();
// 设置进度的 最小值 和 最大值
progressBar.setMinimum(MIN_PROGRESS);
progressBar.setMaximum(MAX_PROGRESS);
progressBar.setStringPainted(true);
// 创建按钮组,把两个单选按钮添加到该组
buttonGroup= new ButtonGroup();
// 创建两个单选按钮
radioBtn01 = new JRadioButton(PropertyUtil.getProperty("ds.ui.database.danger.data"));
radioBtn02 = new JRadioButton(PropertyUtil.getProperty("ds.ui.database.danger.tableData"));
buttonGroup.add(radioBtn01);
buttonGroup.add(radioBtn02);
// 设置第一个单选按钮选中
radioBtn01.setSelected(true);
radioBtn01.setOpaque(false);
radioBtn02.setOpaque(false);
// 字体
labelDatabaseType.setFont(UiConsts.FONT_NORMAL);
labelDatabaseHost.setFont(UiConsts.FONT_NORMAL);
labelDatabaseName.setFont(UiConsts.FONT_NORMAL);
labelDatabaseUser.setFont(UiConsts.FONT_NORMAL);
labelDatabasePassword.setFont(UiConsts.FONT_NORMAL);
labelDangerOperation.setFont(UiConsts.FONT_NORMAL);
comboxDatabaseType.setFont(UiConsts.FONT_NORMAL);
textFieldDatabaseHost.setFont(UiConsts.FONT_NORMAL);
textFieldDatabaseName.setFont(UiConsts.FONT_NORMAL);
textFieldDatabaseUser.setFont(UiConsts.FONT_NORMAL);
passwordFieldDatabasePassword.setFont(UiConsts.FONT_NORMAL);
progressBar.setFont(UiConsts.FONT_NORMAL);
radioBtn01.setFont(UiConsts.FONT_NORMAL);
radioBtn02.setFont(UiConsts.FONT_NORMAL);
// 大小
labelDatabaseType.setPreferredSize(UiConsts.LABLE_SIZE_ITEM);
labelDatabaseHost.setPreferredSize(UiConsts.LABLE_SIZE_ITEM);
labelDatabaseName.setPreferredSize(UiConsts.LABLE_SIZE_ITEM);
labelDatabaseUser.setPreferredSize(UiConsts.LABLE_SIZE_ITEM);
labelDatabasePassword.setPreferredSize(UiConsts.LABLE_SIZE_ITEM);
comboxDatabaseType.setPreferredSize(UiConsts.TEXT_FIELD_SIZE_ITEM);
textFieldDatabaseHost.setPreferredSize(UiConsts.TEXT_FIELD_SIZE_ITEM);
textFieldDatabaseName.setPreferredSize(UiConsts.TEXT_FIELD_SIZE_ITEM);
textFieldDatabaseUser.setPreferredSize(UiConsts.TEXT_FIELD_SIZE_ITEM);
passwordFieldDatabasePassword.setPreferredSize(UiConsts.TEXT_FIELD_SIZE_ITEM);
progressBar.setPreferredSize(UiConsts.TEXT_FIELD_SIZE_ITEM);
// 组合元素
panelGridSetting.add(labelDatabaseType);
panelGridSetting.add(comboxDatabaseType);
panelGridSetting.add(labelDatabaseHost);
panelGridSetting.add(textFieldDatabaseHost);
panelGridSetting.add(labelDatabaseName);
panelGridSetting.add(textFieldDatabaseName);
panelGridSetting.add(labelDatabaseUser);
panelGridSetting.add(textFieldDatabaseUser);
panelGridSetting.add(labelDatabasePassword);
panelGridSetting.add(passwordFieldDatabasePassword);
panelGridSetting.add(labelDangerOperation);
panelGridSetting.add(radioBtn01);
panelGridSetting.add(radioBtn02);
// 设置进度条Grid
JPanel panelGridProgress = new JPanel();
panelGridProgress.setBackground(UiConsts.MAIN_BACK_COLOR);
panelGridProgress.setLayout(new FlowLayout(FlowLayout.LEFT, UiConsts.MAIN_H_GAP, 5));
JLabel labelSyncProgress = new JLabel(PropertyUtil.getProperty("ds.ui.database.sync.progress"));
labelSyncProgress.setFont(UiConsts.FONT_NORMAL);
labelSyncProgress.setPreferredSize(UiConsts.LABLE_SIZE_ITEM);
panelGridProgress.add(labelSyncProgress);
panelGridProgress.add(progressBar);
panelCenter.add(panelGridSetting);
panelCenter.add(panelGridProgress);
return panelCenter;
}
/**
* 底部面板
*
* @return
*/
private JPanel getDownPanel() {
JPanel panelDown = new JPanel();
panelDown.setBackground(UiConsts.MAIN_BACK_COLOR);
panelDown.setLayout(new FlowLayout(FlowLayout.RIGHT, UiConsts.MAIN_H_GAP, 5));
buttonTestLink = new MyIconButton(UiConsts.ICON_TEST_LINK, UiConsts.ICON_TEST_LINK_ENABLE,
UiConsts.ICON_TEST_LINK_DISABLE, "");
buttonStartSync = new MyIconButton(UiConsts.ICON_SYNC_NOW, UiConsts.ICON_SYNC_NOW_ENABLE,
UiConsts.ICON_SYNC_NOW_DISABLE, "开始同步数据,需要等待一会儿");
panelDown.add(buttonTestLink);
panelDown.add(buttonStartSync);
return panelDown;
}
/**
* 设置文本区内容
*/
public static void setContent() {
textFieldDatabaseHost.setText(ConstantsTools.CONFIGER.getHostTo());
textFieldDatabaseName.setText(ConstantsTools.CONFIGER.getNameTo());
String user = "";
String password = "";
try {
DESPlus des = new DESPlus();
user = des.decrypt(ConstantsTools.CONFIGER.getUserTo());
password = des.decrypt(ConstantsTools.CONFIGER.getPasswordTo());
} catch (Exception e) {
logger.error(PropertyUtil.getProperty("ds.ui.database.to.err.decode") + e.toString());
e.printStackTrace();
}
textFieldDatabaseUser.setText(user);
passwordFieldDatabasePassword.setText(password);
}
/**
* 为相关组件添加事件监听
*/
private void addListener() {
radioBtn01.addActionListener(e ->{
dangerOpt = DangerOperationEnum.FULL_DATA_ONLY.ordinal();
});
radioBtn02.addActionListener(e ->{
dangerOpt = DangerOperationEnum.FULL_DATA_AND_TABLE.ordinal();
});
buttonStartSync.addChangeListener(Chan -> {
});
buttonStartSync.addActionListener(e -> {
try {
ConstantsTools.CONFIGER.setHostTo(textFieldDatabaseHost.getText());
ConstantsTools.CONFIGER.setNameTo(textFieldDatabaseName.getText());
String password = "";
String user = "";
try {
DESPlus des = new DESPlus();
user = des.encrypt(textFieldDatabaseUser.getText());
password = des.encrypt(new String(passwordFieldDatabasePassword.getPassword()));
} catch (Exception e1) {
logger.error(PropertyUtil.getProperty("ds.ui.database.to.err.encode") + e1.toString());
e1.printStackTrace();
}
ConstantsTools.CONFIGER.setUserTo(user);
ConstantsTools.CONFIGER.setPasswordTo(password);
DataBaseInfo dbFrom = ConstantsTools.CONFIGER.getDataBaseFrom();
DataBaseInfo dbTo = ConstantsTools.CONFIGER.getDataBaseTo();
DataBaseSync dataBaseSync = new DataBaseSync(dbFrom,dbTo,dangerOpt,currentProgress,10000);
java.util.List<String> msgList = dataBaseSync.syncDataBase();
currentProgress = 100;
progressBar.setValue(currentProgress);
JOptionPane.showMessageDialog(App.databasePanel,String.join("\n", msgList), PropertyUtil.getProperty("ds.ui.tips"), JOptionPane.PLAIN_MESSAGE);
buttonStartSync.setEnabled(true);
currentProgress = MIN_PROGRESS;
} catch (Exception e1) {
buttonStartSync.setEnabled(true);
JOptionPane.showMessageDialog(App.databasePanel, PropertyUtil.getProperty("ds.ui.save.fail") + e1.getMessage(), PropertyUtil.getProperty("ds.ui.tips"), JOptionPane.ERROR_MESSAGE);
logger.error("Write to xml file error" + e1.toString());
e1.printStackTrace();
}
});
buttonTestLink.addActionListener(e -> {
try {
DbUtilMySQL dbMySQL = DbUtilMySQL.getInstance();
String dburl = textFieldDatabaseHost.getText();
String dbname = textFieldDatabaseName.getText();
String dbuser = textFieldDatabaseUser.getText();
String dbpassword = new String(<PASSWORD>Field<PASSWORD>());
Connection conn = dbMySQL.testConnection(dburl, dbname, dbuser, dbpassword);
if (conn == null) {
JOptionPane.showMessageDialog(App.databasePanel, PropertyUtil.getProperty("ds.ui.database.err.link.fail"), PropertyUtil.getProperty("ds.ui.tips"),
JOptionPane.ERROR_MESSAGE);
} else {
JOptionPane.showMessageDialog(App.databasePanel, PropertyUtil.getProperty("ds.ui.database.err.link.success"), PropertyUtil.getProperty("ds.ui.tips"),
JOptionPane.PLAIN_MESSAGE);
}
} catch (Exception e1) {
JOptionPane.showMessageDialog(App.databasePanel, PropertyUtil.getProperty("ds.ui.database.err.link.fail") + e1.getMessage(), PropertyUtil.getProperty("ds.ui.tips"),
JOptionPane.ERROR_MESSAGE);
}
});
}
}
| 12,850 | 0.667938 | 0.663251 | 324 | 37.851852 | 33.700153 | 195 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.669753 | false | false |
7
|
c0b8c5a6a8d6e6b2e0b2c7d41fe6a80b123b40b7
| 386,547,126,165 |
c3e152039fffb8c97bb7f417d9679fc7c777ae5f
|
/app/src/main/java/com/devperso/benjamin/a2playergame/Case.java
|
4965631d5f7d3692dde973e3776205cda2b74b0f
|
[] |
no_license
|
bdi-carlo/2PlayerGame
|
https://github.com/bdi-carlo/2PlayerGame
|
68629f1f91615af5f7e291860ec9e0ed0e1a27d9
|
4c0301169c153c65b428bddeb7ef40eee68830d7
|
refs/heads/master
| 2020-04-21T12:05:06.294000 | 2019-04-26T12:35:29 | 2019-04-26T12:35:29 | 169,550,772 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.devperso.benjamin.a2playergame;
import android.content.Context;
import android.view.Gravity;
import android.view.View;
import android.widget.ImageView;
import android.widget.Toast;
public class Case {
private int joueur;
private TicTacToeActivity game;
private ImageView imageView;
private Context cont;
public Case( TicTacToeActivity aGame, Context cont, ImageView aButton ){
this.joueur = 0;
this.imageView = aButton;
this.cont = cont;
this.game = aGame;
}
public void popUp( String message ) {
Toast toast = Toast.makeText( cont, message, Toast.LENGTH_LONG );
toast.setGravity(Gravity.CENTER, 0, 0);
toast.show();
}
public void changeImage(){
if( this.game.statut != 0 )
popUp( this.game.cont.getString(R.string.finish) );
else {
if (this.joueur != 0)
popUp( this.game.cont.getString(R.string.full) );
else {
this.joueur = this.game.getTour();
if (this.joueur == 1)
this.imageView.setImageResource(R.drawable.trump);
else
this.imageView.setImageResource(R.drawable.poutine);
this.game.changeTour();
this.game.setText();
this.game.checkWin(this.joueur);
}
}
}
public void setClickListener(){
this.imageView.setOnClickListener( new View.OnClickListener() {
@Override
public void onClick(View v) {
changeImage();
}
});
}
public void reset(){
this.joueur = 0;
this.imageView.setImageResource(R.drawable.empty);
}
public int getJoueur(){
return this.joueur;
}
}
|
UTF-8
|
Java
| 1,886 |
java
|
Case.java
|
Java
|
[] | null |
[] |
package com.devperso.benjamin.a2playergame;
import android.content.Context;
import android.view.Gravity;
import android.view.View;
import android.widget.ImageView;
import android.widget.Toast;
public class Case {
private int joueur;
private TicTacToeActivity game;
private ImageView imageView;
private Context cont;
public Case( TicTacToeActivity aGame, Context cont, ImageView aButton ){
this.joueur = 0;
this.imageView = aButton;
this.cont = cont;
this.game = aGame;
}
public void popUp( String message ) {
Toast toast = Toast.makeText( cont, message, Toast.LENGTH_LONG );
toast.setGravity(Gravity.CENTER, 0, 0);
toast.show();
}
public void changeImage(){
if( this.game.statut != 0 )
popUp( this.game.cont.getString(R.string.finish) );
else {
if (this.joueur != 0)
popUp( this.game.cont.getString(R.string.full) );
else {
this.joueur = this.game.getTour();
if (this.joueur == 1)
this.imageView.setImageResource(R.drawable.trump);
else
this.imageView.setImageResource(R.drawable.poutine);
this.game.changeTour();
this.game.setText();
this.game.checkWin(this.joueur);
}
}
}
public void setClickListener(){
this.imageView.setOnClickListener( new View.OnClickListener() {
@Override
public void onClick(View v) {
changeImage();
}
});
}
public void reset(){
this.joueur = 0;
this.imageView.setImageResource(R.drawable.empty);
}
public int getJoueur(){
return this.joueur;
}
}
| 1,886 | 0.552492 | 0.54825 | 67 | 26.149254 | 21.066528 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.537313 | false | false |
7
|
937d3e2a77c0dca4824dfaf8be4ad0b14c8d2a21
| 17,875,653,897,768 |
d65bdbf1e2d24ee7705e75e7dbc3f2e440537c48
|
/src/RGT/common/interfaces/IBusinessProcess.java
|
4c197cbc01724e2d08d7b1af8e1c25ab72c0e650
|
[] |
no_license
|
himatbhanushali/Requirement-Generator-Tool
|
https://github.com/himatbhanushali/Requirement-Generator-Tool
|
2d33b78a0e6e91dadedd6ff24f34fd599eeaa452
|
dd06a39f4da59e9ae82ce4040061f421456cfdee
|
refs/heads/master
| 2021-07-19T20:18:18.703000 | 2016-11-28T08:14:16 | 2017-10-25T07:14:52 | 108,233,516 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package RGT.common.interfaces;
import java.util.List;
public interface IBusinessProcess extends IVerbNounPhrase {
public boolean addStep(IStep aStep);
public boolean removeStep(IStep aStep);
public List<IStep> getSteps();
}
|
UTF-8
|
Java
| 230 |
java
|
IBusinessProcess.java
|
Java
|
[] | null |
[] |
package RGT.common.interfaces;
import java.util.List;
public interface IBusinessProcess extends IVerbNounPhrase {
public boolean addStep(IStep aStep);
public boolean removeStep(IStep aStep);
public List<IStep> getSteps();
}
| 230 | 0.795652 | 0.795652 | 9 | 24.555555 | 19.528391 | 59 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.888889 | false | false |
7
|
fd7b071392a66255801d1328054f611019840b04
| 29,497,835,455,240 |
417cb866817704b0dcde81bb24b334be1423e2ab
|
/FinancimientoDeProyectos/src/financiamientodeproyectos/Registro.java
|
b777666537a921889b00bb9065b949eed4590f83
|
[] |
no_license
|
GelukkigTurtle/Calculadora-Evaluacion-de-proyectos-de-Centros-de-Computo
|
https://github.com/GelukkigTurtle/Calculadora-Evaluacion-de-proyectos-de-Centros-de-Computo
|
e50dd1848c965460fe80629af038f491617262b0
|
22412a0162e87599806fc425de3280fcaef5eaba
|
refs/heads/master
| 2021-01-23T08:28:17.416000 | 2016-11-14T16:20:23 | 2016-11-14T16:20:23 | 29,138,886 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* 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 financiamientodeproyectos;
import java.math.BigDecimal;
/**
*
* @author Freddy
*/
public class Registro {
BigDecimal anio;
BigDecimal interes;
BigDecimal pagoFinAnio;
BigDecimal deudaDespuesPago;
BigDecimal pagoACapital;
BigDecimal pagoAnual;
BigDecimal pagoAPrincipal;
public Registro() {
super();
// TODO Auto-generated constructor stub
}
public BigDecimal getAnio() {
return anio;
}
public void setAnio(BigDecimal anio) {
this.anio = anio;
}
public BigDecimal getInteres() {
return interes;
}
public void setInteres(BigDecimal interes) {
this.interes = interes;
}
public BigDecimal getPagoFinAnio() {
return pagoFinAnio;
}
public void setPagoFinAnio(BigDecimal pagoFinAnio) {
this.pagoFinAnio = pagoFinAnio;
}
public BigDecimal getDeudaDespuesPago() {
return deudaDespuesPago;
}
public void setDeudaDespuesPago(BigDecimal deudaDespuesPago) {
this.deudaDespuesPago = deudaDespuesPago;
}
public BigDecimal getPagoACapital() {
return pagoACapital;
}
public void setPagoACapital(BigDecimal pagoACapital) {
this.pagoACapital = pagoACapital;
}
public BigDecimal getPagoAnual() {
return pagoAnual;
}
public void setPagoAnual(BigDecimal pagoAnual) {
this.pagoAnual = pagoAnual;
}
public BigDecimal getPagoAPrincipal() {
return pagoAPrincipal;
}
public void setPagoAPrincipal(BigDecimal pagoAPrincipal) {
this.pagoAPrincipal = pagoAPrincipal;
}
}
|
UTF-8
|
Java
| 1,621 |
java
|
Registro.java
|
Java
|
[
{
"context": ";\n\nimport java.math.BigDecimal;\n\n/**\n *\n * @author Freddy\n */\npublic class Registro {\n BigDecimal anio;\n",
"end": 275,
"score": 0.9989199638366699,
"start": 269,
"tag": "NAME",
"value": "Freddy"
}
] | null |
[] |
/*
* 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 financiamientodeproyectos;
import java.math.BigDecimal;
/**
*
* @author Freddy
*/
public class Registro {
BigDecimal anio;
BigDecimal interes;
BigDecimal pagoFinAnio;
BigDecimal deudaDespuesPago;
BigDecimal pagoACapital;
BigDecimal pagoAnual;
BigDecimal pagoAPrincipal;
public Registro() {
super();
// TODO Auto-generated constructor stub
}
public BigDecimal getAnio() {
return anio;
}
public void setAnio(BigDecimal anio) {
this.anio = anio;
}
public BigDecimal getInteres() {
return interes;
}
public void setInteres(BigDecimal interes) {
this.interes = interes;
}
public BigDecimal getPagoFinAnio() {
return pagoFinAnio;
}
public void setPagoFinAnio(BigDecimal pagoFinAnio) {
this.pagoFinAnio = pagoFinAnio;
}
public BigDecimal getDeudaDespuesPago() {
return deudaDespuesPago;
}
public void setDeudaDespuesPago(BigDecimal deudaDespuesPago) {
this.deudaDespuesPago = deudaDespuesPago;
}
public BigDecimal getPagoACapital() {
return pagoACapital;
}
public void setPagoACapital(BigDecimal pagoACapital) {
this.pagoACapital = pagoACapital;
}
public BigDecimal getPagoAnual() {
return pagoAnual;
}
public void setPagoAnual(BigDecimal pagoAnual) {
this.pagoAnual = pagoAnual;
}
public BigDecimal getPagoAPrincipal() {
return pagoAPrincipal;
}
public void setPagoAPrincipal(BigDecimal pagoAPrincipal) {
this.pagoAPrincipal = pagoAPrincipal;
}
}
| 1,621 | 0.752622 | 0.752622 | 73 | 21.205479 | 19.029867 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.369863 | false | false |
7
|
91e3bf03433228fccadb2197bed613a5beb3acb4
| 19,628,000,602,686 |
8ef96f524f2f33ee890c89fa404b9d09a1f06d46
|
/library/src/main/java/com/kevinleighcrain/opengl/core/MovableImage2D.java
|
fcfca2e266ddf9330ee3c7d896014ca1cd93b85d
|
[] |
no_license
|
KevinLeighCrain/OpenGLKit
|
https://github.com/KevinLeighCrain/OpenGLKit
|
2d60fb8f9f27ff5d3f8f7889c54bccd34d067b60
|
039472b3a6fea2d9c392de5ad9f9606966976a1b
|
refs/heads/master
| 2016-09-13T14:55:21.318000 | 2016-06-10T12:02:32 | 2016-06-10T12:02:32 | 60,014,764 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.kevinleighcrain.opengl.core;
import android.content.Context;
import android.graphics.PointF;
/**
* @author Kevin Leigh Crain
*/
public abstract class MovableImage2D extends Image2D implements IMovable {
public MovableImage2D(Context context,
Texture texture,
PointF size,
Vertex position,
float yAngle,
float bottom) {
super(context, texture, size, position, yAngle, bottom);
}
}
|
UTF-8
|
Java
| 562 |
java
|
MovableImage2D.java
|
Java
|
[
{
"context": "import android.graphics.PointF;\r\n\r\n/**\r\n * @author Kevin Leigh Crain\r\n */\r\npublic abstract class MovableImage2D extend",
"end": 145,
"score": 0.9998767971992493,
"start": 128,
"tag": "NAME",
"value": "Kevin Leigh Crain"
}
] | null |
[] |
package com.kevinleighcrain.opengl.core;
import android.content.Context;
import android.graphics.PointF;
/**
* @author <NAME>
*/
public abstract class MovableImage2D extends Image2D implements IMovable {
public MovableImage2D(Context context,
Texture texture,
PointF size,
Vertex position,
float yAngle,
float bottom) {
super(context, texture, size, position, yAngle, bottom);
}
}
| 551 | 0.55516 | 0.549822 | 19 | 27.578947 | 22.25289 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.736842 | false | false |
7
|
561383c939c5d79db26fba470c3c6d73602c5a18
| 10,299,331,638,589 |
eb9f655206c43c12b497c667ba56a0d358b6bc3a
|
/java/java-tests/testData/inspection/dataFlow/tracker/SimpleContract.java
|
566cfb97c17a487b4647e209d4eaa7681d140095
|
[
"Apache-2.0"
] |
permissive
|
JetBrains/intellij-community
|
https://github.com/JetBrains/intellij-community
|
2ed226e200ecc17c037dcddd4a006de56cd43941
|
05dbd4575d01a213f3f4d69aa4968473f2536142
|
refs/heads/master
| 2023-09-03T17:06:37.560000 | 2023-09-03T11:51:00 | 2023-09-03T12:12:27 | 2,489,216 | 16,288 | 6,635 |
Apache-2.0
| false | 2023-09-12T07:41:58 | 2011-09-30T13:33:05 | 2023-09-12T03:37:30 | 2023-09-12T06:46:46 | 4,523,919 | 15,754 | 4,972 | 237 | null | false | false |
/*
Value is always false (Objects.isNull(s); line#12)
According to inferred contract, method 'isNull' returns 'false' when s != null (isNull; line#12)
's' was dereferenced (s; line#11)
*/
import java.util.Objects;
class Test {
void test(String s) {
System.out.println(s.trim());
if (<selection>Objects.isNull(s)</selection>) {
}
}
}
|
UTF-8
|
Java
| 364 |
java
|
SimpleContract.java
|
Java
|
[] | null |
[] |
/*
Value is always false (Objects.isNull(s); line#12)
According to inferred contract, method 'isNull' returns 'false' when s != null (isNull; line#12)
's' was dereferenced (s; line#11)
*/
import java.util.Objects;
class Test {
void test(String s) {
System.out.println(s.trim());
if (<selection>Objects.isNull(s)</selection>) {
}
}
}
| 364 | 0.64011 | 0.623626 | 16 | 21.8125 | 26.139574 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.375 | false | false |
7
|
0a83f4a7d6b4d22c473b9597110ca0eba5005de9
| 919,123,015,781 |
8b415499ed2f73b1cf05ef7b8f793248bb97ec86
|
/src/main/java/com/opportunitymanagement/app/service/OpportunityService.java
|
0ccd2da3ddf588858484231418b259451535140f
|
[] |
no_license
|
joablisa1/opportunity
|
https://github.com/joablisa1/opportunity
|
4935290bda0c63036e9d0e06602b4ea45f1ccf8f
|
34255db8aff41fa37263ef42e7d4022334471111
|
refs/heads/master
| 2023-03-06T23:30:55.992000 | 2021-02-20T22:56:22 | 2021-02-20T22:56:22 | 340,646,676 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.opportunitymanagement.app.service;
import com.opportunitymanagement.app.entities.Account;
import com.opportunitymanagement.app.entities.Opportunity;
import java.util.List;
public interface OpportunityService {
Opportunity createOpportunity(Opportunity opportunity);
Opportunity getOpportunityByID(Long id);
List<Opportunity> getListOpportunity();
Account getByAccountName(String accountName);
Account getAccountById(Long id);
List<Account> getAccountList();
}
|
UTF-8
|
Java
| 499 |
java
|
OpportunityService.java
|
Java
|
[] | null |
[] |
package com.opportunitymanagement.app.service;
import com.opportunitymanagement.app.entities.Account;
import com.opportunitymanagement.app.entities.Opportunity;
import java.util.List;
public interface OpportunityService {
Opportunity createOpportunity(Opportunity opportunity);
Opportunity getOpportunityByID(Long id);
List<Opportunity> getListOpportunity();
Account getByAccountName(String accountName);
Account getAccountById(Long id);
List<Account> getAccountList();
}
| 499 | 0.805611 | 0.805611 | 15 | 32.266666 | 21.324373 | 59 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.666667 | false | false |
7
|
e8670eb19134506a6570392320f51e15e1246e54
| 446,676,602,813 |
1f31438246d958e3f0ed7223d13c9c842e5a6e9c
|
/test/datastore/LoadSaveGameStateTest.java
|
d59c50fbabc76b659f443978ec89ed15e863af37
|
[] |
no_license
|
liljaminkev/SEII_HearthStone
|
https://github.com/liljaminkev/SEII_HearthStone
|
931b17a6062a77cce4875432a9e81456bbf99025
|
1b45e040b26557e6d881172f34a66390b6e6e605
|
refs/heads/master
| 2021-01-19T22:09:08.351000 | 2017-03-11T03:46:55 | 2017-03-11T03:46:55 | 80,075,042 | 0 | 0 | null | false | 2017-03-11T03:46:55 | 2017-01-26T01:15:33 | 2017-02-03T07:24:42 | 2017-03-11T03:46:55 | 175 | 0 | 0 | 2 |
Java
| null | null |
/*
* 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 datastore;
import datastore.*;
import playerassets.*;
import hero.*;
import hero.hearthstone.*;
import hero.stormwars.*;
import java.util.ArrayList;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
/**
*
* @author James
*/
public class LoadSaveGameStateTest {
Player p1, p2;
Hero h1, h2;
Deck d1, d2;
Hand ha1, ha2;
ArrayList<Player> fromFile = null;
public LoadSaveGameStateTest() {
SaveGameState.saveFile(p1, p2, "testSaveFile.txt");
fromFile = new AraryList<Player>();
fromFile = LoadGameState.loadGame("testSaveFile.txt");
assertEquals("Jaina" == fromFile.get(0).getName());
assertEquals("Laertes" == fromFile.get(1).getName());
}
@Before
public void setUp() {
p1 = new PlayerHearthStone();
p2 = new PlayerStormWars();
h1 = new Jaina();
h2 = new Laertes();
d1 = new Deck();
d2 = new Deck();
ha1 = new Hand();
ha2 = new Hand();
}
}
|
UTF-8
|
Java
| 1,350 |
java
|
LoadSaveGameStateTest.java
|
Java
|
[
{
"context": "port static org.junit.Assert.*;\n\n/**\n *\n * @author James\n */\npublic class LoadSaveGameStateTest {\n Play",
"end": 532,
"score": 0.9983772039413452,
"start": 527,
"tag": "NAME",
"value": "James"
}
] | null |
[] |
/*
* 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 datastore;
import datastore.*;
import playerassets.*;
import hero.*;
import hero.hearthstone.*;
import hero.stormwars.*;
import java.util.ArrayList;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
/**
*
* @author James
*/
public class LoadSaveGameStateTest {
Player p1, p2;
Hero h1, h2;
Deck d1, d2;
Hand ha1, ha2;
ArrayList<Player> fromFile = null;
public LoadSaveGameStateTest() {
SaveGameState.saveFile(p1, p2, "testSaveFile.txt");
fromFile = new AraryList<Player>();
fromFile = LoadGameState.loadGame("testSaveFile.txt");
assertEquals("Jaina" == fromFile.get(0).getName());
assertEquals("Laertes" == fromFile.get(1).getName());
}
@Before
public void setUp() {
p1 = new PlayerHearthStone();
p2 = new PlayerStormWars();
h1 = new Jaina();
h2 = new Laertes();
d1 = new Deck();
d2 = new Deck();
ha1 = new Hand();
ha2 = new Hand();
}
}
| 1,350 | 0.615556 | 0.600741 | 58 | 22.275862 | 18.198895 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.689655 | false | false |
7
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.