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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
7cdeba63e8ac74d4114f5390e67961c6e5310c9c
| 5,385,889,049,636 |
78ab6488f5a345816e61624e0ff748c17ddf0c69
|
/cj.netos.network.node/src/cj/netos/network/node/pump/PutDownstreamEventTask.java
|
9395e91f1a5f5cf8cccd9163b32abbdab5b44b5d
|
[] |
no_license
|
carocean/cj.netos.network
|
https://github.com/carocean/cj.netos.network
|
0077326897aa9469bdf62c6802e10c768b70b805
|
b15b75ed8f2e06921d84a7985849c0692b5dc21c
|
refs/heads/master
| 2022-04-11T16:57:00.850000 | 2020-03-16T17:07:00 | 2020-03-16T17:07:00 | 242,980,039 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package cj.netos.network.node.pump;
import cj.netos.network.node.Direction;
import cj.netos.network.node.eventloop.EventTask;
import cj.netos.network.node.eventloop.ILine;
import cj.netos.network.node.eventloop.IReceiver;
import cj.netos.network.node.eventloop.ITaskQueue;
import cj.studio.ecm.net.CircuitException;
public class PutDownstreamEventTask implements IReceiver {
ITaskQueue queue;
@Override
public void receive(EventTask task, ILine line) throws CircuitException {
queue.append(task);
}
@Override
public void error(EventTask task, Throwable e, ILine line) {
}
public PutDownstreamEventTask(ITaskQueue queue) {
this.queue = queue;
}
}
|
UTF-8
|
Java
| 704 |
java
|
PutDownstreamEventTask.java
|
Java
|
[] | null |
[] |
package cj.netos.network.node.pump;
import cj.netos.network.node.Direction;
import cj.netos.network.node.eventloop.EventTask;
import cj.netos.network.node.eventloop.ILine;
import cj.netos.network.node.eventloop.IReceiver;
import cj.netos.network.node.eventloop.ITaskQueue;
import cj.studio.ecm.net.CircuitException;
public class PutDownstreamEventTask implements IReceiver {
ITaskQueue queue;
@Override
public void receive(EventTask task, ILine line) throws CircuitException {
queue.append(task);
}
@Override
public void error(EventTask task, Throwable e, ILine line) {
}
public PutDownstreamEventTask(ITaskQueue queue) {
this.queue = queue;
}
}
| 704 | 0.747159 | 0.747159 | 26 | 26.076923 | 23.751799 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false |
1
|
3422051914efcae822d8046c6159fafe138366f6
| 34,368,328,358,765 |
0997ef8c8b85ddc08b038e0d326829dd9be44f72
|
/java/com/example/connect/MyListAdapter.java
|
fc4bff17228dcb001e91084c4e593f0297886580
|
[] |
no_license
|
bharathkumar111/T5
|
https://github.com/bharathkumar111/T5
|
75d5a18e5ad8cac30282acc8fcba9526b82ddde7
|
8c67b7c409024baa0424ee425c251d093cd3f57a
|
refs/heads/main
| 2023-02-22T13:13:47.222000 | 2021-01-13T10:38:52 | 2021-01-13T10:38:52 | 329,273,247 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.connect;
import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Filter;
import android.widget.Filterable;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
import java.util.List;
public class MyListAdapter extends RecyclerView.Adapter<MyListAdapter.ViewHolder> implements Filterable {
private MyListData[] listdata;
List<String> moviesListAll;
// RecyclerView recyclerView;
public MyListAdapter(MyListData[] listdata) {
this.listdata = listdata;
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext());
View listItem= layoutInflater.inflate(R.layout.list_item, parent, false);
ViewHolder viewHolder = new ViewHolder(listItem);
return viewHolder;
}
@Override
public void onBindViewHolder(ViewHolder holder, final int position) {
final MyListData myListData = listdata[position];
holder.textView.setText(listdata[position].getDescription());
holder.imageView.setImageResource(listdata[position].getImgId());
holder.relativeLayout.setOnClickListener(new View.OnClickListener() {
int bk;
@Override
public void onClick(View view) {
final Intent intent;
switch (position){
case 0:
intent=new Intent(context,Main5Activity.class);
break;
case 1:
intent = new Intent(context, Main6Activity.class);
break;
case 2:
intent = new Intent(context, Main7Activity.class);
break;
case 3: intent = new Intent(context, Main8Activity.class);
break;
case 4: intent = new Intent(context, Main9Activity.class);
break;
case 5: intent = new Intent(context, Main10Activity.class);
break;
case 6: intent = new Intent(context, Main11Activity.class);
break;
case 7: intent = new Intent(context, Main12Activity.class);
break;
case 8: intent = new Intent(context, Main13Activity.class);
break;
case 9: intent = new Intent(context, Main14Activity.class);
break;
case 10: intent = new Intent(context, Main15Activity.class);
break;
case 11: intent = new Intent(context, Main17Activity.class);
break;
default:
intent = new Intent(context, Main4Activity.class);
break;
}
context.startActivity(intent);
}
});
}
@Override
public int getItemCount() {
return listdata.length;
}
private Context context = null;
@Override
public Filter getFilter() {
return filter;
}
Filter filter =new Filter() {
@Override
protected FilterResults performFiltering(CharSequence charSequence) {
List<String> filteredList=new ArrayList<>();
if ( charSequence.toString().isEmpty()){
filteredList.addAll(moviesListAll);
}
else
{
for(String movie: moviesListAll)
{
if(movie.toLowerCase().contains(charSequence.toString().toLowerCase()))
{
filteredList.add(movie);
}
}
}
FilterResults filterResults=new FilterResults();
filterResults.values=filteredList;
return filterResults;
}
@Override
protected void publishResults(CharSequence constraint, FilterResults results) {
notifyDataSetChanged();
}
};
public class ViewHolder extends RecyclerView.ViewHolder {
public ImageView imageView;
public TextView textView;
public RelativeLayout relativeLayout;
public ViewHolder(View itemView) {
super(itemView);
context=itemView.getContext();
this.imageView = (ImageView) itemView.findViewById(R.id.imageView);
this.textView = (TextView) itemView.findViewById(R.id.textView);
relativeLayout = (RelativeLayout)itemView.findViewById(R.id.relativeLayout);
}
}
}
|
UTF-8
|
Java
| 5,205 |
java
|
MyListAdapter.java
|
Java
|
[] | null |
[] |
package com.example.connect;
import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Filter;
import android.widget.Filterable;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
import java.util.List;
public class MyListAdapter extends RecyclerView.Adapter<MyListAdapter.ViewHolder> implements Filterable {
private MyListData[] listdata;
List<String> moviesListAll;
// RecyclerView recyclerView;
public MyListAdapter(MyListData[] listdata) {
this.listdata = listdata;
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext());
View listItem= layoutInflater.inflate(R.layout.list_item, parent, false);
ViewHolder viewHolder = new ViewHolder(listItem);
return viewHolder;
}
@Override
public void onBindViewHolder(ViewHolder holder, final int position) {
final MyListData myListData = listdata[position];
holder.textView.setText(listdata[position].getDescription());
holder.imageView.setImageResource(listdata[position].getImgId());
holder.relativeLayout.setOnClickListener(new View.OnClickListener() {
int bk;
@Override
public void onClick(View view) {
final Intent intent;
switch (position){
case 0:
intent=new Intent(context,Main5Activity.class);
break;
case 1:
intent = new Intent(context, Main6Activity.class);
break;
case 2:
intent = new Intent(context, Main7Activity.class);
break;
case 3: intent = new Intent(context, Main8Activity.class);
break;
case 4: intent = new Intent(context, Main9Activity.class);
break;
case 5: intent = new Intent(context, Main10Activity.class);
break;
case 6: intent = new Intent(context, Main11Activity.class);
break;
case 7: intent = new Intent(context, Main12Activity.class);
break;
case 8: intent = new Intent(context, Main13Activity.class);
break;
case 9: intent = new Intent(context, Main14Activity.class);
break;
case 10: intent = new Intent(context, Main15Activity.class);
break;
case 11: intent = new Intent(context, Main17Activity.class);
break;
default:
intent = new Intent(context, Main4Activity.class);
break;
}
context.startActivity(intent);
}
});
}
@Override
public int getItemCount() {
return listdata.length;
}
private Context context = null;
@Override
public Filter getFilter() {
return filter;
}
Filter filter =new Filter() {
@Override
protected FilterResults performFiltering(CharSequence charSequence) {
List<String> filteredList=new ArrayList<>();
if ( charSequence.toString().isEmpty()){
filteredList.addAll(moviesListAll);
}
else
{
for(String movie: moviesListAll)
{
if(movie.toLowerCase().contains(charSequence.toString().toLowerCase()))
{
filteredList.add(movie);
}
}
}
FilterResults filterResults=new FilterResults();
filterResults.values=filteredList;
return filterResults;
}
@Override
protected void publishResults(CharSequence constraint, FilterResults results) {
notifyDataSetChanged();
}
};
public class ViewHolder extends RecyclerView.ViewHolder {
public ImageView imageView;
public TextView textView;
public RelativeLayout relativeLayout;
public ViewHolder(View itemView) {
super(itemView);
context=itemView.getContext();
this.imageView = (ImageView) itemView.findViewById(R.id.imageView);
this.textView = (TextView) itemView.findViewById(R.id.textView);
relativeLayout = (RelativeLayout)itemView.findViewById(R.id.relativeLayout);
}
}
}
| 5,205 | 0.550624 | 0.544092 | 172 | 28.261627 | 27.55768 | 105 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.540698 | false | false |
1
|
80fba89ca80650b2df00394ca1f288548d3ac5f4
| 31,198,642,504,350 |
f6e3e448f7dcdfbe1fc88416698acdf19eab568e
|
/src/main/java/com/tom/fabriclibs/InvUtil.java
|
84535cd1bb669220d3b699e204f523e6463e4cee
|
[
"MIT"
] |
permissive
|
tom5454/Toms-Fabric-Lib
|
https://github.com/tom5454/Toms-Fabric-Lib
|
d6ebec762b15d4d19bba43862a5fbc12ff32d3c3
|
c0b85201ac5e040721a000645bb1d721cb768686
|
refs/heads/master
| 2022-11-27T00:22:02.272000 | 2020-07-26T19:02:44 | 2020-07-26T19:02:44 | 281,626,270 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.tom.fabriclibs;
import net.minecraft.inventory.Inventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
public class InvUtil {
public static ListTag inv2Tag(Inventory inv) {
ListTag l = new ListTag();
for(int i = 0;i<inv.size();i++) {
if(!inv.getStack(i).isEmpty()) {
CompoundTag tag = new CompoundTag();
inv.getStack(i).toTag(tag);
tag.putByte("Slot", (byte) i);
l.add(tag);
}
}
return l;
}
public static void loadTag2Inv(Inventory inv, ListTag l) {
inv.clear();
for(int i = 0;i<l.size();i++) {
CompoundTag tag = l.getCompound(i);
byte slot = tag.getByte("Slot");
if(slot >= 0 && inv.size() > slot) {
inv.setStack(slot, ItemStack.fromTag(tag));
}
}
}
}
|
UTF-8
|
Java
| 789 |
java
|
InvUtil.java
|
Java
|
[] | null |
[] |
package com.tom.fabriclibs;
import net.minecraft.inventory.Inventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
public class InvUtil {
public static ListTag inv2Tag(Inventory inv) {
ListTag l = new ListTag();
for(int i = 0;i<inv.size();i++) {
if(!inv.getStack(i).isEmpty()) {
CompoundTag tag = new CompoundTag();
inv.getStack(i).toTag(tag);
tag.putByte("Slot", (byte) i);
l.add(tag);
}
}
return l;
}
public static void loadTag2Inv(Inventory inv, ListTag l) {
inv.clear();
for(int i = 0;i<l.size();i++) {
CompoundTag tag = l.getCompound(i);
byte slot = tag.getByte("Slot");
if(slot >= 0 && inv.size() > slot) {
inv.setStack(slot, ItemStack.fromTag(tag));
}
}
}
}
| 789 | 0.651458 | 0.64512 | 33 | 22.90909 | 17.458807 | 59 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.363636 | false | false |
1
|
c66030f267fc49bc89271256ca152fd4422538b9
| 15,101,105,072,878 |
88ee28938588a208df819f233fff0c379cdd9a3b
|
/src/net/apryx/dnd/world/Location.java
|
1c1d596f03912a730c73fd5776129af9511ffe04
|
[
"MIT"
] |
permissive
|
flokkienathur/DnDDB
|
https://github.com/flokkienathur/DnDDB
|
918c831db1f4f2db00666ade34dc0a015e795fe5
|
28a7cb98e606610b24a043dacdc9d93cb6c005f4
|
refs/heads/master
| 2021-01-01T04:56:58.221000 | 2016-05-14T08:25:23 | 2016-05-14T08:25:23 | 58,254,169 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package net.apryx.dnd.world;
public abstract class Location {
public static final int WORLD_ID = 0;
public static final int REGION_ID = 10000;
public static final int CITY_ID = 20000;
protected int id;
public Location(){
this.id = getNextID();
}
public void setId(int id) {
this.id = id;
}
public int getId() {
return id;
}
private static int lastID = 0;
public static int getNextID(){
return lastID++;
}
public static void setLastID(int id){
lastID = id;
}
}
|
UTF-8
|
Java
| 498 |
java
|
Location.java
|
Java
|
[] | null |
[] |
package net.apryx.dnd.world;
public abstract class Location {
public static final int WORLD_ID = 0;
public static final int REGION_ID = 10000;
public static final int CITY_ID = 20000;
protected int id;
public Location(){
this.id = getNextID();
}
public void setId(int id) {
this.id = id;
}
public int getId() {
return id;
}
private static int lastID = 0;
public static int getNextID(){
return lastID++;
}
public static void setLastID(int id){
lastID = id;
}
}
| 498 | 0.666667 | 0.64257 | 30 | 15.6 | 14.432833 | 43 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.4 | false | false |
1
|
499fcd2cd7f4814450c183156ee28ffb8deac8e8
| 22,814,866,327,138 |
3d95a69672c3a44a12169dac0b30a918945b66d2
|
/src/main/QuantTrader.java
|
8a7c692e740cc1647d8e50701a968aa6677eb983
|
[] |
no_license
|
siddshuk/quant-trader
|
https://github.com/siddshuk/quant-trader
|
1e40955ba087e25f36aead468749f4c4ec91226a
|
413ae3c95f19be6d19be3868b65ae8c28ccf84c2
|
refs/heads/master
| 2020-06-26T03:35:40.401000 | 2014-01-14T05:01:37 | 2014-01-14T05:01:37 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package main;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/**
* @author john and sid
*
*/
public class QuantTrader {
public static void main(String[] args) {
Process world = null;
Process agent = null;
Runtime rt = Runtime.getRuntime();
try {
agent = rt.exec("java -classpath bin main.AgentMain");
world = rt.exec("java -classpath bin main.WorldMain");
Thread qtsh = new QTShutdownHook(world, agent);
rt.addShutdownHook(qtsh);
} catch (Exception e) {
e.printStackTrace();
System.exit(0);
}
Timer timer = new Timer();
timer.start();
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try {
br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
System.exit(0);
}
}
|
UTF-8
|
Java
| 864 |
java
|
QuantTrader.java
|
Java
|
[
{
"context": "port java.io.InputStreamReader;\r\n\r\n/**\r\n * @author john and sid\r\n *\r\n */\r\npublic class QuantTrader {\r\n\tpu",
"end": 135,
"score": 0.8329476118087769,
"start": 131,
"tag": "USERNAME",
"value": "john"
},
{
"context": ".io.InputStreamReader;\r\n\r\n/**\r\n * @author john and sid\r\n *\r\n */\r\npublic class QuantTrader {\r\n\tpublic sta",
"end": 143,
"score": 0.5170443654060364,
"start": 140,
"tag": "NAME",
"value": "sid"
}
] | null |
[] |
package main;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/**
* @author john and sid
*
*/
public class QuantTrader {
public static void main(String[] args) {
Process world = null;
Process agent = null;
Runtime rt = Runtime.getRuntime();
try {
agent = rt.exec("java -classpath bin main.AgentMain");
world = rt.exec("java -classpath bin main.WorldMain");
Thread qtsh = new QTShutdownHook(world, agent);
rt.addShutdownHook(qtsh);
} catch (Exception e) {
e.printStackTrace();
System.exit(0);
}
Timer timer = new Timer();
timer.start();
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try {
br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
System.exit(0);
}
}
| 864 | 0.62963 | 0.627315 | 41 | 19.073172 | 17.912239 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.121951 | false | false |
1
|
07d812c738dafd7dc24ed35719842497e35cd7c4
| 34,333,968,621,976 |
bdd402d44afb1c3cadb29700afd5360f07117faf
|
/Oefeningen_Java/WC10/src/Entity/Klant.java
|
ccd8cf2381a124f886cdeb3fd14b15097ea2563e
|
[
"MIT"
] |
permissive
|
olivierthas/Programming-Essentials-2
|
https://github.com/olivierthas/Programming-Essentials-2
|
f7835b545a943e74b6e5e4ff6abcf22b1f2bd6dd
|
7a92d562e9e7603a2642e573dc925c29893fde70
|
refs/heads/master
| 2023-03-29T10:15:51.757000 | 2021-03-21T22:49:03 | 2021-03-21T22:49:03 | 266,134,652 | 0 | 0 |
MIT
| true | 2020-05-22T14:46:40 | 2020-05-22T14:46:39 | 2020-05-05T11:56:35 | 2020-04-20T06:49:42 | 39 | 0 | 0 | 0 | null | false | false |
package Entity;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
public class Klant {
private String naam;
private TreeMap<Media, LocalDate> mandje;
public Klant(String naam, TreeMap<Media, LocalDate> mandje) {
this.naam = naam;
this.mandje = new TreeMap<>();
}
public void huur(Media m) {
mandje.put(m, LocalDate.now());
}
public void inlevering(Media m) throws NoSuchItem, TooLateException {
if(!mandje.containsKey(m))
throw new NoSuchItem(m);
//keuze gemaakt om sowieso toch te verwijderen anders kan je eerst de exception gooien. De LocalDate kan je opvragen door mandje.get(m)
//LocalDate ld = mandje.remove(m);
LocalDate ld = mandje.get(m);
System.out.println(ld);
if(ld.plusDays(21).isBefore(LocalDate.now()))
throw new TooLateException(m, ld, LocalDate.now());
}
public void save() {
try (PrintWriter output = new PrintWriter(new FileOutputStream("C:\\Users\\olivier.thas\\Downloads\\" + this.naam + ".txt"))) {
output.println("Klant: "+ naam);
for(Map.Entry<Media, LocalDate> entry : mandje.entrySet()) {
output.println(entry.getKey().getTitel() + " - " + entry.getValue());
}
Collection<LocalDate> ldMandje = mandje.values();
for (LocalDate ld : ldMandje) {
System.out.println("Uitleendatum: " + ld);
}
for (Media m : mandje.keySet()) {
LocalDate ld = mandje.get(m);
System.out.println("Media: " + m + " - Uitleendatum: " + ld);
}
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
public void sorteerOpTitel() {
Set<Media> mandSet = mandje.keySet();
List<Media> mandList = new ArrayList<>();
mandList.addAll(mandSet);
Collections.sort(mandList);
}
public TreeSet<Media> sorteerOpRating() {
//met Lambda: TreeSet<Media> ts = new TreeSet<>( (a, b) -> Double.compare(a.getRating(), b.getRating()));
TreeSet<Media> ts = new TreeSet<>(new Comparator<Media>() {
@Override
public int compare(Media o1, Media o2) {
//niet null-safe
return Double.compare(o1.getRating(), o2.getRating());
}
});
ts.addAll(mandje.keySet());
return ts;
}
}
|
UTF-8
|
Java
| 2,859 |
java
|
Klant.java
|
Java
|
[
{
"context": " new PrintWriter(new FileOutputStream(\"C:\\\\Users\\\\olivier.thas\\\\Downloads\\\\\" + this.naam + \".txt\"))) {\n ",
"end": 1392,
"score": 0.747189998626709,
"start": 1382,
"tag": "USERNAME",
"value": "olivier.th"
},
{
"context": "Writer(new FileOutputStream(\"C:\\\\Users\\\\olivier.thas\\\\Downloads\\\\\" + this.naam + \".txt\"))) {\n ",
"end": 1394,
"score": 0.5529530048370361,
"start": 1392,
"tag": "NAME",
"value": "as"
}
] | null |
[] |
package Entity;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
public class Klant {
private String naam;
private TreeMap<Media, LocalDate> mandje;
public Klant(String naam, TreeMap<Media, LocalDate> mandje) {
this.naam = naam;
this.mandje = new TreeMap<>();
}
public void huur(Media m) {
mandje.put(m, LocalDate.now());
}
public void inlevering(Media m) throws NoSuchItem, TooLateException {
if(!mandje.containsKey(m))
throw new NoSuchItem(m);
//keuze gemaakt om sowieso toch te verwijderen anders kan je eerst de exception gooien. De LocalDate kan je opvragen door mandje.get(m)
//LocalDate ld = mandje.remove(m);
LocalDate ld = mandje.get(m);
System.out.println(ld);
if(ld.plusDays(21).isBefore(LocalDate.now()))
throw new TooLateException(m, ld, LocalDate.now());
}
public void save() {
try (PrintWriter output = new PrintWriter(new FileOutputStream("C:\\Users\\olivier.thas\\Downloads\\" + this.naam + ".txt"))) {
output.println("Klant: "+ naam);
for(Map.Entry<Media, LocalDate> entry : mandje.entrySet()) {
output.println(entry.getKey().getTitel() + " - " + entry.getValue());
}
Collection<LocalDate> ldMandje = mandje.values();
for (LocalDate ld : ldMandje) {
System.out.println("Uitleendatum: " + ld);
}
for (Media m : mandje.keySet()) {
LocalDate ld = mandje.get(m);
System.out.println("Media: " + m + " - Uitleendatum: " + ld);
}
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
public void sorteerOpTitel() {
Set<Media> mandSet = mandje.keySet();
List<Media> mandList = new ArrayList<>();
mandList.addAll(mandSet);
Collections.sort(mandList);
}
public TreeSet<Media> sorteerOpRating() {
//met Lambda: TreeSet<Media> ts = new TreeSet<>( (a, b) -> Double.compare(a.getRating(), b.getRating()));
TreeSet<Media> ts = new TreeSet<>(new Comparator<Media>() {
@Override
public int compare(Media o1, Media o2) {
//niet null-safe
return Double.compare(o1.getRating(), o2.getRating());
}
});
ts.addAll(mandje.keySet());
return ts;
}
}
| 2,859 | 0.592165 | 0.590066 | 90 | 30.777779 | 28.677044 | 143 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.6 | false | false |
1
|
b59a4c166262640690bba69d3fafc235af1fb01e
| 18,107,582,179,980 |
5b947a8ce1a3b20741896615eab7148248b39ce8
|
/app/src/main/java/com/example/mujahid/allinall/CustomAdapters/CustomExpandListAdapter.java
|
7306ba3f96ebd5abc391fd07ff00e04663e43fec
|
[] |
no_license
|
ashiquebiniqbal/MyApplication
|
https://github.com/ashiquebiniqbal/MyApplication
|
a8aca25c5a7d37b8c999ddbbbd7462c4a7cb516f
|
96ac0bea6bec724d6b1f38e18fdb7867e1072908
|
refs/heads/master
| 2021-09-03T10:15:55.528000 | 2018-01-08T09:52:55 | 2018-01-08T09:52:55 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.mujahid.allinall.CustomAdapters;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseExpandableListAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.mujahid.allinall.Pojo.GameData;
import com.example.mujahid.allinall.R;
import java.util.List;
/**
* Created by Mujahid on 11/27/2017.
*/
public class CustomExpandListAdapter extends BaseExpandableListAdapter {
private List<String> header;
private Context ctx;
private List<GameData> list;
public CustomExpandListAdapter(Context c, List<GameData> data){
this.ctx = c;
list = data;
}
@Override
public int getGroupCount() {
return list.size();
}
@Override
public int getChildrenCount(int groupPosition) {
return list.get(groupPosition).getChildItemSize();
}
@Override
public Object getGroup(int i) {
return list.get(i).getHeaderName();
}
@Override
public Object getChild(int groupPosition, int childPosition) {
return list.get(groupPosition).getChildItem(childPosition);
}
@Override
public long getGroupId(int groupPosition) {
return groupPosition;
}
@Override
public long getChildId(int groupPosition, int childPosition) {
return childPosition ;
}
@Override
public boolean hasStableIds() {
return false;
}
@Override
public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup viewGroup) {
String title =(String) this.getGroup(groupPosition);
if(convertView==null){
LayoutInflater inflater = (LayoutInflater)this.ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
assert inflater != null;
convertView = inflater.inflate(R.layout.custom_expandlist_parent,null);
}
TextView textView = convertView.findViewById(R.id.headingItem);
textView.setText(title);
ImageView imageView = convertView.findViewById(R.id.image);
if (isExpanded){
imageView.setImageResource(R.drawable.ic_collapse);
}else{
imageView.setImageResource(R.drawable.ic_expandlist);
}
return convertView;
}
@Override
public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup viewGroup) {
String title = (String)this.getChild(groupPosition,childPosition);
if(convertView==null){
LayoutInflater inflater = (LayoutInflater)this.ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
assert inflater != null;
convertView = inflater.inflate(R.layout.custom_expandlist_child,null);
}
TextView textView = convertView.findViewById(R.id.childItem);
textView.setText(title);
return convertView;
}
@Override
public boolean isChildSelectable(int i, int i1) {
return true;
}
}
|
UTF-8
|
Java
| 3,091 |
java
|
CustomExpandListAdapter.java
|
Java
|
[
{
"context": "nall.R;\n\nimport java.util.List;\n\n/**\n * Created by Mujahid on 11/27/2017.\n */\n\npublic class CustomExpandList",
"end": 434,
"score": 0.9662261009216309,
"start": 427,
"tag": "USERNAME",
"value": "Mujahid"
}
] | null |
[] |
package com.example.mujahid.allinall.CustomAdapters;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseExpandableListAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.mujahid.allinall.Pojo.GameData;
import com.example.mujahid.allinall.R;
import java.util.List;
/**
* Created by Mujahid on 11/27/2017.
*/
public class CustomExpandListAdapter extends BaseExpandableListAdapter {
private List<String> header;
private Context ctx;
private List<GameData> list;
public CustomExpandListAdapter(Context c, List<GameData> data){
this.ctx = c;
list = data;
}
@Override
public int getGroupCount() {
return list.size();
}
@Override
public int getChildrenCount(int groupPosition) {
return list.get(groupPosition).getChildItemSize();
}
@Override
public Object getGroup(int i) {
return list.get(i).getHeaderName();
}
@Override
public Object getChild(int groupPosition, int childPosition) {
return list.get(groupPosition).getChildItem(childPosition);
}
@Override
public long getGroupId(int groupPosition) {
return groupPosition;
}
@Override
public long getChildId(int groupPosition, int childPosition) {
return childPosition ;
}
@Override
public boolean hasStableIds() {
return false;
}
@Override
public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup viewGroup) {
String title =(String) this.getGroup(groupPosition);
if(convertView==null){
LayoutInflater inflater = (LayoutInflater)this.ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
assert inflater != null;
convertView = inflater.inflate(R.layout.custom_expandlist_parent,null);
}
TextView textView = convertView.findViewById(R.id.headingItem);
textView.setText(title);
ImageView imageView = convertView.findViewById(R.id.image);
if (isExpanded){
imageView.setImageResource(R.drawable.ic_collapse);
}else{
imageView.setImageResource(R.drawable.ic_expandlist);
}
return convertView;
}
@Override
public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup viewGroup) {
String title = (String)this.getChild(groupPosition,childPosition);
if(convertView==null){
LayoutInflater inflater = (LayoutInflater)this.ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
assert inflater != null;
convertView = inflater.inflate(R.layout.custom_expandlist_child,null);
}
TextView textView = convertView.findViewById(R.id.childItem);
textView.setText(title);
return convertView;
}
@Override
public boolean isChildSelectable(int i, int i1) {
return true;
}
}
| 3,091 | 0.684245 | 0.681333 | 109 | 27.357798 | 28.824532 | 128 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.504587 | false | false |
1
|
b0cfecabe358897da7a93d341d1d2d0967a0d194
| 36,644,661,001,664 |
2b8dd7de05be85ed76c6eadb9e9607e102a2d9a3
|
/src/com/cn/tbps/service/AuditCntrctService.java
|
8307cc685f2d5c717f7de0e8d89e3e4701910f57
|
[] |
no_license
|
koubai/tbps_0812
|
https://github.com/koubai/tbps_0812
|
3d0f88af29c26947b91ee8ca6e39510808b9644a
|
5dd03a1733e446b8a8ae65e00652bb6f8d391ec3
|
refs/heads/master
| 2022-01-10T19:19:17.961000 | 2022-01-08T15:01:18 | 2022-01-08T15:01:18 | 144,414,160 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.cn.tbps.service;
import com.cn.common.util.Page;
import com.cn.tbps.dto.AuditCntrctDto;
public interface AuditCntrctService {
public Page queryAuditCntrctByPage(String strCntrctBelong, String strCntrctNO, String strCntrctType,
String strCntrctName, String strCntrctStDate, String strCntrctEdDate, String strCntrctNm, Page page);
public AuditCntrctDto queryAuditCntrctByID(String CNTRCT_NO);
public void insertAuditCntrct(AuditCntrctDto auditCntrct) throws Exception;
public void updateAuditCntrct(AuditCntrctDto auditCntrct) throws Exception;
public void deleteAuditCntrct(String cntrctNo, String userName) throws Exception;
}
|
UTF-8
|
Java
| 658 |
java
|
AuditCntrctService.java
|
Java
|
[] | null |
[] |
package com.cn.tbps.service;
import com.cn.common.util.Page;
import com.cn.tbps.dto.AuditCntrctDto;
public interface AuditCntrctService {
public Page queryAuditCntrctByPage(String strCntrctBelong, String strCntrctNO, String strCntrctType,
String strCntrctName, String strCntrctStDate, String strCntrctEdDate, String strCntrctNm, Page page);
public AuditCntrctDto queryAuditCntrctByID(String CNTRCT_NO);
public void insertAuditCntrct(AuditCntrctDto auditCntrct) throws Exception;
public void updateAuditCntrct(AuditCntrctDto auditCntrct) throws Exception;
public void deleteAuditCntrct(String cntrctNo, String userName) throws Exception;
}
| 658 | 0.829787 | 0.829787 | 18 | 35.555557 | 37.226368 | 104 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.555556 | false | false |
1
|
084cd61434c7fa6f7bc7bd1d289f3b475df0d2fa
| 38,190,849,216,115 |
1aa8381ae55ed2bc0df9460472033dfb87cfb032
|
/app/src/main/java/com/example/todolist/Define.java
|
62651c11037a48ae8ba6940383df79cf300c8a84
|
[] |
no_license
|
longdcnb1998/TodoList
|
https://github.com/longdcnb1998/TodoList
|
7af142dd437faf9d35b0d762baa10e16fc0ddf3b
|
311c323e516059eb494ee28b396cb35ec7bb4d01
|
refs/heads/master
| 2022-11-07T04:14:43.097000 | 2020-07-07T18:59:36 | 2020-07-07T18:59:36 | 277,702,496 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.todolist;
public class Define {
public static final String API_GET_LIST = "http://ec2-54-163-16-167.compute-1.amazonaws.com:1337/todos?user_eq=" ;
public static final String API_ADD = "http://ec2-54-163-16-167.compute-1.amazonaws.com:1337/todos";
public static String API_REGISTER = "http://ec2-54-163-16-167.compute-1.amazonaws.com:1337/users";
public static String API_EDIT = "http://ec2-54-163-16-167.compute-1.amazonaws.com:1337/todos/";
public static String API_DELETE = "http://ec2-54-163-16-167.compute-1.amazonaws.com:1337/todos/";
public static String jwt = "jwt";
public static String username ="username";
public static String password ="password";
public static String identifier ="identifier";
public static String email ="email";
public static String role ="role";
public static String API_LOGIN ="http://ec2-54-163-16-167.compute-1.amazonaws.com:1337/auth/local";
public static String authorization ="authorization";
public static String user ="user";
}
|
UTF-8
|
Java
| 1,049 |
java
|
Define.java
|
Java
|
[
{
"context": "jwt = \"jwt\";\n\n public static String username =\"username\";\n public static String password =\"password\";\n",
"end": 665,
"score": 0.9966863989830017,
"start": 657,
"tag": "USERNAME",
"value": "username"
},
{
"context": " =\"username\";\n public static String password =\"password\";\n public static String identifier =\"identifie",
"end": 712,
"score": 0.9993674755096436,
"start": 704,
"tag": "PASSWORD",
"value": "password"
}
] | null |
[] |
package com.example.todolist;
public class Define {
public static final String API_GET_LIST = "http://ec2-54-163-16-167.compute-1.amazonaws.com:1337/todos?user_eq=" ;
public static final String API_ADD = "http://ec2-54-163-16-167.compute-1.amazonaws.com:1337/todos";
public static String API_REGISTER = "http://ec2-54-163-16-167.compute-1.amazonaws.com:1337/users";
public static String API_EDIT = "http://ec2-54-163-16-167.compute-1.amazonaws.com:1337/todos/";
public static String API_DELETE = "http://ec2-54-163-16-167.compute-1.amazonaws.com:1337/todos/";
public static String jwt = "jwt";
public static String username ="username";
public static String password ="<PASSWORD>";
public static String identifier ="identifier";
public static String email ="email";
public static String role ="role";
public static String API_LOGIN ="http://ec2-54-163-16-167.compute-1.amazonaws.com:1337/auth/local";
public static String authorization ="authorization";
public static String user ="user";
}
| 1,051 | 0.71592 | 0.624404 | 21 | 48.952381 | 39.177834 | 118 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.714286 | false | false |
1
|
813a0ca417dc6d096032e490ba2615a7343147c6
| 38,190,849,218,337 |
58a241b855e97487d4732b4ae3c8ab965453b4fb
|
/scfcloud-model/src/main/java/com/zhjs/scfcloud/model/dto/RoleListDTO.java
|
80e4bddba9502073a20209393c9bb5395ed5aa23
|
[] |
no_license
|
oyjy2018/lz-scf
|
https://github.com/oyjy2018/lz-scf
|
92f45a68ecd3f18069532d6cdd4fa44fcc6df2e6
|
6f2672545f1e39e9f4c630783214d08d2651ffa8
|
refs/heads/master
| 2022-12-24T11:07:49.847000 | 2019-12-09T06:24:13 | 2019-12-09T06:24:13 | 226,791,051 | 1 | 2 | null | false | 2022-12-11T16:30:15 | 2019-12-09T05:23:11 | 2019-12-12T06:45:07 | 2022-12-11T16:30:14 | 64,336 | 1 | 2 | 61 |
TSQL
| false | false |
package com.zhjs.scfcloud.model.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 查询角色列表入参
* <功能详细描述>
* Version: 1.0.0, 2019-05-17 16:50
*
* @author liuchanghai
* @create 2019-05-17 16:50
* @since
*/
@Data
public class RoleListDTO {
@ApiModelProperty("公司ID")
private Long companyId;
}
|
UTF-8
|
Java
| 366 |
java
|
RoleListDTO.java
|
Java
|
[
{
"context": "\n * Version: 1.0.0, 2019-05-17 16:50\n *\n * @author liuchanghai\n * @create 2019-05-17 16:50\n * @since\n */\n\n@Data\n",
"end": 196,
"score": 0.9994606971740723,
"start": 185,
"tag": "USERNAME",
"value": "liuchanghai"
}
] | null |
[] |
package com.zhjs.scfcloud.model.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 查询角色列表入参
* <功能详细描述>
* Version: 1.0.0, 2019-05-17 16:50
*
* @author liuchanghai
* @create 2019-05-17 16:50
* @since
*/
@Data
public class RoleListDTO {
@ApiModelProperty("公司ID")
private Long companyId;
}
| 366 | 0.688623 | 0.607784 | 21 | 14.904762 | 14.235785 | 47 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.238095 | false | false |
1
|
1f45fa1d6898a5e4e10fd65d3d98acfd27e69160
| 39,101,382,296,330 |
20e530431d39b2cb2ccec07f8aec88f03f131feb
|
/src/com/amarsoft/app/als/formatdoc/groundhivedoc/GH.java
|
d2b046bc693b1cee74d466148ea6f9d9e30d3baa
|
[] |
no_license
|
light-of-night/ALS755
|
https://github.com/light-of-night/ALS755
|
9fea240babd81d5fd5a0ef6fcbcc1a27b0d27f5b
|
e1cb1bce1d75b014869e0e81217bf99cf6250289
|
refs/heads/master
| 2020-12-23T00:46:42.376000 | 2020-02-01T04:32:37 | 2020-02-01T04:32:37 | 236,973,510 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.amarsoft.app.als.formatdoc.groundhivedoc;
import java.io.Serializable;
import com.amarsoft.app.als.formatdoc.DocExtClass;
import com.amarsoft.biz.formatdoc.model.FormatDocData;
import com.amarsoft.are.ARE;
import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.BizObjectManager;
import com.amarsoft.are.jbo.BizObjectQuery;
import com.amarsoft.are.jbo.JBOFactory;
import com.amarsoft.are.util.DataConvert;
import com.amarsoft.dict.als.manage.CodeManager;
public class GH extends FormatDocData implements Serializable {
private static final long serialVersionUID = 1L;
private DocExtClass extobj1;
private DocExtClass extobj2;
private String opinion1 = "";
public GH() {
}
public boolean initObjectForRead() {
ARE.getLog().trace("GH.initObject()");
if("".equals(opinion1))opinion1="";
String sObjectNo=this.getRecordObjectNo();
String sObjectType=this.getRecordObjectType();
if(sObjectNo==null)sObjectNo="";
BizObjectManager m = null;
BizObjectQuery q = null;
BizObject bo = null;
String customerID = "";
try {
m = JBOFactory.getFactory().getManager("jbo.app.BUSINESS_APPLY");
q = m.createQuery("SERIALNO=:SERIALNO").setParameter("SERIALNO",sObjectNo);
bo = q.getSingleResult();
if(bo != null){
customerID = bo.getAttribute("CustomerID").getString();
}
extobj1 = new DocExtClass();
extobj2 = new DocExtClass();
if(customerID!=null&& !"".equals(customerID)){
m = JBOFactory.getFactory().getManager("jbo.app.PROJECT_INFO");
q = m.createQuery("select * from O where O.projectType='03' and O.projectno in (select pr.projectNo from jbo.app.PROJECT_RELATIVE pr where pr.objectType='Customer' and pr.ObjectNo=:CustomerID) order by O.projectno desc").setParameter("CustomerID",customerID);
bo = q.getSingleResult();
if(bo != null){
String projectType = bo.getAttribute("ProjectType").getString();
extobj1.setAttr1(CodeManager.getItemName("ProjectStyle", projectType));
extobj1.setAttr2(bo.getAttribute("HOLDAREA").getString());
extobj1.setAttr3(bo.getAttribute("PROJECTADD").getString());
String otherar = bo.getAttribute("OTHERAREAFLAG").getString();
extobj1.setAttr4(CodeManager.getItemName("YesNo",otherar));
extobj1.setAttr5(DataConvert.toMoney(bo.getAttribute("Sum1").getDouble()));
extobj1.setAttr6(DataConvert.toMoney(bo.getAttribute("PROJECTCAPITAL").getDouble()));
extobj1.setAttr7(DataConvert.toMoney(bo.getAttribute("Sum2").getDouble()));
extobj1.setAttr8(bo.getAttribute("Sum8").getString());
extobj1.setAttr9(bo.getAttribute("LICENCE1").getString());
extobj1.setAttr0(bo.getAttribute("LICENCE4").getString());
extobj2.setAttr1(bo.getAttribute("LICENCE2").getString());
extobj2.setAttr2(bo.getAttribute("LICENCE5").getString());
extobj2.setAttr3(bo.getAttribute("LICENCE3").getString());
extobj2.setAttr4(bo.getAttribute("LICENCE6").getString());
}
}
} catch (Exception e) {
e.printStackTrace();
}
return true;
}
public boolean initObjectForEdit() {
opinion1 = " ";
return true;
}
public String getOpinion1() {
return opinion1;
}
public void setOpinion1(String opinion1) {
this.opinion1 = opinion1;
}
public DocExtClass getExtobj1() {
return extobj1;
}
public void setExtobj1(DocExtClass extobj1) {
this.extobj1 = extobj1;
}
public DocExtClass getExtobj2() {
return extobj2;
}
public void setExtobj2(DocExtClass extobj2) {
this.extobj2 = extobj2;
}
}
|
UTF-8
|
Java
| 3,610 |
java
|
GH.java
|
Java
|
[] | null |
[] |
package com.amarsoft.app.als.formatdoc.groundhivedoc;
import java.io.Serializable;
import com.amarsoft.app.als.formatdoc.DocExtClass;
import com.amarsoft.biz.formatdoc.model.FormatDocData;
import com.amarsoft.are.ARE;
import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.BizObjectManager;
import com.amarsoft.are.jbo.BizObjectQuery;
import com.amarsoft.are.jbo.JBOFactory;
import com.amarsoft.are.util.DataConvert;
import com.amarsoft.dict.als.manage.CodeManager;
public class GH extends FormatDocData implements Serializable {
private static final long serialVersionUID = 1L;
private DocExtClass extobj1;
private DocExtClass extobj2;
private String opinion1 = "";
public GH() {
}
public boolean initObjectForRead() {
ARE.getLog().trace("GH.initObject()");
if("".equals(opinion1))opinion1="";
String sObjectNo=this.getRecordObjectNo();
String sObjectType=this.getRecordObjectType();
if(sObjectNo==null)sObjectNo="";
BizObjectManager m = null;
BizObjectQuery q = null;
BizObject bo = null;
String customerID = "";
try {
m = JBOFactory.getFactory().getManager("jbo.app.BUSINESS_APPLY");
q = m.createQuery("SERIALNO=:SERIALNO").setParameter("SERIALNO",sObjectNo);
bo = q.getSingleResult();
if(bo != null){
customerID = bo.getAttribute("CustomerID").getString();
}
extobj1 = new DocExtClass();
extobj2 = new DocExtClass();
if(customerID!=null&& !"".equals(customerID)){
m = JBOFactory.getFactory().getManager("jbo.app.PROJECT_INFO");
q = m.createQuery("select * from O where O.projectType='03' and O.projectno in (select pr.projectNo from jbo.app.PROJECT_RELATIVE pr where pr.objectType='Customer' and pr.ObjectNo=:CustomerID) order by O.projectno desc").setParameter("CustomerID",customerID);
bo = q.getSingleResult();
if(bo != null){
String projectType = bo.getAttribute("ProjectType").getString();
extobj1.setAttr1(CodeManager.getItemName("ProjectStyle", projectType));
extobj1.setAttr2(bo.getAttribute("HOLDAREA").getString());
extobj1.setAttr3(bo.getAttribute("PROJECTADD").getString());
String otherar = bo.getAttribute("OTHERAREAFLAG").getString();
extobj1.setAttr4(CodeManager.getItemName("YesNo",otherar));
extobj1.setAttr5(DataConvert.toMoney(bo.getAttribute("Sum1").getDouble()));
extobj1.setAttr6(DataConvert.toMoney(bo.getAttribute("PROJECTCAPITAL").getDouble()));
extobj1.setAttr7(DataConvert.toMoney(bo.getAttribute("Sum2").getDouble()));
extobj1.setAttr8(bo.getAttribute("Sum8").getString());
extobj1.setAttr9(bo.getAttribute("LICENCE1").getString());
extobj1.setAttr0(bo.getAttribute("LICENCE4").getString());
extobj2.setAttr1(bo.getAttribute("LICENCE2").getString());
extobj2.setAttr2(bo.getAttribute("LICENCE5").getString());
extobj2.setAttr3(bo.getAttribute("LICENCE3").getString());
extobj2.setAttr4(bo.getAttribute("LICENCE6").getString());
}
}
} catch (Exception e) {
e.printStackTrace();
}
return true;
}
public boolean initObjectForEdit() {
opinion1 = " ";
return true;
}
public String getOpinion1() {
return opinion1;
}
public void setOpinion1(String opinion1) {
this.opinion1 = opinion1;
}
public DocExtClass getExtobj1() {
return extobj1;
}
public void setExtobj1(DocExtClass extobj1) {
this.extobj1 = extobj1;
}
public DocExtClass getExtobj2() {
return extobj2;
}
public void setExtobj2(DocExtClass extobj2) {
this.extobj2 = extobj2;
}
}
| 3,610 | 0.703601 | 0.685319 | 104 | 32.71154 | 33.522285 | 263 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.538461 | false | false |
1
|
76efceb5b15dff6cf31712a42d43ad368a0b270b
| 7,344,394,143,080 |
255bf0bb1d09a23f2e2c9296ea6770446faecd17
|
/Object oriented programming using JAVA/string/Stringreverse.java
|
9acdce12edf78c163ffc11928078c5cce4c65e27
|
[] |
no_license
|
Ameenaar/Object-oriented-programming-using-JAVA
|
https://github.com/Ameenaar/Object-oriented-programming-using-JAVA
|
a4df5e1a598f6b76e21d13b4e9d4289f434d3d79
|
60fd84e17cb11c407c733389e144d05bcce1d333
|
refs/heads/master
| 2022-04-09T16:57:34.562000 | 2019-11-27T14:04:20 | 2019-11-27T14:04:20 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package string;
import java.util.Scanner;
public class Stringreverse {
public static void main(String[] args)
{
Scanner s=new Scanner(System.in);
System.out.println("enter the strings");
String st=s.nextLine();
String str[]=st.split(" ");
int i;
for(i=0;i<str.length;i++)
{
int l=str[i].length();
if(i%2!=0)
{
for(int j=l-1;j>=0;j--)
{
System.out.print(str[i].charAt(j));
}
System.out.print(" ");
}
else
System.out.print(str[i]+" ");
}
}
}
|
UTF-8
|
Java
| 568 |
java
|
Stringreverse.java
|
Java
|
[] | null |
[] |
package string;
import java.util.Scanner;
public class Stringreverse {
public static void main(String[] args)
{
Scanner s=new Scanner(System.in);
System.out.println("enter the strings");
String st=s.nextLine();
String str[]=st.split(" ");
int i;
for(i=0;i<str.length;i++)
{
int l=str[i].length();
if(i%2!=0)
{
for(int j=l-1;j>=0;j--)
{
System.out.print(str[i].charAt(j));
}
System.out.print(" ");
}
else
System.out.print(str[i]+" ");
}
}
}
| 568 | 0.510563 | 0.501761 | 32 | 15.75 | 14.252192 | 42 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.46875 | false | false |
1
|
2cc3d87050457849ba8a171140bc7266dcc3acec
| 7,344,394,141,733 |
3ba5245c8d0747c69bd5a8cf013eef5e80b652a9
|
/common/src/main/java/com/mprest/client/exception/ClientTimeoutException.java
|
0b3c6bb425ec91077ba63b78b606e2be7cb4b791
|
[] |
no_license
|
orenn76/microservices
|
https://github.com/orenn76/microservices
|
e8e1871ffb54d372d91d566eb63ac4e9224dd126
|
0d0f55adf700df116bbc3a95b66a4c277260ae91
|
refs/heads/master
| 2021-09-05T16:59:55.121000 | 2018-01-29T20:28:24 | 2018-01-29T20:28:24 | 119,437,199 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.mprest.client.exception;
public class ClientTimeoutException extends RuntimeException {
private static final long serialVersionUID = 8458417785209341858L;
public ClientTimeoutException(Throwable cause) {
super(cause);
}
}
|
UTF-8
|
Java
| 257 |
java
|
ClientTimeoutException.java
|
Java
|
[] | null |
[] |
package com.mprest.client.exception;
public class ClientTimeoutException extends RuntimeException {
private static final long serialVersionUID = 8458417785209341858L;
public ClientTimeoutException(Throwable cause) {
super(cause);
}
}
| 257 | 0.766537 | 0.692607 | 10 | 24.700001 | 26.66477 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.3 | false | false |
1
|
f5187ff2866a24fbb84f2b38d94b942e0b2e0596
| 27,264,452,464,723 |
c561bf5a6cb4a524014d1980111154f334754285
|
/src/main/java/com/ppship/spring_boot_helloworld/domain/ProjectSettings.java
|
b9251c0e2e15d35f1805decfbf35d39eebf2fabe
|
[] |
no_license
|
pphip/spring-boot-example
|
https://github.com/pphip/spring-boot-example
|
e92df500619346a0354bf99de785b5ecc9a62354
|
307c42b58f80328d68fb683843e72b8f28b49c6f
|
refs/heads/master
| 2020-04-06T07:01:38.856000 | 2015-11-17T00:43:56 | 2015-11-17T00:43:56 | 38,722,014 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.ppship.spring_boot_helloworld.domain;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Component
@ConfigurationProperties(prefix="project")
public class ProjectSettings {
private String artifactId;
private String name;
private String version;
private String description;
public String getArtifactId() {
return artifactId;
}
public void setArtifactId(String artifactId) {
this.artifactId = artifactId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}
|
UTF-8
|
Java
| 884 |
java
|
ProjectSettings.java
|
Java
|
[] | null |
[] |
package com.ppship.spring_boot_helloworld.domain;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Component
@ConfigurationProperties(prefix="project")
public class ProjectSettings {
private String artifactId;
private String name;
private String version;
private String description;
public String getArtifactId() {
return artifactId;
}
public void setArtifactId(String artifactId) {
this.artifactId = artifactId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}
| 884 | 0.764706 | 0.764706 | 39 | 21.666666 | 18.157902 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.358974 | false | false |
1
|
0b22426a418ca326a6a271bf8c75e3b998fe2200
| 3,839,700,817,204 |
e684082cc57f496a9408a5ae0678c6f8be8c0d3f
|
/src/UserDialog.java
|
27006904f0c68b4873fd51006a74b098a96b5b26
|
[] |
no_license
|
martinpazicky/eightQueens_local_search
|
https://github.com/martinpazicky/eightQueens_local_search
|
52d70586cc9015cf0d9670270ed527547d52c959
|
1f642d21c5d856d51c3b2d5f26c7fa4d80ff834e
|
refs/heads/master
| 2023-05-04T01:06:41.279000 | 2021-05-09T08:23:11 | 2021-05-09T08:23:11 | 365,702,946 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.util.Scanner;
public class UserDialog {
public static void run() {
Scanner in = new Scanner(System.in);
String choice;
int dims, iterLimit, testCount;
byte[] initialBoard, solution;
while (true) {
System.out.println("N Queens");
System.out.println("1 - Solve a board");
System.out.println("2 - Run tests (success rate or time)");
System.out.println("3 - exit");
choice = in.nextLine();
switch (choice) {
case "1":
String choice1;
System.out.println("Enter dimensions of chessboard");
dims = Integer.parseInt(in.nextLine());
System.out.println("Which algorithm would you like to apply?");
System.out.println("1 - Beam Search");
System.out.println("2 - Tabu Search");
System.out.println("3 - Simulated Annealing");
choice1 = in.nextLine();
switch (choice1) {
case "1":
System.out.println("Enter beam width");
int beamWidth = Integer.parseInt(in.nextLine());
System.out.println("Enter amount of iterations after which algorithm stops");
iterLimit = Integer.parseInt(in.nextLine());
byte[][] initialBoards = new byte[beamWidth][];
for (int j = 0; j < beamWidth; j++)
initialBoards[j] = Solver.generateRandomBoard(dims);
solution = Solver.beamSearch(initialBoards, beamWidth, iterLimit);
if (solution != null)
Utility.printMap(solution);
else
System.out.println("Algorithm could not find solution");
break;
case "2":
System.out.println("Enter max. size of tabuList");
int tabuLimit = Integer.parseInt(in.nextLine());
System.out.println("Enter amount of iterations after which algorithm stops");
iterLimit = Integer.parseInt(in.nextLine());
initialBoard = Solver.generateRandomBoard(dims);
solution = Solver.tabuSearch(initialBoard, tabuLimit, iterLimit);
if (solution != null)
Utility.printMap(solution);
else
System.out.println("Algorithm could not find solution");
break;
case "3":
System.out.println("Enter initial temperature");
double initialTemp = Double.parseDouble(in.nextLine());
System.out.println("Enter cooling rate (0-1)");
double coolingRate = Double.parseDouble(in.nextLine());
System.out.println("Enter amount of iterations after which algorithm stops");
iterLimit = Integer.parseInt(in.nextLine());
initialBoard = Solver.generateRandomBoard(dims);
solution = Solver.simulatedAnnealing(initialBoard, initialTemp, coolingRate, iterLimit);
if (solution != null)
Utility.printMap(solution);
else
System.out.println("Algorithm could not find solution");
break;
}
break;
case "2":
System.out.println("Which test would you like to run?");
System.out.println("1 - Beam Search success rate");
System.out.println("2 - Beam Search time");
System.out.println("3 - Tabu Search success rate");
System.out.println("4 - Tabu Search time");
System.out.println("5 - Simulated Annealing success rate");
System.out.println("6 - Simulated Annealing time");
String choice2 = in.nextLine();
System.out.println("Enter dimensions of the board to run tests on");
dims = Integer.parseInt(in.nextLine());
System.out.println("Enter amount of iterations after which algorithm stops");
iterLimit = Integer.parseInt(in.nextLine());
System.out.println("Enter amount of tests to execute on each value of parameter (approximation)");
testCount = Integer.parseInt(in.nextLine());
switch (choice2) {
case "1":
Tester.BSSuccessRate(dims, iterLimit, testCount);
break;
case "2":
Tester.BSTime(dims, iterLimit, testCount);
break;
case "3":
Tester.TSSuccessRate(dims, iterLimit, testCount);
break;
case "4":
Tester.TSTime(dims, iterLimit, testCount);
break;
case "5":
Tester.SASuccessRate(dims, iterLimit, testCount);
break;
case "6":
Tester.SATime(dims, iterLimit, testCount);
break;
}
break;
case "3":
return;
default:
System.out.println("Wrong choice");
break;
}
}
}
}
|
UTF-8
|
Java
| 6,097 |
java
|
UserDialog.java
|
Java
|
[] | null |
[] |
import java.util.Scanner;
public class UserDialog {
public static void run() {
Scanner in = new Scanner(System.in);
String choice;
int dims, iterLimit, testCount;
byte[] initialBoard, solution;
while (true) {
System.out.println("N Queens");
System.out.println("1 - Solve a board");
System.out.println("2 - Run tests (success rate or time)");
System.out.println("3 - exit");
choice = in.nextLine();
switch (choice) {
case "1":
String choice1;
System.out.println("Enter dimensions of chessboard");
dims = Integer.parseInt(in.nextLine());
System.out.println("Which algorithm would you like to apply?");
System.out.println("1 - Beam Search");
System.out.println("2 - Tabu Search");
System.out.println("3 - Simulated Annealing");
choice1 = in.nextLine();
switch (choice1) {
case "1":
System.out.println("Enter beam width");
int beamWidth = Integer.parseInt(in.nextLine());
System.out.println("Enter amount of iterations after which algorithm stops");
iterLimit = Integer.parseInt(in.nextLine());
byte[][] initialBoards = new byte[beamWidth][];
for (int j = 0; j < beamWidth; j++)
initialBoards[j] = Solver.generateRandomBoard(dims);
solution = Solver.beamSearch(initialBoards, beamWidth, iterLimit);
if (solution != null)
Utility.printMap(solution);
else
System.out.println("Algorithm could not find solution");
break;
case "2":
System.out.println("Enter max. size of tabuList");
int tabuLimit = Integer.parseInt(in.nextLine());
System.out.println("Enter amount of iterations after which algorithm stops");
iterLimit = Integer.parseInt(in.nextLine());
initialBoard = Solver.generateRandomBoard(dims);
solution = Solver.tabuSearch(initialBoard, tabuLimit, iterLimit);
if (solution != null)
Utility.printMap(solution);
else
System.out.println("Algorithm could not find solution");
break;
case "3":
System.out.println("Enter initial temperature");
double initialTemp = Double.parseDouble(in.nextLine());
System.out.println("Enter cooling rate (0-1)");
double coolingRate = Double.parseDouble(in.nextLine());
System.out.println("Enter amount of iterations after which algorithm stops");
iterLimit = Integer.parseInt(in.nextLine());
initialBoard = Solver.generateRandomBoard(dims);
solution = Solver.simulatedAnnealing(initialBoard, initialTemp, coolingRate, iterLimit);
if (solution != null)
Utility.printMap(solution);
else
System.out.println("Algorithm could not find solution");
break;
}
break;
case "2":
System.out.println("Which test would you like to run?");
System.out.println("1 - Beam Search success rate");
System.out.println("2 - Beam Search time");
System.out.println("3 - Tabu Search success rate");
System.out.println("4 - Tabu Search time");
System.out.println("5 - Simulated Annealing success rate");
System.out.println("6 - Simulated Annealing time");
String choice2 = in.nextLine();
System.out.println("Enter dimensions of the board to run tests on");
dims = Integer.parseInt(in.nextLine());
System.out.println("Enter amount of iterations after which algorithm stops");
iterLimit = Integer.parseInt(in.nextLine());
System.out.println("Enter amount of tests to execute on each value of parameter (approximation)");
testCount = Integer.parseInt(in.nextLine());
switch (choice2) {
case "1":
Tester.BSSuccessRate(dims, iterLimit, testCount);
break;
case "2":
Tester.BSTime(dims, iterLimit, testCount);
break;
case "3":
Tester.TSSuccessRate(dims, iterLimit, testCount);
break;
case "4":
Tester.TSTime(dims, iterLimit, testCount);
break;
case "5":
Tester.SASuccessRate(dims, iterLimit, testCount);
break;
case "6":
Tester.SATime(dims, iterLimit, testCount);
break;
}
break;
case "3":
return;
default:
System.out.println("Wrong choice");
break;
}
}
}
}
| 6,097 | 0.449893 | 0.444645 | 113 | 52.955753 | 26.442253 | 118 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.911504 | false | false |
1
|
d9d95a534509a155cb16cc1afca9c96b5e2eaaa4
| 4,346,506,931,339 |
4d6f353143d22525b21e65b40dd87c59097bee52
|
/core/src/com/darkhouse/shardwar/Logic/GameEntity/Empty.java
|
386cb22b50a9c1ad5c6323004ec0ebef9c7b0d9a
|
[
"Apache-2.0"
] |
permissive
|
mrDarkHouse/ShardWar
|
https://github.com/mrDarkHouse/ShardWar
|
e889145f5abb88c7764445c40b21044afd5c608f
|
16a260530befbe0362924dc2b66c93d0f9e37b56
|
refs/heads/master
| 2023-03-17T21:32:20.147000 | 2019-10-03T18:19:21 | 2019-10-03T18:19:21 | 170,937,327 | 0 | 0 |
Apache-2.0
| false | 2023-03-03T06:42:09 | 2019-02-15T22:36:05 | 2023-01-31T17:11:35 | 2023-03-03T06:42:08 | 3,563 | 0 | 0 | 7 |
Java
| false | false |
package com.darkhouse.shardwar.Logic.GameEntity;
import com.badlogic.gdx.math.Vector2;
import com.darkhouse.shardwar.ShardWar;
public class Empty extends GameObject{
public Empty() {
super();
name = ShardWar.main.getAssetLoader().getWord("empty");
}
@Override
public String getTooltip() {
return getEffectTooltip();
}
@Override
public Vector2 getShootPosition(int line) {
return null;
}
// @Override
// public Vector2 getShootPosition(int line) {
// return new Vector2(slot.getX() + slot.getParent().getX() + slot.getWidth()/2,
// slot.getY() + slot.getParent().getY() + slot.getHeight()/2);
// }
// @Override
// public int receiveDamage(int damage, DamageSource source, boolean ignoreDefSpells) {
// return 0;
// }
@Override
public void physic(float delta) {
}
}
|
UTF-8
|
Java
| 895 |
java
|
Empty.java
|
Java
|
[] | null |
[] |
package com.darkhouse.shardwar.Logic.GameEntity;
import com.badlogic.gdx.math.Vector2;
import com.darkhouse.shardwar.ShardWar;
public class Empty extends GameObject{
public Empty() {
super();
name = ShardWar.main.getAssetLoader().getWord("empty");
}
@Override
public String getTooltip() {
return getEffectTooltip();
}
@Override
public Vector2 getShootPosition(int line) {
return null;
}
// @Override
// public Vector2 getShootPosition(int line) {
// return new Vector2(slot.getX() + slot.getParent().getX() + slot.getWidth()/2,
// slot.getY() + slot.getParent().getY() + slot.getHeight()/2);
// }
// @Override
// public int receiveDamage(int damage, DamageSource source, boolean ignoreDefSpells) {
// return 0;
// }
@Override
public void physic(float delta) {
}
}
| 895 | 0.626816 | 0.618994 | 37 | 23.18919 | 25.038174 | 90 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.324324 | false | false |
1
|
2aa45ff228c97b1e70e544daaa4d5ee8e0bf3ed1
| 4,346,506,928,131 |
e91c0998a3940352ea46808a3fb29f74c3fbd072
|
/src/main/java/com/jfcorugedo/reactivedemo/wallet/dao/WalletRepository.java
|
f973c86254d4f28ee5b774e177d46df0bd240b92
|
[] |
no_license
|
jfcorugedo/reactive-demo
|
https://github.com/jfcorugedo/reactive-demo
|
c1172aaf268cc920bdd93b69de54b045953b8242
|
6df64f0e57215690d4d0cebcba2c186075061899
|
refs/heads/master
| 2023-07-02T14:24:01.599000 | 2021-08-06T08:11:25 | 2021-08-06T08:11:25 | 392,003,760 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.jfcorugedo.reactivedemo.wallet.dao;
import com.jfcorugedo.reactivedemo.wallet.model.Wallet;
import org.springframework.data.repository.reactive.ReactiveCrudRepository;
public interface WalletRepository extends ReactiveCrudRepository<Wallet, String> {
}
|
UTF-8
|
Java
| 267 |
java
|
WalletRepository.java
|
Java
|
[
{
"context": "package com.jfcorugedo.reactivedemo.wallet.dao;\n\nimport com.jfcorugedo.r",
"end": 22,
"score": 0.6670333743095398,
"start": 14,
"tag": "USERNAME",
"value": "corugedo"
},
{
"context": "jfcorugedo.reactivedemo.wallet.dao;\n\nimport com.jfcorugedo.reactivedemo.wallet.model.Wallet;\nimport org.spri",
"end": 70,
"score": 0.6859427094459534,
"start": 62,
"tag": "USERNAME",
"value": "corugedo"
}
] | null |
[] |
package com.jfcorugedo.reactivedemo.wallet.dao;
import com.jfcorugedo.reactivedemo.wallet.model.Wallet;
import org.springframework.data.repository.reactive.ReactiveCrudRepository;
public interface WalletRepository extends ReactiveCrudRepository<Wallet, String> {
}
| 267 | 0.857678 | 0.857678 | 7 | 37.142857 | 33.651272 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.571429 | false | false |
1
|
27514de7c848fb398994b8a5381358e618fc228e
| 21,328,807,621,637 |
364c1c9102ffcbbdeb97c2c142302715d0ea5ce4
|
/src/haozijava/rmi/usezk/impl/IHelloService.java
|
5864e7f7b73a9284b90dc19bc3857f650626ee19
|
[] |
no_license
|
haoziapple/java_thinking
|
https://github.com/haoziapple/java_thinking
|
a10d89ec1819fa1cdbb336923bc295314b85b357
|
e412349bf25235ef0d6ce97bde49d60f860873af
|
refs/heads/master
| 2020-12-29T02:37:37.545000 | 2017-01-19T15:14:10 | 2017-01-19T15:14:10 | 53,108,913 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/**
* Copyright (C) 2016 FuZhong
*
*
* @className:haozijava.rmi.usezk.impl.IHelloService
* @description:TODO
* @date:2016-6-27 下午4:46:37
* @version:v1.0.0
* @author:WangHao
*
* Modification History:
* Date Author Version Description
* -----------------------------------------------------------------
* 2016-6-27 WangHao v1.0.0 create
*
*
*/
package haozijava.rmi.usezk.impl;
import java.rmi.Remote;
import java.rmi.RemoteException;
/**
* @className:haozijava.rmi.usezk.impl.IHelloService
* @description:定义一个RMI接口
* @version:v1.0.0
* @date:2016-6-27 下午4:46:50
* @author:WangHao
*/
public interface IHelloService extends Remote
{
String sayHello(String name) throws RemoteException;
}
|
UTF-8
|
Java
| 765 |
java
|
IHelloService.java
|
Java
|
[
{
"context": "/**\n * Copyright (C) 2016 FuZhong\n *\n *\n * @className:haozijava.rmi.usezk.impl.IHel",
"end": 33,
"score": 0.6834315657615662,
"start": 26,
"tag": "NAME",
"value": "FuZhong"
},
{
"context": "016-6-27 下午4:46:37\n * @version:v1.0.0 \n * @author:WangHao\n * \n * Modification History:\n * Date Auth",
"end": 181,
"score": 0.9980666637420654,
"start": 174,
"tag": "NAME",
"value": "WangHao"
},
{
"context": "---------------------------------\n * 2016-6-27 WangHao v1.0.0 create\n *\n *\n */\npackage haoz",
"end": 356,
"score": 0.6740689873695374,
"start": 349,
"tag": "NAME",
"value": "WangHao"
},
{
"context": "on:v1.0.0\n * @date:2016-6-27 下午4:46:50\n * @author:WangHao\n */\npublic interface IHelloService extends Remote",
"end": 636,
"score": 0.9967433214187622,
"start": 629,
"tag": "NAME",
"value": "WangHao"
}
] | null |
[] |
/**
* Copyright (C) 2016 FuZhong
*
*
* @className:haozijava.rmi.usezk.impl.IHelloService
* @description:TODO
* @date:2016-6-27 下午4:46:37
* @version:v1.0.0
* @author:WangHao
*
* Modification History:
* Date Author Version Description
* -----------------------------------------------------------------
* 2016-6-27 WangHao v1.0.0 create
*
*
*/
package haozijava.rmi.usezk.impl;
import java.rmi.Remote;
import java.rmi.RemoteException;
/**
* @className:haozijava.rmi.usezk.impl.IHelloService
* @description:定义一个RMI接口
* @version:v1.0.0
* @date:2016-6-27 下午4:46:50
* @author:WangHao
*/
public interface IHelloService extends Remote
{
String sayHello(String name) throws RemoteException;
}
| 765 | 0.614765 | 0.555705 | 33 | 21.575758 | 19.659266 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.151515 | false | false |
1
|
ccb14e5bca10b7d525e3c0339004df2fc6860c39
| 2,267,742,776,701 |
616034ca844897a7c223d9a9d3cdbe6cf59469b8
|
/src/main/java/Hw20180108/TestThread2.java
|
5877a5a3164c2b6a85d85613a6137ca2e94857e9
|
[] |
no_license
|
FYangkui/yk
|
https://github.com/FYangkui/yk
|
d32608a32539c784c70d738c2cbcac847fb6c9da
|
f667afbe2534af3f93a67485f49ec3ab128d8252
|
refs/heads/master
| 2021-09-03T10:05:50.371000 | 2018-01-08T08:27:09 | 2018-01-08T08:27:09 | 114,876,494 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/**
* Project Name:dt59mehomework
* File Name:TestThread2.java
* Package Name:Hw20180108
* Date:2018年1月8日下午3:31:45
* Copyright (c) 2018, bluemobi All Rights Reserved.
*/
package Hw20180108;
/**
* Description: <br/>
* Date: 2018年1月8日 下午3:31:45 <br/>
* @author YangKui
* @version
* @see
*/
public class TestThread2 {
public static void main(String[] args) {
for (int i = 0; i < 3; i++) {
MyThread2 mt=new MyThread2("张三");
MyThread2 mt1=new MyThread2("李四");
new Thread(mt).start();
new Thread(mt1).start();
}
}
}
|
UTF-8
|
Java
| 657 |
java
|
TestThread2.java
|
Java
|
[
{
"context": " Date: 2018年1月8日 下午3:31:45 <br/>\r\n * @author YangKui\r\n * @version\r\n * @see\r\n */\r\npublic class TestThre",
"end": 296,
"score": 0.9990620017051697,
"start": 289,
"tag": "NAME",
"value": "YangKui"
}
] | null |
[] |
/**
* Project Name:dt59mehomework
* File Name:TestThread2.java
* Package Name:Hw20180108
* Date:2018年1月8日下午3:31:45
* Copyright (c) 2018, bluemobi All Rights Reserved.
*/
package Hw20180108;
/**
* Description: <br/>
* Date: 2018年1月8日 下午3:31:45 <br/>
* @author YangKui
* @version
* @see
*/
public class TestThread2 {
public static void main(String[] args) {
for (int i = 0; i < 3; i++) {
MyThread2 mt=new MyThread2("张三");
MyThread2 mt1=new MyThread2("李四");
new Thread(mt).start();
new Thread(mt1).start();
}
}
}
| 657 | 0.556439 | 0.470588 | 29 | 19.620689 | 15.707266 | 52 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.275862 | false | false |
1
|
5d93ce7ba41265099c594915e1d04fbd028d2aa8
| 4,054,449,134,387 |
5f2fba737397115f8c34a62e44b80089c9eaecf8
|
/app/src/main/java/com/ww/lp/environment/module/login/LoginContract.java
|
3e20c8aa1f5310f4f379ce42d0150fc3bc46116e
|
[] |
no_license
|
ljpww72729/environment
|
https://github.com/ljpww72729/environment
|
7300afdb472e98a86ab6e0704892e860e32e2113
|
a09cd21f3beafbb92d232cade7d195b3656e868e
|
refs/heads/master
| 2021-01-11T19:49:16.007000 | 2018-03-10T03:43:48 | 2018-03-10T03:43:48 | 79,404,033 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.ww.lp.environment.module.login;
import android.support.annotation.NonNull;
import com.ww.lp.environment.BasePresenter;
import com.ww.lp.environment.BaseView;
import com.ww.lp.environment.data.user.UserInfo;
/**
* Created by LinkedME06 on 16/10/27.
*/
public class LoginContract {
interface View extends BaseView<Presenter> {
void success(String userId, boolean result);
void showProgressDialog(String msg);
void removeProgressDialog();
}
interface Presenter extends BasePresenter {
void login(@NonNull UserInfo userInfo);
}
}
|
UTF-8
|
Java
| 597 |
java
|
LoginContract.java
|
Java
|
[
{
"context": "nvironment.data.user.UserInfo;\n\n\n/**\n * Created by LinkedME06 on 16/10/27.\n */\n\npublic class LoginContract {\n\n ",
"end": 251,
"score": 0.9995579719543457,
"start": 241,
"tag": "USERNAME",
"value": "LinkedME06"
}
] | null |
[] |
package com.ww.lp.environment.module.login;
import android.support.annotation.NonNull;
import com.ww.lp.environment.BasePresenter;
import com.ww.lp.environment.BaseView;
import com.ww.lp.environment.data.user.UserInfo;
/**
* Created by LinkedME06 on 16/10/27.
*/
public class LoginContract {
interface View extends BaseView<Presenter> {
void success(String userId, boolean result);
void showProgressDialog(String msg);
void removeProgressDialog();
}
interface Presenter extends BasePresenter {
void login(@NonNull UserInfo userInfo);
}
}
| 597 | 0.721943 | 0.708543 | 27 | 21.111111 | 21.131569 | 52 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.37037 | false | false |
1
|
6bea87bf22bd9e4d7e44be2110fb1643eeedc025
| 4,887,672,798,858 |
c8cf973af91404a716d08d6ac12f6cc8601421d4
|
/1096/4433250_AC_1907MS_25152K.java
|
2d5cdd7f435ad874fd7df9c6f82ef52431c317ce
|
[
"MIT"
] |
permissive
|
Xuhui-Wang/poj-solutions
|
https://github.com/Xuhui-Wang/poj-solutions
|
f1cd7009fcc37672d3a2ca81851ac3b3cc64ca02
|
4895764ab800e8c2c4b2334a562dec2f07fa243e
|
refs/heads/master
| 2021-05-05T00:14:35.384000 | 2015-08-19T21:57:31 | 2015-08-19T21:57:31 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.util.*;
public class Main{
private static final Scanner in=new Scanner(System.in);
private class Coordinate{
int x,y,z,grid;
public Coordinate(int grid){
this.grid=grid;
z=grid/(length*width);
y=(grid%(length*width))/length;
x=grid%length;
}
public Coordinate(int x,int y,int z){
this.x=x;
this.y=y;
this.z=z;
grid=x+length*y+length*width*z;
}
public boolean Legal(){
return x>=0 && x<length && y>=0 && y<width && z>=0 && z<height;
}
public boolean AtEdge(){
return x==0 || x==length-1 || y==0 || y==width-1 || z==0 || z==height-1;
}
public Collection<Coordinate> Adjacences(){
Collection<Coordinate> adjacences=new ArrayList<Coordinate>();
adjacences.add(new Coordinate(x-1,y,z));
adjacences.add(new Coordinate(x+1,y,z));
adjacences.add(new Coordinate(x,y-1,z));
adjacences.add(new Coordinate(x,y+1,z));
adjacences.add(new Coordinate(x,y,z-1));
adjacences.add(new Coordinate(x,y,z+1));
return adjacences;
}
public int hashCode(){
return grid;
}
public boolean equals(Object another){
return (another instanceof Coordinate) && hashCode()==another.hashCode();
}
}
private int length,width,height,faceNum=0;
private Set<Coordinate> acms=new HashSet<Coordinate>();
private boolean[] outside;
public Main(int length,int width,int height,int acmNum){
this.length=length;
this.width=width;
this.height=height;
outside=new boolean[length*width*height];
while(acmNum-->0)
acms.add(new Coordinate(in.nextInt()));
for(int grid=0;grid<length*width*height;grid++){
if(outside[grid])
continue;
Coordinate coordinate=new Coordinate(grid);
if(coordinate.AtEdge() && !acms.contains(coordinate))
FillOutside(coordinate);
}
}
private void FillOutside(Coordinate coordinate){
Queue<Coordinate> BFSQueue=new LinkedList<Coordinate>();
BFSQueue.add(coordinate);
while(!BFSQueue.isEmpty()){
Coordinate current=BFSQueue.poll();
if(!current.Legal() || outside[current.grid])
continue;
if(!acms.contains(current)){
outside[current.grid]=true;
BFSQueue.addAll(current.Adjacences());
}
}
}
public void Output(){
for(int grid=0;grid<length*width*height;grid++){
Coordinate coordinate=new Coordinate(grid);
if(acms.contains(coordinate))
for(Coordinate adjacence:coordinate.Adjacences())
if(!adjacence.Legal() || outside[adjacence.grid])
faceNum++;
}
System.out.println("The number of faces needing shielding is "+faceNum+".");
}
public static void main(String[] args){
while(true){
int length=in.nextInt(),width=in.nextInt(),height=in.nextInt(),acmNum=in.nextInt();
if(length==0 && width==0 && height==0 && acmNum==0)
break;
new Main(length,width,height,acmNum).Output();
}
}
}
|
UTF-8
|
Java
| 2,865 |
java
|
4433250_AC_1907MS_25152K.java
|
Java
|
[] | null |
[] |
import java.util.*;
public class Main{
private static final Scanner in=new Scanner(System.in);
private class Coordinate{
int x,y,z,grid;
public Coordinate(int grid){
this.grid=grid;
z=grid/(length*width);
y=(grid%(length*width))/length;
x=grid%length;
}
public Coordinate(int x,int y,int z){
this.x=x;
this.y=y;
this.z=z;
grid=x+length*y+length*width*z;
}
public boolean Legal(){
return x>=0 && x<length && y>=0 && y<width && z>=0 && z<height;
}
public boolean AtEdge(){
return x==0 || x==length-1 || y==0 || y==width-1 || z==0 || z==height-1;
}
public Collection<Coordinate> Adjacences(){
Collection<Coordinate> adjacences=new ArrayList<Coordinate>();
adjacences.add(new Coordinate(x-1,y,z));
adjacences.add(new Coordinate(x+1,y,z));
adjacences.add(new Coordinate(x,y-1,z));
adjacences.add(new Coordinate(x,y+1,z));
adjacences.add(new Coordinate(x,y,z-1));
adjacences.add(new Coordinate(x,y,z+1));
return adjacences;
}
public int hashCode(){
return grid;
}
public boolean equals(Object another){
return (another instanceof Coordinate) && hashCode()==another.hashCode();
}
}
private int length,width,height,faceNum=0;
private Set<Coordinate> acms=new HashSet<Coordinate>();
private boolean[] outside;
public Main(int length,int width,int height,int acmNum){
this.length=length;
this.width=width;
this.height=height;
outside=new boolean[length*width*height];
while(acmNum-->0)
acms.add(new Coordinate(in.nextInt()));
for(int grid=0;grid<length*width*height;grid++){
if(outside[grid])
continue;
Coordinate coordinate=new Coordinate(grid);
if(coordinate.AtEdge() && !acms.contains(coordinate))
FillOutside(coordinate);
}
}
private void FillOutside(Coordinate coordinate){
Queue<Coordinate> BFSQueue=new LinkedList<Coordinate>();
BFSQueue.add(coordinate);
while(!BFSQueue.isEmpty()){
Coordinate current=BFSQueue.poll();
if(!current.Legal() || outside[current.grid])
continue;
if(!acms.contains(current)){
outside[current.grid]=true;
BFSQueue.addAll(current.Adjacences());
}
}
}
public void Output(){
for(int grid=0;grid<length*width*height;grid++){
Coordinate coordinate=new Coordinate(grid);
if(acms.contains(coordinate))
for(Coordinate adjacence:coordinate.Adjacences())
if(!adjacence.Legal() || outside[adjacence.grid])
faceNum++;
}
System.out.println("The number of faces needing shielding is "+faceNum+".");
}
public static void main(String[] args){
while(true){
int length=in.nextInt(),width=in.nextInt(),height=in.nextInt(),acmNum=in.nextInt();
if(length==0 && width==0 && height==0 && acmNum==0)
break;
new Main(length,width,height,acmNum).Output();
}
}
}
| 2,865 | 0.656894 | 0.648866 | 91 | 29.505495 | 21.063156 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.384615 | false | false |
1
|
d71b9656dcc8ca1da166e7a22e872db01fcf3475
| 8,650,064,152,003 |
0356da87ce56df2102c4458f7c3f2337740aaee7
|
/src/com/google/Rectangle.java
|
ff1d038981cde9c90ace9767f88b5f6a8c527dc1
|
[] |
no_license
|
elelinka/pola-figur
|
https://github.com/elelinka/pola-figur
|
9fcba26d30c05b5d5d0e209cd8e17cce594042e2
|
1dcfafcc4f5b677ba8b1e0c5b6f14cab35e85643
|
refs/heads/master
| 2020-06-19T14:59:50.580000 | 2019-07-13T19:07:13 | 2019-07-13T19:07:13 | 196,753,792 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.google;
public class Rectangle {
double sideA;
double sideB;
public Rectangle(double a, double b) {
sideA = a;
sideB = b;
}
public double rectPerimeter() {
return (sideA * 2) + (sideB * 2);
}
}
|
UTF-8
|
Java
| 258 |
java
|
Rectangle.java
|
Java
|
[] | null |
[] |
package com.google;
public class Rectangle {
double sideA;
double sideB;
public Rectangle(double a, double b) {
sideA = a;
sideB = b;
}
public double rectPerimeter() {
return (sideA * 2) + (sideB * 2);
}
}
| 258 | 0.550388 | 0.542636 | 16 | 15.125 | 14.194519 | 42 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4375 | false | false |
1
|
d1ab51497136334a563922878eff1133dedf79e4
| 17,076,789,986,798 |
b58646c7bd76629209cf32bd2544e3970113068b
|
/ms-inventory/src/main/java/com/zc/cache/web/controller/ProductInventoryController.java
|
c4cf8cdb499538ff65b94c967a61ad6a6ec687c8
|
[
"Apache-2.0"
] |
permissive
|
zhongchengxcr/cache
|
https://github.com/zhongchengxcr/cache
|
858907af83281f4f23ddc119131cf75a97605ff7
|
b1b4df6f94918684357d0787d5fb7eb942796584
|
refs/heads/master
| 2021-09-04T13:06:35.745000 | 2018-01-19T01:18:32 | 2018-01-19T01:18:32 | 115,233,785 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.zc.cache.web.controller;
import com.zc.cache.dao.db.entity.ProductInventory;
import com.zc.cache.request.ProductInventoryCacheRefreshRequest;
import com.zc.cache.request.ProductInventoryDBUpdateRequest;
import com.zc.cache.request.Request;
import com.zc.cache.service.ProductInventoryService;
import com.zc.cache.service.RequestAsyncProcessService;
import com.zc.cache.web.vo.Response;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@RequestMapping("/test")
@RestController
public class ProductInventoryController {
private Logger logger = LoggerFactory.getLogger(getClass());
@Resource
private RequestAsyncProcessService requestAsyncProcessService;
@Resource
private ProductInventoryService productInventoryService;
/**
* 更新商品库存
*/
@PostMapping("/updateProductInventory")
public Response updateProductInventory(@RequestBody ProductInventory productInventory) {
logger.info("===========日志===========: 接收到更新商品库存的请求,商品id=" + productInventory.getProductId() + ", 商品库存数量=" + productInventory.getInventoryCnt());
Response response;
try {
Request request = new ProductInventoryDBUpdateRequest(
productInventory, productInventoryService);
requestAsyncProcessService.process(request);
response = new Response(Response.SUCCESS);
} catch (Exception e) {
e.printStackTrace();
response = new Response(Response.FAILURE);
}
return response;
}
/**
* 获取商品库存
*/
@GetMapping("/getProductInventory/{productId}")
public ProductInventory getProductInventory(@PathVariable Long productId) {
logger.info("===========日志===========: 接收到一个商品库存的读请求,商品id=" + productId);
ProductInventory productInventory = productInventoryService.getProductInventoryCache(productId);
if (productInventory != null) {
logger.info("读缓存");
return productInventory;
} else {
logger.info("缓存不存在");
try {
Request request = new ProductInventoryCacheRefreshRequest(
productId, false, productInventoryService);
requestAsyncProcessService.process(request);
// 将请求扔给service异步去处理以后,就需要while(true)一会儿,在这里hang住
// 去尝试等待前面有商品库存更新的操作,同时缓存刷新的操作,将最新的数据刷新到缓存中
long startTime = System.currentTimeMillis();
long endTime = 0L;
long waitTime = 0L;
// 等待超过200ms没有从缓存中获取到结果
while (true) {
// 一般公司里面,面向用户的读请求控制在200ms就可以了
if (waitTime > 200) {
break;
}
// 尝试去redis中读取一次商品库存的缓存数据
productInventory = productInventoryService.getProductInventoryCache(productId);
logger.info("循环度缓存:{}", productInventory);
// 如果读取到了结果,那么就返回
if (productInventory != null) {
logger.info("===========日志===========: 在200ms内读取到了redis中的库存缓存,商品id=" + productInventory.getProductId() + ", 商品库存数量=" + productInventory.getInventoryCnt());
logger.info("===========日志===========: 耗时:{}", System.currentTimeMillis() - startTime);
return productInventory;
}
// 如果没有读取到结果,那么等待一段时间
else {
Thread.sleep(20);
endTime = System.currentTimeMillis();
waitTime = endTime - startTime;
}
}
// 直接尝试从数据库中读取数据
productInventory = productInventoryService.findProductInventory(productId);
logger.info("===========日志===========: 在200ms内没有读到缓存,查库:{}", productInventory);
if (productInventory != null) {
// 将缓存刷新一下
// 这个过程,实际上是一个读操作的过程,但是没有放在队列中串行去处理,还是有数据不一致的问题
request = new ProductInventoryCacheRefreshRequest(
productId, true, productInventoryService);
requestAsyncProcessService.process(request);
// 代码会运行到这里,只有三种情况:
// 1、就是说,上一次也是读请求,数据刷入了redis,但是redis LRU算法给清理掉了,标志位还是false
// 所以此时下一个读请求是从缓存中拿不到数据的,再放一个读Request进队列,让数据去刷新一下
// 2、可能在200ms内,就是读请求在队列中一直积压着,没有等待到它执行(在实际生产环境中,基本是比较坑了)
// 所以就直接查一次库,然后给队列里塞进去一个刷新缓存的请求
// 3、数据库里本身就没有,缓存穿透,穿透redis,请求到达mysql库
return productInventory;
}
} catch (Exception e) {
e.printStackTrace();
}
ProductInventory productInventory1 = new ProductInventory();
productInventory1.setProductId(productId);
productInventory1.setInventoryCnt(-1L);
return productInventory1;
}
}
}
|
UTF-8
|
Java
| 6,132 |
java
|
ProductInventoryController.java
|
Java
|
[] | null |
[] |
package com.zc.cache.web.controller;
import com.zc.cache.dao.db.entity.ProductInventory;
import com.zc.cache.request.ProductInventoryCacheRefreshRequest;
import com.zc.cache.request.ProductInventoryDBUpdateRequest;
import com.zc.cache.request.Request;
import com.zc.cache.service.ProductInventoryService;
import com.zc.cache.service.RequestAsyncProcessService;
import com.zc.cache.web.vo.Response;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@RequestMapping("/test")
@RestController
public class ProductInventoryController {
private Logger logger = LoggerFactory.getLogger(getClass());
@Resource
private RequestAsyncProcessService requestAsyncProcessService;
@Resource
private ProductInventoryService productInventoryService;
/**
* 更新商品库存
*/
@PostMapping("/updateProductInventory")
public Response updateProductInventory(@RequestBody ProductInventory productInventory) {
logger.info("===========日志===========: 接收到更新商品库存的请求,商品id=" + productInventory.getProductId() + ", 商品库存数量=" + productInventory.getInventoryCnt());
Response response;
try {
Request request = new ProductInventoryDBUpdateRequest(
productInventory, productInventoryService);
requestAsyncProcessService.process(request);
response = new Response(Response.SUCCESS);
} catch (Exception e) {
e.printStackTrace();
response = new Response(Response.FAILURE);
}
return response;
}
/**
* 获取商品库存
*/
@GetMapping("/getProductInventory/{productId}")
public ProductInventory getProductInventory(@PathVariable Long productId) {
logger.info("===========日志===========: 接收到一个商品库存的读请求,商品id=" + productId);
ProductInventory productInventory = productInventoryService.getProductInventoryCache(productId);
if (productInventory != null) {
logger.info("读缓存");
return productInventory;
} else {
logger.info("缓存不存在");
try {
Request request = new ProductInventoryCacheRefreshRequest(
productId, false, productInventoryService);
requestAsyncProcessService.process(request);
// 将请求扔给service异步去处理以后,就需要while(true)一会儿,在这里hang住
// 去尝试等待前面有商品库存更新的操作,同时缓存刷新的操作,将最新的数据刷新到缓存中
long startTime = System.currentTimeMillis();
long endTime = 0L;
long waitTime = 0L;
// 等待超过200ms没有从缓存中获取到结果
while (true) {
// 一般公司里面,面向用户的读请求控制在200ms就可以了
if (waitTime > 200) {
break;
}
// 尝试去redis中读取一次商品库存的缓存数据
productInventory = productInventoryService.getProductInventoryCache(productId);
logger.info("循环度缓存:{}", productInventory);
// 如果读取到了结果,那么就返回
if (productInventory != null) {
logger.info("===========日志===========: 在200ms内读取到了redis中的库存缓存,商品id=" + productInventory.getProductId() + ", 商品库存数量=" + productInventory.getInventoryCnt());
logger.info("===========日志===========: 耗时:{}", System.currentTimeMillis() - startTime);
return productInventory;
}
// 如果没有读取到结果,那么等待一段时间
else {
Thread.sleep(20);
endTime = System.currentTimeMillis();
waitTime = endTime - startTime;
}
}
// 直接尝试从数据库中读取数据
productInventory = productInventoryService.findProductInventory(productId);
logger.info("===========日志===========: 在200ms内没有读到缓存,查库:{}", productInventory);
if (productInventory != null) {
// 将缓存刷新一下
// 这个过程,实际上是一个读操作的过程,但是没有放在队列中串行去处理,还是有数据不一致的问题
request = new ProductInventoryCacheRefreshRequest(
productId, true, productInventoryService);
requestAsyncProcessService.process(request);
// 代码会运行到这里,只有三种情况:
// 1、就是说,上一次也是读请求,数据刷入了redis,但是redis LRU算法给清理掉了,标志位还是false
// 所以此时下一个读请求是从缓存中拿不到数据的,再放一个读Request进队列,让数据去刷新一下
// 2、可能在200ms内,就是读请求在队列中一直积压着,没有等待到它执行(在实际生产环境中,基本是比较坑了)
// 所以就直接查一次库,然后给队列里塞进去一个刷新缓存的请求
// 3、数据库里本身就没有,缓存穿透,穿透redis,请求到达mysql库
return productInventory;
}
} catch (Exception e) {
e.printStackTrace();
}
ProductInventory productInventory1 = new ProductInventory();
productInventory1.setProductId(productId);
productInventory1.setInventoryCnt(-1L);
return productInventory1;
}
}
}
| 6,132 | 0.582323 | 0.576066 | 138 | 36.057972 | 32.028015 | 179 | true | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.449275 | false | false |
1
|
e8d5080c2b8dad8fb065d726428c9a9caae49cf1
| 1,760,936,614,553 |
724c977ca15b27d979afc766b2b5bbf3e05bc708
|
/sdk/src/main/java/com/hedera/hashgraph/sdk/FreezeTransaction.java
|
8a1f64ad0dfccd3a608bd178f02b7d9d896c4491
|
[
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
steven-sheehy/hedera-sdk-java
|
https://github.com/steven-sheehy/hedera-sdk-java
|
5cacd45995a2f62270a9df1fe8ed693cca1ec89e
|
cebd51fcf8e626eb62dcec4e826885c305c85f34
|
refs/heads/main
| 2022-12-15T10:27:37.912000 | 2022-01-19T06:21:19 | 2022-01-19T06:21:19 | 196,480,168 | 0 | 0 |
Apache-2.0
| true | 2019-07-12T00:08:47 | 2019-07-12T00:08:46 | 2019-07-11T19:52:05 | 2019-07-11T20:03:42 | 49,859 | 0 | 0 | 0 | null | false | false |
package com.hedera.hashgraph.sdk;
import com.google.protobuf.ByteString;
import com.google.protobuf.InvalidProtocolBufferException;
import com.hedera.hashgraph.sdk.proto.FreezeServiceGrpc;
import com.hedera.hashgraph.sdk.proto.FreezeTransactionBody;
import com.hedera.hashgraph.sdk.proto.SchedulableTransactionBody;
import com.hedera.hashgraph.sdk.proto.TransactionBody;
import com.hedera.hashgraph.sdk.proto.TransactionResponse;
import io.grpc.MethodDescriptor;
import org.threeten.bp.Instant;
import org.threeten.bp.OffsetTime;
import org.threeten.bp.ZoneOffset;
import javax.annotation.Nullable;
import java.util.LinkedHashMap;
import java.util.Objects;
/**
* Set the freezing period in which the platform will stop creating events and accepting transactions.
* This is used before safely shut down the platform for maintenance.
*/
public final class FreezeTransaction extends Transaction<FreezeTransaction> {
private int endHour = 0;
private int endMinute = 0;
@Nullable
private Instant startTime = null;
@Nullable
private FileId fileId = null;
private byte[] fileHash = {};
private FreezeType freezeType = FreezeType.UNKNOWN_FREEZE_TYPE;
public FreezeTransaction() {
}
FreezeTransaction(LinkedHashMap<TransactionId, LinkedHashMap<AccountId, com.hedera.hashgraph.sdk.proto.Transaction>> txs) throws InvalidProtocolBufferException {
super(txs);
initFromTransactionBody();
}
FreezeTransaction(com.hedera.hashgraph.sdk.proto.TransactionBody txBody) {
super(txBody);
initFromTransactionBody();
}
public Instant getStartTime() {
return startTime != null ? startTime : Instant.EPOCH;
}
public FreezeTransaction setStartTime(Instant startTime) {
requireNotFrozen();
Objects.requireNonNull(startTime);
this.startTime = startTime;
return this;
}
/**
* @deprecated Use {@link #setStartTime(Instant)} instead.
*/
@Deprecated
public FreezeTransaction setStartTime(int hour, int minute) {
return setStartTime(Instant.from(OffsetTime.of(hour, minute, 0, 0, ZoneOffset.UTC)));
}
/**
* @deprecated with no replacement
*/
@Deprecated
public Instant getEndTime() {
return Instant.from(OffsetTime.of(endHour, endMinute, 0, 0, ZoneOffset.UTC));
}
/**
* Sets the end time (in UTC).
*
* @deprecated with no replacement
* @param hour The hour to be set
* @param minute The minute to be set
* @return {@code this}
*/
@Deprecated
public FreezeTransaction setEndTime(int hour, int minute) {
requireNotFrozen();
endHour = hour;
endMinute = minute;
return this;
}
/**
* @deprecated Use {@link #getFileId()} instead.
*/
@Deprecated
@Nullable
public FileId getUpdateFileId() {
return fileId;
}
/**
* @deprecated Use {@link #setFileId(FileId)} instead.
*/
@Deprecated
public FreezeTransaction setUpdateFileId(FileId updateFileId) {
return setFileId(updateFileId);
}
/**
* @deprecated Use {@link #getFileHash()} instead.
*/
@Deprecated
public byte[] getUpdateFileHash() {
return fileHash;
}
/**
* @deprecated Use {@link #setFileHash(byte[])} instead.
*/
@Deprecated
public FreezeTransaction setUpdateFileHash(byte[] updateFileHash) {
return setFileHash(updateFileHash);
}
@Nullable
public FileId getFileId() {
return fileId;
}
public FreezeTransaction setFileId(FileId fileId) {
requireNotFrozen();
Objects.requireNonNull(fileId);
this.fileId = fileId;
return this;
}
public byte[] getFileHash() {
return fileHash;
}
public FreezeTransaction setFileHash(byte[] fileHash) {
requireNotFrozen();
Objects.requireNonNull(fileHash);
this.fileHash = fileHash;
return this;
}
public FreezeType getFreezeType() {
return freezeType;
}
public FreezeTransaction setFreezeType(FreezeType freezeType) {
requireNotFrozen();
Objects.requireNonNull(freezeType);
this.freezeType = freezeType;
return this;
}
@Override
void validateChecksums(Client client) {
}
@Override
MethodDescriptor<com.hedera.hashgraph.sdk.proto.Transaction, TransactionResponse> getMethodDescriptor() {
return FreezeServiceGrpc.getFreezeMethod();
}
void initFromTransactionBody() {
var body = sourceTransactionBody.getFreeze();
freezeType = FreezeType.valueOf(body.getFreezeType());
if (body.hasUpdateFile()) {
fileId = FileId.fromProtobuf(body.getUpdateFile());
}
fileHash = body.getFileHash().toByteArray();
if (body.hasStartTime()) {
startTime = InstantConverter.fromProtobuf(body.getStartTime());
}
}
FreezeTransactionBody.Builder build() {
var builder = FreezeTransactionBody.newBuilder();
builder.setFreezeType(freezeType.code);
if (fileId != null) {
builder.setUpdateFile(fileId.toProtobuf());
}
builder.setFileHash(ByteString.copyFrom(fileHash));
if (startTime != null) {
builder.setStartTime(InstantConverter.toProtobuf(startTime));
}
return builder;
}
@Override
void onFreeze(TransactionBody.Builder bodyBuilder) {
bodyBuilder.setFreeze(build());
}
@Override
void onScheduled(SchedulableTransactionBody.Builder scheduled) {
scheduled.setFreeze(build());
}
}
|
UTF-8
|
Java
| 5,693 |
java
|
FreezeTransaction.java
|
Java
|
[] | null |
[] |
package com.hedera.hashgraph.sdk;
import com.google.protobuf.ByteString;
import com.google.protobuf.InvalidProtocolBufferException;
import com.hedera.hashgraph.sdk.proto.FreezeServiceGrpc;
import com.hedera.hashgraph.sdk.proto.FreezeTransactionBody;
import com.hedera.hashgraph.sdk.proto.SchedulableTransactionBody;
import com.hedera.hashgraph.sdk.proto.TransactionBody;
import com.hedera.hashgraph.sdk.proto.TransactionResponse;
import io.grpc.MethodDescriptor;
import org.threeten.bp.Instant;
import org.threeten.bp.OffsetTime;
import org.threeten.bp.ZoneOffset;
import javax.annotation.Nullable;
import java.util.LinkedHashMap;
import java.util.Objects;
/**
* Set the freezing period in which the platform will stop creating events and accepting transactions.
* This is used before safely shut down the platform for maintenance.
*/
public final class FreezeTransaction extends Transaction<FreezeTransaction> {
private int endHour = 0;
private int endMinute = 0;
@Nullable
private Instant startTime = null;
@Nullable
private FileId fileId = null;
private byte[] fileHash = {};
private FreezeType freezeType = FreezeType.UNKNOWN_FREEZE_TYPE;
public FreezeTransaction() {
}
FreezeTransaction(LinkedHashMap<TransactionId, LinkedHashMap<AccountId, com.hedera.hashgraph.sdk.proto.Transaction>> txs) throws InvalidProtocolBufferException {
super(txs);
initFromTransactionBody();
}
FreezeTransaction(com.hedera.hashgraph.sdk.proto.TransactionBody txBody) {
super(txBody);
initFromTransactionBody();
}
public Instant getStartTime() {
return startTime != null ? startTime : Instant.EPOCH;
}
public FreezeTransaction setStartTime(Instant startTime) {
requireNotFrozen();
Objects.requireNonNull(startTime);
this.startTime = startTime;
return this;
}
/**
* @deprecated Use {@link #setStartTime(Instant)} instead.
*/
@Deprecated
public FreezeTransaction setStartTime(int hour, int minute) {
return setStartTime(Instant.from(OffsetTime.of(hour, minute, 0, 0, ZoneOffset.UTC)));
}
/**
* @deprecated with no replacement
*/
@Deprecated
public Instant getEndTime() {
return Instant.from(OffsetTime.of(endHour, endMinute, 0, 0, ZoneOffset.UTC));
}
/**
* Sets the end time (in UTC).
*
* @deprecated with no replacement
* @param hour The hour to be set
* @param minute The minute to be set
* @return {@code this}
*/
@Deprecated
public FreezeTransaction setEndTime(int hour, int minute) {
requireNotFrozen();
endHour = hour;
endMinute = minute;
return this;
}
/**
* @deprecated Use {@link #getFileId()} instead.
*/
@Deprecated
@Nullable
public FileId getUpdateFileId() {
return fileId;
}
/**
* @deprecated Use {@link #setFileId(FileId)} instead.
*/
@Deprecated
public FreezeTransaction setUpdateFileId(FileId updateFileId) {
return setFileId(updateFileId);
}
/**
* @deprecated Use {@link #getFileHash()} instead.
*/
@Deprecated
public byte[] getUpdateFileHash() {
return fileHash;
}
/**
* @deprecated Use {@link #setFileHash(byte[])} instead.
*/
@Deprecated
public FreezeTransaction setUpdateFileHash(byte[] updateFileHash) {
return setFileHash(updateFileHash);
}
@Nullable
public FileId getFileId() {
return fileId;
}
public FreezeTransaction setFileId(FileId fileId) {
requireNotFrozen();
Objects.requireNonNull(fileId);
this.fileId = fileId;
return this;
}
public byte[] getFileHash() {
return fileHash;
}
public FreezeTransaction setFileHash(byte[] fileHash) {
requireNotFrozen();
Objects.requireNonNull(fileHash);
this.fileHash = fileHash;
return this;
}
public FreezeType getFreezeType() {
return freezeType;
}
public FreezeTransaction setFreezeType(FreezeType freezeType) {
requireNotFrozen();
Objects.requireNonNull(freezeType);
this.freezeType = freezeType;
return this;
}
@Override
void validateChecksums(Client client) {
}
@Override
MethodDescriptor<com.hedera.hashgraph.sdk.proto.Transaction, TransactionResponse> getMethodDescriptor() {
return FreezeServiceGrpc.getFreezeMethod();
}
void initFromTransactionBody() {
var body = sourceTransactionBody.getFreeze();
freezeType = FreezeType.valueOf(body.getFreezeType());
if (body.hasUpdateFile()) {
fileId = FileId.fromProtobuf(body.getUpdateFile());
}
fileHash = body.getFileHash().toByteArray();
if (body.hasStartTime()) {
startTime = InstantConverter.fromProtobuf(body.getStartTime());
}
}
FreezeTransactionBody.Builder build() {
var builder = FreezeTransactionBody.newBuilder();
builder.setFreezeType(freezeType.code);
if (fileId != null) {
builder.setUpdateFile(fileId.toProtobuf());
}
builder.setFileHash(ByteString.copyFrom(fileHash));
if (startTime != null) {
builder.setStartTime(InstantConverter.toProtobuf(startTime));
}
return builder;
}
@Override
void onFreeze(TransactionBody.Builder bodyBuilder) {
bodyBuilder.setFreeze(build());
}
@Override
void onScheduled(SchedulableTransactionBody.Builder scheduled) {
scheduled.setFreeze(build());
}
}
| 5,693 | 0.663973 | 0.662919 | 202 | 27.183168 | 25.816587 | 165 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.405941 | false | false |
1
|
495e05177c6e89fedb43ea16db8700de380ee8a3
| 22,711,787,076,718 |
66df351e7497715c392a2c105168b2f88e27cae8
|
/src/main/java/team/balam/security/jwt/JwtFilter.java
|
5f255ac0a4bdc9495196c05c90a17c7345876081
|
[
"MIT"
] |
permissive
|
KNero/jwt-security
|
https://github.com/KNero/jwt-security
|
0aacb4e4bdf5b8ea8b87431ec875a5b902be0d1b
|
d654068473acf67449efd8c70245548ae674e519
|
refs/heads/master
| 2020-04-11T20:28:26.280000 | 2020-02-25T04:40:48 | 2020-02-25T04:40:48 | 162,072,249 | 5 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package team.balam.security.jwt;
import team.balam.security.jwt.access.AccessTarget;
import team.balam.security.jwt.access.AuthorizationException;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
public abstract class JwtFilter<T> implements Filter {
protected JwtSecurity<T> jwtSecurity;
@Override
public final void init(FilterConfig filterConfig) throws ServletException {
jwtSecurity = build(new JwtSecurity.Builder<>(), filterConfig);
}
protected abstract JwtSecurity<T> build(JwtSecurity.Builder<T> builder, FilterConfig filterConfig) throws ServletException;
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
HttpServletRequest httpServletRequest = (HttpServletRequest) request;
String uri = httpServletRequest.getRequestURI();
String method = httpServletRequest.getMethod();
String jwt = httpServletRequest.getHeader(jwtSecurity.getHeaderName());
try {
jwtSecurity.authenticate(jwt, new AccessTarget(uri, method));
chain.doFilter(request, response);
} catch (AuthenticationException e) { // AuthenticationException 인증 실패
if (e.isExpired()) {
onExpiredToken(request, response, chain, e);
} else {
onFailAuthentication(request, response, chain, e);
}
} catch (AuthorizationException e) { // AuthorizationException 접근 권한이 없을 경우
onFailAuthorization(request, response, chain, e);
}
}
/**
* 인증실패
*/
protected void onFailAuthentication(ServletRequest request, ServletResponse response, FilterChain chain, AuthenticationException e) throws ServletException {
try {
((HttpServletResponse) response).sendError(401, "Unauthorized");
} catch (IOException ie) {
throw new ServletException(ie);
}
}
/**
* 토큰만료
*/
protected void onExpiredToken(ServletRequest request, ServletResponse response, FilterChain chain, AuthenticationException e) throws ServletException {
try {
((HttpServletResponse) response).sendError(401, "Unauthorized");
} catch (IOException ie) {
throw new ServletException(ie);
}
}
/**
* 접근권한 없음
*/
protected void onFailAuthorization(ServletRequest request, ServletResponse response, FilterChain chain, AuthorizationException e) throws ServletException {
try {
((HttpServletResponse) response).sendError(403, "Forbidden");
} catch (IOException ie) {
throw new ServletException(ie);
}
}
@Override
public void destroy() {
}
}
|
UTF-8
|
Java
| 2,918 |
java
|
JwtFilter.java
|
Java
|
[] | null |
[] |
package team.balam.security.jwt;
import team.balam.security.jwt.access.AccessTarget;
import team.balam.security.jwt.access.AuthorizationException;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
public abstract class JwtFilter<T> implements Filter {
protected JwtSecurity<T> jwtSecurity;
@Override
public final void init(FilterConfig filterConfig) throws ServletException {
jwtSecurity = build(new JwtSecurity.Builder<>(), filterConfig);
}
protected abstract JwtSecurity<T> build(JwtSecurity.Builder<T> builder, FilterConfig filterConfig) throws ServletException;
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
HttpServletRequest httpServletRequest = (HttpServletRequest) request;
String uri = httpServletRequest.getRequestURI();
String method = httpServletRequest.getMethod();
String jwt = httpServletRequest.getHeader(jwtSecurity.getHeaderName());
try {
jwtSecurity.authenticate(jwt, new AccessTarget(uri, method));
chain.doFilter(request, response);
} catch (AuthenticationException e) { // AuthenticationException 인증 실패
if (e.isExpired()) {
onExpiredToken(request, response, chain, e);
} else {
onFailAuthentication(request, response, chain, e);
}
} catch (AuthorizationException e) { // AuthorizationException 접근 권한이 없을 경우
onFailAuthorization(request, response, chain, e);
}
}
/**
* 인증실패
*/
protected void onFailAuthentication(ServletRequest request, ServletResponse response, FilterChain chain, AuthenticationException e) throws ServletException {
try {
((HttpServletResponse) response).sendError(401, "Unauthorized");
} catch (IOException ie) {
throw new ServletException(ie);
}
}
/**
* 토큰만료
*/
protected void onExpiredToken(ServletRequest request, ServletResponse response, FilterChain chain, AuthenticationException e) throws ServletException {
try {
((HttpServletResponse) response).sendError(401, "Unauthorized");
} catch (IOException ie) {
throw new ServletException(ie);
}
}
/**
* 접근권한 없음
*/
protected void onFailAuthorization(ServletRequest request, ServletResponse response, FilterChain chain, AuthorizationException e) throws ServletException {
try {
((HttpServletResponse) response).sendError(403, "Forbidden");
} catch (IOException ie) {
throw new ServletException(ie);
}
}
@Override
public void destroy() {
}
}
| 2,918 | 0.676676 | 0.673533 | 82 | 33.92683 | 38.895351 | 161 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.658537 | false | false |
1
|
01024c838f740cc22a4e76e05b7916e45759e5e8
| 8,546,984,938,029 |
ebc7c7b3ae9b3a3d0cacf57f6ecc008aafb0705d
|
/Ejemplos/src/ejemplos029_ficheros4_ficheroTextoBuffered/FicheroTextoBufferedMetodos4.java
|
8e61155b4117f8304430753e05e5d7b672f2e3e6
|
[] |
no_license
|
blueslaboratory/Java-Crash-Course
|
https://github.com/blueslaboratory/Java-Crash-Course
|
38226e43411078c5364ab86adf4be8d1deee56b7
|
5516e55416d0a9c4169b7b0f089f583912869067
|
refs/heads/master
| 2023-06-22T03:20:05.815000 | 2023-06-01T08:30:56 | 2023-06-01T08:30:56 | 380,726,311 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package ejemplos029_ficheros4_ficheroTextoBuffered;
import java.io.*; //Importamos todas las clases de java.io.
import java.util.*;
public class FicheroTextoBufferedMetodos4 {
public static void main(String[] args) {
final String FICH = "C:\\Users\\W10Alex\\Desktop\\fichero1.txt";
// Escribimos en el fichero
escribeFichero(FICH);
// Leemos el fichero y lo mostramos por pantalla
leeFichero(FICH);
// No puedes abrir Scanner aqui porque has cerrado el flujo en escribeFichero
// Scanner sc = new Scanner(System.in);
// String s = sc.nextLine();
}
/**
* escribeFichero
*/
public static void escribeFichero(String fichero) {
// try: Con la version 8 de Java
// este try coge parametros
// es una variable que solo va a existir en el bloque, hay que declarla en el try
try (Scanner sc = new Scanner(System.in);
// esto no te deja volver a usar el scanner porque cierra el flujo de System.in
BufferedWriter bw = new BufferedWriter(new FileWriter(fichero));) {
// Escribimos en el fichero
String leido = null;
System.out.print("> ");
while (!(leido = sc.nextLine()).equals("fin")) {
System.out.print("> ");
bw.write(leido);
bw.newLine();
}
} catch (IOException e) {
System.out.println("Error E/S: " + e);
}
}
/**
* leeFichero
*/
public static void leeFichero(String fichero) {
try (BufferedReader br = new BufferedReader(new FileReader(fichero))) {
// Leemos el fichero y lo mostramos por pantalla
// Elegante
String linea;
while ((linea = br.readLine()) != null) {
System.out.println(linea);
}
} catch (IOException e) {
System.out.println("Error E/S: " + e);
}
}
}
|
UTF-8
|
Java
| 1,759 |
java
|
FicheroTextoBufferedMetodos4.java
|
Java
|
[
{
"context": "ring[] args) {\r\n\t\tfinal String FICH = \"C:\\\\Users\\\\W10Alex\\\\Desktop\\\\fichero1.txt\";\r\n\t\t// Escribimos en el f",
"end": 270,
"score": 0.9995759129524231,
"start": 263,
"tag": "USERNAME",
"value": "W10Alex"
}
] | null |
[] |
package ejemplos029_ficheros4_ficheroTextoBuffered;
import java.io.*; //Importamos todas las clases de java.io.
import java.util.*;
public class FicheroTextoBufferedMetodos4 {
public static void main(String[] args) {
final String FICH = "C:\\Users\\W10Alex\\Desktop\\fichero1.txt";
// Escribimos en el fichero
escribeFichero(FICH);
// Leemos el fichero y lo mostramos por pantalla
leeFichero(FICH);
// No puedes abrir Scanner aqui porque has cerrado el flujo en escribeFichero
// Scanner sc = new Scanner(System.in);
// String s = sc.nextLine();
}
/**
* escribeFichero
*/
public static void escribeFichero(String fichero) {
// try: Con la version 8 de Java
// este try coge parametros
// es una variable que solo va a existir en el bloque, hay que declarla en el try
try (Scanner sc = new Scanner(System.in);
// esto no te deja volver a usar el scanner porque cierra el flujo de System.in
BufferedWriter bw = new BufferedWriter(new FileWriter(fichero));) {
// Escribimos en el fichero
String leido = null;
System.out.print("> ");
while (!(leido = sc.nextLine()).equals("fin")) {
System.out.print("> ");
bw.write(leido);
bw.newLine();
}
} catch (IOException e) {
System.out.println("Error E/S: " + e);
}
}
/**
* leeFichero
*/
public static void leeFichero(String fichero) {
try (BufferedReader br = new BufferedReader(new FileReader(fichero))) {
// Leemos el fichero y lo mostramos por pantalla
// Elegante
String linea;
while ((linea = br.readLine()) != null) {
System.out.println(linea);
}
} catch (IOException e) {
System.out.println("Error E/S: " + e);
}
}
}
| 1,759 | 0.640136 | 0.63502 | 67 | 24.253731 | 23.936073 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.925373 | false | false |
1
|
8452841e4edaec79094d9db75a14da06d3566ce3
| 19,447,611,937,607 |
44cf528f48c44c1663a38e129e10930eefe57f1a
|
/src/tv/tv9x9/player/PlasterCast.java
|
9c6ee5785c758a7248b2c6e3e297667adabb5b7d
|
[] |
no_license
|
9X9NETWORK/android51a
|
https://github.com/9X9NETWORK/android51a
|
318f1c6fede03d60e5950d49c499cd7d4a705e40
|
54be21cf80541d7bbb48fa599d99f32ff47cc406
|
refs/heads/master
| 2021-01-20T03:37:11.502000 | 2014-12-10T01:01:55 | 2014-12-10T01:01:55 | 89,561,958 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package tv.tv9x9.player;
import android.content.Context;
import android.os.Bundle;
import android.support.v7.media.MediaRouter;
import android.support.v7.media.MediaRouter.RouteInfo;
import android.support.v7.media.MediaRouteSelector;
import android.util.Log;
public class PlasterCast
{
boolean uses_matchstick = true;
boolean uses_chromecast = true;
WrapMatchstick matchstick = null;
WrapChromecast chromecast = null;
PlasterListener listener = null;
public interface PlasterListener
{
public void onApplicationDisconnected (int errorCode);
public void onVolumeChanged();
public String getNamespace();
public void onConnected (Bundle connectionHint);
public void onApplicationCouldNotLaunch (int statusCode);
public void onMessageReceived (String namespace, String message);
public void onConnectionSuspended (int cause);
public void onConnectionFailed();
public void onTeardown();
}
/* WrapChromecast and WrapMatchstick adhere to this interface */
public interface PlasterInterface
{
public String categoryForCast (String app_name);
public void selectDevice (RouteInfo info);
public void stopApplication();
public void createClient (Context ctx, PlasterCast.PlasterListener listener);
public void sendMessage (String message);
public void teardown();
}
PlasterInterface plaster = null;
PlasterCast (PlasterListener listener)
{
this.listener = listener;
if (uses_matchstick)
matchstick = new WrapMatchstick();
if (uses_chromecast)
chromecast = new WrapChromecast();
}
public void log (String text)
{
Log.i ("vtest", "[plasterCast] " + text);
}
public MediaRouteSelector makeSelector (String app_name)
{
MediaRouteSelector.Builder selectorBuilder = new MediaRouteSelector.Builder();
addCategoriesForCast (selectorBuilder, app_name);
return selectorBuilder.build();
}
public void addCategoriesForCast (MediaRouteSelector.Builder selectorBuilder, String app_name)
{
if (selectorBuilder != null)
{
if (uses_matchstick && matchstick != null)
{
log ("adding category for MatchStick");
selectorBuilder.addControlCategory (matchstick.categoryForCast (app_name));
}
if (uses_chromecast && chromecast != null)
{
if (app_name != null)
{
log ("adding category for Chromecast");
selectorBuilder.addControlCategory (chromecast.categoryForCast (app_name));
}
else
log ("won't add category for Chromecast, since app_name is null");
}
}
else
log ("** selectorBuilder is null!");
}
public void selectDevice (MediaRouter router, RouteInfo info)
{
if (info != null)
{
String devinfo = info.getDescription();
if (devinfo != null && devinfo.contains ("MatchStick"))
plaster = matchstick;
else
plaster = chromecast;
if (plaster != null)
plaster.selectDevice (info);
}
}
public void stopApplication()
{
if (plaster != null)
plaster.stopApplication();
}
public void teardown()
{
if (plaster != null)
plaster.teardown();
listener.onTeardown();
plaster = null;
}
public void createClient (Context ctx, PlasterListener listener)
{
if (plaster != null)
plaster.createClient (ctx, listener);
}
public void sendMessage (String message)
{
if (plaster != null)
plaster.sendMessage (message);
}
}
|
UTF-8
|
Java
| 3,363 |
java
|
PlasterCast.java
|
Java
|
[] | null |
[] |
package tv.tv9x9.player;
import android.content.Context;
import android.os.Bundle;
import android.support.v7.media.MediaRouter;
import android.support.v7.media.MediaRouter.RouteInfo;
import android.support.v7.media.MediaRouteSelector;
import android.util.Log;
public class PlasterCast
{
boolean uses_matchstick = true;
boolean uses_chromecast = true;
WrapMatchstick matchstick = null;
WrapChromecast chromecast = null;
PlasterListener listener = null;
public interface PlasterListener
{
public void onApplicationDisconnected (int errorCode);
public void onVolumeChanged();
public String getNamespace();
public void onConnected (Bundle connectionHint);
public void onApplicationCouldNotLaunch (int statusCode);
public void onMessageReceived (String namespace, String message);
public void onConnectionSuspended (int cause);
public void onConnectionFailed();
public void onTeardown();
}
/* WrapChromecast and WrapMatchstick adhere to this interface */
public interface PlasterInterface
{
public String categoryForCast (String app_name);
public void selectDevice (RouteInfo info);
public void stopApplication();
public void createClient (Context ctx, PlasterCast.PlasterListener listener);
public void sendMessage (String message);
public void teardown();
}
PlasterInterface plaster = null;
PlasterCast (PlasterListener listener)
{
this.listener = listener;
if (uses_matchstick)
matchstick = new WrapMatchstick();
if (uses_chromecast)
chromecast = new WrapChromecast();
}
public void log (String text)
{
Log.i ("vtest", "[plasterCast] " + text);
}
public MediaRouteSelector makeSelector (String app_name)
{
MediaRouteSelector.Builder selectorBuilder = new MediaRouteSelector.Builder();
addCategoriesForCast (selectorBuilder, app_name);
return selectorBuilder.build();
}
public void addCategoriesForCast (MediaRouteSelector.Builder selectorBuilder, String app_name)
{
if (selectorBuilder != null)
{
if (uses_matchstick && matchstick != null)
{
log ("adding category for MatchStick");
selectorBuilder.addControlCategory (matchstick.categoryForCast (app_name));
}
if (uses_chromecast && chromecast != null)
{
if (app_name != null)
{
log ("adding category for Chromecast");
selectorBuilder.addControlCategory (chromecast.categoryForCast (app_name));
}
else
log ("won't add category for Chromecast, since app_name is null");
}
}
else
log ("** selectorBuilder is null!");
}
public void selectDevice (MediaRouter router, RouteInfo info)
{
if (info != null)
{
String devinfo = info.getDescription();
if (devinfo != null && devinfo.contains ("MatchStick"))
plaster = matchstick;
else
plaster = chromecast;
if (plaster != null)
plaster.selectDevice (info);
}
}
public void stopApplication()
{
if (plaster != null)
plaster.stopApplication();
}
public void teardown()
{
if (plaster != null)
plaster.teardown();
listener.onTeardown();
plaster = null;
}
public void createClient (Context ctx, PlasterListener listener)
{
if (plaster != null)
plaster.createClient (ctx, listener);
}
public void sendMessage (String message)
{
if (plaster != null)
plaster.sendMessage (message);
}
}
| 3,363 | 0.710675 | 0.709188 | 131 | 24.67939 | 22.578537 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.40458 | false | false |
1
|
54af95d949032a94c49bdc0b24ee9be6a80480ee
| 9,388,798,529,608 |
3d5fc0dc4999fdce184f819fd41447028ae6f07a
|
/JavaFXSandbox/src/NodeStyleRotateDemo.java
|
19d4e4b09fa3ffc55269dae432f637b5e8138003
|
[] |
no_license
|
Mirzok/CIS260-265_Java
|
https://github.com/Mirzok/CIS260-265_Java
|
60769dfbd413eb84f394ccc1aeeb6f015150a092
|
88d446feba0fc5945b34bad2ffaf474e81fbaf7e
|
refs/heads/master
| 2020-03-06T08:35:21.325000 | 2015-07-09T06:17:41 | 2015-07-09T06:17:41 | 38,801,512 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import javafx.application.Application;
public class NodeStyleRotateDemo {
}
|
UTF-8
|
Java
| 78 |
java
|
NodeStyleRotateDemo.java
|
Java
|
[] | null |
[] |
import javafx.application.Application;
public class NodeStyleRotateDemo {
}
| 78 | 0.820513 | 0.820513 | 4 | 18.5 | 17.557051 | 38 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false |
1
|
ab31d4453389acc82398384c6f6b4214f912cbd4
| 30,803,505,478,417 |
cd19a2dafed007a9305f2b1f9aaa5148eceb186f
|
/src/main/java/br/edu/utfpr/pr/model/Produtora.java
|
d87468d507ff75e85be5ceac11366270fc0f0524
|
[] |
no_license
|
GustavoZaffani/AtividadeJavaRevisao
|
https://github.com/GustavoZaffani/AtividadeJavaRevisao
|
3f3ab12ccde4967f45c8841b3202d9b871806542
|
a244c2e03b97f6e4017c1adb7d5f39b47bd06aca
|
refs/heads/master
| 2020-05-17T03:46:00.056000 | 2019-04-25T18:35:49 | 2019-04-25T18:35:49 | 183,490,028 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package br.edu.utfpr.pr.model;
import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDate;
@Entity
@Table(name = "produtora")
public class Produtora implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "nome")
private String nome;
@Column(name = "cnpj")
private String cnpj;
@Column(name = "endereco")
private String endereco;
@Column(name = "data_fundacao")
private LocalDate dataFundacao;
}
|
UTF-8
|
Java
| 531 |
java
|
Produtora.java
|
Java
|
[] | null |
[] |
package br.edu.utfpr.pr.model;
import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDate;
@Entity
@Table(name = "produtora")
public class Produtora implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "nome")
private String nome;
@Column(name = "cnpj")
private String cnpj;
@Column(name = "endereco")
private String endereco;
@Column(name = "data_fundacao")
private LocalDate dataFundacao;
}
| 531 | 0.694915 | 0.694915 | 27 | 18.666666 | 15.958279 | 55 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false |
1
|
0aa58052489a199113e89efdd1f7cfd61ad9266a
| 3,882,650,463,834 |
b7903075d5a2906d922d9a2abc73c41477a708df
|
/Java/isPermutationOfTwoStrings.java
|
e2b9cd7a0d798683d6c46060734ef1139f97d556
|
[] |
no_license
|
zhanglizeyi/LeetsP
|
https://github.com/zhanglizeyi/LeetsP
|
43f3796f71a2cb08931fa470dd40b9685a89cc49
|
3d7911fb5f4e93b6934c9416f2b15cec5c44b73e
|
refs/heads/master
| 2021-01-10T01:44:56.471000 | 2019-02-19T02:47:32 | 2019-02-19T02:47:32 | 46,373,097 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.util.*;
/*
time complexity: O(n log n)
space complexity: O(n)
*/
public class isPermutationOfTwoStrings{
public static boolean isPermutation(String s1, String s2){
if(s1.length() != s2.length()) return false;
Map<Character, Integer> m1 = new LinkedHashMap<>();
Map<Character, Integer> m2 = new LinkedHashMap<>();
for(int i=0; i<s1.length(); i++){
m1.put(s1.charAt(i), i);
m2.put(s2.charAt(i), i);
}
if(m1.size() != m2.size()) return false;
for(Map.Entry<Character, Integer> entry : m1.entrySet()){
if(m2.containsKey(entry.getKey())){
if(entry.getValue() != m2.get(entry.getKey()))
return false;
}
}
return true;
}
public static void main(String[] args){
String s1 = "asdklfjl";
String s2 = "asdkljflk";
System.out.println(isPermutation(s1, s2));
String s3 = "abcde";
String s4 = "abcde";
System.out.println(isPermutation(s3, s4));
}
}
|
UTF-8
|
Java
| 929 |
java
|
isPermutationOfTwoStrings.java
|
Java
|
[] | null |
[] |
import java.util.*;
/*
time complexity: O(n log n)
space complexity: O(n)
*/
public class isPermutationOfTwoStrings{
public static boolean isPermutation(String s1, String s2){
if(s1.length() != s2.length()) return false;
Map<Character, Integer> m1 = new LinkedHashMap<>();
Map<Character, Integer> m2 = new LinkedHashMap<>();
for(int i=0; i<s1.length(); i++){
m1.put(s1.charAt(i), i);
m2.put(s2.charAt(i), i);
}
if(m1.size() != m2.size()) return false;
for(Map.Entry<Character, Integer> entry : m1.entrySet()){
if(m2.containsKey(entry.getKey())){
if(entry.getValue() != m2.get(entry.getKey()))
return false;
}
}
return true;
}
public static void main(String[] args){
String s1 = "asdklfjl";
String s2 = "asdkljflk";
System.out.println(isPermutation(s1, s2));
String s3 = "abcde";
String s4 = "abcde";
System.out.println(isPermutation(s3, s4));
}
}
| 929 | 0.630786 | 0.603875 | 50 | 17.6 | 19.560163 | 59 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.8 | false | false |
1
|
7990d2e0b879faf1a53620ccccc5a6b5e896d3aa
| 29,746,943,527,559 |
64dcd1889d88c75637ad44b1d15e9ebc18a86622
|
/src/com/chenchong/utils/NetworkUtils.java
|
8d262b962bd52cc9425ca1f89455f58ae08c9d9a
|
[] |
no_license
|
b2b2244424/mySortListview
|
https://github.com/b2b2244424/mySortListview
|
0b05da64f24aac66bc746b5466816c5c117d899b
|
d919ace13df3de72b57dc83af0535282b297fb38
|
refs/heads/master
| 2020-12-25T08:37:44.952000 | 2015-09-08T10:44:44 | 2015-09-08T10:44:44 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.chenchong.utils;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.util.Log;
import android.widget.Toast;
import com.android.volley.AuthFailureError;
import com.android.volley.NetworkResponse;
import com.android.volley.ParseError;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.Response.ErrorListener;
import com.android.volley.Response.Listener;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.HttpHeaderParser;
import com.android.volley.toolbox.JsonObjectRequest;
import com.android.volley.toolbox.Volley;
public class NetworkUtils {
public static enum netType {
wifi, CMNET, CMWAP, noneNet
}
/**
* 网络是否可用
*
* @param context
* @return
*/
public static boolean isNetworkAvailable(Context context) {
ConnectivityManager mgr = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo[] info = mgr.getAllNetworkInfo();
if (info != null) {
for (int i = 0; i < info.length; i++) {
if (info[i].getState() == NetworkInfo.State.CONNECTED) {
return true;
}
}
}
return false;
}
/**
* 判断是否有网络连接
*
* @param context
* @return
*/
public static boolean isNetworkConnected(Context context) {
if (context != null) {
ConnectivityManager mConnectivityManager = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo mNetworkInfo = mConnectivityManager
.getActiveNetworkInfo();
if (mNetworkInfo != null) {
return mNetworkInfo.isAvailable();
}
}
return false;
}
/**
* 判断WIFI网络是否可用
*
* @param context
* @return
*/
public static boolean isWifiConnected(Context context) {
if (context != null) {
ConnectivityManager mConnectivityManager = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo mWiFiNetworkInfo = mConnectivityManager
.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
if (mWiFiNetworkInfo != null) {
return mWiFiNetworkInfo.isAvailable();
}
}
return false;
}
/**
* 判断MOBILE网络是否可用
*
* @param context
* @return
*/
public static boolean isMobileConnected(Context context) {
if (context != null) {
ConnectivityManager mConnectivityManager = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo mMobileNetworkInfo = mConnectivityManager
.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
if (mMobileNetworkInfo != null) {
return mMobileNetworkInfo.isAvailable();
}
}
return false;
}
/**
* 获取当前网络连接的类型信息
*
* @param context
* @return
*/
public static int getConnectedType(Context context) {
if (context != null) {
ConnectivityManager mConnectivityManager = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo mNetworkInfo = mConnectivityManager
.getActiveNetworkInfo();
if (mNetworkInfo != null && mNetworkInfo.isAvailable()) {
return mNetworkInfo.getType();
}
}
return -1;
}
/**
* 获取当前的网络状态 -1:没有网络 1:WIFI网络 2:wap网络 3:net网络
*
* @param context
*
* @return
*/
public static netType getAPNType(Context context) {
ConnectivityManager connMgr = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = connMgr.getActiveNetworkInfo();
if (networkInfo == null) {
return netType.noneNet;
}
int nType = networkInfo.getType();
if (nType == ConnectivityManager.TYPE_MOBILE) {
if (networkInfo.getExtraInfo().toLowerCase().equals("cmnet")) {
return netType.CMNET;
} else {
return netType.CMWAP;
}
} else if (nType == ConnectivityManager.TYPE_WIFI) {
return netType.wifi;
}
return netType.noneNet;
}
/**
*
* 类名NormalPostRequest 实现的主要功能:封装的普通的带参数的post请求 创建日期2015-8-12 创建人 chenchong <br/>
* 联系QQ:695933593
*/
public static class NormalPostRequest extends Request<JSONObject> {
private Map<String, String> mMap;
private Listener<JSONObject> mListener;
public NormalPostRequest(String url, Listener<JSONObject> listener,
ErrorListener errorListener, Map<String, String> map) {
super(Request.Method.POST, url, errorListener);
mListener = listener;
mMap = map;
}
// mMap是已经按照前面的方式,设置了参数的实例
@Override
protected Map<String, String> getParams() throws AuthFailureError {
return mMap;
}
// 此处因为response返回值需要json数据,和JsonObjectRequest类一样即可
@Override
protected Response<JSONObject> parseNetworkResponse(
NetworkResponse response) {
try {
String jsonString = new String(response.data,
HttpHeaderParser.parseCharset(response.headers));
return Response.success(new JSONObject(jsonString),
HttpHeaderParser.parseCacheHeaders(response));
} catch (UnsupportedEncodingException e) {
return Response.error(new ParseError(e));
} catch (JSONException je) {
return Response.error(new ParseError(je));
}
}
@Override
protected void deliverResponse(JSONObject response) {
mListener.onResponse(response);
}
}
/**
* 类名UnNormalPostRequest 实现的主要功能。 创建日期2015-9-6 创建人 chenchong <br/>
* 联系QQ:695933593
*/
public static class UnNormalPostRequest extends Request<JSONObject> {
private Listener<JSONObject> mListener;
public UnNormalPostRequest(String url, Listener<JSONObject> listener,
ErrorListener errorListener) {
super(Request.Method.POST, url, errorListener);
mListener = listener;
}
// 此处因为response返回值需要json数据,和JsonObjectRequest类一样即可
@Override
protected Response<JSONObject> parseNetworkResponse(
NetworkResponse response) {
try {
String jsonString = new String(response.data,
HttpHeaderParser.parseCharset(response.headers));
return Response.success(new JSONObject(jsonString),
HttpHeaderParser.parseCacheHeaders(response));
} catch (UnsupportedEncodingException e) {
return Response.error(new ParseError(e));
} catch (JSONException je) {
return Response.error(new ParseError(je));
}
}
@Override
protected void deliverResponse(JSONObject response) {
mListener.onResponse(response);
}
}
/**
* 类名NormalGetRequest 实现的主要功能:普通的get请求 创建日期2015-8-12 创建人 chenchong <br/>
* 联系QQ:695933593
*/
public static class NormalGetRequest extends Request<JSONObject> {
private Listener<JSONObject> mListener;
public NormalGetRequest(String url, Listener<JSONObject> listener,
ErrorListener errorListener) {
super(Request.Method.GET, url, errorListener);
mListener = listener;
}
// 此处因为response返回值需要json数据,和JsonObjectRequest类一样即可
@Override
protected Response<JSONObject> parseNetworkResponse(
NetworkResponse response) {
Log.i("CC", "===response===" + response.toString());
try {
String jsonString = new String(response.data,
HttpHeaderParser.parseCharset(response.headers));
return Response.success(new JSONObject(jsonString),
HttpHeaderParser.parseCacheHeaders(response));
} catch (UnsupportedEncodingException e) {
return Response.error(new ParseError(e));
} catch (JSONException je) {
return Response.error(new ParseError(je));
}
}
@Override
protected void deliverResponse(JSONObject response) {
mListener.onResponse(response);
}
}
/**
* 方法的一句话概述:傻瓜式封装,只用来获取无参数的post请求的json
* <p>方法详述(简单方法可不必详述)</p>
* @param s 说明参数含义
* @return 说明返回值含义
* @throws IOException 说明发生此异常的条件
* @throws NullPointerException 说明发生此异常的条件
*/
public static JSONObject getJSONObject(String url,final VolleyJsonCallback callback, final Context ctx) {
RequestQueue requestQueue = Volley.newRequestQueue(ctx);
Request<JSONObject> request = new NetworkUtils.UnNormalPostRequest(url, new Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
callback.onSuccess(response);
}
}, new ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(ctx, "获取数据失败", Toast.LENGTH_LONG).show();
}
});
requestQueue.add(request);
return null;
}
// 以下是在同一个类中定义的接口
public interface VolleyJsonCallback {
void onSuccess(JSONObject result);
}
}
|
UTF-8
|
Java
| 9,395 |
java
|
NetworkUtils.java
|
Java
|
[
{
"context": "Request 实现的主要功能:封装的普通的带参数的post请求 创建日期2015-8-12 创建人 chenchong <br/>\r\n\t * 联系QQ:695933593\r\n\t */\r\n\tpublic static c",
"end": 4362,
"score": 0.9054669737815857,
"start": 4353,
"tag": "USERNAME",
"value": "chenchong"
},
{
"context": " * 类名UnNormalPostRequest 实现的主要功能。 创建日期2015-9-6 创建人 chenchong <br/>\r\n\t * 联系QQ:695933593\r\n\t */\r\n\tpublic static c",
"end": 5676,
"score": 0.8773627877235413,
"start": 5667,
"tag": "USERNAME",
"value": "chenchong"
},
{
"context": "ormalGetRequest 实现的主要功能:普通的get请求 创建日期2015-8-12 创建人 chenchong <br/>\r\n\t * 联系QQ:695933593\r\n\t */\r\n\tpublic static c",
"end": 6784,
"score": 0.6729119420051575,
"start": 6775,
"tag": "USERNAME",
"value": "chenchong"
}
] | null |
[] |
package com.chenchong.utils;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.util.Log;
import android.widget.Toast;
import com.android.volley.AuthFailureError;
import com.android.volley.NetworkResponse;
import com.android.volley.ParseError;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.Response.ErrorListener;
import com.android.volley.Response.Listener;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.HttpHeaderParser;
import com.android.volley.toolbox.JsonObjectRequest;
import com.android.volley.toolbox.Volley;
public class NetworkUtils {
public static enum netType {
wifi, CMNET, CMWAP, noneNet
}
/**
* 网络是否可用
*
* @param context
* @return
*/
public static boolean isNetworkAvailable(Context context) {
ConnectivityManager mgr = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo[] info = mgr.getAllNetworkInfo();
if (info != null) {
for (int i = 0; i < info.length; i++) {
if (info[i].getState() == NetworkInfo.State.CONNECTED) {
return true;
}
}
}
return false;
}
/**
* 判断是否有网络连接
*
* @param context
* @return
*/
public static boolean isNetworkConnected(Context context) {
if (context != null) {
ConnectivityManager mConnectivityManager = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo mNetworkInfo = mConnectivityManager
.getActiveNetworkInfo();
if (mNetworkInfo != null) {
return mNetworkInfo.isAvailable();
}
}
return false;
}
/**
* 判断WIFI网络是否可用
*
* @param context
* @return
*/
public static boolean isWifiConnected(Context context) {
if (context != null) {
ConnectivityManager mConnectivityManager = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo mWiFiNetworkInfo = mConnectivityManager
.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
if (mWiFiNetworkInfo != null) {
return mWiFiNetworkInfo.isAvailable();
}
}
return false;
}
/**
* 判断MOBILE网络是否可用
*
* @param context
* @return
*/
public static boolean isMobileConnected(Context context) {
if (context != null) {
ConnectivityManager mConnectivityManager = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo mMobileNetworkInfo = mConnectivityManager
.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
if (mMobileNetworkInfo != null) {
return mMobileNetworkInfo.isAvailable();
}
}
return false;
}
/**
* 获取当前网络连接的类型信息
*
* @param context
* @return
*/
public static int getConnectedType(Context context) {
if (context != null) {
ConnectivityManager mConnectivityManager = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo mNetworkInfo = mConnectivityManager
.getActiveNetworkInfo();
if (mNetworkInfo != null && mNetworkInfo.isAvailable()) {
return mNetworkInfo.getType();
}
}
return -1;
}
/**
* 获取当前的网络状态 -1:没有网络 1:WIFI网络 2:wap网络 3:net网络
*
* @param context
*
* @return
*/
public static netType getAPNType(Context context) {
ConnectivityManager connMgr = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = connMgr.getActiveNetworkInfo();
if (networkInfo == null) {
return netType.noneNet;
}
int nType = networkInfo.getType();
if (nType == ConnectivityManager.TYPE_MOBILE) {
if (networkInfo.getExtraInfo().toLowerCase().equals("cmnet")) {
return netType.CMNET;
} else {
return netType.CMWAP;
}
} else if (nType == ConnectivityManager.TYPE_WIFI) {
return netType.wifi;
}
return netType.noneNet;
}
/**
*
* 类名NormalPostRequest 实现的主要功能:封装的普通的带参数的post请求 创建日期2015-8-12 创建人 chenchong <br/>
* 联系QQ:695933593
*/
public static class NormalPostRequest extends Request<JSONObject> {
private Map<String, String> mMap;
private Listener<JSONObject> mListener;
public NormalPostRequest(String url, Listener<JSONObject> listener,
ErrorListener errorListener, Map<String, String> map) {
super(Request.Method.POST, url, errorListener);
mListener = listener;
mMap = map;
}
// mMap是已经按照前面的方式,设置了参数的实例
@Override
protected Map<String, String> getParams() throws AuthFailureError {
return mMap;
}
// 此处因为response返回值需要json数据,和JsonObjectRequest类一样即可
@Override
protected Response<JSONObject> parseNetworkResponse(
NetworkResponse response) {
try {
String jsonString = new String(response.data,
HttpHeaderParser.parseCharset(response.headers));
return Response.success(new JSONObject(jsonString),
HttpHeaderParser.parseCacheHeaders(response));
} catch (UnsupportedEncodingException e) {
return Response.error(new ParseError(e));
} catch (JSONException je) {
return Response.error(new ParseError(je));
}
}
@Override
protected void deliverResponse(JSONObject response) {
mListener.onResponse(response);
}
}
/**
* 类名UnNormalPostRequest 实现的主要功能。 创建日期2015-9-6 创建人 chenchong <br/>
* 联系QQ:695933593
*/
public static class UnNormalPostRequest extends Request<JSONObject> {
private Listener<JSONObject> mListener;
public UnNormalPostRequest(String url, Listener<JSONObject> listener,
ErrorListener errorListener) {
super(Request.Method.POST, url, errorListener);
mListener = listener;
}
// 此处因为response返回值需要json数据,和JsonObjectRequest类一样即可
@Override
protected Response<JSONObject> parseNetworkResponse(
NetworkResponse response) {
try {
String jsonString = new String(response.data,
HttpHeaderParser.parseCharset(response.headers));
return Response.success(new JSONObject(jsonString),
HttpHeaderParser.parseCacheHeaders(response));
} catch (UnsupportedEncodingException e) {
return Response.error(new ParseError(e));
} catch (JSONException je) {
return Response.error(new ParseError(je));
}
}
@Override
protected void deliverResponse(JSONObject response) {
mListener.onResponse(response);
}
}
/**
* 类名NormalGetRequest 实现的主要功能:普通的get请求 创建日期2015-8-12 创建人 chenchong <br/>
* 联系QQ:695933593
*/
public static class NormalGetRequest extends Request<JSONObject> {
private Listener<JSONObject> mListener;
public NormalGetRequest(String url, Listener<JSONObject> listener,
ErrorListener errorListener) {
super(Request.Method.GET, url, errorListener);
mListener = listener;
}
// 此处因为response返回值需要json数据,和JsonObjectRequest类一样即可
@Override
protected Response<JSONObject> parseNetworkResponse(
NetworkResponse response) {
Log.i("CC", "===response===" + response.toString());
try {
String jsonString = new String(response.data,
HttpHeaderParser.parseCharset(response.headers));
return Response.success(new JSONObject(jsonString),
HttpHeaderParser.parseCacheHeaders(response));
} catch (UnsupportedEncodingException e) {
return Response.error(new ParseError(e));
} catch (JSONException je) {
return Response.error(new ParseError(je));
}
}
@Override
protected void deliverResponse(JSONObject response) {
mListener.onResponse(response);
}
}
/**
* 方法的一句话概述:傻瓜式封装,只用来获取无参数的post请求的json
* <p>方法详述(简单方法可不必详述)</p>
* @param s 说明参数含义
* @return 说明返回值含义
* @throws IOException 说明发生此异常的条件
* @throws NullPointerException 说明发生此异常的条件
*/
public static JSONObject getJSONObject(String url,final VolleyJsonCallback callback, final Context ctx) {
RequestQueue requestQueue = Volley.newRequestQueue(ctx);
Request<JSONObject> request = new NetworkUtils.UnNormalPostRequest(url, new Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
callback.onSuccess(response);
}
}, new ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(ctx, "获取数据失败", Toast.LENGTH_LONG).show();
}
});
requestQueue.add(request);
return null;
}
// 以下是在同一个类中定义的接口
public interface VolleyJsonCallback {
void onSuccess(JSONObject result);
}
}
| 9,395 | 0.705521 | 0.699488 | 309 | 26.43042 | 23.015385 | 106 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.294498 | false | false |
1
|
474f0004930262efccf46b6a6849a653d30ddc7a
| 2,276,332,701,503 |
97a979d6319ffc735b1044000087e2caaf35cecc
|
/src/main/java/com/ldp/ssm/bean/VisitExample.java
|
a60bf573259568e67382b92a00fe3ebfbaeb0e02
|
[] |
no_license
|
ldp971018/ssm_crm
|
https://github.com/ldp971018/ssm_crm
|
eb0644c96fc94c678f211d372979235ae53267b2
|
400a55aae259225b0f5a55dc9c1d45c2308011cd
|
refs/heads/master
| 2020-05-25T11:21:39.873000 | 2019-05-21T06:49:41 | 2019-05-21T06:49:41 | 187,778,549 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.ldp.ssm.bean;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class VisitExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public VisitExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Integer value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Integer value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Integer value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Integer value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Integer value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Integer value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Integer> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Integer> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Integer value1, Integer value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Integer value1, Integer value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andVisitTimeIsNull() {
addCriterion("visit_time is null");
return (Criteria) this;
}
public Criteria andVisitTimeIsNotNull() {
addCriterion("visit_time is not null");
return (Criteria) this;
}
public Criteria andVisitTimeEqualTo(Date value) {
addCriterion("visit_time =", value, "visitTime");
return (Criteria) this;
}
public Criteria andVisitTimeNotEqualTo(Date value) {
addCriterion("visit_time <>", value, "visitTime");
return (Criteria) this;
}
public Criteria andVisitTimeGreaterThan(Date value) {
addCriterion("visit_time >", value, "visitTime");
return (Criteria) this;
}
public Criteria andVisitTimeGreaterThanOrEqualTo(Date value) {
addCriterion("visit_time >=", value, "visitTime");
return (Criteria) this;
}
public Criteria andVisitTimeLessThan(Date value) {
addCriterion("visit_time <", value, "visitTime");
return (Criteria) this;
}
public Criteria andVisitTimeLessThanOrEqualTo(Date value) {
addCriterion("visit_time <=", value, "visitTime");
return (Criteria) this;
}
public Criteria andVisitTimeIn(List<Date> values) {
addCriterion("visit_time in", values, "visitTime");
return (Criteria) this;
}
public Criteria andVisitTimeNotIn(List<Date> values) {
addCriterion("visit_time not in", values, "visitTime");
return (Criteria) this;
}
public Criteria andVisitTimeBetween(Date value1, Date value2) {
addCriterion("visit_time between", value1, value2, "visitTime");
return (Criteria) this;
}
public Criteria andVisitTimeNotBetween(Date value1, Date value2) {
addCriterion("visit_time not between", value1, value2, "visitTime");
return (Criteria) this;
}
public Criteria andVisitAddrIsNull() {
addCriterion("visit_addr is null");
return (Criteria) this;
}
public Criteria andVisitAddrIsNotNull() {
addCriterion("visit_addr is not null");
return (Criteria) this;
}
public Criteria andVisitAddrEqualTo(String value) {
addCriterion("visit_addr =", value, "visitAddr");
return (Criteria) this;
}
public Criteria andVisitAddrNotEqualTo(String value) {
addCriterion("visit_addr <>", value, "visitAddr");
return (Criteria) this;
}
public Criteria andVisitAddrGreaterThan(String value) {
addCriterion("visit_addr >", value, "visitAddr");
return (Criteria) this;
}
public Criteria andVisitAddrGreaterThanOrEqualTo(String value) {
addCriterion("visit_addr >=", value, "visitAddr");
return (Criteria) this;
}
public Criteria andVisitAddrLessThan(String value) {
addCriterion("visit_addr <", value, "visitAddr");
return (Criteria) this;
}
public Criteria andVisitAddrLessThanOrEqualTo(String value) {
addCriterion("visit_addr <=", value, "visitAddr");
return (Criteria) this;
}
public Criteria andVisitAddrLike(String value) {
addCriterion("visit_addr like", value, "visitAddr");
return (Criteria) this;
}
public Criteria andVisitAddrNotLike(String value) {
addCriterion("visit_addr not like", value, "visitAddr");
return (Criteria) this;
}
public Criteria andVisitAddrIn(List<String> values) {
addCriterion("visit_addr in", values, "visitAddr");
return (Criteria) this;
}
public Criteria andVisitAddrNotIn(List<String> values) {
addCriterion("visit_addr not in", values, "visitAddr");
return (Criteria) this;
}
public Criteria andVisitAddrBetween(String value1, String value2) {
addCriterion("visit_addr between", value1, value2, "visitAddr");
return (Criteria) this;
}
public Criteria andVisitAddrNotBetween(String value1, String value2) {
addCriterion("visit_addr not between", value1, value2, "visitAddr");
return (Criteria) this;
}
public Criteria andVisitDetailIsNull() {
addCriterion("visit_detail is null");
return (Criteria) this;
}
public Criteria andVisitDetailIsNotNull() {
addCriterion("visit_detail is not null");
return (Criteria) this;
}
public Criteria andVisitDetailEqualTo(String value) {
addCriterion("visit_detail =", value, "visitDetail");
return (Criteria) this;
}
public Criteria andVisitDetailNotEqualTo(String value) {
addCriterion("visit_detail <>", value, "visitDetail");
return (Criteria) this;
}
public Criteria andVisitDetailGreaterThan(String value) {
addCriterion("visit_detail >", value, "visitDetail");
return (Criteria) this;
}
public Criteria andVisitDetailGreaterThanOrEqualTo(String value) {
addCriterion("visit_detail >=", value, "visitDetail");
return (Criteria) this;
}
public Criteria andVisitDetailLessThan(String value) {
addCriterion("visit_detail <", value, "visitDetail");
return (Criteria) this;
}
public Criteria andVisitDetailLessThanOrEqualTo(String value) {
addCriterion("visit_detail <=", value, "visitDetail");
return (Criteria) this;
}
public Criteria andVisitDetailLike(String value) {
addCriterion("visit_detail like", value, "visitDetail");
return (Criteria) this;
}
public Criteria andVisitDetailNotLike(String value) {
addCriterion("visit_detail not like", value, "visitDetail");
return (Criteria) this;
}
public Criteria andVisitDetailIn(List<String> values) {
addCriterion("visit_detail in", values, "visitDetail");
return (Criteria) this;
}
public Criteria andVisitDetailNotIn(List<String> values) {
addCriterion("visit_detail not in", values, "visitDetail");
return (Criteria) this;
}
public Criteria andVisitDetailBetween(String value1, String value2) {
addCriterion("visit_detail between", value1, value2, "visitDetail");
return (Criteria) this;
}
public Criteria andVisitDetailNotBetween(String value1, String value2) {
addCriterion("visit_detail not between", value1, value2, "visitDetail");
return (Criteria) this;
}
public Criteria andVisitNexttimeIsNull() {
addCriterion("visit_nexttime is null");
return (Criteria) this;
}
public Criteria andVisitNexttimeIsNotNull() {
addCriterion("visit_nexttime is not null");
return (Criteria) this;
}
public Criteria andVisitNexttimeEqualTo(Date value) {
addCriterion("visit_nexttime =", value, "visitNexttime");
return (Criteria) this;
}
public Criteria andVisitNexttimeNotEqualTo(Date value) {
addCriterion("visit_nexttime <>", value, "visitNexttime");
return (Criteria) this;
}
public Criteria andVisitNexttimeGreaterThan(Date value) {
addCriterion("visit_nexttime >", value, "visitNexttime");
return (Criteria) this;
}
public Criteria andVisitNexttimeGreaterThanOrEqualTo(Date value) {
addCriterion("visit_nexttime >=", value, "visitNexttime");
return (Criteria) this;
}
public Criteria andVisitNexttimeLessThan(Date value) {
addCriterion("visit_nexttime <", value, "visitNexttime");
return (Criteria) this;
}
public Criteria andVisitNexttimeLessThanOrEqualTo(Date value) {
addCriterion("visit_nexttime <=", value, "visitNexttime");
return (Criteria) this;
}
public Criteria andVisitNexttimeIn(List<Date> values) {
addCriterion("visit_nexttime in", values, "visitNexttime");
return (Criteria) this;
}
public Criteria andVisitNexttimeNotIn(List<Date> values) {
addCriterion("visit_nexttime not in", values, "visitNexttime");
return (Criteria) this;
}
public Criteria andVisitNexttimeBetween(Date value1, Date value2) {
addCriterion("visit_nexttime between", value1, value2, "visitNexttime");
return (Criteria) this;
}
public Criteria andVisitNexttimeNotBetween(Date value1, Date value2) {
addCriterion("visit_nexttime not between", value1, value2, "visitNexttime");
return (Criteria) this;
}
public Criteria andVisitAdminIdIsNull() {
addCriterion("visit_admin_id is null");
return (Criteria) this;
}
public Criteria andVisitAdminIdIsNotNull() {
addCriterion("visit_admin_id is not null");
return (Criteria) this;
}
public Criteria andVisitAdminIdEqualTo(Integer value) {
addCriterion("visit_admin_id =", value, "visitAdminId");
return (Criteria) this;
}
public Criteria andVisitAdminIdNotEqualTo(Integer value) {
addCriterion("visit_admin_id <>", value, "visitAdminId");
return (Criteria) this;
}
public Criteria andVisitAdminIdGreaterThan(Integer value) {
addCriterion("visit_admin_id >", value, "visitAdminId");
return (Criteria) this;
}
public Criteria andVisitAdminIdGreaterThanOrEqualTo(Integer value) {
addCriterion("visit_admin_id >=", value, "visitAdminId");
return (Criteria) this;
}
public Criteria andVisitAdminIdLessThan(Integer value) {
addCriterion("visit_admin_id <", value, "visitAdminId");
return (Criteria) this;
}
public Criteria andVisitAdminIdLessThanOrEqualTo(Integer value) {
addCriterion("visit_admin_id <=", value, "visitAdminId");
return (Criteria) this;
}
public Criteria andVisitAdminIdIn(List<Integer> values) {
addCriterion("visit_admin_id in", values, "visitAdminId");
return (Criteria) this;
}
public Criteria andVisitAdminIdNotIn(List<Integer> values) {
addCriterion("visit_admin_id not in", values, "visitAdminId");
return (Criteria) this;
}
public Criteria andVisitAdminIdBetween(Integer value1, Integer value2) {
addCriterion("visit_admin_id between", value1, value2, "visitAdminId");
return (Criteria) this;
}
public Criteria andVisitAdminIdNotBetween(Integer value1, Integer value2) {
addCriterion("visit_admin_id not between", value1, value2, "visitAdminId");
return (Criteria) this;
}
public Criteria andVisitEmployeeIdIsNull() {
addCriterion("visit_employee_id is null");
return (Criteria) this;
}
public Criteria andVisitEmployeeIdIsNotNull() {
addCriterion("visit_employee_id is not null");
return (Criteria) this;
}
public Criteria andVisitEmployeeIdEqualTo(Integer value) {
addCriterion("visit_employee_id =", value, "visitEmployeeId");
return (Criteria) this;
}
public Criteria andVisitEmployeeIdNotEqualTo(Integer value) {
addCriterion("visit_employee_id <>", value, "visitEmployeeId");
return (Criteria) this;
}
public Criteria andVisitEmployeeIdGreaterThan(Integer value) {
addCriterion("visit_employee_id >", value, "visitEmployeeId");
return (Criteria) this;
}
public Criteria andVisitEmployeeIdGreaterThanOrEqualTo(Integer value) {
addCriterion("visit_employee_id >=", value, "visitEmployeeId");
return (Criteria) this;
}
public Criteria andVisitEmployeeIdLessThan(Integer value) {
addCriterion("visit_employee_id <", value, "visitEmployeeId");
return (Criteria) this;
}
public Criteria andVisitEmployeeIdLessThanOrEqualTo(Integer value) {
addCriterion("visit_employee_id <=", value, "visitEmployeeId");
return (Criteria) this;
}
public Criteria andVisitEmployeeIdIn(List<Integer> values) {
addCriterion("visit_employee_id in", values, "visitEmployeeId");
return (Criteria) this;
}
public Criteria andVisitEmployeeIdNotIn(List<Integer> values) {
addCriterion("visit_employee_id not in", values, "visitEmployeeId");
return (Criteria) this;
}
public Criteria andVisitEmployeeIdBetween(Integer value1, Integer value2) {
addCriterion("visit_employee_id between", value1, value2, "visitEmployeeId");
return (Criteria) this;
}
public Criteria andVisitEmployeeIdNotBetween(Integer value1, Integer value2) {
addCriterion("visit_employee_id not between", value1, value2, "visitEmployeeId");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}
|
UTF-8
|
Java
| 21,413 |
java
|
VisitExample.java
|
Java
|
[] | null |
[] |
package com.ldp.ssm.bean;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class VisitExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public VisitExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Integer value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Integer value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Integer value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Integer value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Integer value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Integer value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Integer> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Integer> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Integer value1, Integer value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Integer value1, Integer value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andVisitTimeIsNull() {
addCriterion("visit_time is null");
return (Criteria) this;
}
public Criteria andVisitTimeIsNotNull() {
addCriterion("visit_time is not null");
return (Criteria) this;
}
public Criteria andVisitTimeEqualTo(Date value) {
addCriterion("visit_time =", value, "visitTime");
return (Criteria) this;
}
public Criteria andVisitTimeNotEqualTo(Date value) {
addCriterion("visit_time <>", value, "visitTime");
return (Criteria) this;
}
public Criteria andVisitTimeGreaterThan(Date value) {
addCriterion("visit_time >", value, "visitTime");
return (Criteria) this;
}
public Criteria andVisitTimeGreaterThanOrEqualTo(Date value) {
addCriterion("visit_time >=", value, "visitTime");
return (Criteria) this;
}
public Criteria andVisitTimeLessThan(Date value) {
addCriterion("visit_time <", value, "visitTime");
return (Criteria) this;
}
public Criteria andVisitTimeLessThanOrEqualTo(Date value) {
addCriterion("visit_time <=", value, "visitTime");
return (Criteria) this;
}
public Criteria andVisitTimeIn(List<Date> values) {
addCriterion("visit_time in", values, "visitTime");
return (Criteria) this;
}
public Criteria andVisitTimeNotIn(List<Date> values) {
addCriterion("visit_time not in", values, "visitTime");
return (Criteria) this;
}
public Criteria andVisitTimeBetween(Date value1, Date value2) {
addCriterion("visit_time between", value1, value2, "visitTime");
return (Criteria) this;
}
public Criteria andVisitTimeNotBetween(Date value1, Date value2) {
addCriterion("visit_time not between", value1, value2, "visitTime");
return (Criteria) this;
}
public Criteria andVisitAddrIsNull() {
addCriterion("visit_addr is null");
return (Criteria) this;
}
public Criteria andVisitAddrIsNotNull() {
addCriterion("visit_addr is not null");
return (Criteria) this;
}
public Criteria andVisitAddrEqualTo(String value) {
addCriterion("visit_addr =", value, "visitAddr");
return (Criteria) this;
}
public Criteria andVisitAddrNotEqualTo(String value) {
addCriterion("visit_addr <>", value, "visitAddr");
return (Criteria) this;
}
public Criteria andVisitAddrGreaterThan(String value) {
addCriterion("visit_addr >", value, "visitAddr");
return (Criteria) this;
}
public Criteria andVisitAddrGreaterThanOrEqualTo(String value) {
addCriterion("visit_addr >=", value, "visitAddr");
return (Criteria) this;
}
public Criteria andVisitAddrLessThan(String value) {
addCriterion("visit_addr <", value, "visitAddr");
return (Criteria) this;
}
public Criteria andVisitAddrLessThanOrEqualTo(String value) {
addCriterion("visit_addr <=", value, "visitAddr");
return (Criteria) this;
}
public Criteria andVisitAddrLike(String value) {
addCriterion("visit_addr like", value, "visitAddr");
return (Criteria) this;
}
public Criteria andVisitAddrNotLike(String value) {
addCriterion("visit_addr not like", value, "visitAddr");
return (Criteria) this;
}
public Criteria andVisitAddrIn(List<String> values) {
addCriterion("visit_addr in", values, "visitAddr");
return (Criteria) this;
}
public Criteria andVisitAddrNotIn(List<String> values) {
addCriterion("visit_addr not in", values, "visitAddr");
return (Criteria) this;
}
public Criteria andVisitAddrBetween(String value1, String value2) {
addCriterion("visit_addr between", value1, value2, "visitAddr");
return (Criteria) this;
}
public Criteria andVisitAddrNotBetween(String value1, String value2) {
addCriterion("visit_addr not between", value1, value2, "visitAddr");
return (Criteria) this;
}
public Criteria andVisitDetailIsNull() {
addCriterion("visit_detail is null");
return (Criteria) this;
}
public Criteria andVisitDetailIsNotNull() {
addCriterion("visit_detail is not null");
return (Criteria) this;
}
public Criteria andVisitDetailEqualTo(String value) {
addCriterion("visit_detail =", value, "visitDetail");
return (Criteria) this;
}
public Criteria andVisitDetailNotEqualTo(String value) {
addCriterion("visit_detail <>", value, "visitDetail");
return (Criteria) this;
}
public Criteria andVisitDetailGreaterThan(String value) {
addCriterion("visit_detail >", value, "visitDetail");
return (Criteria) this;
}
public Criteria andVisitDetailGreaterThanOrEqualTo(String value) {
addCriterion("visit_detail >=", value, "visitDetail");
return (Criteria) this;
}
public Criteria andVisitDetailLessThan(String value) {
addCriterion("visit_detail <", value, "visitDetail");
return (Criteria) this;
}
public Criteria andVisitDetailLessThanOrEqualTo(String value) {
addCriterion("visit_detail <=", value, "visitDetail");
return (Criteria) this;
}
public Criteria andVisitDetailLike(String value) {
addCriterion("visit_detail like", value, "visitDetail");
return (Criteria) this;
}
public Criteria andVisitDetailNotLike(String value) {
addCriterion("visit_detail not like", value, "visitDetail");
return (Criteria) this;
}
public Criteria andVisitDetailIn(List<String> values) {
addCriterion("visit_detail in", values, "visitDetail");
return (Criteria) this;
}
public Criteria andVisitDetailNotIn(List<String> values) {
addCriterion("visit_detail not in", values, "visitDetail");
return (Criteria) this;
}
public Criteria andVisitDetailBetween(String value1, String value2) {
addCriterion("visit_detail between", value1, value2, "visitDetail");
return (Criteria) this;
}
public Criteria andVisitDetailNotBetween(String value1, String value2) {
addCriterion("visit_detail not between", value1, value2, "visitDetail");
return (Criteria) this;
}
public Criteria andVisitNexttimeIsNull() {
addCriterion("visit_nexttime is null");
return (Criteria) this;
}
public Criteria andVisitNexttimeIsNotNull() {
addCriterion("visit_nexttime is not null");
return (Criteria) this;
}
public Criteria andVisitNexttimeEqualTo(Date value) {
addCriterion("visit_nexttime =", value, "visitNexttime");
return (Criteria) this;
}
public Criteria andVisitNexttimeNotEqualTo(Date value) {
addCriterion("visit_nexttime <>", value, "visitNexttime");
return (Criteria) this;
}
public Criteria andVisitNexttimeGreaterThan(Date value) {
addCriterion("visit_nexttime >", value, "visitNexttime");
return (Criteria) this;
}
public Criteria andVisitNexttimeGreaterThanOrEqualTo(Date value) {
addCriterion("visit_nexttime >=", value, "visitNexttime");
return (Criteria) this;
}
public Criteria andVisitNexttimeLessThan(Date value) {
addCriterion("visit_nexttime <", value, "visitNexttime");
return (Criteria) this;
}
public Criteria andVisitNexttimeLessThanOrEqualTo(Date value) {
addCriterion("visit_nexttime <=", value, "visitNexttime");
return (Criteria) this;
}
public Criteria andVisitNexttimeIn(List<Date> values) {
addCriterion("visit_nexttime in", values, "visitNexttime");
return (Criteria) this;
}
public Criteria andVisitNexttimeNotIn(List<Date> values) {
addCriterion("visit_nexttime not in", values, "visitNexttime");
return (Criteria) this;
}
public Criteria andVisitNexttimeBetween(Date value1, Date value2) {
addCriterion("visit_nexttime between", value1, value2, "visitNexttime");
return (Criteria) this;
}
public Criteria andVisitNexttimeNotBetween(Date value1, Date value2) {
addCriterion("visit_nexttime not between", value1, value2, "visitNexttime");
return (Criteria) this;
}
public Criteria andVisitAdminIdIsNull() {
addCriterion("visit_admin_id is null");
return (Criteria) this;
}
public Criteria andVisitAdminIdIsNotNull() {
addCriterion("visit_admin_id is not null");
return (Criteria) this;
}
public Criteria andVisitAdminIdEqualTo(Integer value) {
addCriterion("visit_admin_id =", value, "visitAdminId");
return (Criteria) this;
}
public Criteria andVisitAdminIdNotEqualTo(Integer value) {
addCriterion("visit_admin_id <>", value, "visitAdminId");
return (Criteria) this;
}
public Criteria andVisitAdminIdGreaterThan(Integer value) {
addCriterion("visit_admin_id >", value, "visitAdminId");
return (Criteria) this;
}
public Criteria andVisitAdminIdGreaterThanOrEqualTo(Integer value) {
addCriterion("visit_admin_id >=", value, "visitAdminId");
return (Criteria) this;
}
public Criteria andVisitAdminIdLessThan(Integer value) {
addCriterion("visit_admin_id <", value, "visitAdminId");
return (Criteria) this;
}
public Criteria andVisitAdminIdLessThanOrEqualTo(Integer value) {
addCriterion("visit_admin_id <=", value, "visitAdminId");
return (Criteria) this;
}
public Criteria andVisitAdminIdIn(List<Integer> values) {
addCriterion("visit_admin_id in", values, "visitAdminId");
return (Criteria) this;
}
public Criteria andVisitAdminIdNotIn(List<Integer> values) {
addCriterion("visit_admin_id not in", values, "visitAdminId");
return (Criteria) this;
}
public Criteria andVisitAdminIdBetween(Integer value1, Integer value2) {
addCriterion("visit_admin_id between", value1, value2, "visitAdminId");
return (Criteria) this;
}
public Criteria andVisitAdminIdNotBetween(Integer value1, Integer value2) {
addCriterion("visit_admin_id not between", value1, value2, "visitAdminId");
return (Criteria) this;
}
public Criteria andVisitEmployeeIdIsNull() {
addCriterion("visit_employee_id is null");
return (Criteria) this;
}
public Criteria andVisitEmployeeIdIsNotNull() {
addCriterion("visit_employee_id is not null");
return (Criteria) this;
}
public Criteria andVisitEmployeeIdEqualTo(Integer value) {
addCriterion("visit_employee_id =", value, "visitEmployeeId");
return (Criteria) this;
}
public Criteria andVisitEmployeeIdNotEqualTo(Integer value) {
addCriterion("visit_employee_id <>", value, "visitEmployeeId");
return (Criteria) this;
}
public Criteria andVisitEmployeeIdGreaterThan(Integer value) {
addCriterion("visit_employee_id >", value, "visitEmployeeId");
return (Criteria) this;
}
public Criteria andVisitEmployeeIdGreaterThanOrEqualTo(Integer value) {
addCriterion("visit_employee_id >=", value, "visitEmployeeId");
return (Criteria) this;
}
public Criteria andVisitEmployeeIdLessThan(Integer value) {
addCriterion("visit_employee_id <", value, "visitEmployeeId");
return (Criteria) this;
}
public Criteria andVisitEmployeeIdLessThanOrEqualTo(Integer value) {
addCriterion("visit_employee_id <=", value, "visitEmployeeId");
return (Criteria) this;
}
public Criteria andVisitEmployeeIdIn(List<Integer> values) {
addCriterion("visit_employee_id in", values, "visitEmployeeId");
return (Criteria) this;
}
public Criteria andVisitEmployeeIdNotIn(List<Integer> values) {
addCriterion("visit_employee_id not in", values, "visitEmployeeId");
return (Criteria) this;
}
public Criteria andVisitEmployeeIdBetween(Integer value1, Integer value2) {
addCriterion("visit_employee_id between", value1, value2, "visitEmployeeId");
return (Criteria) this;
}
public Criteria andVisitEmployeeIdNotBetween(Integer value1, Integer value2) {
addCriterion("visit_employee_id not between", value1, value2, "visitEmployeeId");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}
| 21,413 | 0.570775 | 0.567786 | 641 | 31.408737 | 26.648544 | 102 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.697348 | false | false |
1
|
b3975cb74ca7e03214071166689e9aae4c7fbba4
| 9,457,518,017,540 |
35deeb0c7763964038fb2706de268dacb806e7ca
|
/RestTest/src/com/rest/ducks/RubberDuck.java
|
5fb331221d1558c6d5e67ddaffe19fc209b19c6b
|
[] |
no_license
|
diegotedp/pat
|
https://github.com/diegotedp/pat
|
9411ca2a908c17969375a7f5ccd7fd7785231abe
|
d768a067abd01e35f2c20360bcbc93a9384ac72b
|
refs/heads/master
| 2020-04-14T19:03:14.599000 | 2015-02-11T23:52:32 | 2015-02-11T23:52:32 | 28,243,944 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.rest.ducks;
import com.rest.ducks.behavior.NoFlyBehavior;
import com.rest.ducks.behavior.SqueakBehavior;
public class RubberDuck extends Duck {
public RubberDuck(){
this.setFlyBehavior(new NoFlyBehavior());
this.setCuackBehavior(new SqueakBehavior());
}
}
|
UTF-8
|
Java
| 279 |
java
|
RubberDuck.java
|
Java
|
[] | null |
[] |
package com.rest.ducks;
import com.rest.ducks.behavior.NoFlyBehavior;
import com.rest.ducks.behavior.SqueakBehavior;
public class RubberDuck extends Duck {
public RubberDuck(){
this.setFlyBehavior(new NoFlyBehavior());
this.setCuackBehavior(new SqueakBehavior());
}
}
| 279 | 0.777778 | 0.777778 | 13 | 20.461538 | 19.774168 | 46 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.923077 | false | false |
1
|
e481523548ad9683555ab1e05f591b1c93175b22
| 20,289,425,548,022 |
9d8c44a4b8dae258ca33ddb5ab306d07faac6fe8
|
/src/main/java/com/dai/en/competition/store/q1to100/q61to80/RemoveDuplicates.java
|
27d396207838d4f35f4d5c373fbf7b53af669439
|
[] |
no_license
|
daien0418/math
|
https://github.com/daien0418/math
|
941c1e2e5bf7576e421fe3ed0448445d3c3c80f4
|
96af6bc8a491496fe4dd7d9be80dd7550ed70ce6
|
refs/heads/master
| 2021-06-10T01:37:23.468000 | 2021-01-25T07:09:49 | 2021-01-25T07:14:29 | 143,405,855 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.dai.en.competition.store.q1to100.q61to80;
public class RemoveDuplicates {
public int removeDuplicates(int[] nums) {
int val = -1;
int num = 0;
int off=0;
int index = 0;
int j=0;
while(index+off<nums.length)
{
if(val==nums[index]){
if(num==2){
for(j=index;j<nums.length-off-1;j++){
nums[j]=nums[j+1];
}
off++;
index--;
}else{
num ++;
}
}else{
val = nums[index];
num=1;
}
index++;
}
return nums.length - off;
}
public static void main(String[] args) {
RemoveDuplicates removeDuplicates = new RemoveDuplicates();
int[] nums =new int[]{1,1,1,2,2,3};
System.out.print(removeDuplicates.removeDuplicates(nums));
}
}
|
UTF-8
|
Java
| 980 |
java
|
RemoveDuplicates.java
|
Java
|
[] | null |
[] |
package com.dai.en.competition.store.q1to100.q61to80;
public class RemoveDuplicates {
public int removeDuplicates(int[] nums) {
int val = -1;
int num = 0;
int off=0;
int index = 0;
int j=0;
while(index+off<nums.length)
{
if(val==nums[index]){
if(num==2){
for(j=index;j<nums.length-off-1;j++){
nums[j]=nums[j+1];
}
off++;
index--;
}else{
num ++;
}
}else{
val = nums[index];
num=1;
}
index++;
}
return nums.length - off;
}
public static void main(String[] args) {
RemoveDuplicates removeDuplicates = new RemoveDuplicates();
int[] nums =new int[]{1,1,1,2,2,3};
System.out.print(removeDuplicates.removeDuplicates(nums));
}
}
| 980 | 0.435714 | 0.412245 | 39 | 24.128204 | 16.386642 | 61 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.923077 | false | false |
1
|
a4605104a94b9322b67c4dbeb6d0e95a3420e230
| 1,219,770,757,197 |
f17c3704614e1ef653228fdabc652244ebe5583f
|
/daggertest/src/main/java/com/dagger2/wenbchen/daggertest/CacheManagerPersist.java
|
fd1ebfbc88585a9f26f095fb9f06b94d63d8db85
|
[] |
no_license
|
wnchen/DaggerJavaTest
|
https://github.com/wnchen/DaggerJavaTest
|
c92d41239fecb47628b73198a6f547b691a250c9
|
de3ed858f023a3fdee7257e9109172ee2cda13b5
|
refs/heads/master
| 2020-03-12T02:39:25.822000 | 2019-02-13T17:06:34 | 2019-02-13T17:06:34 | 130,408,005 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.dagger2.wenbchen.daggertest;
import javax.inject.Inject;
import javax.inject.Named;
class CacheManagerPersist {
private final CacheInterface cacheInterface;
@Inject
CacheManagerPersist(@Named("cache_persist") CacheInterface cacheInterface) {
this.cacheInterface = cacheInterface;
}
String get(String key) {
return cacheInterface.get(key);
}
}
|
UTF-8
|
Java
| 400 |
java
|
CacheManagerPersist.java
|
Java
|
[] | null |
[] |
package com.dagger2.wenbchen.daggertest;
import javax.inject.Inject;
import javax.inject.Named;
class CacheManagerPersist {
private final CacheInterface cacheInterface;
@Inject
CacheManagerPersist(@Named("cache_persist") CacheInterface cacheInterface) {
this.cacheInterface = cacheInterface;
}
String get(String key) {
return cacheInterface.get(key);
}
}
| 400 | 0.725 | 0.7225 | 18 | 21.222221 | 22.15239 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false |
1
|
0fca9aed8cfa73dae35539482e4ff78129fbc29d
| 4,002,909,557,974 |
b4c91412d7a7f005222bff3a147d707504e82fa5
|
/src/main/java/com/jerry/map/service/LyrEntityService.java
|
e2299c7b9f57a554edf2b3b8f15596de054a7fc3
|
[] |
no_license
|
mvplove123/maplog-analytic-statistic
|
https://github.com/mvplove123/maplog-analytic-statistic
|
761014bb073362aa9b7b53d581a3baec14919a8d
|
4d62f1bbdb5a5a5a4b2d096541651f73abe65fcb
|
refs/heads/master
| 2021-01-10T06:54:09.466000 | 2016-03-16T02:58:16 | 2016-03-16T02:58:16 | 51,724,131 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.jerry.map.service;
/**
* Created by admin on 2016/1/15.
*/
public interface LyrEntityService {
}
|
UTF-8
|
Java
| 114 |
java
|
LyrEntityService.java
|
Java
|
[
{
"context": "package com.jerry.map.service;\n\n/**\n * Created by admin on 2016/1/15.\n */\npublic interface LyrEntityServi",
"end": 55,
"score": 0.9932792782783508,
"start": 50,
"tag": "USERNAME",
"value": "admin"
}
] | null |
[] |
package com.jerry.map.service;
/**
* Created by admin on 2016/1/15.
*/
public interface LyrEntityService {
}
| 114 | 0.692982 | 0.631579 | 9 | 11.666667 | 14.936904 | 35 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.111111 | false | false |
1
|
4241a7117906e056aec76c4ea065fad19c15e3eb
| 13,288,628,857,118 |
21b15e8785bd24dfa30599e65abe87fd83c06f0a
|
/gameproject/src/org/academiadecodigo/bootcamp/gameproject/GameIntro.java
|
fc636b221031460a12eab1b75a2aecd9fd76c08c
|
[] |
no_license
|
dbaeta/word_typing_game
|
https://github.com/dbaeta/word_typing_game
|
b51a96f71d51179bcffe8ccdb7ba20b1ed0b2a0a
|
e8c024eb70b7116ec05beab481717ae45fecc54d
|
refs/heads/master
| 2021-07-12T21:03:49.992000 | 2017-10-16T17:13:39 | 2017-10-16T17:13:39 | 106,333,710 | 0 | 1 | null | false | 2017-10-10T16:41:07 | 2017-10-09T20:47:35 | 2017-10-10T08:19:07 | 2017-10-10T16:41:07 | 28 | 0 | 1 | 0 |
Java
| null | null |
package org.academiadecodigo.bootcamp.gameproject;
import org.academiadecodigo.bootcamp.gameproject.utils.Sound;
import org.academiadecodigo.simplegraphics.graphics.Color;
import org.academiadecodigo.simplegraphics.graphics.Rectangle;
import org.academiadecodigo.simplegraphics.graphics.Text;
import org.academiadecodigo.simplegraphics.keyboard.Keyboard;
import org.academiadecodigo.simplegraphics.keyboard.KeyboardEvent;
import org.academiadecodigo.simplegraphics.keyboard.KeyboardEventType;
import org.academiadecodigo.simplegraphics.keyboard.KeyboardHandler;
import org.academiadecodigo.simplegraphics.pictures.Picture;
/**
* Created by codecadet on 14/10/17.
*/
public class GameIntro implements KeyboardHandler {
private boolean spaceStart;
private Keyboard keyboard = new Keyboard(this);
private KeyboardEvent keyboardEvent = new KeyboardEvent();
private Picture background = new Picture(10, 10, "resources/game_start_menu.jpg");
private Picture instructions = new Picture(10, 10, "resources/game_start_instructions.png");
private Sound soundIntro = new Sound("/resources/Intro.wav");
protected GameIntro() {
keyboardEvent.setKey(KeyboardEvent.KEY_SPACE);
keyboardEvent.setKeyboardEventType(KeyboardEventType.KEY_PRESSED);
keyboard.addEventListener(keyboardEvent);
}
public void intro() throws InterruptedException {
background.draw();
instructions.draw();
soundIntro.play(true);
while (!spaceStart) {
soundIntro.loopIndef();
Thread.sleep(1000);
instructions.delete();
Thread.sleep(500);
instructions.draw();
}
soundIntro.stop();
}
public void introClose() {
background.delete();
instructions.delete();
}
protected boolean isSpaceStart() {
return spaceStart;
}
@Override
public void keyPressed(KeyboardEvent keyboardEvent) {
if (keyboardEvent.getKey() == KeyboardEvent.KEY_SPACE) {
spaceStart = true;
System.out.println("Game Started");
}
}
@Override
public void keyReleased(KeyboardEvent keyboardEvent) {
}
}
|
UTF-8
|
Java
| 2,206 |
java
|
GameIntro.java
|
Java
|
[
{
"context": "implegraphics.pictures.Picture;\n\n/**\n * Created by codecadet on 14/10/17.\n */\npublic class GameIntro implement",
"end": 652,
"score": 0.999680757522583,
"start": 643,
"tag": "USERNAME",
"value": "codecadet"
}
] | null |
[] |
package org.academiadecodigo.bootcamp.gameproject;
import org.academiadecodigo.bootcamp.gameproject.utils.Sound;
import org.academiadecodigo.simplegraphics.graphics.Color;
import org.academiadecodigo.simplegraphics.graphics.Rectangle;
import org.academiadecodigo.simplegraphics.graphics.Text;
import org.academiadecodigo.simplegraphics.keyboard.Keyboard;
import org.academiadecodigo.simplegraphics.keyboard.KeyboardEvent;
import org.academiadecodigo.simplegraphics.keyboard.KeyboardEventType;
import org.academiadecodigo.simplegraphics.keyboard.KeyboardHandler;
import org.academiadecodigo.simplegraphics.pictures.Picture;
/**
* Created by codecadet on 14/10/17.
*/
public class GameIntro implements KeyboardHandler {
private boolean spaceStart;
private Keyboard keyboard = new Keyboard(this);
private KeyboardEvent keyboardEvent = new KeyboardEvent();
private Picture background = new Picture(10, 10, "resources/game_start_menu.jpg");
private Picture instructions = new Picture(10, 10, "resources/game_start_instructions.png");
private Sound soundIntro = new Sound("/resources/Intro.wav");
protected GameIntro() {
keyboardEvent.setKey(KeyboardEvent.KEY_SPACE);
keyboardEvent.setKeyboardEventType(KeyboardEventType.KEY_PRESSED);
keyboard.addEventListener(keyboardEvent);
}
public void intro() throws InterruptedException {
background.draw();
instructions.draw();
soundIntro.play(true);
while (!spaceStart) {
soundIntro.loopIndef();
Thread.sleep(1000);
instructions.delete();
Thread.sleep(500);
instructions.draw();
}
soundIntro.stop();
}
public void introClose() {
background.delete();
instructions.delete();
}
protected boolean isSpaceStart() {
return spaceStart;
}
@Override
public void keyPressed(KeyboardEvent keyboardEvent) {
if (keyboardEvent.getKey() == KeyboardEvent.KEY_SPACE) {
spaceStart = true;
System.out.println("Game Started");
}
}
@Override
public void keyReleased(KeyboardEvent keyboardEvent) {
}
}
| 2,206 | 0.708522 | 0.699003 | 67 | 31.910448 | 25.759932 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.552239 | false | false |
1
|
7016bb0293182242bdc8b382a1e99605624493a6
| 28,020,366,676,300 |
0ac05e3da06d78292fdfb64141ead86ff6ca038f
|
/OSWE/oswe/openCRX/rtjar/rt.jar.src/com/sun/org/apache/xml/internal/dtm/DTMAxisTraverser.java
|
0bc257512b821b926c65ebab0e12a401711e50a6
|
[] |
no_license
|
qoo7972365/timmy
|
https://github.com/qoo7972365/timmy
|
31581cdcbb8858ac19a8bb7b773441a68b6c390a
|
2fc8baba4f53d38dfe9c2b3afd89dcf87cbef578
|
refs/heads/master
| 2023-07-26T12:26:35.266000 | 2023-07-17T12:35:19 | 2023-07-17T12:35:19 | 353,889,195 | 7 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/* */ package com.sun.org.apache.xml.internal.dtm;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public abstract class DTMAxisTraverser
/* */ {
/* */ public int first(int context) {
/* 63 */ return next(context, context);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public int first(int context, int extendedTypeID) {
/* 82 */ return next(context, context, extendedTypeID);
/* */ }
/* */
/* */ public abstract int next(int paramInt1, int paramInt2);
/* */
/* */ public abstract int next(int paramInt1, int paramInt2, int paramInt3);
/* */ }
/* Location: /Users/timmy/timmy/OSWE/oswe/openCRX/rt.jar!/com/sun/org/apache/xml/internal/dtm/DTMAxisTraverser.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/
|
UTF-8
|
Java
| 1,477 |
java
|
DTMAxisTraverser.java
|
Java
|
[
{
"context": "3);\n/* */ }\n\n\n/* Location: /Users/timmy/timmy/OSWE/oswe/openCRX/rt.jar!/com/sun/org/apach",
"end": 1315,
"score": 0.7405543327331543,
"start": 1310,
"tag": "USERNAME",
"value": "timmy"
}
] | null |
[] |
/* */ package com.sun.org.apache.xml.internal.dtm;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public abstract class DTMAxisTraverser
/* */ {
/* */ public int first(int context) {
/* 63 */ return next(context, context);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public int first(int context, int extendedTypeID) {
/* 82 */ return next(context, context, extendedTypeID);
/* */ }
/* */
/* */ public abstract int next(int paramInt1, int paramInt2);
/* */
/* */ public abstract int next(int paramInt1, int paramInt2, int paramInt3);
/* */ }
/* Location: /Users/timmy/timmy/OSWE/oswe/openCRX/rt.jar!/com/sun/org/apache/xml/internal/dtm/DTMAxisTraverser.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/
| 1,477 | 0.295193 | 0.28436 | 94 | 14.723404 | 18.458351 | 129 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.12766 | false | false |
1
|
29069d03d46b2a8bad4a615fe7db3e14253408f8
| 9,732,395,936,121 |
78e2853dd2cca3b804923ae6a0a5b9a53e0466a0
|
/Gproject/myssm/src/cn/sm1234/interceptor/AuthInterceptor.java
|
710d3a5445e676ea631bcc4dabb29325d62f0cb7
|
[] |
no_license
|
16110100515/graduationProject-
|
https://github.com/16110100515/graduationProject-
|
80fe8f3e33edbbec8e99df60a4edf7a58cfb3cb6
|
5580e9ee0c632db67b9a44ba60fc424550d9b0fb
|
refs/heads/master
| 2021-01-16T02:14:14.174000 | 2020-02-25T08:04:10 | 2020-02-25T08:04:10 | 242,939,981 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package cn.sm1234.interceptor;
import cn.sm1234.domain.Permission;
import cn.sm1234.service.PermissionService;
import cn.sm1234.util.Const;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class AuthInterceptor extends HandlerInterceptorAdapter {
@Autowired
private PermissionService permissionService;
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
List<Permission> queryAllPermission = permissionService.queryAllPermission();
Set<String> allURIs = new HashSet<String>();
for(Permission permission:queryAllPermission){
allURIs.add("/"+permission.getUrl());
}
String servletPath = request.getServletPath();
if(allURIs.contains(servletPath)){
Set<String > myURIs = (HashSet<String >)request.getSession().getAttribute(Const.MY_URIS);
if(myURIs.contains(servletPath)){
return true;
}else{
response.sendRedirect(request.getContextPath()+"/dispatcher/login.action");
return false;
}
}else{
return true;
}
}
}
|
UTF-8
|
Java
| 1,458 |
java
|
AuthInterceptor.java
|
Java
|
[] | null |
[] |
package cn.sm1234.interceptor;
import cn.sm1234.domain.Permission;
import cn.sm1234.service.PermissionService;
import cn.sm1234.util.Const;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class AuthInterceptor extends HandlerInterceptorAdapter {
@Autowired
private PermissionService permissionService;
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
List<Permission> queryAllPermission = permissionService.queryAllPermission();
Set<String> allURIs = new HashSet<String>();
for(Permission permission:queryAllPermission){
allURIs.add("/"+permission.getUrl());
}
String servletPath = request.getServletPath();
if(allURIs.contains(servletPath)){
Set<String > myURIs = (HashSet<String >)request.getSession().getAttribute(Const.MY_URIS);
if(myURIs.contains(servletPath)){
return true;
}else{
response.sendRedirect(request.getContextPath()+"/dispatcher/login.action");
return false;
}
}else{
return true;
}
}
}
| 1,458 | 0.700274 | 0.6893 | 44 | 32.136364 | 29.827984 | 121 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.522727 | false | false |
1
|
bd33dd47b08083f009d9195473dfb20f50dbcd6e
| 16,174,846,896,948 |
3fc8cb4d8005aa9ee9628b9fd57d41544561fcfb
|
/app/job/FixNoMatchTopURLBaseCidJob.java
|
1b99508ed5cd7711663fe9635e78aee1579a3a6f
|
[] |
no_license
|
caoyd/tm
|
https://github.com/caoyd/tm
|
a9d799ca58b2624e5c2fca30c9b9453e46b094a0
|
62a6fc77fe152b2a73110b67d55a13d01c995cb1
|
refs/heads/master
| 2020-04-05T02:26:15.779000 | 2018-03-21T13:09:17 | 2018-03-21T13:09:17 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package job;
import java.util.List;
import models.item.ItemCatPlay;
import models.user.User;
import models.word.top.NoMatchTopURLBaseCid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.ciaosir.client.CommonUtils;
import com.taobao.api.domain.ItemCat;
import bustbapi.ItemCatApi;
import configs.TMConfigs;
import controllers.newAutoTitle;
import play.jobs.Job;
public class FixNoMatchTopURLBaseCidJob extends Job{
static final Logger log = LoggerFactory.getLogger(FixNoMatchTopURLBaseCidJob.class);
public static String TAG = "FixNoMatchTopURLBaseCidJob";
public static int count = 0;
@Override
public void doJob(){
Thread.currentThread().setName(TAG);
/*if (!TMConfigs.Server.jobTimerEnable) {
return;
}*/
count = 0;
new NoMatchTopURLBaseCid.NoMatchTopURLBaseCidBatchOper(32){
@Override
public void doForEachUser(final NoMatchTopURLBaseCid cat) {
this.sleepTime = 100L;
updateCat(cat);
}
}.call();
}
public static boolean updateCat(NoMatchTopURLBaseCid cat) {
log.info("FixNoMatchTopURLBaseCidJob count = [" + count++ + "]");
if(cat == null) {
return false;
}
Long cid = cat.getCid();
if(cid== null || cid <= 0) {
return false;
}
ItemCatPlay itemCatPlay = ItemCatPlay.findByCid(cid);
// 如果数据库中没有该类目,则更新
if(itemCatPlay == null){
ItemCatPlay.updateNewCatByTaobaoCat(cid);
}
return false;
}
}
|
UTF-8
|
Java
| 1,528 |
java
|
FixNoMatchTopURLBaseCidJob.java
|
Java
|
[] | null |
[] |
package job;
import java.util.List;
import models.item.ItemCatPlay;
import models.user.User;
import models.word.top.NoMatchTopURLBaseCid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.ciaosir.client.CommonUtils;
import com.taobao.api.domain.ItemCat;
import bustbapi.ItemCatApi;
import configs.TMConfigs;
import controllers.newAutoTitle;
import play.jobs.Job;
public class FixNoMatchTopURLBaseCidJob extends Job{
static final Logger log = LoggerFactory.getLogger(FixNoMatchTopURLBaseCidJob.class);
public static String TAG = "FixNoMatchTopURLBaseCidJob";
public static int count = 0;
@Override
public void doJob(){
Thread.currentThread().setName(TAG);
/*if (!TMConfigs.Server.jobTimerEnable) {
return;
}*/
count = 0;
new NoMatchTopURLBaseCid.NoMatchTopURLBaseCidBatchOper(32){
@Override
public void doForEachUser(final NoMatchTopURLBaseCid cat) {
this.sleepTime = 100L;
updateCat(cat);
}
}.call();
}
public static boolean updateCat(NoMatchTopURLBaseCid cat) {
log.info("FixNoMatchTopURLBaseCidJob count = [" + count++ + "]");
if(cat == null) {
return false;
}
Long cid = cat.getCid();
if(cid== null || cid <= 0) {
return false;
}
ItemCatPlay itemCatPlay = ItemCatPlay.findByCid(cid);
// 如果数据库中没有该类目,则更新
if(itemCatPlay == null){
ItemCatPlay.updateNewCatByTaobaoCat(cid);
}
return false;
}
}
| 1,528 | 0.683578 | 0.676903 | 69 | 20.710144 | 20.949976 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.289855 | false | false |
1
|
707449852ccbedd6d6200dc8d33c36a6b63bdf89
| 16,501,264,415,757 |
0b54a9d34dae113aa73f4b44c7ad2c168e39609b
|
/src/com/company/Task7/Task7.java
|
bd760cb151debf94e3c3aba5d44fc9ec0594bf30
|
[] |
no_license
|
Denis-Yatsenko/Lab_Java_1
|
https://github.com/Denis-Yatsenko/Lab_Java_1
|
32645d032f189be71fc9146380cf8caf4c98e4bc
|
cebd2442667b4e021cc5cee22953134f9c92e89a
|
refs/heads/main
| 2023-08-29T11:00:29.517000 | 2021-11-04T15:58:57 | 2021-11-04T15:58:57 | 424,654,999 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.company.Task7;
public class Task7 {
public static void main(String[] args) {
User User1;
User1 = new User("Denys","Yatsenko","denys.yatsenko.itis.2020@lpnu.ua",18);
System.out.println(User1.FirstName);
System.out.println(User1.LastName);
System.out.println(User1.age);
System.out.println(User1.email);
}
}
|
UTF-8
|
Java
| 380 |
java
|
Task7.java
|
Java
|
[
{
"context": ") {\n User User1;\n User1 = new User(\"Denys\",\"Yatsenko\",\"denys.yatsenko.itis.2020@lpnu.ua\",18",
"end": 145,
"score": 0.9993689060211182,
"start": 140,
"tag": "NAME",
"value": "Denys"
},
{
"context": " User User1;\n User1 = new User(\"Denys\",\"Yatsenko\",\"denys.yatsenko.itis.2020@lpnu.ua\",18);\n ",
"end": 156,
"score": 0.9998572468757629,
"start": 148,
"tag": "NAME",
"value": "Yatsenko"
},
{
"context": "er1;\n User1 = new User(\"Denys\",\"Yatsenko\",\"denys.yatsenko.itis.2020@lpnu.ua\",18);\n System.out.println(User1.FirstName)",
"end": 191,
"score": 0.9999148845672607,
"start": 159,
"tag": "EMAIL",
"value": "denys.yatsenko.itis.2020@lpnu.ua"
}
] | null |
[] |
package com.company.Task7;
public class Task7 {
public static void main(String[] args) {
User User1;
User1 = new User("Denys","Yatsenko","<EMAIL>",18);
System.out.println(User1.FirstName);
System.out.println(User1.LastName);
System.out.println(User1.age);
System.out.println(User1.email);
}
}
| 355 | 0.631579 | 0.594737 | 13 | 28.153847 | 22.95764 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.769231 | false | false |
1
|
70481769262cc4f93dca90823f93cc95be4870bb
| 6,390,911,357,278 |
8458097659c9b750beea921d13f4e2a9ecf27d4d
|
/src/main/java/com/fenrir/server/model/api/StatusModel.java
|
eff164e9046019f2223da25ca82f49ab7835995a
|
[] |
no_license
|
Yumenokanata/FenrirPayServer
|
https://github.com/Yumenokanata/FenrirPayServer
|
971d5d53a65584ff206cf6086dd78378301e481e
|
8706753ff72f17df76304c9416e94824ec698122
|
refs/heads/master
| 2016-08-06T09:06:09.161000 | 2016-06-07T10:32:25 | 2016-06-07T10:32:25 | 58,027,212 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.fenrir.server.model.api;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* Created by yume on 16-4-12.
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class StatusModel {
private String status = "OK";
private String errorMsg = "";
}
|
UTF-8
|
Java
| 307 |
java
|
StatusModel.java
|
Java
|
[
{
"context": "mport lombok.NoArgsConstructor;\n\n/**\n * Created by yume on 16-4-12.\n */\n@Data\n@AllArgsConstructor\n@NoArgs",
"end": 148,
"score": 0.9992736577987671,
"start": 144,
"tag": "USERNAME",
"value": "yume"
}
] | null |
[] |
package com.fenrir.server.model.api;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* Created by yume on 16-4-12.
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class StatusModel {
private String status = "OK";
private String errorMsg = "";
}
| 307 | 0.742671 | 0.726384 | 16 | 18.1875 | 13.602476 | 36 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.375 | false | false |
1
|
1e9dc001be877429adc5f60b8bb2b9fe0dd8f491
| 17,952,963,309,083 |
02aa9fd6de517fb7ab968a208cfb4f21db8ff8d6
|
/src/main/java/com/veritomyx/actions/PrepAction.java
|
824753f41a7c43f0cc44870fd03922771905eee3
|
[] |
no_license
|
bellmit/PeakInvestigator-Java-SDK
|
https://github.com/bellmit/PeakInvestigator-Java-SDK
|
41f9c18b847a908c5abb1d8e623512342841fc52
|
41a167b52c81ed5cb7af6ae1ad7e4d441212fd30
|
refs/heads/master
| 2022-02-22T01:52:25.027000 | 2017-01-30T15:29:36 | 2017-01-30T15:29:36 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.veritomyx.actions;
public class PrepAction extends BaseAction {
private final static String action = "PREP";
public final static String EXAMPLE_RESPONSE_1 = "{\"Action\":\"PREP\",\"File\":\"WatersQ-TOF.tar\",\"Status\":\"Analyzing\",\"PercentComplete\":\"90%\",\"ScanCount\":0,\"MSType\":\"TBD\"}";
public final static String EXAMPLE_RESPONSE_2 = "{\"Action\":\"PREP\",\"File\":\"Bosch_1_1.tar\",\"Status\":\"Ready\",\"PercentComplete\":\"\",\"ScanCount\":3336,\"MSType\":\"Orbitrap\"}";
private int projectID;
private String filename;
public PrepAction(String user, String code, int projectID, String filename) {
super(user, code);
this.projectID = projectID;
this.filename = filename;
}
public String buildQuery() {
StringBuilder builder = new StringBuilder(super.buildQuery());
builder.append("Action=" + action + "&");
builder.append("ID=" + projectID + "&");
builder.append("File=" + filename);
return builder.toString();
}
private void preCheck() throws IllegalStateException {
if (!isReady(action)) {
throw new IllegalStateException("Response has not been set.");
}
}
public String getFilename() {
preCheck();
return getStringAttribute("File");
}
public Status getStatus() {
preCheck();
return Status.valueOf(getStringAttribute("Status"));
}
public int getScanCount() {
preCheck();
return (int) getLongAttribute("ScanCount");
}
public String getPercentComplete() {
preCheck();
return getStringAttribute("PercentComplete");
};
public String getMStype() {
preCheck();
return getStringAttribute("MSType");
}
@Override
public String getErrorMessage() {
preCheck();
return super.getErrorMessage();
}
@Override
public long getErrorCode() {
preCheck();
return super.getErrorCode();
}
public enum Status { Analyzing, Ready, Error }
}
|
UTF-8
|
Java
| 1,849 |
java
|
PrepAction.java
|
Java
|
[] | null |
[] |
package com.veritomyx.actions;
public class PrepAction extends BaseAction {
private final static String action = "PREP";
public final static String EXAMPLE_RESPONSE_1 = "{\"Action\":\"PREP\",\"File\":\"WatersQ-TOF.tar\",\"Status\":\"Analyzing\",\"PercentComplete\":\"90%\",\"ScanCount\":0,\"MSType\":\"TBD\"}";
public final static String EXAMPLE_RESPONSE_2 = "{\"Action\":\"PREP\",\"File\":\"Bosch_1_1.tar\",\"Status\":\"Ready\",\"PercentComplete\":\"\",\"ScanCount\":3336,\"MSType\":\"Orbitrap\"}";
private int projectID;
private String filename;
public PrepAction(String user, String code, int projectID, String filename) {
super(user, code);
this.projectID = projectID;
this.filename = filename;
}
public String buildQuery() {
StringBuilder builder = new StringBuilder(super.buildQuery());
builder.append("Action=" + action + "&");
builder.append("ID=" + projectID + "&");
builder.append("File=" + filename);
return builder.toString();
}
private void preCheck() throws IllegalStateException {
if (!isReady(action)) {
throw new IllegalStateException("Response has not been set.");
}
}
public String getFilename() {
preCheck();
return getStringAttribute("File");
}
public Status getStatus() {
preCheck();
return Status.valueOf(getStringAttribute("Status"));
}
public int getScanCount() {
preCheck();
return (int) getLongAttribute("ScanCount");
}
public String getPercentComplete() {
preCheck();
return getStringAttribute("PercentComplete");
};
public String getMStype() {
preCheck();
return getStringAttribute("MSType");
}
@Override
public String getErrorMessage() {
preCheck();
return super.getErrorMessage();
}
@Override
public long getErrorCode() {
preCheck();
return super.getErrorCode();
}
public enum Status { Analyzing, Ready, Error }
}
| 1,849 | 0.682531 | 0.676582 | 75 | 23.653334 | 33.597816 | 190 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.746667 | false | false |
1
|
1c86508f0c627bc16853d942e495978f3df8f058
| 20,478,404,123,355 |
7fde0b5c4b7a26849263573e0e5c73648367cb4e
|
/all/common/src/main/java/org/eleven/common/resources/CACHEPath.java
|
6e63cf8d34e00953870ec07e5546df3bcae24f96
|
[] |
no_license
|
100136100/demo
|
https://github.com/100136100/demo
|
3946d4a2e0c2e46664a3aa6204930b0f95d09154
|
89eebb84b207dc5b1a8125272610d18b65bded2f
|
refs/heads/master
| 2018-10-13T11:27:38.186000 | 2017-03-15T14:20:46 | 2017-03-15T14:20:46 | 82,661,408 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.eleven.common.resources;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import lombok.Data;
@ConfigurationProperties(locations = "classpath:conf/paths.properties", prefix = "cache")
@Component
@Data
public class CACHEPath {
public String root;
public String set;
public String set2;
public String get;
}
|
UTF-8
|
Java
| 402 |
java
|
CACHEPath.java
|
Java
|
[] | null |
[] |
package org.eleven.common.resources;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import lombok.Data;
@ConfigurationProperties(locations = "classpath:conf/paths.properties", prefix = "cache")
@Component
@Data
public class CACHEPath {
public String root;
public String set;
public String set2;
public String get;
}
| 402 | 0.80597 | 0.803483 | 18 | 21.388889 | 25.272161 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.722222 | false | false |
1
|
51899c87af226a29d45db3f714960dc5db55b34b
| 18,133,351,956,873 |
67a77907dbfd6fae8164e9c1c06ac96a1c3d593a
|
/src/java/com/una/vdc/model/project/TaskSituation.java
|
5799a75e0c49d5683a95c05c42ec8b1acdf47b3b
|
[] |
no_license
|
marcelobento/vitrinedoconhecimento
|
https://github.com/marcelobento/vitrinedoconhecimento
|
6e039bed95d66cc90ba591f538a6a9126c67e64a
|
08359b591132aab248221b563b590fbe4e110cf1
|
refs/heads/master
| 2021-01-17T12:46:45.735000 | 2014-06-04T22:54:27 | 2014-06-04T22:54:27 | null | 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 com.una.vdc.model.project;
import com.una.vdc.model.user.Student;
import java.io.Serializable;
import java.util.Calendar;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.Temporal;
/**
*
* @author Ulrik
*/
@Entity
public class TaskSituation implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@OneToOne
private Task task;
@OneToOne
private Student student;
@Temporal(javax.persistence.TemporalType.DATE)
private Calendar endDate;
private Status status;
@OneToOne
private TIDIRProject project;
public TaskSituation() {
this.status = Status.INPROGRESS;
}
/**
* Get the value of project
*
* @return the value of project
*/
public TIDIRProject getProject() {
return project;
}
/**
* Set the value of project
*
* @param project new value of project
*/
public void setProject(TIDIRProject project) {
this.project = project;
}
/**
* Get the value of status
*
* @return the value of status
*/
public Status getStatus() {
return status;
}
/**
* Set the value of status
*
* @param status new value of status
*/
public void setStatus(Status status) {
this.status = status;
}
/**
* Get the value of endDate
*
* @return the value of endDate
*/
public Calendar getEndDate() {
return endDate;
}
/**
* Set the value of endDate
*
* @param endDate new value of endDate
*/
public void setEndDate(Calendar endDate) {
this.endDate = endDate;
}
/**
* Get the value of student
*
* @return the value of student
*/
public Student getStudent() {
return student;
}
/**
* Set the value of student
*
* @param student new value of student
*/
public void setStudent(Student student) {
this.student = student;
}
/**
* Get the value of task
*
* @return the value of task
*/
public Task getTask() {
return task;
}
/**
* Set the value of task
*
* @param task new value of task
*/
public void setTask(Task task) {
this.task = task;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof TaskSituation)) {
return false;
}
TaskSituation other = (TaskSituation) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "com.una.vdc.model.project.TaskSituation[ id=" + id + " ]";
}
}
|
UTF-8
|
Java
| 3,570 |
java
|
TaskSituation.java
|
Java
|
[
{
"context": "ort javax.persistence.Temporal;\n\n/**\n *\n * @author Ulrik\n */\n@Entity\npublic class TaskSituation implements",
"end": 554,
"score": 0.9905754923820496,
"start": 549,
"tag": "NAME",
"value": "Ulrik"
}
] | 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 com.una.vdc.model.project;
import com.una.vdc.model.user.Student;
import java.io.Serializable;
import java.util.Calendar;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.Temporal;
/**
*
* @author Ulrik
*/
@Entity
public class TaskSituation implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@OneToOne
private Task task;
@OneToOne
private Student student;
@Temporal(javax.persistence.TemporalType.DATE)
private Calendar endDate;
private Status status;
@OneToOne
private TIDIRProject project;
public TaskSituation() {
this.status = Status.INPROGRESS;
}
/**
* Get the value of project
*
* @return the value of project
*/
public TIDIRProject getProject() {
return project;
}
/**
* Set the value of project
*
* @param project new value of project
*/
public void setProject(TIDIRProject project) {
this.project = project;
}
/**
* Get the value of status
*
* @return the value of status
*/
public Status getStatus() {
return status;
}
/**
* Set the value of status
*
* @param status new value of status
*/
public void setStatus(Status status) {
this.status = status;
}
/**
* Get the value of endDate
*
* @return the value of endDate
*/
public Calendar getEndDate() {
return endDate;
}
/**
* Set the value of endDate
*
* @param endDate new value of endDate
*/
public void setEndDate(Calendar endDate) {
this.endDate = endDate;
}
/**
* Get the value of student
*
* @return the value of student
*/
public Student getStudent() {
return student;
}
/**
* Set the value of student
*
* @param student new value of student
*/
public void setStudent(Student student) {
this.student = student;
}
/**
* Get the value of task
*
* @return the value of task
*/
public Task getTask() {
return task;
}
/**
* Set the value of task
*
* @param task new value of task
*/
public void setTask(Task task) {
this.task = task;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof TaskSituation)) {
return false;
}
TaskSituation other = (TaskSituation) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "com.una.vdc.model.project.TaskSituation[ id=" + id + " ]";
}
}
| 3,570 | 0.586275 | 0.585434 | 171 | 19.877193 | 18.693029 | 102 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.251462 | false | false |
1
|
4cdf1f530306ec5aca072bd03ffc68259b657ca9
| 8,272,107,062,872 |
a510bc42c3a40366fc0b06adac7a0aa7c08c317a
|
/src/com/example/photo/Activity_shoujidenglu.java
|
ae5074d4ceb348aec89b1eb8b6b127be192b7a92
|
[] |
no_license
|
zc110/PhotoCard
|
https://github.com/zc110/PhotoCard
|
ec9e9ec69c375f96ce44bb28258743db1388674d
|
e2b14dc77a75c4bf9700b301459f5c7d29d1b497
|
refs/heads/master
| 2020-09-11T08:41:24.493000 | 2016-08-19T07:00:59 | 2016-08-19T07:00:59 | 66,047,724 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.photo;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Set;
import org.json.JSONObject;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import cn.smssdk.EventHandler;
import cn.smssdk.SMSSDK;
import cn.smssdk.utils.SMSLog;
public class Activity_shoujidenglu extends Activity {
ImageView imageview_fanhui_shouyedenglu;
EditText edit_shoujihao;
EditText edit_yanzhengma;
ImageView imageview_huoquyanzhengma;
TextView text_jinrumimadenglu;
ImageView imageView_denglu;
// 获取国家
private HashMap<Character, ArrayList<String[]>> first; // 第一层数组
ArrayList<String[]> second; // 第二层数组
String countyList = "国家列表:\n";
// 填写从短信SDK应用后台注册得到的APPKEY
private static String APPKEY = "1623846047e00";// "69d6705af33d";0d786a4efe92bfab3d5717b9bc30a10d
// 填写从短信SDK应用后台注册得到的APPSECRET
private static String APPSECRET = "358d9c4c209c0a7dec3a70adaeb64c05";
public String phString;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.shoujidenglu_layout);
getData();
SMSSDK.initSDK(this, APPKEY, APPSECRET, false);
EventHandler eh = new EventHandler() {
@Override
public void afterEvent(int event, int result, Object data) {
Message msg = new Message();
msg.arg1 = event;
msg.arg2 = result;
msg.obj = data;
mHandler.sendMessage(msg);
}
};
SMSSDK.registerEventHandler(eh);
}
public void getData() {
text_jinrumimadenglu = (TextView) findViewById(R.id.text_jinruyouxiangdenglu);
text_jinrumimadenglu.setOnClickListener(clickListener);
imageview_fanhui_shouyedenglu = (ImageView) findViewById(R.id.image_shoujidenglu_fanhui);
imageview_fanhui_shouyedenglu.setOnClickListener(clickListener);
edit_yanzhengma = (EditText) findViewById(R.id.edit_yanzhengma);
edit_shoujihao = (EditText) findViewById(R.id.edit_shoujihaoma);
imageview_huoquyanzhengma = (ImageView) findViewById(R.id.image_huoqyyanzhengma);
imageview_huoquyanzhengma.setOnClickListener(clickListener);
imageView_denglu = (ImageView) findViewById(R.id.shoujidenglu_denglu);
imageView_denglu.setOnClickListener(clickListener);
}
OnClickListener clickListener = new OnClickListener() {
@SuppressWarnings("unused")
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
switch (v.getId()) {
case R.id.image_shoujidenglu_fanhui:
fanhui_shouye_denglu();
break;
case R.id.text_jinruyouxiangdenglu:
jinrumimadenglu();
break;
case R.id.shoujidenglu_denglu:
SMSSDK.submitVerificationCode("86", phString, edit_yanzhengma
.getText().toString());
break;
case R.id.image_huoqyyanzhengma:
if (!TextUtils.isEmpty(edit_shoujihao.getText().toString())) {
SMSSDK.getVerificationCode("86", edit_shoujihao.getText()
.toString());
// SMSSDK.getVoiceVerifyCode("86",phonEditText.getText().toString());
phString = edit_shoujihao.getText().toString();
} else {
Toast.makeText(Activity_shoujidenglu.this, "电话不能为空", 1)
.show();
}
break;
default:
break;
}
}
};
public void denglu() {
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
}
public void fanhui_shouye_denglu() {// 跳转到首页登录
Intent intent = new Intent(this, Activity_jianxing_denglu.class);
startActivity(intent);
}
public void jinrumimadenglu() {// 跳转到密码登录
Intent intent = new Intent(this, Activity_mimadenglu.class);
startActivity(intent);
}
@SuppressLint("HandlerLeak")
Handler mHandler = new Handler() {
public void handleMessage(Message msg) {
// TODO Auto-generated method stub
super.handleMessage(msg);
int event = msg.arg1;
int result = msg.arg2;
Object data = msg.obj;
Log.e("event", "event=" + event);
// System.out.println("--------result---0"+event+"--------*"+result+"--------"+data);
if (result == SMSSDK.RESULT_COMPLETE) {
if (event == SMSSDK.EVENT_GET_VERIFICATION_CODE) {
Toast.makeText(getApplicationContext(), "发送验证码成功",
Toast.LENGTH_SHORT).show();
} else if (event == SMSSDK.EVENT_SUBMIT_VERIFICATION_CODE) {// 提交验证码成功
denglu();
Toast.makeText(getApplicationContext(), "验证成功",
Toast.LENGTH_SHORT).show();
} else if (event == SMSSDK.EVENT_GET_SUPPORTED_COUNTRIES) {
System.out.println("国家数据:");
System.out
.println("国家数据:" + SMSSDK.getGroupedCountryList());
String ct = data.toString();
// tv.setText(ct);
first = SMSSDK.getGroupedCountryList();
System.out.println("第一层数组:" + first);
Set set = first.keySet();
for (Object obj : set) {
// System.out.println("键:"+obj+" 值:"+first.get(obj));
second = first.get(obj);
System.out.println("第二层数组:" + second);
for (int i = 0; i < second.toArray().length; i++) {
String[] thirst = second.get(i);
System.out.println("第三层数组:" + thirst);
System.out.println("单个国家字符:" + thirst[0] + "和"
+ thirst[1]);
String str = thirst[0] + "----------" + thirst[1]
+ ";\n";
countyList = countyList + str;
System.out.println("----" + countyList);
}
}
// tv.setText(countyList);
}
} else {
int status = 0;
try {
((Throwable) data).printStackTrace();
Throwable throwable = (Throwable) data;
JSONObject object = new JSONObject(throwable.getMessage());
String des = object.optString("detail");
status = object.optInt("status");
if (!TextUtils.isEmpty(des)) {
Toast.makeText(Activity_shoujidenglu.this, des,
Toast.LENGTH_SHORT).show();
return;
}
} catch (Exception e) {
SMSLog.getInstance().w(e);
}
}
};
};
protected void onDestroy() {
super.onDestroy();
SMSSDK.unregisterAllEventHandler();
};
}
|
UTF-8
|
Java
| 6,479 |
java
|
Activity_shoujidenglu.java
|
Java
|
[
{
"context": "应用后台注册得到的APPKEY\n\n\tprivate static String APPKEY = \"1623846047e00\";// \"69d6705af33d\";0d786a4efe92bfab3d5717b9bc30a1",
"end": 1121,
"score": 0.9899460077285767,
"start": 1108,
"tag": "KEY",
"value": "1623846047e00"
},
{
"context": "rivate static String APPKEY = \"1623846047e00\";// \"69d6705af33d\";0d786a4efe92bfab3d5717b9bc30a10d\n\t// 填写从短信SDK应用后",
"end": 1139,
"score": 0.9955902099609375,
"start": 1127,
"tag": "KEY",
"value": "69d6705af33d"
},
{
"context": "String APPKEY = \"1623846047e00\";// \"69d6705af33d\";0d786a4efe92bfab3d5717b9bc30a10d\n\t// 填写从短信SDK应用后台注册得到的APPSECRET\n\n\tprivate static S",
"end": 1173,
"score": 0.9808770418167114,
"start": 1141,
"tag": "KEY",
"value": "0d786a4efe92bfab3d5717b9bc30a10d"
},
{
"context": "得到的APPSECRET\n\n\tprivate static String APPSECRET = \"358d9c4c209c0a7dec3a70adaeb64c05\";\n\tpublic String phString;\n\n\t@Override\n\tprotected",
"end": 1274,
"score": 0.9997057914733887,
"start": 1242,
"tag": "KEY",
"value": "358d9c4c209c0a7dec3a70adaeb64c05"
}
] | null |
[] |
package com.example.photo;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Set;
import org.json.JSONObject;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import cn.smssdk.EventHandler;
import cn.smssdk.SMSSDK;
import cn.smssdk.utils.SMSLog;
public class Activity_shoujidenglu extends Activity {
ImageView imageview_fanhui_shouyedenglu;
EditText edit_shoujihao;
EditText edit_yanzhengma;
ImageView imageview_huoquyanzhengma;
TextView text_jinrumimadenglu;
ImageView imageView_denglu;
// 获取国家
private HashMap<Character, ArrayList<String[]>> first; // 第一层数组
ArrayList<String[]> second; // 第二层数组
String countyList = "国家列表:\n";
// 填写从短信SDK应用后台注册得到的APPKEY
private static String APPKEY = "1623846047e00";// "69d6705af33d";<KEY>
// 填写从短信SDK应用后台注册得到的APPSECRET
private static String APPSECRET = "358d9c4c209c0a7dec3a70adaeb64c05";
public String phString;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.shoujidenglu_layout);
getData();
SMSSDK.initSDK(this, APPKEY, APPSECRET, false);
EventHandler eh = new EventHandler() {
@Override
public void afterEvent(int event, int result, Object data) {
Message msg = new Message();
msg.arg1 = event;
msg.arg2 = result;
msg.obj = data;
mHandler.sendMessage(msg);
}
};
SMSSDK.registerEventHandler(eh);
}
public void getData() {
text_jinrumimadenglu = (TextView) findViewById(R.id.text_jinruyouxiangdenglu);
text_jinrumimadenglu.setOnClickListener(clickListener);
imageview_fanhui_shouyedenglu = (ImageView) findViewById(R.id.image_shoujidenglu_fanhui);
imageview_fanhui_shouyedenglu.setOnClickListener(clickListener);
edit_yanzhengma = (EditText) findViewById(R.id.edit_yanzhengma);
edit_shoujihao = (EditText) findViewById(R.id.edit_shoujihaoma);
imageview_huoquyanzhengma = (ImageView) findViewById(R.id.image_huoqyyanzhengma);
imageview_huoquyanzhengma.setOnClickListener(clickListener);
imageView_denglu = (ImageView) findViewById(R.id.shoujidenglu_denglu);
imageView_denglu.setOnClickListener(clickListener);
}
OnClickListener clickListener = new OnClickListener() {
@SuppressWarnings("unused")
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
switch (v.getId()) {
case R.id.image_shoujidenglu_fanhui:
fanhui_shouye_denglu();
break;
case R.id.text_jinruyouxiangdenglu:
jinrumimadenglu();
break;
case R.id.shoujidenglu_denglu:
SMSSDK.submitVerificationCode("86", phString, edit_yanzhengma
.getText().toString());
break;
case R.id.image_huoqyyanzhengma:
if (!TextUtils.isEmpty(edit_shoujihao.getText().toString())) {
SMSSDK.getVerificationCode("86", edit_shoujihao.getText()
.toString());
// SMSSDK.getVoiceVerifyCode("86",phonEditText.getText().toString());
phString = edit_shoujihao.getText().toString();
} else {
Toast.makeText(Activity_shoujidenglu.this, "电话不能为空", 1)
.show();
}
break;
default:
break;
}
}
};
public void denglu() {
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
}
public void fanhui_shouye_denglu() {// 跳转到首页登录
Intent intent = new Intent(this, Activity_jianxing_denglu.class);
startActivity(intent);
}
public void jinrumimadenglu() {// 跳转到密码登录
Intent intent = new Intent(this, Activity_mimadenglu.class);
startActivity(intent);
}
@SuppressLint("HandlerLeak")
Handler mHandler = new Handler() {
public void handleMessage(Message msg) {
// TODO Auto-generated method stub
super.handleMessage(msg);
int event = msg.arg1;
int result = msg.arg2;
Object data = msg.obj;
Log.e("event", "event=" + event);
// System.out.println("--------result---0"+event+"--------*"+result+"--------"+data);
if (result == SMSSDK.RESULT_COMPLETE) {
if (event == SMSSDK.EVENT_GET_VERIFICATION_CODE) {
Toast.makeText(getApplicationContext(), "发送验证码成功",
Toast.LENGTH_SHORT).show();
} else if (event == SMSSDK.EVENT_SUBMIT_VERIFICATION_CODE) {// 提交验证码成功
denglu();
Toast.makeText(getApplicationContext(), "验证成功",
Toast.LENGTH_SHORT).show();
} else if (event == SMSSDK.EVENT_GET_SUPPORTED_COUNTRIES) {
System.out.println("国家数据:");
System.out
.println("国家数据:" + SMSSDK.getGroupedCountryList());
String ct = data.toString();
// tv.setText(ct);
first = SMSSDK.getGroupedCountryList();
System.out.println("第一层数组:" + first);
Set set = first.keySet();
for (Object obj : set) {
// System.out.println("键:"+obj+" 值:"+first.get(obj));
second = first.get(obj);
System.out.println("第二层数组:" + second);
for (int i = 0; i < second.toArray().length; i++) {
String[] thirst = second.get(i);
System.out.println("第三层数组:" + thirst);
System.out.println("单个国家字符:" + thirst[0] + "和"
+ thirst[1]);
String str = thirst[0] + "----------" + thirst[1]
+ ";\n";
countyList = countyList + str;
System.out.println("----" + countyList);
}
}
// tv.setText(countyList);
}
} else {
int status = 0;
try {
((Throwable) data).printStackTrace();
Throwable throwable = (Throwable) data;
JSONObject object = new JSONObject(throwable.getMessage());
String des = object.optString("detail");
status = object.optInt("status");
if (!TextUtils.isEmpty(des)) {
Toast.makeText(Activity_shoujidenglu.this, des,
Toast.LENGTH_SHORT).show();
return;
}
} catch (Exception e) {
SMSLog.getInstance().w(e);
}
}
};
};
protected void onDestroy() {
super.onDestroy();
SMSSDK.unregisterAllEventHandler();
};
}
| 6,452 | 0.688333 | 0.676777 | 209 | 28.818182 | 22.124819 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.210526 | false | false |
1
|
ff70cc2fcc4ff1ed77aead6cb0a7b2c37d5fb40b
| 3,023,657,043,475 |
f7103d7eabc655ea35268bf47da29d7d8e0df17d
|
/CTCI/src/Code/Trie.java
|
85d5c9ec115422ab72c10f3e030567d62edd7349
|
[] |
no_license
|
hgohil2805/CTCI
|
https://github.com/hgohil2805/CTCI
|
81a69b47dc80cf3399a9da11aaec1978031871e5
|
3a9c2cbeb4ad8256a0a40419adc401a50331da86
|
refs/heads/master
| 2021-01-23T15:51:35.258000 | 2017-05-06T22:09:04 | 2017-05-06T22:09:04 | 42,382,688 | 0 | 0 | null | false | 2017-05-06T22:09:04 | 2015-09-13T03:46:05 | 2016-03-28T04:23:49 | 2017-05-06T22:09:04 | 207 | 0 | 0 | 0 |
Java
| null | null |
package Code;
import java.util.ArrayList;
public class Trie
{
Node head = new Node();
public Trie()
{
System.out.println("Trie created");
}
public void insert(String s, Node head)
{
Node temp = head;
for(int i=0;i < s.length();i++)
{
System.out.println("Current node is" +temp.data);
//System.out.println("Current nodes data is : "+temp.next.toString());
char ch = s.charAt(i);
System.out.println("Current character is: "+ch);
if(temp.next.size() > 0)
{
System.out.println(temp.next.toString());
for(Node n : temp.next)
{
if(n.data == ch)
{
temp = n;
continue;
}
}
Node newNode = new Node(ch);
temp.next.add(newNode);
temp = newNode;
}
else
{
Node newNode = new Node(ch);
temp.next.add(newNode);
temp = newNode;
}
}
completePrint(this.head, 1);
}
public void completePrint(Node root, int level)
{
if(root == null)
{
return;
}
else
{
System.out.println(root.data+ "\t" + level);
for(Node n : root.next)
{
completePrint(n, level +1);
}
}
}
public boolean exists(String s)
{
System.out.println("SEARCHING!");
Node temp = head;
for(int i=0;i < s.length();i++)
{
System.out.println("The value if i is: "+i);
System.out.println("Current Node is: "+ temp.data);
System.out.println("Current Node's data is: "+ temp.next.toString());
char ch = s.charAt(i);
System.out.println("Current char is: "+ch);
if(temp.next != null)
{
System.out.println("Inside if loop");
for(Node n : temp.next)
{
System.out.println("Inside for loop");
if(n.data == ch)
{
System.out.println("Inside second if loop");
System.out.println("N data "+n.data);
temp = n;
continue;
}
}
}
}
return true;
}
private static class Node
{
ArrayList<Node> next = new ArrayList<Node>();
char data;
Node(char ch)
{
this.data = ch;
}
public String toString()
{
return ""+this.data;
}
public Node()
{
}
}
public static void main(String[] args)
{
Trie obj = new Trie();
obj.insert("abcd",obj.head);
System.out.println(obj.exists("abcd"));
}
}
|
UTF-8
|
Java
| 2,335 |
java
|
Trie.java
|
Java
|
[] | null |
[] |
package Code;
import java.util.ArrayList;
public class Trie
{
Node head = new Node();
public Trie()
{
System.out.println("Trie created");
}
public void insert(String s, Node head)
{
Node temp = head;
for(int i=0;i < s.length();i++)
{
System.out.println("Current node is" +temp.data);
//System.out.println("Current nodes data is : "+temp.next.toString());
char ch = s.charAt(i);
System.out.println("Current character is: "+ch);
if(temp.next.size() > 0)
{
System.out.println(temp.next.toString());
for(Node n : temp.next)
{
if(n.data == ch)
{
temp = n;
continue;
}
}
Node newNode = new Node(ch);
temp.next.add(newNode);
temp = newNode;
}
else
{
Node newNode = new Node(ch);
temp.next.add(newNode);
temp = newNode;
}
}
completePrint(this.head, 1);
}
public void completePrint(Node root, int level)
{
if(root == null)
{
return;
}
else
{
System.out.println(root.data+ "\t" + level);
for(Node n : root.next)
{
completePrint(n, level +1);
}
}
}
public boolean exists(String s)
{
System.out.println("SEARCHING!");
Node temp = head;
for(int i=0;i < s.length();i++)
{
System.out.println("The value if i is: "+i);
System.out.println("Current Node is: "+ temp.data);
System.out.println("Current Node's data is: "+ temp.next.toString());
char ch = s.charAt(i);
System.out.println("Current char is: "+ch);
if(temp.next != null)
{
System.out.println("Inside if loop");
for(Node n : temp.next)
{
System.out.println("Inside for loop");
if(n.data == ch)
{
System.out.println("Inside second if loop");
System.out.println("N data "+n.data);
temp = n;
continue;
}
}
}
}
return true;
}
private static class Node
{
ArrayList<Node> next = new ArrayList<Node>();
char data;
Node(char ch)
{
this.data = ch;
}
public String toString()
{
return ""+this.data;
}
public Node()
{
}
}
public static void main(String[] args)
{
Trie obj = new Trie();
obj.insert("abcd",obj.head);
System.out.println(obj.exists("abcd"));
}
}
| 2,335 | 0.545182 | 0.543041 | 125 | 16.68 | 17.086884 | 73 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.816 | false | false |
1
|
c16f6a2ab839827b46691b53231b3d6ca5b3cb0b
| 16,192,026,715,059 |
ba992c92de46cb1913657bf9f3939ff23e1bcbc5
|
/Starting Codes/helloWorld/src/com/comviva/day3/ListEx03.java
|
ced583ec9b05bfe2588aa0df538b704d4b371fca
|
[] |
no_license
|
iammurtaza/JavaComvivaTraining
|
https://github.com/iammurtaza/JavaComvivaTraining
|
aabf46c55bc06d6fb960283ce814fd6e18f254ce
|
21088f438c86619d7303e8198a4cd5f38b293cec
|
refs/heads/master
| 2020-03-25T16:08:17.058000 | 2018-08-26T14:12:50 | 2018-08-26T14:12:50 | 143,916,555 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.comviva.day3;
import java.util.Vector;
public class ListEx03 {
public static void main(String[] args) {
Vector<String> list = new Vector<>(2,11);
System.out.println(list.size());
System.out.println(list.capacity());
list.add("dasdasdasd");
list.add("dasdasdasd");
list.add("dasdasdasd");
list.add("dasdasdasd");
list.add("dasdasdasd");
list.add("dasdasdasd");
list.add("dasdasdasd");
list.add("dasdasdasd");
list.add("dasdasdasd");
list.add("dasdasdasd");
list.add("dasdasdasd");
list.add("dasdasdasd");
System.out.println(list.size());
System.out.println(list.capacity());
}
}
|
UTF-8
|
Java
| 634 |
java
|
ListEx03.java
|
Java
|
[] | null |
[] |
package com.comviva.day3;
import java.util.Vector;
public class ListEx03 {
public static void main(String[] args) {
Vector<String> list = new Vector<>(2,11);
System.out.println(list.size());
System.out.println(list.capacity());
list.add("dasdasdasd");
list.add("dasdasdasd");
list.add("dasdasdasd");
list.add("dasdasdasd");
list.add("dasdasdasd");
list.add("dasdasdasd");
list.add("dasdasdasd");
list.add("dasdasdasd");
list.add("dasdasdasd");
list.add("dasdasdasd");
list.add("dasdasdasd");
list.add("dasdasdasd");
System.out.println(list.size());
System.out.println(list.capacity());
}
}
| 634 | 0.671924 | 0.662461 | 27 | 22.481482 | 12.658976 | 43 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.222222 | false | false |
1
|
c0a3c682f79f54886683c71ed42f0ca3aa1c24fc
| 3,478,923,579,178 |
964b61e5459ed193d2028e3d486735592a6e612c
|
/src/main/java/com/bi/mail/TvPlayDailyReport.java
|
542029550065c676159f59970f47027678c09851
|
[] |
no_license
|
jeremy0822/fun-bi-web
|
https://github.com/jeremy0822/fun-bi-web
|
e92bb53dd95773408363ef6d775b4fcba7683a07
|
f56b9c8652fa7824c69abb58a69894e3847b222e
|
refs/heads/master
| 2016-08-10T18:15:04.354000 | 2016-04-01T10:53:54 | 2016-04-01T10:53:54 | 55,124,093 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.bi.mail;
import java.awt.Color;
import java.text.DecimalFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang.time.DateUtils;
import org.jfree.chart.JFreeChart;
import org.jfree.data.category.DefaultCategoryDataset;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.base.util.DateUtil;
import com.base.util.NumberUtil;
import com.bi.entity.mobile.KpiData;
import com.bi.job.GenerateHtmlPlatData;
import com.bi.job.SendHtmlData;
import com.bi.page.mobile.KpiDataPage;
import com.bi.service.mobile.KpiDataService;
/**
* @author jeremy
* @date 2016年2月1日
* @desc
*/
@Service("tvPlayDailyReport")
public class TvPlayDailyReport {
@Autowired(required = false)
MailSender mailSender;
@Autowired(required = false)
private KpiDataService<KpiData> kpiDataService;
@Autowired(required = false)
private GenerateHtmlPlatData generateHtmlPlatData;
private String url = "http://bi.funshion.com/";
// private String url = "http://localhost:8080/fun-bi-web/";
public void doIt() throws Exception {
String date = DateUtil.getFomartDate(DateUtils.addDays(new Date(), -1), "yyyy-MM-dd");
String content = getEmailMsg(date);
date = DateUtil.getFomartDate(DateUtils.addDays(new Date(), -1), "yyyy年MM月dd日");
String title = "电视日报(" + date + ")";
String mailto = mailSender.getMailTo(this.getClass().getSimpleName());
// String mailto = "huangbin@fun.tv";
mailSender.sendMail(mailto, title, content, null, null);
}
public String getEmailMsg(String date_id) throws Exception {
String startDate = DateUtil.getFomartDate(DateUtils.addDays(new Date(), -1), "yyyy-MM-dd");
String endDate = DateUtil.getFomartDate(DateUtils.addDays(new Date(), -1), "yyyy-MM-dd");
KpiDataPage page = new KpiDataPage();
page.setPlatId(12);
page.setStartDate(startDate);
page.setEndDate(endDate);
List<KpiData> dataList = kpiDataService.queryList(page);
List<KpiData> dataChannelList = kpiDataService.queryChannelList(page);
StringBuilder content = new StringBuilder();
// html
buildHtmlContent(content, dataList, dataChannelList);
return content.toString();
}
private void buildHtmlContent(StringBuilder content, List<KpiData> dataList, List<KpiData> dataChannelList) {
content.append("<meta http-equiv='content-type' content='text/html; charset=utf-8'>");
content.append("<html><title>电视播放日报</title>");
content.append("<body>");
String date = DateUtil.getFomartDate(DateUtils.addDays(new Date(), -1), "yyyy-MM-dd");
String h = "电视日报(" + date.substring(0, 4) + "年" + date.substring(5, 7) + "月" + date.substring(8, 10) + "日)";
content.append("<h2>" + h + "</h2>");
content.append("<br>");
content.append("<h>电视核心指标</h>");
content.append("<table border='1' width='600'>");
content.append("<tr>");
content.append("<td width='20%'>指标</td>").append("<td width='16%'>昨日数量</td>").append("<td width='16%'>较前一日</td>").append("<td width='16%'>日环比</td>")
.append("<td width='16%'>较上周同期</td>").append("<td width='16%'>周同比</td>");
content.append("</tr>");
for (KpiData kd : dataList) {
content.append("<tr>").append("<td width='20%'>").append(kd.getKpiName()).append("</td>");
if (kd.getKpiId() == 4) {
content.append("<td width='16%'>").append(NumberUtil.setScale(kd.getKpiCount() * 100, 2) + "%").append("</td>");
} else {
content.append("<td width='16%'>").append(new DecimalFormat(",###").format(kd.getKpiCount())).append("</td>");
}
if (kd.getPreCount() > 0) {
content.append("<td width='16%' style='background-color:rgb(230,184,183);'>").append(new DecimalFormat(",###").format(kd.getPreCount())).append("</td>")
.append("<td width='16%' style='background-color:rgb(230,184,183);'>")
.append(NumberUtil.setScale(kd.getPreRate() * 100, 2) + "%").append("</td>");
} else {
content.append("<td width='16%' style='background-color:rgb(216,228,188);'>").append(new DecimalFormat(",###").format(kd.getPreCount())).append("</td>")
.append("<td width='16%' style='background-color:rgb(216,228,188);'>")
.append(NumberUtil.setScale(kd.getPreRate() * 100, 2) + "%").append("</td>");
}
if (kd.getWeekCount() > 0) {
content.append("<td width='16%' style='background-color:rgb(230,184,183);'>").append(new DecimalFormat(",###").format(kd.getWeekCount())).append("</td>")
.append("<td width='16%' style='background-color:rgb(230,184,183);'>")
.append(NumberUtil.setScale(kd.getWeekRate() * 100, 2) + "%").append("</td>");
} else {
content.append("<td width='16%' style='background-color:rgb(216,228,188);'>").append(new DecimalFormat(",###").format(kd.getWeekCount())).append("</td>")
.append("<td width='16%' style='background-color:rgb(216,228,188);'>")
.append(NumberUtil.setScale(kd.getWeekRate() * 100, 2) + "%").append("</td>");
}
content.append("</tr>");
}
content.append("</table>");
content.append("<br>");
content.append("<h>电视分频道播放数</h>");
content.append("<table border='1' width='600'>");
content.append("<tr>");
content.append("<td width='20%'>频道</td>").append("<td width='16%'>昨日数量</td>").append("<td width='16%'>较前一日</td>").append("<td width='16%'>日环比</td>")
.append("<td width='16%'>较上周同期</td>").append("<td width='16%'>周同比</td>");
content.append("</tr>");
for (KpiData kd : dataChannelList) {
content.append("<tr>").append("<td width='20%'>").append(kd.getKpiName()).append("</td>");
content.append("<td>").append(new DecimalFormat(",###").format(kd.getKpiCount())).append("</td>");
if (kd.getPreCount() > 0) {
content.append("<td width='16%' style='background-color:rgb(230,184,183);'>").append(new DecimalFormat(",###").format(kd.getPreCount())).append("</td>")
.append("<td width='16%' style='background-color:rgb(230,184,183);'>")
.append(NumberUtil.setScale(kd.getPreRate() * 100, 2) + "%").append("</td>");
} else {
content.append("<td width='16%' style='background-color:rgb(216,228,188);'>").append(new DecimalFormat(",###").format(kd.getPreCount())).append("</td>")
.append("<td width='16%' style='background-color:rgb(216,228,188);'>")
.append(NumberUtil.setScale(kd.getPreRate() * 100, 2) + "%").append("</td>");
}
if (kd.getWeekCount() > 0) {
content.append("<td width='16%' style='background-color:rgb(230,184,183);'>").append(new DecimalFormat(",###").format(kd.getWeekCount())).append("</td>")
.append("<td width='16%' style='background-color:rgb(230,184,183);'>")
.append(NumberUtil.setScale(kd.getWeekRate() * 100, 2) + "%").append("</td>");
} else {
content.append("<td width='16%' style='background-color:rgb(216,228,188);'>").append(new DecimalFormat(",###").format(kd.getWeekCount())).append("</td>")
.append("<td width='16%' style='background-color:rgb(216,228,188);'>")
.append(NumberUtil.setScale(kd.getWeekRate() * 100, 2) + "%").append("</td>");
}
content.append("</tr>");
}
content.append("</table>");
content.append("<br>");
content.append(buildImageContent());
content.append("</body>");
content.append("</html>");
}
private String buildImageContent() {
String imgPath = SendHtmlData.class.getClassLoader().getResource("").getPath();
imgPath = imgPath.split("WEB-INF")[0] + "images/";
JFreeChart jfreechart = generateHtmlPlatData.createChart(createDataset(), "30天UV、VV趋势图","千", Color.yellow,Color.white,Color.black);
generateHtmlPlatData.saveAsFile(jfreechart, imgPath + "tv.png", 800, 400);
StringBuilder imgContent = new StringBuilder();
imgContent.append("<br>").append("<i><img src='" + url + "images/tv.png'></i>");
return imgContent.toString();
}
public DefaultCategoryDataset createDataset() {
DefaultCategoryDataset linedataset = new DefaultCategoryDataset();
String startDate = DateUtil.getFomartDate(DateUtils.addDays(new Date(), -30), "yyyy-MM-dd");
String endDate = DateUtil.getFomartDate(DateUtils.addDays(new Date(), -1), "yyyy-MM-dd");
// 各曲线名称
String series1 = "UV";
Map<String, Object> map = new HashMap<String, Object>();
map.put("startDate", startDate);
map.put("endDate", endDate);
map.put("platId", 12);
map.put("kpiId", 2);
List<KpiData> dataList = kpiDataService.queryList(map);
if (dataList != null && dataList.size() > 0) {
for (KpiData kpi : dataList) {
linedataset.addValue(kpi.getKpiCount() / 1000, series1, kpi.getDate());
}
}
series1 = "VV";
map.put("kpiId", 5);
List<KpiData> dataList1 = kpiDataService.queryList(map);
if (dataList1 != null && dataList1.size() > 0) {
for (KpiData kpi : dataList1) {
linedataset.addValue(kpi.getKpiCount() / 1000, series1, kpi.getDate());
}
}
return linedataset;
}
public static void main(String[] args) {
String imgPath = SendHtmlData.class.getClassLoader().getResource("").getPath();
imgPath = imgPath + "images/";
System.out.println(imgPath);
}
}
|
UTF-8
|
Java
| 9,144 |
java
|
TvPlayDailyReport.java
|
Java
|
[
{
"context": ".bi.service.mobile.KpiDataService;\n\n/**\n * @author jeremy\n * @date 2016年2月1日\n * @desc\n */\n@Service(\"tvPlayD",
"end": 699,
"score": 0.9944135546684265,
"start": 693,
"tag": "USERNAME",
"value": "jeremy"
},
{
"context": "getClass().getSimpleName());\n//\t\tString mailto = \"huangbin@fun.tv\";\n\t\tmailSender.sendMail(mailto, title, content, n",
"end": 1522,
"score": 0.9999252557754517,
"start": 1507,
"tag": "EMAIL",
"value": "huangbin@fun.tv"
}
] | null |
[] |
package com.bi.mail;
import java.awt.Color;
import java.text.DecimalFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang.time.DateUtils;
import org.jfree.chart.JFreeChart;
import org.jfree.data.category.DefaultCategoryDataset;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.base.util.DateUtil;
import com.base.util.NumberUtil;
import com.bi.entity.mobile.KpiData;
import com.bi.job.GenerateHtmlPlatData;
import com.bi.job.SendHtmlData;
import com.bi.page.mobile.KpiDataPage;
import com.bi.service.mobile.KpiDataService;
/**
* @author jeremy
* @date 2016年2月1日
* @desc
*/
@Service("tvPlayDailyReport")
public class TvPlayDailyReport {
@Autowired(required = false)
MailSender mailSender;
@Autowired(required = false)
private KpiDataService<KpiData> kpiDataService;
@Autowired(required = false)
private GenerateHtmlPlatData generateHtmlPlatData;
private String url = "http://bi.funshion.com/";
// private String url = "http://localhost:8080/fun-bi-web/";
public void doIt() throws Exception {
String date = DateUtil.getFomartDate(DateUtils.addDays(new Date(), -1), "yyyy-MM-dd");
String content = getEmailMsg(date);
date = DateUtil.getFomartDate(DateUtils.addDays(new Date(), -1), "yyyy年MM月dd日");
String title = "电视日报(" + date + ")";
String mailto = mailSender.getMailTo(this.getClass().getSimpleName());
// String mailto = "<EMAIL>";
mailSender.sendMail(mailto, title, content, null, null);
}
public String getEmailMsg(String date_id) throws Exception {
String startDate = DateUtil.getFomartDate(DateUtils.addDays(new Date(), -1), "yyyy-MM-dd");
String endDate = DateUtil.getFomartDate(DateUtils.addDays(new Date(), -1), "yyyy-MM-dd");
KpiDataPage page = new KpiDataPage();
page.setPlatId(12);
page.setStartDate(startDate);
page.setEndDate(endDate);
List<KpiData> dataList = kpiDataService.queryList(page);
List<KpiData> dataChannelList = kpiDataService.queryChannelList(page);
StringBuilder content = new StringBuilder();
// html
buildHtmlContent(content, dataList, dataChannelList);
return content.toString();
}
private void buildHtmlContent(StringBuilder content, List<KpiData> dataList, List<KpiData> dataChannelList) {
content.append("<meta http-equiv='content-type' content='text/html; charset=utf-8'>");
content.append("<html><title>电视播放日报</title>");
content.append("<body>");
String date = DateUtil.getFomartDate(DateUtils.addDays(new Date(), -1), "yyyy-MM-dd");
String h = "电视日报(" + date.substring(0, 4) + "年" + date.substring(5, 7) + "月" + date.substring(8, 10) + "日)";
content.append("<h2>" + h + "</h2>");
content.append("<br>");
content.append("<h>电视核心指标</h>");
content.append("<table border='1' width='600'>");
content.append("<tr>");
content.append("<td width='20%'>指标</td>").append("<td width='16%'>昨日数量</td>").append("<td width='16%'>较前一日</td>").append("<td width='16%'>日环比</td>")
.append("<td width='16%'>较上周同期</td>").append("<td width='16%'>周同比</td>");
content.append("</tr>");
for (KpiData kd : dataList) {
content.append("<tr>").append("<td width='20%'>").append(kd.getKpiName()).append("</td>");
if (kd.getKpiId() == 4) {
content.append("<td width='16%'>").append(NumberUtil.setScale(kd.getKpiCount() * 100, 2) + "%").append("</td>");
} else {
content.append("<td width='16%'>").append(new DecimalFormat(",###").format(kd.getKpiCount())).append("</td>");
}
if (kd.getPreCount() > 0) {
content.append("<td width='16%' style='background-color:rgb(230,184,183);'>").append(new DecimalFormat(",###").format(kd.getPreCount())).append("</td>")
.append("<td width='16%' style='background-color:rgb(230,184,183);'>")
.append(NumberUtil.setScale(kd.getPreRate() * 100, 2) + "%").append("</td>");
} else {
content.append("<td width='16%' style='background-color:rgb(216,228,188);'>").append(new DecimalFormat(",###").format(kd.getPreCount())).append("</td>")
.append("<td width='16%' style='background-color:rgb(216,228,188);'>")
.append(NumberUtil.setScale(kd.getPreRate() * 100, 2) + "%").append("</td>");
}
if (kd.getWeekCount() > 0) {
content.append("<td width='16%' style='background-color:rgb(230,184,183);'>").append(new DecimalFormat(",###").format(kd.getWeekCount())).append("</td>")
.append("<td width='16%' style='background-color:rgb(230,184,183);'>")
.append(NumberUtil.setScale(kd.getWeekRate() * 100, 2) + "%").append("</td>");
} else {
content.append("<td width='16%' style='background-color:rgb(216,228,188);'>").append(new DecimalFormat(",###").format(kd.getWeekCount())).append("</td>")
.append("<td width='16%' style='background-color:rgb(216,228,188);'>")
.append(NumberUtil.setScale(kd.getWeekRate() * 100, 2) + "%").append("</td>");
}
content.append("</tr>");
}
content.append("</table>");
content.append("<br>");
content.append("<h>电视分频道播放数</h>");
content.append("<table border='1' width='600'>");
content.append("<tr>");
content.append("<td width='20%'>频道</td>").append("<td width='16%'>昨日数量</td>").append("<td width='16%'>较前一日</td>").append("<td width='16%'>日环比</td>")
.append("<td width='16%'>较上周同期</td>").append("<td width='16%'>周同比</td>");
content.append("</tr>");
for (KpiData kd : dataChannelList) {
content.append("<tr>").append("<td width='20%'>").append(kd.getKpiName()).append("</td>");
content.append("<td>").append(new DecimalFormat(",###").format(kd.getKpiCount())).append("</td>");
if (kd.getPreCount() > 0) {
content.append("<td width='16%' style='background-color:rgb(230,184,183);'>").append(new DecimalFormat(",###").format(kd.getPreCount())).append("</td>")
.append("<td width='16%' style='background-color:rgb(230,184,183);'>")
.append(NumberUtil.setScale(kd.getPreRate() * 100, 2) + "%").append("</td>");
} else {
content.append("<td width='16%' style='background-color:rgb(216,228,188);'>").append(new DecimalFormat(",###").format(kd.getPreCount())).append("</td>")
.append("<td width='16%' style='background-color:rgb(216,228,188);'>")
.append(NumberUtil.setScale(kd.getPreRate() * 100, 2) + "%").append("</td>");
}
if (kd.getWeekCount() > 0) {
content.append("<td width='16%' style='background-color:rgb(230,184,183);'>").append(new DecimalFormat(",###").format(kd.getWeekCount())).append("</td>")
.append("<td width='16%' style='background-color:rgb(230,184,183);'>")
.append(NumberUtil.setScale(kd.getWeekRate() * 100, 2) + "%").append("</td>");
} else {
content.append("<td width='16%' style='background-color:rgb(216,228,188);'>").append(new DecimalFormat(",###").format(kd.getWeekCount())).append("</td>")
.append("<td width='16%' style='background-color:rgb(216,228,188);'>")
.append(NumberUtil.setScale(kd.getWeekRate() * 100, 2) + "%").append("</td>");
}
content.append("</tr>");
}
content.append("</table>");
content.append("<br>");
content.append(buildImageContent());
content.append("</body>");
content.append("</html>");
}
private String buildImageContent() {
String imgPath = SendHtmlData.class.getClassLoader().getResource("").getPath();
imgPath = imgPath.split("WEB-INF")[0] + "images/";
JFreeChart jfreechart = generateHtmlPlatData.createChart(createDataset(), "30天UV、VV趋势图","千", Color.yellow,Color.white,Color.black);
generateHtmlPlatData.saveAsFile(jfreechart, imgPath + "tv.png", 800, 400);
StringBuilder imgContent = new StringBuilder();
imgContent.append("<br>").append("<i><img src='" + url + "images/tv.png'></i>");
return imgContent.toString();
}
public DefaultCategoryDataset createDataset() {
DefaultCategoryDataset linedataset = new DefaultCategoryDataset();
String startDate = DateUtil.getFomartDate(DateUtils.addDays(new Date(), -30), "yyyy-MM-dd");
String endDate = DateUtil.getFomartDate(DateUtils.addDays(new Date(), -1), "yyyy-MM-dd");
// 各曲线名称
String series1 = "UV";
Map<String, Object> map = new HashMap<String, Object>();
map.put("startDate", startDate);
map.put("endDate", endDate);
map.put("platId", 12);
map.put("kpiId", 2);
List<KpiData> dataList = kpiDataService.queryList(map);
if (dataList != null && dataList.size() > 0) {
for (KpiData kpi : dataList) {
linedataset.addValue(kpi.getKpiCount() / 1000, series1, kpi.getDate());
}
}
series1 = "VV";
map.put("kpiId", 5);
List<KpiData> dataList1 = kpiDataService.queryList(map);
if (dataList1 != null && dataList1.size() > 0) {
for (KpiData kpi : dataList1) {
linedataset.addValue(kpi.getKpiCount() / 1000, series1, kpi.getDate());
}
}
return linedataset;
}
public static void main(String[] args) {
String imgPath = SendHtmlData.class.getClassLoader().getResource("").getPath();
imgPath = imgPath + "images/";
System.out.println(imgPath);
}
}
| 9,136 | 0.662539 | 0.627064 | 191 | 45.931938 | 39.418026 | 157 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.219895 | false | false |
1
|
cb9442264edea3b4062a3528fbe0f295c139eab0
| 18,519,899,028,939 |
e3f913fc7a89d75429803a5c6aa063dc95cb4cb3
|
/springdemo/src/main/java/com/demo/test/demo/BeanE.java
|
982833f7bca95a014292c698cd6ff881ab900524
|
[] |
no_license
|
alongsea2/java
|
https://github.com/alongsea2/java
|
1d0adcd71159237395eaac102cbecc547c5cad42
|
da3543ad3d3a5c0beff51bdb9ee916a0b105a986
|
refs/heads/master
| 2021-01-24T08:56:17.198000 | 2020-11-27T10:45:23 | 2020-11-27T10:45:23 | 69,797,267 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.demo.test.demo;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
public class BeanE implements BeanFactoryPostProcessor{
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
try {
BeanB beanB = (BeanB) beanFactory.getBean("beanB");
System.out.println(beanB);
}catch (Exception e){
}
}
}
|
UTF-8
|
Java
| 581 |
java
|
BeanE.java
|
Java
|
[] | null |
[] |
package com.demo.test.demo;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
public class BeanE implements BeanFactoryPostProcessor{
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
try {
BeanB beanB = (BeanB) beanFactory.getBean("beanB");
System.out.println(beanB);
}catch (Exception e){
}
}
}
| 581 | 0.745267 | 0.745267 | 20 | 28.049999 | 31.779671 | 107 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.3 | false | false |
1
|
369f67a9c549647ea0de69ec232b8a1e6a3ef53b
| 33,818,572,507,741 |
c18f8db4c2f98ee103a0f929a6d4a5834d2f46b8
|
/src/test/java/com/ctlts/wfaas/data/orchestrate/config/EnableOrchestrateRepositoriesTest.java
|
17d8e09feae7e32369723a6df2b0d1f620487431
|
[] |
no_license
|
CenturyLinkCloud/clc-adapter-orchestrate
|
https://github.com/CenturyLinkCloud/clc-adapter-orchestrate
|
eddea09029dec690dcef2bb131a5043e604f8b3e
|
3ae1e3f67e6571060555dd5778f5cf44690db57b
|
refs/heads/master
| 2021-01-17T13:29:32.423000 | 2016-01-18T14:48:17 | 2016-01-18T14:48:17 | 39,198,730 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/**
*
* Copyright 2015 CenturyLink
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.ctlts.wfaas.data.orchestrate.config;
import static org.junit.Assert.*;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.ctlts.wfaas.data.orchestrate.config.EnableOrchestrateRepositories;
import com.ctlts.wfaas.data.orchestrate.repository.OrchestrateTemplate;
import com.ctlts.wfaas.data.orchestrate.repository.TestEntityRespository;
/**
* @author mramach
*
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration
public class EnableOrchestrateRepositoriesTest {
@Autowired
private TestEntityRespository repository;
@Test
public void testRepositoryConfigured() {
assertNotNull("Checking that the repository was created and injected.", repository);
}
@Configuration
@EnableOrchestrateRepositories("com.ctlts.wfaas.data.orchestrate.repository")
public static class TestConfig {
@Bean
public OrchestrateTemplate orchestrateTemplate() {
OrchestrateTemplate template = new OrchestrateTemplate();
template.setEndpoint("http://localhost:5124");
template.setPort(5124);
template.setUseSSL(false);
template.setApiKey("OUR-API-KEY");
return template;
}
}
}
|
UTF-8
|
Java
| 2,204 |
java
|
EnableOrchestrateRepositoriesTest.java
|
Java
|
[
{
"context": ".repository.TestEntityRespository;\n\n/**\n * @author mramach\n *\n */\n@RunWith(SpringJUnit4ClassRunner.class)\n@C",
"end": 1288,
"score": 0.9994150996208191,
"start": 1281,
"tag": "USERNAME",
"value": "mramach"
}
] | null |
[] |
/**
*
* Copyright 2015 CenturyLink
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.ctlts.wfaas.data.orchestrate.config;
import static org.junit.Assert.*;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.ctlts.wfaas.data.orchestrate.config.EnableOrchestrateRepositories;
import com.ctlts.wfaas.data.orchestrate.repository.OrchestrateTemplate;
import com.ctlts.wfaas.data.orchestrate.repository.TestEntityRespository;
/**
* @author mramach
*
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration
public class EnableOrchestrateRepositoriesTest {
@Autowired
private TestEntityRespository repository;
@Test
public void testRepositoryConfigured() {
assertNotNull("Checking that the repository was created and injected.", repository);
}
@Configuration
@EnableOrchestrateRepositories("com.ctlts.wfaas.data.orchestrate.repository")
public static class TestConfig {
@Bean
public OrchestrateTemplate orchestrateTemplate() {
OrchestrateTemplate template = new OrchestrateTemplate();
template.setEndpoint("http://localhost:5124");
template.setPort(5124);
template.setUseSSL(false);
template.setApiKey("OUR-API-KEY");
return template;
}
}
}
| 2,204 | 0.730036 | 0.721416 | 68 | 31.411764 | 27.16466 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.382353 | false | false |
1
|
9c911f6da67667be03d9e0cdcad0067bac57b2a1
| 24,687,472,062,052 |
200f23c6605d8be38c25eb37b12d0e90d041d66d
|
/admin-control/src/main/java/com/icloud/model/questions/AnswerRecord.java
|
155ea2a3454a5a0d17cb80c89e93832171963e64
|
[] |
no_license
|
jack06/javaProject
|
https://github.com/jack06/javaProject
|
01539b0857c8034cc7e1653e1f11179cff42eeb8
|
6e1184040e1f328024ff7f960a3d7161455c7d9f
|
refs/heads/master
| 2020-05-19T12:04:53.413000 | 2017-06-02T08:33:47 | 2017-06-02T08:33:47 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.icloud.model.questions;
import java.util.Date;
public class AnswerRecord {
private String id;
private String nick;
private String wxHeadImg;
private Date createDate;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getNick() {
return nick;
}
public void setNick(String nick) {
this.nick = nick;
}
public String getWxHeadImg() {
return wxHeadImg;
}
public void setWxHeadImg(String wxHeadImg) {
this.wxHeadImg = wxHeadImg;
}
public Date getCreateDate() {
return createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
}
|
UTF-8
|
Java
| 682 |
java
|
AnswerRecord.java
|
Java
|
[] | null |
[] |
package com.icloud.model.questions;
import java.util.Date;
public class AnswerRecord {
private String id;
private String nick;
private String wxHeadImg;
private Date createDate;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getNick() {
return nick;
}
public void setNick(String nick) {
this.nick = nick;
}
public String getWxHeadImg() {
return wxHeadImg;
}
public void setWxHeadImg(String wxHeadImg) {
this.wxHeadImg = wxHeadImg;
}
public Date getCreateDate() {
return createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
}
| 682 | 0.686217 | 0.686217 | 47 | 13.510638 | 14.084657 | 45 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false |
1
|
4452c8d82cd194b93215e73220316a80131a6ca0
| 36,026,185,685,683 |
afc7148081f7171dbe854ef5eab15340427c3e97
|
/src/test/java/com/cocoker/service/impl/OrderServiceImplTest.java
|
bc5dfc0b2f2ee6f02c4de9e2c3a71291afe63d68
|
[] |
no_license
|
renhuiyong/cocoker
|
https://github.com/renhuiyong/cocoker
|
7aaa74d9d14c041e58f454b5cedfbf6148cf88d2
|
e3bdec0f1c814ad0de4f2dc3133c985f3d7ff5f1
|
refs/heads/master
| 2022-06-29T21:31:54.915000 | 2019-12-17T08:05:40 | 2019-12-17T08:05:40 | 167,325,477 | 4 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.cocoker.service.impl;
import com.cocoker.service.OrderService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
/**
* @Description:
* @Author: y
* @CreateDate: 2018/12/29 10:11 PM
* @Version: 1.0
*/
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class OrderServiceImplTest {
@Autowired
private OrderService orderService;
@Test
public void findAllOrder() throws Exception {
}
@Test
public void addOrder() throws Exception {
// orderService.addOrder("inc","1111","30","ooooo","");
}
}
|
UTF-8
|
Java
| 800 |
java
|
OrderServiceImplTest.java
|
Java
|
[
{
"context": "t4.SpringRunner;\n\n/**\n * @Description:\n * @Author: y\n * @CreateDate: 2018/12/29 10:11 PM\n * @Version: ",
"end": 352,
"score": 0.9645073413848877,
"start": 351,
"tag": "USERNAME",
"value": "y"
}
] | null |
[] |
package com.cocoker.service.impl;
import com.cocoker.service.OrderService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
/**
* @Description:
* @Author: y
* @CreateDate: 2018/12/29 10:11 PM
* @Version: 1.0
*/
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class OrderServiceImplTest {
@Autowired
private OrderService orderService;
@Test
public void findAllOrder() throws Exception {
}
@Test
public void addOrder() throws Exception {
// orderService.addOrder("inc","1111","30","ooooo","");
}
}
| 800 | 0.74125 | 0.715 | 31 | 24.838709 | 22.573317 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.419355 | false | false |
1
|
869115428dfb8d4bd09f2d863608e776fc514920
| 35,244,501,656,894 |
29bf67f8614660978848eaa03d9dcbabb8bd5468
|
/codingTest/src/codility/countingElements/TestSkTechX.java
|
77e5d389f9a7923b930b7110ebadfbe5c98dd9f4
|
[] |
no_license
|
SungJaeCho/problem
|
https://github.com/SungJaeCho/problem
|
9100ce9504a6dd9036a74f3e400a32c1e59e3715
|
be00af7b1795da5fda940af9628eb510842508b7
|
refs/heads/master
| 2021-05-02T14:56:21.109000 | 2018-07-02T14:27:06 | 2018-07-02T14:27:06 | 120,728,690 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package codility.countingElements;
import java.util.Arrays;
import java.util.TreeMap;
public class TestSkTechX {
public static void main(String[] args) {
String S = "John Doe, Peter Parker, Mary Jane Watson-Parker, James Doe, John Elvis Doe, Jane Doe, Penny Parker";
String C = "Example";
String[] arrStr = S.split(",");
String[] arrTempStr = new String[arrStr.length];
String rstStr = "";
String last = "";
String first = "";
for(int i=0; i<arrStr.length; i++) {
String[] arrayStr = arrStr[i].split("\\s+");
if(i == 0) {
first = arrayStr[0].toLowerCase().replaceAll("[\\-]", "");
} else {
first = arrayStr[1].toLowerCase().replaceAll("[\\-]", "");
}
last = arrayStr[arrayStr.length-1].toLowerCase().replaceAll("[\\-]", "");
arrTempStr[i] = last + first.substring(0, 1);
// System.out.println(arrTempStr[i]);
}
TreeMap<String, Integer> map = new TreeMap<String, Integer>();
for(int i=0; i<arrTempStr.length; i++) {
if(map.containsKey(arrTempStr[i])) {
map.put(arrTempStr[i], map.get(arrTempStr[i]) + 1);
} else {
map.put(arrTempStr[i], 1);
}
int num = map.get(arrTempStr[i]);
if( num == 1) {
rstStr += arrTempStr[i] + "@" + C.toLowerCase() + ".com, ";
} else {
rstStr += arrTempStr[i] + map.get(arrTempStr[i]) + "@" + C.toLowerCase() + ".com, ";
}
}
// System.out.println(rstStr.substring(0, rstStr.length() -2));
String result = rstStr.substring(0, rstStr.length() -2);
}
}
|
UTF-8
|
Java
| 1,543 |
java
|
TestSkTechX.java
|
Java
|
[
{
"context": " static void main(String[] args) {\r\n\t\tString S = \"John Doe, Peter Parker, Mary Jane Watson-Parker, James Doe",
"end": 188,
"score": 0.9998327493667603,
"start": 180,
"tag": "NAME",
"value": "John Doe"
},
{
"context": "oid main(String[] args) {\r\n\t\tString S = \"John Doe, Peter Parker, Mary Jane Watson-Parker, James Doe, John Elvis D",
"end": 202,
"score": 0.9998283386230469,
"start": 190,
"tag": "NAME",
"value": "Peter Parker"
},
{
"context": "g[] args) {\r\n\t\tString S = \"John Doe, Peter Parker, Mary Jane Watson-Parker, James Doe, John Elvis Doe, Jane Doe, Penny Parke",
"end": 227,
"score": 0.9998679757118225,
"start": 204,
"tag": "NAME",
"value": "Mary Jane Watson-Parker"
},
{
"context": " \"John Doe, Peter Parker, Mary Jane Watson-Parker, James Doe, John Elvis Doe, Jane Doe, Penny Parker\";\r\n\t\tStri",
"end": 238,
"score": 0.9998072385787964,
"start": 229,
"tag": "NAME",
"value": "James Doe"
},
{
"context": " Peter Parker, Mary Jane Watson-Parker, James Doe, John Elvis Doe, Jane Doe, Penny Parker\";\r\n\t\tString C = \"Example\"",
"end": 254,
"score": 0.9998453259468079,
"start": 240,
"tag": "NAME",
"value": "John Elvis Doe"
},
{
"context": "ary Jane Watson-Parker, James Doe, John Elvis Doe, Jane Doe, Penny Parker\";\r\n\t\tString C = \"Example\";\r\n\r\n\t\tStr",
"end": 264,
"score": 0.9998047351837158,
"start": 256,
"tag": "NAME",
"value": "Jane Doe"
},
{
"context": "atson-Parker, James Doe, John Elvis Doe, Jane Doe, Penny Parker\";\r\n\t\tString C = \"Example\";\r\n\r\n\t\tString[] arrStr =",
"end": 278,
"score": 0.9998148679733276,
"start": 266,
"tag": "NAME",
"value": "Penny Parker"
}
] | null |
[] |
package codility.countingElements;
import java.util.Arrays;
import java.util.TreeMap;
public class TestSkTechX {
public static void main(String[] args) {
String S = "<NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>";
String C = "Example";
String[] arrStr = S.split(",");
String[] arrTempStr = new String[arrStr.length];
String rstStr = "";
String last = "";
String first = "";
for(int i=0; i<arrStr.length; i++) {
String[] arrayStr = arrStr[i].split("\\s+");
if(i == 0) {
first = arrayStr[0].toLowerCase().replaceAll("[\\-]", "");
} else {
first = arrayStr[1].toLowerCase().replaceAll("[\\-]", "");
}
last = arrayStr[arrayStr.length-1].toLowerCase().replaceAll("[\\-]", "");
arrTempStr[i] = last + first.substring(0, 1);
// System.out.println(arrTempStr[i]);
}
TreeMap<String, Integer> map = new TreeMap<String, Integer>();
for(int i=0; i<arrTempStr.length; i++) {
if(map.containsKey(arrTempStr[i])) {
map.put(arrTempStr[i], map.get(arrTempStr[i]) + 1);
} else {
map.put(arrTempStr[i], 1);
}
int num = map.get(arrTempStr[i]);
if( num == 1) {
rstStr += arrTempStr[i] + "@" + C.toLowerCase() + ".com, ";
} else {
rstStr += arrTempStr[i] + map.get(arrTempStr[i]) + "@" + C.toLowerCase() + ".com, ";
}
}
// System.out.println(rstStr.substring(0, rstStr.length() -2));
String result = rstStr.substring(0, rstStr.length() -2);
}
}
| 1,499 | 0.581983 | 0.572262 | 51 | 28.254902 | 26.586775 | 114 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.058824 | false | false |
1
|
73ef3f49eb0613e7946e082bd3a4f80b33fab627
| 38,628,935,864,493 |
0acd22e8a5f2e295652815e062015a4d434e2ffc
|
/src/cn/edu/lsu/dao/NoticeDAO.java
|
18eee2d5bc3889f2420de87a174b0d42f702c2b3
|
[] |
no_license
|
nalixu/bookstore
|
https://github.com/nalixu/bookstore
|
b6d4593dec86ed5b2024d9631b7e6c4d1cfc4913
|
b2109fe5eb6697b5e88e807e7c04517e00684aa4
|
refs/heads/master
| 2021-09-01T19:20:44.197000 | 2017-12-28T12:02:23 | 2017-12-28T12:02:23 | 115,618,498 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package cn.edu.lsu.dao;
import java.util.List;
import cn.edu.lsu.bean.Notice;
public interface NoticeDAO {
//��̨ϵͳ����ѯ���еĹ���
public List<Notice> getAllNotices();
//��̨ϵͳ����ӹ���
public int addNotice(Notice n);
//��̨ϵͳ������id���ҹ���
public Notice findNoticeById(String n_id);
//��̨ϵͳ������id�ĵ�������
public int updateNotice(Notice n);
//��̨ϵͳ������idɾ������
public int deleteNotice(String n_id);
//ǰ̨ϵͳ����ѯ������ӻ��ĵ�һ������
public Notice getRecentNotice();
}
|
UTF-8
|
Java
| 696 |
java
|
NoticeDAO.java
|
Java
|
[] | null |
[] |
package cn.edu.lsu.dao;
import java.util.List;
import cn.edu.lsu.bean.Notice;
public interface NoticeDAO {
//��̨ϵͳ����ѯ���еĹ���
public List<Notice> getAllNotices();
//��̨ϵͳ����ӹ���
public int addNotice(Notice n);
//��̨ϵͳ������id���ҹ���
public Notice findNoticeById(String n_id);
//��̨ϵͳ������id�ĵ�������
public int updateNotice(Notice n);
//��̨ϵͳ������idɾ������
public int deleteNotice(String n_id);
//ǰ̨ϵͳ����ѯ������ӻ��ĵ�һ������
public Notice getRecentNotice();
}
| 696 | 0.580645 | 0.580645 | 23 | 20.565218 | 14.814288 | 44 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.391304 | false | false |
1
|
9e7932291beb92f9232cd596a287f785a4316629
| 36,670,430,783,155 |
2e88af818b2c188c267ac1624640e87670dfde6d
|
/Server/AshesiCapMatch/src/main/java/com/stacko/capmatch/Services/EmailService.java
|
8841cabd525781dec160e045d555d055429ef088
|
[] |
no_license
|
Rahulsj2/CapMatch
|
https://github.com/Rahulsj2/CapMatch
|
339d299d211bdd2e9a1ad0241d7bf198900aa796
|
0820f4f822ff5ee3a798888b4ca5746a3c6446c9
|
refs/heads/master
| 2023-03-18T06:26:08.524000 | 2020-11-02T22:34:26 | 2020-11-02T22:34:26 | 262,300,283 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.stacko.capmatch.Services;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.stereotype.Service;
import org.springframework.ui.freemarker.FreeMarkerTemplateUtils;
import com.stacko.capmatch.Configuration.ClientRoutesConfig;
import com.stacko.capmatch.Models.User;
import com.stacko.capmatch.Security.Signup.AccountConfirmation;
import com.stacko.capmatch.Security.Signup.AccountConfirmationRepository;
import freemarker.template.Configuration;
import freemarker.template.Template;
import freemarker.template.TemplateException;
import lombok.extern.slf4j.Slf4j;
@Service
@Slf4j
public class EmailService {
@Autowired
private JavaMailSender sender;
@Autowired
private Configuration config; // Imported fromFreeMarkerTemplate
@Autowired
private ClientRoutesConfig clientRoutes;
@Autowired
private AccountConfirmationRepository accountConfirmationRepo;
// ObjectMapper jacksonObjectMapper = new ObjectMapper();
/**
*
* @param user
* @return
*/
public boolean sendAccountConfirmationEmail(User user) {
if (user == null || user.getEmail() == null) return false;
// Get Account Confirmation Details
AccountConfirmation confirmationDetails = accountConfirmationRepo.findByUser(user);
if (confirmationDetails == null) {
log.error("Could not find confirmation details for user '" + user.getEmail()
+ "while trying to send account confirmation email");
return false;
}
Map<String, Object> mailMap = new HashMap<>();
mailMap.put("confirmCode", confirmationDetails.getConfirmCode());
mailMap.put("clientBasePath", this.clientRoutes.getBasePath());
String mailSubject = "Confirm Your Account Registration";
String templateName = "verify-email-inline.ftl";
return sendMail(user, mailSubject, templateName, mailMap);
}
/**
*
* @param user
* @return
*/
public boolean sendPasswordResetEmail(User user) {
if (user == null || user.getEmail() == null) return false;
// Get Account Confirmation Details
AccountConfirmation confirmationDetails = accountConfirmationRepo.findByUser(user);
if (confirmationDetails == null) {
log.error("Could not find confirmation details for user '" + user.getEmail()
+ "while trying to send account confirmation email");
return false;
}
Map<String, Object> mailMap = new HashMap<>();
mailMap.put("confirmCode", confirmationDetails.getConfirmCode());
mailMap.put("passwordResetPage", this.clientRoutes.getResetPassword());
String mailSubject = "Reset Your Password";
String templateName = "password_reset_email_template.ftl";
return sendMail(user, mailSubject, templateName, mailMap);
}
/**
*
* @param user
* @param mailSubject
* @param templateName
* @param mailArgumentMap
* @return
*/
private boolean sendMail(User user, String mailSubject, String templateName, Map<String, Object> mailArgumentMap) {
if (user == null || user.getEmail() == null) return false;
MimeMessage email = sender.createMimeMessage();
try {
// Set MediaType
MimeMessageHelper helper = new MimeMessageHelper(email, MimeMessageHelper.MULTIPART_MODE_MIXED_RELATED,
StandardCharsets.UTF_8.name());
// // This is how to simply add an attachment to any mail
// helper.addAttachment("logo.png", new ClassPathResource("logo.png"));
Template mailTemplate = config.getTemplate(templateName);
addUserDetailsToMailMap(user, mailArgumentMap);
String html = FreeMarkerTemplateUtils.processTemplateIntoString(mailTemplate, mailArgumentMap);
helper.setTo(user.getEmail());
helper.setText(html, true);
helper.setSubject(mailSubject);
helper.setFrom("capmatch@ashesi.edu.gh");
sender.send(email);
} catch (TemplateException te) {
log.error("There was a templating error when sending email with subject '" + mailSubject + "' to '" + user.getEmail()
+ "' \t ErrorTrace: ", te.toString());
return false;
} catch(IOException ioe) {
log.error("Could not find or load template '" + templateName + "' when sending email with subject '" + mailSubject +
"' to '" + user.getEmail() + "' \t ErrorTrace: ", ioe.getMessage());
return false;
} catch (MessagingException me) {
log.error("There was a Messaging Exception when sending email with subject '" + mailSubject + "' to '" + user.getEmail()
+ "' \t ErrorTrace: ", me.toString());
return false;
}
log.info("Email with subject '" + mailSubject + "' sent to '" + user.getEmail() + "'... ");
return true;
}
private void addUserDetailsToMailMap(User user, Map<String, Object> mailMap) {
mailMap.put("firstname", user.getFirstname());
mailMap.put("lastname", user.getLastname());
mailMap.put("email", user.getEmail());
}
}
|
UTF-8
|
Java
| 5,125 |
java
|
EmailService.java
|
Java
|
[
{
"context": "elper.setSubject(mailSubject);\n\t\t\thelper.setFrom(\"capmatch@ashesi.edu.gh\");\n\t\t\t\n\t\t\tsender.send(email);\n\t\n\t\t} catch (Templa",
"end": 4063,
"score": 0.9999282956123352,
"start": 4041,
"tag": "EMAIL",
"value": "capmatch@ashesi.edu.gh"
}
] | null |
[] |
package com.stacko.capmatch.Services;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.stereotype.Service;
import org.springframework.ui.freemarker.FreeMarkerTemplateUtils;
import com.stacko.capmatch.Configuration.ClientRoutesConfig;
import com.stacko.capmatch.Models.User;
import com.stacko.capmatch.Security.Signup.AccountConfirmation;
import com.stacko.capmatch.Security.Signup.AccountConfirmationRepository;
import freemarker.template.Configuration;
import freemarker.template.Template;
import freemarker.template.TemplateException;
import lombok.extern.slf4j.Slf4j;
@Service
@Slf4j
public class EmailService {
@Autowired
private JavaMailSender sender;
@Autowired
private Configuration config; // Imported fromFreeMarkerTemplate
@Autowired
private ClientRoutesConfig clientRoutes;
@Autowired
private AccountConfirmationRepository accountConfirmationRepo;
// ObjectMapper jacksonObjectMapper = new ObjectMapper();
/**
*
* @param user
* @return
*/
public boolean sendAccountConfirmationEmail(User user) {
if (user == null || user.getEmail() == null) return false;
// Get Account Confirmation Details
AccountConfirmation confirmationDetails = accountConfirmationRepo.findByUser(user);
if (confirmationDetails == null) {
log.error("Could not find confirmation details for user '" + user.getEmail()
+ "while trying to send account confirmation email");
return false;
}
Map<String, Object> mailMap = new HashMap<>();
mailMap.put("confirmCode", confirmationDetails.getConfirmCode());
mailMap.put("clientBasePath", this.clientRoutes.getBasePath());
String mailSubject = "Confirm Your Account Registration";
String templateName = "verify-email-inline.ftl";
return sendMail(user, mailSubject, templateName, mailMap);
}
/**
*
* @param user
* @return
*/
public boolean sendPasswordResetEmail(User user) {
if (user == null || user.getEmail() == null) return false;
// Get Account Confirmation Details
AccountConfirmation confirmationDetails = accountConfirmationRepo.findByUser(user);
if (confirmationDetails == null) {
log.error("Could not find confirmation details for user '" + user.getEmail()
+ "while trying to send account confirmation email");
return false;
}
Map<String, Object> mailMap = new HashMap<>();
mailMap.put("confirmCode", confirmationDetails.getConfirmCode());
mailMap.put("passwordResetPage", this.clientRoutes.getResetPassword());
String mailSubject = "Reset Your Password";
String templateName = "password_reset_email_template.ftl";
return sendMail(user, mailSubject, templateName, mailMap);
}
/**
*
* @param user
* @param mailSubject
* @param templateName
* @param mailArgumentMap
* @return
*/
private boolean sendMail(User user, String mailSubject, String templateName, Map<String, Object> mailArgumentMap) {
if (user == null || user.getEmail() == null) return false;
MimeMessage email = sender.createMimeMessage();
try {
// Set MediaType
MimeMessageHelper helper = new MimeMessageHelper(email, MimeMessageHelper.MULTIPART_MODE_MIXED_RELATED,
StandardCharsets.UTF_8.name());
// // This is how to simply add an attachment to any mail
// helper.addAttachment("logo.png", new ClassPathResource("logo.png"));
Template mailTemplate = config.getTemplate(templateName);
addUserDetailsToMailMap(user, mailArgumentMap);
String html = FreeMarkerTemplateUtils.processTemplateIntoString(mailTemplate, mailArgumentMap);
helper.setTo(user.getEmail());
helper.setText(html, true);
helper.setSubject(mailSubject);
helper.setFrom("<EMAIL>");
sender.send(email);
} catch (TemplateException te) {
log.error("There was a templating error when sending email with subject '" + mailSubject + "' to '" + user.getEmail()
+ "' \t ErrorTrace: ", te.toString());
return false;
} catch(IOException ioe) {
log.error("Could not find or load template '" + templateName + "' when sending email with subject '" + mailSubject +
"' to '" + user.getEmail() + "' \t ErrorTrace: ", ioe.getMessage());
return false;
} catch (MessagingException me) {
log.error("There was a Messaging Exception when sending email with subject '" + mailSubject + "' to '" + user.getEmail()
+ "' \t ErrorTrace: ", me.toString());
return false;
}
log.info("Email with subject '" + mailSubject + "' sent to '" + user.getEmail() + "'... ");
return true;
}
private void addUserDetailsToMailMap(User user, Map<String, Object> mailMap) {
mailMap.put("firstname", user.getFirstname());
mailMap.put("lastname", user.getLastname());
mailMap.put("email", user.getEmail());
}
}
| 5,110 | 0.727415 | 0.726634 | 166 | 29.873493 | 30.259554 | 123 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.271084 | false | false |
1
|
864abc408c9b7d0594b1775aecd2c53a43c53c82
| 36,670,430,782,724 |
866c077366756c7f6b981d89f4e269d848380cbd
|
/app/src/main/java/com/fitnation/networking/UserLogins.java
|
8fccd3fe29ddce61b0d17b667d1d4027b6bf7372
|
[] |
no_license
|
RyanNewsom/TheFitNation-Android
|
https://github.com/RyanNewsom/TheFitNation-Android
|
0068e9a362687c2b3a4ae04592af8cc4d98fcbc7
|
c37ff146ad99d2decb80b2757cf156c8f91c2a64
|
refs/heads/master
| 2021-03-27T18:26:01.338000 | 2017-12-01T23:12:16 | 2017-12-01T23:12:16 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.fitnation.networking;
/**
* Created by Jeremy on 4/11/2017.
*
*/
public class UserLogins {
private static String userdemographicId = null;
private static String userId = null;
private static String userLogin = null;
private static UserLogins udInstance;
public synchronized static UserLogins getInstance(){
if (udInstance == null) {
udInstance = new UserLogins();
}
return udInstance;
}
public synchronized static String getUserId() {
return userId;
}
public synchronized static void setUserId(String userId) {
if(!(userId==null||userId.equals(""))) UserLogins.userId = userId;
}
public synchronized static String getUserLogin() {
return userLogin;
}
public synchronized static void setUserLogin(String userLogin) {
if(!(userLogin==null||userLogin.equals(""))){
UserLogins.userLogin = userLogin;
}
}
public synchronized static void setUserDemographicId(String id){
if(!(id==null||id.equals(""))) userdemographicId = id;
}
public synchronized static String getUserDemographicId(){
return userdemographicId;
}
private UserLogins(){}
}
|
UTF-8
|
Java
| 1,242 |
java
|
UserLogins.java
|
Java
|
[
{
"context": "kage com.fitnation.networking;\n\n\n/**\n * Created by Jeremy on 4/11/2017.\n *\n */\n\npublic class UserLogins {\n ",
"end": 60,
"score": 0.9995484352111816,
"start": 54,
"tag": "NAME",
"value": "Jeremy"
}
] | null |
[] |
package com.fitnation.networking;
/**
* Created by Jeremy on 4/11/2017.
*
*/
public class UserLogins {
private static String userdemographicId = null;
private static String userId = null;
private static String userLogin = null;
private static UserLogins udInstance;
public synchronized static UserLogins getInstance(){
if (udInstance == null) {
udInstance = new UserLogins();
}
return udInstance;
}
public synchronized static String getUserId() {
return userId;
}
public synchronized static void setUserId(String userId) {
if(!(userId==null||userId.equals(""))) UserLogins.userId = userId;
}
public synchronized static String getUserLogin() {
return userLogin;
}
public synchronized static void setUserLogin(String userLogin) {
if(!(userLogin==null||userLogin.equals(""))){
UserLogins.userLogin = userLogin;
}
}
public synchronized static void setUserDemographicId(String id){
if(!(id==null||id.equals(""))) userdemographicId = id;
}
public synchronized static String getUserDemographicId(){
return userdemographicId;
}
private UserLogins(){}
}
| 1,242 | 0.648148 | 0.642512 | 51 | 23.333334 | 23.935097 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.372549 | false | false |
1
|
6d8e4a3d4ee839e8f9c5e38ce6ee20eb69f1ba21
| 11,287,174,122,866 |
4ca5db2e0229472fb4ff440f3997c64a34f5449d
|
/src/main/java/cn/comico/data/spider/DataSpiderRunner.java
|
5c0f1fde002092decc26f13ca1cbdf203c238796
|
[] |
no_license
|
huchanghuan/data-spider
|
https://github.com/huchanghuan/data-spider
|
b843c8ad4855820c230e610258c9459a5fe36edc
|
b8aa65176cbd49aa6e54d6d26536fcd97fe84e2e
|
refs/heads/master
| 2019-03-10T00:40:35.747000 | 2017-08-25T06:29:28 | 2017-08-25T06:29:28 | 101,372,459 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package cn.comico.data.spider;
import java.util.List;
import org.apache.log4j.Logger;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import cn.comico.data.spider.db.DBHandler;
import cn.comico.data.spider.db.DBType;
import cn.comico.data.spider.model.ccmc.Dept;
import cn.comico.data.spider.model.gaite.Person;
import cn.comico.data.spider.service.IDeptService;
import cn.comico.data.spider.service.IPersonService;
import cn.comico.data.spider.util.ApplicationContextUtil;
/**
* 启动类
* @author
*
*/
public class DataSpiderRunner
{
private static final Logger log = Logger.getLogger(DataSpiderRunner.class);
@SuppressWarnings("resource")
public static void main( String[] args )
{
try {
ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("spring-application.xml");
applicationContext.start();
/////////////////////////////////
//do something start
/////////////////////////////////
log.info("start successful ~ ~");
test();
// while (true) {
// Thread.sleep(300000);
// }
} catch(Exception e) {
log.error(e.getMessage());
e.printStackTrace();
System.exit(-1);
}
}
private static void test() {
IPersonService personService = (IPersonService) ApplicationContextUtil.getBean("personService");
IDeptService deptService = (IDeptService) ApplicationContextUtil.getBean("deptService");
long startUtc = System.currentTimeMillis();
DBHandler.setDBType(DBType.gaiteDataSource);
List<Person> list = personService.findPersonListAll();
log.info(list);
// DBHandler.setDBType(DBType.ccmcDataSource);
// list.forEach(person -> {
// Dept dept = new Dept();
// dept.setId(person.getId());
// dept.setName(person.getName());
// deptService.saveOrUpdate(dept);
// });
//
// List<Dept> deptList = deptService.findDeptListAll();
// deptList.forEach(dept -> {
// System.out.println(dept.toString());
// });
long endUtc2 = System.currentTimeMillis();
log.info("耗时:" + (endUtc2 - startUtc) + "ms");
}
}
|
UTF-8
|
Java
| 2,265 |
java
|
DataSpiderRunner.java
|
Java
|
[] | null |
[] |
package cn.comico.data.spider;
import java.util.List;
import org.apache.log4j.Logger;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import cn.comico.data.spider.db.DBHandler;
import cn.comico.data.spider.db.DBType;
import cn.comico.data.spider.model.ccmc.Dept;
import cn.comico.data.spider.model.gaite.Person;
import cn.comico.data.spider.service.IDeptService;
import cn.comico.data.spider.service.IPersonService;
import cn.comico.data.spider.util.ApplicationContextUtil;
/**
* 启动类
* @author
*
*/
public class DataSpiderRunner
{
private static final Logger log = Logger.getLogger(DataSpiderRunner.class);
@SuppressWarnings("resource")
public static void main( String[] args )
{
try {
ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("spring-application.xml");
applicationContext.start();
/////////////////////////////////
//do something start
/////////////////////////////////
log.info("start successful ~ ~");
test();
// while (true) {
// Thread.sleep(300000);
// }
} catch(Exception e) {
log.error(e.getMessage());
e.printStackTrace();
System.exit(-1);
}
}
private static void test() {
IPersonService personService = (IPersonService) ApplicationContextUtil.getBean("personService");
IDeptService deptService = (IDeptService) ApplicationContextUtil.getBean("deptService");
long startUtc = System.currentTimeMillis();
DBHandler.setDBType(DBType.gaiteDataSource);
List<Person> list = personService.findPersonListAll();
log.info(list);
// DBHandler.setDBType(DBType.ccmcDataSource);
// list.forEach(person -> {
// Dept dept = new Dept();
// dept.setId(person.getId());
// dept.setName(person.getName());
// deptService.saveOrUpdate(dept);
// });
//
// List<Dept> deptList = deptService.findDeptListAll();
// deptList.forEach(dept -> {
// System.out.println(dept.toString());
// });
long endUtc2 = System.currentTimeMillis();
log.info("耗时:" + (endUtc2 - startUtc) + "ms");
}
}
| 2,265 | 0.632934 | 0.628495 | 76 | 27.644737 | 24.865271 | 122 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.552632 | false | false |
1
|
fce832202fba1627a47ba177ffce475e0018a5f3
| 21,998,822,521,325 |
2152fa38757081535cdbf124f55e05b665b23dbc
|
/src/com/szkk/widget/DialogConsultSearch.java
|
43694cb42f26b4b559a8ed6d96310cd94b602421
|
[] |
no_license
|
lt136022740/my_poj
|
https://github.com/lt136022740/my_poj
|
628f844eefa3a4739859e0cdf9bbf8a889654b65
|
ec2588e739c71472ccfd161b978d78c9b5b1f2f8
|
refs/heads/master
| 2020-06-09T05:46:41.381000 | 2013-05-28T15:29:26 | 2013-05-28T15:29:26 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.szkk.widget;
import android.app.Dialog;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TextView;
import com.szkk.utils.ViewUtil;
import com.szkk.www.R;
public class DialogConsultSearch extends Dialog{
private Context context;
private EditText titleEdit;
private EditText contentEdit;
private Spinner catalogSpinner;
private Button confirmBtn;
public DialogConsultSearch(Context context, int theme) {
super(context, theme);
this.context = context;
setContentView(R.layout.dialog_consult_search);
initView();
}
private void initView(){
ViewGroup view = (ViewGroup) findViewById(R.id.main_layout);
ViewUtil.zoomView(view);
titleEdit = (EditText) findViewById(R.id.edit_search_title);
contentEdit = (EditText) findViewById(R.id.edit_search_content);
catalogSpinner = (Spinner) findViewById(R.id.spinner_search_catalog);
confirmBtn = (Button) findViewById(R.id.btn_search);
confirmBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
}
}
|
UTF-8
|
Java
| 1,208 |
java
|
DialogConsultSearch.java
|
Java
|
[] | null |
[] |
package com.szkk.widget;
import android.app.Dialog;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TextView;
import com.szkk.utils.ViewUtil;
import com.szkk.www.R;
public class DialogConsultSearch extends Dialog{
private Context context;
private EditText titleEdit;
private EditText contentEdit;
private Spinner catalogSpinner;
private Button confirmBtn;
public DialogConsultSearch(Context context, int theme) {
super(context, theme);
this.context = context;
setContentView(R.layout.dialog_consult_search);
initView();
}
private void initView(){
ViewGroup view = (ViewGroup) findViewById(R.id.main_layout);
ViewUtil.zoomView(view);
titleEdit = (EditText) findViewById(R.id.edit_search_title);
contentEdit = (EditText) findViewById(R.id.edit_search_content);
catalogSpinner = (Spinner) findViewById(R.id.spinner_search_catalog);
confirmBtn = (Button) findViewById(R.id.btn_search);
confirmBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
}
}
| 1,208 | 0.760762 | 0.760762 | 45 | 25.844444 | 20.18025 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.822222 | false | false |
1
|
95c37c622adc6469dcc22f5890a4b328f4883477
| 16,587,163,703,593 |
ddae05c50e87f06cffe6afe3004cd2cfeef19c23
|
/algo/src/wr/leetcode/algo/Facebook/MinKeyStrikes.java
|
7f595b626f5e6741dcdf09025bdabd6b9f223aa5
|
[] |
no_license
|
rw2409/LeetCode
|
https://github.com/rw2409/LeetCode
|
e16a908e95f5915ddf530f67c2023101b263686a
|
af2c1ea6a827739e8a88463661ebdf025d3543f2
|
refs/heads/master
| 2020-12-20T00:38:25.090000 | 2016-04-11T06:10:23 | 2016-04-11T06:10:23 | 11,626,698 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package wr.leetcode.algo.Facebook;
import java.util.Arrays;
import java.util.PriorityQueue;
public class MinKeyStrikes {
/**
* frequency and keysize array have no specific orders
*
*/
public int minKeyStrikes(int[] keysize, int[] frequency) {
PriorityQueue<Integer> keyCounts = new PriorityQueue<>();
for (int key: keysize) {
for (int i = 1; i <=key; ++i) {
keyCounts.offer(i);
}
}
Arrays.sort(frequency);
int n = frequency.length;
int sum = 0;
for (int i = n-1; i >=0; --i) {
sum += keyCounts.poll() * frequency[i];
}
return sum;
}
public static void main(String[] args) {
MinKeyStrikes sol = new MinKeyStrikes();
int[] keySize = {3,1,2};
int[] freq = {3,3,3,2,1,1};
System.out.println(sol.minKeyStrikes( keySize, freq));
}
/**
* Follow up, what if the order frequency
*
* http://www.cnblogs.com/skyivben/archive/2011/11/09/2243068.html
*/
}
|
UTF-8
|
Java
| 1,068 |
java
|
MinKeyStrikes.java
|
Java
|
[
{
"context": " new MinKeyStrikes();\n\n int[] keySize = {3,1,2};\n int[] freq = {3,3,3,2,1,1};\n S",
"end": 813,
"score": 0.7242206335067749,
"start": 812,
"tag": "KEY",
"value": "1"
},
{
"context": "ew MinKeyStrikes();\n\n int[] keySize = {3,1,2};\n int[] freq = {3,3,3,2,1,1};\n Sys",
"end": 815,
"score": 0.6843245625495911,
"start": 814,
"tag": "KEY",
"value": "2"
},
{
"context": "er frequency\n *\n * http://www.cnblogs.com/skyivben/archive/2011/11/09/2243068.html\n */\n\n\n}\n",
"end": 1023,
"score": 0.9997114539146423,
"start": 1015,
"tag": "USERNAME",
"value": "skyivben"
}
] | null |
[] |
package wr.leetcode.algo.Facebook;
import java.util.Arrays;
import java.util.PriorityQueue;
public class MinKeyStrikes {
/**
* frequency and keysize array have no specific orders
*
*/
public int minKeyStrikes(int[] keysize, int[] frequency) {
PriorityQueue<Integer> keyCounts = new PriorityQueue<>();
for (int key: keysize) {
for (int i = 1; i <=key; ++i) {
keyCounts.offer(i);
}
}
Arrays.sort(frequency);
int n = frequency.length;
int sum = 0;
for (int i = n-1; i >=0; --i) {
sum += keyCounts.poll() * frequency[i];
}
return sum;
}
public static void main(String[] args) {
MinKeyStrikes sol = new MinKeyStrikes();
int[] keySize = {3,1,2};
int[] freq = {3,3,3,2,1,1};
System.out.println(sol.minKeyStrikes( keySize, freq));
}
/**
* Follow up, what if the order frequency
*
* http://www.cnblogs.com/skyivben/archive/2011/11/09/2243068.html
*/
}
| 1,068 | 0.544944 | 0.518727 | 45 | 22.733334 | 21.392002 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.622222 | false | false |
1
|
62c1e420e74578c1f189f2cd4aa09040d1e6a95c
| 10,075,993,334,676 |
65633fdd82a70559f400705763b69fd1e549036f
|
/src/main/java/com/example/mybatis/mapper/OrderMasterMapper.java
|
9eff0a67d10b5c9de04e030fddd30e0fda2a63fb
|
[] |
no_license
|
LiLixikun/mybatis
|
https://github.com/LiLixikun/mybatis
|
8389727b642aadb972dc42d183cb83c6149e7213
|
00598e6cb3a93678bb6db7aca045ecb55f1255e1
|
refs/heads/master
| 2020-06-11T06:59:46.786000 | 2019-08-02T03:51:06 | 2019-08-02T03:51:06 | 193,884,411 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.mybatis.mapper;
import com.example.mybatis.entity.OrderMaster;
import java.util.List;
public interface OrderMasterMapper {
List<OrderMaster> selectAll();
List<OrderMaster> findOrderByUser(String openId);
int deleteByPrimaryKey(String orderId);
int insert(OrderMaster record);
int insertSelective(OrderMaster record);
OrderMaster selectByPrimaryKey(String orderId);
int updateByPrimaryKeySelective(OrderMaster record);
int updateByPrimaryKey(OrderMaster record);
}
|
UTF-8
|
Java
| 526 |
java
|
OrderMasterMapper.java
|
Java
|
[] | null |
[] |
package com.example.mybatis.mapper;
import com.example.mybatis.entity.OrderMaster;
import java.util.List;
public interface OrderMasterMapper {
List<OrderMaster> selectAll();
List<OrderMaster> findOrderByUser(String openId);
int deleteByPrimaryKey(String orderId);
int insert(OrderMaster record);
int insertSelective(OrderMaster record);
OrderMaster selectByPrimaryKey(String orderId);
int updateByPrimaryKeySelective(OrderMaster record);
int updateByPrimaryKey(OrderMaster record);
}
| 526 | 0.775665 | 0.775665 | 24 | 20.958334 | 21.890787 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.458333 | false | false |
1
|
a676bf7b4554e89faddb2ed60a4df5de860a9c3e
| 16,303,695,858,652 |
132105870c2aba29e556177eb3cce9a73a05ba0d
|
/app/src/main/java/com/app/adapter/PhoneRecyclerViewAdapter.java
|
8d888b751a4d44c09a029ba1a5e0b03d14244da2
|
[] |
no_license
|
wwcob6/LRPHProject
|
https://github.com/wwcob6/LRPHProject
|
2551e755218a6365bde00e01668bc1d23ae6882e
|
96f6ac11f4085e5f2697b9cf5dd67b4bcd1a710e
|
refs/heads/master
| 2023-03-20T09:51:07.352000 | 2021-02-17T08:55:35 | 2021-02-17T08:55:35 | 323,892,401 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.app.adapter;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.PopupMenu;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.app.ui.AddressAddActivity;
import com.app.view.CircleImageView;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.app.R;
import java.util.ArrayList;
import java.util.List;
import static com.app.sip.SipInfo.dbHelper;
import static com.app.sip.SipInfo.farmilymemberList;
/**
* Created by 23578 on 2018/10/31.
*/
public class PhoneRecyclerViewAdapter extends RecyclerView.Adapter<PhoneRecyclerViewAdapter.MyViewHolder>{
private List<String> images=new ArrayList<String>();//Image资源,内容为图片的网络地址
private Context mContext;
private DisplayImageOptions options;//UniversalImageLoad
private GridLayoutManager glm;
private PhoneRecyclerViewAdapter.OnItemClickListener mOnItemClickListener;
private PhoneRecyclerViewAdapter.OnLongItemClickListener mOnLongItemClickListener;
Button cancle;
Button delete;
Button edit;
Dialog mCameraDialog;
PopupMenu popup;
public PhoneRecyclerViewAdapter(List<String> images, Context mContext, DisplayImageOptions options, GridLayoutManager glm) {
this.images = images;
this.mContext = mContext;
this.options=options;
this.glm=glm;
}
@Override
public PhoneRecyclerViewAdapter.MyViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
View view= LayoutInflater.from(mContext).inflate(R.layout.rv_item_layout,null);//加载item布局
PhoneRecyclerViewAdapter.MyViewHolder myViewHolder=new PhoneRecyclerViewAdapter.MyViewHolder(view);
return myViewHolder;
}
@Override
public void onBindViewHolder(final PhoneRecyclerViewAdapter.MyViewHolder myViewHolder, final int i) {
myViewHolder.CircleImageView.setScaleType(ImageView.ScaleType.CENTER_CROP);//设置图片充满ImageView并自动裁剪居中显示
ViewGroup.LayoutParams parm = myViewHolder.CircleImageView.getLayoutParams();
parm.height = glm.getWidth()/glm.getSpanCount()
- 2*myViewHolder.CircleImageView.getPaddingLeft() - 2*((ViewGroup.MarginLayoutParams)parm).leftMargin;//设置imageView宽高相同
// ImageLoader.getInstance().displayImage(images.get(i),myViewHolder.imageView,options);//网络加载原图
myViewHolder.textView.setText(farmilymemberList.get(i).getName());
if (farmilymemberList.get(i).getAvatorurl()==null)
{
myViewHolder.CircleImageView.setImageResource(R.drawable.defaultavator);
}else {
ImageLoader.getInstance().displayImage(farmilymemberList.get(i).getAvatorurl(), myViewHolder.CircleImageView);
}
myViewHolder.delete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(final View v) {
Log.d("onlongclick","success");
setDialog();
cancle.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mCameraDialog.dismiss();
}
});
edit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String avatorurl=farmilymemberList.get(i).getAvatorurl();
String name=farmilymemberList.get(i).getName();
String phonenumber=farmilymemberList.get(i).getPhonenumber();
Intent intent=new Intent(mContext,AddressAddActivity.class);
intent.putExtra("extra_avatorurl",avatorurl);
intent.putExtra("extra_name",name);
intent.putExtra("extra_phonenumber",phonenumber);
mContext.startActivity(intent);
mCameraDialog.dismiss();
}
});
delete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SQLiteDatabase db=dbHelper.getWritableDatabase();
Log.d("ton", "onClick: "+farmilymemberList.get(i).getName());
db.execSQL("delete from Person where name = ?",new String[]{farmilymemberList.get(i).getName()});
// db.delete("Person","name = ?",new String[]{holder.name.toString()});
farmilymemberList.remove(i);
notifyDataSetChanged();
mCameraDialog.dismiss();
}
});
// popup = new PopupMenu(mContext,v);
// // 将R.menu.popup_menu菜单资源加载到popup菜单中
// popup.getMenuInflater().inflate(R.menu.popup_menu, popup.getMenu());
// // 为popup菜单的菜单项单击事件绑定事件监听器
// popup.setOnMenuItemClickListener(
// new PopupMenu.OnMenuItemClickListener()
// {
// @Override
// public boolean onMenuItemClick(MenuItem item)
// {
// switch (item.getItemId())
// {
// case R.id.deletepicture:
// SQLiteDatabase db=dbHelper.getWritableDatabase();
// Log.d("ton", "onClick: "+farmilymemberList.get(i).getName());
// db.execSQL("delete from Person where name = ?",new String[]{farmilymemberList.get(i).getName()});
//// db.delete("Person","name = ?",new String[]{holder.name.toString()});
// farmilymemberList.remove(i);
// notifyDataSetChanged();
// break;
// case R.id.editpicture:
// String avatorurl=farmilymemberList.get(i).getAvatorurl();
// String name=farmilymemberList.get(i).getName();
// String phonenumber=farmilymemberList.get(i).getPhonenumber();
// Intent intent=new Intent(mContext,AddressAddActivity.class);
// intent.putExtra("extra_avatorurl",avatorurl);
// intent.putExtra("extra_name",name);
// intent.putExtra("extra_phonenumber",phonenumber);
// mContext.startActivity(intent);
// break;
// }
// return true;
// }
// });
// popup.show();
}
});
if(mOnItemClickListener!=null)//传递监听事件
{
myViewHolder.CircleImageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mOnItemClickListener.onClick(myViewHolder.CircleImageView,i);
}
});
}
}
@Override
public int getItemCount() {
return farmilymemberList.size();
}
class MyViewHolder extends RecyclerView.ViewHolder
{
private CircleImageView CircleImageView;
private TextView textView;
private ImageView delete;
public MyViewHolder(View itemView) {
super(itemView);
CircleImageView=(CircleImageView)itemView.findViewById(R.id.iv_item);
textView=(TextView)itemView.findViewById(R.id.iv_name);
delete=(ImageView)itemView.findViewById(R.id.delete);
}
}
public void setmOnItemClickListener(PhoneRecyclerViewAdapter.OnItemClickListener mOnItemClickListener)
{
this.mOnItemClickListener=mOnItemClickListener;
}
public void setmOnLongItemClickListener(PhoneRecyclerViewAdapter.OnLongItemClickListener mOnLongItemClickListener)
{
this.mOnLongItemClickListener=mOnLongItemClickListener;
}
/**
* 子项点击接口
*/
public interface OnItemClickListener
{
void onClick(View view, int position);
}
public interface OnLongItemClickListener
{
void onLongClick(View view, int position);
}
private void setDialog() {
mCameraDialog = new Dialog(mContext, R.style.BottomDialog);
LinearLayout root = (LinearLayout) LayoutInflater.from(mContext).inflate(
R.layout.editpop, null);
//初始化视图
cancle=(Button) root.findViewById(R.id.pop_cancle);
edit=(Button)root.findViewById(R.id.pop_edit);
delete=(Button)root.findViewById(R.id.pop_delete);
root.findViewById(R.id.pop_delete);
root.findViewById(R.id.pop_edit);
mCameraDialog.setContentView(root);
Window dialogWindow = mCameraDialog.getWindow();
dialogWindow.setGravity(Gravity.BOTTOM);
// dialogWindow.setWindowAnimations(R.style.dialogstyle); // 添加动画
WindowManager.LayoutParams lp = dialogWindow.getAttributes(); // 获取对话框当前的参数值
lp.x = 0; // 新位置X坐标
lp.y = 0; // 新位置Y坐标
lp.width = mContext.getResources().getDisplayMetrics().widthPixels; // 宽度
root.measure(0, 0);
lp.height = root.getMeasuredHeight();
lp.alpha = 9f; // 透明度
dialogWindow.setAttributes(lp);
mCameraDialog.show();
}
}
|
UTF-8
|
Java
| 10,493 |
java
|
PhoneRecyclerViewAdapter.java
|
Java
|
[
{
"context": "ip.SipInfo.farmilymemberList;\n\n\n/**\n * Created by 23578 on 2018/10/31.\n */\n\npublic class PhoneRecyclerVie",
"end": 1042,
"score": 0.9956765174865723,
"start": 1037,
"tag": "USERNAME",
"value": "23578"
},
{
"context": " intent.putExtra(\"extra_name\",name);\n// inten",
"end": 7159,
"score": 0.8315291404724121,
"start": 7155,
"tag": "NAME",
"value": "name"
}
] | null |
[] |
package com.app.adapter;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.PopupMenu;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.app.ui.AddressAddActivity;
import com.app.view.CircleImageView;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.app.R;
import java.util.ArrayList;
import java.util.List;
import static com.app.sip.SipInfo.dbHelper;
import static com.app.sip.SipInfo.farmilymemberList;
/**
* Created by 23578 on 2018/10/31.
*/
public class PhoneRecyclerViewAdapter extends RecyclerView.Adapter<PhoneRecyclerViewAdapter.MyViewHolder>{
private List<String> images=new ArrayList<String>();//Image资源,内容为图片的网络地址
private Context mContext;
private DisplayImageOptions options;//UniversalImageLoad
private GridLayoutManager glm;
private PhoneRecyclerViewAdapter.OnItemClickListener mOnItemClickListener;
private PhoneRecyclerViewAdapter.OnLongItemClickListener mOnLongItemClickListener;
Button cancle;
Button delete;
Button edit;
Dialog mCameraDialog;
PopupMenu popup;
public PhoneRecyclerViewAdapter(List<String> images, Context mContext, DisplayImageOptions options, GridLayoutManager glm) {
this.images = images;
this.mContext = mContext;
this.options=options;
this.glm=glm;
}
@Override
public PhoneRecyclerViewAdapter.MyViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
View view= LayoutInflater.from(mContext).inflate(R.layout.rv_item_layout,null);//加载item布局
PhoneRecyclerViewAdapter.MyViewHolder myViewHolder=new PhoneRecyclerViewAdapter.MyViewHolder(view);
return myViewHolder;
}
@Override
public void onBindViewHolder(final PhoneRecyclerViewAdapter.MyViewHolder myViewHolder, final int i) {
myViewHolder.CircleImageView.setScaleType(ImageView.ScaleType.CENTER_CROP);//设置图片充满ImageView并自动裁剪居中显示
ViewGroup.LayoutParams parm = myViewHolder.CircleImageView.getLayoutParams();
parm.height = glm.getWidth()/glm.getSpanCount()
- 2*myViewHolder.CircleImageView.getPaddingLeft() - 2*((ViewGroup.MarginLayoutParams)parm).leftMargin;//设置imageView宽高相同
// ImageLoader.getInstance().displayImage(images.get(i),myViewHolder.imageView,options);//网络加载原图
myViewHolder.textView.setText(farmilymemberList.get(i).getName());
if (farmilymemberList.get(i).getAvatorurl()==null)
{
myViewHolder.CircleImageView.setImageResource(R.drawable.defaultavator);
}else {
ImageLoader.getInstance().displayImage(farmilymemberList.get(i).getAvatorurl(), myViewHolder.CircleImageView);
}
myViewHolder.delete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(final View v) {
Log.d("onlongclick","success");
setDialog();
cancle.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mCameraDialog.dismiss();
}
});
edit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String avatorurl=farmilymemberList.get(i).getAvatorurl();
String name=farmilymemberList.get(i).getName();
String phonenumber=farmilymemberList.get(i).getPhonenumber();
Intent intent=new Intent(mContext,AddressAddActivity.class);
intent.putExtra("extra_avatorurl",avatorurl);
intent.putExtra("extra_name",name);
intent.putExtra("extra_phonenumber",phonenumber);
mContext.startActivity(intent);
mCameraDialog.dismiss();
}
});
delete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SQLiteDatabase db=dbHelper.getWritableDatabase();
Log.d("ton", "onClick: "+farmilymemberList.get(i).getName());
db.execSQL("delete from Person where name = ?",new String[]{farmilymemberList.get(i).getName()});
// db.delete("Person","name = ?",new String[]{holder.name.toString()});
farmilymemberList.remove(i);
notifyDataSetChanged();
mCameraDialog.dismiss();
}
});
// popup = new PopupMenu(mContext,v);
// // 将R.menu.popup_menu菜单资源加载到popup菜单中
// popup.getMenuInflater().inflate(R.menu.popup_menu, popup.getMenu());
// // 为popup菜单的菜单项单击事件绑定事件监听器
// popup.setOnMenuItemClickListener(
// new PopupMenu.OnMenuItemClickListener()
// {
// @Override
// public boolean onMenuItemClick(MenuItem item)
// {
// switch (item.getItemId())
// {
// case R.id.deletepicture:
// SQLiteDatabase db=dbHelper.getWritableDatabase();
// Log.d("ton", "onClick: "+farmilymemberList.get(i).getName());
// db.execSQL("delete from Person where name = ?",new String[]{farmilymemberList.get(i).getName()});
//// db.delete("Person","name = ?",new String[]{holder.name.toString()});
// farmilymemberList.remove(i);
// notifyDataSetChanged();
// break;
// case R.id.editpicture:
// String avatorurl=farmilymemberList.get(i).getAvatorurl();
// String name=farmilymemberList.get(i).getName();
// String phonenumber=farmilymemberList.get(i).getPhonenumber();
// Intent intent=new Intent(mContext,AddressAddActivity.class);
// intent.putExtra("extra_avatorurl",avatorurl);
// intent.putExtra("extra_name",name);
// intent.putExtra("extra_phonenumber",phonenumber);
// mContext.startActivity(intent);
// break;
// }
// return true;
// }
// });
// popup.show();
}
});
if(mOnItemClickListener!=null)//传递监听事件
{
myViewHolder.CircleImageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mOnItemClickListener.onClick(myViewHolder.CircleImageView,i);
}
});
}
}
@Override
public int getItemCount() {
return farmilymemberList.size();
}
class MyViewHolder extends RecyclerView.ViewHolder
{
private CircleImageView CircleImageView;
private TextView textView;
private ImageView delete;
public MyViewHolder(View itemView) {
super(itemView);
CircleImageView=(CircleImageView)itemView.findViewById(R.id.iv_item);
textView=(TextView)itemView.findViewById(R.id.iv_name);
delete=(ImageView)itemView.findViewById(R.id.delete);
}
}
public void setmOnItemClickListener(PhoneRecyclerViewAdapter.OnItemClickListener mOnItemClickListener)
{
this.mOnItemClickListener=mOnItemClickListener;
}
public void setmOnLongItemClickListener(PhoneRecyclerViewAdapter.OnLongItemClickListener mOnLongItemClickListener)
{
this.mOnLongItemClickListener=mOnLongItemClickListener;
}
/**
* 子项点击接口
*/
public interface OnItemClickListener
{
void onClick(View view, int position);
}
public interface OnLongItemClickListener
{
void onLongClick(View view, int position);
}
private void setDialog() {
mCameraDialog = new Dialog(mContext, R.style.BottomDialog);
LinearLayout root = (LinearLayout) LayoutInflater.from(mContext).inflate(
R.layout.editpop, null);
//初始化视图
cancle=(Button) root.findViewById(R.id.pop_cancle);
edit=(Button)root.findViewById(R.id.pop_edit);
delete=(Button)root.findViewById(R.id.pop_delete);
root.findViewById(R.id.pop_delete);
root.findViewById(R.id.pop_edit);
mCameraDialog.setContentView(root);
Window dialogWindow = mCameraDialog.getWindow();
dialogWindow.setGravity(Gravity.BOTTOM);
// dialogWindow.setWindowAnimations(R.style.dialogstyle); // 添加动画
WindowManager.LayoutParams lp = dialogWindow.getAttributes(); // 获取对话框当前的参数值
lp.x = 0; // 新位置X坐标
lp.y = 0; // 新位置Y坐标
lp.width = mContext.getResources().getDisplayMetrics().widthPixels; // 宽度
root.measure(0, 0);
lp.height = root.getMeasuredHeight();
lp.alpha = 9f; // 透明度
dialogWindow.setAttributes(lp);
mCameraDialog.show();
}
}
| 10,493 | 0.595826 | 0.593192 | 233 | 43.004292 | 32.145523 | 139 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.708154 | false | false |
1
|
801c22662c294a8226f84720df2a029f5879973e
| 19,902,878,508,602 |
442883f0fa942a74983b580fffacefd2c00dbbac
|
/src/main/java/com/sorec/concentrateur/offre/repository/PartantRepository.java
|
d14593aa0daa80742dde00f5b0831b5ef49f92df
|
[] |
no_license
|
Mouhsineham/concentrateur-ms-offre
|
https://github.com/Mouhsineham/concentrateur-ms-offre
|
3e3c69b3e1d7e5524cbea5d5657cae80c43c97dd
|
6a6c775d9b01180eed9024fd1891f77dac6e8a56
|
refs/heads/master
| 2022-11-06T10:42:37.492000 | 2020-06-29T09:39:59 | 2020-06-29T09:39:59 | 275,042,659 | 0 | 0 | null | false | 2020-06-26T14:17:03 | 2020-06-26T00:34:26 | 2020-06-26T14:13:35 | 2020-06-26T13:49:22 | 81 | 0 | 0 | 0 |
Java
| false | false |
package com.sorec.concentrateur.offre.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import com.sorec.concentrateur.offre.domain.Partant;
@Repository
public interface PartantRepository extends JpaRepository<Partant, Integer> {
}
|
UTF-8
|
Java
| 323 |
java
|
PartantRepository.java
|
Java
|
[] | null |
[] |
package com.sorec.concentrateur.offre.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import com.sorec.concentrateur.offre.domain.Partant;
@Repository
public interface PartantRepository extends JpaRepository<Partant, Integer> {
}
| 323 | 0.811145 | 0.811145 | 13 | 23 | 28.076818 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.384615 | false | false |
1
|
784e61d6d174f67669014d0b44ba2eb6b1aeea5f
| 5,093,831,214,159 |
e7f915b18b05b4fd767d1df68cc7a1f3b44fc2a9
|
/src/test/tt.java
|
588be2ac6be7add15353e7a15560103563161a41
|
[] |
no_license
|
femery/TestPlatform
|
https://github.com/femery/TestPlatform
|
d6ab318d349371749e084745b43d7c17779edada
|
8d515f29d2ca4d8beffdc054b60860d476e2969f
|
refs/heads/master
| 2021-02-28T21:34:52.591000 | 2020-03-14T00:35:39 | 2020-03-14T00:35:39 | 245,734,222 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package test;
import java.util.ArrayList;
import java.util.List;
public class tt {
public static void main(String[] args) {
//int a=123;
int x=15;
while(x>10){
int a=0;
a=10+a;
System.out.println(a);
x--;
}
}
}
|
UTF-8
|
Java
| 307 |
java
|
tt.java
|
Java
|
[] | null |
[] |
package test;
import java.util.ArrayList;
import java.util.List;
public class tt {
public static void main(String[] args) {
//int a=123;
int x=15;
while(x>10){
int a=0;
a=10+a;
System.out.println(a);
x--;
}
}
}
| 307 | 0.465798 | 0.433225 | 20 | 14.2 | 12.130952 | 44 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.45 | false | false |
1
|
a4567c178171c362ede715d2f1dc78d49de85834
| 39,049,842,668,959 |
9159d51c5030a2ad04a17853e5530b9391311ca3
|
/scrmV1/test/com/vance/scrm/servlet/LoginServletTest.java
|
924aad1015dfb8599a429b94e44aa99ca7ddf48b
|
[] |
no_license
|
fufengchang/scrmV1
|
https://github.com/fufengchang/scrmV1
|
24d0effe1cb0313dc1152ebda8aeac66f03170c9
|
62fb82fb2b6d8e40c6e3afac9af06cd61e0a0d7b
|
refs/heads/master
| 2020-03-22T23:24:33.966000 | 2018-07-13T07:44:00 | 2018-07-13T07:44:00 | 140,808,649 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.vance.scrm.servlet;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.net.MalformedURLException;
import javax.servlet.ServletException;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.xml.sax.SAXException;
import com.meterware.httpunit.GetMethodWebRequest;
import com.meterware.httpunit.PostMethodWebRequest;
import com.meterware.httpunit.WebConversation;
import com.meterware.httpunit.WebRequest;
import com.meterware.httpunit.WebResponse;
import com.meterware.servletunit.InvocationContext;
import com.meterware.servletunit.ServletRunner;
import com.meterware.servletunit.ServletUnitClient;
public class LoginServletTest {
OutputStream out = new ByteArrayOutputStream();
@Before
public void before() {
// System.setOut(new PrintStream(out));
}
@Test
public void testDoPostHttpServletRequestHttpServletResponse()
throws MalformedURLException, IOException, ServletException, SAXException {
// 建立一个WebConversation实例
WebConversation wc = new WebConversation();
// 向指定的URL发出请求
WebRequest req = new PostMethodWebRequest("http://localhost:9999/scrmV1/login.do");
// 给请求加上参数
req.setParameter("customerName", "ben");
req.setParameter("customerPwd", "12345");
// 获取响应对象
WebResponse resp = wc.getResponse(req);
// 用getText方法获取相应的全部内容
// 用System.out.println将获取的内容打印在控制台上
System.out.println(resp.getText());
// 断言
// Assert.assertEquals(resp.getText(),
// "<!DOCTYPE html>\r\n" + "<html>\r\n" + "<head>\r\n" + "<metacharset=\"ISO-8859-1\">\r\n"
// + "<title>Insert title here</title>\r\n" + "</head>\r\n" + "<body>\r\n"
// + " <h1>success</h1>\r\n" + "</body>\r\n" + "</html>");
Assert.assertEquals(resp.getText(),
"<!DOCTYPE html>\r\n" + "<html>\r\n" + "<head>\r\n" + "<meta charset=\"ISO-8859-1\">\r\n"
+ "<title>Insert title here</title>\r\n" + "</head>\r\n" + "<body>\r\n" + " <h1>fail</h1>\r\n"
+ "</body>\r\n" + "</html>");
}
}
|
UTF-8
|
Java
| 2,205 |
java
|
LoginServletTest.java
|
Java
|
[
{
"context": "\t\t// 给请求加上参数\r\n\t\treq.setParameter(\"customerName\", \"ben\");\r\n\t\treq.setParameter(\"customerPwd\", \"12345\");\r\n",
"end": 1309,
"score": 0.9553295969963074,
"start": 1306,
"tag": "NAME",
"value": "ben"
},
{
"context": "ame\", \"ben\");\r\n\t\treq.setParameter(\"customerPwd\", \"12345\");\r\n\t\t// 获取响应对象\r\n\t\tWebResponse resp = wc.getRespo",
"end": 1354,
"score": 0.9991782307624817,
"start": 1349,
"tag": "PASSWORD",
"value": "12345"
}
] | null |
[] |
package com.vance.scrm.servlet;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.net.MalformedURLException;
import javax.servlet.ServletException;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.xml.sax.SAXException;
import com.meterware.httpunit.GetMethodWebRequest;
import com.meterware.httpunit.PostMethodWebRequest;
import com.meterware.httpunit.WebConversation;
import com.meterware.httpunit.WebRequest;
import com.meterware.httpunit.WebResponse;
import com.meterware.servletunit.InvocationContext;
import com.meterware.servletunit.ServletRunner;
import com.meterware.servletunit.ServletUnitClient;
public class LoginServletTest {
OutputStream out = new ByteArrayOutputStream();
@Before
public void before() {
// System.setOut(new PrintStream(out));
}
@Test
public void testDoPostHttpServletRequestHttpServletResponse()
throws MalformedURLException, IOException, ServletException, SAXException {
// 建立一个WebConversation实例
WebConversation wc = new WebConversation();
// 向指定的URL发出请求
WebRequest req = new PostMethodWebRequest("http://localhost:9999/scrmV1/login.do");
// 给请求加上参数
req.setParameter("customerName", "ben");
req.setParameter("customerPwd", "<PASSWORD>");
// 获取响应对象
WebResponse resp = wc.getResponse(req);
// 用getText方法获取相应的全部内容
// 用System.out.println将获取的内容打印在控制台上
System.out.println(resp.getText());
// 断言
// Assert.assertEquals(resp.getText(),
// "<!DOCTYPE html>\r\n" + "<html>\r\n" + "<head>\r\n" + "<metacharset=\"ISO-8859-1\">\r\n"
// + "<title>Insert title here</title>\r\n" + "</head>\r\n" + "<body>\r\n"
// + " <h1>success</h1>\r\n" + "</body>\r\n" + "</html>");
Assert.assertEquals(resp.getText(),
"<!DOCTYPE html>\r\n" + "<html>\r\n" + "<head>\r\n" + "<meta charset=\"ISO-8859-1\">\r\n"
+ "<title>Insert title here</title>\r\n" + "</head>\r\n" + "<body>\r\n" + " <h1>fail</h1>\r\n"
+ "</body>\r\n" + "</html>");
}
}
| 2,210 | 0.693079 | 0.681623 | 60 | 32.916668 | 25.693249 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.85 | false | false |
1
|
5498ace535fd2c99d2a20bd6fdbab3703601886c
| 36,043,365,589,255 |
8a3414a05bed7a326066bd4ff73f46cb0976712b
|
/Cryptography/src/main/java/cryptography/key/generator/test101/Decryption.java
|
18742f3f1f2902fa460511a694ea0850b2d72352
|
[] |
no_license
|
pankajnimgade/Java_Gradle_Tutorial
|
https://github.com/pankajnimgade/Java_Gradle_Tutorial
|
607fe730fc94fc58bf848b2536faab97036f17d3
|
09330b42b3037e2ede1344a7f278d0f2260843bd
|
refs/heads/master
| 2019-04-08T03:11:48.511000 | 2019-03-07T05:04:03 | 2019-03-07T05:04:03 | 87,482,513 | 1 | 0 | null | false | 2017-08-27T19:44:46 | 2017-04-06T22:59:00 | 2017-07-11T18:02:17 | 2017-08-27T19:44:46 | 700 | 0 | 0 | 0 |
Java
| null | null |
package cryptography.key.generator.test101;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import java.util.Base64;
class Decryption {
private static final String AES_PADDING = "AES/ECB/PKCS5Padding";
private static Decryption ENCRYPTION;
public Cipher mCipher;
public static Decryption getInstance(SecretKey secretKey) {
initializeCipher(secretKey);
return ENCRYPTION;
}
private static void initializeCipher(SecretKey secretKey) {
if (ENCRYPTION == null) {
ENCRYPTION = new Decryption();
}
try {
if (ENCRYPTION.mCipher == null) {
ENCRYPTION.mCipher = Cipher.getInstance(AES_PADDING);
ENCRYPTION.mCipher.init(Cipher.DECRYPT_MODE, secretKey);
}
} catch (Exception e) {
e.printStackTrace();
}
}
public String decrypt(String textToBeDecrypted) {
String decryptedText = textToBeDecrypted;
try {
byte[] decryptedByte = Base64.getDecoder().decode(textToBeDecrypted);
byte[] decrypted = ENCRYPTION.mCipher.doFinal(decryptedByte);
decryptedText = new String(decrypted);
} catch (Exception e) {
e.printStackTrace();
}
return decryptedText;
}
}
|
UTF-8
|
Java
| 1,326 |
java
|
Decryption.java
|
Java
|
[] | null |
[] |
package cryptography.key.generator.test101;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import java.util.Base64;
class Decryption {
private static final String AES_PADDING = "AES/ECB/PKCS5Padding";
private static Decryption ENCRYPTION;
public Cipher mCipher;
public static Decryption getInstance(SecretKey secretKey) {
initializeCipher(secretKey);
return ENCRYPTION;
}
private static void initializeCipher(SecretKey secretKey) {
if (ENCRYPTION == null) {
ENCRYPTION = new Decryption();
}
try {
if (ENCRYPTION.mCipher == null) {
ENCRYPTION.mCipher = Cipher.getInstance(AES_PADDING);
ENCRYPTION.mCipher.init(Cipher.DECRYPT_MODE, secretKey);
}
} catch (Exception e) {
e.printStackTrace();
}
}
public String decrypt(String textToBeDecrypted) {
String decryptedText = textToBeDecrypted;
try {
byte[] decryptedByte = Base64.getDecoder().decode(textToBeDecrypted);
byte[] decrypted = ENCRYPTION.mCipher.doFinal(decryptedByte);
decryptedText = new String(decrypted);
} catch (Exception e) {
e.printStackTrace();
}
return decryptedText;
}
}
| 1,326 | 0.621418 | 0.615385 | 54 | 23.555555 | 24.266779 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.37037 | false | false |
1
|
d2d04925fb046e373e336bb9a2d5ea739909a9ea
| 5,076,651,410,494 |
9c3deb06c8571fc6ac6e8df0af900949782454e6
|
/src/main/java/com/community/app/module/controller/BusinessRepairTypeController.java
|
f72937479818bcf36056fb926cbb326f1c0cbe87
|
[] |
no_license
|
xeonye/community
|
https://github.com/xeonye/community
|
d7a81dca1427e21917656850d97cac61995d9a50
|
c5122d93bc847cbe2be7f85bd0e2c7c1b1c2f64b
|
refs/heads/master
| 2020-03-11T09:42:02.297000 | 2015-04-03T08:23:48 | 2015-04-03T08:23:48 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.community.app.module.controller;
import java.io.IOException;
import java.sql.Timestamp;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import com.community.app.module.bean.BusinessRepairType;
import com.community.app.module.service.BusinessRepairTypeService;
import com.community.app.module.vo.BaseBean;
import com.community.app.module.vo.BusinessRepairTypeQuery;
@Controller
@RequestMapping("/business/businessRepairType")
public class BusinessRepairTypeController {
private static Logger GSLogger = LoggerFactory.getLogger(BusinessRepairTypeController.class);
@Autowired
private BusinessRepairTypeService businessRepairTypeService;
private final String LIST_ACTION = "redirect:/business/businessRepairType/list.do";
/**
* 进入管理页
* @return
*/
@RequestMapping(value="enter")
public ModelAndView enter() {
try{
}catch(Exception e){
GSLogger.error("进入businessRepairType管理页时发生错误:/business/businessRepairType/enter", e);
e.printStackTrace();
}
ModelAndView mav = new ModelAndView("/business/businessRepairType/enter");
return mav;
}
/**
* 列示或者查询所有数据
* @return
*/
@RequestMapping(value="list")
public void list(BusinessRepairTypeQuery query, HttpServletResponse response) {
String json = "";
StringBuilder result = new StringBuilder();
try{
BaseBean baseBean = businessRepairTypeService.findAllPage(query);
result.append("{\"total\":").append(baseBean.getCount()).append(",")
.append("\"rows\":[");
for(int i=0;i<baseBean.getList().size();i++) {
BusinessRepairType businessRepairType = (BusinessRepairType) baseBean.getList().get(i);
result.append("{")
.append("\"typeId\":\"").append(businessRepairType.getTypeId()).append("\"").append(",")
.append("\"typeName\":\"").append(businessRepairType.getTypeName()).append("\"").append(",")
.append("\"typeDesc\":\"").append(businessRepairType.getTypeDesc()).append("\"").append(",")
.append("\"createTime\":\"").append(businessRepairType.getCreateTime()).append("\"").append(",")
.append("\"editTime\":\"").append(businessRepairType.getEditTime()).append("\"").append(",")
.append("\"editor\":\"").append(businessRepairType.getEditor()).append("\"")
.append("}").append(",");
}
json = result.toString();
if(baseBean.getList().size() > 0) {
json = json.substring(0, json.length()-1);
}
json += "]}";
response.setHeader("Cache-Control", "no-cache");
response.setCharacterEncoding("utf-8");
try {
response.getWriter().write(json);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}catch(Exception e){
GSLogger.error("显示businessRepairType列表时发生错误:/business/businessRepairType/list", e);
e.printStackTrace();
}
}
/**
* 进入新增页
* @return
*/
@RequestMapping(value="add")
public ModelAndView add(BusinessRepairTypeQuery query) {
try{
}catch(Exception e){
GSLogger.error("进入businessRepairType新增页时发生错误:/business/businessRepairType/add", e);
e.printStackTrace();
}
ModelAndView mav = new ModelAndView("/business/businessRepairType/add");
return mav;
}
/**
* 保存对象
* @param request
* @param businessRepairType
* @return
*/
@RequestMapping(value="save")
public void save(HttpServletRequest request, HttpServletResponse response, BusinessRepairTypeQuery query) {
BusinessRepairType businessRepairType = new BusinessRepairType();
String json = "";
try{
businessRepairType.setTypeName(query.getTypeName());
businessRepairType.setTypeDesc(query.getTypeDesc());
businessRepairType.setCreateTime(query.getCreateTime());
businessRepairType.setEditTime(query.getEditTime());
businessRepairType.setEditor(query.getEditor());
Timestamp ts=new Timestamp(new Date().getTime());
businessRepairType.setCreateTime(ts);
businessRepairType.setEditTime(ts);
businessRepairTypeService.save(businessRepairType);
//保存成功
json = "{\"success\":\"true\",\"message\":\"保存成功\"}";
} catch(Exception e) {
json = "{\"success\":\"false\",\"message\":\"保存失败\"}";
GSLogger.error("保存businessRepairType信息时发生错误:/business/businessRepairType/save", e);
e.printStackTrace();
}
response.setHeader("Cache-Control", "no-cache");
response.setCharacterEncoding("utf-8");
try {
response.getWriter().write(json);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/**
* 进入修改页
* @return
*/
@RequestMapping(value="modify")
public ModelAndView modify(BusinessRepairTypeQuery query) {
BusinessRepairType businessRepairType=new BusinessRepairType();
try{
businessRepairType = businessRepairTypeService.findById(query.getTypeId());
}catch(Exception e){
GSLogger.error("进入businessRepairType修改页时发生错误:/business/businessRepairType/modify", e);
e.printStackTrace();
}
ModelAndView mav = new ModelAndView("/business/businessRepairType/modify");
mav.addObject("businessRepairType", businessRepairType);
return mav;
}
/**
* 更新对象
* @param request
* @param query
* @return
*/
@RequestMapping(value="update")
public void update(HttpServletRequest request, HttpServletResponse response, BusinessRepairTypeQuery query) {
BusinessRepairType businessRepairType = null;
String json = "";
try{
businessRepairType = businessRepairTypeService.findById(query.getTypeId());
businessRepairType.setTypeName(query.getTypeName());
businessRepairType.setTypeDesc(query.getTypeDesc());
businessRepairType.setCreateTime(query.getCreateTime());
businessRepairType.setEditTime(query.getEditTime());
businessRepairType.setEditor(query.getEditor());
Timestamp ts=new Timestamp(new Date().getTime());
businessRepairType.setEditTime(ts);
businessRepairTypeService.update(businessRepairType);
json = "{\"success\":\"true\",\"message\":\"编辑成功\"}";
} catch(Exception e) {
json = "{\"success\":\"false\",\"message\":\"编辑失败\"}";
GSLogger.error("编辑businessRepairType信息时发生错误:/business/businessRepairType/update", e);
e.printStackTrace();
}
response.setHeader("Cache-Control", "no-cache");
response.setCharacterEncoding("utf-8");
try {
response.getWriter().write(json);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/**
* 删除单个或多个对象
* @param id
* @return
*/
@RequestMapping(value="delete")
public void delete(@RequestParam(value="id") String id, HttpServletResponse response) {
String json = "";
try{
if(id != null) {
if(id.indexOf(',') > -1) {
String[] ids = id.split(",");
for(int i=0;i<ids.length;i++) {
businessRepairTypeService.delete(new Integer(ids[i]));
}
}else{
businessRepairTypeService.delete(new Integer(id));
}
}
json = "{\"success\":\"true\",\"message\":\"删除成功\"}";
}catch(Exception e){
json = "{\"success\":\"false\",\"message\":\"删除失败\"}";
GSLogger.error("删除BusinessRepairType时发生错误:/business/businessRepairType/delete", e);
e.printStackTrace();
}
response.setHeader("Cache-Control", "no-cache");
response.setCharacterEncoding("utf-8");
try {
response.getWriter().write(json);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
|
UTF-8
|
Java
| 8,257 |
java
|
BusinessRepairTypeController.java
|
Java
|
[] | null |
[] |
package com.community.app.module.controller;
import java.io.IOException;
import java.sql.Timestamp;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import com.community.app.module.bean.BusinessRepairType;
import com.community.app.module.service.BusinessRepairTypeService;
import com.community.app.module.vo.BaseBean;
import com.community.app.module.vo.BusinessRepairTypeQuery;
@Controller
@RequestMapping("/business/businessRepairType")
public class BusinessRepairTypeController {
private static Logger GSLogger = LoggerFactory.getLogger(BusinessRepairTypeController.class);
@Autowired
private BusinessRepairTypeService businessRepairTypeService;
private final String LIST_ACTION = "redirect:/business/businessRepairType/list.do";
/**
* 进入管理页
* @return
*/
@RequestMapping(value="enter")
public ModelAndView enter() {
try{
}catch(Exception e){
GSLogger.error("进入businessRepairType管理页时发生错误:/business/businessRepairType/enter", e);
e.printStackTrace();
}
ModelAndView mav = new ModelAndView("/business/businessRepairType/enter");
return mav;
}
/**
* 列示或者查询所有数据
* @return
*/
@RequestMapping(value="list")
public void list(BusinessRepairTypeQuery query, HttpServletResponse response) {
String json = "";
StringBuilder result = new StringBuilder();
try{
BaseBean baseBean = businessRepairTypeService.findAllPage(query);
result.append("{\"total\":").append(baseBean.getCount()).append(",")
.append("\"rows\":[");
for(int i=0;i<baseBean.getList().size();i++) {
BusinessRepairType businessRepairType = (BusinessRepairType) baseBean.getList().get(i);
result.append("{")
.append("\"typeId\":\"").append(businessRepairType.getTypeId()).append("\"").append(",")
.append("\"typeName\":\"").append(businessRepairType.getTypeName()).append("\"").append(",")
.append("\"typeDesc\":\"").append(businessRepairType.getTypeDesc()).append("\"").append(",")
.append("\"createTime\":\"").append(businessRepairType.getCreateTime()).append("\"").append(",")
.append("\"editTime\":\"").append(businessRepairType.getEditTime()).append("\"").append(",")
.append("\"editor\":\"").append(businessRepairType.getEditor()).append("\"")
.append("}").append(",");
}
json = result.toString();
if(baseBean.getList().size() > 0) {
json = json.substring(0, json.length()-1);
}
json += "]}";
response.setHeader("Cache-Control", "no-cache");
response.setCharacterEncoding("utf-8");
try {
response.getWriter().write(json);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}catch(Exception e){
GSLogger.error("显示businessRepairType列表时发生错误:/business/businessRepairType/list", e);
e.printStackTrace();
}
}
/**
* 进入新增页
* @return
*/
@RequestMapping(value="add")
public ModelAndView add(BusinessRepairTypeQuery query) {
try{
}catch(Exception e){
GSLogger.error("进入businessRepairType新增页时发生错误:/business/businessRepairType/add", e);
e.printStackTrace();
}
ModelAndView mav = new ModelAndView("/business/businessRepairType/add");
return mav;
}
/**
* 保存对象
* @param request
* @param businessRepairType
* @return
*/
@RequestMapping(value="save")
public void save(HttpServletRequest request, HttpServletResponse response, BusinessRepairTypeQuery query) {
BusinessRepairType businessRepairType = new BusinessRepairType();
String json = "";
try{
businessRepairType.setTypeName(query.getTypeName());
businessRepairType.setTypeDesc(query.getTypeDesc());
businessRepairType.setCreateTime(query.getCreateTime());
businessRepairType.setEditTime(query.getEditTime());
businessRepairType.setEditor(query.getEditor());
Timestamp ts=new Timestamp(new Date().getTime());
businessRepairType.setCreateTime(ts);
businessRepairType.setEditTime(ts);
businessRepairTypeService.save(businessRepairType);
//保存成功
json = "{\"success\":\"true\",\"message\":\"保存成功\"}";
} catch(Exception e) {
json = "{\"success\":\"false\",\"message\":\"保存失败\"}";
GSLogger.error("保存businessRepairType信息时发生错误:/business/businessRepairType/save", e);
e.printStackTrace();
}
response.setHeader("Cache-Control", "no-cache");
response.setCharacterEncoding("utf-8");
try {
response.getWriter().write(json);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/**
* 进入修改页
* @return
*/
@RequestMapping(value="modify")
public ModelAndView modify(BusinessRepairTypeQuery query) {
BusinessRepairType businessRepairType=new BusinessRepairType();
try{
businessRepairType = businessRepairTypeService.findById(query.getTypeId());
}catch(Exception e){
GSLogger.error("进入businessRepairType修改页时发生错误:/business/businessRepairType/modify", e);
e.printStackTrace();
}
ModelAndView mav = new ModelAndView("/business/businessRepairType/modify");
mav.addObject("businessRepairType", businessRepairType);
return mav;
}
/**
* 更新对象
* @param request
* @param query
* @return
*/
@RequestMapping(value="update")
public void update(HttpServletRequest request, HttpServletResponse response, BusinessRepairTypeQuery query) {
BusinessRepairType businessRepairType = null;
String json = "";
try{
businessRepairType = businessRepairTypeService.findById(query.getTypeId());
businessRepairType.setTypeName(query.getTypeName());
businessRepairType.setTypeDesc(query.getTypeDesc());
businessRepairType.setCreateTime(query.getCreateTime());
businessRepairType.setEditTime(query.getEditTime());
businessRepairType.setEditor(query.getEditor());
Timestamp ts=new Timestamp(new Date().getTime());
businessRepairType.setEditTime(ts);
businessRepairTypeService.update(businessRepairType);
json = "{\"success\":\"true\",\"message\":\"编辑成功\"}";
} catch(Exception e) {
json = "{\"success\":\"false\",\"message\":\"编辑失败\"}";
GSLogger.error("编辑businessRepairType信息时发生错误:/business/businessRepairType/update", e);
e.printStackTrace();
}
response.setHeader("Cache-Control", "no-cache");
response.setCharacterEncoding("utf-8");
try {
response.getWriter().write(json);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/**
* 删除单个或多个对象
* @param id
* @return
*/
@RequestMapping(value="delete")
public void delete(@RequestParam(value="id") String id, HttpServletResponse response) {
String json = "";
try{
if(id != null) {
if(id.indexOf(',') > -1) {
String[] ids = id.split(",");
for(int i=0;i<ids.length;i++) {
businessRepairTypeService.delete(new Integer(ids[i]));
}
}else{
businessRepairTypeService.delete(new Integer(id));
}
}
json = "{\"success\":\"true\",\"message\":\"删除成功\"}";
}catch(Exception e){
json = "{\"success\":\"false\",\"message\":\"删除失败\"}";
GSLogger.error("删除BusinessRepairType时发生错误:/business/businessRepairType/delete", e);
e.printStackTrace();
}
response.setHeader("Cache-Control", "no-cache");
response.setCharacterEncoding("utf-8");
try {
response.getWriter().write(json);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
| 8,257 | 0.680878 | 0.679373 | 234 | 32.081196 | 28.160822 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.478632 | false | false |
1
|
36e4c91755acaf40f8059d6538860fd47ca0ae23
| 23,587,960,457,283 |
bbd5267060304f37a474dd84eb9f6b43816ea3c2
|
/engine/engine/src/main/java/com/virtusa/gto/nyql/engine/exceptions/NyParamNotFoundException.java
|
a4ba2ea79fae1c24c699780be0a309379abf52ed
|
[
"Apache-2.0"
] |
permissive
|
amendafernando/NyQL
|
https://github.com/amendafernando/NyQL
|
bcb3000863301e3f93dd65bd0c6f168f24d747b1
|
532e6ceffe87dfe35e62b6a5c3891cbcbed61525
|
refs/heads/master
| 2020-03-27T02:43:39.881000 | 2018-05-19T05:10:07 | 2018-05-19T05:10:07 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.virtusa.gto.nyql.engine.exceptions;
/**
* @author iweerarathna
*/
public class NyParamNotFoundException extends NyScriptExecutionException {
public NyParamNotFoundException(String paramName) {
super(String.format("Parameter '%s' not found in the script session!", paramName));
}
}
|
UTF-8
|
Java
| 313 |
java
|
NyParamNotFoundException.java
|
Java
|
[
{
"context": "irtusa.gto.nyql.engine.exceptions;\n\n/**\n * @author iweerarathna\n */\npublic class NyParamNotFoundException extends",
"end": 76,
"score": 0.995582640171051,
"start": 64,
"tag": "USERNAME",
"value": "iweerarathna"
}
] | null |
[] |
package com.virtusa.gto.nyql.engine.exceptions;
/**
* @author iweerarathna
*/
public class NyParamNotFoundException extends NyScriptExecutionException {
public NyParamNotFoundException(String paramName) {
super(String.format("Parameter '%s' not found in the script session!", paramName));
}
}
| 313 | 0.744409 | 0.744409 | 10 | 30.200001 | 32.316559 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.3 | false | false |
1
|
27c58e820695ac394be9322e58319f231817ba8c
| 34,557,306,918,764 |
b86420119294e4389f695a0aa6abd213ed291f84
|
/Visitor/FloatElement.java
|
5a563c978ce0fcec71e5b549e18aff4456e987c0
|
[] |
no_license
|
wanghongfucoder/DesignMode
|
https://github.com/wanghongfucoder/DesignMode
|
4ba214d049258a87b71aadb10f8add00a6ed20e1
|
9ad7df0d02937f4ad364d761287d1043bfe6292a
|
refs/heads/master
| 2020-12-31T04:28:20.447000 | 2016-05-09T09:34:06 | 2016-05-09T09:34:06 | 57,038,830 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
public class FloatElement implements Visitable {
private Float fe;
public FloatElement (Float fe)
{
this.fe=fe;
}
public Float getFe(){
return this.fe;
}
public void accept(Visitor visitor)
{
visitor.visitFloat(this);
}
}
|
UTF-8
|
Java
| 237 |
java
|
FloatElement.java
|
Java
|
[] | null |
[] |
public class FloatElement implements Visitable {
private Float fe;
public FloatElement (Float fe)
{
this.fe=fe;
}
public Float getFe(){
return this.fe;
}
public void accept(Visitor visitor)
{
visitor.visitFloat(this);
}
}
| 237 | 0.708861 | 0.708861 | 14 | 16 | 14.73092 | 48 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.357143 | false | false |
1
|
c0165dbb772ce5bdfe592c6b805393f4e9bee1ff
| 33,887,292,028,837 |
8fe6e20701375bdbfaf976c49969784f1e2c416a
|
/Lab007_17-04/Java_GR3_Kluz_17-04/src/Worker.java
|
542a9fb54e556bdb8e12edac4012ace7486cec76
|
[] |
no_license
|
Patryk2211/Java_GCL03_lato_2018_294625
|
https://github.com/Patryk2211/Java_GCL03_lato_2018_294625
|
bb1038bf30caae1c37e1910b80d5a6a85b66c66c
|
e630e1795b84b5102d7cef8887d835f27f973bd0
|
refs/heads/master
| 2021-03-30T21:04:24.843000 | 2018-06-16T20:53:14 | 2018-06-16T20:53:14 | 124,231,027 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
public class Worker {
private final String workerName;
private final ConcurrentLinkedQueue<NamedTask> queue = new ConcurrentLinkedQueue<>();
private final Thread thread;
private AtomicInteger taskNumber = new AtomicInteger(0);
private AtomicBoolean isStarted = new AtomicBoolean(false);
private AtomicBoolean isStopped = new AtomicBoolean(false);
private WorkerListener workerListener = null;
public Worker(String workerName)
{
this.workerName = workerName;
thread = new Thread(new Runnable() {
@Override
public void run() {
while (true) {
if (!isStopped.get()) {
NamedTask task = queue.peek();
if (task != null) {
int currentTaskCount = taskNumber.getAndAdd(1);
try {
workerListener.onTaskStarted(currentTaskCount, task.name);
task.task.run(currentTaskCount);
workerListener.onTaskCompleted(currentTaskCount, task.name);
queue.remove(task);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
}
}, "Worker" + workerName + "Thread");
}
void enqueueTask(String taskName, Task task) {
queue.add(new NamedTask(taskName, task));
}
void start() {
if (workerListener != null) {
workerListener.onWorkerStarted();
}
if (!isStarted.get()) {
isStarted.set(true);
thread.start();
}
isStopped.set(false);
}
void stop() {
isStopped.set(true);
thread.interrupt();
if (workerListener != null) {
workerListener.onWorkerStopped();
}
}
void setListener(WorkerListener workerListener) {
this.workerListener = workerListener;
}
boolean isStarted() {
return isStarted.get();
}
boolean isWorking() {
return !isStopped.get() && !queue.isEmpty() ;
}
private static class NamedTask{
private final String name;
private final Task task;
private NamedTask(String name, Task task) {
this.name = name;
this.task = task;
}
}
}
|
UTF-8
|
Java
| 2,659 |
java
|
Worker.java
|
Java
|
[
{
"context": "(String name, Task task) {\n this.name = name;\n this.task = task;\n }\n }\n\n}",
"end": 2607,
"score": 0.9062378406524658,
"start": 2603,
"tag": "NAME",
"value": "name"
}
] | null |
[] |
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
public class Worker {
private final String workerName;
private final ConcurrentLinkedQueue<NamedTask> queue = new ConcurrentLinkedQueue<>();
private final Thread thread;
private AtomicInteger taskNumber = new AtomicInteger(0);
private AtomicBoolean isStarted = new AtomicBoolean(false);
private AtomicBoolean isStopped = new AtomicBoolean(false);
private WorkerListener workerListener = null;
public Worker(String workerName)
{
this.workerName = workerName;
thread = new Thread(new Runnable() {
@Override
public void run() {
while (true) {
if (!isStopped.get()) {
NamedTask task = queue.peek();
if (task != null) {
int currentTaskCount = taskNumber.getAndAdd(1);
try {
workerListener.onTaskStarted(currentTaskCount, task.name);
task.task.run(currentTaskCount);
workerListener.onTaskCompleted(currentTaskCount, task.name);
queue.remove(task);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
}
}, "Worker" + workerName + "Thread");
}
void enqueueTask(String taskName, Task task) {
queue.add(new NamedTask(taskName, task));
}
void start() {
if (workerListener != null) {
workerListener.onWorkerStarted();
}
if (!isStarted.get()) {
isStarted.set(true);
thread.start();
}
isStopped.set(false);
}
void stop() {
isStopped.set(true);
thread.interrupt();
if (workerListener != null) {
workerListener.onWorkerStopped();
}
}
void setListener(WorkerListener workerListener) {
this.workerListener = workerListener;
}
boolean isStarted() {
return isStarted.get();
}
boolean isWorking() {
return !isStopped.get() && !queue.isEmpty() ;
}
private static class NamedTask{
private final String name;
private final Task task;
private NamedTask(String name, Task task) {
this.name = name;
this.task = task;
}
}
}
| 2,659 | 0.533283 | 0.532531 | 93 | 27.580645 | 23.43388 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.430108 | false | false |
1
|
f3b93953f03786c2d3d0316ffcd4576050eaa0b8
| 16,140,487,116,663 |
7fa1757df57e9bd0f329257f4dcf92e707cd2e03
|
/src/main/java/io/jochimsen/cahwebservice/repository/WhiteCardRepository.java
|
005c08d0e07cbf527004134fff58974ecb962f74
|
[] |
no_license
|
soejoc/cah-webservice
|
https://github.com/soejoc/cah-webservice
|
e90663a9d882fbf4e232933c1e2dab79f36963bc
|
9ba6778345de9a0fda32c6007371f486b4d8cee6
|
refs/heads/master
| 2020-04-13T02:28:57.275000 | 2019-02-11T15:08:42 | 2019-02-11T15:08:42 | 162,903,817 | 0 | 0 | null | false | 2019-02-11T15:08:43 | 2018-12-23T15:48:21 | 2019-01-28T17:17:44 | 2019-02-11T15:08:42 | 314 | 0 | 0 | 0 |
Java
| false | null |
package io.jochimsen.cahwebservice.repository;
import io.jochimsen.cahwebservice.entity.WhiteCard;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface WhiteCardRepository extends JpaRepository<WhiteCard, Long> {
}
|
UTF-8
|
Java
| 305 |
java
|
WhiteCardRepository.java
|
Java
|
[] | null |
[] |
package io.jochimsen.cahwebservice.repository;
import io.jochimsen.cahwebservice.entity.WhiteCard;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface WhiteCardRepository extends JpaRepository<WhiteCard, Long> {
}
| 305 | 0.855738 | 0.855738 | 9 | 32.888889 | 28.195526 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.555556 | false | false |
1
|
6d7cc0813bf70f1d3c2629383889835e0863750c
| 146,028,932,654 |
fc53a0649c4f76638c1dedc1f6652181e7cb75d2
|
/Validator/src/main/java/com/galaxy/dao/impl/WorkDaoImpl.java
|
66f5a0c845a6fd412c73a15aa0882a00c0217a60
|
[] |
no_license
|
Bala2110/Galaxy
|
https://github.com/Bala2110/Galaxy
|
549bd19974ac6479a4e38360d9f9299a5565813e
|
01c32e78a330a89291def94692fbb729d18d618b
|
refs/heads/master
| 2020-03-25T12:18:47.719000 | 2018-08-06T18:54:26 | 2018-08-06T18:54:26 | 143,769,661 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.galaxy.dao.impl;
import java.util.List;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;
import com.galaxy.dao.WorkDao;
import com.galaxy.model.Registration;
@Repository
public class WorkDaoImpl implements WorkDao{
private static final Logger logger = LoggerFactory.getLogger(SearchDaoImpl.class);
private SessionFactory sessionFactory;
public void setSessionFactory(SessionFactory sf) {
this.sessionFactory = sf;
}
@Override
public List<Registration> listCandidates(String status){
Session session=this.sessionFactory.getCurrentSession();
List<Registration> listCandidates= session.createQuery("from Registration")
//+ "where staus=registered")
.list();
for(Registration c : listCandidates){
logger.info("Candidate List::"+c);
}
return listCandidates;
}
/*@Override
public list<Registration> listCandidates(String status){
Session session=this.sessionFactory.getCurrentSession();
List<Registration> listCandidates= session.createQuery("from addcandidate where staus=inprogress").list();
for(Registration c : listCandidates){
logger.info("Candidate List::"+c);
}
return listCandidates;
}
@Override
public list<Registration> listCandidates(String status){
Session session=this.sessionFactory.getCurrentSession();
List<Registration> listCandidates= session.createQuery("from addcandidate where staus=highpriority").list();
for(Registration c : listCandidates){
logger.info("Candidate List::"+c);
}
return listCandidates;
}
@Override
public list<Registration> listCandidates(String status){
Session session=this.sessionFactory.getCurrentSession();
List<Registration> listCandidates= session.createQuery("from addcandidate where staus=lowpriority").list();
for(Registration c : listCandidates){
logger.info("Candidate List::"+c);
}
return listCandidates;
}
@Override
public list<Registration> listCandidates(String status){
Session session=this.sessionFactory.getCurrentSession();
List<Registration> listCandidates= session.createQuery("from addcandidate where staus=completed").list();
for(Registration c : listCandidates){
logger.info("Candidate List::"+c);
}
return listCandidates;
}
@Override
public list<Registration> listCandidates(String status){
Session session=this.sessionFactory.getCurrentSession();
List<Registration> listCandidates= session.createQuery("from addcandidate where staus=rejected").list();
for(Registration c : listCandidates){
logger.info("Candidate List::"+c);
}
return listCandidates;
}*/
}
|
UTF-8
|
Java
| 2,694 |
java
|
WorkDaoImpl.java
|
Java
|
[] | null |
[] |
package com.galaxy.dao.impl;
import java.util.List;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;
import com.galaxy.dao.WorkDao;
import com.galaxy.model.Registration;
@Repository
public class WorkDaoImpl implements WorkDao{
private static final Logger logger = LoggerFactory.getLogger(SearchDaoImpl.class);
private SessionFactory sessionFactory;
public void setSessionFactory(SessionFactory sf) {
this.sessionFactory = sf;
}
@Override
public List<Registration> listCandidates(String status){
Session session=this.sessionFactory.getCurrentSession();
List<Registration> listCandidates= session.createQuery("from Registration")
//+ "where staus=registered")
.list();
for(Registration c : listCandidates){
logger.info("Candidate List::"+c);
}
return listCandidates;
}
/*@Override
public list<Registration> listCandidates(String status){
Session session=this.sessionFactory.getCurrentSession();
List<Registration> listCandidates= session.createQuery("from addcandidate where staus=inprogress").list();
for(Registration c : listCandidates){
logger.info("Candidate List::"+c);
}
return listCandidates;
}
@Override
public list<Registration> listCandidates(String status){
Session session=this.sessionFactory.getCurrentSession();
List<Registration> listCandidates= session.createQuery("from addcandidate where staus=highpriority").list();
for(Registration c : listCandidates){
logger.info("Candidate List::"+c);
}
return listCandidates;
}
@Override
public list<Registration> listCandidates(String status){
Session session=this.sessionFactory.getCurrentSession();
List<Registration> listCandidates= session.createQuery("from addcandidate where staus=lowpriority").list();
for(Registration c : listCandidates){
logger.info("Candidate List::"+c);
}
return listCandidates;
}
@Override
public list<Registration> listCandidates(String status){
Session session=this.sessionFactory.getCurrentSession();
List<Registration> listCandidates= session.createQuery("from addcandidate where staus=completed").list();
for(Registration c : listCandidates){
logger.info("Candidate List::"+c);
}
return listCandidates;
}
@Override
public list<Registration> listCandidates(String status){
Session session=this.sessionFactory.getCurrentSession();
List<Registration> listCandidates= session.createQuery("from addcandidate where staus=rejected").list();
for(Registration c : listCandidates){
logger.info("Candidate List::"+c);
}
return listCandidates;
}*/
}
| 2,694 | 0.766518 | 0.765776 | 87 | 29.965517 | 28.887196 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.873563 | false | false |
1
|
962443a6fcaeac7f5507ceebc7dc0bb2801e17ba
| 17,351,667,934,071 |
750bb6c6fa115fde1bfe646bb3359f886373d24e
|
/src/test/java/wat/WAT03.java
|
a1dc0458b23ce373c73a486579bd7d0857cfa32b
|
[] |
no_license
|
Basha692/BashaSelenium
|
https://github.com/Basha692/BashaSelenium
|
d21e2c7abd5f9a5d7c3be43578863186f2f7322f
|
37fb79f85e6c973610b14b53d3e14b6183219a41
|
refs/heads/master
| 2022-07-13T11:05:59.156000 | 2019-12-06T06:08:37 | 2019-12-06T06:08:37 | 226,252,795 | 0 | 0 | null | false | 2022-06-29T17:49:37 | 2019-12-06T05:30:40 | 2019-12-06T06:09:16 | 2022-06-29T17:49:36 | 9,007 | 0 | 0 | 6 |
Java
| false | false |
package wat;
import org.testng.Assert;
import org.testng.SkipException;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
import com.relevantcodes.extentreports.LogStatus;
import base.TestBase;
import util.ExtentManager;
import util.OnePObjectMap;
/**
* Class for testing all static contents in Author cluster search page
*
* @author UC225218
*
*/
public class WAT03 extends TestBase {
static int status = 1;
static String wos_title = "Web of Science: Author search";
static String sar_labs_text = "SaR Labs";
static String search_link_text = "Search";
static String welcome_text = "Welcome to SaR Labs, a place where you can try new functionality in development by the Scientific and Scholarly Research group of Clarivate Analytics.\n"
+ "\n"
+ "We are currently working on an improved author search tool for Web of Science. We welcome your feedback.";
static String search_suggestion_text = "Enter the author's name, ORCiD or RID to begin your search against Web of Science article groups.";
static String name_search_button_text = "Name search";
static String orcid_search_button_text = "ORCiD search";
static String last_name_inner_text = "Last name";
static String first_name_inner_text = "First name and middle initial(s)";
static String add_alt_name_text = "Include alternative name";
static String find_btn_text = "Find";
/**
* Method for displaying JIRA ID's for test case in specified path of Extent
* Reports
*
* @throws Exception,
* When Something unexpected
*/
@BeforeTest
public void beforeTest() throws Exception {
extent = ExtentManager.getReporter(filePath);
rowData = testcase.get(this.getClass().getSimpleName());
test = extent.startTest(rowData.getTestcaseId(), rowData.getTestcaseDescription()).assignCategory("WAT");
}
/**
* Method for login into WAT application using Steam ID
*
* @throws Exception,
* When WAT Login is not done
*/
@Test
@Parameters({ "username", "password" })
public void testLoginWATApp(String username, String password) throws Exception {
boolean testRunmode = getTestRunMode(rowData.getTestcaseRunmode());
boolean master_condition = suiteRunmode && testRunmode;
logger.info("checking master condition status-->" + this.getClass().getSimpleName() + "-->" + master_condition);
if (!master_condition) {
status = 3;
test.log(LogStatus.SKIP,
"Skipping test case " + this.getClass().getSimpleName() + " as the run mode is set to NO");
throw new SkipException("Skipping Test Case" + this.getClass().getSimpleName() + " as runmode set to NO");// reports
}
test.log(LogStatus.INFO, this.getClass().getSimpleName() + " execution starts.... ");
try {
openBrowser();
clearCookies();
maximizeWindow();
test.log(LogStatus.INFO, "Login to WAT Applicaton using valid WAT Entitled user ");
ob.navigate().to(host + CONFIG.getProperty("appendWATAppUrl"));
pf.getLoginTRInstance(ob).loginToWAT(username, password, test);
} catch (Throwable t) {
logFailureDetails(test, t, "Login Fail", "login_fail");
pf.getBrowserActionInstance(ob).closeBrowser();
}
}
/**
* Method to verify all the static page content in author search page.
*
* @throws Exception,
* When Something unexpected
*
*/
@Test(dependsOnMethods = { "testLoginWATApp" })
public void testStaticPageContent() throws Exception {
// NOTE - Assertion ERRORs are caught in EXCEPTION block just for
// Reporting purpose
try {
try {
// Verify WOS title text
Assert.assertTrue(pf.getBrowserActionInstance(ob)
.getElement(OnePObjectMap.WAT_WOS_AUTHOR_SEARCH_TITLE_XPATH).isDisplayed(),
"WOS title is not displayed");
Assert.assertEquals(pf.getBrowserActionInstance(ob)
.getElement(OnePObjectMap.WAT_WOS_AUTHOR_SEARCH_TITLE_XPATH).getText(), wos_title,
"WOS title text not matching");
test.log(LogStatus.PASS, "WOS title text is matching in WOS Author Search page");
} catch (AssertionError e) {
test.log(LogStatus.FAIL, "WOS title text is not present or not matching in WOS Author Search page");
logFailureDetails(test, e, "WOS title is not displayed", "wos_title_fail");
}
try {
// Verify SaR Labs Text
Assert.assertTrue(
pf.getBrowserActionInstance(ob).getElement(OnePObjectMap.WAT_SAR_LABS_TEXT_XPATH).isDisplayed(),
"SaR Labs Text is not present");
Assert.assertEquals(
pf.getBrowserActionInstance(ob).getElement(OnePObjectMap.WAT_SAR_LABS_TEXT_XPATH).getText(),
sar_labs_text, "SaR Labs text not matching");
test.log(LogStatus.PASS, "SaR Labs text matching in Author search page.");
} catch (AssertionError e) {
test.log(LogStatus.FAIL, "SaR Labs text not matching in Author search page.");
logFailureDetails(test, e, "SaR Labs Text is not present", "sar_label_fail");
}
try {
// Verify Search Link
Assert.assertTrue(
pf.getBrowserActionInstance(ob).getElement(OnePObjectMap.WAT_SEARCH_LINK_XPATH).isDisplayed(),
"Search link not present");
Assert.assertEquals(
pf.getBrowserActionInstance(ob).getElement(OnePObjectMap.WAT_SEARCH_LINK_XPATH).getText(),
search_link_text, "Search link text not matching");
test.log(LogStatus.PASS, "Search link is present and is displayed as expected in Author search page.");
} catch (AssertionError e) {
test.log(LogStatus.FAIL,
"Search link is not present or is not displayed as expected in Author search page.");
logFailureDetails(test, e, "Search link not present", "search_link_fail");
}
try {
// Verify Name search button is present
Assert.assertTrue(pf.getBrowserActionInstance(ob).getElement(OnePObjectMap.WAT_NAME_SEARCH_BUTTON_XPATH)
.isDisplayed(), "Name Search button is not displayed");
Assert.assertEquals(pf.getBrowserActionInstance(ob)
.getElement(OnePObjectMap.WAT_NAME_SEARCH_BUTTON_XPATH).getText(), name_search_button_text,
"Name search button text not matching");
test.log(LogStatus.PASS, "Name search button is present in Author search page.");
} catch (AssertionError e) {
test.log(LogStatus.FAIL,
"Name search button is not present or button text not matching in Author search page.");
logFailureDetails(test, e, "Name Search button is not displayed", "name_button_fail");
}
try {
// Verify ORCid search button is present
Assert.assertTrue(pf.getBrowserActionInstance(ob)
.getElement(OnePObjectMap.WAT_ORCiD_SEARCH_BUTTON_XPATH).isDisplayed(),
"ORCiD Search button is not displayed");
Assert.assertEquals(pf.getBrowserActionInstance(ob)
.getElement(OnePObjectMap.WAT_ORCiD_SEARCH_BUTTON_XPATH).getText(), orcid_search_button_text,
"Name search button text not matching");
test.log(LogStatus.PASS, "ORCiD search button is present in Author search page.");
} catch (AssertionError e) {
test.log(LogStatus.FAIL,
"ORCiD search button is not present or button text not matching in Author search page.");
logFailureDetails(test, e, "ORCiD Search button is not displayed", "orcid_button_fail");
}
try {
// Verify Welcome Text
Assert.assertTrue(
pf.getBrowserActionInstance(ob).getElement(OnePObjectMap.WAT_WELCOME_TEXT_XPATH).isDisplayed(),
"Welcome text is not displayed");
Assert.assertEquals(
pf.getBrowserActionInstance(ob).getElement(OnePObjectMap.WAT_WELCOME_TEXT_XPATH).getText(),
welcome_text, "Welcome text not matching");
test.log(LogStatus.PASS, "Welcome text is present and is displayed as expected in Author search page.");
} catch (AssertionError e) {
e.printStackTrace();
test.log(LogStatus.FAIL,
"Welcome text is not present or its not displayed as expected in Author search page.");
logFailureDetails(test, e, "Welcome text is not displayed", "welcome_text_fail");
}
try {
// Verify search suggestion text
Assert.assertTrue(pf.getBrowserActionInstance(ob)
.getElement(OnePObjectMap.WAT_SEARCH_SUGGESTION_TEXT_XPATH).isDisplayed(),
"Search suggestion text is not displayed");
Assert.assertEquals(pf.getBrowserActionInstance(ob)
.getElement(OnePObjectMap.WAT_SEARCH_SUGGESTION_TEXT_XPATH).getText(), search_suggestion_text,
"Search suggestion text not matching");
test.log(LogStatus.PASS,
"Search suggestion text is present and is displayed as expected in Author search page.");
} catch (AssertionError e) {
test.log(LogStatus.FAIL,
"Search suggestion text is not present or is not displayed as expected in Author search page.");
logFailureDetails(test, e, "Search suggestion text is not displayed", "search_suggestion_text_fail");
}
try {
// Verify Lastname textbox inner text
Assert.assertTrue(pf.getBrowserActionInstance(ob)
.getElement(OnePObjectMap.WAT_AUTHOR_LASTNAME_INNERTEXT_XPATH).isDisplayed(),
"Lastname textbox is not displayed");
Assert.assertEquals(pf.getBrowserActionInstance(ob)
.getElement(OnePObjectMap.WAT_AUTHOR_LASTNAME_INNERTEXT_XPATH).getText(), last_name_inner_text,
"Lastname textbox inner text not matching");
test.log(LogStatus.PASS,
"Lastname textbox inner text is present and is displayed as expected in Author search page.");
} catch (AssertionError e) {
test.log(LogStatus.FAIL,
"Lastname textbox inner text is not present or is not displayed as expected in Author search page.");
logFailureDetails(test, e, "Lastname textbox is not displayed", "ln_textbox_fail");
}
try {
// Verify Firstname textbox inner text
Assert.assertTrue(pf.getBrowserActionInstance(ob)
.getElement(OnePObjectMap.WAT_AUTHOR_FIRSTSTNAME_INNERTEXT_XPATH).isDisplayed(),
"Firstname textbox is not displayed");
Assert.assertEquals(pf.getBrowserActionInstance(ob)
.getElement(OnePObjectMap.WAT_AUTHOR_FIRSTSTNAME_INNERTEXT_XPATH).getText(),
first_name_inner_text, "Firstname textbox inner text not matching");
test.log(LogStatus.PASS,
"Firstname textbox inner text is present and is displayed as expected in Author search page.");
} catch (AssertionError e) {
test.log(LogStatus.FAIL,
"Firstname textbox inner text is not present or is not displayed as expected in Author search page.");
logFailureDetails(test, e, "Firstname textbox is not displayed", "fn_textbox_fail");
}
try {
// Verify Add alternate name inner text
Assert.assertTrue(pf.getBrowserActionInstance(ob)
.getElement(OnePObjectMap.WAT_ADD_ALT_NAME_BTN_TEXT_XPATH).isDisplayed(),
"Add alternate name button is not displayed");
Assert.assertEquals(pf.getBrowserActionInstance(ob)
.getElement(OnePObjectMap.WAT_ADD_ALT_NAME_BTN_TEXT_XPATH).getText(), add_alt_name_text,
"Add alternate name inner text not matching");
test.log(LogStatus.PASS,
"Include alternate name inner text is present and is displayed as expected in Author search page.");
} catch (AssertionError e) {
test.log(LogStatus.FAIL,
"Include alternate name inner text is not present or is not displayed as expected in Author search page.");
logFailureDetails(test, e, "Add alternate name button is not displayed", "alt_name_btn_fail");
}
try {
// Verify Find button
Assert.assertTrue(
pf.getBrowserActionInstance(ob)
.getElement(OnePObjectMap.WAT_AUTHOR_SEARCH_BY_NAME_FIND_BTN_XPATH).isDisplayed(),
"Find button is not displayed");
Assert.assertEquals(
pf.getBrowserActionInstance(ob)
.getElement(OnePObjectMap.WAT_AUTHOR_SEARCH_BY_NAME_FIND_BTN_XPATH).getText(),
find_btn_text, "Find button text not matching");
test.log(LogStatus.PASS,
"Find button text is present and is displayed as expected in Author search page.");
pf.getBrowserActionInstance(ob).closeBrowser();
} catch (AssertionError e) {
test.log(LogStatus.FAIL,
"Find button text is not present or is not displayed as expected in Author search page.");
logFailureDetails(test, e, "Find button is not displayed", "find_btn_fail");
}
} catch (Exception e) {
logFailureDetails(test, e, "Author Search Fail", "author_search_fail");
pf.getBrowserActionInstance(ob).closeBrowser();
}
}
/**
* updating Extent Report with test case status whether it is PASS or FAIL
* or SKIP
*/
@AfterTest
public void reportTestResult() {
extent.endTest(test);
/*
* if (status == 1) TestUtil.reportDataSetResult(profilexls,
* "Test Cases", TestUtil.getRowNum(profilexls,
* this.getClass().getSimpleName()), "PASS"); else if (status == 2)
* TestUtil.reportDataSetResult(profilexls, "Test Cases",
* TestUtil.getRowNum(profilexls, this.getClass().getSimpleName()),
* "FAIL"); else TestUtil.reportDataSetResult(profilexls, "Test Cases",
* TestUtil.getRowNum(profilexls, this.getClass().getSimpleName()),
* "SKIP");
*/
}
}
|
UTF-8
|
Java
| 13,030 |
java
|
WAT03.java
|
Java
|
[
{
"context": "tents in Author cluster search page\n * \n * @author UC225218\n *\n */\n\npublic class WAT03 extends TestBase {\n\n\ts",
"end": 461,
"score": 0.9857803583145142,
"start": 453,
"tag": "USERNAME",
"value": "UC225218"
}
] | null |
[] |
package wat;
import org.testng.Assert;
import org.testng.SkipException;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
import com.relevantcodes.extentreports.LogStatus;
import base.TestBase;
import util.ExtentManager;
import util.OnePObjectMap;
/**
* Class for testing all static contents in Author cluster search page
*
* @author UC225218
*
*/
public class WAT03 extends TestBase {
static int status = 1;
static String wos_title = "Web of Science: Author search";
static String sar_labs_text = "SaR Labs";
static String search_link_text = "Search";
static String welcome_text = "Welcome to SaR Labs, a place where you can try new functionality in development by the Scientific and Scholarly Research group of Clarivate Analytics.\n"
+ "\n"
+ "We are currently working on an improved author search tool for Web of Science. We welcome your feedback.";
static String search_suggestion_text = "Enter the author's name, ORCiD or RID to begin your search against Web of Science article groups.";
static String name_search_button_text = "Name search";
static String orcid_search_button_text = "ORCiD search";
static String last_name_inner_text = "Last name";
static String first_name_inner_text = "First name and middle initial(s)";
static String add_alt_name_text = "Include alternative name";
static String find_btn_text = "Find";
/**
* Method for displaying JIRA ID's for test case in specified path of Extent
* Reports
*
* @throws Exception,
* When Something unexpected
*/
@BeforeTest
public void beforeTest() throws Exception {
extent = ExtentManager.getReporter(filePath);
rowData = testcase.get(this.getClass().getSimpleName());
test = extent.startTest(rowData.getTestcaseId(), rowData.getTestcaseDescription()).assignCategory("WAT");
}
/**
* Method for login into WAT application using Steam ID
*
* @throws Exception,
* When WAT Login is not done
*/
@Test
@Parameters({ "username", "password" })
public void testLoginWATApp(String username, String password) throws Exception {
boolean testRunmode = getTestRunMode(rowData.getTestcaseRunmode());
boolean master_condition = suiteRunmode && testRunmode;
logger.info("checking master condition status-->" + this.getClass().getSimpleName() + "-->" + master_condition);
if (!master_condition) {
status = 3;
test.log(LogStatus.SKIP,
"Skipping test case " + this.getClass().getSimpleName() + " as the run mode is set to NO");
throw new SkipException("Skipping Test Case" + this.getClass().getSimpleName() + " as runmode set to NO");// reports
}
test.log(LogStatus.INFO, this.getClass().getSimpleName() + " execution starts.... ");
try {
openBrowser();
clearCookies();
maximizeWindow();
test.log(LogStatus.INFO, "Login to WAT Applicaton using valid WAT Entitled user ");
ob.navigate().to(host + CONFIG.getProperty("appendWATAppUrl"));
pf.getLoginTRInstance(ob).loginToWAT(username, password, test);
} catch (Throwable t) {
logFailureDetails(test, t, "Login Fail", "login_fail");
pf.getBrowserActionInstance(ob).closeBrowser();
}
}
/**
* Method to verify all the static page content in author search page.
*
* @throws Exception,
* When Something unexpected
*
*/
@Test(dependsOnMethods = { "testLoginWATApp" })
public void testStaticPageContent() throws Exception {
// NOTE - Assertion ERRORs are caught in EXCEPTION block just for
// Reporting purpose
try {
try {
// Verify WOS title text
Assert.assertTrue(pf.getBrowserActionInstance(ob)
.getElement(OnePObjectMap.WAT_WOS_AUTHOR_SEARCH_TITLE_XPATH).isDisplayed(),
"WOS title is not displayed");
Assert.assertEquals(pf.getBrowserActionInstance(ob)
.getElement(OnePObjectMap.WAT_WOS_AUTHOR_SEARCH_TITLE_XPATH).getText(), wos_title,
"WOS title text not matching");
test.log(LogStatus.PASS, "WOS title text is matching in WOS Author Search page");
} catch (AssertionError e) {
test.log(LogStatus.FAIL, "WOS title text is not present or not matching in WOS Author Search page");
logFailureDetails(test, e, "WOS title is not displayed", "wos_title_fail");
}
try {
// Verify SaR Labs Text
Assert.assertTrue(
pf.getBrowserActionInstance(ob).getElement(OnePObjectMap.WAT_SAR_LABS_TEXT_XPATH).isDisplayed(),
"SaR Labs Text is not present");
Assert.assertEquals(
pf.getBrowserActionInstance(ob).getElement(OnePObjectMap.WAT_SAR_LABS_TEXT_XPATH).getText(),
sar_labs_text, "SaR Labs text not matching");
test.log(LogStatus.PASS, "SaR Labs text matching in Author search page.");
} catch (AssertionError e) {
test.log(LogStatus.FAIL, "SaR Labs text not matching in Author search page.");
logFailureDetails(test, e, "SaR Labs Text is not present", "sar_label_fail");
}
try {
// Verify Search Link
Assert.assertTrue(
pf.getBrowserActionInstance(ob).getElement(OnePObjectMap.WAT_SEARCH_LINK_XPATH).isDisplayed(),
"Search link not present");
Assert.assertEquals(
pf.getBrowserActionInstance(ob).getElement(OnePObjectMap.WAT_SEARCH_LINK_XPATH).getText(),
search_link_text, "Search link text not matching");
test.log(LogStatus.PASS, "Search link is present and is displayed as expected in Author search page.");
} catch (AssertionError e) {
test.log(LogStatus.FAIL,
"Search link is not present or is not displayed as expected in Author search page.");
logFailureDetails(test, e, "Search link not present", "search_link_fail");
}
try {
// Verify Name search button is present
Assert.assertTrue(pf.getBrowserActionInstance(ob).getElement(OnePObjectMap.WAT_NAME_SEARCH_BUTTON_XPATH)
.isDisplayed(), "Name Search button is not displayed");
Assert.assertEquals(pf.getBrowserActionInstance(ob)
.getElement(OnePObjectMap.WAT_NAME_SEARCH_BUTTON_XPATH).getText(), name_search_button_text,
"Name search button text not matching");
test.log(LogStatus.PASS, "Name search button is present in Author search page.");
} catch (AssertionError e) {
test.log(LogStatus.FAIL,
"Name search button is not present or button text not matching in Author search page.");
logFailureDetails(test, e, "Name Search button is not displayed", "name_button_fail");
}
try {
// Verify ORCid search button is present
Assert.assertTrue(pf.getBrowserActionInstance(ob)
.getElement(OnePObjectMap.WAT_ORCiD_SEARCH_BUTTON_XPATH).isDisplayed(),
"ORCiD Search button is not displayed");
Assert.assertEquals(pf.getBrowserActionInstance(ob)
.getElement(OnePObjectMap.WAT_ORCiD_SEARCH_BUTTON_XPATH).getText(), orcid_search_button_text,
"Name search button text not matching");
test.log(LogStatus.PASS, "ORCiD search button is present in Author search page.");
} catch (AssertionError e) {
test.log(LogStatus.FAIL,
"ORCiD search button is not present or button text not matching in Author search page.");
logFailureDetails(test, e, "ORCiD Search button is not displayed", "orcid_button_fail");
}
try {
// Verify Welcome Text
Assert.assertTrue(
pf.getBrowserActionInstance(ob).getElement(OnePObjectMap.WAT_WELCOME_TEXT_XPATH).isDisplayed(),
"Welcome text is not displayed");
Assert.assertEquals(
pf.getBrowserActionInstance(ob).getElement(OnePObjectMap.WAT_WELCOME_TEXT_XPATH).getText(),
welcome_text, "Welcome text not matching");
test.log(LogStatus.PASS, "Welcome text is present and is displayed as expected in Author search page.");
} catch (AssertionError e) {
e.printStackTrace();
test.log(LogStatus.FAIL,
"Welcome text is not present or its not displayed as expected in Author search page.");
logFailureDetails(test, e, "Welcome text is not displayed", "welcome_text_fail");
}
try {
// Verify search suggestion text
Assert.assertTrue(pf.getBrowserActionInstance(ob)
.getElement(OnePObjectMap.WAT_SEARCH_SUGGESTION_TEXT_XPATH).isDisplayed(),
"Search suggestion text is not displayed");
Assert.assertEquals(pf.getBrowserActionInstance(ob)
.getElement(OnePObjectMap.WAT_SEARCH_SUGGESTION_TEXT_XPATH).getText(), search_suggestion_text,
"Search suggestion text not matching");
test.log(LogStatus.PASS,
"Search suggestion text is present and is displayed as expected in Author search page.");
} catch (AssertionError e) {
test.log(LogStatus.FAIL,
"Search suggestion text is not present or is not displayed as expected in Author search page.");
logFailureDetails(test, e, "Search suggestion text is not displayed", "search_suggestion_text_fail");
}
try {
// Verify Lastname textbox inner text
Assert.assertTrue(pf.getBrowserActionInstance(ob)
.getElement(OnePObjectMap.WAT_AUTHOR_LASTNAME_INNERTEXT_XPATH).isDisplayed(),
"Lastname textbox is not displayed");
Assert.assertEquals(pf.getBrowserActionInstance(ob)
.getElement(OnePObjectMap.WAT_AUTHOR_LASTNAME_INNERTEXT_XPATH).getText(), last_name_inner_text,
"Lastname textbox inner text not matching");
test.log(LogStatus.PASS,
"Lastname textbox inner text is present and is displayed as expected in Author search page.");
} catch (AssertionError e) {
test.log(LogStatus.FAIL,
"Lastname textbox inner text is not present or is not displayed as expected in Author search page.");
logFailureDetails(test, e, "Lastname textbox is not displayed", "ln_textbox_fail");
}
try {
// Verify Firstname textbox inner text
Assert.assertTrue(pf.getBrowserActionInstance(ob)
.getElement(OnePObjectMap.WAT_AUTHOR_FIRSTSTNAME_INNERTEXT_XPATH).isDisplayed(),
"Firstname textbox is not displayed");
Assert.assertEquals(pf.getBrowserActionInstance(ob)
.getElement(OnePObjectMap.WAT_AUTHOR_FIRSTSTNAME_INNERTEXT_XPATH).getText(),
first_name_inner_text, "Firstname textbox inner text not matching");
test.log(LogStatus.PASS,
"Firstname textbox inner text is present and is displayed as expected in Author search page.");
} catch (AssertionError e) {
test.log(LogStatus.FAIL,
"Firstname textbox inner text is not present or is not displayed as expected in Author search page.");
logFailureDetails(test, e, "Firstname textbox is not displayed", "fn_textbox_fail");
}
try {
// Verify Add alternate name inner text
Assert.assertTrue(pf.getBrowserActionInstance(ob)
.getElement(OnePObjectMap.WAT_ADD_ALT_NAME_BTN_TEXT_XPATH).isDisplayed(),
"Add alternate name button is not displayed");
Assert.assertEquals(pf.getBrowserActionInstance(ob)
.getElement(OnePObjectMap.WAT_ADD_ALT_NAME_BTN_TEXT_XPATH).getText(), add_alt_name_text,
"Add alternate name inner text not matching");
test.log(LogStatus.PASS,
"Include alternate name inner text is present and is displayed as expected in Author search page.");
} catch (AssertionError e) {
test.log(LogStatus.FAIL,
"Include alternate name inner text is not present or is not displayed as expected in Author search page.");
logFailureDetails(test, e, "Add alternate name button is not displayed", "alt_name_btn_fail");
}
try {
// Verify Find button
Assert.assertTrue(
pf.getBrowserActionInstance(ob)
.getElement(OnePObjectMap.WAT_AUTHOR_SEARCH_BY_NAME_FIND_BTN_XPATH).isDisplayed(),
"Find button is not displayed");
Assert.assertEquals(
pf.getBrowserActionInstance(ob)
.getElement(OnePObjectMap.WAT_AUTHOR_SEARCH_BY_NAME_FIND_BTN_XPATH).getText(),
find_btn_text, "Find button text not matching");
test.log(LogStatus.PASS,
"Find button text is present and is displayed as expected in Author search page.");
pf.getBrowserActionInstance(ob).closeBrowser();
} catch (AssertionError e) {
test.log(LogStatus.FAIL,
"Find button text is not present or is not displayed as expected in Author search page.");
logFailureDetails(test, e, "Find button is not displayed", "find_btn_fail");
}
} catch (Exception e) {
logFailureDetails(test, e, "Author Search Fail", "author_search_fail");
pf.getBrowserActionInstance(ob).closeBrowser();
}
}
/**
* updating Extent Report with test case status whether it is PASS or FAIL
* or SKIP
*/
@AfterTest
public void reportTestResult() {
extent.endTest(test);
/*
* if (status == 1) TestUtil.reportDataSetResult(profilexls,
* "Test Cases", TestUtil.getRowNum(profilexls,
* this.getClass().getSimpleName()), "PASS"); else if (status == 2)
* TestUtil.reportDataSetResult(profilexls, "Test Cases",
* TestUtil.getRowNum(profilexls, this.getClass().getSimpleName()),
* "FAIL"); else TestUtil.reportDataSetResult(profilexls, "Test Cases",
* TestUtil.getRowNum(profilexls, this.getClass().getSimpleName()),
* "SKIP");
*/
}
}
| 13,030 | 0.716807 | 0.715886 | 302 | 42.145695 | 35.14415 | 184 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.665563 | false | false |
1
|
25a4b1b373864be08b6b6c44661640daa4401b64
| 3,736,621,584,046 |
564b91a54309e77a9767934fe70100dcfe8ea2d1
|
/src/com/c0destudy/sokoban/helper/Point.java
|
cf4bdfcff4ebf855d846ed74fc54a52591658ccf
|
[
"MIT"
] |
permissive
|
TheStudyGroup/Sokoban
|
https://github.com/TheStudyGroup/Sokoban
|
735ef32c617757f681618f1ce9a85eaa337f243d
|
4fca9febf7e967879a1b3f23490894f894f67eac
|
refs/heads/main
| 2023-04-10T14:14:06.413000 | 2021-04-11T16:02:35 | 2021-04-11T16:02:35 | 302,822,561 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.c0destudy.sokoban.helper;
import java.io.Serializable;
public class Point implements Serializable
{
private int x;
private int y;
public Point(final int x, final int y) { this.x = x; this.y = y; }
public Point(final Point point) { this(point.getX(), point.getY()); }
public int getX() { return x; }
public int getY() { return y; }
public void add(final Point point) {
x += point.x;
y += point.y;
}
@Override
public boolean equals(Object object) {
if (object instanceof Point) {
final Point point = (Point)object;
return x == point.x && y == point.y;
}
return false;
}
// Static
public static Point add(final Point a, final Point b) {
return new Point(a.x + b.x, a.y + b.y);
}
public static Point add(final Point a, final Point b, final Point c) {
return new Point(a.x + b.x + c.x, a.y + b.y + c.y);
}
public static Point reverse(final Point a) {
return new Point(-a.x, -a.y);
}
}
|
UTF-8
|
Java
| 1,083 |
java
|
Point.java
|
Java
|
[] | null |
[] |
package com.c0destudy.sokoban.helper;
import java.io.Serializable;
public class Point implements Serializable
{
private int x;
private int y;
public Point(final int x, final int y) { this.x = x; this.y = y; }
public Point(final Point point) { this(point.getX(), point.getY()); }
public int getX() { return x; }
public int getY() { return y; }
public void add(final Point point) {
x += point.x;
y += point.y;
}
@Override
public boolean equals(Object object) {
if (object instanceof Point) {
final Point point = (Point)object;
return x == point.x && y == point.y;
}
return false;
}
// Static
public static Point add(final Point a, final Point b) {
return new Point(a.x + b.x, a.y + b.y);
}
public static Point add(final Point a, final Point b, final Point c) {
return new Point(a.x + b.x + c.x, a.y + b.y + c.y);
}
public static Point reverse(final Point a) {
return new Point(-a.x, -a.y);
}
}
| 1,083 | 0.561404 | 0.56048 | 39 | 26.76923 | 24.070902 | 84 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.641026 | false | false |
1
|
0b8bbd17e0491085e42419db30eccedde11b6153
| 13,245,679,164,540 |
c05428a9ce856c28579af9c6fb987bc9eb9362f8
|
/VisuGraph2/ForceDirect.java
|
c7439b2cd8f37fa2727c7a9918a7e9592a928e31
|
[] |
no_license
|
bernardDousset/tetralogie
|
https://github.com/bernardDousset/tetralogie
|
63c4d26bbb8c497e3439f495cb07d810a2137da8
|
ce8d1ce7975a228375742cef3ba4eff140095d3a
|
refs/heads/master
| 2021-04-12T04:22:51.598000 | 2018-03-20T02:59:49 | 2018-03-20T02:59:49 | 125,950,024 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.util.*;
public class ForceDirect {
Graphe gr;
public double time;
public double temp = 5.0;
public double minTemp = 3.0;
protected double K, L, D;
public ForceDirect(Graphe gr, double d ) {
time = 0;
this.D = d;
this.L = d*gr.nombreSommets();
this.K = Math.sqrt(this.L*this.L/gr.nombreSommets() );
}
public final double Temp() { return temp; }
public final void Temp( double d ) { temp = d; }
public final double minTemp() { return minTemp;}
public final void minTemp( double d ) { minTemp = d;}
protected final double fa(double x, double ac, double ae) { /* ac*x*x/K;*/
/*System.out.println("valeur de fae :"+ae);
System.out.println("valeur de fae :"+ac);
System.out.println("resultat attraction : "+ (ac*Math.pow(x, ae)/K));
*/return ac*Math.pow(x, ae)/K;}
protected final double fr(double x, double rc, double re) { /* rc* K*K/x;*/
/*System.out.println("valeur de fre :"+re);
System.out.println("valeur de fre :"+rc);
System.out.println("resultat repulsion : "+ (rc*(K*K)/Math.pow(x, re)));
*/return rc*(K*K)/Math.pow(x, re);}
// Temperature du systeme
protected final double temp(double t) { return (L/(2*D))/(1 + Math.exp(t/8-5));}
protected double energie = 0.0;
public final double D() { return D; }
public final void D( double d ) { D = d;}
public final void L() { L = D*gr.nombreSommets();}
public double area() { return L*L; }
public void K(double kk) {
this.K = kk;
}
public double K() {
return Math.sqrt(area()/gr.nombreSommets() );
}
public double min( double a, double b ) { return (a < b )?a:b; }
public double max( double a, double b ) { return ( a > b)?a:b; }
} // class ForceDirect
|
UTF-8
|
Java
| 1,768 |
java
|
ForceDirect.java
|
Java
|
[] | null |
[] |
import java.util.*;
public class ForceDirect {
Graphe gr;
public double time;
public double temp = 5.0;
public double minTemp = 3.0;
protected double K, L, D;
public ForceDirect(Graphe gr, double d ) {
time = 0;
this.D = d;
this.L = d*gr.nombreSommets();
this.K = Math.sqrt(this.L*this.L/gr.nombreSommets() );
}
public final double Temp() { return temp; }
public final void Temp( double d ) { temp = d; }
public final double minTemp() { return minTemp;}
public final void minTemp( double d ) { minTemp = d;}
protected final double fa(double x, double ac, double ae) { /* ac*x*x/K;*/
/*System.out.println("valeur de fae :"+ae);
System.out.println("valeur de fae :"+ac);
System.out.println("resultat attraction : "+ (ac*Math.pow(x, ae)/K));
*/return ac*Math.pow(x, ae)/K;}
protected final double fr(double x, double rc, double re) { /* rc* K*K/x;*/
/*System.out.println("valeur de fre :"+re);
System.out.println("valeur de fre :"+rc);
System.out.println("resultat repulsion : "+ (rc*(K*K)/Math.pow(x, re)));
*/return rc*(K*K)/Math.pow(x, re);}
// Temperature du systeme
protected final double temp(double t) { return (L/(2*D))/(1 + Math.exp(t/8-5));}
protected double energie = 0.0;
public final double D() { return D; }
public final void D( double d ) { D = d;}
public final void L() { L = D*gr.nombreSommets();}
public double area() { return L*L; }
public void K(double kk) {
this.K = kk;
}
public double K() {
return Math.sqrt(area()/gr.nombreSommets() );
}
public double min( double a, double b ) { return (a < b )?a:b; }
public double max( double a, double b ) { return ( a > b)?a:b; }
} // class ForceDirect
| 1,768 | 0.606335 | 0.600113 | 54 | 31.722221 | 23.923038 | 84 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.12963 | false | false |
1
|
13144efb4c0bb0a89ae490d02fe122d650fd7d3d
| 22,024,592,318,284 |
bd69d3ed94588e673dd08b1e9655fe342a596dd5
|
/Client/co/swiftbook/entity/Room.java
|
45db1bbc4ed1a6a09cd40403cdf82a3f756a12a4
|
[] |
no_license
|
brianjmorris/SwiftBook
|
https://github.com/brianjmorris/SwiftBook
|
068196605e27b808f0c8bc9e5e74d83db2c12762
|
cf3b10f08e57e4a145dbdfab6d362368855198be
|
refs/heads/master
| 2020-04-17T02:34:00.948000 | 2019-05-24T16:36:44 | 2019-05-24T16:36:44 | 166,141,647 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package co.swiftbook.entity;
import co.swiftbook.exception.ApiObjectException;
public class Room extends ApiObject {
private int roomID = -1;
private Building building;
private String name;
private String roomNumber;
private String floorNumber;
private String buildingSection;
private String roomType; // classroom, conference room, etc.
public Room(Building building, String name, String roomNumber,
String floorNumber, String buildingSection, String roomType) {
setBuilding(building);
setName(name);
setRoomNumber(roomNumber);
setFloorNumber(floorNumber);
setBuildingSection(buildingSection);
setRoomType(roomType);
}
@Override
public String toJson() {
String json = "{ ";
json += "\"roomID\" : \"" + this.getID() + "\", ";
json += "\"buildingID\" : \"" + this.getBuilding().getID() + "\", ";
json += "\"name\" : \"" + this.getName() + "\", ";
json += "\"roomNumber\" : \"" + this.getRoomNumber() + "\", ";
json += "\"floorNumber\" : \"" + this.getFloorNumber() + "\", ";
json += "\"buildingSection\" : \"" + this.getBuildingSection() + "\", ";
json += "\"roomType\" : \"" + this.getRoomType() + "\"";
json += " }";
return json;
}
/**
* @return the roomID
*/
@Override
public int getID() {
return this.roomID;
}
/**
* @param id the roomID to set
*/
@Override
protected void setID(int id) {
this.roomID = id;
}
/**
* @return the building
*/
public Building getBuilding() {
return building;
}
/**
* @param building the building to set
*/
public void setBuilding(Building building) {
if(building.getID() < 0)
throw new ApiObjectException("Building does not have an ID");
this.building = building;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the roomNumber
*/
public String getRoomNumber() {
return roomNumber;
}
/**
* @param roomNumber the roomNumber to set
*/
public void setRoomNumber(String roomNumber) {
this.roomNumber = roomNumber;
}
/**
* @return the floorNumber
*/
public String getFloorNumber() {
return floorNumber;
}
/**
* @param floorNumber the floorNumber to set
*/
public void setFloorNumber(String floorNumber) {
this.floorNumber = floorNumber;
}
/**
* @return the buildingSection
*/
public String getBuildingSection() {
return buildingSection;
}
/**
* @param buildingSection the buildingSection to set
*/
public void setBuildingSection(String buildingSection) {
this.buildingSection = buildingSection;
}
/**
* @return the roomType
*/
public String getRoomType() {
return roomType;
}
/**
* @param roomType the roomType to set
*/
public void setRoomType(String roomType) {
this.roomType = roomType;
}
@Override
public String toString() {
return toJson();
}
}
|
UTF-8
|
Java
| 2,918 |
java
|
Room.java
|
Java
|
[] | null |
[] |
package co.swiftbook.entity;
import co.swiftbook.exception.ApiObjectException;
public class Room extends ApiObject {
private int roomID = -1;
private Building building;
private String name;
private String roomNumber;
private String floorNumber;
private String buildingSection;
private String roomType; // classroom, conference room, etc.
public Room(Building building, String name, String roomNumber,
String floorNumber, String buildingSection, String roomType) {
setBuilding(building);
setName(name);
setRoomNumber(roomNumber);
setFloorNumber(floorNumber);
setBuildingSection(buildingSection);
setRoomType(roomType);
}
@Override
public String toJson() {
String json = "{ ";
json += "\"roomID\" : \"" + this.getID() + "\", ";
json += "\"buildingID\" : \"" + this.getBuilding().getID() + "\", ";
json += "\"name\" : \"" + this.getName() + "\", ";
json += "\"roomNumber\" : \"" + this.getRoomNumber() + "\", ";
json += "\"floorNumber\" : \"" + this.getFloorNumber() + "\", ";
json += "\"buildingSection\" : \"" + this.getBuildingSection() + "\", ";
json += "\"roomType\" : \"" + this.getRoomType() + "\"";
json += " }";
return json;
}
/**
* @return the roomID
*/
@Override
public int getID() {
return this.roomID;
}
/**
* @param id the roomID to set
*/
@Override
protected void setID(int id) {
this.roomID = id;
}
/**
* @return the building
*/
public Building getBuilding() {
return building;
}
/**
* @param building the building to set
*/
public void setBuilding(Building building) {
if(building.getID() < 0)
throw new ApiObjectException("Building does not have an ID");
this.building = building;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the roomNumber
*/
public String getRoomNumber() {
return roomNumber;
}
/**
* @param roomNumber the roomNumber to set
*/
public void setRoomNumber(String roomNumber) {
this.roomNumber = roomNumber;
}
/**
* @return the floorNumber
*/
public String getFloorNumber() {
return floorNumber;
}
/**
* @param floorNumber the floorNumber to set
*/
public void setFloorNumber(String floorNumber) {
this.floorNumber = floorNumber;
}
/**
* @return the buildingSection
*/
public String getBuildingSection() {
return buildingSection;
}
/**
* @param buildingSection the buildingSection to set
*/
public void setBuildingSection(String buildingSection) {
this.buildingSection = buildingSection;
}
/**
* @return the roomType
*/
public String getRoomType() {
return roomType;
}
/**
* @param roomType the roomType to set
*/
public void setRoomType(String roomType) {
this.roomType = roomType;
}
@Override
public String toString() {
return toJson();
}
}
| 2,918 | 0.648389 | 0.647704 | 147 | 18.85034 | 19.205425 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.482993 | false | false |
1
|
267ec5be6719ee5b735013d8dd60aefac0733a1d
| 8,950,711,888,960 |
c3bd639b45be9923933b1c47948247aa7d565768
|
/app/src/main/java/ua/in/quireg/chan/ui/views/LoadMoreFooterView.java
|
7d7fb9d639c39f89e569ad1896ef378b1a7ee5d3
|
[
"MIT"
] |
permissive
|
vortexwolf/2ch-Browser
|
https://github.com/vortexwolf/2ch-Browser
|
9380af49ade533087fefa58fb235d03370d70788
|
428848e39616377ff4faad695cb3dfc86def354a
|
refs/heads/development
| 2022-09-17T05:32:33.893000 | 2019-07-01T05:43:02 | 2019-07-01T05:43:02 | 3,678,193 | 77 | 29 |
MIT
| false | 2022-09-10T10:04:16 | 2012-03-10T07:42:01 | 2022-06-18T22:30:40 | 2019-09-09T08:55:24 | 7,696 | 87 | 19 | 16 |
Java
| false | false |
package ua.in.quireg.chan.ui.views;
import android.content.Context;
import android.util.AttributeSet;
import com.aspsine.swipetoloadlayout.SwipeLoadMoreTrigger;
import com.aspsine.swipetoloadlayout.SwipeTrigger;
/**
* Created by Arcturus Mengsk on 3/11/2018, 11:58 AM.
* 2ch-Browser
*/
public class LoadMoreFooterView extends TextView implements SwipeTrigger, SwipeLoadMoreTrigger {
public LoadMoreFooterView(Context context) {
super(context);
}
public LoadMoreFooterView(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public void onLoadMore() {
setText("LOADING MORE");
}
@Override
public void onPrepare() {
setText("");
}
@Override
public void onMove(int yScrolled, boolean isComplete, boolean automatic) {
if (!isComplete) {
if (yScrolled <= -getHeight()) {
setText("RELEASE TO LOAD MORE");
} else {
setText("SWIPE TO LOAD MORE");
}
} else {
setText("LOAD MORE RETURNING");
}
}
@Override
public void onRelease() {
setText("LOADING MORE");
}
@Override
public void onComplete() {
setText("COMPLETE");
}
@Override
public void onReset() {
setText("");
}
}
|
UTF-8
|
Java
| 1,343 |
java
|
LoadMoreFooterView.java
|
Java
|
[
{
"context": "swipetoloadlayout.SwipeTrigger;\n\n/**\n * Created by Arcturus Mengsk on 3/11/2018, 11:58 AM.\n * 2ch-Browser\n */\n\npubli",
"end": 248,
"score": 0.9998393654823303,
"start": 233,
"tag": "NAME",
"value": "Arcturus Mengsk"
}
] | null |
[] |
package ua.in.quireg.chan.ui.views;
import android.content.Context;
import android.util.AttributeSet;
import com.aspsine.swipetoloadlayout.SwipeLoadMoreTrigger;
import com.aspsine.swipetoloadlayout.SwipeTrigger;
/**
* Created by <NAME> on 3/11/2018, 11:58 AM.
* 2ch-Browser
*/
public class LoadMoreFooterView extends TextView implements SwipeTrigger, SwipeLoadMoreTrigger {
public LoadMoreFooterView(Context context) {
super(context);
}
public LoadMoreFooterView(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public void onLoadMore() {
setText("LOADING MORE");
}
@Override
public void onPrepare() {
setText("");
}
@Override
public void onMove(int yScrolled, boolean isComplete, boolean automatic) {
if (!isComplete) {
if (yScrolled <= -getHeight()) {
setText("RELEASE TO LOAD MORE");
} else {
setText("SWIPE TO LOAD MORE");
}
} else {
setText("LOAD MORE RETURNING");
}
}
@Override
public void onRelease() {
setText("LOADING MORE");
}
@Override
public void onComplete() {
setText("COMPLETE");
}
@Override
public void onReset() {
setText("");
}
}
| 1,334 | 0.60834 | 0.599404 | 60 | 21.4 | 21.286303 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.35 | false | false |
1
|
5da65fd85e36570fba931f82c06e07f9f674847e
| 5,514,738,009,069 |
27f007db5cb6ff140c744ff5a27b5e2d4a74e3ea
|
/e-payment-webservice-client/src/main/java/org/e/payment/webservice/client/vo/httpclient/BankTranWebServiceReverseRequest.java
|
ebfe237c7802f332b2b1c14f1a694aa6ce6012a0
|
[] |
no_license
|
moutainhigh/e
|
https://github.com/moutainhigh/e
|
8afec7e10cb7795e1653f787bfe978222da01c4e
|
435725913cddec2300bd15d41441c771577354ef
|
refs/heads/master
| 2021-09-21T00:18:17.897000 | 2018-08-17T09:03:59 | 2018-08-17T09:03:59 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.e.payment.webservice.client.vo.httpclient;
public class BankTranWebServiceReverseRequest {
private String userName;
private String password;
private String ipAddress;
private String bankId;
private String interfaceVersion;
private String refNo;
private String reverseRefNo;
public String getBankId() {
return bankId;
}
public void setBankId(String bankId) {
this.bankId = bankId;
}
public String getIpAddress() {
return ipAddress;
}
public void setIpAddress(String ipAddress) {
this.ipAddress = ipAddress;
}
public String getInterfaceVersion() {
return interfaceVersion;
}
public void setInterfaceVersion(String interfaceVersion) {
this.interfaceVersion = interfaceVersion;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getRefNo() {
return refNo;
}
public void setRefNo(String refNo) {
this.refNo = refNo;
}
public String getReverseRefNo() {
return reverseRefNo;
}
public void setReverseRefNo(String reverseRefNo) {
this.reverseRefNo = reverseRefNo;
}
}
|
UTF-8
|
Java
| 1,255 |
java
|
BankTranWebServiceReverseRequest.java
|
Java
|
[
{
"context": "BankTranWebServiceReverseRequest {\n\tprivate String userName;\n\tprivate String password;\n\tprivate String ipAddr",
"end": 128,
"score": 0.9581926465034485,
"start": 120,
"tag": "USERNAME",
"value": "userName"
},
{
"context": "rsion;\n\t}\n\n\tpublic String getUserName() {\n\t\treturn userName;\n\t}\n\n\tpublic void setUserName(String userName) {\n",
"end": 775,
"score": 0.9918133020401001,
"start": 767,
"tag": "USERNAME",
"value": "userName"
},
{
"context": "turn userName;\n\t}\n\n\tpublic void setUserName(String userName) {\n\t\tthis.userName = userName;\n\t}\n\n\tpublic String",
"end": 821,
"score": 0.9439235925674438,
"start": 813,
"tag": "USERNAME",
"value": "userName"
},
{
"context": "d setUserName(String userName) {\n\t\tthis.userName = userName;\n\t}\n\n\tpublic String getPassword() {\n\t\treturn pass",
"end": 851,
"score": 0.9970735907554626,
"start": 843,
"tag": "USERNAME",
"value": "userName"
}
] | null |
[] |
package org.e.payment.webservice.client.vo.httpclient;
public class BankTranWebServiceReverseRequest {
private String userName;
private String password;
private String ipAddress;
private String bankId;
private String interfaceVersion;
private String refNo;
private String reverseRefNo;
public String getBankId() {
return bankId;
}
public void setBankId(String bankId) {
this.bankId = bankId;
}
public String getIpAddress() {
return ipAddress;
}
public void setIpAddress(String ipAddress) {
this.ipAddress = ipAddress;
}
public String getInterfaceVersion() {
return interfaceVersion;
}
public void setInterfaceVersion(String interfaceVersion) {
this.interfaceVersion = interfaceVersion;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getRefNo() {
return refNo;
}
public void setRefNo(String refNo) {
this.refNo = refNo;
}
public String getReverseRefNo() {
return reverseRefNo;
}
public void setReverseRefNo(String reverseRefNo) {
this.reverseRefNo = reverseRefNo;
}
}
| 1,255 | 0.745817 | 0.745817 | 68 | 17.455883 | 17.103865 | 59 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.25 | false | false |
1
|
e3a07c211cea130ae216de624af72af11408d5e1
| 5,514,738,011,450 |
8fd44d92cd697b0d2ed1cbca77abc39bf8d84d7f
|
/src/im4ix/www/EditPaySlipServlet.java
|
0d321cd381b7861c7f0707c38b798e0b259e9e81
|
[] |
no_license
|
fncodr/im4ix
|
https://github.com/fncodr/im4ix
|
62b46a527ab82d9bbb6e985925e0ee8f9824d1c7
|
23ec05c9a1a8b7ed4e5a15ff1e00ae470f346bda
|
refs/heads/master
| 2016-08-31T22:17:04.128000 | 2016-08-22T01:31:45 | 2016-08-22T01:31:45 | 54,169,700 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package im4ix.www;
import im4ix.Employee;
import im4ix.PaySlip;
import im4ix.Im4ixUser;
import im4ix.db.Query;
import im4ix.db.SQL;
import im4ix.dom.Doc;
import im4ix.dom.HTTP;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.sql.SQLException;
import java.text.ParseException;
import java.util.Date;
public class EditPaySlipServlet extends Im4ixServlet {
static final long serialVersionUID = 1L;
@Override
protected Doc doCreateDoc() {
String path = request().getPathInfo().substring(1);
int end = path.indexOf('/');
String userName = path.substring(0, end);
int start = end + 1;
try {
Date endDate = cx().parseDate(
URLDecoder.decode(path.substring(start), "UTF-8"));
if (!userName.equals(cx().currentUser().name())) {
cx().checkAdminAccess();
}
Query q = PaySlip.table.query()
.select(PaySlip.table, Employee.table)
.join(PaySlip.table.EMPLOYEE)
.join(Employee.table.USER)
.where(SQL.eq(PaySlip.table.EMPLOYEE
.getCol(Employee.table.USER
.getCol(Im4ixUser.table.NAME)),
userName),
SQL.eq(PaySlip.table.END_DATE, endDate));
try (Query.Result qr = q.exec(cx())) {
if (!qr.next()) { throw HTTP.notFound(); }
PaySlip rec = PaySlip.table.loadRec(cx(), qr);
PaySlip.table.EMPLOYEE.loadRefRec(rec, qr);
return new PaySlipDoc(rec, request());
}
}
catch (SQLException e) { throw HTTP.internalServerError(e); }
catch (ParseException e) { throw HTTP.badRequestError(e); }
catch (UnsupportedEncodingException e) {
throw HTTP.internalServerError(e);
}
}
}
|
UTF-8
|
Java
| 1,626 |
java
|
EditPaySlipServlet.java
|
Java
|
[] | null |
[] |
package im4ix.www;
import im4ix.Employee;
import im4ix.PaySlip;
import im4ix.Im4ixUser;
import im4ix.db.Query;
import im4ix.db.SQL;
import im4ix.dom.Doc;
import im4ix.dom.HTTP;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.sql.SQLException;
import java.text.ParseException;
import java.util.Date;
public class EditPaySlipServlet extends Im4ixServlet {
static final long serialVersionUID = 1L;
@Override
protected Doc doCreateDoc() {
String path = request().getPathInfo().substring(1);
int end = path.indexOf('/');
String userName = path.substring(0, end);
int start = end + 1;
try {
Date endDate = cx().parseDate(
URLDecoder.decode(path.substring(start), "UTF-8"));
if (!userName.equals(cx().currentUser().name())) {
cx().checkAdminAccess();
}
Query q = PaySlip.table.query()
.select(PaySlip.table, Employee.table)
.join(PaySlip.table.EMPLOYEE)
.join(Employee.table.USER)
.where(SQL.eq(PaySlip.table.EMPLOYEE
.getCol(Employee.table.USER
.getCol(Im4ixUser.table.NAME)),
userName),
SQL.eq(PaySlip.table.END_DATE, endDate));
try (Query.Result qr = q.exec(cx())) {
if (!qr.next()) { throw HTTP.notFound(); }
PaySlip rec = PaySlip.table.loadRec(cx(), qr);
PaySlip.table.EMPLOYEE.loadRefRec(rec, qr);
return new PaySlipDoc(rec, request());
}
}
catch (SQLException e) { throw HTTP.internalServerError(e); }
catch (ParseException e) { throw HTTP.badRequestError(e); }
catch (UnsupportedEncodingException e) {
throw HTTP.internalServerError(e);
}
}
}
| 1,626 | 0.685117 | 0.675277 | 56 | 28.053572 | 17.971624 | 63 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.089286 | false | false |
1
|
c3c19938bf3a409798d9af8abfab1b7f135ac68f
| 15,410,342,704,101 |
ff7ceb2ae23617838738e895fa949ab9977b0ce8
|
/src/pahinave/algorithms/problems/Fibonacci.java
|
bde06dd5d234a7a315df9d306d9185f45d256ab9
|
[] |
no_license
|
pahinave/algorithms
|
https://github.com/pahinave/algorithms
|
3e1689c8c0cc8b307623012f0e7642ffe06554da
|
4906f33e64ef32850641dce0429ff960aa100c8d
|
refs/heads/master
| 2021-01-10T06:04:20.676000 | 2015-12-28T20:22:01 | 2015-12-28T20:22:01 | 46,161,533 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package pahinave.algorithms.problems;
public class Fibonacci {
public int fibonacci(int nth) {
if (nth == 0) {
return 0;
}
if (nth == 1) {
return 1;
}
int n_2 = 0;
int n_1 = 1;
int result = 0;
for (int i = 2; i <= nth; i++) {
result = n_1 + n_2;
n_2 = n_1;
n_1 = result;
}
return result;
}
}
|
UTF-8
|
Java
| 330 |
java
|
Fibonacci.java
|
Java
|
[] | null |
[] |
package pahinave.algorithms.problems;
public class Fibonacci {
public int fibonacci(int nth) {
if (nth == 0) {
return 0;
}
if (nth == 1) {
return 1;
}
int n_2 = 0;
int n_1 = 1;
int result = 0;
for (int i = 2; i <= nth; i++) {
result = n_1 + n_2;
n_2 = n_1;
n_1 = result;
}
return result;
}
}
| 330 | 0.521212 | 0.475758 | 21 | 14.714286 | 10.515942 | 37 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.333333 | false | false |
1
|
c8048d5d6c0b0ccb21c2d86274aab006825a2cc4
| 33,612,414,092,787 |
958df5a3fd96f3f087096bdf86aca3bdba40283a
|
/SumNat.java
|
1ae67afdac7944e14e0a71c53a75a6207c4aed99
|
[] |
no_license
|
keerjc/codekata
|
https://github.com/keerjc/codekata
|
c63ca542e3f2c41ce292db097d766514f8879d75
|
8d5bacdb9c029a2f75717bd6fa6a354aa92343c2
|
refs/heads/master
| 2021-01-13T06:10:46.101000 | 2017-06-23T10:46:30 | 2017-06-23T10:46:30 | 94,868,122 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.Scanner;
public class SumNat
{
public static void main(String[] args)
{
System.out.println(" *SUM OF NATURAL NOS*");
Scanner s=new Scanner(System.in);
System.out.println("Enter the n value");
int n=s.nextInt();
int result=n*(n+1)/2;
System.out.println("The sum of n values is " + result);
}
}
|
UTF-8
|
Java
| 384 |
java
|
SumNat.java
|
Java
|
[] | null |
[] |
import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.Scanner;
public class SumNat
{
public static void main(String[] args)
{
System.out.println(" *SUM OF NATURAL NOS*");
Scanner s=new Scanner(System.in);
System.out.println("Enter the n value");
int n=s.nextInt();
int result=n*(n+1)/2;
System.out.println("The sum of n values is " + result);
}
}
| 384 | 0.674479 | 0.669271 | 16 | 23 | 16.658331 | 57 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.625 | false | false |
1
|
d5c8b5c81954218c54412158e3bb33d4f4b21089
| 15,066,745,286,565 |
460cffc058c18f568abf3902614f43727e726e6d
|
/src/main/java/com/brain/earthcitizenclub/dao/UserDAOImpl.java
|
4355e294ece8c70cfef30ff3888d88d37e0723a2
|
[] |
no_license
|
jes89/spring4-default-settings
|
https://github.com/jes89/spring4-default-settings
|
324cbcd76d10822d07d079296e529524564eaa1b
|
8c8ff88ec29e1792e8762f585419ced60c551241
|
refs/heads/master
| 2020-04-06T13:34:20.377000 | 2018-11-14T07:12:58 | 2018-11-14T07:12:58 | 157,505,863 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.brain.earthcitizenclub.dao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import com.brain.earthcitizenclub.dto.UserDTO;
import com.brain.earthcitizenclub.mapper.UserMapper;
@Repository("UserDAO")
public class UserDAOImpl implements UserDAO {
@Autowired
UserMapper userMapper;
public UserDTO selectUserByUserId(String userId){
return userMapper.selectUserByUserId(userId);
}
public UserDTO selectUserForSecurity(String userId){
return userMapper.selectUserForSecurity(userId);
}
}
|
UTF-8
|
Java
| 577 |
java
|
UserDAOImpl.java
|
Java
|
[] | null |
[] |
package com.brain.earthcitizenclub.dao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import com.brain.earthcitizenclub.dto.UserDTO;
import com.brain.earthcitizenclub.mapper.UserMapper;
@Repository("UserDAO")
public class UserDAOImpl implements UserDAO {
@Autowired
UserMapper userMapper;
public UserDTO selectUserByUserId(String userId){
return userMapper.selectUserByUserId(userId);
}
public UserDTO selectUserForSecurity(String userId){
return userMapper.selectUserForSecurity(userId);
}
}
| 577 | 0.824957 | 0.824957 | 21 | 26.476191 | 22.942204 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.952381 | false | false |
1
|
2e427be57c986420e7b631fc41fe714fd210cfd0
| 6,279,242,215,327 |
5ad061d507683448b78215dbf7df0b509078f74f
|
/bd/后端/ground/ground-repair/src/main/java/com/hirain/phm/bd/ground/maintenance/service/impl/FlowReadServiceImpl.java
|
24b62cdaf621476a46a75154d97ebfdf53f99a3b
|
[] |
no_license
|
zheng-chang-wei/myproject
|
https://github.com/zheng-chang-wei/myproject
|
221bf2b3b646435b962d4d921fa20867c1cac2f3
|
49be8c6e6048c299ed844eb99ea112166a4b4d2e
|
refs/heads/master
| 2022-12-13T19:15:39.464000 | 2020-07-20T11:28:16 | 2020-07-20T11:28:16 | 232,452,539 | 0 | 1 | null | false | 2022-12-06T00:34:29 | 2020-01-08T01:38:10 | 2020-07-20T11:32:58 | 2022-12-06T00:34:29 | 205,643 | 0 | 1 | 44 |
Java
| false | false |
/*******************************************************************************
* Copyright (c) 2019, 2019 Hirain Technologies Corporation.
******************************************************************************/
package com.hirain.phm.bd.ground.maintenance.service.impl;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.hirain.phm.bd.ground.authority.controller.RBACGateWay;
import com.hirain.phm.bd.ground.authority.domain.User;
import com.hirain.phm.bd.ground.common.event.FaultTopType;
import com.hirain.phm.bd.ground.common.page.QueryRequest;
import com.hirain.phm.bd.ground.maintenance.domain.RepairOption;
import com.hirain.phm.bd.ground.maintenance.domain.StepType;
import com.hirain.phm.bd.ground.maintenance.domain.WorkSheet;
import com.hirain.phm.bd.ground.maintenance.domain.WorkStep;
import com.hirain.phm.bd.ground.maintenance.param.FaultType;
import com.hirain.phm.bd.ground.maintenance.param.SheetCountResponse;
import com.hirain.phm.bd.ground.maintenance.param.WorkSheetQueryParam;
import com.hirain.phm.bd.ground.maintenance.param.WorkSheetRecord;
import com.hirain.phm.bd.ground.maintenance.param.WorksheetPacket;
import com.hirain.phm.bd.ground.maintenance.redis.WorksheetRedisMapper;
import com.hirain.phm.bd.ground.maintenance.service.FlowReadService;
import com.hirain.phm.bd.ground.maintenance.service.RbacService;
import com.hirain.phm.bd.ground.maintenance.service.StepTypeService;
import com.hirain.phm.bd.ground.maintenance.service.WorkSheetService;
import com.hirain.phm.bd.ground.maintenance.service.WorkStepService;
import com.hirain.phm.bd.ground.train.controller.ProjectGateWay;
import com.hirain.phm.bd.ground.train.domain.Project;
import com.hirain.phm.bd.ground.util.RedisUtil;
/**
* @Version 1.0
* @Author jianwen.xin@hirain.com
* @Created 2019年6月3日 下午2:57:05
* @Description
* <p>
* @TODO 修改数据查询
* @Modification
* <p>
* Date Author Version Description
* <p>
* 2019年6月3日 jianwen.xin@hirain.com 1.0 create file
*/
@Service
public class FlowReadServiceImpl implements FlowReadService {
@Autowired
private WorkSheetService sheetService;
@Autowired
private RBACGateWay rbacGW;
@Autowired
private RbacService rbacService;
@Autowired
private WorkStepService stepService;
@Autowired
private StepTypeService typeService;
@Autowired
private ProjectGateWay trainGW;
@Autowired
private RedisUtil redisUtil;
@Autowired
private WorksheetRedisMapper redisMapper;
/**
* @see com.hirain.phm.bd.ground.maintenance.service.FlowReadService#listWorkSheetsWithDetail(com.hirain.phm.bd.ground.maintenance.param.WorkSheetQueryParam)
*/
@Override
public List<WorkSheet> listWorkSheetsWithDetail(WorkSheetQueryParam param) {
User user = rbacService.getCurrentUser();
List<Integer> roles = rbacService.getRepairRoles(user);
List<StepType> types = filter(roles, typeService.selectAll());
List<WorkSheet> sheets = listSheets(user, isOnlyAfterSales(types), param);
return sheets;
}
@Override
public List<WorkSheetRecord> listWorkSheets(WorkSheetQueryParam param, QueryRequest queryRequest) {
User user = rbacService.getCurrentUser();
List<Integer> roles = rbacService.getRepairRoles(user);
List<StepType> types = filter(roles, typeService.selectAll());
param.setOffset(queryRequest.getPageSize() * (queryRequest.getPageNum() - 1));
param.setLimit(queryRequest.getPageSize());
List<WorkSheet> sheets = listSheets(user, isOnlyAfterSales(types), param);
// 工单类型和维修权限ID的Map映射
Map<String, Integer> typeMap = types.stream().collect(Collectors.toMap(t -> t.getType(), t -> t.getRoleId()));
List<WorkSheetRecord> records = new ArrayList<>();
// 判断每个工单可操作范围
sheets.stream().forEach(sheet -> {
sheet.setFaultTypeName(getFaultTopTypeByCode(sheet.getFaultType()));
WorkSheetRecord record = new WorkSheetRecord();
record.setSheet(sheet);
boolean option = false;
if (typeMap.containsKey(sheet.getState())) {
if (sheet.getState().equals(RepairOption.Resolve.getDesc())) {
// 工单处于问题解决状态,需要判断用户所处的部门是否有权限,以及所处部门是否已有员工提交解决
Long deptId = user.getDeptId();
Object result = redisUtil.hmget(sheet.getId() + "-department", String.valueOf(deptId));
option = "true".equals(result);
} else if (sheet.getState().equals(RepairOption.Create.getDesc())) {
if (sheet.getUserId() == null || user.getUserId().equals(sheet.getUserId())) {
option = true;
} else {
return;
}
} else {
option = true;
}
}
record.setOption(option);
records.add(record);
});
return records;
}
public Integer countWorkSheets(WorkSheetQueryParam param) {
User user = rbacService.getCurrentUser();
List<Integer> roles = rbacService.getRepairRoles(user);
List<StepType> types = filter(roles, typeService.selectAll());
return countSheets(user, isOnlyAfterSales(types), param);
}
/**
* @param user
* @param onlyAfterSales
* @param param
* @return
*/
private Integer countSheets(User user, boolean onlyAfterSales, WorkSheetQueryParam param) {
if (onlyAfterSales) {
List<Long> projects = rbacService.getProjects(user);
if (param.getProject() != null) {
Project project = trainGW.selectProjectByName(param.getProject());
if (projects.contains(Long.valueOf(project.getId()))) {
projects.clear();
projects.add(Long.valueOf(project.getId()));
} else {
return 0;
}
}
return sheetService.countWorkSheetOfProjects(projects, param, user.getUserId());
} else {
return sheetService.countWorkSheetWithDetail(param, user.getUserId());
}
}
private List<WorkSheet> listSheets(User user, boolean onlyAfterSales, WorkSheetQueryParam param) {
if (onlyAfterSales) {
List<Long> projects = rbacService.getProjects(user);
if (param.getProject() != null) {
Project project = trainGW.selectProjectByName(param.getProject());
if (projects.contains(Long.valueOf(project.getId()))) {
projects.clear();
projects.add(Long.valueOf(project.getId()));
} else {
return null;
}
}
return sheetService.listWorkSheetOfProjects(projects, param, user.getUserId());
} else {
return sheetService.listWorkSheetWithDetail(param, user.getUserId());
}
}
/**
* @param types
* @return
*/
private boolean isOnlyAfterSales(List<StepType> types) {
if (types.size() == 1) {
StepType stepType = types.get(0);
if (stepType.getType().equals(RepairOption.Create.getDesc())) {
return true;
}
}
return false;
}
/**
* 过滤出和工单步骤相关的权限
*
* @param groundRoleIds
* @param stepTypes
* @return
*/
private List<StepType> filter(List<Integer> roles, List<StepType> stepTypes) {
List<StepType> types = new ArrayList<>();
for (StepType type : stepTypes) {
if (roles.contains(type.getRoleId())) {
types.add(type);
}
}
return types;
}
/**
* 获取工单,工单详情以及工单步骤
*
* @see com.hirain.phm.bd.ground.maintenance.service.DFlowReadService#getWorksheet(java.lang.Long)
*/
@Override
public WorksheetPacket getWorksheet(Long sheetId) {
WorkSheet sheet = sheetService.selectBySheetId(sheetId);
List<WorkStep> steps = findAllSteps(sheetId);
WorksheetPacket packet = new WorksheetPacket();
packet.setSheet(sheet);
packet.setSteps(steps);
User user = (User) SecurityUtils.getSubject().getPrincipal();
packet.setOption(getRepairOption(sheet, user));
return packet;
}
private List<WorkStep> findAllSteps(Long sheetId) {
List<WorkStep> steps = stepService.findAllSteps(sheetId);
steps.forEach(step -> {
Long auditorId = step.getAuditorId();
if (auditorId != null) {
User user = rbacGW.findUserByIdWithRole(auditorId);
step.setAuditor(user.getName());
}
});
return steps;
}
/**
* 根据用户权限判断工单的可操作状态
*
* @param sheet
* @param user
* @return
*/
private RepairOption getRepairOption(WorkSheet sheet, User user) {
StepType type = typeService.selectByKey(sheet.getState());
List<Integer> roles = rbacGW.getRepairRolesByUserId(user.getUserId());
boolean contains = roles.contains(type.getRoleId());
if (contains) {
if (type.getType().equals(RepairOption.Resolve.getDesc())) {
Object result = redisUtil.hmget(sheet.getId() + "-department", String.valueOf(user.getDeptId()));
return "true".equals(result) ? RepairOption.Resolve : RepairOption.None;
} else {
return Arrays.asList(RepairOption.values()).stream().filter(t -> t.getDesc().equals(type.getType())).findFirst().get();
}
}
return RepairOption.None;
}
/**
* @see com.hirain.phm.bd.ground.maintenance.service.DFlowReadService#findLastSameStep(java.lang.Long, java.lang.String)
*/
@Override
public WorkStep findLastSameStep(Long sheetId, String state) {
WorkStep step = stepService.findLastSameType(sheetId, state);
ObjectMapper mapper = new ObjectMapper();
try {
// 由于前端接收的content字符串中包含转义符号,故JSON ----> JsonNode
if (step != null) {
JsonNode rootNode = mapper.readTree(step.getContent());
step.setData(rootNode);
}
} catch (IOException e) {
e.printStackTrace();
}
return step;
}
@Override
public SheetCountResponse countSheets() {
Date time = new Date();
int countNew = redisMapper.countNewSheet(time);
int countHandled = redisMapper.countHandledSheet(time);
int countUnHandled = redisMapper.countUnHandled();
SheetCountResponse response = new SheetCountResponse();
response.setNewSheets(countNew);
response.setHandled(countHandled);
response.setUnHandled(countNew - countHandled);
response.setUnHandledBeforeMonth(countUnHandled);
return response;
}
@Override
public List<FaultType> getFaultTypes() {
List<FaultType> list = new ArrayList<>();
List<Integer> faultTypes = sheetService.getFaultTypes();
for (Integer code : faultTypes) {
String faultTypeName = getFaultTopTypeByCode(code);
if (faultTypeName != null) {
list.add(new FaultType(code, faultTypeName));
}
}
return list;
}
private String getFaultTopTypeByCode(Integer code) {
if (code != null) {
FaultTopType[] values = FaultTopType.values();
for (FaultTopType faultTopType : values) {
if (faultTopType.getCode() == code) {
return faultTopType.getName();
}
}
}
return null;
}
}
|
UTF-8
|
Java
| 10,904 |
java
|
FlowReadServiceImpl.java
|
Java
|
[
{
"context": "nd.util.RedisUtil;\n\n/**\n * @Version 1.0\n * @Author jianwen.xin@hirain.com\n * @Created 2019年6月3日 下午2:57:05\n * @Description\n ",
"end": 2177,
"score": 0.9999160766601562,
"start": 2155,
"tag": "EMAIL",
"value": "jianwen.xin@hirain.com"
},
{
"context": "on\n * <p>\n * 2019年6月3日 jianwen.xin@hirain.com 1.0 create file\n */\n@Service\npublic class FlowRea",
"end": 2419,
"score": 0.9999195337295532,
"start": 2397,
"tag": "EMAIL",
"value": "jianwen.xin@hirain.com"
}
] | null |
[] |
/*******************************************************************************
* Copyright (c) 2019, 2019 Hirain Technologies Corporation.
******************************************************************************/
package com.hirain.phm.bd.ground.maintenance.service.impl;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.hirain.phm.bd.ground.authority.controller.RBACGateWay;
import com.hirain.phm.bd.ground.authority.domain.User;
import com.hirain.phm.bd.ground.common.event.FaultTopType;
import com.hirain.phm.bd.ground.common.page.QueryRequest;
import com.hirain.phm.bd.ground.maintenance.domain.RepairOption;
import com.hirain.phm.bd.ground.maintenance.domain.StepType;
import com.hirain.phm.bd.ground.maintenance.domain.WorkSheet;
import com.hirain.phm.bd.ground.maintenance.domain.WorkStep;
import com.hirain.phm.bd.ground.maintenance.param.FaultType;
import com.hirain.phm.bd.ground.maintenance.param.SheetCountResponse;
import com.hirain.phm.bd.ground.maintenance.param.WorkSheetQueryParam;
import com.hirain.phm.bd.ground.maintenance.param.WorkSheetRecord;
import com.hirain.phm.bd.ground.maintenance.param.WorksheetPacket;
import com.hirain.phm.bd.ground.maintenance.redis.WorksheetRedisMapper;
import com.hirain.phm.bd.ground.maintenance.service.FlowReadService;
import com.hirain.phm.bd.ground.maintenance.service.RbacService;
import com.hirain.phm.bd.ground.maintenance.service.StepTypeService;
import com.hirain.phm.bd.ground.maintenance.service.WorkSheetService;
import com.hirain.phm.bd.ground.maintenance.service.WorkStepService;
import com.hirain.phm.bd.ground.train.controller.ProjectGateWay;
import com.hirain.phm.bd.ground.train.domain.Project;
import com.hirain.phm.bd.ground.util.RedisUtil;
/**
* @Version 1.0
* @Author <EMAIL>
* @Created 2019年6月3日 下午2:57:05
* @Description
* <p>
* @TODO 修改数据查询
* @Modification
* <p>
* Date Author Version Description
* <p>
* 2019年6月3日 <EMAIL> 1.0 create file
*/
@Service
public class FlowReadServiceImpl implements FlowReadService {
@Autowired
private WorkSheetService sheetService;
@Autowired
private RBACGateWay rbacGW;
@Autowired
private RbacService rbacService;
@Autowired
private WorkStepService stepService;
@Autowired
private StepTypeService typeService;
@Autowired
private ProjectGateWay trainGW;
@Autowired
private RedisUtil redisUtil;
@Autowired
private WorksheetRedisMapper redisMapper;
/**
* @see com.hirain.phm.bd.ground.maintenance.service.FlowReadService#listWorkSheetsWithDetail(com.hirain.phm.bd.ground.maintenance.param.WorkSheetQueryParam)
*/
@Override
public List<WorkSheet> listWorkSheetsWithDetail(WorkSheetQueryParam param) {
User user = rbacService.getCurrentUser();
List<Integer> roles = rbacService.getRepairRoles(user);
List<StepType> types = filter(roles, typeService.selectAll());
List<WorkSheet> sheets = listSheets(user, isOnlyAfterSales(types), param);
return sheets;
}
@Override
public List<WorkSheetRecord> listWorkSheets(WorkSheetQueryParam param, QueryRequest queryRequest) {
User user = rbacService.getCurrentUser();
List<Integer> roles = rbacService.getRepairRoles(user);
List<StepType> types = filter(roles, typeService.selectAll());
param.setOffset(queryRequest.getPageSize() * (queryRequest.getPageNum() - 1));
param.setLimit(queryRequest.getPageSize());
List<WorkSheet> sheets = listSheets(user, isOnlyAfterSales(types), param);
// 工单类型和维修权限ID的Map映射
Map<String, Integer> typeMap = types.stream().collect(Collectors.toMap(t -> t.getType(), t -> t.getRoleId()));
List<WorkSheetRecord> records = new ArrayList<>();
// 判断每个工单可操作范围
sheets.stream().forEach(sheet -> {
sheet.setFaultTypeName(getFaultTopTypeByCode(sheet.getFaultType()));
WorkSheetRecord record = new WorkSheetRecord();
record.setSheet(sheet);
boolean option = false;
if (typeMap.containsKey(sheet.getState())) {
if (sheet.getState().equals(RepairOption.Resolve.getDesc())) {
// 工单处于问题解决状态,需要判断用户所处的部门是否有权限,以及所处部门是否已有员工提交解决
Long deptId = user.getDeptId();
Object result = redisUtil.hmget(sheet.getId() + "-department", String.valueOf(deptId));
option = "true".equals(result);
} else if (sheet.getState().equals(RepairOption.Create.getDesc())) {
if (sheet.getUserId() == null || user.getUserId().equals(sheet.getUserId())) {
option = true;
} else {
return;
}
} else {
option = true;
}
}
record.setOption(option);
records.add(record);
});
return records;
}
public Integer countWorkSheets(WorkSheetQueryParam param) {
User user = rbacService.getCurrentUser();
List<Integer> roles = rbacService.getRepairRoles(user);
List<StepType> types = filter(roles, typeService.selectAll());
return countSheets(user, isOnlyAfterSales(types), param);
}
/**
* @param user
* @param onlyAfterSales
* @param param
* @return
*/
private Integer countSheets(User user, boolean onlyAfterSales, WorkSheetQueryParam param) {
if (onlyAfterSales) {
List<Long> projects = rbacService.getProjects(user);
if (param.getProject() != null) {
Project project = trainGW.selectProjectByName(param.getProject());
if (projects.contains(Long.valueOf(project.getId()))) {
projects.clear();
projects.add(Long.valueOf(project.getId()));
} else {
return 0;
}
}
return sheetService.countWorkSheetOfProjects(projects, param, user.getUserId());
} else {
return sheetService.countWorkSheetWithDetail(param, user.getUserId());
}
}
private List<WorkSheet> listSheets(User user, boolean onlyAfterSales, WorkSheetQueryParam param) {
if (onlyAfterSales) {
List<Long> projects = rbacService.getProjects(user);
if (param.getProject() != null) {
Project project = trainGW.selectProjectByName(param.getProject());
if (projects.contains(Long.valueOf(project.getId()))) {
projects.clear();
projects.add(Long.valueOf(project.getId()));
} else {
return null;
}
}
return sheetService.listWorkSheetOfProjects(projects, param, user.getUserId());
} else {
return sheetService.listWorkSheetWithDetail(param, user.getUserId());
}
}
/**
* @param types
* @return
*/
private boolean isOnlyAfterSales(List<StepType> types) {
if (types.size() == 1) {
StepType stepType = types.get(0);
if (stepType.getType().equals(RepairOption.Create.getDesc())) {
return true;
}
}
return false;
}
/**
* 过滤出和工单步骤相关的权限
*
* @param groundRoleIds
* @param stepTypes
* @return
*/
private List<StepType> filter(List<Integer> roles, List<StepType> stepTypes) {
List<StepType> types = new ArrayList<>();
for (StepType type : stepTypes) {
if (roles.contains(type.getRoleId())) {
types.add(type);
}
}
return types;
}
/**
* 获取工单,工单详情以及工单步骤
*
* @see com.hirain.phm.bd.ground.maintenance.service.DFlowReadService#getWorksheet(java.lang.Long)
*/
@Override
public WorksheetPacket getWorksheet(Long sheetId) {
WorkSheet sheet = sheetService.selectBySheetId(sheetId);
List<WorkStep> steps = findAllSteps(sheetId);
WorksheetPacket packet = new WorksheetPacket();
packet.setSheet(sheet);
packet.setSteps(steps);
User user = (User) SecurityUtils.getSubject().getPrincipal();
packet.setOption(getRepairOption(sheet, user));
return packet;
}
private List<WorkStep> findAllSteps(Long sheetId) {
List<WorkStep> steps = stepService.findAllSteps(sheetId);
steps.forEach(step -> {
Long auditorId = step.getAuditorId();
if (auditorId != null) {
User user = rbacGW.findUserByIdWithRole(auditorId);
step.setAuditor(user.getName());
}
});
return steps;
}
/**
* 根据用户权限判断工单的可操作状态
*
* @param sheet
* @param user
* @return
*/
private RepairOption getRepairOption(WorkSheet sheet, User user) {
StepType type = typeService.selectByKey(sheet.getState());
List<Integer> roles = rbacGW.getRepairRolesByUserId(user.getUserId());
boolean contains = roles.contains(type.getRoleId());
if (contains) {
if (type.getType().equals(RepairOption.Resolve.getDesc())) {
Object result = redisUtil.hmget(sheet.getId() + "-department", String.valueOf(user.getDeptId()));
return "true".equals(result) ? RepairOption.Resolve : RepairOption.None;
} else {
return Arrays.asList(RepairOption.values()).stream().filter(t -> t.getDesc().equals(type.getType())).findFirst().get();
}
}
return RepairOption.None;
}
/**
* @see com.hirain.phm.bd.ground.maintenance.service.DFlowReadService#findLastSameStep(java.lang.Long, java.lang.String)
*/
@Override
public WorkStep findLastSameStep(Long sheetId, String state) {
WorkStep step = stepService.findLastSameType(sheetId, state);
ObjectMapper mapper = new ObjectMapper();
try {
// 由于前端接收的content字符串中包含转义符号,故JSON ----> JsonNode
if (step != null) {
JsonNode rootNode = mapper.readTree(step.getContent());
step.setData(rootNode);
}
} catch (IOException e) {
e.printStackTrace();
}
return step;
}
@Override
public SheetCountResponse countSheets() {
Date time = new Date();
int countNew = redisMapper.countNewSheet(time);
int countHandled = redisMapper.countHandledSheet(time);
int countUnHandled = redisMapper.countUnHandled();
SheetCountResponse response = new SheetCountResponse();
response.setNewSheets(countNew);
response.setHandled(countHandled);
response.setUnHandled(countNew - countHandled);
response.setUnHandledBeforeMonth(countUnHandled);
return response;
}
@Override
public List<FaultType> getFaultTypes() {
List<FaultType> list = new ArrayList<>();
List<Integer> faultTypes = sheetService.getFaultTypes();
for (Integer code : faultTypes) {
String faultTypeName = getFaultTopTypeByCode(code);
if (faultTypeName != null) {
list.add(new FaultType(code, faultTypeName));
}
}
return list;
}
private String getFaultTopTypeByCode(Integer code) {
if (code != null) {
FaultTopType[] values = FaultTopType.values();
for (FaultTopType faultTopType : values) {
if (faultTopType.getCode() == code) {
return faultTopType.getName();
}
}
}
return null;
}
}
| 10,874 | 0.718538 | 0.71543 | 324 | 31.765432 | 28.198162 | 158 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.197531 | false | false |
1
|
1cb72e99363485a1db9718dadffc28eb3683de12
| 19,782,619,382,211 |
1a4b713e961c7e25a37fd7bf6371681d6ed9887f
|
/rts/lra-examples/mixed-participant-with-coordinator/src/main/java/io/narayana/rts/lra/MixedResource.java
|
8ed6e1a4e3df15a98972d57d668ead94675cae5b
|
[
"Apache-2.0"
] |
permissive
|
JoePullen/quickstart
|
https://github.com/JoePullen/quickstart
|
23d5198267d256d6737ad917d9771e68daf79fa1
|
c675d54fc6a048892a7965c9238c54502d8976bb
|
refs/heads/master
| 2020-07-02T11:17:11.383000 | 2019-08-07T08:23:53 | 2019-08-07T08:23:53 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package io.narayana.rts.lra;
import org.eclipse.microprofile.lra.annotation.LRA;
import javax.annotation.PostConstruct;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.HeaderParam;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.QueryParam;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import static org.eclipse.microprofile.lra.client.LRAClient.LRA_HTTP_HEADER;
import static org.eclipse.microprofile.lra.client.LRAClient.LRA_HTTP_RECOVERY_HEADER;
/**
* for testing {@link org.eclipse.microprofile.lra.annotation.LRA}
* in combination with {@link org.eclipse.microprofile.lra.participant.LRAManagement}
*/
@Path("/")
@ApplicationScoped
public class MixedResource {
@Inject
private StateHolder stats;
@Context
private UriInfo context;
private static Client msClient;
private WebTarget msTarget;
@PostConstruct
private void postConstruct() {
int servicePort = Integer.getInteger("swarm.http.port", 8080);
try {
URL microserviceBaseUrl = new URL("http://localhost:" + servicePort);
// setting up the client
msClient = ClientBuilder.newClient();
msTarget = msClient.target(URI.create(new URL(microserviceBaseUrl, "/").toExternalForm()));
} catch (MalformedURLException e) {
System.err.printf("WARN: unabled to construct URL: %s%n", e.getMessage());
}
}
@LRA(LRA.Type.REQUIRED)
@Path("/mixed")
@PUT
public void doInTransaction(@DefaultValue("") @QueryParam("fault") String fault,
@HeaderParam(LRA_HTTP_RECOVERY_HEADER) String rcvId,
@HeaderParam(LRA_HTTP_HEADER) String lraId) throws MalformedURLException {
URL lra = new URL(lraId);
doWork(lra, "/cdi", fault);
doWork(lra, "/api", fault);
}
@Path("/mixed")
@GET
public String getStats() {
return stats.toString();
}
private void doWork(URL lraId, String path, String fault) {
stats.setFault(fault);
try (Response response = msTarget.path(path)
.queryParam("fault", fault)
.request().put(Entity.text(""))) {
if (!response.getStatusInfo().getFamily().equals(Response.Status.Family.SUCCESSFUL)) {
throw new WebApplicationException(response);
}
}
}
}
|
UTF-8
|
Java
| 2,835 |
java
|
MixedResource.java
|
Java
|
[] | null |
[] |
package io.narayana.rts.lra;
import org.eclipse.microprofile.lra.annotation.LRA;
import javax.annotation.PostConstruct;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.HeaderParam;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.QueryParam;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import static org.eclipse.microprofile.lra.client.LRAClient.LRA_HTTP_HEADER;
import static org.eclipse.microprofile.lra.client.LRAClient.LRA_HTTP_RECOVERY_HEADER;
/**
* for testing {@link org.eclipse.microprofile.lra.annotation.LRA}
* in combination with {@link org.eclipse.microprofile.lra.participant.LRAManagement}
*/
@Path("/")
@ApplicationScoped
public class MixedResource {
@Inject
private StateHolder stats;
@Context
private UriInfo context;
private static Client msClient;
private WebTarget msTarget;
@PostConstruct
private void postConstruct() {
int servicePort = Integer.getInteger("swarm.http.port", 8080);
try {
URL microserviceBaseUrl = new URL("http://localhost:" + servicePort);
// setting up the client
msClient = ClientBuilder.newClient();
msTarget = msClient.target(URI.create(new URL(microserviceBaseUrl, "/").toExternalForm()));
} catch (MalformedURLException e) {
System.err.printf("WARN: unabled to construct URL: %s%n", e.getMessage());
}
}
@LRA(LRA.Type.REQUIRED)
@Path("/mixed")
@PUT
public void doInTransaction(@DefaultValue("") @QueryParam("fault") String fault,
@HeaderParam(LRA_HTTP_RECOVERY_HEADER) String rcvId,
@HeaderParam(LRA_HTTP_HEADER) String lraId) throws MalformedURLException {
URL lra = new URL(lraId);
doWork(lra, "/cdi", fault);
doWork(lra, "/api", fault);
}
@Path("/mixed")
@GET
public String getStats() {
return stats.toString();
}
private void doWork(URL lraId, String path, String fault) {
stats.setFault(fault);
try (Response response = msTarget.path(path)
.queryParam("fault", fault)
.request().put(Entity.text(""))) {
if (!response.getStatusInfo().getFamily().equals(Response.Status.Family.SUCCESSFUL)) {
throw new WebApplicationException(response);
}
}
}
}
| 2,835 | 0.670194 | 0.668783 | 92 | 29.815218 | 27.270357 | 108 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.554348 | false | false |
1
|
18b4fe12a98e0260d1ece329ff21e62eda474a8c
| 19,782,619,382,128 |
f1e15750603e182c953a704aceefc990768659ce
|
/src/BankAccount.java
|
764af27ca1d367e5c272dd97b517b965c2a84571
|
[] |
no_license
|
philosomniac/JavaBankApplication
|
https://github.com/philosomniac/JavaBankApplication
|
13038a34331c226ae02e77ec87886f07a2ded48d
|
b4ad834a3bf104791e4a54972a2cb2f033af97cb
|
refs/heads/master
| 2020-12-24T08:41:36.929000 | 2016-11-30T22:43:33 | 2016-11-30T22:43:33 | 73,327,403 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.math.BigDecimal;
public class BankAccount {
private String _accountNumber;
private String _accountName;
private String _PIN;
private BigDecimal _balance;
public BankAccount(String accountnumber, String accountname, String PIN, BigDecimal balance)
{
_accountNumber = accountnumber;
_accountName = accountname;
_PIN = PIN;
_balance = balance;
}
public void Deposit(BigDecimal amount)
{
// checks if the deposit amount is positive
if (amount.compareTo(BigDecimal.ZERO) > 0)
{
_balance = _balance.add(amount);
}
}
public BigDecimal getBalance()
{
return _balance;
}
public String getAccountNumber()
{
return _accountNumber;
}
public String getPIN()
{
return _PIN;
}
public String getAccountName()
{
return _accountName;
}
public void withdraw(BigDecimal amount) {
if(amount.compareTo(BigDecimal.ZERO) > 0)
{
_balance = _balance.subtract(amount);
}
}
}
|
UTF-8
|
Java
| 940 |
java
|
BankAccount.java
|
Java
|
[] | null |
[] |
import java.math.BigDecimal;
public class BankAccount {
private String _accountNumber;
private String _accountName;
private String _PIN;
private BigDecimal _balance;
public BankAccount(String accountnumber, String accountname, String PIN, BigDecimal balance)
{
_accountNumber = accountnumber;
_accountName = accountname;
_PIN = PIN;
_balance = balance;
}
public void Deposit(BigDecimal amount)
{
// checks if the deposit amount is positive
if (amount.compareTo(BigDecimal.ZERO) > 0)
{
_balance = _balance.add(amount);
}
}
public BigDecimal getBalance()
{
return _balance;
}
public String getAccountNumber()
{
return _accountNumber;
}
public String getPIN()
{
return _PIN;
}
public String getAccountName()
{
return _accountName;
}
public void withdraw(BigDecimal amount) {
if(amount.compareTo(BigDecimal.ZERO) > 0)
{
_balance = _balance.subtract(amount);
}
}
}
| 940 | 0.696809 | 0.694681 | 56 | 15.785714 | 18.408766 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.517857 | false | false |
1
|
87fa5c500c2bc306753b0e2c56d19131eab331d9
| 19,164,144,077,263 |
2f7ba260ab058112af49e2e560ba0b29b0feffaf
|
/project/dive-in-spring-boot/spring-boot-autoconfigure/src/main/java/com/bebopze/diveinspringboot/repository/MyFirstLevelRepository.java
|
75c091266617dd9e3240ce44b647069ab7d3c6f9
|
[
"Apache-2.0"
] |
permissive
|
junzijian/note
|
https://github.com/junzijian/note
|
5486497d001f1628897ee4d61db349c7b468b8dd
|
3c2f8c9c7fcedfac0916bc9bcf5bad19498588cf
|
refs/heads/master
| 2020-08-27T01:27:09.673000 | 2020-08-25T09:59:28 | 2020-08-25T09:59:28 | 217,204,387 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.bebopze.diveinspringboot.repository;
import com.bebopze.diveinspringboot.annotation.FirstLevelRepository;
import com.bebopze.diveinspringboot.annotation.SecondLevelRepository;
/**
* 我的 {@link FirstLevelRepository}
*
* @author bebopze
* @since 2018/5/14
*/
@SecondLevelRepository(value = "myFirstLevelRepository") // Bean 名称
public class MyFirstLevelRepository {
}
|
UTF-8
|
Java
| 391 |
java
|
MyFirstLevelRepository.java
|
Java
|
[
{
"context": "*\n * 我的 {@link FirstLevelRepository}\n *\n * @author bebopze\n * @since 2018/5/14\n */\n@SecondLevelRepository(va",
"end": 250,
"score": 0.9996902942657471,
"start": 243,
"tag": "USERNAME",
"value": "bebopze"
}
] | null |
[] |
package com.bebopze.diveinspringboot.repository;
import com.bebopze.diveinspringboot.annotation.FirstLevelRepository;
import com.bebopze.diveinspringboot.annotation.SecondLevelRepository;
/**
* 我的 {@link FirstLevelRepository}
*
* @author bebopze
* @since 2018/5/14
*/
@SecondLevelRepository(value = "myFirstLevelRepository") // Bean 名称
public class MyFirstLevelRepository {
}
| 391 | 0.798956 | 0.780679 | 14 | 26.357143 | 26.302111 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.214286 | false | false |
1
|
15d956de05017b31924c43d39b28a25c4dd5d2ee
| 19,164,144,075,165 |
d71e879b3517cf4fccde29f7bf82cff69856cfcd
|
/ExtractedJars/Shopkick_com.shopkick.app/javafiles/com/google/android/exoplayer/upstream/cache/Cache$Listener.java
|
36d92f50f246d1d8b695576d8c239519b9e0d2d4
|
[
"MIT"
] |
permissive
|
Andreas237/AndroidPolicyAutomation
|
https://github.com/Andreas237/AndroidPolicyAutomation
|
b8e949e072d08cf6c6166c3f15c9c63379b8f6ce
|
c1ed10a2c6d4cf3dfda8b8e6291dee2c2a15ee8a
|
refs/heads/master
| 2020-04-10T02:14:08.789000 | 2019-05-16T19:29:11 | 2019-05-16T19:29:11 | 160,739,088 | 5 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) annotate safe
package com.google.android.exoplayer.upstream.cache;
// Referenced classes of package com.google.android.exoplayer.upstream.cache:
// Cache, CacheSpan
public static interface Cache$Listener
{
public abstract void onSpanAdded(Cache cache, CacheSpan cachespan);
public abstract void onSpanRemoved(Cache cache, CacheSpan cachespan);
public abstract void onSpanTouched(Cache cache, CacheSpan cachespan, CacheSpan cachespan1);
}
|
UTF-8
|
Java
| 600 |
java
|
Cache$Listener.java
|
Java
|
[
{
"context": "// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.\n// Jad home page: http://www.kpdus.com/jad.html\n",
"end": 61,
"score": 0.9996058940887451,
"start": 45,
"tag": "NAME",
"value": "Pavel Kouznetsov"
}
] | null |
[] |
// Decompiled by Jad v1.5.8g. Copyright 2001 <NAME>.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) annotate safe
package com.google.android.exoplayer.upstream.cache;
// Referenced classes of package com.google.android.exoplayer.upstream.cache:
// Cache, CacheSpan
public static interface Cache$Listener
{
public abstract void onSpanAdded(Cache cache, CacheSpan cachespan);
public abstract void onSpanRemoved(Cache cache, CacheSpan cachespan);
public abstract void onSpanTouched(Cache cache, CacheSpan cachespan, CacheSpan cachespan1);
}
| 590 | 0.788333 | 0.773333 | 19 | 30.578947 | 32.035038 | 92 | true | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.789474 | false | false |
1
|
ae71b7a15a2f1e8754f1ddc6b6bd94055833b0a4
| 19,782,619,403,833 |
518f4e9a1c3f7573b9e92a32c24383d50c6622cf
|
/src/lesson2/Main.java
|
5d83f811c50808ac163b0111c65965dc2321687c
|
[] |
no_license
|
nemoks123/java_2_dz
|
https://github.com/nemoks123/java_2_dz
|
bf500884eea377303988ab6fc7abc38e60ac9def
|
764792cb9e129701b077fd21781b78390297f78d
|
refs/heads/master
| 2023-01-19T15:53:03.674000 | 2020-11-28T11:57:57 | 2020-11-28T11:57:57 | 299,284,007 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package lesson2;
public class Main {
public static void main(String[] args) {
try {
String[][] a = {
{"1","4","5","6"},
{"5","4","3","2"},
{"5","1","3","2"},
{"5","4","3","2"}
};
System.out.println("Сумма всех элементов массива = " + Massiv(a));
}catch (MyArraySizeException | MyArrayDataException e){
System.out.println(e.getMessage());
}
}
static int Massiv(String[][] a) throws MyArraySizeException,MyArrayDataException{
int sum=0;
if(a.length ==4 ) {
for (int i = 0; i < a.length; i++) {
if(!(a[i].length == 4)) throw new MyArraySizeException(a);
}
}else throw new MyArraySizeException( a);
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
try{
sum += Integer.parseInt(a[i][j]);
}catch (NumberFormatException e){
throw new MyArrayDataException( i,j);
}
}
}
return sum;
}
}
|
UTF-8
|
Java
| 1,148 |
java
|
Main.java
|
Java
|
[] | null |
[] |
package lesson2;
public class Main {
public static void main(String[] args) {
try {
String[][] a = {
{"1","4","5","6"},
{"5","4","3","2"},
{"5","1","3","2"},
{"5","4","3","2"}
};
System.out.println("Сумма всех элементов массива = " + Massiv(a));
}catch (MyArraySizeException | MyArrayDataException e){
System.out.println(e.getMessage());
}
}
static int Massiv(String[][] a) throws MyArraySizeException,MyArrayDataException{
int sum=0;
if(a.length ==4 ) {
for (int i = 0; i < a.length; i++) {
if(!(a[i].length == 4)) throw new MyArraySizeException(a);
}
}else throw new MyArraySizeException( a);
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
try{
sum += Integer.parseInt(a[i][j]);
}catch (NumberFormatException e){
throw new MyArrayDataException( i,j);
}
}
}
return sum;
}
}
| 1,148 | 0.439003 | 0.416741 | 38 | 28.552631 | 23.104679 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.894737 | false | false |
1
|
9f53e4285f0594e1a8e613360fc6b52f062ff939
| 22,728,966,991,491 |
a393a4c0442689c1e290442d710039a78bd8abbf
|
/1/desktop/src/pl/edu/pb/gamedev/desktop/DesktopLauncher.java
|
51ea6f608a132451678c92552c83b9a034a04748
|
[] |
no_license
|
BialJam/GameDevKiddies
|
https://github.com/BialJam/GameDevKiddies
|
67f1fc2548c846cd08a1bf3261adec449a198724
|
23708699d07d574e3e4019b9c8de518dad9eba6d
|
refs/heads/master
| 2021-01-24T22:35:30.535000 | 2016-04-20T12:53:36 | 2016-04-20T12:53:36 | 45,840,320 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package pl.edu.pb.gamedev.desktop;
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
import pl.edu.pb.gamedev.Game;
public class DesktopLauncher {
public static void main(final String[] arg) {
final LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
config.title = "DropletsTM";
config.width = 800;
config.height = 480;
new LwjglApplication(new Game(), config);
}
}
|
UTF-8
|
Java
| 519 |
java
|
DesktopLauncher.java
|
Java
|
[] | null |
[] |
package pl.edu.pb.gamedev.desktop;
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
import pl.edu.pb.gamedev.Game;
public class DesktopLauncher {
public static void main(final String[] arg) {
final LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
config.title = "DropletsTM";
config.width = 800;
config.height = 480;
new LwjglApplication(new Game(), config);
}
}
| 519 | 0.726397 | 0.714836 | 16 | 31.4375 | 25.73657 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.625 | false | false |
1
|
96a49fb58b38680b4b4c8b213b5be15b04f6b5ea
| 6,760,278,559,795 |
975b12886d627d3cd2e582e71a92a4dea44ceb60
|
/ParkAlert/app/messages/FacebookLogin.java
|
85670f6b15145fb61f18e4c8a2f2a0fdbc3bd0ed
|
[
"Apache-2.0"
] |
permissive
|
nmldiegues/park-alert
|
https://github.com/nmldiegues/park-alert
|
a4b6fafef1c8ca39428b20dd10dee7c30e6cb189
|
84080b07e93e14e2df327550ccc310faae5b0666
|
refs/heads/master
| 2021-01-15T18:46:35.611000 | 2015-09-08T16:11:35 | 2015-09-08T16:11:35 | 42,123,636 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package messages;
public class FacebookLogin {
public String socialId;
public String name;
public String email;
}
|
UTF-8
|
Java
| 122 |
java
|
FacebookLogin.java
|
Java
|
[] | null |
[] |
package messages;
public class FacebookLogin {
public String socialId;
public String name;
public String email;
}
| 122 | 0.754098 | 0.754098 | 9 | 12.444445 | 11.046478 | 28 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.888889 | false | false |
1
|
1c91109a00082cddc61ffb889ec15d5b4d1589ce
| 26,740,466,411,618 |
4b7c23897924f7c7687ef230e0c70a8d032951a6
|
/src/TreeDirectory.java
|
40e1b3278ffe709c12419f276acc34c345cdedf9
|
[] |
no_license
|
phandc/JtreeLazyLoading
|
https://github.com/phandc/JtreeLazyLoading
|
cdfde8a96d7528de8be8530a9f961fb40a6382db
|
4cfe20127d08d62c642c2d7270def237aa8b9399
|
refs/heads/master
| 2022-07-29T16:01:15.025000 | 2020-02-29T02:59:41 | 2020-02-29T02:59:41 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.awt.*;
import java.io.File;
import java.util.List;
import javax.swing.*;
import javax.swing.event.TreeExpansionEvent;
import javax.swing.event.TreeWillExpandListener;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.ExpandVetoException;
import javax.swing.tree.MutableTreeNode;
public class TreeDirectory extends JFrame implements TreeWillExpandListener
{
private JTree jTree;
private DefaultTreeModel treeModel;
public static void main(String[] args)
{
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
TreeDirectory tree = new TreeDirectory();
}
});
}
@Override
public void treeWillCollapse(TreeExpansionEvent arg0)
throws ExpandVetoException {
}
@Override
public void treeWillExpand(TreeExpansionEvent arg0)
throws ExpandVetoException {
final FileNode lazyNode =
(FileNode) arg0.getPath().getLastPathComponent();
if( lazyNode.isFullyLoaded() )
{
return;
}
new SwingWorker<List<MutableTreeNode>, Void>(){ //every time when a parent node happens after expanding, we load it's children
@Override
protected List<MutableTreeNode> doInBackground() throws Exception {
// TODO Auto-generated method stub
return lazyNode.loadChildren();
}
protected void done() {
try {
for (MutableTreeNode node : get()) {
treeModel.insertNodeInto(node, lazyNode,
lazyNode.getChildCount());
}
} catch (Exception e) {
e.printStackTrace();
}
}
}.execute();
}
public TreeDirectory() {
FileNode root = new FileNode(new File(""));
treeModel = new DefaultTreeModel(root, true);
jTree = new JTree(treeModel);
jTree.setRootVisible(true);
jTree.addTreeWillExpandListener(this);
jTree.collapseRow(0); // collapse the root in order to implement TreeWillExpandListener after expanding in first level.
JScrollPane scrollBar = new JScrollPane(jTree,
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
add(scrollBar);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setTitle("JTree Example");
this.setSize(800,600);
this.setVisible(true);
}
}
|
UTF-8
|
Java
| 2,700 |
java
|
TreeDirectory.java
|
Java
|
[] | null |
[] |
import java.awt.*;
import java.io.File;
import java.util.List;
import javax.swing.*;
import javax.swing.event.TreeExpansionEvent;
import javax.swing.event.TreeWillExpandListener;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.ExpandVetoException;
import javax.swing.tree.MutableTreeNode;
public class TreeDirectory extends JFrame implements TreeWillExpandListener
{
private JTree jTree;
private DefaultTreeModel treeModel;
public static void main(String[] args)
{
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
TreeDirectory tree = new TreeDirectory();
}
});
}
@Override
public void treeWillCollapse(TreeExpansionEvent arg0)
throws ExpandVetoException {
}
@Override
public void treeWillExpand(TreeExpansionEvent arg0)
throws ExpandVetoException {
final FileNode lazyNode =
(FileNode) arg0.getPath().getLastPathComponent();
if( lazyNode.isFullyLoaded() )
{
return;
}
new SwingWorker<List<MutableTreeNode>, Void>(){ //every time when a parent node happens after expanding, we load it's children
@Override
protected List<MutableTreeNode> doInBackground() throws Exception {
// TODO Auto-generated method stub
return lazyNode.loadChildren();
}
protected void done() {
try {
for (MutableTreeNode node : get()) {
treeModel.insertNodeInto(node, lazyNode,
lazyNode.getChildCount());
}
} catch (Exception e) {
e.printStackTrace();
}
}
}.execute();
}
public TreeDirectory() {
FileNode root = new FileNode(new File(""));
treeModel = new DefaultTreeModel(root, true);
jTree = new JTree(treeModel);
jTree.setRootVisible(true);
jTree.addTreeWillExpandListener(this);
jTree.collapseRow(0); // collapse the root in order to implement TreeWillExpandListener after expanding in first level.
JScrollPane scrollBar = new JScrollPane(jTree,
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
add(scrollBar);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setTitle("JTree Example");
this.setSize(800,600);
this.setVisible(true);
}
}
| 2,700 | 0.595185 | 0.591482 | 80 | 32.762501 | 26.378138 | 134 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4875 | false | false |
1
|
d9563b4e0793778394e7db63d632ef861b147029
| 26,560,077,788,150 |
225890c3aad7e15e9d2f74e720edacc15dc3e5b3
|
/src/main/java/ua/kukhtar/model/entity/Order.java
|
9e075a2c2c442f6bd3d419fc682524ed9755c965
|
[] |
no_license
|
AndreRudyk/Repair-agency
|
https://github.com/AndreRudyk/Repair-agency
|
6790445ec068b09b2f2c09235e48e539fbefb9a2
|
4f34296a238487834e348873a5822af992bfbe2d
|
refs/heads/master
| 2022-12-31T07:43:32.722000 | 2020-10-26T07:24:15 | 2020-10-26T07:24:15 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package ua.kukhtar.model.entity;
import ua.kukhtar.model.entity.enums.STATUS;
import java.time.LocalDate;
//todo: add builder instead of setters
public class Order {
private int id;
private User customer;
private User master;
private STATUS status;
private LocalDate date;
private Address address;
private int price;
private String feedBack;
public int getId() { return id; }
public void setId(int id) { this.id = id; }
public User getCustomer() { return customer; }
public void setCustomer(User customer) { this.customer = customer; }
public User getMaster() { return master; }
public void setMaster(User master) { this.master = master; }
public STATUS getStatus() { return status;}
public void setStatus(STATUS status) { this.status = status; }
public LocalDate getDate() {return date; }
public void setDate(LocalDate date) { this.date = date; }
public Address getAddress() { return address;}
public void setAddress(Address address) { this.address = address; }
public int getPrice() { return price; }
public void setPrice(int price) { this.price = price; }
public String getFeedBack() { return feedBack; }
public void setFeedBack(String feedBack) { this.feedBack = feedBack; }
@Override
public String toString() {
return "Order{" +
"id=" + id +
", customer=" + customer +
", master=" + master +
", status=" + status +
", date=" + date +
", address=" + address +
", price=" + price +
", feedBack='" + feedBack + '\'' +
'}';
}
}
|
UTF-8
|
Java
| 1,710 |
java
|
Order.java
|
Java
|
[] | null |
[] |
package ua.kukhtar.model.entity;
import ua.kukhtar.model.entity.enums.STATUS;
import java.time.LocalDate;
//todo: add builder instead of setters
public class Order {
private int id;
private User customer;
private User master;
private STATUS status;
private LocalDate date;
private Address address;
private int price;
private String feedBack;
public int getId() { return id; }
public void setId(int id) { this.id = id; }
public User getCustomer() { return customer; }
public void setCustomer(User customer) { this.customer = customer; }
public User getMaster() { return master; }
public void setMaster(User master) { this.master = master; }
public STATUS getStatus() { return status;}
public void setStatus(STATUS status) { this.status = status; }
public LocalDate getDate() {return date; }
public void setDate(LocalDate date) { this.date = date; }
public Address getAddress() { return address;}
public void setAddress(Address address) { this.address = address; }
public int getPrice() { return price; }
public void setPrice(int price) { this.price = price; }
public String getFeedBack() { return feedBack; }
public void setFeedBack(String feedBack) { this.feedBack = feedBack; }
@Override
public String toString() {
return "Order{" +
"id=" + id +
", customer=" + customer +
", master=" + master +
", status=" + status +
", date=" + date +
", address=" + address +
", price=" + price +
", feedBack='" + feedBack + '\'' +
'}';
}
}
| 1,710 | 0.59883 | 0.59883 | 64 | 25.71875 | 22.81205 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.546875 | false | false |
1
|
8c0316f2282c12bc9690379cb1e798401ddc40ba
| 29,678,224,017,894 |
82fe21bdee764d60e405ed420605537a8f61282e
|
/src/coletapreco/parse/callback/custom/ProdutoWalmartDetalheCallback.java
|
aec7ff18c21e9ad45f3119dc05a632b3bb8b8e98
|
[] |
no_license
|
paulofor/ColetorGeralPrecos
|
https://github.com/paulofor/ColetorGeralPrecos
|
4d07d5476fd13cde8863de2daa8ce2215a1a902d
|
49512c8afe480ef8b81211038ed461ffea4508ca
|
refs/heads/master
| 2021-07-09T05:26:21.108000 | 2020-12-27T21:03:00 | 2020-12-27T21:03:00 | 224,445,622 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package coletapreco.parse.callback.custom;
import coletapreco.parse.callback.ProdutoDetalheCallbackHtml;
import coletapreco.parse.dados.ProdutoDadosParse;
public class ProdutoWalmartDetalheCallback extends ProdutoDetalheCallbackHtml {
private String preco = null;
private String nome = null;
public ProdutoWalmartDetalheCallback() {
//this.setDebug();
}
public void handleText(char[] data, int pos) {
super.handleText(data, pos);
String texto = String.copyValueOf(data);
if ("int".equals(this.getUltClasse()) && "product-price-value".equals(this.getUltClasse2())) {
preco = texto;
}
if (preco!=null && "dec".equals(this.getUltClasse())) {
preco += texto;
((ProdutoDadosParse)dadosParse).setPrecoDetalhe(preco);
preco = null;
}
if (nome==null && "product-name".equals(this.getUltClasse())) {
nome = texto;
((ProdutoDadosParse)dadosParse).setNomeDetalhe(nome);
}
}
}
|
UTF-8
|
Java
| 920 |
java
|
ProdutoWalmartDetalheCallback.java
|
Java
|
[] | null |
[] |
package coletapreco.parse.callback.custom;
import coletapreco.parse.callback.ProdutoDetalheCallbackHtml;
import coletapreco.parse.dados.ProdutoDadosParse;
public class ProdutoWalmartDetalheCallback extends ProdutoDetalheCallbackHtml {
private String preco = null;
private String nome = null;
public ProdutoWalmartDetalheCallback() {
//this.setDebug();
}
public void handleText(char[] data, int pos) {
super.handleText(data, pos);
String texto = String.copyValueOf(data);
if ("int".equals(this.getUltClasse()) && "product-price-value".equals(this.getUltClasse2())) {
preco = texto;
}
if (preco!=null && "dec".equals(this.getUltClasse())) {
preco += texto;
((ProdutoDadosParse)dadosParse).setPrecoDetalhe(preco);
preco = null;
}
if (nome==null && "product-name".equals(this.getUltClasse())) {
nome = texto;
((ProdutoDadosParse)dadosParse).setNomeDetalhe(nome);
}
}
}
| 920 | 0.721739 | 0.720652 | 34 | 26.058823 | 26.555094 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.852941 | false | false |
1
|
5a0272e84f8f654d1b409545e03ea9acfcf761e2
| 29,678,224,016,989 |
0fb3cbe3cdc220f25cf997ef5b4d4f64d6ca86b0
|
/spring-framework/src/main/java/com/kim/springframework/ioc/postprocessor/MyBeanFactoryPostProcessor.java
|
776bc380e1d15fc8112bec059a497e83295a910f
|
[] |
no_license
|
kim709394/java-common
|
https://github.com/kim709394/java-common
|
f54b72be7dc6a78f5d32fd5c01b44fd1d9738314
|
da7639dd2913d5c97a47efccd9ff19046daf1475
|
refs/heads/master
| 2023-02-07T08:29:20.367000 | 2023-02-01T00:51:21 | 2023-02-01T00:51:21 | 266,161,982 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.kim.springframework.ioc.postprocessor;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.stereotype.Component;
/**
* @author huangjie
* @description BeanDefinition初始化完成时的后置处理器
* @date 2022-01-01
*/
@Component
public class MyBeanFactoryPostProcessor implements BeanFactoryPostProcessor {
/**
* 调用此方法时,bean还没有实例化,只是bean都被封装成BeanDefinition对象时调用
* BeanDefinition对象:封装了bean的各种参数和属性的对象,spring第一步先将bean
* 的所有参数和属性封装成BeanDefinition对象,再进行后续操作
* */
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory config) throws BeansException {
BeanDefinition car = config.getBeanDefinition("car");
//拿到某个BeanDefinition对象时,可以对其进行属性值等进行修改
System.out.println(car);
}
}
|
UTF-8
|
Java
| 1,206 |
java
|
MyBeanFactoryPostProcessor.java
|
Java
|
[
{
"context": "ingframework.stereotype.Component;\n\n/**\n * @author huangjie\n * @description BeanDefinition初始化完成时的后置处理器\n * @",
"end": 393,
"score": 0.9994365572929382,
"start": 385,
"tag": "USERNAME",
"value": "huangjie"
}
] | null |
[] |
package com.kim.springframework.ioc.postprocessor;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.stereotype.Component;
/**
* @author huangjie
* @description BeanDefinition初始化完成时的后置处理器
* @date 2022-01-01
*/
@Component
public class MyBeanFactoryPostProcessor implements BeanFactoryPostProcessor {
/**
* 调用此方法时,bean还没有实例化,只是bean都被封装成BeanDefinition对象时调用
* BeanDefinition对象:封装了bean的各种参数和属性的对象,spring第一步先将bean
* 的所有参数和属性封装成BeanDefinition对象,再进行后续操作
* */
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory config) throws BeansException {
BeanDefinition car = config.getBeanDefinition("car");
//拿到某个BeanDefinition对象时,可以对其进行属性值等进行修改
System.out.println(car);
}
}
| 1,206 | 0.792585 | 0.784569 | 30 | 32.266666 | 29.450447 | 102 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.266667 | false | false |
1
|
248e829e48ae8fecb5381f2d1f261d628681bd46
| 5,712,306,561,289 |
d7a80ddd5297e800b213aaf7f05366197feb424f
|
/IcyNote/app/src/main/java/icynote/noteproviders/persistent/ListNoteProvider.java
|
fd37d91231c6667decd307e46968f11a62d470e5
|
[] |
no_license
|
RomainGehrig/SwEng2016
|
https://github.com/RomainGehrig/SwEng2016
|
1303745a2933a71e6991e96b2c6bdb2a68aaf38c
|
5ed8ab6d5b4d646319a9ac1886cf49ed49a7ccc9
|
refs/heads/master
| 2021-08-28T09:38:13.625000 | 2016-12-22T14:53:29 | 2016-12-22T14:53:29 | 113,911,080 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package icynote.noteproviders.persistent;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import icynote.note.Note;
import icynote.noteproviders.OrderBy;
import icynote.noteproviders.OrderType;
import icynote.note.Response;
import icynote.noteproviders.NoteProvider;
import icynote.note.impl.NoteData;
import icynote.note.common.ResponseFactory;
import icynote.note.decorators.ConstId;
import util.Optional;
/**
* Concrete NoteProvider implementation to be used by the IcyNote addNoteDecorators.
* <p>
* <p>
* Internally, this class uses an ArrayList and ensures uniqueness of notes' IDs.
*
* @author Julien Harbulot
* @version 1.0
*/
public class ListNoteProvider implements NoteProvider<Note<String>> {
private final List<Note<String>> notes = new ArrayList<>();
private int nextId = 0;
/**
* Instantiates a new List note provider.
*/
public ListNoteProvider() {
}
/**
* Instantiates a new List note provider.
*
* @param memory the memory
*/
public ListNoteProvider(Iterable<Note<String>> memory) {
for (Note<String> n : memory) {
notes.add(new NoteData<>(n));
}
}
@Override
public Optional<Note<String>> createNote() {
Note<String> created = new NoteData<>("", "");
created.setId(nextId);
++nextId;
Note<String> defensiveCopy = new NoteData<>(created);
notes.add(defensiveCopy);
Note<String> validator = new ConstId<>(created);
return Optional.of(validator);
}
@Override
public Optional<Note<String>> getNote(int id) {
for (Note<String> note : notes) {
if (note.getId() == id) {
Note<String> defensiveCopy = new NoteData<>(note);
return Optional.of((Note<String>) new ConstId<>(defensiveCopy));
}
}
return Optional.empty();
}
@Override
public Iterable<Note<String>> getNotes(final OrderBy index, final OrderType order) {
List<Note<String>> unsorted = new ArrayList<>();
for (Note<String> n : notes) {
Note<String> defensiveCopy = new NoteData<>(n);
unsorted.add(new ConstId<>(defensiveCopy));
}
Collections.sort(unsorted, new Comparator<Note<String>>() {
@Override
public int compare(Note<String> o1, Note<String> o2) {
Note<String> lhs = o1;
Note<String> rhs = o2;
if (order == OrderType.DSC) {
lhs = o2;
rhs = o1;
}
switch (index) {
case TITLE:
return lhs.getTitle().compareTo(rhs.getTitle());
case CREATION:
return lhs.getCreation().compareTo(rhs.getCreation());
case LAST_UPDATE:
return lhs.getLastUpdate().compareTo(rhs.getLastUpdate());
default:
throw new AssertionError(index);
}
}
});
return unsorted;
}
@Override
public Response persist(Note<String> n) {
n = n.getRaw(); //unwind the decorator stack, if there is one
for (int i = 0; i < notes.size(); ++i) {
if (notes.get(i).getId() == n.getId()) {
Note<String> defensiveCopy = new NoteData<>(n);
notes.set(i, defensiveCopy);
return ResponseFactory.positiveResponse();
}
}
return ResponseFactory.negativeResponse();
}
@Override
public Response delete(int id) {
for (Iterator<Note<String>> it = notes.iterator(); it.hasNext(); ) {
if (it.next().getId() == id) {
it.remove();
return ResponseFactory.positiveResponse();
}
}
return ResponseFactory.negativeResponse();
}
}
|
UTF-8
|
Java
| 4,034 |
java
|
ListNoteProvider.java
|
Java
|
[
{
"context": "nd ensures uniqueness of notes' IDs.\n *\n * @author Julien Harbulot\n * @version 1.0\n */\npublic class ListNoteProvider",
"end": 714,
"score": 0.9998372793197632,
"start": 699,
"tag": "NAME",
"value": "Julien Harbulot"
}
] | null |
[] |
package icynote.noteproviders.persistent;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import icynote.note.Note;
import icynote.noteproviders.OrderBy;
import icynote.noteproviders.OrderType;
import icynote.note.Response;
import icynote.noteproviders.NoteProvider;
import icynote.note.impl.NoteData;
import icynote.note.common.ResponseFactory;
import icynote.note.decorators.ConstId;
import util.Optional;
/**
* Concrete NoteProvider implementation to be used by the IcyNote addNoteDecorators.
* <p>
* <p>
* Internally, this class uses an ArrayList and ensures uniqueness of notes' IDs.
*
* @author <NAME>
* @version 1.0
*/
public class ListNoteProvider implements NoteProvider<Note<String>> {
private final List<Note<String>> notes = new ArrayList<>();
private int nextId = 0;
/**
* Instantiates a new List note provider.
*/
public ListNoteProvider() {
}
/**
* Instantiates a new List note provider.
*
* @param memory the memory
*/
public ListNoteProvider(Iterable<Note<String>> memory) {
for (Note<String> n : memory) {
notes.add(new NoteData<>(n));
}
}
@Override
public Optional<Note<String>> createNote() {
Note<String> created = new NoteData<>("", "");
created.setId(nextId);
++nextId;
Note<String> defensiveCopy = new NoteData<>(created);
notes.add(defensiveCopy);
Note<String> validator = new ConstId<>(created);
return Optional.of(validator);
}
@Override
public Optional<Note<String>> getNote(int id) {
for (Note<String> note : notes) {
if (note.getId() == id) {
Note<String> defensiveCopy = new NoteData<>(note);
return Optional.of((Note<String>) new ConstId<>(defensiveCopy));
}
}
return Optional.empty();
}
@Override
public Iterable<Note<String>> getNotes(final OrderBy index, final OrderType order) {
List<Note<String>> unsorted = new ArrayList<>();
for (Note<String> n : notes) {
Note<String> defensiveCopy = new NoteData<>(n);
unsorted.add(new ConstId<>(defensiveCopy));
}
Collections.sort(unsorted, new Comparator<Note<String>>() {
@Override
public int compare(Note<String> o1, Note<String> o2) {
Note<String> lhs = o1;
Note<String> rhs = o2;
if (order == OrderType.DSC) {
lhs = o2;
rhs = o1;
}
switch (index) {
case TITLE:
return lhs.getTitle().compareTo(rhs.getTitle());
case CREATION:
return lhs.getCreation().compareTo(rhs.getCreation());
case LAST_UPDATE:
return lhs.getLastUpdate().compareTo(rhs.getLastUpdate());
default:
throw new AssertionError(index);
}
}
});
return unsorted;
}
@Override
public Response persist(Note<String> n) {
n = n.getRaw(); //unwind the decorator stack, if there is one
for (int i = 0; i < notes.size(); ++i) {
if (notes.get(i).getId() == n.getId()) {
Note<String> defensiveCopy = new NoteData<>(n);
notes.set(i, defensiveCopy);
return ResponseFactory.positiveResponse();
}
}
return ResponseFactory.negativeResponse();
}
@Override
public Response delete(int id) {
for (Iterator<Note<String>> it = notes.iterator(); it.hasNext(); ) {
if (it.next().getId() == id) {
it.remove();
return ResponseFactory.positiveResponse();
}
}
return ResponseFactory.negativeResponse();
}
}
| 4,025 | 0.570402 | 0.567923 | 132 | 29.560606 | 23.804844 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.454545 | false | false |
1
|
2b8451aa56cdd86e6054f666197be99f558498ae
| 9,509,057,657,128 |
1af24f61d3a5ee3dddd81b8340490246cbb259e9
|
/src/main/java/com/voidabhi/sso/Broker.java
|
897e6570659d039838c4750476cc77106420cdc0
|
[
"MIT"
] |
permissive
|
voidabhi/sso-java
|
https://github.com/voidabhi/sso-java
|
e20c43fb21f6f8ce20a9534982528572a3751145
|
538ca147d8a822992852471c02990e777835f403
|
refs/heads/master
| 2020-12-07T03:49:28.638000 | 2016-07-11T17:45:59 | 2016-07-11T17:45:59 | 59,426,932 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.voidabhi.sso;
public class Broker
{
}
|
UTF-8
|
Java
| 54 |
java
|
Broker.java
|
Java
|
[] | null |
[] |
package com.voidabhi.sso;
public class Broker
{
}
| 54 | 0.703704 | 0.703704 | 5 | 9.4 | 10.818502 | 25 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | false | false |
1
|
cc479992c5708d8856cbf8219176d0831f46c2d2
| 2,422,361,606,254 |
05ecc92b39528adaabdbbb0ed9e13115838f4e95
|
/src/fr/um2/projetl3/tarotandroid/jeu/Main.java
|
f46512d730d4d3585e306d47b771f60a982770f3
|
[] |
no_license
|
jailby/genialissime
|
https://github.com/jailby/genialissime
|
5853d9ccd38b24e19523839104f343e213b00c66
|
a84b56122cf2e24f70b2fe0ac6772b80b154332f
|
refs/heads/master
| 2016-09-05T16:05:26.221000 | 2012-05-11T07:28:35 | 2012-05-11T07:28:35 | 32,886,674 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package fr.um2.projetl3.tarotandroid.jeu;
import java.util.Collections;
import java.util.Vector;
import fr.um2.projetl3.tarotandroid.clients.IJoueur;
import fr.um2.projetl3.tarotandroid.clients.JoueurTexte;
import fr.um2.projetl3.tarotandroid.connection.Cartes;
@SuppressWarnings("unused")
public class Main
{
private Vector<Carte> cartes;
/**
* constructeur de main vide
*/
public Main()
{
cartes = new Vector<Carte>();
}
public Main(Vector<Carte> vCartes)
{
cartes = vCartes;
}
public Vector<Carte> triMain()
{
Vector<Carte> cartesTrier = new Vector<Carte>();
cartesTrier.addAll(cartes);
Collections.sort(cartesTrier);
return cartesTrier;
}
/**
* Ajoute une carte passée en paramètre dans la main.
* @param c une carte
* @return false si l’opération a échoué, true si elle a réussi.
*/
public boolean addCarte(Carte c)
{
// System.out.println("Ajout de " + c + " au joueur" + proprietaire);
return cartes.add(c);
}
/**
* Enlève une carte passée en paramètre de la main.
* @param c une carte
* @return false si l’opération a échoué, true si elle a réussi.
*/
public boolean removeCarte(Carte c)
{
for (int i=0;i<cartes.size();i++)
{
if (c.uid()==cartes.get(i).uid()){
cartes.remove(i);
return true;
}
}
return false;
}
/**
* Donne le nombre de cartes restantes dans la main.
* @return le nombre de cartes restantes
*/
public int nbCartesRestantes()
{
return cartes.size();
}
/**
* Teste si une carte est dans la main ou pas.
* @param c une carte
* @return true si la main contient la carte c, false sinon.
*/
public boolean possede(Carte c)
{
for (Carte ca: cartes)
{
if (c.uid()==ca.uid()){
return true;
}
}
return false;
}
/**
* Retourne le vecteur des cartes
* @return le vecteur contenant les cartes de la main.
*/
public Vector<Carte> getCartes()
{
return cartes;
}
/**
* Teste si la main possède la couleur passée en paramètre.
* @param coul une couleur
* @return true si la main possède au moins une carte de la couleur coul, false sinon.
*/
public boolean possedeCouleur(Couleur coul)
{
boolean couleurExiste = false;
for(Carte c: cartes)
{
if(c.isCouleur())
{
if(c.getCouleur() == coul)
{
couleurExiste = true;
break;
}
}
}
return couleurExiste;
}
/**
* Teste si la main possède de l’atout.
* @return true si la main possède au moins un atout, false sinon.
*/
public boolean possedeAtout()
{
boolean atoutPresent = false;
for(Carte c: cartes)
{
if(c.isAtout() && !c.isExcuse())
{
atoutPresent = true;
break;
}
}
return atoutPresent;
}
/**
* Enlève de la main l’écart passé en paramètre.
* @param ecart un tableau de cartes contenant l’écart
* On pourrait dire le nom du proprietaire de la main
*/
public void enleverEcart(Vector<Carte> ecart)
{
for(Carte c: ecart)
{
if(possede(c))
{
removeCarte(c);
}
else
{
System.out.println("??? enleverEcart : carte " + c + " pas dans la main du joueur ");
}
}
}
/**
* Affiche la main, sous la forme :
*
* Main de NomDuJoueur : [ (7,♦) (2,♦) (3,♦) (4,♡) ]
*
*/
public void affiche()
{
//System.out.print("Main de "+proprietaire.getNomDuJoueur()+" :\t");
System.out.print("[ ");
for(Carte c: cartes)
{
if(c != null)
c.affiche();
else
System.out.print("# ");
}
System.out.println("]");
}
public Main(Cartes c)
{
for(int i = 0 ; i<c.size() ; i++)
{
cartes.add(c.getcarte(i));
}
}
/**
* Donne la carte à l’indice indiqué en paramètre.
* @param num
* @return la carte à l’indice num
*/
public Carte getCarte(int num)
{
return cartes.elementAt(num);
}
/**
* Teste si la main possède un atout supérieur à l’ordre passé en paramètre
* @param ordre la valeur de l’atout à tester
* @return true si la main possède un atout supérieur à ordre (paramètre)
*/
public boolean possedeAtoutPlusGrand(int ordre)
{
// System.out.println("possede Atout plus grand que "+ordre+" ?");
for(int i = 0; i< cartes.size(); i++)
{
if (cartes.get(i).isAtout() && cartes.get(i).getOrdre() > ordre)
{
return true;
}
}
return false;
}
public static void main(String[] args)
{
/*
IJoueur j1 = new JoueurTexte("Truc");
//System.out.println(j1.demanderAnnonce().getName()); erreur
Main m = new Main(j1);
m.addCarte(new Carte(Couleur.Trefle, 12));
m.addCarte(new Carte(14));
m.addCarte(new Carte(0));
m.addCarte(new Carte(21));
m.addCarte(new Carte(Couleur.Carreau, 2));
//m.addCarte(new CarteCouleur(Couleur.Carreau, 1));
m.affiche();
System.out.println(m.cartes.size());*/
}
public void clear() {
cartes.clear();
}
}
|
UTF-8
|
Java
| 4,840 |
java
|
Main.java
|
Java
|
[] | null |
[] |
package fr.um2.projetl3.tarotandroid.jeu;
import java.util.Collections;
import java.util.Vector;
import fr.um2.projetl3.tarotandroid.clients.IJoueur;
import fr.um2.projetl3.tarotandroid.clients.JoueurTexte;
import fr.um2.projetl3.tarotandroid.connection.Cartes;
@SuppressWarnings("unused")
public class Main
{
private Vector<Carte> cartes;
/**
* constructeur de main vide
*/
public Main()
{
cartes = new Vector<Carte>();
}
public Main(Vector<Carte> vCartes)
{
cartes = vCartes;
}
public Vector<Carte> triMain()
{
Vector<Carte> cartesTrier = new Vector<Carte>();
cartesTrier.addAll(cartes);
Collections.sort(cartesTrier);
return cartesTrier;
}
/**
* Ajoute une carte passée en paramètre dans la main.
* @param c une carte
* @return false si l’opération a échoué, true si elle a réussi.
*/
public boolean addCarte(Carte c)
{
// System.out.println("Ajout de " + c + " au joueur" + proprietaire);
return cartes.add(c);
}
/**
* Enlève une carte passée en paramètre de la main.
* @param c une carte
* @return false si l’opération a échoué, true si elle a réussi.
*/
public boolean removeCarte(Carte c)
{
for (int i=0;i<cartes.size();i++)
{
if (c.uid()==cartes.get(i).uid()){
cartes.remove(i);
return true;
}
}
return false;
}
/**
* Donne le nombre de cartes restantes dans la main.
* @return le nombre de cartes restantes
*/
public int nbCartesRestantes()
{
return cartes.size();
}
/**
* Teste si une carte est dans la main ou pas.
* @param c une carte
* @return true si la main contient la carte c, false sinon.
*/
public boolean possede(Carte c)
{
for (Carte ca: cartes)
{
if (c.uid()==ca.uid()){
return true;
}
}
return false;
}
/**
* Retourne le vecteur des cartes
* @return le vecteur contenant les cartes de la main.
*/
public Vector<Carte> getCartes()
{
return cartes;
}
/**
* Teste si la main possède la couleur passée en paramètre.
* @param coul une couleur
* @return true si la main possède au moins une carte de la couleur coul, false sinon.
*/
public boolean possedeCouleur(Couleur coul)
{
boolean couleurExiste = false;
for(Carte c: cartes)
{
if(c.isCouleur())
{
if(c.getCouleur() == coul)
{
couleurExiste = true;
break;
}
}
}
return couleurExiste;
}
/**
* Teste si la main possède de l’atout.
* @return true si la main possède au moins un atout, false sinon.
*/
public boolean possedeAtout()
{
boolean atoutPresent = false;
for(Carte c: cartes)
{
if(c.isAtout() && !c.isExcuse())
{
atoutPresent = true;
break;
}
}
return atoutPresent;
}
/**
* Enlève de la main l’écart passé en paramètre.
* @param ecart un tableau de cartes contenant l’écart
* On pourrait dire le nom du proprietaire de la main
*/
public void enleverEcart(Vector<Carte> ecart)
{
for(Carte c: ecart)
{
if(possede(c))
{
removeCarte(c);
}
else
{
System.out.println("??? enleverEcart : carte " + c + " pas dans la main du joueur ");
}
}
}
/**
* Affiche la main, sous la forme :
*
* Main de NomDuJoueur : [ (7,♦) (2,♦) (3,♦) (4,♡) ]
*
*/
public void affiche()
{
//System.out.print("Main de "+proprietaire.getNomDuJoueur()+" :\t");
System.out.print("[ ");
for(Carte c: cartes)
{
if(c != null)
c.affiche();
else
System.out.print("# ");
}
System.out.println("]");
}
public Main(Cartes c)
{
for(int i = 0 ; i<c.size() ; i++)
{
cartes.add(c.getcarte(i));
}
}
/**
* Donne la carte à l’indice indiqué en paramètre.
* @param num
* @return la carte à l’indice num
*/
public Carte getCarte(int num)
{
return cartes.elementAt(num);
}
/**
* Teste si la main possède un atout supérieur à l’ordre passé en paramètre
* @param ordre la valeur de l’atout à tester
* @return true si la main possède un atout supérieur à ordre (paramètre)
*/
public boolean possedeAtoutPlusGrand(int ordre)
{
// System.out.println("possede Atout plus grand que "+ordre+" ?");
for(int i = 0; i< cartes.size(); i++)
{
if (cartes.get(i).isAtout() && cartes.get(i).getOrdre() > ordre)
{
return true;
}
}
return false;
}
public static void main(String[] args)
{
/*
IJoueur j1 = new JoueurTexte("Truc");
//System.out.println(j1.demanderAnnonce().getName()); erreur
Main m = new Main(j1);
m.addCarte(new Carte(Couleur.Trefle, 12));
m.addCarte(new Carte(14));
m.addCarte(new Carte(0));
m.addCarte(new Carte(21));
m.addCarte(new Carte(Couleur.Carreau, 2));
//m.addCarte(new CarteCouleur(Couleur.Carreau, 1));
m.affiche();
System.out.println(m.cartes.size());*/
}
public void clear() {
cartes.clear();
}
}
| 4,840 | 0.6317 | 0.626047 | 237 | 19.151899 | 20.518648 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.873418 | false | false |
1
|
8582162645e5b43fd89f90b90f94a0ab2b236f97
| 8,667,244,033,527 |
35027d67be88fce1afaaca6b26c7b074629e8247
|
/MahlMal/src/common/packet/ConsoleMessagePacket.java
|
bf056252bb4d9dfe50a1019819a07bdc4ab7da82
|
[] |
no_license
|
lolsalat/Mahlmal
|
https://github.com/lolsalat/Mahlmal
|
f000e42117e13fca28208e28a51cae7c608f1d75
|
0369e083d8b086f27834e02d3218dfc5a339bd77
|
refs/heads/master
| 2018-08-29T07:03:04.725000 | 2018-06-20T16:55:49 | 2018-06-20T16:55:49 | 135,698,736 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package common.packet;
import java.awt.Color;
import java.nio.ByteBuffer;
public class ConsoleMessagePacket extends Packet{
public static final byte PACKET_ID = 0x7;
public ConsoleMessagePacket(){
id = PACKET_ID;
}
public ConsoleMessagePacket(String message, Color color){
id = PACKET_ID;
this.message = message;
this.color = color;
}
public String message;
public Color color;
@Override
public void fromBytes(ByteBuffer bytes) {
color = new Color(bytes.getInt());
message = new String(bytes.array(), charset).substring(4);
}
@Override
public ByteBuffer toBytes() {
byte[] msg = message.getBytes(charset);
ByteBuffer request = header(msg.length + 4);
request.putInt(color.getRGB());
request.put(msg);
return request;
}
}
|
UTF-8
|
Java
| 807 |
java
|
ConsoleMessagePacket.java
|
Java
|
[] | null |
[] |
package common.packet;
import java.awt.Color;
import java.nio.ByteBuffer;
public class ConsoleMessagePacket extends Packet{
public static final byte PACKET_ID = 0x7;
public ConsoleMessagePacket(){
id = PACKET_ID;
}
public ConsoleMessagePacket(String message, Color color){
id = PACKET_ID;
this.message = message;
this.color = color;
}
public String message;
public Color color;
@Override
public void fromBytes(ByteBuffer bytes) {
color = new Color(bytes.getInt());
message = new String(bytes.array(), charset).substring(4);
}
@Override
public ByteBuffer toBytes() {
byte[] msg = message.getBytes(charset);
ByteBuffer request = header(msg.length + 4);
request.putInt(color.getRGB());
request.put(msg);
return request;
}
}
| 807 | 0.681537 | 0.67658 | 38 | 19.236841 | 17.781471 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.526316 | false | false |
1
|
57b20edadb69eec467e0b54776e1496f82d59272
| 10,934,986,752,759 |
a26842915fa186188c48b9c07a55192d42913715
|
/src/main/java/com/github/gilbertotcc/cofs/cli/CommandLineInterface.java
|
2e7cf78a6941f684a7dadb8d2009ba453fd3d90a
|
[] |
no_license
|
gilbertotcc/cofs
|
https://github.com/gilbertotcc/cofs
|
98a6f7a4d63292deaaf7f41ff146951438bb8e5e
|
4491f864bd7f3000b56718dec9bc3ca4574a8667
|
refs/heads/develop
| 2020-07-20T12:53:07.698000 | 2019-01-13T22:04:13 | 2019-01-13T22:04:13 | 73,745,964 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.github.gilbertotcc.cofs.cli;
import static io.vavr.API.Invalid;
import static io.vavr.API.None;
import static io.vavr.API.Some;
import static io.vavr.API.Valid;
import java.util.function.Supplier;
import com.beust.jcommander.JCommander;
import io.vavr.collection.List;
import io.vavr.control.Option;
import io.vavr.control.Try;
import io.vavr.control.Validation;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class CommandLineInterface {
private static final Validation.Valid<CliErrors, CliArguments> VALID_HELP_COMMAND = Valid(CliArguments.builder()
.help(true)
.filename(None())
.build());
private final CliParameters parameters;
private final JCommander commander;
private CommandLineInterface(final CliParameters parameters, final JCommander commander) {
this.parameters = parameters;
this.commander = commander;
}
public static CommandLineInterface newCommandLineInterface() {
CliParameters parameters = new CliParameters();
JCommander commander = JCommander.newBuilder()
.addObject(parameters)
.build();
return new CommandLineInterface(parameters, commander);
}
public void printlnMessage(final String message) {
JCommander.getConsole().println(message);
}
public void showUsage() {
commander.usage();
}
public Validation<CliErrors, CliArguments> parse(final String ... arguments) {
log.debug("Parse command line arguments: {}", List.of(arguments));
return toValidCliArguments(() -> {
commander.parse(arguments);
return parameters.isHelp() ?
VALID_HELP_COMMAND :
Option.of(parameters.getInputFile())
.map(this::toValidCliArguments)
.getOrElse(Invalid(CliErrors.FILE_NOT_FOUND));
});
}
private Validation<CliErrors, CliArguments> toValidCliArguments(final Supplier<Validation<CliErrors, CliArguments>> validator) {
return Try.of(validator::get).getOrElse(Invalid(CliErrors.PARSING_ERROR));
}
private Validation<CliErrors, CliArguments> toValidCliArguments(final String filename) {
return Valid(CliArguments.builder()
.help(false)
.filename(Some(filename))
.build());
}
}
|
UTF-8
|
Java
| 2,405 |
java
|
CommandLineInterface.java
|
Java
|
[
{
"context": "package com.github.gilbertotcc.cofs.cli;\n\nimport static io.vavr.API.Invalid;\nimp",
"end": 30,
"score": 0.9990415573120117,
"start": 19,
"tag": "USERNAME",
"value": "gilbertotcc"
}
] | null |
[] |
package com.github.gilbertotcc.cofs.cli;
import static io.vavr.API.Invalid;
import static io.vavr.API.None;
import static io.vavr.API.Some;
import static io.vavr.API.Valid;
import java.util.function.Supplier;
import com.beust.jcommander.JCommander;
import io.vavr.collection.List;
import io.vavr.control.Option;
import io.vavr.control.Try;
import io.vavr.control.Validation;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class CommandLineInterface {
private static final Validation.Valid<CliErrors, CliArguments> VALID_HELP_COMMAND = Valid(CliArguments.builder()
.help(true)
.filename(None())
.build());
private final CliParameters parameters;
private final JCommander commander;
private CommandLineInterface(final CliParameters parameters, final JCommander commander) {
this.parameters = parameters;
this.commander = commander;
}
public static CommandLineInterface newCommandLineInterface() {
CliParameters parameters = new CliParameters();
JCommander commander = JCommander.newBuilder()
.addObject(parameters)
.build();
return new CommandLineInterface(parameters, commander);
}
public void printlnMessage(final String message) {
JCommander.getConsole().println(message);
}
public void showUsage() {
commander.usage();
}
public Validation<CliErrors, CliArguments> parse(final String ... arguments) {
log.debug("Parse command line arguments: {}", List.of(arguments));
return toValidCliArguments(() -> {
commander.parse(arguments);
return parameters.isHelp() ?
VALID_HELP_COMMAND :
Option.of(parameters.getInputFile())
.map(this::toValidCliArguments)
.getOrElse(Invalid(CliErrors.FILE_NOT_FOUND));
});
}
private Validation<CliErrors, CliArguments> toValidCliArguments(final Supplier<Validation<CliErrors, CliArguments>> validator) {
return Try.of(validator::get).getOrElse(Invalid(CliErrors.PARSING_ERROR));
}
private Validation<CliErrors, CliArguments> toValidCliArguments(final String filename) {
return Valid(CliArguments.builder()
.help(false)
.filename(Some(filename))
.build());
}
}
| 2,405 | 0.661538 | 0.660291 | 73 | 31.945206 | 29.1439 | 132 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.493151 | false | false |
1
|
6a25f95fa125197eb76f8cdd71ccd4faf3712991
| 20,031,727,472,609 |
5cbe68c73a92f25a2c1f583cca89542b3ada0a8b
|
/src/main/java/com/semantyca/ess/store/model/Address.java
|
19a758aaa684ff5e1b1a6b2aac1457dfb64db0f5
|
[] |
no_license
|
justkayra/ElasticManipulator
|
https://github.com/justkayra/ElasticManipulator
|
57c1dc5cdec05dbb97b87f1b768c37b958b45199
|
f077c27481a231de1dad9c5f92fe952d1deb53be
|
refs/heads/master
| 2020-04-04T17:19:36.932000 | 2018-11-06T16:44:50 | 2018-11-06T16:44:50 | 156,116,313 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.semantyca.ess.store.model;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
/**
* Created by kaira on 10/31/18.
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "Address")
public class Address {
@XmlElement(name = "Street")
private String street;
@XmlElement(name = "Town")
private String town;
@XmlElement(name = "County")
private String county;
@XmlElement(name = "Postcode")
private String postcode;
@XmlElement(name = "CountryCode")
private String countryCode;
@XmlElement(name = "GridLocation")
GridLocation gridLocation;
public String getStreet() {
return street;
}
public void setStreet(String street) {
this.street = street;
}
public String getTown() {
return town;
}
public void setTown(String town) {
this.town = town;
}
public String getCounty() {
return county;
}
public void setCounty(String county) {
this.county = county;
}
public String getPostcode() {
return postcode;
}
public void setPostcode(String postcode) {
this.postcode = postcode;
}
public String getCountryCode() {
return countryCode;
}
public void setCountryCode(String countryCode) {
this.countryCode = countryCode;
}
public GridLocation getGridLocation() {
return gridLocation;
}
public void setGridLocation(GridLocation gridLocation) {
this.gridLocation = gridLocation;
}
}
|
UTF-8
|
Java
| 1,681 |
java
|
Address.java
|
Java
|
[
{
"context": "bind.annotation.XmlRootElement;\n\n/**\n * Created by kaira on 10/31/18.\n */\n@XmlAccessorType(XmlAccessType.F",
"end": 256,
"score": 0.9991576671600342,
"start": 251,
"tag": "USERNAME",
"value": "kaira"
}
] | null |
[] |
package com.semantyca.ess.store.model;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
/**
* Created by kaira on 10/31/18.
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "Address")
public class Address {
@XmlElement(name = "Street")
private String street;
@XmlElement(name = "Town")
private String town;
@XmlElement(name = "County")
private String county;
@XmlElement(name = "Postcode")
private String postcode;
@XmlElement(name = "CountryCode")
private String countryCode;
@XmlElement(name = "GridLocation")
GridLocation gridLocation;
public String getStreet() {
return street;
}
public void setStreet(String street) {
this.street = street;
}
public String getTown() {
return town;
}
public void setTown(String town) {
this.town = town;
}
public String getCounty() {
return county;
}
public void setCounty(String county) {
this.county = county;
}
public String getPostcode() {
return postcode;
}
public void setPostcode(String postcode) {
this.postcode = postcode;
}
public String getCountryCode() {
return countryCode;
}
public void setCountryCode(String countryCode) {
this.countryCode = countryCode;
}
public GridLocation getGridLocation() {
return gridLocation;
}
public void setGridLocation(GridLocation gridLocation) {
this.gridLocation = gridLocation;
}
}
| 1,681 | 0.658537 | 0.654967 | 74 | 21.716217 | 17.090792 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.310811 | false | false |
1
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.