blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
9e8338f974beb2b614f27074c040a9d1c3985b3a | 8dd2f72ff99b37b206f9c5f57a9f9c7690a048d7 | /hotelonlinereservation/src/main/java/com/ls/UserRegistration/Controller/RegistrationController.java | b5b09a656c7f28179ad4c8c4f7737fea8a14b6aa | [] | no_license | xiaoqiangouba/biyesheji | 98828fe040422d7ad767c94337d24c074c235de8 | ee68be60e989a9f7ba55685452a2a702915714a5 | refs/heads/master | 2021-01-24T10:53:31.222951 | 2018-04-19T07:46:03 | 2018-04-19T07:46:03 | 118,417,515 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,482 | java | package com.ls.UserRegistration.Controller;
import com.ls.UserRegistration.Service.UserService;
import com.ls.UserRegistration.pojo.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
/**
* @author chenqiang
* 用户注册控制器
*/
@Controller
@RequestMapping("/RegistrationController")
public class RegistrationController {
@Autowired
UserService userService;
/**
* @param userName 用户名
* @return
* @verifyUserName 检验用户名
*/
@ResponseBody
@RequestMapping(value = "/verifyUserName",method= RequestMethod.POST)
public boolean verifyUserName(@RequestParam("userName") String userName){
boolean cunt=userService.verifyUserName(userName);
return cunt;
}
/**
*
* @param email 邮箱
* @return 检验邮箱
*/
@ResponseBody
@RequestMapping(value = "/verifyEmail",method= RequestMethod.POST)
public boolean verifyEmail(@RequestParam("email") String email){
boolean cunt=userService.verifyEmail(email);
return cunt;
}
/**
* 用户注册
* @param user 用户实体类
* @return 注册结果
*/
@ResponseBody
@RequestMapping(value = "/registrationUser",method= RequestMethod.POST)
public boolean registrationUser(User user){
//生成id
String uuid = UUID.randomUUID().toString().replaceAll("-", "");
user.setId(uuid);
String salt = ShiroKit.getRandomSalt(5);
String pwdMd5 = ShiroKit.md5(user.getPassword(), salt);
user.setPassword(pwdMd5);
user.setSalt(salt);
int cunt= userService.saveUser(user);
if(cunt==1){
return true;
}else{
return false;
}
}
/**
* 用户登录
* @param user
* @return
*/
@ResponseBody
@RequestMapping(value = "/userLogin",method= RequestMethod.POST)
public Msg userLogin(User user){
boolean cout=userService.userLogin(user);
if(cout==true){
String id=userService.getId(user);
Map<String, Object> loginInfo = new HashMap<String,Object>();
loginInfo.put("userId",id);
String sessionId = JavaWebToken.createJavaWebToken(loginInfo);
return Msg.success().add("id", sessionId);
}
return Msg.fail();
}
/**
* 根据id查询用户姓名
* @param id
* @return
*/
@ResponseBody
@RequestMapping(value ="/getName",method = {RequestMethod.GET,RequestMethod.POST})
public Msg getName(HttpServletRequest request, @RequestParam("id") String id){
//System.out.println(id);
//从session拿到token,再解密得到userid
try {
String userId = AuthUtil.getUserId(id);
User list= userService.getName(userId);
return Msg.success().add("list",list);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* 跟据邮箱改密码
* @param user
* @return
*/
@ResponseBody
@RequestMapping(value ="/updataPassword",method = RequestMethod.POST)
public int updataPassword(User user){
int n= userService.updataPassword(user);
return n;
}
}
| [
"[email protected]"
] | |
eb5ef60ab0cfbffe723800202cc91f79d0e0cff1 | 1e63f0f4aaf00131f62949d1a364dbf635a3569a | /reckoner-content-services/src/main/java/com/reckonlabs/reckoner/contentservices/repo/UserRepoCustom.java | 35e85777829725fe3bff5655160185c713d1fe65 | [] | no_license | dankoch/reckoner-parent | d9f5c7d19bc3b5845243e7a5ad17dd2eec29bec6 | 4b29c1684c7aa4a1a26e6d99ad463c6d0daea17e | refs/heads/master | 2021-01-01T06:33:18.403690 | 2013-06-24T03:57:54 | 2013-06-24T03:57:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 370 | java | package com.reckonlabs.reckoner.contentservices.repo;
import java.util.List;
import com.reckonlabs.reckoner.domain.user.User;
public interface UserRepoCustom {
public void insertNewUser (User user);
public void updateUser (User user);
public List<User> getUserSummaries(Boolean active,
String sortBy, Boolean ascending,
Integer page, Integer size);
}
| [
"[email protected]"
] | |
6b80a0575f36dd21640d3ba127067cbbf74fe9ab | e63363389e72c0822a171e450a41c094c0c1a49c | /Mate20_9_0_0/src/main/java/com/android/server/hidata/histream/HwHistreamCHRMachineInfo.java | 11e81173349796d8d6dda21d8e15fcbed4429cde | [] | no_license | solartcc/HwFrameWorkSource | fc23ca63bcf17865e99b607cc85d89e16ec1b177 | 5b92ed0f1ccb4bafc0fdb08b6fc4d98447b754ad | refs/heads/master | 2022-12-04T21:14:37.581438 | 2020-08-25T04:30:43 | 2020-08-25T04:30:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,663 | java | package com.android.server.hidata.histream;
import com.android.server.hidata.appqoe.HwAPPQoEUtils;
public class HwHistreamCHRMachineInfo {
public String mApkName = HwAPPQoEUtils.INVALID_STRING_VALUE;
public int mCellQuality = -1;
public int mCellSig = -1;
public int mCellSinr = -1;
public int mChLoad = -1;
public int mNetDlTup = -1;
public int mNetRtt = -1;
public int mRAT = -1;
public int mRxTup1Bef = -1;
public int mRxTup2Bef = -1;
public int mScenario = -1;
public int mStreamQoe = -1;
public int mTxFail1Bef = -1;
public int mTxFail2Bef = -1;
public int mWechatVideoQoe = -1;
public int mWifiRssi = -1;
public int mWifiSnr = -1;
public void printCHRMachineInfo() {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("printCHRMachineInfo mApkName = ");
stringBuilder.append(this.mApkName);
stringBuilder.append(" mScenario = ");
stringBuilder.append(this.mScenario);
stringBuilder.append(" mRxTup1Bef = ");
stringBuilder.append(this.mRxTup1Bef);
stringBuilder.append(" mRxTup2Bef = ");
stringBuilder.append(this.mRxTup2Bef);
stringBuilder.append(" mScenario = ");
stringBuilder.append(this.mScenario);
stringBuilder.append(" mChLoad = ");
stringBuilder.append(this.mChLoad);
stringBuilder.append(" mTxFail1Bef = ");
stringBuilder.append(this.mTxFail1Bef);
stringBuilder.append(" mTxFail2Bef = ");
stringBuilder.append(this.mTxFail2Bef);
stringBuilder.append(" mStreamQoe = ");
stringBuilder.append(this.mStreamQoe);
stringBuilder.append(" mWechatVideoQoe = ");
stringBuilder.append(this.mWechatVideoQoe);
stringBuilder.append(" mRAT = ");
stringBuilder.append(this.mRAT);
stringBuilder.append(" mWifiRssi = ");
stringBuilder.append(this.mWifiRssi);
stringBuilder.append(" mWifiSnr = ");
stringBuilder.append(this.mWifiSnr);
stringBuilder.append(" mWifiSnr = ");
stringBuilder.append(this.mWifiSnr);
stringBuilder.append(" mCellSig = ");
stringBuilder.append(this.mCellSig);
stringBuilder.append(" mCellQuality = ");
stringBuilder.append(this.mCellQuality);
stringBuilder.append(" mCellSinr = ");
stringBuilder.append(this.mCellSinr);
stringBuilder.append(" mNetDlTup = ");
stringBuilder.append(this.mNetDlTup);
stringBuilder.append(" mNetRtt = ");
stringBuilder.append(this.mNetRtt);
HwHiStreamUtils.logD(stringBuilder.toString());
}
}
| [
"[email protected]"
] | |
63b92799baf27dfb05bf94f2797604b3efb271ff | 1bb8c81d9338a2c89c730fc7f156533d0f44f4d4 | /Lista_5/src/ex3/ContaBancaria.java | 7030b9c6d76f08f3e24c50cd71f73f6fa2b813e0 | [
"MIT"
] | permissive | Brunokrk/POO_Java | 8b6580de884c144b58c872948d3cffbaa57ca4ed | 5c2d06fa98dfa01e411cf102d6543bcd23c92ae8 | refs/heads/main | 2023-08-04T10:36:02.830331 | 2021-08-28T06:32:37 | 2021-08-28T06:32:37 | 310,121,294 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,080 | java | package ex3;
import java.util.Date;
public class ContaBancaria {
private Double saldo;
public ContaBancaria(Double valor) {
this.saldo = valor;
}
public void sacar(Double valor) {
try {
if(valor > saldo) {
throw new SaldoInsuficienteException(valor - saldo);
}else {
this.saldo = this.saldo - valor;
System.out.println("Saque efetuado");
}
}catch(SaldoInsuficienteException si) {
System.out.println(si.toString());
}
}
public void pagarBoleto(Boleto boleto) {
Date atual = new Date();
try {
if(boleto.getVencimento().compareTo(atual) == -1) {
throw new BoletoVencidoException(boleto.getVencimento());
}else if(boleto.getValor() > this.saldo) {
throw new SaldoInsuficienteException(boleto.getValor()- saldo);
}else {
this.saldo = this.saldo - boleto.getValor();
}
}catch(BoletoVencidoException | SaldoInsuficienteException ee) {
System.out.println(ee.toString());
}
}
public Double getSaldo() {
return saldo;
}
public void setSaldo(Double saldo) {
this.saldo = saldo;
}
}
| [
"[email protected]"
] | |
9a8dec614f1959bbc17fe9371dc3f18737f69baf | a7aea3cce5e5a6584664838f9eabf7b53f1fa2d5 | /src/git_test/HelloWorld.java | 87806e0fdb956ad61a657265573fcb5d3d211345 | [] | no_license | WendyFYR/git_test | d21afaee5bd65d33f2ad6849e355d621871e6802 | e4f9f648cecaee979852965489114eecc7c72555 | refs/heads/master | 2023-01-10T20:38:28.865085 | 2020-11-06T02:22:38 | 2020-11-06T02:22:38 | 304,536,592 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 142 | java | package git_test;
public class HelloWorld {
public static void main(String[] args) {
System.out.println("hello world");
}
}
| [
"[email protected]"
] | |
d61a9930bc1fa72d0f85f151f9c93c81e348b302 | c5e7a02631065b9a05dfc2369eb667f48c656dd4 | /src/main/java/com/pifrans/modules/ecommerce/enums/StatusPayment.java | 63ec606b3419f18b869a1d0054868fd3932d14c1 | [] | no_license | pifrans/pifrans-erp | 9b8865fe24cd45cf43c9abbe7c7b29064229cd0d | 5af0da604a7c274f4691188b0cbf2df8bf408d28 | refs/heads/master | 2023-01-28T13:51:13.054126 | 2020-12-08T21:14:24 | 2020-12-08T21:14:24 | 304,478,396 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 658 | java | package com.pifrans.modules.ecommerce.enums;
public enum StatusPayment {
PENDING(1, "Pendente"), PAID(2, "Pago"), CANCELED(3, "Cancelado");
private int id;
private String description;
private StatusPayment(int id, String description) {
this.id = id;
this.description = description;
}
public int getId() {
return id;
}
public String getDescription() {
return description;
}
public static StatusPayment toEnum(Integer id) {
if (id == null) {
return null;
}
for (StatusPayment x : StatusPayment.values()) {
if (id.equals(x.getId())) {
return x;
}
}
throw new IllegalArgumentException("ID inválido: " + id);
}
}
| [
"[email protected]"
] | |
d84c8c655a256a7d922b7ace7e1b108288a2f6cb | 9af1881e304af4a97a17b58bab11f3f6ad23c1c3 | /cloud-nacos/src/main/java/com/example/config/DataSourceConfiguration.java | 8f1a2605aafd5865e88c210a470f3858fb79c45d | [] | no_license | l564203965/SpringCloud | 80dec119c52ca765232d0959c58f031532f949ea | eca5512701d923f76c9e9b0a01bf7036e03a6903 | refs/heads/master | 2023-02-03T07:33:52.524960 | 2020-12-18T14:05:35 | 2020-12-18T14:05:35 | 297,370,886 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,942 | java | //package com.example.config;
//
//import com.alibaba.druid.pool.DruidDataSource;
//import io.seata.rm.datasource.DataSourceProxy;
//import org.apache.ibatis.session.SqlSessionFactory;
//import org.mybatis.spring.SqlSessionFactoryBean;
//import org.mybatis.spring.transaction.SpringManagedTransactionFactory;
//import org.springframework.boot.context.properties.ConfigurationProperties;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.context.annotation.Primary;
//import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
//
//import javax.sql.DataSource;
//
//
///**
// * @author: ljy Date: 2020/10/2.
// * 配置seata代理数据源
// */
//@Configuration
//public class DataSourceConfiguration {
//
// @Bean
// @ConfigurationProperties(prefix = "spring.datasource")
// public DataSource druidDataSource(){
// DruidDataSource druidDataSource = new DruidDataSource();
// return druidDataSource;
// }
//
// /**
// * 创建DataSourceProxy
// */
// @Primary
// @Bean("dataSource")
// public DataSourceProxy dataSourceProxy(DataSource druidDataSource){
// return new DataSourceProxy(druidDataSource);
// }
//
// /**
// * 将原有的DataSource对象替换为DataSourceProxy
// */
// @Bean
// public SqlSessionFactory sqlSessionFactory(DataSourceProxy dataSourceProxy)throws Exception{
// SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();
// sqlSessionFactoryBean.setDataSource(dataSourceProxy);
// sqlSessionFactoryBean.setMapperLocations(new PathMatchingResourcePatternResolver()
// .getResources("classpath*:/mapper/*.xml"));
// sqlSessionFactoryBean.setTransactionFactory(new SpringManagedTransactionFactory());
// return sqlSessionFactoryBean.getObject();
// }
//
//}
| [
"[email protected]"
] | |
278267fce0024dca536133db6c20aac29e2692e7 | d1a9d3b5e0fd90c3d4a2539fd3e8fa67df8512a7 | /ExamPortal/ExamPortal/src/main/java/com/exam/config/MySecurityConfig.java | 54e98942716b89d1060b62962c5fbd53aba86560 | [] | no_license | arabindasahoo/springboot | 4f69c00beb7c17a81d0bd13d9d9e61add0758f66 | 84b0a72e91e7908bb9bc3a52fb5e662a747c9072 | refs/heads/master | 2021-11-18T17:10:25.695481 | 2021-08-06T01:47:54 | 2021-08-06T01:47:54 | 239,928,734 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,661 | java | package com.exam.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.NoOpPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import com.exam.service.impl.UserDetailsServiceImpl;
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class MySecurityConfig extends WebSecurityConfigurerAdapter{
@Autowired
private JwtAuthenticationEntryPoint unauthorizedHander;
@Autowired
private JwtAuthenticationFilter jwtAuthenticationFilter;
@Bean
public AuthenticationManager authenticationManagerBean() throws Exception {
return super.authenticationManagerBean();
}
@Autowired
private UserDetailsServiceImpl userDetailsServiceImpl;
@Bean
public BCryptPasswordEncoder passwordEncoder()
{
return new BCryptPasswordEncoder();
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(userDetailsServiceImpl).passwordEncoder(passwordEncoder());
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable()
.cors().disable()
.authorizeRequests()
.antMatchers("/generate-token","/user/").permitAll()
.antMatchers(HttpMethod.OPTIONS).permitAll()
.anyRequest().authenticated()
.and()
.exceptionHandling().authenticationEntryPoint(unauthorizedHander)
.and()
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS);
http.addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class);
}
}
| [
"ARABINDA@DESKTOP-G3PTM3I"
] | ARABINDA@DESKTOP-G3PTM3I |
26756adf8f95d1063c5a5c970d095334e4362786 | d864a0163e1a10281ebc3a7c200f3ad0009d17e2 | /Drone/week01/Teel_Drone.java | 7bac342fb23c17005e959ce431e9a8980c00a1ef | [] | no_license | Charlest83/Drone | c8bedaffec87aa8c4db5614600994722860b6002 | 209f9d27404a49d55646163dd957041b22b70077 | refs/heads/master | 2022-07-05T03:31:24.592310 | 2020-05-19T19:14:29 | 2020-05-19T19:14:29 | 265,339,932 | 0 | 0 | null | null | null | null | WINDOWS-1258 | Java | false | false | 4,300 | java | //Author name: Charles Teel
//Date: 5/13/2020
//Program Name : Teel_Drone
//Purpose: Simulation using button, drone movement in x, y, z location
package week01;
import java.util.Scanner;
//Every move x or y or z coordinate increase or decrease by 1.
//This program should not be GUI. Please submit source file and 2 screenshots of running program.
//Write a class that controls a drone. The class will have certain public methods that allow the UI to control the drone, and display the drone location.
public class Teel_Drone {
// The internal variables would track the drone’s location (x, y and z
// coordinates).
private int x;
private int y;
private int z;
public Teel_Drone() {
x = 0;
y = 0;
z = 0;
}
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
public int getZ() {
return z;
}
public void setZ(int z) {
this.z = z;
return;
}
// Method to move drone up vertically
public int moveUp(int position) {
return y += position;
}
// Method to move drone down vertically
public void moveDown(int position) {
y -= position;
if (y < 0) {
y = 0;
}
}
public void moveForward(int position) {
// moving north
z += position;
}
// Method to move drone backward for given position
public void moveBackward(int position) {
// moving south
z -= position;
}
// method to turn drone 90 degrees to right
public int turnRight(int position) {
// Moving East
return x += position;
}
// method to turn drone 90 degrees to left
public int turnLeft(int position) {
// Moving West
return x -= position;
}
// Method to control direction of the drone.
/*
* x values determine east (positive x value) or west (negative x value) , z values determine north(positive) and south(negative)
*/
public String orientation() {
String n = "North";
String e = "East";
String w = "West";
String s = "South";
if (z > 0) {
return n;
} else if (x > 0) {
return e;
} else if (x < 0) {
return w;
} else if (z < 0) {
return s;
}
return n;
}
public static void main(String[] args) {
int userChoice = 0;
Teel_Drone drone = new Teel_Drone();
// displayMenu();
Scanner keyboard = new Scanner(System.in);
while (userChoice != 8) {
displayMenu();
userChoice = Integer.parseInt(keyboard.nextLine());
if (userChoice < 0) {
System.out.println("Number must be greater than zero");
continue;
}
switch (userChoice) {
// Move drone up
case 1:
System.out.println("You have moved up");
drone.moveUp(1);
break;
// Move drone down
case 2:
System.out.println("You have moved down");
drone.moveDown(1);
break;
// Move forward
case 3:
System.out.println("You have moved forward");
drone.moveForward(1);
break;
// Move Backward
case 4:
System.out.println("You have moved backward");
drone.moveBackward(1);
break;
// Turn Left
case 5:
System.out.println("You have turned left");
drone.turnLeft(1);
break;
// Turn Right
case 6:
System.out.println("You have turned right");
drone.turnRight(1);
break;
// Display Position
case 7:
System.out.println(drone.toString());
break;
case 8:
System.out.println("You are no longer controlling the drone.");
break;
}
}
}
public static void displayMenu() {
System.out.println("Which direction would you like to move the drone? ");
System.out.println("1 - Move Up");
System.out.println("2 - Move Down");
System.out.println("3 - Move Forward");
System.out.println("4 - Move Backward");
System.out.println("5 - Turn Left");
System.out.println("6 - Turn Right");
System.out.println("7 - Display Position");
System.out.println("8 - Exit Navigation");
}
@Override
public String toString() {
return "Teel_Drone" + "[ x_pos= " + x + ", y_pos= " + y + ", z_pos=" + z + ", orientation=" + orientation()
+ "]";
}
}
| [
"[email protected]"
] | |
f7ac1ee3c028162ad28600480bee799995fa685b | e626553fed6749fa4762ed820c9bf76f739ae5de | /day04-code/src/cn/itcast/day04/demo01/HelloWorld.java | 893d8303065c3d4e458497a2f8ef37db30f8b113 | [] | no_license | gatorpeng/basic-code | 490874392720581e27211d8850876095c2e887bd | 41e361ef67b983795e8eaa25814c4265dd5bfc99 | refs/heads/master | 2020-07-02T02:04:50.652046 | 2019-09-01T22:20:17 | 2019-09-01T22:20:17 | 201,380,142 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 246 | java | package cn.itcast.day04.demo01;
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello world!");
System.out.println("Hello world!");
System.out.println("Hello world!");
}
}
| [
"[email protected]"
] | |
a32cb153bac8adfb34368473024e694d345aaf88 | 40229e2fcafe1099c5c8d9c7c44e5a5cd069b5fc | /66. Plus One.java | e6e47ca427caaae9a74de578aad5d666f5d626e7 | [] | no_license | TCoherence/LeetCodeExercise | 0cf7356a47869c31d922843fe4bbafc7e9dcbd04 | d5cdb0bb0dc282381f6b492730004b137b01cc53 | refs/heads/master | 2020-03-11T13:17:00.188389 | 2020-03-01T19:41:03 | 2020-03-01T19:41:03 | 130,020,492 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 704 | java | class Solution {
public int[] plusOne(int[] digits) {
if ( digits == null ) return null;
int len = digits.length;
digits[len - 1]++;
for( int i = len - 2; i >= 0; i--){
if( digits[i+1] == 10 ) digits[i]++;
}
if( digits[0] == 10) {
int[] ret = new int[len+1];
ret[0] = 1;
for( int i = 1; i < len + 1; i++){
ret[i] = digits[i-1] % 10;
}
return ret;
}
else{
int[] ret = new int[len];
for( int i = 0; i < len; i++){
ret[i] = digits[i] % 10;
}
return ret;
}
}
}
| [
"[email protected]"
] | |
a997d0fb6cfbbdb4acf4cbb4605724e28041b362 | d24e1303894efa688fba2d506ceaa5c7594f9a22 | /src/main/java/com/wufuqiang/leetcode/MS33_VerifyPostorder.java | 3127e925d24728904bec7bc7d23f37ff5ea0b1b9 | [] | no_license | Eureka1996/leetcode | 3663e6a500589a5cd23cd3a0f0dbe61a2fd11764 | 9f56f68208270f3565cf2a0ea6bf1654fdbe4a1a | refs/heads/master | 2022-11-19T11:02:49.801924 | 2022-10-27T01:11:25 | 2022-10-27T01:11:25 | 222,052,314 | 2 | 2 | null | 2020-10-13T19:21:00 | 2019-11-16T05:33:27 | Java | UTF-8 | Java | false | false | 475 | java | package com.wufuqiang.leetcode;
import java.util.Stack;
//验证后序遍历 单调栈
public class MS33_VerifyPostorder {
public boolean verifyPostorder(int[] postorder) {
Stack<Integer> stack = new Stack<>();
int root = Integer.MAX_VALUE;
for(int i = postorder.length - 1; i >= 0; i--) {
if(postorder[i] > root) return false;
while(!stack.isEmpty() && stack.peek() > postorder[i])
root = stack.pop();
stack.add(postorder[i]);
}
return true;
}
}
| [
"[email protected]"
] | |
07605967e15b4fba27b5b3cd8734bf356f61c26d | 090e7d94eb91ac1d981d23ac4ba29d194a5ead97 | /application/src/main/java/com/hugopicado/stocks/controller/api/StockDto.java | 19e31d3c827ff4b04aa31dbc52d57f268ecf0d6e | [] | no_license | KAUSHIKRAO1196/STOCKING | d21e034bde1db72abd308bfb60c9c69f37965dfa | c4cd017076ea576527500ca1a5c773e030e923d6 | refs/heads/master | 2022-12-03T11:55:23.963317 | 2019-06-07T11:12:41 | 2019-06-07T11:12:41 | 190,729,496 | 0 | 0 | null | 2022-11-24T07:02:19 | 2019-06-07T10:59:49 | Java | UTF-8 | Java | false | false | 1,657 | java | package com.hugopicado.stocks.controller.api;
import com.google.common.base.MoreObjects;
public class StockDto {
private String symbol;
private String type;
private double lastDividend;
private double fixedDividend;
private double parValue;
private double tickerPrice;
public String getSymbol() {
return symbol;
}
public String getType() {
return type;
}
public double getLastDividend() {
return lastDividend;
}
public double getFixedDividend() {
return fixedDividend;
}
public double getParValue() {
return parValue;
}
public double getTickerPrice() {
return tickerPrice;
}
public void setSymbol(String symbol) {
this.symbol = symbol;
}
public void setType(String type) {
this.type = type;
}
public void setLastDividend(double lastDividend) {
this.lastDividend = lastDividend;
}
public void setFixedDividend(double fixedDividend) {
this.fixedDividend = fixedDividend;
}
public void setParValue(double parValue) {
this.parValue = parValue;
}
public void setTickerPrice(double tickerPrice) {
this.tickerPrice = tickerPrice;
}
@Override
public String toString() {
return MoreObjects.toStringHelper(this)
.add("symbol", symbol)
.add("type", type)
.add("lastDividend", lastDividend)
.add("fixedDividend", fixedDividend)
.add("parValue", parValue)
.add("tickerPrice", tickerPrice)
.toString();
}
}
| [
"kaushik@[email protected]"
] | kaushik@[email protected] |
d0c9185edae7b5a7f3f5da843144a28dba03a7ac | ae5eb1a38b4d22c82dfd67c86db73592094edc4b | /project278/src/main/java/org/gradle/test/performance/largejavamultiproject/project278/p1393/Production27875.java | bd5d949aaea7129f595cbd00cabc02971b7d7381 | [] | no_license | big-guy/largeJavaMultiProject | 405cc7f55301e1fd87cee5878a165ec5d4a071aa | 1cd6a3f9c59e9b13dffa35ad27d911114f253c33 | refs/heads/main | 2023-03-17T10:59:53.226128 | 2021-03-04T01:01:39 | 2021-03-04T01:01:39 | 344,307,977 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,890 | java | package org.gradle.test.performance.largejavamultiproject.project278.p1393;
public class Production27875 {
private String property0;
public String getProperty0() {
return property0;
}
public void setProperty0(String value) {
property0 = value;
}
private String property1;
public String getProperty1() {
return property1;
}
public void setProperty1(String value) {
property1 = value;
}
private String property2;
public String getProperty2() {
return property2;
}
public void setProperty2(String value) {
property2 = value;
}
private String property3;
public String getProperty3() {
return property3;
}
public void setProperty3(String value) {
property3 = value;
}
private String property4;
public String getProperty4() {
return property4;
}
public void setProperty4(String value) {
property4 = value;
}
private String property5;
public String getProperty5() {
return property5;
}
public void setProperty5(String value) {
property5 = value;
}
private String property6;
public String getProperty6() {
return property6;
}
public void setProperty6(String value) {
property6 = value;
}
private String property7;
public String getProperty7() {
return property7;
}
public void setProperty7(String value) {
property7 = value;
}
private String property8;
public String getProperty8() {
return property8;
}
public void setProperty8(String value) {
property8 = value;
}
private String property9;
public String getProperty9() {
return property9;
}
public void setProperty9(String value) {
property9 = value;
}
} | [
"[email protected]"
] | |
9f2aa89ea2418e7b86a89a3a72fdd48533a251c5 | 6c1c18f95d0bfe3e300c775ecacd296cb0ec176e | /commlib/src/main/java/com/android/banana/commlib/view/MyGridView.java | ab4efba5f3c8fda34bc896aa38658bbf18cc8aac | [] | no_license | winnxiegang/save | a7ea6a3dcee7a9ebda8c6ad89957ae0e4d3c430d | 16ad3a98e8b6ab5d17acacce322dfc5e51ab3330 | refs/heads/master | 2020-03-13T04:27:26.650719 | 2018-04-26T01:18:59 | 2018-04-26T01:18:59 | 130,963,368 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 796 | java | package com.android.banana.commlib.view;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.GridView;
/**
*
*
* @author leslie
*
* @version $Id: MyGridView.java, v 0.1 2014年9月11日 下午1:50:21 leslie Exp $
*/
public class MyGridView extends GridView {
public MyGridView(Context context) {
super(context);
}
public MyGridView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public MyGridView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);
super.onMeasure(widthMeasureSpec, expandSpec);
}
}
| [
"[email protected]"
] | |
da0385f5661bdddff2c9b6ba6aa41a0710b1f8e5 | 1bc928c269707865b316446e9ec8120e74cf6020 | /src/main/java/apple/npc/data/npc/VarsConclusionMap.java | 0d73187773d311b2a987c9262b90376e2e74d805 | [] | no_license | amp7368/MinecraftNPCDialogue | 8e4ed008aac7d661eef34ece3bddd0da77c924c1 | fbfa661ab0d9bf16c73c60f9e428c070a794ddc7 | refs/heads/master | 2021-05-21T22:20:32.461311 | 2020-04-15T05:14:58 | 2020-04-15T05:14:58 | 252,827,308 | 0 | 0 | null | 2020-04-19T18:31:19 | 2020-04-03T19:54:06 | Java | UTF-8 | Java | false | false | 1,153 | java | package apple.npc.data.npc;
import apple.npc.data.booleanAlgebra.BooleanRedirect;
import apple.npc.data.booleanAlgebra.Evaluateable;
import apple.npc.ymlNavigate.YMLBooleanNavigate;
import apple.npc.ymlNavigate.YMLNpcNavigate;
import org.bukkit.configuration.ConfigurationSection;
public class VarsConclusionMap implements Evaluateable {
public int conclusionResult;
private Evaluateable exp;
public VarsConclusionMap(ConfigurationSection config) {
exp = BooleanRedirect.make(config.getConfigurationSection(YMLBooleanNavigate.EXPRESSION));
conclusionResult = config.getInt(YMLNpcNavigate.CONCLUSION_ID);
}
public VarsConclusionMap(int conclusionResult, Evaluateable finished) {
this.conclusionResult = conclusionResult;
this.exp = finished;
}
@Override
public boolean evaluate(String playerUID, int currentConclusion, long timeLastTalked) {
return exp.evaluate(playerUID, currentConclusion, timeLastTalked);
}
public Evaluateable getExpression() {
return exp;
}
public void setExpression(Evaluateable finished) {
this.exp = finished;
}
}
| [
"[email protected]"
] | |
c01d55905edfd5431260f87fba886beee47222c8 | 807e4dab8b862e7b03c3ab2b0530e193184b3c97 | /baseio-codec/src/main/java/com/generallycloud/nio/codec/http2/future/HeaderTable.java | c8dbd85e4e0d99d3a62ec167bca87f3ef3455dfc | [
"Apache-2.0"
] | permissive | zc1249274251/baseio | 6ffaff77e23f51d637717ec72edb1ab2b9534f2e | e1a923147894af8b68dc7722cff1be03a99b5a11 | refs/heads/master | 2021-01-20T11:51:20.548255 | 2017-02-21T04:06:46 | 2017-02-21T04:06:46 | 82,634,725 | 1 | 0 | null | 2017-02-21T04:07:56 | 2017-02-21T04:07:55 | null | UTF-8 | Java | false | false | 5,806 | java | /*
* Copyright 2015-2017 GenerallyCloud.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.generallycloud.nio.codec.http2.future;
import java.util.ArrayList;
import java.util.List;
public class HeaderTable {
private List<Http2Header> headers;
public Http2Header getHeader(int index) {
return headers.get(index);
}
public String getHeaderValue(int index) {
return getHeader(index).getValue();
}
public HeaderTable(int size) {
this.headers = new ArrayList<Http2Header>(size);
}
public HeaderTable() {
this.headers = new ArrayList<Http2Header>();
}
public void addHeader(Http2Header header) {
headers.add(header.getIndex(), header);
}
public List<Http2Header> getHeaders() {
return headers;
}
public static HeaderTable STATIC_HEADER_TABLE = new HeaderTable(62);
static {
STATIC_HEADER_TABLE.addHeader(new Http2Header(1, ":authority", ""));
STATIC_HEADER_TABLE.addHeader(new Http2Header(2, ":method", "GET"));
STATIC_HEADER_TABLE.addHeader(new Http2Header(3, ":method", "POST"));
STATIC_HEADER_TABLE.addHeader(new Http2Header(4, ":path", "/"));
STATIC_HEADER_TABLE.addHeader(new Http2Header(5, ":path", "/index.html"));
STATIC_HEADER_TABLE.addHeader(new Http2Header(6, ":scheme", "http"));
STATIC_HEADER_TABLE.addHeader(new Http2Header(7, ":scheme", "https"));
STATIC_HEADER_TABLE.addHeader(new Http2Header(8, ":status", "200"));
STATIC_HEADER_TABLE.addHeader(new Http2Header(9, ":status", "204"));
STATIC_HEADER_TABLE.addHeader(new Http2Header(10, ":status", "206"));
STATIC_HEADER_TABLE.addHeader(new Http2Header(11, ":status", "304"));
STATIC_HEADER_TABLE.addHeader(new Http2Header(12, ":status", "400"));
STATIC_HEADER_TABLE.addHeader(new Http2Header(13, ":status", "404"));
STATIC_HEADER_TABLE.addHeader(new Http2Header(14, ":status", "500"));
STATIC_HEADER_TABLE.addHeader(new Http2Header(15, "accept-charset", ""));
STATIC_HEADER_TABLE.addHeader(new Http2Header(16, "accept-encoding", "gzip, deflate"));
STATIC_HEADER_TABLE.addHeader(new Http2Header(17, "accept-language", ""));
STATIC_HEADER_TABLE.addHeader(new Http2Header(18, "accept-ranges", ""));
STATIC_HEADER_TABLE.addHeader(new Http2Header(19, "accept", ""));
STATIC_HEADER_TABLE.addHeader(new Http2Header(20, "access-control-allow-origin", ""));
STATIC_HEADER_TABLE.addHeader(new Http2Header(21, "age", ""));
STATIC_HEADER_TABLE.addHeader(new Http2Header(22, "allow", ""));
STATIC_HEADER_TABLE.addHeader(new Http2Header(23, "authorization", ""));
STATIC_HEADER_TABLE.addHeader(new Http2Header(24, "cache-control", ""));
STATIC_HEADER_TABLE.addHeader(new Http2Header(25, "content-disposition", ""));
STATIC_HEADER_TABLE.addHeader(new Http2Header(26, "content-encoding", ""));
STATIC_HEADER_TABLE.addHeader(new Http2Header(27, "content-language", ""));
STATIC_HEADER_TABLE.addHeader(new Http2Header(28, "content-length", ""));
STATIC_HEADER_TABLE.addHeader(new Http2Header(29, "content-location", ""));
STATIC_HEADER_TABLE.addHeader(new Http2Header(30, "content-range", ""));
STATIC_HEADER_TABLE.addHeader(new Http2Header(31, "content-type", ""));
STATIC_HEADER_TABLE.addHeader(new Http2Header(32, "cookie", ""));
STATIC_HEADER_TABLE.addHeader(new Http2Header(33, "date", ""));
STATIC_HEADER_TABLE.addHeader(new Http2Header(34, "etag", ""));
STATIC_HEADER_TABLE.addHeader(new Http2Header(35, "expect", ""));
STATIC_HEADER_TABLE.addHeader(new Http2Header(36, "expires", ""));
STATIC_HEADER_TABLE.addHeader(new Http2Header(37, "from", ""));
STATIC_HEADER_TABLE.addHeader(new Http2Header(38, "host", ""));
STATIC_HEADER_TABLE.addHeader(new Http2Header(39, "if-match", ""));
STATIC_HEADER_TABLE.addHeader(new Http2Header(40, "if-modified-since", ""));
STATIC_HEADER_TABLE.addHeader(new Http2Header(41, "if-none-match", ""));
STATIC_HEADER_TABLE.addHeader(new Http2Header(42, "if-range", ""));
STATIC_HEADER_TABLE.addHeader(new Http2Header(43, "if-unmodified-since", ""));
STATIC_HEADER_TABLE.addHeader(new Http2Header(44, "last-modified", ""));
STATIC_HEADER_TABLE.addHeader(new Http2Header(45, "link", ""));
STATIC_HEADER_TABLE.addHeader(new Http2Header(46, "location", ""));
STATIC_HEADER_TABLE.addHeader(new Http2Header(47, "max-forwards", ""));
STATIC_HEADER_TABLE.addHeader(new Http2Header(48, "proxy-authenticate", ""));
STATIC_HEADER_TABLE.addHeader(new Http2Header(49, "proxy-authorization", ""));
STATIC_HEADER_TABLE.addHeader(new Http2Header(50, "range", ""));
STATIC_HEADER_TABLE.addHeader(new Http2Header(51, "referer", ""));
STATIC_HEADER_TABLE.addHeader(new Http2Header(52, "refresh", ""));
STATIC_HEADER_TABLE.addHeader(new Http2Header(53, "retry-after", ""));
STATIC_HEADER_TABLE.addHeader(new Http2Header(54, "server", ""));
STATIC_HEADER_TABLE.addHeader(new Http2Header(55, "set-cookie", ""));
STATIC_HEADER_TABLE.addHeader(new Http2Header(56, "strict-transport-security", ""));
STATIC_HEADER_TABLE.addHeader(new Http2Header(57, "transfer-encoding", ""));
STATIC_HEADER_TABLE.addHeader(new Http2Header(58, "user-agent", ""));
STATIC_HEADER_TABLE.addHeader(new Http2Header(59, "vary", ""));
STATIC_HEADER_TABLE.addHeader(new Http2Header(60, "via", ""));
STATIC_HEADER_TABLE.addHeader(new Http2Header(61, "www-authenticate", ""));
}
}
| [
"[email protected]"
] | |
08656a9de244a15f0574cb7f59861a4937008c88 | 1f3419109b857b58138be7b90c93532bb3be845d | /app/src/main/java/com/guidovezzoni/bingeworthyshows/common/base/ImdbViewModel.java | b9f327fef9e6732f032301e4d3c283b34c851e16 | [] | no_license | morristech/BingeWorthyShows | fb350a2f2519fc2f0a95f6b87dfbcd98cdf6f4ea | 19f995a70dd6cf9350636bed1b139be2fc7aa246 | refs/heads/master | 2020-05-18T13:13:31.856882 | 2019-01-10T19:32:49 | 2019-01-10T19:32:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 613 | java | package com.guidovezzoni.bingeworthyshows.common.base;
import com.guidovezzoni.bingeworthyshows.common.baselibrary.BaseViewModel;
import com.guidovezzoni.bingeworthyshows.common.baselibrary.Service;
import com.guidovezzoni.bingeworthyshows.config.ConfigService;
public class ImdbViewModel<M, P> extends BaseViewModel<M, P> {
private final ConfigService configService;
public ImdbViewModel(Service<M, P> service, ConfigService configService) {
super(service);
this.configService = configService;
}
public ConfigService getConfigService() {
return configService;
}
}
| [
"[email protected]"
] | |
53f9a091300152b15b0a5106f808a14841a2f144 | f5f972cb42fc46cddadc08388bc2678708878685 | /wooplr-bean/src/main/java/com/ubiquity/common/jaxb/themecollection/CollectionSmallJAXB.java | 58c67931eeaada296a8d85dfb21ff06644bf530e | [] | no_license | SantoshChandrakant/wooplr-automation2 | 1441b539ea2578e451a7c6b61f69dd3b7321571a | 24003a438d46b5ac6b64968383a0e36495f40733 | refs/heads/master | 2021-01-12T08:22:23.646508 | 2016-12-15T12:23:27 | 2016-12-15T12:23:27 | 76,557,197 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,691 | java | package com.ubiquity.common.jaxb.themecollection;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
import com.ubiquity.common.jaxb.ecomm.Countable;
/**
* <p>
* Java class for CollectionJAXB complex type.
*
* <p>
* The following schema fragment specifies the expected content contained within
* this class.
*
* <pre>
* <complexType name="CollectionJAXB">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="object_type" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="object_id" type="{http://www.w3.org/2001/XMLSchema}long"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CollectionSmallJAXB", propOrder = { "name", "collectionId", "isPrivate" })
public class CollectionSmallJAXB implements Serializable, Countable {
private final static Long serialVersionUID = 12343L;
protected String name;
protected Long collectionId;
protected Boolean isPrivate;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Long getCollectionId() {
return collectionId;
}
public Long getId() {
return collectionId;
}
public void setCollectionId(Long collectionId) {
this.collectionId = collectionId;
}
public Boolean getIsPrivate() {
return isPrivate;
}
public void setIsPrivate(Boolean isPrivate) {
this.isPrivate = isPrivate;
}
}
| [
"[email protected]"
] | |
f82d6b001d2a20a68df5f560eb52e5fa1a58711a | bb9a610688b6a5fc15d94d3fc18e36a9922c14b7 | /src/main/java/kg/nais/models/ServiceUpdate.java | 4bfef64c93a061209e9ac2883a2845abc6eb09b4 | [] | no_license | aziret26/nais | 2503a1df8de72724aac5aae48a20de7f0dbe4dea | 1815222a2cb821e23e6d322ac6710fea6ef79254 | refs/heads/master | 2021-01-20T07:28:55.537819 | 2018-06-17T18:54:21 | 2018-06-17T18:54:21 | 90,003,389 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,671 | java | package kg.nais.models;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Calendar;
/**
* Created by aziret on 7/12/17.
*/
@Entity
@NamedQueries({
@NamedQuery(name = "ServiceUpdate.findAll",
query = "SELECT su FROM ServiceUpdate su")
})
public class ServiceUpdate implements Serializable{
@Id
@GeneratedValue
private int serviceUpdateId;
@Column
private Calendar ordersLastUpd;
@Column
private Calendar chicksLastUpd;
@Column
private Calendar notificationsLastUpd;
/**
* set time for update in hh:mm format
* system will be updating everyday selected time
*/
@Column
private String updateTime;
public int getServiceUpdateId() {
return serviceUpdateId;
}
public void setServiceUpdateId(int serviceUpdateId) {
this.serviceUpdateId = serviceUpdateId;
}
public Calendar getOrdersLastUpd() {
return ordersLastUpd;
}
public void setOrdersLastUpd(Calendar ordersLastUpd) {
this.ordersLastUpd = ordersLastUpd;
}
public Calendar getChicksLastUpd() {
return chicksLastUpd;
}
public void setChicksLastUpd(Calendar chicksLastUpd) {
this.chicksLastUpd = chicksLastUpd;
}
public String getUpdateTime() {
return updateTime;
}
public void setUpdateTime(String updateTime) {
this.updateTime = updateTime;
}
public Calendar getNotificationsLastUpd() {
return notificationsLastUpd;
}
public void setNotificationsLastUpd(Calendar notificationsLasUpd) {
this.notificationsLastUpd = notificationsLasUpd;
}
}
| [
"[email protected]"
] | |
7a6dbab2660f73a25bb12098e2af33fe755e9b5b | 166f845bc08cd71f817542e323a5f95aa758b435 | /CEPE/src/view/aluno/CadastroEspecificoAluno.java | d42eda8d0df446d47c877b6773a60e187d537b9a | [] | no_license | mirielesilverio/projeto-cepe | 16cf690781648a5496f816e9dbeca3516783a59f | 5da61b49f4e44f940e356cb71e897353cc3dd6b9 | refs/heads/master | 2020-09-14T04:37:11.779692 | 2019-11-21T18:49:57 | 2019-11-21T18:49:57 | 157,082,777 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,565 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package view.aluno;
import control.connection.dataAccess.AlunoAccess;
import control.connection.dataAccess.ProfessorAccess;
import control.connection.dataAccess.TurmasAccess;
import javax.swing.JFrame;
import model.Aluno;
import model.Professor;
import model.Usuario;
/**
*
* @author Aluno
*/
public class CadastroEspecificoAluno extends javax.swing.JFrame {
static Aluno aluno;
static Usuario usuario;
static MenuAluno menu;
public CadastroEspecificoAluno(Usuario usuario) {
initComponents();
this.setLocationRelativeTo(null);
this.usuario = usuario;
TurmasAccess turmasAc = new TurmasAccess();
jcbTurmas.removeAllItems();
for(String turma:turmasAc.lista())
{
jcbTurmas.addItem(turma);
}
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
btnCadastrar = new javax.swing.JButton();
jLabel3 = new javax.swing.JLabel();
btnClose1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jLabel5 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jsLinhaNome = new javax.swing.JSeparator();
jcbTurmas = new javax.swing.JComboBox<>();
txtRa = new javax.swing.JTextField();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setUndecorated(true);
setPreferredSize(new java.awt.Dimension(625, 422));
getContentPane().setLayout(null);
jPanel1.setBackground(new java.awt.Color(255, 255, 255));
jPanel1.setLayout(null);
btnCadastrar.setFont(new java.awt.Font("Century Gothic", 1, 16)); // NOI18N
btnCadastrar.setForeground(new java.awt.Color(0, 77, 133));
btnCadastrar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/view/img/plus.png"))); // NOI18N
btnCadastrar.setText(" FINALIZAR CADASTRO");
btnCadastrar.setActionCommand("btnCadastrar");
btnCadastrar.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 77, 133), 1, true));
btnCadastrar.setContentAreaFilled(false);
btnCadastrar.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
btnCadastrar.setFocusPainted(false);
btnCadastrar.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseEntered(java.awt.event.MouseEvent evt) {
btnCadastrarMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
btnCadastrarMouseExited(evt);
}
});
btnCadastrar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnCadastrarActionPerformed(evt);
}
});
jPanel1.add(btnCadastrar);
btnCadastrar.setBounds(110, 310, 390, 60);
jLabel3.setFont(new java.awt.Font("Century Gothic", 0, 24)); // NOI18N
jLabel3.setForeground(new java.awt.Color(0, 77, 133));
jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel3.setText("INFORMAÇÕES ESPECÍFICAS");
jPanel1.add(jLabel3);
jLabel3.setBounds(40, 100, 540, 30);
btnClose1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/view/img/cross-square-button.png"))); // NOI18N
btnClose1.setToolTipText("Fechar o programa");
btnClose1.setBorder(null);
btnClose1.setContentAreaFilled(false);
btnClose1.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
btnClose1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnClose1ActionPerformed(evt);
}
});
jPanel1.add(btnClose1);
btnClose1.setBounds(560, 10, 33, 33);
jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/view/img/minimize.png"))); // NOI18N
jButton2.setToolTipText("Minimizar o programa");
jButton2.setBorder(null);
jButton2.setContentAreaFilled(false);
jButton2.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jPanel1.add(jButton2);
jButton2.setBounds(520, 10, 33, 33);
jLabel5.setFont(new java.awt.Font("Century Gothic", 0, 14)); // NOI18N
jLabel5.setForeground(new java.awt.Color(0, 77, 133));
jLabel5.setText("Turma");
jPanel1.add(jLabel5);
jLabel5.setBounds(110, 230, 130, 19);
jLabel4.setFont(new java.awt.Font("Century Gothic", 0, 14)); // NOI18N
jLabel4.setForeground(new java.awt.Color(0, 77, 133));
jLabel4.setText("Registro Escolar");
jPanel1.add(jLabel4);
jLabel4.setBounds(110, 150, 130, 19);
jsLinhaNome.setBackground(new java.awt.Color(102, 102, 102));
jsLinhaNome.setForeground(new java.awt.Color(255, 255, 255));
jPanel1.add(jsLinhaNome);
jsLinhaNome.setBounds(110, 210, 390, 30);
jcbTurmas.setFont(new java.awt.Font("Century Gothic", 0, 11)); // NOI18N
jcbTurmas.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Matéria" }));
jPanel1.add(jcbTurmas);
jcbTurmas.setBounds(110, 260, 390, 30);
txtRa.setFont(new java.awt.Font("Century Gothic", 0, 11)); // NOI18N
txtRa.setForeground(new java.awt.Color(153, 153, 153));
txtRa.setText("Clique para escrever");
txtRa.setBorder(null);
txtRa.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
txtRaMouseClicked(evt);
}
public void mousePressed(java.awt.event.MouseEvent evt) {
txtRaMousePressed(evt);
}
});
txtRa.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtRaActionPerformed(evt);
}
});
jPanel1.add(txtRa);
txtRa.setBounds(110, 180, 390, 30);
getContentPane().add(jPanel1);
jPanel1.setBounds(-5, -4, 630, 430);
pack();
}// </editor-fold>//GEN-END:initComponents
private void btnCadastrarMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnCadastrarMouseEntered
btnCadastrar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/view/img/plus-blue.png")));
}//GEN-LAST:event_btnCadastrarMouseEntered
private void btnCadastrarMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnCadastrarMouseExited
btnCadastrar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/view/img/plus.png")));
}//GEN-LAST:event_btnCadastrarMouseExited
private void btnCadastrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCadastrarActionPerformed
aluno = new Aluno(usuario);
aluno.setRa(txtRa.getText());
aluno.setClasse(jcbTurmas.getSelectedIndex()+1);
AlunoAccess acesso = new AlunoAccess();
acesso.create(aluno);
this.dispose();
menu = new MenuAluno(aluno);
menu.setVisible(true);
}//GEN-LAST:event_btnCadastrarActionPerformed
private void btnClose1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnClose1ActionPerformed
System.exit(0);
}//GEN-LAST:event_btnClose1ActionPerformed
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
this.setExtendedState(JFrame.ICONIFIED);
}//GEN-LAST:event_jButton2ActionPerformed
private void txtRaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_txtRaMouseClicked
this.txtRa.setText("");
}//GEN-LAST:event_txtRaMouseClicked
private void txtRaMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_txtRaMousePressed
}//GEN-LAST:event_txtRaMousePressed
private void txtRaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtRaActionPerformed
}//GEN-LAST:event_txtRaActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(CadastroEspecificoAluno.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(CadastroEspecificoAluno.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(CadastroEspecificoAluno.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(CadastroEspecificoAluno.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run(Usuario usuario) {
new CadastroEspecificoAluno(usuario).setVisible(true);
}
@Override
public void run() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnCadastrar;
private javax.swing.JButton btnClose1;
private javax.swing.JButton jButton2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JPanel jPanel1;
private javax.swing.JComboBox<String> jcbTurmas;
private javax.swing.JSeparator jsLinhaNome;
private javax.swing.JTextField txtRa;
// End of variables declaration//GEN-END:variables
}
| [
"[email protected]"
] | |
9773bb7f636892268b9bc1eb305e71154d042753 | 6bdcbbd11e67696c916561a10028d31270f3f3fc | /backend/src/main/java/com/fullstackapp/backend/model/User.java | 371ecb41e59887199fc568a905e2b6eb87d223d5 | [] | no_license | paul-wr/fullstackapp | 4f46eb5c9a3ca7cfc95f6e168f28eba3adbf0e69 | 6b0db651a8c2fb5763073f8ca5388e4e628a8336 | refs/heads/master | 2023-03-05T10:25:09.560601 | 2021-02-15T16:47:44 | 2021-02-15T16:47:44 | 337,462,681 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 852 | java | package com.fullstackapp.backend.model;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.persistence.*;
@Getter
@Setter
@NoArgsConstructor
@Entity
@Table(name = "user_acc")
public class User {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
@Column(name = "first_name")
private String firstName;
@Column(name = "last_name")
private String lastName;
@Column(name = "user_name")
private String userName;
@Column(name = "email")
private String email;
@Column(name = "user_password")
private String password;
public User(String firstName, String lastName, String userName, String email) {
this.firstName = firstName;
this.lastName = lastName;
this.userName = userName;
this.email = email;
}
}
| [
"[email protected]"
] | |
726eecbc372127b19d28d111be9140605f8c508f | c865fbd5b4dfc2498b7af676669cd58abb1575ef | /info/jonclark/util/FormatUtils.java | f8d0e74424bd65f71a02555c0eba17f90a63fe8f | [] | no_license | sutra/numbertrans | f197f68b14ad225e88a2e59934ba713f0ed09068 | 7f586d9de7ba6384b3cd9d8e1113c91469684584 | refs/heads/master | 2021-01-01T15:05:16.474119 | 2008-03-11T17:53:31 | 2008-03-11T17:53:31 | 239,330,252 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,659 | java | /*
* Copyright (c) 2006, Jonathan Clark <jon_DOT_h_DOT_clark_AT_gmail_DOT_com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* * Neither the name of my affiliates nor the names of thier contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIEDWARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*/
package info.jonclark.util;
import info.jonclark.lang.PrependStringBuilder;
import java.util.Date;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
/**
* @author Jonathan
*/
public class FormatUtils {
private static final SimpleDateFormat fTime = new SimpleDateFormat("hh:mm:ss aa");
private static final SimpleDateFormat fDateFull =
new SimpleDateFormat("EEEEEEEEE, MMMMMMMM dd, yyyy hh:mm:ss aa");
private static final SimpleDateFormat fDateLong = new SimpleDateFormat("MMMMMMMM dd, yyyy");
public static final DecimalFormat FORMAT_2DECIMALS = new DecimalFormat("#,###.##");
public static final DecimalFormat FORMAT_4DECIMALS = new DecimalFormat("#,###.####");
public static final DecimalFormat FORMAT_EXP = new DecimalFormat("0.0000E0");
public static final DecimalFormat FORMAT_WHOLE = new DecimalFormat("#,###");
public static String formatTime(final Date d) {
return fTime.format(d);
}
/**
* Format date like as in this example: Wednesday, March 31, 2005 5:23:55 pm
*
* @param d
* The date object to be formatted
* @return The specified date formatted in the format shown above
*/
public static String formatFullDate(final Date d) {
return fDateFull.format(d);
}
/**
* Format date like as in this example: March 31, 2005
*
* @param d
* The date object to be formatted
* @return The specified date formatted in the format shown above
*/
public static String formatLongDate(Date d) {
return fDateLong.format(d);
}
/**
* Format a timespan as in this example: 5 days, 2 hours, 9 minutes, 23
* seconds
*
* @param span
* @return
*/
public static String formatTimeSpanFull(final long span) {
final int ALL_UNITS = 6;
return formatTimeSpan(span, ALL_UNITS);
}
/**
* Format a timespan as in this examples: 5 days, 2 hours 9 minutes, 23
* seconds BUT NOT 5 days, 2 hours, 9 minutes, 23 seconds
*
* @param span
* @param nUnits
* The maxiumum number of units that will be shown
* @return
*/
public static String formatTimeSpan(final long span, final int nUnits) {
// modulo the years, months, days, hours, minutes, seconds, etc.
// and create parameters that allow only a certain number
// of those things to be shown
throw new RuntimeException("Unimplemented");
}
/**
* Formats a whole number, adding commas.
*
* @param wholeNumber
* @return
*/
public static String formatLong(long wholeNumber) {
return FORMAT_WHOLE.format(wholeNumber);
}
/**
* Formats a decimal number, adding commas and providing up to 2 places of
* decimal accuracy.
*
* @param decimalNumber
* @return
*/
public static String formatDouble2(double decimalNumber) {
return FORMAT_2DECIMALS.format(decimalNumber);
}
public static String formatDouble4(double decimalNumber) {
return FORMAT_4DECIMALS.format(decimalNumber);
}
public static String formatDoubleExp(double decimalNumber) {
return FORMAT_EXP.format(decimalNumber);
}
public static String formatPhoneNumber(String phoneNumber) {
// make a list of only the digits
StringBuilder digits = new StringBuilder();
for (int i = 0; i < phoneNumber.length(); i++) {
char c = phoneNumber.charAt(i);
if (Character.isDigit(c)) {
digits.append(c);
}
}
// now format like this: (817) 939-1985
int i = 0;
PrependStringBuilder formatted = new PrependStringBuilder();
if (digits.length() >= 4) {
formatted.prepend(digits.substring(0, 4));
i += 4;
if (digits.length() > 4) {
formatted.prepend('-');
}
}
if (digits.length() >= 7) {
formatted.prepend(digits.substring(4, 7));
i += 3;
if (digits.length() > 7) {
formatted.prepend(' ');
}
}
if (digits.length() >= 10) {
formatted.prepend("(" + digits.substring(7, 10) + ")");
i += 3;
if (digits.length() > 10) {
formatted.prepend(' ');
}
}
// just stick whatever is left on the beginning
formatted.prepend(digits.substring(i));
return formatted.toString();
}
}
| [
""
] | |
de85773e7fe556e95f1d7ac08ca45137879bba2b | a715e8312a90d099b72c24e5b7da1372c9fe67fb | /android/android/src/com/android/tools/idea/editors/navigation/model/Locator.java | 0600a8beea9ab43cc026cc5c125201be250d7a36 | [
"Apache-2.0"
] | permissive | wiltonlazary/bugvm-studio | ff98c1beca1f890013aa05ecd67f137a14a70c32 | 5861389424a51181c58178576c78cf35c0ceb1b5 | refs/heads/master | 2021-01-24T20:58:41.730805 | 2015-12-18T19:34:14 | 2015-12-18T19:34:14 | 56,322,614 | 2 | 1 | null | 2016-04-15T13:34:56 | 2016-04-15T13:34:56 | null | UTF-8 | Java | false | false | 2,659 | java | /*
* Copyright (C) 2013 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.tools.idea.editors.navigation.model;
import com.android.annotations.NonNull;
import com.android.annotations.Nullable;
public class Locator {
@NonNull
private final State state;
@Nullable
private final String fragmentClassName;
@Nullable
private final String viewId;
private Locator(@NonNull State state, @Nullable String fragmentClassName, @Nullable String viewId) {
this.state = state;
this.fragmentClassName = fragmentClassName;
this.viewId = viewId;
}
public static Locator of(@NonNull State state) {
return new Locator(state, null, null);
}
public static Locator of(@NonNull State state, @Nullable String viewName) {
return new Locator(state, null, viewName);
}
public static Locator of(@NonNull State state, @Nullable String fragmentClassName, @Nullable String viewName) {
return new Locator(state, fragmentClassName, viewName);
}
@NonNull
public State getState() {
return state;
}
@Nullable
public String getFragmentClassName() {
return fragmentClassName;
}
@Nullable
public String getViewId() {
return viewId;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Locator locator = (Locator)o;
if (fragmentClassName != null ? !fragmentClassName.equals(locator.fragmentClassName) : locator.fragmentClassName != null) return false;
if (!state.equals(locator.state)) return false;
if (viewId != null ? !viewId.equals(locator.viewId) : locator.viewId != null) return false;
return true;
}
@Override
public int hashCode() {
int result = state.hashCode();
result = 31 * result + (fragmentClassName != null ? fragmentClassName.hashCode() : 0);
result = 31 * result + (viewId != null ? viewId.hashCode() : 0);
return result;
}
@Override
public String toString() {
return "Locator{" +
"state=" + state +
", viewName='" + viewId + '\'' +
'}';
}
}
| [
"[email protected]"
] | |
802e49a3a86da18090bffd5d6d55d768fba96191 | ec5fe8f20dfe82b479cea3da24c78190f768e086 | /cas-4.1.0/cas-server-extension-clearpass/src/test/java/org/jasig/cas/extension/clearpass/EncryptedMapDecoratorTests.java | f4cb2edb44484a5256021ed45813088124902445 | [
"BSD-3-Clause",
"CDDL-1.1",
"LGPL-2.0-or-later",
"W3C",
"WTFPL",
"SAX-PD",
"CDDL-1.0",
"MIT",
"MPL-1.1",
"LicenseRef-scancode-jsr-107-jcache-spec-2013",
"EPL-1.0",
"Classpath-exception-2.0",
"LGPL-2.1-only",
"GPL-2.0-only",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference",
"LGPL-2.1-or-later",
"GPL-1.0-or-later",
"LicenseRef-scancode-free-unknown"
] | permissive | hsj-xiaokang/springboot-shiro-cas-mybatis | b4cf76dc2994d63f771da0549cf711ea674e53bf | 3673a9a9b279dd1e624c1a7a953182301f707997 | refs/heads/master | 2022-06-26T15:28:49.854390 | 2020-12-06T04:43:13 | 2020-12-06T04:43:13 | 103,009,179 | 42 | 24 | MIT | 2022-06-25T07:27:42 | 2017-09-10T06:35:28 | Java | UTF-8 | Java | false | false | 3,677 | java | /*
* Licensed to Apereo under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Apereo licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a
* copy of the License at the following location:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jasig.cas.extension.clearpass;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.fail;
import java.util.Map;
import net.sf.ehcache.Cache;
import net.sf.ehcache.CacheManager;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
/**
* @author Scott Battaglia
* @since 1.0.6
*/
public class EncryptedMapDecoratorTests {
private Map<String, String> map;
private EncryptedMapDecorator decorator;
private CacheManager cacheManager;
@Before
public void setUp() throws Exception {
try {
this.cacheManager = new CacheManager(this.getClass().getClassLoader()
.getResourceAsStream("ehcacheClearPass.xml"));
final Cache cache = this.cacheManager.getCache("clearPassCache");
this.map = new EhcacheBackedMap(cache);
this.decorator = new EncryptedMapDecorator(map);
} catch (final Exception e) {
fail(e.getMessage());
}
}
@After
public void tearDown() throws Exception {
this.cacheManager.removalAll();
this.cacheManager.shutdown();
}
@Test
public void addItem() {
final String key = "MY_KEY";
final String value = "MY_VALUE";
this.decorator.put(key, value);
assertEquals(value, this.decorator.get(key));
assertNull(this.map.get(key));
}
@Test
public void addManyItems() {
final int totalItems = 100;
for (int i = 0; i < totalItems; i++) {
this.decorator.put("key" + i, "value" + i);
}
assertEquals(this.decorator.size(), totalItems);
for (int i = 0; i < totalItems; i++) {
assertNull(this.map.get("key" + i));
assertEquals("value" + i, this.decorator.get("key" + i));
}
}
@Test
public void addAndRemoveItem() {
final String key1 = "MY_REALLY_KEY";
final String value1 = "MY_VALUE";
final String key2 = "MY_KEY2";
final String value2 = "MY_VALUE2";
this.decorator.put(key1, value1);
this.decorator.put(key2, value2);
assertEquals(value1, this.decorator.get(key1));
assertEquals(value2, this.decorator.get(key2));
assertNull(this.map.get(key1));
assertNull(this.map.get(key2));
assertEquals(value1, this.decorator.remove(key1));
assertEquals(value2, this.decorator.remove(key2));
assertNull(this.decorator.get(key1));
assertNull(this.decorator.get(key2));
}
@Test
public void addNullKeyAndValue() {
this.decorator.put(null, null);
assertNull(this.decorator.get(null));
}
@Test
public void addNullValue() {
this.decorator.put("hello", null);
assertNull(this.decorator.get("hello"));
}
}
| [
"[email protected]"
] | |
30085f2b7c6629c545910188dc757c080c44c9d3 | bee4da6fab3466d20d852c59cd344553b538d508 | /src/arseny/bochkarev/simpletree/TreeTest.java | d32687a6ee11685820f509887ecea71716ab743e | [] | no_license | rfiit/svp | 714bc34251792076a0b1e3343654f36011ade988 | c49b56a06303ac58c57c209f005b4fff8d85131e | refs/heads/master | 2016-09-06T16:26:06.850520 | 2013-12-23T20:28:23 | 2013-12-23T20:28:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,601 | java | package arseny.bochkarev.simpletree;
import junit.framework.*;
import junit.framework.Assert;
import org.junit.*;
import org.junit.Test;
public class TreeTest extends Assert {
Tree<Integer> tree = new Tree<Integer>();
@Before
public void setUp() throws Exception {
tree.setRoot(1);
Tree.Conductor cnd = tree.getConductor();
cnd.addLeft(2);
cnd.addRight(2);
Tree.Conductor b = cnd.clone();
cnd.goLeft();
cnd.addLeft(3);
cnd.addRight(3);
cnd.goRight();
cnd.addRight(4);
cnd = b;
cnd.goRight();
cnd.addLeft(3);
cnd.goLeft();
cnd.addLeft(4);
}
@Test
public void testGetDeep() throws Exception {
assertEquals(tree.getDeep(), 4);
}
@Test
public void testCountNodeOnLevel() throws Exception {
assertEquals(tree.countNodeOnLevel(0), 0);
assertEquals(tree.countNodeOnLevel(-10), 0);
assertEquals(tree.countNodeOnLevel(1), 1);
assertEquals(tree.countNodeOnLevel(2), 2);
assertEquals(tree.countNodeOnLevel(3), 3);
assertEquals(tree.countNodeOnLevel(4), 2);
}
@Test
public void testLeftToRight() throws Exception {
Counter<Integer> c = new Counter<Integer>();
tree.leftToRight(c);
assertEquals(c.getCount(), 22);
}
@Test
public void testRightToLeft() throws Exception {
Counter<Integer> c = new Counter<Integer>();
tree.rightToLeft(c);
assertEquals(c.getCount(), 22);
}
}
| [
"[email protected]"
] | |
363238fddaedcd4e97347370874c88252b049a0d | e91f2c87a930a33a23c8896e47fa782daba80eed | /src/main/java/com/company/flint/States.java | abd8bf7f5b8259dd82bf64d42c1ebb1bbd220ef1 | [
"MIT"
] | permissive | jakobehmsen/flint | 3f23cb2d09a255264f8a032afcbf666fc305886b | d0e91543c0e43cd3ce354afe1142467fb92a324e | refs/heads/master | 2020-06-13T17:00:26.377248 | 2019-08-30T15:44:10 | 2019-08-30T15:44:10 | 194,723,214 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,866 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.company.flint;
/**
*
* @author jakob
*/
public class States {
public static State finish = new State() {
@Override
public State nextState(Evaluator evaluator) {
evaluator.stop();
return this;
}
@Override
public String toString() {
return "finish";
}
};
public static State invoke(State.Callable c, State.Continuation continuation) {
return new State() {
@Override
public State nextState(Evaluator evaluator) {
return c.invoke(evaluator, continuation);
}
@Override
public String toString() {
return "invoke " + c + " for " + continuation;
}
};
}
public static State continueWith(Object result, State.Continuation continuation) {
return new State() {
@Override
public State nextState(Evaluator evaluator) {
return continuation.nextState(evaluator, result);
}
@Override
public String toString() {
return "continue-with " + (result != null ? result + " for " : "") + continuation;
}
};
}
public static State.Continuation always(State state) {
return new State.Continuation() {
@Override
public State nextState(Evaluator evaluator, Object result) {
return state;
}
@Override
public String toString() {
return "" + state;
}
};
}
public static State.Callable respond(State.Callable expr) {
return new State.Callable() {
@Override
public State invoke(Evaluator evaluator, State.Continuation continuation) {
return States.invoke(expr, new State.Continuation() {
@Override
public State nextState(Evaluator evaluator, Object result) {
evaluator.getFrame().push(result);
evaluator.getFrame().respondWith(evaluator);
return continueWith(result, continuation);
}
});
}
};
}
public static State.Callable push(State.Callable expr) {
return new State.Callable() {
@Override
public State invoke(Evaluator evaluator, State.Continuation continuation) {
return States.invoke(expr, new State.Continuation() {
@Override
public State nextState(Evaluator evaluator, Object result) {
evaluator.getFrame().push(result);
return continueWith(null, continuation);
}
@Override
public String toString() {
return "push";
}
});
}
@Override
public String toString() {
return "push " + expr;
}
};
}
public static State.Callable exprs() {
return null;
}
public static State.Callable expr() {
return new State.Callable() {
@Override
public State invoke(Evaluator evaluator, State.Continuation continuation) {
if(evaluator.getFrame().getMessageStream().peek() instanceof Long) {
if(evaluator.getFrame().getMessageStream().peekEquals(1, evaluator.getSymbolTable().getSymbolCodeFromString("<-"))) {
Long name = (Long) evaluator.getFrame().getMessageStream().consume();
evaluator.getFrame().getMessageStream().consume();
return States.invoke(expr(), new State.Continuation() {
@Override
public State nextState(Evaluator evaluator, Object result) {
evaluator.getFrame().push(result);
evaluator.getFrame().store(name);
return continueWith(result, continuation);
}
@Override
public String toString() {
return "expr";
}
});
}
}
return States.invoke(expr1(), continuation);
}
@Override
public String toString() {
return "expr";
}
};
}
public static State.Callable expr1() {
return new State.Callable() {
@Override
public State invoke(Evaluator evaluator, State.Continuation continuation) {
Object obj = evaluator.getFrame().getMessageStream().consume();
return continueWith(obj, continuation);
}
@Override
public String toString() {
return "expr1";
}
};
}
public static State.Callable consume() {
return new State.Callable() {
@Override
public State invoke(Evaluator evaluator, State.Continuation continuation) {
Object obj = evaluator.getFrame().getMessageStream().consume();
return continueWith(obj, continuation);
}
@Override
public String toString() {
return "consume";
}
};
}
}
| [
"[email protected]"
] | |
4914735fa7aea207229229a16e6bbcab230ab8d3 | 028cbe18b4e5c347f664c592cbc7f56729b74060 | /external/modules/felix.woodstox-core-asl/4.0.7/src/java/com/ctc/wstx/sr/NonNsInputElementStack.java | 8fe6a0a6d59579222a178a885d8b5a6b7a9412b2 | [] | no_license | dmatej/Glassfish-SVN-Patched | 8d355ff753b23a9a1bd9d7475fa4b2cfd3b40f9e | 269e29ba90db6d9c38271f7acd2affcacf2416f1 | refs/heads/master | 2021-05-28T12:55:06.267463 | 2014-11-11T04:21:44 | 2014-11-11T04:21:44 | 23,610,469 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,577 | java | package com.ctc.wstx.sr;
import java.util.*;
import javax.xml.namespace.QName;
import javax.xml.stream.Location;
import javax.xml.stream.XMLStreamException;
import org.codehaus.stax2.ri.EmptyIterator;
import org.codehaus.stax2.validation.XMLValidator;
import com.ctc.wstx.api.ReaderConfig;
import com.ctc.wstx.util.BaseNsContext;
import com.ctc.wstx.util.EmptyNamespaceContext;
import com.ctc.wstx.util.StringVector;
import com.ctc.wstx.util.TextBuilder;
/**
* Sub-class of {@link InputElementStack} used when operating in
* non-namespace-aware, non validating mode.
*/
public final class NonNsInputElementStack
extends InputElementStack
{
final static String INT_ERR_UNEXPECTED_CALL = "Internal error: method should never be called for non-namespace element stack.";
/*
//////////////////////////////////////////////////
// Configuration
//////////////////////////////////////////////////
*/
protected final NonNsAttributeCollector mAttrCollector;
/*
//////////////////////////////////////////////////
// Element stack state information
//////////////////////////////////////////////////
*/
/**
* Array that contains path of open elements from root, one String
* for each open start element.
*/
protected String[] mElements;
/**
* Number of Strings in {@link #mElements} that are valid.
*/
protected int mSize;
/*
//////////////////////////////////////////////////
// Simple 1-slot QName cache; used for improving
// efficiency of code that uses QNames extensively
// (like StAX Event API implementation)
//////////////////////////////////////////////////
*/
protected String mLastLocalName = null;
protected QName mLastName = null;
/*
//////////////////////////////////////////////////
// Life-cycle (create, update state)
//////////////////////////////////////////////////
*/
public NonNsInputElementStack(int initialSize, ReaderConfig cfg)
{
super(cfg);
mSize = 0;
if (initialSize < 4) {
initialSize = 4;
}
mElements = new String[initialSize];
mAttrCollector = new NonNsAttributeCollector(cfg);
}
protected void setAutomaticDTDValidator(XMLValidator validator, NsDefaultProvider nsDefs)
{
addValidator(validator);
}
public final void push(String prefix, String localName)
{
throw new IllegalStateException(INT_ERR_UNEXPECTED_CALL);
}
public final void push(String fullName)
{
if (mSize == mElements.length) {
String[] old = mElements;
mElements = new String[old.length + 32];
System.arraycopy(old, 0, mElements, 0, old.length);
}
mElements[mSize] = fullName;
++mSize;
mAttrCollector.reset();
}
/**
* @return True if stack still has elements; false if not (root closed)
*/
public boolean pop()
throws XMLStreamException
{
if (mSize == 0) {
throw new IllegalStateException("Popping from empty stack.");
}
/* Let's allow GCing (not likely to matter, as Strings are very
* likely interned... but it's a good habit
*/
mElements[--mSize] = null;
return (mSize > 0);
}
/**
* Method called to update information about top of the stack, with
* attribute information passed in. Will resolve namespace references,
* and update namespace stack with information.
*
* @return Validation state that should be effective for the fully
* resolved element context
*/
public int resolveAndValidateElement()
throws XMLStreamException
{
NonNsAttributeCollector ac = mAttrCollector;
/* Attribute collector can now build its accessor data structs
* as necessary
*/
int xmlidIx = ac.resolveValues(mReporter);
mIdAttrIndex = xmlidIx;
// Any validator(s)? If not, we are done (except for xml:id check)
if (mValidator == null) {
if (xmlidIx >= 0) { // need to normalize xml:id, still?
normalizeXmlIdAttr(ac, xmlidIx);
}
return XMLValidator.CONTENT_ALLOW_ANY_TEXT;
}
// Otherwise need to call validator's methods:
/* First, a call to check if the element itself may be acceptable
* within structure:
*/
mValidator.validateElementStart(mElements[mSize-1], null,null);
// Then attributes, if any:
int attrLen = ac.getCount();
if (attrLen > 0) {
StringVector attrNames = ac.getNameList();
String[] nameData = attrNames.getInternalArray();
TextBuilder attrBuilder = ac.getAttrBuilder();
char[] attrCB = attrBuilder.getCharBuffer();
for (int i = 0; i < attrLen; ++i) {
String normValue = mValidator.validateAttribute
(nameData[i], null, null, attrCB,
attrBuilder.getOffset(i),
attrBuilder.getOffset(i+1));
if (normValue != null) {
ac.setNormalizedValue(i, normValue);
}
}
}
/* And finally let's wrap things up to see what textual content
* is allowed as child content, if any:
*/
return mValidator.validateElementAndAttributes();
}
public int validateEndElement()
throws XMLStreamException
{
if (mValidator == null) { // should never be null if we get here
return XMLValidator.CONTENT_ALLOW_ANY_TEXT;
}
int index = mSize-1;
int result = mValidator.validateElementEnd(mElements[index], null, null);
if (index == 0) { // root closing
mValidator.validationCompleted(true);
}
return result;
}
/*
///////////////////////////////////////////////////
// Access to helper objects
///////////////////////////////////////////////////
*/
public final AttributeCollector getAttrCollector() {
return mAttrCollector;
}
/**
* Method called to construct a non-transient NamespaceContext instance;
* generally needed when creating events to return from event-based
* iterators.
*/
public final BaseNsContext createNonTransientNsContext(Location loc) {
return EmptyNamespaceContext.getInstance();
}
/*
///////////////////////////////////////////////////
// Implementation of NamespaceContext:
///////////////////////////////////////////////////
*/
public final String getNamespaceURI(String prefix) {
/* No prefixes can be bound in non-namespace mode, however,
* "no prefix" needs to match "no namespace": latter of which
* is signified by the empty String
*/
if (prefix == null || prefix.length() == 0) {
return "";
}
return null;
}
public final String getPrefix(String nsURI) {
return null;
}
public final Iterator getPrefixes(String nsURI) {
return EmptyIterator.getInstance();
}
/*
///////////////////////////////////////////////////
// AttributeInfo methods (StAX2)
///////////////////////////////////////////////////
*/
public final int getAttributeCount()
{
return mAttrCollector.getCount();
}
public final int findAttributeIndex(String nsURI, String localName)
{
// Should never pass a NS URI...
if (nsURI != null && nsURI.length() > 0) {
return -1;
}
return mAttrCollector.findIndex(localName);
}
/*
///////////////////////////////////////////////////
// ValidationContext methods
///////////////////////////////////////////////////
*/
public final QName getCurrentElementName()
{
if (mSize == 0) {
return null;
}
/* 03-Dec-2004, TSa: Maybe we can just reuse the last QName
* object created, if we have same data? (happens if
* state hasn't changed, or we got end element for a leaf
* element, or repeating leaf elements)
*/
String ln = mElements[mSize-1];
/* Since local names are always interned, can just use cheap
* identity comparison here:
*/
if (ln == mLastLocalName) {
return mLastName;
}
QName n = new QName(ln);
mLastLocalName = ln;
mLastName = n;
return n;
}
public int addDefaultAttribute(String localName, String uri, String prefix,
String value)
{
// No real namespace info passed...
return mAttrCollector.addDefaultAttribute(localName, value);
}
/*
///////////////////////////////////////////////////
// Support for NsDefaultProvider
///////////////////////////////////////////////////
*/
public boolean isPrefixLocallyDeclared(String internedPrefix) {
// should never be called... but let's not care if it is
return false;
}
public void addNsBinding(String prefix, String uri) {
// should never be called... but let's just ignore it.
}
/*
///////////////////////////////////////////////////
// Accessors:
///////////////////////////////////////////////////
*/
public final boolean isNamespaceAware() {
return false;
}
// // // Generic stack information:
public final int getDepth() { return mSize; }
public final boolean isEmpty() {
return mSize == 0;
}
// // // Information about element at top of stack:
public final String getDefaultNsURI() {
return null;
}
public final String getNsURI() {
return null;
}
public final String getPrefix() {
return null;
}
public final String getLocalName() {
if (mSize == 0) {
throw new IllegalStateException("Illegal access, empty stack.");
}
return mElements[mSize-1];
}
public final boolean matches(String prefix, String localName)
{
if (mSize == 0) {
throw new IllegalStateException("Illegal access, empty stack.");
}
if (prefix != null && prefix.length() > 0) {
return false;
}
String thisName = mElements[mSize-1];
return (thisName == localName) || thisName.equals(localName);
}
public final String getTopElementDesc() {
if (mSize == 0) {
throw new IllegalStateException("Illegal access, empty stack.");
}
return mElements[mSize-1];
}
// // // Namespace information:
public final int getTotalNsCount() {
return 0;
}
/**
* @return Number of active prefix/namespace mappings for current scope,
* NOT including mappings from enclosing elements.
*/
public final int getCurrentNsCount() {
return 0;
}
public final String getLocalNsPrefix(int index) {
throwIllegalIndex(index);
return null;
}
public final String getLocalNsURI(int index) {
throwIllegalIndex(index);
return null;
}
private static void throwIllegalIndex(int index) {
throw new IllegalArgumentException("Illegal namespace index "+index
+"; current scope has no namespace declarations.");
}
}
| [
"heavy@6f3ba3e3-413c-0410-a8aa-90bee3ab43b5"
] | heavy@6f3ba3e3-413c-0410-a8aa-90bee3ab43b5 |
fa755d12bde2f0060164d52b228da63d30382a7a | ae463c806a0a4bbd4284af66d22921e0992db338 | /assignment-2/Assignment3/Test.java | 23fa7553943964707bc0a9cc11f2962ae9b8fde8 | [] | no_license | heisthere/Blockchain-assignments | 2b6a199118c930ac7386de37849f2ffd795326f7 | cf44f8bdf0b9d54b57d9af5d25ce8931fd33998d | refs/heads/master | 2022-11-26T06:29:41.316826 | 2020-07-31T11:08:42 | 2020-07-31T11:08:42 | 284,001,484 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,432 | java | import java.security.InvalidKeyException;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.NoSuchAlgorithmException;
import java.security.Signature;
import java.security.SignatureException;
import java.util.ArrayList;
import java.util.Random;
public class Test {
public static void main(String[] args) throws InvalidKeyException, NoSuchAlgorithmException,
SignatureException {
// txHandler holds all randomly generated transactions
TxHandler txHandler;
Transaction tx;
Random random = new Random();
int numBitsKeyPair = 512;
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA");
keyPairGenerator.initialize(numBitsKeyPair);
KeyPair scroogeKeyPair = keyPairGenerator.genKeyPair();
KeyPair aliceKeyPair = keyPairGenerator.genKeyPair();
KeyPair bobKeyPair = keyPairGenerator.genKeyPair();
// Create initial UTXO-Pool with coins to be spend later
UTXOPool utxoPool = new UTXOPool();
int numInitialUTXOs = 20;
int maxValueOutput = 20;
for (int i = 0; i < numInitialUTXOs; i++){
tx = new Transaction();
int numOutput = random.nextInt(maxValueOutput) + 1;
for (int j = 0; j < numOutput; j++){
double value = random.nextDouble() + 1;
tx.addOutput(value, scroogeKeyPair.getPublic()); // assign all coins to scrooge
}
tx.finalize();
// add all outputs as Unspent Transaction Output
for (int j = 0; j < numOutput; j++){
UTXO utxo = new UTXO(tx.getHash(), j);
utxoPool.addUTXO(utxo, tx.getOutput(j));
}
}
// txHandler is now initialized
txHandler = new TxHandler(new UTXOPool(utxoPool));
// Example Test: test isValidTx() with one valid transaction from scrooge to alice
Transaction validTx = new Transaction();
// choose an unspent transaction as input
UTXO utxo = utxoPool.getAllUTXO().get(0);
validTx.addInput(utxo.getTxHash(), utxo.getIndex());
// assign whole input to alice
double inputValue = utxoPool.getTxOutput(utxo).value;
double outputValue = inputValue;
validTx.addOutput(outputValue, aliceKeyPair.getPublic());
// uncommenting the next line tests for doublespending within one transaction
//validTx.addOutput(outputValue, bobKeyPair.getPublic());
// sign transaction using scrooge's private key
Signature signature = Signature.getInstance("SHA256withRSA");
signature.initSign(scroogeKeyPair.getPrivate());
signature.update(validTx.getRawDataToSign(0));
validTx.addSignature(signature.sign(), 0);
validTx.finalize();
// check for validity
if(txHandler.isValidTx(validTx)){
System.out.println("Transaction is valid.\n");
}else{
System.out.println("Transaction is invalid.\n");
}
Transaction[] acceptedTx = txHandler.handleTxs(new Transaction[]{validTx});
if(acceptedTx.length == 1){
System.out.println("Transaction is accepted.\n");
}else{
System.out.println("Transaction is not accepted.\n");
}
}
}
| [
"[email protected]"
] | |
dd20022aea6fea8dcf78314daa757f71a94c92b3 | 42b4b2000bfe0bb0dffa2a8d74f4d47916141dbe | /src/main/java/com/springmvc/mapping/RoleFunctionMapper.java | e0f003deaedbefc751792c7e77056b10a6df147c | [] | no_license | hexingtong/Yuerfei | f84ab45e4b8522e72d5c92ba1d4edac4b2c1769b | 7a0fc24304451ae236f7b9cde24c2e242e0e4550 | refs/heads/master | 2020-04-25T09:00:48.366274 | 2019-05-17T01:25:48 | 2019-05-17T01:25:48 | 172,187,237 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 182 | java | package com.springmvc.mapping;
import com.springmvc.pojo.RoleFunction;
import tk.mybatis.mapper.common.Mapper;
public interface RoleFunctionMapper extends Mapper<RoleFunction> {
} | [
"[email protected]"
] | |
42df0a1907f5610f3e6cd6598de53ad0fe987777 | 83d3c511f02ab4d37dba551f76040f4c5031e14b | /HashMap Exercises/src/com/ojas/hashmap/ShallowCopyOfMap.java | 92a6df63b0fc1d28de5b119ca198362283e1d4c5 | [] | no_license | MaheshPikkili/javacode | e079c0388f9ef6a5ca091700e2878733033a6f0b | c3ffaaac093f5f9fd78d1a126aac213315670aeb | refs/heads/master | 2020-03-24T07:04:18.158571 | 2018-07-27T07:12:34 | 2018-07-27T07:12:34 | 142,551,568 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 613 | java | package com.ojas.hashmap;
import java.util.HashMap;
import java.util.Map;
public class ShallowCopyOfMap {
public static void main(String[] args) {
HashMap<Integer,String> hash_map= new HashMap<Integer,String>();
hash_map.put(1, "Red");
hash_map.put(2, "Green");
hash_map.put(3, "Black");
hash_map.put(4, "White");
hash_map.put(5, "Blue");
HashMap<Integer,String> hash_map1= new HashMap<Integer,String>(hash_map);
for (Map.Entry<Integer, String> string : hash_map1.entrySet()) {
System.out.println(string.getKey()+" "+string.getValue());
}
}
}
| [
"[email protected]"
] | |
bf48ea70d6d23f1864bc81723eecb2a4d112ac9f | f7160c0f0526cc5afc0fe4e6f06d384394059aa1 | /cellang/cl-webc/src/main/java/org/cellang/webc/main/client/handler/headeritem/CreateTableHeaderItemHandler.java | 93089fbda08b138b25e43e2832acbdb4ea1ee2a4 | [] | no_license | o1711/somecode | e2461c4fb51b3d75421c4827c43be52885df3a56 | a084f71786e886bac8f217255f54f5740fa786de | refs/heads/master | 2021-09-14T14:51:58.704495 | 2018-05-15T07:51:05 | 2018-05-15T07:51:05 | 112,574,683 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 710 | java | package org.cellang.webc.main.client.handler.headeritem;
import org.cellang.clwt.commons.client.frwk.HeaderItemEvent;
import org.cellang.clwt.core.client.Container;
import org.cellang.clwt.core.client.event.Event.EventHandlerI;
import org.cellang.webc.main.client.MainControlI;
import org.cellang.webc.main.client.handler.WebcHandlerSupport;
public class CreateTableHeaderItemHandler extends WebcHandlerSupport implements EventHandlerI<HeaderItemEvent> {
public CreateTableHeaderItemHandler(Container c) {
super(c);
}
@Override
public void handle(HeaderItemEvent t) {
MainControlI mc = this.getControl(MainControlI.class, true);
mc.openCreateTableView(true);//
}
}
| [
"[email protected]"
] | |
76cce54afe5fd9a41191ed30796440c3a51f8a80 | 1e212405cd1e48667657045ad91fb4dc05596559 | /lib/openflowj-3.3.0-SNAPSHOT-sources (copy)/org/projectfloodlight/openflow/protocol/ver14/OFBsnTlvExternalGatewayIpVer14.java | aa0ff1093e246f31424da4f7ee925da3d1217be5 | [
"Apache-2.0"
] | permissive | aamorim/floodlight | 60d4ef0b6d7fe68b8b4688f0aa610eb23dd790db | 1b7d494117f3b6b9adbdbcf23e6cb3cc3c6187c9 | refs/heads/master | 2022-07-10T21:50:11.130010 | 2019-09-03T19:02:41 | 2019-09-03T19:02:41 | 203,223,614 | 1 | 0 | Apache-2.0 | 2022-07-06T20:07:15 | 2019-08-19T18:00:01 | Java | UTF-8 | Java | false | false | 8,552 | java | // Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
// Copyright (c) 2011, 2012 Open Networking Foundation
// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
// This library was generated by the LoxiGen Compiler.
// See the file LICENSE.txt which should have been included in the source distribution
// Automatically generated by LOXI from template of_class.java
// Do not modify
package org.projectfloodlight.openflow.protocol.ver14;
import org.projectfloodlight.openflow.protocol.*;
import org.projectfloodlight.openflow.protocol.action.*;
import org.projectfloodlight.openflow.protocol.actionid.*;
import org.projectfloodlight.openflow.protocol.bsntlv.*;
import org.projectfloodlight.openflow.protocol.errormsg.*;
import org.projectfloodlight.openflow.protocol.meterband.*;
import org.projectfloodlight.openflow.protocol.instruction.*;
import org.projectfloodlight.openflow.protocol.instructionid.*;
import org.projectfloodlight.openflow.protocol.match.*;
import org.projectfloodlight.openflow.protocol.stat.*;
import org.projectfloodlight.openflow.protocol.oxm.*;
import org.projectfloodlight.openflow.protocol.oxs.*;
import org.projectfloodlight.openflow.protocol.queueprop.*;
import org.projectfloodlight.openflow.types.*;
import org.projectfloodlight.openflow.util.*;
import org.projectfloodlight.openflow.exceptions.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Set;
import io.netty.buffer.ByteBuf;
import com.google.common.hash.PrimitiveSink;
import com.google.common.hash.Funnel;
class OFBsnTlvExternalGatewayIpVer14 implements OFBsnTlvExternalGatewayIp {
private static final Logger logger = LoggerFactory.getLogger(OFBsnTlvExternalGatewayIpVer14.class);
// version: 1.4
final static byte WIRE_VERSION = 5;
final static int LENGTH = 8;
private final static IPv4Address DEFAULT_VALUE = IPv4Address.NONE;
// OF message fields
private final IPv4Address value;
//
// Immutable default instance
final static OFBsnTlvExternalGatewayIpVer14 DEFAULT = new OFBsnTlvExternalGatewayIpVer14(
DEFAULT_VALUE
);
// package private constructor - used by readers, builders, and factory
OFBsnTlvExternalGatewayIpVer14(IPv4Address value) {
if(value == null) {
throw new NullPointerException("OFBsnTlvExternalGatewayIpVer14: property value cannot be null");
}
this.value = value;
}
// Accessors for OF message fields
@Override
public int getType() {
return 0x1a;
}
@Override
public IPv4Address getValue() {
return value;
}
@Override
public OFVersion getVersion() {
return OFVersion.OF_14;
}
public OFBsnTlvExternalGatewayIp.Builder createBuilder() {
return new BuilderWithParent(this);
}
static class BuilderWithParent implements OFBsnTlvExternalGatewayIp.Builder {
final OFBsnTlvExternalGatewayIpVer14 parentMessage;
// OF message fields
private boolean valueSet;
private IPv4Address value;
BuilderWithParent(OFBsnTlvExternalGatewayIpVer14 parentMessage) {
this.parentMessage = parentMessage;
}
@Override
public int getType() {
return 0x1a;
}
@Override
public IPv4Address getValue() {
return value;
}
@Override
public OFBsnTlvExternalGatewayIp.Builder setValue(IPv4Address value) {
this.value = value;
this.valueSet = true;
return this;
}
@Override
public OFVersion getVersion() {
return OFVersion.OF_14;
}
@Override
public OFBsnTlvExternalGatewayIp build() {
IPv4Address value = this.valueSet ? this.value : parentMessage.value;
if(value == null)
throw new NullPointerException("Property value must not be null");
//
return new OFBsnTlvExternalGatewayIpVer14(
value
);
}
}
static class Builder implements OFBsnTlvExternalGatewayIp.Builder {
// OF message fields
private boolean valueSet;
private IPv4Address value;
@Override
public int getType() {
return 0x1a;
}
@Override
public IPv4Address getValue() {
return value;
}
@Override
public OFBsnTlvExternalGatewayIp.Builder setValue(IPv4Address value) {
this.value = value;
this.valueSet = true;
return this;
}
@Override
public OFVersion getVersion() {
return OFVersion.OF_14;
}
//
@Override
public OFBsnTlvExternalGatewayIp build() {
IPv4Address value = this.valueSet ? this.value : DEFAULT_VALUE;
if(value == null)
throw new NullPointerException("Property value must not be null");
return new OFBsnTlvExternalGatewayIpVer14(
value
);
}
}
final static Reader READER = new Reader();
static class Reader implements OFMessageReader<OFBsnTlvExternalGatewayIp> {
@Override
public OFBsnTlvExternalGatewayIp readFrom(ByteBuf bb) throws OFParseError {
int start = bb.readerIndex();
// fixed value property type == 0x1a
short type = bb.readShort();
if(type != (short) 0x1a)
throw new OFParseError("Wrong type: Expected=0x1a(0x1a), got="+type);
int length = U16.f(bb.readShort());
if(length != 8)
throw new OFParseError("Wrong length: Expected=8(8), got="+length);
if(bb.readableBytes() + (bb.readerIndex() - start) < length) {
// Buffer does not have all data yet
bb.readerIndex(start);
return null;
}
if(logger.isTraceEnabled())
logger.trace("readFrom - length={}", length);
IPv4Address value = IPv4Address.read4Bytes(bb);
OFBsnTlvExternalGatewayIpVer14 bsnTlvExternalGatewayIpVer14 = new OFBsnTlvExternalGatewayIpVer14(
value
);
if(logger.isTraceEnabled())
logger.trace("readFrom - read={}", bsnTlvExternalGatewayIpVer14);
return bsnTlvExternalGatewayIpVer14;
}
}
public void putTo(PrimitiveSink sink) {
FUNNEL.funnel(this, sink);
}
final static OFBsnTlvExternalGatewayIpVer14Funnel FUNNEL = new OFBsnTlvExternalGatewayIpVer14Funnel();
static class OFBsnTlvExternalGatewayIpVer14Funnel implements Funnel<OFBsnTlvExternalGatewayIpVer14> {
private static final long serialVersionUID = 1L;
@Override
public void funnel(OFBsnTlvExternalGatewayIpVer14 message, PrimitiveSink sink) {
// fixed value property type = 0x1a
sink.putShort((short) 0x1a);
// fixed value property length = 8
sink.putShort((short) 0x8);
message.value.putTo(sink);
}
}
public void writeTo(ByteBuf bb) {
WRITER.write(bb, this);
}
final static Writer WRITER = new Writer();
static class Writer implements OFMessageWriter<OFBsnTlvExternalGatewayIpVer14> {
@Override
public void write(ByteBuf bb, OFBsnTlvExternalGatewayIpVer14 message) {
// fixed value property type = 0x1a
bb.writeShort((short) 0x1a);
// fixed value property length = 8
bb.writeShort((short) 0x8);
message.value.write4Bytes(bb);
}
}
@Override
public String toString() {
StringBuilder b = new StringBuilder("OFBsnTlvExternalGatewayIpVer14(");
b.append("value=").append(value);
b.append(")");
return b.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
OFBsnTlvExternalGatewayIpVer14 other = (OFBsnTlvExternalGatewayIpVer14) obj;
if (value == null) {
if (other.value != null)
return false;
} else if (!value.equals(other.value))
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((value == null) ? 0 : value.hashCode());
return result;
}
}
| [
"alex@VM-UFS-001"
] | alex@VM-UFS-001 |
26eeb118585bc0edbb4271f8d9f02cbd0c20ad92 | 9ba95236906aa41c9811b67570df863f5c0ff5c8 | /app/src/test/java/com/example/busra/tabapp/ExampleUnitTest.java | a631d45c6b836b6698d2c49cfeda5bca66c5c595 | [] | no_license | BusraKarnucuKou/AkilliEvApp | 42cbea0f80e6489daad74e02270bd4f0d0693226 | 7900751dbe8ddcf51218d72b34dc216be7144774 | refs/heads/master | 2021-01-22T21:23:21.361203 | 2017-03-21T09:25:25 | 2017-03-21T09:25:25 | 85,425,759 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 402 | java | package com.example.busra.tabapp;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
] | |
2f8e23a4215b7de6befd6b0c7b3f8d180c33f0a3 | b2acd6c8c84bb610a9e7f6135ea150d43a76af39 | /OCP_JAVA8_PREP/src/org/sbpdiscovery/java/collections/Sorted.java | 30dea796ac0d3a50109dd7c111653106f7f50703 | [] | no_license | kaiwpost/OCP_JAVA8_PREP | 50d35ce6de6d0aefad5e4d5a226d90df40060128 | 0b5fd790c7f0a7b484ec6c7a53f41e79d669e7b9 | refs/heads/master | 2021-01-21T15:27:40.024804 | 2017-06-02T06:34:41 | 2017-06-02T06:34:41 | 91,846,613 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 932 | java | package org.sbpdiscovery.java.collections;
import java.util.*;
/**
* @author Kai W. Post, SBP Medical Discovery Institute, 2017
*/
public class Sorted implements Comparable<Sorted>, Comparator<Sorted> {
private int num;
private String text;
public Sorted(int num, String text) {
super();
this.num = num;
this.text = text;
}
@Override
public int compare(Sorted s1, Sorted s2) {
return s1.num - s2.num;
}
@Override
public int compareTo(Sorted s) {
return text.compareTo(s.text);
}
@Override
public String toString() {
return "" + num;
}
public static void main(String[] args) {
Sorted s1 = new Sorted(88, "a");
Sorted s2 = new Sorted(55, "b");
TreeSet<Sorted> t1 = new TreeSet<>();
t1.add(s1);
t1.add(s2);
System.out.println(t1);
TreeSet<Sorted> t2 = new TreeSet<>(s1);
t2.add(s1);
t2.add(s2);
System.out.println(t2);
System.out.println(t1 + " " + t2);
}
}
| [
"[email protected]"
] | |
a4b644197a3561637da90516698d23771ab988bb | b0c63ba84a96116b1e3d45348f51a6361fb4691e | /Spring/AOP/spring-aop/src/main/java/org/genesis/javacollector/spring/aop/advice/ForumService.java | e0116c3ad5dbe9620289ae602851a7ac0fbb79d2 | [
"Apache-2.0"
] | permissive | davidgjy/java-collector | 24f76b788db44fc7b1ce0b98c8be12e62d984fc2 | 137d46a72c82c29931e39911f6487f7fdd206d0c | refs/heads/master | 2022-12-24T21:10:56.126983 | 2021-02-26T03:06:16 | 2021-02-26T03:06:16 | 124,169,492 | 0 | 0 | Apache-2.0 | 2022-12-16T04:31:39 | 2018-03-07T02:50:42 | Java | UTF-8 | Java | false | false | 371 | java | package org.genesis.javacollector.spring.aop.advice;
import java.sql.SQLException;
public class ForumService {
public void removeForum(int forumId) {
// do sth...
throw new RuntimeException("运行异常。");
}
public void updateForum(Forum forum) throws Exception{
// do sth...
throw new SQLException("数据更新操作异常。");
}
}
| [
"[email protected]"
] | |
4569ef8b7b72750c6d33211169cdb372a85e9c68 | c6eadacfc86f17e5d4d9634470e2c478177d4bcb | /app/src/main/java/com/example/listapp/DetailActivity.java | e8b373ec51e4154a4eecf065cc00cddba443e6ab | [] | no_license | marine03/listApp | 5cc712cc6930838c6ebc1ea664fe69cb237e3a99 | c8efe889089b512b95e94c3735ac4d708e4dd3d1 | refs/heads/master | 2020-07-27T13:15:13.308435 | 2019-09-17T16:19:13 | 2019-09-17T16:19:13 | 209,101,717 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,798 | java | package com.example.listapp;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.widget.ImageViewCompat;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.view.Display;
import android.widget.ImageView;
public class DetailActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_detail);
Intent in = getIntent();
int index = in.getIntExtra("com.example.listapp.ITEM_INDEX", -1);
if (index > -1){
int pic = getImg(index);
ImageView img = (ImageView) findViewById(R.id.imageView);
scaleImg(img,pic);
}
}
private int getImg(int index){
switch(index){
case 0 : return R.drawable.peach;
case 1 : return R.drawable.tomato;
case 2 : return R.drawable.squash;
default: return -1;
}
}
private void scaleImg(ImageView img, int pic){
Display screen = getWindowManager().getDefaultDisplay();
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeResource(getResources(),pic,options);
int imgWidth = options.outWidth;
int screenWidth = screen.getWidth();
if(imgWidth>screenWidth){
int ratio = Math.round((float)imgWidth/(float)screenWidth);
options.inSampleSize = ratio;
}
options.inJustDecodeBounds = false;
Bitmap scaledImg = BitmapFactory.decodeResource(getResources(),pic,options);
img.setImageBitmap(scaledImg);
}
}
| [
"[email protected]"
] | |
52fb6e7335b2e8e409a11720d450849ed533cf34 | c7a4d834c0fabf1d8bae5c38294c1ecf5aa8b845 | /RetailerAppMedi/app/src/main/java/com/medicento/retailerappmedi/adapter/ItemCartList.java | a890185828271803fbffd64a4b64d4af2f55341e | [] | no_license | Gitesh-Shastri/retailer-app-tester | f2b84c0772d51c2e489d0ae52059ac2a14ed21a4 | fc0a180cb88c9f0c519e1be88dbefe59d220cfcd | refs/heads/master | 2021-07-06T16:06:56.978777 | 2020-08-29T09:18:20 | 2020-08-29T09:18:20 | 162,337,905 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,433 | java | package com.medicento.retailerappmedi.adapter;
import android.content.Context;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.medicento.retailerappmedi.R;
import com.medicento.retailerappmedi.data.EssentialList;
import java.util.ArrayList;
public class ItemCartList extends RecyclerView.Adapter<BaseViewHolder> {
private ArrayList<EssentialList> essentialLists;
private Context context;
public ItemCartList(ArrayList<EssentialList> essentialLists, Context context) {
this.essentialLists = essentialLists;
this.context = context;
}
OverallCostChangeListener mOverallCostChangeListener;
public interface OverallCostChangeListener {
void onCostChanged();
}
public void setmOverallCostChangeListener(OverallCostChangeListener mOverallCostChangeListener) {
this.mOverallCostChangeListener = mOverallCostChangeListener;
}
@NonNull
@Override
public BaseViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
LayoutInflater inflater = LayoutInflater.from(viewGroup.getContext());
View view = inflater.inflate(R.layout.item_cart_list, viewGroup, false);
return new ViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull BaseViewHolder baseViewHolder, int i) {
baseViewHolder.onBind(i);
}
public ArrayList<EssentialList> getEssentialLists() {
return essentialLists;
}
@Override
public int getItemCount() {
return essentialLists != null ? essentialLists.size() : 0;
}
public class ViewHolder extends BaseViewHolder {
EditText qty;
TextView cost, name, discount, gst;
ImageView edit, delete, image;
public ViewHolder(View itemView) {
super(itemView);
gst = itemView.findViewById(R.id.gst);
discount = itemView.findViewById(R.id.discount);
edit = itemView.findViewById(R.id.edit);
qty = itemView.findViewById(R.id.qty);
name = itemView.findViewById(R.id.name);
cost = itemView.findViewById(R.id.cost);
delete = itemView.findViewById(R.id.delete);
image = itemView.findViewById(R.id.image);
}
@Override
protected void clear() {
qty.setText("");
cost.setText("");
name.setText("");
discount.setText("");
gst.setText("");
}
@Override
public void onBind(int position) {
super.onBind(position);
EssentialList essentialList = essentialLists.get(position);
qty.setText(essentialList.getQty()+"");
if (essentialList.getMrp() >= essentialList.getCost()) {
discount.setText((int)((1-(essentialLists.get(position).getCost()/essentialLists.get(position).getMrp()))*100)+"% OFF");
} else {
discount.setText("0% OFF");
}
gst.setText(essentialList.getDiscount() + "% GST applicable");
cost.setText("₹ " + (essentialList.getCost()*essentialList.getQty()));
name.setText(essentialList.getName());
Glide.with(context).load(essentialLists.get(position).getImage_url()).into(image);
edit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
qty.requestFocus();
}
});
delete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
essentialLists.remove(getCurrentPosition());
if (mOverallCostChangeListener != null) {
mOverallCostChangeListener.onCostChanged();
}
notifyDataSetChanged();
}
});
qty.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void afterTextChanged(Editable editable) {
if (!qty.getText().toString().trim().equals("0")) {
try {
essentialLists.get(getCurrentPosition()).setQty(Integer.parseInt(qty.getText().toString()));
if (mOverallCostChangeListener != null) {
mOverallCostChangeListener.onCostChanged();
}
notifyItemChanged(getCurrentPosition());
} catch (Exception e) {
e.printStackTrace();
}
}
qty.setSelection(qty.getText().toString().length());
}
});
}
}
}
| [
"[email protected]"
] | |
c648befdc60719edb8a3d2e1c3a71299208b7869 | 076b8e079f885488d74ad9209429c6ed964bd171 | /corejavateacher/src/com/tz/day13/StudentComparator.java | fea621d2df7a4cc4d700324e36b092bbaa261aa7 | [] | no_license | jinrenyu/JavaEE | b987cddb53ee9cf9f58de60aa15c7fa5053579bd | 6d6d4bd62160958d55167e59103e9768cc172396 | refs/heads/master | 2020-03-20T09:12:46.597602 | 2018-06-14T08:56:31 | 2018-06-14T08:56:31 | 137,331,180 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 422 | java | /**
*
*/
package com.tz.day13;
import java.util.Comparator;
import com.tz.day11.Student;
/**本类用来演示 学生比较器
* @author 吴老师
*
* 2017年3月16日下午4:37:52
*/
public class StudentComparator implements Comparator<Student>
{
@Override
public int compare(Student o1, Student o2) {
System.out.println(">>> invoked...");
//定义比较的逻辑
return o1.getAge() - o2.getAge();
}
}
| [
"[email protected]"
] | |
d8fd92dd9d0717106855e20146c9f78dde6f32b7 | 7a87bbe68cc6df4358072dd802fbb8f617902dfa | /src/main/java/boot/crud/securityBoot/dao/UserDao.java | ebc88f82716552ab71143b067fc11a5fadbd70cf | [] | no_license | Tolerantfire/SecurityBootStrapJS | 0f8c7b2ee781df0d574c14a4a30edd79e3d96ea0 | cd704485d55950cb6e35e0258fed7ff5a466adc2 | refs/heads/master | 2023-02-04T22:02:26.815724 | 2020-12-13T20:38:57 | 2020-12-13T20:38:57 | 321,155,307 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 397 | java | package boot.crud.securityBoot.dao;
import boot.crud.securityBoot.model.User;
import java.util.List;
public interface UserDao {
void addUser(User user);
List<?> queryForUser();
void removeUser(int id);
void editUser(User user);
User findByUsername(String username);
User findByEmail(String email);
void addUserByAdmin(User user);
User getById(int id);
}
| [
"[email protected]"
] | |
4be2fe196d271422e309740af13018300dd97714 | a7140b9ef65530b99903ffd9b53e6bd32d41ed10 | /yule-mongo/src/main/java/com/yule/mongo/company/query/BalanceQuery.java | c6948f27e274b522dd7d73ef343f955ee7cfc034 | [] | no_license | FantasybabyChange/yule_workspace | 0c0b2c5cd59f866b70d24ac7c1f9a12df24b9f9d | 5125a39ac04378a4f6c6225dd85fcc46939f4451 | refs/heads/master | 2023-07-21T01:13:22.917184 | 2021-08-17T13:23:06 | 2021-08-17T13:23:06 | 397,264,689 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 880 | java | package com.yule.mongo.company.query;
import java.io.Serializable;
public class BalanceQuery implements Serializable {
/**
*
*/
private static final long serialVersionUID = 3193977797295790434L;
private String month;
private String start_time;
private String end_time;
private String company_id;
public String getStart_time() {
return start_time;
}
public void setStart_time(String start_time) {
this.start_time = start_time;
}
public String getEnd_time() {
return end_time;
}
public void setEnd_time(String end_time) {
this.end_time = end_time;
}
public String getCompany_id() {
return company_id;
}
public void setCompany_id(String company_id) {
this.company_id = company_id;
}
public String getMonth() {
return month;
}
public void setMonth(String month) {
this.month = month;
}
public BalanceQuery() {
super();
}
}
| [
"[email protected]"
] | |
0fac4837c4d470381f668eac91b366257e4e8d8e | 3006489ea73d75e928fe0a69bc901513f43ed192 | /oasys-auth/src/main/java/cn/linter/oasys/auth/config/WebSecurityConfig.java | 0e8b78883eefacaf742bf1de7d2804d91b0fe99a | [
"Apache-2.0"
] | permissive | missaouib/OASys | 7b97befcec85756512dd641a5b1b621188db1eac | 1f0039ed7a3dcc7b1dcb23a94c6722058296dac4 | refs/heads/master | 2023-02-24T04:55:39.887218 | 2021-02-03T04:43:11 | 2021-02-03T04:43:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,468 | java | package cn.linter.oasys.auth.config;
import cn.linter.oasys.auth.client.UserClient;
import cn.linter.oasys.auth.entity.Role;
import cn.linter.oasys.auth.entity.User;
import cn.linter.oasys.common.entity.ResultStatus;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.oauth2.provider.token.store.KeyStoreKeyFactory;
import java.security.KeyPair;
import java.util.ArrayList;
import java.util.List;
/**
* Security配置
*
* @author wangxiaoyang
* @since 2020/11/03
*/
@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
private final UserClient userClient;
@Value("#{'${security.oauth2.authorization.jwt.key-store}'.substring(10)}")
private String keyLocation;
@Value("${security.oauth2.authorization.jwt.key-store-password}")
private String keyPassword;
@Value("${security.oauth2.authorization.jwt.key-alias}")
private String keyAlias;
public WebSecurityConfig(UserClient userClient) {
this.userClient = userClient;
}
@Bean
public KeyPair keyPairFactory() {
KeyStoreKeyFactory keyStoreKeyFactory = new KeyStoreKeyFactory(new ClassPathResource(keyLocation), keyPassword.toCharArray());
return keyStoreKeyFactory.getKeyPair(keyAlias, keyPassword.toCharArray());
}
@Bean
public PasswordEncoder passwordEncoderFactory() {
return new BCryptPasswordEncoder();
}
@Bean
public AuthenticationManager authenticationManagerBeanFactory() throws Exception {
return super.authenticationManagerBean();
}
@Bean
public UserDetailsService userDetailsServiceFactory() {
return username -> {
User user = userClient.queryUser(username).getData();
if (user == null) {
throw new UsernameNotFoundException(ResultStatus.USER_NOT_FOUND.getMessage());
}
List<Role> roles = userClient.listRoleOfUser(username).getData();
List<GrantedAuthority> authorities = new ArrayList<>(roles.size());
for (Role role : roles) {
authorities.add(new SimpleGrantedAuthority("ROLE_" + role.getName()));
}
user.setAuthorities(authorities);
return user;
};
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests(authorize -> authorize
.anyRequest().permitAll())
.csrf().disable();
}
} | [
"[email protected]"
] | |
3b6b889373091c8ffb57a118bc2b01629aa50c01 | abec384825199e4308d739f817c64439d103426d | /app/src/main/java/com/cdhxqh/household_app/ui/widget/Photo/GraphicsBitmapUtils.java | e41c92e769513c737f054dedc242b720569955d3 | [] | no_license | zhongweiyunkeji/Household_app-1 | fd83394a3f5ed401edbac21f421752610d86ee21 | c0f558ce9397a42177fe9609371ff73d934664d8 | refs/heads/master | 2021-01-15T23:41:26.019236 | 2015-09-16T09:13:52 | 2015-09-16T09:13:52 | 40,633,662 | 0 | 0 | null | 2015-08-13T01:57:10 | 2015-08-13T01:57:07 | null | UTF-8 | Java | false | false | 9,837 | java | package com.cdhxqh.household_app.ui.widget.Photo;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.LinearGradient;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.PixelFormat;
import android.graphics.PorterDuff.Mode;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Shader.TileMode;
import android.graphics.drawable.Drawable;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
public class GraphicsBitmapUtils {
// 放大缩小图片
public static Bitmap zoomBitmap(Bitmap bitmap, int w, int h) {
int width = bitmap.getWidth();
int height = bitmap.getHeight();
Matrix matrix = new Matrix();
float scaleWidht = ((float) w / width);
float scaleHeight = ((float) h / height);
matrix.postScale(scaleWidht, scaleHeight);
Bitmap newbmp = Bitmap.createBitmap(bitmap, 0, 0, width, height,
matrix, true);
return newbmp;
}
// 获得圆角图片的方法
public static Bitmap drawableToBitmap(Drawable drawable) {
int width = drawable.getIntrinsicWidth();
int height = drawable.getIntrinsicHeight();
Bitmap bitmap = Bitmap.createBitmap(width, height, drawable
.getOpacity() != PixelFormat.OPAQUE ? Config.ARGB_8888
: Config.RGB_565);
Canvas canvas = new Canvas(bitmap);
drawable.setBounds(0, 0, width, height);
drawable.draw(canvas);
return bitmap;
}
// 获得带倒影的图片方法
public static Bitmap getRoundedCornerBitmap(Bitmap bitmap, float roundPx) {
Bitmap output = Bitmap.createBitmap(bitmap.getWidth(),
bitmap.getHeight(), Config.ARGB_8888);
Canvas canvas = new Canvas(output);
final int color = 0xff424242;
final Paint paint = new Paint();
final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
final RectF rectF = new RectF(rect);
paint.setAntiAlias(true);
canvas.drawARGB(0, 0, 0, 0);
paint.setColor(color);
canvas.drawRoundRect(rectF, roundPx, roundPx, paint);
paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN));
canvas.drawBitmap(bitmap, rect, rect, paint);
return output;
}
// 将Drawable转化为Bitmap
public static Bitmap createReflectionImageWithOrigin(Bitmap bitmap) {
final int reflectionGap = 4;
int width = bitmap.getWidth();
int height = bitmap.getHeight();
Matrix matrix = new Matrix();
matrix.preScale(1, -1);
Bitmap reflectionImage = Bitmap.createBitmap(bitmap, 0, height / 2,
width, height / 2, matrix, false);
Bitmap bitmapWithReflection = Bitmap.createBitmap(width,
(height + height / 2), Config.ARGB_8888);
Canvas canvas = new Canvas(bitmapWithReflection);
canvas.drawBitmap(bitmap, 0, 0, null);
Paint deafalutPaint = new Paint();
canvas.drawRect(0, height, width, height + reflectionGap, deafalutPaint);
canvas.drawBitmap(reflectionImage, 0, height + reflectionGap, null);
Paint paint = new Paint();
LinearGradient shader = new LinearGradient(0, bitmap.getHeight(), 0,
bitmapWithReflection.getHeight() + reflectionGap, 0x70ffffff,
0x00ffffff, TileMode.CLAMP);
paint.setShader(shader);
// Set the Transfer mode to be porter duff and destination in
paint.setXfermode(new PorterDuffXfermode(Mode.DST_IN));
// Draw a rectangle using the paint with our linear gradient
canvas.drawRect(0, height, width, bitmapWithReflection.getHeight()
+ reflectionGap, paint);
return bitmapWithReflection;
}
public static void writerFileForByteArray(byte[] data)
{
Bitmap $bitmap = BitmapFactory.decodeByteArray(data, 0, data.length);
if($bitmap==null)
return;
String filename="/sdcard/10.8/"+System.currentTimeMillis()+".png";
File f=new File(filename);
FileOutputStream fos=null;
try {
f.createNewFile();
fos=new FileOutputStream(f);
$bitmap.compress(Bitmap.CompressFormat.PNG, 100, fos);
fos.flush();
fos.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static byte[] Bitmap2Bytes(Bitmap bm){
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bm.compress(Bitmap.CompressFormat.PNG, 100, baos);
return baos.toByteArray();
}
public static byte[] Bitmap2Bytes(Bitmap bm,int cos){
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bm.compress(Bitmap.CompressFormat.PNG, cos, baos);
return baos.toByteArray();
}
public static void writerFileForBitmap(Bitmap bitmap)
{
String filename="/sdcard/10.8/"+System.currentTimeMillis()+".png";
File f=new File(filename);
FileOutputStream fos=null;
try {
f.createNewFile();
fos=new FileOutputStream(f);
bitmap.compress(Bitmap.CompressFormat.PNG, 100, fos);
fos.flush();
fos.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/**
* 图片合成
* @param bitmap
* @return
*/
private Bitmap createBitmap( Bitmap src, Bitmap watermark ) {
if( src == null ) {
return null;
}
int w = src.getWidth();
int h = src.getHeight();
int ww = watermark.getWidth();
int wh = watermark.getHeight();
//create the new blank bitmap
Bitmap newb = Bitmap.createBitmap( w, h, Config.ARGB_8888 );//创建一个新的和SRC长度宽度一样的位图
Canvas cv = new Canvas( newb );
//draw src into
cv.drawBitmap( src, 0, 0, null );//在 0,0坐标开始画入src
//draw watermark into
cv.drawBitmap( watermark, w - ww + 5, h - wh + 5, null );//在src的右下角画入水印
//save all clip
cv.save( Canvas.ALL_SAVE_FLAG );//保存
//store
cv.restore();//存储
return newb;
}
/**
* 图片圆角
* @param bitmap
* @return
*/
public static Bitmap getRoundedCornerBitmap(Bitmap bitmap) {
Bitmap output = Bitmap.createBitmap(bitmap.getWidth(),
bitmap.getHeight(), Config.ARGB_8888);
Canvas canvas = new Canvas(output);
final int color = 0xff424242;
final Paint paint = new Paint();
final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
final RectF rectF = new RectF(rect);
final float roundPx = 12;
paint.setAntiAlias(true);
canvas.drawARGB(0, 0, 0, 0);
paint.setColor(color);
canvas.drawRoundRect(rectF, roundPx, roundPx, paint);
paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN));
canvas.drawBitmap(bitmap, rect, rect, paint);
return output;
}
/**
* 缩放、翻转和旋转图片
* @param bmpOrg
* @param rotate
* @return
*/
private Bitmap gerZoomRotateBitmap(
Bitmap bmpOrg, int rotate) {
// 获取图片的原始的大小
int width = bmpOrg.getWidth();
int height = bmpOrg.getHeight();
int newWidth = 300;
int newheight = 300;
// 定义缩放的高和宽的比例
float sw = ((float) newWidth) / width;
float sh = ((float) newheight) / height;
// 创建操作图片的用的Matrix对象
Matrix matrix = new Matrix();
// 缩放翻转图片的动作
// sw sh的绝对值为绽放宽高的比例,sw为负数表示X方向翻转,sh为负数表示Y方向翻转
matrix.postScale(sw, sh);
// 旋转30*
matrix.postRotate(rotate);
//创建一个新的图片
Bitmap resizeBitmap = Bitmap
.createBitmap(bmpOrg, 0, 0, width, height, matrix, true);
return resizeBitmap;
}
/**
* 图片旋转
*
* @param bmp
* 要旋转的图片
* @param degree
* 图片旋转的角度,负值为逆时针旋转,正值为顺时针旋转
* @return
*/
public static Bitmap rotateBitmap(Bitmap bmp, float degree) {
Matrix matrix = new Matrix();
matrix.postRotate(degree);
return Bitmap.createBitmap(bmp, 0, 0, bmp.getWidth(), bmp.getHeight(), matrix, true);
}
/**
* 图片缩放
*
* @param bm
* @param scale
* 值小于则为缩小,否则为放大
* @return
*/
public static Bitmap resizeBitmap(Bitmap bm, float scale) {
Matrix matrix = new Matrix();
matrix.postScale(scale, scale);
return Bitmap.createBitmap(bm, 0, 0, bm.getWidth(), bm.getHeight(), matrix, true);
}
/**
* 图片缩放
*
* @param bm
* @param w
* 缩小或放大成的宽
* @param h
* 缩小或放大成的高
* @return
*/
public static Bitmap resizeBitmap(Bitmap bm, int w, int h) {
Bitmap BitmapOrg = bm;
int width = BitmapOrg.getWidth();
int height = BitmapOrg.getHeight();
float scaleWidth = ((float) w) / width;
float scaleHeight = ((float) h) / height;
Matrix matrix = new Matrix();
matrix.postScale(scaleWidth, scaleHeight);
return Bitmap.createBitmap(BitmapOrg, 0, 0, width, height, matrix, true);
}
/**
* 图片反转
*
* @param bm
* @param flag
* 0为水平反转,1为垂直反转
* @return
*/
public static Bitmap reverseBitmap(Bitmap bmp, int flag) {
float[] floats = null;
switch (flag) {
case 0: // 水平反转
floats = new float[] { -1f, 0f, 0f, 0f, 1f, 0f, 0f, 0f, 1f };
break;
case 1: // 垂直反转
floats = new float[] { 1f, 0f, 0f, 0f, -1f, 0f, 0f, 0f, 1f };
break;
}
if (floats != null) {
Matrix matrix = new Matrix();
matrix.setValues(floats);
return Bitmap.createBitmap(bmp, 0, 0, bmp.getWidth(), bmp.getHeight(), matrix, true);
}
return null;
}
}
| [
"[email protected]"
] | |
e7830d9bd40034b65be81baebc60cddc005f6434 | e046a87ae31c5006c37e0010ee5b4c5cbfca28b1 | /springboot-mybatis-common/src/test/java/MybatisApplicationTest.java | 1947e6905c2b2e8fa2b7f3d6ad97feb7906b536e | [] | no_license | Kiritor/Spring-Boot-Study | 46f84324e8b67d5e114b9a5b15db34bd0622a44d | 2a5fef61db0d73742c6df3ec9ad562f09f6abb97 | refs/heads/master | 2021-01-20T12:49:43.166639 | 2019-06-13T08:16:34 | 2019-06-13T08:16:34 | 101,716,268 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 657 | java | import com.kiritor.mapper.UserMapper;
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 static org.assertj.core.api.Assertions.assertThat;
@RunWith(SpringRunner.class)
@SpringBootTest
public class MybatisApplicationTest {
@SuppressWarnings("all")
@Autowired
UserMapper userMapper;
@Test
public void test_db() {
//开始进行测试
assertThat(userMapper.getUserListByKey("L.Tao").size()).isGreaterThan(1);
}
}
| [
"[email protected]"
] | |
9771537b4226081c7e589b35f1a0dede132543a8 | 5298b284019f42dca40e6a60ee63b82631179264 | /src/test/java/com/example/demo/RequestmaptestApplicationTests.java | 55b2b5e6a5a381a6e8db2ada5feb61e7dd08afae | [] | no_license | yinyx/requestmaptest | f07f3987767943510bb05147857de7b296d3ec39 | d6e5f1c942a9e363111cc158dcc2a737791f08bd | refs/heads/master | 2022-12-28T06:17:39.133401 | 2020-10-02T07:33:06 | 2020-10-02T07:33:06 | 259,555,866 | 0 | 0 | null | 2020-07-29T11:09:39 | 2020-04-28T06:51:47 | CSS | UTF-8 | Java | false | false | 699 | java | package com.example.demo;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringRunner;
//import com.example.demo.po.*;
@RunWith(SpringRunner.class)
@TestPropertySource("classpath:wisely.properties")
@SpringBootTest
public class RequestmaptestApplicationTests {
@Value("${person.name}")
private String apiKey;
@Test
public void contextLoads() {
System.out.println(apiKey);
}
}
| [
"[email protected]"
] | |
f807a83bf96e98a2be08501b4a81c6733bb9e433 | 300aefc3ada2c9f2c41e8aa01ba31971c87feb5b | /criacionais/factoryMethod/src/com/factory/method/pattern/Button.java | ae823a4e875b9d94b67b7dc61e76758ca46060ef | [] | no_license | rafaelcaetano/mergulheNosPadroesDeProjeto | 886796546991eb350c939d3fb8c40dd114b0c339 | 5b372eab20bac4f4453b2a21d899e22c3d6bd43e | refs/heads/master | 2023-04-08T19:35:35.092723 | 2021-04-19T01:23:26 | 2021-04-19T01:23:26 | 346,550,008 | 0 | 0 | null | 2021-04-19T01:23:26 | 2021-03-11T02:09:05 | Java | UTF-8 | Java | false | false | 104 | java | package com.factory.method.pattern;
public interface Button {
void render();
void onClick();
}
| [
"[email protected]"
] | |
e82844f64347d1bc42424babb8c1d348badf144c | ca64688c624c624e5c7c2b66c638c929144cf11e | /javabasic/src/chapter08_2/Car2.java | 799435ff1b3677ed6baa88e22208cc29691bebea | [] | no_license | bbbb-6666/java_old | eed83c784437e169a5c1aba88557fca96b1a0f5d | 2be89c42be9bf2984b3bce3741f95c021d26b222 | refs/heads/master | 2020-06-18T15:53:28.600875 | 2019-09-17T07:49:29 | 2019-09-17T07:49:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 216 | java | package chapter08_2;
public class Car2 {
String color;
int speed;
public void upSpeed (int speed) {
this.speed += speed;
}
public void showInfo() {
System.out.println(this.color+", "+this.speed);
}
}
| [
""
] | |
42e7a15d0f25ca90e3fc2cbb148ea1125338bec2 | 621b60e4bf64de79e5cd46fb86eb1de804ba9a49 | /src/main/java/com/heliohdd/springboothdd2_ionic_backend/domain/ItemPedido.java | 16f6f2b53301eb0ea41f1d85020c455c7cc4972e | [] | no_license | heliohdd/springboothdd2_ionic_backend | d1de1f89182f5fbd50111557b325ab3e27b8c25e | 12c253a5800abc4351a623022911da4a6aea68e3 | refs/heads/master | 2021-07-22T22:19:56.889584 | 2020-03-30T13:51:59 | 2020-03-30T13:51:59 | 248,313,473 | 0 | 0 | null | 2021-04-26T20:05:09 | 2020-03-18T18:36:40 | Java | UTF-8 | Java | false | false | 2,647 | java | package com.heliohdd.springboothdd2_ionic_backend.domain;
import java.io.Serializable;
import java.text.NumberFormat;
import java.util.Locale;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import com.fasterxml.jackson.annotation.JsonIgnore;
@Entity
public class ItemPedido implements Serializable {
private static final long serialVersionUID = 1L;
@JsonIgnore
@EmbeddedId
private ItemPedidoPK id = new ItemPedidoPK();
private Double desconto;
private Integer quantidade;
private Double preco;
public ItemPedido() {
}
public ItemPedido(Pedido pedido, Produto produto, Double desconto, Integer quantidade, Double preco) {
super();
id.setPedido(pedido);
id.setProduto(produto);
this.desconto = desconto;
this.quantidade = quantidade;
this.preco = preco;
}
public double getSubTotal() {
return (preco - desconto) * quantidade;
}
@JsonIgnore
public Pedido getPedido() {
return id.getPedido();
}
public void setPedido(Pedido pedido) {
id.setPedido(pedido);
}
public Produto getProduto() {
return id.getProduto();
}
public void setProduto(Produto produto) {
id.setProduto(produto);
}
public ItemPedidoPK getId() {
return id;
}
public void setId(ItemPedidoPK id) {
this.id = id;
}
public Double getDesconto() {
return desconto;
}
public void setDesconto(Double desconto) {
this.desconto = desconto;
}
public Integer getQuantidade() {
return quantidade;
}
public void setQuantidade(Integer quantidade) {
this.quantidade = quantidade;
}
public Double getPreco() {
return preco;
}
public void setPreco(Double preco) {
this.preco = preco;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.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;
ItemPedido other = (ItemPedido) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
@Override
public String toString() {
NumberFormat nf = NumberFormat.getCurrencyInstance(new Locale("pt", "BR"));
StringBuilder builder = new StringBuilder();
builder.append(getProduto().getNome());
builder.append(", Qte: ");
builder.append(getQuantidade());
builder.append(", Preço unitário: ");
builder.append(nf.format(getPreco()));
builder.append(", Subtotal: ");
builder.append(nf.format(getSubTotal()));
builder.append("\n");
return builder.toString();
}
} | [
"[email protected]"
] | |
88eebf809c231d680b96340101851c3dc11636f3 | d4c41e8c5188a10d3b7a02984690948371eaa09a | /src/de/hdm/vocke/myContacts/shared/bo/BusinessObject.java | 70c8b0b03084fd5577910f3695716e7e1ad7f03a | [] | no_license | theresa-vocke/myContacts | 444e9e5770fb130f9b70483956c85370d3a67511 | c586a842eb8617644727a6300ef533fcf70b7c33 | refs/heads/master | 2020-03-17T11:23:30.612909 | 2018-06-26T12:55:29 | 2018-06-26T12:55:29 | 133,549,774 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 2,508 | java | package de.hdm.vocke.myContacts.shared.bo;
import java.io.Serializable;
public abstract class BusinessObject implements Serializable {
private static final long serialVersionUID = 1L;
/**
* eindeutige Identifikationsnummer einer Instanz dieser Klasse
*/
private int id = 0;
/**
* auslesen der id
*/
public int getId() {
return id;
}
/**
* setzen der id
*/
public void setId(int id) {
this.id = id;
}
/**
* erzeugen einer einfachen textuellen Darstellung der jeweiligen Instanz
* Dies kann in den Subklassen überschrieben werden
*/
public String toString(){
/**
* zurückgegeben wird der Klassenname gefolgt von der ID
*/
return this.getClass().getName() + " #" + this.id;
}
/**
* <p>
* Feststellen der <em>inhaltlichen</em> Gleichheit zweier
* <code>BusinessObject</code>-Objekte. Die Gleichheit wird in diesem Beispiel auf eine
* identische ID beschränkt.
* </p>
* <p>
*
* Die Methode <code>equals(...)</code> ist für jeden Referenzdatentyp
* definiert, da sie bereits in der Klasse <code>Object</code> in einfachster
* Form realisiert ist. Dort ist sie allerdings auf die simple Bestimmung der
* Gleicheit der Java-internen Objekt-ID der verglichenen Objekte beschränkt.
* In unseren eigenen Klassen können wir diese Methode überschreiben und ihr
* mehr Intelligenz verleihen.
* </p>
*/
public boolean equals(Object o){
/**
* Abfragen, ob ein Objekt ungleich NULL ist und gecastet werden kann
*/
if (o != null && o instanceof BusinessObject){
BusinessObject bo = (BusinessObject) o;
try {
if (bo.getId() == this.id)
return true;
}
catch (IllegalArgumentException e){
// wenn was schief geht wird zur Sicherheit false zurückgegeben
return false;
}
}
// wenn bislang keine Gleichheit festgestellt wurde wird false zurückgegeben
return false;
}
/**
* erzeugen einer ganzen Zahl, die für das BusinessObjekt charakteristisch ist
* Zusammen mit <code>equals</code> sollte diese Methode immer definiert werden.
* Manche Java-Klassen
* verwendenden <code>hashCode</code>, um initial ein Objekt (z.B. in einer Hashtable)
* zu identifizieren. Erst danach
* würde mit <code>equals</code> festgestellt, ob es sich tatsächlich um das
* gesuchte Objekt handelt.
*/
public int hashCode (){
return this.id;
}
}
| [
"[email protected]"
] | |
01669a35d124fbe992d5a95c4b03734a36dd0057 | ca379d35ab208e9f1fae463d55f909dbb85ef161 | /src/org/brutality/model/players/PathFinder.java | 21187edaa6a01096fd30cf4b0a38c205c8080074 | [] | no_license | rampage-osrs/rampage-os-server | a8d1f55073ebfbb14b6b8d97c75575c9b5a80ca6 | 53b9e4124659e35983740b4ef365a2f02d23ea86 | refs/heads/master | 2021-08-19T09:42:18.123993 | 2017-11-25T16:53:13 | 2017-11-25T16:53:13 | 112,019,026 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,015 | java | package org.brutality.model.players;
import java.util.LinkedList;
import org.brutality.clip.Region;
import org.brutality.model.players.Player;
public class PathFinder {
private static final PathFinder pathFinder = new PathFinder();
public static PathFinder getPathFinder() {
return pathFinder;
}
public PathFinder() {
}
public void findRoute(Player c, int destX, int destY, boolean moveNear,
int xLength, int yLength) {
if (destX == c.getLocalX() && destY == c.getLocalY() && !moveNear) {
c.sendMessage("ERROR!");
return;
}
destX = destX - 8 * c.getMapRegionX();
destY = destY - 8 * c.getMapRegionY();
int[][] via = new int[104][104];
int[][] cost = new int[104][104];
LinkedList<Integer> tileQueueX = new LinkedList<Integer>();
LinkedList<Integer> tileQueueY = new LinkedList<Integer>();
for (int xx = 0; xx < 104; xx++) {
for (int yy = 0; yy < 104; yy++) {
cost[xx][yy] = 99999999;
}
}
int curX = c.getLocalX();
int curY = c.getLocalY();
via[curX][curY] = 99;
cost[curX][curY] = 0;
int tail = 0;
tileQueueX.add(curX);
tileQueueY.add(curY);
boolean foundPath = false;
int pathLength = 4000;
while (tail != tileQueueX.size() && tileQueueX.size() < pathLength) {
curX = tileQueueX.get(tail);
curY = tileQueueY.get(tail);
int curAbsX = c.getMapRegionX() * 8 + curX;
int curAbsY = c.getMapRegionY() * 8 + curY;
if (curX == destX && curY == destY) {
foundPath = true;
break;
}
tail = (tail + 1) % pathLength;
int thisCost = cost[curX][curY] + 1;
if (curY > 0
&& via[curX][curY - 1] == 0
&& (Region.getClipping(curAbsX, curAbsY - 1, c.heightLevel) & 0x1280102) == 0) {
tileQueueX.add(curX);
tileQueueY.add(curY - 1);
via[curX][curY - 1] = 1;
cost[curX][curY - 1] = thisCost;
}
if (curX > 0
&& via[curX - 1][curY] == 0
&& (Region.getClipping(curAbsX - 1, curAbsY, c.heightLevel) & 0x1280108) == 0) {
tileQueueX.add(curX - 1);
tileQueueY.add(curY);
via[curX - 1][curY] = 2;
cost[curX - 1][curY] = thisCost;
}
if (curY < 104 - 1
&& via[curX][curY + 1] == 0
&& (Region.getClipping(curAbsX, curAbsY + 1, c.heightLevel) & 0x1280120) == 0) {
tileQueueX.add(curX);
tileQueueY.add(curY + 1);
via[curX][curY + 1] = 4;
cost[curX][curY + 1] = thisCost;
}
if (curX < 104 - 1
&& via[curX + 1][curY] == 0
&& (Region.getClipping(curAbsX + 1, curAbsY, c.heightLevel) & 0x1280180) == 0) {
tileQueueX.add(curX + 1);
tileQueueY.add(curY);
via[curX + 1][curY] = 8;
cost[curX + 1][curY] = thisCost;
}
if (curX > 0
&& curY > 0
&& via[curX - 1][curY - 1] == 0
&& (Region.getClipping(curAbsX - 1, curAbsY - 1,
c.heightLevel) & 0x128010e) == 0
&& (Region.getClipping(curAbsX - 1, curAbsY, c.heightLevel) & 0x1280108) == 0
&& (Region.getClipping(curAbsX, curAbsY - 1, c.heightLevel) & 0x1280102) == 0) {
tileQueueX.add(curX - 1);
tileQueueY.add(curY - 1);
via[curX - 1][curY - 1] = 3;
cost[curX - 1][curY - 1] = thisCost;
}
if (curX > 0
&& curY < 104 - 1
&& via[curX - 1][curY + 1] == 0
&& (Region.getClipping(curAbsX - 1, curAbsY + 1,
c.heightLevel) & 0x1280138) == 0
&& (Region.getClipping(curAbsX - 1, curAbsY, c.heightLevel) & 0x1280108) == 0
&& (Region.getClipping(curAbsX, curAbsY + 1, c.heightLevel) & 0x1280120) == 0) {
tileQueueX.add(curX - 1);
tileQueueY.add(curY + 1);
via[curX - 1][curY + 1] = 6;
cost[curX - 1][curY + 1] = thisCost;
}
if (curX < 104 - 1
&& curY > 0
&& via[curX + 1][curY - 1] == 0
&& (Region.getClipping(curAbsX + 1, curAbsY - 1,
c.heightLevel) & 0x1280183) == 0
&& (Region.getClipping(curAbsX + 1, curAbsY, c.heightLevel) & 0x1280180) == 0
&& (Region.getClipping(curAbsX, curAbsY - 1, c.heightLevel) & 0x1280102) == 0) {
tileQueueX.add(curX + 1);
tileQueueY.add(curY - 1);
via[curX + 1][curY - 1] = 9;
cost[curX + 1][curY - 1] = thisCost;
}
if (curX < 104 - 1
&& curY < 104 - 1
&& via[curX + 1][curY + 1] == 0
&& (Region.getClipping(curAbsX + 1, curAbsY + 1,
c.heightLevel) & 0x12801e0) == 0
&& (Region.getClipping(curAbsX + 1, curAbsY, c.heightLevel) & 0x1280180) == 0
&& (Region.getClipping(curAbsX, curAbsY + 1, c.heightLevel) & 0x1280120) == 0) {
tileQueueX.add(curX + 1);
tileQueueY.add(curY + 1);
via[curX + 1][curY + 1] = 12;
cost[curX + 1][curY + 1] = thisCost;
}
}
if (!foundPath) {
if (moveNear) {
int i_223_ = 1000;
int thisCost = 100;
int i_225_ = 10;
for (int x = destX - i_225_; x <= destX + i_225_; x++) {
for (int y = destY - i_225_; y <= destY + i_225_; y++) {
if (x >= 0 && y >= 0 && x < 104 && y < 104
&& cost[x][y] < 100) {
int i_228_ = 0;
if (x < destX) {
i_228_ = destX - x;
} else if (x > destX + xLength - 1) {
i_228_ = x - (destX + xLength - 1);
}
int i_229_ = 0;
if (y < destY) {
i_229_ = destY - y;
} else if (y > destY + yLength - 1) {
i_229_ = y - (destY + yLength - 1);
}
int i_230_ = i_228_ * i_228_ + i_229_ * i_229_;
if (i_230_ < i_223_
|| (i_230_ == i_223_ && (cost[x][y] < thisCost))) {
i_223_ = i_230_;
thisCost = cost[x][y];
curX = x;
curY = y;
}
}
}
}
if (i_223_ == 1000) {
return;
}
} else {
return;
}
}
tail = 0;
tileQueueX.set(tail, curX);
tileQueueY.set(tail++, curY);
int l5;
for (int j5 = l5 = via[curX][curY]; curX != c.getLocalX()
|| curY != c.getLocalY(); j5 = via[curX][curY]) {
if (j5 != l5) {
l5 = j5;
tileQueueX.set(tail, curX);
tileQueueY.set(tail++, curY);
}
if ((j5 & 2) != 0) {
curX++;
} else if ((j5 & 8) != 0) {
curX--;
}
if ((j5 & 1) != 0) {
curY++;
} else if ((j5 & 4) != 0) {
curY--;
}
}
c.resetWalkingQueue();
int size = tail--;
int pathX = c.getMapRegionX() * 8 + tileQueueX.get(tail);
int pathY = c.getMapRegionY() * 8 + tileQueueY.get(tail);
c.addToWalkingQueue(localize(pathX, c.getMapRegionX()),
localize(pathY, c.getMapRegionY()));
for (int i = 1; i < size; i++) {
tail--;
pathX = c.getMapRegionX() * 8 + tileQueueX.get(tail);
pathY = c.getMapRegionY() * 8 + tileQueueY.get(tail);
c.addToWalkingQueue(localize(pathX, c.getMapRegionX()),
localize(pathY, c.getMapRegionY()));
}
}
public boolean accessable(Player c, int destX, int destY) {
destX = destX - 8 * c.getMapRegionX();
destY = destY - 8 * c.getMapRegionY();
int[][] via = new int[104][104];
int[][] cost = new int[104][104];
LinkedList<Integer> tileQueueX = new LinkedList<Integer>();
LinkedList<Integer> tileQueueY = new LinkedList<Integer>();
for (int xx = 0; xx < 104; xx++) {
for (int yy = 0; yy < 104; yy++) {
cost[xx][yy] = 99999999;
}
}
int curX = c.getLocalX();
int curY = c.getLocalY();
via[curX][curY] = 99;
cost[curX][curY] = 0;
int tail = 0;
tileQueueX.add(curX);
tileQueueY.add(curY);
int pathLength = 4000;
int z = c.heightLevel;
while (tail != tileQueueX.size() && tileQueueX.size() < pathLength) {
curX = tileQueueX.get(tail);
curY = tileQueueY.get(tail);
int curAbsX = c.getMapRegionX() * 8 + curX;
int curAbsY = c.getMapRegionY() * 8 + curY;
if (curX == destX && curY == destY) {
return true;
}
tail = (tail + 1) % pathLength;
int thisCost = cost[curX][curY] + 1;
if (curY > 0 && via[curX][curY - 1] == 0 && (Region.getClipping(curAbsX, curAbsY - 1, z) & 0x1280102) == 0) {
tileQueueX.add(curX);
tileQueueY.add(curY - 1);
via[curX][curY - 1] = 1;
cost[curX][curY - 1] = thisCost;
}
if (curX > 0 && via[curX - 1][curY] == 0 && (Region.getClipping(curAbsX - 1, curAbsY, z) & 0x1280108) == 0) {
tileQueueX.add(curX - 1);
tileQueueY.add(curY);
via[curX - 1][curY] = 2;
cost[curX - 1][curY] = thisCost;
}
if (curY < 104 - 1 && via[curX][curY + 1] == 0 && (Region.getClipping(curAbsX, curAbsY + 1, z) & 0x1280120) == 0) {
tileQueueX.add(curX);
tileQueueY.add(curY + 1);
via[curX][curY + 1] = 4;
cost[curX][curY + 1] = thisCost;
}
if (curX < 104 - 1 && via[curX + 1][curY] == 0 && (Region.getClipping(curAbsX + 1, curAbsY, z) & 0x1280180) == 0) {
tileQueueX.add(curX + 1);
tileQueueY.add(curY);
via[curX + 1][curY] = 8;
cost[curX + 1][curY] = thisCost;
}
if (curX > 0 && curY > 0 && via[curX - 1][curY - 1] == 0 && (Region.getClipping(curAbsX - 1, curAbsY - 1, z) & 0x128010e) == 0
&& (Region.getClipping(curAbsX - 1, curAbsY, z) & 0x1280108) == 0
&& (Region.getClipping(curAbsX, curAbsY - 1, z) & 0x1280102) == 0) {
tileQueueX.add(curX - 1);
tileQueueY.add(curY - 1);
via[curX - 1][curY - 1] = 3;
cost[curX - 1][curY - 1] = thisCost;
}
if (curX > 0 && curY < 104 - 1 && via[curX - 1][curY + 1] == 0 && (Region.getClipping(curAbsX - 1, curAbsY + 1, z) & 0x1280138) == 0
&& (Region.getClipping(curAbsX - 1, curAbsY, z) & 0x1280108) == 0
&& (Region.getClipping(curAbsX, curAbsY + 1, z) & 0x1280120) == 0) {
tileQueueX.add(curX - 1);
tileQueueY.add(curY + 1);
via[curX - 1][curY + 1] = 6;
cost[curX - 1][curY + 1] = thisCost;
}
if (curX < 104 - 1 && curY > 0 && via[curX + 1][curY - 1] == 0 && (Region.getClipping(curAbsX + 1, curAbsY - 1, z) & 0x1280183) == 0
&& (Region.getClipping(curAbsX + 1, curAbsY, z) & 0x1280180) == 0
&& (Region.getClipping(curAbsX, curAbsY - 1, z) & 0x1280102) == 0) {
tileQueueX.add(curX + 1);
tileQueueY.add(curY - 1);
via[curX + 1][curY - 1] = 9;
cost[curX + 1][curY - 1] = thisCost;
}
if (curX < 104 - 1 && curY < 104 - 1 && via[curX + 1][curY + 1] == 0 && (Region.getClipping(curAbsX + 1, curAbsY + 1, z) & 0x12801e0) == 0
&& (Region.getClipping(curAbsX + 1, curAbsY, z) & 0x1280180) == 0
&& (Region.getClipping(curAbsX, curAbsY + 1, z) & 0x1280120) == 0) {
tileQueueX.add(curX + 1);
tileQueueY.add(curY + 1);
via[curX + 1][curY + 1] = 12;
cost[curX + 1][curY + 1] = thisCost;
}
}
return false;
}
public int localize(int x, int mapRegion) {
return x - 8 * mapRegion;
}
} | [
"[email protected]"
] | |
f74650bc76e3f32ec5f2004e0ed7b02f7f44df40 | 74bbf384414f2bf4be7aefd031aa4eaa856f0d60 | /src/main/java/com/example/ekart/model/Products.java | e3302d9028c4fd7d71b9ddbfbf84239fbbe91223 | [] | no_license | harikumarc/ekart | 76977eefaa00f6a7895646cfda6f10ec866b807e | 96471fb1839ee24692cae9dbbe900a95a631e4c5 | refs/heads/master | 2020-05-02T10:51:57.642900 | 2019-04-03T02:52:04 | 2019-04-03T02:52:04 | 177,909,766 | 0 | 0 | null | 2019-03-27T16:14:53 | 2019-03-27T03:14:21 | Java | UTF-8 | Java | false | false | 1,126 | java | package com.example.ekart.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@Entity
public class Products {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
private String name;
private String category;
private String subcategory;
private String brand ;
private long price;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public String getSubcategory() {
return subcategory;
}
public void setSubcategory(String subcategory) {
this.subcategory = subcategory;
}
public String getBrand() {
return brand;
}
public void setBrand(String brand) {
this.brand = brand;
}
public long getPrice() {
return price;
}
public void setPrice(long price) {
this.price = price;
}
}
| [
"[email protected]"
] | |
8381e0633a119e3fea83117c109292643fd0eedd | 3eab5c80d43bd8940f28c538b0e8b855a9f2e3f7 | /app/src/main/java/com/example/nam/travel/views/fragment/ProfileFragment.java | ae315ec1fb0f5ea91634743d9105d852854be3a5 | [] | no_license | Nam2402/Travel | e654d398d8b8bc4461d5f8a1138e018fca442d43 | 55a1991228366020d275ba3616c4d480a5880c8a | refs/heads/master | 2020-04-01T13:15:43.563047 | 2018-10-16T07:56:59 | 2018-10-16T07:56:59 | 153,244,488 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 642 | java | package com.example.nam.travel.views.fragment;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.example.nam.travel.R;
public class ProfileFragment extends Fragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_profile, container, false);
return view;
}
}
| [
"[email protected]"
] | |
3ae2a3a1384b2a87be658052f779bc2b4f47ae92 | 512581608ea438ecd79f06708bf35fc4fe10a481 | /src/main/java/com/example/delivery_fit/Dashboard/track/TrackViewModel.java | 5a9fad9c99c24cc12c79a9d7ed83e04045c6b664 | [] | no_license | harshalshingne/Delivery_Fit | f887d5041bbd407164239bc05d839596b56a7b60 | 2531f197714455e929f1ea5e1e7a93754977baff | refs/heads/master | 2022-12-18T02:51:09.514374 | 2020-09-10T09:00:21 | 2020-09-10T09:00:21 | 294,356,862 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 804 | java | package com.example.delivery_fit.Dashboard.track;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
public class TrackViewModel extends ViewModel {
private MutableLiveData<String> mText;
public MutableLiveData<String> resultImageUrl = new MutableLiveData<>();
public TrackViewModel() {
resultImageUrl = new MutableLiveData<>();
resultImageUrl.setValue("https://picsum.photos/seed/picsum/200/300");
}
public MutableLiveData<String> getResultImageUrl() {
return resultImageUrl;
}
public void setResultImageUrl(MutableLiveData<String> resultImageUrl) {
this.resultImageUrl = resultImageUrl;
}
public LiveData<String> getText() {
return resultImageUrl;
}
}
| [
"[email protected]"
] | |
08bddf8f939dc379bac033874c8c19b499dc8732 | 1252480eee5818dc2e8662591a17ab1c4f28f788 | /cmall-service/src/main/java/com/cmall/dubbo/service/TbUserDubboService.java | 067f19e058d440e69f42090deccc73048c4de0b2 | [] | no_license | yixiaofan/CMall-java | a534e9b009cda4757e3e25726a038340783e2395 | 0fee373dc7ffb5214e5d2b98a038370c72aa5e74 | refs/heads/master | 2022-12-25T18:59:06.698998 | 2019-07-24T11:25:05 | 2019-07-24T11:25:05 | 179,604,068 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 361 | java | package com.cmall.dubbo.service;
import com.cmall.pojo.TbUser;
public interface TbUserDubboService {
/*
* 根据用户名和密码查询登录
*/
TbUser selByUser(TbUser user);
/*
* 根据用户id修改用户信息
*/
int updUserInfo(TbUser user);
/*
* 注册
*/
int insUserInfo(TbUser user);
}
| [
"[email protected]"
] | |
bc29eebbef2292fd0126cb0cb17ab6086a1f1d4d | 61e42a58da2bafe92b52eae8140f5e3a3715b01c | /src/main/java/br/com/gerenciador/converters/GrupoToGrupoEntity.java | 5c220f2881b9e68dc38d851963d6633913c67de6 | [] | no_license | BLouzada/gerenciador-restaurante | 569c6f43c8eb439603a8d584c9a0db2fb0617d43 | 01700314e2b8b321d094cdb51f494cb782de4613 | refs/heads/master | 2021-01-19T10:28:41.783750 | 2017-06-20T00:19:36 | 2017-06-20T00:19:36 | 87,868,951 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,455 | java | package br.com.gerenciador.converters;
import br.com.gerenciador.beans.Grupo;
import br.com.gerenciador.beans.Ingrediente;
import br.com.gerenciador.entity.GrupoEntity;
import br.com.gerenciador.entity.IngredienteEntity;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
/**
* Created by 201320336 on 20/04/2017.
*/
@Component
public class GrupoToGrupoEntity implements Converter<Grupo,GrupoEntity> {
private IngredienteToIngredienteEntity ingredienteEntityToIngrediente;
public GrupoToGrupoEntity(IngredienteToIngredienteEntity ingredienteEntityToIngrediente) {
this.ingredienteEntityToIngrediente = ingredienteEntityToIngrediente;
}
@Override
public GrupoEntity convert(Grupo source) {
Long id = source.getId();
ArrayList<IngredienteEntity> ingredientes = new ArrayList<IngredienteEntity>();
for (Ingrediente ingrediente : source.getIngredientes()){
ingredientes.add(ingredienteEntityToIngrediente.convert(ingrediente));
}
if(id != null){
return new GrupoEntity()
.setId(id)
.setNome(source.getNome())
.setIngredientes(ingredientes);
}else{
return new GrupoEntity()
.setNome(source.getNome())
.setIngredientes(ingredientes);
}
}
}
| [
"[email protected]"
] | |
cc027899cff3d86fb0ee96fcf54f3591f3ad9654 | fd95009dd904dfdb91fec14bab6c886a1504cda4 | /dosen.java | 3eb3c7b0a3bfa4d668acbc638eba13fcacdf9ad9 | [] | no_license | Dimpecks/Tutorial01 | 3fbb846a915b71981303ecf535950509952cfcd1 | 650cf9a1dd4285f7c9f96e0f65576ff744fd71ed | refs/heads/master | 2020-03-28T05:48:21.052530 | 2018-09-07T08:46:26 | 2018-09-07T08:46:26 | 147,797,279 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 224 | java | class dosen{
// Your program begins with a call to main().
// Prints "Hello, World" to the terminal window.
public static void main(String args[])
{
System.out.println("Hello, World");
}
} | [
"[email protected]"
] | |
fce92b708fac9e1b4ac61418aa770695d5b9cc91 | 62ae2e59b0c4b737af0c425a6b7c60fbfc0f9d3d | /src/LinearRegression.java | d75368980f63a0861ab02f822dedcc92f38d7c64 | [] | no_license | emanlodovice/LinearRegression | edf1b2ef8124fedd0ea8c2d6b7ed87c324c45c30 | 90b5a1bbf4f7fbb20b68719a1b8472310a1f7bfa | refs/heads/master | 2021-05-28T07:00:34.484135 | 2014-10-18T20:30:17 | 2014-10-18T20:30:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,457 | java | public class LinearRegression {
double[][] features;
double[][] test;
double[] output;
double[] theta;
// private double alpha = 0.0000000001;
double alpha = 0.0002;
int max_steps = 10000;
double minDeltaJ = 0.0003;
int number_test_entry = 1500;
public LinearRegression(String input, String separator,String config) throws Exception {
Object[] obs = FileReader.read(config);
// get value of alpha from config
String temp = obs[0].toString();
temp = temp.substring(0, temp.indexOf('#')).trim();
this.alpha = Double.parseDouble(temp);
// get max steps
temp = obs[1].toString();
temp = temp.substring(0, temp.indexOf('#')).trim();
this.max_steps = Integer.parseInt(temp);
// get min delta J from config
temp = obs[2].toString();
temp = temp.substring(0, temp.indexOf('#')).trim();
this.minDeltaJ = Double.parseDouble(temp);
System.out.println(this.alpha);
// check if feature scaling enabled
temp = obs[3].toString();
temp = temp.substring(0, temp.indexOf('#')).trim();
boolean scaling_enabled = temp.contentEquals("1");
// check selected features
temp = obs[4].toString();
temp = temp.substring(0, temp.indexOf('#')).trim();
String[] indeces = temp.split(" ");
int[] feature_index = new int[indeces.length];
double[] powers = new double[indeces.length];
for(int i=0; i < indeces.length; i++) {
String[] parts = indeces[i].split("\\^");
feature_index[i] = Integer.parseInt(parts[0]);
if (parts.length > 1) {
powers[i] = Double.parseDouble(parts[1]);
} else {
powers[i] = 1.0;
}
}
Object[] values = FileReader.read(input);
features = new double[values.length][];
output = new double[values.length];
// initialize feature values
for (int i=0; i < values.length; i++) {
String v = values[i].toString();
String[] vals = v.split(separator);
features[i] = new double[feature_index.length + 1];
features[i][0] = 1.0;
// initialize theta to 0
if (theta == null) {
theta = new double[feature_index.length + 1];
}
// initialize values of features according to the columns specified in the config
for (int j=0; j < feature_index.length; j++) {
features[i][j + 1] = Math.pow(Double.parseDouble(vals[feature_index[j] - 1]), powers[j]);
}
output[i] = Double.parseDouble(vals[vals.length - 1]);
}
if (scaling_enabled) {
this.features = normalizeAndScale(features);
}
}
public void gradientDescend() {
Graph g = new Graph();
g.graph();
int steps = 0;
double prevJ = j(theta, features, output);
g.add(steps, prevJ);
while (steps < max_steps) {
steps++;
double[] hMinusY = new double[features.length];
for (int i=0; i < features.length; i++) {
hMinusY[i] = hOfx(theta, features[i]) - output[i];
}
double[] newTheta = new double[theta.length];
for (int i=0; i < theta.length; i++) {
newTheta[i] = theta[i] - alpha * gradient(hMinusY, features, i);
}
theta = newTheta;
double newJ = j(theta, features, output);
if (Math.abs(prevJ - newJ) < minDeltaJ) {
System.out.println("prev: " + prevJ);
System.out.println("new: " + newJ);
System.out.println("diff: " + (prevJ - newJ));
System.out.println("End gd a j = " + newJ);
return;
}
prevJ = newJ;
g.add(steps, newJ);
}
System.out.println("End after " + steps + " steps");
System.out.println("with " + prevJ + " error");
}
/* This function will compute for the partial derivative of J with respect of
theta[i], which is the gradient. It accepts the h(x) - y for all data entry,
the matrix feature, and the current index of theta we are updating.
*/
public double gradient(double[] hMinusY, double[][] features, int curJ) {
double res = 0;
for (int i=0; i < hMinusY.length; i++) {
res += hMinusY[i] * features[i][curJ];
}
return res / hMinusY.length;
}
/* This function accepts a matrix of features from x[0] to x[n].
Then it returns the normalized and scaled feature matrix.
*/
public static double[][] normalizeAndScale(double[][] features) {
double[][] res = new double[features.length][features[0].length];
// set x[0]s equal to 1
for (int i=0; i < features.length; i++) {
res[i][0] = 1.0;
}
// do normalization and scaling for x[1] to x[n]
for (int x=1; x < features[0].length; x++) {
double total = 0;
double max = features[0][x];
double min = features[0][x];
// computes the total of a feature and gets the max and min values
for (int j=0; j < features.length; j++) {
total += features[j][x];
if (features[j][x] > max) {
max = features[j][x];
}
if (features[j][x] < min) {
min = features[j][x];
}
}
double ave = total / features.length;
// computes the new value of the feature applying mean normalization and scaling
for (int j=0; j < features.length; j++) {
res[j][x] = (features[j][x] - ave) / (max - min);
}
}
return res;
}
/* This function accepts two vectors (thetas and x's). It will return value
value of h(x) = x[0]*theta[0] + x[1]*theta[1] + ... x[n]*theta[n].
*/
public static double hOfx(double[] theta, double[] xs) {
double total = 0;
for (int i=0; i < theta.length; i++) {
total += theta[i] * xs[i];
}
return total;
}
/* This function computes for a J(theta), which is the error. It accepts a
theta vector and feature matrix.
*/
public static double j(double[] theta, double[][] features, double[] output) {
double res = 0;
for (int i=0; i < features.length; i++) {
double hx = hOfx(theta, features[i]);
res += Math.pow(hx - output[i], 2);
}
return res / (2 * features.length);
}
// delete later
public static void print(double[][] features) {
for (int i=0; i < features.length; i++) {
System.out.print("\n[ ");
for (int j=0; j < features[i].length; j++) {
System.out.print(features[i][j] + " ");
}
System.out.print("]");
}
}
public static void print(double[] output) {
System.out.print("\n[ ");
for (int i=0; i < output.length; i++) {
System.out.print(output[i] + " ");
}
System.out.print("]");
}
}
| [
"[email protected]"
] | |
f2e17ce0feb35e8344ec9006cf36beb4b8416485 | 0bd022e87ce618c41370f951fcfc2c68c714c3b5 | /app/src/main/java/com/example/tecinfo/calculator/Activityd.java | 0db57e65d8eb1c39e154fdf02236a9f3e748993c | [] | no_license | tavaresrafaela/calculator | 913b15f30d38aef3f4a58b85c22c3d8b086711a6 | 80bed33e85f76ea193d7873c3462ca46bfe2cf12 | refs/heads/master | 2020-04-05T10:03:56.957620 | 2018-11-09T00:19:07 | 2018-11-09T00:19:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,286 | java | package com.example.tecinfo.calculator;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Display;
import android.view.View;
import android.widget.EditText;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
public class Activityd extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_d);
Button bt_inicio = (Button) findViewById(R.id.bt_inicio);
Button bt_calcular = (Button) findViewById(R.id.bt_calcular);
TextView tx_nome = findViewById(R.id.nome);
TextView tx_sobrenome = findViewById(R.id.sobrenome);
TextView tx_formacao = findViewById(R.id.formacao);
TextView tx_idade = findViewById(R.id.idade);
TextView tx_telefone = findViewById(R.id.telefone);
TextView tx_data = findViewById(R.id.data);
Intent intentRecebido = getIntent();
String nome = intentRecebido.getStringExtra("nome");
String sobrenome = intentRecebido.getStringExtra("sobrenome");
String formacao = intentRecebido.getStringExtra("formacao");
String idade = intentRecebido.getStringExtra("idade");
String telefone = intentRecebido.getStringExtra("telefone");
String data = intentRecebido.getStringExtra("data");
tx_nome.setText(nome);
tx_sobrenome.setText(sobrenome);
tx_formacao.setText(formacao);
tx_idade.setText(idade);
tx_telefone.setText(telefone);
tx_data.setText(data);
bt_inicio.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent( Activityd.this, ActivityB.class);
startActivity(intent);
finish();
}
});
bt_calcular.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent( Activityd.this, MainActivity.class);
startActivity(intent);
finish();
}
});
}
}
| [
"[email protected]"
] | |
4e2578b0669adc81c98a01fa121feda4d1947608 | ac99dc85be34d25e277724dc20e1e4ccf40584c8 | /src/main/java/com/mir/app/simplecloud/account/AccountRepository.java | 173f45e02831932d3df2df3ea273e65514d66038 | [] | no_license | maxeasy2/simple-cloud | b89d79861d6861a298756db3a02cdcc74be18a97 | 0ce207066693e42c91dc6acf3361bdb6cbd7ac5c | refs/heads/master | 2021-05-16T19:45:24.258533 | 2020-03-29T15:52:30 | 2020-03-29T15:52:30 | 250,444,080 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 222 | java | package com.mir.app.simplecloud.account;
import org.springframework.data.jpa.repository.JpaRepository;
public interface AccountRepository extends JpaRepository<Account, Long> {
Account findByUserId(String userId);
}
| [
"[email protected]"
] | |
9cfc2a10b7272b5c14c550a32a9fefdf013b5983 | d73a7016e56233f1f6e447bdebd9b0935ba7fe2d | /Logic/src/DataTypes/Util/SecretWithMissionSizeConverter.java | 2308eeed454457a577dbe197cf980e2e7cd3a8e4 | [] | no_license | yair16karshi/Enigma | 57ecc941a02a2ac6ba818d56f3697e9d218de491 | 7eca8160b4f837a59636a26fe1f047c0e94d5a88 | refs/heads/master | 2020-03-17T21:49:13.412380 | 2018-08-09T21:38:31 | 2018-08-09T21:38:31 | 133,971,068 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,975 | java | package DataTypes.Util;
import DataTypes.GeneratedMachineDataTypes.SerializeableMachine.Secret;
import DataTypes.GeneratedMachineDataTypes.SerializeableMachine.SecretWithMissionSize;
import pukteam.enigma.component.machine.secret.SecretBuilder;
import pukteam.enigma.component.machine.secret.SecretImpl;
public class SecretWithMissionSizeConverter{
public static SecretWithMissionSize AviadToSerializable(DataTypes.SecretWithMissionSize secretWithMissionSize){
Secret resSecret = new Secret(
secretWithMissionSize.getSecret().getSelectedRotorsInOrder(),
secretWithMissionSize.getSecret().getSelectedRotorsPositions(),
secretWithMissionSize.getSecret().getSelectedReflector());
SecretWithMissionSize resSecretWithMissionSize = new SecretWithMissionSize();
resSecretWithMissionSize.setMissionSize(secretWithMissionSize.getMissionSize());
resSecretWithMissionSize.setSecret(resSecret);
return resSecretWithMissionSize;
}
public static DataTypes.SecretWithMissionSize SerializableToAviad(SecretWithMissionSize secretWithMissionSize,SecretBuilder secretBuilder){
DataTypes.SecretWithMissionSize resSecretWithMissionSize = new DataTypes.SecretWithMissionSize();
secretBuilder.selectReflector(secretWithMissionSize.getSecret().getSelectedReflector());
for(int i=0; i<secretWithMissionSize.getSecret().getSelectedRotorsInOrder().size(); i++){
secretBuilder.selectRotor(
secretWithMissionSize.getSecret().getSelectedRotorsInOrder().get(i),
secretWithMissionSize.getSecret().getSelectedRotorsPositions().get(i));
}
pukteam.enigma.component.machine.api.Secret resSecret = secretBuilder.create();
resSecretWithMissionSize.setSecret(resSecret);
resSecretWithMissionSize.setMissionSize(secretWithMissionSize.getMissionSize());
return resSecretWithMissionSize;
}
}
| [
"[email protected]"
] | |
b2c1bc44852c4fded83ef5d90a2133a97f9e1770 | c43b921cc7b0b8e005a1fad25eb2642b07021db3 | /KTC_V3/src/ktc_v3/CellMatrix.java | ee8b8fdc55247167adbf79450b4bb1ac8cede6f5 | [] | no_license | Alex-Willenbrink/KTC | 2f0b369aeaf874e20b6b51bddf76f87585d28c3f | ca379dc792b13176975478c03b32e573706d12c7 | refs/heads/master | 2021-01-20T07:51:54.952166 | 2017-05-02T16:27:37 | 2017-05-02T16:27:37 | 90,054,415 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,037 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ktc_v3;
import java.util.ArrayList;
import java.util.Random;
import javafx.scene.shape.Circle;
import javafx.scene.shape.Shape;
/**
*
* @author Alex
*/
public class CellMatrix implements CellMatrixInterface{
private ArrayList<Cell> cellArray = new ArrayList<>();
private ArrayList<Cell> divideList = new ArrayList<>();
private Circle circle;
public CellMatrix(Circle circle){
this.circle = circle;
}
@Override
public void repliate() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void infect() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void turn() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public boolean checkCellCollisions(Cell newCell) {
for (Cell currCell : cellArray) {
Shape intersect = Shape.intersect(currCell.getCircle(), newCell.getCircle());
if (intersect.getBoundsInLocal().getWidth() != -1) {
return true;
}
}
return false;
}
public void addCell2Matrix(Cell newCell){
this.cellArray.add(newCell);
}
public ArrayList<Cell> getCellArray() {
return this.cellArray;
}
public Circle getCircle() {
return this.circle;
}
// You'll have to make this more dynamic later
@Override
public boolean checkWithinBigCircle(Cell cellNew) {
double xDiff = this.circle.getCenterX() - cellNew.getCircle().getCenterX();
double yDiff = this.circle.getCenterY() - cellNew.getCircle().getCenterY();
double rCondition = this.circle.getRadius() - cellNew.getCircle().getRadius();
return Math.pow(Math.pow(yDiff, 2) + Math.pow(xDiff, 2), 0.5) <= rCondition;
}
public void updateDivisionList(){
divideList = new ArrayList<>();
for(Cell cell : cellArray){
if(checkForNextDivision(cell)){
divideList.add(cell);
}
}
}
public boolean checkForNextDivision(Cell cell){
if(nextBooleanAboveX(cell.getCellDivideRatio())){
return true;
}
return false;
}
public boolean nextBooleanAboveX(double x){
Random rand = new Random();
if(rand.nextFloat() < x){
return true;
} else return false;
}
public ArrayList<Cell> getDivideList() {
return divideList;
}
}
| [
"[email protected]"
] | |
3776552f48c63e1d15bee95fe9ab9e1a3b6b650c | fe087dd77d53a57263a8a9d5a4cae8c4c9afc060 | /imagej/EDF-src/EDF_Viewer3D_.java | c53c56ad99b5a232c6a8daabd7f7668fe749b33b | [] | no_license | tischi/scripts | 9ebeae80785996ac91d34a366cc9571dd70c4d88 | fbef07ecf7c2fde1626b24839a7d8933f58ccb1e | refs/heads/master | 2021-01-10T19:02:54.208340 | 2015-12-21T15:38:35 | 2015-12-21T15:38:35 | 6,355,262 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,255 | java | //==============================================================================
//
// Project: EDF - Extended Depth of Focus
//
// Author: Daniel Sage
//
// Organization: Biomedical Imaging Group (BIG)
// Ecole Polytechnique Federale de Lausanne (EPFL), Lausanne, Switzerland
//
// Information: http://bigwww.epfl.ch/demo/edf/
//
// Reference: B. Forster, D. Van De Ville, J. Berent, D. Sage, M. Unser
// Complex Wavelets for Extended Depth-of-Field: A New Method for the Fusion
// of Multichannel Microscopy Images, Microscopy Research and Techniques,
// 65(1-2), pp. 33-42, September 2004.
//
// Conditions of use: You'll be free to use this software for research purposes,
// but you should not redistribute it without our consent. In addition, we
// expect you to include a citation or acknowledgment whenever you present or
// publish results that are based on it.
//
// History:
// - Updated (Daniel Sage, 21 December 2010)
//
//==============================================================================
import ij.IJ;
import ij.ImagePlus;
import ij.WindowManager;
import ij.gui.GUI;
import java.awt.FlowLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Vector;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import surfacemap.SurfaceMap3D;
public class EDF_Viewer3D_ extends JDialog implements ActionListener {
private Vector indexMap;
private Vector indexTexture;
private JPanel jContentPane = null;
private GridBagLayout layout;
private GridBagConstraints constraint;
private JButton bnHeightMap;
private JButton bnClose;
private JLabel lblMap;
private JLabel lblTexture;
private JComboBox choiceMap;
private JComboBox choiceTexture;
private String STR_CHOICE = "<Select an image>";
private boolean isMapSelected = false;
private boolean isTextureSelected = false;
/**
* Constructor extends JDialog.
*/
public EDF_Viewer3D_() {
super();
super.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setContentPane(getJContentPane());
setTitle("EDF Viewer 3D");
pack();
setVisible(true);
GUI.center(this);
}
/**
* This method initializes jContentPane.
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
// Layout
layout = new GridBagLayout();
constraint = new GridBagConstraints();
// List of images
lblMap = new JLabel("Height-Map");
lblTexture = new JLabel("Texture");
// Buttons
bnClose = new JButton("Close");
bnHeightMap = new JButton("Show Height-Map");
bnHeightMap.setEnabled(false);
// Panel buttons
JPanel pnButtons = new JPanel();
pnButtons.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 0));
pnButtons.add(bnClose);
pnButtons.add(bnHeightMap);
jContentPane = new JPanel(layout);
choiceMap = new JComboBox();
choiceMap.addActionListener(this);
choiceTexture = new JComboBox();
choiceTexture.addActionListener(this);
choiceMap.addItem(STR_CHOICE);
choiceTexture.addItem(STR_CHOICE);
indexMap = setMapList(choiceMap);
indexTexture = setTextureList(choiceTexture);
JPanel pnControls = new JPanel(layout);
pnControls.setBorder(BorderFactory.createEtchedBorder());
addComponent(pnControls, 1, 0, 1, 1, 5, lblMap);
addComponent(pnControls, 1, 1, 1, 1, 5, choiceMap);
addComponent(pnControls, 2, 0, 1, 1, 5, lblTexture);
addComponent(pnControls, 2, 1, 1, 1, 5, choiceTexture);
addComponent(jContentPane, 1, 0, 3, 1, 10, pnControls);
addComponent(jContentPane, 3, 0, 3, 1, 10, pnButtons);
bnClose.addActionListener(this);
bnHeightMap.addActionListener(this);
if (indexMap.size() == 0 || indexTexture.size() == 0) {
IJ.error("You have to open a Topology image and a Texture image");
}
}
return jContentPane;
}
/**
* Add a component in a panel in the northeast of the cell.
*/
private void addComponent(JPanel pn, int row, final int col, int width, final int height, int space, JComponent comp) {
constraint.gridx = col;
constraint.gridy = row;
constraint.gridwidth = width;
constraint.gridheight = height;
constraint.anchor = GridBagConstraints.NORTHWEST;
constraint.insets = new Insets(space, space, space, space);
constraint.weightx = IJ.isMacintosh()?90:100;
constraint.fill = GridBagConstraints.HORIZONTAL;
layout.setConstraints(comp, constraint);
pn.add(comp);
}
/**
* Implements the actionPerformed method of the ActionListener.
*/
public synchronized void actionPerformed(ActionEvent e) {
Object source = e.getSource();
if (source == bnClose) {
dispose();
}
else if (source == bnHeightMap) {
int index = choiceMap.getSelectedIndex() - 1;
Integer map = (Integer)indexMap.elementAt(index);
ImagePlus imp = WindowManager.getImage(map.intValue());
index = choiceTexture.getSelectedIndex() - 1;
Integer Texture = (Integer)indexTexture.elementAt(index);
ImagePlus impTexture = WindowManager.getImage(Texture.intValue());
SurfaceMap3D viewer = new SurfaceMap3D(imp, impTexture);
Thread thread = new Thread(viewer);
thread.start();
this.dispose();
}
else if (source == choiceMap){
if (choiceMap.getSelectedIndex() !=0) {
isMapSelected = true;
}
else{
isMapSelected = false;
}
if (isMapSelected && isTextureSelected)
this.bnHeightMap.setEnabled(true);
else
this.bnHeightMap.setEnabled(false);
}
else if (source == choiceTexture){
if (choiceTexture.getSelectedIndex() !=0) {
isTextureSelected = true;
}
else{
isTextureSelected = false;
}
if ( isMapSelected && isTextureSelected)
this.bnHeightMap.setEnabled(true);
else
this.bnHeightMap.setEnabled(false);
}
}
/**
* Set the list of images.
*/
private Vector setTextureList(JComboBox choice) {
Vector index = new Vector(1,1);
int[] wList = WindowManager.getIDList();
if (wList==null) {
return index;
}
index.removeAllElements();
Vector list = new Vector(1,1);
for (int i=0; i<wList.length; i++) {
ImagePlus imp = WindowManager.getImage(wList[i]);
if (imp != null)
if (imp.getStackSize() == 1)
if ((imp.getType() == ImagePlus.COLOR_RGB) ||
(imp.getType() == ImagePlus.GRAY8) ||
(imp.getType() == ImagePlus.GRAY16) ||
(imp.getType() == ImagePlus.GRAY32) ||
(imp.getType() == ImagePlus.COLOR_256)) {
list.addElement(imp.getTitle());
index.addElement(new Integer(wList[i]));
}
}
if (list.size() <= 0 && choice == choiceMap) {
IJ.error("No suitable texture images are open.");
return index;
}
for (int i=0; i<list.size(); i++)
choice.addItem((String)list.elementAt(i));
return index;
}
/**
* Set the list of images.
*/
private Vector setMapList(JComboBox choice) {
Vector index = new Vector(1,1);
int[] wList = WindowManager.getIDList();
if (wList==null) {
if (choice == choiceMap) // To display the message only one time
IJ.error("No images are open.");
return index;
}
Vector list = new Vector(1,1);
for (int i=0; i<wList.length; i++) {
ImagePlus imp = WindowManager.getImage(wList[i]);
if (imp != null)
if (imp.getStackSize() == 1)
if ((imp.getType() == ImagePlus.GRAY32) ||
(imp.getType() == ImagePlus.GRAY8) ||
(imp.getType() == ImagePlus.GRAY16)) {
list.addElement(imp.getTitle());
index.addElement(new Integer(wList[i]));
}
}
if (list.size() <= 0 && choice == choiceMap) {
IJ.error("No suitable map images are open. Try Grayscale Images.");
return index;
}
for (int i=0; i<list.size(); i++)
choice.addItem((String)list.elementAt(i));
return index;
}
}
| [
"[email protected]"
] | |
3b87959e57c735cde0bf56cea3eb45771b724a8f | 6fab3f1e150284edd43a7b1d9b050879235b4b01 | /src/main/java/com/nongyeos/loan/app/service/IFlowNodeService.java | 6f3cc4893fba1b17172f7d5b70cab2e7fa9ff209 | [] | no_license | theLittleBirds/hlj_nongdai | e5c96386dbc6e1ebd1e770b00e9a5f042aa42ddc | 3a53d4e541190c0dd509f7583e5937bde415e21e | refs/heads/master | 2020-05-05T13:00:47.212692 | 2019-04-08T02:46:34 | 2019-04-08T02:46:34 | 180,055,330 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 664 | java | package com.nongyeos.loan.app.service;
import java.util.List;
import com.nongyeos.loan.app.entity.FlowNode;
public interface IFlowNodeService {
void addFleNode(FlowNode fleNode) throws Exception;
void updateFleNode(FlowNode fleNode) throws Exception;
void updateFleNode1(FlowNode fleNode) throws Exception;
void deleteFleNode(String fleNodeId) throws Exception;
List<FlowNode> selectByAppId(String appId) throws Exception;
FlowNode selectByNodeId(String nodeId) throws Exception;
FlowNode getApproverIdsByNodeId(String nodeId) throws Exception;
FlowNode queryByEnameAndModel(FlowNode fleNode) throws Exception;
List<FlowNode> selectAll();
}
| [
"[email protected]"
] | |
bc932b4ecd5f31c8a9418f0009a449f047f896ce | 71aeaa0dda33ef7efcf9b1ac0ace51f017a03a0f | /TEST/二手租赁APP代码/Java Web服务端源码/src/com/tomo/dao/UsersDao.java | 4890abd935e31b57598ccb463fb2e934ee77fd2e | [] | no_license | justinhaha/borrow-and-lend | 47de342a5def6bc5872d302bc7122ca4936908fc | a457fed8c8b869789770b14345293d64f59fe4a8 | refs/heads/master | 2020-03-16T03:05:20.803358 | 2018-05-07T15:38:57 | 2018-05-07T15:38:57 | 132,480,115 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 231 | java | /**
*
*/
package com.tomo.dao;
import com.tomo.dao.common.BaseDao;
import com.tomo.entity.Users;
/**
* @author YHX
* @date: 日期:2014-1-6 时间:下午3:03:26
*/
public interface UsersDao extends BaseDao<Users>{
}
| [
"[email protected]"
] | |
4d0f385ec11a6587f446ab5733dc2be02cfd6d28 | 6b05de2fa683fcd3d89898898f45841105113900 | /pipeline-core/src/main/java/com/github/jadepeng/pipeline/core/api/AgentApi.java | 8a49f593c89e91af840824dee6b5b00c0595d240 | [] | no_license | surging-dandelion/docker-pipeline | 2a8e11d585ecf14b3fe6c8ffbb037c84b724e5b7 | 858c694aab4eca4c41cd9ccebe6e7a9298a327fd | refs/heads/main | 2023-06-28T00:31:47.211295 | 2021-07-29T01:55:30 | 2021-07-29T01:55:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,421 | java | package com.github.jadepeng.pipeline.core.api;
import javax.validation.Valid;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.github.jadepeng.pipeline.core.bean.AgentInfo;
import com.github.jadepeng.pipeline.core.bean.OperationalSystemInfo;
import com.github.jadepeng.pipeline.core.bean.PipelineJob;
import com.github.jadepeng.pipeline.core.bean.PipelineJobLog;
import com.github.jadepeng.pipeline.core.bean.PipelineJobTaskLog;
import com.github.jadepeng.pipeline.core.dto.BaseResponse;
import com.github.jadepeng.pipeline.core.dto.ExecutePipelineRequest;
import com.github.jadepeng.pipeline.core.dto.JobState;
import feign.Headers;
import feign.Param;
import feign.RequestLine;
public interface AgentApi {
@RequestLine(value = "GET /api/info")
AgentInfo info();
@RequestLine(value = "GET /api/os")
OperationalSystemInfo os() ;
@RequestLine(value = "GET /api/joblog/{jobId}")
PipelineJobLog getJobLog(@Param("jobId") String jobId);
@RequestLine("POST /api/runJob")
@Headers("Content-Type: application/json")
BaseResponse runJob(@Valid @RequestBody ExecutePipelineRequest job);
@RequestLine("POST /api/stopJob")
@Headers("Content-Type: application/json")
BaseResponse stopJob(@Valid @RequestBody PipelineJob job);
}
| [
"[email protected]"
] | |
fa9b0e74665a7dfecaaba25b37ec1c344262b5a5 | ed604b012ff7040db218efd1b9b49c514e15e14c | /src/main/java/com/desgreen/education/siapp/app_email/EmailService.java | 9162821064a44edd3e1c549de21ffec1fdebc9dc | [
"Unlicense"
] | permissive | bagus-stimata/siapp | 2f2edf0be9c00c629faffa050bf060ccd3d3c0c7 | 67f6ddde5efcf01959100f084da402453d7a419d | refs/heads/master | 2022-12-25T09:05:36.261606 | 2020-10-11T11:28:03 | 2020-10-11T11:28:03 | 284,419,437 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,739 | java | package com.desgreen.education.siapp.app_email;
import com.desgreen.education.siapp.AppPublicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.JavaMailSenderImpl;
import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import javax.mail.internet.MimeMessage;
import java.util.Properties;
@Service
public class EmailService {
@Autowired
public JavaMailSender mailSender;
public JavaMailSenderImpl javaMailSender = new JavaMailSenderImpl();
public EmailService(){
try {
// javaMailSender.setUsername("[email protected]");
javaMailSender.setUsername("[email protected]");
javaMailSender.setPassword("Welcome123456789");
Properties properties = new Properties();
properties.put("mail.transport.protocol", "smtp");
properties.put("mail.smtp.ssl.enable", "true");
properties.put("mail.smtp.auth", "true");
properties.put("mail.debug", "true");
properties.put("mail.smtp.connectiontimeout", 6000);
// properties.put("mail.smtp.timeout", 6000); //sellau bikin error: Jangan pakai ini
// properties.put("mail.smtp.starttls.enable", "true");
javaMailSender.setJavaMailProperties(properties);
// javaMailSender.setHost("mail.des-green.com");
javaMailSender.setHost("mail.ponpesdahlanikhsan.com");
javaMailSender.setPort(465);
// mailSender.setPort(587); //Not SSL
}catch (Exception ex) {}
}
@Async
public void sendSimpleMessage(String to, String subject, String textMesage) {
SimpleMailMessage msg = new SimpleMailMessage();
msg.setFrom(AppPublicService.PUBLIC_HOST_EMAIL); //Dummy aslinya ada di setting: Tapi harus ada
// msg.setTo("[email protected]", "[email protected]", "[email protected]");
msg.setTo(to);
msg.setSubject(subject);
// msg.setText("Hello World \n Spring Boot Email ari mas bagus winanro");
msg.setText(textMesage);
mailSender.send(msg);
}
@Async
public void sendSimpleHtmlMessage(String to, String subject, String htmlContent){
MimeMessage mimeMessage = this.mailSender.createMimeMessage();
MimeMessageHelper message = new MimeMessageHelper(mimeMessage, "UTF-8");
try {
message.setFrom(AppPublicService.PUBLIC_HOST_EMAIL); //Dummy aslinya ada di setting: Tapi harus ada
message.setTo(to);
message.setSubject(subject);
message.setText(htmlContent, true);
}catch (Exception ex){}
mailSender.send(mimeMessage);
}
@Async
public void sendSimpleMessageManual(String to, String subject, String textMesage) throws Exception {
SimpleMailMessage msg = new SimpleMailMessage();
msg.setFrom(AppPublicService.PUBLIC_HOST_EMAIL); //Dummy aslinya ada di setting: Tapi harus ada
// msg.setFrom("[email protected]");
// msg.setTo("[email protected]", "[email protected]", "[email protected]");
msg.setTo(to);
msg.setSubject(subject);
// msg.setText("Hello World \n Spring Boot Email Boss");
msg.setText(textMesage);
javaMailSender.send(msg);
}
@Bean
public void testImplement(){
System.out.println("hello oke ini");
}
} | [
"[email protected]"
] | |
ed6ffbd3fc23e959d0f3f2434dbc4690b59d501e | b6acb787a644ab293e5a4c7a711ac7cdfca5d0df | /feesCommissionManager/src/main/java/com/electron/mfs/pg/feescommission/repository/package-info.java | 982e5de54aa93b7611d31d7e9d2b95355650f0a4 | [] | no_license | fsfish/electron-backend | 3440089550a5222cfa5fa4855302a2404fa34577 | dff5634d0f8e75c090eca3c66aad3c76883b1edd | refs/heads/master | 2021-05-22T00:27:37.984536 | 2020-03-30T18:16:03 | 2020-03-30T18:16:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 96 | java | /**
* Spring Data JPA repositories.
*/
package com.electron.mfs.pg.feescommission.repository;
| [
"[email protected]"
] | |
135bbbc4bf089fedd35ef7a2108904780839eeb4 | 288ef587366db6c75051fad10cce01c9f433cba4 | /M4_Assessment_VM/src/main/java/com/sg/vendingmachine/advice/LoggingAdvice.java | e79be379bbf9cdc667097487bdfbb117f725d5aa | [] | no_license | ajama28/Apprenticeship_Assignments | 74087023d5a72239ef3e72d05a4498df3166f697 | 15b909c1688741a07c5d68aee0b795202f01cfca | refs/heads/master | 2021-01-01T11:15:59.691939 | 2019-12-13T16:26:25 | 2019-12-13T16:26:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,340 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.sg.vendingmachine.advice;
import com.sg.vendingmachine.dao.VendingMachineAuditDao;
import com.sg.vendingmachine.dao.VendingMachinePersistenceException;
import com.sg.vendingmachine.service.InsufficientFundsException;
import com.sg.vendingmachine.service.NoItemInventoryException;
import org.aspectj.lang.JoinPoint;
/**
*
* @author jesse
*/
public class LoggingAdvice {
VendingMachineAuditDao auditDao;
public LoggingAdvice(VendingMachineAuditDao auditDao) {
this.auditDao = auditDao;
}
public void createAuditEntry(JoinPoint jp, Throwable ex)
throws InsufficientFundsException,
NoItemInventoryException {
Object[] args = jp.getArgs();
String auditEntry = jp.getSignature().getName() +": "+ ex.toString() + ": ";
for (Object currentArg : args) {
auditEntry += currentArg + ": ";
}
try {
auditDao.writeAuditEntry(auditEntry);
} catch (VendingMachinePersistenceException e) {
System.err.println(
"ERROR: Could not create audit entry in LoggingAdvice.");
}
}
}
| [
"[email protected]"
] | |
6bc2a5ea51e49d5c5180a87279964330f71eb7e9 | 4950a1d01c47d411e9d6f086530bd5faf865c900 | /agents-app/agents-back-end/src/main/java/com/SoapWebServiceConfig.java | 6d98aa1260898967b15a9f5483526a973f00e022 | [] | no_license | vlada29/XML-i-Web-Servisi | a41e5762a9a032e2369515f213b2bff6532396f6 | 7070ef1086fdb5129c1db615d5d6dfb7baa29467 | refs/heads/master | 2020-03-11T10:24:33.119277 | 2018-06-24T08:38:14 | 2018-06-24T08:38:14 | 129,941,725 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,521 | java | package com;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;
import org.springframework.ws.config.annotation.EnableWs;
import org.springframework.ws.config.annotation.WsConfigurerAdapter;
import org.springframework.ws.transport.http.MessageDispatcherServlet;
import org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition;
import org.springframework.xml.xsd.SimpleXsdSchema;
import org.springframework.xml.xsd.XsdSchema;
@EnableWs
@Configuration
public class SoapWebServiceConfig extends WsConfigurerAdapter {
@Bean
public ServletRegistrationBean messageDispatcherServlet(ApplicationContext context) {
MessageDispatcherServlet servlet = new MessageDispatcherServlet();
servlet.setApplicationContext(context);
servlet.setTransformWsdlLocations(true);
return new ServletRegistrationBean(servlet, "/soapWS/*");
}
// @Bean
// public DefaultWsdl11Definition defaultWsdl11Definition(XsdSchema userSchema) {
//
// DefaultWsdl11Definition definition = new DefaultWsdl11Definition();
// definition.setSchema(userSchema);
// definition.setLocationUri("/soapWS");
// definition.setPortTypeName("UserServicePort");
// definition.setTargetNamespace("ns");
// return definition;
// }
} | [
"[email protected]"
] | |
f0f3d991e763515d6c1e7ac4bcd0ebbea8ff1220 | 7d25e78ff4b72e6df6bb5c97678f7070287bbddd | /src/acmp/problem246/Main.java | 8700ad012dc581d4b9a708cf7536ef0aafd9c3a4 | [] | no_license | numatay/CompetativeProgramming | 490e12f25fc4d4f62777b7fb1dc3f3881c3f4472 | 6c0ea0d224e8f717e925a484ac42dc8aaae98ac6 | refs/heads/master | 2021-01-22T05:54:06.772772 | 2017-05-17T12:09:41 | 2017-05-17T12:09:41 | 81,718,119 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 806 | java | package acmp.problem246;
import java.io.PrintWriter;
import java.util.Scanner;
/**
* Created by umatayn on 01/25/2017.
*/
public class Main {
public static void main(String[] args) {
new Thread(null, () -> new Main().run(), "solution", 1 << 23).start();
}
public void run() {
// initialize resources
Scanner in = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int n = in.nextInt();
int prev = -1, cur;
int cnt = 0;
for (int i = 0; i < n; i++) {
cur = in.nextInt();
if ((prev != -1) && (prev > cur || (cur - prev > 1))) {
cnt++;
}
prev = cur;
}
out.print(cnt);
// release resources
out.close();
}
} | [
"[email protected]"
] | |
48a131601be7149a19f7bedf7c8e813754864d35 | 760e696ab78d9347b62381ce395c9023b05c28a6 | /jtsapp/src/main/java/com/vividsolutions/jtstest/testbuilder/geom/EnvelopeUtil.java | 0f656c38f0088c3aea727e371359a650ff56fd00 | [] | no_license | hastebrot/jts-topo-suite | 0c532641147d3880b91312dff375d9226585b0d1 | 8f0bd55cb7c837799c6b356af16d1a23b2114c29 | refs/heads/master | 2016-09-05T22:54:04.073815 | 2015-06-02T05:15:19 | 2015-06-02T05:15:19 | 37,997,834 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 444 | java | package com.vividsolutions.jtstest.testbuilder.geom;
import com.vividsolutions.jts.geom.Envelope;
public class EnvelopeUtil
{
public static double minExtent(Envelope env)
{
double w = env.getWidth();
double h = env.getHeight();
if (w < h) return w;
return h;
}
public static double maxExtent(Envelope env)
{
double w = env.getWidth();
double h = env.getHeight();
if (w > h) return w;
return h;
}
}
| [
"dr_jts@3b1963ad-ff86-43ac-bf88-fa91f6ade54d"
] | dr_jts@3b1963ad-ff86-43ac-bf88-fa91f6ade54d |
08d3344f9e1d76d64156405d62d4991bf5498299 | 1567751bf6cdfbc97aa6988614b8f7ab955ef3aa | /app/src/main/java/com/example/rohan/hellotoast/MainActivity.java | b6dabc1b3dcf24cc67f95610120403d1e60611a3 | [] | no_license | rohanyadav1152/Hellotoast | d7f4a77a0086d97a49d4c324079b3050cc0d342a | 4ea43e79b012ac3ef24feaf69079334e5e5ad3a9 | refs/heads/master | 2020-03-23T09:30:50.777593 | 2018-07-18T06:41:06 | 2018-07-18T06:41:06 | 141,392,291 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 827 | java | package com.example.rohan.hellotoast;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
public class MainActivity extends Activity {
private int mCount=0;
private TextView mShowCount;
String msg="Count is: ";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mShowCount=(TextView)findViewById(R.id.show_count);
}
public void countUp(View view){
mCount++;
if(mShowCount !=null)
mShowCount.setText(Integer.toString(mCount));
}
public void ShowToast(View view){
Toast toast=Toast.makeText(this,msg+mCount, Toast.LENGTH_LONG);
toast.show();
}
}
| [
"[email protected]"
] | |
4ab0c45ed86c52824daf676445f033cbda25f376 | 0a840a61a4b72908d1faa3a2d01026f9ed8a6515 | /SSLServerProject/src/sslserverproject/Server.java | 262fe748c9561b1652ea7778f817637f183f238a | [] | no_license | cimystory/Distributed_System | 0f5c067694bc5e2e50d324a9c5e5dad438858cf6 | 91df23d18b89c1dbb38c50181ffdbd5c9f22ab82 | refs/heads/master | 2021-05-30T01:59:06.736543 | 2015-11-14T00:10:18 | 2015-11-14T00:10:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,820 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package sslserverproject;
import java.io.*;
import java.net.*;
import javax.net.*;
import javax.net.ssl.*;
import java.security.*;
/**
*
* @author Gao
*/
public class Server {
// hold the name of the keystore containing public and private keys
static String keyStore = "Coolkeystore.jks";
// password of the keystore (same as the alias)
static char keyStorePass[] = "sesame".toCharArray();
public static void main(String args[]) {
int port = 6502;
SSLServerSocket server;
try {
// get the keystore into memory
KeyStore ks = KeyStore.getInstance("JKS");
ks.load(new FileInputStream(keyStore), keyStorePass);
// initialize the key manager factory with the keystore data
KeyManagerFactory kmf =
KeyManagerFactory.getInstance("SunX509");
kmf.init(ks,keyStorePass);
// initialize the SSLContext engine
// may throw NoSuchProvider or NoSuchAlgorithm exception
// TLS - Transport Layer Security most generic
SSLContext sslContext = SSLContext.getInstance("TLS");
// Inititialize context with given KeyManagers, TrustManagers,
// SecureRandom defaults taken if null
sslContext.init(kmf.getKeyManagers(), null, null);
// Get ServerSocketFactory from the context object
ServerSocketFactory ssf = sslContext.getServerSocketFactory();
// Now like programming with normal server sockets
ServerSocket serverSocket = ssf.createServerSocket(port);
System.out.println("Accepting secure connections");
Socket client = serverSocket.accept();
System.out.println("Got connection");
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(client.getOutputStream()));
BufferedReader in = new BufferedReader(new InputStreamReader(client.getInputStream()));
String username = in.readLine();
String password = in.readLine();
if(username.equals("Josh") && password.equals("GoBucs")) {
out.write("Greeting Client");
} else {
out.write("Sorry, you are not authorized");
}
out.flush();
in.close();
out.close();
}
catch(Exception e) {
System.out.println("Exception thrown " + e);
}
}
}
| [
"[email protected]"
] | |
291f0a7c2c84c169eb0ab27c1068325cb83b5177 | dfe16b7a810482ed72ed939d1b1d1b833d4fd3db | /DeepComment/src/main/java/chc/bean/DiffType.java | fdfee3bda144f6b03505f2be98eaa6e3c38856f7 | [] | no_license | huanchaochen/DeepComment | 4846a4c41ea5471b6aef5d356bbe0aab4b0b3667 | 9075e2ab616aa0e9d3e5c7838cbfe3d817b72ffb | refs/heads/master | 2021-07-02T17:56:05.703085 | 2017-09-22T03:37:59 | 2017-09-22T03:37:59 | 104,426,380 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,463 | java | package chc.bean;
import java.util.ArrayList;
import java.util.List;
import org.springframework.data.mongodb.core.mapping.Field;
public class DiffType {
private String type;
@Field("new_start_line")
private int newStartLine;
@Field("new_end_line")
private int newEndLine;
@Field("old_start_line")
private int oldStartLine;
@Field("old_end_line")
private int oldEndLine;
@Field("new_hashs")
private List<Long> newHashList = new ArrayList<Long>();
@Field("old_hashs")
private List<Long> oldHashList = new ArrayList<Long>();
@Field("new_keywords")
private List<String> newKeywordList = new ArrayList<String>();
@Field("old_keywords")
private List<String> oldKeywordList = new ArrayList<String>();
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public int getOldStartLine() {
return oldStartLine;
}
public void setOldStartLine(int oldStartLine) {
this.oldStartLine = oldStartLine;
}
public int getOldEndLine() {
return oldEndLine;
}
public void setOldEndLine(int oldEndLine) {
this.oldEndLine = oldEndLine;
}
public int getNewStartLine() {
return newStartLine;
}
public void setNewStartLine(int newStartLine) {
this.newStartLine = newStartLine;
}
public int getNewEndLine() {
return newEndLine;
}
public void setNewEndLine(int newEndLine) {
this.newEndLine = newEndLine;
}
public List<Long> getNewHashList() {
return newHashList;
}
public void setNewHashList(List<Long> newHashList) {
this.newHashList = newHashList;
}
public List<Long> getOldHashList() {
return oldHashList;
}
public void setOldHashList(List<Long> oldHashList) {
this.oldHashList = oldHashList;
}
public void addNewHash(long newHash){
newHashList.add(newHash);
}
public void addOldHash(long oldHash){
oldHashList.add(oldHash);
}
public List<String> getNewKeywordList() {
return newKeywordList;
}
public void setNewKeywordList(List<String> newKeywordList) {
this.newKeywordList = newKeywordList;
}
public List<String> getOldKeywordList() {
return oldKeywordList;
}
public void setOldKeywordList(List<String> oldKeywordList) {
this.oldKeywordList = oldKeywordList;
}
public void addNewKeyword(String keyword){
newKeywordList.add(keyword);
}
public void addOldKeyword(String keyword){
oldKeywordList.add(keyword);
}
}
| [
"Administrator@CHC_LAB_01"
] | Administrator@CHC_LAB_01 |
e2165ee5cd761ae37a71f08a8690cb648a82a78b | cfe621e8c36e6ac5053a2c4f7129a13ea9f9f66b | /AndroidApplications/com.zeptolab.ctr.ads-912244/src/com/google/ads/mediation/jsadapter/JavascriptServerParameters.java | 032b8e55ef1416ad93e194124c685f8e11ca3877 | [] | no_license | linux86/AndoirdSecurity | 3165de73b37f53070cd6b435e180a2cb58d6f672 | 1e72a3c1f7a72ea9cd12048d9874a8651e0aede7 | refs/heads/master | 2021-01-11T01:20:58.986651 | 2016-04-05T17:14:26 | 2016-04-05T17:14:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 526 | java | package com.google.ads.mediation.jsadapter;
import com.google.ads.mediation.MediationServerParameters;
public class JavascriptServerParameters extends MediationServerParameters {
@Parameter(name = "adxtym_height", required = false)
public Integer height;
@Parameter(name = "adxtym_html", required = true)
public String htmlScript;
@Parameter(name = "adxtym_passback_url", required = false)
public String passBackUrl;
@Parameter(name = "adxtym_width", required = false)
public Integer width;
} | [
"[email protected]"
] | |
c4dee8a6da052b150c396407d0976433e474f527 | 1ebf4b6fcede63888fb98abb0d6253db2d99d899 | /snippets/spring-framework-master_SerializableTypeWrapper_4.java | fd978efaae3f085eddbb95b3021ca26fc012ef21 | [] | no_license | stakelab/replication-naturalness-understandability | 07adfd51427a4f5ec7c1a06a146772a90c3b3ace | f00ddec3b9628ea085337f9749e5f3f045ed17a2 | refs/heads/master | 2020-12-15T10:49:21.867564 | 2020-07-16T14:50:16 | 2020-07-16T14:50:16 | 235,079,605 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,296 | java | @Nullable
static Type forTypeProvider(TypeProvider provider) {
Type providedType = provider.getType();
if (providedType == null || providedType instanceof Serializable) {
// No serializable type wrapping necessary (e.g. for java.lang.Class)
return providedType;
}
if (GraalDetector.inImageCode() || !Serializable.class.isAssignableFrom(Class.class)) {
// Let's skip any wrapping attempts if types are generally not serializable in
// the current runtime environment (even java.lang.Class itself, e.g. on Graal)
return providedType;
}
// Obtain a serializable type proxy for the given provider...
Type cached = cache.get(providedType);
if (cached != null) {
return cached;
}
for (Class<?> type : SUPPORTED_SERIALIZABLE_TYPES) {
if (type.isInstance(providedType)) {
ClassLoader classLoader = provider.getClass().getClassLoader();
Class<?>[] interfaces = new Class<?>[] {type, SerializableTypeProxy.class, Serializable.class};
InvocationHandler handler = new TypeProxyInvocationHandler(provider);
cached = (Type) Proxy.newProxyInstance(classLoader, interfaces, handler);
cache.put(providedType, cached);
return cached;
}
}
throw new IllegalArgumentException("Unsupported Type class: " + providedType.getClass().getName());
} | [
"[email protected]"
] | |
3cbe73f1f99b2971fa5353e03cf30c942822ccc1 | de3cc32c392bda4cbc33903259f99194c78bf4d7 | /src/main/java/io/github/jhipster/application/service/mapper/ListTeeTypeMapper.java | 7afc6d95349aa3cebe70e93a36dbf35b668187fa | [] | no_license | Orvas/jhipster-sample-application | 526d4a05098dd508ee66d478b2e419f9b65af96d | 86da109ed1f76fc89370d9d3428d5cbc09ace482 | refs/heads/master | 2022-12-22T21:07:49.001252 | 2019-05-31T14:25:34 | 2019-05-31T14:25:34 | 189,054,767 | 1 | 0 | null | 2022-12-16T04:52:31 | 2019-05-28T15:24:59 | Java | UTF-8 | Java | false | false | 750 | java | package io.github.jhipster.application.service.mapper;
import io.github.jhipster.application.domain.*;
import io.github.jhipster.application.service.dto.ListTeeTypeDTO;
import org.mapstruct.*;
/**
* Mapper for the entity {@link ListTeeType} and its DTO {@link ListTeeTypeDTO}.
*/
@Mapper(componentModel = "spring", uses = {})
public interface ListTeeTypeMapper extends EntityMapper<ListTeeTypeDTO, ListTeeType> {
@Mapping(target = "teeHists", ignore = true)
ListTeeType toEntity(ListTeeTypeDTO listTeeTypeDTO);
default ListTeeType fromId(Long id) {
if (id == null) {
return null;
}
ListTeeType listTeeType = new ListTeeType();
listTeeType.setId(id);
return listTeeType;
}
}
| [
"[email protected]"
] | |
55a9c0239c58116e4eb65ce2075bb14424fdedcd | 57e0a3ead6f2aec63cb37ac490b323cf2f67ae07 | /RegistarKnjiga/src/Citac.java | e76458d830ca07d6f61ea6d89c04d8f48fd7e686 | [] | no_license | KatarinaMhm/Registar-knjiga | a6012d37391fb2a754ef47d21f19ea01694ddf59 | c6ad31971701b1dd42687cf68f4a56c09bff99a4 | refs/heads/master | 2020-04-06T20:00:24.540732 | 2018-11-19T21:20:02 | 2018-11-19T21:20:02 | 157,757,526 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,897 | java | import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import enciklopedijeRecnici.Enciklopedija;
import enciklopedijeRecnici.Recnik;
import fikcija.Fikcija;
import knjiga.Knjiga;
import ostalo.Ostalo;
import struke.Struke;
public class Citac implements ListaKnjiga {
static Scanner input = new Scanner(System.in);
public static void unesiKnjigu() {
System.out.println(
"Koju vrstu knjige zelite da unesete?\nUnesite 1 za fikciju, 2 za enciklopediju, 3 za recnik, 4 za strucnu knjigu ili 5 za ostalo.\nUkoliko ne zelite da unesete knjigu, unesite 6.");
boolean zaUnos = false;
do {
String izbor = input.next();
if (izbor.equals("1")) {
Fikcija f = Fikcija.unosFikcije();
listaKnjiga.add(f);
} else if (izbor.equals("2")) {
Enciklopedija e = Enciklopedija.unosEnciklopedije();
listaKnjiga.add(e);
} else if (izbor.equals("3")) {
Recnik r = Recnik.unosRecnika();
listaKnjiga.add(r);
} else if (izbor.equals("4")) {
Struke s = Struke.unosStruke();
listaKnjiga.add(s);
} else if (izbor.equals("5")) {
Ostalo o = Ostalo.unosOstalo();
listaKnjiga.add(o);
} else if (izbor.equals("6")) {
break;
} else {
System.out.println("Uneli ste pogresan izbor. Ponovite.");
zaUnos = true;
continue;
}
// za novi unos
boolean greska = false;
do {
System.out.println("Zelite li da unesete jos jednu knjigu? Unesite 1 za da ili 2 za ne.");
izbor = input.next();
if (izbor.equals("1")) {
zaUnos = true;
} else if (izbor.equals("2")) {
zaUnos = false;
break;
} else {
System.out.println("Uneli ste pogresan izbor. Ponovite.");
greska = true;
}
} while (greska == true);
// kraj novog unosa
} while (zaUnos == true);
}
}
| [
"[email protected]"
] | |
2bf407454ce936386d58d95f9ac714217fe8b656 | eb604a447e028af5351349ae4fc25aa475846be1 | /ABC100~150/ABC139/b.java | c5d62ed7ad23e1cfb36041e8164258632cbd519c | [] | no_license | RuRey0310/Competitive_Programming | 2fe494410aa49c4d44e85f99530664afeb0e1d96 | e230cc4034ef3b2fe984b583add7a9e3449aa7f5 | refs/heads/master | 2023-04-17T22:16:25.130530 | 2020-06-14T13:43:33 | 2020-06-14T13:43:33 | 246,257,430 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 653 | java | import java.io.PrintWriter;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner stdin = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int A = Integer.parseInt(stdin.next());
int B = Integer.parseInt(stdin.next());
if(B == 1) {
System.out.println(0);
}
else if(A == B) {
System.out.println(1);
}
else {
int sum=A;
for(int i=1;i<100;i++) {
if(i==1) {
if(A*i >= B) {
out.println(i);
break;
}
}
else {
sum+=A-1;
if(sum >= B) {
out.println(i);
break;
}
}
}
}
out.flush();
}
}
| [
"[email protected]"
] | |
9bbd954ec69e20ebf213d9bc23f2ffd3790e3719 | 1cf7a426846e12374ba7d37718bd917322d5065b | /ssm/src/main/java/cn/kgc/service/impl/AccountServiceImpl.java | 6644058bf1c5d3d816d3c70b3656f29bc87ecea7 | [] | no_license | qaq-12123/ssm | 6ef144a917954af4c631bf073db67e442ecbf843 | d41008f7d61a9046d13d30b131a3e3de39698ec3 | refs/heads/master | 2022-12-22T08:59:32.549392 | 2019-07-21T02:31:13 | 2019-07-21T02:31:13 | 196,665,093 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 600 | java | package cn.kgc.service.impl;
import cn.kgc.dao.AccountDao;
import cn.kgc.domain.Account;
import cn.kgc.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service("accountService")
public class AccountServiceImpl implements AccountService {
@Autowired
private AccountDao accountDao;
/**
* @param phone 根据手机号查询账户信息
* @return
*/
@Override
public Account findByPhone(String phone) {
return accountDao.findByPhone(phone);
}
}
| [
"[email protected]"
] | |
8599ce9ec472b109af5f618df7864ab9454d8676 | 3326674d1945e095df4f039e9b28b9dda34131cd | /src/main/java/org/example/App.java | dd8465c0e19ae89d0254b8fe394006f466a9c80e | [] | no_license | psottomayorpereir/sottomayorpereiradasilva-cop3330-ex17 | 6f421d13f12a5db9e1d628fb0ee966f3c008ed9e | 91f7643f9fcabf307787ad6c2a9b1779fa26260f | refs/heads/master | 2023-08-04T10:19:50.902791 | 2021-09-14T06:35:28 | 2021-09-14T06:35:28 | 406,189,356 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,467 | java | /*
* UCF COP3330 Fall 2021 Assignment 1 Solution
* Copyright 2021 Pedro Henrique Sotto-Mayor Pereira da Silva
*/
package org.example;
import java.util.Scanner;
public class App
{
public static void main( String[] args )
{
Scanner sc= new Scanner(System.in);
String sex="", ounces="", weight="", hours="";
boolean check=true;
int s=0, oz=0, wei=0, h=0;
double bac=0.0, ratio=0.0;
do{
System.out.print("Enter a 1 is you are male or a 2 if you are female: ");
sex=sc.nextLine();
try{
s = Integer.parseInt(sex);
check=true;
}catch (NumberFormatException ex) {
System.out.println("You have to enter a numeric value!");
check=false;
}
}while(check==false);
do{
System.out.print("How many ounces of alcohol did you have? ");
ounces=sc.nextLine();
try{
oz = Integer.parseInt(ounces);
check=true;
}catch (NumberFormatException ex) {
System.out.println("You have to enter a numeric value!");
check=false;
}
}while(check==false);
do{
System.out.print("What is your weight, in pounds? ");
weight=sc.nextLine();
try{
wei = Integer.parseInt(weight);
check=true;
}catch (NumberFormatException ex) {
System.out.println("You have to enter a numeric value!");
check=false;
}
}while(check==false);
do{
System.out.print("How many hours has it been since your last drink? ");
hours=sc.nextLine();
try{
h = Integer.parseInt(hours);
check=true;
}catch (NumberFormatException ex) {
System.out.println("You have to enter a numeric value!");
check=false;
}
}while(check==false);
if(s==1){
ratio=0.73;
}
else{
ratio=0.66;
}
bac=(oz*5.14/wei*ratio)-(0.015*h);
System.out.printf("Your BAC is %.6f", bac);
if(bac<0.08){
System.out.printf("\nIt is legal for you to drive.");
}
else{
System.out.printf("\nIt is not legal for you to drive.");
}
}
} | [
"[email protected]"
] | |
4b303098ee231a2d4910769b8b44f882a1d712c9 | fc7ac8a620ec8196346436690a2215fe1a09b807 | /design-patterns/src/main/java/_08simple_factory/section4/WhiteHuman.java | 057581ea48aed246d9ab2038d33699e7788678b1 | [] | no_license | nanphonfy/TTUP | a530aeecb7c7041de8688b79287c36d339b4dfdf | d11bd7fa3612f0751bd3481df483c065c58f41d6 | refs/heads/master | 2021-07-03T14:18:00.519388 | 2019-03-18T15:09:17 | 2019-03-18T15:09:17 | 108,563,952 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 476 | java | package _08simple_factory.section4;
/**
* @author cbf4Life [email protected]
* I'm glad to share my knowledge with you all.
* 白色人人种
*/
public class WhiteHuman implements Human {
//白色人种的颜色是白色的
@Override public void getColor(){
System.out.println("白色人种的皮肤颜色是白色的!");
}
//白色人种讲话
@Override public void talk() {
System.out.println("白色人种会说话,一般都是但是单字节。");
}
}
| [
"[email protected]"
] | |
7742ccc13723fb17c4491b8fc54296ca769094c9 | 53b0bd73f0b2ea6418b4798be63ed9e603531c0c | /geoLocate/src/com/example/geolocate/MainActivity.java | b76665567233342d938c5df09ae7acdf90ca748e | [] | no_license | concolato/MobileAndroid | 3328dbbf637e3610bf24da2e67216c6c76a807cd | 3ee58a2e14e4a107980474c97d80521c9023bbe2 | refs/heads/master | 2021-01-10T20:19:45.363064 | 2015-01-08T22:48:15 | 2015-01-08T22:48:15 | 27,456,481 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,952 | java | package com.example.geolocate;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
import android.app.Activity;
import android.location.Criteria;
import android.location.Location;
import android.location.LocationManager;
import android.os.Bundle;
import android.widget.Toast;
public class MainActivity extends Activity {
// Google Map
private GoogleMap googleMap;
private LocationManager locationmanager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
try {
// Loading map
googleMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
googleMap.setMyLocationEnabled(true); // false to disable
googleMap.getUiSettings().setZoomControlsEnabled(false); // true to enable
googleMap.getUiSettings().setMyLocationButtonEnabled(true);
googleMap.getUiSettings().setRotateGesturesEnabled(true);
googleMap.getUiSettings().setCompassEnabled(true);
googleMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
Criteria cri= new Criteria();
String bbb = locationmanager.getBestProvider(cri, true);
Location myLocation = locationmanager.getLastKnownLocation(bbb);
double latitude= myLocation.getLatitude();
double longitude = myLocation.getLongitude();
LatLng coords = new LatLng(latitude, longitude);
if(latitude == 0){
Toast.makeText(getApplicationContext(),
"Sorry! unable to get location", Toast.LENGTH_SHORT)
.show();
}
googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(coords, 20));
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* function to load map. If map is not created it will create it for you
* */
public void initilizeMap() {
// latitude and longitude
Criteria cri= new Criteria();
String bbb = locationmanager.getBestProvider(cri, true);
Location myLocation = locationmanager.getLastKnownLocation(bbb);
double latitude= myLocation.getLatitude();
double longitude = myLocation.getLongitude();
LatLng ll = new LatLng(latitude, longitude);
// create marker
MarkerOptions marker = new MarkerOptions().position(new LatLng(latitude, longitude)).title("Hello Maps");
// Changing marker icon and adding marker
//marker.icon(BitmapDescriptorFactory.fromResource(R.drawable.my_marker_icon)));
marker.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_ROSE));
googleMap.setMyLocationEnabled(true); // false to disable
googleMap.getUiSettings().setZoomControlsEnabled(false); // true to enable
googleMap.getUiSettings().setMyLocationButtonEnabled(true);
googleMap.getUiSettings().setRotateGesturesEnabled(true);
googleMap.getUiSettings().setCompassEnabled(true);
googleMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(ll, 20));
googleMap.addMarker(marker);
if (googleMap == null) {
googleMap = ((MapFragment) getFragmentManager()
.findFragmentById(R.id.map)).getMap();
// check if map is created successfully or not
if (googleMap == null) {
Toast.makeText(getApplicationContext(),
"Sorry! unable to create maps", Toast.LENGTH_SHORT)
.show();
}
}
}
/*@Override
protected void onResume() {
super.onResume();
this.initilizeMap();
}
*/
}
| [
"[email protected]"
] | |
9ae6cefcb213d3a6d0cfe36fc8b38933b5e6f906 | 5e08e601d3de73713a292a4d67c5c6b8d213cc13 | /javapractice/src/kbinaryTree/MirrorTree.java | b884a0858c93ff541e8f5febfe14961cb84ba504 | [] | no_license | Minal11/AlgosAndDataStructures | be910673d77b390f8511e091409efb72af948d0e | 8d8522a2ba00047517c5562a0340980c1062a23e | refs/heads/master | 2021-01-20T15:38:54.424942 | 2015-09-27T00:36:42 | 2015-09-27T00:36:42 | 33,506,493 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,276 | java | /**
*
*/
package kbinaryTree;
import inheritance.B;
import java.util.Stack;
/**
* @author Minal
*
*/
public class MirrorTree {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int[] array=new int[]{1,2,3,4,5};
CreateBinaryTree create=new CreateBinaryTree(array);
BinaryTreeNode root=create.createTree();
System.out.println();
System.out.println("Non-Recursive");
inorder(root);
System.out.println();
mirrorTree2(root);
inorder(root);
System.out.println();
}
public static void inorder(BinaryTreeNode node){
if(node==null)
return;
//you need Stack for non recursive
Stack stack=new Stack();
while(true){
while(node!=null){
stack.push(node);
node=node.getLeft();
}
if(stack.isEmpty())
break;
node=(BinaryTreeNode) stack.pop();
System.out.print(node.getData()+" ");
node=node.getRight();
}
}
public static void mirrorTree2( BinaryTreeNode n){
if(n==null)
return;
else{
mirrorTree2(n.getLeft());
mirrorTree2(n.getRight());
BinaryTreeNode temp=n.getLeft();
n.setLeft(n.getRight());
n.setRight(temp);
}
}
}
| [
"[email protected]"
] | |
485e9e723884cad6bc7a4dd4ad7cf4f5a8f634bb | f10238571df2bd8d5ccebb5760288902b46b5a2b | /src/com/mantosh/operators/arithmetic_operators/Lab71.java | a985fbb680e974ce08d61514442d092a003f1b54 | [] | no_license | mantoshpanda/JAVA | beabc6d6cefd08598b6e1d942ed5b35b513789d2 | 0d13596a7108803d324c8ecc4936deab3f9c3d72 | refs/heads/master | 2020-04-12T18:36:48.863493 | 2018-12-27T12:46:39 | 2018-12-27T12:46:39 | 162,684,671 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 288 | java | package com.mantosh.operators.arithematic_operators;
public class Lab71 {
public static void main(String... arg){
byte b1=12;
byte b2=23;
//byte a=b1+b2;
System.out.println(b1);
System.out.println(b2);
//System.out.println(a);
}
}
| [
"[email protected]"
] | |
97655161363ec04096984c9f9f60f7cb0be5e420 | a7bff68f0adfc377c97777534f780d9ed4ed62a4 | /code/2009-9-1/src/com/umt/runnable/TestJoin.java | 1cd7cb5d9196208e467d6302e8f462431674ef07 | [] | no_license | salingers/Jee | 0a683715c62fd1e7c2d16d29f1c311506a23ed3b | c6ba53bdc87c60740a7f3a284518b9dd2c3f8d9e | refs/heads/master | 2021-01-11T05:42:08.078111 | 2016-11-22T05:09:55 | 2016-11-22T05:09:55 | 71,548,561 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 501 | java | package com.umt.runnable;
public class TestJoin extends Thread{
public void run() {
for(int i = 0; i < 100; i++){
System.out.println(this.getName() + "_____" + i);
}
}
/**
* @param args
*/
public static void main(String[] args) {
TestJoin tj1 = new TestJoin();
tj1.setName("tj1");
tj1.start();
try {
tj1.join();
} catch (InterruptedException e1) {
e1.printStackTrace();
}
TestJoin tj2 = new TestJoin();
tj2.setName("tj2");
tj2.start();
}
}
| [
"[email protected]"
] | |
9890d8aa07c718a376ce2a34b169bdaeaab17e20 | 5f86fb9adb3c49624b39cd25ae3c3f1bcb09d536 | /app/src/main/java/sdk/facecamera/demo/fragment/FaceCompareFragment.java | 639e2c4076c4c99fe33d37de07e9ac1cb33fc4f1 | [] | no_license | qingtian521/FaceCameraSdk | 6c11cb7f30be40dc781922ec20f122aafbda8766 | 9948ac0c4d27a8691f96247fba2a7328a4efc47a | refs/heads/master | 2020-05-20T09:58:37.768295 | 2019-08-23T08:43:15 | 2019-08-23T08:43:15 | 185,515,283 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 544 | java | package sdk.facecamera.demo.fragment;
import android.graphics.Color;
import android.view.View;
import android.widget.TextView;
/**
* Created by 云中双月 on 2018/3/30.
*/
public class FaceCompareFragment extends BaseFragment{
@Override
public View initView() {
TextView textView = new TextView(getActivity());
textView.setText("人脸参数对比");
textView.setTextColor(Color.BLACK);
textView.setTextSize(30);
return textView;
}
@Override
public void initData() {
}
}
| [
"[email protected]"
] | |
dd30beacd815ee7f4b1a1675d81fdf8fbb69710e | 343c186455d9cc726ad48ea6aed58a9f13d6ab63 | /app/app/build/generated/source/buildConfig/debug/com/example/fbclick/BuildConfig.java | 47914f2f1c4ee465ced8354a4dea23f4ddb8d12d | [] | no_license | Mohit-Hasan/Facebook-open-by-clicking-button | 98e63f3ec6818a3c103c76946aca3426834517a7 | 221a314dc94f494de6d8ed7ceaf3ad2e9cea745c | refs/heads/main | 2023-04-30T11:21:48.678135 | 2021-05-04T03:01:47 | 2021-05-04T03:01:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 403 | java | /**
* Automatically generated file. DO NOT MODIFY
*/
package com.example.fbclick;
public final class BuildConfig {
public static final boolean DEBUG = Boolean.parseBoolean("true");
public static final String APPLICATION_ID = "com.example.fbclick";
public static final String BUILD_TYPE = "debug";
public static final int VERSION_CODE = 1;
public static final String VERSION_NAME = "1.0";
}
| [
"[email protected]"
] | |
21cce90d885d4107e8f11bfda27ed02807fa2dfc | 999299895a4ddf9e6328d85f34552689b7cbb22a | /app/src/main/java/br/edu/unidavi/kantask/model/Tarefa.java | 7bb0d9c1ead245a02feb37a36181733dea18c0fd | [] | no_license | fnandos1987/KanTask | 6590e1ce0c9a8f0cb5c5347fa90425a851adb142 | 51c4c81a0b105b75f2d777b96799d79082a67ed2 | refs/heads/master | 2020-03-10T03:24:14.452178 | 2018-04-28T20:11:14 | 2018-04-28T20:11:14 | 129,163,829 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,998 | java | package br.edu.unidavi.kantask.model;
import android.support.annotation.NonNull;
import java.util.Date;
public class Tarefa implements Comparable<Tarefa> {
private Integer id;
private String descricao;
private String prazo;
private String dataInicio;
private String dataConlusao;
private Integer prioridade;
private Integer status;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getDescricao() {
return "Tarefa: " + descricao;
}
public void setDescricao(String descricao) {
this.descricao = descricao;
}
public String getPrazo() {
return "Prazo Conclusão: " + prazo;
}
public void setPrazo(String prazo) {
this.prazo = prazo;
}
public String getDataInicio() {
return "Data Início: " + dataInicio;
}
public void setDataInicio(String dataInicio) {
this.dataInicio = dataInicio;
}
public String getDataConlusao() {
return "Data Conclusão: " + dataConlusao;
}
public void setDataConlusao(String dataConlusao) {
this.dataConlusao = dataConlusao;
}
public Integer getPrioridade() {
return prioridade;
}
public void setPrioridade(Integer prioridade) {
this.prioridade = prioridade;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getDescricaoPrioridade(){
return "Prioridade: " + Prioridade.getById(this.prioridade).getDescricao();
}
public String getDescricaoStatus(){
return Status.getById(this.status).getDescricao();
}
@Override
public int compareTo(@NonNull Tarefa o) {
if (this.prioridade < o.prioridade) {
return -1;
}
if (this.prioridade > o.prioridade) {
return 1;
}
return 0;
}
}
| [
"[email protected]"
] | |
7e650b27c9816bb653c36b0a864448da17f09489 | 57e9721a045a1a5e127bb1ed061095170b706f23 | /Dec23L8T2.java | 865a080b8a196bf18ecfaae4edccb5dd52b85a82 | [] | no_license | ashraf-kabir/Java-Basic-Practices | 5fd19b875995761bd528e0c135fb0e08e91d09d8 | 74bdabfc9aeb23639706063c27c2c1913f958a1d | refs/heads/master | 2020-04-23T07:01:48.805424 | 2019-11-03T17:09:41 | 2019-11-03T17:09:41 | 170,994,289 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 400 | java | import java.util.Scanner;
public class Dec23L8T2 {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int num[] = new int[10];
for (int a = 0; a < num.length; a++) {
System.out.println("Enter number: ");
num[a] = sc.nextInt();
}
System.out.println("Enter the index: ");
int b = sc.nextInt();
System.out.println(num[b]);
}
}
| [
"[email protected]"
] | |
e6435b5d9a4c05466f6d54cfb5fa7424e5537192 | aaef72117a2208f9d06ee7b17964c6d189e4b597 | /src/com/fym/app/utils/LogUtil.java | adba286ca0a1cfad5621dcd312c696507a226a0d | [] | no_license | 2245957331/fym | 0f104418e42344c622515e1ecaa035f6d4b33e92 | c614fc44db855fc7dd031bcb979fd720e00a7c52 | refs/heads/master | 2021-01-20T02:07:57.792276 | 2013-05-31T02:15:02 | 2013-05-31T02:15:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,173 | java | package com.fym.app.utils;
public class LogUtil {
public static boolean isDebug = false;
public static void v(String tag, String msg) {
if (isDebug)
android.util.Log.v(tag, msg);
}
public static void v(String tag, String msg, Throwable t) {
if (isDebug)
android.util.Log.v(tag, msg, t);
}
public static void d(String tag, String msg) {
if (isDebug)
android.util.Log.d(tag, msg);
}
public static void d(String tag, String msg, Throwable t) {
if (isDebug)
android.util.Log.d(tag, msg, t);
}
public static void i(String tag, String msg) {
if (isDebug)
android.util.Log.i(tag, msg);
}
public static void i(String tag, String msg, Throwable t) {
if (isDebug)
android.util.Log.i(tag, msg, t);
}
public static void w(String tag, String msg) {
if (isDebug)
android.util.Log.w(tag, msg);
}
public static void w(String tag, String msg, Throwable t) {
if (isDebug)
android.util.Log.w(tag, msg, t);
}
public static void e(String tag, String msg) {
if (isDebug)
android.util.Log.e(tag, msg);
}
public static void e(String tag, String msg, Throwable t) {
if (isDebug)
android.util.Log.e(tag, msg, t);
}
}
| [
"[email protected]"
] | |
6ab828265eb719017863e952fae4a2830db26410 | 8a6abfee7d223875badafb924dc61be72598508f | /src/main/java/Commands.java | bd18758411d4d55c41b2510a60dccefcd6cc3ba4 | [] | no_license | CoocooFroggy/King-of-the-Hill-Bot | 71cce1dbdd8bbd42528b198eb066175f68054574 | 7001299a5f25659d470a0fb6539ed3519591f501 | refs/heads/master | 2023-07-06T23:08:45.497539 | 2021-08-14T04:07:25 | 2021-08-14T04:07:25 | 336,071,959 | 0 | 1 | null | 2021-08-14T18:53:59 | 2021-02-04T20:17:40 | Java | UTF-8 | Java | false | false | 16,907 | java | import net.dv8tion.jda.api.Permission;
import net.dv8tion.jda.api.entities.*;
import net.dv8tion.jda.api.exceptions.ErrorResponseException;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
import net.dv8tion.jda.api.requests.ErrorResponse;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.time.Duration;
import java.time.Instant;
import java.util.List;
import java.util.Timer;
import java.util.concurrent.TimeUnit;
public class Commands {
public static String pushCommand(User user, Member member, Guild guild, TextChannel channel, OptionMapping userToPush) throws SQLException {
//Vars
Statement statement = Main.statement;
String userId = user.getId();
String guildId = guild.getId();
String channelId = channel.getId();
String nickname;
Instant currentTimestamp = Instant.now();
long currentTimestampEpoch = Instant.now().toEpochMilli();
//Fetch all bans
ResultSet bansResultSet = statement.executeQuery("SELECT expiretimestamp FROM kingbans " +
"WHERE guildid = '" + guildId + "' AND channelid = '" + channelId + "' AND userid = '" + userId + "'");
//If a ban exists for the user ID
while (bansResultSet.next()) {
long banExpireTimestamp = Long.parseLong(bansResultSet.getString("expiretimestamp"));
//if the current date is before the timestamp
if (currentTimestampEpoch < banExpireTimestamp) {
long banDuration = banExpireTimestamp - currentTimestampEpoch;
String banDurationFormatted = String.format("%d hours and %d minutes",
TimeUnit.SECONDS.toHours(banDuration),
TimeUnit.SECONDS.toMinutes(banDuration) -
TimeUnit.HOURS.toMinutes(TimeUnit.SECONDS.toHours(banDuration))
);
return ("You are banned for **" + banDurationFormatted + "** :(");
}
}
//Get personal name for user
if (member.getNickname() == null)
nickname = user.getName();
else
nickname = member.getNickname();
//Get user ID of king
ResultSet resultSet = statement.executeQuery(
"SELECT userid, timestamp FROM king " +
"WHERE key = 'king' AND guildid = '" + guildId + "' AND channelid = '" + channelId + "'");
//If there's no hill in this channel + guild
if (!resultSet.next())
return "EPHEMERAL:There's no Hill in the current channel. Use `/create` to create one!";
//King vars part 1
int kingidIndex = resultSet.findColumn("userid");
int kingTimestampIndex = resultSet.findColumn("timestamp");
String kingId = resultSet.getString(kingidIndex);
String kingTimestamp = resultSet.getString(kingTimestampIndex);
//If there already is row for this guild and channel, just no king
if (kingId == null) {
statement.execute("UPDATE king " +
"SET userid = '" + userId + "', timestamp = '" + currentTimestampEpoch + "' " +
"WHERE key = 'king' AND guildid = '" + guildId + "' AND channelid = '" + channelId + "'");
//Create roles if they don't exist
createRoles(guild);
//Distribute roles
distributeRoles(null, member, guild, channel);
return ("**" + nickname + "** is now king of the hill!");
}
// If nobody is mentioned
if (userToPush == null) {
//If you're the king
if (userId.equals(kingId)) {
return ("You're the king already!");
} else {
return ("Please mention a player to push!");
}
}
//King vars P2
String pushedUserId = userToPush.getAsUser().getId();
User kingUser = Main.jda.retrieveUserById(kingId).complete();
// Member of the person pushed off
Member kingMember = null;
// What to call the person who was pushed off
String kingName;
// Temp variable for their literal server nickname
String kingNick = null;
try {
kingMember = guild.retrieveMember(kingUser).complete();
kingNick = kingMember.getNickname();
}
// We just catch because it's ok if kingMember is null. No action necessary
catch (ErrorResponseException ignored) {
}
// If you mention yourself
if (pushedUserId.equals(userId)) {
return ("You can't push yourself off, silly!");
}
// Get personal name for king
if (kingNick == null)
kingName = kingUser.getName();
else
kingName = kingNick;
// Otherwise, check if they pushed the king off
if (pushedUserId.equals(kingId)) {
//Create roles if they don't exist
createRoles(guild);
//Distribute roles
distributeRoles(kingMember, member, guild, channel);
//Update king's stats (person who just got pushed off, not the pusher)
updateKingStats(guildId, channelId, kingId, kingTimestamp, currentTimestamp);
// Get totalkings
ResultSet totalKingsResultSet = statement.executeQuery("SELECT totalkings FROM kingstats " +
"WHERE guildid = '" + guildId + "' AND channelid = '" + channelId + "' AND userid = '" + userId + "'");
int totalkings = 0;
// If they already have a value
if (totalKingsResultSet.next()) {
totalkings = totalKingsResultSet.getInt("totalkings");
}
// Increment totalkings
totalkings++;
// Put it back
statement.executeUpdate("UPDATE kingstats " +
"SET totalkings = " + totalkings + " " +
"WHERE guildid = '" + guildId + "' AND channelid = '" + channelId + "' AND userid = '" + userId + "'");
//Push off the king
statement.executeUpdate("UPDATE king " +
"SET userid = '" + kingId + "' " +
"WHERE key = 'pushed' AND guildid = '" + guildId + "' AND channelid = '" + channelId + "'");
//Make the pusher the new king
statement.executeUpdate("UPDATE king " +
"SET userid = '" + userId + "', timestamp = '" + currentTimestampEpoch + "'" +
"WHERE key = 'king' AND guildid = '" + guildId + "' AND channelid = '" + channelId + "'");
return ("**" + nickname + "** pushed **" + kingName + "** off the hill!");
}
//Else if they didn't push the king off the hill
else {
return ("Please push **" + kingName + "** off the hill!");
}
}
public static String createCommand(Guild guild, Member member, TextChannel channel) throws SQLException {
//Vars
Statement statement = Main.statement;
String guildId = guild.getId();
String channelId = channel.getId();
//If they don't have manage server perms, ignore them
if (!member.hasPermission(Permission.MANAGE_CHANNEL))
return "EPHEMERAL:You need Manage Channel permissions to create a Hill.";
//See if hill exists here
ResultSet resultSet = statement.executeQuery(
"SELECT * FROM king " +
"WHERE key = 'king' AND guildid = '" + guildId + "' AND channelid = '" + channelId + "'");
//Check if hill already exists here
if (resultSet.next()) {
return ("EPHEMERAL:Cannot create a hill here, hill already exists!");
}
createRoles(guild);
//Otherwise create a hill here
statement.execute("INSERT INTO king (key, guildid, channelid) VALUES " +
"('king', '" + guildId + "', '" + channelId + "')");
statement.execute("INSERT INTO king (key, guildid, channelid) VALUES " +
"('pushed', '" + guildId + "', '" + channelId + "')");
return ("Hill created! Do `/push` to start!");
}
public static String removeCommand(Guild guild, Member member, TextChannel channel) throws SQLException {
//DELETE FROM king WHERE channelid = '685618172975513625';
//Vars
Statement statement = Main.statement;
String guildId = guild.getId();
String channelId = channel.getId();
//If they don't have manage server perms, ignore them
if (!member.hasPermission(Permission.MANAGE_CHANNEL))
return "EPHEMERAL:You need Manage Channel permissions to remove a Hill.";
statement.execute("DELETE FROM king WHERE guildid = '" + guildId + "' AND channelid = '" + channelId + "'");
return ("Removed hill from this channel.");
}
public static String statsCommand(Guild guild, Member member, TextChannel channel, OptionMapping user) throws SQLException {
//Vars
Statement statement = Main.statement;
String userId = member.getId();
String guildId = guild.getId();
String channelId = channel.getId();
int totalSeconds = 0;
int totalkings = 0;
int totalpushed = 0;
String nickname;
//if they mentioned a user
if (user != null) {
//Then set the user ID to that mentioned user
userId = user.getAsUser().getId();
member = guild.retrieveMemberById(userId).complete();
}
//Otherwise it'll be the user ID of the user who triggered the command
//Get personal name for user
if (member.getNickname() == null)
nickname = member.getUser().getName();
else
nickname = member.getNickname();
//Get stats
ResultSet kingstatsResultSet = statement.executeQuery("SELECT totalseconds, totalkings, totalpushed FROM kingstats " +
"WHERE guildid = '" + guildId + "' AND channelid = '" + channelId + "' AND userid = '" + userId + "'");
//Get stored seconds
if (kingstatsResultSet.next()) {
String totalsecondsString = kingstatsResultSet.getString("totalseconds");
totalkings = kingstatsResultSet.getInt("totalkings");
totalpushed = kingstatsResultSet.getInt("totalpushed");
totalSeconds = Integer.parseInt(totalsecondsString);
}
//Get king of the channel + timestamp
ResultSet kingResultSet = statement.executeQuery("SELECT userid, timestamp FROM king " +
"WHERE key = 'king' AND guildid = '" + guildId + "' AND channelid = '" + channelId + "'");
//If there's no hill in this channel
if (!kingResultSet.next())
return "EPHEMERAL:There's no hill in this channel!";
//Add current session's seconds if you're king
int kingIdIndex = kingResultSet.findColumn("userid");
String kingId = kingResultSet.getString(kingIdIndex);
if (userId.equals(kingId)) {
Instant currentInstant = Instant.now();
String kingStartEpoch = kingResultSet.getString("timestamp");
Instant kingStartInstant = Instant.ofEpochMilli(Long.parseLong(kingStartEpoch));
Duration between = Duration.between(kingStartInstant, currentInstant);
totalSeconds += between.getSeconds();
}
//If your time is 0
if (totalSeconds == 0) {
return ("**" + nickname + "** hasn't been king yet.");
}
String formattedTime = String.format("%d hours, %d minutes, %d seconds",
TimeUnit.SECONDS.toHours(totalSeconds),
TimeUnit.SECONDS.toMinutes(totalSeconds) -
TimeUnit.HOURS.toMinutes(TimeUnit.SECONDS.toHours(totalSeconds)),
totalSeconds -
TimeUnit.MINUTES.toSeconds(TimeUnit.SECONDS.toMinutes(totalSeconds))
);
return ("**" + nickname + "** has been king for **" + formattedTime + "**.\n" +
"They've also been king " + totalkings + " times and has been pushed off " + totalpushed + " times.");
}
public static String kingBanCommand(Guild guild, Member member, TextChannel channel, OptionMapping userToBan) {
//Vars
Statement statement = Main.statement;
String guildId = guild.getId();
String channelId = channel.getId();
//If they don't have manage server perms, ignore them
if (!member.hasPermission(Permission.MANAGE_CHANNEL))
return "EPHEMERAL:You need Manage Channel permissions to ban a player from this Hill.";
return "EPHEMERAL:Not implemented yet!";
}
/* UTILITIES */
//Distribute roles
static Timer distributeTimer;
public static void distributeRoles(Member kingMember, Member member, Guild guild, TextChannel channel) throws SQLException {
//If we don't have perms to distribute roles, do nothing
if (!guild.getSelfMember().hasPermission(Permission.MANAGE_ROLES))
return;
//Vars
Statement statement = Main.statement;
String pushedId = null;
String guildId = guild.getId();
String channelId = channel.getId();
//Cancel existing timers
if (distributeTimer != null) {
distributeTimer.cancel();
distributeTimer.purge();
}
//Get user ID of pushed off
ResultSet resultSet;
resultSet = statement.executeQuery(
"SELECT userid FROM king " +
"WHERE key = 'pushed' AND guildid = '" + guildId + "' AND channelid = '" + channelId + "'");
if (resultSet.next()) {
pushedId = resultSet.getString("userid");
}
distributeTimer = new Timer();
distributeTimer.schedule(new DistributeRolesTimer(member, kingMember, pushedId, guild, channel), 5000);
}
public static void createRoles(Guild guild) {
//If we don't have manage role perms, just don't do anything
if (!guild.getSelfMember().hasPermission(Permission.MANAGE_ROLES))
return;
//Check if roles already exist
List<Role> kothRoles = guild.getRolesByName("King of the Hill!", false);
List<Role> pushedRoles = guild.getRolesByName("Pushed off the Hill", false);
//Make it if it doesn't
if (kothRoles.isEmpty()) {
guild.createRole()
.setName("King of the Hill!")
.setPermissions()
.queue();
}
if (pushedRoles.isEmpty()) {
guild.createRole()
.setName("Pushed off the Hill")
.setPermissions()
.queue();
}
}
public static void updateKingStats(String guildId, String channelId, String kingId, String kingTimestamp, Instant currentTimestamp) throws SQLException {
//Vars
Statement statement = Main.statement;
Instant kingStartDate = Instant.ofEpochMilli(Long.parseLong(kingTimestamp));
//Get king's totalseconds and totalpushed
ResultSet statsResultSet = statement.executeQuery("SELECT totalseconds, totalpushed FROM kingstats " +
"WHERE guildid = '" + guildId + "' AND channelid = '" + channelId + "' AND userid = '" + kingId + "'");
//Stats vars
long totalseconds = 0;
long totalpushed = 0;
//If they already have stats, add time
if (statsResultSet.next()) {
//Time
String totalsecondsString = statsResultSet.getString("totalseconds");
totalseconds = Long.parseLong(totalsecondsString);
//Kings
totalpushed = statsResultSet.getInt("totalpushed");
}
//Calculate how long they've been king
Duration between = Duration.between(kingStartDate, currentTimestamp);
long kingSessionSeconds = between.getSeconds();
//Add to totalseconds
totalseconds += kingSessionSeconds;
//Add to totalpushed
totalpushed++;
//Update table with new stats
statement.execute("UPDATE kingstats SET totalseconds = '" + totalseconds + "', totalpushed = '" + totalpushed + "' WHERE guildid = '" + guildId + "' AND channelid = '" + channelId + "' AND userid = '" + kingId + "'; " +
"INSERT INTO kingstats (guildid, channelid, userid, totalseconds, totalpushed) " +
"SELECT '" + guildId + "', '" + channelId + "', '" + kingId + "', '" + totalseconds + "', '" + totalpushed + "' " +
"WHERE NOT EXISTS (SELECT 1 FROM kingstats WHERE guildid = '" + guildId + "' AND channelid = '" + channelId + "' AND userid = '" + kingId + "');"
);
}
}
| [
"[email protected]"
] | |
3f75e3f3620cc7db39801e7bc5d6de5e42b7cf4f | 1f5712487a482ef6c8c8982f3774ac8ab261f46e | /Renown_aws/src/test/java/renown/app/LambdaTest.java | 15e8225308886b876d0780c284bab217a25bb396 | [] | no_license | semorrissey/Renown | b07d38e11381d50e94e4007277e82941294884ac | 708164ea2af96750ac551f938638b3a82bd9044c | refs/heads/master | 2021-07-26T01:06:55.308590 | 2019-12-13T22:29:33 | 2019-12-13T22:29:33 | 223,048,776 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 521 | java | package renown.app;
import com.amazonaws.services.lambda.runtime.Context;
public class LambdaTest {
/**
* Helper method that creates a context that supports logging so you can test lambda functions
* in JUnit without worrying about the logger anymore.
*
* @param apiCall An arbitrary string to identify which API is being called.
* @return
*/
Context createContext(String apiCall) {
TestContext ctx = new TestContext();
ctx.setFunctionName(apiCall);
return ctx;
}
}
| [
"[email protected]"
] | |
3250864dc4b45a054631299a4656d31f8af45fc9 | 191a88918b1427cd9a6a298d01338ba015290536 | /karate-core/src/main/java/com/intuit/karate/http/HttpBody.java | 719df74ab9e014a42fdea05920ce775f26b94a28 | [
"MIT"
] | permissive | venkatramanareddy/karate | 8f47947cbca4a93e54a7a81407986aaa42f4d7aa | b02ba80ea6c3186cc938421a68ad0e17f25731cf | refs/heads/master | 2021-01-20T23:11:29.007515 | 2017-08-31T17:28:52 | 2017-08-31T17:28:52 | 101,843,148 | 0 | 0 | null | 2017-08-30T05:55:37 | 2017-08-30T05:55:37 | null | UTF-8 | Java | false | false | 4,298 | java | /*
* The MIT License
*
* Copyright 2017 Intuit Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.intuit.karate.http;
import java.io.InputStream;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.io.IOUtils;
/**
*
* @author pthomas3
*/
public class HttpBody {
private final byte[] bytes;
private final InputStream stream;
private final MultiValuedMap fields;
private final List<MultiPartItem> parts;
private final String contentType;
public boolean isStream() {
return stream != null;
}
public boolean isUrlEncoded() {
return fields != null;
}
public boolean isMultiPart() {
return parts != null;
}
public byte[] getBytes() {
if (isStream()) {
try {
return IOUtils.toByteArray(stream);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
return bytes;
}
public InputStream getStream() {
return stream;
}
public String getContentType() {
return contentType;
}
public List<MultiPartItem> getParts() {
return parts;
}
public Map<String, String[]> getParameters() {
if (fields == null) {
return Collections.EMPTY_MAP;
}
Map<String, String[]> map = new LinkedHashMap<>(fields.size());
for (Map.Entry<String, List> entry : fields.entrySet()) {
List list = entry.getValue();
String[] values = new String[list.size()];
for (int i = 0; i < values.length; i++) {
values[i] = list.get(i) + "";
}
map.put(entry.getKey(), values);
}
return map;
}
private HttpBody(byte[] bytes, InputStream stream, String contentType) {
this.bytes = bytes;
this.stream = stream;
this.contentType = contentType;
this.fields = null;
this.parts = null;
}
private HttpBody(MultiValuedMap fields, String contentType) {
this.bytes = null;
this.stream = null;
this.contentType = contentType;
this.fields = fields;
this.parts = null;
}
private HttpBody(List<MultiPartItem> parts, String contentType) {
this.bytes = null;
this.stream = null;
this.contentType = contentType;
this.fields = null;
this.parts = parts;
}
public static HttpBody string(String value, String contentType) {
return new HttpBody(value.getBytes(), null, contentType);
}
public static HttpBody stream(InputStream stream, String contentType) {
return new HttpBody(null, stream, contentType);
}
public static HttpBody bytes(byte[] bytes, String contentType) {
return new HttpBody(bytes, null, contentType);
}
public static HttpBody formFields(MultiValuedMap fields, String contentType) {
return new HttpBody(fields, contentType);
}
public static HttpBody multiPart(List<MultiPartItem> parts, String contentType) {
return new HttpBody(parts, contentType);
}
}
| [
"[email protected]"
] | |
819245d11ed7ecb392d66418742afb3ee6462152 | 7f9c0b7878c942ad0d5f52c170dbe1f29215709c | /phonebook-web/src/main/java/com/jeromesimmonds/phonebook/web/form/AccountPersonalInfoForm.java | 2f6c7daa7dd97cda0b7fcf68d34a74a5d3e457bb | [] | no_license | JeromeSimmonds/phonebook | 518a9cbb3ba21a1ee166486a23305daf2325f190 | 190f8558ec9e9410b1653278f76b60d2d116a3e7 | refs/heads/master | 2021-01-02T09:33:03.007547 | 2016-01-12T04:03:21 | 2016-01-12T04:03:21 | 24,154,980 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 876 | java | package com.jeromesimmonds.phonebook.web.form;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import org.hibernate.validator.constraints.NotBlank;
import com.jeromesimmonds.phonebook.web.validator.UsernameAvailable;
/**
* @author Jerome Simmonds
*
*/
public class AccountPersonalInfoForm {
@NotBlank(message="{com.jeromesimmonds.phonebook.constraints.username.required}")
@Size(min=2, max=40, message="{com.jeromesimmonds.phonebook.constraints.username.invalid}")
@Pattern(regexp="^[a-zA-Z0-9_-]+$", message="{com.jeromesimmonds.phonebook.constraints.username.invalid}")
@UsernameAvailable(message="{com.jeromesimmonds.phonebook.constraints.username.notavailable}")
private String username;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
}
| [
"[email protected]"
] | |
42dcf87a18ffa6ecbe6dc800325ddb6630a67006 | 07ba22802386b8fe92d7319f46dba1db4bfa7235 | /oblib/src/main/java/com/oldbaby/oblib/image/viewer/ImageDataAdapter.java | 164c1c9f45dae7671ed0f25bebcf15a4c9a73f0a | [
"Apache-2.0"
] | permissive | kHRYSTAL/Old-Baby | 0b8610cac38c0e4d515b551553c5e5510d3736ab | c8d90bee468c0f0cde4eb2f32ab9e381f99e2445 | refs/heads/master | 2020-04-07T15:37:23.900913 | 2018-11-21T05:46:54 | 2018-11-21T05:46:54 | 158,493,517 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 685 | java | package com.oldbaby.oblib.image.viewer;
import java.io.Serializable;
public interface ImageDataAdapter extends Serializable {
/**
* 有多少条浏览
*
* @return
*/
public int count();
/**
* 获取制定位置的URL
*
* @param postion
* @return
*/
public String getUrl(int postion);
/**
* 获取制定位置的图片id
*/
public int getDrawableId(int position);
/**
* 删除某张照片
*
* @param position
*/
void remove(int position);
/**
* 获取某张照片的描述
*
* @param position
* @return
*/
String getDesc(int position);
} | [
"[email protected]"
] | |
51a779c0ce3e45cf82b21a55121da7061d8747fc | dba72dcd74e2e04b256dde1c3326ffdb3881bc9b | /week-03/day-2/src/PrintEachLine.java | d06ba2b6bc4b2a447a782d1c580d7e4de68575aa | [] | no_license | green-fox-academy/rdgrv | dc0c6681359706c78acd5776799af54e316c1de5 | 22a24b7f8c0fcd91859600d7d1d75ec32d288cd2 | refs/heads/master | 2021-07-11T05:07:00.242402 | 2019-01-24T09:30:20 | 2019-01-24T09:30:20 | 143,150,938 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 463 | java | import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.Files;
import java.util.List;
public class PrintEachLine {
public static void main(String[] args) {
try {
Path path = Paths.get("my-file.txt");
List<String> lines = Files.readAllLines(path);
for (String line : lines) {
System.out.println(line);
}
} catch (Exception e) {
System.out.println("Unable to read file: my-file.txt");
}
}
} | [
"[email protected]"
] | |
0f6cadbd6b4c1bf70644d62f44e47feefa69209b | bd81360948c417a1f80677a3911625e4e26e0241 | /Scuola/Tpsit/Risponditore/src/risponditore/Edge.java | 1131dca1f5076beaa69cd8786eb42a0cd59aeebb | [] | no_license | MicheleLadisa/cose | dde509279d94d1003347ea06feb6532ac817c958 | 2a3a97a4a51a077fc98d54caed1b4a973d62e537 | refs/heads/master | 2018-07-23T02:27:43.392976 | 2018-06-02T10:50:26 | 2018-06-02T10:50:26 | 119,897,815 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 601 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package risponditore;
/**
*
* @author ladis
*/
public class Edge
{
private String command;
private Node endNode;
public Edge(String command, Node endNode)
{
this.command=command;
this.endNode=endNode;
}
public String getCommand()
{
return command;
}
public Node getEndNode()
{
return endNode;
}
}
| [
"[email protected]"
] | |
d60d8e19bccb3f9feccbb9a574c304a41e7d55b7 | f13ded84ed52291ae06f61e38b6aa918e45d4a5d | /app/src/main/java/com/yinaf/dragon/Content/Utils/DoorLock/util/EspNetUtil.java | 0c46de080c699523192793eef9623bd2b34ca162 | [] | no_license | 18649738669/YNFandroid | 5cf03c90d295ce6b967b228ad8002a998f389ad0 | 683d88f7d80e2991d57f277e9eeeb3e644b840fe | refs/heads/master | 2020-03-20T09:19:05.480519 | 2018-06-14T09:25:44 | 2018-06-14T09:25:44 | 137,333,638 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,303 | java | package com.yinaf.dragon.Content.Utils.DoorLock.util;
import android.content.Context;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import java.net.InetAddress;
import java.net.UnknownHostException;
public class EspNetUtil {
/**
* get the local ip address by Android System
*
* @param context
* the context
* @return the local ip addr allocated by Ap
*/
public static InetAddress getLocalInetAddress(Context context) {
WifiManager wm = (WifiManager) context
.getSystemService(Context.WIFI_SERVICE);
WifiInfo wifiInfo = wm.getConnectionInfo();
int localAddrInt = wifiInfo.getIpAddress();
String localAddrStr = __formatString(localAddrInt);
InetAddress localInetAddr = null;
try {
localInetAddr = InetAddress.getByName(localAddrStr);
} catch (UnknownHostException e) {
e.printStackTrace();
}
return localInetAddr;
}
private static String __formatString(int value) {
String strValue = "";
byte[] ary = __intToByteArray(value);
for (int i = ary.length - 1; i >= 0; i--) {
strValue += (ary[i] & 0xFF);
if (i > 0) {
strValue += ".";
}
}
return strValue;
}
private static byte[] __intToByteArray(int value) {
byte[] b = new byte[4];
for (int i = 0; i < 4; i++) {
int offset = (b.length - 1 - i) * 8;
b[i] = (byte) ((value >>> offset) & 0xFF);
}
return b;
}
/**
* parse InetAddress
*
* @param inetAddrBytes
* @return
*/
public static InetAddress parseInetAddr(byte[] inetAddrBytes, int offset,
int count) {
InetAddress inetAddress = null;
StringBuilder sb = new StringBuilder();
for (int i = 0; i < count; i++) {
sb.append(Integer.toString(inetAddrBytes[offset + i] & 0xff));
if (i != count-1) {
sb.append('.');
}
}
try {
inetAddress = InetAddress.getByName(sb.toString());
} catch (UnknownHostException e) {
e.printStackTrace();
}
return inetAddress;
}
/**
* parse bssid
*
* @param bssid the bssid
* @return byte converted from bssid
*/
public static byte[] parseBssid2bytes(String bssid) {
String bssidSplits[] = bssid.split(":");
byte[] result = new byte[bssidSplits.length];
for(int i = 0;i < bssidSplits.length; i++) {
result[i] = (byte) Integer.parseInt(bssidSplits[i], 16);
}
return result;
}
}
| [
"[email protected]"
] | |
008b03aa99bf6c0358e7232e9be30792d8b42a4e | 8618dab2eedae58082920758f67f7e7a3f4f7464 | /jenkinsxml2jobdsl-master/src/main/java/xyz/hellmouth/jenkinsxml2jobdsl/xml/model/publishers/parameterizedbuildtrigger/ParameterizedBuildTriggerConfigs.java | 3feeaac42214ab2ac1152f5960976abf508fc3b6 | [] | no_license | circlesgit/resources | b58338525a1c92d8db5104c2d2f1147c19bea3fa | eb7c170a44cb8fd8d5bde450cf931edbcfd4a52f | refs/heads/master | 2023-03-04T20:43:51.797764 | 2020-01-02T02:45:27 | 2020-01-02T02:45:27 | 231,294,863 | 1 | 2 | null | 2023-03-03T18:03:23 | 2020-01-02T02:42:28 | Go | UTF-8 | Java | false | false | 752 | java | package xyz.hellmouth.jenkinsxml2jobdsl.xml.model.publishers.parameterizedbuildtrigger;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElements;
import xyz.hellmouth.jenkinsxml2jobdsl.jobdsl.Buildable;
import xyz.hellmouth.jenkinsxml2jobdsl.jobdsl.Builder;
import xyz.hellmouth.jenkinsxml2jobdsl.xml.model.publishers.Publisher;
public class ParameterizedBuildTriggerConfigs implements Buildable{
@XmlElements({
@XmlElement(name="hudson.plugins.parameterizedtrigger.BuildTriggerConfig", type=ParameterizedBuildTriggerConfig.class)
})
public List<Buildable> elements;
@Override
public void build(Builder builder) {
for (Buildable o : elements){
o.build(builder);
}
}
}
| [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.