id stringlengths 36 36 | meta stringlengths 429 697 | url stringlengths 27 109 | tokens int64 137 584 | domain_prefix stringlengths 16 106 | score float64 0.16 0.3 | code_content stringlengths 960 1.25k |
|---|---|---|---|---|---|---|
02339111-d112-456d-baa2-ecabf3e5fe43 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2013-08-06T17:22:48", "repo_name": "brudgers/VectorScriptTools", "sub_path": "/RenderworksScripts/readme.md", "file_name": "readme.md", "file_ext": "md", "file_size_in_byte": 1008, "line_count": 15, "lang": "en", "doc_type": "text", "blob_id": "2c7159ced2e580bdf80d789cf968d27e78bd1864", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/brudgers/VectorScriptTools | 222 | FILENAME: readme.md | 0.281406 | <p>RenderworksScripts was written for Vectorworks 2008. It was written based upon the Vectorscript referece: </p>
<p>http://developer.vectorworks.net/index.php?title=VS:Function_Reference_Appendix </p>
<p>Some of the commands require Renderworks. Others manipulate the standard drawing modes.</p>
<p>Originally, there was some divergence between the documentation of the chunk Parameters and the actual implementation in Vectorworks 2008. So be aware that there may be minor difference between the official documentation and the current [or past] version of Vectorworks.</p>
<p>As Always, if you choose to implement the commands by wrapping them into a tool and calling them from an icon, a click in the drawing window will be required to exectute the command after clicking on its icon.</p>
<p>RenderworksScripts contains:</p>
<li>Parameter Scripts for switching Renderworks modes</li>
<li>Parameter Scripts for setting Renderworks modes</li>
<li>Icons for representing Renderworks modes as tools</li>
|
aa95fd7a-1353-4e4a-8820-f8e652d0bae8 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-02-02 19:32:30", "repo_name": "warumNicht/Databases-Frameworks-Hibernate-Spring-Data-october-2018", "sub_path": "/7.CodeFirstEntityRelations/exercises/src/main/java/pb6_FootballBettingDatabase/entities/teams/Color.java", "file_name": "Color.java", "file_ext": "java", "file_size_in_byte": 1043, "line_count": 54, "lang": "en", "doc_type": "code", "blob_id": "75840ec1dff8e5e7310146b19641ab903cbe19de", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/warumNicht/Databases-Frameworks-Hibernate-Spring-Data-october-2018 | 240 | FILENAME: Color.java | 0.283781 | package pb6_FootballBettingDatabase.entities.teams;
import javax.persistence.*;
import java.util.HashSet;
import java.util.Set;
@Entity
@Table(name = "colors")
public class Color {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private int id;
@OneToMany(mappedBy = "primaryColor",targetEntity = Team.class,cascade = CascadeType.ALL,fetch = FetchType.LAZY)
private Set<Team> teams;
@Column(name = "name")
private String name;
public Color() {
this.teams=new HashSet<>();
}
public Color(String name) {
this.name = name;
this.teams=new HashSet<>();
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public Set<Team> getTeams() {
return teams;
}
public void setTeams(Set<Team> teams) {
this.teams = teams;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
|
8c621531-5569-4e2f-abc8-86fc056cec0e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-11-01 12:48:46", "repo_name": "canissapiens/springtraining-week6-hw", "sub_path": "/src/main/java/pl/mirek/ksb2/moviecollector/service/MovieService.java", "file_name": "MovieService.java", "file_ext": "java", "file_size_in_byte": 1084, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "cce24187cc597c23f634f7addbc254b66b930133", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/canissapiens/springtraining-week6-hw | 224 | FILENAME: MovieService.java | 0.253861 | package pl.mirek.ksb2.moviecollector.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service;
import pl.mirek.ksb2.moviecollector.aspect.MovieSendMail;
import pl.mirek.ksb2.moviecollector.mailservice.MailService;
import pl.mirek.ksb2.moviecollector.model.Movie;
import pl.mirek.ksb2.moviecollector.repository.MovieRepository;
import java.util.List;
@Service
public class MovieService {
private MovieRepository repository;
private MailService mailService;
private Environment env;
@Autowired
public MovieService(MovieRepository repository, MailService mailService, Environment env) {
this.repository = repository;
this.mailService = mailService;
this.env = env;
}
public List<Movie> getAll() {
return repository.getMovies();
}
public Movie getLast() {
return repository.getLast();
}
@MovieSendMail
public void addMovie(Movie movie) {
repository.addMovie(movie);
}
}
|
b8c0187e-2ce1-46fe-8ac5-47c24f177e08 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2017-09-19T12:18:01", "repo_name": "kentchiu/kentchiu.github.com", "sub_path": "/_posts/2011-10-17-postgresql_config.md", "file_name": "2011-10-17-postgresql_config.md", "file_ext": "md", "file_size_in_byte": 1293, "line_count": 54, "lang": "zh", "doc_type": "text", "blob_id": "96a6e0c4c68e82f7b20d091d84b1f03a2baef144", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/kentchiu/kentchiu.github.com | 346 | FILENAME: 2011-10-17-postgresql_config.md | 0.236516 | ---
author: Kent Chiu
published: true
layout: post
title: "設定PostgrSQL的連線配置"
date: 2011-10-17
comments: true
external-url:
sharing: true
footer: true
tags:
- postgresql
---
設定可以連線的IP是在 data\\postgresql.conf
```
listen_addresses = '*' # what IP address(es) to listen on;
```
設定連線的認證方式是在 data\\pg\_hba.conf
```
# TYPE DATABASE USER CIDR-ADDRESS METHOD
# IPv4 local connections:
#host all all 127.0.0.1/32 trust
# IPv6 local connections 允許來自同網域的1~128網段的使用者連線,不需密碼
#host all all ::1/128 trust
# password authorize 允許來自同網域的1~128網段的任何使用者連線,需密碼
host all all ::1/128 md5
```
USER設為ALL表示,資料庫裡所有的user都能連進資料庫,沒有的user就不能連
如果忘記db密碼,可以設成
```
host all all ::1/128 trust
```
允許同網段的ip連入,之後可以透過postgres這個預設的user登入之後,修改postgres
user的密碼,再改回用密碼認證的方式。
|
186e6c28-45b8-42dd-9af6-8a3af6fd5ca8 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2018-10-23T16:27:49", "repo_name": "jamesschlader/bamazon", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1010, "line_count": 15, "lang": "en", "doc_type": "text", "blob_id": "b06adc74e0c69a02f49eac76512f67d234ea3509", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/jamesschlader/bamazon | 230 | FILENAME: README.md | 0.282988 | # bamazon
The bamazon app deploys a mySql database to allow a user to play around with buying goods from the 5h Edition of Dungeons and Dragons.
To see the app in action, watch this: https://youtu.be/pZ4axnuDoD4.
The bamazon app uses the inquirer node package to prompt users for how they would like to interact with the data. The options are:
1. View Everything - shows the entire table of data
2. Search - allows a text search of items in the table
3. Browse by category - loads a list of all the items in the table by the chosen category
4. Log in as a Dealer - allows the user to log in and access management function (NOT DEPLOYED)
Using inquirer, the user walks through the selection and purchasing decision in an intuitive manner. If there isn't enough inventory available, the user is told as much. If the purchase is made, the total amount is displayed and the user is allowed to confirm or reject the purchase. After a purchase decision has been finalized, the app cycles back to the main menu.
|
8407a85b-ef51-4074-9324-1072c63389f0 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-06-30 01:44:28", "repo_name": "alefherrera/sisalud", "sub_path": "/SiSaludSRL/src/main/java/ar/edu/ungs/commons/utils/ExceptionUtils.java", "file_name": "ExceptionUtils.java", "file_ext": "java", "file_size_in_byte": 1019, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "e824bdb549c297d151c8eea00b73977019bdc8d6", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/alefherrera/sisalud | 198 | FILENAME: ExceptionUtils.java | 0.228156 | /**
*
*/
package ar.edu.ungs.commons.utils;
/**
* Clase de utilidades para el Manejo de Excepciones
*
*/
public final class ExceptionUtils {
private ExceptionUtils() {
}
/**
* Parsea el StackTrace de un error
*
* @param e Excepción
* @return Devulve el Mensaje Parseado
*/
public static synchronized String getMessage(Throwable e) {
StringBuilder buffer = new StringBuilder();
buffer.append(e.getMessage());
buffer.append(System.getProperty("line.separator"));
buffer.append("----------------");
StackTraceElement[] trace = e.getStackTrace();
if (trace != null && trace.length > 0) {
for (StackTraceElement trace1 : trace) {
StackTraceElement element = (StackTraceElement) trace1;
buffer.append(element.toString());
buffer.append(System.getProperty("line.separator"));
}
return buffer.toString();
}
return "";
}
}
|
e694aa49-943b-40c8-9765-739f6f87c95b | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-09-09 07:45:36", "repo_name": "84489556/hxg_app115_rn_upgrade", "sub_path": "/android/app/src/main/java/com/yuanda/cy_professional_select_stock/module/RegisterMiPushPackage.java", "file_name": "RegisterMiPushPackage.java", "file_ext": "java", "file_size_in_byte": 1186, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "badfbe871ebd288239e271dd6e7e34eb951a4fcd", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/84489556/hxg_app115_rn_upgrade | 238 | FILENAME: RegisterMiPushPackage.java | 0.268941 | package com.yuanda.cy_professional_select_stock.module;
import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.JavaScriptModule;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* Created by pp. on 2018/12/03.
*/
public class RegisterMiPushPackage implements ReactPackage {
public static ReactApplicationContext sReactContext;
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
sReactContext = reactContext;
List<NativeModule> modules=new ArrayList<>();
//将我们创建的类添加进原生模块列表中
modules.add(new RegisterMiPushManager(reactContext));
return modules;
}
// @Override
// public List<Class<? extends JavaScriptModule>> createJSModules() {
// return Collections.emptyList();
// }
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
return Collections.emptyList();
}
}
|
5734b203-97b5-49c0-bad6-e2a1dbd340c1 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2017-09-25T22:12:35", "repo_name": "junzhengca/LightningChat", "sub_path": "/docs/docs/client_config.md", "file_name": "client_config.md", "file_ext": "md", "file_size_in_byte": 1211, "line_count": 40, "lang": "en", "doc_type": "text", "blob_id": "079764ad891dcb57b0ee016963d60aec41c0e336", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/junzhengca/LightningChat | 283 | FILENAME: client_config.md | 0.252384 | # Client Configuration
Client configuration is coded to your HTML page, right before `<script src="<path to lc.min.js>"></script>`.
The default configuration looks like this:
```js
lightningChatApiBase = "<your api access point>"
lightningChatInterfaceResources = {
htmlPath:"<path to ui.html>",
welcomeMessage: "Welcome to AMACSS at UTSC, how can we help?",
emailMessage: "What is you email address? if you are away, you will recieve an email notification when we reply."
}
lightningChatInitialQuiz = []
```
### lightningChatApiBase
Your API access point, default should be `your-domain:3000`.
### lightningChatInterfaceResources.htmlPath
Path to `/client/compiled/ui.html`.
### lightningChatInterfaceResources.welcomeMessage
Initial welcome message to be displayed to the visitor.
### lightningChatInterfaceResources.emailMessage
Initial message to ask for email address.
### lightningChatInitialQuiz[]
Contains a series of question object. **API IS VARY LIKELY TO CHANGE!!!!!**
* `question` - The question to ask
* `choice` - Array of choices
* `consequence` - Array of consequences, for example `assign user,to 2`.
* `time` - If `choice` is `null`, question will dismiss after this time. |
05ff16d8-8f59-47ad-8860-670ffe4aa397 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-09-06 06:02:27", "repo_name": "QiuJava/spring", "sub_path": "/spring-core/src/test/java/cn/qj/SpringCoreApplicationTest.java", "file_name": "SpringCoreApplicationTest.java", "file_ext": "java", "file_size_in_byte": 1032, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "924463321816361dc3fa7d90d59564e1de685cdd", "star_events_count": 1, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/QiuJava/spring | 218 | FILENAME: SpringCoreApplicationTest.java | 0.245085 | package cn.qj;
import java.util.Date;
import org.apache.commons.lang3.time.DateUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import cn.qj.config.security.AuthenticationProviderImpl;
import cn.qj.entity.LoginUser;
import cn.qj.service.LoginUserServiceImpl;
/**
* 应用测试
*
* @author Qiujian
* @date 2019年3月26日
*
*/
@RunWith(SpringRunner.class)
@SpringBootTest
public class SpringCoreApplicationTest {
@Autowired
private LoginUserServiceImpl loginUserService;
@Test
public void contextLoads() {
LoginUser loginUser = new LoginUser();
loginUser.setUsername("admin");
loginUser.setPassword(AuthenticationProviderImpl.B_CRYPT.encode("123"));
loginUser.setUserStatus(LoginUser.NORMAL);
loginUser.setPasswordExpiration(DateUtils.addMonths(new Date(), 6));
loginUserService.save(loginUser);
}
}
|
54ca01fc-f1d3-45ee-8dc3-1e99effe3b84 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-03-13 06:26:35", "repo_name": "andyg7/CodePractice", "sub_path": "/Interview-Practice/Java/Find-Dups/Main.java", "file_name": "Main.java", "file_ext": "java", "file_size_in_byte": 1129, "line_count": 48, "lang": "en", "doc_type": "code", "blob_id": "5441282aa928f9837ac567a893acc7ca9e8ee1b5", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/andyg7/CodePractice | 373 | FILENAME: Main.java | 0.286169 | import java.util.*;
public class Main
{
public static void main(String args[])
{
int[] arr = {1,2,3,4,239,2,9,9,9};
int[] arr2 = {10,9,2398,28,2,2,9,1,9,4};
HashMap<Integer, Integer> hashMap = new HashMap<Integer, Integer>();
HashMap<Integer, Integer> hashMap2 = new HashMap<Integer, Integer>();
for (int i = 0; i < arr.length; i++) {
if (hashMap.containsKey(arr[i])) {
int temp = hashMap.get(arr[i]);
temp++;
hashMap.remove(arr[i]);
hashMap.put(arr[i], temp);
} else {
hashMap.put(arr[i], 1);
}
}
for (int i = 0; i < arr2.length; i++) {
if (hashMap2.containsKey(arr2[i])) {
int temp = hashMap2.get(arr2[i]);
temp++;
hashMap2.remove(arr2[i]);
hashMap2.put(arr2[i], temp);
} else {
hashMap2.put(arr2[i], 1);
}
}
for (int i = 0; i < arr.length; i++) {
if (hashMap2.containsKey(arr[i])) {
if (hashMap.get(arr[i]) == hashMap2.get(arr[i])) {
System.out.println("Found dup with same cardinality" + arr[i]);
}
}
}
Friend sam = new Friend("sam");
sam.setName("jon");
System.out.println("His name is: " + sam.getName());
}
}
|
9b26b622-1fd6-4d4c-ba44-1a4f3b1a6159 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-04-09 05:57:03", "repo_name": "superRp/pracitce", "sub_path": "/src/verify/producer/Main.java", "file_name": "Main.java", "file_ext": "java", "file_size_in_byte": 1173, "line_count": 35, "lang": "en", "doc_type": "code", "blob_id": "04f2a98c580be54417e2d06fcb3f449b246fbbe5", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/superRp/pracitce | 220 | FILENAME: Main.java | 0.278257 | package verify.producer;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
public class Main {
public static void main(String[] args) throws InterruptedException {
BlockingQueue<PCData> queue = new LinkedBlockingQueue<PCData>();
Producer producer1=new Producer(queue);
Producer producer2=new Producer(queue);
Producer producer3=new Producer(queue);
Consumer consumer1=new Consumer(queue);
Consumer consumer2=new Consumer(queue);
Consumer consumer3=new Consumer(queue);
ExecutorService es = Executors.newCachedThreadPool();
es.execute(producer1);
es.execute(producer2);
es.execute(producer3);
es.execute(consumer1);
es.execute(consumer2);
es.execute(consumer3);
System.out.println("主线程休眠");
Thread.sleep(5000);
producer1.stop();
producer2.stop();
producer3.stop();
System.out.println("关闭线程池");
es.shutdown();
}
}
|
31f1d92c-cd4d-4c27-8ce7-317c00d0b42e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2017-05-08T23:37:29", "repo_name": "lilybarrett/hyper_local", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 979, "line_count": 13, "lang": "en", "doc_type": "text", "blob_id": "e5af39857d288869521933202433fd3d832d7134", "star_events_count": 4, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/lilybarrett/hyper_local | 238 | FILENAME: README.md | 0.23092 | 

[](https://coveralls.io/github/lilybarrett/hyper_local?branch=master)
[HyperLocal](https://hyper-local.herokuapp.com/) is a Rails app connecting people with local volunteer opportunities. I based my app on the idea that, in order to make a large impact -- whether you care deeply about climate change, women's issues, or health care access -- you can start small.
For HyperLocal, I've done the following:
- built two different interfaces, one for volunteers and one for organizations
- constructed complex database relationships with PostgreSQL
- incorporated the Google Maps API
- enhanced the user experience on the front-end with the Foundation framework and the Animate.css library
|
f45d8b55-2df0-44b2-98e7-0b75d8cc2f8e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-07-21 02:49:50", "repo_name": "tstout/db-tools", "sub_path": "/db-tool/src/main/java/dbtools/cmdopts/CmdOpt.java", "file_name": "CmdOpt.java", "file_ext": "java", "file_size_in_byte": 997, "line_count": 47, "lang": "en", "doc_type": "code", "blob_id": "24bacf8c273cef3230e854352ae4a0d052443e3a", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/tstout/db-tools | 201 | FILENAME: CmdOpt.java | 0.256832 | package dbtools.cmdopts;
import com.google.common.base.Optional;
import static com.google.common.base.Optional.fromNullable;
public class CmdOpt {
private final String name;
private final String value;
private CmdOpt(String name, String value) {
this.name = name;
this.value = value;
}
public static CmdOptBuilder builder() {
return new CmdOptBuilder();
}
public String name() {
return name;
}
public Optional<String> value() {
return fromNullable(value);
}
public static class CmdOptBuilder {
private String optName;
private String value;
public CmdOptBuilder withName(String optName) {
this.optName = optName;
return this;
}
public CmdOptBuilder withValue(String value) {
this.value = value;
return this;
}
public CmdOpt build() {
return new CmdOpt(optName, value);
}
}
}
|
3283f041-fdcd-4583-9085-a31d115c3219 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-06-04 08:31:02", "repo_name": "moon928/MyAlbum-Boot", "sub_path": "/myalbum-service-provider-backstage/src/main/java/cn/yan_wm/myalbum/service/provider/backstage/job/RabbiMQJob.java", "file_name": "RabbiMQJob.java", "file_ext": "java", "file_size_in_byte": 1036, "line_count": 35, "lang": "en", "doc_type": "code", "blob_id": "6d1741b3e39011e15b936d00ee6ab79f499bd7a1", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/moon928/MyAlbum-Boot | 240 | FILENAME: RabbiMQJob.java | 0.243642 | package cn.yan_wm.myalbum.service.provider.backstage.job;
import cn.yan_wm.myalbum.commons.utils.MapperUtils;
import cn.yan_wm.myalbum.service.provider.backstage.service.BackstageService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
* @program: MyAlbum-Boot
* @description: 消息队列job,处理首页访问量添加时的并发问题
* @author: yan_zt
* @create: 2020-01-10 16:23
*/
@Service
public class RabbiMQJob {
@Autowired
private BackstageService backstageService;
@RabbitListener(queues = "indexPage-frequency")
public void addFrequency(String json){
Map<String,Integer> map;
try {
map = MapperUtils.json2pojo(json, Map.class);
int id = map.get("indexPageViewId");
backstageService.updaFrequencyById(id);
} catch (Exception e) {
e.printStackTrace();
}
}
}
|
fa3d8156-44c2-4ea3-a511-367d4025d9ff | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2014-12-24 23:07:48", "repo_name": "hansen-erik/contactlist", "sub_path": "/Black Book/addressbook/LoadingUI.java", "file_name": "LoadingUI.java", "file_ext": "java", "file_size_in_byte": 1110, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "6ce62152309d84214e792f937b1dc8d7fe78ba1f", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/hansen-erik/contactlist | 254 | FILENAME: LoadingUI.java | 0.293404 | /**
*
*/
package addressbook;
/**
* @author Erik
*
*/
public interface LoadingUI {
static final String NL = System.lineSeparator();
/**
* Locating File: Inform user that the program is attempting to find the
* file specified.
*/
static final String LOCATING_FILE = "[LOAD]: [LOC_FILE] Locating Contact List File. . .";
/**
* File Found: Inform user program is attempting to load the old file.
*/
static final String FILE_FOUND = "[LOAD]: [FILE_FOUND] Loading Contact List. . .";
/**
* Error Loading: There was an I/O Exception. Class was not found.
*/
static final String ERR_LOAD = "[LOAD_FAIL]: [RED]\nError Reading From Disk";
/**
* No File: The File was not found. Inform user a new contact list will be
* created.
*/
static final String NO_FILE = "[LOAD_NOFILE]: [YELLOW]\nCreating New Contact List. . .";
/**
* Load Green: Inform user the load was a success and program is finished
* loading.
*/
static final String LOAD_GREEN = "[LOAD]: [SUCCESS]";
}
|
2a445b27-3502-4630-b5ca-d5c7bde46a15 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-05-12 12:21:37", "repo_name": "moodright/blurry-world", "sub_path": "/src/main/java/com/moodright/blurryworld/utils/DateUtil.java", "file_name": "DateUtil.java", "file_ext": "java", "file_size_in_byte": 1184, "line_count": 45, "lang": "en", "doc_type": "code", "blob_id": "43e423cbced4266e3fd90d021ab0834edca03a5d", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/moodright/blurry-world | 241 | FILENAME: DateUtil.java | 0.261331 | package com.moodright.blurryworld.utils;
import org.springframework.stereotype.Component;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* 日期转换工具类
* @author moodright
* @date 2021/3/12
*/
public class DateUtil {
/**
* 将生日字符串转换为 java.util.Date 对象
* @param dateString 时间字符串
* @return java.util.Date
*/
public static Date birthdayStringToDate(String dateString) {
Date date = null;
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
try {
date = formatter.parse(dateString);
}catch (ParseException e) {
e.printStackTrace();
}
return date;
}
public static Date releaseTimeStringToDate(String releaseTime) {
Date date = null;
// 字符串处理
releaseTime = releaseTime.replace("T", " ");
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm");
try {
date = formatter.parse(releaseTime);
}catch (ParseException e) {
e.printStackTrace();
}
return date;
}
}
|
64dbc24a-b927-4b3a-8b53-2a9adba879ea | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-08-09 09:28:18", "repo_name": "zkm1992/springboot-mybatis-demo", "sub_path": "/src/main/java/com/winter/handle/ExceptionHandle.java", "file_name": "ExceptionHandle.java", "file_ext": "java", "file_size_in_byte": 1064, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "7274993b696a7459a7792b4383e64961c3304959", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/zkm1992/springboot-mybatis-demo | 197 | FILENAME: ExceptionHandle.java | 0.200558 | package com.winter.handle;
import com.winter.constant.ResponseStatus;
import com.winter.exception.UserException;
import com.winter.util.StatusMsg;
import com.winter.util.TransJsonUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* 统一异常处理
*/
@ControllerAdvice
public class ExceptionHandle {
private final static Logger logger = LoggerFactory.getLogger(ExceptionHandle.class);
@ResponseBody
@ExceptionHandler(RuntimeException.class)
public String handle(Exception e) {
if (e instanceof UserException) {
UserException userException = ((UserException) e);
return TransJsonUtil.Obj2Json("", new StatusMsg(userException.getCode(), userException.getMessage()));
}
logger.info("", e);
return TransJsonUtil.Obj2Json("", new StatusMsg(ResponseStatus.UNKNOWN_ERROR));
}
}
|
44d9a9af-73f5-4c61-a596-fa64e71a30f7 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-02-28 07:28:35", "repo_name": "xiaopeng-ding/graduation-project", "sub_path": "/src/main/java/com/peng/ding/config/CrossDomain.java", "file_name": "CrossDomain.java", "file_ext": "java", "file_size_in_byte": 1077, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "34d1cf29c5a052201eaf1d8a608cf69f57e448d6", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/xiaopeng-ding/graduation-project | 190 | FILENAME: CrossDomain.java | 0.199308 | package com.peng.ding.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
@Configuration
public class CrossDomain extends WebMvcConfigurerAdapter {
/**
* 跨域解决
* @return
*/
@Bean
public CorsFilter corsFilter() {
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
source.registerCorsConfiguration("/**", buildConfig());
return new CorsFilter(source);
}
private CorsConfiguration buildConfig() {
CorsConfiguration corsConfiguration = new CorsConfiguration();
corsConfiguration.addAllowedOrigin("*");
corsConfiguration.addAllowedMethod("*");
corsConfiguration.addAllowedHeader("*");
return corsConfiguration;
}
}
|
787bc88e-a7f6-42a4-ab83-03775c0c2886 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-02-18 06:51:07", "repo_name": "Bipul1895/ModernWorskshopApp", "sub_path": "/app/src/main/java/com/example/modernworkshopapp/ViewHolder/AdminParticularOrderViewHolder.java", "file_name": "AdminParticularOrderViewHolder.java", "file_ext": "java", "file_size_in_byte": 1212, "line_count": 45, "lang": "en", "doc_type": "code", "blob_id": "866c56c21dc1767df79267ccbba08e6fbf21a6bc", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Bipul1895/ModernWorskshopApp | 226 | FILENAME: AdminParticularOrderViewHolder.java | 0.267408 | package com.example.modernworkshopapp.ViewHolder;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.example.modernworkshopapp.Interface.ItemClickListner;
import com.example.modernworkshopapp.R;
public class AdminParticularOrderViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
public TextView quantity;
public ImageView orderImage;
public Button downloadFile;
private ItemClickListner itemClickListner;
public AdminParticularOrderViewHolder(@NonNull View itemView) {
super(itemView);
quantity=itemView.findViewById(R.id.admin_order_quantity);
orderImage=itemView.findViewById(R.id.admin_file_img_view);
downloadFile=itemView.findViewById(R.id.admin_view_particular_order_download_btn);
}
@Override
public void onClick(View view) {
itemClickListner.onClick(view, getAdapterPosition(), false);
}
public void setItemClickListner(ItemClickListner itemClickListner) {
this.itemClickListner = itemClickListner;
}
}
|
edaf3612-f1c0-4e88-80b5-b6e665d8cbe4 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-02-20 08:38:30", "repo_name": "sampicks/NyTimesPopularArticles", "sub_path": "/app/src/test/java/com/nytimes/populararticles/ui/activity/MainActivityRoboelectricTest.java", "file_name": "MainActivityRoboelectricTest.java", "file_ext": "java", "file_size_in_byte": 1028, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "5ce366a7db08580b1ae5de4a6c7d4f1c475b0f4f", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/sampicks/NyTimesPopularArticles | 203 | FILENAME: MainActivityRoboelectricTest.java | 0.247987 | package com.nytimes.populararticles.ui.activity;
import android.support.v7.widget.Toolbar;
import android.widget.Button;
import com.nytimes.populararticles.BuildConfig;
import com.nytimes.populararticles.R;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
import static org.junit.Assert.*;
@RunWith(RobolectricTestRunner.class)
@Config(constants = BuildConfig.class)
public class MainActivityRoboelectricTest {
private MainActivity activity;
@Before
public void setup() {
activity = Robolectric.setupActivity(MainActivity.class);
}
@Test
public void testToolbarAndFrameLayout() {
Toolbar toolbar = activity.findViewById(R.id.toolbar);
assertNotNull("Toolbar could not be found", toolbar);
assertNotNull("content framelayout not found", activity.findViewById(R.id.container));
}
} |
7b70191b-4227-4bcf-bb97-ebc29ab89195 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-02-10 20:57:05", "repo_name": "yes4me/java-bdd-cucumber", "sub_path": "/src/test/java/page_objects/LoginPage.java", "file_name": "LoginPage.java", "file_ext": "java", "file_size_in_byte": 1048, "line_count": 32, "lang": "en", "doc_type": "code", "blob_id": "f59e13fabe4d9466af8c640145d8b0fe3c118437", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/yes4me/java-bdd-cucumber | 225 | FILENAME: LoginPage.java | 0.287768 | package page_objects;
import com.thomas.base.BasePage;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.How;
/**
* Created by Thomas on 12/19/2016.
*/
public class LoginPage extends BasePage {
// Called at run time => Reflection doesn't work (i.e. using Javascript eval())
@FindBy(how = How.NAME, using = "UserName")
private WebElement txtLogin;
@FindBy(how = How.NAME, using = "Password")
private WebElement txtPassword;
@FindBy(how = How.NAME, using = "Login")
private WebElement btnSubmit;
//@FindBy(how = How.CSS, using = "[class*='name']")
// private WebElement btnSubmit;
public LoginPage() {}
public BasePage login(String login, String password) {
// WebElement txtLogin = DriverContext.getDriver().findElement(By.name("Login"));
txtLogin.sendKeys(login);
txtPassword.sendKeys(password);
btnSubmit.submit();
return getInstance(HomePage.class);
}
}
|
17a0f514-8f7b-4676-aa8d-03c811a6ba5c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-07-01 23:04:55", "repo_name": "tiagosgalvao/wallet-server", "sub_path": "/src/main/java/com/galvao/wallet/infrastructure/entity/impl/UserAccountEntity.java", "file_name": "UserAccountEntity.java", "file_ext": "java", "file_size_in_byte": 1151, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "b7ca97a432bec0a6791795de9515887037820b4d", "star_events_count": 2, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/tiagosgalvao/wallet-server | 221 | FILENAME: UserAccountEntity.java | 0.249447 | package com.galvao.wallet.infrastructure.entity.impl;
import com.galvao.wallet.infrastructure.entity.BaseEntity;
import com.fasterxml.jackson.annotation.JsonBackReference;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
@Getter
@Setter
@ToString(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
@Builder
@Entity
@Table(name = "user_account")
public class UserAccountEntity extends BaseEntity {
@JsonBackReference
@ManyToOne
@JoinColumn(name = "account_id", nullable = false)
private AccountEntity account;
@OneToMany(mappedBy = "userAccount", fetch = FetchType.LAZY)
private List<DepositHistoricEntity> deposits;
@OneToMany(mappedBy = "userAccount", fetch = FetchType.LAZY)
private List<WithdrawHistoricEntity> withdraws;
@Column
private String name;
} |
bcc6b132-c846-45d0-ae1d-27fde13e0b43 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-09-04 13:58:16", "repo_name": "ricciardi/editor-de-servicos", "sub_path": "/src/test/java/br/gov/servicos/editor/servicos/RemoverCartaControllerTest.java", "file_name": "RemoverCartaControllerTest.java", "file_ext": "java", "file_size_in_byte": 1048, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "2c59c3cc507f274c21805030c624a1c98be75a99", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ricciardi/editor-de-servicos | 225 | FILENAME: RemoverCartaControllerTest.java | 0.26588 | package br.gov.servicos.editor.servicos;
import br.gov.servicos.editor.cartas.Carta;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.security.core.userdetails.User;
import java.util.function.Supplier;
import static java.util.Collections.emptyList;
import static org.mockito.Mockito.verify;
@RunWith(MockitoJUnitRunner.class)
public class RemoverCartaControllerTest {
@Mock
Carta carta;
@Captor
ArgumentCaptor<Supplier<Void>> captor;
RemoverCartaController controller;
public static final User USUARIO = new User("Fulano de Tal", "", emptyList());
@Before
public void setUp() throws Exception {
controller = new RemoverCartaController();
}
@Test
public void removeCartaExistente() throws Exception {
controller.remover(carta, USUARIO);
verify(carta).remover(USUARIO);
}
}
|
9e1097d6-0dab-45ff-b324-f5061ebd8b59 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2021-09-10T01:25:40", "repo_name": "Statikman619/Team-Profile-Generator", "sub_path": "/Lib/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1208, "line_count": 45, "lang": "en", "doc_type": "text", "blob_id": "443da0e384681983b8f38aee92c6d4764cec8a15", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Statikman619/Team-Profile-Generator | 312 | FILENAME: README.md | 0.255344 | # Team Profile Generator
\*GitHubLink https://github.com/Statikman619/Team-Profile-Generator/tree/main
\*VideoWalkThroughLink
[](https://opensource.org/licenses/MIT)
## Table of Contents
- [Title](#Title)
- [Description](#description)
- [Installation](#installation)
- [Usage](#usage)
- [License](#license)
- [Test](#test)
- [Username](#username)
- [Email](#license)
## Description
My project allows you to choose from various employee's (Manager, Engineer or Intern) to create a team of your choosing.
## Installation
npm install -y and npm i inquierer in the command line. After run "node infex.js".
## Usage
When you want to create a team you get a series of questions asking you what type of employee you're trying to add to your team. Follow the prompts to help guide you in creating your team.
## License MIT
## Contributors
Mike with the help of Herm during office hours and my awesome tutor Andrew.
## Test
run "node index.js" in the command line of your terminal.
## Questions
Contact me:
Github:[Statikman619](https://github.com/Statikman619)
Email:[martinez.michael02@gmail.com](https://github.com/Statikman619)
|
c7bd6782-af17-47f2-9adf-301f85d9f6c7 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-12-10 05:01:53", "repo_name": "UQdeco2800/dangernoodles", "sub_path": "/dangernoodles/src/main/java/uq/deco2800/dangernoodles/components/weapons/ExplosionComponent.java", "file_name": "ExplosionComponent.java", "file_ext": "java", "file_size_in_byte": 1026, "line_count": 46, "lang": "en", "doc_type": "code", "blob_id": "99bff332cb3a85fc5eb184ecffe4fe00ddbbf5c7", "star_events_count": 6, "fork_events_count": 3, "src_encoding": "UTF-8"} | https://github.com/UQdeco2800/dangernoodles | 242 | FILENAME: ExplosionComponent.java | 0.282988 | package uq.deco2800.dangernoodles.components.weapons;
import uq.deco2800.dangernoodles.ecs.Component;
public class ExplosionComponent extends Component {
double damage;
int blastRadius;
double lifeLeft;
boolean firstRun;
public ExplosionComponent(int blastRadius, double damage) {
this.blastRadius = blastRadius;
this.damage = damage;
this.lifeLeft = 0.18; // This looks right... probably should do testing
this.firstRun = true;
}
public int getBlastRadius() {
return this.blastRadius;
}
public double getDamage() {
return this.damage;
}
public boolean isAlive() {
return this.lifeLeft > 0;
}
public double lifeLeft() {
return this.lifeLeft;
}
public void decrementLife(double dt) {
this.lifeLeft -= dt;
}
public boolean isFirstRun() {
return this.firstRun;
}
public void firstRunHappened() {
this.firstRun = false;
}
}
|
115cd1e4-f06e-492c-92c1-ebb712dd65d4 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-04-03 14:03:09", "repo_name": "ccknow/geekdol", "sub_path": "/src/main/java/com/soft863/dolphin/shiro/DWZUserFilter.java", "file_name": "DWZUserFilter.java", "file_ext": "java", "file_size_in_byte": 1078, "line_count": 30, "lang": "en", "doc_type": "code", "blob_id": "dbe18e60389dd6a3039850f1976f2ba8a29e3004", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ccknow/geekdol | 219 | FILENAME: DWZUserFilter.java | 0.256832 | package com.soft863.dolphin.shiro;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import org.apache.shiro.web.filter.authc.UserFilter;
import org.apache.shiro.web.util.WebUtils;
public class DWZUserFilter extends UserFilter {
public static final String X_R = "X-Requested-With";
public static final String X_R_VALUE = "XMLHttpRequest";
protected void redirectToLogin(ServletRequest request,
ServletResponse response) throws IOException {
HttpServletRequest httpServletRequest = (HttpServletRequest) request;
String xrv = httpServletRequest.getHeader("X-Requested-With");
if ((xrv != null) && (xrv.equalsIgnoreCase("XMLHttpRequest"))) {
Map<String, String> queryParams = new HashMap<String, String>();
queryParams.put("ajax", "true");
WebUtils.issueRedirect(request, response, getLoginUrl(),
queryParams);
} else {
super.redirectToLogin(request, response);
}
}
}
|
bc582c72-cc8b-4652-baf1-dda1b93c1f2c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-08-20 03:11:44", "repo_name": "jkavdev/books_projects", "sub_path": "/sgt/src/main/java/br/com/jkavdev/sgt/flexibilizacao/Parecer.java", "file_name": "Parecer.java", "file_ext": "java", "file_size_in_byte": 1129, "line_count": 56, "lang": "en", "doc_type": "code", "blob_id": "686695d1a57d8485e6bf68c90dddb85b333dfa9f", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/jkavdev/books_projects | 269 | FILENAME: Parecer.java | 0.235108 | package br.com.jkavdev.sgt.flexibilizacao;
import java.time.LocalDateTime;
public class Parecer {
private String obsNegocial;
private String obsFinal;
private final LocalDateTime criacao;
private LocalDateTime ultimaAlteracao;
public Parecer(String obsNegocial, String obsFinal) {
this();
this.obsNegocial = obsNegocial;
this.obsFinal = obsFinal;
}
public Parecer() {
this.criacao = LocalDateTime.now();
this.ultimaAlteracao = LocalDateTime.now();
}
public String getObsNegocial() {
return obsNegocial;
}
public void setObsNegocial(String obsNegocial) {
this.ultimaAlteracao = LocalDateTime.now();
this.obsNegocial = obsNegocial;
}
public String getObsFinal() {
return obsFinal;
}
public void setObsFinal(String obsFinal) {
this.ultimaAlteracao = LocalDateTime.now();
this.obsFinal = obsFinal;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("Parecer [obsNegocial=");
builder.append(obsNegocial);
builder.append(", obsFinal=");
builder.append(obsFinal);
builder.append("]");
return builder.toString();
}
}
|
5150b366-6608-42d1-ac52-44498f9ec6c6 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-03-26 02:09:17", "repo_name": "Saddleback-Injectors/ChatClient", "sub_path": "/Test/edu/saddleback/cs4b/Backend/Messages/TextMessageTest.java", "file_name": "TextMessageTest.java", "file_ext": "java", "file_size_in_byte": 1050, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "7a0e6557d478af29122519a92ade47f9f06c100a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Saddleback-Injectors/ChatClient | 252 | FILENAME: TextMessageTest.java | 0.282988 | package edu.saddleback.cs4b.Backend.Messages;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
class TextMessageTest
{
@Test
@DisplayName("Test Type for txt-Msg")
void testTypeForTxtMsg()
{
TextMessage ms = new TextMessage("Test", "User", "Hello");
assertEquals("txt-Msg", ms.getType());
}
@Test
@DisplayName("Test Sender for Txt-Msg")
void testSenderForTxtMsg()
{
TextMessage ms = new TextMessage("Test", "User", "Hello");
assertEquals("Test", ms.getSender());
}
@Test
@DisplayName("Test Channel for Txt-Msg")
void testChannelForTxtMsg()
{
TextMessage ms = new TextMessage("Test", "User", "Hello");
assertEquals("User", ms.getChannel());
}
@Test
@DisplayName("Test Message for Txt-Msg")
void testMessageForTxtMsg()
{
TextMessage ms = new TextMessage("Test", "User", "Hello");
assertEquals("Hello", ms.getMessage());
}
} |
39652c2b-04a2-4456-a615-a47321198b20 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-01-29 11:42:56", "repo_name": "DENNINGKEVIN/Trends", "sub_path": "/SECOND/Trends/app/src/main/java/com/mulama/trends/SplashActivity.java", "file_name": "SplashActivity.java", "file_ext": "java", "file_size_in_byte": 1150, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "fe160ae75a4a491923e2f538fca0c028f0015f86", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/DENNINGKEVIN/Trends | 199 | FILENAME: SplashActivity.java | 0.200558 | package com.mulama.trends;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import com.firebase.ui.auth.AuthUI;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.GoogleAuthProvider;
import java.util.Collections;
import butterknife.BindView;
import butterknife.ButterKnife;
public class SplashActivity extends AppCompatActivity implements View.OnClickListener {
private FirebaseAuth mAuth;
private FirebaseAuth.AuthStateListener mAuthListener;
public static final int RC_SIGN_IN = 111;
@BindView(R.id.splashButton) Button splashButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
ButterKnife.bind(this);
splashButton.setOnClickListener(this);
}
@Override
public void onClick(View v) {
if(v == splashButton){
Intent intent=new Intent(this,LoginActivity.class);
startActivity(intent);
}
}
}
|
40547e52-247e-452d-84bd-4bc68ffe6ba3 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-11-16 16:13:13", "repo_name": "goodguyplayer/17.00531-0_MauaStudies", "sub_path": "/Linguagens1_Projetos/Pratica12/src/com/company/implementacoes/serializacao/TesteSerializar.java", "file_name": "TesteSerializar.java", "file_ext": "java", "file_size_in_byte": 990, "line_count": 35, "lang": "en", "doc_type": "code", "blob_id": "5d425d90536a097f26cb99ab5d70c42c3921087a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/goodguyplayer/17.00531-0_MauaStudies | 178 | FILENAME: TesteSerializar.java | 0.225417 | package com.company.implementacoes.serializacao;
import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
public class TesteSerializar {
public static void main(String[] args) {
System.out.println("TEst");
Pessoa p1 = new Pessoa("Murilo", 30);
Pessoa p2 = new Pessoa("All might", 31);
try{
FileOutputStream fileOutputStream = new FileOutputStream("ecm251.txt");
// Creates object that makes conversion in bytes
ObjectOutputStream objectOutputStream = new ObjectOutputStream(fileOutputStream);
objectOutputStream.writeObject(p1);
objectOutputStream.writeObject(p2);
objectOutputStream.close();
fileOutputStream.close();
} catch (Exception exception){
System.out.println("Something's wrong I can feel it");
exception.printStackTrace();
}
System.out.println("Done");
}
}
|
94ee54f9-efec-49fb-8d27-eb912cfd06cd | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-02-04 07:50:44", "repo_name": "gzstyp/humiture", "sub_path": "/src/main/java/com/fwtai/controller/HumitureController.java", "file_name": "HumitureController.java", "file_ext": "java", "file_size_in_byte": 1147, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "055dea57dcae1c7b6fd8da263e475e52a2bd9bed", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/gzstyp/humiture | 287 | FILENAME: HumitureController.java | 0.23793 | package com.fwtai.controller;
import com.fwtai.config.ConfigFile;
import com.fwtai.service.HumitureService;
import com.fwtai.tool.ToolClient;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* 楼层的货位号管理
* @作者 田应平
* @版本 v1.0
* @创建时间 2020/5/28 10:22
* @QQ号码 444141300
* @Email service@yinlz.com
* @官网 <url>http://www.yinlz.com</url>
*/
@RestController
@CrossOrigin
@RequestMapping(ConfigFile.api_v10 + "humiture")
public class HumitureController{
@Resource
private HumitureService service;
//http://192.168.3.108:20000/api/v1.0/humiture/listData?ids=3,5
@GetMapping("listData")
public void listData(final HttpServletRequest request,final HttpServletResponse response){
ToolClient.responseJson(service.listData(request),response);
}
} |
0d7e42c8-a434-4a75-b06e-5fb8355b0635 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-07-08 15:19:16", "repo_name": "manjaeng/dflow", "sub_path": "/src/main/java/kr/co/thenet/fapee/common/util/AlimUtil.java", "file_name": "AlimUtil.java", "file_ext": "java", "file_size_in_byte": 969, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "03120b4a3e18ad11f21a19392f5f41d36f64cff4", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/manjaeng/dflow | 258 | FILENAME: AlimUtil.java | 0.274351 | package kr.co.thenet.fapee.common.util;
import kr.co.thenet.fapee.common.model.AlimVO;
import kr.co.thenet.fapee.my.service.AlimService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@Component
public class AlimUtil {
private static AlimService alimService;
@Autowired
public AlimUtil(AlimService alimService) {
AlimUtil.alimService = alimService;
}
public static boolean send(String grp, String alimType, String title, String content,
String linkUrl, String linkImageUrl, Long receiverIdKey, Long senderIdKey) {
try {
AlimVO form = AlimVO.of(grp, alimType, title, content, linkUrl, linkImageUrl, receiverIdKey, senderIdKey);
log.info("Alim insert...info={}", form );
alimService.insertAlim(form);
return true;
} catch (Exception e) {
log.error("[ERROR] Alim send failed...{}", e);
return false;
}
}
}
|
a08222a7-0c99-4340-920d-dc83afd71378 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-05-10 18:00:01", "repo_name": "RenatodeSousa/Projeto-reserva", "sub_path": "/ProjReservaSala/src/br/com/projReservaSala/teste/TesteInserir.java", "file_name": "TesteInserir.java", "file_ext": "java", "file_size_in_byte": 1041, "line_count": 51, "lang": "en", "doc_type": "code", "blob_id": "13ba6a7bfd2cdf3c00e13cbb14c7776093ac92ad", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/RenatodeSousa/Projeto-reserva | 247 | FILENAME: TesteInserir.java | 0.278257 | package br.com.projReservaSala.teste;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import br.com.projReservaSala.conexao.Conexao;
import br.com.projReservaSala.util.Reserva;
public class TesteInserir {
private Connection connection;
public TesteInserir () {
connection = Conexao.getConnection();
System.out.println("Tudo pronto!");
}
/**
* @param reserva
* @return
* @throws SQLException
*/
public boolean inserir(Reserva reserva) throws SQLException {
try {
PreparedStatement stmt = this.connection
.prepareStatement("INSERT INTO TB_RESERVA (descricao, dataCadastro, dataReserva, hora) values (?, ?, ?, ?)");
stmt.setString(1, "testdescricao");
stmt.setString(2, "testDatacad");
stmt.setString(3, "testedatreserva");
stmt.setString(4, "testhora");
stmt.execute();
System.out.println("Iserido com sucesso!");
return true;
} catch (SQLException e) {
System.err.println(e.toString());
} finally {
connection.close();
}
return false;
}
}
|
56ab3c04-e3d7-4186-80c9-0c8662c74cd4 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-06-16 03:45:01", "repo_name": "FPhoenixCorneaE/Ignorance", "sub_path": "/LIgnorance/src/main/java/com/livelearn/ignorance/ui/fragment/book/BookRecommendFragment.java", "file_name": "BookRecommendFragment.java", "file_ext": "java", "file_size_in_byte": 992, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "8f6083f566e5f97f53f20163580f2d94c5afcf48", "star_events_count": 2, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/FPhoenixCorneaE/Ignorance | 217 | FILENAME: BookRecommendFragment.java | 0.220007 | package com.livelearn.ignorance.ui.fragment.book;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import com.livelearn.ignorance.R;
import com.livelearn.ignorance.base.BaseFragment;
import com.livelearn.ignorance.presenter.book.BookRecommendPresenter;
import com.livelearn.ignorance.ui.view.book.BookRecommendView;
import butterknife.BindView;
/**
* 书籍推荐
* Created on 2016/12/26.
*/
public class BookRecommendFragment extends BaseFragment {
@BindView(R.id.brv_book_recommend)
BookRecommendView brvBookRecommend;
@Override
public int getLayoutResource() {
return R.layout.fragment_book_recommend;
}
@Override
public void initLayout(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
mPresenter = new BookRecommendPresenter(brvBookRecommend);
}
@Override
public void setListeners() {
}
@Override
public void lazyFetchData() {
}
}
|
70b39d99-012b-4475-9c8a-883b7f988e44 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-04-25 16:10:22", "repo_name": "iffa/SSKKY-ruokalista", "sub_path": "/app/src/main/java/email/crappy/ssao/ruoka/SSKKYApplication.java", "file_name": "SSKKYApplication.java", "file_ext": "java", "file_size_in_byte": 1713, "line_count": 64, "lang": "en", "doc_type": "code", "blob_id": "489e40ba56f10bd3e034227436e08a1897efdbab", "star_events_count": 1, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/iffa/SSKKY-ruokalista | 207 | FILENAME: SSKKYApplication.java | 0.250913 | package email.crappy.ssao.ruoka;
import android.app.Application;
import android.content.Context;
import email.crappy.ssao.ruoka.injection.component.ApplicationComponent;
import email.crappy.ssao.ruoka.injection.component.DaggerApplicationComponent;
import email.crappy.ssao.ruoka.injection.module.ApplicationModule;
import timber.log.Timber;
/**
* @author Santeri 'iffa'
*/
public class SSKKYApplication extends Application {
ApplicationComponent applicationComponent;
@Override
public void onCreate() {
super.onCreate();
if (BuildConfig.DEBUG) {
Timber.plant(new Timber.DebugTree());
}
}
public ApplicationComponent getComponent() {
if (applicationComponent == null) {
applicationComponent = DaggerApplicationComponent.builder()
.applicationModule(new ApplicationModule(this))
.build();
}
return applicationComponent;
}
public static SSKKYApplication get(Context context) {
return (SSKKYApplication) context.getApplicationContext();
}
}
|
6e1b9193-4d81-42ed-a3c7-ddf2b8fd3ade | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-03-23 14:45:19", "repo_name": "y-zou/java_swing_application", "sub_path": "/src/TestClean.java", "file_name": "TestClean.java", "file_ext": "java", "file_size_in_byte": 1060, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "cc9b52e119a8e8ee0f6269e638db89a32880e05d", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/y-zou/java_swing_application | 209 | FILENAME: TestClean.java | 0.253861 |
import java.sql.Connection;
import java.sql.PreparedStatement;
/*
* 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.
*/
/**
*
* @author yiyue
*/
public class TestClean {
private static Connection conn = DBInterface.getConnection();
private static PreparedStatement ps;
public static void cleanDate() throws Exception{
ps = conn.prepareStatement("delete from dates where 1=1");
ps.executeUpdate();
}
public static void cleanFlightid() throws Exception{
ps = conn.prepareStatement("delete from flights where 1=1");
ps.executeUpdate();
}
public static void cleanBooked() throws Exception{
ps = conn.prepareStatement("delete from booked where 1=1");
ps.executeUpdate();
}
public static void cleanWaitlist() throws Exception{
ps = conn.prepareStatement("delete from waitlist where 1=1");
ps.executeUpdate();
}
}
|
6782272b-4a65-4806-a312-4f33383353c9 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2014-08-01 12:46:08", "repo_name": "tkrpan/MovieDB_new", "sub_path": "/app/src/main/java/com/tkrpan/moviedb/helpers/SoftKeyboardHelper.java", "file_name": "SoftKeyboardHelper.java", "file_ext": "java", "file_size_in_byte": 1074, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "cf8f67ec536cdf2415ecaa09e5b305d54407b74f", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/tkrpan/MovieDB_new | 209 | FILENAME: SoftKeyboardHelper.java | 0.267408 | package com.tkrpan.moviedb.helpers;
import android.app.Activity;
import android.util.Log;
import android.view.inputmethod.InputMethodManager;
import com.tkrpan.moviedb.StaticValue;
/**
* Created by tomislav on 7/23/14.
*/
public class SoftKeyboardHelper {
public static void hideSoftKeyboard(Activity activity) {
/*
final View myActivityView = activity.findViewById(R.id.my_activity_layout);
int heightDiff = myActivityView.getRootView().getHeight() - myActivityView.getHeight();
if (heightDiff > 100) { // keyboard is visible */
InputMethodManager inputMethodManager = (InputMethodManager)
activity.getSystemService(Activity.INPUT_METHOD_SERVICE);
try{
inputMethodManager.hideSoftInputFromWindow(activity.getCurrentFocus()
.getWindowToken(), 0);
}
catch (NullPointerException e){
// keyboardIsVisible == false
Log.e(StaticValue.TOM, "hideSoftKeyboard() " + e);
}
// }
}
}
|
b34d9e1d-d301-4807-9c48-0e3bc954fc3c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-04-09 07:51:46", "repo_name": "NanY-zjy/couchbase-spring-data-sample", "sub_path": "/src/main/java/com/cb/springdata/sample/controller/TestController.java", "file_name": "TestController.java", "file_ext": "java", "file_size_in_byte": 1102, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "b28ed82ca5024a3bffc961c760a88f4733fb3960", "star_events_count": 2, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/NanY-zjy/couchbase-spring-data-sample | 222 | FILENAME: TestController.java | 0.229535 | package com.cb.springdata.sample.controller;
import java.util.List;
import java.util.UUID;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.cb.springdata.sample.entities.Building;
import com.cb.springdata.sample.entities.User;
import com.cb.springdata.sample.repositories.BuildingRepository;
import com.cb.springdata.sample.repositories.UserRepository;
import com.cb.springdata.sample.service.BuildingService;
@RestController
@RequestMapping("test")
public class TestController {
@Autowired
private BuildingService buildingService;
@Autowired
private UserRepository userRepository;
@GetMapping("test")
public String test() {
User user = null;
for (int i = 0; i <= 200000; i ++) {
user = new User();
user.setId("user1."+UUID.randomUUID().toString());
user.setName("zjy"+i);
userRepository.save(user);
System.out.println(i);
}
return "hello";
}
}
|
dc91b483-d6f0-4ab9-9c09-5e316e8d419f | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-08-30 08:19:32", "repo_name": "ArkiZh/Laboratory", "sub_path": "/laboratory-parent/laboratory-snippet/src/main/java/com/arki/laboratory/snippet/image/ImageScan.java", "file_name": "ImageScan.java", "file_ext": "java", "file_size_in_byte": 992, "line_count": 30, "lang": "en", "doc_type": "code", "blob_id": "e7c6e809e2b4ee3239d9e2782e24bf0bbc1c242b", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ArkiZh/Laboratory | 234 | FILENAME: ImageScan.java | 0.289372 | package com.arki.laboratory.snippet.image;
import com.drew.imaging.ImageMetadataReader;
import com.drew.imaging.ImageProcessingException;
import com.drew.metadata.Directory;
import com.drew.metadata.Metadata;
import com.drew.metadata.Tag;
import java.io.File;
import java.io.IOException;
import java.util.Collection;
public class ImageScan {
public static void main(String[] args) throws ImageProcessingException, IOException {
//String image_path = "D:\\POCKET\\MINE\\100D7100\\DSC_2659.JPG";
String image_path = "C:\\Users\\mi\\Desktop\\2012-07-12_15-22-04_768.jpg";
Metadata metadata = ImageMetadataReader.readMetadata(new File(image_path));
Iterable<Directory> directories = metadata.getDirectories();
for (Directory d : directories) {
System.out.println("===============");
Collection<Tag> tags = d.getTags();
for (Tag t : tags) {
System.out.println(t);
}
}
}
}
|
60ee5abf-4c39-4936-8859-5dbce3257663 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-12-10 03:10:16", "repo_name": "butolapradip/Atm-application-in-springboot-using-mongo-client", "sub_path": "/src/main/java/com/example/ReadingText/Account.java", "file_name": "Account.java", "file_ext": "java", "file_size_in_byte": 1003, "line_count": 55, "lang": "en", "doc_type": "code", "blob_id": "89b18326ec33c9848f30a55caecc180a713c4f2e", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/butolapradip/Atm-application-in-springboot-using-mongo-client | 243 | FILENAME: Account.java | 0.259826 | package com.example.ReadingText;
import javax.validation.constraints.Size;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
@Document(collection = "account")
public class Account {
@Id
@Size(min = 14, message = "Name should have atleast 14 characters")
private long accountNo;
@Size(min = 4, message = "Name should have atleast 4 characters")
private int pin;
private int balance;
public long getAccountNo() {
return accountNo;
}
public Account()
{
}
public void setAccountNo(long accountNo) {
this.accountNo = accountNo;
}
public int getPin() {
return pin;
}
public void setPin(int pin) {
this.pin = pin;
}
public int getBalance() {
return balance;
}
public void setBalance(int balance) {
this.balance = balance;
}
public Account(long accountNo, int pin) {
super();
this.accountNo = accountNo;
this.pin = pin;
}
public Account(int balance) {
//super();
this.balance = balance;
}
}
|
caffb3e8-fd9f-4502-9fb1-321ce8de514c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-10-07 12:08:46", "repo_name": "BuzzardParking/buzzard-android", "sub_path": "/app/src/main/java/com/buzzardparking/buzzard/util/AddLocationLayer.java", "file_name": "AddLocationLayer.java", "file_ext": "java", "file_size_in_byte": 1072, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "5ca69f1c21b6b21b44efe81a149e16897ea8c984", "star_events_count": 3, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/BuzzardParking/buzzard-android | 230 | FILENAME: AddLocationLayer.java | 0.282988 | package com.buzzardparking.buzzard.util;
import com.google.android.gms.maps.GoogleMap;
/**
* {@link AddLocationLayer} adds the current device location to the map.
*
* It listens for the map ready and the location permission event to
* enable the map's location layer.
*/
public class AddLocationLayer implements
OnMap.Listener,
OnPermission.Listener {
private GoogleMap mGoogleMap;
private OnPermission.Result mPermissionResult;
@SuppressWarnings("MissingPermission")
private void addLayer(GoogleMap map) {
// shows the default blue location dot
map.setMyLocationEnabled(true);
}
private void check() {
if (mGoogleMap != null &&
mPermissionResult == OnPermission.Result.GRANTED) {
addLayer(mGoogleMap);
}
}
@Override
public void onMap(GoogleMap map) {
mGoogleMap = map;
check();
}
@Override
public void onResult(int requestCode, OnPermission.Result result) {
mPermissionResult = result;
check();
}
} |
c251cfce-9c92-4589-85fe-40d0fb768db6 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-06-12 06:46:57", "repo_name": "yelantingfengyu/sg-zhixiu-backend", "sub_path": "/sg-zhixiu-server/src/main/java/com/zhixiu/server/model/Extra.java", "file_name": "Extra.java", "file_ext": "java", "file_size_in_byte": 1077, "line_count": 60, "lang": "en", "doc_type": "code", "blob_id": "f4502859f393dd399b785f9369d1d9497a515f07", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/yelantingfengyu/sg-zhixiu-backend | 317 | FILENAME: Extra.java | 0.255344 | /**
* @author : 孙留平
* @since : 2020年3月1日 上午1:44:55
* @see:
*/
package com.zhixiu.server.model;
/**
* @author : Administrator
* @since : 2020年3月1日 上午1:44:55
* @see :
*/
public class Extra {
private String screenSize;
public String getScreenSize() {
return screenSize;
}
public void setScreenSize(String screenSize) {
this.screenSize = screenSize;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((screenSize == null) ? 0 : screenSize.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
Extra other = (Extra) obj;
if (screenSize == null) {
if (other.screenSize != null) {
return false;
}
} else if (!screenSize.equals(other.screenSize)) {
return false;
}
return true;
}
@Override
public String toString() {
return "Extra [screenSize=" + screenSize + "]";
}
}
|
fe195a4e-d623-4405-9e4c-adceec25a787 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2020-06-26T20:06:08", "repo_name": "kostyve/TheFantastic4Proj", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1082, "line_count": 20, "lang": "en", "doc_type": "text", "blob_id": "552f41ae3cbe9f9e2224196f62854b497b50e4ef", "star_events_count": 0, "fork_events_count": 4, "src_encoding": "UTF-8"} | https://github.com/kostyve/TheFantastic4Proj | 239 | FILENAME: README.md | 0.23231 | # TheFantastic4Proj
Project Management
This website is made for renters to provide service for university students, to help provide them a hub for and a place they can rent with great prices and call it home!
The app domain : https://thenewfantastic4-96af1.web.app
Developed by TheFantastic4Proj at SCE.
Student: you can enter the website, register, then browse and rent apartments (students will have to upload a valid student ID card to use the services provided, the ID card is verified manually at a later date.)
1. after registration you will see list of appartments presented to you from which you can choose an apartment.
2. you can use the search bar to make it easier for you.
3. making an order will ask for a credid card (simulation) and you will rent the apartment.
4. you can leave a review for the apartment in the dashboard.
Renter: you can register to the site and register your apartment/s the students will be able to rent them.
1. You can create an apartment which will be added automatically to the listings
2. you can browse the rating pepople leave you.
|
d9a35316-1e21-4b60-95e3-fd886de0048c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-03-02 08:54:43", "repo_name": "xiejiefeng/newMvcRepository", "sub_path": "/ebiz-xjf-pom/ebiz-xjf-api/src/main/java/com/xjf/wemall/api/entity/wechat/request/VideoMessage.java", "file_name": "VideoMessage.java", "file_ext": "java", "file_size_in_byte": 900, "line_count": 50, "lang": "zh", "doc_type": "code", "blob_id": "80b161b4c0829d443be5c430a954f83c9d9ee440", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/xiejiefeng/newMvcRepository | 341 | FILENAME: VideoMessage.java | 0.258326 | /*
* Copyright (C), 2013-2014, 上海汽车集团股份有限公司
* FileName: VideoMessage.java
* Author: wanglijun
* Date: 2014年8月19日 下午11:38:35
* Description: //模块目的、功能描述
* History: //修改记录
* <author> <time> <version> <desc>
* 修改人姓名 修改时间 版本号 描述
*/
package com.xjf.wemall.api.entity.wechat.request;
import com.thoughtworks.xstream.annotations.XStreamAlias;
/**
* 视频消息 <br>
* 〈功能详细描述〉
*
* @author wanglijun
* @see [相关类/方法](可选)
* @since [产品/模块版本] (可选)
*/
@XStreamAlias("xml")
public class VideoMessage extends MediaMessage {
/**视频消息:缩略图的媒体id,可以调用多媒体文件下载接口拉取数据。*/
@XStreamAlias("ThumbMediaId")
private String thumbMediaId;
/**
* default
*/
public VideoMessage() {
super();
}
/**
* @return the thumbMediaId
*/
public String getThumbMediaId() {
return thumbMediaId;
}
/**
* @param thumbMediaId the thumbMediaId to set
*/
public void setThumbMediaId(String thumbMediaId) {
this.thumbMediaId = thumbMediaId;
}
}
|
8818f4db-c384-4b3b-84d2-09762af008ad | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-07-10 03:18:39", "repo_name": "FRC4188/2020_InfiniteRecharge", "sub_path": "/src/main/java/frc/robot/commands/shooter/SpinShooterFormula.java", "file_name": "SpinShooterFormula.java", "file_ext": "java", "file_size_in_byte": 1099, "line_count": 48, "lang": "en", "doc_type": "code", "blob_id": "4a662facbb707e9a9b1a9872ff68ecf2cfaa8ede", "star_events_count": 2, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/FRC4188/2020_InfiniteRecharge | 247 | FILENAME: SpinShooterFormula.java | 0.293404 | package frc.robot.commands.shooter;
import edu.wpi.first.wpilibj2.command.CommandBase;
import frc.robot.subsystems.Limelight;
import frc.robot.subsystems.Shooter;
/**
* Spins shooter to a velocity calculated by Limelight.
*/
public class SpinShooterFormula extends CommandBase {
private final Shooter shooter;
private final Limelight limelight;
/**
* Constructs a new SpinShooterFormula command to spin shooter
* to a velocity calculated by Limelight.
*
* @param shooter - Shooter subsystem to use.
* @param limelight - Limelight subsystem to use.
*/
public SpinShooterFormula(Shooter shooter, Limelight limelight) {
addRequirements(shooter);
this.shooter = shooter;
this.limelight = limelight;
}
@Override
public void initialize() {
}
@Override
public void execute() {
shooter.setVelocity(limelight.formulaRpm());
}
@Override
public boolean isFinished() {
return false;
}
@Override
public void end(boolean interrupted) {
shooter.set(0);
}
}
|
e1ab5918-ab0a-44df-8e0d-bdcbd5c6de61 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2020-10-19T18:14:52", "repo_name": "fernandreu/fernandreu.github.io", "sub_path": "/content/projects/Portfolio/index.md", "file_name": "index.md", "file_ext": "md", "file_size_in_byte": 1053, "line_count": 24, "lang": "en", "doc_type": "text", "blob_id": "65d27e836e0241b9c9ad97f7aeb3096ca4fb6c68", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/fernandreu/fernandreu.github.io | 255 | FILENAME: index.md | 0.169956 | ---
path: "/portfolio"
cover: "./Screenshot1.png"
screenshots: ["./Screenshot1.png", "./Screenshot2.png", "./Screenshot3.png"]
date: "2019-11"
title: "This Portfolio"
subtitle: "A static portfolio website hosted in GitHub Pages"
github: "https://github.com/fernandreu/fernandreu.github.io"
published: true
tags: ['React', 'Gatsby', 'JavaScript', 'Node.js', 'Web']
---
### A static portfolio website hosted in GitHub Pages
All info regarding every project (title, tags, content, screenshots, etc.) is kept in a folder
within the repository. As with any typical [Gatsby](https://www.gatsbyjs.org/) website, GraphQL
is used to parse this info and render the corresponding web sections. No external CDN is needed.
The build / deployment is completely automated via GitHub Actions, creating a new static
build of the website on any push to the `dev` branch which then gets pushed to the
`master` branch.
The [Contact Me](/contact) section sends all form data to an AWS Lambda function, which in turn
sends me back an email with that data via Amazon SES.
|
84603e9c-4d62-4eb0-aff8-584c49a66762 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-01-08 05:31:32", "repo_name": "prayxiang/RecyclerViewExtension", "sub_path": "/recyclerview-extension/src/main/java/com/prayxiang/recyclerview/extension/tools/CheckBean.java", "file_name": "CheckBean.java", "file_ext": "java", "file_size_in_byte": 1028, "line_count": 51, "lang": "en", "doc_type": "code", "blob_id": "dd8ee282c6788b48aa1ac1afdeed8c2bbbc75f8f", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/prayxiang/RecyclerViewExtension | 217 | FILENAME: CheckBean.java | 0.245085 | package com.prayxiang.recyclerview.extension.tools;
import android.databinding.BaseObservable;
import android.databinding.Bindable;
import com.prayxiang.recyclerview.extension.BR;
/**
* Created by xianggaofeng on 2017/12/14.
*/
public class CheckBean extends BaseObservable {
private Object object;
private boolean checked;
private String title;
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public CheckBean(Object object, String title) {
this.object = object;
this.title = String.valueOf(title);
}
public CheckBean(Object object) {
this.object = object;
this.title = String.valueOf(object);
}
public <T> T getObject() {
return (T) object;
}
public void setChecked(boolean checked) {
this.checked = checked;
notifyPropertyChanged(BR.checked);
}
@Bindable
public boolean isChecked() {
return checked;
}
}
|
110b2703-cda9-453d-a45a-0aa5cf454b95 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-03-23 01:57:14", "repo_name": "laijianliangs/market_goods", "sub_path": "/src/test/java/com/fujian/marketgoods/MarketGoodsApplicationTests.java", "file_name": "MarketGoodsApplicationTests.java", "file_ext": "java", "file_size_in_byte": 1026, "line_count": 45, "lang": "en", "doc_type": "code", "blob_id": "1a98172346c650d641848fc1b49781b66489b507", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/laijianliangs/market_goods | 223 | FILENAME: MarketGoodsApplicationTests.java | 0.214691 | package com.fujian.marketgoods;
import com.alibaba.fastjson.JSON;
import com.fujian.marketgoods.dao.GoodsDao;
import com.fujian.marketgoods.pojo.dto.GoodsListDto;
import com.fujian.marketgoods.pojo.entity.Goods;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@SpringBootTest
class MarketGoodsApplicationTests {
@Resource
GoodsDao goodsDao;
@Test
void contextLoads() {
}
@Test
void TESTS()
{
GoodsListDto goodsListDto = new GoodsListDto();
List<Goods> list = new ArrayList<>();
goodsListDto.setCode(1);
goodsListDto.setMsg("");
goodsListDto.setCount(2);
goodsListDto.addObject("dasdsa");
goodsListDto.addObject("dassa");
String s = JSON.toJSONString(goodsListDto);
System.out.println(s);
list = goodsDao.selectAll();
System.out.println(list.toString());
}
}
|
fd392ca4-df43-4dcd-9d48-781059f43bfe | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-11-19 01:45:58", "repo_name": "ybmasmiling/Istio", "sub_path": "/billing-service-info/billing-service-info-v2/src/main/java/com/billing/billingserviceinfo/entity/Plan.java", "file_name": "Plan.java", "file_ext": "java", "file_size_in_byte": 1085, "line_count": 51, "lang": "en", "doc_type": "code", "blob_id": "438891f38100cf881e19cb348e65ca9b7008dc2c", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ybmasmiling/Istio | 216 | FILENAME: Plan.java | 0.268941 | package com.billing.billingserviceinfo.entity;
import lombok.Data;
import javax.persistence.*;
import java.io.Serializable;
@Entity
@Table(name="Plan")
@Data
public class Plan implements Serializable {
public Plan() {
}
@Id
@Column(name="id")
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@Column(name="accountId")
private String accountId;
@Column(name="planAmount")
private int planAmount;
@Column(name="dataGB")
private int dataGB;
@Column(name="nationalCallsAmount")
private int nationalCallsAmount;
@Column(name="internationalCallsMinutes")
private int internationalCallsMinutes;
@Override
public String toString() {
return "Plan {" +
"accountId='" + accountId + '\'' +
", planAmount='" + planAmount + '\'' +
", data='" + dataGB + '\'' +
", nationalCallsAmount='" + nationalCallsAmount + '\'' +
", internationalCallsMinutes=" + internationalCallsMinutes +
'}';
}
}
|
69df3d8f-649a-4b39-a408-94199148268c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-07-26 07:29:06", "repo_name": "Aahart911/mongoose", "sub_path": "/src/main/java/com/emc/mongoose/common/log/appenders/ShortenedLogEvent.java", "file_name": "ShortenedLogEvent.java", "file_ext": "java", "file_size_in_byte": 1076, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "e9c4496c9739aa2b95deeefbf3a32fa3a6efdd39", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Aahart911/mongoose | 241 | FILENAME: ShortenedLogEvent.java | 0.271252 | package com.emc.mongoose.common.log.appenders;
import org.apache.logging.log4j.core.LogEvent;
import java.io.Serializable;
import java.util.Comparator;
/**
* Created on 05.05.16.
*/
@SuppressWarnings("FieldCanBeLocal")
public class ShortenedLogEvent implements Serializable {
private String level;
private String loggerName;
private String threadName;
private final long timeStamp;
private String message;
public ShortenedLogEvent(LogEvent logEvent) {
level = logEvent.getLevel().name();
loggerName = logEvent.getLoggerName();
threadName = logEvent.getThreadName();
timeStamp = logEvent.getTimeMillis();
message = logEvent.getMessage().getFormattedMessage();
}
public ShortenedLogEvent(final long timeStamp) {
this.timeStamp = timeStamp;
}
public static class SleComparator implements Comparator<ShortenedLogEvent> {
@Override
public int compare(ShortenedLogEvent sle1, ShortenedLogEvent sle2) {
return Long.compare(sle1.timeStamp, sle2.timeStamp);
}
}
@Override
public String toString() {
return String.valueOf(timeStamp);
}
}
|
7f8ae9ef-295f-43f2-9b62-343decb453a7 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-02-23 21:13:57", "repo_name": "Thomsch/hashcode-2017", "sub_path": "/src/ch/thediggers/streaming/io/DataWriter.java", "file_name": "DataWriter.java", "file_ext": "java", "file_size_in_byte": 1078, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "02133c429624e2012acac47aabe5f3018e9eb443", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Thomsch/hashcode-2017 | 197 | FILENAME: DataWriter.java | 0.285372 | package ch.thediggers.streaming.io;
import ch.thediggers.streaming.models.CacheServer;
import ch.thediggers.streaming.util.Config;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.util.List;
import java.util.Map;
public abstract class DataWriter {
public static void write(Map<Integer, CacheServer> cacheServers, String fileName) {
try (BufferedWriter writer = new BufferedWriter(new FileWriter(fileName))) {
writer.write(String.valueOf(cacheServers.size()));
writer.newLine();
for (Map.Entry<Integer, CacheServer> cacheServer : cacheServers.entrySet()) {
writer.write(String.valueOf(cacheServer.getKey()) + Config.SEPARATOR);
final List<Integer> videos = cacheServer.getValue().videos;
for (Integer video : videos)
writer.write(String.valueOf(video) + Config.SEPARATOR);
writer.newLine();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
|
160faaf8-9c4f-4567-9c26-f52f5185a550 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2023-08-30T19:44:45", "repo_name": "angular/angular", "sub_path": "/integration/cli-elements-universal/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1083, "line_count": 14, "lang": "en", "doc_type": "text", "blob_id": "3ca640084509d8aaddea8ed84c17355e8a6ca395", "star_events_count": 108299, "fork_events_count": 34425, "src_encoding": "UTF-8"} | https://github.com/angular/angular | 243 | FILENAME: README.md | 0.208179 | # CliElementsUniversal
This project tests the integration of Angular Elements (`@angular/elements`) with SSR (via `@angular/platform-server`).
The project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 11.1.4.
Support for Angular Elements was added with `ng add @angular/elements` and for SSR with `ng generate app-shell`.
What this project tests is that an app can be successfully SSR'd even when it uses `@angular/elements`, which relies on certain DOM built-ins being available as soon as it is imported.
This is tested by generating the [app-shell](https://angular.io/guide/app-shell) (using `ng run cli-elements-universal:app-shell:production`) and then verifying that the `index.html` file was generated correctly.
(See, the `test-ssr` script in [package.json](./package.json).)
NOTE:
Currently, `domino` (the server-side DOM implementation used by `@angular/platform-server`) does not support [Web Components](https://developer.mozilla.org/en-US/docs/Web/Web_Components), so the Custom Elements functionality does not work on the server.
|
d2052a0f-ab1c-42fb-af23-3b575237b35c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-10-25 12:16:50", "repo_name": "Khalanirek/Learning", "sub_path": "/slider/SliderFrameTest.java", "file_name": "SliderFrameTest.java", "file_ext": "java", "file_size_in_byte": 1035, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "63d657a3acf424199a2c8b0de7d0d0666431bd76", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Khalanirek/Learning | 195 | FILENAME: SliderFrameTest.java | 0.262842 | /*
* 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 slider;
import java.awt.EventQueue;
import java.net.MalformedURLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFrame;
/**
*
* @author Piotrek
*/
public class SliderFrameTest {
/**
*
* @param args
* @throws MalformedURLException
*/
public static void main(String[] args) throws MalformedURLException
{
EventQueue.invokeLater(()->
{
try {
JFrame frame = new SliderFrame();
frame.setTitle("SliderFrameTest");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
} catch (MalformedURLException ex) {
Logger.getLogger(SliderFrameTest.class.getName()).log(Level.SEVERE, null, ex);
}
});
}
}
|
ef1a0362-5394-4ca9-a113-9480d7093b0f | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2021-05-04T08:52:40", "repo_name": "CS305-software-Engineering/Service-Request-Application-CS305", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1083, "line_count": 17, "lang": "en", "doc_type": "text", "blob_id": "e54d9a1d6822fdfac94a26c26f9f0f9d697bc35f", "star_events_count": 0, "fork_events_count": 4, "src_encoding": "UTF-8"} | https://github.com/CS305-software-Engineering/Service-Request-Application-CS305 | 244 | FILENAME: README.md | 0.249447 | # Service-Request-Application-CS305
Software to request maintenance services
## High Level Idea
- User takes a photo (ex: broken tap) and the application automatically predicts the required authority(ex: water department and help calling a plumber)
- Entire maintenance work flow (raise complaint -> solve issue by authorities -> feedback from complainant)
## ToDo
1. Preparation of the [software requirements specification (SRS)](https://github.com/CS305-software-Engineering/Service-Request-Application-CS305/wiki/SRS) documentation.
2. Preparation of [High Level Design Document](https://github.com/CS305-software-Engineering/Service-Request-Application-CS305/wiki/High-Level-Design) and [Low Level Design Document](https://github.com/CS305-software-Engineering/Service-Request-Application-CS305/wiki/Low-Level-Design).
3. Construction of the software. This includes creating and maintaining the source code artifacts in a version control system (VCS) such as git repository.
4. Continuous build and delivery/deployment of the software.
5. Final deployment of the software.
|
27e88912-3933-4e82-9661-d411d6e34d98 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-10-16 20:20:28", "repo_name": "khrystiian/JAVA_Repository", "sub_path": "/BuildPc/src/controller/ProductController.java", "file_name": "ProductController.java", "file_ext": "java", "file_size_in_byte": 992, "line_count": 51, "lang": "en", "doc_type": "code", "blob_id": "d88a70a0fad20f57f99b5854355d3640d59493ee", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/khrystiian/JAVA_Repository | 235 | FILENAME: ProductController.java | 0.256832 | package controller;
import java.util.ArrayList;
import modelLayer.*;
public class ProductController {
private ProductContainer prodCont;
public ProductController(){
prodCont = new ProductContainer();
}
public ArrayList<Cpu> getCpus(){
return prodCont.getCpus();
}
public ArrayList<Cooler> getCoolers(){
return prodCont.getCoolers();
}
public ArrayList<ExternDrive> getExtDrive(){
return prodCont.getExtDrives();
}
public ArrayList<GraphicsCard> getGfx(){
return prodCont.getGfxs();
}
public ArrayList<OpticalDrive> getOptDrive(){
return prodCont.getOptDrives();
}
public ArrayList<Hdd> getHdds(){
return prodCont.getHdds();
}
public ArrayList<Motherboard> getMths(){
return prodCont.getMths();
}
public ArrayList<Memory> getMem(){
return prodCont.getRams();
}
public Motherboard readMth(String socket) throws Exception {
Motherboard
}
}
|
64ac7414-3dbb-47ef-8674-276a3425b017 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-08-15 22:30:50", "repo_name": "dvessey/InventoryManagementSystem", "sub_path": "/src/main/java/com/dvessey/inventorymanagementsystemsoftware/Outsourced.java", "file_name": "Outsourced.java", "file_ext": "java", "file_size_in_byte": 978, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "193455bb34fda45c76da969428f96ba7233108c0", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/dvessey/InventoryManagementSystem | 220 | FILENAME: Outsourced.java | 0.23793 | package com.dvessey.inventorymanagementsystemsoftware;
/**
* Outsourced class is a child of part
* @author Damon Vessey
*/
public class Outsourced extends Part{
private String companyName;
/**
* Outsourced constructor calls Part constructor and adds companyName
* @param id
* @param name
* @param price
* @param stock
* @param min
* @param max
* @param companyName
*/
public Outsourced(int id, String name, double price, int stock, int min, int max, String companyName){
super(id, name, price, stock, min, max);
this.companyName = companyName;
}
/**
* getCompanyName gets the company name
* @return companyName
*/
public String getCompanyName() {
return companyName;
}
/**
* setCompanyName sets the company name
* @param companyName
*/
public void setCompanyName(String companyName) {
this.companyName = companyName;
}
}
|
b2469240-13cf-44a9-a571-6f607c6b8845 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-01-16 23:45:44", "repo_name": "sharingToLearn/javaLearning", "sub_path": "/sendingSms/src/com/shahbaz/utils/ApplicationProperties.java", "file_name": "ApplicationProperties.java", "file_ext": "java", "file_size_in_byte": 978, "line_count": 48, "lang": "en", "doc_type": "code", "blob_id": "33ff2f464d817a1e7f51044866c3d3e828b437a3", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/sharingToLearn/javaLearning | 223 | FILENAME: ApplicationProperties.java | 0.279828 | package com.shahbaz.utils;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import com.shahbaz.utils.AppConstants;
/**
* Common class to load all the property file
*
* @author Shahbaz.Khan
*
*/
public class ApplicationProperties {
static InputStream input = null;
static Properties properties = new Properties();
/**
* Pass the key to get the property value
*
* @param key
* @return
*/
public static String getProperty(String key) {
String propertyFilename = AppConstants.PROPERTY_FILE_PATH;
try {
if (input == null) {
input = new FileInputStream(propertyFilename);
}
properties.load(input);
} catch (IOException e) {
e.printStackTrace();
}
// I am not closing the stream which is a bad practice. But I do not
// want Property file to be loaded every time method gets called . Code
// need revised.
return properties.getProperty(key).trim();
}
}
|
af070a22-fe04-4337-bc0d-0c0d7c556a94 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-02-23 21:13:57", "repo_name": "Thomsch/hashcode-2017", "sub_path": "/src/ch/thediggers/streaming/models/InputData.java", "file_name": "InputData.java", "file_ext": "java", "file_size_in_byte": 978, "line_count": 28, "lang": "en", "doc_type": "code", "blob_id": "9d0a5f76e7aa0fe3358a12e998f9fe584d61ca45", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Thomsch/hashcode-2017 | 199 | FILENAME: InputData.java | 0.276691 | package ch.thediggers.streaming.models;
import java.util.List;
public class InputData {
public final int numVideos;
public final int numEndPoint;
public final int numRequestDescriptions;
public final int numCacheServers;
public final int cacheServerCapacity;
public final int[] videos;
public final EndPoint[] endPoints;
public final List<Request> requestDescriptions;
public InputData(int numVideos, int numEndPoint, int numRequestDescriptions, int numCacheServers, int cacheServerCapacity, int[] videos, EndPoint[] endPoints, List<Request> requestDescriptions) {
this.numVideos = numVideos;
this.numEndPoint = numEndPoint;
this.numRequestDescriptions = numRequestDescriptions;
this.numCacheServers = numCacheServers;
this.cacheServerCapacity = cacheServerCapacity;
this.videos = videos;
this.endPoints = endPoints;
this.requestDescriptions = requestDescriptions;
}
}
|
cd609170-12d7-4d96-ae19-886afa5a3eac | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-11-13 11:32:42", "repo_name": "DesamNaren/OPMS", "sub_path": "/app/src/main/java/com/cgg/pps/model/response/devicemgmt/mastervillage/MasterVillageMainResponse.java", "file_name": "MasterVillageMainResponse.java", "file_ext": "java", "file_size_in_byte": 1084, "line_count": 45, "lang": "en", "doc_type": "code", "blob_id": "fcfdf4cc8368df181cf57790a111914e6b3fb30b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/DesamNaren/OPMS | 220 | FILENAME: MasterVillageMainResponse.java | 0.214691 | package com.cgg.pps.model.response.devicemgmt.mastervillage;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class MasterVillageMainResponse {
@SerializedName("StatusCode")
@Expose
private Integer statusCode;
@SerializedName("ResponseMessage")
@Expose
private String responseMessage;
@SerializedName("districtMandalViallgeResponse")
@Expose
private List<VillageEntity> villageEntity = null;
public Integer getStatusCode() {
return statusCode;
}
public void setStatusCode(Integer statusCode) {
this.statusCode = statusCode;
}
public String getResponseMessage() {
return responseMessage;
}
public void setResponseMessage(String responseMessage) {
this.responseMessage = responseMessage;
}
public List<VillageEntity> getVillageEntity() {
return villageEntity;
}
public void setVillageEntity(List<VillageEntity> villageEntity) {
this.villageEntity = villageEntity;
}
}
|
6c605287-4cec-4ebd-b190-8f79898d66df | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2012-02-18 07:50:23", "repo_name": "hehahovip/mygapps", "sub_path": "/Demo/src/com/hehaho/googleapp/demo/jdo/Person.java", "file_name": "Person.java", "file_ext": "java", "file_size_in_byte": 1234, "line_count": 79, "lang": "en", "doc_type": "code", "blob_id": "924c693e430cfc6c9d539723b7bdc2ab496a4c5e", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/hehahovip/mygapps | 286 | FILENAME: Person.java | 0.264358 | /**
*
*/
package com.hehaho.googleapp.demo.jdo;
import java.util.Date;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;
/**
* @author Kevin.Wang
*
*/
@PersistenceCapable(identityType=IdentityType.APPLICATION)
public class Person {
@PrimaryKey
@Persistent(valueStrategy=IdGeneratorStrategy.IDENTITY)
private String id;
@Persistent
private String name;
@Persistent
private int age;
@Persistent
private Date createDate;
@Persistent
private Date modifyDate;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public Date getCreateDate() {
return createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
public Date getModifyDate() {
return modifyDate;
}
public void setModifyDate(Date modifyDate) {
this.modifyDate = modifyDate;
}
}
|
4d840d0f-e34f-4c52-8dec-75b6b60152a2 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-03-21 06:51:22", "repo_name": "LeonZhang2013/vegetables_service", "sub_path": "/src/main/java/com/zhongshu/vegetables/utils/Tools.java", "file_name": "Tools.java", "file_ext": "java", "file_size_in_byte": 966, "line_count": 35, "lang": "en", "doc_type": "code", "blob_id": "9afad4f3dc7b55b01bc9504c453b13c665e97005", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/LeonZhang2013/vegetables_service | 211 | FILENAME: Tools.java | 0.258326 | package com.zhongshu.vegetables.utils;
import com.zhongshu.vegetables.encrypt.Algorithm;
import com.zhongshu.vegetables.encrypt.MessageDigestUtils;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Random;
public class Tools {
public static Long generatorId() {
return System.currentTimeMillis()+new Random().nextInt(999);
}
public static String encryptPass(String username,String newPwd) throws Exception {
return MessageDigestUtils.encrypt(username + newPwd, Algorithm.SHA1);
}
public static void PraseDate(List<Map<String, Object>> data, String key) {
try {
for (int i=0; i<data.size(); i++){
Date o = (Date)data.get(i).get(key);
if (o!=null){
String s = DateUtils.formatTime(o.getTime());
data.get(i).put(key,s);
}
}
}catch (Exception e){
}
}
}
|
4d3fd67b-e703-440f-b6cb-00e80d16ad19 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-01-02 04:49:21", "repo_name": "huangpengpeng/wechat", "sub_path": "/src/main/java/com/wechat/dao/impl/QrcodeBindingDaoImpl.java", "file_name": "QrcodeBindingDaoImpl.java", "file_ext": "java", "file_size_in_byte": 978, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "d26b174fd6277889f37a66abe14a4bb6073bb2b7", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/huangpengpeng/wechat | 234 | FILENAME: QrcodeBindingDaoImpl.java | 0.29584 | package com.wechat.dao.impl;
import org.springframework.stereotype.Repository;
import com.common.jdbc.JdbcTemplateBaseDao;
import com.common.jdbc.SqlBuilder;
import com.wechat.dao.QrcodeBindingDao;
import com.wechat.entity.QrcodeBinding;
@Repository
public class QrcodeBindingDaoImpl extends JdbcTemplateBaseDao implements QrcodeBindingDao{
public void add(QrcodeBinding qrcodeBinding) {
super.add(qrcodeBinding);
}
public QrcodeBinding getByQrcode(Long partnerId,
Long wechatUserId) {
SqlBuilder sqlBuilder = new SqlBuilder(
"select * from QrcodeBinding where 1=1");
if (sqlBuilder.ifNotNull(partnerId)) {
sqlBuilder.andEqualTo("partnerId", partnerId);
}
if (sqlBuilder.ifNotNull(wechatUserId)) {
sqlBuilder.andEqualTo("wechatUserId", wechatUserId);
}
return queryForObject(sqlBuilder);
}
@Override
protected Class<?> getEntityClass() {
return QrcodeBinding.class;
}
@Override
public void delete(Long id) {
super.delete(id);
}
}
|
b85c533f-cf4c-4b55-a055-649a6877a00e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-09-13 14:50:31", "repo_name": "makist1101/LibraryApplication", "sub_path": "/src/main/java/io/vertx/intro/first/Book.java", "file_name": "Book.java", "file_ext": "java", "file_size_in_byte": 1018, "line_count": 59, "lang": "en", "doc_type": "code", "blob_id": "08eede0ca615f8fb2f6d28cfcd685d835463cf16", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/makist1101/LibraryApplication | 216 | FILENAME: Book.java | 0.225417 | package io.vertx.intro.first;
import io.vertx.core.json.JsonObject;
public class Book {
private long id = -1;
private String title;
private String author;
public Book(String title, String author) {
this.title = title;
this.author = author;
}
public Book(long id, String title, String author) {
this.id = id;
this.title = title;
this.author = author;
}
public Book() {
}
public Book(JsonObject json) {
this(
json.getInteger("id", -1),
json.getString("title"),
json.getString("author")
);
}
public long getId() {
return id;
}
public String getTitle() {
return title;
}
public Book setTitle(String title) {
this.title = title;
return this;
}
public String getAuthor() {
return author;
}
public Book setAuthor(String author) {
this.author = author;
return this;
}
}
|
cf3566a9-bf9d-4d8e-bc2b-2ba924bf08cf | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2023-06-21 17:02:37", "repo_name": "usnistgov/iheos-toolkit2", "sub_path": "/xdstools2/src/main/java/gov/nist/toolkit/xdstools2/client/tabs/genericQueryTab/SamlSelector.java", "file_name": "SamlSelector.java", "file_ext": "java", "file_size_in_byte": 1100, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "da149e0a7c9d617c2760a46453db9b47db44f1c8", "star_events_count": 48, "fork_events_count": 29, "src_encoding": "UTF-8"} | https://github.com/usnistgov/iheos-toolkit2 | 293 | FILENAME: SamlSelector.java | 0.291787 | package gov.nist.toolkit.xdstools2.client.tabs.genericQueryTab;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ChangeEvent;
import com.google.gwt.event.dom.client.ChangeHandler;
import com.google.gwt.user.client.ui.ListBox;
public class SamlSelector implements ChangeHandler {
GenericQueryTab tab;
public SamlSelector(GenericQueryTab tab) {
this.tab = tab;
}
public void onChange(ChangeEvent event) {
if (tab!= null) {
String selectedValue = ((ListBox)event.getSource()).getSelectedValue();
boolean noSaml = "NoSaml".equals(selectedValue);
String xuaUserName = (noSaml) ? null : selectedValue;
try {
if (tab.getSiteSelection() != null)
tab.getSiteSelection().setSaml(noSaml);
} catch (Exception ex) {
GWT.log("SamlSelector error [1]: " + ex.toString());
}
try {
if (tab.getCommonSiteSpec() != null) {
tab.getCommonSiteSpec().setSaml(noSaml);
tab.getCommonSiteSpec().setGazelleXuaUsername(xuaUserName);
}
} catch (Exception ex) {
GWT.log("SamlSelector error [2]: " + ex.toString());
}
}
}
} |
d2e0450c-1b01-4eca-9781-b87094665dde | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-06-14 10:26:46", "repo_name": "Vova2009/save-inventory", "sub_path": "/src/main/java/ru/vova_2009/saveinventory/SaveInventory.java", "file_name": "SaveInventory.java", "file_ext": "java", "file_size_in_byte": 975, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "91eb633a1febf4436e8484c3545465bb5a1e2b85", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Vova2009/save-inventory | 199 | FILENAME: SaveInventory.java | 0.242206 | package ru.vova_2009.saveinventory;
import com.google.inject.Inject;
import org.slf4j.Logger;
import org.spongepowered.api.event.Listener;
import org.spongepowered.api.event.game.state.GameInitializationEvent;
import org.spongepowered.api.plugin.Plugin;
import ru.vova_2009.saveinventory.service.CommandService;
@Plugin(
id = "save-inventory",
name = "Save Inventory",
description = "Plugin for saving player inventory",
authors = {
"Vova 2009"
}
)
public class SaveInventory {
private final Logger logger;
private final CommandService commandService;
@Inject
public SaveInventory(Logger logger, CommandService commandService) {
this.logger = logger;
this.commandService = commandService;
}
@Listener
public void onServerStart(GameInitializationEvent event) {
logger.info("Initialize save inventory plugin!");
commandService.initialize(this);
}
}
|
39be1f70-1ad9-47df-b6e1-058ec0a3ef42 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-07-31 10:46:46", "repo_name": "UXPlatformDemoTeam/SensingFlowEditor", "sub_path": "/sensingflow/sensingflow.gef/src/sensingflow/gef/editor/policy/SensingflowThingDirectEditPolicy.java", "file_name": "SensingflowThingDirectEditPolicy.java", "file_ext": "java", "file_size_in_byte": 990, "line_count": 27, "lang": "en", "doc_type": "code", "blob_id": "c1b046600fe586991432fd2d9e9b2b8b53488673", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/UXPlatformDemoTeam/SensingFlowEditor | 206 | FILENAME: SensingflowThingDirectEditPolicy.java | 0.279828 | package sensingflow.gef.editor.policy;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.editpolicies.DirectEditPolicy;
import org.eclipse.gef.requests.DirectEditRequest;
import sensingflow.gef.editor.command.SensingflowThingRenameCommand;
import sensingflow.gef.editor.figure.SensingflowThingFigure;
import sensingflow.model.SensingflowThing;
public class SensingflowThingDirectEditPolicy extends DirectEditPolicy {
@Override
protected Command getDirectEditCommand(DirectEditRequest request) {
SensingflowThingRenameCommand command = new SensingflowThingRenameCommand();
command.setModel((SensingflowThing) getHost().getModel());
command.setNewName((String) request.getCellEditor().getValue());
return command;
}
@Override
protected void showCurrentEditValue(DirectEditRequest request) {
String value = (String) request.getCellEditor().getValue();
((SensingflowThingFigure) getHostFigure()).getNameLabel().setText(value);
}
}
|
e83929e5-9176-4546-9f9a-fbdb5a3eca8a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-12-12 10:06:03", "repo_name": "adnanisajbeg/apache-camel-playground", "sub_path": "/split-examples/src/main/java/is/symphony/test/split/examples/routes/strategy/ListPersonAggregationStrategy.java", "file_name": "ListPersonAggregationStrategy.java", "file_ext": "java", "file_size_in_byte": 991, "line_count": 32, "lang": "en", "doc_type": "code", "blob_id": "79368a3a83424bcc3ada3fe5547ffcee4f7b9d05", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/adnanisajbeg/apache-camel-playground | 184 | FILENAME: ListPersonAggregationStrategy.java | 0.261331 | package is.symphony.test.split.examples.routes.strategy;
import is.symphony.test.split.examples.model.Person;
import org.apache.camel.Exchange;
import org.apache.camel.processor.aggregate.AggregationStrategy;
import java.util.ArrayList;
import java.util.List;
public class ListPersonAggregationStrategy implements AggregationStrategy {
@Override
@SuppressWarnings("unchecked")
public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
Person body = newExchange.getIn().getBody(Person.class);
if (oldExchange == null) {
List<Person> list = new ArrayList<>();
if (body != null) {
list.add(body);
}
newExchange.getIn().setBody(list);
return newExchange;
} else {
List<Person> list = oldExchange.getIn().getBody(List.class);
if (body != null) {
list.add(body);
}
return oldExchange;
}
}
}
|
d1d730a6-4012-4ac3-9485-4ef6b6d17628 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-12-02 10:05:17", "repo_name": "Shaokun-X/info_rest", "sub_path": "/src/test/java/com/wmp/demo/service/UserServiceTest.java", "file_name": "UserServiceTest.java", "file_ext": "java", "file_size_in_byte": 1098, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "4bcebdbb9093b04d4128c128883813991e27ea44", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Shaokun-X/info_rest | 199 | FILENAME: UserServiceTest.java | 0.245085 | package com.wmp.demo.service;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.system.CapturedOutput;
import org.springframework.boot.test.system.OutputCaptureExtension;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.test.context.junit.jupiter.SpringExtension;
@ExtendWith(OutputCaptureExtension.class)
@ExtendWith(SpringExtension.class)
public class UserServiceTest {
@Configuration // does this "import" the beans from another package? since here is in the test?
@ComponentScan("com.wmp.demo.service")
public static class UserServiceTestConfig {
}
@Autowired
public DummyUserService dummyUserService;
@Test
public void testGreetingAll(CapturedOutput output) {
dummyUserService.greetAll();
Assertions.assertThat(output).contains("Elodie!", "Charles!");
}
}
|
5ceca25b-7661-475d-a0b5-277f5da63ae4 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-06-08 15:31:03", "repo_name": "meikaiss/framework", "sub_path": "/app/src/main/java/com/android/framework/demo/activity/daemon/DaemonResult.java", "file_name": "DaemonResult.java", "file_ext": "java", "file_size_in_byte": 1037, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "f3cf60772b5c3dd5ba42ed8c2e0de450dd66dd9f", "star_events_count": 4, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/meikaiss/framework | 232 | FILENAME: DaemonResult.java | 0.253861 | package com.android.framework.demo.activity.daemon;
/**
* 后台上传的结果信息
* Created by meikai on 2018/06/01.
*/
public class DaemonResult {
public @DaemonSource.SOURCE_TYPE
int type;
/**
* 上传成功后的 图片或视频 的 服务器路径
*/
public String netUrl;
public String videoCoverNetUrl;
public int videoCoverWidth;
public int videoCoverHeight;
public static DaemonResult image(String netUrl) {
DaemonResult result = new DaemonResult();
result.netUrl = netUrl;
result.type = DaemonSource.TYPE_IMAGE;
return result;
}
public static DaemonResult video(String netUrl, String coverNetUrl, int coverWidth, int coverHeight) {
DaemonResult result = new DaemonResult();
result.netUrl = netUrl;
result.videoCoverNetUrl = coverNetUrl;
result.videoCoverWidth = coverWidth;
result.videoCoverHeight = coverHeight;
result.type = DaemonSource.TYPE_VIDEO;
return result;
}
}
|
13f3bf8f-0337-406e-9faa-ebf799466a9a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-04-17 17:10:27", "repo_name": "dnacher/ship", "sub_path": "/src/main/java/com/ship/ship/domain/service/BranchOfficeService.java", "file_name": "BranchOfficeService.java", "file_ext": "java", "file_size_in_byte": 1083, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "6b1b8c3cdde80e12ce7e7e1afd731e2a76be8dcc", "star_events_count": 2, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/dnacher/ship | 200 | FILENAME: BranchOfficeService.java | 0.262842 | package com.ship.ship.domain.service;
import com.ship.ship.persistence.dao.BranchOfficeDAO;
import com.ship.ship.persistence.model.BranchOffice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.transaction.Transactional;
import java.util.List;
@Service
@Transactional
public class BranchOfficeService {
@Autowired
private BranchOfficeDAO branchOfficeDAO;
public List<BranchOffice> getBranchOffice(){
return branchOfficeDAO.getBranchOffice();
}
public BranchOffice getBranchOfficeById(Integer id){
return branchOfficeDAO.getBranchOfficeById(id);
}
public BranchOffice saveBranchOffice(BranchOffice branchOffice){
return branchOfficeDAO.saveBranchOffice(branchOffice);
}
public BranchOffice updateBranchOffice(BranchOffice branchOffice){
return branchOfficeDAO.updateBranchOffice(branchOffice);
}
public void deleteBranchOffice(BranchOffice branchOffice){
branchOfficeDAO.deleteBranchOffice(branchOffice);
}
}
|
64a9c4f5-b1aa-4d29-9c83-f6baa385bc54 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-05-04 08:08:04", "repo_name": "Shaderock/Behavioral", "sub_path": "/src/com/behavioral/observer/publisher/LevelLoader.java", "file_name": "LevelLoader.java", "file_ext": "java", "file_size_in_byte": 977, "line_count": 51, "lang": "en", "doc_type": "code", "blob_id": "6101e7266127f43bf42bc9168eec90c11b20c807", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Shaderock/Behavioral | 197 | FILENAME: LevelLoader.java | 0.272799 | package com.behavioral.observer.publisher;
import com.behavioral.observer.subscriber_interface.OnLevelLoadListener;
import java.util.ArrayList;
public class LevelLoader implements Runnable
{
ArrayList<OnLevelLoadListener> listeners;
public LevelLoader()
{
listeners = new ArrayList<>();
}
public void addOnLoadListener(OnLevelLoadListener listener)
{
listeners.add(listener);
}
private void loadLevelData()
{
System.out.println("Loading level data...");
try
{
Thread.sleep(1000);
System.out.println("Level data loaded");
}
catch (InterruptedException e)
{
e.printStackTrace();
}
}
@Override
public void run()
{
loadLevelData();
loadGUI();
}
private void loadGUI()
{
for (OnLevelLoadListener listener : listeners)
{
listener.onLoad();
}
}
}
|
e01b9a13-7fcf-41e9-a178-1b11da9a3139 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-03-10 17:04:06", "repo_name": "JulioCesarSF/JPA-Hibernate-Services", "sub_path": "/Enterprise (back_jpa)/Aulas/04-JPA-Relacionamentos/src/br/com/fiap/testes/Teste1.java", "file_name": "Teste1.java", "file_ext": "java", "file_size_in_byte": 1094, "line_count": 49, "lang": "en", "doc_type": "code", "blob_id": "743be1bad5952d61a91a1c5b6f8932bbc9ae228d", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/JulioCesarSF/JPA-Hibernate-Services | 298 | FILENAME: Teste1.java | 0.294215 | package br.com.fiap.testes;
import java.util.Calendar;
import java.util.GregorianCalendar;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import br.com.fiap.dao.GrupoDAO;
import br.com.fiap.dao.ProjetoDAO;
import br.com.fiap.daoImpl.GrupoDAOImpl;
import br.com.fiap.daoImpl.ProjetoDAOImpl;
import br.com.fiap.entity.Grupo;
import br.com.fiap.entity.Projeto;
import br.com.fiap.singleton.EMSingleton;
public class Teste1 {
private static EntityManagerFactory ef;
private static EntityManager em;
public static void main(String[] args) {
ef = EMSingleton.getInst();
em = ef.createEntityManager();
GrupoDAO daoG = new GrupoDAOImpl(em);
ProjetoDAO dao = new ProjetoDAOImpl(em);
try {
daoG.cadastrar(new Grupo(0, "GDC"));
dao.cadastrar(new Projeto(0, "GenericDAO", "Fodao", new GregorianCalendar(2017, Calendar.MARCH, 3),
new GregorianCalendar(2017, Calendar.MARCH, 4), daoG.buscar(1)));
dao.salvar();
} catch (Exception e) {
e.printStackTrace();
} finally {
if (ef.isOpen()) {
ef.close();
}
}
}
}
|
b9c464ce-4e4f-44e8-a4ba-a01c8a68a24c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-09-05 23:10:57", "repo_name": "Metavenger/Sorteador", "sub_path": "/CriandoEJB1-war/src/java/web/PaginaDaSorteBean.java", "file_name": "PaginaDaSorteBean.java", "file_ext": "java", "file_size_in_byte": 985, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "4d6fd7c643d2abc244df1b007ab37b312ee848b5", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Metavenger/Sorteador | 239 | FILENAME: PaginaDaSorteBean.java | 0.292595 | /*
* 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 web;
/**
*
* @author Luiz Armando
*/
import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped;
import javax.inject.Named;
import negocio.SorteadorLocal;
@Named
@RequestScoped
public class PaginaDaSorteBean {
@EJB(name = "sorteadorBean")
private SorteadorLocal sorteadorBean;
private int valor1, valor2;
public int getNumero() {
int numero = 0;
do{
numero = sorteadorBean.getNumero();
}while(valor1 > numero || valor2 < numero);
return numero;
}
public void setValor1(int valor1){
this.valor1 = valor1;
}
public void setValor2(int valor2){
this.valor2 = valor2;
}
public int getValor1(){
return valor1;
}
public int getValor2(){
return valor2;
}
}
|
49477375-43c2-49d3-a608-42db395f4889 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-06-23 11:44:57", "repo_name": "irdi1/ManagmentSystem", "sub_path": "/src/main/java/com/ManagmentSystem/FleetApp/services/VehicleMakeService.java", "file_name": "VehicleMakeService.java", "file_ext": "java", "file_size_in_byte": 1098, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "6b390f573b424f99e1bf24d181199f4c6d687152", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/irdi1/ManagmentSystem | 215 | FILENAME: VehicleMakeService.java | 0.279042 | package com.ManagmentSystem.FleetApp.services;
import com.ManagmentSystem.FleetApp.models.Location;
import com.ManagmentSystem.FleetApp.models.VehicleMake;
import com.ManagmentSystem.FleetApp.repositories.LocationRepository;
import com.ManagmentSystem.FleetApp.repositories.VehicleMakeRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
@Service
public class VehicleMakeService {
@Autowired
private VehicleMakeRepository vehicleMakeRepository;
// Return list of states
public List<VehicleMake> getVehicleMakes() {
return vehicleMakeRepository.findAll();
}
//Save new Location
public void save(VehicleMake vehicleMake) {
vehicleMakeRepository.save(vehicleMake);
}
//Find Location by Id
public Optional<VehicleMake> findById(Integer id) {
return vehicleMakeRepository.findById(id);
}
//Delete by Location id
public void delete(Integer id) {
vehicleMakeRepository.deleteById(id);
}
}
|
8b6a2e66-2ed4-487a-8347-357f953e0f4a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-11-28 12:21:51", "repo_name": "Matirbl/Concurrente", "sub_path": "/Programación Concurrente Juli/Práctica/TPs Y TPFinal, ultima version/tp5/ej4Puente/Coche.java", "file_name": "Coche.java", "file_ext": "java", "file_size_in_byte": 971, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "05b39abbabd05da07264a73481a042330c8a62ff", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Matirbl/Concurrente | 222 | FILENAME: Coche.java | 0.252384 | /*
* 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 tp5.ej4Puente;
/**
*
*/
public class Coche implements Runnable {
private int id;
private boolean lado;//true NorteSur - false SurNorte
private PuenteSemaph recCom;
public Coche(int id, boolean lado, PuenteSemaph recCom) {
this.id = id;
this.lado = lado;
this.recCom = recCom;
}
@Override
public void run() {
while (true) {
if (lado) {
recCom.entrarNorteASur(id);
recCom.circular(id);
recCom.salirNorteASur(id);
} else {
recCom.entrarSurANorte(id);
recCom.circular(id);
recCom.salirSurANorte(id);
}
lado = !lado;
}
}
}
|
84881ba8-5ffd-4beb-b71e-6ec01feac312 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-06-12 20:01:57", "repo_name": "selimseker/CS-IntroToProgramming_II", "sub_path": "/monopoly/Card.java", "file_name": "Card.java", "file_ext": "java", "file_size_in_byte": 1041, "line_count": 53, "lang": "en", "doc_type": "code", "blob_id": "092a525b012dfc77cc30a86ad973018efe49e27a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/selimseker/CS-IntroToProgramming_II | 255 | FILENAME: Card.java | 0.246533 |
import java.util.ArrayList;
public abstract class Card extends Square{
private ArrayList<String> actions;
private int top_of_deck;
public Card(int id, ArrayList<String> action) {
super(id);
this.actions = action;
}
public void advance_to_go(Person[] player, int current_player) {
player[current_player].take_charge(200);
((Player) player[current_player]).setInstant_square(1);
player[2].pay_dept(200);
}
public void pay_card(Person[] player, int current_player, int amount) {
player[current_player].pay_dept(amount);
player[2].take_charge(amount);;
}
public void collect_card(Person[] player, int current_player, int amount) {
player[current_player].take_charge(amount);
player[2].pay_dept(amount);
}
public int getTop_of_deck() {
return top_of_deck;
}
public void setTop_of_deck(int top_of_deck) {
this.top_of_deck = top_of_deck;
}
public ArrayList<String> getAction() {
return actions;
}
public void setAction(ArrayList<String> action) {
this.actions = action;
}
}
|
ff3259c3-626c-4adc-af1e-88526dbf0a6b | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-08-21 20:27:27", "repo_name": "TechCR-Tutorial/spring_microservice_tutorial_1", "sub_path": "/microsevice_basic/src/main/java/chamly/learn/spring/microservice/config/swagger/SwaggerConfig.java", "file_name": "SwaggerConfig.java", "file_ext": "java", "file_size_in_byte": 1082, "line_count": 32, "lang": "en", "doc_type": "code", "blob_id": "4ac15f9565099273cf1b47be6813535fa546387f", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/TechCR-Tutorial/spring_microservice_tutorial_1 | 220 | FILENAME: SwaggerConfig.java | 0.218669 | package chamly.learn.spring.microservice.config.swagger;
import java.util.ArrayList;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration
@EnableSwagger2
public class SwaggerConfig {
private static final Contact DEFAULT_CONTACT = new Contact("Chamly",
"http://chamly.com", "chamlyidunil@gmail.com");
private static final ApiInfo DEFAULT_API_INFO = new ApiInfo(
"User Blog APi Documentation", "User Blog APi Documentation", "1.0",
"urn:tos", DEFAULT_CONTACT, "Apache 2.0",
"http://www.apache.org/licenses/LICENSE-2.0",
new ArrayList<>());
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(DEFAULT_API_INFO);
}
}
|
6410037a-4f6c-481e-9c3c-3b70116f1c5b | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-09-26 04:06:39", "repo_name": "ceparadise/IntrermingualLang", "sub_path": "/data/maven/sourceCode/maven-plugins/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/AbstractPluginMojo.java", "file_name": "AbstractPluginMojo.java", "file_ext": "java", "file_size_in_byte": 1077, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "9a1dfbc9f3e5c271e20d5670f366546a3e146f2d", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ceparadise/IntrermingualLang | 174 | FILENAME: AbstractPluginMojo.java | 0.276691 | package org.apache.maven.plugin.plugin;
import org.apache.maven.plugin.AbstractPlugin;
import org.apache.maven.plugin.PluginExecutionRequest;
import org.apache.maven.plugin.PluginExecutionResponse;
import java.io.File;
/**
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
* @version $Id$
*/
public abstract class AbstractPluginMojo
extends AbstractPlugin
{
protected File getJarFile( PluginExecutionRequest request )
{
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
String outputDirectory = (String) request.getParameter( "outputDirectory" );
String jarName = (String) request.getParameter( "jarName" );
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
File jarFile = new File( new File( outputDirectory ), jarName + ".jar" );
return jarFile;
}
}
|
cb008f60-c469-4ab6-b40a-4868457010b2 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2023-03-16 05:15:28", "repo_name": "YaodanZhang/code-kata", "sub_path": "/word-wrap/src/main/java/com/thoughtworks/kata/word/Wrap.java", "file_name": "Wrap.java", "file_ext": "java", "file_size_in_byte": 978, "line_count": 35, "lang": "en", "doc_type": "code", "blob_id": "ac0c8055a0054c6477f04a1ea119c01e1fd7a363", "star_events_count": 3, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/YaodanZhang/code-kata | 215 | FILENAME: Wrap.java | 0.221351 | package com.thoughtworks.kata.word;
import com.google.common.base.Joiner;
import java.util.List;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Splitter.fixedLength;
import static com.google.common.base.Splitter.on;
import static com.google.common.collect.Lists.newArrayList;
public class Wrap {
private static final Joiner JOINER = Joiner.on("|");
public String wrap(String word, int size) {
checkArgument(size > 0);
if (word == null) {
return "";
}
if (word.length() <= size) {
return word;
}
if (!word.contains(" ")) {
return JOINER.join(fixedLength(size).split(word));
}
List<String> splitOnSpace = newArrayList(on(" ").omitEmptyStrings().split(word));
for (int lineEnd = 1, lineBegin = 0; lineEnd < splitOnSpace.size(); lineEnd++) {
}
return JOINER.join(splitOnSpace);
}
}
|
77bbe2fa-21b3-4647-a024-f66fe4826804 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-05-12 13:27:44", "repo_name": "289281335/Ticy_01", "sub_path": "/bigdata-application/src/main/java/com/sunmnet/bigdata/web/service/basedata/impl/DictCourseServiceImpl.java", "file_name": "DictCourseServiceImpl.java", "file_ext": "java", "file_size_in_byte": 978, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "57aa146dab39f7d19e34f1788efe034ef846f099", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/289281335/Ticy_01 | 249 | FILENAME: DictCourseServiceImpl.java | 0.242206 | /*
* Copyright (c) 2018-2046, sunmnet Inc. All Rights Reserved.
*
* Project Name: bigdata
* date: 2018-01-30 09:48:58
*/
package com.sunmnet.bigdata.web.service.basedata.impl;
import com.sunmnet.bigdata.web.dao.basedata.IDictCourseDAO;
import com.sunmnet.bigdata.web.model.entity.basedata.DictCourse;
import com.sunmnet.bigdata.web.service.basedata.IDictCourseService;
import com.sunmnet.bigdata.common.service.impl.BaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.Serializable;
/**
* @author wdong
* @version 1.0
* @ClassName DictCourseServiceImpl
* @Description
* @date 2018-01-30 09:48:58
*/
@Transactional
@Service("DictCourseServiceImpl")
public class DictCourseServiceImpl implements IDictCourseService{
@Autowired
private IDictCourseDAO dictCourseDAO;
}
|
538be869-4bdc-4b6b-8a01-445a9bd5d4d4 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-04-23 10:16:36", "repo_name": "dwikibayu/BiroPerjalanan", "sub_path": "/BiroPerjalanan/src/Models/Pelanggan.java", "file_name": "Pelanggan.java", "file_ext": "java", "file_size_in_byte": 1097, "line_count": 50, "lang": "en", "doc_type": "code", "blob_id": "2c9560a805604fd8c4231842ba227f1b18c17869", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/dwikibayu/BiroPerjalanan | 252 | FILENAME: Pelanggan.java | 0.26971 | package Models;
/*
* 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.
*/
/**
*
* @author dwiki
*/
public class Pelanggan extends Orang{
private String nama;
private String idPelanggan;
private String noHP;
private String kota;
public Pelanggan(String nama, String idPelanggan, String noHP) {
super(nama, noHP);
this.idPelanggan = idPelanggan;
}
public void setIdPelanggan(String idPelanggan) {
this.idPelanggan = idPelanggan;
}
public void setKota(String kota) {
this.kota = kota;
}
public String getIdPelanggan() {
return idPelanggan;
}
public String getKota() {
return kota;
}
@Override
public void displayInfo(){
System.out.println("ID : "+getIdPelanggan());
System.out.println("Nama : "+ super.getNama());
System.out.println("No. HP : "+ super.getNoHP());
}
}
|
fcb5211f-6fcb-4519-bb0e-d3412e2dcef6 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-05-27 08:32:57", "repo_name": "BramTeurlings/GraduationProject2020", "sub_path": "/domain/src/main/java/nl/brickx/domain/Models/MainMenuRecyclerModel.java", "file_name": "MainMenuRecyclerModel.java", "file_ext": "java", "file_size_in_byte": 1049, "line_count": 48, "lang": "en", "doc_type": "code", "blob_id": "07f374028285a80b3321efb8746e7a0d16d29bbe", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/BramTeurlings/GraduationProject2020 | 202 | FILENAME: MainMenuRecyclerModel.java | 0.208179 | package nl.brickx.domain.Models;
import android.graphics.drawable.Drawable;
public class MainMenuRecyclerModel {
private String title;
private Drawable image;
private MenuItemIdentifier identifier;
public MainMenuRecyclerModel() {
}
public MainMenuRecyclerModel(String title, Drawable image) {
this.title = title;
this.image = image;
}
public MainMenuRecyclerModel(String title, Drawable image, MenuItemIdentifier identifier) {
this.title = title;
this.image = image;
this.identifier = identifier;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public Drawable getImage() {
return image;
}
public void setImage(Drawable image) {
this.image = image;
}
public MenuItemIdentifier getIdentifier() {
return identifier;
}
public void setIdentifier(MenuItemIdentifier identifier) {
this.identifier = identifier;
}
}
|
c7fd2da0-2b06-4e69-9510-4d315b943074 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-03-26 09:15:01", "repo_name": "CodeFire-210117/JavaMovieDB", "sub_path": "/src/ua/com/codefire/domain/Film.java", "file_name": "Film.java", "file_ext": "java", "file_size_in_byte": 1037, "line_count": 48, "lang": "en", "doc_type": "code", "blob_id": "80c0dee6ab4f961dbd3a703e4c3775941fd04ae5", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/CodeFire-210117/JavaMovieDB | 220 | FILENAME: Film.java | 0.235108 | package ua.com.codefire.domain;
import java.time.LocalDate;
/**
* Created by human on 3/26/17.
*/
public class Film {
private long id;
private String originTitle;
private double voteAverage;
private LocalDate releaseDate;
public Film(long id, String originTitle, double voteAverage, LocalDate releaseDate) {
this.id = id;
this.originTitle = originTitle;
this.voteAverage = voteAverage;
this.releaseDate = releaseDate;
}
public long getId() {
return id;
}
public String getOriginTitle() {
return originTitle;
}
public double getVoteAverage() {
return voteAverage;
}
public LocalDate getReleaseDate() {
return releaseDate;
}
@Override
public String toString() {
return "Film{" +
"id=" + id +
", originTitle='" + originTitle + '\'' +
", voteAverage=" + voteAverage +
", releaseDate=" + releaseDate +
'}';
}
}
|
2c48f9fc-3f4a-4c7f-8c03-b0391f495aa4 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2020-02-29T00:57:06", "repo_name": "djrcoder/tech-talk-image", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1077, "line_count": 22, "lang": "en", "doc_type": "text", "blob_id": "41a7328050ed1ae721ca15ec0346d2bc0b13e7bc", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/djrcoder/tech-talk-image | 237 | FILENAME: README.md | 0.29584 | # Tech Talk - "A brief introduction to image recognition"
Here are some examples of code that I used to explore my tech talk topic "A brief introduction to image recognition"
The python code was used to explore examples of feature recognition techniques.
The vision folder contains a very simple react app which features pictures which on clicking will make a call to the google vision API
service and will get back the results.
If you would like to use the vision example, you will need to create a google cloud account and generate an API key for google vision.
Once you have done that, add it to the area outlined in src/config/environment.js
Lastly, to get some images to display, create a new image bucket on google api and add each image link to src/config/app.js in the
image array on line 15.
Some resources to help you get started:
https://cloud.google.com/vision/docs/quickstart
Tutorials used for ResNet and using CNNs
https://colab.research.google.com/github/SalChem/Fastai-iNotes-iTutorials/blob/master/Image_Recognition_Basics.ipynb#scrollTo=xHtBFQBLNFie
|
2c7f5bb2-6aaf-490d-bbef-a22df73582c9 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2023-04-14 19:19:41", "repo_name": "TrxyyDev/AlternativeAPI", "sub_path": "/src/main/java/fr/trxyy/alternative/alternative_apiv2/assets/AssetIndexInfo.java", "file_name": "AssetIndexInfo.java", "file_ext": "java", "file_size_in_byte": 987, "line_count": 59, "lang": "en", "doc_type": "code", "blob_id": "98fddd668b476d8102ca8b00b6a9e96e7134fd7c", "star_events_count": 26, "fork_events_count": 29, "src_encoding": "UTF-8"} | https://github.com/TrxyyDev/AlternativeAPI | 269 | FILENAME: AssetIndexInfo.java | 0.275909 | package fr.trxyy.alternative.alternative_apiv2.assets;
import fr.trxyy.alternative.alternative_apiv2.minecraft.json.DownloadInfo;
/**
* @author Trxyy
*/
public class AssetIndexInfo extends DownloadInfo {
/**
* The assetIndex
*/
protected String id;
/**
* The total size of all Objects
*/
protected long totalSize;
/**
* Is known
*/
protected boolean known = true;
/**
* The Constructor
*/
public AssetIndexInfo() {
}
/**
* The Constructor
* @param id_ The assetIndex id
*/
public AssetIndexInfo(String id_) {
this.id = id_;
this.url = constantURL("https://s3.amazonaws.com/Minecraft.Download/indexes/" + id + ".json");
this.known = false;
}
/**
* @return The total size
*/
public long getTotalSize() {
return this.totalSize;
}
/**
* @return The assetIndex id
*/
public String getId() {
return this.id;
}
/**
* @return If the Size and Hash is known
*/
public boolean sizeAndHashKnown() {
return this.known;
}
}
|
e3e3da28-69af-45f5-b067-7362604f878e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2015-02-11T16:39:34", "repo_name": "epitty1023/puppet-modules", "sub_path": "/sysctl/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1084, "line_count": 28, "lang": "en", "doc_type": "text", "blob_id": "588c43bd562b319cab426b3ab9b67675cab92ab8", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/epitty1023/puppet-modules | 264 | FILENAME: README.md | 0.280616 | # puppet-sysctl
## Overview
Manage sysctl variable values. All changes are immediately applied, as well as
configured to become persistent. Tested on Red Hat Enterprise Linux 6.
* `sysctl` : Definition to manage sysctl variables by setting a value.
* `sysctl::base` : Base class, included from the main definition.
For persistence to work, your Operating System needs to support looking for
sysctl configuration inside `/etc/sysctl.d/`. When using this module, the
existing content of this directory will be purged, so be careful if you
have already put content there.
Beware also that for the purge to work, you need to either have at least one
sysctl definition call left for the node, or include `sysctl::base` manually.
You can also force a value to `ensure => absent`, which will always work.
For the few original settings in the main `/etc/sysct.conf` file, the value is
replaced so that running `sysctl -p` doesn't revert any change made by puppet.
## Examples
sysctl { 'net.ipv4.ip_forward': value => '1' }
sysctl { 'net.core.somaxconn': value => '65536' }
|
599150c3-10a1-4643-948b-efbdddbb561d | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-05-31 05:54:54", "repo_name": "hoang06kx1/movie-database", "sub_path": "/app/src/test/java/nguyen/hoang/movierating/TestParseApplication.java", "file_name": "TestParseApplication.java", "file_ext": "java", "file_size_in_byte": 1051, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "829ef4dbb76da821df642edf14014b2792632add", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/hoang06kx1/movie-database | 222 | FILENAME: TestParseApplication.java | 0.26588 | package nguyen.hoang.movierating;
import android.content.Context;
import javax.inject.Singleton;
import nguyen.hoang.movierating.di.DaggerMockParseWrapperComponent;
import nguyen.hoang.movierating.di.DaggerParseWrapperComponent;
import nguyen.hoang.movierating.di.MockParseWrapperModule;
import nguyen.hoang.movierating.di.ParseWrapperComponent;
/**
* Created by Hoang on 12/14/2015.
*/
public class TestParseApplication extends ParseApplication {
@Override
public void onCreate() {
super.onCreate();
}
@Override
protected void enableParseLocalDatastore(Context context) {
// Parse.enableLocalDatastore(context);
}
private final ParseWrapperComponent component = createComponent();
ParseWrapperComponent createComponent() {
return DaggerMockParseWrapperComponent.builder()
.mockParseWrapperModule(new MockParseWrapperModule())
.build();
}
@Override
public ParseWrapperComponent getParseWrapperComponent() {
return component;
}
}
|
a4a44f37-4e3c-47d4-90a9-1591790e3e55 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2022-12-07 22:24:34", "repo_name": "Androoideka/GeRuDok", "sub_path": "/src/exceptions/OpenException.java", "file_name": "OpenException.java", "file_ext": "java", "file_size_in_byte": 973, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "8d3307060adb12dd25750da545742d973dad53e3", "star_events_count": 2, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Androoideka/GeRuDok | 170 | FILENAME: OpenException.java | 0.250913 | package exceptions;
import javax.swing.JOptionPane;
import helpers.LoadFailCause;
public class OpenException extends OptionException {
private OpenException(String title) {
super(title, "Would you like to try opening a different file?",
JOptionPane.ERROR_MESSAGE,
JOptionPane.YES_NO_OPTION);
}
public static OptionException create(LoadFailCause cause, String type) {
String title;
switch (cause) {
case FileNotFound:
title = "Selected file does not exist";
break;
case ClassNotFound:
title = "Selected file is not a recognised format";
break;
case WrongClass:
title = "Selected file is not a " + type;
break;
default:
title = "Selected file is inaccessible";
break;
}
return new OpenException(title);
}
}
|
3bfb8fd5-6af0-415f-8486-baae7fdc6ba9 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-09-24 23:22:00", "repo_name": "cgoulding/core-amqp-parent", "sub_path": "/core-messaging/src/main/java/com/monadiccloud/core/amqp/retrypolicy/ResponseMessageRetryPolicy.java", "file_name": "ResponseMessageRetryPolicy.java", "file_ext": "java", "file_size_in_byte": 1023, "line_count": 27, "lang": "en", "doc_type": "code", "blob_id": "c4a435ea361be466c3dba13846b7237e1b5580c7", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/cgoulding/core-amqp-parent | 199 | FILENAME: ResponseMessageRetryPolicy.java | 0.23231 | package com.monadiccloud.core.amqp.retrypolicy;
import com.monadiccloud.core.amqp.retrypolicy.exception.ResponseMessageException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.retry.RetryContext;
import org.springframework.retry.policy.SimpleRetryPolicy;
public class ResponseMessageRetryPolicy extends SimpleRetryPolicy {
private static final Logger log = LoggerFactory.getLogger(ResponseMessageRetryPolicy.class);
@Override
public boolean canRetry(RetryContext context) {
Throwable t = context.getLastThrowable();
if (t instanceof ResponseMessageException) {
int maxRetryCount = ((ResponseMessageException) t).getMaxRetryCount();
return context.getRetryCount() < maxRetryCount;
}
log.warn(
"Policy is used for a wrong exception: {}. Falling back to SimpleRetryPolicy.",
(t == null ? null : t.getClass().getSimpleName())
);
return super.canRetry(context);
}
}
|
e5d59c0d-7bc1-4c1a-9fee-7c13d43877ec | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-06-30 01:59:39", "repo_name": "AndyZhang1105/spring-cloud-demo", "sub_path": "/service-hystrix/src/main/java/com/zz/cloud/service/hystrix/controller/HelloController.java", "file_name": "HelloController.java", "file_ext": "java", "file_size_in_byte": 969, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "03bbf4da279e75087e53b0867ced9b1c61d54aa0", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/AndyZhang1105/spring-cloud-demo | 182 | FILENAME: HelloController.java | 0.218669 | package com.zz.cloud.service.hystrix.controller;
import com.zz.cloud.service.hystrix.service.HelloService;
import com.zz.cloud.service.hystrix.service.ServiceHello;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping(path = "/hello")
public class HelloController {
@Autowired
HelloService helloService;
@GetMapping(value = "/hiFromRibbon")
public String hiFromRibbon(@RequestParam String name) {
return helloService.hiService( name );
}
@Autowired
ServiceHello serviceHello;
@GetMapping(value = "/hiFromFeign")
public String hiFromFeign(@RequestParam String name) {
return serviceHello.sayHiFromClientOne(name);
}
}
|
59f80e7d-dd8c-400b-b5fa-0a3f31f5407a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-03-02 12:41:47", "repo_name": "xjodoin/vshield", "sub_path": "/src/main/java/co/vshield/api/ScanApiEndPoint.java", "file_name": "ScanApiEndPoint.java", "file_ext": "java", "file_size_in_byte": 1100, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "b9d3997ea88fa88a9c170f0835183f7b71543c77", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/xjodoin/vshield | 223 | FILENAME: ScanApiEndPoint.java | 0.264358 | package co.vshield.api;
import java.util.concurrent.Callable;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import co.vshield.ScanResult;
import co.vshield.ScanResult.StatusEnum;
import fi.solita.clamav.ClamAVClient;
@RestController
public class ScanApiEndPoint implements ScanApi {
@Value("${clamd.host}")
private String hostname;
@Value("${clamd.port}")
private int port;
@Override
public Callable<ResponseEntity<ScanResult>> scanPost(MultipartFile file) throws NotFoundException {
return () -> {
ClamAVClient client = new ClamAVClient(hostname, port);
byte[] result = client.scan(file.getInputStream());
ScanResult scanResult = new ScanResult();
StatusEnum status = ClamAVClient.isCleanReply(result) ? StatusEnum.OK : StatusEnum.FOUND;
scanResult.setStatus(status);
return ResponseEntity.status(HttpStatus.OK).body(scanResult);
};
}
}
|
2dae4759-d862-4e6c-9263-64bbf00c2a0b | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2014-07-01 06:23:18", "repo_name": "jiancom/magic", "sub_path": "/src/main/java/com/resgain/base/entity/UserRole.java", "file_name": "UserRole.java", "file_ext": "java", "file_size_in_byte": 1139, "line_count": 54, "lang": "en", "doc_type": "code", "blob_id": "f82a9de9fbb681dd6f69f1ecb131ca2ffba0931b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/jiancom/magic | 246 | FILENAME: UserRole.java | 0.246533 | package com.resgain.base.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import com.resgain.base.abs.AbstractPersistentObject;
import com.resgain.base.annotation.Desc;
import com.resgain.base.annotation.Label;
/**
* 用户角色关联表实体类
* @author gyl
*/
@Entity
@Table(name = "BASE_USER_ROLE")
@Desc("用户角色关联")
public class UserRole extends AbstractPersistentObject
{
private static final long serialVersionUID = 1L;
@Column(name="USER_ID")
@Label(name = "用户ID", nullFlag = false)
private String userId;
@Column(name="ROLE_ID")
@Label(name = "角色ID", nullFlag = false)
private String roleId;
public UserRole() {
super();
}
public UserRole(String userId, String roleId) {
super();
this.userId = userId;
this.roleId = roleId;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getRoleId() {
return roleId;
}
public void setRoleId(String roleId) {
this.roleId = roleId;
}
} |
661f4e6e-f3ba-439f-ae59-78c9e543172b | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-06-12 03:33:01", "repo_name": "DevDavidGra/0608", "sub_path": "/src/problemController/part04/ProblemContorller.java", "file_name": "ProblemContorller.java", "file_ext": "java", "file_size_in_byte": 970, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "05a4e3f228a24ec82707dfe89d13425678019647", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/DevDavidGra/0608 | 170 | FILENAME: ProblemContorller.java | 0.27513 | package problemController.part04;
import java.io.IOException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/problem")
public class ProblemContorller extends HttpServlet{
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
RequestDispatcher dis = req.getRequestDispatcher("/servletview/part04/form.jsp");
dis.forward(req, resp);
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
req.setCharacterEncoding("utf-8");
req.setAttribute("res", req.getParameter("ko"));
RequestDispatcher dis = req.getRequestDispatcher("/servletview/part04/result.jsp");
dis.forward(req, resp);
}
}
|
da2d5c8a-44bd-4bdc-822e-ad43eb39efc4 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-09-29 09:57:25", "repo_name": "alphagov/pay-direct-debit-connector", "sub_path": "/src/main/java/uk/gov/pay/directdebit/payments/api/ExternalPaymentState.java", "file_name": "ExternalPaymentState.java", "file_ext": "java", "file_size_in_byte": 972, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "e6c52e9174eb8f1de1e5474c45103bdb82c9ecf6", "star_events_count": 6, "fork_events_count": 8, "src_encoding": "UTF-8"} | https://github.com/alphagov/pay-direct-debit-connector | 199 | FILENAME: ExternalPaymentState.java | 0.208179 | package uk.gov.pay.directdebit.payments.api;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum ExternalPaymentState {
EXTERNAL_CREATED("created"),
EXTERNAL_PENDING("pending"),
EXTERNAL_SUCCESS("success"),
EXTERNAL_FAILED("failed"),
EXTERNAL_CANCELLED("cancelled"),
EXTERNAL_PAID_OUT("paidout"),
EXTERNAL_INDEMNITY_CLAIM("indemnityclaim"),
EXTERNAL_ERROR("error");
@JsonProperty("status")
private final String status;
ExternalPaymentState(String status) {
this.status = status;
}
public String getStatus() {
return status;
}
@Override
public String toString() {
return "ExternalPaymentState{" +
"status='" + status + '\'' +
'}';
}
}
|
eb34c431-e2be-40b0-908b-1467501aa886 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2018-08-28T02:44:42", "repo_name": "navinramsaroop/Outbreak", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 974, "line_count": 20, "lang": "en", "doc_type": "text", "blob_id": "8eace139d288888e8e0eae581e015b4d67a86f68", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/navinramsaroop/Outbreak | 247 | FILENAME: README.md | 0.286169 | # Outbreak
<img src="https://github.com/navinramsaroop/Outbreak/blob/master/outbreak.gif" />
## Summary
##### Single-player avoiding-enemies game made in Java
Welcome to Outbreak! Bear with the glitches.... Use the arrow keys to move your player around! Avoid all the enemies (anything rectangular = AVOID). You have a certain amount of health, and once all your health is gone the game is over. You can go to the store to upgrade your player, and you can change players during the game with the 1, 2, 3, 4, and 5 keys. Finally, you can shoot bullets at enemies that have a health bar on top of them (Enemies without a health bar CANNOT be killed, only avoided)
## Controls
1. w = shoot bullets up
2. a = shoot bullets left
3. s = shoot bullets down
4. d = shoot bullets left
5. arrow keys: move player around
6. Space: Pause Game
7. number keys 1-5: switch players during the game
## How to Start Game
Run `java -jar Outbreak.jar` while in the Outbreak directory
|
92c05435-b7f2-4b19-bb34-f7d8db0e7403 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-02-16 09:53:50", "repo_name": "JGSPL/BayerRewards", "sub_path": "/app/src/main/java/com/bayer/bayerreward/GetterSetter/product_achived_planned.java", "file_name": "product_achived_planned.java", "file_ext": "java", "file_size_in_byte": 997, "line_count": 48, "lang": "en", "doc_type": "code", "blob_id": "d49b6a31e580eae108d0064ef12eac7d68835cd6", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/JGSPL/BayerRewards | 208 | FILENAME: product_achived_planned.java | 0.233706 | package com.bayer.bayerreward.GetterSetter;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class product_achived_planned {
public String getProduct_name() {
return product_name;
}
public void setProduct_name(String product_name) {
this.product_name = product_name;
}
public String getPlanned_volume() {
return planned_volume;
}
public void setPlanned_volume(String planned_volume) {
this.planned_volume = planned_volume;
}
public String getAchived_volume() {
return achived_volume;
}
public void setAchived_volume(String achived_volume) {
this.achived_volume = achived_volume;
}
@SerializedName("product_name")
@Expose
private String product_name;
@SerializedName("planned_volume")
@Expose
private String planned_volume;
@SerializedName("achived_volume")
@Expose
private String achived_volume;
}
|
37d2e079-b43b-47cb-ad55-e3bd3af819e7 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-09-02 10:49:28", "repo_name": "AlekseyMikaelyan/programming-courses", "sub_path": "/src/main/java/org/example/programmingcourses/entity/Group.java", "file_name": "Group.java", "file_ext": "java", "file_size_in_byte": 1033, "line_count": 57, "lang": "en", "doc_type": "code", "blob_id": "865368fb3614a7ce3154c5ea997c0a36d476cba9", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/AlekseyMikaelyan/programming-courses | 215 | FILENAME: Group.java | 0.255344 | package org.example.programmingcourses.entity;
import org.example.programmingcourses.entity.abstr.AbstractEntity;
import javax.persistence.*;
@Entity
@Table(name = "groups")
public class Group extends AbstractEntity {
@Column
private String name;
@ManyToOne
@JoinColumn(name = "course_id")
private Course course;
@ManyToOne
@JoinColumn(name = "teacher_id")
private Teacher teacher;
public Group() {
}
public Group(String name, Course course, Teacher teacher) {
this.name = name;
this.course = course;
this.teacher = teacher;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Course getCourse() {
return course;
}
public void setCourse(Course course) {
this.course = course;
}
public Teacher getTeacher() {
return teacher;
}
public void setTeacher(Teacher teacher) {
this.teacher = teacher;
}
}
|
568012be-ed38-4e1e-a32f-29aff08e6c43 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-05-10 03:54:25", "repo_name": "yrd47/java_learn", "sub_path": "/Work_training/TestNGListener/src/main/java/testnglistener/model/StackTrace.java", "file_name": "StackTrace.java", "file_ext": "java", "file_size_in_byte": 1234, "line_count": 57, "lang": "en", "doc_type": "code", "blob_id": "037550e102320577571c8042be3c01a00f1d3fbd", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/yrd47/java_learn | 248 | FILENAME: StackTrace.java | 0.226784 | package testnglistener.model;
/**
* Created by yrd on 2017/5/24.
*/
public class StackTrace {
private String declaringClass;
private String methodName;
private String fileName;
private String lineNumber;
public StackTrace() {
super();
}
public StackTrace(String declaringClass, String methodName, String fileName, String lineNumber) {
super();
this.declaringClass = declaringClass;
this.methodName = methodName;
this.fileName = fileName;
this.lineNumber = lineNumber;
}
public String getDeclaringClass() {
return declaringClass;
}
public void setDeclaringClass(String declaringClass) {
this.declaringClass = declaringClass;
}
public String getMethodName() {
return methodName;
}
public void setMethodName(String methodName) {
this.methodName = methodName;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getLineNumber() {
return lineNumber;
}
public void setLineNumber(String lineNumber) {
this.lineNumber = lineNumber;
}
}
|
b95bfd7b-cd4e-4757-b78b-530942682c28 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-10-19 16:50:00", "repo_name": "YasinZhangX/ieeextreme-practice", "sub_path": "/src/main/java/com/yasin/practice/solution3/Path.java", "file_name": "Path.java", "file_ext": "java", "file_size_in_byte": 1066, "line_count": 54, "lang": "en", "doc_type": "code", "blob_id": "d55d6d1a1e193670b581053f3d29b63248002923", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/YasinZhangX/ieeextreme-practice | 237 | FILENAME: Path.java | 0.281406 | package com.yasin.practice.solution3;
import java.util.List;
import java.util.Vector;
/**
* @author Yasin Zhang
*/
public class Path {
private List<Vertex> vertexList = new Vector<>();
private Long rate = -1L;
public Path(List<Vertex> vertexList, long rate) {
this.vertexList = vertexList;
this.rate = rate;
}
public List<Vertex> getVertexList() {
return vertexList;
}
public void setVertexList(List<Vertex> vertexList) {
this.vertexList = vertexList;
}
public long getRate() {
return rate;
}
public void setRate(long rate) {
this.rate = rate;
}
@Override
public boolean equals(Object right) {
if(right instanceof Path)
{
Path r_path = (Path) right;
return vertexList.equals(r_path.vertexList);
}
return false;
}
@Override
public int hashCode() {
return vertexList.hashCode();
}
public String toString() {
return vertexList.toString() + ":" + rate;
}
}
|
70650735-6e6f-47c9-b48c-e8d8c82508a4 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-11-22 19:08:36", "repo_name": "ZCW-Java6dot2/talking-pets-msanzar1", "sub_path": "/src/main/java/io/zipcoder/polymorphism/Pet.java", "file_name": "Pet.java", "file_ext": "java", "file_size_in_byte": 974, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "c8c63ac685a102030afd44e8e9ce03ccce984355", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ZCW-Java6dot2/talking-pets-msanzar1 | 216 | FILENAME: Pet.java | 0.264358 | package io.zipcoder.polymorphism;
public class Pet implements Comparable<Pet>{
private String name;
public Pet (String name) {
this.name = name;
}
public Pet (String name, String type) {
this.name = name;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String speak() {
return "<Insert generic animal noise>";
}
public String outputPet () {
String[] className;
className = this.getClass().getName().split("\\.");
return String.format("Pet: %s Type: %s Says: %s", this.getName(), className[className.length-1], this.speak());
}
public int compareTo(Pet pet2) {
if (!this.name.equals(pet2.getName())) {
return this.name.compareTo(pet2.getName());
} else {
return this.getClass().getName().compareTo(pet2.getClass().getName());
}
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.