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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
687ed803dbe1828c4eb9ddf533e2a99526f9685c | 23,665,269,835,945 | 09da42befa705ef6a6aa008ab162d8422fb841ca | /xqoo-cloud-sms/src/main/java/com/xqoo/sms/entity/SmsSignEntity.java | b74a675a0a8a6b3fcd95d7aeca37a240972bee84 | [
"MIT"
] | permissive | bellmit/xqoo-cloud-admin | https://github.com/bellmit/xqoo-cloud-admin | 36f67f1c6daf510d51ad061eedcc8865f11f287b | 73e3846cf505c76152bc7f13cfdbb12b53bcc98e | refs/heads/master | 2023-02-28T08:54:31.437000 | 2021-02-07T10:47:12 | 2021-02-07T10:47:12 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.xqoo.sms.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
/**
* @author mumu
* @date 2019/11/08 上午11:17
**/
@SuppressWarnings("serial")
@ApiModel("")
@TableName(value = "sms_sign")
public class SmsSignEntity extends Model<SmsSignEntity> {
@TableId(value = "id")
private Integer id;
@ApiModelProperty("签名名称")
private String sign;
@ApiModelProperty("平台id")
private String servicePlatformId;
@ApiModelProperty("平台名称")
private String servicePlatformName;
public SmsSignEntity() {
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getSign() {
return sign;
}
public void setSign(String sign) {
this.sign = sign;
}
public String getServicePlatformId() {
return servicePlatformId;
}
public void setServicePlatformId(String servicePlatformId) {
this.servicePlatformId = servicePlatformId;
}
public String getServicePlatformName() {
return servicePlatformName;
}
public void setServicePlatformName(String servicePlatformName) {
this.servicePlatformName = servicePlatformName;
}
/**
* 获取主键值
*
* @return 主键值
*/
@Override
protected Serializable pkVal() {
return this.id;
}
/**
* {@inheritDoc}
*/
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("SmsSignEntity").append('[')
.append("id=")
.append(id)
.append(",sign=")
.append(sign)
.append(",servicePlatformId=")
.append(servicePlatformId)
.append(",servicePlatformName=")
.append(servicePlatformName)
.append(']');
return sb.toString();
}
} | UTF-8 | Java | 2,260 | java | SmsSignEntity.java | Java | [
{
"context": "ty;\n\nimport java.io.Serializable;\n\n\n/**\n * @author mumu\n * @date 2019/11/08 上午11:17\n **/\n@SuppressWarning",
"end": 337,
"score": 0.9994621276855469,
"start": 333,
"tag": "USERNAME",
"value": "mumu"
}
] | null | [] | package com.xqoo.sms.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
/**
* @author mumu
* @date 2019/11/08 上午11:17
**/
@SuppressWarnings("serial")
@ApiModel("")
@TableName(value = "sms_sign")
public class SmsSignEntity extends Model<SmsSignEntity> {
@TableId(value = "id")
private Integer id;
@ApiModelProperty("签名名称")
private String sign;
@ApiModelProperty("平台id")
private String servicePlatformId;
@ApiModelProperty("平台名称")
private String servicePlatformName;
public SmsSignEntity() {
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getSign() {
return sign;
}
public void setSign(String sign) {
this.sign = sign;
}
public String getServicePlatformId() {
return servicePlatformId;
}
public void setServicePlatformId(String servicePlatformId) {
this.servicePlatformId = servicePlatformId;
}
public String getServicePlatformName() {
return servicePlatformName;
}
public void setServicePlatformName(String servicePlatformName) {
this.servicePlatformName = servicePlatformName;
}
/**
* 获取主键值
*
* @return 主键值
*/
@Override
protected Serializable pkVal() {
return this.id;
}
/**
* {@inheritDoc}
*/
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("SmsSignEntity").append('[')
.append("id=")
.append(id)
.append(",sign=")
.append(sign)
.append(",servicePlatformId=")
.append(servicePlatformId)
.append(",servicePlatformName=")
.append(servicePlatformName)
.append(']');
return sb.toString();
}
} | 2,260 | 0.595496 | 0.59009 | 97 | 21.896908 | 19.792994 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.257732 | false | false | 3 |
ab6f9737d5545241f9dcb40766d2f1b2e07c5cb1 | 4,363,686,808,730 | c198bba6abdcf326d9d37d4009055d40035e726c | /src/test/java/com/recruitment/maze/RoomFactory.java | 5c304b5a4db7392481bc0edbec8801d1be0ea43c | [] | no_license | MostafaACHRAF/maze | https://github.com/MostafaACHRAF/maze | 48fa0a6ac3d05e47b625bbda7f696493b93dc494 | 89f42fe1f73e5682f48a58b7cb2bbf271db967a9 | refs/heads/master | 2021-05-02T10:18:05.967000 | 2018-02-12T22:00:13 | 2018-02-12T22:00:13 | 120,793,319 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.recruitment.maze;
import com.recruitment.maze.AppExceptions.IllegalMoveException;
import java.util.ArrayList;
import java.util.List;
class RoomFactory {
private List<Room> createdRooms = new ArrayList<>();
Room create(String roomCode, Gate gate) {
if (isExist(roomCode)) {
Room room = getRoomByCode(roomCode);
assert room != null;
room.addNewGate(gate);
return room;
}
Room room = new Room(roomCode, gate);
createdRooms.add(room);
return room;
}
private boolean isExist(String roomCode) {
for (Room room : createdRooms) {
if (room.code.equals(roomCode))
return true;
}
return false;
}
Room getRoomByCode(String code) {
for (Room room : createdRooms) {
if (room.code.equals(code))
return room;
}
throw new IllegalMoveException();
}
String displayCreatedRooms() {
StringBuilder stringBuilder = new StringBuilder();
for (Room room : createdRooms)
stringBuilder.append(room.toString());
return String.valueOf(stringBuilder);
}
}
| UTF-8 | Java | 1,208 | java | RoomFactory.java | Java | [] | null | [] | package com.recruitment.maze;
import com.recruitment.maze.AppExceptions.IllegalMoveException;
import java.util.ArrayList;
import java.util.List;
class RoomFactory {
private List<Room> createdRooms = new ArrayList<>();
Room create(String roomCode, Gate gate) {
if (isExist(roomCode)) {
Room room = getRoomByCode(roomCode);
assert room != null;
room.addNewGate(gate);
return room;
}
Room room = new Room(roomCode, gate);
createdRooms.add(room);
return room;
}
private boolean isExist(String roomCode) {
for (Room room : createdRooms) {
if (room.code.equals(roomCode))
return true;
}
return false;
}
Room getRoomByCode(String code) {
for (Room room : createdRooms) {
if (room.code.equals(code))
return room;
}
throw new IllegalMoveException();
}
String displayCreatedRooms() {
StringBuilder stringBuilder = new StringBuilder();
for (Room room : createdRooms)
stringBuilder.append(room.toString());
return String.valueOf(stringBuilder);
}
}
| 1,208 | 0.594371 | 0.594371 | 45 | 25.844444 | 18.580702 | 63 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.466667 | false | false | 3 |
24d14460dc209bb3ed4f8dddc87e5598d3e193c6 | 19,000,935,360,544 | 49dd2ed16d724bdaa706d564e35a5195baa35007 | /proj2-skeleton/partAtmp/src/pipair/common/Result.java | ec9dd89218be04215108ee4f519810edd90396f3 | [] | no_license | luke-jiang/CS_510 | https://github.com/luke-jiang/CS_510 | b327400f97932b3b92cd3f52fe31588b58a4ada0 | efd9d61953cb79753ed4f18986801b2cc45880d1 | refs/heads/master | 2023-01-28T00:03:30.689000 | 2020-11-29T16:12:40 | 2020-11-29T16:12:40 | 291,387,945 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package pipair.common;
import java.io.*;
import java.util.List;
public class Result {
public int bugFunc;
public int partner;
public List<Integer> callersMissing = null;
public int support;
public double confidence;
public Result(
int bugFunc, int partner, List<Integer> callersMissing, int support, double confidence) {
this.bugFunc = bugFunc;
this.partner = partner;
this.callersMissing = callersMissing;
this.support = support;
this.confidence = confidence;
}
}
| UTF-8 | Java | 508 | java | Result.java | Java | [] | null | [] | package pipair.common;
import java.io.*;
import java.util.List;
public class Result {
public int bugFunc;
public int partner;
public List<Integer> callersMissing = null;
public int support;
public double confidence;
public Result(
int bugFunc, int partner, List<Integer> callersMissing, int support, double confidence) {
this.bugFunc = bugFunc;
this.partner = partner;
this.callersMissing = callersMissing;
this.support = support;
this.confidence = confidence;
}
}
| 508 | 0.716535 | 0.716535 | 21 | 23.190475 | 20.388184 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.809524 | false | false | 3 |
6329f5c9ab68f3c08344ed98017e440f714a85ae | 22,617,297,820,154 | 377d7d7b6296d8e46da89645676f03cc65a9e02f | /FinalProject/app/src/main/java/com/uoit/calvin/finalproject/DetailsActivity.java | b2ae409bec0a92494e3882e88f1f2a03dd49ba0f | [] | no_license | calvin-lo/MyTodo | https://github.com/calvin-lo/MyTodo | ec4b9cd3d455ea5f0f7043924c5b1b5f95fd3bf0 | 2021c78eec73052a465bc5aa7a5f26cf2fac8f37 | refs/heads/master | 2021-03-19T13:59:51.284000 | 2016-11-29T01:42:58 | 2016-11-29T01:42:58 | 68,838,689 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.uoit.calvin.finalproject;
import android.location.Address;
import android.location.Geocoder;
import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
public class DetailsActivity extends AppCompatActivity {
long ID;
DBHelper dbHelper;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_details);
ID = Long.parseLong(getIntent().getStringExtra("ID"));
dbHelper = new DBHelper(this);
Task task = dbHelper.getSingelData(ID);
TextView nameView = (TextView) findViewById(R.id.textViewName);
TextView addressView = (TextView) findViewById(R.id.textViewAddress);
nameView.setText(task.getTitle());
// addressView.setText(task.getLatitude() + " ; " + task.getLongitude());
if (task.getLatitude() != 0.0 && task.getLongitude() != 0.0) {
addressView.setText(new Helper().getAddress(this, task.getLatitude(), task.getLongitude()));
}
}
}
| UTF-8 | Java | 1,298 | java | DetailsActivity.java | Java | [] | null | [] | package com.uoit.calvin.finalproject;
import android.location.Address;
import android.location.Geocoder;
import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
public class DetailsActivity extends AppCompatActivity {
long ID;
DBHelper dbHelper;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_details);
ID = Long.parseLong(getIntent().getStringExtra("ID"));
dbHelper = new DBHelper(this);
Task task = dbHelper.getSingelData(ID);
TextView nameView = (TextView) findViewById(R.id.textViewName);
TextView addressView = (TextView) findViewById(R.id.textViewAddress);
nameView.setText(task.getTitle());
// addressView.setText(task.getLatitude() + " ; " + task.getLongitude());
if (task.getLatitude() != 0.0 && task.getLongitude() != 0.0) {
addressView.setText(new Helper().getAddress(this, task.getLatitude(), task.getLongitude()));
}
}
}
| 1,298 | 0.707242 | 0.702619 | 45 | 27.844444 | 27.034098 | 104 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.6 | false | false | 3 |
93de816c0ee4a74ea725921223be01fe9e7e33ab | 11,836,929,898,186 | aa24c119d65bc08b554c265284c6dcb7800f82a8 | /Class_0710/src/com/jianjieming/Test01.java | 558a69fd601138f2f7fa6f2a3e872310a5c11902 | [] | no_license | JianJieMing/JianJieMing_JAVA | https://github.com/JianJieMing/JianJieMing_JAVA | dfe4929d6e3702ebad62bfc8e5583b851fdb042e | 0f3f7212e026e6ab0699943082a41f12cd487b69 | refs/heads/master | 2023-01-13T12:56:00.532000 | 2018-12-11T09:02:31 | 2018-12-11T09:02:31 | 149,609,661 | 2 | 0 | null | false | 2023-01-06T09:53:09 | 2018-09-20T12:59:01 | 2019-03-02T07:17:57 | 2023-01-06T09:53:08 | 93,833 | 2 | 0 | 110 | Java | false | false | package com.jianjieming;
import java.util.Scanner;
/**
* @author 铭
*/
public class Test01 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("欢迎光临! 输入1登录2注册: ");
int ss = scanner.nextInt();
String a1;
String a2;
while (true) {
if (ss == 2) {
System.out.println("请输入用户名: ");
String username = scanner.nextLine();
a1 = username;
System.out.println("请输入密码: ");
String password = scanner.nextLine();
a2 = password;
if (password.length() < 8) {
System.out.println("密码长度不够8位");
continue;
}
for (int i = 0; i < 10; i++) {
String s = String.valueOf(i);
if (password.startsWith(s)) {
System.out.println("密码不能以数字开头");
continue;
}
}
System.out.println("注册成功!");
break;
}
}
if (ss == 1) {
System.out.println("请输入用户名: ");
String username2 = scanner.nextLine();
System.out.println("请输入密码: ");
String password2 = scanner.nextLine();
if (a1.equals(username2) && a2.equals(password2)) {
System.out.println("登录成功");
} else {
System.out.println("用户名或者密码错误");
}
}
}
}
| UTF-8 | Java | 1,697 | java | Test01.java | Java | [
{
"context": "eming;\n\nimport java.util.Scanner;\n\n/**\n * @author 铭\n */\npublic class Test01 {\n public static void ",
"end": 69,
"score": 0.9978216886520386,
"start": 68,
"tag": "NAME",
"value": "铭"
}
] | null | [] | package com.jianjieming;
import java.util.Scanner;
/**
* @author 铭
*/
public class Test01 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("欢迎光临! 输入1登录2注册: ");
int ss = scanner.nextInt();
String a1;
String a2;
while (true) {
if (ss == 2) {
System.out.println("请输入用户名: ");
String username = scanner.nextLine();
a1 = username;
System.out.println("请输入密码: ");
String password = scanner.nextLine();
a2 = password;
if (password.length() < 8) {
System.out.println("密码长度不够8位");
continue;
}
for (int i = 0; i < 10; i++) {
String s = String.valueOf(i);
if (password.startsWith(s)) {
System.out.println("密码不能以数字开头");
continue;
}
}
System.out.println("注册成功!");
break;
}
}
if (ss == 1) {
System.out.println("请输入用户名: ");
String username2 = scanner.nextLine();
System.out.println("请输入密码: ");
String password2 = scanner.nextLine();
if (a1.equals(username2) && a2.equals(password2)) {
System.out.println("登录成功");
} else {
System.out.println("用户名或者密码错误");
}
}
}
}
| 1,697 | 0.434505 | 0.421086 | 50 | 30.299999 | 17.507998 | 63 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.56 | false | false | 3 |
a3680fdcdb7db5ab4e2de7f7c8e030edd34a39a6 | 25,512,105,788,317 | 39701bda027069b65ad40783f2c003c873bf780f | /src/test/java/io/lumeer/storage/hbase/EmbeddedHbaseDb.java | 8fc5518704dea7654830d3abadac4b590e4f3f32 | [] | no_license | Ilionesso/lumeer-storage-hbase | https://github.com/Ilionesso/lumeer-storage-hbase | 01d0634c468ed95bae7d565360564cab37931d1f | 0764ce8937dc43df47a5de8f3d3dd92c1509f48c | refs/heads/master | 2020-03-17T12:40:23.203000 | 2018-05-21T06:13:53 | 2018-05-21T06:13:53 | 133,597,419 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package io.lumeer.storage.hbase;/*
* Lumeer: Modern Data Definition and Processing Platform
*
* Copyright (C) since 2017 Answer Institute, s.r.o. and/or its affiliates.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import com.google.protobuf.ServiceException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.client.Admin;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.ConnectionFactory;
import org.apache.hadoop.hbase.client.HBaseAdmin;
import org.apache.hadoop.hbase.client.coprocessor.AggregationClient;
import java.io.IOException;
public class EmbeddedHbaseDb {
private Configuration config;
private Admin admin;
private Connection connection;
private AggregationClient aggregationClient;
public EmbeddedHbaseDb() {
}
public void start() throws IOException, ServiceException {
config = HBaseConfiguration.create();
String path = this.getClass()
.getClassLoader()
.getResource("hbase-site.xml")
.getPath();
config.addResource(new Path(path));
connection = ConnectionFactory.createConnection(config);
admin = connection.getAdmin();
aggregationClient = new AggregationClient(config);
HBaseAdmin.checkHBaseAvailable(config);
}
public void stop() throws IOException {
if (admin != null){
// admin.shutdown();
admin.close();
}
}
public Configuration getConfig() {
return config;
}
public Admin getAdmin() {
return admin;
}
public Connection getConnection() {
return connection;
}
public AggregationClient getAggregationClient() {
return aggregationClient;
}
}
| UTF-8 | Java | 2,427 | java | EmbeddedHbaseDb.java | Java | [] | null | [] | package io.lumeer.storage.hbase;/*
* Lumeer: Modern Data Definition and Processing Platform
*
* Copyright (C) since 2017 Answer Institute, s.r.o. and/or its affiliates.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import com.google.protobuf.ServiceException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.client.Admin;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.ConnectionFactory;
import org.apache.hadoop.hbase.client.HBaseAdmin;
import org.apache.hadoop.hbase.client.coprocessor.AggregationClient;
import java.io.IOException;
public class EmbeddedHbaseDb {
private Configuration config;
private Admin admin;
private Connection connection;
private AggregationClient aggregationClient;
public EmbeddedHbaseDb() {
}
public void start() throws IOException, ServiceException {
config = HBaseConfiguration.create();
String path = this.getClass()
.getClassLoader()
.getResource("hbase-site.xml")
.getPath();
config.addResource(new Path(path));
connection = ConnectionFactory.createConnection(config);
admin = connection.getAdmin();
aggregationClient = new AggregationClient(config);
HBaseAdmin.checkHBaseAvailable(config);
}
public void stop() throws IOException {
if (admin != null){
// admin.shutdown();
admin.close();
}
}
public Configuration getConfig() {
return config;
}
public Admin getAdmin() {
return admin;
}
public Connection getConnection() {
return connection;
}
public AggregationClient getAggregationClient() {
return aggregationClient;
}
}
| 2,427 | 0.717759 | 0.715698 | 80 | 29.3375 | 24.001534 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4375 | false | false | 3 |
925f1fdca9205e4fb155ffde0de5100c0a5d217b | 8,684,423,917,801 | 7effb2f1faebc3c5d55afee3d15c859c5b28e67b | /core/store.lmdb/src/main/java/mb/pie/store/lmdb/SerializedAndHashed.java | 9a260cd07e1c2cb5b5a0259c17cac8726795e302 | [
"Apache-2.0"
] | permissive | metaborg/pie | https://github.com/metaborg/pie | ac421ebf4e5265245137908b0c3c061848581db4 | ecf896f11a4fbc11b8aef8a8fb831663baa0d188 | refs/heads/develop | 2022-06-20T03:09:11.729000 | 2022-06-15T09:46:10 | 2022-06-15T09:46:10 | 102,454,792 | 8 | 4 | Apache-2.0 | false | 2022-06-15T09:46:11 | 2017-09-05T08:23:07 | 2021-12-13T13:50:55 | 2022-06-15T09:46:10 | 4,856 | 7 | 4 | 1 | Java | false | false | package mb.pie.store.lmdb;
import java.util.Arrays;
class SerializedAndHashed {
final byte[] serialized;
final byte[] hashed;
SerializedAndHashed(byte[] serialized, byte[] hashed) {
this.serialized = serialized;
this.hashed = hashed;
}
@Override public boolean equals(Object o) {
if(this == o) return true;
if(o == null || getClass() != o.getClass()) return false;
final SerializedAndHashed that = (SerializedAndHashed)o;
return Arrays.equals(serialized, that.serialized) && Arrays.equals(hashed, that.hashed);
}
@Override public int hashCode() {
int result = Arrays.hashCode(serialized);
result = 31 * result + Arrays.hashCode(hashed);
return result;
}
}
| UTF-8 | Java | 765 | java | SerializedAndHashed.java | Java | [] | null | [] | package mb.pie.store.lmdb;
import java.util.Arrays;
class SerializedAndHashed {
final byte[] serialized;
final byte[] hashed;
SerializedAndHashed(byte[] serialized, byte[] hashed) {
this.serialized = serialized;
this.hashed = hashed;
}
@Override public boolean equals(Object o) {
if(this == o) return true;
if(o == null || getClass() != o.getClass()) return false;
final SerializedAndHashed that = (SerializedAndHashed)o;
return Arrays.equals(serialized, that.serialized) && Arrays.equals(hashed, that.hashed);
}
@Override public int hashCode() {
int result = Arrays.hashCode(serialized);
result = 31 * result + Arrays.hashCode(hashed);
return result;
}
}
| 765 | 0.640523 | 0.637909 | 26 | 28.423077 | 25.026405 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.692308 | false | false | 3 |
f3e3b898cb07889ec9545f4a31ed1dfdc689a55f | 7,507,602,844,181 | f893e942ed4052f1797be4cc8a61b909a974ded1 | /learn-bigdata-flink/src/main/java/com/lwq/bigdata/flink/batch/CrossDemo.java | 9cd9f0b3d5412db645103bc8ec04a015ed438170 | [] | no_license | wroldchinalee/project-all | https://github.com/wroldchinalee/project-all | 34f8604f6573b4e7da1fa228d0ddc0d873af1e78 | e5cc9f71138193473f8da4e6cc7af837d916c7a0 | refs/heads/master | 2023-06-01T00:00:43.741000 | 2021-07-01T12:39:52 | 2021-07-01T12:39:52 | 313,957,784 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.lwq.bigdata.flink.batch;
import org.apache.flink.api.java.ExecutionEnvironment;
import org.apache.flink.api.java.operators.DataSource;
import org.apache.flink.api.java.tuple.Tuple2;
import java.util.ArrayList;
/**
* Created by Administrator on 2020-12-06.
* 笛卡尔积
*/
public class CrossDemo {
public static void main(String[] args) throws Exception {
ExecutionEnvironment environment = ExecutionEnvironment.getExecutionEnvironment();
ArrayList<String> list1 = new ArrayList<>();
list1.add("zs");
list1.add("ls");
ArrayList<Integer> list2 = new ArrayList<>();
list2.add(1);
list2.add(2);
DataSource<String> text1 = environment.fromCollection(list1);
DataSource<Integer> text2 = environment.fromCollection(list2);
text1.cross(text2).print();
}
}
| UTF-8 | Java | 859 | java | CrossDemo.java | Java | [
{
"context": "2;\n\nimport java.util.ArrayList;\n\n/**\n * Created by Administrator on 2020-12-06.\n * 笛卡尔积\n */\npublic class CrossDemo",
"end": 256,
"score": 0.5278452038764954,
"start": 243,
"tag": "NAME",
"value": "Administrator"
}
] | null | [] | package com.lwq.bigdata.flink.batch;
import org.apache.flink.api.java.ExecutionEnvironment;
import org.apache.flink.api.java.operators.DataSource;
import org.apache.flink.api.java.tuple.Tuple2;
import java.util.ArrayList;
/**
* Created by Administrator on 2020-12-06.
* 笛卡尔积
*/
public class CrossDemo {
public static void main(String[] args) throws Exception {
ExecutionEnvironment environment = ExecutionEnvironment.getExecutionEnvironment();
ArrayList<String> list1 = new ArrayList<>();
list1.add("zs");
list1.add("ls");
ArrayList<Integer> list2 = new ArrayList<>();
list2.add(1);
list2.add(2);
DataSource<String> text1 = environment.fromCollection(list1);
DataSource<Integer> text2 = environment.fromCollection(list2);
text1.cross(text2).print();
}
}
| 859 | 0.687427 | 0.6604 | 29 | 28.344828 | 25.838058 | 90 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.517241 | false | false | 3 |
0208928a2629399974118cf252cd563af2bd0351 | 21,320,217,669,768 | b86355b908d583075d1dada1b8db842909b88f83 | /src/main/java/semaphore/MySemaphore.java | 208921fecf6ca57de9b647014a3684df7c185d9c | [] | no_license | admitrevskiy/MySemaphore | https://github.com/admitrevskiy/MySemaphore | aa939434d6b21a22fba059114af982dc8844fdb3 | 00293ef568ea998abef9852520af154c9c1d24a4 | refs/heads/master | 2021-04-27T08:57:48.607000 | 2018-03-06T00:22:56 | 2018-03-06T00:22:56 | 122,501,420 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package semaphore;
/**
* Created by Leshka on 24.02.18.
*/
public interface MySemaphore {
void acquire() throws InterruptedException;
void release();
boolean tryAcquire();
}
| UTF-8 | Java | 189 | java | MySemaphore.java | Java | [
{
"context": "package semaphore;\n\n/**\n * Created by Leshka on 24.02.18.\n */\npublic interface MySemaphore {\n ",
"end": 44,
"score": 0.9748806953430176,
"start": 38,
"tag": "NAME",
"value": "Leshka"
}
] | null | [] | package semaphore;
/**
* Created by Leshka on 24.02.18.
*/
public interface MySemaphore {
void acquire() throws InterruptedException;
void release();
boolean tryAcquire();
}
| 189 | 0.687831 | 0.656085 | 10 | 17.9 | 15.241063 | 47 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false | 3 |
34396e883a8e15bcd7dd7c4cf19c1f932e1a7fb9 | 13,176,959,717,513 | cb601c9b503d43d5dea2c54e777ecd115222a16a | /src/org/pepstock/charba/client/colors/ColorBuilder.java | d5ed2a0afa7caa3cccb1f708bf3e9d46bbdfe097 | [
"LicenseRef-scancode-free-unknown",
"Apache-2.0",
"MIT"
] | permissive | pepstock-org/Charba | https://github.com/pepstock-org/Charba | cdd98c47081cb3cf52a939c8c3489a80fa9451fd | 32e1807325b646918f595b3043e4990dccb112b4 | refs/heads/master | 2023-09-01T11:43:20.143000 | 2023-08-28T19:49:14 | 2023-08-28T19:49:14 | 106,569,586 | 55 | 7 | Apache-2.0 | false | 2023-08-28T19:37:21 | 2017-10-11T15:03:37 | 2023-08-25T11:09:42 | 2023-08-28T19:37:20 | 671,282 | 57 | 6 | 1 | Java | false | false | /**
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
package org.pepstock.charba.client.colors;
import java.util.LinkedList;
import java.util.List;
import org.pepstock.charba.client.commons.Checker;
import org.pepstock.charba.client.utils.RegExp;
import org.pepstock.charba.client.utils.RegExpResult;
/**
* Utility to create colors by red, green and blue values, HEX value and RGB and RGBA strings.<br>
* It checks if the requested color is already defined in HTML colors.
*
* @author Andrea "Stock" Stocchero
*
* @see HtmlColor
* @see GwtMaterialColor
*/
public final class ColorBuilder {
// REGEXP pattern for RGB
private static final String REGEXP_RGB_PATTERN = "rgb\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*\\)";
// REGEXP pattern for RGBA
private static final String REGEXP_RGBA_PATTERN = "rgba\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(\\d*\\.?\\d*)\\s*\\)";
// REGEXP pattern for HSL
private static final String REGEXP_HSL_PATTERN = "hsl\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})%\\s*,\\s*(\\d{1,3})%\\s*\\)";
// REGEXP pattern for HSLA
private static final String REGEXP_HSLA_PATTERN = "hsla\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})%\\s*,\\s*(\\d{1,3})%\\s*,\\s*(\\d*\\.?\\d*)\\s*\\)";
// REGEXP for RGB
private static final RegExp REGEXP_RGB = new RegExp(REGEXP_RGB_PATTERN);
// REGEXP for RGBA
private static final RegExp REGEXP_RGBA = new RegExp(REGEXP_RGBA_PATTERN);
// REGEXP for HSL
private static final RegExp REGEXP_HSL = new RegExp(REGEXP_HSL_PATTERN);
// REGEXP for HSLA
private static final RegExp REGEXP_HSLA = new RegExp(REGEXP_HSLA_PATTERN);
/**
* To avoid any instantiation
*/
private ColorBuilder() {
// nothing
}
/**
* Builds a list of colors starting from a list of strings which represent colors.
*
* @param colorsAsString list of strings which represent colors
* @return a list of colors
*/
public static List<IsColor> parse(List<String> colorsAsString) {
// creates result
final List<IsColor> colors = new LinkedList<>();
// checks if argument is consistent
if (colorsAsString != null) {
// scans all colors as strings
for (String colorAsString : colorsAsString) {
// parses and add colors
colors.add(parse(colorAsString));
}
}
return colors;
}
/**
* Creates a color using red, green and blue channels.
*
* @param r red channel
* @param g green channel
* @param b blue channel
* @return a color instance
*/
public static IsColor build(int r, int g, int b) {
// checks if already exists the required color
// in the HTML color enumeration
for (HtmlColor color : HtmlColor.values()) {
// if equals returns the enum item
if (color.getRed() == r && color.getGreen() == g && color.getBlue() == b) {
return color;
}
}
// checks if already exists the required color
// in the GWT material color enumeration
for (GwtMaterialColor color : GwtMaterialColor.values()) {
// if equals returns the enum item
if (color.getRed() == r && color.getGreen() == g && color.getBlue() == b) {
return color;
}
}
// checks if already exists the required color
// in the Google chart color enumeration
for (GoogleChartColor color : GoogleChartColor.values()) {
// if equals returns the enum item
if (color.getRed() == r && color.getGreen() == g && color.getBlue() == b) {
return color;
}
}
// if here, the required color doesn't exist
// creates new color
return new Color(r, g, b);
}
/**
* Returns a color parsing the string value passed as argument.<br>
* It's able to parse HEX, RGB, RGBA and named color representation.
*
* @param value value to parse
* @return color instance
*/
public static IsColor parse(String value) {
// checks if the value is consistent
Checker.checkIfValid(value, "Color argument");
// removes blanks to be able to check
// if starting with a specific label
String newValue = value.trim();
// checks which type of color is passed
if (newValue.startsWith(ColorUtil.HEX_STARTING_CHAR)) {
// is a HEX
return buildByHexValue(newValue);
} else if (value.startsWith(ColorUtil.RGBA_STARTING_CHARS)) {
// is a RGBA. It must be checked before RGB
return buildByRGBAValue(newValue);
} else if (value.startsWith(ColorUtil.RGB_STARTING_CHARS)) {
// is a RGB
return buildByRGBValue(newValue);
} else if (value.startsWith(ColorUtil.HSLA_STARTING_CHARS)) {
// is a HSLA. It must be checked before HSL
return buildByHSLAValue(newValue);
} else if (value.startsWith(ColorUtil.HSL_STARTING_CHARS)) {
// is a HSL
return buildByHSLValue(newValue);
} else {
// search by color name
for (HtmlColor color : HtmlColor.values()) {
if (color.getHtmlColorName().equalsIgnoreCase(newValue)) {
return color;
}
}
// if here, the string argument is not valid
throw new IllegalArgumentException("Invalid format for a color: " + value);
}
}
/**
* Creates a color by red, green, blue and alpha
*
* @param r red value
* @param g green value
* @param b blue value
* @param alpha alpha value
* @return color instance
*/
private static IsColor build(int r, int g, int b, double alpha) {
// checks if already exists the required color
// in the enum HTML color with alpha
for (HtmlColor color : HtmlColor.values()) {
if (color.getRed() == r && color.getGreen() == g && color.getBlue() == b) {
return color.alpha(alpha);
}
}
for (GwtMaterialColor color : GwtMaterialColor.values()) {
// if equals returns the enum item
if (color.getRed() == r && color.getGreen() == g && color.getBlue() == b) {
return color.alpha(alpha);
}
}
// creates a new color
return new Color(r, g, b, alpha);
}
/**
* Parses HEX value translating in the a color. HEX format: <code>#rrggbb</code>.
*
* @param hexvalue hex color.
* @return color instance
*/
static IsColor buildByHexValue(String hexvalue) {
return buildByHexValue(hexvalue, true);
}
/**
* Parses HEX value translating in the a color. HEX format: <code>#rrggbb</code>.
*
* @param hexvalue hex color.
* @param searchOnEnum if <code>true</code> scans the html and GWT material color
* @return color instance
*/
static IsColor buildByHexValue(String hexvalue, boolean searchOnEnum) {
// removes the pound
String newHexvalue = hexvalue.substring(1);
// checks if the HEX value is the short one
if (newHexvalue.length() == 3) {
// reads colors
String redValue = newHexvalue.substring(0, 1) + newHexvalue.substring(0, 1);
int red = Integer.parseInt(redValue, 16);
String greenValue = newHexvalue.substring(1, 2) + newHexvalue.substring(1, 2);
int green = Integer.parseInt(greenValue, 16);
String blueValue = newHexvalue.substring(2) + newHexvalue.substring(2);
int blue = Integer.parseInt(blueValue, 16);
// builds color
return build(red, green, blue);
} else if (newHexvalue.length() == 6) {
// checks if the HEX value
// reads colors
String redValue = newHexvalue.substring(0, 2);
int red = Integer.parseInt(redValue, 16);
String greenValue = newHexvalue.substring(2, 4);
int green = Integer.parseInt(greenValue, 16);
String blueValue = newHexvalue.substring(4);
int blue = Integer.parseInt(blueValue, 16);
// builds color
return searchOnEnum ? build(red, green, blue) : new Color(red, green, blue, Color.DEFAULT_ALPHA);
} else {
// if here the hex value is not valid
throw new IllegalArgumentException("Color length in HEX format is not valid. Must have a length of 3 or 6 charactes");
}
}
/**
* Parses RGB value translating in the a color. RGB format: <code>rgb(r, g, b)</code>
*
* @param rgbvalue rgb value
* @return color instance
*/
private static IsColor buildByRGBValue(String rgbvalue) {
// executes regular expression
RegExpResult matcher = REGEXP_RGB.exec(rgbvalue);
// checks if matcher instance is consistent
Checker.checkIfValid(matcher, "Invalid RGB format for color: " + rgbvalue);
// checks if matcher is consistent
Checker.checkIfEqualTo(matcher.length(), 4, "Invalid RGB format for color: " + rgbvalue);
// initializes integers values
int red = 0;
int green = 0;
int blue = 0;
// scans all token. Starts by 1
for (int i = 1; i < matcher.length(); i++) {
String groupStr = matcher.get(i);
switch (i) {
case 1:
red = Integer.parseInt(groupStr);
break;
case 2:
green = Integer.parseInt(groupStr);
break;
case 3:
blue = Integer.parseInt(groupStr);
break;
default:
break;
}
}
// builds color
return build(red, green, blue);
}
/**
* Parses RGBA value translating in the a color. RGB format: <code>rgba(r, g, b, a)</code>
*
* @param rgbavalue rgba value
* @return color instance
*/
private static IsColor buildByRGBAValue(String rgbavalue) {
// executes regular expression
RegExpResult matcher = REGEXP_RGBA.exec(rgbavalue);
// checks if matcher instance is consistent
Checker.checkIfValid(matcher, "Invalid RGBA format for color: " + rgbavalue);
// checks if matcher is consistent
Checker.checkIfEqualTo(matcher.length(), 5, "Invalid RGBA format for color: " + rgbavalue);
// initializes integers values
int red = 0;
int green = 0;
int blue = 0;
double alpha = Color.DEFAULT_ALPHA;
// scans all token. Starts by 1
for (int i = 1; i < matcher.length(); i++) {
String groupStr = matcher.get(i);
switch (i) {
case 1:
red = Integer.parseInt(groupStr);
break;
case 2:
green = Integer.parseInt(groupStr);
break;
case 3:
blue = Integer.parseInt(groupStr);
break;
case 4:
alpha = Double.parseDouble(groupStr);
break;
default:
break;
}
}
// builds color
return build(red, green, blue, alpha);
}
/**
* Parses HSL value translating in the a color. HSL format: <code>hsl(h, s, l)</code>
*
* @param hslvalue hsl value
* @return color instance
*/
private static IsColor buildByHSLValue(String hslvalue) {
// executes regular expression
RegExpResult matcher = REGEXP_HSL.exec(hslvalue);
// checks if matcher instance is consistent
Checker.checkIfValid(matcher, "Invalid HSL format for color: " + hslvalue);
// checks if matcher is consistent
Checker.checkIfEqualTo(matcher.length(), 4, "Invalid HSL format for color: " + hslvalue);
// initializes integers values
int hue = 0;
int saturation = 0;
int lightness = 0;
// scans all token. Starts by 1
for (int i = 1; i < matcher.length(); i++) {
String groupStr = matcher.get(i);
switch (i) {
case 1:
hue = Integer.parseInt(groupStr);
break;
case 2:
saturation = Integer.parseInt(groupStr);
break;
case 3:
lightness = Integer.parseInt(groupStr);
break;
default:
break;
}
}
// builds color
return convertHSL2RGB(hue, saturation, lightness, Double.NaN);
}
/**
* Parses HSL value translating in the a color. HSL format: <code>hsla(h, s, l, a)</code>
*
* @param hslavalue hsla value
* @return color instance
*/
private static IsColor buildByHSLAValue(String hslavalue) {
// executes regular expression
RegExpResult matcher = REGEXP_HSLA.exec(hslavalue);
// checks if matcher instance is consistent
Checker.checkIfValid(matcher, "Invalid HSLA format for color: " + hslavalue);
// checks if matcher is consistent
Checker.checkIfEqualTo(matcher.length(), 5, "HSLA HSL format for color: " + hslavalue);
// initializes integers values
int hue = 0;
int saturation = 0;
int lightness = 0;
double alpha = Color.DEFAULT_ALPHA;
// scans all token. Starts by 1
for (int i = 1; i < matcher.length(); i++) {
String groupStr = matcher.get(i);
switch (i) {
case 1:
hue = Integer.parseInt(groupStr);
break;
case 2:
saturation = Integer.parseInt(groupStr);
break;
case 3:
lightness = Integer.parseInt(groupStr);
break;
case 4:
alpha = Double.parseDouble(groupStr);
break;
default:
break;
}
}
// builds color
return convertHSL2RGB(hue, saturation, lightness, alpha);
}
/**
* Convert HSL(A) values to a RGB(A) Color.<br>
* See explanation <a href="http://www.niwa.nu/2013/05/math-behind-colorspace-conversions-rgb-hsl/">Math behind colorspace conversions, RGB-HSL</a>.
*
* @param hue hue is a degree on the color wheel from 0 to 360. 0 is red, 120 is green, 240 is blue.
* @param saturation saturation is a percentage value; 0% means a shade of gray and 100% is the full color.
* @param lightness lightness is a percentage; 0% is black, 100% is white.
* @param alpha the alpha
* @return the RGB/RGBA Color object
*/
private static IsColor convertHSL2RGB(int hue, int saturation, int lightness, double alpha) {
// checks if hue is in range
Checker.checkIfBetween(hue, 0, 260, "Hue argument");
// saturation if saturation is in range
Checker.checkIfBetween(saturation, 0, 100, "Saturation argument");
// lightness if saturation is in range
Checker.checkIfBetween(lightness, 0, 100, "Lightness argument");
// transforms all values in the values between 0 and 1
// with maximum value of range
double transientHue = hue % 360D;
transientHue /= 360D;
double transientSaturation = saturation / 100D;
double transientLightness = lightness / 100D;
// we need to create some temporary variables
// the variables are used to store temporary values which makes the formulas easier to read
double temporary1;
// There are two formulas to choose from in the first step.
// if Lightness is smaller then 0.5 (50%) then temporary1 = Lightness x (1.0 + Saturation)
// If Lightness is equal or larger then 0.5 (50%) then temporary1 = Lightness + Saturation - Lightness x Saturation
if (transientLightness < 0.5D) {
temporary1 = transientLightness * (1 + transientSaturation);
} else {
temporary1 = (transientLightness + transientSaturation) - (transientSaturation * transientLightness);
}
// we need one more temporary variable, temporary2
double temporary2 = 2 * transientLightness - temporary1;
// // And now we need another temporary variable for each color channel, temporary_R, temporary_G and temporary_B.
// calculate RED, GREEN and BLUE as Double
double temporaryRed = Math.max(0, hueToRGB(temporary2, temporary1, transientHue + (1D / 3D)));
double temporaryGreen = Math.max(0, hueToRGB(temporary2, temporary1, transientHue));
double temporaryBlue = Math.max(0, hueToRGB(temporary2, temporary1, transientHue - (1D / 3D)));
// calculate RED, GREEN and BLUE as Integer
int red = (int) Math.round(Math.min(temporaryRed, 1) * 255F);
int green = (int) Math.round(Math.min(temporaryGreen, 1) * 255);
int blue = (int) Math.round(Math.min(temporaryBlue, 1) * 255);
// checks if alpha is NaN
// builds the RGB color without alpha
// otherwise with alpha
return Checker.isBetween(alpha, 0D, 1D) ? build(red, green, blue, alpha) : build(red, green, blue);
}
/**
* Transforms Hue value in the a color value for RGB
*
* @param temporary2 lightness and saturation temporary variable
* @param temporary1 lightness and saturation temporary variable
* @param temporaryChannelValue temporary channel value
* @return the channel color value to use for RGB color
*/
private static double hueToRGB(double temporary2, double temporary1, double temporaryChannelValue) {
// all values need to be between 0 and 1.
// if you get a negative value you need to add 1 to it.
// if you get a value above 1 you need to subtract 1 from it.
if (temporaryChannelValue < 0) {
temporaryChannelValue += 1;
}
if (temporaryChannelValue > 1) {
temporaryChannelValue -= 1;
}
// now we need to do up to 3 tests to select the correct formula for each color channel.
// test 1 - If 6 x CHANNEL temporary color is smaller then 1, CHANNEL temporary color = temporary_2 + (temporary_1 -
// temporary_2) x 6 x CHANNEL temporary color
if (6 * temporaryChannelValue < 1) {
return temporary2 + ((temporary1 - temporary2) * 6 * temporaryChannelValue);
}
// test 2 - If 2 x CHANNEL temporary color is smaller then 1, CHANNEL temporary color = temporary_1
if (2 * temporaryChannelValue < 1) {
return temporary1;
}
// test 3 - If 3 x CHANNEL temporary color is smaller then 2, CHANNEL temporary color = temporary_2 + (temporary_1 -
// temporary_2) x (0.666 - CHANNEL temporary color) x 6
if (3 * temporaryChannelValue < 2) {
return temporary2 + ((temporary1 - temporary2) * 6 * ((2.0D / 3.0D) - temporaryChannelValue));
}
return temporary2;
}
} | UTF-8 | Java | 17,343 | java | ColorBuilder.java | Java | [
{
"context": " is already defined in HTML colors.\n * \n * @author Andrea \"Stock\" Stocchero\n *\n * @see HtmlColor\n * @see Gw",
"end": 1272,
"score": 0.9996002912521362,
"start": 1266,
"tag": "NAME",
"value": "Andrea"
},
{
"context": "dy defined in HTML colors.\n * \n * @author An... | null | [] | /**
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
package org.pepstock.charba.client.colors;
import java.util.LinkedList;
import java.util.List;
import org.pepstock.charba.client.commons.Checker;
import org.pepstock.charba.client.utils.RegExp;
import org.pepstock.charba.client.utils.RegExpResult;
/**
* Utility to create colors by red, green and blue values, HEX value and RGB and RGBA strings.<br>
* It checks if the requested color is already defined in HTML colors.
*
* @author Andrea "Stock" Stocchero
*
* @see HtmlColor
* @see GwtMaterialColor
*/
public final class ColorBuilder {
// REGEXP pattern for RGB
private static final String REGEXP_RGB_PATTERN = "rgb\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*\\)";
// REGEXP pattern for RGBA
private static final String REGEXP_RGBA_PATTERN = "rgba\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(\\d*\\.?\\d*)\\s*\\)";
// REGEXP pattern for HSL
private static final String REGEXP_HSL_PATTERN = "hsl\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})%\\s*,\\s*(\\d{1,3})%\\s*\\)";
// REGEXP pattern for HSLA
private static final String REGEXP_HSLA_PATTERN = "hsla\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})%\\s*,\\s*(\\d{1,3})%\\s*,\\s*(\\d*\\.?\\d*)\\s*\\)";
// REGEXP for RGB
private static final RegExp REGEXP_RGB = new RegExp(REGEXP_RGB_PATTERN);
// REGEXP for RGBA
private static final RegExp REGEXP_RGBA = new RegExp(REGEXP_RGBA_PATTERN);
// REGEXP for HSL
private static final RegExp REGEXP_HSL = new RegExp(REGEXP_HSL_PATTERN);
// REGEXP for HSLA
private static final RegExp REGEXP_HSLA = new RegExp(REGEXP_HSLA_PATTERN);
/**
* To avoid any instantiation
*/
private ColorBuilder() {
// nothing
}
/**
* Builds a list of colors starting from a list of strings which represent colors.
*
* @param colorsAsString list of strings which represent colors
* @return a list of colors
*/
public static List<IsColor> parse(List<String> colorsAsString) {
// creates result
final List<IsColor> colors = new LinkedList<>();
// checks if argument is consistent
if (colorsAsString != null) {
// scans all colors as strings
for (String colorAsString : colorsAsString) {
// parses and add colors
colors.add(parse(colorAsString));
}
}
return colors;
}
/**
* Creates a color using red, green and blue channels.
*
* @param r red channel
* @param g green channel
* @param b blue channel
* @return a color instance
*/
public static IsColor build(int r, int g, int b) {
// checks if already exists the required color
// in the HTML color enumeration
for (HtmlColor color : HtmlColor.values()) {
// if equals returns the enum item
if (color.getRed() == r && color.getGreen() == g && color.getBlue() == b) {
return color;
}
}
// checks if already exists the required color
// in the GWT material color enumeration
for (GwtMaterialColor color : GwtMaterialColor.values()) {
// if equals returns the enum item
if (color.getRed() == r && color.getGreen() == g && color.getBlue() == b) {
return color;
}
}
// checks if already exists the required color
// in the Google chart color enumeration
for (GoogleChartColor color : GoogleChartColor.values()) {
// if equals returns the enum item
if (color.getRed() == r && color.getGreen() == g && color.getBlue() == b) {
return color;
}
}
// if here, the required color doesn't exist
// creates new color
return new Color(r, g, b);
}
/**
* Returns a color parsing the string value passed as argument.<br>
* It's able to parse HEX, RGB, RGBA and named color representation.
*
* @param value value to parse
* @return color instance
*/
public static IsColor parse(String value) {
// checks if the value is consistent
Checker.checkIfValid(value, "Color argument");
// removes blanks to be able to check
// if starting with a specific label
String newValue = value.trim();
// checks which type of color is passed
if (newValue.startsWith(ColorUtil.HEX_STARTING_CHAR)) {
// is a HEX
return buildByHexValue(newValue);
} else if (value.startsWith(ColorUtil.RGBA_STARTING_CHARS)) {
// is a RGBA. It must be checked before RGB
return buildByRGBAValue(newValue);
} else if (value.startsWith(ColorUtil.RGB_STARTING_CHARS)) {
// is a RGB
return buildByRGBValue(newValue);
} else if (value.startsWith(ColorUtil.HSLA_STARTING_CHARS)) {
// is a HSLA. It must be checked before HSL
return buildByHSLAValue(newValue);
} else if (value.startsWith(ColorUtil.HSL_STARTING_CHARS)) {
// is a HSL
return buildByHSLValue(newValue);
} else {
// search by color name
for (HtmlColor color : HtmlColor.values()) {
if (color.getHtmlColorName().equalsIgnoreCase(newValue)) {
return color;
}
}
// if here, the string argument is not valid
throw new IllegalArgumentException("Invalid format for a color: " + value);
}
}
/**
* Creates a color by red, green, blue and alpha
*
* @param r red value
* @param g green value
* @param b blue value
* @param alpha alpha value
* @return color instance
*/
private static IsColor build(int r, int g, int b, double alpha) {
// checks if already exists the required color
// in the enum HTML color with alpha
for (HtmlColor color : HtmlColor.values()) {
if (color.getRed() == r && color.getGreen() == g && color.getBlue() == b) {
return color.alpha(alpha);
}
}
for (GwtMaterialColor color : GwtMaterialColor.values()) {
// if equals returns the enum item
if (color.getRed() == r && color.getGreen() == g && color.getBlue() == b) {
return color.alpha(alpha);
}
}
// creates a new color
return new Color(r, g, b, alpha);
}
/**
* Parses HEX value translating in the a color. HEX format: <code>#rrggbb</code>.
*
* @param hexvalue hex color.
* @return color instance
*/
static IsColor buildByHexValue(String hexvalue) {
return buildByHexValue(hexvalue, true);
}
/**
* Parses HEX value translating in the a color. HEX format: <code>#rrggbb</code>.
*
* @param hexvalue hex color.
* @param searchOnEnum if <code>true</code> scans the html and GWT material color
* @return color instance
*/
static IsColor buildByHexValue(String hexvalue, boolean searchOnEnum) {
// removes the pound
String newHexvalue = hexvalue.substring(1);
// checks if the HEX value is the short one
if (newHexvalue.length() == 3) {
// reads colors
String redValue = newHexvalue.substring(0, 1) + newHexvalue.substring(0, 1);
int red = Integer.parseInt(redValue, 16);
String greenValue = newHexvalue.substring(1, 2) + newHexvalue.substring(1, 2);
int green = Integer.parseInt(greenValue, 16);
String blueValue = newHexvalue.substring(2) + newHexvalue.substring(2);
int blue = Integer.parseInt(blueValue, 16);
// builds color
return build(red, green, blue);
} else if (newHexvalue.length() == 6) {
// checks if the HEX value
// reads colors
String redValue = newHexvalue.substring(0, 2);
int red = Integer.parseInt(redValue, 16);
String greenValue = newHexvalue.substring(2, 4);
int green = Integer.parseInt(greenValue, 16);
String blueValue = newHexvalue.substring(4);
int blue = Integer.parseInt(blueValue, 16);
// builds color
return searchOnEnum ? build(red, green, blue) : new Color(red, green, blue, Color.DEFAULT_ALPHA);
} else {
// if here the hex value is not valid
throw new IllegalArgumentException("Color length in HEX format is not valid. Must have a length of 3 or 6 charactes");
}
}
/**
* Parses RGB value translating in the a color. RGB format: <code>rgb(r, g, b)</code>
*
* @param rgbvalue rgb value
* @return color instance
*/
private static IsColor buildByRGBValue(String rgbvalue) {
// executes regular expression
RegExpResult matcher = REGEXP_RGB.exec(rgbvalue);
// checks if matcher instance is consistent
Checker.checkIfValid(matcher, "Invalid RGB format for color: " + rgbvalue);
// checks if matcher is consistent
Checker.checkIfEqualTo(matcher.length(), 4, "Invalid RGB format for color: " + rgbvalue);
// initializes integers values
int red = 0;
int green = 0;
int blue = 0;
// scans all token. Starts by 1
for (int i = 1; i < matcher.length(); i++) {
String groupStr = matcher.get(i);
switch (i) {
case 1:
red = Integer.parseInt(groupStr);
break;
case 2:
green = Integer.parseInt(groupStr);
break;
case 3:
blue = Integer.parseInt(groupStr);
break;
default:
break;
}
}
// builds color
return build(red, green, blue);
}
/**
* Parses RGBA value translating in the a color. RGB format: <code>rgba(r, g, b, a)</code>
*
* @param rgbavalue rgba value
* @return color instance
*/
private static IsColor buildByRGBAValue(String rgbavalue) {
// executes regular expression
RegExpResult matcher = REGEXP_RGBA.exec(rgbavalue);
// checks if matcher instance is consistent
Checker.checkIfValid(matcher, "Invalid RGBA format for color: " + rgbavalue);
// checks if matcher is consistent
Checker.checkIfEqualTo(matcher.length(), 5, "Invalid RGBA format for color: " + rgbavalue);
// initializes integers values
int red = 0;
int green = 0;
int blue = 0;
double alpha = Color.DEFAULT_ALPHA;
// scans all token. Starts by 1
for (int i = 1; i < matcher.length(); i++) {
String groupStr = matcher.get(i);
switch (i) {
case 1:
red = Integer.parseInt(groupStr);
break;
case 2:
green = Integer.parseInt(groupStr);
break;
case 3:
blue = Integer.parseInt(groupStr);
break;
case 4:
alpha = Double.parseDouble(groupStr);
break;
default:
break;
}
}
// builds color
return build(red, green, blue, alpha);
}
/**
* Parses HSL value translating in the a color. HSL format: <code>hsl(h, s, l)</code>
*
* @param hslvalue hsl value
* @return color instance
*/
private static IsColor buildByHSLValue(String hslvalue) {
// executes regular expression
RegExpResult matcher = REGEXP_HSL.exec(hslvalue);
// checks if matcher instance is consistent
Checker.checkIfValid(matcher, "Invalid HSL format for color: " + hslvalue);
// checks if matcher is consistent
Checker.checkIfEqualTo(matcher.length(), 4, "Invalid HSL format for color: " + hslvalue);
// initializes integers values
int hue = 0;
int saturation = 0;
int lightness = 0;
// scans all token. Starts by 1
for (int i = 1; i < matcher.length(); i++) {
String groupStr = matcher.get(i);
switch (i) {
case 1:
hue = Integer.parseInt(groupStr);
break;
case 2:
saturation = Integer.parseInt(groupStr);
break;
case 3:
lightness = Integer.parseInt(groupStr);
break;
default:
break;
}
}
// builds color
return convertHSL2RGB(hue, saturation, lightness, Double.NaN);
}
/**
* Parses HSL value translating in the a color. HSL format: <code>hsla(h, s, l, a)</code>
*
* @param hslavalue hsla value
* @return color instance
*/
private static IsColor buildByHSLAValue(String hslavalue) {
// executes regular expression
RegExpResult matcher = REGEXP_HSLA.exec(hslavalue);
// checks if matcher instance is consistent
Checker.checkIfValid(matcher, "Invalid HSLA format for color: " + hslavalue);
// checks if matcher is consistent
Checker.checkIfEqualTo(matcher.length(), 5, "HSLA HSL format for color: " + hslavalue);
// initializes integers values
int hue = 0;
int saturation = 0;
int lightness = 0;
double alpha = Color.DEFAULT_ALPHA;
// scans all token. Starts by 1
for (int i = 1; i < matcher.length(); i++) {
String groupStr = matcher.get(i);
switch (i) {
case 1:
hue = Integer.parseInt(groupStr);
break;
case 2:
saturation = Integer.parseInt(groupStr);
break;
case 3:
lightness = Integer.parseInt(groupStr);
break;
case 4:
alpha = Double.parseDouble(groupStr);
break;
default:
break;
}
}
// builds color
return convertHSL2RGB(hue, saturation, lightness, alpha);
}
/**
* Convert HSL(A) values to a RGB(A) Color.<br>
* See explanation <a href="http://www.niwa.nu/2013/05/math-behind-colorspace-conversions-rgb-hsl/">Math behind colorspace conversions, RGB-HSL</a>.
*
* @param hue hue is a degree on the color wheel from 0 to 360. 0 is red, 120 is green, 240 is blue.
* @param saturation saturation is a percentage value; 0% means a shade of gray and 100% is the full color.
* @param lightness lightness is a percentage; 0% is black, 100% is white.
* @param alpha the alpha
* @return the RGB/RGBA Color object
*/
private static IsColor convertHSL2RGB(int hue, int saturation, int lightness, double alpha) {
// checks if hue is in range
Checker.checkIfBetween(hue, 0, 260, "Hue argument");
// saturation if saturation is in range
Checker.checkIfBetween(saturation, 0, 100, "Saturation argument");
// lightness if saturation is in range
Checker.checkIfBetween(lightness, 0, 100, "Lightness argument");
// transforms all values in the values between 0 and 1
// with maximum value of range
double transientHue = hue % 360D;
transientHue /= 360D;
double transientSaturation = saturation / 100D;
double transientLightness = lightness / 100D;
// we need to create some temporary variables
// the variables are used to store temporary values which makes the formulas easier to read
double temporary1;
// There are two formulas to choose from in the first step.
// if Lightness is smaller then 0.5 (50%) then temporary1 = Lightness x (1.0 + Saturation)
// If Lightness is equal or larger then 0.5 (50%) then temporary1 = Lightness + Saturation - Lightness x Saturation
if (transientLightness < 0.5D) {
temporary1 = transientLightness * (1 + transientSaturation);
} else {
temporary1 = (transientLightness + transientSaturation) - (transientSaturation * transientLightness);
}
// we need one more temporary variable, temporary2
double temporary2 = 2 * transientLightness - temporary1;
// // And now we need another temporary variable for each color channel, temporary_R, temporary_G and temporary_B.
// calculate RED, GREEN and BLUE as Double
double temporaryRed = Math.max(0, hueToRGB(temporary2, temporary1, transientHue + (1D / 3D)));
double temporaryGreen = Math.max(0, hueToRGB(temporary2, temporary1, transientHue));
double temporaryBlue = Math.max(0, hueToRGB(temporary2, temporary1, transientHue - (1D / 3D)));
// calculate RED, GREEN and BLUE as Integer
int red = (int) Math.round(Math.min(temporaryRed, 1) * 255F);
int green = (int) Math.round(Math.min(temporaryGreen, 1) * 255);
int blue = (int) Math.round(Math.min(temporaryBlue, 1) * 255);
// checks if alpha is NaN
// builds the RGB color without alpha
// otherwise with alpha
return Checker.isBetween(alpha, 0D, 1D) ? build(red, green, blue, alpha) : build(red, green, blue);
}
/**
* Transforms Hue value in the a color value for RGB
*
* @param temporary2 lightness and saturation temporary variable
* @param temporary1 lightness and saturation temporary variable
* @param temporaryChannelValue temporary channel value
* @return the channel color value to use for RGB color
*/
private static double hueToRGB(double temporary2, double temporary1, double temporaryChannelValue) {
// all values need to be between 0 and 1.
// if you get a negative value you need to add 1 to it.
// if you get a value above 1 you need to subtract 1 from it.
if (temporaryChannelValue < 0) {
temporaryChannelValue += 1;
}
if (temporaryChannelValue > 1) {
temporaryChannelValue -= 1;
}
// now we need to do up to 3 tests to select the correct formula for each color channel.
// test 1 - If 6 x CHANNEL temporary color is smaller then 1, CHANNEL temporary color = temporary_2 + (temporary_1 -
// temporary_2) x 6 x CHANNEL temporary color
if (6 * temporaryChannelValue < 1) {
return temporary2 + ((temporary1 - temporary2) * 6 * temporaryChannelValue);
}
// test 2 - If 2 x CHANNEL temporary color is smaller then 1, CHANNEL temporary color = temporary_1
if (2 * temporaryChannelValue < 1) {
return temporary1;
}
// test 3 - If 3 x CHANNEL temporary color is smaller then 2, CHANNEL temporary color = temporary_2 + (temporary_1 -
// temporary_2) x (0.666 - CHANNEL temporary color) x 6
if (3 * temporaryChannelValue < 2) {
return temporary2 + ((temporary1 - temporary2) * 6 * ((2.0D / 3.0D) - temporaryChannelValue));
}
return temporary2;
}
} | 17,343 | 0.683215 | 0.668396 | 484 | 34.834709 | 29.326347 | 149 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.485537 | false | false | 3 |
a179be7d1823046f72bec0baa5759cc9d0b8d812 | 13,142,599,974,706 | 83a53213993da356c90a4b84bbf47e2dc4486ec4 | /InsertionSortList.java | 21e82a74e9e5ea9360adaf220a640b49c998eb61 | [] | no_license | NoSui/leetcode-java | https://github.com/NoSui/leetcode-java | e3fa2fb4aa297b70e28359f8a4fec11a7ad8b16b | 4b81185baead721486092517f758e88eb1f3d570 | refs/heads/master | 2021-01-11T22:02:50.790000 | 2017-01-14T13:20:44 | 2017-01-14T13:20:44 | 78,905,554 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* Sort a linked list using insertion sort.
*/
/**
* Definition for singly-linked list.
* public class ListNode {
* int val;
* ListNode next;
* ListNode(int x) {
* val = x;
* next = null;
* }
* }
*/
public class InsertionSortList {
public ListNode insertionSortList(ListNode head) {
if(head == null || head.next == null)
return head;
ListNode minNode = head, minPrev = head, minNext = head, cur = head, curPrev = head;
while(cur != null) {
if(cur.val < minNode.val) {
minNode = cur;
minPrev = curPrev;
minNext = cur.next;
}
curPrev = cur;
cur = cur.next;
}
if(minNode == head)
head = head.next;
else
minPrev.next = minNext;
minNode.next = insertionSortList(head);
return minNode;
}
public ListNode insertionSortList(ListNode head) {
if(head == null || head.next == null)
return head;
ListNode p = head.next, pStart = new ListNode(0), pEnd = head;
pStart.next = head;
while(p != null) {
ListNode temp = pStart.next, prev = pStart;
while(temp != p && p.val >= temp.val) {
temp = temp.next;
prev = prev.next;
}
if(temp == p)
pEnd = p;
else {
pEnd.next = p.next;
p.next = temp;
prev.next = p;
}
p = pEnd.next;
}
head = pStart.next;
return head;
}
/**************************TLE, to be recorected!****************************/
public ListNode insertionSortList(ListNode head) {
if(head == null || head.next == null)
return head;
ListNode res = new ListNode(0), cur = head.next;
res.next = head;
ListNode resEnd = res.next;
while(cur != null) {
ListNode cur1 = res, cur2 = res.next;
while(cur2 != cur && cur2.val < cur.val) {
cur1 = cur1.next;
cur2 = cur2.next;
}
if(cur2 != cur) {
ListNode temp = cur;
cur1.next = temp;
temp.next = cur2;
resEnd.next = cur.next;
} else {
resEnd = resEnd.next;
}
cur = cur.next;
}
return res.next;
}
}
| UTF-8 | Java | 2,517 | java | InsertionSortList.java | Java | [] | null | [] | /*
* Sort a linked list using insertion sort.
*/
/**
* Definition for singly-linked list.
* public class ListNode {
* int val;
* ListNode next;
* ListNode(int x) {
* val = x;
* next = null;
* }
* }
*/
public class InsertionSortList {
public ListNode insertionSortList(ListNode head) {
if(head == null || head.next == null)
return head;
ListNode minNode = head, minPrev = head, minNext = head, cur = head, curPrev = head;
while(cur != null) {
if(cur.val < minNode.val) {
minNode = cur;
minPrev = curPrev;
minNext = cur.next;
}
curPrev = cur;
cur = cur.next;
}
if(minNode == head)
head = head.next;
else
minPrev.next = minNext;
minNode.next = insertionSortList(head);
return minNode;
}
public ListNode insertionSortList(ListNode head) {
if(head == null || head.next == null)
return head;
ListNode p = head.next, pStart = new ListNode(0), pEnd = head;
pStart.next = head;
while(p != null) {
ListNode temp = pStart.next, prev = pStart;
while(temp != p && p.val >= temp.val) {
temp = temp.next;
prev = prev.next;
}
if(temp == p)
pEnd = p;
else {
pEnd.next = p.next;
p.next = temp;
prev.next = p;
}
p = pEnd.next;
}
head = pStart.next;
return head;
}
/**************************TLE, to be recorected!****************************/
public ListNode insertionSortList(ListNode head) {
if(head == null || head.next == null)
return head;
ListNode res = new ListNode(0), cur = head.next;
res.next = head;
ListNode resEnd = res.next;
while(cur != null) {
ListNode cur1 = res, cur2 = res.next;
while(cur2 != cur && cur2.val < cur.val) {
cur1 = cur1.next;
cur2 = cur2.next;
}
if(cur2 != cur) {
ListNode temp = cur;
cur1.next = temp;
temp.next = cur2;
resEnd.next = cur.next;
} else {
resEnd = resEnd.next;
}
cur = cur.next;
}
return res.next;
}
}
| 2,517 | 0.443782 | 0.438617 | 88 | 27.602272 | 17.788876 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.659091 | false | false | 3 |
2cccd04537f0335f53cbe6fcb00358a54ae860df | 38,920,993,652,230 | 0a679d6ba96a9850c194d5311198b64fb969629f | /conference-backend/src/main/java/com/prodyna/pac/conference/frontend/repository/OrganizationRepository.java | a1be95392cae117c0b814c1ee97136885da113a5 | [] | no_license | dkrizic/conference | https://github.com/dkrizic/conference | fc03bd7480275266b7160d873d64d0282f0b0631 | 4d5c4623dde896417f0868885989b2b45bdc7e2e | refs/heads/development | 2021-06-14T14:59:39.561000 | 2021-05-23T22:58:19 | 2021-05-23T22:58:19 | 194,661,296 | 6 | 4 | null | false | 2021-05-23T22:58:20 | 2019-07-01T11:38:39 | 2020-04-03T16:19:09 | 2021-05-23T22:58:19 | 9,271 | 6 | 2 | 0 | Java | false | false | package com.prodyna.pac.conference.frontend.repository;
import com.prodyna.pac.conference.frontend.entity.Organization;
import com.prodyna.pac.conference.frontend.entity.Person;
import io.micrometer.core.annotation.Timed;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.neo4j.annotation.Query;
import org.springframework.data.neo4j.repository.Neo4jRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import org.springframework.data.rest.core.annotation.RestResource;
import org.springframework.stereotype.Repository;
@Repository
@RepositoryRestResource(path="/organizations")
@Timed
public interface OrganizationRepository extends Neo4jRepository<Organization,Long> {
// using default
@RestResource(exported = true)
@Query("match (o:Organization {id:{id}}) return o")
Person findByOwnId( @Param("id") String id );
@RestResource
Page<Organization> findAll(Pageable p );
}
| UTF-8 | Java | 1,072 | java | OrganizationRepository.java | Java | [] | null | [] | package com.prodyna.pac.conference.frontend.repository;
import com.prodyna.pac.conference.frontend.entity.Organization;
import com.prodyna.pac.conference.frontend.entity.Person;
import io.micrometer.core.annotation.Timed;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.neo4j.annotation.Query;
import org.springframework.data.neo4j.repository.Neo4jRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import org.springframework.data.rest.core.annotation.RestResource;
import org.springframework.stereotype.Repository;
@Repository
@RepositoryRestResource(path="/organizations")
@Timed
public interface OrganizationRepository extends Neo4jRepository<Organization,Long> {
// using default
@RestResource(exported = true)
@Query("match (o:Organization {id:{id}}) return o")
Person findByOwnId( @Param("id") String id );
@RestResource
Page<Organization> findAll(Pageable p );
}
| 1,072 | 0.809702 | 0.80597 | 29 | 35.965519 | 26.36937 | 84 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.517241 | false | false | 3 |
5c88578be4efa2c29f07d29c699d16121215b1cb | 37,014,028,190,128 | 13c2d3db2d49c40c74c2e6420a9cd89377f1c934 | /program_data/JavaProgramData/39/1482.java | aea67ed27788a1c6725e6481d28ff39a34ac0abc | [
"MIT"
] | permissive | qiuchili/ggnn_graph_classification | https://github.com/qiuchili/ggnn_graph_classification | c2090fefe11f8bf650e734442eb96996a54dc112 | 291ff02404555511b94a4f477c6974ebd62dcf44 | refs/heads/master | 2021-10-18T14:54:26.154000 | 2018-10-21T23:34:14 | 2018-10-21T23:34:14 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | public class student
{
public String name = new String(new char[100]);
public int n1;
public int n2;
public char a;
public char b;
public int n3;
}
package <missing>;
public class GlobalMembers
{
public static void Main()
{
int N;
int i;
int j;
int[][] s = new int[101][6];
int max;
int k = 0;
int sum = 0;
String tempVar = ConsoleInput.scanfRead();
if (tempVar != null)
{
N = Integer.parseInt(tempVar);
}
student[] stu = tangible.Arrays.initializeWithDefaultstudentInstances(101);
//C++ TO JAVA CONVERTER TODO TASK: Pointer arithmetic is detected on this variable, so pointers on this variable are left unchanged:
student * p = new student();
for (p = stu;p < stu + N;p++)
{
String tempVar2 = ConsoleInput.scanfRead();
if (tempVar2 != null)
{
p.name = tempVar2.charAt(0);
}
String tempVar3 = ConsoleInput.scanfRead(" ");
if (tempVar3 != null)
{
p.n1 = Integer.parseInt(tempVar3);
}
String tempVar4 = ConsoleInput.scanfRead(" ");
if (tempVar4 != null)
{
p.n2 = Integer.parseInt(tempVar4);
}
String tempVar5 = ConsoleInput.scanfRead(" ", 1);
if (tempVar5 != null)
{
p.a = tempVar5.charAt(0);
}
String tempVar6 = ConsoleInput.scanfRead(" ", 1);
if (tempVar6 != null)
{
p.b = tempVar6.charAt(0);
}
String tempVar7 = ConsoleInput.scanfRead(" ");
if (tempVar7 != null)
{
p.n3 = Integer.parseInt(tempVar7);
}
}
for (i = 0;i < N;i++)
{
for (j = 0;j < 6;j++)
{
s[i][j] = 0;
}
}
for (i = 0;i < N;i++)
{
if (stu[i].n1 > 80 && stu[i].n3 >= 1)
{
s[i][0] = 8000;
}
if (stu[i].n1 > 85 && stu[i].n2 > 80)
{
s[i][1] = 4000;
}
if (stu[i].n1 > 90)
{
s[i][2] = 2000;
}
if (stu[i].n1 > 85 && stu[i].b == 'Y')
{
s[i][3] = 1000;
}
if (stu[i].n2 > 80 && stu[i].a == 'Y')
{
s[i][4] = 850;
}
}
for (i = 0;i < N;i++)
{
for (j = 4;j >= 0;j--)
{
s[i][5] = s[i][5] + s[i][j];
}
}
max = s[0][5];
for (i = 0;i < N;i++)
{
if (s[i][5] > max)
{
max = s[i][5];
k = i;
}
}
System.out.printf("%s\n%d\n",stu[k].name,s[k][5]);
for (i = 0;i < N;i++)
{
sum = sum + s[i][5];
}
System.out.printf("%ld\n",sum);
}
}
| UTF-8 | Java | 2,262 | java | 1482.java | Java | [] | null | [] | public class student
{
public String name = new String(new char[100]);
public int n1;
public int n2;
public char a;
public char b;
public int n3;
}
package <missing>;
public class GlobalMembers
{
public static void Main()
{
int N;
int i;
int j;
int[][] s = new int[101][6];
int max;
int k = 0;
int sum = 0;
String tempVar = ConsoleInput.scanfRead();
if (tempVar != null)
{
N = Integer.parseInt(tempVar);
}
student[] stu = tangible.Arrays.initializeWithDefaultstudentInstances(101);
//C++ TO JAVA CONVERTER TODO TASK: Pointer arithmetic is detected on this variable, so pointers on this variable are left unchanged:
student * p = new student();
for (p = stu;p < stu + N;p++)
{
String tempVar2 = ConsoleInput.scanfRead();
if (tempVar2 != null)
{
p.name = tempVar2.charAt(0);
}
String tempVar3 = ConsoleInput.scanfRead(" ");
if (tempVar3 != null)
{
p.n1 = Integer.parseInt(tempVar3);
}
String tempVar4 = ConsoleInput.scanfRead(" ");
if (tempVar4 != null)
{
p.n2 = Integer.parseInt(tempVar4);
}
String tempVar5 = ConsoleInput.scanfRead(" ", 1);
if (tempVar5 != null)
{
p.a = tempVar5.charAt(0);
}
String tempVar6 = ConsoleInput.scanfRead(" ", 1);
if (tempVar6 != null)
{
p.b = tempVar6.charAt(0);
}
String tempVar7 = ConsoleInput.scanfRead(" ");
if (tempVar7 != null)
{
p.n3 = Integer.parseInt(tempVar7);
}
}
for (i = 0;i < N;i++)
{
for (j = 0;j < 6;j++)
{
s[i][j] = 0;
}
}
for (i = 0;i < N;i++)
{
if (stu[i].n1 > 80 && stu[i].n3 >= 1)
{
s[i][0] = 8000;
}
if (stu[i].n1 > 85 && stu[i].n2 > 80)
{
s[i][1] = 4000;
}
if (stu[i].n1 > 90)
{
s[i][2] = 2000;
}
if (stu[i].n1 > 85 && stu[i].b == 'Y')
{
s[i][3] = 1000;
}
if (stu[i].n2 > 80 && stu[i].a == 'Y')
{
s[i][4] = 850;
}
}
for (i = 0;i < N;i++)
{
for (j = 4;j >= 0;j--)
{
s[i][5] = s[i][5] + s[i][j];
}
}
max = s[0][5];
for (i = 0;i < N;i++)
{
if (s[i][5] > max)
{
max = s[i][5];
k = i;
}
}
System.out.printf("%s\n%d\n",stu[k].name,s[k][5]);
for (i = 0;i < N;i++)
{
sum = sum + s[i][5];
}
System.out.printf("%ld\n",sum);
}
}
| 2,262 | 0.517241 | 0.471706 | 119 | 18 | 18.874641 | 132 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.957983 | false | false | 3 |
4a9c40be5c575f5ef8dcaf36b3ff9c4af99c26f1 | 37,014,028,189,796 | 8312439737c0ce67118566f9f6542dc35ecc546e | /src/main/java/com/library/logger/LibraryLogger.java | df16a0b394c5653161eed774fa2ad88b4172ee7f | [] | no_license | abdelghanymahmoud/Library | https://github.com/abdelghanymahmoud/Library | 44e882d4a183e3fc5170afc283b2cb42c60305eb | 2baf75a756c45106a7fba273310f3095ab18fc31 | refs/heads/master | 2023-06-23T17:21:20.270000 | 2021-07-27T15:10:23 | 2021-07-27T15:10:23 | 237,624,401 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.library.logger;
import com.library.LibraryApplication;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class LibraryLogger {
public static Logger log = LoggerFactory.getLogger(LibraryApplication.class);
} | UTF-8 | Java | 238 | java | LibraryLogger.java | Java | [] | null | [] | package com.library.logger;
import com.library.LibraryApplication;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class LibraryLogger {
public static Logger log = LoggerFactory.getLogger(LibraryApplication.class);
} | 238 | 0.815126 | 0.806723 | 9 | 25.555555 | 23.986622 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.555556 | false | false | 3 |
1384b3d38f6294c02654c9326daaa99ab4004879 | 39,642,548,144,814 | 1491858c74e5d51bf9978e2b0da5230b63652ded | /R4-1/src/pageobjects/incap311console__Console311_Aadil_SR_Activity_Edit.java | a5555b43a8e8db1b226dc6871509ce5127dfe867 | [] | no_license | VasuBevara/Jenkins-Provar-test | https://github.com/VasuBevara/Jenkins-Provar-test | 5782e0df1bd8829d02eef01e79faac24267a889a | b80fba11e67fcee2331d814691146974df4bbbb8 | refs/heads/master | 2020-04-11T21:21:54.634000 | 2019-01-28T11:45:52 | 2019-01-28T11:45:52 | 162,103,249 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package pageobjects;
import java.util.List;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import com.provar.core.testapi.annotations.*;
@SalesforcePage( title="Incap 311console__ Console311_ Aadil_ SR_ Activity_ Edit"
, page="Console311_Aadil_SR_Activity_Edit"
, namespacePrefix="Incap311Console"
, object="Incap311__Service_Activity__c"
, connection="QA"
)
public class incap311console__Console311_Aadil_SR_Activity_Edit {
@TextType()
@FindBy(xpath = "//div[contains(@class, \"slds-form-element__control\")]/select")
public WebElement selectAnOutcome;
@TextType()
@FindBy(xpath = "//label[contains(@for,'addComments')][contains(text(),'Additional Comments')]/parent::div//textarea")
public WebElement response;
@TextType()
@FindBy(xpath = "//div[contains(@class, \"slds-form-element__control\")]/div/textarea")
public WebElement internalComments;
@TextType()
@FindBy(id = "serviceQuestions-picklist-0")
public WebElement theGodfather;
@TextType()
@FindBy(xpath = "//*[@id=\"option-list-0\"]/li[1]/span/span")
public WebElement picklistOPTPanelid;
@ButtonType()
@FindByLabel(label = "Save")
public WebElement save;
}
| UTF-8 | Java | 1,288 | java | incap311console__Console311_Aadil_SR_Activity_Edit.java | Java | [] | null | [] | package pageobjects;
import java.util.List;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import com.provar.core.testapi.annotations.*;
@SalesforcePage( title="Incap 311console__ Console311_ Aadil_ SR_ Activity_ Edit"
, page="Console311_Aadil_SR_Activity_Edit"
, namespacePrefix="Incap311Console"
, object="Incap311__Service_Activity__c"
, connection="QA"
)
public class incap311console__Console311_Aadil_SR_Activity_Edit {
@TextType()
@FindBy(xpath = "//div[contains(@class, \"slds-form-element__control\")]/select")
public WebElement selectAnOutcome;
@TextType()
@FindBy(xpath = "//label[contains(@for,'addComments')][contains(text(),'Additional Comments')]/parent::div//textarea")
public WebElement response;
@TextType()
@FindBy(xpath = "//div[contains(@class, \"slds-form-element__control\")]/div/textarea")
public WebElement internalComments;
@TextType()
@FindBy(id = "serviceQuestions-picklist-0")
public WebElement theGodfather;
@TextType()
@FindBy(xpath = "//*[@id=\"option-list-0\"]/li[1]/span/span")
public WebElement picklistOPTPanelid;
@ButtonType()
@FindByLabel(label = "Save")
public WebElement save;
}
| 1,288 | 0.677019 | 0.658385 | 37 | 33.81081 | 30.085318 | 119 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.027027 | false | false | 3 |
114e52bcc558e3628f0d69e7a2f025ec4f08a7f1 | 39,015,482,937,093 | eae03acf302444e8745286eca1bc37459c6de374 | /359/B[ Permutation ].java | a5f771a47b9e510060a4bc2f760298b1e21d3ded | [] | no_license | ballon/codeforces | https://github.com/ballon/codeforces | bf67145b2e6692458a0b585004adf333d60b26b9 | 6bb9e79765793e8e8dc16ab3f152baba27870711 | refs/heads/master | 2016-06-07T21:04:29.461000 | 2015-10-11T20:19:50 | 2015-10-11T20:19:50 | 44,068,221 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.util.*;
import java.io.*;
import java.math.*;
public class Main {
FastScanner in;
PrintWriter out;
public void solve() throws IOException {
Scanner in = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int n = in.nextInt();
int k = in.nextInt();
int a[]= new int[200000];
for(int i=0; i<2*n; ++i) a[i]=2*n-i;
for(int i=0; i<2*k; i+=2) {
int temp = a[i];
a[i]=a[i+1];
a[i+1]=temp;
}
for(int i=0; i<2*n; ++i) {
String t = Integer.toString(a[i]);
out.print(t+" ");
}
out.println();
out.flush();
}
public void run() {
try {
in = new FastScanner(new File("input.txt"));
out = new PrintWriter(new File("output.txt"));
solve();
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
class FastScanner {
BufferedReader br;
StringTokenizer st;
FastScanner(File f) {
try {
br = new BufferedReader(new FileReader(f));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
String next() {
while (st == null || !st.hasMoreTokens()) {
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
}
public static void main(String[] arg) {
new Main().run();
}
} | UTF-8 | Java | 1,776 | java | B[ Permutation ].java | Java | [] | null | [] | import java.util.*;
import java.io.*;
import java.math.*;
public class Main {
FastScanner in;
PrintWriter out;
public void solve() throws IOException {
Scanner in = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int n = in.nextInt();
int k = in.nextInt();
int a[]= new int[200000];
for(int i=0; i<2*n; ++i) a[i]=2*n-i;
for(int i=0; i<2*k; i+=2) {
int temp = a[i];
a[i]=a[i+1];
a[i+1]=temp;
}
for(int i=0; i<2*n; ++i) {
String t = Integer.toString(a[i]);
out.print(t+" ");
}
out.println();
out.flush();
}
public void run() {
try {
in = new FastScanner(new File("input.txt"));
out = new PrintWriter(new File("output.txt"));
solve();
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
class FastScanner {
BufferedReader br;
StringTokenizer st;
FastScanner(File f) {
try {
br = new BufferedReader(new FileReader(f));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
String next() {
while (st == null || !st.hasMoreTokens()) {
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
}
public static void main(String[] arg) {
new Main().run();
}
} | 1,776 | 0.448761 | 0.439752 | 75 | 22.693333 | 17.003508 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.533333 | false | false | 3 |
e8481e4d03aba569a1d7b785350f2f7341a14396 | 20,349,555,058,038 | ccfa16499697bea6e309f9d33eca83d7840c40bd | /src/main/java/app/view/View.java | d96ddcd3989556d84e6d7898ee458a34c8635f5a | [] | no_license | makiam/Actionee | https://github.com/makiam/Actionee | 2133ecdccad98654aee695f1dc7f2e92333df21c | a72b47c4270c5a0be36329ceab111b81bc586d08 | refs/heads/master | 2020-04-25T09:23:42.238000 | 2019-04-08T14:28:40 | 2019-04-08T14:28:40 | 172,674,378 | 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 app.view;
import app.model.Model;
import app.model.Selection;
import app.view.impl.MainViewImpl;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import lombok.Getter;
/**
*
* @author maksim.khramov
*/
public final class View {
@Getter
private final JFrame peer;
@Getter
private final Model model;
@Getter
private final Selection selection;
public View(Model model) {
this.model = model;
this.peer = new MainViewImpl(this);
this.selection = new Selection(this);
SwingUtilities.invokeLater(this::setVisible);
}
private void setVisible() {
peer.setTitle("View:" + model);
peer.setVisible(true);
}
public final void close() {
peer.dispose();
}
}
| UTF-8 | Java | 1,015 | java | View.java | Java | [
{
"context": "tilities;\nimport lombok.Getter;\n\n/**\n *\n * @author maksim.khramov\n */\npublic final class View {\n \n @Getter\n ",
"end": 408,
"score": 0.984714686870575,
"start": 394,
"tag": "NAME",
"value": "maksim.khramov"
}
] | 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 app.view;
import app.model.Model;
import app.model.Selection;
import app.view.impl.MainViewImpl;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import lombok.Getter;
/**
*
* @author maksim.khramov
*/
public final class View {
@Getter
private final JFrame peer;
@Getter
private final Model model;
@Getter
private final Selection selection;
public View(Model model) {
this.model = model;
this.peer = new MainViewImpl(this);
this.selection = new Selection(this);
SwingUtilities.invokeLater(this::setVisible);
}
private void setVisible() {
peer.setTitle("View:" + model);
peer.setVisible(true);
}
public final void close() {
peer.dispose();
}
}
| 1,015 | 0.633498 | 0.633498 | 48 | 20.145834 | 17.645809 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.416667 | false | false | 3 |
ef0706676238596aeb5eab054855c0882f5be6d9 | 14,216,341,801,036 | 6b1b7b7a21e97d29e99ababee87c3d2ad66351ac | /src/main/java/pl/kielce/tu/przedszkole/przedszkole/service/PaymentService/PaymentDecorator/PaymentDecorator.java | eaab67b69766690f84d2e7038b2c73b0d9a257f0 | [] | no_license | siwonpawel/kindergarden | https://github.com/siwonpawel/kindergarden | 4000b470d433cfd0a6af01a44a4dac8b5ab2d5d6 | 4b89fb0884dcaff2f08907cf4536547233095317 | refs/heads/main | 2023-07-19T01:57:19.566000 | 2019-01-20T18:39:21 | 2019-01-20T18:39:21 | 325,000,270 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package pl.kielce.tu.przedszkole.przedszkole.service.PaymentService.PaymentDecorator;
import java.math.BigDecimal;
abstract public class PaymentDecorator implements BasicFee {
private BasicFee customizedPayment;
public PaymentDecorator(BasicFee customizedPayment) {
this.customizedPayment = customizedPayment;
}
@Override
public BigDecimal getCost() {
return customizedPayment.getCost();
}
@Override
public String getDescription() {
return customizedPayment.getDescription();
}
}
| UTF-8 | Java | 545 | java | PaymentDecorator.java | Java | [] | null | [] | package pl.kielce.tu.przedszkole.przedszkole.service.PaymentService.PaymentDecorator;
import java.math.BigDecimal;
abstract public class PaymentDecorator implements BasicFee {
private BasicFee customizedPayment;
public PaymentDecorator(BasicFee customizedPayment) {
this.customizedPayment = customizedPayment;
}
@Override
public BigDecimal getCost() {
return customizedPayment.getCost();
}
@Override
public String getDescription() {
return customizedPayment.getDescription();
}
}
| 545 | 0.737615 | 0.737615 | 21 | 24.952381 | 24.93129 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.285714 | false | false | 3 |
4960d35e6324a35c650c8bec76d2348ecf13114e | 14,216,341,798,054 | 8ed464bc19f3559866dcecc51108fa6355c173c8 | /app/src/main/java/com/wadesi/codespeak/UploadScoreActivity.java | 6241d0879bf33b314ae2531bc13cc00bc295d9ed | [] | no_license | SimonWade/educode | https://github.com/SimonWade/educode | cbf799ea658b32547134c4cb05d3a08da939140d | 81413e2a4ed966f23cebf2535785c0e54e810881 | refs/heads/master | 2021-06-05T01:06:09.815000 | 2016-07-27T15:14:09 | 2016-07-27T15:14:09 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.wadesi.codespeak;
import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import android.widget.Toast;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
public class UploadScoreActivity extends AsyncTask<String, Void, String>
{
Context context;
String username;
String topic;
int score;
public final static String USERNAME = "com.wadesi.codespeak.USERNAME";
public final static String SCORE = "com.wadesi.codespeak.SCORE";
public final static String TOPIC = "com.wadesi.codespeak.TOPIC";
public UploadScoreActivity(Context context, int score)
{
this.context = context;
this.score = score;
}
@Override
protected void onPreExecute()
{
}
@Override
protected String doInBackground(String...arg0)
{
username = (String)arg0[0];
topic = (String)arg0[1];
if(!topic.equals("Boolean") && !topic.equals("Selection") && !topic.equals("Iteration"))
{
topic = "Miscellaneous";
}
String hyperlink, arguments, result;
BufferedReader rdr; // Declare a BufferedReader to read the response from the PHP page
try
{
arguments = "?username=" + URLEncoder.encode(username, "UTF-8"); // Encode with UTF-8
arguments += "&score=" + URLEncoder.encode("" + score, "UTF-8");
arguments += "&topic=" + URLEncoder.encode(topic, "UTF-8");
hyperlink = "http://teacherportal.netau.net/upload_score.php" + arguments;
URL url = new URL(hyperlink);
HttpURLConnection con = (HttpURLConnection) url.openConnection(); // Connect to the PHP login page
rdr = new BufferedReader(new InputStreamReader(con.getInputStream())); // Use an InputStreamReader to read in the bytes and convert them to characters
result = rdr.readLine(); // Read each line of data and store in string result
return result;
}
catch(Exception e)
{
return new String("Exception: " + e.getMessage());
}
}
@Override
protected void onPostExecute(String result)
{
if (result != null) // If we've received a response that isn't null
{
try
{
JSONObject jsonObj = new JSONObject(result);
String response = jsonObj.getString("response");
if (response.equals("Successful"))
{
Toast.makeText(context, "Uploading score...", Toast.LENGTH_SHORT).show();
}
else if (response.equals("Unsuccessful"))
{
Toast.makeText(context, "There's been an error uploading your score. Sorry!", Toast.LENGTH_SHORT).show();
}
else
{
Toast.makeText(context, "Cannot connect to database.", Toast.LENGTH_SHORT).show();
}
}
catch (JSONException e)
{
Toast.makeText(context, "Cannot parse the JSON data", Toast.LENGTH_SHORT).show();
}
}
else
{
Toast.makeText(context, "No JSON data found", Toast.LENGTH_SHORT).show();
}
}
}
| UTF-8 | Java | 3,589 | java | UploadScoreActivity.java | Java | [] | null | [] | package com.wadesi.codespeak;
import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import android.widget.Toast;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
public class UploadScoreActivity extends AsyncTask<String, Void, String>
{
Context context;
String username;
String topic;
int score;
public final static String USERNAME = "com.wadesi.codespeak.USERNAME";
public final static String SCORE = "com.wadesi.codespeak.SCORE";
public final static String TOPIC = "com.wadesi.codespeak.TOPIC";
public UploadScoreActivity(Context context, int score)
{
this.context = context;
this.score = score;
}
@Override
protected void onPreExecute()
{
}
@Override
protected String doInBackground(String...arg0)
{
username = (String)arg0[0];
topic = (String)arg0[1];
if(!topic.equals("Boolean") && !topic.equals("Selection") && !topic.equals("Iteration"))
{
topic = "Miscellaneous";
}
String hyperlink, arguments, result;
BufferedReader rdr; // Declare a BufferedReader to read the response from the PHP page
try
{
arguments = "?username=" + URLEncoder.encode(username, "UTF-8"); // Encode with UTF-8
arguments += "&score=" + URLEncoder.encode("" + score, "UTF-8");
arguments += "&topic=" + URLEncoder.encode(topic, "UTF-8");
hyperlink = "http://teacherportal.netau.net/upload_score.php" + arguments;
URL url = new URL(hyperlink);
HttpURLConnection con = (HttpURLConnection) url.openConnection(); // Connect to the PHP login page
rdr = new BufferedReader(new InputStreamReader(con.getInputStream())); // Use an InputStreamReader to read in the bytes and convert them to characters
result = rdr.readLine(); // Read each line of data and store in string result
return result;
}
catch(Exception e)
{
return new String("Exception: " + e.getMessage());
}
}
@Override
protected void onPostExecute(String result)
{
if (result != null) // If we've received a response that isn't null
{
try
{
JSONObject jsonObj = new JSONObject(result);
String response = jsonObj.getString("response");
if (response.equals("Successful"))
{
Toast.makeText(context, "Uploading score...", Toast.LENGTH_SHORT).show();
}
else if (response.equals("Unsuccessful"))
{
Toast.makeText(context, "There's been an error uploading your score. Sorry!", Toast.LENGTH_SHORT).show();
}
else
{
Toast.makeText(context, "Cannot connect to database.", Toast.LENGTH_SHORT).show();
}
}
catch (JSONException e)
{
Toast.makeText(context, "Cannot parse the JSON data", Toast.LENGTH_SHORT).show();
}
}
else
{
Toast.makeText(context, "No JSON data found", Toast.LENGTH_SHORT).show();
}
}
}
| 3,589 | 0.569518 | 0.56701 | 108 | 32.23148 | 35.89584 | 163 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.564815 | false | false | 3 |
e46849d2147ac6ffdad754ff59240f74beec81f0 | 8,796,093,056,803 | 477fec7e1cbd60fdb7980823c4a3c8ba52d89310 | /auth-server/src/main/java/com/amigo/authserver/serviceImpl/UserServiceImpl.java | 0a50eef9a0850d3708321541575695bab80963c8 | [] | no_license | anju54/Amigo-microservice | https://github.com/anju54/Amigo-microservice | bfb2c046fb02a752ec71930562d79ad2a0354865 | f87547323c7d3bbf88aae8e60fb6a9a78b5a904c | refs/heads/master | 2023-02-16T13:42:58.908000 | 2021-01-15T12:01:11 | 2021-01-15T12:01:11 | 306,096,038 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.amigo.authserver.serviceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Component;
import com.amigo.authserver.entities.User;
import com.amigo.authserver.repository.UserRepository;
import com.amigo.authserver.service.UserService;
@Component
public class UserServiceImpl implements UserService{
@Autowired
private BCryptPasswordEncoder bCryptPasswordEncoder;
@Autowired
private UserRepository userRepository;
public User saveUserLoginDetail(User user) {
// User user = new User();
// user.setEmail(userMsg.getEmailId());
// user.setPassword("");
user.setPassword(bCryptPasswordEncoder.encode(user.getPassword()));
return userRepository.save(user);
}
}
| UTF-8 | Java | 822 | java | UserServiceImpl.java | Java | [] | null | [] | package com.amigo.authserver.serviceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Component;
import com.amigo.authserver.entities.User;
import com.amigo.authserver.repository.UserRepository;
import com.amigo.authserver.service.UserService;
@Component
public class UserServiceImpl implements UserService{
@Autowired
private BCryptPasswordEncoder bCryptPasswordEncoder;
@Autowired
private UserRepository userRepository;
public User saveUserLoginDetail(User user) {
// User user = new User();
// user.setEmail(userMsg.getEmailId());
// user.setPassword("");
user.setPassword(bCryptPasswordEncoder.encode(user.getPassword()));
return userRepository.save(user);
}
}
| 822 | 0.807786 | 0.807786 | 31 | 25.516129 | 24.207266 | 72 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.096774 | false | false | 3 |
40bf04f1afa177d6f09028c369cea87fbb68126e | 16,080,357,585,900 | 76e162ba4a08abe81ccaae5a8c64afe968c0a890 | /src/backtracking/Task_1291/Solution.java | c9fbabd7890e5bd3660491a06d4505586a443686 | [] | no_license | skuzmukov/LeetCode | https://github.com/skuzmukov/LeetCode | d8b700baac869a24dbafe725344c7a041f9814a8 | 0c0676c920aa2c50b1f31161a4aeaca5b61ed4b9 | refs/heads/master | 2022-09-29T17:33:02.651000 | 2022-09-24T11:58:50 | 2022-09-24T11:58:50 | 222,656,880 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package backtracking.Task_1291;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
//https://leetcode.com/problems/sequential-digits/
public class Solution {
List<Integer> seq = new ArrayList<>(100);
public List<Integer> sequentialDigits(int low, int high) {
processSequences(high);
List<Integer> result = new ArrayList<Integer>();
for(Integer i : seq) {
if (low <= i && i <= high) {
result.add(i);
}
}
Collections.sort(result);
return result;
}
private void processSequences(int limit) {
for (int i = 1; i < 10; i++) {
generateNextSequenceMoreThan(i, limit);
}
}
private void generateNextSequenceMoreThan(int x, int limit) {
if (x > limit) { return; }
seq.add(x);
int lastDigit = x % 10;
if (lastDigit + 1 < 10) {
generateNextSequenceMoreThan(x * 10 + lastDigit + 1, limit);
}
}
} | UTF-8 | Java | 1,014 | java | Solution.java | Java | [] | null | [] | package backtracking.Task_1291;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
//https://leetcode.com/problems/sequential-digits/
public class Solution {
List<Integer> seq = new ArrayList<>(100);
public List<Integer> sequentialDigits(int low, int high) {
processSequences(high);
List<Integer> result = new ArrayList<Integer>();
for(Integer i : seq) {
if (low <= i && i <= high) {
result.add(i);
}
}
Collections.sort(result);
return result;
}
private void processSequences(int limit) {
for (int i = 1; i < 10; i++) {
generateNextSequenceMoreThan(i, limit);
}
}
private void generateNextSequenceMoreThan(int x, int limit) {
if (x > limit) { return; }
seq.add(x);
int lastDigit = x % 10;
if (lastDigit + 1 < 10) {
generateNextSequenceMoreThan(x * 10 + lastDigit + 1, limit);
}
}
} | 1,014 | 0.571006 | 0.553254 | 39 | 25.02564 | 20.370274 | 72 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.538462 | false | false | 3 |
ff904f0a56cdb98a3c45f3cac1bda18b2b9fc759 | 34,918,084,120,461 | 3ee6d6a1ca3f19b56eab7936a1e2839fc4b29e78 | /study/src/com/test0422/Test7.java | 88423fa29187f3bc65845a1a569872113902aff8 | [] | no_license | daegi/study-dg | https://github.com/daegi/study-dg | 2764592b0f0914ec64b0a418a0417a1d6091651f | ad9862ecb60aca7265481daf7735d9dfd826e5f6 | refs/heads/master | 2021-01-19T13:52:59.044000 | 2014-07-25T03:27:26 | 2014-07-25T03:27:26 | 32,976,520 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.test0422;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
public class Test7 {
public static void fileCopy1(String source, String target) {
try {
FileInputStream fis = new FileInputStream(source);
FileOutputStream fos = new FileOutputStream(target);
byte b[] = new byte[1024];
int len;
System.out.println("복사시작...");
long start = System.currentTimeMillis();
while ((len = fis.read(b, 0, 1024)) != -1) {
fos.write(b, 0, len);
}
fos.close();
fis.close();
long end = System.currentTimeMillis();
System.out.println("걸린시간 :" + (end - start) + "ms");
} catch (Exception e) {
}
}
public static void fileCopy2(String source, String target) {
try {
int BUFFER_SIZE = 1024;
FileInputStream fis = new FileInputStream(source);
FileOutputStream fos = new FileOutputStream(target);
// 버퍼스트림
BufferedInputStream bis = new BufferedInputStream(fis);
BufferedOutputStream bos = new BufferedOutputStream(fos,BUFFER_SIZE);
byte b[] = new byte[BUFFER_SIZE];
int len;
System.out.println("복사시작...");
long start = System.currentTimeMillis();
while ((len = bis.read(b, 0, BUFFER_SIZE)) != -1) {
bos.write(b, 0, len);
}
bos.flush();
bos.close();
bis.close();
long end = System.currentTimeMillis();
System.out.println("걸린시간 :" + (end - start) + "ms");
} catch (Exception e) {
}
}
public static void main(String[] args) {
String source = "d:\\ex\\12.zip";
String target = "d:\\ex\\123.zip";
//fileCopy1(source, target);
fileCopy2(source, target);
}
}
| UHC | Java | 1,784 | java | Test7.java | Java | [] | null | [] | package com.test0422;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
public class Test7 {
public static void fileCopy1(String source, String target) {
try {
FileInputStream fis = new FileInputStream(source);
FileOutputStream fos = new FileOutputStream(target);
byte b[] = new byte[1024];
int len;
System.out.println("복사시작...");
long start = System.currentTimeMillis();
while ((len = fis.read(b, 0, 1024)) != -1) {
fos.write(b, 0, len);
}
fos.close();
fis.close();
long end = System.currentTimeMillis();
System.out.println("걸린시간 :" + (end - start) + "ms");
} catch (Exception e) {
}
}
public static void fileCopy2(String source, String target) {
try {
int BUFFER_SIZE = 1024;
FileInputStream fis = new FileInputStream(source);
FileOutputStream fos = new FileOutputStream(target);
// 버퍼스트림
BufferedInputStream bis = new BufferedInputStream(fis);
BufferedOutputStream bos = new BufferedOutputStream(fos,BUFFER_SIZE);
byte b[] = new byte[BUFFER_SIZE];
int len;
System.out.println("복사시작...");
long start = System.currentTimeMillis();
while ((len = bis.read(b, 0, BUFFER_SIZE)) != -1) {
bos.write(b, 0, len);
}
bos.flush();
bos.close();
bis.close();
long end = System.currentTimeMillis();
System.out.println("걸린시간 :" + (end - start) + "ms");
} catch (Exception e) {
}
}
public static void main(String[] args) {
String source = "d:\\ex\\12.zip";
String target = "d:\\ex\\123.zip";
//fileCopy1(source, target);
fileCopy2(source, target);
}
}
| 1,784 | 0.625144 | 0.606774 | 73 | 21.863014 | 20.733347 | 72 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.369863 | false | false | 3 |
3a2de6126f237fd2ebbfaf14f64be2d07978b7dc | 13,761,075,267,855 | 6444f823ab6ea051fcbfa011a265771b57e3aba5 | /Client/mod_Minechem/net/minecraft/minechem/GuiUnbonder.java | e4c093ee33439d629f12a8015ea9b24eda057088 | [] | no_license | Ehrlingby/Minechem | https://github.com/Ehrlingby/Minechem | 5f3638e3fbd1a1b971f26397018ae901571c706b | c2d05eb683da0882bdc79701d956dc4cb4a2c6fb | refs/heads/master | 2021-01-16T19:48:20.397000 | 2012-02-06T00:31:59 | 2012-02-06T00:31:59 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package net.minecraft.minechem;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.GuiContainer;
import net.minecraft.src.TileEntity;
import net.minecraft.src.mod_Minechem;
import org.lwjgl.opengl.GL11;
public class GuiUnbonder extends GuiMinechemMachine {
public GuiUnbonder(EntityPlayer entityplayer, TileEntity tileentity)
{
super(new ContainerUnbonder(entityplayer.inventory, (TileEntityUnbonder)tileentity));
tileMachine = (TileEntityMinechemMachine)tileentity;
}
@Override
protected void drawGuiContainerForegroundLayer()
{
fontRenderer.drawString("Un-Bonder", 56, 6, 0x404040);
fontRenderer.drawString("Inventory", 8, (ySize - 96) + 2, 0x404040);
drawIC2Information();
}
@Override
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
int k = mc.renderEngine.getTexture("/minechem/unbonder.png");
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.renderEngine.bindTexture(k);
int l = (width - xSize) / 2;
int i1 = (height - ySize) / 2;
drawTexturedModalRect(l, i1, 0, 0, xSize, ySize);
int time = tileMachine.getTimer();
if(time > 0)
{
int k1 = time % 2;
if(k1 == 0) {
drawTexturedModalRect(l+54, i1+39, 176, 0, 13, 10);
}
}
}
}
| UTF-8 | Java | 1,334 | java | GuiUnbonder.java | Java | [] | null | [] | package net.minecraft.minechem;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.GuiContainer;
import net.minecraft.src.TileEntity;
import net.minecraft.src.mod_Minechem;
import org.lwjgl.opengl.GL11;
public class GuiUnbonder extends GuiMinechemMachine {
public GuiUnbonder(EntityPlayer entityplayer, TileEntity tileentity)
{
super(new ContainerUnbonder(entityplayer.inventory, (TileEntityUnbonder)tileentity));
tileMachine = (TileEntityMinechemMachine)tileentity;
}
@Override
protected void drawGuiContainerForegroundLayer()
{
fontRenderer.drawString("Un-Bonder", 56, 6, 0x404040);
fontRenderer.drawString("Inventory", 8, (ySize - 96) + 2, 0x404040);
drawIC2Information();
}
@Override
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
int k = mc.renderEngine.getTexture("/minechem/unbonder.png");
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.renderEngine.bindTexture(k);
int l = (width - xSize) / 2;
int i1 = (height - ySize) / 2;
drawTexturedModalRect(l, i1, 0, 0, xSize, ySize);
int time = tileMachine.getTimer();
if(time > 0)
{
int k1 = time % 2;
if(k1 == 0) {
drawTexturedModalRect(l+54, i1+39, 176, 0, 13, 10);
}
}
}
}
| 1,334 | 0.661919 | 0.617691 | 45 | 28.644444 | 24.938284 | 87 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.444444 | false | false | 3 |
dd4e5ee8536fe5a45531f2be2d60dd61268182d0 | 35,450,660,063,965 | b9bc64d80d7be61dbb8dad8b3a643b9a73d59af3 | /李子厚/公用函数/src/com/kingdee/eas/custom/socketjk/SocketLogCollection.java | 6199c38aec61c2bf1cbeedf30362635c8b402fe0 | [] | no_license | chengganglz/cglz | https://github.com/chengganglz/cglz | 070426a1c445004ab39898eddfe7b83a7955bc50 | 402cb145b601a34f647eee506c952ea2292e17d7 | refs/heads/master | 2020-05-17T09:33:43.474000 | 2019-05-21T13:12:06 | 2019-05-21T13:12:06 | 183,634,982 | 0 | 1 | null | false | 2019-04-28T03:56:02 | 2019-04-26T13:37:54 | 2019-04-26T13:37:57 | 2019-04-28T03:56:02 | 0 | 0 | 1 | 0 | null | false | false | package com.kingdee.eas.custom.socketjk;
import com.kingdee.bos.dao.AbstractObjectCollection;
import com.kingdee.bos.dao.IObjectPK;
public class SocketLogCollection extends AbstractObjectCollection
{
public SocketLogCollection()
{
super(SocketLogInfo.class);
}
public boolean add(SocketLogInfo item)
{
return addObject(item);
}
public boolean addCollection(SocketLogCollection item)
{
return addObjectCollection(item);
}
public boolean remove(SocketLogInfo item)
{
return removeObject(item);
}
public SocketLogInfo get(int index)
{
return(SocketLogInfo)getObject(index);
}
public SocketLogInfo get(Object key)
{
return(SocketLogInfo)getObject(key);
}
public void set(int index, SocketLogInfo item)
{
setObject(index, item);
}
public boolean contains(SocketLogInfo item)
{
return containsObject(item);
}
public boolean contains(Object key)
{
return containsKey(key);
}
public int indexOf(SocketLogInfo item)
{
return super.indexOf(item);
}
} | UTF-8 | Java | 1,190 | java | SocketLogCollection.java | Java | [] | null | [] | package com.kingdee.eas.custom.socketjk;
import com.kingdee.bos.dao.AbstractObjectCollection;
import com.kingdee.bos.dao.IObjectPK;
public class SocketLogCollection extends AbstractObjectCollection
{
public SocketLogCollection()
{
super(SocketLogInfo.class);
}
public boolean add(SocketLogInfo item)
{
return addObject(item);
}
public boolean addCollection(SocketLogCollection item)
{
return addObjectCollection(item);
}
public boolean remove(SocketLogInfo item)
{
return removeObject(item);
}
public SocketLogInfo get(int index)
{
return(SocketLogInfo)getObject(index);
}
public SocketLogInfo get(Object key)
{
return(SocketLogInfo)getObject(key);
}
public void set(int index, SocketLogInfo item)
{
setObject(index, item);
}
public boolean contains(SocketLogInfo item)
{
return containsObject(item);
}
public boolean contains(Object key)
{
return containsKey(key);
}
public int indexOf(SocketLogInfo item)
{
return super.indexOf(item);
}
} | 1,190 | 0.635294 | 0.635294 | 48 | 22.833334 | 19.567547 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.3125 | false | false | 3 |
86c6fd5c4378dee71e5f29171c431d58dbba292a | 5,257,040,017,791 | fed41971c78ff70c701d754cfd023e3ea671ee85 | /gd-home-intf/src/main/java/com/gudeng/commerce/gd/home/service/UsercollectProductToolService.java | 6f976d5c7fe6dbbc49f8c7d16e4d4ff950cf8772 | [] | no_license | f3226912/gd | https://github.com/f3226912/gd | 204647c822196b52513e5f0f8e475b9d47198d2a | 882332a9da91892a38e38443541d93ddd91c7fec | refs/heads/master | 2021-01-19T06:47:44.052000 | 2017-04-07T03:42:12 | 2017-04-07T03:42:12 | 87,498,686 | 0 | 6 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.gudeng.commerce.gd.home.service;
import java.util.List;
import java.util.Map;
import com.gudeng.commerce.gd.customer.dto.PushProductDTO;
import com.gudeng.commerce.gd.customer.dto.UsercollectProductDTO;
/**
* web层
* usercollectProductTool接口
* @author Administrator
*
*/
public interface UsercollectProductToolService {
public List<PushProductDTO> getList(Long userId,Long businessId,Long marketId,Long productId, int startRow,int endRow) throws Exception;
/**
* 获取用户关注的单品
* @param memberId
* @return
*/
public List<UsercollectProductDTO> getProductList(Long memberId,Long marketId) throws Exception;
/**
* 关注产品
* @param userId
* @param productId
* @param categoryId
* @return
*/
public Long addFocus (Long userId, Long productId,Long categoryId) throws Exception;
/**
* 取消关注产品
* @param userId
* @param productId
*/
public void cancelFocus (Long userId, Long productId ) throws Exception;
/**
* 根据UserId productId
* 获得关注信息
* 用于判断是否关注
* @param userId
* @param productId
* @return
*/
public UsercollectProductDTO getCollect(Long userId,Long productId) throws Exception;
/**
* 根据参数获得总数
* @param parammap
* @return
* @throws Exception
*/
public Integer getCount(Map<String, Object> parammap) throws Exception;
/**
* 获得关联产品数据
* @param userId
* @param businessId
* @param marketId
* @param productId
* @param startRow
* @param endRow
* @return
*/
public List<PushProductDTO> getCollectList(Long userId,Long businessId,Long marketId,Long productId, int startRow,int endRow) throws Exception;
/**
* 取消多个产品关注
* @param productIds
* @return 执行结果返回
*/
public Integer cancelMoreFocus(Long userId, String productIds) throws Exception;
}
| UTF-8 | Java | 1,896 | java | UsercollectProductToolService.java | Java | [
{
"context": "**\n * web层 \n * usercollectProductTool接口\n * @author Administrator\n *\n */\npublic interface UsercollectProductToolSer",
"end": 283,
"score": 0.7650867104530334,
"start": 270,
"tag": "NAME",
"value": "Administrator"
}
] | null | [] | package com.gudeng.commerce.gd.home.service;
import java.util.List;
import java.util.Map;
import com.gudeng.commerce.gd.customer.dto.PushProductDTO;
import com.gudeng.commerce.gd.customer.dto.UsercollectProductDTO;
/**
* web层
* usercollectProductTool接口
* @author Administrator
*
*/
public interface UsercollectProductToolService {
public List<PushProductDTO> getList(Long userId,Long businessId,Long marketId,Long productId, int startRow,int endRow) throws Exception;
/**
* 获取用户关注的单品
* @param memberId
* @return
*/
public List<UsercollectProductDTO> getProductList(Long memberId,Long marketId) throws Exception;
/**
* 关注产品
* @param userId
* @param productId
* @param categoryId
* @return
*/
public Long addFocus (Long userId, Long productId,Long categoryId) throws Exception;
/**
* 取消关注产品
* @param userId
* @param productId
*/
public void cancelFocus (Long userId, Long productId ) throws Exception;
/**
* 根据UserId productId
* 获得关注信息
* 用于判断是否关注
* @param userId
* @param productId
* @return
*/
public UsercollectProductDTO getCollect(Long userId,Long productId) throws Exception;
/**
* 根据参数获得总数
* @param parammap
* @return
* @throws Exception
*/
public Integer getCount(Map<String, Object> parammap) throws Exception;
/**
* 获得关联产品数据
* @param userId
* @param businessId
* @param marketId
* @param productId
* @param startRow
* @param endRow
* @return
*/
public List<PushProductDTO> getCollectList(Long userId,Long businessId,Long marketId,Long productId, int startRow,int endRow) throws Exception;
/**
* 取消多个产品关注
* @param productIds
* @return 执行结果返回
*/
public Integer cancelMoreFocus(Long userId, String productIds) throws Exception;
}
| 1,896 | 0.717045 | 0.717045 | 80 | 21 | 29.451654 | 144 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.125 | false | false | 3 |
5270cc364b653a4a603f12f809983bde0a5b9572 | 27,376,121,555,531 | c422df5be5b4dfcefafda3b2f53b8b60e57ede19 | /Stack_machine.java | 1ca973960f155452cfb2e26f52dcb3999fad9cae | [] | no_license | revachauhan/workspace | https://github.com/revachauhan/workspace | 32f927d8f1f8aeade879eb3bbb7bfe313d14b53e | 8f26f5f3919df15abcf5bea90fe1d1eea1788275 | refs/heads/master | 2021-05-28T08:46:30.174000 | 2014-03-04T04:25:37 | 2014-03-04T04:25:37 | 13,977,460 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package reva.java.practice;
public class Stack_machine {
int top;
int length;
int[] stack_array;
public Stack_machine(String s) {
stack_array = new int[s.length()];
length= s.length();
top =0;
System.out.println(calculate(s));
}
void push(int element)
{
stack_array[top++] = element;
}
int pop()
{
return stack_array[--top];
}
int calculate(String s){
for(int i =0;i <length;i++)
{
char c = s.charAt(i);
if(Character.isDigit(c))
push(Integer.parseInt(Character.toString(c)));
else
{
switch(c)
{
case('+'):
{
int a = pop();
int b = pop();
int result = a+b;
push(result);
break;
}
case('*'):
{
int a = pop();
int b = pop();
int result = a*b;
push((char) result);
break;
}
}
}
}
return stack_array[--top];
}
}
| UTF-8 | Java | 878 | java | Stack_machine.java | Java | [] | null | [] | package reva.java.practice;
public class Stack_machine {
int top;
int length;
int[] stack_array;
public Stack_machine(String s) {
stack_array = new int[s.length()];
length= s.length();
top =0;
System.out.println(calculate(s));
}
void push(int element)
{
stack_array[top++] = element;
}
int pop()
{
return stack_array[--top];
}
int calculate(String s){
for(int i =0;i <length;i++)
{
char c = s.charAt(i);
if(Character.isDigit(c))
push(Integer.parseInt(Character.toString(c)));
else
{
switch(c)
{
case('+'):
{
int a = pop();
int b = pop();
int result = a+b;
push(result);
break;
}
case('*'):
{
int a = pop();
int b = pop();
int result = a*b;
push((char) result);
break;
}
}
}
}
return stack_array[--top];
}
}
| 878 | 0.517084 | 0.514806 | 78 | 10.256411 | 11.856444 | 50 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.153846 | false | false | 3 |
98649917f85b48a7d4a94766283492c86d2bdad1 | 34,634,616,281,435 | c2dd47d5e29bba6539996b0ab04bca1077ab35d5 | /app/src/main/java/cn/yyp/srs/adapter/SearchResFileAdapter.java | fabc9f78a07616af553514111cc2e2694768e020 | [] | no_license | yeaper/StudyResShare | https://github.com/yeaper/StudyResShare | cee6fd52c41fa39285f0509574f00540ada85237 | be544ce41f06a8b0de3cd8085d7ff98e87f317fa | refs/heads/master | 2020-03-11T17:15:05.599000 | 2018-04-21T13:32:49 | 2018-04-21T13:32:49 | 130,141,695 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cn.yyp.srs.adapter;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import butterknife.Bind;
import cn.yyp.srs.R;
import cn.yyp.srs.model.ResFile;
import cn.yyp.srs.model.i.DownloadResFileListener;
import cn.yyp.srs.util.FileUtil;
import cn.bmob.v3.datatype.BmobFile;
import cn.bmob.v3.exception.BmobException;
import cn.bmob.v3.listener.DownloadFileListener;
import cn.yyp.srs.util.Util;
/**
* 资源适配器
*/
public class SearchResFileAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>{
private List<ResFile> files = new ArrayList<>();
public void setDatas(List<ResFile> list) {
files.clear();
if (null != list) {
files.addAll(list);
notifyDataSetChanged();
}
}
public void clear(){
files.clear();
notifyDataSetChanged();
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
return new MyHolder(parent.getContext(), parent, onRecyclerViewListener);
}
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
((BaseViewHolder) holder).bindData(files.get(position));
}
@Override
public int getItemCount() {
return files.size();
}
public class MyHolder extends BaseViewHolder<ResFile>{
@Bind(R.id.res_file_name)
public TextView file_name;
@Bind(R.id.res_file_upload_time)
public TextView file_upload_time;
@Bind(R.id.res_file_download_count)
public TextView file_download_count;
@Bind(R.id.res_file_type)
TextView file_type;
@Bind(R.id.res_file_download)
public ImageView btn_file_download;
public MyHolder(Context context, ViewGroup root, OnRecyclerViewListener onRecyclerViewListener) {
super(context, root, R.layout.item_res_file, onRecyclerViewListener);
}
@Override
public void bindData(final ResFile resFile) {
file_name.setText(resFile.getFileName());
file_upload_time.setText(resFile.getUploadTime());
if(resFile.getDownloadCount() <= 0){
file_download_count.setVisibility(View.GONE);
}else if(resFile.getDownloadCount() < 100){
file_download_count.setVisibility(View.VISIBLE);
file_download_count.setText("已下载"+resFile.getDownloadCount()+"次");
}else{
file_download_count.setVisibility(View.VISIBLE );
file_download_count.setText("已下载99+次");
}
file_type.setText(FileUtil.getResTypeName(resFile.getResType()));
btn_file_download.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//下载文件
BmobFile bmobfile =new BmobFile(resFile.getFileName(), "", resFile.getFileUrl());
//允许设置下载文件的存储路径,默认下载文件的目录为:context.getApplicationContext().getCacheDir()+"/bmob/"
File saveFile = new File(Util.getSDPath()+"/StudyResShare/", resFile.getFileName());
bmobfile.download(saveFile, new DownloadFileListener() {
@Override
public void onStart() {
if(downloadResFileListener != null){
downloadResFileListener.downloadStart();
}
}
@Override
public void done(String savePath,BmobException e) {
if(e==null){
if(downloadResFileListener != null){
downloadResFileListener.downloadSuccess(savePath, resFile);
}
}else{
if(downloadResFileListener != null){
downloadResFileListener.downloadError(e.getMessage());
}
}
}
@Override
public void onProgress(Integer value, long newworkSpeed) {
if(downloadResFileListener != null){
downloadResFileListener.downloading(value);
}
}
});
}
});
}
}
private DownloadResFileListener downloadResFileListener;
private OnRecyclerViewListener onRecyclerViewListener;
public void setOnRecyclerViewListener(OnRecyclerViewListener onRecyclerViewListener) {
this.onRecyclerViewListener = onRecyclerViewListener;
}
public void setDownloadResFileListener(DownloadResFileListener downloadResFileListener) {
this.downloadResFileListener = downloadResFileListener;
}
}
| UTF-8 | Java | 5,278 | java | SearchResFileAdapter.java | Java | [] | null | [] | package cn.yyp.srs.adapter;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import butterknife.Bind;
import cn.yyp.srs.R;
import cn.yyp.srs.model.ResFile;
import cn.yyp.srs.model.i.DownloadResFileListener;
import cn.yyp.srs.util.FileUtil;
import cn.bmob.v3.datatype.BmobFile;
import cn.bmob.v3.exception.BmobException;
import cn.bmob.v3.listener.DownloadFileListener;
import cn.yyp.srs.util.Util;
/**
* 资源适配器
*/
public class SearchResFileAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>{
private List<ResFile> files = new ArrayList<>();
public void setDatas(List<ResFile> list) {
files.clear();
if (null != list) {
files.addAll(list);
notifyDataSetChanged();
}
}
public void clear(){
files.clear();
notifyDataSetChanged();
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
return new MyHolder(parent.getContext(), parent, onRecyclerViewListener);
}
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
((BaseViewHolder) holder).bindData(files.get(position));
}
@Override
public int getItemCount() {
return files.size();
}
public class MyHolder extends BaseViewHolder<ResFile>{
@Bind(R.id.res_file_name)
public TextView file_name;
@Bind(R.id.res_file_upload_time)
public TextView file_upload_time;
@Bind(R.id.res_file_download_count)
public TextView file_download_count;
@Bind(R.id.res_file_type)
TextView file_type;
@Bind(R.id.res_file_download)
public ImageView btn_file_download;
public MyHolder(Context context, ViewGroup root, OnRecyclerViewListener onRecyclerViewListener) {
super(context, root, R.layout.item_res_file, onRecyclerViewListener);
}
@Override
public void bindData(final ResFile resFile) {
file_name.setText(resFile.getFileName());
file_upload_time.setText(resFile.getUploadTime());
if(resFile.getDownloadCount() <= 0){
file_download_count.setVisibility(View.GONE);
}else if(resFile.getDownloadCount() < 100){
file_download_count.setVisibility(View.VISIBLE);
file_download_count.setText("已下载"+resFile.getDownloadCount()+"次");
}else{
file_download_count.setVisibility(View.VISIBLE );
file_download_count.setText("已下载99+次");
}
file_type.setText(FileUtil.getResTypeName(resFile.getResType()));
btn_file_download.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//下载文件
BmobFile bmobfile =new BmobFile(resFile.getFileName(), "", resFile.getFileUrl());
//允许设置下载文件的存储路径,默认下载文件的目录为:context.getApplicationContext().getCacheDir()+"/bmob/"
File saveFile = new File(Util.getSDPath()+"/StudyResShare/", resFile.getFileName());
bmobfile.download(saveFile, new DownloadFileListener() {
@Override
public void onStart() {
if(downloadResFileListener != null){
downloadResFileListener.downloadStart();
}
}
@Override
public void done(String savePath,BmobException e) {
if(e==null){
if(downloadResFileListener != null){
downloadResFileListener.downloadSuccess(savePath, resFile);
}
}else{
if(downloadResFileListener != null){
downloadResFileListener.downloadError(e.getMessage());
}
}
}
@Override
public void onProgress(Integer value, long newworkSpeed) {
if(downloadResFileListener != null){
downloadResFileListener.downloading(value);
}
}
});
}
});
}
}
private DownloadResFileListener downloadResFileListener;
private OnRecyclerViewListener onRecyclerViewListener;
public void setOnRecyclerViewListener(OnRecyclerViewListener onRecyclerViewListener) {
this.onRecyclerViewListener = onRecyclerViewListener;
}
public void setDownloadResFileListener(DownloadResFileListener downloadResFileListener) {
this.downloadResFileListener = downloadResFileListener;
}
}
| 5,278 | 0.586446 | 0.584521 | 143 | 35.321678 | 28.652145 | 105 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.48951 | false | false | 3 |
5ffa40155188de17197070aa6e50aa25805baad4 | 16,999,480,602,801 | df332d105faaedf23531bb1a1802b1803b20417e | /src/main/java/com/github/xemiru/sponge/boxboy/button/ScrollButton.java | 118fe0c77345062d4b48266211a547768bb943be | [
"MIT"
] | permissive | Xemiru/Boxboy | https://github.com/Xemiru/Boxboy | 7e275fd7511aeb90c0cd03332ca3e127aafb5baf | 7d91fe4ee579c9ac0dc11bc017df47aab7e0c14f | refs/heads/master | 2020-03-22T07:40:41.012000 | 2018-08-03T22:17:29 | 2018-08-03T22:17:29 | 139,717,159 | 2 | 1 | MIT | false | 2018-07-27T20:09:33 | 2018-07-04T12:09:26 | 2018-07-16T12:28:15 | 2018-07-27T20:09:32 | 216 | 2 | 1 | 1 | Java | false | null | /*
* MIT License
*
* Copyright (c) 2018 Tellerva, Marc Lawrence
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.github.xemiru.sponge.boxboy.button;
import com.github.xemiru.sponge.boxboy.util.Animation;
import com.github.xemiru.sponge.boxboy.util.ClickContext;
import com.github.xemiru.sponge.boxboy.util.ClickType;
import org.spongepowered.api.item.inventory.ItemStack;
import java.util.Optional;
/**
* A {@link Button} implementation that switches between a varying number of states defined provided
* {@link ActionButton}s.
*/
public class ScrollButton implements Button {
private int state;
private ActionButton[] buttons;
private ScrollButton() {
}
/**
* Creates a new {@link ScrollButton} with the default state of 0 and array of {@link ActionButton}s.
*
* @param buttons the buttons representing the states of the ScrollButton
* @return the ScrollButton
*/
public static ScrollButton of(ActionButton... buttons) {
return ScrollButton.of(0, buttons);
}
/**
* Creates a new {@link ScrollButton} with the given default state and array of {@link ActionButton}s.
*
* @param defaultState the default state of the ScrollButton
* @param buttons the buttons representing the states of the ScrollButton
* @return the ScrollButton
*/
public static ScrollButton of(int defaultState, ActionButton... buttons) {
ScrollButton btn = new ScrollButton();
btn.state = defaultState;
btn.buttons = buttons;
if (buttons.length < 3)
throw new IllegalArgumentException("Scroll button must have at least three state buttons (use Action or Toggle buttons instead)");
if (btn.state >= buttons.length)
throw new IllegalArgumentException("Scroll button default state out of bounds of provided button array");
return btn;
}
/**
* Returns the current state of this {@link ScrollButton} as an integer.
*
* @return the state of this ScrollButton
*/
public int getCurrentState() {
return this.state;
}
/**
* Returns the {@link ActionButton} assigned to the current state of this {@link ScrollButton}.
*
* @return the representative ActionButton of this ScrollButton's current state
*/
public ActionButton getCurrentStateButton() {
return this.buttons[this.state];
}
@Override
public ItemStack getRepresentative() {
return this.getCurrentStateButton().getRepresentative();
}
@Override
public Optional<Animation<ItemStack>> getAnimatedRepresentative() {
return this.getCurrentStateButton().getAnimatedRepresentative();
}
@Override
public void onClick(ClickContext context) {
ClickType type = context.getType();
if (type.isPrimary() || type.isSecondary()) {
if (type.isPrimary()) this.state++;
if (type.isSecondary()) this.state--;
if (this.state >= buttons.length) this.state = 0;
if (this.state <= -1) this.state = buttons.length - 1;
this.getCurrentStateButton().onClick(context);
context.getSourceMenu().invalidate();
}
}
}
| UTF-8 | Java | 4,266 | java | ScrollButton.java | Java | [
{
"context": "/*\n * MIT License\n *\n * Copyright (c) 2018 Tellerva, Marc Lawrence\n *\n * Permission is hereby granted",
"end": 51,
"score": 0.9857072234153748,
"start": 43,
"tag": "NAME",
"value": "Tellerva"
},
{
"context": "\n * MIT License\n *\n * Copyright (c) 2018 Tellerva, Ma... | null | [] | /*
* MIT License
*
* Copyright (c) 2018 Tellerva, <NAME>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.github.xemiru.sponge.boxboy.button;
import com.github.xemiru.sponge.boxboy.util.Animation;
import com.github.xemiru.sponge.boxboy.util.ClickContext;
import com.github.xemiru.sponge.boxboy.util.ClickType;
import org.spongepowered.api.item.inventory.ItemStack;
import java.util.Optional;
/**
* A {@link Button} implementation that switches between a varying number of states defined provided
* {@link ActionButton}s.
*/
public class ScrollButton implements Button {
private int state;
private ActionButton[] buttons;
private ScrollButton() {
}
/**
* Creates a new {@link ScrollButton} with the default state of 0 and array of {@link ActionButton}s.
*
* @param buttons the buttons representing the states of the ScrollButton
* @return the ScrollButton
*/
public static ScrollButton of(ActionButton... buttons) {
return ScrollButton.of(0, buttons);
}
/**
* Creates a new {@link ScrollButton} with the given default state and array of {@link ActionButton}s.
*
* @param defaultState the default state of the ScrollButton
* @param buttons the buttons representing the states of the ScrollButton
* @return the ScrollButton
*/
public static ScrollButton of(int defaultState, ActionButton... buttons) {
ScrollButton btn = new ScrollButton();
btn.state = defaultState;
btn.buttons = buttons;
if (buttons.length < 3)
throw new IllegalArgumentException("Scroll button must have at least three state buttons (use Action or Toggle buttons instead)");
if (btn.state >= buttons.length)
throw new IllegalArgumentException("Scroll button default state out of bounds of provided button array");
return btn;
}
/**
* Returns the current state of this {@link ScrollButton} as an integer.
*
* @return the state of this ScrollButton
*/
public int getCurrentState() {
return this.state;
}
/**
* Returns the {@link ActionButton} assigned to the current state of this {@link ScrollButton}.
*
* @return the representative ActionButton of this ScrollButton's current state
*/
public ActionButton getCurrentStateButton() {
return this.buttons[this.state];
}
@Override
public ItemStack getRepresentative() {
return this.getCurrentStateButton().getRepresentative();
}
@Override
public Optional<Animation<ItemStack>> getAnimatedRepresentative() {
return this.getCurrentStateButton().getAnimatedRepresentative();
}
@Override
public void onClick(ClickContext context) {
ClickType type = context.getType();
if (type.isPrimary() || type.isSecondary()) {
if (type.isPrimary()) this.state++;
if (type.isSecondary()) this.state--;
if (this.state >= buttons.length) this.state = 0;
if (this.state <= -1) this.state = buttons.length - 1;
this.getCurrentStateButton().onClick(context);
context.getSourceMenu().invalidate();
}
}
}
| 4,259 | 0.692218 | 0.689873 | 117 | 35.46154 | 33.212742 | 142 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.452991 | false | false | 3 |
d06979e7d92235a1c6aa2781128a62f7ee8f83bb | 10,806,137,756,896 | 016a594b54f984ec18d169afa8e666277710cd91 | /src/main/java/cn/applausewow/spring_final/service/TypeService.java | 6dfd38b8b5be14de713d3ab9b81169c0f247d269 | [] | no_license | ApplauseWow/SpringBoot_Fianl | https://github.com/ApplauseWow/SpringBoot_Fianl | 61ac3629fdee697d335de80cacd5d14bdd34e271 | 20e0b93136eb3f8978dae17400002b59e72b72a5 | refs/heads/master | 2022-01-19T01:41:22.878000 | 2019-06-26T01:08:22 | 2019-06-26T01:08:22 | 193,243,306 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cn.applausewow.spring_final.service;
import cn.applausewow.spring_final.bean.Type;
import cn.applausewow.spring_final.dao.TypeDao;
import org.springframework.stereotype.Service;
import java.util.List;
public interface TypeService {
List<Type> getAllTypes();
}
| UTF-8 | Java | 276 | java | TypeService.java | Java | [] | null | [] | package cn.applausewow.spring_final.service;
import cn.applausewow.spring_final.bean.Type;
import cn.applausewow.spring_final.dao.TypeDao;
import org.springframework.stereotype.Service;
import java.util.List;
public interface TypeService {
List<Type> getAllTypes();
}
| 276 | 0.797101 | 0.797101 | 12 | 22 | 19.79899 | 47 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 3 |
7f17abd3418587944f0e2aa47bdb1fa3a132e94c | 5,866,925,385,474 | b6602970c4e6d52df5da9ad2d1322f85acbf3574 | /bank/database/BalanceChecking.java | 85282395afa6bbe50bb5262a9b4b903cce9db5b4 | [] | no_license | Deepakkumar14/Bank.Database | https://github.com/Deepakkumar14/Bank.Database | d4d6512bc8f5c06933f5e634ad780cbc83d22552 | 265324ebf54498d47eb7f1d58984fe992d114f3a | refs/heads/main | 2023-06-24T18:51:51.154000 | 2021-07-22T18:53:13 | 2021-07-22T18:53:13 | 387,719,734 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package bank.database;
import java.util.Scanner;
public class BalanceChecking {
private static Scanner input;
public static void userChoice() throws Exception{
Boolean flag=true;
do {
System.out.println("1.Existing user-Need to check Balance");
System.out.println("2.Existing user-Need to add new account");
System.out.println("3.New Customer-Need to Enter both Customer and account details");
System.out.println("4. Exit");
System.out.println("");
input = new Scanner(System.in);
System.out.println("Enter your choice");
int choice = input.nextInt();
switch(choice){
case 1 :
DatabaseManagement.dataStorageInMap();
ValueRetrieval.retrieveValues();
System.out.println("");
break;
case 2 :
InsertAccountInfo.account_info();
DatabaseManagement.dataStorageInMap();
System.out.println("");
break;
case 3:
InsertCustomerInfo.customer_info();
DatabaseManagement.dataStorageInMap();
System.out.println("");
break;
case 4:
flag=false;
break;
default :
System.out.println("Enter valid choice");
break;
}
}while(flag);
}
}
| UTF-8 | Java | 1,254 | java | BalanceChecking.java | Java | [] | null | [] | package bank.database;
import java.util.Scanner;
public class BalanceChecking {
private static Scanner input;
public static void userChoice() throws Exception{
Boolean flag=true;
do {
System.out.println("1.Existing user-Need to check Balance");
System.out.println("2.Existing user-Need to add new account");
System.out.println("3.New Customer-Need to Enter both Customer and account details");
System.out.println("4. Exit");
System.out.println("");
input = new Scanner(System.in);
System.out.println("Enter your choice");
int choice = input.nextInt();
switch(choice){
case 1 :
DatabaseManagement.dataStorageInMap();
ValueRetrieval.retrieveValues();
System.out.println("");
break;
case 2 :
InsertAccountInfo.account_info();
DatabaseManagement.dataStorageInMap();
System.out.println("");
break;
case 3:
InsertCustomerInfo.customer_info();
DatabaseManagement.dataStorageInMap();
System.out.println("");
break;
case 4:
flag=false;
break;
default :
System.out.println("Enter valid choice");
break;
}
}while(flag);
}
}
| 1,254 | 0.617225 | 0.610845 | 53 | 21.660378 | 19.37509 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.716981 | false | false | 3 |
d398bed800be4087e96508b114e51a1a3c89e135 | 5,119,601,086,454 | 7ddf12279615118a19657111849c2da0fb56d662 | /src/test/java/abstractPackage/APIClass.java | e3514c5dfb0d433a21651a3d749021aaa824d93d | [] | no_license | TATJAVAAliakseiMialeshka/4FRAG-comm2 | https://github.com/TATJAVAAliakseiMialeshka/4FRAG-comm2 | c5d8cc17118002cf3fa49db7f1345ae15bb9c1a8 | fff14406a127f56ff17b30220ca9699774875976 | refs/heads/master | 2023-05-23T13:21:47.953000 | 2020-04-04T14:44:01 | 2020-04-04T14:44:01 | 253,006,925 | 0 | 0 | null | false | 2023-05-09T18:24:55 | 2020-04-04T13:41:26 | 2020-04-04T14:44:36 | 2023-05-09T18:24:52 | 41 | 0 | 0 | 1 | Java | false | false | package abstractPackage;
import org.openqa.selenium.WebDriver;
import static com.sun.xml.internal.ws.spi.db.BindingContextFactory.LOGGER;
//overall, this level of abstraction looks redundant. these methods could be just located in BasePageClass
public abstract class APIClass {
protected static WebDriver driver;
public abstract WebDriver getDriver();
public void open(String url) {
getDriver().get(url);
}
//remove unused delay method
public void delay(long millisec) {
try {
Thread.sleep(millisec);
} catch (InterruptedException e) {
LOGGER.info(e.getMessage());
}
}
public void maximizeWindow() {
driver.manage().window().maximize();
}
}
| UTF-8 | Java | 745 | java | APIClass.java | Java | [] | null | [] | package abstractPackage;
import org.openqa.selenium.WebDriver;
import static com.sun.xml.internal.ws.spi.db.BindingContextFactory.LOGGER;
//overall, this level of abstraction looks redundant. these methods could be just located in BasePageClass
public abstract class APIClass {
protected static WebDriver driver;
public abstract WebDriver getDriver();
public void open(String url) {
getDriver().get(url);
}
//remove unused delay method
public void delay(long millisec) {
try {
Thread.sleep(millisec);
} catch (InterruptedException e) {
LOGGER.info(e.getMessage());
}
}
public void maximizeWindow() {
driver.manage().window().maximize();
}
}
| 745 | 0.672483 | 0.672483 | 31 | 23.032259 | 24.492901 | 106 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.322581 | false | false | 3 |
270f141f0544c2841cebe32347747bb1012cd9c5 | 8,203,387,550,824 | 060aa44f58c4dd2314cfa4670e0a159e61999cc4 | /src/observable/example/ObservableExample.java | 2ccf27faf37d6a11348c0dd63401d1195c50f468 | [] | no_license | alexroyar/Java-Observer-Example | https://github.com/alexroyar/Java-Observer-Example | 400f7c2ad72488717bc247001063e5f9592a0bf4 | 0e9d1eb78abaa78ed4b6c89adec57263964040ea | refs/heads/master | 2021-01-13T02:22:29.046000 | 2014-04-07T08:03:59 | 2014-04-07T08:03:59 | 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 observable.example;
import java.util.Observable;
import java.util.Observer;
import java.util.Scanner;
/**
*
* @author alex
*/
public final class ObservableExample implements Observer{
ObservableList list = null;
Scanner sc = null;
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
new ObservableExample();
}
public ObservableExample(){
this.list = new ObservableList();
this.list.addObserver(this);
this.sc = new Scanner(System.in);
run();
}
public void run(){
String str = "";
while(!str.equalsIgnoreCase("exit")){
System.out.println("Add some String to list:");
str = this.sc.nextLine();
this.list.add(str);
}
}
@Override
public void update(Observable o, Object arg) {
System.out.println("Change detected");
}
}
| UTF-8 | Java | 1,148 | java | ObservableExample.java | Java | [
{
"context": "rver;\nimport java.util.Scanner;\n\n/**\n *\n * @author alex\n */\npublic final class ObservableExample implemen",
"end": 320,
"score": 0.9987274408340454,
"start": 316,
"tag": "USERNAME",
"value": "alex"
}
] | 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 observable.example;
import java.util.Observable;
import java.util.Observer;
import java.util.Scanner;
/**
*
* @author alex
*/
public final class ObservableExample implements Observer{
ObservableList list = null;
Scanner sc = null;
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
new ObservableExample();
}
public ObservableExample(){
this.list = new ObservableList();
this.list.addObserver(this);
this.sc = new Scanner(System.in);
run();
}
public void run(){
String str = "";
while(!str.equalsIgnoreCase("exit")){
System.out.println("Add some String to list:");
str = this.sc.nextLine();
this.list.add(str);
}
}
@Override
public void update(Observable o, Object arg) {
System.out.println("Change detected");
}
}
| 1,148 | 0.60453 | 0.60453 | 50 | 21.959999 | 19.776714 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false | 3 |
e4ae0b085b77fa278f6caad91c8ca3c7e02decb0 | 14,353,780,711,134 | 50a4f9e2aadfecaba1c785343312e181dc38dce8 | /src/net/andy/web/util/SelectorInfoData.java | f94332c9eddda362b1a5f76efc69ec42dabd9d87 | [] | no_license | andyzhou192/autocreatewebtestscript | https://github.com/andyzhou192/autocreatewebtestscript | b4eaaa1860cfb9ebfce704045bde9303aef1023e | 39f3d1656af776d09ee4ca5049a2eed6d3cbc82e | refs/heads/master | 2021-01-10T13:46:12.186000 | 2013-03-01T09:15:22 | 2013-03-01T09:15:22 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package net.andy.web.util;
import java.util.List;
import net.andy.web.elements.SelectorInfo;
public class SelectorInfoData {
private SelectorInfo si = new SelectorInfo();
private String pageUrlInput;
private String selectorInput;
private String selectorAliasInput;
private String checkedType;
private String introduceInput;
public List<SelectorInfoData> selectorInfoDataList;
public void setPageUrlInput(String pageURL) {
this.pageUrlInput = si.pageURLInput.getText();
}
public String getPageUrlInput() {
return pageUrlInput;
}
public void setSelectorInput(String selector) {
this.selectorInput = si.selectorInput.getText();
}
public String getSelectorInput() {
return selectorInput;
}
public void setSelectorAliasInput(String selectorAlias) {
this.selectorAliasInput = si.selectorAliasInput.getText();
}
public String getSelectorAliasInput() {
return selectorAliasInput;
}
public void setCheckedType(String checkType) {
this.checkedType = si.checkTypeList.getSelectedItem().toString();
}
public String getCheckedType() {
return checkedType;
}
public void setIntroduceInput(String introduce) {
this.introduceInput = si.introduceInput.getText();
}
public String getIntroduceInput() {
return introduceInput;
}
}
| UTF-8 | Java | 1,268 | java | SelectorInfoData.java | Java | [] | null | [] | package net.andy.web.util;
import java.util.List;
import net.andy.web.elements.SelectorInfo;
public class SelectorInfoData {
private SelectorInfo si = new SelectorInfo();
private String pageUrlInput;
private String selectorInput;
private String selectorAliasInput;
private String checkedType;
private String introduceInput;
public List<SelectorInfoData> selectorInfoDataList;
public void setPageUrlInput(String pageURL) {
this.pageUrlInput = si.pageURLInput.getText();
}
public String getPageUrlInput() {
return pageUrlInput;
}
public void setSelectorInput(String selector) {
this.selectorInput = si.selectorInput.getText();
}
public String getSelectorInput() {
return selectorInput;
}
public void setSelectorAliasInput(String selectorAlias) {
this.selectorAliasInput = si.selectorAliasInput.getText();
}
public String getSelectorAliasInput() {
return selectorAliasInput;
}
public void setCheckedType(String checkType) {
this.checkedType = si.checkTypeList.getSelectedItem().toString();
}
public String getCheckedType() {
return checkedType;
}
public void setIntroduceInput(String introduce) {
this.introduceInput = si.introduceInput.getText();
}
public String getIntroduceInput() {
return introduceInput;
}
}
| 1,268 | 0.777603 | 0.777603 | 50 | 24.360001 | 20.522924 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.4 | false | false | 3 |
517443da3b476ee963031ad7a95016c8a1fa52a1 | 14,353,780,708,481 | 7ca8ffcdfb39ab4ffc2d8ff291e46ffabc8db6a2 | /hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetNewReservationResponse.java | ccb22a4672264f6cab6c580753af41582414da40 | [
"CC-PDDC",
"CC0-1.0",
"CC-BY-3.0",
"LicenseRef-scancode-unknown-license-reference",
"LGPL-2.1-only",
"LicenseRef-scancode-other-permissive",
"CDDL-1.0",
"GCC-exception-3.1",
"MIT",
"EPL-1.0",
"Classpath-exception-2.0",
"BSD-3-Clause",
"GPL-2.0-only",
"Apache-2.0",
"LicenseRef-scancode-pu... | permissive | apache/hadoop | https://github.com/apache/hadoop | ea2a4a370dd00d4a3806dd38df5b3cf6fd5b2c64 | 42b4525f75b828bf58170187f030b08622e238ab | refs/heads/trunk | 2023-08-18T07:29:26.346000 | 2023-08-17T16:56:34 | 2023-08-17T16:56:34 | 23,418,517 | 16,088 | 10,600 | Apache-2.0 | false | 2023-09-14T16:59:38 | 2014-08-28T07:00:08 | 2023-09-14T13:02:57 | 2023-09-14T16:59:37 | 1,823,927 | 13,835 | 8,586 | 907 | Java | false | false | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.records.ReservationId;
import org.apache.hadoop.yarn.util.Records;
/**
* <p>The response sent by the <code>ResourceManager</code> to the client for
* a request to get a new {@link ReservationId} for submitting reservations.</p>
*
* <p>Clients can submit an reservation with the returned
* {@link ReservationId}.</p>
*
* {@code ApplicationClientProtocol#getNewReservation(GetNewReservationRequest)}
*/
@Public
@Unstable
public abstract class GetNewReservationResponse {
@Private
@Unstable
public static GetNewReservationResponse newInstance(
ReservationId reservationId) {
GetNewReservationResponse response =
Records.newRecord(GetNewReservationResponse.class);
response.setReservationId(reservationId);
return response;
}
/**
* Get a new {@link ReservationId} to be used to submit a reservation.
*
* @return a {@link ReservationId} representing the unique id to identify
* a reservation with which it was submitted.
*/
@Public
@Unstable
public abstract ReservationId getReservationId();
/**
* Set a new {@link ReservationId} to be used to submit a reservation.
*
* @param reservationId a {@link ReservationId} representing the unique id to
* identify a reservation with which it was submitted.
*/
@Private
@Unstable
public abstract void setReservationId(ReservationId reservationId);
}
| UTF-8 | Java | 2,489 | java | GetNewReservationResponse.java | Java | [] | null | [] | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.records.ReservationId;
import org.apache.hadoop.yarn.util.Records;
/**
* <p>The response sent by the <code>ResourceManager</code> to the client for
* a request to get a new {@link ReservationId} for submitting reservations.</p>
*
* <p>Clients can submit an reservation with the returned
* {@link ReservationId}.</p>
*
* {@code ApplicationClientProtocol#getNewReservation(GetNewReservationRequest)}
*/
@Public
@Unstable
public abstract class GetNewReservationResponse {
@Private
@Unstable
public static GetNewReservationResponse newInstance(
ReservationId reservationId) {
GetNewReservationResponse response =
Records.newRecord(GetNewReservationResponse.class);
response.setReservationId(reservationId);
return response;
}
/**
* Get a new {@link ReservationId} to be used to submit a reservation.
*
* @return a {@link ReservationId} representing the unique id to identify
* a reservation with which it was submitted.
*/
@Public
@Unstable
public abstract ReservationId getReservationId();
/**
* Set a new {@link ReservationId} to be used to submit a reservation.
*
* @param reservationId a {@link ReservationId} representing the unique id to
* identify a reservation with which it was submitted.
*/
@Private
@Unstable
public abstract void setReservationId(ReservationId reservationId);
}
| 2,489 | 0.752511 | 0.750904 | 70 | 34.557144 | 29.196201 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.228571 | false | false | 3 |
6afce828d7f437e314f752a956a8c26637544e55 | 15,470,472,202,710 | 2147e85d78248d394e190dc917585a2db542ecff | /iTreasuryEJB/src/com/iss/itreasury/settlement/clientmanage/bizdelegation/.svn/text-base/ClientManageDelegation.java.svn-base | 0a8a98f92518f096e06551085d907332c176d236 | [] | no_license | happyjianguo/itreasury | https://github.com/happyjianguo/itreasury | 20d012b34341802e5f3b51d6b0a5d5ebc730bb62 | 377c313223b64d9e87b32a20b4d993fc7834a45d | refs/heads/master | 2020-09-12T13:58:31.753000 | 2018-11-09T04:26:39 | 2018-11-09T04:26:39 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.iss.itreasury.settlement.clientmanage.bizdelegation;
import java.rmi.RemoteException;
import java.util.Collection;
import javax.ejb.CreateException;
import com.iss.itreasury.settlement.clientmanage.dao.Sett_ClientSealPicDAO;
import com.iss.itreasury.settlement.clientmanage.dataentity.ClientInfo;
import com.iss.itreasury.settlement.clientmanage.bizlogic.ClientManage;
import com.iss.itreasury.settlement.clientmanage.bizlogic.ClientManageHome;
import com.iss.itreasury.settlement.clientmanage.dataentity.QueryClientConditionInfo;
import com.iss.itreasury.util.Constant;
import com.iss.itreasury.util.EJBHomeFactory;
import com.iss.itreasury.util.IException;
import com.iss.itreasury.util.IRollbackException;
import com.iss.itreasury.util.Log4j;
public class ClientManageDelegation {
private Log4j log = new Log4j(Constant.ModuleType.SETTLEMENT, this);
private ClientManage clientManage;
public ClientManageDelegation() throws RemoteException
{
try
{
ClientManageHome home = (ClientManageHome) EJBHomeFactory.getFactory().lookUpHome(ClientManageHome.class);
clientManage = (ClientManage) home.create();
}
catch (RemoteException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (CreateException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (IException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
log.debug("ClientManageDelegation::Constructor 11!!!~");
}
public Collection findClientByCondition(QueryClientConditionInfo qcci) throws RemoteException, IRollbackException
{
Collection coll = null;
coll = clientManage.findClientByCondition(qcci);
return coll;
}
public ClientInfo findClientByID(long lClientID) throws RemoteException, IRollbackException
{
ClientInfo ci = new ClientInfo();
ci = clientManage.findClientByID(lClientID);
return ci;
}
public long deleteClient(long lClientID) throws RemoteException, IRollbackException
{
long lReturn = -1;
lReturn = clientManage.deleteClient(lClientID);
return lReturn;
}
public String getNewClientCode(long lOfficeID) throws RemoteException, IRollbackException
{
String strReturn = "";
strReturn = clientManage.getNewClientCode(lOfficeID);
return strReturn;
}
public long addClient(ClientInfo ci) throws RemoteException, IRollbackException
{
long lReturn = -1;
lReturn = clientManage.addClient(ci);
return lReturn;
}
public long updateClient(ClientInfo ci) throws RemoteException, IRollbackException
{
long lReturn = -1;
lReturn = clientManage.updateClient(ci);
return lReturn;
}
public Collection findClientSealPicByClientID(long lClientID)
{
Collection c = null;
try
{
Sett_ClientSealPicDAO dao = new Sett_ClientSealPicDAO();
c = dao.findByClientID(lClientID);
}
catch (Exception e)
{
e.printStackTrace();
}
return c;
}
}
| UTF-8 | Java | 2,886 | ClientManageDelegation.java.svn-base | Java | [] | null | [] | package com.iss.itreasury.settlement.clientmanage.bizdelegation;
import java.rmi.RemoteException;
import java.util.Collection;
import javax.ejb.CreateException;
import com.iss.itreasury.settlement.clientmanage.dao.Sett_ClientSealPicDAO;
import com.iss.itreasury.settlement.clientmanage.dataentity.ClientInfo;
import com.iss.itreasury.settlement.clientmanage.bizlogic.ClientManage;
import com.iss.itreasury.settlement.clientmanage.bizlogic.ClientManageHome;
import com.iss.itreasury.settlement.clientmanage.dataentity.QueryClientConditionInfo;
import com.iss.itreasury.util.Constant;
import com.iss.itreasury.util.EJBHomeFactory;
import com.iss.itreasury.util.IException;
import com.iss.itreasury.util.IRollbackException;
import com.iss.itreasury.util.Log4j;
public class ClientManageDelegation {
private Log4j log = new Log4j(Constant.ModuleType.SETTLEMENT, this);
private ClientManage clientManage;
public ClientManageDelegation() throws RemoteException
{
try
{
ClientManageHome home = (ClientManageHome) EJBHomeFactory.getFactory().lookUpHome(ClientManageHome.class);
clientManage = (ClientManage) home.create();
}
catch (RemoteException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (CreateException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (IException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
log.debug("ClientManageDelegation::Constructor 11!!!~");
}
public Collection findClientByCondition(QueryClientConditionInfo qcci) throws RemoteException, IRollbackException
{
Collection coll = null;
coll = clientManage.findClientByCondition(qcci);
return coll;
}
public ClientInfo findClientByID(long lClientID) throws RemoteException, IRollbackException
{
ClientInfo ci = new ClientInfo();
ci = clientManage.findClientByID(lClientID);
return ci;
}
public long deleteClient(long lClientID) throws RemoteException, IRollbackException
{
long lReturn = -1;
lReturn = clientManage.deleteClient(lClientID);
return lReturn;
}
public String getNewClientCode(long lOfficeID) throws RemoteException, IRollbackException
{
String strReturn = "";
strReturn = clientManage.getNewClientCode(lOfficeID);
return strReturn;
}
public long addClient(ClientInfo ci) throws RemoteException, IRollbackException
{
long lReturn = -1;
lReturn = clientManage.addClient(ci);
return lReturn;
}
public long updateClient(ClientInfo ci) throws RemoteException, IRollbackException
{
long lReturn = -1;
lReturn = clientManage.updateClient(ci);
return lReturn;
}
public Collection findClientSealPicByClientID(long lClientID)
{
Collection c = null;
try
{
Sett_ClientSealPicDAO dao = new Sett_ClientSealPicDAO();
c = dao.findByClientID(lClientID);
}
catch (Exception e)
{
e.printStackTrace();
}
return c;
}
}
| 2,886 | 0.776507 | 0.773735 | 98 | 28.44898 | 28.490286 | 114 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.928571 | false | false | 3 | |
0f21339dfb6e4e646a51c44dffdacd0c6fda9f14 | 15,427,522,593,900 | c728bc10e0a17b230f68fb85e7f03fe7fd9069b3 | /src/main/java/Player/Fighter/Knight.java | 863c68d0f4f1923037a7db851491150bd9d40e21 | [] | no_license | malkyx/w12_d4_lab_FantasyAdventure | https://github.com/malkyx/w12_d4_lab_FantasyAdventure | 354c0b797d9e3823512adf1a8fb3933657717fea | fea19c1334539c5bfa5b4254d221552fac04add1 | refs/heads/master | 2020-06-07T05:49:46.388000 | 2019-06-20T15:08:23 | 2019-06-20T15:08:23 | 192,941,014 | 0 | 0 | null | false | 2020-10-13T14:02:38 | 2019-06-20T15:05:44 | 2019-06-20T15:08:34 | 2020-10-13T14:02:36 | 20 | 0 | 0 | 1 | Java | false | false | package Player.Fighter;
import Player.Player;
public class Knight {
}
| UTF-8 | Java | 74 | java | Knight.java | Java | [] | null | [] | package Player.Fighter;
import Player.Player;
public class Knight {
}
| 74 | 0.743243 | 0.743243 | 8 | 8.25 | 10.413333 | 23 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | false | false | 3 |
8816daf65a324ac6e7bbb38b654ffcea7c2e27fd | 24,464,133,781,843 | 265154bed7ec3a922583bc120c8200577db458a9 | /AIFriender/app/src/main/java/com/avnhome/aifriender/Services/TwitterService.java | a5adaa28a21c1a23e1564671cc4a835b15b5f955 | [] | no_license | MINHTIENUIT/AIFrienderProject | https://github.com/MINHTIENUIT/AIFrienderProject | c233dad1e0e62e891491650156805672cc2f8983 | b288e7ccb988dabe2fe55fd55aa9f974bea4871d | refs/heads/master | 2020-09-14T06:39:59.538000 | 2019-12-17T17:05:11 | 2019-12-17T17:05:11 | 223,052,992 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.avnhome.aifriender.Services;
import com.twitter.sdk.android.core.models.User;
import java.util.List;
import retrofit2.Call;
import retrofit2.http.GET;
import retrofit2.http.Query;
public interface TwitterService {
@GET("/1.1/users/show.json")
Call<User> getUser(@Query("user_id")long userId);
@GET("/1.1/users/lookup.json")
Call<List<User>> lookupUser(@Query("screen_name") String twitterId);
}
| UTF-8 | Java | 429 | java | TwitterService.java | Java | [] | null | [] | package com.avnhome.aifriender.Services;
import com.twitter.sdk.android.core.models.User;
import java.util.List;
import retrofit2.Call;
import retrofit2.http.GET;
import retrofit2.http.Query;
public interface TwitterService {
@GET("/1.1/users/show.json")
Call<User> getUser(@Query("user_id")long userId);
@GET("/1.1/users/lookup.json")
Call<List<User>> lookupUser(@Query("screen_name") String twitterId);
}
| 429 | 0.729604 | 0.713287 | 18 | 22.833334 | 21.357409 | 72 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.444444 | false | false | 3 |
cfe8cff59b6a8174d14d0dc15866446a4b5f50ab | 27,934,467,358,111 | 0af166aae1af8629883a947a2be6d56484e0f05f | /OneStatementPerLine.java | a55caeb83bbc7c9746625ffa08906e1edff62d8f | [] | no_license | cordis-dev/cf-checkstyle-test | https://github.com/cordis-dev/cf-checkstyle-test | 21517359b48348bd4c3f50186a3a0182ccae52fe | 387ddecd4a733c3ec1e41887b80fc0e78ec68905 | refs/heads/master | 2021-01-01T16:15:55.283000 | 2018-08-28T15:48:47 | 2018-08-28T15:48:47 | 97,801,568 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.io.EOFException; import java.io.BufferedReader;
import java.util.Collections;
import java.util.LinkedHashSet;
| UTF-8 | Java | 122 | java | OneStatementPerLine.java | Java | [] | null | [] | import java.io.EOFException; import java.io.BufferedReader;
import java.util.Collections;
import java.util.LinkedHashSet;
| 122 | 0.836066 | 0.836066 | 3 | 39.666668 | 13.695092 | 59 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.333333 | false | false | 3 |
2584d7836ac5deafb0f4fd6ffc18e772c7f63a8a | 16,947,940,956,983 | e0f1d3ccc474a2bccc709206346ae3b173e7530f | /app/src/main/java/Bean/NoSubmitScanResult.java | dd6bf0d53ecc5e65731e467993e1792bb42ef883 | [
"Apache-2.0"
] | permissive | wd18535470628/NFCAPP | https://github.com/wd18535470628/NFCAPP | 4fa03a894203ca1b61b2eec4aab1715082b20e16 | 024704f07391bbdc475e4b35e3fbf4bf8925a206 | refs/heads/master | 2021-05-08T18:01:44.466000 | 2018-01-30T08:01:24 | 2018-01-30T08:01:24 | 119,495,379 | 3 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Bean;
import org.litepal.crud.DataSupport;
/**
* Created by Administrator on 2018/1/16 0016.
*/
public class NoSubmitScanResult extends DataSupport{
private int id;
private String time;
private String remark;
private String scanResult;
private String date;
private String username;
private String acunt;
private String finaldate;
private int pictures;
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public String getScanResult() {
return scanResult;
}
public void setScanResult(String scanResult) {
this.scanResult = scanResult;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getAcunt() {
return acunt;
}
public void setAcunt(String acunt) {
this.acunt = acunt;
}
public String getFinaldate() {
return finaldate;
}
public void setFinaldate(String finaldate) {
this.finaldate = finaldate;
}
public int getPictures() {
return pictures;
}
public void setPictures(int pictures) {
this.pictures = pictures;
}
}
| UTF-8 | Java | 1,682 | java | NoSubmitScanResult.java | Java | [
{
"context": "t org.litepal.crud.DataSupport;\n\n/**\n * Created by Administrator on 2018/1/16 0016.\n */\n\npublic class NoSubmitScan",
"end": 84,
"score": 0.6353583335876465,
"start": 71,
"tag": "USERNAME",
"value": "Administrator"
},
{
"context": "\n\n public String getUsername... | null | [] | package Bean;
import org.litepal.crud.DataSupport;
/**
* Created by Administrator on 2018/1/16 0016.
*/
public class NoSubmitScanResult extends DataSupport{
private int id;
private String time;
private String remark;
private String scanResult;
private String date;
private String username;
private String acunt;
private String finaldate;
private int pictures;
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public String getScanResult() {
return scanResult;
}
public void setScanResult(String scanResult) {
this.scanResult = scanResult;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getAcunt() {
return acunt;
}
public void setAcunt(String acunt) {
this.acunt = acunt;
}
public String getFinaldate() {
return finaldate;
}
public void setFinaldate(String finaldate) {
this.finaldate = finaldate;
}
public int getPictures() {
return pictures;
}
public void setPictures(int pictures) {
this.pictures = pictures;
}
}
| 1,682 | 0.60107 | 0.59453 | 92 | 17.282608 | 15.549588 | 52 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.315217 | false | false | 3 |
bbd907bf34c95c42288cc32d07eb426806fb368e | 21,071,109,614,871 | 3b916e2faf91a390b282f29e9876b2a174252366 | /projects/PRESS/src/com/press/healthguide/action/HealthGuideCatalogAction.java | 01ade920fc4d8023a618540d2bcdf62c2e8d4db2 | [] | no_license | KishoDai/Kisho | https://github.com/KishoDai/Kisho | 711d31ce64cf6c6873529701cee1a2a3c29da9da | da90223d42977568a39a1a4e1717c8889de74aa3 | refs/heads/master | 2020-05-05T02:56:52.190000 | 2014-05-28T15:25:09 | 2014-05-28T15:25:09 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.press.healthguide.action;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.press.comm.action.CatalogAction;
public class HealthGuideCatalogAction extends CatalogAction {
private static Logger logger = LoggerFactory.getLogger(HealthGuideCatalogAction.class);
}
| UTF-8 | Java | 313 | java | HealthGuideCatalogAction.java | Java | [] | null | [] | package com.press.healthguide.action;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.press.comm.action.CatalogAction;
public class HealthGuideCatalogAction extends CatalogAction {
private static Logger logger = LoggerFactory.getLogger(HealthGuideCatalogAction.class);
}
| 313 | 0.789137 | 0.782748 | 14 | 20.357143 | 27.280571 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | false | false | 3 |
8443fcd40178e9ae9c7f6382dc84342a393bf71f | 2,929,167,702,953 | ca9c91c46ee8bdfa65f377264d83993421f61fdb | /src/main/java/com/hmiter/common/cache/helper/CacheHelper.java | d439699d2b15453dd7bae4192ed1c5b078c282b2 | [] | no_license | hmiter/ssh | https://github.com/hmiter/ssh | 8a5685c02b9d114b07eed7aeb9b7b464f96063bf | c8119dbd21f88ba9c644d56fd07c469b8b9bd52f | refs/heads/master | 2016-09-06T16:11:15.696000 | 2015-03-18T13:14:03 | 2015-03-18T13:14:03 | 32,396,526 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.hmiter.common.cache.helper;
public abstract class CacheHelper {
protected abstract CacheHelper getInstance();
protected abstract void initLoader();
}
| UTF-8 | Java | 170 | java | CacheHelper.java | Java | [] | null | [] | package com.hmiter.common.cache.helper;
public abstract class CacheHelper {
protected abstract CacheHelper getInstance();
protected abstract void initLoader();
}
| 170 | 0.782353 | 0.782353 | 9 | 17.888889 | 19.518906 | 46 | true | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.777778 | false | false | 3 |
dfdd2cf22b8180d0bac3be1f1890b8c587464581 | 7,138,235,654,650 | 3d8559114bad929a6b08e12a769824aaf6d8fac7 | /app/src/main/java/com/grace/book/http/response/UserInfo.java | 2472500b55aa676405bcf908af812874dba68973 | [] | no_license | chenxb1988/GraceBookAndroid | https://github.com/chenxb1988/GraceBookAndroid | f67a0edf57c87afc2342b76edcdeb91b0af0be97 | 84b0fdc9013855d4346409849b4731c3b7356694 | refs/heads/master | 2021-06-16T16:48:05.459000 | 2017-04-25T10:03:59 | 2017-04-25T10:03:59 | 78,624,053 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.grace.book.http.response;
/**
* Created by chenxb
* 17/2/17.
*/
public class UserInfo extends BaseResponse{
private String UserId;
private String UserName;
private String RealName;
private String Mobile;
private String Avatar;
private int Gender;
private String Email;
private String Birthday;
private String GroupId;
private String GroupName;
private String ChurchId;
private String ChurchName;
public String getUserId() {
return UserId;
}
public void setUserId(String UserId) {
this.UserId = UserId;
}
public String getUserName() {
return UserName;
}
public void setUserName(String UserName) {
this.UserName = UserName;
}
public String getRealName() {
return RealName;
}
public void setRealName(String RealName) {
this.RealName = RealName;
}
public String getMobile() {
return Mobile;
}
public void setMobile(String Mobile) {
this.Mobile = Mobile;
}
public String getAvatar() {
return Avatar;
}
public void setAvatar(String Avatar) {
this.Avatar = Avatar;
}
public int getGender() {
return Gender;
}
public void setGender(int Gender) {
this.Gender = Gender;
}
public String getEmail() {
return Email;
}
public void setEmail(String Email) {
this.Email = Email;
}
public String getBirthday() {
return Birthday;
}
public void setBirthday(String Birthday) {
this.Birthday = Birthday;
}
public String getGroupId() {
return GroupId;
}
public void setGroupId(String GroupId) {
this.GroupId = GroupId;
}
public String getGroupName() {
return GroupName;
}
public void setGroupName(String GroupName) {
this.GroupName = GroupName;
}
public String getChurchId() {
return ChurchId;
}
public void setChurchId(String churchId) {
ChurchId = churchId;
}
public String getChurchName() {
return ChurchName;
}
public void setChurchName(String churchName) {
ChurchName = churchName;
}
}
| UTF-8 | Java | 2,242 | java | UserInfo.java | Java | [
{
"context": "e com.grace.book.http.response;\n\n/**\n * Created by chenxb\n * 17/2/17.\n */\n\npublic class UserInfo extends Ba",
"end": 63,
"score": 0.9996779561042786,
"start": 57,
"tag": "USERNAME",
"value": "chenxb"
}
] | null | [] | package com.grace.book.http.response;
/**
* Created by chenxb
* 17/2/17.
*/
public class UserInfo extends BaseResponse{
private String UserId;
private String UserName;
private String RealName;
private String Mobile;
private String Avatar;
private int Gender;
private String Email;
private String Birthday;
private String GroupId;
private String GroupName;
private String ChurchId;
private String ChurchName;
public String getUserId() {
return UserId;
}
public void setUserId(String UserId) {
this.UserId = UserId;
}
public String getUserName() {
return UserName;
}
public void setUserName(String UserName) {
this.UserName = UserName;
}
public String getRealName() {
return RealName;
}
public void setRealName(String RealName) {
this.RealName = RealName;
}
public String getMobile() {
return Mobile;
}
public void setMobile(String Mobile) {
this.Mobile = Mobile;
}
public String getAvatar() {
return Avatar;
}
public void setAvatar(String Avatar) {
this.Avatar = Avatar;
}
public int getGender() {
return Gender;
}
public void setGender(int Gender) {
this.Gender = Gender;
}
public String getEmail() {
return Email;
}
public void setEmail(String Email) {
this.Email = Email;
}
public String getBirthday() {
return Birthday;
}
public void setBirthday(String Birthday) {
this.Birthday = Birthday;
}
public String getGroupId() {
return GroupId;
}
public void setGroupId(String GroupId) {
this.GroupId = GroupId;
}
public String getGroupName() {
return GroupName;
}
public void setGroupName(String GroupName) {
this.GroupName = GroupName;
}
public String getChurchId() {
return ChurchId;
}
public void setChurchId(String churchId) {
ChurchId = churchId;
}
public String getChurchName() {
return ChurchName;
}
public void setChurchName(String churchName) {
ChurchName = churchName;
}
}
| 2,242 | 0.608831 | 0.606601 | 118 | 18 | 15.602042 | 50 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.313559 | false | false | 3 |
192110cdd3e34193464e3de209f2dd79b81b603c | 8,581,344,662,646 | 87779a2794fcff2e7ddca6ed8a342e9ac641552a | /Brad2Java/src/tw/brad/apps/Brad45.java | a4d5957e828393aa218c02e5a7b20ac1e2b50c43 | [] | no_license | bradchao/FSIT06_Java | https://github.com/bradchao/FSIT06_Java | 62ad04ef536666b696e9af3ec417ac1eded80800 | cb7c0c2a2be41dabb27b927a457f1454885db6eb | refs/heads/master | 2020-05-27T06:02:42.102000 | 2019-07-06T01:07:50 | 2019-07-06T01:07:50 | 188,512,942 | 2 | 4 | null | null | null | null | null | null | null | null | null | null | null | null | null | package tw.brad.apps;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.Properties;
public class Brad45 {
public static void main(String[] args) {
try {
Properties prop = new Properties();
prop.put("user", "root");
prop.put("password", "root");
prop.put("serverTimezone", "Asia/Taipei");
Connection conn = DriverManager.getConnection(
"jdbc:mysql://localhost:3307/cust",
prop);
PreparedStatement pstmt = conn.prepareStatement(
"INSERT INTO brad (cname,tel,birthday) VALUES (?,?,?)");
for (int i=0; i<10; i++) {
pstmt.setString(1, "Alen" + (int)(Math.random()*100));
pstmt.setString(2, "222");
pstmt.setString(3, "1909-09-08");
pstmt.executeUpdate();
}
System.out.println("OK");
} catch (Exception e) {
System.out.println(e.toString());
}
}
}
| UTF-8 | Java | 980 | java | Brad45.java | Java | [
{
"context": "op.put(\"user\", \"root\");\r\n\t\t\tprop.put(\"password\", \"root\");\r\n\t\t\tprop.put(\"serverTimezone\", \"Asia/Taipei\");",
"end": 386,
"score": 0.9994808435440063,
"start": 382,
"tag": "PASSWORD",
"value": "root"
}
] | null | [] | package tw.brad.apps;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.Properties;
public class Brad45 {
public static void main(String[] args) {
try {
Properties prop = new Properties();
prop.put("user", "root");
prop.put("password", "<PASSWORD>");
prop.put("serverTimezone", "Asia/Taipei");
Connection conn = DriverManager.getConnection(
"jdbc:mysql://localhost:3307/cust",
prop);
PreparedStatement pstmt = conn.prepareStatement(
"INSERT INTO brad (cname,tel,birthday) VALUES (?,?,?)");
for (int i=0; i<10; i++) {
pstmt.setString(1, "Alen" + (int)(Math.random()*100));
pstmt.setString(2, "222");
pstmt.setString(3, "1909-09-08");
pstmt.executeUpdate();
}
System.out.println("OK");
} catch (Exception e) {
System.out.println(e.toString());
}
}
}
| 986 | 0.630612 | 0.604082 | 38 | 23.789474 | 17.574141 | 61 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.868421 | false | false | 3 |
d4323cc2726e9052bcad8ca7038dcb2e9688e100 | 12,721,693,139,526 | 651c57e8e8ea2710b6a1a80490f6949eb803ab27 | /PortalServices/portal-data-service/src/main/java/com/nisum/portal/data/dao/api/ComponentsRoleMappingDAO.java | d775da41c618238742aa46ead5b1ad6b99e811fe | [] | no_license | srilakshmivemulapalli/portal | https://github.com/srilakshmivemulapalli/portal | d23d7b18ca33e87c077445c21befa8628b82cb0e | 6a58c8cd5b71d32805e5b18bdf6c83e0ef986d73 | refs/heads/master | 2021-08-18T17:35:35.746000 | 2017-11-22T11:34:16 | 2017-11-22T11:34:16 | 111,812,234 | 0 | 0 | null | true | 2017-11-23T13:23:23 | 2017-11-23T13:23:23 | 2017-10-31T05:07:57 | 2017-11-22T11:34:28 | 9,668 | 0 | 0 | 0 | null | false | null | package com.nisum.portal.data.dao.api;
import java.util.List;
import com.nisum.portal.data.domain.ComponentsRoleMapping;
/**
* @author nisum
*
*/
public interface ComponentsRoleMappingDAO {
public List<ComponentsRoleMapping> fetchComponentsRolesAccess();
public void updateComponentsRolesAccess(ComponentsRoleMapping componentsRoleMapping);
List<ComponentsRoleMapping> updateComponentsRolesAccess(List<ComponentsRoleMapping> componentsRoleMappingList);
}
| UTF-8 | Java | 466 | java | ComponentsRoleMappingDAO.java | Java | [
{
"context": "data.domain.ComponentsRoleMapping;\n\n/**\n * @author nisum\n *\n */\npublic interface ComponentsRoleMappingDAO ",
"end": 144,
"score": 0.9996154308319092,
"start": 139,
"tag": "USERNAME",
"value": "nisum"
}
] | null | [] | package com.nisum.portal.data.dao.api;
import java.util.List;
import com.nisum.portal.data.domain.ComponentsRoleMapping;
/**
* @author nisum
*
*/
public interface ComponentsRoleMappingDAO {
public List<ComponentsRoleMapping> fetchComponentsRolesAccess();
public void updateComponentsRolesAccess(ComponentsRoleMapping componentsRoleMapping);
List<ComponentsRoleMapping> updateComponentsRolesAccess(List<ComponentsRoleMapping> componentsRoleMappingList);
}
| 466 | 0.832618 | 0.832618 | 16 | 28.125 | 34.396358 | 112 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.625 | false | false | 3 |
f2f41a43793a10a86004c58ec766e72e4263a8d7 | 10,617,159,169,720 | 5ec4fede66afbe83464253027b498bb78f4f8a36 | /src/com/线程/常用方法/StopThread.java | 34c9fcbf61cae2fb3c0ca2a9a8c292a4e8578c63 | [] | no_license | jinyou123/one | https://github.com/jinyou123/one | ffd11ac176d1e663f8423bd1874d6b4204215891 | 6acd46dda02b6916d45dd857cf6356d6ba8283d0 | refs/heads/master | 2023-07-08T23:41:00.868000 | 2021-08-10T06:05:38 | 2021-08-10T06:05:38 | 388,472,149 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.线程.常用方法;
public class StopThread {
public static void main(String[] args) {
Thread3 t1 = new Thread3();
t1.start();
for (int i = 1; i < 20; i++) {
System.out.println( "main:" + i );
//制作条件,终止线程
if(i%10==0){
t1.setFlag( false );
System.out.println("我终止了线程....");
}
try {
Thread.sleep( 1000 );
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
class Thread3 extends Thread {
private boolean flag = true;//定义一个标识,判断循环是否需要终止
public void setFlag(boolean flag) {
this.flag = flag;
}
@Override
public void run() {
while (flag) {
System.out.println( "say hello!" );
try {
Thread.sleep( 1000 );
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
| UTF-8 | Java | 1,074 | java | StopThread.java | Java | [] | null | [] | package com.线程.常用方法;
public class StopThread {
public static void main(String[] args) {
Thread3 t1 = new Thread3();
t1.start();
for (int i = 1; i < 20; i++) {
System.out.println( "main:" + i );
//制作条件,终止线程
if(i%10==0){
t1.setFlag( false );
System.out.println("我终止了线程....");
}
try {
Thread.sleep( 1000 );
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
class Thread3 extends Thread {
private boolean flag = true;//定义一个标识,判断循环是否需要终止
public void setFlag(boolean flag) {
this.flag = flag;
}
@Override
public void run() {
while (flag) {
System.out.println( "say hello!" );
try {
Thread.sleep( 1000 );
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
| 1,074 | 0.453908 | 0.433868 | 43 | 22.209303 | 16.440956 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.348837 | false | false | 3 |
a044658037664f0c1bec063fdc98f5a0269be541 | 1,434,519,089,158 | 27b213edfc6ec01e836d5f1b02999aa5a7f73a39 | /src/main/java/com/booking/tenniscourt/controller/ScheduleController.java | 6e9edc0332350e98ba1e0df11f2b707c5b8de41a | [] | no_license | teodortud/tennis-court-platform | https://github.com/teodortud/tennis-court-platform | 3b4cac1fe71f7ba5019ab3fa22da47efe8dd19d5 | 9e629d9f5de62da6630cbf0bb7d828585e0073f0 | refs/heads/master | 2023-07-12T22:22:01.175000 | 2021-08-19T14:01:07 | 2021-08-19T14:01:07 | 396,489,590 | 0 | 0 | null | false | 2021-08-19T14:01:08 | 2021-08-15T20:44:05 | 2021-08-17T21:32:23 | 2021-08-19T14:01:07 | 83 | 0 | 0 | 0 | Java | false | false | package com.booking.tenniscourt.controller;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class ScheduleController {
}
| UTF-8 | Java | 161 | java | ScheduleController.java | Java | [] | null | [] | package com.booking.tenniscourt.controller;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class ScheduleController {
}
| 161 | 0.84472 | 0.84472 | 7 | 22 | 22.740776 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.285714 | false | false | 3 |
1cc8b01c887554664d7ae5948e100e8243a6316a | 22,196,390,995,728 | d0c24456c83b2e40f15bcb894fe109fa8f9684e0 | /src/hangman/HungPersonDisplay.java | 7714cffab9afb1d3f9a8c8431ad6a7dac7a52ff4 | [
"MIT"
] | permissive | evankenyon/cs307-hangman-game | https://github.com/evankenyon/cs307-hangman-game | 22f13b6ab34ffe148139072defe97f61d848b165 | e025974574640012814e0f4ed82b900774d3d25f | refs/heads/master | 2023-08-18T20:27:35.311000 | 2021-09-13T04:59:56 | 2021-09-13T04:59:56 | 404,175,204 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package hangman;
import javafx.scene.Group;
import javafx.scene.Node;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.scene.shape.Line;
import runner.Main;
import java.util.HashMap;
import java.util.Map;
/**
* Purpose: Represent a hung person display for a hangman game
* Assumptions: guessesToBodyPart only has Nodes for keys 0-7 (inclusive)
* Dependencies: HashMap, Map, Main, JavaFX
* Example: Construct a HungPersonDisplay to use in HangmanGame. In HangmanGame, there is
* a method that calls getBodyPart with the guesser's guesses and adds the returned body
* part to ths scene. Also, HangmanGame calls setupGallowsDisplay at the beginning of the game
* to add the gallows Group to the scene.
*/
public class HungPersonDisplay {
public static final int BOTTOM_GALLOWS_START_X = Main.SIZE/2 - 200;
public static final int BOTTOM_GALLOWS_END_X = Main.SIZE/2 - 100;
public static final int BOTTOM_GALLOWS_Y = Main.SIZE/2 + 100;
public static final int VERTICAL_GALLOWS_X = (BOTTOM_GALLOWS_START_X + BOTTOM_GALLOWS_END_X)/2;
public static final int VERTICAL_GALLOWS_END_Y = BOTTOM_GALLOWS_Y - 250;
public static final int TOP_GALLOWS_END_X = VERTICAL_GALLOWS_X + 100;
public static final int ROPE_GALLOWS_END_Y = VERTICAL_GALLOWS_END_Y + 50;
public static final int HEAD_OFFSET_Y = 25;
public static final int BODY_TOP_OFFSET_Y = 50;
public static final int ARM_OFFSET_Y = 65;
public static final int LEG_OFFSET_Y = 125;
public static final int LIMB_END_OFFSET = 25;
public static final int LETTER_X_OFFSET_X_ONE = 10;
public static final int LETTER_X_OFFSET_X_TWO = 5;
public static final int LETTER_X_OFFSET_Y_ONE = 15;
public static final int LETTER_X_OFFSET_Y_TWO = 25;
private Map<Integer, Node> guessesToBodyPart;
/**
* Purpose: Construct a HungPersonDisplay object. Specifically, adds
* relevant Nodes to hashmap with the number of guesses left when they should
* be drawn as the key
* Assumptions: The constants are changed in accordance with one another to ensure
* everything fits together well (i.e. the head shouldn't be disproportionately larger than
* the body or far away from the gallows themselves)
*/
public HungPersonDisplay() {
guessesToBodyPart = new HashMap<>();
guessesToBodyPart.put(7, new Circle(TOP_GALLOWS_END_X, ROPE_GALLOWS_END_Y + HEAD_OFFSET_Y, HEAD_OFFSET_Y));
guessesToBodyPart.put(6, new Line(TOP_GALLOWS_END_X, ROPE_GALLOWS_END_Y + BODY_TOP_OFFSET_Y, TOP_GALLOWS_END_X, ROPE_GALLOWS_END_Y + BODY_TOP_OFFSET_Y + 75));
guessesToBodyPart.put(5, new Line(TOP_GALLOWS_END_X, ROPE_GALLOWS_END_Y + ARM_OFFSET_Y, TOP_GALLOWS_END_X - LIMB_END_OFFSET, ROPE_GALLOWS_END_Y + ARM_OFFSET_Y + LIMB_END_OFFSET));
guessesToBodyPart.put(4, new Line(TOP_GALLOWS_END_X, ROPE_GALLOWS_END_Y + ARM_OFFSET_Y, TOP_GALLOWS_END_X + LIMB_END_OFFSET, ROPE_GALLOWS_END_Y + ARM_OFFSET_Y + LIMB_END_OFFSET));
guessesToBodyPart.put(3, new Line(TOP_GALLOWS_END_X, ROPE_GALLOWS_END_Y + LEG_OFFSET_Y, TOP_GALLOWS_END_X - LIMB_END_OFFSET, ROPE_GALLOWS_END_Y + LEG_OFFSET_Y + LIMB_END_OFFSET));
guessesToBodyPart.put(2, new Line(TOP_GALLOWS_END_X, ROPE_GALLOWS_END_Y + LEG_OFFSET_Y, TOP_GALLOWS_END_X + LIMB_END_OFFSET, ROPE_GALLOWS_END_Y + LEG_OFFSET_Y + LIMB_END_OFFSET));
produceLeftX();
produceRightX();
}
/**
* Purpose: Get the body part corresponding to the number of guesses the guesser has left
* in order for the HangmanGame class to add the Node to the scene
* Assumptions: numGuessesLeft represents the number of guesses the player has left, is not
* the same between function calls within the same run of the program, and is not more than 7
* or less than 0
* @param numGuessesLeft the number of guesses the player has left
* @return the Node to add to the scene in HangmanGame
*/
public Node getBodyPart(int numGuessesLeft) {
return guessesToBodyPart.get(numGuessesLeft);
}
/**
* Purpose: Set up the gallows themselves at the game's beginning
* Assumptions: Only called once by HangmanGame at the beginning of the game
* @return a Group consisting of the Lines that make up gallows
*/
public Group setupGallowsDisplay() {
Line bottomGallows = new Line(BOTTOM_GALLOWS_START_X, BOTTOM_GALLOWS_Y, BOTTOM_GALLOWS_END_X, BOTTOM_GALLOWS_Y);
Line verticalGallows = new Line(VERTICAL_GALLOWS_X, BOTTOM_GALLOWS_Y, VERTICAL_GALLOWS_X, VERTICAL_GALLOWS_END_Y);
Line topGallows = new Line(VERTICAL_GALLOWS_X, VERTICAL_GALLOWS_END_Y, TOP_GALLOWS_END_X, VERTICAL_GALLOWS_END_Y);
Line ropeGallows = new Line(TOP_GALLOWS_END_X, VERTICAL_GALLOWS_END_Y, TOP_GALLOWS_END_X, ROPE_GALLOWS_END_Y);
return new Group(bottomGallows, verticalGallows, topGallows, ropeGallows);
}
private void produceLeftX() {
Line leftXOne = new Line(TOP_GALLOWS_END_X - LETTER_X_OFFSET_X_ONE, ROPE_GALLOWS_END_Y + LETTER_X_OFFSET_Y_ONE, TOP_GALLOWS_END_X - LETTER_X_OFFSET_X_TWO, ROPE_GALLOWS_END_Y + LETTER_X_OFFSET_Y_TWO);
Line leftXTwo = new Line(TOP_GALLOWS_END_X - LETTER_X_OFFSET_X_ONE, ROPE_GALLOWS_END_Y + LETTER_X_OFFSET_Y_TWO, TOP_GALLOWS_END_X - LETTER_X_OFFSET_X_TWO, ROPE_GALLOWS_END_Y + LETTER_X_OFFSET_Y_ONE);
leftXOne.setStroke(Color.RED);
leftXTwo.setStroke(Color.RED);
guessesToBodyPart.put(1, new Group(leftXOne, leftXTwo));
}
private void produceRightX() {
Line rightXOne = new Line(TOP_GALLOWS_END_X + LETTER_X_OFFSET_X_TWO, ROPE_GALLOWS_END_Y + LETTER_X_OFFSET_Y_ONE, TOP_GALLOWS_END_X + LETTER_X_OFFSET_X_ONE, ROPE_GALLOWS_END_Y + LETTER_X_OFFSET_Y_TWO);
Line rightXTwo = new Line(TOP_GALLOWS_END_X + LETTER_X_OFFSET_X_TWO, ROPE_GALLOWS_END_Y + LETTER_X_OFFSET_Y_TWO, TOP_GALLOWS_END_X + LETTER_X_OFFSET_X_ONE, ROPE_GALLOWS_END_Y + LETTER_X_OFFSET_Y_ONE);
rightXOne.setStroke(Color.RED);
rightXTwo.setStroke(Color.RED);
guessesToBodyPart.put(0, new Group(rightXOne, rightXTwo));
}
}
| UTF-8 | Java | 6,143 | java | HungPersonDisplay.java | Java | [] | null | [] | package hangman;
import javafx.scene.Group;
import javafx.scene.Node;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.scene.shape.Line;
import runner.Main;
import java.util.HashMap;
import java.util.Map;
/**
* Purpose: Represent a hung person display for a hangman game
* Assumptions: guessesToBodyPart only has Nodes for keys 0-7 (inclusive)
* Dependencies: HashMap, Map, Main, JavaFX
* Example: Construct a HungPersonDisplay to use in HangmanGame. In HangmanGame, there is
* a method that calls getBodyPart with the guesser's guesses and adds the returned body
* part to ths scene. Also, HangmanGame calls setupGallowsDisplay at the beginning of the game
* to add the gallows Group to the scene.
*/
public class HungPersonDisplay {
public static final int BOTTOM_GALLOWS_START_X = Main.SIZE/2 - 200;
public static final int BOTTOM_GALLOWS_END_X = Main.SIZE/2 - 100;
public static final int BOTTOM_GALLOWS_Y = Main.SIZE/2 + 100;
public static final int VERTICAL_GALLOWS_X = (BOTTOM_GALLOWS_START_X + BOTTOM_GALLOWS_END_X)/2;
public static final int VERTICAL_GALLOWS_END_Y = BOTTOM_GALLOWS_Y - 250;
public static final int TOP_GALLOWS_END_X = VERTICAL_GALLOWS_X + 100;
public static final int ROPE_GALLOWS_END_Y = VERTICAL_GALLOWS_END_Y + 50;
public static final int HEAD_OFFSET_Y = 25;
public static final int BODY_TOP_OFFSET_Y = 50;
public static final int ARM_OFFSET_Y = 65;
public static final int LEG_OFFSET_Y = 125;
public static final int LIMB_END_OFFSET = 25;
public static final int LETTER_X_OFFSET_X_ONE = 10;
public static final int LETTER_X_OFFSET_X_TWO = 5;
public static final int LETTER_X_OFFSET_Y_ONE = 15;
public static final int LETTER_X_OFFSET_Y_TWO = 25;
private Map<Integer, Node> guessesToBodyPart;
/**
* Purpose: Construct a HungPersonDisplay object. Specifically, adds
* relevant Nodes to hashmap with the number of guesses left when they should
* be drawn as the key
* Assumptions: The constants are changed in accordance with one another to ensure
* everything fits together well (i.e. the head shouldn't be disproportionately larger than
* the body or far away from the gallows themselves)
*/
public HungPersonDisplay() {
guessesToBodyPart = new HashMap<>();
guessesToBodyPart.put(7, new Circle(TOP_GALLOWS_END_X, ROPE_GALLOWS_END_Y + HEAD_OFFSET_Y, HEAD_OFFSET_Y));
guessesToBodyPart.put(6, new Line(TOP_GALLOWS_END_X, ROPE_GALLOWS_END_Y + BODY_TOP_OFFSET_Y, TOP_GALLOWS_END_X, ROPE_GALLOWS_END_Y + BODY_TOP_OFFSET_Y + 75));
guessesToBodyPart.put(5, new Line(TOP_GALLOWS_END_X, ROPE_GALLOWS_END_Y + ARM_OFFSET_Y, TOP_GALLOWS_END_X - LIMB_END_OFFSET, ROPE_GALLOWS_END_Y + ARM_OFFSET_Y + LIMB_END_OFFSET));
guessesToBodyPart.put(4, new Line(TOP_GALLOWS_END_X, ROPE_GALLOWS_END_Y + ARM_OFFSET_Y, TOP_GALLOWS_END_X + LIMB_END_OFFSET, ROPE_GALLOWS_END_Y + ARM_OFFSET_Y + LIMB_END_OFFSET));
guessesToBodyPart.put(3, new Line(TOP_GALLOWS_END_X, ROPE_GALLOWS_END_Y + LEG_OFFSET_Y, TOP_GALLOWS_END_X - LIMB_END_OFFSET, ROPE_GALLOWS_END_Y + LEG_OFFSET_Y + LIMB_END_OFFSET));
guessesToBodyPart.put(2, new Line(TOP_GALLOWS_END_X, ROPE_GALLOWS_END_Y + LEG_OFFSET_Y, TOP_GALLOWS_END_X + LIMB_END_OFFSET, ROPE_GALLOWS_END_Y + LEG_OFFSET_Y + LIMB_END_OFFSET));
produceLeftX();
produceRightX();
}
/**
* Purpose: Get the body part corresponding to the number of guesses the guesser has left
* in order for the HangmanGame class to add the Node to the scene
* Assumptions: numGuessesLeft represents the number of guesses the player has left, is not
* the same between function calls within the same run of the program, and is not more than 7
* or less than 0
* @param numGuessesLeft the number of guesses the player has left
* @return the Node to add to the scene in HangmanGame
*/
public Node getBodyPart(int numGuessesLeft) {
return guessesToBodyPart.get(numGuessesLeft);
}
/**
* Purpose: Set up the gallows themselves at the game's beginning
* Assumptions: Only called once by HangmanGame at the beginning of the game
* @return a Group consisting of the Lines that make up gallows
*/
public Group setupGallowsDisplay() {
Line bottomGallows = new Line(BOTTOM_GALLOWS_START_X, BOTTOM_GALLOWS_Y, BOTTOM_GALLOWS_END_X, BOTTOM_GALLOWS_Y);
Line verticalGallows = new Line(VERTICAL_GALLOWS_X, BOTTOM_GALLOWS_Y, VERTICAL_GALLOWS_X, VERTICAL_GALLOWS_END_Y);
Line topGallows = new Line(VERTICAL_GALLOWS_X, VERTICAL_GALLOWS_END_Y, TOP_GALLOWS_END_X, VERTICAL_GALLOWS_END_Y);
Line ropeGallows = new Line(TOP_GALLOWS_END_X, VERTICAL_GALLOWS_END_Y, TOP_GALLOWS_END_X, ROPE_GALLOWS_END_Y);
return new Group(bottomGallows, verticalGallows, topGallows, ropeGallows);
}
private void produceLeftX() {
Line leftXOne = new Line(TOP_GALLOWS_END_X - LETTER_X_OFFSET_X_ONE, ROPE_GALLOWS_END_Y + LETTER_X_OFFSET_Y_ONE, TOP_GALLOWS_END_X - LETTER_X_OFFSET_X_TWO, ROPE_GALLOWS_END_Y + LETTER_X_OFFSET_Y_TWO);
Line leftXTwo = new Line(TOP_GALLOWS_END_X - LETTER_X_OFFSET_X_ONE, ROPE_GALLOWS_END_Y + LETTER_X_OFFSET_Y_TWO, TOP_GALLOWS_END_X - LETTER_X_OFFSET_X_TWO, ROPE_GALLOWS_END_Y + LETTER_X_OFFSET_Y_ONE);
leftXOne.setStroke(Color.RED);
leftXTwo.setStroke(Color.RED);
guessesToBodyPart.put(1, new Group(leftXOne, leftXTwo));
}
private void produceRightX() {
Line rightXOne = new Line(TOP_GALLOWS_END_X + LETTER_X_OFFSET_X_TWO, ROPE_GALLOWS_END_Y + LETTER_X_OFFSET_Y_ONE, TOP_GALLOWS_END_X + LETTER_X_OFFSET_X_ONE, ROPE_GALLOWS_END_Y + LETTER_X_OFFSET_Y_TWO);
Line rightXTwo = new Line(TOP_GALLOWS_END_X + LETTER_X_OFFSET_X_TWO, ROPE_GALLOWS_END_Y + LETTER_X_OFFSET_Y_TWO, TOP_GALLOWS_END_X + LETTER_X_OFFSET_X_ONE, ROPE_GALLOWS_END_Y + LETTER_X_OFFSET_Y_ONE);
rightXOne.setStroke(Color.RED);
rightXTwo.setStroke(Color.RED);
guessesToBodyPart.put(0, new Group(rightXOne, rightXTwo));
}
}
| 6,143 | 0.707635 | 0.699007 | 106 | 56.952831 | 53.306408 | 208 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.075472 | false | false | 3 |
6e217ea81f1cd6fcdc0b3d08bd7045e71814cf89 | 22,196,390,997,213 | 0fcbaea30654b067eeb304a5ab482e15662ee736 | /dynomitemanager-common/src/main/java/com/netflix/nfsidecar/instance/VpcInstanceDataRetriever.java | 8c4383c00daf44590c2e65482c01606ed5563eef | [
"Apache-2.0"
] | permissive | Netflix/dynomite-manager | https://github.com/Netflix/dynomite-manager | 9f5602f91dbc93e3afc2d97e4eb803234b7fb485 | a234f4ba48b6c6a5a7a72824bfaac6c5cbc7c5a0 | refs/heads/dev | 2023-07-08T13:30:46.839000 | 2021-11-24T23:26:17 | 2021-11-24T23:26:17 | 60,204,104 | 99 | 62 | Apache-2.0 | false | 2023-06-23T22:33:38 | 2016-06-01T19:14:37 | 2022-11-01T04:22:24 | 2023-06-20T18:26:19 | 1,769 | 92 | 63 | 13 | Java | false | false | package com.netflix.nfsidecar.instance;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.netflix.nfsidecar.utils.SystemUtils;
/**
* Calls AWS ec2 metadata to get info on the location of the running instance in
* VPC. Public Hostname will return local-hostname Public IP will return
* local-ipv4
*/
public class VpcInstanceDataRetriever implements InstanceDataRetriever {
private static final Logger logger = LoggerFactory.getLogger(VpcInstanceDataRetriever.class);
public String getRac() {
return SystemUtils.getDataFromUrl("http://169.254.169.254/latest/meta-data/placement/availability-zone");
}
public String getPublicHostname() {
return SystemUtils.getDataFromUrl("http://169.254.169.254/latest/meta-data/public-hostname");
}
public String getPublicIP() {
return SystemUtils.getDataFromUrl("http://169.254.169.254/latest/meta-data/public-ipv4");
}
public String getInstanceId() {
return SystemUtils.getDataFromUrl("http://169.254.169.254/latest/meta-data/instance-id");
}
public String getInstanceType() {
return SystemUtils.getDataFromUrl("http://169.254.169.254/latest/meta-data/instance-type");
}
@Override
/*
* @return id of the network interface for running instance
*/
public String getMac() {
return SystemUtils.getDataFromUrl("http://169.254.169.254/latest/meta-data/network/interfaces/macs/").trim();
}
@Override
/*
* @return the id of the vpc account for running instance, null if does not
* exist.
*/
public String getVpcId() {
String nacId = getMac();
if (nacId == null || nacId.isEmpty())
return null;
String vpcId = null;
try {
vpcId = SystemUtils
.getDataFromUrl(
"http://169.254.169.254/latest/meta-data/network/interfaces/macs/" + nacId + "vpc-id")
.trim();
} catch (Exception e) {
logger.info(
"Vpc id does not exist for running instance, not fatal as running instance maybe not be in vpc. Msg: "
+ e.getLocalizedMessage());
}
return vpcId;
}
}
| UTF-8 | Java | 2,260 | java | VpcInstanceDataRetriever.java | Java | [
{
"context": " return SystemUtils.getDataFromUrl(\"http://169.254.169.254/latest/meta-data/placement/availability-zone\");\n ",
"end": 590,
"score": 0.9797890186309814,
"start": 575,
"tag": "IP_ADDRESS",
"value": "169.254.169.254"
},
{
"context": " return SystemUtils.ge... | null | [] | package com.netflix.nfsidecar.instance;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.netflix.nfsidecar.utils.SystemUtils;
/**
* Calls AWS ec2 metadata to get info on the location of the running instance in
* VPC. Public Hostname will return local-hostname Public IP will return
* local-ipv4
*/
public class VpcInstanceDataRetriever implements InstanceDataRetriever {
private static final Logger logger = LoggerFactory.getLogger(VpcInstanceDataRetriever.class);
public String getRac() {
return SystemUtils.getDataFromUrl("http://169.254.169.254/latest/meta-data/placement/availability-zone");
}
public String getPublicHostname() {
return SystemUtils.getDataFromUrl("http://169.254.169.254/latest/meta-data/public-hostname");
}
public String getPublicIP() {
return SystemUtils.getDataFromUrl("http://169.254.169.254/latest/meta-data/public-ipv4");
}
public String getInstanceId() {
return SystemUtils.getDataFromUrl("http://169.254.169.254/latest/meta-data/instance-id");
}
public String getInstanceType() {
return SystemUtils.getDataFromUrl("http://169.254.169.254/latest/meta-data/instance-type");
}
@Override
/*
* @return id of the network interface for running instance
*/
public String getMac() {
return SystemUtils.getDataFromUrl("http://169.254.169.254/latest/meta-data/network/interfaces/macs/").trim();
}
@Override
/*
* @return the id of the vpc account for running instance, null if does not
* exist.
*/
public String getVpcId() {
String nacId = getMac();
if (nacId == null || nacId.isEmpty())
return null;
String vpcId = null;
try {
vpcId = SystemUtils
.getDataFromUrl(
"http://169.254.169.254/latest/meta-data/network/interfaces/macs/" + nacId + "vpc-id")
.trim();
} catch (Exception e) {
logger.info(
"Vpc id does not exist for running instance, not fatal as running instance maybe not be in vpc. Msg: "
+ e.getLocalizedMessage());
}
return vpcId;
}
}
| 2,260 | 0.638496 | 0.599115 | 68 | 32.235294 | 35.523861 | 123 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.308824 | false | false | 3 |
8ec81558c7f8c31d2e5f6a25690f219373954a82 | 32,461,362,874,559 | 3c39531633100e2bb9a1b0fe7fa6dc8411f43981 | /Session_13/Exercise13_05/src/TestJobBase.java | 844793ec08cb2860a445752aace8affdc4451410 | [] | no_license | StKnudsen/SDJ1 | https://github.com/StKnudsen/SDJ1 | 234093bc234f2251765eaf7e45546f5eedfa22fb | bdb5cfd0d1cd6db80a3b2938a344e3adeed67ced | refs/heads/main | 2023-01-24T00:19:38.001000 | 2020-11-20T12:57:10 | 2020-11-20T12:57:10 | 309,068,244 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | public class TestJobBase
{
public static void main(String[] args)
{
Secretary secretary = new Secretary("John Doe", "123", 25, 4);
Teacher teacher = new Teacher("Jane Doe", "234", 12.5,2);
Student student1 = new Student("Jack Black", "345", false);
Student student2 = new Student("Jill Black", "456", true);
JobBase jobBase = new JobBase();
jobBase.addPerson(secretary);
jobBase.addPerson(teacher);
jobBase.addPerson(student1);
jobBase.addPerson(student2);
System.out.println(jobBase);
jobBase.removePerson(student1);
System.out.println(jobBase);
}
}
| UTF-8 | Java | 610 | java | TestJobBase.java | Java | [
{
"context": "rgs)\n {\n Secretary secretary = new Secretary(\"John Doe\", \"123\", 25, 4);\n Teacher teacher = new Teache",
"end": 121,
"score": 0.9998779892921448,
"start": 113,
"tag": "NAME",
"value": "John Doe"
},
{
"context": "\"123\", 25, 4);\n Teacher teacher = new T... | null | [] | public class TestJobBase
{
public static void main(String[] args)
{
Secretary secretary = new Secretary("<NAME>", "123", 25, 4);
Teacher teacher = new Teacher("<NAME>", "234", 12.5,2);
Student student1 = new Student("<NAME>", "345", false);
Student student2 = new Student("<NAME>", "456", true);
JobBase jobBase = new JobBase();
jobBase.addPerson(secretary);
jobBase.addPerson(teacher);
jobBase.addPerson(student1);
jobBase.addPerson(student2);
System.out.println(jobBase);
jobBase.removePerson(student1);
System.out.println(jobBase);
}
}
| 598 | 0.670492 | 0.631148 | 23 | 25.52174 | 22.623323 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.956522 | false | false | 3 |
756a6685954a54ed95998e79f8e2b6c6091277ef | 30,219,389,952,018 | 7bb15e36d6554a59ec039f87bea9b688fb00668d | /spacearena-core/src/main/java/ru/spacearena/engine/events/TouchEvent.java | 31a70fc8019dbc4fea5b0a5020a76b8c9096a6f7 | [] | no_license | acc15/spacearena | https://github.com/acc15/spacearena | af1cbbdfc933443cb89454c06d8d6065ebf87612 | 7fa5e730faf401520cdddb1ca380f6908fe8fd65 | refs/heads/master | 2021-01-01T15:33:25.316000 | 2014-10-17T22:50:28 | 2014-10-17T22:50:28 | 97,640,851 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ru.spacearena.engine.events;
/**
* @author Vyacheslav Mayorov
* @since 2014-18-03
*/
public class TouchEvent extends InputEvent {
public static enum Action {
DOWN,
UP,
MOVE,
CANCEL
}
private final float[] pointerCoords;
private final int[] pointerIds;
private final Action action;
private final int pointerIndex;
public TouchEvent(Action action, int pointerCount, int pointerIndex) {
super(InputType.TOUCH);
this.action = action;
this.pointerIndex = pointerIndex;
pointerCoords = new float[pointerCount*2];
pointerIds = new int[pointerCount];
}
private void checkIndex(int i) {
if (i < 0 || i >= pointerIds.length) {
throw new IndexOutOfBoundsException("Illegal pointer index " + i);
}
}
public void setPointer(int index, int id, float x, float y) {
checkIndex(index);
pointerCoords[index*2] = x;
pointerCoords[index*2+1] = y;
pointerIds[index] = id;
}
public int findPointerIndex(int id) {
for (int i=0; i<pointerIds.length; i++) {
if (pointerIds[i] == id) {
return i;
}
}
return -1;
}
public int getPointerCount() {
return pointerIds.length;
}
public float[] getRawPointers() {
return pointerCoords;
}
public int getPointerId() {
return pointerIds[pointerIndex];
}
public int getPointerIndex() {
return pointerIndex;
}
public Action getAction() {
return action;
}
public float getPointerY(int i) {
checkIndex(i);
return pointerCoords[i*2+1];
}
public float getPointerX(int i) {
checkIndex(i);
return pointerCoords[i*2];
}
public int getPointerId(int i) {
checkIndex(i);
return pointerIds[i];
}
}
| UTF-8 | Java | 1,931 | java | TouchEvent.java | Java | [
{
"context": "ckage ru.spacearena.engine.events;\n\n/**\n * @author Vyacheslav Mayorov\n * @since 2014-18-03\n */\npublic class TouchEvent ",
"end": 71,
"score": 0.999580442905426,
"start": 53,
"tag": "NAME",
"value": "Vyacheslav Mayorov"
}
] | null | [] | package ru.spacearena.engine.events;
/**
* @author <NAME>
* @since 2014-18-03
*/
public class TouchEvent extends InputEvent {
public static enum Action {
DOWN,
UP,
MOVE,
CANCEL
}
private final float[] pointerCoords;
private final int[] pointerIds;
private final Action action;
private final int pointerIndex;
public TouchEvent(Action action, int pointerCount, int pointerIndex) {
super(InputType.TOUCH);
this.action = action;
this.pointerIndex = pointerIndex;
pointerCoords = new float[pointerCount*2];
pointerIds = new int[pointerCount];
}
private void checkIndex(int i) {
if (i < 0 || i >= pointerIds.length) {
throw new IndexOutOfBoundsException("Illegal pointer index " + i);
}
}
public void setPointer(int index, int id, float x, float y) {
checkIndex(index);
pointerCoords[index*2] = x;
pointerCoords[index*2+1] = y;
pointerIds[index] = id;
}
public int findPointerIndex(int id) {
for (int i=0; i<pointerIds.length; i++) {
if (pointerIds[i] == id) {
return i;
}
}
return -1;
}
public int getPointerCount() {
return pointerIds.length;
}
public float[] getRawPointers() {
return pointerCoords;
}
public int getPointerId() {
return pointerIds[pointerIndex];
}
public int getPointerIndex() {
return pointerIndex;
}
public Action getAction() {
return action;
}
public float getPointerY(int i) {
checkIndex(i);
return pointerCoords[i*2+1];
}
public float getPointerX(int i) {
checkIndex(i);
return pointerCoords[i*2];
}
public int getPointerId(int i) {
checkIndex(i);
return pointerIds[i];
}
}
| 1,919 | 0.578975 | 0.569653 | 87 | 21.195402 | 18.495628 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.45977 | false | false | 3 |
51b55f0c1271811d48204c1aed9e2d96a544e57f | 94,489,290,294 | c2eb157ad0f2db24f48b30caebb7a113e190f9db | /src/listener/MFrameCloseListener.java | 5e9e0d7ebf4bc4bdad16d68fd7e85c642a77fb10 | [] | no_license | KDL-in/AccountBook | https://github.com/KDL-in/AccountBook | 53cf664c86167ccbfc1b2eb88c65706206bf0491 | eb0d44c2ec4f93cbc5c2db9d56002841fb8f184f | refs/heads/master | 2022-02-13T06:25:20.600000 | 2019-07-21T15:35:20 | 2019-07-21T15:35:20 | 198,074,504 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package listener;
import util.DBUtil;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
/**
* Created by KundaLin on 17/6/14.
*/
public class MFrameCloseListener extends WindowAdapter {
@Override
public void windowClosing(WindowEvent e) {
DBUtil.close();
System.exit(0);
}
}
| UTF-8 | Java | 368 | java | MFrameCloseListener.java | Java | [
{
"context": " java.awt.event.WindowListener;\n\n/**\n * Created by KundaLin on 17/6/14.\n */\npublic class MFrameCloseListener ",
"end": 177,
"score": 0.9993560910224915,
"start": 169,
"tag": "USERNAME",
"value": "KundaLin"
}
] | null | [] | package listener;
import util.DBUtil;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
/**
* Created by KundaLin on 17/6/14.
*/
public class MFrameCloseListener extends WindowAdapter {
@Override
public void windowClosing(WindowEvent e) {
DBUtil.close();
System.exit(0);
}
}
| 368 | 0.711957 | 0.695652 | 18 | 19.444445 | 17.23118 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.388889 | false | false | 3 |
d8ccc4222a4b6f9e36ecb6753c961817052e76e7 | 18,554,258,780,954 | 9b03d26186954aeb86e636b068ecfc695663a683 | /src/main/java/com/google/code/springcryptoutils/core/spring/signature/Base64EncodedVerifierWithChooserByPublicKeyIdBeanDefinitionParser.java | 5f20eda9f3b9f6b6acc0beff0cd2c5180d5eaa96 | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | bosakm/spring-crypto-utils | https://github.com/bosakm/spring-crypto-utils | ae5073052634c71da527320627e822dd7b7c0961 | 15f305e522bd3c85eec7cc46a50e18385f324b9e | refs/heads/master | 2020-12-24T10:11:55.319000 | 2012-08-21T16:51:30 | 2012-08-21T16:51:30 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.google.code.springcryptoutils.core.spring.signature;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
import org.w3c.dom.Element;
import com.google.code.springcryptoutils.core.signature.Base64EncodedVerifierWithChooserByPublicKeyIdImpl;
public class Base64EncodedVerifierWithChooserByPublicKeyIdBeanDefinitionParser extends AbstractSingleBeanDefinitionParser {
@Override
protected Class getBeanClass(Element element) {
return Base64EncodedVerifierWithChooserByPublicKeyIdImpl.class;
}
@Override
protected void doParse(Element element, BeanDefinitionBuilder bean) {
bean.addPropertyReference("publicKeyMap", element.getAttribute("publicKeyMap-ref"));
bean.addPropertyValue("algorithm", element.getAttribute("algorithm"));
bean.addPropertyValue("charsetName", element.getAttribute("charset"));
bean.addPropertyValue("provider", element.getAttribute("provider"));
}
} | UTF-8 | Java | 1,002 | java | Base64EncodedVerifierWithChooserByPublicKeyIdBeanDefinitionParser.java | Java | [] | null | [] | package com.google.code.springcryptoutils.core.spring.signature;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
import org.w3c.dom.Element;
import com.google.code.springcryptoutils.core.signature.Base64EncodedVerifierWithChooserByPublicKeyIdImpl;
public class Base64EncodedVerifierWithChooserByPublicKeyIdBeanDefinitionParser extends AbstractSingleBeanDefinitionParser {
@Override
protected Class getBeanClass(Element element) {
return Base64EncodedVerifierWithChooserByPublicKeyIdImpl.class;
}
@Override
protected void doParse(Element element, BeanDefinitionBuilder bean) {
bean.addPropertyReference("publicKeyMap", element.getAttribute("publicKeyMap-ref"));
bean.addPropertyValue("algorithm", element.getAttribute("algorithm"));
bean.addPropertyValue("charsetName", element.getAttribute("charset"));
bean.addPropertyValue("provider", element.getAttribute("provider"));
}
} | 1,002 | 0.842315 | 0.835329 | 24 | 40.791668 | 39.262981 | 123 | false | false | 0 | 0 | 0 | 0 | 65 | 0.06487 | 1.291667 | false | false | 3 |
17ca6d012fa55441022fe20d1c7137de1b168f2f | 18,451,179,564,464 | 4b49ba58f2daee3131fc7b699447137301303f6b | /src/main/java/com/service/romanconversion/controller/package-info.java | 7685554a0ff49e4134dfd91ba17d1528ea526c0d | [] | no_license | aemuser/roman-conversion-master | https://github.com/aemuser/roman-conversion-master | 7a0040eb37a54afb9bc0b2a84ba7ec2d27fd85fb | 63cc79456ed21665b528d2423940e8c5f988bc91 | refs/heads/master | 2023-08-03T03:44:32.171000 | 2021-09-15T12:55:34 | 2021-09-15T12:55:34 | 405,761,505 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.service.romanconversion.controller; | UTF-8 | Java | 47 | java | package-info.java | Java | [] | null | [] | package com.service.romanconversion.controller; | 47 | 0.893617 | 0.893617 | 1 | 47 | 0 | 47 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false | 3 |
b6b80c23a0a5e6a87e4444f2e24222ac9aa673b5 | 38,972,533,252,981 | 18c70f2a4f73a9db9975280a545066c9e4d9898e | /mirror-alert/alert-common/src/main/java/com/aspire/mirror/alert/server/clientservice/payload/GetLdapUserResponse.java | 8202a9fa5fdea8ad2caf4203997bfbb8263f5856 | [] | no_license | iu28igvc9o0/cmdb_aspire | https://github.com/iu28igvc9o0/cmdb_aspire | 1fe5d8607fdacc436b8a733f0ea44446f431dfa8 | 793eb6344c4468fe4c61c230df51fc44f7d8357b | refs/heads/master | 2023-08-11T03:54:45.820000 | 2021-09-18T01:47:25 | 2021-09-18T01:47:25 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.aspire.mirror.alert.server.clientservice.payload;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* 项目名称: ldap-api <br>
* 包: com.migu.tsg.microservice.atomicservice.ldap.dto <br>
* 类名称: GetLdapUserResponse.java <br>
* 类描述: 获取LDAP用户响应对象<br>
* 创建人: WangSheng <br>
* 创建时间: 2017年11月6日下午4:04:15 <br>
* 版本: v1.0
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class GetLdapUserResponse {
/**
* 用户名
*/
private String username;
/**
* 密码
*/
private String password;
/**
* 姓名
*/
private String name;
/**
* 手机号码
*/
private String mobile;
/**
* 邮箱
*/
private String mail;
/**
* 公司名称
*/
private String company;
/**
* 部门
*/
private String dept;
/**
* 头像信息
*/
@JsonProperty("jpeg_photo")
private String jpegPhoto;
/**
* 所属项目列表
*/
private List<String> projects;
/**
* 全部项目列表
*/
@JsonProperty("all_projects")
private List<String> allProjects;
/**
* 用户类型, root表示超级用户;admin表示根帐号;user表示普通用户
*/
@JsonProperty("user_type")
private LdapUserTypeEnum userType;
/**
* (命名空间)根帐号UID
* 只有成员有该值,表示该成员所属命名空间
*/
private String namespace;
/**
* 描述
*/
@JsonProperty("description")
private String description;
/**
* 创建时间
*/
@JsonProperty("create_time")
private String createTime;
/**
* 修改时间
*/
@JsonProperty("update_time")
private String updateTime;
}
| UTF-8 | Java | 1,961 | java | GetLdapUserResponse.java | Java | [
{
"context": "rResponse.java <br>\n* 类描述: 获取LDAP用户响应对象<br>\n* 创建人: WangSheng <br>\n* 创建时间: 2017年11月6日下午4:04:15 <br>\n* 版本: ",
"end": 386,
"score": 0.6904135346412659,
"start": 382,
"tag": "NAME",
"value": "Wang"
},
{
"context": "onse.java <br>\n* 类描述: 获取LDAP用户响应对象<br>\n* 创建人: WangShe... | null | [] | package com.aspire.mirror.alert.server.clientservice.payload;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* 项目名称: ldap-api <br>
* 包: com.migu.tsg.microservice.atomicservice.ldap.dto <br>
* 类名称: GetLdapUserResponse.java <br>
* 类描述: 获取LDAP用户响应对象<br>
* 创建人: WangSheng <br>
* 创建时间: 2017年11月6日下午4:04:15 <br>
* 版本: v1.0
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class GetLdapUserResponse {
/**
* 用户名
*/
private String username;
/**
* 密码
*/
private String password;
/**
* 姓名
*/
private String name;
/**
* 手机号码
*/
private String mobile;
/**
* 邮箱
*/
private String mail;
/**
* 公司名称
*/
private String company;
/**
* 部门
*/
private String dept;
/**
* 头像信息
*/
@JsonProperty("jpeg_photo")
private String jpegPhoto;
/**
* 所属项目列表
*/
private List<String> projects;
/**
* 全部项目列表
*/
@JsonProperty("all_projects")
private List<String> allProjects;
/**
* 用户类型, root表示超级用户;admin表示根帐号;user表示普通用户
*/
@JsonProperty("user_type")
private LdapUserTypeEnum userType;
/**
* (命名空间)根帐号UID
* 只有成员有该值,表示该成员所属命名空间
*/
private String namespace;
/**
* 描述
*/
@JsonProperty("description")
private String description;
/**
* 创建时间
*/
@JsonProperty("create_time")
private String createTime;
/**
* 修改时间
*/
@JsonProperty("update_time")
private String updateTime;
}
| 1,961 | 0.569177 | 0.561004 | 104 | 15.471154 | 13.437145 | 61 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | false | false | 3 |
59347f61640f7b313984c224bfc7acb68c4cc85c | 1,073,741,862,313 | 254ec2ee086795e901491270e05538424fffe4ba | /oa-interface/src/main/java/cn/com/bizunited/cp/oa/service/CustomerService.java | d7d7f2ef10631166773a391158bf18d53a98f03d | [] | no_license | ShenPaulChan/oa | https://github.com/ShenPaulChan/oa | 2de291fd9b3ea214fd3bce1601d16a7915d986cd | ed0f25a611a58979f1acdd0c647e8e8522031966 | refs/heads/master | 2021-01-20T01:53:43.693000 | 2017-10-23T01:52:59 | 2017-10-23T01:52:59 | 89,341,302 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cn.com.bizunited.cp.oa.service;
import cn.com.bizunited.cp.common.web.pagination.Page;
import cn.com.bizunited.cp.common.web.pagination.Pageable;
import cn.com.bizunited.cp.oa.domain.base.Admin;
import cn.com.bizunited.cp.oa.domain.base.CusGroup;
import cn.com.bizunited.cp.oa.domain.base.Customer;
import java.util.List;
/**
* @Description:
* @author: Paul Chan
* @date: 2017/4/19-23:08
*/
public interface CustomerService extends BaseService<Customer> {
Page<Customer> getPage(Pageable pageable);
void saveCus(Customer customer, Admin admin);
void updateCusGroup(Long customerId, Long cusGroupId);
void transfer(Admin admin, List<Long> cusIds);
boolean checkMobile(Long customerId, String mobile);
void removeCusOfGroup(CusGroup cusGroup);
String getAdminNameByMobile(String mobile);
}
| UTF-8 | Java | 835 | java | CustomerService.java | Java | [
{
"context": " java.util.List;\n\n/**\n * @Description:\n * @author: Paul Chan\n * @date: 2017/4/19-23:08\n */\npublic interface Cu",
"end": 375,
"score": 0.9998230338096619,
"start": 366,
"tag": "NAME",
"value": "Paul Chan"
}
] | null | [] | package cn.com.bizunited.cp.oa.service;
import cn.com.bizunited.cp.common.web.pagination.Page;
import cn.com.bizunited.cp.common.web.pagination.Pageable;
import cn.com.bizunited.cp.oa.domain.base.Admin;
import cn.com.bizunited.cp.oa.domain.base.CusGroup;
import cn.com.bizunited.cp.oa.domain.base.Customer;
import java.util.List;
/**
* @Description:
* @author: <NAME>
* @date: 2017/4/19-23:08
*/
public interface CustomerService extends BaseService<Customer> {
Page<Customer> getPage(Pageable pageable);
void saveCus(Customer customer, Admin admin);
void updateCusGroup(Long customerId, Long cusGroupId);
void transfer(Admin admin, List<Long> cusIds);
boolean checkMobile(Long customerId, String mobile);
void removeCusOfGroup(CusGroup cusGroup);
String getAdminNameByMobile(String mobile);
}
| 832 | 0.760479 | 0.747305 | 31 | 25.935484 | 23.998569 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.612903 | false | false | 3 |
05742b58589c50c7546ecf50e714a193a0aedbc5 | 1,073,741,860,683 | 8b14f76172f8bd7451c003ecdd25d4d3223270bc | /src/test/java/com/example/SpringBootCrudMongoDB/controller/helloResouceTest.java | df03badf36eafbdfd54f93069eea346a23485f5a | [] | no_license | shorab95/SpringBootCrud-MongoDB | https://github.com/shorab95/SpringBootCrud-MongoDB | 1201d0a8eb99d6fdebe268193a3cd417e1c53490 | ad0be66155a71127a36511f0760cd5f63f86b7d5 | refs/heads/master | 2021-05-23T14:03:45.072000 | 2020-04-05T20:40:44 | 2020-04-05T20:40:44 | 253,327,906 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.SpringBootCrudMongoDB.controller;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.when;
import java.util.ArrayList;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.http.MediaType;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import com.example.SpringBootCrudMongoDB.dao.EmployeeDao;
import com.example.SpringBootCrudMongoDB.model.Employee;
import com.example.SpringBootCrudMongoDB.service.TaxService;
import com.fasterxml.jackson.databind.ObjectMapper;
@RunWith(SpringJUnit4ClassRunner.class)
public class helloResouceTest {
@InjectMocks
private EmployeeController empController;
@MockBean
private TaxService taxService;
@Mock
private EmployeeDao empDao;
private MockMvc mockMvc;
ObjectMapper m = new ObjectMapper();
ArrayList<Employee> al = new ArrayList<Employee>();
Employee emp1=null;
Employee emp2=null;
@Before
public void setUp() throws Exception
{
MockitoAnnotations.initMocks(this);
mockMvc=MockMvcBuilders.standaloneSetup(empController).build();
Employee emp1=new Employee("Shorab",5,"DBD");
Employee emp2=new Employee("Moony",6,"KOL");
al.add(emp1);
al.add(emp2);
}
@Test
public void testHelloResource() throws Exception
{
mockMvc.perform(MockMvcRequestBuilders.get("/employees/hello"))
.andExpect(MockMvcResultMatchers.status().isOk()).
andExpect(MockMvcResultMatchers.content()
.string("helloWorld"));
}
@Test
public void testJson() throws Exception
{
Employee emp1=new Employee("Shorab",4,"DBD");
MvcResult mvcResult=mockMvc.perform(MockMvcRequestBuilders.get("/employees/json").accept(MediaType.APPLICATION_JSON))
.andExpect(MockMvcResultMatchers.status().isOk()).andReturn();
String js=m.writeValueAsString(emp1);
assertEquals(js,mvcResult.getResponse().getContentAsString());
}
@Test
public void testgetEmployees() throws Exception
{
when(empDao.findAll()).thenReturn(al);
MvcResult mvcResult=mockMvc.perform(MockMvcRequestBuilders.get("/employees/getAllEmployee").accept(MediaType.APPLICATION_JSON))
.andExpect(MockMvcResultMatchers.status().isOk()).andReturn();
assertEquals( m.writeValueAsString(al),mvcResult.getResponse().getContentAsString());
}
@Test
public void testAddEmployee() throws Exception
{
when(empDao.save(emp1)).thenReturn(emp1);
assertEquals(emp1,empDao.save(emp1));
}
@Test
public void testdeleteEmployee() throws Exception
{
mockMvc.perform(MockMvcRequestBuilders.delete("/employees/deleteEmployee/1").accept(MediaType.APPLICATION_JSON))
.andExpect(MockMvcResultMatchers.status().isOk());
}
@Test
public void testIncome()
{
int income=5000;
when(taxService.getBracket(income)).thenReturn("HIGH");
assertEquals("HIGH",taxService.getBracket(income));
}
@Test
public void testWord()
{
String s="Shorab";
when(taxService.countA(s)).thenReturn(1);
assertEquals(1,taxService.countA(s));
}
@Test
public void testTwoString()
{
String s1="Sho";
String s2="Sho";
when(taxService.compareTwoString(s1, s2)).thenReturn(true);
assertEquals(true,taxService.compareTwoString(s1, s2));
}
@Test
public void testArray()
{
int[] arr=new int[] {2,3};
when(taxService.addOneTOArr(arr)).thenReturn(new int[] {3,4});
assertArrayEquals(new int[] {3,4},taxService.addOneTOArr(arr));
}
@Test(timeout=1000)
public void testPerformance()
{
taxService.performance();
}
}
| UTF-8 | Java | 4,186 | java | helloResouceTest.java | Java | [
{
"context": "ontroller).build();\n\t\tEmployee emp1=new Employee(\"Shorab\",5,\"DBD\");\n \tEmployee emp2=new Employee(\"Moony",
"end": 1703,
"score": 0.9997623562812805,
"start": 1697,
"tag": "NAME",
"value": "Shorab"
},
{
"context": "horab\",5,\"DBD\");\n \tEmployee emp2=new... | null | [] | package com.example.SpringBootCrudMongoDB.controller;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.when;
import java.util.ArrayList;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.http.MediaType;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import com.example.SpringBootCrudMongoDB.dao.EmployeeDao;
import com.example.SpringBootCrudMongoDB.model.Employee;
import com.example.SpringBootCrudMongoDB.service.TaxService;
import com.fasterxml.jackson.databind.ObjectMapper;
@RunWith(SpringJUnit4ClassRunner.class)
public class helloResouceTest {
@InjectMocks
private EmployeeController empController;
@MockBean
private TaxService taxService;
@Mock
private EmployeeDao empDao;
private MockMvc mockMvc;
ObjectMapper m = new ObjectMapper();
ArrayList<Employee> al = new ArrayList<Employee>();
Employee emp1=null;
Employee emp2=null;
@Before
public void setUp() throws Exception
{
MockitoAnnotations.initMocks(this);
mockMvc=MockMvcBuilders.standaloneSetup(empController).build();
Employee emp1=new Employee("Shorab",5,"DBD");
Employee emp2=new Employee("Moony",6,"KOL");
al.add(emp1);
al.add(emp2);
}
@Test
public void testHelloResource() throws Exception
{
mockMvc.perform(MockMvcRequestBuilders.get("/employees/hello"))
.andExpect(MockMvcResultMatchers.status().isOk()).
andExpect(MockMvcResultMatchers.content()
.string("helloWorld"));
}
@Test
public void testJson() throws Exception
{
Employee emp1=new Employee("Shorab",4,"DBD");
MvcResult mvcResult=mockMvc.perform(MockMvcRequestBuilders.get("/employees/json").accept(MediaType.APPLICATION_JSON))
.andExpect(MockMvcResultMatchers.status().isOk()).andReturn();
String js=m.writeValueAsString(emp1);
assertEquals(js,mvcResult.getResponse().getContentAsString());
}
@Test
public void testgetEmployees() throws Exception
{
when(empDao.findAll()).thenReturn(al);
MvcResult mvcResult=mockMvc.perform(MockMvcRequestBuilders.get("/employees/getAllEmployee").accept(MediaType.APPLICATION_JSON))
.andExpect(MockMvcResultMatchers.status().isOk()).andReturn();
assertEquals( m.writeValueAsString(al),mvcResult.getResponse().getContentAsString());
}
@Test
public void testAddEmployee() throws Exception
{
when(empDao.save(emp1)).thenReturn(emp1);
assertEquals(emp1,empDao.save(emp1));
}
@Test
public void testdeleteEmployee() throws Exception
{
mockMvc.perform(MockMvcRequestBuilders.delete("/employees/deleteEmployee/1").accept(MediaType.APPLICATION_JSON))
.andExpect(MockMvcResultMatchers.status().isOk());
}
@Test
public void testIncome()
{
int income=5000;
when(taxService.getBracket(income)).thenReturn("HIGH");
assertEquals("HIGH",taxService.getBracket(income));
}
@Test
public void testWord()
{
String s="Shorab";
when(taxService.countA(s)).thenReturn(1);
assertEquals(1,taxService.countA(s));
}
@Test
public void testTwoString()
{
String s1="Sho";
String s2="Sho";
when(taxService.compareTwoString(s1, s2)).thenReturn(true);
assertEquals(true,taxService.compareTwoString(s1, s2));
}
@Test
public void testArray()
{
int[] arr=new int[] {2,3};
when(taxService.addOneTOArr(arr)).thenReturn(new int[] {3,4});
assertArrayEquals(new int[] {3,4},taxService.addOneTOArr(arr));
}
@Test(timeout=1000)
public void testPerformance()
{
taxService.performance();
}
}
| 4,186 | 0.742236 | 0.732441 | 140 | 28.9 | 26.928556 | 132 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.321429 | false | false | 3 |
7cdc23e710b3341b2714fb5c02d8e242e3cd9f15 | 18,373,870,157,693 | 29d31224559213cf30dad226f3f2a7a17a380496 | /src/main/java/com/biffbangpow/advcode/AdvantageCodeEnum.java | d832440c68b8508a0848161b129c7a59263bf004 | [] | no_license | tpvillard/tidbits | https://github.com/tpvillard/tidbits | 6d7f7932cb3b033f206a5bd7d960f81773a00f29 | fcccf3163d93eb2459c6f70d12ae7566b3dd293f | refs/heads/master | 2022-12-24T02:07:33.572000 | 2019-09-29T17:28:10 | 2019-09-29T17:28:10 | 108,433,537 | 0 | 0 | null | false | 2022-12-14T20:27:03 | 2017-10-26T15:57:01 | 2019-09-29T17:29:36 | 2022-12-14T20:27:00 | 58 | 0 | 0 | 3 | Java | false | false | package com.biffbangpow.advcode;
public enum AdvantageCodeEnum implements AdvantageCode {
GH03C {
@Override
public String getId() {
return name();
}
};
}
| UTF-8 | Java | 201 | java | AdvantageCodeEnum.java | Java | [] | null | [] | package com.biffbangpow.advcode;
public enum AdvantageCodeEnum implements AdvantageCode {
GH03C {
@Override
public String getId() {
return name();
}
};
}
| 201 | 0.587065 | 0.577114 | 12 | 15.75 | 16.703917 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | false | false | 3 |
1c4f6e3abe7df1c02bd95f7f812ad7bed16309f8 | 1,494,648,666,776 | 7ae11ecd535b0c4fad6da9031f94116af72b959e | /app/src/main/java/com/project/attylax/sapiadvertiser/PostUploaderService.java | a31b74e484cd1b6a6959e839aaab2d902979ab24 | [] | no_license | Attylax/SapiAdvertiser | https://github.com/Attylax/SapiAdvertiser | 72b2d482f6398a7beb977419964262effacf3a53 | 89d62660a0b857ba9bc2915ba579104999ffdbb2 | refs/heads/master | 2021-03-19T14:45:58.339000 | 2018-01-04T11:39:06 | 2018-01-04T11:39:06 | 111,219,632 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.project.attylax.sapiadvertiser;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.Uri;
import android.os.IBinder;
import android.support.v4.content.LocalBroadcastManager;
import android.util.Log;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.gson.Gson;
/**
* This class is responsible for upload post to firebase database
*/
public class PostUploaderService extends Service {
/**
* Intent Actions
**/
public static final String POST_ACTION_UPLOAD = "post_action_upload";
public static final String POST_UPLOAD_COMPLETED = "post_upload_completed";
public static final String POST_UPLOAD_ERROR = "post_upload_error";
/**
* Intent Extras
**/
public static final String EXTRA_POST_OBJECT = "extra_Post_object";
public static final String EXTRA_POST_ID = "extra_post_id";
private DatabaseReference mDatabase;
private BroadcastReceiver broadcastReceiver;
private int mNumTasks = 0;
private int counter = 0;
private Post post;
public void taskStarted() {
changeNumberOfTasks(1);
}
public void taskCompleted() {
changeNumberOfTasks(-1);
}
private synchronized void changeNumberOfTasks(int delta) {
mNumTasks += delta;
// If there are no tasks left, stop the service
if (mNumTasks <= 0) {
stop();
stopSelf();
}
}
@Override
public IBinder onBind(Intent intent) {
return null;
}
@Override
public void onCreate() {
super.onCreate();
mDatabase = FirebaseDatabase.getInstance().getReference();
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
String id = null;
if (POST_ACTION_UPLOAD.equals(intent.getAction())) {
Log.d("Post", "Megjott");
post = intent.getParcelableExtra(EXTRA_POST_OBJECT);
Gson gson = new Gson();
String json = gson.toJson(post);
Log.d("Post", json);
if(intent.hasExtra(EXTRA_POST_ID)){
id = intent.getStringExtra(EXTRA_POST_ID);
}
uploadPost(post, id);
}
return START_REDELIVER_INTENT;
}
/**
* This function inserts post into database with ID which one got as parameter.
* @param post
* @param id
*/
private void uploadPost(Post post, String id) {
taskStarted();
final String key;
if(id == null) {
key = mDatabase.child("posts").push().getKey();
}else{
key = id;
}
broadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
switch (intent.getAction()) {
case FileUploader.UPLOAD_COMPLETED:
String stringPath = intent.getStringExtra(FileUploader.EXTRA_DOWNLOAD_URL);
Uri path = null;
if(stringPath != null) {
path = Uri.parse(stringPath);
Log.d("Post", path.toString());
}
Post post = getPost();
stringPath = intent.getStringExtra(FileUploader.EXTRA_FILE_URI);
if(stringPath != null) {
Log.i("uzenetek",stringPath);
int index = post.indexOf(stringPath);
post.setDownloadLink(index, path.toString());
}
++counter;
if(counter == post.getSize()){
Gson gson = new Gson();
String json = gson.toJson(post);
mDatabase.child("posts").child(key).setValue(json);
broadcastUploadFinished(true);
taskCompleted();
}
break;
case FileUploader.UPLOAD_ERROR:
broadcastUploadFinished(false);
taskCompleted();
break;
}
}
};
start();
for(int i = 0; i < post.getSize(); ++i){
startService(new Intent(this, FileUploader.class)
.putExtra(FileUploader.EXTRA_FILE_URI, post.getImagePath(i))
.setAction(FileUploader.ACTION_UPLOAD));
}
}
private Post getPost(){
return post;
}
public void start() {
LocalBroadcastManager manager = LocalBroadcastManager.getInstance(this);
manager.registerReceiver(broadcastReceiver, FileUploader.getIntentFilter());
}
public void stop() {
// Unregister download receiver
LocalBroadcastManager.getInstance(this).unregisterReceiver(broadcastReceiver);
}
/**
* This function sends back if this upload are successful or not.
* @param success
* @return
*/
private boolean broadcastUploadFinished(boolean success) {
String action = success ? POST_UPLOAD_COMPLETED : POST_UPLOAD_ERROR;
Intent broadcast = new Intent(action);
return LocalBroadcastManager.getInstance(getApplicationContext())
.sendBroadcast(broadcast);
}
public static IntentFilter getIntentFilter() {
IntentFilter filter = new IntentFilter();
filter.addAction(POST_UPLOAD_COMPLETED);
filter.addAction(POST_UPLOAD_ERROR);
return filter;
}
} | UTF-8 | Java | 5,931 | java | PostUploaderService.java | Java | [] | null | [] | package com.project.attylax.sapiadvertiser;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.Uri;
import android.os.IBinder;
import android.support.v4.content.LocalBroadcastManager;
import android.util.Log;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.gson.Gson;
/**
* This class is responsible for upload post to firebase database
*/
public class PostUploaderService extends Service {
/**
* Intent Actions
**/
public static final String POST_ACTION_UPLOAD = "post_action_upload";
public static final String POST_UPLOAD_COMPLETED = "post_upload_completed";
public static final String POST_UPLOAD_ERROR = "post_upload_error";
/**
* Intent Extras
**/
public static final String EXTRA_POST_OBJECT = "extra_Post_object";
public static final String EXTRA_POST_ID = "extra_post_id";
private DatabaseReference mDatabase;
private BroadcastReceiver broadcastReceiver;
private int mNumTasks = 0;
private int counter = 0;
private Post post;
public void taskStarted() {
changeNumberOfTasks(1);
}
public void taskCompleted() {
changeNumberOfTasks(-1);
}
private synchronized void changeNumberOfTasks(int delta) {
mNumTasks += delta;
// If there are no tasks left, stop the service
if (mNumTasks <= 0) {
stop();
stopSelf();
}
}
@Override
public IBinder onBind(Intent intent) {
return null;
}
@Override
public void onCreate() {
super.onCreate();
mDatabase = FirebaseDatabase.getInstance().getReference();
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
String id = null;
if (POST_ACTION_UPLOAD.equals(intent.getAction())) {
Log.d("Post", "Megjott");
post = intent.getParcelableExtra(EXTRA_POST_OBJECT);
Gson gson = new Gson();
String json = gson.toJson(post);
Log.d("Post", json);
if(intent.hasExtra(EXTRA_POST_ID)){
id = intent.getStringExtra(EXTRA_POST_ID);
}
uploadPost(post, id);
}
return START_REDELIVER_INTENT;
}
/**
* This function inserts post into database with ID which one got as parameter.
* @param post
* @param id
*/
private void uploadPost(Post post, String id) {
taskStarted();
final String key;
if(id == null) {
key = mDatabase.child("posts").push().getKey();
}else{
key = id;
}
broadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
switch (intent.getAction()) {
case FileUploader.UPLOAD_COMPLETED:
String stringPath = intent.getStringExtra(FileUploader.EXTRA_DOWNLOAD_URL);
Uri path = null;
if(stringPath != null) {
path = Uri.parse(stringPath);
Log.d("Post", path.toString());
}
Post post = getPost();
stringPath = intent.getStringExtra(FileUploader.EXTRA_FILE_URI);
if(stringPath != null) {
Log.i("uzenetek",stringPath);
int index = post.indexOf(stringPath);
post.setDownloadLink(index, path.toString());
}
++counter;
if(counter == post.getSize()){
Gson gson = new Gson();
String json = gson.toJson(post);
mDatabase.child("posts").child(key).setValue(json);
broadcastUploadFinished(true);
taskCompleted();
}
break;
case FileUploader.UPLOAD_ERROR:
broadcastUploadFinished(false);
taskCompleted();
break;
}
}
};
start();
for(int i = 0; i < post.getSize(); ++i){
startService(new Intent(this, FileUploader.class)
.putExtra(FileUploader.EXTRA_FILE_URI, post.getImagePath(i))
.setAction(FileUploader.ACTION_UPLOAD));
}
}
private Post getPost(){
return post;
}
public void start() {
LocalBroadcastManager manager = LocalBroadcastManager.getInstance(this);
manager.registerReceiver(broadcastReceiver, FileUploader.getIntentFilter());
}
public void stop() {
// Unregister download receiver
LocalBroadcastManager.getInstance(this).unregisterReceiver(broadcastReceiver);
}
/**
* This function sends back if this upload are successful or not.
* @param success
* @return
*/
private boolean broadcastUploadFinished(boolean success) {
String action = success ? POST_UPLOAD_COMPLETED : POST_UPLOAD_ERROR;
Intent broadcast = new Intent(action);
return LocalBroadcastManager.getInstance(getApplicationContext())
.sendBroadcast(broadcast);
}
public static IntentFilter getIntentFilter() {
IntentFilter filter = new IntentFilter();
filter.addAction(POST_UPLOAD_COMPLETED);
filter.addAction(POST_UPLOAD_ERROR);
return filter;
}
} | 5,931 | 0.559939 | 0.558759 | 195 | 29.420513 | 25.901146 | 103 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.476923 | false | false | 3 |
8548ea1055365f1b315dfe004606686c8b52db5e | 25,366,076,893,862 | 2149cbce3e7af851ce26ab8c2e091feb44e012fb | /Forloop.java | a66d5096317b49b7f42f60a60396fbb3fbf1a471 | [] | no_license | rmatin20/Java-Basics | https://github.com/rmatin20/Java-Basics | 236e9d5addc873d1ff97f76266f0601d6e3d28d3 | 0b12521d10a5756088c59ca3837b6987bae84d18 | refs/heads/main | 2023-03-28T16:09:00.557000 | 2021-03-27T17:34:48 | 2021-03-27T17:34:48 | 352,134,641 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package loops;
public class Forloop {
public static void main(String[] args) {
for (int i=1; i<=10;i=i+2) {
System.out.println(i);// put i in parentheses. Prints 1 3 5 7 9
//System.out.println("odd numbers");// prints odd numbers
}
}
}
| UTF-8 | Java | 276 | java | Forloop.java | Java | [] | null | [] | package loops;
public class Forloop {
public static void main(String[] args) {
for (int i=1; i<=10;i=i+2) {
System.out.println(i);// put i in parentheses. Prints 1 3 5 7 9
//System.out.println("odd numbers");// prints odd numbers
}
}
}
| 276 | 0.583333 | 0.550725 | 17 | 14.235294 | 21.407887 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.176471 | false | false | 3 |
9dd090e6d90c0dd0cbc478f48339f9b842ee5c63 | 25,366,076,894,283 | 8233be07b95bdf170f0e36123d8d8c1aa077475e | /httb/src/main/java/com/huatu/ou/role/dao/RoleDao.java | 3b3559d912bd83d99037b897f3151e7e8e95030b | [] | no_license | missmissing/myProjects | https://github.com/missmissing/myProjects | 284061a0cdbc341a2b9f0180556f6e458f539faa | 2fec0a052c9d82c0bef4af7b21b22bf5849f59e8 | refs/heads/master | 2021-05-23T05:56:33.067000 | 2018-01-24T07:33:28 | 2018-01-24T07:33:28 | 94,732,864 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.huatu.ou.role.dao;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import com.huatu.core.dao.impl.SqlBaseDaoImpl;
import com.huatu.core.exception.HttbException;
import com.huatu.ou.role.model.Role;
import com.huatu.ou.roleMenu.model.Role_Menu;
@Repository
public class RoleDao{
@Autowired
private SqlBaseDaoImpl sqlBaseDaoImpl;
private static final String NameSpace = "com.huatu.ou.role.model.Role.";
public List<Role> selectRoles(Map<String, Object> condition) throws HttbException {
try {
return sqlBaseDaoImpl.selectList(NameSpace + "selectList", condition);
} catch (Exception e) {
throw new HttbException(this.getClass() + "根据参数查询角色时发生异常", e);
}
}
/**
* 添加角色
*
* @param role
* @return
* @throws HttbException
*/
public int insert(Role role) throws HttbException {
try {
return sqlBaseDaoImpl.insert(NameSpace +"insert", role);
} catch (Exception e) {
throw new HttbException(this.getClass()+"添加角色时发生异常", e);
}
}
/**
* 修改角色
*
* @param role
* @return
* @throws HttbException
*/
public int update(Role role) throws HttbException {
try {
return sqlBaseDaoImpl.update(NameSpace+"update", role);
} catch (Exception e) {
throw new HttbException(this.getClass()+"修改角色时发生异常", e);
}
}
/**
* 修改角色
*
* @param role
* @return
* @throws HttbException
*/
public int delete(Role role) throws HttbException {
try {
String[] roleIds = role.getId().split(",");
HashMap map = new HashMap();
map.put("ids", roleIds);
return sqlBaseDaoImpl.delete(NameSpace+"deleteByPrimaryKey", map);
} catch (Exception e) {
throw new HttbException(this.getClass()+"修改角色时发生异常", e);
}
}
/**
* 判断角色是否和用户绑定
*
* @param role
* @return
* @throws HttbException
*/
public int roleIsUesd(String role_id) throws HttbException {
try {
int count = sqlBaseDaoImpl.get(NameSpace +"roleIsUesd",role_id);
return count;
} catch (Exception e) {
throw new HttbException(this.getClass()+"判断角色是否和用户绑定时发生异常", e);
}
}
public int selectCount() throws HttbException {
try {
int count = sqlBaseDaoImpl.get(NameSpace +"selectCount");
return count;
} catch (Exception e) {
throw new HttbException(this.getClass()+"查询角色总数量时发生异常", e);
}
}
}
| UTF-8 | Java | 2,689 | java | RoleDao.java | Java | [] | null | [] | package com.huatu.ou.role.dao;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import com.huatu.core.dao.impl.SqlBaseDaoImpl;
import com.huatu.core.exception.HttbException;
import com.huatu.ou.role.model.Role;
import com.huatu.ou.roleMenu.model.Role_Menu;
@Repository
public class RoleDao{
@Autowired
private SqlBaseDaoImpl sqlBaseDaoImpl;
private static final String NameSpace = "com.huatu.ou.role.model.Role.";
public List<Role> selectRoles(Map<String, Object> condition) throws HttbException {
try {
return sqlBaseDaoImpl.selectList(NameSpace + "selectList", condition);
} catch (Exception e) {
throw new HttbException(this.getClass() + "根据参数查询角色时发生异常", e);
}
}
/**
* 添加角色
*
* @param role
* @return
* @throws HttbException
*/
public int insert(Role role) throws HttbException {
try {
return sqlBaseDaoImpl.insert(NameSpace +"insert", role);
} catch (Exception e) {
throw new HttbException(this.getClass()+"添加角色时发生异常", e);
}
}
/**
* 修改角色
*
* @param role
* @return
* @throws HttbException
*/
public int update(Role role) throws HttbException {
try {
return sqlBaseDaoImpl.update(NameSpace+"update", role);
} catch (Exception e) {
throw new HttbException(this.getClass()+"修改角色时发生异常", e);
}
}
/**
* 修改角色
*
* @param role
* @return
* @throws HttbException
*/
public int delete(Role role) throws HttbException {
try {
String[] roleIds = role.getId().split(",");
HashMap map = new HashMap();
map.put("ids", roleIds);
return sqlBaseDaoImpl.delete(NameSpace+"deleteByPrimaryKey", map);
} catch (Exception e) {
throw new HttbException(this.getClass()+"修改角色时发生异常", e);
}
}
/**
* 判断角色是否和用户绑定
*
* @param role
* @return
* @throws HttbException
*/
public int roleIsUesd(String role_id) throws HttbException {
try {
int count = sqlBaseDaoImpl.get(NameSpace +"roleIsUesd",role_id);
return count;
} catch (Exception e) {
throw new HttbException(this.getClass()+"判断角色是否和用户绑定时发生异常", e);
}
}
public int selectCount() throws HttbException {
try {
int count = sqlBaseDaoImpl.get(NameSpace +"selectCount");
return count;
} catch (Exception e) {
throw new HttbException(this.getClass()+"查询角色总数量时发生异常", e);
}
}
}
| 2,689 | 0.661348 | 0.661348 | 103 | 22.339806 | 22.98271 | 84 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.76699 | false | false | 3 |
b7df5526dd10a60bc5fe31254d29b623599ae488 | 13,460,427,520,243 | b27f68aa5f6b6da64324c00b406bd6a2eaeb55da | /gestion.hotel/gestion.hotel-ejb/src/main/java/persistence/Reservation.java | 0e6a3814d3e08fd52424e475b075cc83d6140d62 | [] | no_license | barouniimen/4sim2 | https://github.com/barouniimen/4sim2 | afd0e987f4073b0b889d4b710a29a94bd727ef15 | a4982a135db7a6621e8451b1813b00fd2548145c | refs/heads/master | 2021-01-11T17:43:26.547000 | 2017-03-07T12:48:59 | 2017-03-07T12:48:59 | 79,824,637 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package persistence;
import java.io.Serializable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
@Entity
public class Reservation implements Serializable{
private ReservationPk pk;
private int daysToStay;
private int rommNumber;
private Client client;
private Hotel hotel;
public int getDaysToStay() {
return daysToStay;
}
public void setDaysToStay(int daysToStay) {
this.daysToStay = daysToStay;
}
@EmbeddedId
public ReservationPk getPk() {
return pk;
}
public void setPk(ReservationPk pk) {
this.pk = pk;
}
public int getRommNumber() {
return rommNumber;
}
public void setRommNumber(int rommNumber) {
this.rommNumber = rommNumber;
}
@ManyToOne
@JoinColumn(name = "idClient", insertable = false, updatable = false)
public Client getClient() {
return client;
}
public void setClient(Client client) {
this.client = client;
}
@ManyToOne
@JoinColumn(name = "idHotel", insertable = false, updatable = false)
public Hotel getHotel() {
return hotel;
}
public void setHotel(Hotel hotel) {
this.hotel = hotel;
}
}
| UTF-8 | Java | 1,266 | java | Reservation.java | Java | [] | null | [] | package persistence;
import java.io.Serializable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
@Entity
public class Reservation implements Serializable{
private ReservationPk pk;
private int daysToStay;
private int rommNumber;
private Client client;
private Hotel hotel;
public int getDaysToStay() {
return daysToStay;
}
public void setDaysToStay(int daysToStay) {
this.daysToStay = daysToStay;
}
@EmbeddedId
public ReservationPk getPk() {
return pk;
}
public void setPk(ReservationPk pk) {
this.pk = pk;
}
public int getRommNumber() {
return rommNumber;
}
public void setRommNumber(int rommNumber) {
this.rommNumber = rommNumber;
}
@ManyToOne
@JoinColumn(name = "idClient", insertable = false, updatable = false)
public Client getClient() {
return client;
}
public void setClient(Client client) {
this.client = client;
}
@ManyToOne
@JoinColumn(name = "idHotel", insertable = false, updatable = false)
public Hotel getHotel() {
return hotel;
}
public void setHotel(Hotel hotel) {
this.hotel = hotel;
}
}
| 1,266 | 0.703791 | 0.703791 | 64 | 17.78125 | 17.288425 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.1875 | false | false | 3 |
3324a0317ea9e604437a6e21ceec95023215b8e1 | 5,480,378,279,687 | 0c71df9fb5ab706d9ecdc7430427da13d606bbc6 | /sha-256/Solution.java | 69c82514c97c2c266464844891b59798cf7e7164 | [] | no_license | dlee0113/hackerrank-1 | https://github.com/dlee0113/hackerrank-1 | f8447cf41b199950f1b98b966cc1b4599f7ab354 | 49ebe518d72ca3248b3550e6aed11676af8d2749 | refs/heads/master | 2021-01-12T13:39:15.156000 | 2016-10-02T17:19:04 | 2016-10-02T17:19:04 | 70,055,328 | 1 | 0 | null | true | 2016-10-05T11:47:22 | 2016-10-05T11:47:20 | 2016-10-05T11:47:21 | 2016-10-02T17:19:42 | 530 | 0 | 0 | 0 | Java | null | null | import java.security.MessageDigest;
import java.util.Scanner;
public class Solution {
public static void main(String[] args) throws Throwable {
Scanner sc = new Scanner(System.in);
String S = sc.next();
for (byte oneByte : MessageDigest.getInstance("SHA-256").digest(S.getBytes())) {
System.out.printf("%02x", oneByte);
}
System.out.println();
sc.close();
}
static String padZeros(int size, String str) {
return repeat('0', size - str.length()) + str;
}
static String repeat(char ch, int number) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < number; i++) {
sb.append(ch);
}
return sb.toString();
}
}
| UTF-8 | Java | 656 | java | Solution.java | Java | [] | null | [] | import java.security.MessageDigest;
import java.util.Scanner;
public class Solution {
public static void main(String[] args) throws Throwable {
Scanner sc = new Scanner(System.in);
String S = sc.next();
for (byte oneByte : MessageDigest.getInstance("SHA-256").digest(S.getBytes())) {
System.out.printf("%02x", oneByte);
}
System.out.println();
sc.close();
}
static String padZeros(int size, String str) {
return repeat('0', size - str.length()) + str;
}
static String repeat(char ch, int number) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < number; i++) {
sb.append(ch);
}
return sb.toString();
}
}
| 656 | 0.661585 | 0.650915 | 29 | 21.620689 | 21.416098 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.758621 | false | false | 3 |
f2a8823d788090f5625e6c11321b4a811bd86ba3 | 37,323,265,826,926 | cbf110e58099e95585a090227613897d4879a32f | /db44-imscp/src/main/java/com/suptc/db44/imscp/login/check/LoginCheckChain.java | 4412657653d77a5a74d80b78a57a005afbe3bd9c | [] | no_license | wanjch/db44 | https://github.com/wanjch/db44 | 17a91e83a913964f042e3b64b747463d5f35f8ed | 71a528cea3a5efb74f8c632adecb1297470f39da | refs/heads/master | 2020-03-10T12:31:15.808000 | 2018-04-19T01:34:52 | 2018-04-19T01:34:52 | 129,380,611 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.suptc.db44.imscp.login.check;
import java.util.ArrayList;
import java.util.List;
import com.suptc.db44.imscp.config.ImscpConfig;
public class LoginCheckChain implements LoginCheck {
List<LoginCheck> Checks = new ArrayList<LoginCheck>();
// 用于标记规则的引用顺序
int index = 0;
// 往规则链条中添加规则
public LoginCheckChain addLoginCheck(LoginCheck f) {
Checks.add(f);
return this;
}
@Override
public String doCheck() {
String success = ImscpConfig.get("success");
for (LoginCheck check : Checks) {
String result = check.doCheck();
if (!result.equals(success)) {
return result;
}
}
return success;
}
}
| UTF-8 | Java | 678 | java | LoginCheckChain.java | Java | [] | null | [] | package com.suptc.db44.imscp.login.check;
import java.util.ArrayList;
import java.util.List;
import com.suptc.db44.imscp.config.ImscpConfig;
public class LoginCheckChain implements LoginCheck {
List<LoginCheck> Checks = new ArrayList<LoginCheck>();
// 用于标记规则的引用顺序
int index = 0;
// 往规则链条中添加规则
public LoginCheckChain addLoginCheck(LoginCheck f) {
Checks.add(f);
return this;
}
@Override
public String doCheck() {
String success = ImscpConfig.get("success");
for (LoginCheck check : Checks) {
String result = check.doCheck();
if (!result.equals(success)) {
return result;
}
}
return success;
}
}
| 678 | 0.712264 | 0.704403 | 33 | 18.272728 | 18.089462 | 55 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.393939 | false | false | 3 |
96336e927ed4e3ba6810d790832ff6005c34a00c | 4,415,226,420,023 | e891ea2496b5f162a60eb4c6f7d04e8ae34f66e0 | /src/EstructuraDatos/EjerciciosRecursivos/MCMRecursivo.java | 101daae77d963e24eece58e27a56198c2f83251c | [] | no_license | JuanfelipeX/3_Semestre | https://github.com/JuanfelipeX/3_Semestre | 812bc675f846543f66d66069eda1fba81b154a7b | cfa30db5caf245a9b8908377ec9814ac4124167f | refs/heads/master | 2023-05-14T00:56:17.504000 | 2021-06-03T17:13:19 | 2021-06-03T17:13:19 | 341,965,858 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package EstructuraDatos.EjerciciosRecursivos;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class MCMRecursivo {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int number1 = Integer.parseInt(br.readLine());
int number2 = Integer.parseInt(br.readLine());
System.out.println(miniMinimoComunMultiplo(number1, number2));
}
public static int mcdRecursivo(int p, int q) {
if (p < q) {
return mcdRecursivo(q, p);
} else if (q == 0) {
return p;
}
return mcdRecursivo(q, p % q);
}
public static int miniMinimoComunMultiplo(int number1, int number2) {
return (number1 * number2)/ mcdRecursivo(number1, number2);
}
}
| UTF-8 | Java | 880 | java | MCMRecursivo.java | Java | [] | null | [] | package EstructuraDatos.EjerciciosRecursivos;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class MCMRecursivo {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int number1 = Integer.parseInt(br.readLine());
int number2 = Integer.parseInt(br.readLine());
System.out.println(miniMinimoComunMultiplo(number1, number2));
}
public static int mcdRecursivo(int p, int q) {
if (p < q) {
return mcdRecursivo(q, p);
} else if (q == 0) {
return p;
}
return mcdRecursivo(q, p % q);
}
public static int miniMinimoComunMultiplo(int number1, int number2) {
return (number1 * number2)/ mcdRecursivo(number1, number2);
}
}
| 880 | 0.651136 | 0.638636 | 32 | 26.5 | 25.77911 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5625 | false | false | 3 |
d3450e52984d5a7c83fdbee8392bce98bac97e7a | 36,842,229,493,386 | 6b89e89836ab48b66de85bf48d1a19f4c7abbdcd | /app/src/main/java/org/kiwix/kiwixmobile/zim_manager/fileselect_view/ZimFileSelectPresenter.java | 8b72d49b4be35261096f067fec6ed7c53eec045a | [] | no_license | bjacotg/kiwix-android | https://github.com/bjacotg/kiwix-android | 4b0e1842f14f4ea5632e5da14b0cf5d117517456 | 6104a555fddbb01da01083c85f386033f4b719ba | refs/heads/master | 2020-12-03T01:57:47.692000 | 2017-06-30T14:45:49 | 2017-06-30T14:45:49 | 95,887,535 | 0 | 0 | null | true | 2017-06-30T12:44:26 | 2017-06-30T12:44:26 | 2017-06-30T03:06:50 | 2017-06-30T12:44:05 | 146,692 | 0 | 0 | 0 | null | null | null | package org.kiwix.kiwixmobile.zim_manager.fileselect_view;
import android.content.Context;
import org.kiwix.kiwixmobile.base.BasePresenter;
import org.kiwix.kiwixmobile.database.BookDao;
import org.kiwix.kiwixmobile.database.KiwixDatabase;
import org.kiwix.kiwixmobile.library.entity.LibraryNetworkEntity;
import java.util.ArrayList;
import javax.inject.Inject;
/**
* Created by EladKeyshawn on 06/04/2017.
*/
public class ZimFileSelectPresenter extends BasePresenter<ZimFileSelectViewCallback> {
@Inject
public ZimFileSelectPresenter() {
}
@Override
public void attachView(ZimFileSelectViewCallback mvpView) {
super.attachView(mvpView);
}
@Override
public void detachView() {
super.detachView();
}
public void loadLocalZimFileFromDb(Context context){
BookDao bookDao = new BookDao(KiwixDatabase.getInstance(context));
ArrayList<LibraryNetworkEntity.Book> books = bookDao.getBooks();
getMvpView().showFiles(books);
}
}
| UTF-8 | Java | 975 | java | ZimFileSelectPresenter.java | Java | [
{
"context": "t;\n\nimport javax.inject.Inject;\n\n/**\n * Created by EladKeyshawn on 06/04/2017.\n */\n\npublic class ZimFileSele",
"end": 392,
"score": 0.7435007095336914,
"start": 385,
"tag": "USERNAME",
"value": "EladKey"
},
{
"context": "rt javax.inject.Inject;\n\n/**\n * Create... | null | [] | package org.kiwix.kiwixmobile.zim_manager.fileselect_view;
import android.content.Context;
import org.kiwix.kiwixmobile.base.BasePresenter;
import org.kiwix.kiwixmobile.database.BookDao;
import org.kiwix.kiwixmobile.database.KiwixDatabase;
import org.kiwix.kiwixmobile.library.entity.LibraryNetworkEntity;
import java.util.ArrayList;
import javax.inject.Inject;
/**
* Created by EladKeyshawn on 06/04/2017.
*/
public class ZimFileSelectPresenter extends BasePresenter<ZimFileSelectViewCallback> {
@Inject
public ZimFileSelectPresenter() {
}
@Override
public void attachView(ZimFileSelectViewCallback mvpView) {
super.attachView(mvpView);
}
@Override
public void detachView() {
super.detachView();
}
public void loadLocalZimFileFromDb(Context context){
BookDao bookDao = new BookDao(KiwixDatabase.getInstance(context));
ArrayList<LibraryNetworkEntity.Book> books = bookDao.getBooks();
getMvpView().showFiles(books);
}
}
| 975 | 0.774359 | 0.766154 | 41 | 22.780487 | 25.213732 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.317073 | false | false | 3 |
106bae0dc423fad15da71db3d162fbb4d6d960f5 | 36,842,229,489,852 | 5ceb0fba4fc4aa60c57f1eb37f84896da8ed7af5 | /app/src/main/java/com/example/service_example_edson/StressLevelsProcessing.java | f0337cad2d01740270b54b55c85d493bed7ab4e1 | [] | no_license | edsonlipa/kusisqa-stress-detector | https://github.com/edsonlipa/kusisqa-stress-detector | 6db3df12548df0053fa4a0892f539513c5298ebd | 2c18c06527bf511bf0f8971a267f9a4d903805a4 | refs/heads/main | 2023-06-28T21:38:25.755000 | 2021-07-30T11:35:26 | 2021-07-30T11:35:26 | 391,038,879 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.service_example_edson;
import android.util.Log;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class StressLevelsProcessing {
List<Double> signal;
public StressLevelsProcessing( List<Double> data){
this.signal=data;
};
// 1) Preprocesing (noise reduction)
List<Double> medianFilter(List<Double> signal) {
int lenFilter = 25; //TODO: default 100;
int lenSignal = signal.size();
List<Double> suavizado = Collections.emptyList();
int mitad = lenFilter / 2; //divicion entera
for (int i = 0; i < lenSignal; i++) {
int initIndex = i - mitad;
Double s = 0.0;
int counter = 0;
for (int f = 0; f < lenFilter; f++) {
int currentIndex = initIndex + f;
//check valid current index
if (0 < currentIndex && currentIndex < lenSignal) {
s += signal.get(currentIndex); // *filter[f] o (*1)
counter += 1;
}
}
suavizado.add(s / counter);
}
return suavizado;
}
//2 Agregation
List<Double> aggregation(List<Double> signal) {
int lenFilter = 60; //TODO: default 240(4hz) 1 minute sampling
List<Double> aggregated = Collections.emptyList();
int lenSignal = signal.size();
int mitad = lenFilter / 2;
for (int i = 0; i < lenSignal; i++) {
int initIndex = i - mitad;
Double maxValue = 0.0;
for (int f = 0; f < lenFilter; f++) {
int currentIndex = initIndex + f;
//check valid current index
if (0 < currentIndex && currentIndex < lenSignal) {
maxValue = Math.max(maxValue, signal.get(currentIndex));
}
}
aggregated.add(maxValue);
}
return aggregated;
}
// 3) Discretization
Double mean(List<Double> signal) {
Double s = 0.0;
for (Double e : signal) {
s = s + e;
}
return s / (signal.size());
}
Double standardDeviation(List<Double> signal) {
Double variance = 0.0;
Double m = mean(signal);
for (int i = 0; i < signal.size(); ++i) {
variance += Math.pow(signal.get(i) - m, 2.0);
}
Double stdDeviation = Math.sqrt(variance / signal.size());
return stdDeviation;
}
List<Double> znorm(List<Double> signal, Double znormTheshold ) {// znormTheshold = 0.01
List<Double> r = Collections.emptyList();
Double std = standardDeviation(signal);
Log.i("STD: $std", String.valueOf(std));
if (std < znormTheshold) {
return signal;
} else {
Double m = mean(signal);
Log.i("Media: $m", String.valueOf(m));
signal.forEach((e) ->{
r.add((e - m) / std);
});
return r;
}
}
List<Double> paa(List<Double> series, int paaSegments) {
int seriesLen = series.size();
//check for the trivial case
if (seriesLen == paaSegments) {
return series;
} else {
return series;
//todo: not using for this project
}
}
List<Double> aggregationPAA(List<Double> signal) {
List<Double> datZnorm = znorm(signal,0.01);
List<Double> r = paa(datZnorm, signal.size());
return r;
}
// 3.1 -----------------final dicretization
// Convert a numerical index to a char
String idx2letter(int idx) {
if (0 <= idx && idx < 5) {
return String.valueOf(97 + idx);
} else {
String text = "Warning: idx2letter idx out of range";
Log.i("idx2letter",text);//"\x1B[33m$text\x1B[0m"
return String.valueOf(97);
}
}
// num-to-string conversion.
List<String> ts_to_string(List<Double> series, List<Double> cuts) {
int a_size = cuts.size();
List<String> sax = Collections.emptyList();
for (int i = 0; i < series.size(); i++) {
Double num = series.get(i);
//if the number below 0, start from the bottom, or else from the top
int j;
if (num >= 0) {
j = a_size - 1;
while ((j > 0) && (cuts.get(j) >= num)) {
j = j - 1;
}
sax.add(idx2letter(j));
} else {
j = 1;
while ((j < a_size) && (cuts.get(j) <= num)) {
j = j + 1;
}
sax.add(idx2letter(j - 1));
}
}
return sax;
}
List<Double> cuts_for_asize(Integer a_size) {
Double inf = 999999.0;
List<Double> options= new ArrayList<Double>();
if (a_size==3){
options.add(-inf);
options.add(-0.4307273);
options.add(0.4307273);
}else if(a_size==5){
options.add(-inf);
options.add(-0.841621233572914);
options.add(-0.2533471031358);
options.add(0.2533471031358);
options.add(0.841621233572914);
}
return options;
}
List<Integer> discretizar(List<Double> signal) {
List<String> abc =
ts_to_string(signal, cuts_for_asize(5)); // abc : (cadena de String)
List<Integer> r = new ArrayList<>();
Integer val =0;
for (Integer i = 0; i < abc.size(); i++) {
switch (abc.get(i)){
case "a": val= 1;
break;
case "b": val = 2;
break;
case "c": val = 3;
break;
case "d": val = 4;
break;
case "e": val = 5;
break;
}
r.add(val);
}
return r;
}
List<Double> getResult() {
List<Double> signalSuavizado = medianFilter(signal);
List<Double> aggregated = aggregation(signalSuavizado);
List<Double> ppaV = aggregationPAA(aggregated);
List<Integer> eda_discretizado = discretizar(ppaV);
List<Double> r = new ArrayList<>();
eda_discretizado.forEach((e) -> {
r.add(e * 1.0);
});
return r;
}
}
| UTF-8 | Java | 6,536 | java | StressLevelsProcessing.java | Java | [] | null | [] | package com.example.service_example_edson;
import android.util.Log;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class StressLevelsProcessing {
List<Double> signal;
public StressLevelsProcessing( List<Double> data){
this.signal=data;
};
// 1) Preprocesing (noise reduction)
List<Double> medianFilter(List<Double> signal) {
int lenFilter = 25; //TODO: default 100;
int lenSignal = signal.size();
List<Double> suavizado = Collections.emptyList();
int mitad = lenFilter / 2; //divicion entera
for (int i = 0; i < lenSignal; i++) {
int initIndex = i - mitad;
Double s = 0.0;
int counter = 0;
for (int f = 0; f < lenFilter; f++) {
int currentIndex = initIndex + f;
//check valid current index
if (0 < currentIndex && currentIndex < lenSignal) {
s += signal.get(currentIndex); // *filter[f] o (*1)
counter += 1;
}
}
suavizado.add(s / counter);
}
return suavizado;
}
//2 Agregation
List<Double> aggregation(List<Double> signal) {
int lenFilter = 60; //TODO: default 240(4hz) 1 minute sampling
List<Double> aggregated = Collections.emptyList();
int lenSignal = signal.size();
int mitad = lenFilter / 2;
for (int i = 0; i < lenSignal; i++) {
int initIndex = i - mitad;
Double maxValue = 0.0;
for (int f = 0; f < lenFilter; f++) {
int currentIndex = initIndex + f;
//check valid current index
if (0 < currentIndex && currentIndex < lenSignal) {
maxValue = Math.max(maxValue, signal.get(currentIndex));
}
}
aggregated.add(maxValue);
}
return aggregated;
}
// 3) Discretization
Double mean(List<Double> signal) {
Double s = 0.0;
for (Double e : signal) {
s = s + e;
}
return s / (signal.size());
}
Double standardDeviation(List<Double> signal) {
Double variance = 0.0;
Double m = mean(signal);
for (int i = 0; i < signal.size(); ++i) {
variance += Math.pow(signal.get(i) - m, 2.0);
}
Double stdDeviation = Math.sqrt(variance / signal.size());
return stdDeviation;
}
List<Double> znorm(List<Double> signal, Double znormTheshold ) {// znormTheshold = 0.01
List<Double> r = Collections.emptyList();
Double std = standardDeviation(signal);
Log.i("STD: $std", String.valueOf(std));
if (std < znormTheshold) {
return signal;
} else {
Double m = mean(signal);
Log.i("Media: $m", String.valueOf(m));
signal.forEach((e) ->{
r.add((e - m) / std);
});
return r;
}
}
List<Double> paa(List<Double> series, int paaSegments) {
int seriesLen = series.size();
//check for the trivial case
if (seriesLen == paaSegments) {
return series;
} else {
return series;
//todo: not using for this project
}
}
List<Double> aggregationPAA(List<Double> signal) {
List<Double> datZnorm = znorm(signal,0.01);
List<Double> r = paa(datZnorm, signal.size());
return r;
}
// 3.1 -----------------final dicretization
// Convert a numerical index to a char
String idx2letter(int idx) {
if (0 <= idx && idx < 5) {
return String.valueOf(97 + idx);
} else {
String text = "Warning: idx2letter idx out of range";
Log.i("idx2letter",text);//"\x1B[33m$text\x1B[0m"
return String.valueOf(97);
}
}
// num-to-string conversion.
List<String> ts_to_string(List<Double> series, List<Double> cuts) {
int a_size = cuts.size();
List<String> sax = Collections.emptyList();
for (int i = 0; i < series.size(); i++) {
Double num = series.get(i);
//if the number below 0, start from the bottom, or else from the top
int j;
if (num >= 0) {
j = a_size - 1;
while ((j > 0) && (cuts.get(j) >= num)) {
j = j - 1;
}
sax.add(idx2letter(j));
} else {
j = 1;
while ((j < a_size) && (cuts.get(j) <= num)) {
j = j + 1;
}
sax.add(idx2letter(j - 1));
}
}
return sax;
}
List<Double> cuts_for_asize(Integer a_size) {
Double inf = 999999.0;
List<Double> options= new ArrayList<Double>();
if (a_size==3){
options.add(-inf);
options.add(-0.4307273);
options.add(0.4307273);
}else if(a_size==5){
options.add(-inf);
options.add(-0.841621233572914);
options.add(-0.2533471031358);
options.add(0.2533471031358);
options.add(0.841621233572914);
}
return options;
}
List<Integer> discretizar(List<Double> signal) {
List<String> abc =
ts_to_string(signal, cuts_for_asize(5)); // abc : (cadena de String)
List<Integer> r = new ArrayList<>();
Integer val =0;
for (Integer i = 0; i < abc.size(); i++) {
switch (abc.get(i)){
case "a": val= 1;
break;
case "b": val = 2;
break;
case "c": val = 3;
break;
case "d": val = 4;
break;
case "e": val = 5;
break;
}
r.add(val);
}
return r;
}
List<Double> getResult() {
List<Double> signalSuavizado = medianFilter(signal);
List<Double> aggregated = aggregation(signalSuavizado);
List<Double> ppaV = aggregationPAA(aggregated);
List<Integer> eda_discretizado = discretizar(ppaV);
List<Double> r = new ArrayList<>();
eda_discretizado.forEach((e) -> {
r.add(e * 1.0);
});
return r;
}
}
| 6,536 | 0.493421 | 0.468176 | 208 | 30.423077 | 20.001295 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.639423 | false | false | 3 |
adf56c8bfb148bbf48ceb32ecadb2df0407f7865 | 5,858,335,411,633 | 004c01f2bdf2626a9f08ad7aeba9940c3488516b | /Java-Algorithm-Practice/src/Scanner/NumberCount.java | a314ee7ec1db04758f03f04d68ebb64338f14204 | [] | no_license | tjsk002/Algorithm | https://github.com/tjsk002/Algorithm | b42f26a2130a7b0a230b9a78cf1b1c260c5af853 | 8ffcba71a5659811a96050febddaaf6cb2b05d81 | refs/heads/master | 2023-04-09T19:18:39.637000 | 2022-02-07T12:12:38 | 2022-02-07T12:12:38 | 348,974,403 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Scanner;
import java.util.Scanner;
public class NumberCount {
public static void main(String[] args) {
/*
* 세 개의 자연수 A, B, C가 주어질 때 A × B × C를 계산한 결과에
* 0부터 9까지 각각의 숫자가 몇 번씩 쓰였는지를 구하는 프로그램을 작성하시오.
예를 들어 A = 150, B = 266, C = 427 이라면 A × B × C = 150 × 266 × 427 = 17037300 이 되고,
계산한 결과 17037300 에는 0이 3번, 1이 1번, 3이 2번, 7이 2번 쓰였다.
*/
Scanner sc = new Scanner(System.in);
int mul = sc.nextInt()*sc.nextInt()*sc.nextInt();
System.out.println(mul); //17037300
// String으로 타입 변환 후 charAt()을 사용
String str = String.valueOf(mul);
for(int i = 0; i < 10; i++) {
// 숫자 1부터 9까지
int count= 0;
str.charAt(i);
// System.out.println(str.charAt(i));
// 1 7 0 3 7 3 0 0
for (int j = 0; j < str.length(); j++) {
if((str.charAt(j) - '0') == i) {
count++;
}
}
System.out.println(count);
}
}
}
| UHC | Java | 1,058 | java | NumberCount.java | Java | [] | null | [] | package Scanner;
import java.util.Scanner;
public class NumberCount {
public static void main(String[] args) {
/*
* 세 개의 자연수 A, B, C가 주어질 때 A × B × C를 계산한 결과에
* 0부터 9까지 각각의 숫자가 몇 번씩 쓰였는지를 구하는 프로그램을 작성하시오.
예를 들어 A = 150, B = 266, C = 427 이라면 A × B × C = 150 × 266 × 427 = 17037300 이 되고,
계산한 결과 17037300 에는 0이 3번, 1이 1번, 3이 2번, 7이 2번 쓰였다.
*/
Scanner sc = new Scanner(System.in);
int mul = sc.nextInt()*sc.nextInt()*sc.nextInt();
System.out.println(mul); //17037300
// String으로 타입 변환 후 charAt()을 사용
String str = String.valueOf(mul);
for(int i = 0; i < 10; i++) {
// 숫자 1부터 9까지
int count= 0;
str.charAt(i);
// System.out.println(str.charAt(i));
// 1 7 0 3 7 3 0 0
for (int j = 0; j < str.length(); j++) {
if((str.charAt(j) - '0') == i) {
count++;
}
}
System.out.println(count);
}
}
}
| 1,058 | 0.561201 | 0.482679 | 34 | 24.470589 | 19.781506 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3 | false | false | 3 |
c376062fe9781e70a52483570fff2c0dd1875128 | 5,686,536,718,703 | 3e5367ced14c7611f641880e5fd6c53a53069f2e | /src/Lesson25/HW25.java | b343d604ee43a6a0b8ed952246d503072856a794 | [] | no_license | DimaBog22/java-for-beginners-zaur-tregulov | https://github.com/DimaBog22/java-for-beginners-zaur-tregulov | f75becd2ff24be75d2d7e32f6b178a2a903a89e9 | 8c582baac0705ffc180f26f34338c1180f39e99e | refs/heads/main | 2023-04-01T19:00:53.050000 | 2021-04-08T19:12:35 | 2021-04-08T19:12:35 | 356,003,312 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package Lesson25;
public class HW25 {
public static void main(String[] args) {
Animal2 a1 = new Mechenosec2("Karl_1");
Animal2 a2 = new Pingvin2("Kovalski_1");
Animal2 a3 = new Lion2("Leva_1");
Fish2 f1 = new Mechenosec2("Karl_2");
Bird2 b1 = new Pingvin2("Kovalski_2");
Mammal2 m1 = new Lion2("Leva_2");
Mechenosec2 mech1 = new Mechenosec2("Karl_3");
Pingvin2 p1 = new Pingvin2("Kovalski_3");
Lion2 l1 = new Lion2("Leva_3");
Speakable s1 = new Pingvin2("Kovalski_4");
Speakable s2 = new Lion2("Leva_4");
Animal2 [] arr1 = {a1, a2, a3, b1, m1, mech1, p1, l1};
Speakable [] arr2 = {s1, s2, b1, m1, p1, l1};
for(Animal2 animal:arr1){
if (animal instanceof Mechenosec2) {
Mechenosec2 m = (Mechenosec2)animal;
System.out.println(m.name);
m.eat();
m.sleep();
m.swim();
} else if (animal instanceof Pingvin2) {
Pingvin2 p = (Pingvin2)animal;
System.out.println(p.name);
p.eat();
p.sleep();
p.fly();
p.speak();
} else if(animal instanceof Lion2) {
Lion2 l = (Lion2)animal;
System.out.println(l.name);
l.eat();
l.sleep();
l.run();
l.speak();
}
System.out.println("*********");
}
for(Speakable spekable:arr2){
if (spekable instanceof Pingvin2) {
Pingvin2 p = (Pingvin2)spekable;
System.out.println(p.name);
p.eat();
p.sleep();
p.fly();
p.speak();
} else if(spekable instanceof Lion2) {
Lion2 l = (Lion2)spekable;
System.out.println(l.name);
l.eat();
l.sleep();
l.run();
l.speak();
}
System.out.println("-------------");
}
}
}
abstract class Animal2{
Animal2(String name) {
this.name = name;
}
String name;
abstract void eat();
abstract void sleep();
}
abstract class Fish2 extends Animal2{
Fish2(String name){
super(name);
this.name = name;
}
abstract void swim();
@Override
public void sleep(){
System.out.println("fish sleeps");
}
}
abstract class Bird2 extends Animal2 implements Speakable{
Bird2(String name){
super(name);
this.name = name;
}
abstract void fly();
@Override
public void speak(){
System.out.println(name + " sings");
}
}
abstract class Mammal2 extends Animal2 implements Speakable{
Mammal2(String name){
super(name);
this.name = name;
}
abstract void run();
}
interface Speakable{
default void speak(){
System.out.println("somebody speaks");
}
}
class Mechenosec2 extends Fish2{
Mechenosec2(String name){
super(name);
this.name = name;
}
@Override
public void swim(){
System.out.println("Mechenosec swims");
}
@Override
public void eat(){
System.out.println("Mechenosec eats food for fish");
}
}
class Pingvin2 extends Bird2{
Pingvin2(String name){
super(name);
this.name = name;
}
@Override
public void eat(){
System.out.println("Pingvin prefers to eat fish");
}
@Override
public void sleep(){
System.out.println("Pingvin prefers to sleep a lot");
}
@Override
public void fly(){
System.out.println("Pingvin can not fly");
}
@Override
public void speak(){
System.out.println("Pingvin can not speak russian");
}
}
class Lion2 extends Mammal2{
Lion2(String name){
super(name);
this.name = name;
}
@Override
public void eat(){
System.out.println("Lion prefers to eat meat");
}
@Override
public void sleep(){
System.out.println("Lion prefers to sleep a lot");
}
@Override
public void run(){
System.out.println("Lion runs like a cat");
}
} | UTF-8 | Java | 4,743 | java | HW25.java | Java | [
{
"context": " {\n \n Animal2 a1 = new Mechenosec2(\"Karl_1\");\n Animal2 a2 = new Pingvin2(\"Kovalski_1\"",
"end": 143,
"score": 0.7953311204910278,
"start": 137,
"tag": "NAME",
"value": "Karl_1"
},
{
"context": "ec2(\"Karl_1\");\n Animal2 a2 = new Pingvi... | null | [] |
package Lesson25;
public class HW25 {
public static void main(String[] args) {
Animal2 a1 = new Mechenosec2("Karl_1");
Animal2 a2 = new Pingvin2("Kovalski_1");
Animal2 a3 = new Lion2("Leva_1");
Fish2 f1 = new Mechenosec2("Karl_2");
Bird2 b1 = new Pingvin2("Kovalski_2");
Mammal2 m1 = new Lion2("Leva_2");
Mechenosec2 mech1 = new Mechenosec2("Karl_3");
Pingvin2 p1 = new Pingvin2("Kovalski_3");
Lion2 l1 = new Lion2("Leva_3");
Speakable s1 = new Pingvin2("Kovalski_4");
Speakable s2 = new Lion2("Leva_4");
Animal2 [] arr1 = {a1, a2, a3, b1, m1, mech1, p1, l1};
Speakable [] arr2 = {s1, s2, b1, m1, p1, l1};
for(Animal2 animal:arr1){
if (animal instanceof Mechenosec2) {
Mechenosec2 m = (Mechenosec2)animal;
System.out.println(m.name);
m.eat();
m.sleep();
m.swim();
} else if (animal instanceof Pingvin2) {
Pingvin2 p = (Pingvin2)animal;
System.out.println(p.name);
p.eat();
p.sleep();
p.fly();
p.speak();
} else if(animal instanceof Lion2) {
Lion2 l = (Lion2)animal;
System.out.println(l.name);
l.eat();
l.sleep();
l.run();
l.speak();
}
System.out.println("*********");
}
for(Speakable spekable:arr2){
if (spekable instanceof Pingvin2) {
Pingvin2 p = (Pingvin2)spekable;
System.out.println(p.name);
p.eat();
p.sleep();
p.fly();
p.speak();
} else if(spekable instanceof Lion2) {
Lion2 l = (Lion2)spekable;
System.out.println(l.name);
l.eat();
l.sleep();
l.run();
l.speak();
}
System.out.println("-------------");
}
}
}
abstract class Animal2{
Animal2(String name) {
this.name = name;
}
String name;
abstract void eat();
abstract void sleep();
}
abstract class Fish2 extends Animal2{
Fish2(String name){
super(name);
this.name = name;
}
abstract void swim();
@Override
public void sleep(){
System.out.println("fish sleeps");
}
}
abstract class Bird2 extends Animal2 implements Speakable{
Bird2(String name){
super(name);
this.name = name;
}
abstract void fly();
@Override
public void speak(){
System.out.println(name + " sings");
}
}
abstract class Mammal2 extends Animal2 implements Speakable{
Mammal2(String name){
super(name);
this.name = name;
}
abstract void run();
}
interface Speakable{
default void speak(){
System.out.println("somebody speaks");
}
}
class Mechenosec2 extends Fish2{
Mechenosec2(String name){
super(name);
this.name = name;
}
@Override
public void swim(){
System.out.println("Mechenosec swims");
}
@Override
public void eat(){
System.out.println("Mechenosec eats food for fish");
}
}
class Pingvin2 extends Bird2{
Pingvin2(String name){
super(name);
this.name = name;
}
@Override
public void eat(){
System.out.println("Pingvin prefers to eat fish");
}
@Override
public void sleep(){
System.out.println("Pingvin prefers to sleep a lot");
}
@Override
public void fly(){
System.out.println("Pingvin can not fly");
}
@Override
public void speak(){
System.out.println("Pingvin can not speak russian");
}
}
class Lion2 extends Mammal2{
Lion2(String name){
super(name);
this.name = name;
}
@Override
public void eat(){
System.out.println("Lion prefers to eat meat");
}
@Override
public void sleep(){
System.out.println("Lion prefers to sleep a lot");
}
@Override
public void run(){
System.out.println("Lion runs like a cat");
}
} | 4,743 | 0.465106 | 0.443812 | 227 | 19.894274 | 17.137621 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.387665 | false | false | 3 |
75bb9ba5e80b6f4a4020c0961389f9c29c4e5c51 | 15,015,205,682,030 | 803371eefea7e1a87a1d09b9dd369f06793ac442 | /src/system/masters/narration/DAONarration.java | 44690174f708f8a9a7f946b0d45f34e842c662e5 | [] | no_license | santusr/AccountPackage | https://github.com/santusr/AccountPackage | a38f0188d48be3d2b6f3cc1a2e6d19bb49ff4a20 | 37e0d1c7ef82a5c22d8e180d598a8d4bceba8697 | refs/heads/master | 2021-08-25T09:25:36.455000 | 2021-07-29T14:25:28 | 2021-07-29T14:25:28 | 61,485,014 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package system.masters.narration;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
*
* @author dell
*/
public class DAONarration {
//set Table
private static final String TABAL = "narration";
static void save(OBJNarration obj, Connection conn, int Act) throws SQLException {
if (Act == 1) {
String sql = "INSERT INTO "+TABAL+" (Narrationcode, Narration) VALUES (?,?)";
PreparedStatement st = conn.prepareStatement(sql);
st.setString(1, obj.getCode());
st.setString(2, obj.getName());
st.execute();
} else {
String sql = "UPDATE "+TABAL+" SET Narration = ? WHERE Narrationcode = '" + obj.getCode() + "'";
PreparedStatement st = conn.prepareStatement(sql);
st.setString(1, obj.getName());
st.executeUpdate();
}
}
static OBJNarration getNavi(Connection conn, int Ix) throws SQLException {
OBJNarration obj = null;
// SQL Server
// String sql = "SELECT TOP("+Ix+") * FROM "+TABAL+" ORDER BY Narrationcode ASC";
//MySql
//Ix =-1;
String sql = "SELECT * FROM "+TABAL+" ORDER BY Narrationcode ASC LIMIT"+Ix+",1";
PreparedStatement st = conn.prepareStatement(sql);
st.execute();
ResultSet result = st.getResultSet();
while (result.next()) {
obj = new OBJNarration(
result.getString("Narrationcode"),
result.getString("Narration"));
}
return obj;
}
static OBJNarration serch(Connection conn, String code) throws SQLException {
OBJNarration obj = null;
String sql = "SELECT * FROM "+TABAL+" WHERE Narrationcode = '" + code + "' AND Status = '0'";
PreparedStatement st = conn.prepareStatement(sql);
st.execute();
ResultSet result = st.getResultSet();
while (result.next()) {
obj = new OBJNarration(
result.getString("Narrationcode"),
result.getString("Narration"));
}
return obj;
}
static int getValue(Connection conn) throws SQLException {
int index = 0;
String sql = "SELECT COUNT (*) AS val FROM "+TABAL+"";
PreparedStatement st = conn.prepareStatement(sql);
st.execute();
ResultSet result = st.getResultSet();
while (result.next()) {
// SQL Server
// index++;
//MySql
index = result.getInt("val");
}
return index;
}
static void delete(Connection conn, String code) throws SQLException {
//PreparedStatement st = conn.prepareStatement("DELETE FROM "+TABAL+" WHERE Narrationcode = '" + code + "'");
String sql = "UPDATE " + TABAL + " SET Status = ? WHERE Narrationcode = '" + code + "'";
PreparedStatement st = conn.prepareStatement(sql);
st.setString(1, "1");
st.execute();
st.close();
}
static String genID(Connection conn) throws SQLException {
String ID = "01";
String sql = "SELECT Narrationcode FROM "+TABAL+" ORDER BY Narrationcode";
PreparedStatement st = conn.prepareStatement(sql);
st.execute();
ResultSet result = st.getResultSet();
while (result.next()) {
String cd = result.getString("Narrationcode");
int i = Integer.parseInt(cd);
i++;
cd = i+"";
i = cd.length();
for (int j = i; j < 2; j++) {
cd = "0"+cd;
}
ID = cd;
}
return ID;
}
}
| UTF-8 | Java | 3,863 | java | DAONarration.java | Java | [
{
"context": ";\nimport java.sql.SQLException;\n\n/**\n *\n * @author dell\n */\npublic class DAONarration {\n //set Table\n",
"end": 278,
"score": 0.9976693987846375,
"start": 274,
"tag": "USERNAME",
"value": "dell"
}
] | null | [] | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package system.masters.narration;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
*
* @author dell
*/
public class DAONarration {
//set Table
private static final String TABAL = "narration";
static void save(OBJNarration obj, Connection conn, int Act) throws SQLException {
if (Act == 1) {
String sql = "INSERT INTO "+TABAL+" (Narrationcode, Narration) VALUES (?,?)";
PreparedStatement st = conn.prepareStatement(sql);
st.setString(1, obj.getCode());
st.setString(2, obj.getName());
st.execute();
} else {
String sql = "UPDATE "+TABAL+" SET Narration = ? WHERE Narrationcode = '" + obj.getCode() + "'";
PreparedStatement st = conn.prepareStatement(sql);
st.setString(1, obj.getName());
st.executeUpdate();
}
}
static OBJNarration getNavi(Connection conn, int Ix) throws SQLException {
OBJNarration obj = null;
// SQL Server
// String sql = "SELECT TOP("+Ix+") * FROM "+TABAL+" ORDER BY Narrationcode ASC";
//MySql
//Ix =-1;
String sql = "SELECT * FROM "+TABAL+" ORDER BY Narrationcode ASC LIMIT"+Ix+",1";
PreparedStatement st = conn.prepareStatement(sql);
st.execute();
ResultSet result = st.getResultSet();
while (result.next()) {
obj = new OBJNarration(
result.getString("Narrationcode"),
result.getString("Narration"));
}
return obj;
}
static OBJNarration serch(Connection conn, String code) throws SQLException {
OBJNarration obj = null;
String sql = "SELECT * FROM "+TABAL+" WHERE Narrationcode = '" + code + "' AND Status = '0'";
PreparedStatement st = conn.prepareStatement(sql);
st.execute();
ResultSet result = st.getResultSet();
while (result.next()) {
obj = new OBJNarration(
result.getString("Narrationcode"),
result.getString("Narration"));
}
return obj;
}
static int getValue(Connection conn) throws SQLException {
int index = 0;
String sql = "SELECT COUNT (*) AS val FROM "+TABAL+"";
PreparedStatement st = conn.prepareStatement(sql);
st.execute();
ResultSet result = st.getResultSet();
while (result.next()) {
// SQL Server
// index++;
//MySql
index = result.getInt("val");
}
return index;
}
static void delete(Connection conn, String code) throws SQLException {
//PreparedStatement st = conn.prepareStatement("DELETE FROM "+TABAL+" WHERE Narrationcode = '" + code + "'");
String sql = "UPDATE " + TABAL + " SET Status = ? WHERE Narrationcode = '" + code + "'";
PreparedStatement st = conn.prepareStatement(sql);
st.setString(1, "1");
st.execute();
st.close();
}
static String genID(Connection conn) throws SQLException {
String ID = "01";
String sql = "SELECT Narrationcode FROM "+TABAL+" ORDER BY Narrationcode";
PreparedStatement st = conn.prepareStatement(sql);
st.execute();
ResultSet result = st.getResultSet();
while (result.next()) {
String cd = result.getString("Narrationcode");
int i = Integer.parseInt(cd);
i++;
cd = i+"";
i = cd.length();
for (int j = i; j < 2; j++) {
cd = "0"+cd;
}
ID = cd;
}
return ID;
}
}
| 3,863 | 0.552679 | 0.549055 | 123 | 30.406504 | 27.295683 | 117 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.617886 | false | false | 3 |
33ec4130c1f7e6acc4aa9ac313d42e41bfb6b59a | 26,431,228,764,886 | 070a01a32110d03e31791ce141e42138eebbf005 | /Sortasc.java | 35c7d68a41d9c309cec3364f13a92653ff3b4c29 | [] | no_license | Nisha556/DataStructre_prog | https://github.com/Nisha556/DataStructre_prog | 7776bd692de11c643c5033712ab3ee7b37af1f59 | e35504f3e1408167c5d97c123cc47c38c58c0a64 | refs/heads/master | 2022-12-07T10:13:29.785000 | 2020-08-31T18:13:04 | 2020-08-31T18:13:04 | 290,836,802 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Sorting_searching;
public class Sortasc {
public static void main(String args[])
{
int[] arr = new int[] {5,3,2};
int temp =0;
//System.out.println("Elements of original array :");
for( int i =0;i<arr.length;i++)
{
//System.out.println(arr[i]);
//System.out.println(arr[i]+"");
for( i = 0;i<arr.length;i++)
{
for(int j=0;j<arr.length;j++)
{
if(arr[i]>arr[j])
{
temp = arr[i];
arr[i]= arr[j];
arr[j] = temp;
System.out.println(arr[i]);
}
}
}
System.out.println();
//System.out.println("Elements of array");
for( i=0;i<arr.length;i++)
{
System.out.println(arr[i]);
}
}
}
}
| UTF-8 | Java | 684 | java | Sortasc.java | Java | [] | null | [] | package Sorting_searching;
public class Sortasc {
public static void main(String args[])
{
int[] arr = new int[] {5,3,2};
int temp =0;
//System.out.println("Elements of original array :");
for( int i =0;i<arr.length;i++)
{
//System.out.println(arr[i]);
//System.out.println(arr[i]+"");
for( i = 0;i<arr.length;i++)
{
for(int j=0;j<arr.length;j++)
{
if(arr[i]>arr[j])
{
temp = arr[i];
arr[i]= arr[j];
arr[j] = temp;
System.out.println(arr[i]);
}
}
}
System.out.println();
//System.out.println("Elements of array");
for( i=0;i<arr.length;i++)
{
System.out.println(arr[i]);
}
}
}
}
| 684 | 0.532164 | 0.520468 | 42 | 15.285714 | 14.62432 | 54 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.809524 | false | false | 3 |
1025bcbc0de7b90e020fa0408c06cdc683e34a2f | 29,094,108,498,683 | e01451f482c54eb354d7228f0f069fb35a0d9e7a | /src/main/java/com/synthesize/test/interfaceExtendes/psvm.java | e8d54fba750480c9b95ffdfa7f419ec7be7cd9cd | [] | no_license | tata6168/utilAndTest | https://github.com/tata6168/utilAndTest | 3dd80bd71c426e7361cae056242f4264c9a28551 | 087363019f972d46c8a52efa6ac090da6daee218 | refs/heads/master | 2022-12-06T17:55:39.598000 | 2020-09-01T01:44:15 | 2020-09-01T01:44:15 | 287,044,562 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.synthesize.test.interfaceExtendes;
public class psvm {
public static void main(String[] args) {
}
}
| UTF-8 | Java | 122 | java | psvm.java | Java | [] | null | [] | package com.synthesize.test.interfaceExtendes;
public class psvm {
public static void main(String[] args) {
}
}
| 122 | 0.704918 | 0.704918 | 7 | 16.428572 | 19.085201 | 46 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.142857 | false | false | 3 |
28d20cba043625ebc51fd536729715329e682eee | 34,136,400,069,839 | 77df61166aaca682849d2c57b479501175d68933 | /app/src/main/java/com/example/a93403/maintainerservice/base/MyApplication.java | 91e7af627112641dccd2f0688ea419d9d3b5a25e | [] | no_license | lizhanxu/MaintainerServer | https://github.com/lizhanxu/MaintainerServer | d30ab1d57d2707613cdea7ca585b0173a2504905 | efec8df7d6909ea8561fea1668223c1dab094f7d | refs/heads/master | 2020-03-30T07:31:34.893000 | 2020-01-10T09:00:55 | 2020-01-10T09:00:55 | 150,945,853 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.a93403.maintainerservice.base;
import android.app.Application;
import android.content.Context;
import org.litepal.LitePal;
import cn.jpush.android.api.JPushInterface;
/**
* Title: CarService
* Date: Create in 2018/4/21 21:56
* Description:
*
* @author Jundger
* @version 1.0
*/
public class MyApplication extends Application {
private static Context context;
public static int judgement= 0;
public static int totalnumber=0;
public static int monthnumber = 0;
public static int todaynumber = 0;
public static Boolean isShowFinishRequestDialog = false;
@Override
public void onCreate() {
super.onCreate();
LitePal.initialize(this);
context = getApplicationContext();
JPushInterface.setDebugMode(true);
JPushInterface.init(this);
}
public static Context getContext() {
return context;
}
}
| UTF-8 | Java | 916 | java | MyApplication.java | Java | [
{
"context": "e in 2018/4/21 21:56\n * Description:\n *\n * @author Jundger\n * @version 1.0\n */\n\npublic class MyApplication e",
"end": 288,
"score": 0.9829514026641846,
"start": 281,
"tag": "USERNAME",
"value": "Jundger"
}
] | null | [] | package com.example.a93403.maintainerservice.base;
import android.app.Application;
import android.content.Context;
import org.litepal.LitePal;
import cn.jpush.android.api.JPushInterface;
/**
* Title: CarService
* Date: Create in 2018/4/21 21:56
* Description:
*
* @author Jundger
* @version 1.0
*/
public class MyApplication extends Application {
private static Context context;
public static int judgement= 0;
public static int totalnumber=0;
public static int monthnumber = 0;
public static int todaynumber = 0;
public static Boolean isShowFinishRequestDialog = false;
@Override
public void onCreate() {
super.onCreate();
LitePal.initialize(this);
context = getApplicationContext();
JPushInterface.setDebugMode(true);
JPushInterface.init(this);
}
public static Context getContext() {
return context;
}
}
| 916 | 0.693231 | 0.669214 | 42 | 20.809525 | 17.802137 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.404762 | false | false | 3 |
6db09d9e5695c8b37f39009c333f3dffdecbe3fe | 10,599,979,346,071 | 35db0958054b4c439bddb2d7471ced70cb3921be | /src/main/java/com/linoge/models/shared/Job.java | ca8940bd75eae90c48f8b5e3cec057cf368a2539 | [] | no_license | LinogeAndre/Fitu | https://github.com/LinogeAndre/Fitu | af7e273ed8a9040bcc3c7e710f9b8c6761a4f260 | ee09ea8e8092c672fc945fe7c349d28db74bf432 | refs/heads/master | 2017-12-07T06:50:08.718000 | 2017-01-22T10:21:08 | 2017-01-22T10:21:08 | 79,649,563 | 0 | 1 | null | false | 2017-03-03T07:44:40 | 2017-01-21T14:09:49 | 2017-01-22T07:10:10 | 2017-03-03T07:34:17 | 3,677 | 0 | 0 | 1 | HTML | null | null | package com.linoge.models.shared;
import lombok.Builder;
import lombok.Data;
/**
* Created by Timo on 12.01.2017.
*/
@Data
@Builder
public class Job {
private String organisation;
private String position;
private String dateBegin;
private String dateEnd;
}
| UTF-8 | Java | 277 | java | Job.java | Java | [
{
"context": "ok.Builder;\nimport lombok.Data;\n\n/**\n * Created by Timo on 12.01.2017.\n */\n@Data\n@Builder\npublic class Jo",
"end": 101,
"score": 0.9992073774337769,
"start": 97,
"tag": "NAME",
"value": "Timo"
}
] | null | [] | package com.linoge.models.shared;
import lombok.Builder;
import lombok.Data;
/**
* Created by Timo on 12.01.2017.
*/
@Data
@Builder
public class Job {
private String organisation;
private String position;
private String dateBegin;
private String dateEnd;
}
| 277 | 0.718412 | 0.689531 | 16 | 16.3125 | 12.687192 | 33 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4375 | false | false | 3 |
83056b83504672ce7889d7550ac73eebc332a8d8 | 4,269,197,508,162 | 1edfd650efd8ba4708dbfca922f0435cfbc9cf94 | /src/main/java/cn/mlb/mongo/demo/MongoPojo.java | 0d105049ad3eb9ae4f9c5b9281351ee79d5be516 | [] | no_license | eryeer/mongodbDemo | https://github.com/eryeer/mongodbDemo | e72672512562ec02c6f3755b25241e1594dec9bc | 1d50492e5387c33751702d35088669184b988d27 | refs/heads/master | 2021-04-27T04:48:37.954000 | 2018-02-23T07:08:33 | 2018-02-23T07:08:33 | 122,585,583 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cn.mlb.mongo.demo;
import static org.bson.codecs.configuration.CodecRegistries.fromProviders;
import static org.bson.codecs.configuration.CodecRegistries.fromRegistries;
import static com.mongodb.client.model.Filters.*;
import static com.mongodb.client.model.Updates.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.bson.codecs.configuration.CodecRegistry;
import org.bson.codecs.pojo.PojoCodecProvider;
import cn.mlb.mongo.pojo.Address;
import cn.mlb.mongo.pojo.Person;
import com.mongodb.Block;
import com.mongodb.MongoClient;
import com.mongodb.MongoClientOptions;
import com.mongodb.MongoCredential;
import com.mongodb.ServerAddress;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
import com.mongodb.client.model.Updates;
import com.mongodb.client.result.DeleteResult;
import com.mongodb.client.result.UpdateResult;
public class MongoPojo {
public static void main(String[] args) {
try {
// 连接到MongoDB服务 如果是远程连接可以替换“localhost”为服务器所在IP地址
// ServerAddress()两个参数分别为 服务器地址 和 端口
ServerAddress serverAddress = new ServerAddress("localhost", 27017);
List<ServerAddress> addrs = new ArrayList<ServerAddress>();
addrs.add(serverAddress);
// MongoCredential.createScramSha1Credential()三个参数分别为 用户名 数据库名称 密码
MongoCredential credential = MongoCredential
.createScramSha1Credential("user", "account",
"pwd".toCharArray());
List<MongoCredential> credentials = new ArrayList<MongoCredential>();
credentials.add(credential);
// 通过连接认证获取MongoDB连接
CodecRegistry pojoCodecRegistry = fromRegistries(
MongoClient.getDefaultCodecRegistry(),
fromProviders(PojoCodecProvider.builder().automatic(true)
.build()));
MongoClientOptions options = MongoClientOptions.builder()
.codecRegistry(pojoCodecRegistry).build();
MongoClient mongoClient = new MongoClient(addrs, credentials,
options);
// 连接到数据库
MongoDatabase database = mongoClient.getDatabase("account");
//mongoDatabase = mongoDatabase.withCodecRegistry(pojoCodecRegistry);
System.out.println("Connect to database successfully");
//insertOne(database);
//insertMany(database);
//findAll(database);
//findOne(database);
//updateOne(database);
//updateMany(database);
//deleteOne(database);
//deleteMany(database);
} catch (Exception e) {
System.err.println(e.getClass().getName() + ": " + e.getMessage());
}
}
private static void deleteMany(MongoDatabase database) {
MongoCollection<Person> collection = database.getCollection("people", Person.class);
DeleteResult deleteResult = collection.deleteMany(eq("address.city", "London"));
System.out.println(deleteResult.getDeletedCount());
}
private static void deleteOne(MongoDatabase database) {
MongoCollection<Person> collection = database.getCollection("people", Person.class);
collection.deleteOne(eq("address.city", "Wimborne"));
}
private static void updateMany(MongoDatabase database) {
MongoCollection<Person> collection = database.getCollection("people", Person.class);
UpdateResult updateResult = collection.updateMany(not(eq("address.zip", null)), set("address.zip", null));
System.out.println(updateResult.getModifiedCount());
}
private static void updateOne(MongoDatabase database) {
MongoCollection<Person> collection = database.getCollection("people", Person.class);
UpdateResult updateOne = collection.updateOne(eq("name", "Ada Byron"), combine(set("age", 23), set("name", "Ada Lovelace")));
System.out.println(updateOne.toString());
}
private static void findOne(MongoDatabase database) {
MongoCollection<Person> collection = database.getCollection("people", Person.class);
Person first = collection.find(eq("address.city", "Wimborne")).first();
System.out.println(first);
}
private static void findAll(MongoDatabase database) {
MongoCollection<Person> collection = database.getCollection("people", Person.class);
Block<Person> printBlock = new Block<Person>() {
@Override
public void apply(final Person person) {
System.out.println(person);
}
};
collection.find().forEach(printBlock);
}
private static void insertMany(MongoDatabase database) {
MongoCollection<Person> collection = database.getCollection("people", Person.class);
List<Person> people = Arrays.asList(
new Person("Charles Babbage", 45, new Address("5 Devonshire Street", "London", "W11")),
new Person("Alan Turing", 28, new Address("Bletchley Hall", "Bletchley Park", "MK12")),
new Person("Timothy Berners-Lee", 61, new Address("Colehill", "Wimborne", null))
);
collection.insertMany(people);
}
private static void insertOne(MongoDatabase database) {
MongoCollection<Person> collection = database.getCollection("people", Person.class);
Person ada = new Person("Ada Byron", 20, new Address("St James Square", "London", "W1"));
collection.insertOne(ada);
}
}
| UTF-8 | Java | 5,120 | java | MongoPojo.java | Java | [
{
"context": "sult updateOne = collection.updateOne(eq(\"name\", \"Ada Byron\"), combine(set(\"age\", 23), set(\"name\", \"Ada Lovel",
"end": 3481,
"score": 0.9998383522033691,
"start": 3472,
"tag": "NAME",
"value": "Ada Byron"
},
{
"context": "Ada Byron\"), combine(set(\"age\", 23),... | null | [] | package cn.mlb.mongo.demo;
import static org.bson.codecs.configuration.CodecRegistries.fromProviders;
import static org.bson.codecs.configuration.CodecRegistries.fromRegistries;
import static com.mongodb.client.model.Filters.*;
import static com.mongodb.client.model.Updates.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.bson.codecs.configuration.CodecRegistry;
import org.bson.codecs.pojo.PojoCodecProvider;
import cn.mlb.mongo.pojo.Address;
import cn.mlb.mongo.pojo.Person;
import com.mongodb.Block;
import com.mongodb.MongoClient;
import com.mongodb.MongoClientOptions;
import com.mongodb.MongoCredential;
import com.mongodb.ServerAddress;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
import com.mongodb.client.model.Updates;
import com.mongodb.client.result.DeleteResult;
import com.mongodb.client.result.UpdateResult;
public class MongoPojo {
public static void main(String[] args) {
try {
// 连接到MongoDB服务 如果是远程连接可以替换“localhost”为服务器所在IP地址
// ServerAddress()两个参数分别为 服务器地址 和 端口
ServerAddress serverAddress = new ServerAddress("localhost", 27017);
List<ServerAddress> addrs = new ArrayList<ServerAddress>();
addrs.add(serverAddress);
// MongoCredential.createScramSha1Credential()三个参数分别为 用户名 数据库名称 密码
MongoCredential credential = MongoCredential
.createScramSha1Credential("user", "account",
"pwd".toCharArray());
List<MongoCredential> credentials = new ArrayList<MongoCredential>();
credentials.add(credential);
// 通过连接认证获取MongoDB连接
CodecRegistry pojoCodecRegistry = fromRegistries(
MongoClient.getDefaultCodecRegistry(),
fromProviders(PojoCodecProvider.builder().automatic(true)
.build()));
MongoClientOptions options = MongoClientOptions.builder()
.codecRegistry(pojoCodecRegistry).build();
MongoClient mongoClient = new MongoClient(addrs, credentials,
options);
// 连接到数据库
MongoDatabase database = mongoClient.getDatabase("account");
//mongoDatabase = mongoDatabase.withCodecRegistry(pojoCodecRegistry);
System.out.println("Connect to database successfully");
//insertOne(database);
//insertMany(database);
//findAll(database);
//findOne(database);
//updateOne(database);
//updateMany(database);
//deleteOne(database);
//deleteMany(database);
} catch (Exception e) {
System.err.println(e.getClass().getName() + ": " + e.getMessage());
}
}
private static void deleteMany(MongoDatabase database) {
MongoCollection<Person> collection = database.getCollection("people", Person.class);
DeleteResult deleteResult = collection.deleteMany(eq("address.city", "London"));
System.out.println(deleteResult.getDeletedCount());
}
private static void deleteOne(MongoDatabase database) {
MongoCollection<Person> collection = database.getCollection("people", Person.class);
collection.deleteOne(eq("address.city", "Wimborne"));
}
private static void updateMany(MongoDatabase database) {
MongoCollection<Person> collection = database.getCollection("people", Person.class);
UpdateResult updateResult = collection.updateMany(not(eq("address.zip", null)), set("address.zip", null));
System.out.println(updateResult.getModifiedCount());
}
private static void updateOne(MongoDatabase database) {
MongoCollection<Person> collection = database.getCollection("people", Person.class);
UpdateResult updateOne = collection.updateOne(eq("name", "<NAME>"), combine(set("age", 23), set("name", "<NAME>")));
System.out.println(updateOne.toString());
}
private static void findOne(MongoDatabase database) {
MongoCollection<Person> collection = database.getCollection("people", Person.class);
Person first = collection.find(eq("address.city", "Wimborne")).first();
System.out.println(first);
}
private static void findAll(MongoDatabase database) {
MongoCollection<Person> collection = database.getCollection("people", Person.class);
Block<Person> printBlock = new Block<Person>() {
@Override
public void apply(final Person person) {
System.out.println(person);
}
};
collection.find().forEach(printBlock);
}
private static void insertMany(MongoDatabase database) {
MongoCollection<Person> collection = database.getCollection("people", Person.class);
List<Person> people = Arrays.asList(
new Person("<NAME>", 45, new Address("5 Devonshire Street", "London", "W11")),
new Person("<NAME>", 28, new Address("Bletchley Hall", "Bletchley Park", "MK12")),
new Person("<NAME>", 61, new Address("Colehill", "Wimborne", null))
);
collection.insertMany(people);
}
private static void insertOne(MongoDatabase database) {
MongoCollection<Person> collection = database.getCollection("people", Person.class);
Person ada = new Person("<NAME>", 20, new Address("St James Square", "London", "W1"));
collection.insertOne(ada);
}
}
| 5,081 | 0.747385 | 0.742759 | 127 | 38.149605 | 29.653931 | 127 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.503937 | false | false | 3 |
8d624c899e2f46384785ddf3dc87160553047653 | 4,269,197,508,341 | 1dc75710a815b41df960cda5e4a37e872ac05079 | /backend/ticketBackEnd/ticketBackEnd/src/runtime/userAccountsRWTest.java | 14cd50125a65c567ea53801c5bdc8c6c5b36581a | [] | no_license | Tdfrantz/team-name-working | https://github.com/Tdfrantz/team-name-working | 84abf923aad0f4223e11778f35d49ee8cf97011c | 95db386cb608f7ef211b930a17c4cd5fc5d7a018 | refs/heads/master | 2021-01-18T06:57:53.323000 | 2015-04-06T01:57:27 | 2015-04-06T01:57:27 | 31,176,490 | 0 | 0 | null | true | 2015-02-22T19:33:32 | 2015-02-22T19:33:31 | 2015-02-19T03:25:17 | 2015-02-19T03:25:17 | 0 | 0 | 0 | 0 | null | null | null | package runtime;
import static org.junit.Assert.*;
import java.io.IOException;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
public class userAccountsRWTest {
//our file is userInfo.txt, so if it is found then the RW will be created properly
@Test
public void testUserAccountsRW() {
userAccountsRW test = new userAccountsRW();
assertTrue(test.isFileFound());
}
@Test
public void testGetUsers() throws Exception {
userAccountsRW testRW = new userAccountsRW();
user[] userList;
userList=testRW.getUsers();
assertEquals("gamma20142 ",userList[0].getName());
}
//to test this we are reading in the current userInfo file and then just rewriting it back
@Test
public void testWriteUsers() throws Exception {
userAccountsRW testRW = new userAccountsRW();
user[] userList;
userList=testRW.getUsers();
int result= testRW.writeUsers(userList);
assertEquals(0, result);
}
}
| UTF-8 | Java | 998 | java | userAccountsRWTest.java | Java | [] | null | [] | package runtime;
import static org.junit.Assert.*;
import java.io.IOException;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
public class userAccountsRWTest {
//our file is userInfo.txt, so if it is found then the RW will be created properly
@Test
public void testUserAccountsRW() {
userAccountsRW test = new userAccountsRW();
assertTrue(test.isFileFound());
}
@Test
public void testGetUsers() throws Exception {
userAccountsRW testRW = new userAccountsRW();
user[] userList;
userList=testRW.getUsers();
assertEquals("gamma20142 ",userList[0].getName());
}
//to test this we are reading in the current userInfo file and then just rewriting it back
@Test
public void testWriteUsers() throws Exception {
userAccountsRW testRW = new userAccountsRW();
user[] userList;
userList=testRW.getUsers();
int result= testRW.writeUsers(userList);
assertEquals(0, result);
}
}
| 998 | 0.742485 | 0.735471 | 40 | 23.875 | 22.386589 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.4 | false | false | 3 |
de8a26e866fb04ead3a0f7ffa700d803d60a29d4 | 12,601,434,064,783 | 9e30b2c673417f433e2881a8ad5c2a5bdfbc0d4a | /Server/src/main/java/sharedData/Movie.java | 1e58dfc5afe7f3f58cee57d97f73c62a7b79027b | [] | no_license | HagarLivneh/Movie-Rental-System | https://github.com/HagarLivneh/Movie-Rental-System | 070c6841a6f7de513c9476bea93d59071bfd0aee | b0aed3323a1da779c0689c119b09afaa744879ae | refs/heads/master | 2022-06-12T22:12:40.178000 | 2019-11-02T14:13:43 | 2019-11-02T14:13:43 | 219,162,175 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package sharedData;
import java.util.List;
public class Movie{
private Integer id;
private String name;
private Integer totalAmount;
private Integer availableAmount;
private Integer price;
private List<String> bannedCountries;
public Movie(Integer id,String name,Integer totalAmount,Integer price, List<String>bannedCountries)
{
this.id=id;
this.name=name;
this.totalAmount=totalAmount;
availableAmount=totalAmount;
this.price=price;
this.bannedCountries=bannedCountries;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getPrice() {
return price;
}
public void setPrice(Integer price) {
this.price = price;
}
public List<String> getBannedCountries() {
return bannedCountries;
}
public Integer getAvailableAmount() {
return availableAmount;
}
public void setAvailableAmount(Integer availableAmount) {
this.availableAmount = availableAmount;
}
public Boolean isMovieLegalInCountry(String country){
for(String c : bannedCountries){
if(country.equals(c)){
return false;
}
}
return true;
}
public boolean isRentd() {
return (availableAmount != totalAmount);
}
} | UTF-8 | Java | 1,541 | java | Movie.java | Java | [] | null | [] | package sharedData;
import java.util.List;
public class Movie{
private Integer id;
private String name;
private Integer totalAmount;
private Integer availableAmount;
private Integer price;
private List<String> bannedCountries;
public Movie(Integer id,String name,Integer totalAmount,Integer price, List<String>bannedCountries)
{
this.id=id;
this.name=name;
this.totalAmount=totalAmount;
availableAmount=totalAmount;
this.price=price;
this.bannedCountries=bannedCountries;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getPrice() {
return price;
}
public void setPrice(Integer price) {
this.price = price;
}
public List<String> getBannedCountries() {
return bannedCountries;
}
public Integer getAvailableAmount() {
return availableAmount;
}
public void setAvailableAmount(Integer availableAmount) {
this.availableAmount = availableAmount;
}
public Boolean isMovieLegalInCountry(String country){
for(String c : bannedCountries){
if(country.equals(c)){
return false;
}
}
return true;
}
public boolean isRentd() {
return (availableAmount != totalAmount);
}
} | 1,541 | 0.615185 | 0.615185 | 75 | 19.559999 | 19.210581 | 103 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false | 3 |
187c738328308a49bbc088863d8aa8510728bc85 | 10,170,482,557,861 | f4f0e987a6279febffc6cfe9bfb33d1423404a27 | /src/main/java/LeetCode/Dynamic/Candy.java | 0fb95e02bebf344f96fc93da1661f73badb07e0f | [] | no_license | mabyoung/JavaPractice | https://github.com/mabyoung/JavaPractice | b152d5309e602ba19e4c3988db70ba4d90c4cd72 | e28338e671fd3711b32062a95e8169f26687d284 | refs/heads/master | 2022-10-19T22:32:23.778000 | 2022-10-17T11:55:58 | 2022-10-17T11:55:58 | 144,514,249 | 0 | 0 | null | false | 2022-09-01T23:11:18 | 2018-08-13T01:21:53 | 2021-12-17T14:39:55 | 2022-09-01T23:11:15 | 1,170 | 0 | 0 | 3 | Java | false | false | package LeetCode.Dynamic;
/**
* There are N children standing in a line. Each child is assigned a rating value.
* You are giving candies to these children subjected to the following requirements:
* Each child must have at least one candy.
* Children with a higher rating get more candies than their neighbors.
* What is the minimum candies you must give?
*/
public class Candy {
public int candy(int[] ratings) {
int num = ratings.length;
int[] candy = new int[num];
for (int i = 0; i < num; i++) {
candy[i] = 1;
}
for (int i = 0; i < num - 1; i++) {
if (ratings[i + 1] > ratings[i]) {
candy[i + 1] = candy[i] + 1;
}
}
for (int i = num - 1; i > 0; i--) {
if (ratings[i - 1] > ratings[i] && candy[i - 1] <= candy[i]) {
candy[i - 1] = candy[i] + 1;
}
}
int sum = 0;
for (int item : candy) {
sum += item;
}
return sum;
}
public static void main(String[] args) {
Candy candy = new Candy();
int[] ratings = new int[]{4, 2, 3, 4, 1};
candy.candy(ratings);
}
}
| UTF-8 | Java | 1,202 | java | Candy.java | Java | [] | null | [] | package LeetCode.Dynamic;
/**
* There are N children standing in a line. Each child is assigned a rating value.
* You are giving candies to these children subjected to the following requirements:
* Each child must have at least one candy.
* Children with a higher rating get more candies than their neighbors.
* What is the minimum candies you must give?
*/
public class Candy {
public int candy(int[] ratings) {
int num = ratings.length;
int[] candy = new int[num];
for (int i = 0; i < num; i++) {
candy[i] = 1;
}
for (int i = 0; i < num - 1; i++) {
if (ratings[i + 1] > ratings[i]) {
candy[i + 1] = candy[i] + 1;
}
}
for (int i = num - 1; i > 0; i--) {
if (ratings[i - 1] > ratings[i] && candy[i - 1] <= candy[i]) {
candy[i - 1] = candy[i] + 1;
}
}
int sum = 0;
for (int item : candy) {
sum += item;
}
return sum;
}
public static void main(String[] args) {
Candy candy = new Candy();
int[] ratings = new int[]{4, 2, 3, 4, 1};
candy.candy(ratings);
}
}
| 1,202 | 0.502496 | 0.486689 | 39 | 29.820513 | 22.335291 | 84 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.564103 | false | false | 3 |
196b0288501647594663bd4333c0d1295bf5da93 | 5,248,450,096,479 | 19f59109088b668bb232d3081e5567730376cfd4 | /src/arrays/SetMatrixZeros.java | 903218cbcaed25b080beb24b89efb17b43127b86 | [] | no_license | ankitnarang/DataStructures | https://github.com/ankitnarang/DataStructures | f9a437b4c7bac9c7e7b39511750e2f12751ef277 | db6a5a801b47bb68b1069fdea0fb02f72e238b3a | refs/heads/master | 2021-07-07T03:19:34.296000 | 2020-12-14T06:09:11 | 2020-12-14T06:09:11 | 214,749,880 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package arrays;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class SetMatrixZeros {
private static void setZeroes(ArrayList<ArrayList<Integer>> a) {
Map<String,ArrayList<Integer>> map = new HashMap<>();
map.put("rows",new ArrayList<Integer>(Arrays.asList(-1)));
map.put("cols",new ArrayList<Integer>(Arrays.asList(-1)));
ArrayList<Integer> tempRow = new ArrayList<Integer>();
ArrayList<Integer> tempCol = new ArrayList<Integer>();
for(int row = 0 ; row < a.size(); row ++){
for(int col = 0 ; col < a.get(0).size(); col++){
if(a.get(row).get(col) == 0){
tempRow = new ArrayList<Integer>();
tempCol = new ArrayList<Integer>();
tempRow.add(row);
tempCol.add(col);
//map.put("rows",);
//map.put("cols",);
}
}
}
map.get("rows").remove(0);
map.get("cols").remove(0);
}
public static void main(String[] args) {
ArrayList<ArrayList<Integer>> arrList = new ArrayList<ArrayList<Integer>>();
arrList.add(new ArrayList<Integer>(Arrays.asList(1,0,1)));
arrList.add(new ArrayList<Integer>(Arrays.asList(1,1,1)));
arrList.add(new ArrayList<Integer>(Arrays.asList(1,1,1)));
System.out.println(arrList);
setZeroes(arrList);
System.out.println("End");
}
}
| UTF-8 | Java | 1,440 | java | SetMatrixZeros.java | Java | [] | null | [] | package arrays;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class SetMatrixZeros {
private static void setZeroes(ArrayList<ArrayList<Integer>> a) {
Map<String,ArrayList<Integer>> map = new HashMap<>();
map.put("rows",new ArrayList<Integer>(Arrays.asList(-1)));
map.put("cols",new ArrayList<Integer>(Arrays.asList(-1)));
ArrayList<Integer> tempRow = new ArrayList<Integer>();
ArrayList<Integer> tempCol = new ArrayList<Integer>();
for(int row = 0 ; row < a.size(); row ++){
for(int col = 0 ; col < a.get(0).size(); col++){
if(a.get(row).get(col) == 0){
tempRow = new ArrayList<Integer>();
tempCol = new ArrayList<Integer>();
tempRow.add(row);
tempCol.add(col);
//map.put("rows",);
//map.put("cols",);
}
}
}
map.get("rows").remove(0);
map.get("cols").remove(0);
}
public static void main(String[] args) {
ArrayList<ArrayList<Integer>> arrList = new ArrayList<ArrayList<Integer>>();
arrList.add(new ArrayList<Integer>(Arrays.asList(1,0,1)));
arrList.add(new ArrayList<Integer>(Arrays.asList(1,1,1)));
arrList.add(new ArrayList<Integer>(Arrays.asList(1,1,1)));
System.out.println(arrList);
setZeroes(arrList);
System.out.println("End");
}
}
| 1,440 | 0.603472 | 0.591667 | 45 | 31 | 22.520115 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.888889 | false | false | 3 |
9a9a55653b03dbd4e76446de19c119dbef0689cb | 10,840,497,457,805 | f1f766808ab05ea1ad17c986b4001d3253d21fb1 | /Butterfly/src/test/java/com/java/butterfly/system/service/UserInfoServiceTest.java | f2c83178b36dee9b128706d7687718b7a937ec4d | [] | no_license | AhuangLikeYou/others | https://github.com/AhuangLikeYou/others | 7b8e3056741362828bb89642708290f0b92f115f | 3fed26f1a7b793a1aec88eabb19368b3dfe77496 | refs/heads/master | 2022-02-25T04:26:43.380000 | 2019-09-19T03:33:53 | 2019-09-19T03:33:53 | 209,454,582 | 0 | 0 | null | false | 2022-02-09T22:11:02 | 2019-09-19T03:27:59 | 2019-09-19T03:34:06 | 2022-02-09T22:11:01 | 1,092 | 0 | 0 | 12 | Java | false | false | package com.java.butterfly.system.service;
import java.util.Date;
import javax.annotation.Resource;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.java.butterfly.common.dto.ResultMsg;
import com.java.butterfly.common.util.BeanUtils;
import com.java.butterfly.system.entity.SysUserInfo;
import com.java.butterfly.system.enums.SysUserRoleStatusEnums;
/**
* Created by lu.xu on 2017/8/16.
* TODO: 用户测试
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:applicationContext.xml"})
public class UserInfoServiceTest {
@Resource
private IUserInfoService iUserInfoService;
private SysUserInfo baseUser = null;
private SysUserInfo userinfo = null;
@Before
public void showMsgBefore() throws Exception {
System.out.println("***********UserInfoServiceTest start**********");
baseUser = new SysUserInfo();
baseUser.setUserName("junittestName");
baseUser.setUserPwd("junittestPwd");
baseUser.setStatus(SysUserRoleStatusEnums.USER_SATUS_LOCK.getCode());
baseUser.setRealName("junitRealName");
baseUser.setUserPhone("185111111151");
baseUser.setCreateDate(new Date());
baseUser.setModifyDate(new Date());
userinfo = new SysUserInfo();
BeanUtils.copyProperties(baseUser, userinfo);
}
@Test
public void main() throws Exception {
/**删除冗余数据*/
deleteUsers();
addUser();
queryListByPage();
updateUser();
updateStatus();
queryByUserName();
getByUserId();
resetPwd();
/**删除测试数据*/
deleteUsers();
}
public void queryListByPage() {
System.out.println("-----queryListByPage start----");
System.out.println("-----queryListByPage end----");
}
public void deleteUsers() {
System.out.println("-----deleteUsers start----");
System.out.println("删除测试数据");
SysUserInfo user = this.iUserInfoService.queryByUserName(baseUser.getUserName());
if (null == user) {
return;
}
ResultMsg rmg = this.iUserInfoService.deleteUsers(user.getUserId());
Assert.assertTrue(rmg.isSuccess());
System.out.println("-----deleteUsers end----");
}
public void addUser() throws Exception {
System.out.println("-----addUser start----");
BeanUtils.copyProperties(baseUser, userinfo);
ResultMsg rmg = this.iUserInfoService.addUser(userinfo);
Assert.assertTrue(rmg.isSuccess());
System.out.println("-----addUser end----");
}
public void updateUser() {
System.out.println("-----updateUser start----");
System.out.println("-----updateUser end----");
}
public void updateStatus() {
System.out.println("-----updateStatus start----");
System.out.println("-----updateStatus end----");
}
public void queryByUserName() {
System.out.println("-----queryByUserName start----");
System.out.println("-----queryByUserName end----");
}
public void getByUserId() {
System.out.println("-----getByUserId start----");
System.out.println("-----getByUserId end----");
}
public void resetPwd() {
System.out.println("-----resetPwd start----");
System.out.println("-----resetPwd end----");
}
@After
public void showMsgAfter() {
System.out.println("***********UserInfoServiceTest end**********");
}
}
| UTF-8 | Java | 3,825 | java | UserInfoServiceTest.java | Java | [
{
"context": "m.enums.SysUserRoleStatusEnums;\n\n/**\n * Created by lu.xu on 2017/8/16.\n * TODO: 用户测试\n */\n\n@RunWith(SpringJ",
"end": 605,
"score": 0.9921179413795471,
"start": 600,
"tag": "USERNAME",
"value": "lu.xu"
},
{
"context": " new SysUserInfo();\n baseUser.setUserN... | null | [] | package com.java.butterfly.system.service;
import java.util.Date;
import javax.annotation.Resource;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.java.butterfly.common.dto.ResultMsg;
import com.java.butterfly.common.util.BeanUtils;
import com.java.butterfly.system.entity.SysUserInfo;
import com.java.butterfly.system.enums.SysUserRoleStatusEnums;
/**
* Created by lu.xu on 2017/8/16.
* TODO: 用户测试
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:applicationContext.xml"})
public class UserInfoServiceTest {
@Resource
private IUserInfoService iUserInfoService;
private SysUserInfo baseUser = null;
private SysUserInfo userinfo = null;
@Before
public void showMsgBefore() throws Exception {
System.out.println("***********UserInfoServiceTest start**********");
baseUser = new SysUserInfo();
baseUser.setUserName("junittestName");
baseUser.setUserPwd("<PASSWORD>");
baseUser.setStatus(SysUserRoleStatusEnums.USER_SATUS_LOCK.getCode());
baseUser.setRealName("junitRealName");
baseUser.setUserPhone("185111111151");
baseUser.setCreateDate(new Date());
baseUser.setModifyDate(new Date());
userinfo = new SysUserInfo();
BeanUtils.copyProperties(baseUser, userinfo);
}
@Test
public void main() throws Exception {
/**删除冗余数据*/
deleteUsers();
addUser();
queryListByPage();
updateUser();
updateStatus();
queryByUserName();
getByUserId();
resetPwd();
/**删除测试数据*/
deleteUsers();
}
public void queryListByPage() {
System.out.println("-----queryListByPage start----");
System.out.println("-----queryListByPage end----");
}
public void deleteUsers() {
System.out.println("-----deleteUsers start----");
System.out.println("删除测试数据");
SysUserInfo user = this.iUserInfoService.queryByUserName(baseUser.getUserName());
if (null == user) {
return;
}
ResultMsg rmg = this.iUserInfoService.deleteUsers(user.getUserId());
Assert.assertTrue(rmg.isSuccess());
System.out.println("-----deleteUsers end----");
}
public void addUser() throws Exception {
System.out.println("-----addUser start----");
BeanUtils.copyProperties(baseUser, userinfo);
ResultMsg rmg = this.iUserInfoService.addUser(userinfo);
Assert.assertTrue(rmg.isSuccess());
System.out.println("-----addUser end----");
}
public void updateUser() {
System.out.println("-----updateUser start----");
System.out.println("-----updateUser end----");
}
public void updateStatus() {
System.out.println("-----updateStatus start----");
System.out.println("-----updateStatus end----");
}
public void queryByUserName() {
System.out.println("-----queryByUserName start----");
System.out.println("-----queryByUserName end----");
}
public void getByUserId() {
System.out.println("-----getByUserId start----");
System.out.println("-----getByUserId end----");
}
public void resetPwd() {
System.out.println("-----resetPwd start----");
System.out.println("-----resetPwd end----");
}
@After
public void showMsgAfter() {
System.out.println("***********UserInfoServiceTest end**********");
}
}
| 3,823 | 0.622322 | 0.616504 | 121 | 30.247934 | 22.785845 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.528926 | false | false | 3 |
42f8ccdc1c5b154c44afd45a4527fb43e393c3e7 | 3,865,470,633,809 | 5a01b1364e6d2e2850a5ad122f422e7b767e4d1c | /src/main/java/com/larztalk/backend/team/Team.java | 580e035355f934d9160b924548543228cdbe109c | [] | no_license | coderRaghvendra/acko-pagerduty | https://github.com/coderRaghvendra/acko-pagerduty | 5054a28490b5693d6a9e24a6b3a3b861c5fe335a | ac5966b47dc626c9f79275cf5efec41c14e65acb | refs/heads/master | 2023-03-22T12:37:45.581000 | 2021-03-22T07:40:39 | 2021-03-22T07:40:39 | 350,238,019 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.larztalk.backend.team;
import com.larztalk.backend.BaseEntityAudit;
import javax.persistence.Entity;
import javax.persistence.Table;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.SuperBuilder;
/**
* Created by raghvendra.mishra on 22/03/21.
*/
@Entity
@Table(name = "team")
@Getter
@Setter
@SuperBuilder
@NoArgsConstructor
public class Team extends BaseEntityAudit {
@Builder.Default
private String name = "";
}
| UTF-8 | Java | 518 | java | Team.java | Java | [
{
"context": "mbok.experimental.SuperBuilder;\n\n/**\n * Created by raghvendra.mishra on 22/03/21.\n */\n@Entity\n@Table(name = \"team\")\n@G",
"end": 323,
"score": 0.939362645149231,
"start": 306,
"tag": "USERNAME",
"value": "raghvendra.mishra"
}
] | null | [] | package com.larztalk.backend.team;
import com.larztalk.backend.BaseEntityAudit;
import javax.persistence.Entity;
import javax.persistence.Table;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.SuperBuilder;
/**
* Created by raghvendra.mishra on 22/03/21.
*/
@Entity
@Table(name = "team")
@Getter
@Setter
@SuperBuilder
@NoArgsConstructor
public class Team extends BaseEntityAudit {
@Builder.Default
private String name = "";
}
| 518 | 0.779923 | 0.76834 | 25 | 19.719999 | 14.793296 | 44 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false | 3 |
cb38e7ce58ee79b428e887b2c095e09b5736c625 | 25,520,695,729,146 | 8ee258570770b93fa60432d2ce5de271a5c13c27 | /Backend/ExaminationSystem/src/main/java/com/system/dao/StudentTestRelationRepository.java | 09e71c77b46257d1fc16bcd32cbe1b5adf263eec | [] | no_license | Neil1213/Examination_System_v1 | https://github.com/Neil1213/Examination_System_v1 | 383c624935d8c41831a080915c244a06e8fc697f | 27c86578f614364b24056c62192807e42b2ce4eb | refs/heads/master | 2022-04-18T01:23:19.608000 | 2020-04-14T03:19:20 | 2020-04-14T03:19:20 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.system.dao;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import com.system.model.StudentTestRelation;
@Repository
public interface StudentTestRelationRepository extends JpaRepository<StudentTestRelation, Integer> {
}
| UTF-8 | Java | 355 | java | StudentTestRelationRepository.java | Java | [] | null | [] | package com.system.dao;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import com.system.model.StudentTestRelation;
@Repository
public interface StudentTestRelationRepository extends JpaRepository<StudentTestRelation, Integer> {
}
| 355 | 0.850704 | 0.850704 | 12 | 28.583334 | 31.244888 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.583333 | false | false | 3 |
70c562907146cb8b1eb0cabc9028909696762e34 | 11,519,102,321,649 | b5387ccf386b692bcd1d0434dea4c9a28b05f009 | /test/commands/CreditAssignCommandTest.java | c57632523ce9466c35edf85ea780f862206989ea | [] | no_license | dhirajchawla2000/merchants_guide_to_galaxy_java | https://github.com/dhirajchawla2000/merchants_guide_to_galaxy_java | 7f5287bf7107d314c148651a379efb8bb2dbcced | bf3169b8066bfa782f761111c8850c96f00ab7b3 | refs/heads/master | 2021-01-10T12:02:06.369000 | 2016-03-15T17:01:33 | 2016-03-15T17:01:33 | 50,773,843 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package commands;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
import com.guide.merchant.commands.CreditAssignCommand;
import com.guide.merchant.databank.DataBank;
public class CreditAssignCommandTest {
private DataBank db;
@Before
public void setUp() throws Exception {
db = new DataBank();
}
@Test
public void test() {
db.setAssignment("pish", "I");
CreditAssignCommand cac = new CreditAssignCommand(db, "pish pish", "Iron", "4");
cac.execute();
assertEquals(db.getCredit("Iron"), Double.valueOf(2.0));
}
}
| UTF-8 | Java | 573 | java | CreditAssignCommandTest.java | Java | [] | null | [] | package commands;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
import com.guide.merchant.commands.CreditAssignCommand;
import com.guide.merchant.databank.DataBank;
public class CreditAssignCommandTest {
private DataBank db;
@Before
public void setUp() throws Exception {
db = new DataBank();
}
@Test
public void test() {
db.setAssignment("pish", "I");
CreditAssignCommand cac = new CreditAssignCommand(db, "pish pish", "Iron", "4");
cac.execute();
assertEquals(db.getCredit("Iron"), Double.valueOf(2.0));
}
}
| 573 | 0.724258 | 0.719023 | 30 | 18.1 | 21.117685 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.133333 | false | false | 3 |
f4b98e80a3044e4604b16a68a2cf0386e276a7ae | 12,300,786,398,598 | e77d922711a1ca81ccbb00ed699e68cf966b9da1 | /Kafka-Example/src/main/java/com/kafka/entity/MessageObjectSerializer.java | 35b17c3a3c4d9a22247a7f9dbb4f7ee764df8974 | [] | no_license | arun-vjkumar/KafkaProjects | https://github.com/arun-vjkumar/KafkaProjects | cbdc80c363c134b5290309785acfacf59eaa9b58 | aff5f24d6081d787c656a3ade828338e98deb8bb | refs/heads/master | 2023-08-10T22:07:39.216000 | 2018-12-30T17:13:08 | 2018-12-30T17:13:08 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.kafka.entity;
import java.util.Map;
import org.apache.kafka.common.serialization.Serializer;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
public class MessageObjectSerializer implements Serializer<MessageObject> {
@Override
public void close() {
}
@Override
public void configure(Map<String, ?> arg0, boolean arg1) {
}
@Override
public byte[] serialize(String topic, MessageObject messageObject) {
ObjectMapper objectMapper = new ObjectMapper();
try {
return objectMapper.writeValueAsString(messageObject).getBytes();
} catch (JsonProcessingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
}
| UTF-8 | Java | 747 | java | MessageObjectSerializer.java | Java | [] | null | [] | package com.kafka.entity;
import java.util.Map;
import org.apache.kafka.common.serialization.Serializer;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
public class MessageObjectSerializer implements Serializer<MessageObject> {
@Override
public void close() {
}
@Override
public void configure(Map<String, ?> arg0, boolean arg1) {
}
@Override
public byte[] serialize(String topic, MessageObject messageObject) {
ObjectMapper objectMapper = new ObjectMapper();
try {
return objectMapper.writeValueAsString(messageObject).getBytes();
} catch (JsonProcessingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
}
| 747 | 0.763052 | 0.760375 | 34 | 20.970589 | 24.600916 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.176471 | false | false | 3 |
0f8fec872ef98d38e0f63e2213f3a240b3881019 | 19,267,223,321,083 | 3addb8b7699a5f424b0ed38ceeb092177d06f146 | /src/TD3/Main.java | 2cfdf6edf2cbb3b836c693e26a42b3711549accc | [] | no_license | kbaptista/Approche-Objet | https://github.com/kbaptista/Approche-Objet | 468b260bf43396cc79244c3416f13a66bc71d062 | 3132cb555171825761e2a21742c3a285721a7823 | refs/heads/master | 2021-01-10T08:48:44.245000 | 2015-10-02T13:57:31 | 2015-10-02T13:57:31 | 43,312,907 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package TD3;
public class Main {
public static void main(String[] args) {
Catalogue Fnac = new Catalogue();
Produit PS4 = new Produit("Playstation 4", "Consôle de salon produite par Sony.", "Jeu Vidéo", 400.0);
Produit XBoxOne = new Produit("XBox One", "Consôle de salon produite par Microsoft.", "Jeu Vidéo", 350.0);
Produit Galaxy_S_5 = new Produit("Galaxy S 5", "Smartphone produit par Samsung", "Téléphonie", 800.0);
Produit WiiU = new Produit("Wii U");
System.out.println(PS4);
Fnac.add(PS4);
Fnac.printProducts();
System.out.println(Fnac.getFromListe("Playstation 4"));
System.out.println(Fnac.getFromListe("Wii U"));
Fnac.add(XBoxOne);
Fnac.printProducts();
Fnac.add(Galaxy_S_5);
Fnac.printProducts();
Fnac.trierParLePrix(1);
Fnac.printProducts();
Fnac.delete(WiiU);
Fnac.delete(PS4);
Fnac.printProducts();
Fnac.delete(XBoxOne);
Fnac.delete(Galaxy_S_5);
Fnac.printProducts();
}
}
| UTF-8 | Java | 971 | java | Main.java | Java | [
{
"context": "tion 4\", \"Consôle de salon produite par Sony.\", \"Jeu Vidéo\", 400.0);\n\t\tProduit XBoxOne = new Produit(\"",
"end": 206,
"score": 0.538291335105896,
"start": 204,
"tag": "NAME",
"value": "eu"
},
{
"context": " 4\", \"Consôle de salon produite par Sony.\", \"Jeu Vid... | null | [] | package TD3;
public class Main {
public static void main(String[] args) {
Catalogue Fnac = new Catalogue();
Produit PS4 = new Produit("Playstation 4", "Consôle de salon produite par Sony.", "Jeu Vidéo", 400.0);
Produit XBoxOne = new Produit("XBox One", "Consôle de salon produite par Microsoft.", "Jeu Vidéo", 350.0);
Produit Galaxy_S_5 = new Produit("Galaxy S 5", "Smartphone produit par Samsung", "Téléphonie", 800.0);
Produit WiiU = new Produit("Wii U");
System.out.println(PS4);
Fnac.add(PS4);
Fnac.printProducts();
System.out.println(Fnac.getFromListe("Playstation 4"));
System.out.println(Fnac.getFromListe("Wii U"));
Fnac.add(XBoxOne);
Fnac.printProducts();
Fnac.add(Galaxy_S_5);
Fnac.printProducts();
Fnac.trierParLePrix(1);
Fnac.printProducts();
Fnac.delete(WiiU);
Fnac.delete(PS4);
Fnac.printProducts();
Fnac.delete(XBoxOne);
Fnac.delete(Galaxy_S_5);
Fnac.printProducts();
}
}
| 971 | 0.673575 | 0.648705 | 40 | 23.125 | 27.421877 | 108 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.425 | false | false | 3 |
b40d17d594abf6f04eb40c262383c546f4eb005b | 11,725,260,719,884 | bfa31a32017299b7edbbe473de536dbfc72e4c90 | /src/snw/engine/component/Button.java | 14cc97dfcc314df8ef1f2656b8334c305aa457f2 | [] | no_license | snw2015/GameEngine | https://github.com/snw2015/GameEngine | 812331a78db26dc2d63ea107163e1d2615abea14 | ad7be5365100582b75e9452717f6a501ce346040 | refs/heads/master | 2022-01-08T15:22:54.967000 | 2019-06-15T05:44:42 | 2019-06-15T05:44:42 | 116,161,210 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package snw.engine.component;
import java.awt.Image;
import java.awt.event.KeyEvent;
import snw.engine.component.reaction.Reaction;
import snw.math.VectorInt;
public class Button extends FrameComponent {
private Graphic background = null;
private Text text = null;
private Reaction<VectorInt> reactionClicked = null;
private Reaction<VectorInt> reactionIn = null;
private Reaction<VectorInt> reactionOut = null;
private VectorInt borderSize = new VectorInt(0, 0);
private int clickKey = KeyEvent.VK_ENTER;
//TODO you know how to improve it
public Button(String name, int x, int y, Graphic background, String rawtext) {
super(name, x, y, background.getWidth(), background.getHeight());
setText(rawtext);
this.background = background;
add(background);
add(text);
}
public Button(String name, int x, int y, Graphic background) {
this(name, x, y, background, "");
}
public Button(String name, int x, int y, Image backgroundImg) {
this(name, x, y, backgroundImg, "");
}
public Button(String name, int x, int y, int width, int height, String rawtext) {
this(name, x, y, width, height, null, rawtext);
}
public Button(String name, int x, int y, Image backgroundImg, String rawtext) {
this(name, x, y, backgroundImg, rawtext, 0, 0);
}
public Button(String name, int x, int y, Image backgroundImg, String rawtext,
int borderX, int borderY) {
this(name, x, y, backgroundImg.getWidth(null), backgroundImg.getHeight(null), backgroundImg, rawtext, borderX, borderY);
}
public Button(String name, int x, int y, int width, int height) {
this(name, x, y, width, height, "");
}
public Button(String name, int x, int y, int width, int height, Image backgroundImg) {
this(name, x, y, width, height, backgroundImg, "");
}
public Button(String name, int x, int y, int width, int height, Image backgroundImg,
String rawtext) {
this(name, x, y, width, height, backgroundImg, rawtext, 0, 0);
}
public Button(String name, int x, int y, int width, int height, Image backgroundImg,
String rawtext, int borderX, int borderY) {
super(name, x, y, width, height);
borderSize.x = borderX;
borderSize.y = borderY;
if (backgroundImg != null) {
setBackground(backgroundImg);
}
setText(rawtext);
}
@Override
public void mouseClicked(double mouseX, double mouseY) {
if (reactionClicked != null) {
reactionClicked.react(new VectorInt((int)mouseX, (int)mouseY));
}
}
@Override
public void mouseEntered() {
super.mouseEntered();
if (reactionIn != null) {
reactionIn.react(null);
}
}
@Override
public void mouseExited() {
super.mouseExited();
if (reactionOut != null) {
reactionOut.react(null);
}
}
@Override
public void keyPressed(int key) {
if (key == clickKey) {
if (reactionClicked != null) {
reactionClicked.react(null);
}
}
}
public Graphic getBackground() {
return background;
}
public void setBackground(Image image) {
remove(background);
background = new Graphic(name + "_background", image, 0, 0, getWidth(),
getHeight(), false);
add(background, 0);
}
public Text getText() {
return text;
}
public void setText(String rawtext) {
remove(text);
text = new Text(name + "_text", rawtext, getWidth() / 2, getHeight() / 2,
getWidth() - borderSize.x * 2, getHeight() - borderSize.y * 2);
text.setAlignment(ALIGNMENT_CENTER);
add(text, 1);
}
public void setReactionClicked(Reaction<VectorInt> reactionClicked) {
this.reactionClicked = reactionClicked;
}
public void setReactionIn(Reaction<VectorInt> reactionIn) {
this.reactionIn = reactionIn;
}
public void setReactionOut(Reaction<VectorInt> reactionOut) {
this.reactionOut = reactionOut;
}
public int getClickKey() {
return clickKey;
}
public void setClickKey(int clickKey) {
this.clickKey = clickKey;
}
}
| UTF-8 | Java | 4,405 | java | Button.java | Java | [] | null | [] | package snw.engine.component;
import java.awt.Image;
import java.awt.event.KeyEvent;
import snw.engine.component.reaction.Reaction;
import snw.math.VectorInt;
public class Button extends FrameComponent {
private Graphic background = null;
private Text text = null;
private Reaction<VectorInt> reactionClicked = null;
private Reaction<VectorInt> reactionIn = null;
private Reaction<VectorInt> reactionOut = null;
private VectorInt borderSize = new VectorInt(0, 0);
private int clickKey = KeyEvent.VK_ENTER;
//TODO you know how to improve it
public Button(String name, int x, int y, Graphic background, String rawtext) {
super(name, x, y, background.getWidth(), background.getHeight());
setText(rawtext);
this.background = background;
add(background);
add(text);
}
public Button(String name, int x, int y, Graphic background) {
this(name, x, y, background, "");
}
public Button(String name, int x, int y, Image backgroundImg) {
this(name, x, y, backgroundImg, "");
}
public Button(String name, int x, int y, int width, int height, String rawtext) {
this(name, x, y, width, height, null, rawtext);
}
public Button(String name, int x, int y, Image backgroundImg, String rawtext) {
this(name, x, y, backgroundImg, rawtext, 0, 0);
}
public Button(String name, int x, int y, Image backgroundImg, String rawtext,
int borderX, int borderY) {
this(name, x, y, backgroundImg.getWidth(null), backgroundImg.getHeight(null), backgroundImg, rawtext, borderX, borderY);
}
public Button(String name, int x, int y, int width, int height) {
this(name, x, y, width, height, "");
}
public Button(String name, int x, int y, int width, int height, Image backgroundImg) {
this(name, x, y, width, height, backgroundImg, "");
}
public Button(String name, int x, int y, int width, int height, Image backgroundImg,
String rawtext) {
this(name, x, y, width, height, backgroundImg, rawtext, 0, 0);
}
public Button(String name, int x, int y, int width, int height, Image backgroundImg,
String rawtext, int borderX, int borderY) {
super(name, x, y, width, height);
borderSize.x = borderX;
borderSize.y = borderY;
if (backgroundImg != null) {
setBackground(backgroundImg);
}
setText(rawtext);
}
@Override
public void mouseClicked(double mouseX, double mouseY) {
if (reactionClicked != null) {
reactionClicked.react(new VectorInt((int)mouseX, (int)mouseY));
}
}
@Override
public void mouseEntered() {
super.mouseEntered();
if (reactionIn != null) {
reactionIn.react(null);
}
}
@Override
public void mouseExited() {
super.mouseExited();
if (reactionOut != null) {
reactionOut.react(null);
}
}
@Override
public void keyPressed(int key) {
if (key == clickKey) {
if (reactionClicked != null) {
reactionClicked.react(null);
}
}
}
public Graphic getBackground() {
return background;
}
public void setBackground(Image image) {
remove(background);
background = new Graphic(name + "_background", image, 0, 0, getWidth(),
getHeight(), false);
add(background, 0);
}
public Text getText() {
return text;
}
public void setText(String rawtext) {
remove(text);
text = new Text(name + "_text", rawtext, getWidth() / 2, getHeight() / 2,
getWidth() - borderSize.x * 2, getHeight() - borderSize.y * 2);
text.setAlignment(ALIGNMENT_CENTER);
add(text, 1);
}
public void setReactionClicked(Reaction<VectorInt> reactionClicked) {
this.reactionClicked = reactionClicked;
}
public void setReactionIn(Reaction<VectorInt> reactionIn) {
this.reactionIn = reactionIn;
}
public void setReactionOut(Reaction<VectorInt> reactionOut) {
this.reactionOut = reactionOut;
}
public int getClickKey() {
return clickKey;
}
public void setClickKey(int clickKey) {
this.clickKey = clickKey;
}
}
| 4,405 | 0.607264 | 0.604086 | 156 | 27.237179 | 26.876047 | 128 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.083333 | false | false | 3 |
278cfac7a82312859fdf89c27b1ebe4806689a3e | 4,664,334,503,751 | 00ffe3e7206f34987edb893bd3fd3db88ed83704 | /Integrate_v1.0_clean/bin/src/DISTILLER_motif_matrix.java | cc4467246bac2f5d530bf4df843981075bea4711 | [] | no_license | srimam/Integrate_v1.0 | https://github.com/srimam/Integrate_v1.0 | 1e804040d50033bea3d0aeb97fa0c97474021fbf | 650960cacfa0b533f9179d38cd16995f2e479bb4 | refs/heads/master | 2021-06-04T12:20:39.882000 | 2020-07-05T13:52:57 | 2020-07-05T13:52:57 | 26,867,066 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package bin;
import java.lang.*;
import java.*;
import java.io.*;
import java.util.regex.*;
import java.util.ArrayList;
import java.util.*;
/*
Code to generate binary motif matrix for DISTILLER
Written by Saheed Imam
Institute for Systems biology
*/
public class DISTILLER_motif_matrix
{
public static int build(String expression) throws IOException
{
try
{
//Read in cluster information
BufferedReader b1 = new BufferedReader(new FileReader("Results/Miscellaneous/Phylo_Clusters.txt"));
//Read in expression matrix just for the genes
BufferedReader b = new BufferedReader(new FileReader("Data/Expression/"+expression));
//write out DISTILLER motif matrix
BufferedWriter buf = new BufferedWriter(new FileWriter("bin/DISTILLER-V2/Data/DISTILLER_matrix.txt"));
//write out normalized expression matrix
BufferedWriter buf1 = new BufferedWriter(new FileWriter("bin/DISTILLER-V2/Data/Norm_expression_matrix.txt"));
//write out index to geneID map
BufferedWriter buf2 = new BufferedWriter(new FileWriter("Results/DISTILLER/Index_to_geneID.txt"));
//write out index to clusterID map
BufferedWriter buf3 = new BufferedWriter(new FileWriter("Results/DISTILLER/Index_to_clusterID.txt"));
ArrayList<String> geneID = new ArrayList<String>();
ArrayList<String> geneID2 = new ArrayList<String>();
ArrayList<String> clusterID = new ArrayList<String>();
ArrayList<String> clusterID2 = new ArrayList<String>();
Matcher m;
String lines = "";
b.readLine();//skip header
int rows=0,cols=0;
while ((lines = b.readLine())!=null)//identify all genes with available expression data
{
String[] result = lines.split("\t");
if(cols==0)
cols=result.length-1;
if(!geneID2.contains(result[0]))
geneID2.add(result[0]);
else
{
System.out.println("Duplicate expression values for "+result[0]);
System.out.println("Exiting run as only one set of values expected per gene");
return -1;
}
rows++;
}
double[][] expression_matrix = new double[rows][cols];//hold expression data
b = new BufferedReader(new FileReader("Data/Expression/"+expression));
lines="";
int rowCount=0;
b.readLine();
while ((lines = b.readLine())!=null)//place expression data into matrix
{
String[] result = lines.split("\t");
for(int i=1;i<result.length;i++)
{
expression_matrix[rowCount][i-1]=Double.parseDouble(result[i]);
if(rowCount==0)//only do this once (writing header for expression matrix)
buf1.write("\t"+i);
}
rowCount++;
}
buf1.newLine();
System.out.println("Normalizing expression matrix...");
for(int i=0;i<rows;i++)
{
buf1.write(String.valueOf(i+1));
double[] mean_sd = Mean_SD.compute(expression_matrix[i]);
for(int j=0;j<cols;j++)
buf1.write("\t"+(expression_matrix[i][j]-mean_sd[0])/mean_sd[1]);
buf1.newLine();
}
lines="";
while ((lines = b1.readLine())!=null)//obtain genes to cluster mapping
{
String[] result = lines.split("\t");
geneID.add(result[1]);
clusterID.add(result[0]);
if(!clusterID2.contains(result[0]))
clusterID2.add(result[0]);
}
int clusterCount=1;
for(int i=0;i<clusterID2.size();i++)
{
buf.write("\t"+clusterCount);
buf3.write(clusterCount+"\t"+clusterID2.get(i)+"\n");
clusterCount++;
}
buf.newLine();
int geneCount=1;
for(int i=0;i<geneID2.size();i++)
{
buf.write(String.valueOf(geneCount));
buf2.write(geneCount+"\t"+geneID2.get(i)+"\n");
for(int j=0;j<clusterID2.size();j++)
{
int counter=0;
for(int k=0;k<geneID.size();k++)
{
if(geneID2.get(i).equals(geneID.get(k)) && clusterID.get(k).equals(clusterID2.get(j)))
counter++;
}
if(counter>0)
buf.write("\t"+1);
else
buf.write("\t"+0);
}
buf.newLine();
geneCount++;
}
buf.flush();b1.close();b.close();buf.close();buf1.flush();buf1.close();buf2.flush();buf2.close();buf3.flush();buf3.close();
}
catch(Exception e)
{e.printStackTrace(); return -1;}
return 0;
}
}
| UTF-8 | Java | 3,994 | java | DISTILLER_motif_matrix.java | Java | [
{
"context": "rate binary motif matrix for DISTILLER\n\nWritten by Saheed Imam\nInstitute for Systems biology\n*/\n\npublic class DI",
"end": 217,
"score": 0.9998871088027954,
"start": 206,
"tag": "NAME",
"value": "Saheed Imam"
}
] | null | [] | package bin;
import java.lang.*;
import java.*;
import java.io.*;
import java.util.regex.*;
import java.util.ArrayList;
import java.util.*;
/*
Code to generate binary motif matrix for DISTILLER
Written by <NAME>
Institute for Systems biology
*/
public class DISTILLER_motif_matrix
{
public static int build(String expression) throws IOException
{
try
{
//Read in cluster information
BufferedReader b1 = new BufferedReader(new FileReader("Results/Miscellaneous/Phylo_Clusters.txt"));
//Read in expression matrix just for the genes
BufferedReader b = new BufferedReader(new FileReader("Data/Expression/"+expression));
//write out DISTILLER motif matrix
BufferedWriter buf = new BufferedWriter(new FileWriter("bin/DISTILLER-V2/Data/DISTILLER_matrix.txt"));
//write out normalized expression matrix
BufferedWriter buf1 = new BufferedWriter(new FileWriter("bin/DISTILLER-V2/Data/Norm_expression_matrix.txt"));
//write out index to geneID map
BufferedWriter buf2 = new BufferedWriter(new FileWriter("Results/DISTILLER/Index_to_geneID.txt"));
//write out index to clusterID map
BufferedWriter buf3 = new BufferedWriter(new FileWriter("Results/DISTILLER/Index_to_clusterID.txt"));
ArrayList<String> geneID = new ArrayList<String>();
ArrayList<String> geneID2 = new ArrayList<String>();
ArrayList<String> clusterID = new ArrayList<String>();
ArrayList<String> clusterID2 = new ArrayList<String>();
Matcher m;
String lines = "";
b.readLine();//skip header
int rows=0,cols=0;
while ((lines = b.readLine())!=null)//identify all genes with available expression data
{
String[] result = lines.split("\t");
if(cols==0)
cols=result.length-1;
if(!geneID2.contains(result[0]))
geneID2.add(result[0]);
else
{
System.out.println("Duplicate expression values for "+result[0]);
System.out.println("Exiting run as only one set of values expected per gene");
return -1;
}
rows++;
}
double[][] expression_matrix = new double[rows][cols];//hold expression data
b = new BufferedReader(new FileReader("Data/Expression/"+expression));
lines="";
int rowCount=0;
b.readLine();
while ((lines = b.readLine())!=null)//place expression data into matrix
{
String[] result = lines.split("\t");
for(int i=1;i<result.length;i++)
{
expression_matrix[rowCount][i-1]=Double.parseDouble(result[i]);
if(rowCount==0)//only do this once (writing header for expression matrix)
buf1.write("\t"+i);
}
rowCount++;
}
buf1.newLine();
System.out.println("Normalizing expression matrix...");
for(int i=0;i<rows;i++)
{
buf1.write(String.valueOf(i+1));
double[] mean_sd = Mean_SD.compute(expression_matrix[i]);
for(int j=0;j<cols;j++)
buf1.write("\t"+(expression_matrix[i][j]-mean_sd[0])/mean_sd[1]);
buf1.newLine();
}
lines="";
while ((lines = b1.readLine())!=null)//obtain genes to cluster mapping
{
String[] result = lines.split("\t");
geneID.add(result[1]);
clusterID.add(result[0]);
if(!clusterID2.contains(result[0]))
clusterID2.add(result[0]);
}
int clusterCount=1;
for(int i=0;i<clusterID2.size();i++)
{
buf.write("\t"+clusterCount);
buf3.write(clusterCount+"\t"+clusterID2.get(i)+"\n");
clusterCount++;
}
buf.newLine();
int geneCount=1;
for(int i=0;i<geneID2.size();i++)
{
buf.write(String.valueOf(geneCount));
buf2.write(geneCount+"\t"+geneID2.get(i)+"\n");
for(int j=0;j<clusterID2.size();j++)
{
int counter=0;
for(int k=0;k<geneID.size();k++)
{
if(geneID2.get(i).equals(geneID.get(k)) && clusterID.get(k).equals(clusterID2.get(j)))
counter++;
}
if(counter>0)
buf.write("\t"+1);
else
buf.write("\t"+0);
}
buf.newLine();
geneCount++;
}
buf.flush();b1.close();b.close();buf.close();buf1.flush();buf1.close();buf2.flush();buf2.close();buf3.flush();buf3.close();
}
catch(Exception e)
{e.printStackTrace(); return -1;}
return 0;
}
}
| 3,989 | 0.670005 | 0.65323 | 137 | 28.153284 | 28.471497 | 125 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.79562 | false | false | 3 |
304ffbf135a2b38ce48fcd45e2fb675c7e4233fa | 25,520,695,674,258 | c45b3979c5dc06ee73168bb77adf00198192427c | /src/main/java/com/Blog/Service/impl/LinkServiceImpl.java | 468c6a3e2e6f633da403141244ff860433853eee | [] | no_license | GreenArrow2017/Blog | https://github.com/GreenArrow2017/Blog | 269989ee629c29ab6eb35673a0d4e0a9e041a579 | 35e1bf488feaf779ed0afd860a7cff7548c5cd55 | refs/heads/master | 2022-05-09T01:32:23.861000 | 2019-07-22T02:25:47 | 2019-07-22T02:25:47 | 161,721,455 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.Blog.Service.impl;
import com.Blog.Dao.LinkDao;
import com.Blog.Entity.Link;
import com.Blog.Service.LinkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
@Service
public class LinkServiceImpl implements LinkService {
@Autowired
private LinkDao linkDao;
/**
* 得到全部友情链接
*
* @return
*/
public List<Link> getLink() {
return linkDao.getLink();
}
/**
* 得到友情链接数量
*
* @return
*/
@Override
public Integer getTotal() {
return linkDao.getTotal();
}
/**
* 得到分页信息
*
* @param map
* @return
*/
@Override
public List<Link> list(Map<String, Object> map) {
return linkDao.list(map);
}
}
| UTF-8 | Java | 934 | java | LinkServiceImpl.java | Java | [] | null | [] | package com.Blog.Service.impl;
import com.Blog.Dao.LinkDao;
import com.Blog.Entity.Link;
import com.Blog.Service.LinkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
@Service
public class LinkServiceImpl implements LinkService {
@Autowired
private LinkDao linkDao;
/**
* 得到全部友情链接
*
* @return
*/
public List<Link> getLink() {
return linkDao.getLink();
}
/**
* 得到友情链接数量
*
* @return
*/
@Override
public Integer getTotal() {
return linkDao.getTotal();
}
/**
* 得到分页信息
*
* @param map
* @return
*/
@Override
public List<Link> list(Map<String, Object> map) {
return linkDao.list(map);
}
}
| 934 | 0.58427 | 0.58427 | 47 | 16.936171 | 15.615601 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.276596 | false | false | 3 |
d8b8e74efbad90e89f5ef497b505f563ec403a9e | 23,390,391,950,401 | b79e72fcbbbb2d322473e8fbd90285345fbae25c | /src/main/java/day2week1sel1/DuplicateLead.java | bd6fa3e53ba775c18bc7c5a9919fd8331c6aab31 | [] | no_license | mathuraganesh/Sel_2018 | https://github.com/mathuraganesh/Sel_2018 | babbbb4a60fac22ade4631a19f864a6b01fbebbb | 57f85ef0ea21eb2ed6df237e95a5c2c8696e935e | refs/heads/master | 2021-09-21T16:31:35.682000 | 2018-08-28T16:12:35 | 2018-08-28T16:12:35 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package day2week1sel1;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.chrome.ChromeDriver;
public class DuplicateLead {
public static void main(String[] args) throws InterruptedException {
ChromeDriver driver=new ChromeDriver();
driver.get("http://leaftaps.com/opentaps/");
driver.manage().window().maximize();
driver.findElementById("username").sendKeys("DemoSalesManager");
driver.findElementById("password").sendKeys("crmsfa");
driver.findElementByClassName("decorativeSubmit").click();
driver.findElementByLinkText("CRM/SFA").click();
driver.findElementByLinkText("Leads").click();
Thread.sleep(100);
driver.findElementByLinkText("Find Leads").click();
Thread.sleep(1000);
//driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
driver.findElementByXPath("//span[text()='Email']").click();
Thread.sleep(1000);
driver.findElementByXPath("//input[@name='emailAddress']").sendKeys("test@gmail.com");
driver.findElementByXPath("//button[text()='Find Leads']").click();
Thread.sleep(1000);
String sGetFirstName=driver.findElementByXPath("(//a[@class='linktext'])[6]").getText();
driver.findElementByXPath("(//a[@class='linktext'])[6]").click();
Thread.sleep(1000);
driver.findElementByXPath("//a[text()='Duplicate Lead']").click();
Thread.sleep(1000);
String sGetTitle=driver.getTitle();
if(sGetTitle.contains("Duplicate Lead")) {
System.out.println("Verified The Title of the Page: "+sGetTitle);
}
else
{
System.out.println("Verification Failed The Title of the Page not Exist"+sGetTitle);
}
driver.findElementByClassName("smallSubmit").click();
Thread.sleep(1000);
String sFirstName=driver.findElementById("viewLead_firstName_sp").getText();
//System.out.println(sGetFirstName);
//System.out.println(sFirstName);
if(sGetFirstName.equals(sFirstName)) {
System.out.println("Confirmed the duplicated lead name is same as captured name- "+sGetFirstName);
}
else {
System.out.println("Confirmation Failed the duplicated lead name is not same as captured name- "+sGetFirstName+ "is not Exist");
}
driver.close();
}
}
| UTF-8 | Java | 2,204 | java | DuplicateLead.java | Java | [
{
"context": ";\r\n\t\tdriver.findElementById(\"username\").sendKeys(\"DemoSalesManager\");\r\n\t\tdriver.findElementById(\"password\").sendKeys",
"end": 415,
"score": 0.9993665814399719,
"start": 399,
"tag": "USERNAME",
"value": "DemoSalesManager"
},
{
"context": ";\r\n\t\tdriver.fi... | null | [] | package day2week1sel1;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.chrome.ChromeDriver;
public class DuplicateLead {
public static void main(String[] args) throws InterruptedException {
ChromeDriver driver=new ChromeDriver();
driver.get("http://leaftaps.com/opentaps/");
driver.manage().window().maximize();
driver.findElementById("username").sendKeys("DemoSalesManager");
driver.findElementById("password").sendKeys("<PASSWORD>");
driver.findElementByClassName("decorativeSubmit").click();
driver.findElementByLinkText("CRM/SFA").click();
driver.findElementByLinkText("Leads").click();
Thread.sleep(100);
driver.findElementByLinkText("Find Leads").click();
Thread.sleep(1000);
//driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
driver.findElementByXPath("//span[text()='Email']").click();
Thread.sleep(1000);
driver.findElementByXPath("//input[@name='emailAddress']").sendKeys("<EMAIL>");
driver.findElementByXPath("//button[text()='Find Leads']").click();
Thread.sleep(1000);
String sGetFirstName=driver.findElementByXPath("(//a[@class='linktext'])[6]").getText();
driver.findElementByXPath("(//a[@class='linktext'])[6]").click();
Thread.sleep(1000);
driver.findElementByXPath("//a[text()='Duplicate Lead']").click();
Thread.sleep(1000);
String sGetTitle=driver.getTitle();
if(sGetTitle.contains("Duplicate Lead")) {
System.out.println("Verified The Title of the Page: "+sGetTitle);
}
else
{
System.out.println("Verification Failed The Title of the Page not Exist"+sGetTitle);
}
driver.findElementByClassName("smallSubmit").click();
Thread.sleep(1000);
String sFirstName=driver.findElementById("viewLead_firstName_sp").getText();
//System.out.println(sGetFirstName);
//System.out.println(sFirstName);
if(sGetFirstName.equals(sFirstName)) {
System.out.println("Confirmed the duplicated lead name is same as captured name- "+sGetFirstName);
}
else {
System.out.println("Confirmation Failed the duplicated lead name is not same as captured name- "+sGetFirstName+ "is not Exist");
}
driver.close();
}
}
| 2,201 | 0.708711 | 0.693285 | 56 | 37.357143 | 30.92123 | 131 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.428571 | false | false | 3 |
5a82cdff77a6663e6ca29c1fde9adec0ccc54514 | 8,632,884,276,469 | 6399dd6ea2b3718a2dd04c09aad73703aad9abd0 | /src/ui/StaticTable.java | 2c4c3dd57c16206390bcb30d9953c6399c88fa0e | [] | no_license | MatanBenshu/HW1_AOOP | https://github.com/MatanBenshu/HW1_AOOP | 83aa8b4b6d93977a44e3c76d0effac12b7f4f00d | 118cb08f9c27b2e6242d9d9bb7587811a205cdbe | refs/heads/master | 2023-05-11T23:10:24.617000 | 2021-05-27T20:14:09 | 2021-05-27T20:14:09 | 356,302,003 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
//Matan Ben-Shushsan 205639800
//Aviya David 209203991
package ui;
import country.Settlement;
import country.SettlementData;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.table.*;
//
public class StaticTable extends JTable {
private static class SettelementModel extends AbstractTableModel {
private SettlementData data;
private final String[] columnNames = {"Index", "Name","Settlement Type", "Ramzor","Present Of Sick","Vaccinate Given","Population Size","Max Residents ","Dead"};
public SettelementModel(SettlementData data) {
this.data = data;
}
@Override
public int getRowCount() {
return data.size();
}
@Override
public int getColumnCount() {
return columnNames.length;
}
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
Settlement settlement = data.at(rowIndex);
switch (columnIndex) {
case 0:
return rowIndex+1;
case 1:
return settlement.getName();
case 2:
return settlement.SettlementType();
case 3:
return settlement.calculateRamzorGrade().getColorName();
case 4:
return String.format("%.3f",settlement.contagiousPercent()*100) + "%";
case 5:
return settlement.getVaccineNum();
case 6:
return settlement.PopulationSize();
case 7:
return settlement.getMaxResidents();
case 8:
return settlement.getDeadNum();
}
return null;
}
@Override
public String getColumnName(int column) {
return columnNames[column];
}
@Override
public Class getColumnClass(int c) {
return getValueAt(0, c).getClass();
}
@Override
public boolean isCellEditable(int rowIndex, int columnIndex) {
return columnIndex > 0;
}
@Override
public void setValueAt(Object aValue, int row, int col) {
Settlement settlement = data.at(row);
switch (col) {
case 1: settlement.setName((String) aValue); break;
}
fireTableCellUpdated(row, col);
}
public String[] getColumnNames() {
return columnNames;
}
}
private static int row_index;
private StatisticsDialog dialog;
private TableRowSorter<SettelementModel> sorter;
private JTextField tbFilterText;
private SettelementModel model;
private SettlementData settlementData;
public StaticTable(SettlementData settlementData, StatisticsDialog dialog, JTextField tbFText) {
this.dialog=dialog;
this.settlementData=settlementData;
this.model=new SettelementModel(settlementData);
this.setModel(model);
this.tbFilterText=tbFText;
// JTable table = new JTable(model);
this.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
this.setFillsViewportHeight(true);
this.setRowSorter(sorter = new TableRowSorter<SettelementModel>(model));
dialog.add(new JScrollPane(this));
tbFilterText.setToolTipText("Filter Name Column");
tbFilterText.getDocument().addDocumentListener(new DocumentListener() {
public void insertUpdate(DocumentEvent e) {
newFilter();
}
public void removeUpdate(DocumentEvent e) {
newFilter();
}
public void changedUpdate(DocumentEvent e) {
newFilter();
}
});
// dialog.pack();
this.setRowSelectionAllowed(true);
this.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
this.setColumnSelectionAllowed(false);
StaticTable table=this;
this.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
public void valueChanged(ListSelectionEvent event) {
row_index= table.getSelectedRow();
System.out.println(row_index);
}
});
}
private void newFilter() {
try {
sorter.setRowFilter(RowFilter.regexFilter(tbFilterText.getText(), 1));
} catch (java.util.regex.PatternSyntaxException e) {
// If current expression doesn't parse, don't update.
}
}
public Settlement getSettlementInRow(){
return settlementData.at(row_index);
}
public void Update(){model.fireTableDataChanged();this.repaint();
}
public String[] getColNames(){return model.getColumnNames();}
public void SortTableby(int col_index){
this.sorter.toggleSortOrder(col_index);
this.Update();
}
} | UTF-8 | Java | 4,986 | java | StaticTable.java | Java | [
{
"context": "\n//Matan Ben-Shushsan 205639800\n//Aviya David 209203991\npackage ui;\n\nim",
"end": 21,
"score": 0.9998629689216614,
"start": 3,
"tag": "NAME",
"value": "Matan Ben-Shushsan"
},
{
"context": "\n//Matan Ben-Shushsan 205639800\n//Aviya David 209203991\npackage ui;\n\nimp... | null | [] |
//<NAME> 205639800
//<NAME> 209203991
package ui;
import country.Settlement;
import country.SettlementData;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.table.*;
//
public class StaticTable extends JTable {
private static class SettelementModel extends AbstractTableModel {
private SettlementData data;
private final String[] columnNames = {"Index", "Name","Settlement Type", "Ramzor","Present Of Sick","Vaccinate Given","Population Size","Max Residents ","Dead"};
public SettelementModel(SettlementData data) {
this.data = data;
}
@Override
public int getRowCount() {
return data.size();
}
@Override
public int getColumnCount() {
return columnNames.length;
}
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
Settlement settlement = data.at(rowIndex);
switch (columnIndex) {
case 0:
return rowIndex+1;
case 1:
return settlement.getName();
case 2:
return settlement.SettlementType();
case 3:
return settlement.calculateRamzorGrade().getColorName();
case 4:
return String.format("%.3f",settlement.contagiousPercent()*100) + "%";
case 5:
return settlement.getVaccineNum();
case 6:
return settlement.PopulationSize();
case 7:
return settlement.getMaxResidents();
case 8:
return settlement.getDeadNum();
}
return null;
}
@Override
public String getColumnName(int column) {
return columnNames[column];
}
@Override
public Class getColumnClass(int c) {
return getValueAt(0, c).getClass();
}
@Override
public boolean isCellEditable(int rowIndex, int columnIndex) {
return columnIndex > 0;
}
@Override
public void setValueAt(Object aValue, int row, int col) {
Settlement settlement = data.at(row);
switch (col) {
case 1: settlement.setName((String) aValue); break;
}
fireTableCellUpdated(row, col);
}
public String[] getColumnNames() {
return columnNames;
}
}
private static int row_index;
private StatisticsDialog dialog;
private TableRowSorter<SettelementModel> sorter;
private JTextField tbFilterText;
private SettelementModel model;
private SettlementData settlementData;
public StaticTable(SettlementData settlementData, StatisticsDialog dialog, JTextField tbFText) {
this.dialog=dialog;
this.settlementData=settlementData;
this.model=new SettelementModel(settlementData);
this.setModel(model);
this.tbFilterText=tbFText;
// JTable table = new JTable(model);
this.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
this.setFillsViewportHeight(true);
this.setRowSorter(sorter = new TableRowSorter<SettelementModel>(model));
dialog.add(new JScrollPane(this));
tbFilterText.setToolTipText("Filter Name Column");
tbFilterText.getDocument().addDocumentListener(new DocumentListener() {
public void insertUpdate(DocumentEvent e) {
newFilter();
}
public void removeUpdate(DocumentEvent e) {
newFilter();
}
public void changedUpdate(DocumentEvent e) {
newFilter();
}
});
// dialog.pack();
this.setRowSelectionAllowed(true);
this.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
this.setColumnSelectionAllowed(false);
StaticTable table=this;
this.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
public void valueChanged(ListSelectionEvent event) {
row_index= table.getSelectedRow();
System.out.println(row_index);
}
});
}
private void newFilter() {
try {
sorter.setRowFilter(RowFilter.regexFilter(tbFilterText.getText(), 1));
} catch (java.util.regex.PatternSyntaxException e) {
// If current expression doesn't parse, don't update.
}
}
public Settlement getSettlementInRow(){
return settlementData.at(row_index);
}
public void Update(){model.fireTableDataChanged();this.repaint();
}
public String[] getColNames(){return model.getColumnNames();}
public void SortTableby(int col_index){
this.sorter.toggleSortOrder(col_index);
this.Update();
}
} | 4,969 | 0.58945 | 0.58223 | 167 | 28.856287 | 26.337349 | 169 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.508982 | false | false | 3 |
0c6719162bc5bcb007b714e2bc6681664828f6ff | 15,410,342,667,716 | e7c82f3bb540058870ea66509275111f3a1d8524 | /teams/src/main/java/us/jack/teams/TeamService.java | 075c77a79ab240c9e113c2eb18bf6395b2ada5ef | [] | no_license | Jenders1/Lab_8 | https://github.com/Jenders1/Lab_8 | 3ba0d0b7afab3360bf4e72c1671b533ec74fac9e | 7e146b20db66be9a1be00d9676dcd9f83432690f | refs/heads/master | 2020-05-16T22:25:49.434000 | 2019-04-25T01:51:38 | 2019-04-25T01:51:38 | 183,335,797 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package us.jack.teams;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@Service
public class TeamService {
private List<Team> teams = new ArrayList<>(
Arrays.asList(
new Team("Birds of Prey", "Gotham"),
new Team("Justice League", "Washington DC"),
new Team("Teen Titans", "Jump City")
)
);
public List<Team> getAllTeams() {
return teams;
}
public Team getTeam(String id) {
return teams.stream()
.filter(t -> t.getName().contains(id))
.findFirst().get();
}
public void addTeam(Team team) {
teams.add(team);
}
} | UTF-8 | Java | 1,036 | java | TeamService.java | Java | [] | null | [] | package us.jack.teams;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@Service
public class TeamService {
private List<Team> teams = new ArrayList<>(
Arrays.asList(
new Team("Birds of Prey", "Gotham"),
new Team("Justice League", "Washington DC"),
new Team("Teen Titans", "Jump City")
)
);
public List<Team> getAllTeams() {
return teams;
}
public Team getTeam(String id) {
return teams.stream()
.filter(t -> t.getName().contains(id))
.findFirst().get();
}
public void addTeam(Team team) {
teams.add(team);
}
} | 1,036 | 0.542471 | 0.542471 | 34 | 28.529411 | 20.760872 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 3 |
58d3e8930a99734ebb27153bf054302fd409562e | 33,706,903,402,443 | 984d48090d7f469602a3f5822a1afb46192bdd31 | /app/src/main/java/com/example/ronaldbenjamin/saarthironald/InitContainer.java | ebaeab38727ef152ca2c89453181a5e4039f742a | [] | no_license | Rodoben/Internship | https://github.com/Rodoben/Internship | 32bfbf7e56ccfdba1253365eb3b4da3ea29b890f | 4a39c85a26297c713b019058b91d1175681045b0 | refs/heads/master | 2020-03-18T13:52:11.837000 | 2018-05-30T06:17:13 | 2018-05-30T06:17:13 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.ronaldbenjamin.saarthironald;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Toast;
import com.google.android.gms.auth.api.Auth;
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
import com.google.android.gms.auth.api.signin.GoogleSignInResult;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.SignInButton;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthCredential;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.auth.GoogleAuthProvider;
public class InitContainer extends AppCompatActivity {
private SignInButton mgooglebtn;
FirebaseAuth mAuth;
FirebaseAuth.AuthStateListener mAuthListner;
private static final String TAG="MAIN_ACTIVITY";
private static final int RC_SIGN_IN=1;
private GoogleApiClient mGoogleApiClient;
private OptionFragment optionFragment;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_init_container);
optionFragment=new OptionFragment();
replaceFragment(optionFragment);
//Google Sign in......
mgooglebtn=(SignInButton)findViewById(R.id.sigInButton);
mAuth=FirebaseAuth.getInstance();
mAuthListner=new FirebaseAuth.AuthStateListener() {
@Override
public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
if (firebaseAuth.getCurrentUser()!=null){
Toast.makeText(getApplicationContext(),"enter",Toast.LENGTH_LONG).show();;
startActivity(new Intent(InitContainer.this,ChatMainPage.class));
}
}
};
}
private void replaceFragment(Fragment fragment) {
FragmentTransaction fragmentTransaction =getSupportFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.MainFrame,fragment);
fragmentTransaction.commit();
}
@Override
protected void onStart() {
super.onStart();
mAuth.addAuthStateListener(mAuthListner);
}
}
| UTF-8 | Java | 2,706 | java | InitContainer.java | Java | [
{
"context": "package com.example.ronaldbenjamin.saarthironald;\n\nimport android.content.Intent;\nim",
"end": 34,
"score": 0.9993937611579895,
"start": 20,
"tag": "USERNAME",
"value": "ronaldbenjamin"
}
] | null | [] | package com.example.ronaldbenjamin.saarthironald;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Toast;
import com.google.android.gms.auth.api.Auth;
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
import com.google.android.gms.auth.api.signin.GoogleSignInResult;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.SignInButton;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthCredential;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.auth.GoogleAuthProvider;
public class InitContainer extends AppCompatActivity {
private SignInButton mgooglebtn;
FirebaseAuth mAuth;
FirebaseAuth.AuthStateListener mAuthListner;
private static final String TAG="MAIN_ACTIVITY";
private static final int RC_SIGN_IN=1;
private GoogleApiClient mGoogleApiClient;
private OptionFragment optionFragment;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_init_container);
optionFragment=new OptionFragment();
replaceFragment(optionFragment);
//Google Sign in......
mgooglebtn=(SignInButton)findViewById(R.id.sigInButton);
mAuth=FirebaseAuth.getInstance();
mAuthListner=new FirebaseAuth.AuthStateListener() {
@Override
public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
if (firebaseAuth.getCurrentUser()!=null){
Toast.makeText(getApplicationContext(),"enter",Toast.LENGTH_LONG).show();;
startActivity(new Intent(InitContainer.this,ChatMainPage.class));
}
}
};
}
private void replaceFragment(Fragment fragment) {
FragmentTransaction fragmentTransaction =getSupportFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.MainFrame,fragment);
fragmentTransaction.commit();
}
@Override
protected void onStart() {
super.onStart();
mAuth.addAuthStateListener(mAuthListner);
}
}
| 2,706 | 0.745381 | 0.743902 | 80 | 32.825001 | 25.417402 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.625 | false | false | 3 |
1f66c2985f12f9bef338019b21a0ffde4e78f1bd | 15,006,615,746,680 | d6439889fe0cd5f332d05ac17cef153dcc674123 | /src/main/java/common/ServerInterface.java | 0a6e95549aa226b6ad87e3d0a9dfeb9a528acce8 | [] | no_license | rstanleyrodrigues/exam | https://github.com/rstanleyrodrigues/exam | aa590539ac6219a8722d659e156b144ed3181d3b | 000a209c9e0701909ed4fc47322cc64b53d28c9d | refs/heads/master | 2020-03-24T22:34:46.231000 | 2018-08-01T02:15:35 | 2018-08-01T02:15:35 | 143,092,229 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package common;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.util.List;
/**
* Define a interface remota do servidor
*/
public interface ServerInterface extends Remote {
/** nome para referenciar remotamente o servidor */
String REFERENCE_NAME = "Server";
int RMI_PORT = 1099;
/**
* Obtém todos os usuários do sistema.
*
* @return lista com os usuários
* @throws RemoteException .
*/
List<User> getUsers() throws RemoteException;
}
| UTF-8 | Java | 492 | java | ServerInterface.java | Java | [] | null | [] | package common;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.util.List;
/**
* Define a interface remota do servidor
*/
public interface ServerInterface extends Remote {
/** nome para referenciar remotamente o servidor */
String REFERENCE_NAME = "Server";
int RMI_PORT = 1099;
/**
* Obtém todos os usuários do sistema.
*
* @return lista com os usuários
* @throws RemoteException .
*/
List<User> getUsers() throws RemoteException;
}
| 492 | 0.699386 | 0.691207 | 25 | 18.559999 | 18.031261 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.28 | false | false | 3 |
3b700edd2565019c5a4978ed4c73730172834c3b | 223,338,307,294 | 864f21c842b3195a23831a48e98d291eaa8a4cbd | /app/src/main/java/com/huawei/gxlm/sunday/activities/ActivityPersonalActivity.java | 4dce65b29e62e475915270d30f0842912f29743f | [] | no_license | dengyi1992/Sunday | https://github.com/dengyi1992/Sunday | 51ab7b3c718e8d47bbf2f704f70e2dc1a070eb38 | 688ffd8b29b06374b1d0ecf53c14eb0f861dea0c | refs/heads/master | 2021-01-17T01:20:11.782000 | 2016-07-22T06:04:57 | 2016-07-22T06:04:57 | 63,024,277 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.huawei.gxlm.sunday.activities;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle;
import android.app.Activity;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;
import android.widget.Toast;
import com.huawei.gxlm.sunday.R;
import com.huawei.gxlm.sunday.utils.ToolFor9Ge;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class ActivityPersonalActivity extends AppCompatActivity {
private LinearLayout layoutContent;
private ListView listView;
private ArrayList<String> strings;
private LinearLayout mLayoutEmptyinclude;
private LinearLayout mLayoutUserinclude;
private SharedPreferences sharedPreferences;
private boolean isLogin;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_personal);
initView();
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
actionBar.setElevation(0);
}
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.home:
// this.finish();
default:
this.finish();
return super.onOptionsItemSelected(item);
}
}
@Override
protected void onResume() {
initData();
super.onResume();
}
private void initData() {
strings = new ArrayList<String>();
strings.add("账户与安全");
strings.add("我的收藏");
strings.add("我的动态");
List<Map<String, Object>> listems = new ArrayList<Map<String, Object>>();
for (int i = 0; i < strings.size(); i++) {
Map<String, Object> listem = new HashMap<String, Object>();
listem.put("name", strings.get(i));
listems.add(listem);
}
sharedPreferences = getSharedPreferences("loginInfo", Context.MODE_PRIVATE);
isLogin = sharedPreferences.getBoolean("isLogin", false);
String name = sharedPreferences.getString("name", null);
int account = sharedPreferences.getInt("account", 0);
listView.setAdapter(new SimpleAdapter(this, listems, R.layout.settingitem, new String[]{"name"}, new int[]{R.id.item_name}));
if (isLogin) {
mLayoutEmptyinclude.setVisibility(View.GONE);
mLayoutUserinclude.setVisibility(View.VISIBLE);
initLoginData(name, account);
} else {
mLayoutEmptyinclude.setVisibility(View.VISIBLE);
mLayoutUserinclude.setVisibility(View.GONE);
initUnLoginData();
}
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Intent intent = new Intent();
switch (position) {
case 0:
iftoDetail(AccountActivity.class);
break;
case 1:
if (ToolFor9Ge.checkNetworkInfo(ActivityPersonalActivity.this)) {
// iftoDetail(MyAssets.class);
Toast.makeText(ActivityPersonalActivity.this, "暂未开发", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(ActivityPersonalActivity.this, "没有网络!", Toast.LENGTH_SHORT).show();
}
break;
case 2:
if (ToolFor9Ge.checkNetworkInfo(ActivityPersonalActivity.this)) {
// iftoDetail(MyCollection.class);
Toast.makeText(ActivityPersonalActivity.this, "暂未开发", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(ActivityPersonalActivity.this, "没有网络!", Toast.LENGTH_SHORT).show();
}
break;
default:
break;
}
}
});
}
private void iftoDetail(Class c) {
Intent intent = new Intent();
if (isLogin) {
intent.setClass(this, c);
} else {
intent.setClass(this, LoginActivity.class);
}
startActivity(intent);
}
/**
* 已经登录的操作
*
* @param name
* @param account
*/
private void initLoginData(String name, int account) {
TextView txtName = (TextView) mLayoutUserinclude.findViewById(R.id.txtName);
TextView txtJifen = (TextView) mLayoutUserinclude.findViewById(R.id.txtJifen);
txtName.setText(name);
txtJifen.setText("积分:" + account);
// mLayoutUserinclude.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// startActivity(new Intent(this, AccountActivity.class));
// }
// });
}
/**
* 未登录操作
*/
private void initUnLoginData() {
TextView bt_setting_login = (TextView) mLayoutEmptyinclude.findViewById(R.id.bt_setting_login);
TextView bt_setting_register = (TextView) mLayoutEmptyinclude.findViewById(R.id.bt_setting_register);
//登录
bt_setting_login.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent();
intent.setClass(ActivityPersonalActivity.this, LoginActivity.class);
startActivity(intent);
}
});
//注册
bt_setting_register.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent();
intent.setClass(ActivityPersonalActivity.this, RegisterActivity.class);
startActivity(intent);
}
});
}
private void initView() {
layoutContent = (LinearLayout) findViewById(R.id.layoutContent);
listView = (ListView) findViewById(R.id.listView);
mLayoutEmptyinclude = (LinearLayout) findViewById(R.id.layoutEmpty);
mLayoutUserinclude = (LinearLayout) findViewById(R.id.layoutUser);
}
}
| UTF-8 | Java | 6,995 | java | ActivityPersonalActivity.java | Java | [] | null | [] | package com.huawei.gxlm.sunday.activities;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle;
import android.app.Activity;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;
import android.widget.Toast;
import com.huawei.gxlm.sunday.R;
import com.huawei.gxlm.sunday.utils.ToolFor9Ge;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class ActivityPersonalActivity extends AppCompatActivity {
private LinearLayout layoutContent;
private ListView listView;
private ArrayList<String> strings;
private LinearLayout mLayoutEmptyinclude;
private LinearLayout mLayoutUserinclude;
private SharedPreferences sharedPreferences;
private boolean isLogin;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_personal);
initView();
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
actionBar.setElevation(0);
}
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.home:
// this.finish();
default:
this.finish();
return super.onOptionsItemSelected(item);
}
}
@Override
protected void onResume() {
initData();
super.onResume();
}
private void initData() {
strings = new ArrayList<String>();
strings.add("账户与安全");
strings.add("我的收藏");
strings.add("我的动态");
List<Map<String, Object>> listems = new ArrayList<Map<String, Object>>();
for (int i = 0; i < strings.size(); i++) {
Map<String, Object> listem = new HashMap<String, Object>();
listem.put("name", strings.get(i));
listems.add(listem);
}
sharedPreferences = getSharedPreferences("loginInfo", Context.MODE_PRIVATE);
isLogin = sharedPreferences.getBoolean("isLogin", false);
String name = sharedPreferences.getString("name", null);
int account = sharedPreferences.getInt("account", 0);
listView.setAdapter(new SimpleAdapter(this, listems, R.layout.settingitem, new String[]{"name"}, new int[]{R.id.item_name}));
if (isLogin) {
mLayoutEmptyinclude.setVisibility(View.GONE);
mLayoutUserinclude.setVisibility(View.VISIBLE);
initLoginData(name, account);
} else {
mLayoutEmptyinclude.setVisibility(View.VISIBLE);
mLayoutUserinclude.setVisibility(View.GONE);
initUnLoginData();
}
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Intent intent = new Intent();
switch (position) {
case 0:
iftoDetail(AccountActivity.class);
break;
case 1:
if (ToolFor9Ge.checkNetworkInfo(ActivityPersonalActivity.this)) {
// iftoDetail(MyAssets.class);
Toast.makeText(ActivityPersonalActivity.this, "暂未开发", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(ActivityPersonalActivity.this, "没有网络!", Toast.LENGTH_SHORT).show();
}
break;
case 2:
if (ToolFor9Ge.checkNetworkInfo(ActivityPersonalActivity.this)) {
// iftoDetail(MyCollection.class);
Toast.makeText(ActivityPersonalActivity.this, "暂未开发", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(ActivityPersonalActivity.this, "没有网络!", Toast.LENGTH_SHORT).show();
}
break;
default:
break;
}
}
});
}
private void iftoDetail(Class c) {
Intent intent = new Intent();
if (isLogin) {
intent.setClass(this, c);
} else {
intent.setClass(this, LoginActivity.class);
}
startActivity(intent);
}
/**
* 已经登录的操作
*
* @param name
* @param account
*/
private void initLoginData(String name, int account) {
TextView txtName = (TextView) mLayoutUserinclude.findViewById(R.id.txtName);
TextView txtJifen = (TextView) mLayoutUserinclude.findViewById(R.id.txtJifen);
txtName.setText(name);
txtJifen.setText("积分:" + account);
// mLayoutUserinclude.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// startActivity(new Intent(this, AccountActivity.class));
// }
// });
}
/**
* 未登录操作
*/
private void initUnLoginData() {
TextView bt_setting_login = (TextView) mLayoutEmptyinclude.findViewById(R.id.bt_setting_login);
TextView bt_setting_register = (TextView) mLayoutEmptyinclude.findViewById(R.id.bt_setting_register);
//登录
bt_setting_login.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent();
intent.setClass(ActivityPersonalActivity.this, LoginActivity.class);
startActivity(intent);
}
});
//注册
bt_setting_register.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent();
intent.setClass(ActivityPersonalActivity.this, RegisterActivity.class);
startActivity(intent);
}
});
}
private void initView() {
layoutContent = (LinearLayout) findViewById(R.id.layoutContent);
listView = (ListView) findViewById(R.id.listView);
mLayoutEmptyinclude = (LinearLayout) findViewById(R.id.layoutEmpty);
mLayoutUserinclude = (LinearLayout) findViewById(R.id.layoutUser);
}
}
| 6,995 | 0.596608 | 0.595014 | 191 | 35.120419 | 27.562042 | 133 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.680628 | false | false | 3 |
0d7ec762ccd57c6122eafbc068aae1897883450f | 26,611,617,433,669 | 695e17fdb8882fe41ffce1aaba2daa1c1338396d | /src/net/progressbg/javabasics20180616/oop/polymorphism/wildfarm/animal/Mammal.java | 6eec160dec606e3278822e2d0b5cea3c177ad9cc | [] | no_license | dsvetoslavov/java-basics | https://github.com/dsvetoslavov/java-basics | 833dedafb523507d3c517bf226677636e246f0df | 5185c838358080f9f631383a8bb821ef3b9a061c | refs/heads/master | 2018-11-04T01:08:26.420000 | 2018-10-06T09:14:17 | 2018-10-06T09:14:17 | 137,732,771 | 0 | 1 | null | false | 2018-07-06T20:32:59 | 2018-06-18T09:25:25 | 2018-07-02T08:39:05 | 2018-07-02T08:39:03 | 34 | 0 | 1 | 1 | Java | false | null | package net.progressbg.javabasics20180616.oop.polymorphism.wildfarm.animal;
public abstract class Mammal extends Animal{
protected String livingRegion;
public Mammal(String animalType, String animalName,
double animalWeigth, String animalLivingRegion){
this.animalType = animalType;
this.animalName = animalName;
this.animalWeigth = animalWeigth;
this.livingRegion = animalLivingRegion;
}
@Override
public String toString(){
return String.format("%s[%s, %.2f, %s, %d]",
this.animalType,
this.animalName, this.animalWeigth,
this.livingRegion, this.foodEaten);
}
}
| UTF-8 | Java | 678 | java | Mammal.java | Java | [] | null | [] | package net.progressbg.javabasics20180616.oop.polymorphism.wildfarm.animal;
public abstract class Mammal extends Animal{
protected String livingRegion;
public Mammal(String animalType, String animalName,
double animalWeigth, String animalLivingRegion){
this.animalType = animalType;
this.animalName = animalName;
this.animalWeigth = animalWeigth;
this.livingRegion = animalLivingRegion;
}
@Override
public String toString(){
return String.format("%s[%s, %.2f, %s, %d]",
this.animalType,
this.animalName, this.animalWeigth,
this.livingRegion, this.foodEaten);
}
}
| 678 | 0.668142 | 0.654867 | 21 | 31.285715 | 22.690763 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.857143 | false | false | 3 |
4a51a67d762cdbe0c7e99ca914f283890a70789a | 30,545,807,421,456 | d570b9a336ddf952274446f38c8e71c256ce137f | /src/main/java/preprcssr/SquareRootMethod.java | fecc0d802bb2fe4e7139decce8ad8db5514f3ae5 | [] | no_license | msm1323/SAPR | https://github.com/msm1323/SAPR | 764104bda935d510223f659cd79c090e38fcb963 | 1488e52f58bb893ac755e2bae7a166c3969c4b75 | refs/heads/master | 2023-05-23T01:50:17.071000 | 2021-06-12T14:40:31 | 2021-06-12T14:40:31 | 376,311,984 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package preprcssr;
public class SquareRootMethod {
private double[][] A;
private double[] b;
SquareRootMethod(double[][] A, double[] b){
this.A = A;
this.b= b;
}
protected double[] run(){
int N = A.length;
double y;
double[] a = new double[N];
double[] B = new double[N];
double[] matRes = new double[N];
int N1 = N - 1;
y = A[0][0];
a[0] = -A[0][1] / y;
B[0] = b[0] / y ;
for (int i = 1; i < N1; i++) {
y = A[i][i] + A[i][i - 1] * a[i - 1];
a[i] = -A[i][i + 1] / y;
B[i] = (b[i] - A[i][i - 1] * B[i - 1]) / y;
}
matRes[N1] = (b[N1] - A[N1][N1 - 1] * B[N1 - 1]) / (A[N1][N1] + A[N1][N1 - 1] * a[N1 - 1]);
for (int i = N1 - 1; i >= 0; i--) {
matRes[i] = a[i] * matRes[i + 1] + B[i];
}
return matRes;
}
} | UTF-8 | Java | 915 | java | SquareRootMethod.java | Java | [] | null | [] | package preprcssr;
public class SquareRootMethod {
private double[][] A;
private double[] b;
SquareRootMethod(double[][] A, double[] b){
this.A = A;
this.b= b;
}
protected double[] run(){
int N = A.length;
double y;
double[] a = new double[N];
double[] B = new double[N];
double[] matRes = new double[N];
int N1 = N - 1;
y = A[0][0];
a[0] = -A[0][1] / y;
B[0] = b[0] / y ;
for (int i = 1; i < N1; i++) {
y = A[i][i] + A[i][i - 1] * a[i - 1];
a[i] = -A[i][i + 1] / y;
B[i] = (b[i] - A[i][i - 1] * B[i - 1]) / y;
}
matRes[N1] = (b[N1] - A[N1][N1 - 1] * B[N1 - 1]) / (A[N1][N1] + A[N1][N1 - 1] * a[N1 - 1]);
for (int i = N1 - 1; i >= 0; i--) {
matRes[i] = a[i] * matRes[i + 1] + B[i];
}
return matRes;
}
} | 915 | 0.381421 | 0.344262 | 34 | 25.941177 | 20.193098 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.735294 | false | false | 3 |
d6d5f75c915d8c89a978884fb271270f14923fe3 | 23,441,931,533,738 | af975a332bab49d7800191e4d3b1a25aac0c1ead | /src/main/java/sims2016derive/quotationtranscode/context/struct/CThostFtdcExchangeSequenceField.java | f66478b9dd1bb780c37ea25809ca3088ef1bd0b3 | [] | no_license | ssh352/ctp32 | https://github.com/ssh352/ctp32 | bef842b3789ba83f53c281646f4a68a2cd439282 | 4d809d22d1ff2dbaa13e2f576bf29791d991e8bb | refs/heads/master | 2020-03-28T23:28:05.367000 | 2016-03-01T05:53:27 | 2016-03-01T05:53:47 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package sims2016derive.quotationtranscode.context.struct;
import org.bridj.Pointer;
import org.bridj.StructObject;
import org.bridj.ann.Array;
import org.bridj.ann.Field;
/**
* This file was autogenerated by <a href="http://jnaerator.googlecode.com/">JNAerator</a>,<br>
* a tool written by <a href="http://ochafik.com/">Olivier Chafik</a> that <a href="http://code.google.com/p/jnaerator/wiki/CreditsAndLicense">uses a few opensource projects.</a>.<br>
* For help, please visit <a href="http://nativelibs4java.googlecode.com/">NativeLibs4Java</a> or <a href="http://bridj.googlecode.com/">BridJ</a> .
*/
public class CThostFtdcExchangeSequenceField extends StructObject {
public CThostFtdcExchangeSequenceField() {
super();
}
/**
* \u4ea4\u6613\u6240\u4ee3\u7801
*/
@Array({9})
@Field(0)
private Pointer<Byte> ExchangeID() {
return this.io.getPointerField(this, 0);
}
@Array({9})
@Field(0)
public void setExchangeID(String exchangeID) {
this.io.getPointerField(this, 0).setCString(exchangeID);
}
public String getExchangeID() {
return ExchangeID().getCString();
}
/**
* \u5e8f\u53f7
*/
@Field(1)
private int SequenceNo() {
return this.io.getIntField(this, 1);
}
public int getSequenceNo() {
return SequenceNo();
}
/**
* \u5e8f\u53f7
*/
@Field(1)
private CThostFtdcExchangeSequenceField SequenceNo(int SequenceNo) {
this.io.setIntField(this, 1, SequenceNo);
return this;
}
public void setSequenceNo(int sequenceNo) {
SequenceNo(sequenceNo);
}
/**
* \u5408\u7ea6\u4ea4\u6613\u72b6\u6001
*/
@Field(2)
private byte MarketStatus() {
return this.io.getByteField(this, 2);
}
public char getMarketStatus() {
return (char)MarketStatus();
}
/**
* \u5408\u7ea6\u4ea4\u6613\u72b6\u6001
*/
@Field(2)
private CThostFtdcExchangeSequenceField MarketStatus(byte MarketStatus) {
this.io.setByteField(this, 2, MarketStatus);
return this;
}
public void setMarketStatus(char marketStatus) {
MarketStatus((byte)marketStatus);
}
public CThostFtdcExchangeSequenceField(Pointer pointer) {
super(pointer);
}
}
| UTF-8 | Java | 2,189 | java | CThostFtdcExchangeSequenceField.java | Java | [
{
"context": "* a tool written by <a href=\"http://ochafik.com/\">Olivier Chafik</a> that <a href=\"http://code.google.com/p/jnaera",
"end": 343,
"score": 0.9998757243156433,
"start": 329,
"tag": "NAME",
"value": "Olivier Chafik"
}
] | null | [] | package sims2016derive.quotationtranscode.context.struct;
import org.bridj.Pointer;
import org.bridj.StructObject;
import org.bridj.ann.Array;
import org.bridj.ann.Field;
/**
* This file was autogenerated by <a href="http://jnaerator.googlecode.com/">JNAerator</a>,<br>
* a tool written by <a href="http://ochafik.com/"><NAME></a> that <a href="http://code.google.com/p/jnaerator/wiki/CreditsAndLicense">uses a few opensource projects.</a>.<br>
* For help, please visit <a href="http://nativelibs4java.googlecode.com/">NativeLibs4Java</a> or <a href="http://bridj.googlecode.com/">BridJ</a> .
*/
public class CThostFtdcExchangeSequenceField extends StructObject {
public CThostFtdcExchangeSequenceField() {
super();
}
/**
* \u4ea4\u6613\u6240\u4ee3\u7801
*/
@Array({9})
@Field(0)
private Pointer<Byte> ExchangeID() {
return this.io.getPointerField(this, 0);
}
@Array({9})
@Field(0)
public void setExchangeID(String exchangeID) {
this.io.getPointerField(this, 0).setCString(exchangeID);
}
public String getExchangeID() {
return ExchangeID().getCString();
}
/**
* \u5e8f\u53f7
*/
@Field(1)
private int SequenceNo() {
return this.io.getIntField(this, 1);
}
public int getSequenceNo() {
return SequenceNo();
}
/**
* \u5e8f\u53f7
*/
@Field(1)
private CThostFtdcExchangeSequenceField SequenceNo(int SequenceNo) {
this.io.setIntField(this, 1, SequenceNo);
return this;
}
public void setSequenceNo(int sequenceNo) {
SequenceNo(sequenceNo);
}
/**
* \u5408\u7ea6\u4ea4\u6613\u72b6\u6001
*/
@Field(2)
private byte MarketStatus() {
return this.io.getByteField(this, 2);
}
public char getMarketStatus() {
return (char)MarketStatus();
}
/**
* \u5408\u7ea6\u4ea4\u6613\u72b6\u6001
*/
@Field(2)
private CThostFtdcExchangeSequenceField MarketStatus(byte MarketStatus) {
this.io.setByteField(this, 2, MarketStatus);
return this;
}
public void setMarketStatus(char marketStatus) {
MarketStatus((byte)marketStatus);
}
public CThostFtdcExchangeSequenceField(Pointer pointer) {
super(pointer);
}
}
| 2,181 | 0.680676 | 0.642302 | 90 | 22.299999 | 30.125828 | 183 | false | false | 0 | 0 | 36 | 0.046597 | 0 | 0 | 1.211111 | false | false | 3 |
ce5aa58915a538b35ad4033a6e6bb595f37613fd | 12,498,354,872,960 | be352b5e3d29216818192c7cc26c1a131952d3ff | /ticket/TicketSystem/src/com/chedilong/event/entity/Competition.java | fbb66907e1d2252b1fc64037bd1d17529adcbd18 | [] | no_license | air902/cat | https://github.com/air902/cat | 369d9b291e572d448f26319cee6f5005c7e46aef | 31299fffbf461c409f6193f3c3c556246695c551 | refs/heads/master | 2022-06-27T09:07:03.885000 | 2020-05-06T15:08:54 | 2020-05-06T15:08:54 | 250,258,993 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.chedilong.event.entity;
import java.math.BigDecimal;
/**
* 赛事的实体类
*/
public class Competition {
private Integer id;
private String homeField;
private String visitingField;
private String introduction;
private String time;
private BigDecimal price;
public Competition(Integer id, String homeField, String visitingField, String introduction, String time, BigDecimal price) {
this.id = id;
this.homeField = homeField;
this.visitingField = visitingField;
this.introduction = introduction;
this.time = time;
this.price = price;
}
public Competition(){}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getHomeField() {
return homeField;
}
public void setHomeField(String homeField) {
this.homeField = homeField;
}
public String getVisitingField() {
return visitingField;
}
public void setVisitingField(String visitingField) {
this.visitingField = visitingField;
}
public String getIntroduction() {
return introduction;
}
public void setIntroduction(String introduction) {
this.introduction = introduction;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
}
| UTF-8 | Java | 1,580 | java | Competition.java | Java | [] | null | [] | package com.chedilong.event.entity;
import java.math.BigDecimal;
/**
* 赛事的实体类
*/
public class Competition {
private Integer id;
private String homeField;
private String visitingField;
private String introduction;
private String time;
private BigDecimal price;
public Competition(Integer id, String homeField, String visitingField, String introduction, String time, BigDecimal price) {
this.id = id;
this.homeField = homeField;
this.visitingField = visitingField;
this.introduction = introduction;
this.time = time;
this.price = price;
}
public Competition(){}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getHomeField() {
return homeField;
}
public void setHomeField(String homeField) {
this.homeField = homeField;
}
public String getVisitingField() {
return visitingField;
}
public void setVisitingField(String visitingField) {
this.visitingField = visitingField;
}
public String getIntroduction() {
return introduction;
}
public void setIntroduction(String introduction) {
this.introduction = introduction;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
}
| 1,580 | 0.630102 | 0.630102 | 74 | 20.18919 | 20.511484 | 128 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.418919 | false | false | 3 |
36fc05c007868be9440d20fbc38b1c2d7f003b7f | 9,947,144,300,648 | 47baae443c04a7e32e99f4d50302d8ae46526f92 | /android-studio-plugin/src/configuration/FreeConfigurationFactory.java | 7159486eebc42e729b34ba30db5c8a88cfd759c4 | [
"BSD-3-Clause"
] | permissive | liu13chao/freeline | https://github.com/liu13chao/freeline | 270747cf86312f518e1b5b2aeaf83219f069320d | 79e867664ebbd104f8873cddfafdb39c8d0d9819 | refs/heads/master | 2021-01-11T11:39:06.741000 | 2016-12-17T07:54:17 | 2016-12-17T07:54:17 | 76,861,128 | 1 | 0 | null | true | 2016-12-19T12:40:12 | 2016-12-19T12:40:12 | 2016-12-19T11:40:34 | 2016-12-17T07:55:59 | 61,346 | 0 | 0 | 0 | null | null | null | package configuration;
import com.intellij.execution.configurations.ConfigurationFactory;
import com.intellij.execution.configurations.ConfigurationType;
import com.intellij.execution.configurations.RunConfiguration;
import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NotNull;
import utils.FreelineUtil;
/**
* Freeline Configuration Factory
*
* @author act262@gmail.com
*/
class FreeConfigurationFactory extends ConfigurationFactory {
FreeConfigurationFactory(@NotNull ConfigurationType type) {
super(type);
}
@NotNull
@Override
public RunConfiguration createTemplateConfiguration(@NotNull Project project) {
return new FreeRunConfiguration(project, this, "FreelineFactory");
}
@Override
public boolean isApplicable(@NotNull Project project) {
// enabled only had init project
return FreelineUtil.hadInitFreeline(project);
}
@Override
public boolean isConfigurationSingletonByDefault() {
return true;
}
}
| UTF-8 | Java | 1,030 | java | FreeConfigurationFactory.java | Java | [
{
"context": "**\n * Freeline Configuration Factory\n *\n * @author act262@gmail.com\n */\nclass FreeConfigurationFactory extends Config",
"end": 401,
"score": 0.9999258518218994,
"start": 385,
"tag": "EMAIL",
"value": "act262@gmail.com"
}
] | null | [] | package configuration;
import com.intellij.execution.configurations.ConfigurationFactory;
import com.intellij.execution.configurations.ConfigurationType;
import com.intellij.execution.configurations.RunConfiguration;
import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NotNull;
import utils.FreelineUtil;
/**
* Freeline Configuration Factory
*
* @author <EMAIL>
*/
class FreeConfigurationFactory extends ConfigurationFactory {
FreeConfigurationFactory(@NotNull ConfigurationType type) {
super(type);
}
@NotNull
@Override
public RunConfiguration createTemplateConfiguration(@NotNull Project project) {
return new FreeRunConfiguration(project, this, "FreelineFactory");
}
@Override
public boolean isApplicable(@NotNull Project project) {
// enabled only had init project
return FreelineUtil.hadInitFreeline(project);
}
@Override
public boolean isConfigurationSingletonByDefault() {
return true;
}
}
| 1,021 | 0.75534 | 0.752427 | 37 | 26.837837 | 25.873407 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.351351 | false | false | 3 |
a4c145ee7f7b78681c249b441a9904abe87d1198 | 128,849,059,522 | 5c35cc358dfe34ea88f8ed904071a4e9cbcb09f6 | /HubbsCenter/src/com/example/dissentfinal/pageAdapter.java | b6ab5bca8990f1e084c5e61d4d32e5d7632c8ac7 | [] | no_license | kennybello/DissentFinal | https://github.com/kennybello/DissentFinal | 85e7825b7d36182297c2c395060f92944e753eb0 | a532324f0fed7e70db002ade93c880e2b236f1ce | refs/heads/master | 2020-04-15T21:08:55.945000 | 2015-08-12T07:03:52 | 2015-08-12T07:03:52 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.dissentfinal;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.os.Parcelable;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
public class pageAdapter extends PagerAdapter{
public int getCount() {
return 2;
}
public Object instantiateItem(final View collection, int position) {
LayoutInflater inflater = (LayoutInflater) collection.getContext()
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v = null;
switch (position) {
case 0:
v = inflater.inflate(R.layout.activity_home_screen, null);
break;
case 1:
v = inflater.inflate(R.layout.activity_menu_screen, null);
Button MenuAbout = (Button) v.findViewById(R.id.mAbout);
MenuAbout.setBackgroundColor(Color.TRANSPARENT);
MenuAbout.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
Context context = collection.getContext();
Intent mA = new Intent(context, AboutScreen.class);
context.startActivity(mA);
}
});
Button MenuHand = (Button) v.findViewById(R.id.mHand);
MenuHand.setBackgroundColor(Color.TRANSPARENT);
MenuHand.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Context context = collection.getContext();
Intent mH = new Intent(context, HandBookScreen.class);
context.startActivity(mH);
}
});
Button MenuScavange = (Button) v.findViewById(R.id.mScavange);
MenuScavange.setBackgroundColor(Color.TRANSPARENT);
MenuScavange.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Context context = collection.getContext();
Intent mO = new Intent(context, OpportunityScreen.class);
context.startActivity(mO);
}
});
Button MenuMap = (Button) v.findViewById(R.id.mMap);
MenuMap.setBackgroundColor(Color.TRANSPARENT);
MenuMap.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Context context = collection.getContext();
Intent mCh = new Intent(context, CheckScreen.class);
context.startActivity(mCh);
}
});
Button MenuContact = (Button) v.findViewById(R.id.mContact);
MenuContact.setBackgroundColor(Color.TRANSPARENT);
MenuContact.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Context context = collection.getContext();
Intent mC = new Intent(context, ContactScreen.class);
context.startActivity(mC);
}
});
break;
}
((ViewPager) collection).addView(v, 0);
return v;
}
@Override
public void destroyItem(View arg0, int arg1, Object arg2){
((ViewPager) arg0).removeView((View) arg2);
}
@Override
public boolean isViewFromObject(View arg0, Object arg1){
return arg0 == ((View) arg1);
}
@Override
public Parcelable saveState() {
return null;
}
}
| UTF-8 | Java | 3,309 | java | pageAdapter.java | Java | [] | null | [] | package com.example.dissentfinal;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.os.Parcelable;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
public class pageAdapter extends PagerAdapter{
public int getCount() {
return 2;
}
public Object instantiateItem(final View collection, int position) {
LayoutInflater inflater = (LayoutInflater) collection.getContext()
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v = null;
switch (position) {
case 0:
v = inflater.inflate(R.layout.activity_home_screen, null);
break;
case 1:
v = inflater.inflate(R.layout.activity_menu_screen, null);
Button MenuAbout = (Button) v.findViewById(R.id.mAbout);
MenuAbout.setBackgroundColor(Color.TRANSPARENT);
MenuAbout.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
Context context = collection.getContext();
Intent mA = new Intent(context, AboutScreen.class);
context.startActivity(mA);
}
});
Button MenuHand = (Button) v.findViewById(R.id.mHand);
MenuHand.setBackgroundColor(Color.TRANSPARENT);
MenuHand.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Context context = collection.getContext();
Intent mH = new Intent(context, HandBookScreen.class);
context.startActivity(mH);
}
});
Button MenuScavange = (Button) v.findViewById(R.id.mScavange);
MenuScavange.setBackgroundColor(Color.TRANSPARENT);
MenuScavange.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Context context = collection.getContext();
Intent mO = new Intent(context, OpportunityScreen.class);
context.startActivity(mO);
}
});
Button MenuMap = (Button) v.findViewById(R.id.mMap);
MenuMap.setBackgroundColor(Color.TRANSPARENT);
MenuMap.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Context context = collection.getContext();
Intent mCh = new Intent(context, CheckScreen.class);
context.startActivity(mCh);
}
});
Button MenuContact = (Button) v.findViewById(R.id.mContact);
MenuContact.setBackgroundColor(Color.TRANSPARENT);
MenuContact.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Context context = collection.getContext();
Intent mC = new Intent(context, ContactScreen.class);
context.startActivity(mC);
}
});
break;
}
((ViewPager) collection).addView(v, 0);
return v;
}
@Override
public void destroyItem(View arg0, int arg1, Object arg2){
((ViewPager) arg0).removeView((View) arg2);
}
@Override
public boolean isViewFromObject(View arg0, Object arg1){
return arg0 == ((View) arg1);
}
@Override
public Parcelable saveState() {
return null;
}
}
| 3,309 | 0.664853 | 0.66032 | 113 | 28.283186 | 23.341433 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.707965 | false | false | 3 |
2d0031e1ccaf0640769918d3c491ca38df972308 | 15,771,119,954,205 | 1add48530fd535f6baf5ee7ef088378bbe15c36a | /chess/gui/SpotPanel.java | 7b257660dcb68588d116fe3b0e36e87242b04418 | [] | no_license | samuelokrent/chess | https://github.com/samuelokrent/chess | 2d8ce7482d34868af5636578a126bf9ae0e2767f | fe2d29aabfb3905cf349059877a7929347a5ceeb | refs/heads/master | 2020-12-04T13:25:09.234000 | 2016-09-22T19:00:22 | 2016-09-22T19:00:22 | 67,471,641 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package chess.gui;
import chess.*;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
/**
* SpotPanel: A JPanel that displays a single spot on
* the chess board
*/
public class SpotPanel extends JPanel {
// The display length of the side of a SpotPanel
public static int SIDE_LENGTH = 100;
// The display colors of spots
public static final Color BLACK = new Color(0.56f, 0.32f, 0.1f);
public static final Color WHITE = new Color(0.95f, 0.9f, 0.83f);
// The spot this SpotPanel represents
private Board.Spot spot;
public SpotPanel(MouseListener listener) {
super();
setPreferredSize(new Dimension(SIDE_LENGTH, SIDE_LENGTH));
setBorder(BorderFactory.createLineBorder(Color.BLACK));
addMouseListener(listener);
}
public Board.Spot getSpot() {
return spot;
}
public void setSpot(Board.Spot spot) {
this.spot = spot;
revalidate();
repaint();
}
@Override
public void paintComponent(Graphics g) {
g.setColor(getColor());
g.fillRect(0, 0, SIDE_LENGTH, SIDE_LENGTH);
if(spot != null && spot.isOccupied()) {
String iconFile = spot.getPiece().getIconFile();
try {
BufferedImage img = ImageIO.read(new File(iconFile));
int left = (getWidth() - img.getWidth()) / 2;
int right = left + img.getWidth();
int top = (getHeight() - img.getHeight()) / 2;
int bottom = top + img.getHeight();
g.drawImage(img, left, top, right, bottom, 0, 0, img.getWidth(), img.getHeight(), null);
} catch (IOException e) {
System.err.println("COULD NOT READ FILE: " + iconFile);
}
}
}
/**
*
* @returns The display color of this SpotPanel
*/
public Color getColor() {
if(spot == null) return WHITE;
if(spot.getColor() == Chess.Color.BLACK)
return BLACK;
else
return WHITE;
}
/**
* Highlights this spot to indicate it was selected,
* or removes highlighting if not selected
*/
public void setHighlighted(boolean selected) {
if(selected) {
setBorder(BorderFactory.createLineBorder(Color.GREEN));
} else {
setBorder(BorderFactory.createLineBorder(Color.BLACK));
}
}
}
| UTF-8 | Java | 2,251 | java | SpotPanel.java | Java | [] | null | [] | package chess.gui;
import chess.*;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
/**
* SpotPanel: A JPanel that displays a single spot on
* the chess board
*/
public class SpotPanel extends JPanel {
// The display length of the side of a SpotPanel
public static int SIDE_LENGTH = 100;
// The display colors of spots
public static final Color BLACK = new Color(0.56f, 0.32f, 0.1f);
public static final Color WHITE = new Color(0.95f, 0.9f, 0.83f);
// The spot this SpotPanel represents
private Board.Spot spot;
public SpotPanel(MouseListener listener) {
super();
setPreferredSize(new Dimension(SIDE_LENGTH, SIDE_LENGTH));
setBorder(BorderFactory.createLineBorder(Color.BLACK));
addMouseListener(listener);
}
public Board.Spot getSpot() {
return spot;
}
public void setSpot(Board.Spot spot) {
this.spot = spot;
revalidate();
repaint();
}
@Override
public void paintComponent(Graphics g) {
g.setColor(getColor());
g.fillRect(0, 0, SIDE_LENGTH, SIDE_LENGTH);
if(spot != null && spot.isOccupied()) {
String iconFile = spot.getPiece().getIconFile();
try {
BufferedImage img = ImageIO.read(new File(iconFile));
int left = (getWidth() - img.getWidth()) / 2;
int right = left + img.getWidth();
int top = (getHeight() - img.getHeight()) / 2;
int bottom = top + img.getHeight();
g.drawImage(img, left, top, right, bottom, 0, 0, img.getWidth(), img.getHeight(), null);
} catch (IOException e) {
System.err.println("COULD NOT READ FILE: " + iconFile);
}
}
}
/**
*
* @returns The display color of this SpotPanel
*/
public Color getColor() {
if(spot == null) return WHITE;
if(spot.getColor() == Chess.Color.BLACK)
return BLACK;
else
return WHITE;
}
/**
* Highlights this spot to indicate it was selected,
* or removes highlighting if not selected
*/
public void setHighlighted(boolean selected) {
if(selected) {
setBorder(BorderFactory.createLineBorder(Color.GREEN));
} else {
setBorder(BorderFactory.createLineBorder(Color.BLACK));
}
}
}
| 2,251 | 0.66948 | 0.658374 | 94 | 22.946808 | 21.566999 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.978723 | false | false | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.