blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 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 684M ⌀ | 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 132
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 28
values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
bff344ceb2feb6a0aadda2e5c242ee369ea1297e | 64abfc0130cfa0aeb85c2c0a7d2f95037a80271f | /ECO_EmployeeManagement-portlet/docroot/WEB-INF/src/vn/com/ecopharma/emp/bean/LocaleKeyBean.java | 0b619a129176771ff320070883b268bb297426cd | [] | no_license | taotran/eco | 8c962eb918ad4675b535d775f7b8af99cfaab31b | 22620bc21ceb8da83e06c402cfa7bd5a0ea05cee | refs/heads/master | 2021-01-10T02:48:29.194619 | 2016-04-14T11:00:58 | 2016-04-14T11:00:58 | 44,424,693 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,288 | java | package vn.com.ecopharma.emp.bean;
import java.io.Serializable;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import org.apache.commons.lang3.StringUtils;
import vn.com.ecopharma.emp.enumeration.DisciplineType;
import vn.com.ecopharma.emp.enumeration.ResignationType;
import vn.com.ecopharma.emp.enumeration.VacationLeaveType;
/**
* @author TaoTran
*
*/
@ManagedBean
@RequestScoped
public class LocaleKeyBean implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
public String getDisciplineTypeKey(String type) {
if (StringUtils.EMPTY.equals(type))
return StringUtils.EMPTY;
DisciplineType disciplineType = DisciplineType.valueOf(type);
return disciplineType.getLocalizedString();
}
public String getLeaveTypeKey(String type) {
if (StringUtils.EMPTY.equals(type))
return StringUtils.EMPTY;
type = type.replaceAll(" ", "_");
VacationLeaveType typeEnum = VacationLeaveType.valueOf(type);
return typeEnum.getLocalizedString();
}
public String getResignedTypeKey(String type) {
if (StringUtils.EMPTY.equals(type))
return StringUtils.EMPTY;
type = type.replaceAll(" ", "_");
ResignationType typeEnum = ResignationType.valueOf(type);
return typeEnum.getLocalizedString();
}
}
| [
"tao.tranv@gmail.com"
] | tao.tranv@gmail.com |
404302dd26701a7de4b4fe8539dcd513fde1b33a | 9644bc22b219c5ec0ede619baf344327f97bd235 | /src/main/java/com/yega/mlc/security/JwtAuthorizationFilter.java | d51c931311e7f93d99bbfb2184c996dff13d2cb8 | [] | no_license | JoseTrejoM/blackmlctrejo | 0472023a02180c4f0b4b0f46e6b909f8d6c93818 | 128ff31e2cb6008199ffb793abec0f521c47bf3d | refs/heads/master | 2023-09-05T01:31:00.028894 | 2021-11-18T19:39:33 | 2021-11-18T19:39:33 | 429,557,949 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,901 | java | package com.yega.mlc.security;
import java.io.IOException;
import java.util.Arrays;
import java.util.Calendar;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yega.mlc.constants.JwtConstants;
import com.yega.mlc.dto.ErrorCodeDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import org.springframework.web.filter.OncePerRequestFilter;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@Component
public class JwtAuthorizationFilter extends OncePerRequestFilter {
@Autowired
private ApiUserDetailService apiUserDetailService;
@Autowired
private JwtService jwtService;
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
throws ServletException, IOException {
String authorizationHeader = request.getHeader(JwtConstants.HEADER_AUTHORIZATION);
var listException = Arrays.asList(JwtConstants.AUTHORIZE_REQUESTS);
if (!listException.contains(request.getRequestURI())
&& StringUtils.startsWithIgnoreCase(authorizationHeader, JwtConstants.HEADER_TOKEN_PREFIX)) {
String token = authorizationHeader.replace(JwtConstants.HEADER_TOKEN_PREFIX, "");
String tokenRefresh = null;
if (jwtService.isValidPattern(token)) {
try {
String username = jwtService.extractUsername(token);
var userDetails = apiUserDetailService.loadUserByUsername(username);
String tokenInCache = jwtService.createToken(userDetails);
if (jwtService.validateToken(token, userDetails, tokenInCache)) {
var authentication = new UsernamePasswordAuthenticationToken(userDetails, null,
userDetails.getAuthorities());
SecurityContextHolder.getContext().setAuthentication(authentication);
tokenRefresh = refreshToken(token, userDetails);
} else {
jwtService.deleteToken(userDetails);
log.error("Bad credentials {}", username);
createServiceException(response, HttpStatus.UNAUTHORIZED, "Bad credentials");
return;
}
} catch (Exception e) {
log.error("Internal error {}", e);
createServiceException(response, HttpStatus.INTERNAL_SERVER_ERROR, e.getMessage());
return;
}
} else {
log.error("Is not JWT valid {}", token);
createServiceException(response, HttpStatus.BAD_REQUEST, "Is not JWT valid");
return;
}
if (StringUtils.hasText(tokenRefresh)) {
response.setHeader(JwtConstants.HEADER_AUTHORIZATION, JwtConstants.HEADER_TOKEN_PREFIX.concat(tokenRefresh));
}
}
filterChain.doFilter(request, response);
}
private void createServiceException(HttpServletResponse response, HttpStatus httpStatus, String message)
throws JsonProcessingException, IOException {
var errorCode = new ErrorCodeDTO(httpStatus, message);
var mapeador = new ObjectMapper();
response.setContentType(MediaType.APPLICATION_JSON_VALUE);
response.setStatus(httpStatus.value());
response.getWriter().write(mapeador.writeValueAsString(errorCode));
response.getWriter().flush();
}
private String refreshToken(String token, UserDetails userDetails) {
var dateToken = jwtService.extractExpiresAt(token);
var calMin = Calendar.getInstance();
calMin.add(Calendar.MINUTE, -2);
var calToken = Calendar.getInstance();
calToken.setTime(dateToken);
calToken.add(Calendar.MINUTE, -1);
var calMax = Calendar.getInstance();
boolean willTokenDead = calToken.after(calMin) && calToken.before(calMax);
String refreshToken = token;
if (willTokenDead) {
jwtService.deleteToken(userDetails);
refreshToken = jwtService.createToken(userDetails);
}
return refreshToken;
}
}
| [
"93302790+JoseTrejoM@users.noreply.github.com"
] | 93302790+JoseTrejoM@users.noreply.github.com |
418dd4887181d3f89a96137c49ec0e71f256f383 | de89f78eed28d11511b47a513603e52770f16879 | /Design-Patterns/Chapter1/MiniDucksSimulator.java | 07c987b786724e180647356864bc20a1d51d676b | [] | no_license | ninjaNgai/Programming-Exercises | 2f1faf3a248b70be7b18b4f7b248eb5a4f824c4b | 805223050e6c71508afd960ae55ad65296dd4881 | refs/heads/master | 2023-06-09T09:01:45.791371 | 2021-07-03T19:12:14 | 2021-07-03T19:12:14 | 270,178,360 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 991 | java | package Chapter1;
import Chapter1.Behaviors.Flying.FlyRocketPowered;
public class MiniDucksSimulator {
public static void main(String[] args) {
Duck mallard = new MallardDuck();
mallard.performQuack();
mallard.performFly();
Duck model = new ModelDuck();
model.performFly(); // first call to performFly() delegates to the flyBehavior obj set in
// ModelDuck's constructor, which is a FlyNoWay instance
// To change a duck's behavior at runtime, call the duck's setter method for
// that behavior
model.setFlyBehavior(new FlyRocketPowered()); // this invokes the model's inherited behavior setter method
model.performFly(); // Model has dynamically changed its flying behavior
// Brain Power challenge: How would you implement your own duck call that does
// not inherit from the Duck class?
DuckCall device = new DuckCall();
device.quack();
}
} | [
"ctngai@asu.edu"
] | ctngai@asu.edu |
b7cb925b100ba242ee010cae6bdae05ee536f977 | c7bce5ecbc34e6d8d1081261c63aa740f67f3cab | /app/src/main/java/fastmenu/gcherubini/android/fastmenu/fastmenu/gcherubini/android/fastmenu/login/LoginFragment.java | 741d3f2c676d74e715337aa438340e6c3d4eff7d | [] | no_license | gabrielcherubini/FastMenu | d98bbe72dfe130a8d61211e116557967479581da | d1a4b07a7a67400c2b7502a05d6f684027ad59b5 | refs/heads/master | 2020-04-16T02:12:13.738829 | 2016-09-17T19:57:01 | 2016-09-17T19:57:01 | 65,599,017 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,812 | java | package fastmenu.gcherubini.android.fastmenu.fastmenu.gcherubini.android.fastmenu.login;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import fastmenu.gcherubini.android.fastmenu.R;
import fastmenu.gcherubini.android.fastmenu.fastmenu.gcherubini.android.fastmenu.registrar.RegistrarActivity;
import fastmenu.gcherubini.android.fastmenu.fastmenu.gcherubini.android.fastmenu.restaurants.RestaurantListActivity;
/**
* Created by G.Cherubini on 09/08/2016.
*/
public class LoginFragment extends Fragment {
private Button mRegistrarButtonLogin;
private Button mLoginButtonLogin;
private EditText mEmailEditText;
private EditText mSenhaEditText;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
View v = inflater.inflate(R.layout.fragment_login, container, false);
mEmailEditText = (EditText)v.findViewById(R.id.emailLogin_editText);
mSenhaEditText = (EditText)v.findViewById(R.id.senhaLogin_editText);
mRegistrarButtonLogin = (Button)v.findViewById(R.id.registrarLogin_button);
mRegistrarButtonLogin.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick (View v)
{
Intent intent = new Intent(getActivity(), RegistrarActivity.class);
startActivity(intent);
}
});
mLoginButtonLogin = (Button)v.findViewById(R.id.loginLogin_button);
mLoginButtonLogin.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick (View v)
{
/* UsuarioLogin usuarioLogin = new UsuarioLogin(mEmailEditText.getText().toString(), mSenhaEditText.getText().toString());
if(usuarioLogin.isUserRegistered())
{
Usuario usuario = usuarioLogin.buscaUsuario();
if (usuario.getSenha().equals(mSenhaEditText.getText().toString()))
{
//TODO: Código para logar usuário (criar fragmento de menu, com subfragmento de informações do usuario)
//TODO: Código para exibir tela de seleção de restaurantes
}
}*/
Intent intent = new Intent(getActivity(),RestaurantListActivity.class);
startActivity(intent);
}
});
return v;
}
}
| [
"cherubinigabriel@gmail.com"
] | cherubinigabriel@gmail.com |
396e66640bd53ba39d56231d61e7e236b9454212 | a96286029e03315c8f3e3582241b4e64a80addaa | /java-1Z0-815/20_ModuleTesting/MySecondModule/src/mod2/GoodbyeWorld.java | 147675a7a2fb9de389145b4ee831ffffb107b5b6 | [] | no_license | Withel/java | 6cb48265b12aac990554bfc81b4686a01c91a92e | ab911bfeffa4f055eb21959d8aa01373602f4a79 | refs/heads/master | 2023-01-21T18:48:04.111663 | 2020-12-05T17:16:26 | 2020-12-05T17:16:26 | 302,117,336 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 156 | java | package mod2;
public class GoodbyeWorld {
public static void main(String[] args) {
System.out.println("And that's a wrap - goodbye.");
}
}
| [
"matiklim.98@gmail.com"
] | matiklim.98@gmail.com |
65bb45a0508f5c00874ed4489bea61ed0cbc17c2 | 966b9b21654352ed0cd25887d08dea235f5d24c4 | /app/src/main/java/com/mad/trafficclient/model/PeccancyTypeInfo.java | 734d194399a260b5ffdd70ea4098efe81e52a49b | [] | no_license | ztxyzu/TrafficClientMy | 581a6621186a3dabde914abb8aaf61fa0e1a83a5 | 56ab1e26f94b82b266b6027884310eba100d06b8 | refs/heads/master | 2021-09-14T07:43:25.981531 | 2018-05-10T03:29:24 | 2018-05-10T03:29:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,221 | java | package com.mad.trafficclient.model;
/**
* Created by Administrator on 2017/6/2.
*/
public class PeccancyTypeInfo {
/**
* pcode : 1001A
* premarks : A驾驶拼装的非汽车类机动车上道路行驶的
* pmoney : 1000
* pscore : 0
*/
private String pcode;
private String premarks;
private int pmoney;
private int pscore;
public String getPcode() {
return pcode;
}
public void setPcode(String pcode) {
this.pcode = pcode;
}
public String getPremarks() {
return premarks;
}
public void setPremarks(String premarks) {
this.premarks = premarks;
}
public int getPmoney() {
return pmoney;
}
public void setPmoney(int pmoney) {
this.pmoney = pmoney;
}
public int getPscore() {
return pscore;
}
public void setPscore(int pscore) {
this.pscore = pscore;
}
@Override
public String toString() {
return "PeccancyTypeInfo{" +
"pcode='" + pcode + '\'' +
", premarks='" + premarks + '\'' +
", pmoney=" + pmoney +
", pscore=" + pscore +
'}';
}
}
| [
"33612094+Ai00000@users.noreply.github.com"
] | 33612094+Ai00000@users.noreply.github.com |
363253ceebbd08338e5ae77d4da1059079fcb127 | c6382361fa644bcd14cbd1e10533bab2e0c72fc4 | /Barco.java | a209502ec608ce36aaa1245aa4e3836c9ae5927e | [] | no_license | Espadaclar/PuertoLuisFrancisco | 3ca9f0e80da67f397769e140ce7cd839cfe14183 | 6a8b4f6b06ccc5ff442ae6f560b4fb7a4338dab8 | refs/heads/master | 2021-01-20T03:40:19.589714 | 2017-04-27T10:37:19 | 2017-04-27T10:37:19 | 89,571,631 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 827 | java | public abstract class Barco {
private Persona persona;
private String matricula;
private double eslora;
private int anio;
public Barco(String matricula, double eslora, int anio, Persona persona) {
this.persona = persona;
this.matricula = matricula;
this.anio = anio;
this.eslora = eslora;
}
public double getEslora() {
return eslora;
}
public abstract int getCoeficienteBernua();
@Override
public String toString() {
String datos = "";
datos += "Nombre propietario: " +persona.getName()+ "\n";
datos += "Matrícula del barco: " +matricula+ "\n";
datos += "Metros de eslora: " +eslora+ " m.\n";
datos += "Año de fabricación: " +anio;
return datos;
}
} | [
"eneroborde8002@gmail.com"
] | eneroborde8002@gmail.com |
3ec1daa7fbba9a60cd840bf3052d7b7b86afd974 | 7b9a25d1fe0fdcc6069d8d5bbf2d53120cb99033 | /20210204作业/src/Main.java | f4e3bbf90a7bcad226cce6cededd55eedb8c2630 | [] | no_license | ZPF2537679213/74code | bb65beb0f8172967c7ac134caacdc4fc176c59d0 | 552513f0c9fe501607a8f0b8ade019f21efbcde0 | refs/heads/master | 2023-07-08T17:47:12.802587 | 2021-08-09T12:18:27 | 2021-08-09T12:18:27 | 309,596,804 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,929 | java | import java.util.*;
public class Main {
public static void main(String[] args) {
Set<Integer>set=new HashSet<>();
String str="gfhghfg";
List<Integer>list=new LinkedList<>();
list.add(1);
for(int x:list){
System.out.println(x);
}
PriorityQueue<Integer>queue=new PriorityQueue<>();
queue.offer(1);
queue.offer(2);
for(int x:queue){
System.out.println(x);
}
Stack<Integer>stack=new Stack<>();
stack.push(20);
stack.push(30);
for(int x:stack){
System.out.println(x);
}
Map<Integer,Integer>map=new HashMap<>();
Map.Entry<String, Integer> all = Map.entry("xlu" , 1);
String key = all.getKey();
Integer value = all.getValue();
System.out.println(key);
System.out.println(value);
System.out.println(all.getClass().getName());
}
}
//给定两个字符串 s 和 t,判断它们是否是同构的。
//如果 s 中的字符可以按某种映射关系替换得到 t ,那么这两个字符串是同构的。
//每个出现的字符都应当映射到另一个字符,同时不改变字符的顺序。不同字符不能映射到同一个字符上,相同字符只能映射到同一个字符上,字符可以映射到自己本身。
//示例 1:
//输入:s = "egg", t = "add"
//输出:true
//示例 2:
//输入:s = "foo", t = "bar"
//输出:false
//示例 3:
//输入:s = "paper", t = "title"
//输出:true
class Solution {
public boolean isIsomorphic(String s, String t) {
HashMap<Character,Character> map=new HashMap<>();
for(int i=0;i<s.length();++i){
char c=s.charAt(i);
char m=t.charAt(i);
if(map.get(c)==null){
int index=t.indexOf(m+"");
if(s.charAt(index)!=c){
return false;
}
map.put(c,m);
}else{
if(map.get(c)!=m){
return false;
}
}
Set<Integer> set=new HashSet<>();
Integer[]num=set.toArray(new Integer[10]);
}
return true;
}
}
//给定两个数组,编写一个函数来计算它们的交集。
//示例 1:
//输入:nums1 = [1,2,2,1], nums2 = [2,2]
//输出:[2]
//示例 2:
//输入:nums1 = [4,9,5], nums2 = [9,4,9,8,4]
//输出:[9,4]
class Solution2 {
public int[] intersection(int[] nums1, int[] nums2) {
Set<Integer>set1=new HashSet<>();
Set<Integer>set2=new HashSet<>();
if(nums1.length==0||nums2.length==0){
return new int[0];
}else{
for(int x:nums1){
set1.add(x);
}
for(int y:nums2){
if(set1.contains(y)){
set2.add(y);
}
}
Integer[]n=set2.toArray(new Integer[set2.size()]);
int[]num=new int[set2.size()];
for(int i=0;i<set2.size();++i){
num[i]=n[i];
}
return num;
}
}
}
//给定一个字符串,找到它的第一个不重复的字符,并返回它的索引。如果不存在,则返回 -1。
//示例:
//s = "leetcode"
//返回 0
//s = "loveleetcode"
//返回 2
class Solution3 {
public int firstUniqChar(String s) {
if(s==null||s.length()==0){
return -1;
}
Map<String,Integer> map=new HashMap<>();
int i;
for(i=0;i<s.length();++i){
String str=s.substring(i,i+1);
if(map.get(str)==null){
map.put(str,1);
}else{
map.put(str,map.get(str)+1);
}
}
for(i=0;i<s.length();++i){
String str=s.substring(i,i+1);
if(map.get(str)==1){
return i;
}
}
return -1;
}
}
| [
"2537679213@qq.com"
] | 2537679213@qq.com |
4e5192380b85025f095e9bef1bd4c8f21b5d14ff | 49049412d75c7090adf51295cb7e988e03b3d1b9 | /src/main/java/com/algaworks/ecommerce/model/Estoque.java | 69b83873f1093d8d2f2a37dc8fe328dd0a7e1820 | [] | no_license | RenatoRichard01/algaworks-ecommerce | 72f27442dcad2fdf8b9573e7b9ea65ec23ee909d | 0c248d1f11e530760ac62f9e567483e2c849ec86 | refs/heads/main | 2023-03-18T23:06:42.158600 | 2021-03-17T00:06:41 | 2021-03-17T00:06:41 | 342,997,616 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 485 | java | package com.algaworks.ecommerce.model;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.*;
@Getter
@Setter
@EqualsAndHashCode(onlyExplicitlyIncluded = true)
@Entity
@Table(name="estoque")
public class Estoque {
@EqualsAndHashCode.Include
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
@Column(name="produto_id")
private Integer produtoId;
private Integer quantidade;
}
| [
"renatorichard2012@gmail.com"
] | renatorichard2012@gmail.com |
ed5ce01322843e7f8547c97e07fcfcba65466522 | e788b934417dca414dbba8a90a50d5aea7b7a551 | /src/main/java/club/xiaoandx/servlet/controller/PracticeServlet.java | 264b97af6054cc788ce083aad4b7948bc095a094 | [
"MIT"
] | permissive | xwhnb/mr-mis | 25411c298994c2ff446c06abe96d9b4d985509e5 | d119dd4c8d19243cdd1d66b0513813731fc9e16f | refs/heads/main | 2023-06-15T00:13:56.819735 | 2021-07-06T10:37:59 | 2021-07-06T10:38:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,407 | java | /*
* Copyright (c) 2021 WEI.ZHOU. All rights reserved.
* The following code is only used for learning and communication, not for illegal and
* commercial use.
* If the code is used, no consent is required, but the author has nothing to do with any problems
* and consequences.
* In case of code problems, feedback can be made through the following email address.
*
* <xiaoandx@gmail.com>
*/
package club.xiaoandx.servlet.controller;
import club.xiaoandx.entity.InternShip;
import club.xiaoandx.entity.vo.ResultVo;
import club.xiaoandx.entity.vo.SearchVo;
import club.xiaoandx.service.PracticeService;
import club.xiaoandx.servlet.BaseServlet;
import club.xiaoandx.util.DataHandleUtil;
import club.xiaoandx.util.JSONUtil;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.Map;
/**
* <p> 实习信息 </p>
* @version V1.0.0
* @ClassName:PracticeServlet
* @author: WEI.ZHOU
* @date: 2021/6/12 10:26
*/
public class PracticeServlet extends BaseServlet {
/**
* <p> 分页查询所有的实习信息 </p>
* @title: findAllPracticeToPage
* @date: 2021/6/12 21:06
* @author: WEI.ZHOU
* @version: v1.0.0
* @param request
* @param response
* @return: void
**/
public void findAllPracticeToPage(HttpServletRequest request, HttpServletResponse response) throws IOException {
Map<String,Object> data = null;
String page = request.getParameter("page");
String limit = request.getParameter("limit");
if(page.isEmpty() || limit.isEmpty()){
data = PracticeService.findAllPracticeToPage(1,5);
}
data = PracticeService.findAllPracticeToPage(Integer.valueOf(page),
Integer.valueOf(limit));
String s = JSONUtil.objectToJson(data);
PrintWriter writer = response.getWriter();
writer.append(s);
}
/**
* <p> 查询指定学生的实习就业信息 </p>
* @title: findPracticeById
* @date: 2021/6/12 21:08
* @author: WEI.ZHOU
* @version: v1.0.0
* @param request
* @param response
* @return: void
* @throws: IO操作异常
**/
public void findPracticeById(HttpServletRequest request, HttpServletResponse response) throws IOException {
String sid = request.getParameter("sid");
InternShip internShip = PracticeService.findPracticeById(sid);
String s = JSONUtil.objectToJson(internShip);
PrintWriter writer = response.getWriter();
writer.append(s);
}
/**
* <p> 更新指定学生的就业信息 </p>
* @title: updateStuInfoById
* @date: 2021/6/12 21:08
* @author: WEI.ZHOU
* @version: v1.0.0
* @param request
* @param response
* @return: void
* @throws:
**/
public void updateStuInfoById(HttpServletRequest request, HttpServletResponse response) throws IOException {
Map<String, Object> result = new HashMap<>();
InternShip internShip = DataHandleUtil.postRequestJsonToObject(request,
InternShip.class);
int status = PracticeService.updateInternShipById(internShip);
if(status != 0){
result.put("status",0);
result.put("message","update success");
String json = DataHandleUtil.objectToJsonString(response,result);
PrintWriter writer = response.getWriter();
writer.append(json);
}else {
result.put("status", -1);
result.put("message", "update error");
String json = DataHandleUtil.objectToJsonString(response, result);
PrintWriter writer = response.getWriter();
writer.append(json);
}
}
/**
* <p> 删除指定用户的就业信息 </p>
* @title: deleteInternShipById
* @date: 2021/6/12 21:09
* @author: WEI.ZHOU
* @version: v1.0.0
* @param request
* @param response
* @return: void
* @throws:
**/
public void deleteInternShipById(HttpServletRequest request, HttpServletResponse response) throws IOException {
String sid = request.getParameter("sid");
int status = PracticeService.deleteInternShipById(Integer.valueOf(sid));
if(status != 0){
String json = DataHandleUtil.objectToJsonString(response,new ResultVo(0,"success",
null));
PrintWriter writer = response.getWriter();
writer.append(json);
}else {
String json = DataHandleUtil.objectToJsonString(response,new ResultVo(-1,"error",
null));
PrintWriter writer = response.getWriter();
writer.append(json);
}
}
/**
* <p> 插入学生毕业信息 </p>
* @title: insertPractice
* @date: 2021/6/12 21:10
* @author: WEI.ZHOU
* @version: v1.0.0
* @param request
* @param response
* @return: void
* @throws:
**/
public void insertPractice(HttpServletRequest request, HttpServletResponse response) throws IOException {
InternShip internShip = DataHandleUtil.postRequestJsonToObject(request,
InternShip.class);
int status = PracticeService.insertPractice(internShip);
if(status != 0){
String json = DataHandleUtil.objectToJsonString(response,new ResultVo(0,"success",
null));
PrintWriter writer = response.getWriter();
writer.append(json);
}else {
String json = DataHandleUtil.objectToJsonString(response,new ResultVo(-1,"error",
null));
PrintWriter writer = response.getWriter();
writer.append(json);
}
}
/**
* <p> 学生毕业信息搜索 </p>
* @title: search
* @date: 2021/6/12 21:17
* @author: WEI.ZHOU
* @version: v1.0.0
* @param request
* @param response
* @return: void
* @throws:
**/
public void search(HttpServletRequest request, HttpServletResponse response) throws IOException {
Map<String,Object> data = null;
String page = request.getParameter("page");
String limit = request.getParameter("limit");
String username ;
String sid;
try {
username = new String(request.getParameter("sname").getBytes("ISO-8859-1"),
"UTF-8");
}catch (RuntimeException | UnsupportedEncodingException r){
username = "null";
}
try {
sid = request.getParameter("sid");
}catch (RuntimeException r){
sid = "101";
}
SearchVo searchVo = new SearchVo();
searchVo.setUsername(username);
searchVo.setSid(Integer.valueOf((null == sid)? "101" : sid ));
Map<String,String> reqData = new HashMap<>();
if(page.isEmpty() || limit.isEmpty()){
data = PracticeService.findSearchPractice(1,5,searchVo);
}
data = PracticeService.findSearchPractice(Integer.valueOf(page),
Integer.valueOf(limit),searchVo);
String s = JSONUtil.objectToJson(data);
PrintWriter writer = response.getWriter();
writer.append(s);
}
}
| [
"2324671838@qq.com"
] | 2324671838@qq.com |
5fbcaa8bf7d357e1a139e771154cb55c4a1c67a5 | 8aece436d93c3c8b300d809e0aafa2ce4b985713 | /contactscommon/src/com/android/contacts/commonbind/experiments/Flags.java | 995b2c59b6da26b6d77538aeee4956903540d655 | [] | no_license | xjpmauricio/dialer-nougat-release | d571dc1817beb60bdd3fb8743b29676d84dacf7a | eea8846eb16a1ed60f2d97db4291442888f55b1f | refs/heads/master | 2021-01-22T23:06:14.019082 | 2019-04-25T17:54:01 | 2019-04-25T17:54:01 | 85,606,453 | 9 | 5 | null | 2019-04-25T18:18:54 | 2017-03-20T17:31:06 | Java | UTF-8 | Java | false | false | 1,646 | java | /*
* Copyright (C) 2016 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.contacts.commonbind.experiments;
import android.content.Context;
/**
* Provides getters for experiment flags.
* This stub class is designed to be overwritten by an overlay.
*/
public final class Flags {
private static Flags sInstance;
public static Flags getInstance(Context context) {
if (sInstance == null) {
sInstance = new Flags();
}
return sInstance;
}
private Flags() {
}
public boolean getBoolean(String flagName, boolean defValue) {
return defValue;
}
public byte[] getBytes(String flagName, byte[] defValue) {
return defValue;
}
public double getDouble(String flagName, double defValue) {
return defValue;
}
public int getInt(String flagName, int defValue) {
return defValue;
}
public long getLong(String flagName, long defValue) {
return defValue;
}
public String getString(String flagName, String defValue) {
return defValue;
}
}
| [
"xjpmauricio@gmail.com"
] | xjpmauricio@gmail.com |
7f8d16509ffd909dd3aa81a84fc3be7397e20625 | 8a6e08afc4f545a1ff2ad7f435de988abaa86e11 | /Chapter_20/AddInt.java | 2c7a59c4044a2b924101236f56f035338abaf48a | [] | no_license | aleksis-vilums/Exercises | 059208a716769cf847a2023fde9114c3f1e4a3b9 | 271be6d68dab85ab9a18924294bd2a6700ba4649 | refs/heads/master | 2023-03-05T04:40:18.553189 | 2021-02-20T06:42:29 | 2021-02-20T06:42:29 | 294,169,879 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 418 | java | import java.util.Scanner;
public class AddInt {
public static void main(String[] args){
Scanner scanner = new Scanner(System.in);
System.out.print("How many: ");
int length = scanner.nextInt();
int sum = 0;
int i = 0;
while(i < length){
System.out.print("Enter number: ");
sum += scanner.nextInt();
i += 1;
}
System.out.println("The sum is " + sum);
}
} | [
"vilumsar@s.dcsdk12.org"
] | vilumsar@s.dcsdk12.org |
91545d4dfa442060c3b333f083aecab65071a4f9 | d90bc68346a2a786b01266e577dd23b0ff3387f2 | /fs/src/test/org/jnode/test/fs/driver/context/FloppyDriverContext.java | e3062156562a5db4560eecfe73ff447d77bbaed5 | [] | no_license | flesire/jnode.mirror | aa2930923e998e7fbd9a48564c40edadfddb8cc7 | 2fae7f6b392a8ace3840e09635d3cc0105e4f335 | refs/heads/master | 2021-01-23T03:48:46.788908 | 2013-09-06T14:23:31 | 2013-09-06T14:23:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,574 | java | /*
* $Id: FloppyDriverContext.java 5957 2013-02-17 21:12:34Z lsantha $
*
* Copyright (C) 2003-2013 JNode.org
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; If not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package org.jnode.test.fs.driver.context;
import java.io.IOException;
import javax.naming.NamingException;
import org.jmock.MockObjectTestCase;
import org.jnode.driver.DeviceFinder;
import org.jnode.driver.block.floppy.FloppyControllerFinder;
import org.jnode.driver.block.floppy.FloppyDeviceToDriverMapper;
import org.jnode.driver.block.floppy.FloppyDriver;
import org.jnode.driver.block.floppy.support.FloppyDriverUtils;
import org.jnode.test.fs.driver.BlockDeviceAPIContext;
import org.jnode.test.fs.driver.factories.MockFloppyDeviceFactory;
import org.jnode.test.fs.driver.stubs.StubDeviceManager;
import org.jnode.test.support.TestConfig;
public class FloppyDriverContext extends BlockDeviceAPIContext {
public FloppyDriverContext() {
super("FloppyDriver");
}
public void init(TestConfig config, MockObjectTestCase testCase) throws Exception {
super.init(config, testCase);
// set the current testCase for our factory
MockFloppyDeviceFactory factory;
try {
factory = (MockFloppyDeviceFactory)
FloppyDriverUtils.getFloppyDeviceFactory();
} catch (NamingException ex) {
throw (IOException) new IOException().initCause(ex);
}
factory.setTestCase(testCase);
DeviceFinder deviceFinder = new FloppyControllerFinder();
StubDeviceManager.INSTANCE.removeAll();
StubDeviceManager.INSTANCE.add(deviceFinder, new FloppyDeviceToDriverMapper());
FloppyDriver driver = (FloppyDriver) findDriver(deviceFinder, "fd0");
log.debug("findDriver->" + driver);
init(null, driver, null);
}
}
| [
"galatnm@gmail.com"
] | galatnm@gmail.com |
a804493d559ab49f9e2743edda6e708526b17c31 | 2f7b585bc87c88e46747c969f49b86706e05cfa6 | /iefas-ws/src/main/java/hk/oro/iefas/ws/system/service/DashboardInfoService.java | 252aced9b97d50bbeb83c4c000b5a258b07869bc | [] | no_license | peterso05168/oro | 3fd5ee3e86838215b02b73e8c5a536ba2bb7c525 | 6ca20e6dc77d4716df29873c110eb68abbacbdbd | refs/heads/master | 2020-03-21T17:10:58.381531 | 2018-06-27T02:19:08 | 2018-06-27T02:19:08 | 138,818,244 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 414 | java | /**
*
*/
package hk.oro.iefas.ws.system.service;
import java.util.List;
import hk.oro.iefas.domain.system.dto.DashboardInfoDTO;
/**
* @version $Revision: 2040 $ $Date: 2018-04-12 14:37:25 +0800 (週四, 12 四月 2018) $
* @author $Author: marvel.ma $
*/
public interface DashboardInfoService {
void generateDashboardInfo(Integer postId);
List<DashboardInfoDTO> findByPostId(Integer postId);
}
| [
"peterso05168@gmail.com"
] | peterso05168@gmail.com |
0de7eaa6cd37da1394f2e98b3129cde841ae600d | 44a66006c9873f200837bc0feda0a2e7a088e9b9 | /src/main/java/com/objectpartners/spark/rt911/streaming/sockets/SparkFullDemoRunner.java | c0038bc0ba96eba3c0470432eed4698c063e1639 | [] | no_license | waldmark/spark-java-stream-examples | ccf02efebb595b42f02b1fed59df79594faf79c1 | 3d885c44edc5f472681b26072c58df1a6c26128a | refs/heads/master | 2020-05-30T07:13:03.719455 | 2016-10-10T17:34:47 | 2016-10-10T17:34:47 | 70,190,781 | 2 | 8 | null | null | null | null | UTF-8 | Java | false | false | 2,055 | java | package com.objectpartners.spark.rt911.streaming.sockets;
import com.objectpartners.spark.rt911.streaming.CallProcessing;
import com.objectpartners.spark.rt911.streaming.SparkRunner;
import org.apache.spark.SparkException;
import org.apache.spark.streaming.api.java.JavaStreamingContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
@Component
public class SparkFullDemoRunner implements SparkRunner {
private static Logger logger = LoggerFactory.getLogger(SparkFullDemoRunner.class);
@Autowired
@Qualifier("callProcessingSpark")
private CallProcessing sparkProcessor;
@Autowired
private CallProducingServer producer;
public void runSparkStreamProcessing() {
final JavaStreamingContext jssc;
try {
jssc = sparkProcessor.processStream();
} catch (SparkException se) {
logger.error(se.getMessage());
return;
}
jssc.start();
final Thread runSimulation = new Thread(() -> {
logger.info("starting call producing client...");
producer.run();
logger.info("911 call production completed...");
try {
// wait for twice the batch interval to allow spark to finish
Thread.sleep((sparkProcessor.getStreamBatchInterval() * 2));
} catch (InterruptedException e) {
logger.info(e.getMessage());
}
logger.info("calling stop on Spark Streaming Context ....");
jssc.stop();
});
runSimulation.start();
try {
jssc.awaitTermination();
logger.info("Spark termintation ....");
} catch (InterruptedException ie) {
logger.error(ie.getMessage());
} finally {
jssc.close();
}
logger.info("application completed ....");
}
}
| [
"mark.wald@objectpartners.com"
] | mark.wald@objectpartners.com |
95ba3b27a1fb479e920bd00f8556b3dd5f7f9834 | d3e3c0fd73509d3f3b4f9469a85660f640bc8a3e | /app/src/main/java/com/example/chenxuhua/meishi/CreateuserActivity.java | 3aebc3e723b902557bf3cbae2f987b9a659dd02b | [] | no_license | android-starss/android-meishi | 23eb22505b1bfaee1c944c1bcfee7de1d98ee427 | 377c23ffdfcfefe4130e2f72ad856538906c31de | refs/heads/master | 2020-03-22T17:21:47.467953 | 2018-07-12T12:31:58 | 2018-07-12T12:31:58 | 140,390,973 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,509 | java | package com.example.chenxuhua.meishi;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.example.lihongzheng.meishi.MainActivity;
import com.example.lihongzheng.meishi.R;
import java.util.List;
import cn.bmob.v3.BmobQuery;
import cn.bmob.v3.datatype.BmobQueryResult;
import cn.bmob.v3.exception.BmobException;
import cn.bmob.v3.listener.SQLQueryListener;
import cn.bmob.v3.listener.SaveListener;
public class CreateuserActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_createuser);
setTitle("注册");
final Person p2 = new Person();
Button bt = (Button) findViewById(R.id.bt);
bt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final String username = ((EditText) findViewById(R.id.username)).getText().toString();
final String psd = ((EditText) findViewById(R.id.psd)).getText().toString();
String sql = "Select *from Person";
new BmobQuery<Person>().doSQLQuery(sql, new SQLQueryListener<Person>() {
@Override
public void done(BmobQueryResult<Person> bmobQueryResult, BmobException e) {
if (e == null) {
List<Person> list = (List<Person>) bmobQueryResult.getResults();
if (list != null && list.size() > 0) {
int m=1;
for (int i = 0; i < list.size(); i++) {
Person person = list.get(i);
if (person.getUsername() == username) {
Toast.makeText(getApplicationContext(), "名称已被使用,请重新输入", Toast.LENGTH_SHORT).show();
m=0;
}
}
if(m==1) {
p2.setUsername(username);
p2.setPsd(psd);
p2.save(new SaveListener<String>() {
@Override
public void done(String objectId, BmobException e) {
if (e == null) {
Toast.makeText(getApplicationContext(), "注册成功,Id为:" + objectId, Toast.LENGTH_SHORT).show();
Intent intent = new Intent(CreateuserActivity.this, MainActivity.class);
startActivity(intent);
} else {
Toast.makeText(getApplicationContext(), "注册失败:" + e.getMessage(), Toast.LENGTH_SHORT).show();
}
}
});
}
}
}
}
});
}
});
}
}
| [
"2454891277@qq.com"
] | 2454891277@qq.com |
9e4d4d0127e07da483f6e60051617c47a36696fa | 5febd1cbc4b98b1e69798b62f1057865da7d734f | /RunningMan/core/src/main/edu/chalmers/RunningMan/model/gameobject/IVisitable.java | 63a2aed675a65c947de0338985a1b67e99e6dbd1 | [] | no_license | jeppzone/TDA367 | 45dc44eb0c38fb37f0f7d4468c3ec48331648fce | 601b71d97d07544789758709df9082511c7994ad | refs/heads/master | 2021-01-23T02:39:39.733557 | 2015-05-31T21:48:35 | 2015-05-31T21:48:35 | 32,786,842 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 214 | java | package edu.chalmers.RunningMan.model.gameobject;
/**
* Interface for all entities that can be collided with
* @author Jesper Olsson
*/
public interface IVisitable {
void acceptVisitor(IVisitor visitor);
}
| [
"jespols@student.chalmers.se"
] | jespols@student.chalmers.se |
04c91c59ed195cead83fe7b3cd06ace894b0d6f0 | 7c0728ca0fa207af933a57cb7353e43ef946b424 | /Android/app/src/main/java/com/example/junkikim/donate/communicateServerByPHP/SendMessage_dbName_notes.java | 3232306c503b4c609940724aef3547f0c2ce1260 | [] | no_license | zxc7023/timetime | e468691b251b01d3d69d9c7bb3c96eafa4cbc145 | 44d9634dfa9c2b3e10287300825d9d4a1cf6d4d2 | refs/heads/master | 2023-02-07T14:06:42.890132 | 2020-12-28T10:44:07 | 2020-12-28T10:44:07 | 324,983,300 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,721 | java | package com.example.junkikim.donate.communicateServerByPHP;
import android.app.ProgressDialog;
import android.content.Context;
import android.os.AsyncTask;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.util.Log;
import android.widget.Toast;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
/**
* Created by junki on 2016-11-27.
*/
public class SendMessage_dbName_notes extends AsyncTask <String, Void, String> {
ProgressDialog loading;
FragmentManager fm;
Fragment fragment;
FragmentTransaction tr;
int layout;
Context context;
public SendMessage_dbName_notes(FragmentManager fm, Fragment fragment, FragmentTransaction tr, int layout, ProgressDialog loading, Context context) {
this.fm=fm;
this.fragment=fragment;
this.tr=tr;
this.layout=layout;
this.loading=loading;
this.context=context;
}
// Background 작업 시작전에 UI 작업을 진행 한다.
@Override
protected void onPreExecute() {
super.onPreExecute();
}
//Background 작업이 끝난 후 UI 작업을 진행 한다.
@Override
protected void onPostExecute(String s) {
loading.dismiss();
Log.d("messageResult",s);
if(!(s.equalsIgnoreCase("failure"))){
Toast.makeText(context, "전송하였습니다. " + "", Toast.LENGTH_LONG).show();
}
else {
Toast.makeText(context, "메세지를 전송하는데 실패했습니다.", Toast.LENGTH_LONG).show();
}
super.onPostExecute(s);
}
//Background 작업을 진행 한다.
protected String doInBackground(String... params) {
try {
String id_recv = (String) params[0];
String id_send = (String) params[1];
String msg_contents = (String) params[2];
String msg_writeDate = (String) params[3];
String link = "http://1.243.135.179:8080/get_notes.php/";
String data = URLEncoder.encode("id_recv", "UTF-8") + "=" + URLEncoder.encode(id_recv, "UTF-8");
data += "&" + URLEncoder.encode("id_send", "UTF-8") + "=" + URLEncoder.encode(id_send, "UTF-8");
data += "&" + URLEncoder.encode("msg_contents", "UTF-8") + "=" + URLEncoder.encode(msg_contents, "UTF-8");
data += "&" + URLEncoder.encode("msg_writeDate", "UTF-8") + "=" + URLEncoder.encode(msg_writeDate, "UTF-8");
//data=data.replaceAll("<br />", "\n");
URL url = new URL(link);
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
wr.write(data);
wr.flush();
BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
StringBuilder sb = new StringBuilder();
String line = null;
// Read Server Response
while ((line = reader.readLine()) != null) {
sb.append(line);
break;
}
return sb.toString();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
}
| [
"zxc7023@gmail.com"
] | zxc7023@gmail.com |
b7a007e3fd6367da6e8f4816e20bdccf9843b459 | 79e06b3a5478c22a2e8f69940a761e288f6bc522 | /src/com/yy/crf/dao/OrdersMapper.java | 8a2997748d7548d402f279bdd6244a477a37997f | [] | no_license | chenrongfa/Mybatis_generator | 6cc67dd052c088b81117184b0ea5f22e70261adf | d336c24be6cb2f9ddb0fec9f9f7efc1a2ca74031 | refs/heads/master | 2021-01-20T15:18:03.476288 | 2017-05-10T03:33:57 | 2017-05-10T03:33:57 | 90,745,290 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 354 | java | package com.yy.crf.dao;
import com.yy.crf.entity.Orders;
public interface OrdersMapper {
int deleteByPrimaryKey(Integer number);
int insert(Orders record);
int insertSelective(Orders record);
Orders selectByPrimaryKey(Integer number);
int updateByPrimaryKeySelective(Orders record);
int updateByPrimaryKey(Orders record);
} | [
"18720979339@163.com"
] | 18720979339@163.com |
7d084527d9979a277ba0bd5a5b051c90cbe0e513 | c5af5b479a83f4dbe1a6998f08614b63a8ece1f3 | /src/fr/maxlego08/auth/packet/PacketAuthClient.java | 1895b028716c732c278eadae1776c4fdcb56a0cf | [
"MIT"
] | permissive | Maxlego08/Authme | 970bcd219f8d0b637a942a1c5cc7b733136fa500 | 886e49ad063b202fedd4963075c7b575f23461c8 | refs/heads/master | 2020-07-22T19:51:35.346463 | 2019-09-12T09:43:52 | 2019-09-12T09:43:52 | 207,309,471 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,101 | java | package fr.maxlego08.auth.packet;
import java.io.IOException;
import fr.maxlego08.auth.auth.AuthAction;
import net.minecraft.server.v1_7_R4.Packet;
import net.minecraft.server.v1_7_R4.PacketDataSerializer;
import net.minecraft.server.v1_7_R4.PacketListener;
public class PacketAuthClient extends Packet {
private final AuthAction action;
private String message;
/**
* @param action
* @param message
*/
public PacketAuthClient(AuthAction action, String message) {
super();
this.action = action;
this.message = message;
}
/**
* @param auth
*/
public PacketAuthClient(AuthAction auth) {
super();
this.action = auth;
}
@Override
public void a(PacketDataSerializer packet) throws IOException {
}
@Override
public void b(PacketDataSerializer write) throws IOException {
write.writeInt(action.getId());
if (action.equals(AuthAction.LOGIN_ERROR) || action.equals(AuthAction.CONFIRM_ERROR)
|| action.equals(AuthAction.REGISTER_ERROR))
write.a(message);
}
@Override
public void handle(PacketListener packet) {
// TODO Auto-generated method stub
}
}
| [
"32517160+Maxlego08@users.noreply.github.com"
] | 32517160+Maxlego08@users.noreply.github.com |
088ae76d8cd67fb5e9f9cf6febf52f7fce590651 | 795d9fd576b86d225855b58a6727856de3b82247 | /resume_builder/resume_builder/build/generated/src/org/apache/jsp/index_005fsuccess_jsp.java | 86b0fe4de101c99e63798df092ae7894760c3d13 | [] | no_license | NavDhaliwal/StudentProjects | 0b1d457a28a06ac4b9f54df4ce2846790af4c9af | defd93c7028b22b4397effc6b49da12a96fba3ed | refs/heads/master | 2021-01-02T08:33:52.723616 | 2014-02-22T23:17:14 | 2014-02-22T23:17:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,504 | java | package org.apache.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
public final class index_005fsuccess_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory();
private static java.util.Vector _jspx_dependants;
private org.apache.jasper.runtime.ResourceInjector _jspx_resourceInjector;
public Object getDependants() {
return _jspx_dependants;
}
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
JspWriter _jspx_out = null;
PageContext _jspx_page_context = null;
try {
response.setContentType("text/html");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
_jspx_resourceInjector = (org.apache.jasper.runtime.ResourceInjector) application.getAttribute("com.sun.appserv.jsp.resource.injector");
out.write("<html>\r\n");
out.write("\r\n");
out.write("<head>\r\n");
out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\r\n");
out.write("<meta name=\"GENERATOR\" content=\"Microsoft FrontPage 4.0\">\r\n");
out.write("<meta name=\"ProgId\" content=\"FrontPage.Editor.Document\">\r\n");
out.write("<title>resumebuilder.com</title>\r\n");
out.write("</head>\r\n");
out.write("\r\n");
out.write("<body bgcolor=\"#FFFFFF\" text=\"#990000\" leftmargin=\"0\" topmargin=\"0\" rightmargin=\"0\" bottommargin=\"0\" marginwidth=\"0\" marginheight=\"0\">\r\n");
out.write("<table width=\"100%\" height=\"172\" border=\"0\" cellspacing=\"0\">\r\n");
out.write(" <tr>\r\n");
out.write(" <td width=\"25%\" height=\"168\" align=\"left\" valign=\"top\" bgcolor=\"#1F41B8\"><img src=\"cap.png\" width=\"248\" height=\"161\"></td>\r\n");
out.write(" <td width=\"75%\" valign=\"middle\"^ bgcolor=\"#1F41B8\"><font size=\"7\">RESUME BUILDER </font></td>\r\n");
out.write(" </tr>\r\n");
out.write("</table>\r\n");
out.write("<table border=\"0\" width=\"100%\" bgcolor=\"#000000\" cellspacing=\"0\" cellpadding=\"0\">\r\n");
out.write(" <tr>\r\n");
out.write(" <td width=\"100%\"><font color=\"#FFFFFF\" face=\"Arial\" size=\"2\"><b>WWW.RESUMEBUILDER.COM</b></font></td>\r\n");
out.write(" </tr>\r\n");
out.write("</table>\r\n");
out.write("<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" background=\"./JobSearchNewspaper.jpg\">\r\n");
out.write(" <tr>\r\n");
out.write(" <td valign=\"top\"> </td>\r\n");
out.write(" <td align=\"left\" valign=\"middle\">\r\n");
out.write(" \r\n");
out.write(" <td align=\"right\" valign=\"middle\"><a href=\"user_reg.jsp\"></a>\r\n");
out.write(" <td colspan=\"2\"> </td>\r\n");
out.write(" </tr>\r\n");
out.write(" \r\n");
out.write(" <tr>\r\n");
out.write(" <td width=\"15%\" height=\"380\" valign=\"top\"> \r\n");
out.write(" <p style=\"margin-left: 20\"> </p>\r\n");
out.write(" <p> </p>\r\n");
out.write(" <p> </p>\r\n");
out.write(" <p> </p>\r\n");
out.write(" <p> </p>\r\n");
out.write(" <p></td>\r\n");
out.write(" <td width=\"58%\" colspan=\"2\" align=\"right\" valign=\"top\">\r\n");
out.write(" \r\n");
out.write(" <table width=\"390\" border=\"0\" align=\"center\">\r\n");
out.write(" <tr>\r\n");
out.write(" <td colspan=\"3\" align=\"left\"><label></label>\r\n");
out.write(" <label>ARE YOU ALREADY EMPLOYEE OF THE COMPANY </label></td>\r\n");
out.write(" </tr>\r\n");
out.write(" <tr>\r\n");
out.write(" <td colspan=\"3\"> </td>\r\n");
out.write(" </tr>\r\n");
out.write(" <tr>\r\n");
out.write(" <td width=\"92\"><p>\r\n");
out.write(" <label></label>\r\n");
out.write(" <label></label>\r\n");
out.write(" </p></td>\r\n");
out.write(" <td width=\"92\" align=\"center\"><a href=\"enter_empid.jsp\"><font color=\"#990000\">Yes</font></a></td>\r\n");
out.write(" <td width=\"194\"><a href=\"user_reg.jsp\"><font color=\"#990000\">No</font></a></td>\r\n");
out.write(" </tr>\r\n");
out.write(" </table>\r\n");
out.write(" <p><br>\r\n");
out.write(" </p>\r\n");
out.write(" <td width=\"11%\">\r\n");
out.write(" <p> </p>\r\n");
out.write(" <p> </p>\r\n");
out.write(" <p> </p>\r\n");
out.write(" <p> </p>\r\n");
out.write(" <p> </p>\r\n");
out.write(" <p> </p>\r\n");
out.write(" <p> </p>\r\n");
out.write(" <p> </p>\r\n");
out.write(" <p> </p>\r\n");
out.write(" <p> </p>\r\n");
out.write(" <p> </p>\r\n");
out.write(" <p> </p>\r\n");
out.write(" <p> </p>\r\n");
out.write(" <p> </p>\r\n");
out.write(" <p> </p>\r\n");
out.write(" <p> </p>\r\n");
out.write(" <p> </p>\r\n");
out.write(" </blockquote> </td>\r\n");
out.write(" <td width=\"16%\" valign=\"top\">\r\n");
out.write(" <table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\">\r\n");
out.write(" <tr>\r\n");
out.write(" <td width=\"100%\" bgcolor=\"#FFFFFF\"><b><font face=\"Arial\" size=\"2\" color=\"#990000\">SIDE\r\n");
out.write(" HEADING 1</font></b></td>\r\n");
out.write(" </tr>\r\n");
out.write(" </table>\r\n");
out.write(" <table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\">\r\n");
out.write(" <tr>\r\n");
out.write(" <td width=\"100%\"><br>\r\n");
out.write(" <font size=\"2\" face=\"Arial\">This is the place for your news or other\r\n");
out.write(" site information. Another good use for this space is to display\r\n");
out.write(" advertisements.</font>\r\n");
out.write(" <p><font size=\"2\" face=\"Arial\">This is the place for your news or\r\n");
out.write(" other site information. Another good use for this space is to\r\n");
out.write(" display advertisements.<br>\r\n");
out.write(" </font></td>\r\n");
out.write(" </tr>\r\n");
out.write(" </table>\r\n");
out.write(" <table border=\"0\" width=\"100%\" bgcolor=\"#008080\" cellspacing=\"0\" cellpadding=\"0\">\r\n");
out.write(" <tr>\r\n");
out.write(" <td width=\"100%\" bgcolor=\"#FFFFFF\"><b><font face=\"Arial\" size=\"2\" color=\"#990000\">SIDE\r\n");
out.write(" HEADING 2</font></b></td>\r\n");
out.write(" </tr>\r\n");
out.write(" </table>\r\n");
out.write(" <table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\">\r\n");
out.write(" <tr>\r\n");
out.write(" <td width=\"100%\"><br>\r\n");
out.write(" <font size=\"2\" face=\"Arial\">This is the place for your news or other\r\n");
out.write(" site information. Another good use for this space is to display\r\n");
out.write(" advertisements.</font>\r\n");
out.write(" <p><font size=\"2\" face=\"Arial\">This is the place for your news or\r\n");
out.write(" other site information. Another good use for this space is to\r\n");
out.write(" display advertisements<br>\r\n");
out.write(" </font></td>\r\n");
out.write(" </tr>\r\n");
out.write(" </table> </td>\r\n");
out.write(" </tr>\r\n");
out.write("</table>\r\n");
out.write("<table border=\"0\" width=\"100%\" bgcolor=\"#000000\" cellspacing=\"0\" cellpadding=\"0\">\r\n");
out.write(" <tr>\r\n");
out.write(" <td width=\"100%\"><font size=\"1\"> </font></td>\r\n");
out.write(" </tr>\r\n");
out.write("</table>\r\n");
out.write("\r\n");
out.write("</body>\r\n");
out.write("\r\n");
out.write("</html>\r\n");
} catch (Throwable t) {
if (!(t instanceof SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
}
| [
"navjot.tu@gmail.com"
] | navjot.tu@gmail.com |
5e62744d010531a39e1aa8a394c8e3b04fa3a76a | e307eba673d1568c33ddc1bce02dede4386f1a22 | /kafka-utility/src/main/java/poc/kafka/serialization/PersonSerializer.java | 8b40a8f8e8dc0b2a463032626c41be706133cbb5 | [] | no_license | ashishb888/kafka-poc | 28e74866364b54c06eae13875ab34a0a8f360b9c | 9c0ec9fdf34424a099651cdedd261842b9157634 | refs/heads/master | 2020-07-10T00:25:05.515156 | 2020-03-04T06:14:52 | 2020-03-04T06:14:52 | 204,118,651 | 2 | 1 | null | 2023-09-05T22:02:03 | 2019-08-24T06:30:13 | Java | UTF-8 | Java | false | false | 569 | java | package poc.kafka.serialization;
import org.apache.kafka.common.errors.SerializationException;
import org.apache.kafka.common.serialization.Serializer;
import org.springframework.util.SerializationUtils;
import poc.kafka.domain.Person;
public class PersonSerializer implements Serializer<Person> {
@Override
public byte[] serialize(String topic, Person data) {
if (data == null)
return null;
try {
return SerializationUtils.serialize(data);
} catch (Exception e) {
throw new SerializationException("Error while serializing object", e);
}
}
}
| [
"ashish.bhosle008@gmail.com"
] | ashish.bhosle008@gmail.com |
fae689f5a5f02d0a82b0db195ec24b1693e21af8 | 2129f9ec76c25c6a0df531c18882c23518ce9a4a | /IndexHashTable.java | f6e1117aa38f96922cd16c98a76bf384becfdc02 | [] | no_license | jmccarthy92/Hash-Table---Implemented-in-Java | d152e0a8d775665570b5413f6fc3f370ac41e224 | 0752913163d61c11c09d979ed9c4da81cef8b6ad | refs/heads/master | 2021-01-21T20:11:53.307441 | 2017-05-23T18:34:41 | 2017-05-23T18:34:41 | 92,206,636 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,085 | java | /*
CS-3810 Data Structures and Algorithms
Assignment #4 12.7.16
James McCarthy
This is the index hash table applied in the HashInterface application
I have a couple integer variables to take in the number of blocks and number of records
entered by the user, which is than used for the hashing in the insert, delete, and find operations.
I have two arrays one for the hash table, and one to take in the number of records in each block
as we carry out the operations. I also include a method so the application can retrieve the values from the array in a string.
I use a method fill hash table in the constructor to insure that the hash table array has random values
distributed, and that no value distributed in the hash table is a duplicate.
*/
import java.util.*;
import java.io.*;
import java.io.RandomAccessFile;
public class IndexHashTable
{
private int[] hashTbl;
private int [] blockCounter;
private int blockLength;
private int blockRecs;
private int numberOfBlocks;
private final Record DELETED = new Record("-1","DELETED");
public IndexHashTable(int numBlocks, int numRecords)
{
hashTbl = new int[numBlocks];
fillHashTable();
blockRecs = numRecords;
numberOfBlocks = numBlocks;
blockLength = 40 * blockRecs * 2;
blockCounter = new int [hashTbl.length];
}
public int hashFunction( int key)
{
return key % hashTbl.length;
}
public int insert(RandomAccessFile file, Record rec)
{
int key = Integer.parseInt(rec.getId());
int hashVal = hashFunction(key);
int blockInd = hashTbl[hashVal];
int fileSeek = blockInd * blockLength;
Record readFile = new Record();
try
{
file.seek(fileSeek);
readFile.read(file);
for( int j = 0; j < blockRecs *2 ; j++)
{
if( blockCounter[blockInd] == blockRecs )
{
break;
}
if(readFile.getId().trim().equals(rec.getId()))
{
return 1;
}
if( "".equals(readFile.getId().trim()) || DELETED.getId().trim().equals(readFile.getId().trim()) )
{
file.seek(file.getFilePointer() - 40);
rec.write(file);
blockCounter[blockInd]++;
return 0;
}
readFile.read(file);
}
}
catch(IOException ioe)
{
try
{
rec.write(file);
blockCounter[blockInd]++;
return 0;
}
catch(IOException ioee) {}
}
return -1;
}
public Record delete(RandomAccessFile file, String id)
{
int key = Integer.parseInt(id);
int hashVal = hashFunction(key);
int blockInd = hashTbl[hashVal];
Record temp = null;
try
{
Record readFile = new Record();
file.seek(blockInd * blockLength);
readFile.read(file);
for( int j = 0 ; j < blockRecs * 2; j++)
{
if( readFile.getId().equals(id))
{
temp = readFile;
file.seek(file.getFilePointer() - 40);
DELETED.write(file);
blockCounter[blockInd]--;
return temp;
}
readFile.read(file);
}
}
catch(IOException ioe){}
return null;
}
public Record find(RandomAccessFile file, String id)
{
int key = Integer.parseInt(id);
int hashVal = hashFunction(key);
int blockInd = hashTbl[hashVal];
try
{
Record readFile = new Record();
file.seek(blockInd * blockLength);
readFile.read(file);
for ( int j = 0; j < blockRecs * 2 ; j++ )
{
if( readFile.getId().equals(id))
{
return readFile;
}
readFile.read(file);
}
}
catch(IOException ioe){}
return null;
}
public void fillHashTable()
{
Random rand = new Random();
int randNumb = 0;
boolean notUnique;
for(int i=0; i < hashTbl.length - 1; i++)
{
notUnique = true;
while(notUnique == true)
{
notUnique = false;
randNumb = rand.nextInt(hashTbl.length);
for( int j = 0; j<i; j++)
{
if(hashTbl[j] == randNumb)
notUnique = true;
}
}
hashTbl[i] = randNumb;
}
}
public int[] getBlockCounter()
{
return blockCounter;
}
public String getBlockRecsAmount()
{
String returner = "";
for(int j = 0 ; j < blockCounter.length ; j++)
{
returner += "Block"+j+ " : " + blockCounter[j] + "\n";
}
return returner;
}
}
| [
"jmccar16@oldwestbury.edu"
] | jmccar16@oldwestbury.edu |
b3a4df6348f11b692c1678bf351e7793a761f4f0 | 87810c583a6a4b0740564083663e361ede46b0a9 | /CRM/src/lw/web/action/SaleVisitAction.java | 4be3eacb28b590cba141ab817f3d88c4f886e778 | [] | no_license | linwu0909/CRM | d797d29c3092ee8287fd5e53a0a6648b1d426095 | c0e3a932ff5e513315792eb9a393b4c93c29a257 | refs/heads/master | 2020-07-31T22:34:41.443250 | 2019-09-25T07:00:41 | 2019-09-25T07:00:41 | 210,774,680 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,119 | java | package lw.web.action;
import java.util.Date;
import javax.annotation.Resource;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
import lw.domain.PageBean;
import lw.domain.SaleVisit;
import lw.service.SaleVisitService;
public class SaleVisitAction extends ActionSupport implements ModelDriven<SaleVisit> {
private SaleVisit saleVisit=new SaleVisit();
@Override
public SaleVisit getModel() {
return saleVisit;
}
//在Action中注入Service
@Resource(name="saleVisitService")
private SaleVisitService saleVisitService;
//接收分页数据
private Integer currPage=1;
private Integer pageSize=3;
public void setCurrPage(Integer currPage) {
if(currPage==null){
currPage=1;
}
this.currPage = currPage;
}
public void setPageSize(Integer pageSize) {
if(pageSize==null){
pageSize=3;
}
this.pageSize = pageSize;
}
public String findAll(){
//创建离线查询对象
DetachedCriteria detachedCriteria=DetachedCriteria.forClass(SaleVisit.class);
//设置条件
if(saleVisit.getVisit_time()!=null){
detachedCriteria.add(Restrictions.ge("visit_time", saleVisit.getVisit_time()));
}
if(visit_end_time!=null){
detachedCriteria.add(Restrictions.le("visit_time", visit_end_time));
}
//调用业务层
PageBean<SaleVisit> pageBean=saleVisitService.findByPage(detachedCriteria,currPage,pageSize);
//存入到值栈
ActionContext.getContext().getValueStack().push(pageBean);
return "findAll";
}
/**
* 拜访记录跳转到添加页面的方法
* @return
*/
public String saveUI(){
return "saveUI";
}
/**
* 保存客户拜访记录的方法
*/
public String save(){
//调用业务层
saleVisitService.save(saleVisit);
return "saveSuccess";
}
//接收数据
private Date visit_end_time;
public void setVisit_end_time(Date visit_end_time) {
this.visit_end_time = visit_end_time;
}
public Date getVisit_end_time() {
return visit_end_time;
}
}
| [
"541814469@qq.com"
] | 541814469@qq.com |
f453017a500e2e72e3270ea8481ba202c7c1f514 | 4489f1f428d94df4c53b01bd520b0ee06b5612e3 | /OQueVoceProcura-Bean/src/main/java/br/ufrn/imd/util/OpcaoSelect.java | 8fbcdf46aa8ab5676c350f0e81a97eb05f69be60 | [] | no_license | samueldbatista/OQueVocePerdeu | ff844871b28dc98bb04297c2d1930f1f1345c883 | 4e91a328166bd9ca3301088840aedbab12f90289 | refs/heads/master | 2020-03-21T14:56:28.645064 | 2018-06-26T18:56:44 | 2018-06-26T18:56:44 | 138,684,537 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 601 | java | package br.ufrn.imd.util;
import br.ufrn.imd.dominio.Perfil;
import java.util.ArrayList;
import java.util.List;
public class OpcaoSelect {
private int id;
private String chave;
private String valor;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getChave() {
return chave;
}
public void setChave(String chave) {
this.chave = chave;
}
public String getValor() {
return valor;
}
public void setValor(String valor) {
this.valor = valor;
}
}
| [
"samueldantas7@hotmail.com"
] | samueldantas7@hotmail.com |
6bb87769f68ef2b5b621c6a7520609cf8a42c6aa | c8ba315c6bc3b56c7b77f93f955c10888129beaa | /src/CryptogramGame/QuoteList.java | 07303078648dbc66c6d81d322e27e07b540af5e1 | [] | no_license | kmill/CryptogramGame | b492fd9bed21bb7eb0d41d3f2d78c00ae55eb631 | 05b2f685877632a60b84af91734dae44f011a3a1 | refs/heads/master | 2021-01-18T17:13:34.745653 | 2016-05-25T19:05:13 | 2016-05-25T19:05:13 | 59,690,114 | 0 | 0 | null | 2016-05-25T19:03:20 | 2016-05-25T19:03:20 | null | UTF-8 | Java | false | false | 651 | java | package CryptogramGame;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Scanner;
public class QuoteList {
private ArrayList<Cryptogram> quotes;
public QuoteList() throws FileNotFoundException {
Scanner in = new Scanner(new File("quotes.txt"));
this.quotes = new ArrayList<Cryptogram>();
while (in.hasNext()) {
this.quotes.add(new Cryptogram(in.nextLine()));
}
}
public Cryptogram getRandomQuote() {
int rand = (int) (Math.random() * this.quotes.size());
return this.quotes.get(rand);
}
public ArrayList<Cryptogram> getQuotes() {
return this.quotes;
}
}
| [
"90310192@hs-62348-macair.ad.edenpr.org"
] | 90310192@hs-62348-macair.ad.edenpr.org |
151b2c2b2e3727a3e0f09a0de78c50fefbf699b5 | 3bbc76ba8b88899eee1908dd1c87ad431ef21a3c | /azure-mgmt-appservice/src/main/java/com/microsoft/azure/management/appservice/implementation/AppSettingImpl.java | 9f18b7f5933aad5c4bfba3fd7dae2020e8aa0791 | [
"MIT"
] | permissive | rsbth/azure-sdk-for-java | b937c21e91480401348cda6d5d7b025c3fbc306a | a5358dd58b629e3443399b76823ae72315c8b0f8 | refs/heads/master | 2020-06-09T08:28:21.573111 | 2016-12-09T01:28:41 | 2016-12-09T01:28:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 954 | java | /**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*/
package com.microsoft.azure.management.appservice.implementation;
import com.microsoft.azure.management.apigeneration.LangDefinition;
import com.microsoft.azure.management.appservice.AppSetting;
/**
* An immutable client-side representation of an app setting on a web app.
*/
@LangDefinition
class AppSettingImpl implements AppSetting {
private String key;
private String value;
private boolean sticky;
AppSettingImpl(String key, String value, boolean sticky) {
this.key = key;
this.value = value;
this.sticky = sticky;
}
@Override
public String key() {
return key;
}
@Override
public String value() {
return value;
}
@Override
public boolean sticky() {
return sticky;
}
}
| [
"jianghaolu@users.noreply.github.com"
] | jianghaolu@users.noreply.github.com |
8311094ae361415b652a69455bf8187180037fb0 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/10/10_b253a54bc90b0d8489af7a217f747c629bde91f3/CDIExtension/10_b253a54bc90b0d8489af7a217f747c629bde91f3_CDIExtension_t.java | e5bdf1a8a63a0c49c9b30e75daf9d190f81d231a | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 45,583 | java | /*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can
* obtain a copy of the License at
* https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
* or packager/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at packager/legal/LICENSE.txt.
*
* GPL Classpath Exception:
* Oracle designates this particular file as subject to the "Classpath"
* exception as provided by Oracle in the GPL Version 2 section of the License
* file that accompanied this code.
*
* Modifications:
* If applicable, add the following below the License Header, with the fields
* enclosed by brackets [] replaced by your own identifying information:
* "Portions Copyright [year] [name of copyright owner]"
*
* Contributor(s):
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package com.sun.jersey.server.impl.cdi;
import com.sun.jersey.api.container.ContainerException;
import com.sun.jersey.api.core.ExtendedUriInfo;
import com.sun.jersey.api.core.HttpContext;
import com.sun.jersey.api.core.HttpRequestContext;
import com.sun.jersey.api.core.HttpResponseContext;
import com.sun.jersey.api.core.ResourceConfig;
import com.sun.jersey.api.core.ResourceContext;
import com.sun.jersey.api.model.Parameter;
import com.sun.jersey.core.spi.component.ComponentScope;
import com.sun.jersey.core.util.FeaturesAndProperties;
import com.sun.jersey.server.impl.InitialContextHelper;
import com.sun.jersey.server.impl.inject.AbstractHttpContextInjectable;
import com.sun.jersey.spi.MessageBodyWorkers;
import com.sun.jersey.spi.container.ExceptionMapperContext;
import com.sun.jersey.spi.container.WebApplication;
import com.sun.jersey.spi.inject.Injectable;
import java.lang.annotation.Annotation;
import java.lang.reflect.Array;
import java.lang.reflect.GenericArrayType;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Logger;
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.event.Observes;
import javax.enterprise.inject.Produces;
import javax.enterprise.inject.spi.AfterBeanDiscovery;
import javax.enterprise.inject.spi.AnnotatedCallable;
import javax.enterprise.inject.spi.AnnotatedConstructor;
import javax.enterprise.inject.spi.AnnotatedField;
import javax.enterprise.inject.spi.AnnotatedMethod;
import javax.enterprise.inject.spi.AnnotatedParameter;
import javax.enterprise.inject.spi.AnnotatedType;
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.BeforeBeanDiscovery;
import javax.enterprise.inject.spi.Extension;
import javax.enterprise.inject.spi.InjectionPoint;
import javax.enterprise.inject.spi.ProcessAnnotatedType;
import javax.enterprise.inject.spi.ProcessInjectionTarget;
import javax.enterprise.inject.spi.ProcessManagedBean;
import javax.enterprise.util.AnnotationLiteral;
import javax.inject.Inject;
import javax.inject.Provider;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.servlet.ServletContext;
import javax.ws.rs.CookieParam;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.Encoded;
import javax.ws.rs.FormParam;
import javax.ws.rs.HeaderParam;
import javax.ws.rs.MatrixParam;
import javax.ws.rs.PathParam;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Application;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.Request;
import javax.ws.rs.core.SecurityContext;
import javax.ws.rs.core.UriInfo;
import javax.ws.rs.ext.Providers;
/**
*
* @author robc
*/
public class CDIExtension implements Extension {
private static final Logger LOGGER = Logger.getLogger(CDIExtension.class.getName());
private static class ContextAnnotationLiteral extends AnnotationLiteral<Context> implements Context {};
private final Context contextAnnotationLiteral = new ContextAnnotationLiteral();
private static class InjectAnnotationLiteral extends AnnotationLiteral<Inject> implements Inject {};
private final Inject injectAnnotationLiteral = new InjectAnnotationLiteral();
private static class SyntheticQualifierAnnotationImpl extends AnnotationLiteral<SyntheticQualifier> implements SyntheticQualifier {
private int value;
public SyntheticQualifierAnnotationImpl(int value) {
this.value = value;
}
public int value() {
return value;
}
}
private WebApplication webApplication;
private ResourceConfig resourceConfig;
private Set<Class<? extends Annotation>> knownParameterQualifiers;
private Set<Class<?>> staticallyDefinedContextBeans;
private Map<Class<? extends Annotation>, Parameter.Source> paramQualifiersMap;
private Map<Class<? extends Annotation>, Set<DiscoveredParameter>> discoveredParameterMap;
private Map<DiscoveredParameter, SyntheticQualifier> syntheticQualifierMap;
private int nextSyntheticQualifierValue = 0;
private List<InitializedLater> toBeInitializedLater;
private static String JNDI_CDIEXTENSION_NAME = "/com.sun.jersey.config/CDIExtension";
/*
* Setting this system property to "true" will force use of the BeanManager to look up the bean for the active CDIExtension,
* rather than going through a thread local.
*/
private static final String LOOKUP_EXTENSION_IN_BEAN_MANAGER_SYSTEM_PROPERTY = "com.sun.jersey.server.impl.cdi.lookupExtensionInBeanManager";
public static final boolean lookupExtensionInBeanManager = getLookupExtensionInBeanManager();
private static boolean getLookupExtensionInBeanManager() {
return Boolean.parseBoolean(System.getProperty(LOOKUP_EXTENSION_IN_BEAN_MANAGER_SYSTEM_PROPERTY, "false"));
}
/*
* Returns the instance of CDIExtension that was initialized previously in this same thread, if any.
*/
public static CDIExtension getInitializedExtension() {
try {
InitialContext ic = InitialContextHelper.getInitialContext();
if (ic == null) {
throw new RuntimeException();
}
return (CDIExtension)ic.lookup(JNDI_CDIEXTENSION_NAME);
} catch (NamingException ex) {
throw new RuntimeException(ex);
}
}
public CDIExtension() {}
private void initialize() {
// initialize in a separate method because Weld creates a proxy for the extension
// and we don't want to waste time initializing it
// workaround for Weld proxy bug
if (!lookupExtensionInBeanManager) {
try {
InitialContext ic = InitialContextHelper.getInitialContext();
if (ic != null) {
ic.rebind(JNDI_CDIEXTENSION_NAME, this);
}
} catch (NamingException ex) {
throw new RuntimeException(ex);
}
}
// annotations to be turned into qualifiers
Set<Class<? extends Annotation>> set = new HashSet<Class<? extends Annotation>>();
set.add(CookieParam.class);
set.add(FormParam.class);
set.add(HeaderParam.class);
set.add(MatrixParam.class);
set.add(PathParam.class);
set.add(QueryParam.class);
set.add(Context.class);
knownParameterQualifiers = Collections.unmodifiableSet(set);
// used to map a qualifier to a Parameter.Source
Map<Class<? extends Annotation>, Parameter.Source> map = new HashMap<Class<? extends Annotation>, Parameter.Source>();
map.put(CookieParam.class,Parameter.Source.COOKIE);
map.put(FormParam.class,Parameter.Source.FORM);
map.put(HeaderParam.class,Parameter.Source.HEADER);
map.put(MatrixParam.class,Parameter.Source.MATRIX);
map.put(PathParam.class,Parameter.Source.PATH);
map.put(QueryParam.class,Parameter.Source.QUERY);
map.put(Context.class,Parameter.Source.CONTEXT);
paramQualifiersMap = Collections.unmodifiableMap(map);
// pre-defined contextual types
Set<Class<?>> set3 = new HashSet<Class<?>>();
// standard types
set3.add(Application.class);
set3.add(HttpHeaders.class);
set3.add(Providers.class);
set3.add(Request.class);
set3.add(SecurityContext.class);
set3.add(UriInfo.class);
// Jersey extensions
set3.add(ExceptionMapperContext.class);
set3.add(ExtendedUriInfo.class);
set3.add(FeaturesAndProperties.class);
set3.add(HttpContext.class);
set3.add(HttpRequestContext.class);
set3.add(HttpResponseContext.class);
set3.add(MessageBodyWorkers.class);
set3.add(ResourceContext.class);
set3.add(WebApplication.class);
staticallyDefinedContextBeans = Collections.unmodifiableSet(set3);
// tracks all discovered parameters
Map<Class<? extends Annotation>, Set<DiscoveredParameter>> map2 = new HashMap<Class<? extends Annotation>, Set<DiscoveredParameter>>();
for (Class<? extends Annotation> qualifier : knownParameterQualifiers) {
map2.put(qualifier, new HashSet<DiscoveredParameter>());
}
discoveredParameterMap = Collections.unmodifiableMap(map2);
// tracks the synthetic qualifiers we have to create to handle a specific
// combination of JAX-RS injection annotation + default value + encoded
syntheticQualifierMap = new HashMap<DiscoveredParameter, SyntheticQualifier>();
// things to do in a second time, i.e. once Jersey has been initialized,
// as opposed to when CDI delivers the SPI events to its extensions
toBeInitializedLater = new ArrayList<InitializedLater>();
}
void beforeBeanDiscovery(@Observes BeforeBeanDiscovery event) {
LOGGER.fine("Handling BeforeBeanDiscovery event");
initialize();
// turn JAX-RS injection annotations into CDI qualifiers
for (Class<? extends Annotation> qualifier : knownParameterQualifiers) {
event.addQualifier(qualifier);
}
}
/*
* Holds information on one site (constructor/method argument or field) to be patched.
*/
private static class PatchInformation {
private DiscoveredParameter parameter;
private SyntheticQualifier syntheticQualifier;
private Annotation annotation;
private boolean mustAddInject;
public PatchInformation(DiscoveredParameter parameter, SyntheticQualifier syntheticQualifier, boolean mustAddInject) {
this(parameter, syntheticQualifier, null, mustAddInject);
}
public PatchInformation(DiscoveredParameter parameter, SyntheticQualifier syntheticQualifier, Annotation annotation, boolean mustAddInject) {
this.parameter = parameter;
this.syntheticQualifier = syntheticQualifier;
this.annotation = annotation;
this.mustAddInject = mustAddInject;
}
public DiscoveredParameter getParameter() {
return parameter;
}
public SyntheticQualifier getSyntheticQualifier() {
return syntheticQualifier;
}
public Annotation getAnnotation() {
return annotation;
}
public boolean mustAddInject() {
return mustAddInject;
}
}
<T> void processAnnotatedType(@Observes ProcessAnnotatedType<T> event) {
LOGGER.fine("Handling ProcessAnnotatedType event for " + event.getAnnotatedType().getJavaClass().getName());
AnnotatedType<T> type = event.getAnnotatedType();
/*
// only scan managed beans
if (!type.isAnnotationPresent(ManagedBean.class)) {
return;
}
// only scan root resource classes for now
if (!type.isAnnotationPresent(Path.class)) {
return;
}
*/
// first pass to determine if we need to patch any sites
// we also record any qualifiers with parameters we encounter
// so we can create beans for them later
// TODO - maybe we should detect cases in which the constructor selection
// rules in CDI and JAX-RS are in conflict -- CDI should win, but
// the result may surprise the user
boolean classHasEncodedAnnotation = type.isAnnotationPresent(Encoded.class);
Set<AnnotatedConstructor<T>> mustPatchConstructors = new HashSet<AnnotatedConstructor<T>>();
Map<AnnotatedParameter<T>, PatchInformation> parameterToPatchInfoMap = new HashMap<AnnotatedParameter<T>, PatchInformation>();
for (AnnotatedConstructor<T> constructor : type.getConstructors()) {
if (processAnnotatedConstructor(constructor, classHasEncodedAnnotation, parameterToPatchInfoMap)) {
mustPatchConstructors.add(constructor);
}
}
Set<AnnotatedField<T>> mustPatchFields = new HashSet<AnnotatedField<T>>();
Map<AnnotatedField<T>, PatchInformation> fieldToPatchInfoMap = new HashMap<AnnotatedField<T>, PatchInformation>();
outer:
for (AnnotatedField<? super T> field : type.getFields()) {
if (field.getDeclaringType() == type) {
if (processAnnotatedField((AnnotatedField<T>) field, classHasEncodedAnnotation, fieldToPatchInfoMap)) {
mustPatchFields.add((AnnotatedField<T>)field);
}
}
}
Set<AnnotatedMethod<T>> mustPatchMethods = new HashSet<AnnotatedMethod<T>>();
Set<AnnotatedMethod<T>> setterMethodsWithoutInject = new HashSet<AnnotatedMethod<T>>();
for (AnnotatedMethod<? super T> method : type.getMethods()) {
if (method.getDeclaringType() == type) {
if (processAnnotatedMethod((AnnotatedMethod<T>)method, classHasEncodedAnnotation, parameterToPatchInfoMap, setterMethodsWithoutInject)) {
mustPatchMethods.add((AnnotatedMethod<T>)method);
}
}
}
boolean typeNeedsPatching = !(mustPatchConstructors.isEmpty() && mustPatchFields.isEmpty() && mustPatchMethods.isEmpty());
// second pass
if (typeNeedsPatching) {
AnnotatedTypeImpl<T> newType = new AnnotatedTypeImpl(type);
Set<AnnotatedConstructor<T>> newConstructors = new HashSet<AnnotatedConstructor<T>>();
for (AnnotatedConstructor<T> constructor : type.getConstructors()) {
AnnotatedConstructorImpl<T> newConstructor = new AnnotatedConstructorImpl(constructor, newType);
if (mustPatchConstructors.contains(constructor)) {
patchAnnotatedCallable(constructor, newConstructor, parameterToPatchInfoMap);
}
else {
copyParametersOfAnnotatedCallable(constructor, newConstructor);
}
newConstructors.add(newConstructor);
}
Set<AnnotatedField<? super T>> newFields = new HashSet<AnnotatedField<? super T>>();
for (AnnotatedField<? super T> field : type.getFields()) {
if (field.getDeclaringType() == type) {
if (mustPatchFields.contains((AnnotatedField<T>)field)) {
PatchInformation patchInfo = fieldToPatchInfoMap.get((AnnotatedField<T>)field);
Set<Annotation> annotations = new HashSet<Annotation>();
if (patchInfo.mustAddInject()) {
annotations.add(injectAnnotationLiteral);
}
if (patchInfo.getSyntheticQualifier() != null) {
annotations.add(patchInfo.getSyntheticQualifier());
Annotation skippedQualifier = patchInfo.getParameter().getAnnotation();
for (Annotation annotation : field.getAnnotations()) {
if (annotation != skippedQualifier) {
annotations.add(annotation);
}
}
}
else {
annotations.addAll(field.getAnnotations());
}
if (patchInfo.getAnnotation() != null) {
annotations.add(patchInfo.getAnnotation());
}
newFields.add(new AnnotatedFieldImpl<T>(field, annotations, newType));
}
else {
// copy and reparent
newFields.add(new AnnotatedFieldImpl<T>(field, newType));
}
}
else {
// simple copy
newFields.add(field);
}
}
Set<AnnotatedMethod<? super T>> newMethods = new HashSet<AnnotatedMethod<? super T>>();
for (AnnotatedMethod<? super T> method : type.getMethods()) {
if (method.getDeclaringType() == type) {
if (mustPatchMethods.contains((AnnotatedMethod<T>)method)) {
if (setterMethodsWithoutInject.contains((AnnotatedMethod<T>)method)) {
Set<Annotation> annotations = new HashSet<Annotation>();
annotations.add(injectAnnotationLiteral);
for (Annotation annotation : method.getAnnotations()) {
if (!knownParameterQualifiers.contains(annotation.annotationType())) {
annotations.add(annotation);
}
}
AnnotatedMethodImpl<T> newMethod = new AnnotatedMethodImpl<T>(method, annotations, newType);
patchAnnotatedCallable((AnnotatedMethod<T>)method, newMethod, parameterToPatchInfoMap);
newMethods.add(newMethod);
}
else {
AnnotatedMethodImpl<T> newMethod = new AnnotatedMethodImpl<T>(method, newType);
patchAnnotatedCallable((AnnotatedMethod<T>)method, newMethod, parameterToPatchInfoMap);
newMethods.add(newMethod);
}
}
else {
AnnotatedMethodImpl<T> newMethod = new AnnotatedMethodImpl<T>(method, newType);
copyParametersOfAnnotatedCallable((AnnotatedMethod<T>)method, newMethod);
newMethods.add(newMethod);
}
}
else {
// simple copy
newMethods.add(method);
}
}
newType.setConstructors(newConstructors);
newType.setFields(newFields);
newType.setMethods(newMethods);
event.setAnnotatedType(newType);
LOGGER.fine(" replaced annotated type for " + type.getJavaClass());
}
}
private <T> boolean processAnnotatedConstructor(AnnotatedConstructor<T> constructor,
boolean classHasEncodedAnnotation,
Map<AnnotatedParameter<T>, PatchInformation> parameterToPatchInfoMap) {
boolean mustPatch = false;
if (constructor.getAnnotation(Inject.class) != null) {
boolean methodHasEncodedAnnotation = constructor.isAnnotationPresent(Encoded.class);
for (AnnotatedParameter<T> parameter : constructor.getParameters()) {
for (Annotation annotation : parameter.getAnnotations()) {
Set<DiscoveredParameter> discovered = discoveredParameterMap.get(annotation.annotationType());
if (discovered != null) {
if (knownParameterQualifiers.contains(annotation.annotationType())) {
if (methodHasEncodedAnnotation ||
classHasEncodedAnnotation ||
parameter.isAnnotationPresent(DefaultValue.class)) {
mustPatch = true;
}
boolean encoded = parameter.isAnnotationPresent(Encoded.class) || methodHasEncodedAnnotation || classHasEncodedAnnotation;
DefaultValue defaultValue = parameter.getAnnotation(DefaultValue.class);
if (defaultValue != null) {
mustPatch = true;
}
DiscoveredParameter jerseyParameter = new DiscoveredParameter(annotation, parameter.getBaseType(), defaultValue, encoded);
discovered.add(jerseyParameter);
LOGGER.fine(" recorded " + jerseyParameter);
parameterToPatchInfoMap.put(parameter, new PatchInformation(jerseyParameter, getSyntheticQualifierFor(jerseyParameter), false));
}
}
}
}
}
return mustPatch;
}
private <T> boolean processAnnotatedMethod(AnnotatedMethod<T> method,
boolean classHasEncodedAnnotation,
Map<AnnotatedParameter<T>, PatchInformation> parameterToPatchInfoMap,
Set<AnnotatedMethod<T>> setterMethodsWithoutInject) {
boolean mustPatch = false;
if (method.getAnnotation(Inject.class) != null) {
// a method already annotated with @Inject -- we assume the user is
// aware of CDI and all we need to do is to detect the need for
// a synthetic qualifier so as to take @DefaultValue and @Encoded into
// account
boolean methodHasEncodedAnnotation = method.isAnnotationPresent(Encoded.class);
for (AnnotatedParameter<T> parameter : method.getParameters()) {
for (Annotation annotation : parameter.getAnnotations()) {
Set<DiscoveredParameter> discovered = discoveredParameterMap.get(annotation.annotationType());
if (discovered != null) {
if (knownParameterQualifiers.contains(annotation.annotationType())) {
if (methodHasEncodedAnnotation ||
classHasEncodedAnnotation ||
parameter.isAnnotationPresent(DefaultValue.class)) {
mustPatch = true;
}
boolean encoded = parameter.isAnnotationPresent(Encoded.class) || methodHasEncodedAnnotation || classHasEncodedAnnotation;
DefaultValue defaultValue = parameter.getAnnotation(DefaultValue.class);
if (defaultValue != null) {
mustPatch = true;
}
DiscoveredParameter jerseyParameter = new DiscoveredParameter(annotation, parameter.getBaseType(), defaultValue, encoded);
discovered.add(jerseyParameter);
LOGGER.fine(" recorded " + jerseyParameter);
parameterToPatchInfoMap.put(parameter, new PatchInformation(jerseyParameter, getSyntheticQualifierFor(jerseyParameter), false));
}
}
}
}
}
else {
// a method *not* annotated with @Inject -- here we only deal with
// setter methods with a JAX-RS "qualifier" (Context, QueryParam, etc.)
// on the method itself
if (isSetterMethod(method)) {
boolean methodHasEncodedAnnotation = method.isAnnotationPresent(Encoded.class);
for (Annotation annotation : method.getAnnotations()) {
Set<DiscoveredParameter> discovered = discoveredParameterMap.get(annotation.annotationType());
if (discovered != null) {
if (knownParameterQualifiers.contains(annotation.annotationType())) {
mustPatch = true;
setterMethodsWithoutInject.add(method);
for (AnnotatedParameter<T> parameter : method.getParameters()) {
boolean encoded = parameter.isAnnotationPresent(Encoded.class) || methodHasEncodedAnnotation || classHasEncodedAnnotation;
DefaultValue defaultValue = parameter.getAnnotation(DefaultValue.class);
if (defaultValue == null) {
defaultValue = method.getAnnotation(DefaultValue.class);
}
DiscoveredParameter jerseyParameter = new DiscoveredParameter(annotation, parameter.getBaseType(), defaultValue, encoded);
discovered.add(jerseyParameter);
LOGGER.fine(" recorded " + jerseyParameter);
SyntheticQualifier syntheticQualifier = getSyntheticQualifierFor(jerseyParameter);
// if there is no synthetic qualifier, add to the parameter the annotation that was on the method itself
Annotation addedAnnotation = syntheticQualifier == null ? annotation : null;
parameterToPatchInfoMap.put(parameter, new PatchInformation(jerseyParameter, syntheticQualifier, addedAnnotation, false));
}
break;
}
}
}
}
}
return mustPatch;
}
private <T> boolean isSetterMethod(AnnotatedMethod<T> method) {
Method javaMethod = method.getJavaMember();
if ((javaMethod.getModifiers() & Modifier.PUBLIC) != 0 &&
(javaMethod.getReturnType() == Void.TYPE) &&
(javaMethod.getName().startsWith("set"))) {
List<AnnotatedParameter<T>> parameters = method.getParameters();
if (parameters.size() == 1) {
return true;
}
}
return false;
}
private <T> boolean processAnnotatedField(AnnotatedField<T> field,
boolean classHasEncodedAnnotation,
Map<AnnotatedField<T>, PatchInformation> fieldToPatchInfoMap) {
boolean mustPatch = false;
for (Annotation annotation : field.getAnnotations()) {
if (knownParameterQualifiers.contains(annotation.annotationType())) {
boolean mustAddInjectAnnotation = !field.isAnnotationPresent(Inject.class);
if (field.isAnnotationPresent(Encoded.class) ||
classHasEncodedAnnotation ||
mustAddInjectAnnotation ||
field.isAnnotationPresent(DefaultValue.class)) {
mustPatch = true;
}
Set<DiscoveredParameter> discovered = discoveredParameterMap.get(annotation.annotationType());
if (discovered != null) {
boolean encoded = field.isAnnotationPresent(Encoded.class) || classHasEncodedAnnotation;
DefaultValue defaultValue = field.getAnnotation(DefaultValue.class);
DiscoveredParameter parameter = new DiscoveredParameter(annotation, field.getBaseType(), defaultValue, encoded);
discovered.add(parameter);
LOGGER.fine(" recorded " + parameter);
fieldToPatchInfoMap.put(field, new PatchInformation(parameter, getSyntheticQualifierFor(parameter), mustAddInjectAnnotation));
}
}
}
return mustPatch;
}
private <T> void patchAnnotatedCallable(AnnotatedCallable<T> callable,
AnnotatedCallableImpl<T> newCallable,
Map<AnnotatedParameter<T>, PatchInformation> parameterToPatchInfoMap) {
List<AnnotatedParameter<T>> newParams = new ArrayList<AnnotatedParameter<T>>();
for (AnnotatedParameter<T> parameter : callable.getParameters()) {
PatchInformation patchInfo = parameterToPatchInfoMap.get(parameter);
if (patchInfo != null) {
Set<Annotation> annotations = new HashSet<Annotation>();
// in reality, this cannot happen
if (patchInfo.mustAddInject()) {
annotations.add(injectAnnotationLiteral);
}
if (patchInfo.getSyntheticQualifier() != null) {
annotations.add(patchInfo.getSyntheticQualifier());
Annotation skippedQualifier = patchInfo.getParameter().getAnnotation();
for (Annotation annotation : parameter.getAnnotations()) {
if (annotation != skippedQualifier) {
annotations.add(annotation);
}
}
}
else {
annotations.addAll(parameter.getAnnotations());
}
if (patchInfo.getAnnotation() != null) {
annotations.add(patchInfo.getAnnotation());
}
newParams.add(new AnnotatedParameterImpl<T>(parameter, annotations, callable));
}
else {
newParams.add(new AnnotatedParameterImpl<T>(parameter, newCallable));
}
}
newCallable.setParameters(newParams);
}
private <T> void copyParametersOfAnnotatedCallable(AnnotatedCallable<T> callable, AnnotatedCallableImpl<T> newCallable) {
// copy and reparent all the parameters
List<AnnotatedParameter<T>> newParams = new ArrayList<AnnotatedParameter<T>>();
for (AnnotatedParameter<T> parameter : callable.getParameters()) {
newParams.add(new AnnotatedParameterImpl<T>(parameter, newCallable));
}
newCallable.setParameters(newParams);
}
private SyntheticQualifier getSyntheticQualifierFor(DiscoveredParameter parameter) {
SyntheticQualifier result = syntheticQualifierMap.get(parameter);
if (result == null) {
// only create a synthetic qualifier if we're dealing with @DefaultValue
// or @Encoded; this way the application can still use vanilla param
// annotations as qualifiers
if (parameter.isEncoded() || parameter.getDefaultValue() != null) {
result = new SyntheticQualifierAnnotationImpl(nextSyntheticQualifierValue++);
syntheticQualifierMap.put(parameter, result);
LOGGER.fine(" created synthetic qualifier " + result);
}
}
return result;
}
// taken from ReflectionHelper
private static Class getClassOfType(Type type) {
if (type instanceof Class) {
return (Class)type;
} else if (type instanceof GenericArrayType) {
GenericArrayType arrayType = (GenericArrayType)type;
Type t = arrayType.getGenericComponentType();
if (t instanceof Class) {
Class c = (Class)t;
try {
// TODO is there a better way to get the Class object
// representing an array
Object o = Array.newInstance(c, 0);
return o.getClass();
} catch (Exception e) {
throw new IllegalArgumentException(e);
}
}
} else if (type instanceof ParameterizedType) {
ParameterizedType subType = (ParameterizedType)type;
Type t = subType.getRawType();
if (t instanceof Class) {
return (Class)t;
}
}
return null;
}
<T> void processInjectionTarget(@Observes ProcessInjectionTarget<T> event) {
LOGGER.fine("Handling ProcessInjectionTarget event for " + event.getAnnotatedType().getJavaClass().getName());
}
/*
void processBean(@Observes ProcessBean<?> event) {
LOGGER.fine("Handling ProcessBean event for " + event.getBean().getBeanClass().getName());
}
*/
void processManagedBean(@Observes ProcessManagedBean<?> event) {
LOGGER.fine("Handling ProcessManagedBean event for " + event.getBean().getBeanClass().getName());
// TODO - here we should check that all the rules have been followed
// and call addDefinitionError for each problem we encountered
Bean<?> bean = event.getBean();
for (InjectionPoint injectionPoint : bean.getInjectionPoints()) {
StringBuilder sb = new StringBuilder();
sb.append(" found injection point ");
sb.append(injectionPoint.getType());
for (Annotation annotation : injectionPoint.getQualifiers()) {
sb.append(" ");
sb.append(annotation);
}
LOGGER.fine(sb.toString());
}
}
void afterBeanDiscovery(@Observes AfterBeanDiscovery event) {
LOGGER.fine("Handling AfterBeanDiscovery event");
addPredefinedContextBeans(event);
// finally define beans for all qualifiers we discovered
BeanGenerator beanGenerator = new BeanGenerator("com/sun/jersey/server/impl/cdi/generated/Bean");
for (Map.Entry<Class<? extends Annotation>, Set<DiscoveredParameter>> entry : discoveredParameterMap.entrySet()) {
Class<? extends Annotation> qualifier = entry.getKey();
for (DiscoveredParameter parameter : entry.getValue()) {
Annotation annotation = parameter.getAnnotation();
Class<?> klass = getClassOfType(parameter.getType());
if (annotation.annotationType() == Context.class &&
staticallyDefinedContextBeans.contains(klass) &&
!parameter.isEncoded() &&
parameter.getDefaultValue() == null) {
continue;
}
SyntheticQualifier syntheticQualifier = syntheticQualifierMap.get(parameter);
Annotation theQualifier = syntheticQualifier != null ? syntheticQualifier : annotation;
Set<Annotation> annotations = new HashSet<Annotation>();
annotations.add(theQualifier);
// TODO - here we pass a single annotation as the second argument,
// i.e. the qualifier itself, but to be true to Jersey semantics we
// should pass in all the annotations that were on the original program
// element.
// The problem here is that (1) we don't have the original program
// element any more and (2) a single DiscoveredParameter may have
// been encountered in multiple places with different annotations
Parameter jerseyParameter = new Parameter(
new Annotation[]{ annotation },
annotation,
paramQualifiersMap.get(annotation.annotationType()),
parameter.getValue(),
parameter.getType(),
klass,
parameter.isEncoded(),
(parameter.getDefaultValue() == null ? null : parameter.getDefaultValue().value()));
Class<?> beanClass = beanGenerator.createBeanClass();
ParameterBean bean = new ParameterBean(beanClass, parameter.getType(), annotations, parameter, jerseyParameter);
toBeInitializedLater.add(bean);
event.addBean(bean);
LOGGER.fine("Added bean for parameter " + parameter + " and qualifier " + theQualifier);
}
}
}
/*
* Adds a CDI bean for each @Context type we support out of the box
*/
private void addPredefinedContextBeans(AfterBeanDiscovery event) {
// all standard types first
// @Context Application
event.addBean(new PredefinedBean<Application>(Application.class, contextAnnotationLiteral));
// @Context HttpHeaders
event.addBean(new PredefinedBean<HttpHeaders>(HttpHeaders.class, contextAnnotationLiteral));
// @Context Providers
event.addBean(new PredefinedBean<Providers>(Providers.class, contextAnnotationLiteral));
// @Context Request
event.addBean(new PredefinedBean<Request>(Request.class, contextAnnotationLiteral));
// @Context SecurityContext
event.addBean(new PredefinedBean<SecurityContext>(SecurityContext.class, contextAnnotationLiteral));
// @Context UriInfo
event.addBean(new PredefinedBean<UriInfo>(UriInfo.class, contextAnnotationLiteral));
// now the Jersey extensions
// @Context ExceptionMapperContext
event.addBean(new PredefinedBean<ExceptionMapperContext>(ExceptionMapperContext.class, contextAnnotationLiteral));
// @Context ExtendedUriInfo
event.addBean(new PredefinedBean<ExtendedUriInfo>(ExtendedUriInfo.class, contextAnnotationLiteral));
// @Context FeaturesAndProperties
event.addBean(new PredefinedBean<FeaturesAndProperties>(FeaturesAndProperties.class, contextAnnotationLiteral));
// @Context HttpContext
event.addBean(new PredefinedBean<HttpContext>(HttpContext.class, contextAnnotationLiteral));
// @Context HttpRequestContext
event.addBean(new PredefinedBean<HttpRequestContext>(HttpRequestContext.class, contextAnnotationLiteral));
// @Context HttpResponseContext
event.addBean(new PredefinedBean<HttpResponseContext>(HttpResponseContext.class, contextAnnotationLiteral));
// @Context MessageBodyWorkers
event.addBean(new PredefinedBean<MessageBodyWorkers>(MessageBodyWorkers.class, contextAnnotationLiteral));
// @Context ResourceContext
event.addBean(new PredefinedBean<ResourceContext>(ResourceContext.class, contextAnnotationLiteral));
// @Context WebApplication
event.addBean(new ProviderBasedBean<WebApplication>(WebApplication.class, new Provider<WebApplication>() {
public WebApplication get() {
return webApplication;
}
}, contextAnnotationLiteral));
}
void setWebApplication(WebApplication wa) {
webApplication = wa;
}
WebApplication getWebApplication() {
return webApplication;
}
void setResourceConfig(ResourceConfig rc) {
resourceConfig = rc;
}
ResourceConfig getResourceConfig() {
return resourceConfig;
}
/*
* Called after the WebApplication and ResourceConfig have been set,
* i.e. when Jersey is in a somewhat initialized state.
*
* By contrast, all the CDI driven code earlier in this source file
* runs before Jersey gets a chance to initialize itself.
*/
void lateInitialize() {
try {
for (InitializedLater object : toBeInitializedLater) {
object.later();
}
}
finally {
// clear the JNDI reference as soon as possible
if (!lookupExtensionInBeanManager) {
try {
InitialContext ic = InitialContextHelper.getInitialContext();
if (ic != null) {
ic.unbind(JNDI_CDIEXTENSION_NAME);
}
} catch (NamingException ex) {
throw new RuntimeException(ex);
}
}
}
}
/*
* Constructs an object by delegating to the ServerInjectableProviderFactory of the WebApplication
*/
class PredefinedBean<T> extends AbstractBean<T> {
private Annotation qualifier;
public PredefinedBean(Class<T> klass, Annotation qualifier) {
super(klass, qualifier);
this.qualifier = qualifier;
}
@Override
public T create(CreationalContext<T> creationalContext) {
Injectable<T> injectable = webApplication.getServerInjectableProviderFactory().getInjectable(qualifier.annotationType(), null, qualifier, getBeanClass(), ComponentScope.Singleton);
return injectable.getValue();
}
}
/*
* Constructs an object by delegating to the Injectable for a Jersey parameter
*/
class ParameterBean<T> extends AbstractBean<T> implements InitializedLater {
private DiscoveredParameter discoveredParameter;
private Parameter parameter;
private Injectable<T> injectable;
public ParameterBean(Class<?> klass, Type type, Set<Annotation> qualifiers, DiscoveredParameter discoveredParameter, Parameter parameter) {
super(klass, type, qualifiers);
this.discoveredParameter = discoveredParameter;
this.parameter = parameter;
}
public void later() {
if (injectable != null) {
return;
}
boolean registered = webApplication.getServerInjectableProviderFactory().isParameterTypeRegistered(parameter);
if (!registered) {
throw new ContainerException("parameter type not registered " + discoveredParameter);
}
// TODO - here it just doesn't seem possible to remove the cast
injectable = (Injectable<T>) webApplication.getServerInjectableProviderFactory().getInjectable(parameter, ComponentScope.PerRequest);
if (injectable == null) {
throw new ContainerException("no injectable for parameter " + discoveredParameter);
}
}
@Override public T create(CreationalContext<T> creationalContext) {
if (injectable == null) {
later();
}
try {
return injectable.getValue();
}
catch (IllegalStateException e) {
if (injectable instanceof AbstractHttpContextInjectable) {
return (T)((AbstractHttpContextInjectable)injectable).getValue(webApplication.getThreadLocalHttpContext());
}
else {
throw e;
}
}
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
f8073430414cc0b2b79050c85a6fcd8b6a9c8c2b | 45ca1cf12d8fe7c0e670b63e9f3ec4988c7b35d6 | /app/src/main/java/ru/vital/daily/fragment/sheet/SocialSheetFragment.java | 272f2859b532ef4dcbb89e82430aed0b4b43b7f4 | [] | no_license | MadAxon/daily | 0c87a3de4928727926bbf0c31a183e98b242e82b | fc6e6fc78c257ebb0e4b01779ef5932f19329aac | refs/heads/master | 2020-08-03T16:45:15.197606 | 2019-11-05T06:08:08 | 2019-11-05T06:08:08 | 211,817,143 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,028 | java | package ru.vital.daily.fragment.sheet;
import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.lifecycle.ViewModelProviders;
import ru.vital.daily.BR;
import ru.vital.daily.R;
import ru.vital.daily.adapter.SocialSheetAdapter;
import ru.vital.daily.databinding.FragmentSocialSheetBinding;
import ru.vital.daily.view.model.SocialSheetViewModel;
public class SocialSheetFragment extends BaseSheetFragment<SocialSheetViewModel, FragmentSocialSheetBinding> {
@Override
protected SocialSheetViewModel onCreateViewModel() {
return ViewModelProviders.of(this).get(SocialSheetViewModel.class);
}
@Override
protected int getLayoutId() {
return R.layout.fragment_social_sheet;
}
@Override
protected int getVariable() {
return BR.viewModel;
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
dataBinding.setAdapter(new SocialSheetAdapter());
}
}
| [
"rusgoro@rambler.ru"
] | rusgoro@rambler.ru |
a46cc891d1520549c0612221e3530cfb803e1ef5 | 0753db154c98aa17d6b70fbc9a358a0bd9bcdaba | /src/SmirnoffRed.java | 872ef56c7a54138670ac87d00fa383d96bebf853 | [] | no_license | hrkalona/WWW-6th-Assignment | 58d2efd37fb0d951f95e2b44ac4d94917703e5d8 | 7e0a7ea0d4ec47f3134672902400d7fc7e6583ca | refs/heads/master | 2021-01-20T11:11:30.058641 | 2012-01-20T16:14:06 | 2012-01-20T16:14:06 | 3,227,637 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,480 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package LiquorStore;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
*
* @author hrkalona2
*/
public class SmirnoffRed {
private boolean flag;
private int quantity;
private HttpServletResponse response;
private HttpServletRequest request;
public SmirnoffRed() {
flag = false;
quantity = 0;
}
public int getQuantityint() {
if(flag == false) {
Cookie[] cookies = request.getCookies();
if(cookies != null) {
for(int i = 0; i < cookies.length; i++) {
Cookie cookie = cookies[i];
if(cookie.getName().equals("SmirnoffRed")) {
String users_basket = cookie.getValue();
quantity = Integer.parseInt(users_basket);
break;
}
}
}
}
flag = true;
return quantity;
}
public String getQuantity() {
if(flag == false) {
Cookie[] cookies = request.getCookies();
if(cookies != null) {
for(int i = 0; i < cookies.length; i++) {
Cookie cookie = cookies[i];
if(cookie.getName().equals("SmirnoffRed")) {
String users_basket = cookie.getValue();
quantity = Integer.parseInt(users_basket);
break;
}
}
}
}
flag = true;
return quantity == 0 ? "" : "" + quantity;
}
public void setResponse(HttpServletResponse response) {
this.response = response;
}
public void setRequest(HttpServletRequest request) {
this.request = request;
}
public void setQuantity(String squantity) {
try {
quantity = Integer.parseInt(squantity);
}
catch(NumberFormatException ex) {
quantity = 0;
}
Cookie cookie = new Cookie("SmirnoffRed", "" + quantity);
cookie.setMaxAge(60 * 60 * 60 * 60 * 60);
response.addCookie(cookie);
}
}
| [
"hrkalona@uth.gr"
] | hrkalona@uth.gr |
f7442937a9ff25f6420f47e31fb88ecf9a81f678 | 3efa70091bbf526b2efbea33586a47ad23692ed3 | /src/chap11/textbook/s110304/Member.java | 2f715fea6284ac51343eca958e13c2fe48c700f5 | [] | no_license | 2wonseok/java20200929 | 939b0a1f3fea5745618113e0ab7f100a134a1413 | 384c8a63094b10abc0c0eb82a4f99ffb9ff3f05d | refs/heads/master | 2023-01-06T22:11:35.043857 | 2020-11-03T01:49:19 | 2020-11-03T01:49:19 | 299,485,601 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 579 | java | package chap11.textbook.s110304;
public class Member implements Cloneable {
public String id;
public String name;
public String password;
public int age;
public boolean adult;
public Member(String id, String name, String password, int age, boolean adult) {
this.id = id;
this.name = name;
this.password = password;
this.age = age;
this.adult = adult;
}
public Member getMember() {
Member cloned = null;
try {
cloned = (Member) clone();
} catch (CloneNotSupportedException e) {
return cloned;
// e.printStackTrace();
}
return cloned;
}
}
| [
"lws3793@naver.com"
] | lws3793@naver.com |
a48b45e55879ca271e6af86a058269cef95d6612 | e465c4eb70f66d9d3d5e8718c1dd4522eccec177 | /main/java/com/stackroute/pe1/StringReverse.java | 19f53033fe4750637c9bc75805e20cd8a7c88f2f | [] | no_license | Sindhura-Majji/java-PE1 | 837a67cf9fef46bdf5b8a6c3c74a5ce6a506efee | 4f51ac9686fa50e3244feaf20912826252772c42 | refs/heads/master | 2020-06-11T17:44:48.749981 | 2019-07-04T02:23:57 | 2019-07-04T02:23:57 | 194,039,676 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 444 | java | package com.stackroute.pe1;
public class StringReverse
{
public String ReverseString( String original){
String reverse = "";
int length = original.length();
if(original == " ") {
reverse= "Empty String not allowed";
}
for (int i = length - 1 ; i >= 0 ; i--)
{
reverse = reverse + original.charAt(i);
}
return reverse.trim();
}
} | [
"sindhura.majji@gmail.com"
] | sindhura.majji@gmail.com |
09981f870f47c8b4df83103a842420467ea7ab24 | 504293c8c94c1874b9b67265a114fc39d9fbad57 | /springboot/springboot-validation/src/main/java/vip/xjdai/validation/increase/NotNullIncreaseValidator.java | 58593ee98d62b1f77a2048bb824c992aa3a57882 | [] | no_license | mrh167/Springboot | b57a3f28019776a272c09bed6919838c185600bc | b64e9453699cdbb595831b23085b7fef7deeaf04 | refs/heads/master | 2023-04-14T03:35:00.176499 | 2020-12-19T07:15:59 | 2020-12-19T07:15:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 819 | java | package vip.xjdai.validation.increase;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.SneakyThrows;
import org.hibernate.validator.internal.constraintvalidators.bv.NotNullValidator;
import javax.validation.ConstraintValidatorContext;
import javax.validation.constraints.NotNull;
@EqualsAndHashCode(callSuper = true)
@Data
public class NotNullIncreaseValidator extends NotNullValidator {
private NotNull notNull;
public void initialize(NotNull notNull) {
this.notNull = notNull;
}
@SneakyThrows
@Override
public boolean isValid(Object object, ConstraintValidatorContext constraintValidatorContext) {
boolean valid = super.isValid(object, constraintValidatorContext);
if (valid) {
return valid;
}
return false;
}
}
| [
"597186288@qq.com"
] | 597186288@qq.com |
a5278832da424c7cda376a3bc510871857aa5168 | 268b254b82f1f9d61299a46c247c920645783bdb | /7week_WeatherForecast/app/src/main/java/com/loyid/weatherforecast/MainActivity.java | a99cd9ec4e508da4839c667d21122bf8747e7f4b | [] | no_license | Yumi-Koh/myassignment.github.io | d022d99f5424bd186f455057b0fbeac6ba38dbcf | 84e7efb62d07cfc1b0939e566a34a4dc41c91317 | refs/heads/master | 2022-08-03T22:16:47.175019 | 2020-05-31T14:56:18 | 2020-05-31T14:56:18 | 256,235,173 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,371 | java | package com.loyid.weatherforecast;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
/*
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.add(R.id.container, new ForecastFragment())
.commit();
}
*/
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
startActivity(new Intent(this, SettingsActivity.class));
return true;
}
return super.onOptionsItemSelected(item);
}
} | [
"kohyumy12@gmail.com"
] | kohyumy12@gmail.com |
01cd5feff2a5c3b427628936ef56214a302ae2ac | 099246d02945106a02a38f383df49ba16f5980b4 | /app/src/test/java/com/example/son/othellogame/ExampleUnitTest.java | 63c08bf46cb2df4e122ce6d976bfc454229dcc7f | [] | no_license | Sonnpm197/OthelloGame | 6a1872f929004dd2884bf75d27858d8cdf655442 | 5d037ac76e1932ddb2a9e72eb088462eea3483fc | refs/heads/master | 2022-07-23T01:29:47.661823 | 2018-11-14T17:29:55 | 2018-11-14T17:29:55 | 154,654,794 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 388 | java | package com.example.son.othellogame;
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() {
assertEquals(4, 2 + 2);
}
} | [
"sonnpm197@gmail.com"
] | sonnpm197@gmail.com |
9d0af102ffe46d5a1ededbc3dd57a55993692060 | 5a0d2dc856ee37c6557c8a33e8cd40d158fee766 | /YouthApp/app/src/main/java/com/example/asus/youthapp/ListUser.java | e3e3429aa5532258762dddf27625b1d47718a662 | [] | no_license | bhaktiar/youthapp | b8dbf749cb872e6982e290aa3aa2fd75301cdd39 | abd4a58e3954a1fc9aee3ac62a8d77e2581916c0 | refs/heads/master | 2020-04-10T13:48:43.629812 | 2018-12-10T03:51:05 | 2018-12-10T03:51:05 | 161,059,899 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,866 | java | package com.example.asus.youthapp;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import com.example.asus.youthapp.Adapter.ProgramAdapter;
import com.example.asus.youthapp.Adapter.UserAdapter;
import com.example.asus.youthapp.Model.GetProgram;
import com.example.asus.youthapp.Model.GetUser;
import com.example.asus.youthapp.Model.Program;
import com.example.asus.youthapp.Model.User;
import com.example.asus.youthapp.Rest.ApiClient;
import com.example.asus.youthapp.Rest.ApiInterface;
import java.util.List;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class ListUser extends AppCompatActivity {
RecyclerView mRecyclerView;
RecyclerView.Adapter mAdapter;
RecyclerView.LayoutManager mLayoutManager;
Context mContext;
ApiInterface mApiInterface;
Button btGet,btAddData;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_list_program);
mContext = this.getApplicationContext();
mRecyclerView = (RecyclerView) findViewById(R.id.recyclerView);
mLayoutManager = new LinearLayoutManager(mContext);
mRecyclerView.setLayoutManager(mLayoutManager);
btGet = (Button) findViewById(R.id.btGet);
btAddData = (Button) findViewById(R.id.btAddData);
btGet.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mApiInterface = ApiClient.getClient().create(ApiInterface.class);
Call<GetUser> mPembeliCall = mApiInterface.getUser();
mPembeliCall.enqueue(new Callback<GetUser>() {
@Override
public void onResponse(Call<GetUser> call, Response<GetUser> response) {
Log.d("Get Kategori",response.body().getStatus());
List<User> listUser = response.body().getResult();
mAdapter = new UserAdapter(listUser,ListUser.this);
mRecyclerView.setAdapter(mAdapter);
}
@Override
public void onFailure(Call<GetUser> call, Throwable t) {
}
});
}
});
btAddData.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(mContext, insert_user.class);
startActivity(intent);
}
});
}
}
| [
"bactiaradi"
] | bactiaradi |
d290adceea88b4f27776ec1fbb91b8c5d4579b34 | 5e0a1be902790566f419ef74dc229cb8c8131081 | /src/com/th/eoss/servlet/SETHighlightsBatchServlet.java | 89a38bd087efbe3cf07b1cb9a57716309fd21d96 | [] | no_license | eoss-th/eoss-setfin | 282a2b69f6b599d32150009f4f4a550e875714d8 | 37da2dc491e135b6de4a508933fed8a1bdcd0fe9 | refs/heads/master | 2021-03-16T07:56:18.768773 | 2017-07-06T05:33:38 | 2017-07-06T05:33:38 | 96,392,094 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,807 | java | package com.th.eoss.servlet;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.google.appengine.api.datastore.DatastoreService;
import com.google.appengine.api.datastore.DatastoreServiceFactory;
import com.google.appengine.api.datastore.Entity;
import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.KeyFactory;
import com.th.eoss.gcp.datastore.SETUpdater;
public class SETHighlightsBatchServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
String industry = req.getParameter("industry");
String s = req.getParameter("sector");
Key key = KeyFactory.createKey("Industry", industry);
try {
Entity entity = datastore.get(key);
Map<String, Object> map = entity.getProperties();
Set<String> sectors = map.keySet();
for (String sector:sectors) {
if ( s!=null && s.equals(sector) ) {
List<String> symbols = (List<String>) entity.getProperty(sector);
for (String symbol:symbols) {
Entity symbolEntity = SETUpdater.getOrCreate(datastore, symbol);
SETUpdater.updateSector(symbolEntity, industry, sector);
SETUpdater.updateHighlights(symbolEntity);
SETUpdater.updateDVD(symbolEntity);
SETUpdater.updateProfile(symbolEntity);
datastore.put(symbolEntity);
}
}
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
| [
"eossth@Enterprises-iMac.local"
] | eossth@Enterprises-iMac.local |
1d9fa20657a8972e4c25d024bc3335cc0138eb32 | e80e7fab3c550d7736118c2622ae753e0777dd3f | /ipss.plugin.core/src/org/interpss/display/impl/AclfOut_PSSE.java | 14e08056772160a28c144e6266c7cf385f98c929 | [] | no_license | tawakol/ipss-plugin | f850f4ca65cdce29be98524b09b92ed918263a27 | 90702319140f52db2aa7385646b8b96fdaac80c4 | refs/heads/master | 2021-01-14T13:47:55.654345 | 2014-01-24T02:44:58 | 2014-01-24T02:44:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,983 | java | /*
* @(#)AclfOutFunc.java
*
* Copyright (C) 2006 www.interpss.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE
* as published by the Free Software Foundation; either version 2.1
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* @Author Mike Zhou
* @Version 1.0
* @Date 11/27/2007
*
* Revision History
* ================
*
*/
package org.interpss.display.impl;
import static org.interpss.CorePluginFunction.FormatKVStr;
import org.apache.commons.math3.complex.Complex;
import org.interpss.display.AclfOutFunc;
import org.interpss.numeric.datatype.Unit.UnitType;
import com.interpss.core.aclf.AclfBranch;
import com.interpss.core.aclf.AclfBus;
import com.interpss.core.aclf.AclfNetwork;
import com.interpss.core.net.Branch;
import com.interpss.core.net.Bus;
/**
* Aclf output functions, PSS/E format
*
* @author mzhou
*
*/
public class AclfOut_PSSE {
public static enum Format {
GUI,
POUT};
/**
* output LF result in the PSS/E format
*
* @param net
* @param format
* @return
*/
public static StringBuffer lfResults(AclfNetwork net, Format format) {
StringBuffer str = new StringBuffer("");
try {
double baseKVA = net.getBaseKva();
str.append(psseStyleTitle(net, format));
for (Bus b : net.getBusList()) {
AclfBus bus = (AclfBus) b;
if (bus.isActive()) {
if (format == Format.GUI)
str.append("\n" + busGUIFormat(bus, baseKVA));
else
str.append("\n" + busResults(bus, baseKVA));
}
}
} catch (Exception emsg) {
str.append(emsg.toString());
}
return str;
}
private static StringBuffer busGUIFormat(AclfBus bus, double baseKVA) {
StringBuffer str = new StringBuffer("");
double pu2Mva = baseKVA * 0.001;
String s = "";
s += String.format(" %7s %-12s%6s %3d %6.4f %6.1f",
bus.getNumber(), bus.getName(),
FormatKVStr.f(bus.getBaseVoltage()*0.001),
bus.getArea().getNumber(),
bus.getVoltageMag(), bus.getVoltageAng(UnitType.Deg));
double pgen = 0.0, pload = 0.0, pshunt = 0.0;
double qgen = 0.0, qload = 0.0, qshunt = 0.0;
char qchar = ' ';
if (bus.isGen()) {
Complex c = bus.getNetGenResults();
pgen = pu2Mva * c.getReal();
qgen = pu2Mva * c.getImaginary();
// R = regulating, L = low limit, H = high limit
if (qgen != 0.0)
qchar = 'R'; //TODO
}
if (bus.isLoad()) {
Complex c = bus.getNetLoadResults();
pload = pu2Mva * c.getReal();
qload = pu2Mva * c.getImaginary();
}
if (bus.getShuntY() != null) {
double factor = bus.getVoltageMag() * bus.getVoltageMag() * baseKVA * 0.001;
if (bus.getShuntY().getReal() != 0.0)
pshunt = -bus.getShuntY().getReal() * factor;
if (bus.getShuntY().getImaginary() != 0.0)
qshunt = -bus.getShuntY().getImaginary() * factor;
}
s += String.format(" %7.1f %7.1f %7.1f", pgen, pload, pshunt);
s += String.format(" -----------------------------------------------------------------------------\n");
s += String.format(" %3d %6s ",
bus.getZone().getNumber(), FormatKVStr.f(bus.getVoltageMag(UnitType.kV)));
s += String.format(" %7.1f%s %7.1f %7.1f", qgen, qchar, qload, qshunt);
int cnt = 0;
for (Branch b : bus.getBranchList()) {
AclfBranch bra = (AclfBranch) b;
if (bra.isActive()) {
s += branchGUIForat(bra, cnt++, bus, baseKVA);
}
}
return str.append(s);
}
private static StringBuffer branchGUIForat(AclfBranch branch, int braCnt, AclfBus fromBus, double baseKVA) {
StringBuffer str = new StringBuffer("");
boolean onFromSide = fromBus.getId().equals(branch.getFromBus().getId());
AclfBus toBus = onFromSide ? branch.getToAclfBus() : branch.getFromAclfBus();
String s = braCnt == 0? "" : " ";
s += String.format("%7s %-12s%6s %3d %2s",
toBus.getNumber(), toBus.getName(),
FormatKVStr.f(toBus.getBaseVoltage()*0.001),
toBus.getArea().getNumber(), branch.getCircuitNumber());
Complex pq = onFromSide? branch.powerFrom2To(UnitType.mVar) :
branch.powerTo2From(UnitType.mVar);
double p = pq.getReal(), q = pq.getImaginary();
s += String.format(" %7.1f %7.1f", p, q);
if (branch.isXfr()) {
/*
* Transformer tap ratio is printed both when the "from bus" is the tapped side and when
the "to bus" is the tapped side. When the "to bus" is the tapped side, the ratio is followed
by the flag UN, regardless of whether it is on limit, regulating, or locked. The flags
printed after the transformer ratio when the "from bus" is the tapped side are these:
// LO When ratio is on low limit.
// HI When ratio is on high limit.
// RG When ratio is in regulating range.
// LK When ratio is locked.
*/
double ratio = branch.getToTurnRatio();
String tapStr = "UN";
if (onFromSide) {
ratio = branch.getFromTurnRatio();
tapStr = "LK"; // TODO
}
s += String.format(" %6.3f%s ", ratio, tapStr);
}
else
s += String.format(" ");
double rating = branch.getRatingMva1();
if (rating > 0.0) {
double loading = 100.0 * pq.abs() / branch.getRatingMva1();
s += String.format(" %3.0f %5.0f\n", loading, rating);
}
else
s += "\n";
return str.append(s);
}
/**
* output LF bus result in PSS/E format
*
* @param bus
* @param baseKVA
* @return
*/
public static StringBuffer busResults(AclfBus bus, double baseKVA) {
StringBuffer str = new StringBuffer("");
double factor = baseKVA * 0.001;
/*
BUS 10002 GZ-HLZ 220.00 CKT MW MVAR MVA %I 1.0445PU -47.34 X--- LOSSES ---X X---- AREA -----X X---- ZONE -----X 10002
*/
String s = String.format("BUS %6d %-12s", bus.getNumber(), bus.getName());
double baseKV = bus.getBaseVoltage()*0.001;
if (baseKV > 100.0)
s += String.format("%6.2f ", baseKV);
else
s += String.format("%6.3f ", baseKV);
s += String.format("CKT MW MVAR MVA %2s %6.4fPU %7.2f X--- LOSSES ---X X---- AREA -----X X---- ZONE -----X %6d\n",
"%I", bus.getVoltageMag(), bus.getVoltageAng(UnitType.Deg), bus.getNumber());
double vkv = bus.getVoltageMag(UnitType.kV);
/*
FROM GENERATION 600.0 34.4R 601.0 601 19.095KV MW MVAR 1 GD 19 50
*/
if (bus.isGen() && !bus.isCapacitor()) {
Complex pq = bus.getNetGenResults();
s += formatBusLoad("FROM GENERATION", pq.getReal()*factor, pq.getImaginary()*factor, pq.abs()*factor);
//double iper = 986;
//s += String.format(" %3.0f ", iper);
s += " ";
if (baseKV > 100.0)
s += String.format("%6.2fKV", vkv);
else
s += String.format("%6.3fKV", vkv);
s += String.format(" MW MVAR %2d %2s %2d %2s\n",
bus.getArea().getNumber(), bus.getArea().getName(),
bus.getZone().getNumber(), bus.getZone().getName());
}
else {
/*
229.79KV MW MVAR 1 GD 2 XX
*/
s += " ";
if (vkv > 100.0)
s += String.format("%7.2fKV", vkv);
else
s += String.format("%7.3fKV", vkv);
s += String.format(" MW MVAR %2d %2s %2d %2s\n",
bus.getArea().getNumber(), bus.getArea().getName(),
bus.getZone().getNumber(), bus.getZone().getName());
}
/*
TO SHUNT 0.0 484.3 484.3
*/
if (bus.isGen() && bus.isCapacitor() || bus.getShuntY().getImaginary() != 0.0) {
double p = 0.0, q = 0.0;
if (bus.isCapacitor())
q = bus.getGenQ();
else if (bus.getShuntY() != null) {
if (bus.getShuntY().getReal() != 0.0)
p = -bus.getShuntY().getReal();
q = -bus.getShuntY().getImaginary();
}
p *= bus.getVoltageMag() * bus.getVoltageMag() * factor;
q *= bus.getVoltageMag() * bus.getVoltageMag() * factor;
s += formatBusLoad("TO SHUNT", p, q, q) + "\n";
}
/*
TO LOAD-PQ 0.0 -104.0 104.0
*/
if (bus.isLoad()) {
Complex pq = bus.getNetLoadResults();
s += formatBusLoad("TO LOAD-PQ", pq.getReal()*factor, pq.getImaginary()*factor, pq.abs()*factor) + "\n";
}
for (Branch br : bus.getBranchList()) {
if (br.isActive()) {
s += branchResults(br, bus, baseKVA);
}
}
str.append(s);
return str;
}
private static String formatBusLoad(String label, double mw, double mvar, double mva) {
return String.format(" %-16s %7.1f %7.1f %7.1f", label, mw, mvar, mva);
}
private static StringBuffer branchResults(Branch branch, AclfBus fromBus, double baseKVA) {
if (branch instanceof AclfBranch) {
return branchResults((AclfBranch)branch, fromBus, baseKVA);
}
else
return new StringBuffer("");
}
private static StringBuffer branchResults(AclfBranch branch, AclfBus fromBus, double baseKVA) {
StringBuffer str = new StringBuffer("");
/*
TO 10193 SHAJIAC= 500.00 1 572.0 19.4 572.3 80 1.0000LK 0.97 72.03 1 GD 2 XX
TO 10535 SHENZHE= 500.00 1 624.4 62.2 627.5 24 1.41 16.95 1 GD 2 XX
*/
boolean onFromSide = fromBus.getId().equals(branch.getFromBus().getId());
AclfBus toBus = onFromSide ? branch.getToAclfBus() : branch.getFromAclfBus();
String s = String.format(" TO %6d %-12s", toBus.getNumber(), toBus.getName());
double vkv = toBus.getBaseVoltage() * 0.001;;
if (vkv > 100.0)
s += String.format("%7.2f ", vkv);
else
s += String.format("%7.3f ", vkv);
Complex pq = onFromSide? branch.powerFrom2To(UnitType.mVar) :
branch.powerTo2From(UnitType.mVar);
s += String.format("%-2s %7.1f %7.1f %7.1f ", branch.getCircuitNumber(),
pq.getReal(), pq.getImaginary(), pq.abs());
if (branch.getRatingMva1() > 0.0) {
double iper = 100.0 * pq.abs() / branch.getRatingMva1();
s += String.format("%3.0f ", iper);
}
else
s += " ";
// only applies to Xfr
if (branch.isXfr()) {
double ratio = branch.getToTurnRatio();
String tapStr = "UN";
if (onFromSide) {
ratio = branch.getFromTurnRatio();
tapStr = "LK"; // TODO
}
s += String.format("%6.4f%2s ", ratio, tapStr);
}
else
s += String.format(" ");
Complex loss = branch.loss(UnitType.mVA);
s += String.format("%7.2f %7.2f %2d %2s %2d %2s\n",
loss.getReal(), loss.getImaginary(),
branch.getArea().getNumber(), branch.getArea().getName(),
branch.getZone().getNumber(), branch.getZone().getName());
str.append(s);
return str;
}
private static String psseStyleTitle(AclfNetwork net, Format format) {
String str = "";
str += "\n\n Load Flow Results\n\n";
str += AclfOutFunc.maxMismatchToString(net," ") + "\n";
if (format == Format.GUI) {
str += " X------- FROM BUS ------X AREA VOLT GEN LOAD SHUNT X---------- TO BUS ----------X TRANSFORMER RATING A\n";
str += " BUS# X-- NAME --X BASKV ZONE PU/KV ANGLE MW/MVAR MW/MVAR MW/MVAR BUS# X-- NAME --X BASKV AREA CKT MW MVAR RATIO ANGLE %I MVA\n";
}
return str;
}
}
| [
"mike@interpss.org"
] | mike@interpss.org |
f7029f59cfd877a5619ec48983725d224b88ed9e | 47dfb6e837ceb60f960a57c1cb4494cc16b3068c | /src/ecstc/Log.java | 43a45407c092e1229773c858fae21203218b5c6a | [] | no_license | grouptheory/ecstc | 72dbce39cd8bbf90ea49b323fdd4dd9c5341a61f | 5f1abedbc7536e9e80ed0c7354b6433676fc7de7 | refs/heads/master | 2020-03-16T23:33:15.218919 | 2018-05-11T19:48:12 | 2018-05-11T19:48:12 | 133,082,196 | 2 | 2 | null | null | null | null | UTF-8 | Java | false | false | 2,044 | java | package ecstc;
import edu.uci.ics.jung.graph.*;
import java.util.*;
/**
* Class to produce output log
*
* @version $$
* @author Bilal Khan
*/
public class Log {
public static class Level implements Comparable {
private int _value;
Level(int v) {
_value = v;
}
public int compareTo(Object obj) {
Level other = (Level)obj;
if (this._value < other._value) return -1;
else if (this._value > other._value) return +1;
else return 0;
}
public String toString() {
if (_value==1) return "DEBUG";
else if (_value==2) return "INFO";
else if (_value==3) return "WARN";
else if (_value==4) return "ERROR";
else return "FATAL";
}
}
public static final Level DEBUG = new Level(1);
public static final Level INFO = new Level(2);
public static final Level WARN = new Level(3);
public static final Level ERROR = new Level(4);
public static final Level FATAL = new Level(5);
public static final Level DEFAULT_LEVEL = INFO;
private static final int KEYLENGTH = 10;
private static final HashMap _key2level = new HashMap();
public static void setLevel(Object key, Level lev) {
_key2level.put(key, lev);
}
public static Level getLevel(Object key) {
Level setting = (Level)_key2level.get(key);
if (setting==null) {
setting = DEFAULT_LEVEL;
}
return setting;
}
public static void diag(Object key, Level lev, String s) {
Level setting = getLevel(key);
if (key instanceof String) {
String skey = (String)key;
int index = skey.lastIndexOf(".");
if (index >= 0) {
skey = skey.substring(index+1);
}
int len = skey.length();
while (len < KEYLENGTH) {
skey = skey+" ";
len = skey.length();
}
if (len > KEYLENGTH) {
skey = skey.substring(0, KEYLENGTH);
}
else {
}
key = skey;
}
if (setting.compareTo(lev) <= 0) {
System.out.println(key+" ("+lev+") "+"\t"+s);
if (lev.compareTo(FATAL)==0) {
System.exit(-1);
}
}
}
}
| [
"grouptheory@gmail.com"
] | grouptheory@gmail.com |
bb9d6de8480f39e2b4ce4f85810854f85d1fc563 | 88599e06197da6f44809d0d39a114fb1e151ab8b | /java/AULA/src/If_else_elseIf/Desafio_1.java | 1284794c13e1ebcb1883ae42ce5035738bf7c617 | [] | no_license | claramon/turma27java | 8c709d4019c87b2ff01eb23d4a270c386b422b28 | 7b2d2074ed29f031f3680da239a386cd8336875d | refs/heads/main | 2023-06-19T03:00:32.757832 | 2021-07-14T18:30:43 | 2021-07-14T18:30:43 | 379,587,338 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 731 | java | package If_else_elseIf;
import java.util.Scanner;
public class Desafio_1 {
public static void main(String[] args) {
Scanner leia = new Scanner (System.in);
int numero;
System.out.println("digite um valor: ");
numero = leia.nextInt();
//numero que seja positivo, falar se é par ou ímpar, e que zero é neutro
if(numero==0) {//tem que fazer o zero neutro primeiro, pq senão vai considerar zero como par
System.out.println("seu numero é neutro");
}else if(numero>0) {
if(numero%2==1) {
System.out.println("seu numero é impar");
}else {
System.out.println("seu numero é par");
}
}else {
System.out.println("seu numero é negativo, não pode");
}
}
}
| [
"claramontanhez@gmail.com"
] | claramontanhez@gmail.com |
d9990737536fdbdd53930767bf54c35af45058e1 | ed3e1cd573d64efa21ab585c72c0913b8cf4e597 | /src/com/es/ecircle/concurency/MyDataStructure.java | 2ff311160d4faeec18eadfeb680e8b5bd5a344d3 | [] | no_license | netankit/java-sample-concurrency | 1fe08a908b99725d46ef7853fd4cea2431b3b957 | 4903c1e41ece9d1bc602df84ff3ef8689e53e6e8 | refs/heads/master | 2021-01-19T00:27:37.916098 | 2014-03-19T14:48:26 | 2014-03-19T14:48:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 554 | java | package com.es.ecircle.concurency;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* Defensive Copy Example
*
* @author AB186066
*
*/
public class MyDataStructure {
List<String> list = new ArrayList<String>();
public void add(String s) {
list.add(s);
}
/**
* Makes a defensive copy of the List and return it This way cannot modify
* the list itself
*
* @return List<String>
*/
public List<String> getList() {
return Collections.unmodifiableList(list);
}
} | [
"ankit.bahuguna@cs.tum.edu"
] | ankit.bahuguna@cs.tum.edu |
9eac10faeb5d6aef3be88821405f21f4e4d63f60 | e8f8f7d290336856e67de6a6cdbe5ea5e92a7e47 | /src/main/java/anon/defeasible/benchmark/core/Approach.java | 03fb67a3c35f9b85d24352e8477c62eb082ba9d4 | [
"MIT"
] | permissive | anoConf/Benchmark | b4815e371428d50471dba0af2001ccb7afe171d8 | d9d25a59557e4ef7333567e5931837e4ab20f807 | refs/heads/master | 2021-06-25T23:18:02.695602 | 2017-09-11T14:07:54 | 2017-09-11T14:07:54 | 103,025,673 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 666 | java | package anon.defeasible.benchmark.core;
import java.util.Iterator;
import org.apache.commons.lang3.tuple.Pair;
import fr.lirmm.graphik.defeasible.core.DefeasibleKnowledgeBase;
import fr.lirmm.graphik.graal.api.core.ConjunctiveQuery;
public interface Approach extends Runnable {
public static final String TOTAL_TIME = "total-time";
public static final String EXE_TIME = "exe-time";
public static final String LOADING_TIME = "loading-time";
public static final String ANSWER = "answer";
void prepare(DefeasibleKnowledgeBase kb, ConjunctiveQuery query);
void initialize();
Iterator<Pair<String, ? extends Object>> getResults();
String getName();
}
| [
"anoConf@ano"
] | anoConf@ano |
094d26380eef0e79c2d508b02a1456072e29b9bd | da5a2d2050ac529a19e14a8ea3f9f21714cc2b5d | /app/src/main/java/com/google/android/gms/internal/zzcb.java | 29ddf0be96f6cd7b2c0126629f3c5c3d241070e7 | [] | no_license | F0rth/Izly | 851bf22e53ea720fd03f03269d015efd7d8de5a4 | 89af45cedfc38e370a64c9fa341815070cdf49d6 | refs/heads/master | 2021-07-17T15:39:25.947444 | 2017-10-21T10:05:58 | 2017-10-21T10:05:58 | 108,004,099 | 1 | 1 | null | 2017-10-23T15:51:00 | 2017-10-23T15:51:00 | null | UTF-8 | Java | false | false | 3,976 | java | package com.google.android.gms.internal;
import android.text.TextUtils;
import com.google.android.gms.ads.internal.zzr;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@zzhb
public class zzcb {
private final Object zzpV = new Object();
private final Map<String, String> zzxA = new LinkedHashMap();
private String zzxB;
private zzbz zzxC;
private zzcb zzxD;
boolean zzxi;
private final List<zzbz> zzxz = new LinkedList();
public zzcb(boolean z, String str, String str2) {
this.zzxi = z;
this.zzxA.put("action", str);
this.zzxA.put("ad_format", str2);
}
public void zzN(String str) {
if (this.zzxi) {
synchronized (this.zzpV) {
this.zzxB = str;
}
}
}
public boolean zza(zzbz com_google_android_gms_internal_zzbz, long j, String... strArr) {
synchronized (this.zzpV) {
for (String com_google_android_gms_internal_zzbz2 : strArr) {
this.zzxz.add(new zzbz(j, com_google_android_gms_internal_zzbz2, com_google_android_gms_internal_zzbz));
}
}
return true;
}
public boolean zza(zzbz com_google_android_gms_internal_zzbz, String... strArr) {
return (!this.zzxi || com_google_android_gms_internal_zzbz == null) ? false : zza(com_google_android_gms_internal_zzbz, zzr.zzbG().elapsedRealtime(), strArr);
}
public zzbz zzb(long j) {
return !this.zzxi ? null : new zzbz(j, null, null);
}
public void zzc(zzcb com_google_android_gms_internal_zzcb) {
synchronized (this.zzpV) {
this.zzxD = com_google_android_gms_internal_zzcb;
}
}
public void zzc(String str, String str2) {
if (this.zzxi && !TextUtils.isEmpty(str2)) {
zzbv zzhb = zzr.zzbF().zzhb();
if (zzhb != null) {
synchronized (this.zzpV) {
zzhb.zzL(str).zza(this.zzxA, str, str2);
}
}
}
}
public zzbz zzdB() {
return zzb(zzr.zzbG().elapsedRealtime());
}
public void zzdC() {
synchronized (this.zzpV) {
this.zzxC = zzdB();
}
}
public String zzdD() {
String stringBuilder;
StringBuilder stringBuilder2 = new StringBuilder();
synchronized (this.zzpV) {
for (zzbz com_google_android_gms_internal_zzbz : this.zzxz) {
long time = com_google_android_gms_internal_zzbz.getTime();
String zzdy = com_google_android_gms_internal_zzbz.zzdy();
zzbz com_google_android_gms_internal_zzbz2 = com_google_android_gms_internal_zzbz2.zzdz();
if (com_google_android_gms_internal_zzbz2 != null && time > 0) {
stringBuilder2.append(zzdy).append('.').append(time - com_google_android_gms_internal_zzbz2.getTime()).append(',');
}
}
this.zzxz.clear();
if (!TextUtils.isEmpty(this.zzxB)) {
stringBuilder2.append(this.zzxB);
} else if (stringBuilder2.length() > 0) {
stringBuilder2.setLength(stringBuilder2.length() - 1);
}
stringBuilder = stringBuilder2.toString();
}
return stringBuilder;
}
public zzbz zzdE() {
zzbz com_google_android_gms_internal_zzbz;
synchronized (this.zzpV) {
com_google_android_gms_internal_zzbz = this.zzxC;
}
return com_google_android_gms_internal_zzbz;
}
Map<String, String> zzn() {
Map<String, String> map;
synchronized (this.zzpV) {
zzbv zzhb = zzr.zzbF().zzhb();
if (zzhb == null || this.zzxD == null) {
map = this.zzxA;
} else {
map = zzhb.zza(this.zzxA, this.zzxD.zzn());
}
}
return map;
}
}
| [
"baptiste.robert@sigma.se"
] | baptiste.robert@sigma.se |
2c1167077a3a7e4bb21d73950ce4e152f70aa098 | 140233b2495a1d2ecccc8fab9d212b3ae30fa980 | /src/Assignment_4/PracticeGit.java | 402d2c0dc76b5369c48b7d2db03136c48bd29e53 | [] | no_license | sameerpakuwal/Vastika-assignment | 0924e79159659df1a1bd7cefbf646023c56d4238 | bbc756136c8754a4c6d92e38c379ab6a372ea8c7 | refs/heads/master | 2023-01-21T07:42:09.695495 | 2020-11-25T16:31:29 | 2020-11-25T16:31:29 | 315,491,329 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 137 | java | package Assignment_4;
public class PracticeGit {
public static void main(String[] args) {
// TODO Auto-generated method stub
}
}
| [
"sameerpakuwal@sameers-mbp.home"
] | sameerpakuwal@sameers-mbp.home |
991377a069a39be179dd770c13170ce908ad686a | 351f96c8ef0874def66f1944c5a1c97ae8b52517 | /app/src/main/java/com/example/myapplication/nextPicture.java | 2ec2ffb753cd8bf4a3d25d5c380f53d3350c5569 | [] | no_license | nivek1028/Team-DApp | 32727ca1ebca87992b87df210d629c32c732b147 | 7dc185e5377f1a84dc57aa6b560c8998bc97378a | refs/heads/main | 2023-01-31T16:09:21.176762 | 2020-12-13T21:43:13 | 2020-12-13T21:43:13 | 302,162,623 | 0 | 4 | null | 2020-11-09T05:45:36 | 2020-10-07T21:18:06 | Jupyter Notebook | UTF-8 | Java | false | false | 341 | java | package com.example.myapplication;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
public class nextPicture extends AppCompatActivity
{
//@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.nextpicture);
}
}
| [
"nivek1028@hotmail.com"
] | nivek1028@hotmail.com |
b3c1954621d2f36bbed5c3ed8d404c8aa17b0bc6 | ff5104beb34b5624819493eefb6b0976b4a5969d | /src/main/java/com/wellcare/rules/Helper.java | 99d55b93152332625b7ffc4e512a0f406c9a2922 | [] | no_license | j33853/E-POC | 78ecdacb13ef4a44582d4d527ae58a4ad5defec1 | 2531bfe606ef92a3a269ab1a79077c4285f3c01d | refs/heads/master | 2023-01-23T04:38:12.246343 | 2020-11-30T18:17:14 | 2020-11-30T18:17:14 | 289,107,428 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 758 | java | package com.wellcare.rules;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Helper {
public static boolean isValidMBI( String mbi ) {
if(mbi==null || mbi.isEmpty()){
return false;
}
mbi = mbi.replace("-", "");
if(mbi.length()!=11) {
return false;
}
final String regex = "^\\d(?![SLOIBZ])[A-Z][A-Z0-9]\\d(?![SLOIBZ])[A-Z][A-Z0-9]\\d(?![SLOIBZ])[A-Z](?![SLOIBZ])[A-Z]\\d\\d$";
final Pattern pattern = Pattern.compile(regex, Pattern.MULTILINE);
final Matcher matcher = pattern.matcher(mbi);
if(!matcher.find()) {
return false;
}
return true;
}
public static void main(String args[]) {
System.out.println(Helper.isValidMBI("1EG4-TE5-MK73"));
}
}
| [
"69205055+j33853@users.noreply.github.com"
] | 69205055+j33853@users.noreply.github.com |
b8e58745fc6cddb0fe4dbf1d15d9b74efcdf6016 | 4170b2dda4107b4987267cd99489ed9bc7654026 | /src/com/concurrency_in_practice/part_2_structuring_concurrent_applications/chap06_task_execution/Chapt06_TaskExecution.java | 6a44c09e124f36b2b5fd9af3cf516219014a557d | [] | no_license | aifoss/java-concurrency-in-practice | a15fbae905925046bde9b5ed8866fe73e73b2b9a | d17ecbdb110fb61abc08fe693b953b9b1538638e | refs/heads/master | 2020-04-07T22:23:36.385842 | 2018-11-23T22:34:19 | 2018-11-23T22:34:19 | 158,768,362 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 631 | java | package com.concurrency_in_practice.part_2_structuring_concurrent_applications.chap06_task_execution;
/**
* Created by sofia on 5/27/17.
*/
/**
* Chapter 6. Task Execution
*
* Most concurrent applications are organized around the execution of tasks: abstract, discrete units of work.
* Dividing the work of an application into tasks simplifies program organization,
* facilitates error recovery by providing natural transaction boundaries,
* and promotes concurrency by providing a natural structure for parallelizing work.
*/
public class Chapt06_TaskExecution {
public static void main(String[] args) {
}
}
| [
"sathenikos@gmail.com"
] | sathenikos@gmail.com |
fdb4a4243af02f1c16c9eae2ba311965b7106be3 | 63733e708fc036fb288f36c5680aeb10c60a6bdb | /src/main/java/com/jrdevel/aboutus/web/controller/FolderController.java | 9aff7818f185a29144c805f0bae7946721262abd | [] | no_license | raphdom/aboutus-web | ed4d681d83452fdd6723392915b414e865971c00 | 7ff96392875087cd712d78b6738cc32f363707d8 | refs/heads/master | 2021-01-01T18:49:35.633167 | 2015-02-18T23:08:27 | 2015-02-18T23:08:27 | 17,574,848 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,570 | java | package com.jrdevel.aboutus.web.controller;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpSession;
import net.aboutchurch.common.to.ResultObject;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.jrdevel.aboutus.core.authentication.UserDetailsAdapter;
import com.jrdevel.aboutus.core.cloud.FolderService;
import com.jrdevel.aboutus.core.cloud.FolderWrapper;
import com.jrdevel.aboutus.core.common.model.Folder;
import com.jrdevel.aboutus.core.util.ExtJSReturn;
/**
* @author Raphael Domingues
*
*/
@Controller
@RequestMapping(value="/folder")
public class FolderController {
private static final Logger logger = Logger.getLogger(FolderController.class);
@Autowired
private FolderService folderService;
@RequestMapping(value="/view.action")
public @ResponseBody FolderWrapper view(HttpSession session) throws Exception {
try{
UserDetailsAdapter user = (UserDetailsAdapter) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
FolderWrapper result = folderService.getFoldersPermited(user.getUser());
return result;
} catch (Exception e) {
return null;
}
}
@RequestMapping(value="/save.action")
public @ResponseBody Map<String,? extends Object> save(@RequestBody FolderWrapper folder) throws Exception {
try{
Folder bean = new Folder();
bean.setId(folder.getId());
bean.setName(folder.getText());
bean.setParent(folder.getParent());
ResultObject result = null;
if (folder.getId() != 0){
result = folderService.update(bean);
}else{
result = folderService.insert(bean);
}
return result.toMap();
} catch (Exception e) {
logger.error(e.getMessage());
return ExtJSReturn.mapError("Error updating Folder from database.");
}
}
@RequestMapping(value="/delete.action")
public @ResponseBody Map<String,? extends Object> delete(@RequestBody List<Integer> ids) throws Exception {
try{
ResultObject result = folderService.delete(ids);
return result.toMap();
} catch (Exception e) {
logger.error(e.getMessage());
return ExtJSReturn.mapError("Error removing Folder from database.");
}
}
}
| [
"raphdom@gmail.com"
] | raphdom@gmail.com |
5a94983ac8a48481dda253c3d3d4e9dce5cf243f | 68a7f18b99fa4bdfcd57749655b88b907ccf6210 | /webProject/src/notice/controller/NoticeListServlet.java | f2ca457ca05d914bcdf885022faab3e558ab2822 | [] | no_license | danji0123456/KH_Project | 236c33316c10f8050633121d4d9426098d7ff305 | 46c20b6f457242b5506bdcb9e560f7c1e699f9f1 | refs/heads/master | 2022-06-28T00:38:46.588463 | 2020-05-07T15:01:18 | 2020-05-07T15:01:18 | 262,079,028 | 0 | 0 | null | 2020-05-07T15:01:20 | 2020-05-07T14:51:22 | JavaScript | UTF-8 | Java | false | false | 1,697 | java | package notice.controller;
import java.io.IOException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import notice.model.vo.NoticePageData;
import notice.service.noticeService;
/**
* Servlet implementation class NoticeListServlet
*/
@WebServlet(name = "NoticeList", urlPatterns = { "/noticeList" })
public class NoticeListServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public NoticeListServlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("utf-8");
int reqPage = Integer.parseInt(request.getParameter("reqPage"));
NoticePageData pd = new noticeService().selectList(reqPage);
RequestDispatcher rd = request.getRequestDispatcher("/WEB-INF/views/notice/noticeList.jsp");
request.setAttribute("list", pd.getList());
request.setAttribute("pageNavi", pd.getPageNavi());
rd.forward(request, response);
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
}
| [
"danji0123456@naver.com"
] | danji0123456@naver.com |
3f403688fc89227f7a79c2564391d0ace49bb856 | bd8cea6b55a02b4ca22c8029248ade3f7a518dc3 | /Week_01/自定义类加载器/HelloClassLoader.java | 2365f4828b83eb326a99402e3703be6dac2ffb41 | [] | no_license | li-keguo/JAVA-01 | 871109dd3fc9f801730be799a6d7b3ec3929d2c1 | 3f1ae41164c600b5fe9ea736a91074667ee4152c | refs/heads/main | 2023-04-22T12:46:49.648215 | 2021-05-16T09:40:45 | 2021-05-16T09:40:45 | 326,870,413 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,639 | java |
import java.io.*;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Base64;
/**
* HelloClassLoader
*
* @author 李克国
* @version 1.0.0
* @date 2021/1/8 9:43
*/
public abstract class HelloClassLoader extends ClassLoader {
public static final String SUFFIX_CLASS = ".class";
public static final String SUFFIX_XLASS = ".xlass";
protected String suffix;
public HelloClassLoader(String suffix) {
this.suffix = suffix;
}
public static void main(String[] args) throws ClassNotFoundException, IllegalAccessException, InstantiationException, InvocationTargetException, NoSuchMethodException {
// 读取base64加密的.class字符串 执行hello方法
test(new Base64HelloClassLoader(SUFFIX_CLASS));
// 读取base64加密的.xlass字符串 执行hello方法
test(new Base64HelloClassLoader(SUFFIX_XLASS));
String classPath = System.getProperty("user.dir") + File.separator + "Hello";
// 读取.class文件 执行hello方法
test(new FileHelloClassLoader(SUFFIX_CLASS, classPath));
// 读取.xlass文件 执行hello方法
test(new FileHelloClassLoader(SUFFIX_XLASS, classPath));
}
private static void test(HelloClassLoader helloClassLoader) throws ClassNotFoundException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException {
Class<?> hello = helloClassLoader.findClass("Hello");
Object o = hello.newInstance();
Method htlloMethod = hello.getMethod("hello");
htlloMethod.invoke(o);
}
@Override
protected Class<?> findClass(String name) throws ClassNotFoundException {
byte[] bytes = getClassBytes(name);
if (SUFFIX_CLASS.equals(suffix)) {
System.out.println(new String(bytes));
return defineClass(name, bytes, 0, bytes.length);
}
if (SUFFIX_XLASS.equals(suffix)) {
deCodeBytes(bytes);
System.out.println(new String(bytes));
return defineClass(name, bytes, 0, bytes.length);
}
throw new IllegalArgumentException("不合法的类文件后缀");
}
protected abstract byte[] getClassBytes(String name) throws ClassNotFoundException;
private void deCodeBytes(byte[] bytes) {
for (int i = 0; i < bytes.length; i++) {
bytes[i] = (byte) ~bytes[i];
}
}
public void setSuffix(String suffix) {
this.suffix = suffix;
}
static class FileHelloClassLoader extends HelloClassLoader {
private String helloClassPath;
public FileHelloClassLoader(String helloClassPath) {
super(SUFFIX_CLASS);
this.helloClassPath = helloClassPath;
}
public FileHelloClassLoader(String suffix, String helloClassPath) {
super(suffix);
this.helloClassPath = helloClassPath;
}
@Override
protected byte[] getClassBytes(String name) throws ClassNotFoundException {
try (FileInputStream reader = new FileInputStream(new File(helloClassPath + File.separator + name + suffix))) {
byte[] bytes = new byte[reader.available()];
reader.read(bytes);
return bytes;
} catch (FileNotFoundException e) {
throw new ClassNotFoundException(name);
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
}
static class Base64HelloClassLoader extends HelloClassLoader {
public Base64HelloClassLoader(String suffix) {
super(suffix);
}
@Override
protected byte[] getClassBytes(String name) throws ClassNotFoundException {
if (SUFFIX_CLASS.equals(suffix)) {
return Base64.getDecoder().decode("yv66vgAAADQAHAoABgAOCQAPABAIABEKABIAEwcAFAcAFQEABjxpbml0PgEAAygp" +
"VgEABENvZGUBAA9MaW5lTnVtYmVyVGFibGUBAAVoZWxsbwEAClNvdXJjZUZpbGUB" +
"AApIZWxsby5qYXZhDAAHAAgHABYMABcAGAEAE0hlbGxvLCBjbGFzc0xvYWRlciEH" +
"ABkMABoAGwEABUhlbGxvAQAQamF2YS9sYW5nL09iamVjdAEAEGphdmEvbGFuZy9T" +
"eXN0ZW0BAANvdXQBABVMamF2YS9pby9QcmludFN0cmVhbTsBABNqYXZhL2lvL1By" +
"aW50U3RyZWFtAQAHcHJpbnRsbgEAFShMamF2YS9sYW5nL1N0cmluZzspVgAhAAUA" +
"BgAAAAAAAgABAAcACAABAAkAAAAdAAEAAQAAAAUqtwABsQAAAAEACgAAAAYAAQAA" +
"AAEAAQALAAgAAQAJAAAAJQACAAEAAAAJsgACEgO2AASxAAAAAQAKAAAACgACAAAA" +
"BAAIAAUAAQAMAAAAAgAN");
}
if (SUFFIX_XLASS.equals(suffix)) {
return Base64.getDecoder().decode("NQFFQf///8v/4/X/+f/x9v/w/+/3/+71/+3/7Pj/6/j/6v7/+cOWkZaLwf7//NfW" +
"qf7/+7yQm5r+//CzlpGasYqSnZqNq56dk5r+//qXmpOTkP7/9ayQio2cmrmWk5r+" +
"//W3mpOTkNGVnome8//4//f4/+nz/+j/5/7/7Leak5OQ09+ck56MjLOQnpuajd74" +
"/+bz/+X/5P7/+reak5OQ/v/vlZ6JntCTnpGY0LCdlZqci/7/75WeiZ7Qk56RmNCs" +
"hoyLmpL+//yQiov+/+qzlZ6JntCWkNCvjZaRi6yLjZqeksT+/+yVnome0JaQ0K+N" +
"lpGLrIuNmp6S/v/4j42WkYuTkf7/6tezlZ6JntCTnpGY0KyLjZaRmMTWqf/e//r/" +
"+f///////f/+//j/9//+//b////i//7//v////rVSP/+Tv////7/9f////n//v//" +
"//7//v/0//f//v/2////2v/9//7////2Tf/97fxJ//tO/////v/1////9f/9////" +
"+//3//r//v/z/////f/y");
}
throw new ClassNotFoundException();
}
}
} | [
"33576070+lkg123@users.noreply.github.com"
] | 33576070+lkg123@users.noreply.github.com |
8d0cbca22f0c24e5477bd9e1f048622adc869be4 | 5c38fe337a7678595df2114baf6e5482a08a71f1 | /src/br/com/ruifpi/models/PratoPronto.java | 91b32ba1d141da214bdd87edf5dace74f6f60618 | [] | no_license | marcianomoura/ruifpi | 00e9bd5df1e31c62b49790818e11c50def6b2805 | 5eb16bbb8b2ea5d4c430a340a791e382c6aa268b | refs/heads/master | 2021-01-18T18:12:52.848688 | 2016-08-08T00:08:19 | 2016-08-08T00:08:19 | 35,859,363 | 0 | 1 | null | 2016-07-14T05:06:34 | 2015-05-19T04:33:39 | Java | UTF-8 | Java | false | false | 3,036 | java | package br.com.ruifpi.models;
import java.io.Serializable;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
@Entity
public class PratoPronto implements Serializable, Comparable<PratoPronto> {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String tituloPrato;
@OneToMany(mappedBy = "pratoPronto", fetch = FetchType.LAZY, cascade = CascadeType.ALL)
private List<ItemPratoPronto> itemPratoProntos;
private double totalCaloria;
public PratoPronto() {
// TODO Auto-generated constructor stub
}
public PratoPronto(Long id, String tituloPrato, List<ItemPratoPronto> itemPratoProntos, double totalCaloria) {
super();
this.id = id;
this.totalCaloria = totalCaloria;
this.tituloPrato = tituloPrato;
this.itemPratoProntos = itemPratoProntos;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public double getTotalCaloria() {
return totalCaloria;
}
public void setTotalCaloria(double totalCaloria) {
this.totalCaloria = totalCaloria;
}
public String getTituloPrato() {
return tituloPrato;
}
public void setTituloPrato(String tituloPrato) {
this.tituloPrato = tituloPrato;
}
public List<ItemPratoPronto> getItemPratoProntos() {
return itemPratoProntos;
}
public void setItemPratoProntos(List<ItemPratoPronto> itemPratoProntos) {
this.itemPratoProntos = itemPratoProntos;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + ((itemPratoProntos == null) ? 0 : itemPratoProntos.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;
PratoPronto other = (PratoPronto) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
if (itemPratoProntos == null) {
if (other.itemPratoProntos != null)
return false;
} else if (!itemPratoProntos.equals(other.itemPratoProntos))
return false;
return true;
}
@Override
public int compareTo(PratoPronto o) {
return 0;
}
public void ordenaPratoByTitulo(List<PratoPronto> pratoProntos) {
Collections.sort(pratoProntos, new Comparator<PratoPronto>() {
@Override
public int compare(PratoPronto o1, PratoPronto o2) {
// TODO Auto-generated method stub
return o1.getTituloPrato().compareToIgnoreCase(o2.getTituloPrato());
}
});
}
}
| [
"root@root-PC"
] | root@root-PC |
4a8b12fbe9b40a2175af8cc13db9a959b08942aa | f60da2cc10306556124f5709c900ef4e994e8328 | /src/main/java/com/taskassignment/loadyaml/LoadYAML.java | 3938aa7999c449ea1f6b9c3df9804fdffad1e8d6 | [] | no_license | satishyc/Task | bfa69a7208ff77188e07b0cd56f6fcafdf72c270 | e082fb6beaff7e6265e69af13fec0d1d2b0e0492 | refs/heads/main | 2023-01-13T12:40:23.318767 | 2020-11-17T08:13:37 | 2020-11-17T08:13:37 | 313,529,775 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,210 | java | package com.taskassignment.loadyaml;
import com.taskassignment.kafkatopicwriter.KafkaTopicWriter;
import org.yaml.snakeyaml.Yaml;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Logger;
public class LoadYAML {
public static int LoadData() {
Logger logger = Logger.getLogger(
KafkaTopicWriter.class.getName());
String confPath="/home/ubuntu/Downloads/javabackend/Task/src/main/java/config.yaml";
Map conf = new HashMap();
Yaml yaml = new Yaml();
try {
InputStream stream = new FileInputStream(confPath);
conf = (Map) yaml.load(stream);
if (conf == null || conf.isEmpty() == true) {
logger.warning("Failed to read config file");
throw new RuntimeException("Failed to read config file");
}
} catch (FileNotFoundException e) {
logger.warning("No such file " + confPath);
throw new RuntimeException("No config file");
}
int time= (Integer) conf.get("timeInterval");
return time;
}
}
| [
"sryc123@gmail.com"
] | sryc123@gmail.com |
43c30f6e1800c1e923203bc144fa5f43bc58d82f | af0d1cb2999d25ecf6e5e854138bbc6f62d326c7 | /src/main/java/ci/projetSociaux/repository/OdkMenageRepository.java | 5fc2ca91da3fa93187c827a3813f3f59f6390108 | [] | no_license | syliGaye/ProjetSocial_Dev_2019 | 48deee4f5d870de22a939bc313c496c26be4fee4 | 8ce08aa7cd53ee8de531063371f2ea71d4c5d81a | refs/heads/master | 2023-04-01T00:45:21.665087 | 2019-05-27T12:24:50 | 2019-05-27T12:24:50 | 187,012,842 | 0 | 0 | null | 2023-03-27T22:16:32 | 2019-05-16T11:19:00 | Java | UTF-8 | Java | false | false | 446 | 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 ci.projetSociaux.repository;
import ci.projetSociaux.entity.OdkMenage;
import org.springframework.data.jpa.repository.JpaRepository;
/**
*
* @author soumabkar
*/
public interface OdkMenageRepository extends JpaRepository<OdkMenage, String>{
} | [
"sylvestregaye@gmail.com"
] | sylvestregaye@gmail.com |
3a7abf0947522e26e2fd25fbc02e5242e32dcdac | 155b96001ec8c082a4186312791d7171172979d7 | /base-java-project/src/main/java/com/protry/thread/ThreadTestTwo.java | 0c8e557689f9285455c30afbc23de0e599ebb3c2 | [] | no_license | protriable/demo-java | e31508723d27b2ffafcd8d5e8e2b8ade56f980a9 | cb6478e8e249c6e526d2d9742c8215bbb6042add | refs/heads/master | 2022-12-23T12:15:46.914113 | 2020-08-23T01:43:56 | 2020-08-23T01:43:56 | 119,324,949 | 0 | 1 | null | 2022-12-16T15:34:50 | 2018-01-29T03:10:48 | Java | UTF-8 | Java | false | false | 609 | java | package com.protry.thread;
public class ThreadTestTwo {
public static void main(String[] args) {
MyThread myThread = new MyThread();
new Thread(myThread).start();
new Thread(myThread).start();
new Thread(myThread).start();
}
}
class MyThread implements Runnable {
private int ticket = 5;
@Override
public void run() {
for (int i = 0; i < 200; i++) {
if (this.ticket > 0) {
System.out.println("卖票,ticket = " +this.ticket -- + " threadName = " + Thread.currentThread().getName());
}
}
}
}
| [
"173228002@qq.com"
] | 173228002@qq.com |
12edcfff94d04621761e656917fb578342e85a12 | fa8be8a5817232420f88de570f99bdc1c88604bc | /Institute.java | b4f88e21a9d10c47ff216596098614053849b326 | [] | no_license | PavloLuchyk/OP-Lab11 | b6c987a16205ee776194e507b747d916f1988fb5 | cf05a467edbf021d54081d73dfe97341cc44fe67 | refs/heads/main | 2023-02-06T06:05:53.189247 | 2020-12-31T08:42:14 | 2020-12-31T08:42:14 | 325,755,895 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,929 | java | package lab11;
import java.util.TreeSet;
import java.util.Iterator;
import java.util.Objects;
class Institute{
private String name;
private TreeSet<Faculty> faculties;
public Institute(String name){
this.name = name;
this.faculties = new TreeSet<>();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public TreeSet<Faculty> getFaculties() {
return faculties;
}
//Метод додавання факультету
public void addFaculty(Faculty faculty){
if (faculty == null){
throw new NullPointerException("Faculty cannot be null!");
}
faculties.add(faculty);
}
//Метод видалення факультету
public void removeFaculty(Faculty faculty){
if (faculty == null){
throw new NullPointerException("Null value cannot be removed");
}
faculties.remove(faculty);
}
@Override
public String toString(){
return "Name ot the institute: " + name + ". List of the faculties: " + faculties;
}
@Override
public int hashCode() {
int hash = 7;
return hash;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Institute other = (Institute) obj;
if (!Objects.equals(this.name, other.name)) {
return false;
}
return true;
}
//Метод знаходження загального числа студентів
public int getTotalNumberOfStudents(){
if (faculties.isEmpty()){
throw new NullPointerException("There is no faculties");
}
int number = 0;
for (Faculty faculty: faculties){
number += faculty.getNumberOfStudents();
}
return number;
}
//Метод знаходження факультету з найбільшим числом студентів
public Faculty getbiggestFaculty(){
if (faculties.isEmpty()){
throw new NullPointerException("There is no faculties");
}
Faculty max = new Faculty("Empty");
Faculty faculty;
for(Iterator<Faculty> i = faculties.iterator(); i.hasNext();){
faculty = i.next();
if (max.getNumberOfStudents() < faculty.getNumberOfStudents()){
max = faculty;
}
}
return max;
}
//Метод знаходження студентів з найвищими балами
public TreeSet<Student> getStudentWithHighestMarks(){
if (faculties.isEmpty()){
throw new NullPointerException("There is no faculties");
}
TreeSet<Student> highMarks = new TreeSet<>(new Student.StudentComparator());
for(Iterator i = faculties.iterator(); i.hasNext();){
Object obj = i.next();
if (obj instanceof Faculty){
Faculty faculty = (Faculty) obj;
TreeSet<Student> students = faculty.getStudents();
for (Iterator j = students.iterator(); j.hasNext(); ){
Object o = j.next();
if (o instanceof Student){
Student student = (Student) o;
if (student.getAverageMark() >= 95 && student.getAverageMark() <= 100){
highMarks.add(student);
}
}
}
}
}
return highMarks;
}
//Метод тестового заповнення
public void testFill(){
Faculty fict = new Faculty("FICT");
fict.addStudent(new Student("Ivan", "Ivanov", "IT-321", 90.1));
fict.addStudent(new Student("Petro", "Fedorenko", "IT-232", 95.9));
fict.addStudent(new Student("Ivan", "Oleksandrenko", "IT-21", 75));
fict.addStudent("Anastasiya", "Vasileva", "IL -001", 95.0);
fict.addStudent("Anna", "Makarenko", "UI-301", 100.0);
Faculty iasa = new Faculty("IASA");
iasa.addStudent(new Student("Valeriy", "Mensa", "KA-123", 96.7));
iasa.addStudent(new Student("Petro", "Melenko", "AK-901", 80.5));
iasa.addStudent(new Student("Vasyl", "Romanko", "PH-21", 75));
Faculty tef = new Faculty("IAT");
tef.addStudent(new Student("Serhiy", "Korolev", "RE-1", 100.0));
tef.addStudent(new Student("Volodymyr", "Lidovskiy", "Am-321", 95.91));
tef.addStudent(new Student("Ihor", "Molochar", "KE-3223", 60));
tef.addStudent(new Student("Oleksiy", "Dovbush", "AE-434", 86.1));
this.addFaculty(fict);
this.addFaculty(iasa);
this.addFaculty(tef);
}
} | [
"76796482+PavloLuchyk@users.noreply.github.com"
] | 76796482+PavloLuchyk@users.noreply.github.com |
434e7c8daeee6f30ae6f490f167faf8ba5d21240 | e60317495de8a9be2d2aab1f58604e9c64a99de8 | /JpaAula5/src/br/edu/unitri/DTO/Consultas/ConsultaLetraM.java | 681e868d0546f383f2f42ef0676ff8192a8a1c64 | [] | no_license | marcosfba/JAVA | 4a6803cb0be5305ff8b0614bdff11da63afbf479 | 0924dca56739c261c5106a142d99d2805027f0b6 | refs/heads/master | 2021-01-10T07:54:32.491292 | 2015-08-03T11:19:39 | 2015-08-03T11:19:39 | 36,016,878 | 0 | 1 | null | null | null | null | ISO-8859-10 | Java | false | false | 1,923 | java | /**
*
*/
package br.edu.unitri.DTO.Consultas;
import java.io.Serializable;
import br.edu.unitri.model.Colunas;
/**
* @author marcos.fernando
*
*/
public class ConsultaLetraM implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
@Colunas(nome = "Nome do Empregado", size = 175)
private String nomeEmpregado;
@Colunas(nome = "Nš Departamento", size = 175)
private String numDepartamento;
@Colunas(nome = "Nome do Departamento", size = 175)
private String nomeDepartamento;
@Colunas(nome = "Nš Projeto", size = 175)
private String nomeProjeto;
public ConsultaLetraM() {
super();
}
public ConsultaLetraM(String nomeEmpregado, String numDepartamento,
String nomeDepartamento, String nomeProjeto) {
super();
this.nomeEmpregado = nomeEmpregado;
this.numDepartamento = numDepartamento;
this.nomeDepartamento = nomeDepartamento;
this.nomeProjeto = nomeProjeto;
}
public String getNomeEmpregado() {
return nomeEmpregado;
}
public void setNomeEmpregado(String nomeEmpregado) {
this.nomeEmpregado = nomeEmpregado;
}
public String getNumDepartamento() {
return numDepartamento;
}
public void setNumDepartamento(String numDepartamento) {
this.numDepartamento = numDepartamento;
}
public String getNomeDepartamento() {
return nomeDepartamento;
}
public void setNomeDepartamento(String nomeDepartamento) {
this.nomeDepartamento = nomeDepartamento;
}
public String getNomeProjeto() {
return nomeProjeto;
}
public void setNomeProjeto(String nomeProjeto) {
this.nomeProjeto = nomeProjeto;
}
@Override
public String toString() {
return "ConsultaLetraM [nomeEmpregado=" + nomeEmpregado
+ ", numDepartamento=" + numDepartamento
+ ", nomeDepartamento=" + nomeDepartamento + ", nomeProjeto="
+ nomeProjeto + "]";
}
}
| [
"marcosfba.algar@gmail.com"
] | marcosfba.algar@gmail.com |
51ae82b8d00fa14ecc00f2ca89d9c3fb0d1ddd27 | 9779ff06fb812d385f93e132c6cca57fb910722d | /array求指定元素在数据中插入位置/leetcode/Main.java | cc56ff7527dc4b54d58662e1b4101990bb25fc75 | [] | no_license | Gpwner/Algorithm | 4713d4a34f3c653098e79244b49677ace2ad3fd0 | 5e1093560a933060d3fa7d86472cc028c2c56549 | refs/heads/master | 2021-01-22T21:37:19.758473 | 2017-09-23T08:04:20 | 2017-09-23T08:04:20 | 85,446,951 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,056 | java | package leetcode;
/**
* Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.
* <p>
* You may assume no duplicates in the array.
* <p>
* Here are few examples.
* [1,3,5,6], 5 → 2
* [1,3,5,6], 2 → 1
* [1,3,5,6], 7 → 4
* [1,3,5,6], 0 → 0
*/
class Main {
public static void main(String[] args) {
int[] nums = {1, 3};
Main main = new Main();
System.out.println(main.searchInsert(nums, 2));
}
public int searchInsert(int[] nums, int target) {
int low = 0, high = nums.length - 1;
while (low <= high) {
int mid = (low + high) / 2;
if (nums[mid] == target) {
return mid;
} else if (nums[mid] > target) {
high = mid - 1;
} else {
low = mid + 1;
}
}
//注意只能返回low,返回high是错的(如果想返回high的话就返回high+1)
return low;
}
} | [
"xuzhengchuang@126.com"
] | xuzhengchuang@126.com |
df3f13d55ad20b1a8d66d1f8ed5a3f06a69b20b3 | 5dddb44e514e00c7925e80233b6ae45c9cb4f80b | /src/main/java/ru/testsForStudents/service/implementation/UserServiceImpl.java | a99e656351c98ca717df81502d2ef7cb92fb64f4 | [] | no_license | SamarinAnton/TestSystemForStudents | 84abe7ad4e7e5cfcefea8cad70c8ed38034264e2 | 86f7ebb8f11abb52d57853ede45e824737eebb11 | refs/heads/master | 2020-03-14T19:26:52.392059 | 2018-05-20T11:34:31 | 2018-05-20T11:34:31 | 131,761,350 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 86 | java | package ru.testsForStudents.service.implementation;
public class UserServiceImpl {
}
| [
"noguto@mail.ru"
] | noguto@mail.ru |
6b0426116d365745c1f801ea16bed47bc8506b34 | 61c11900a62c697cbf5fa95637dda129c51d99ff | /workspace/servidor-interfaz/src/main/java/ec/com/codesoft/codefaclite/servidorinterfaz/servicios/CatalogoProductoServiceIf.java | 45006dac63b2a5a8e3f621eaeabc0b74a5dd6a07 | [] | no_license | carlosmast23/codefac-lite | 078507508512ee14d1b1bc81e639e4085dcfb60b | 7ba071bc4ff483a6035d5773363ac9a3ee957aae | refs/heads/master | 2023-08-07T15:20:20.229328 | 2021-10-25T01:57:04 | 2021-10-25T01:57:04 | 108,033,774 | 0 | 0 | null | 2023-01-07T07:33:07 | 2017-10-23T20:09:27 | Java | UTF-8 | Java | false | false | 782 | 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 ec.com.codesoft.codefaclite.servidorinterfaz.servicios;
import ec.com.codesoft.codefaclite.servidorinterfaz.entity.academico.CatalogoProducto;
import ec.com.codesoft.codefaclite.servidorinterfaz.enumerados.ModuloCodefacEnum;
import java.rmi.RemoteException;
import java.util.List;
/**
*
* @author Carlos
*/
public interface CatalogoProductoServiceIf extends ServiceAbstractIf<CatalogoProducto>
{
public List<CatalogoProducto> obtenerPorModulo(ModuloCodefacEnum modulo) throws RemoteException;
public CatalogoProducto obtenerPorNombre(String nombre) throws RemoteException;
}
| [
"carlosmast2301@hotmail.es"
] | carlosmast2301@hotmail.es |
6617ca70f0c15f1c363182a8ae41ecb5615ba98c | f613e3518af1eb979511adbb07ef047df0db69f8 | /Mybatis_04_DynamicSQL/src/com/yeqifu/mybatis/bean/Employee.java | 98dcc301393ac379cae0eedff0aaa60bf74a2181 | [] | no_license | yeqifu/Mybatis2 | 01201f51d5ac521f897cc7a2fc78f8aa86c0bf93 | f48fe39c825e0d51b669b40e8f7e16f3aaf8f011 | refs/heads/master | 2022-12-23T02:29:00.728125 | 2020-09-20T08:48:54 | 2020-09-20T08:48:54 | 295,286,065 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,380 | java | package com.yeqifu.mybatis.bean;
public class Employee {
private Integer Id;
private String lastName;
private String gender;
private String email;
private Department department;
public Employee() {
super();
}
public Employee(Integer id, String lastName, String gender, String email) {
super();
Id = id;
this.lastName = lastName;
this.gender = gender;
this.email = email;
}
public Employee(Integer id, String lastName, String gender, String email,Department department) {
super();
Id = id;
this.lastName = lastName;
this.gender = gender;
this.email = email;
this.department = department;
}
public Integer getId() {
return Id;
}
public void setId(Integer id) {
Id = id;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public Department getDepartment() {
return department;
}
public void setDepartment(Department department) {
this.department = department;
}
@Override
public String toString() {
return "Employee [Id=" + Id + ", lastName=" + lastName + ", gender=" + gender + ", email=" + email
+"]";
}
}
| [
"1784525940@qq.com"
] | 1784525940@qq.com |
16e566f31192c1194bd95f65ff6cffc634c6c0b1 | 8bb82eade576472d1001e0a1b7e6d0fffc48062c | /microcase/src/main/java/ca/on/gov/jus/microcase/model/Movie.java | 386b9ce816302afa1a86f72cab605cd07a1aff4b | [] | no_license | glee2400/mirosp | f700f82333ded7278f5e9096966219df1356eedc | 0c952dd27f0daffa474681cb6a5c8f85c7657802 | refs/heads/master | 2021-05-24T11:39:23.512943 | 2020-04-16T14:01:42 | 2020-04-16T14:01:42 | 253,541,998 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 505 | java | package ca.on.gov.jus.microcase.model;
public class Movie {
private String movieId;
private String name;
public Movie() {
}
public Movie(String movieId, String name) {
super();
this.movieId = movieId;
this.name = name;
}
public String getMovieId() {
return movieId;
}
public void setMovieId(String movieId) {
this.movieId = movieId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
| [
"ligar@ON34C03005931.cihs.ad.gov.on.ca"
] | ligar@ON34C03005931.cihs.ad.gov.on.ca |
a65231500a77bc8e07243eb93d57d98687b8a387 | c02d7c5435614552588383ac1437669fa6b69433 | /src/sm/base/data/ifVectorData.java | b8bf2f07ca3832af9e2b4188594e0dd7690be240 | [] | no_license | mytnyk/NFBB | 3cb9d9907e9dc283485bf55f04eec1bf30841973 | e47c0e3d2557baeae8b42b068a404d414e4c63a0 | refs/heads/master | 2021-01-10T06:56:27.909697 | 2016-01-16T10:16:26 | 2016-01-16T10:16:26 | 49,768,708 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 407 | java | package sm.base.data;
/**
* User: Oleg
* Date: Jun 16, 2004
* Time: 2:20:15 PM
* Description: this interface is intended to handle all operations with vector data
*/
public interface ifVectorData extends ifDataHandler {
void setArrayPtr(double[] dData);
void setValue(int i, double d);
double[] getArrayPtr();
double getValue(int i);
int getArraySize();
}
| [
"oleg.mytnyk@gmail.com"
] | oleg.mytnyk@gmail.com |
4c970a727ff30d1c72ccbcbec01fab9c742c7f11 | 90fc6a5994119c612a4994001ac7f43e8d0bde5a | /src/main/java/com/kingpivot/base/wechart/model/Wechart.java | 67fe7a6c4b3483ff7ed1a80c6b723f0f8f44775d | [] | no_license | chentieyong/zaomeng | e7e1ef8f3cad25f6aa52f95f218058004dc869c6 | 59289aafe13398cdaea8bcde5d8019d820a6f278 | refs/heads/master | 2022-06-27T00:59:29.680669 | 2021-10-13T11:54:54 | 2021-10-13T11:54:54 | 182,352,499 | 2 | 1 | null | 2022-06-17T02:53:57 | 2019-04-20T02:57:13 | Java | UTF-8 | Java | false | false | 4,535 | java | package com.kingpivot.base.wechart.model;
import com.kingpivot.base.application.model.Application;
import com.kingpivot.base.site.model.Site;
import com.kingpivot.common.model.BaseModel;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
@Entity
@Table(name = "wechart")
public class Wechart extends BaseModel<String> {
@Id
@GeneratedValue(generator = "system-uuid")
@GenericGenerator(name = "system-uuid", strategy = "uuid")
@Column(length = 36)
private String id;//主键
@Column(length = 100)
private String name;
@Column(length = 20)
private String shortname;
@Column(length = 200)
private String description;
@Column(length = 36)
private String companyID;
@Column(length = 36)
private String applicationId;//应用ID"
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "applicationId", insertable = false, updatable = false) //不能保存和修改
private Application application;
@Column(name = "type", columnDefinition = "int default 0")
private int type = 0; //是否锁定 0公众号1小程序
@Column(length = 36)
private String siteID;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "siteID", insertable = false, updatable = false) //不能保存和修改
private Site site;
@Column(length = 36)
private String loginName;
@Column
private String loginPwd;//访问密码
@Column(length = 32)
private String PUBLIC_NO;
@Column(length = 32)
private String APPid;
@Column(length = 100)
private String APPsecret;
@Column(length = 200)
private String QRCODEPATH;
@Column
private String access_token;
@Column(length = 36)
private String token;
@Override
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getShortname() {
return shortname;
}
public void setShortname(String shortname) {
this.shortname = shortname;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getCompanyID() {
return companyID;
}
public void setCompanyID(String companyID) {
this.companyID = companyID;
}
public String getApplicationId() {
return applicationId;
}
public void setApplicationId(String applicationId) {
this.applicationId = applicationId;
}
public Application getApplication() {
return application;
}
public void setApplication(Application application) {
this.application = application;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public String getSiteID() {
return siteID;
}
public void setSiteID(String siteID) {
this.siteID = siteID;
}
public Site getSite() {
return site;
}
public void setSite(Site site) {
this.site = site;
}
public String getLoginName() {
return loginName;
}
public void setLoginName(String loginName) {
this.loginName = loginName;
}
public String getLoginPwd() {
return loginPwd;
}
public void setLoginPwd(String loginPwd) {
this.loginPwd = loginPwd;
}
public String getPUBLIC_NO() {
return PUBLIC_NO;
}
public void setPUBLIC_NO(String PUBLIC_NO) {
this.PUBLIC_NO = PUBLIC_NO;
}
public String getAPPid() {
return APPid;
}
public void setAPPid(String APPid) {
this.APPid = APPid;
}
public String getAPPsecret() {
return APPsecret;
}
public void setAPPsecret(String APPsecret) {
this.APPsecret = APPsecret;
}
public String getQRCODEPATH() {
return QRCODEPATH;
}
public void setQRCODEPATH(String QRCODEPATH) {
this.QRCODEPATH = QRCODEPATH;
}
public String getAccess_token() {
return access_token;
}
public void setAccess_token(String access_token) {
this.access_token = access_token;
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
}
| [
"912081337@qq.com"
] | 912081337@qq.com |
2b4e436ee776b48b88ef79ad7905f2d8d0b0edb6 | f4dc88176e11f72127ffd48c5f5f7b1de9714a8f | /LogHelloJni/src/com/example/hellojni/HelloJni.java | 5e9830ccb6f0df40522a766244c4a34191b3f3db | [] | no_license | 1107979819/ANDROID_NDK | 13ac0c546a596ad75dc1101daea7831cf6ed96b3 | 79fbab97172cad6c2588a9740d0670f91599427d | refs/heads/master | 2021-01-23T16:26:32.884760 | 2015-04-21T16:59:35 | 2015-04-21T16:59:35 | 33,998,358 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,334 | java | /*
* Copyright (C) 2009 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.example.hellojni;
import android.app.Activity;
import android.util.Log;
import android.widget.TextView;
import android.os.Bundle;
public class HelloJni extends Activity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
/* Create a TextView and set its content.
* the text is retrieved by calling a native
* function.
*/
TextView tv = new TextView(this);
tv.setText( stringFromJNI() );
setContentView(tv);
log();
Log.i("jni-log","---------------");
}
/* A native method that is implemented by the
* 'hello-jni' native library, which is packaged
* with this application.
*/
public native String stringFromJNI();
/* This is another native method declaration that is *not*
* implemented by 'hello-jni'. This is simply to show that
* you can declare as many native methods in your Java code
* as you want, their implementation is searched in the
* currently loaded native libraries only the first time
* you call them.
*
* Trying to call this function will result in a
* java.lang.UnsatisfiedLinkError exception !
*/
public native String unimplementedStringFromJNI();
/* this is used to load the 'hello-jni' library on application
* startup. The library has already been unpacked into
* /data/data/com.example.hellojni/lib/libhello-jni.so at
* installation time by the package manager.
*/
public native void log();
static {
System.loadLibrary("hello-jni");
}
}
| [
"1107979819@qq.com"
] | 1107979819@qq.com |
38ebbbfacb80df5eb32613c3cd82a558f0afb667 | 02740db40da6747d01303ee42e1a97105e851e4a | /src/main/java/model/BankLogic.java | cf17769527ad7897a92c83e8aa41a8b413e1dbbd | [] | no_license | ejmanning/bank | 421330f65b7a330eb2eb7359782c4337c5159393 | f9a6e31d30289a0b354f65733c7054d279ef09d4 | refs/heads/master | 2023-02-21T21:17:57.615872 | 2021-01-25T19:29:47 | 2021-01-25T19:29:47 | 332,858,113 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 800 | java | package model;
public class BankLogic {
public double calculateTotalAmount(Bank bank) {
double total = 0;
total = bank.getCheckingsAmount() + bank.getSavingsAmount();
return total;
}
public double calculatePercentInSavings(Bank bank) {
double percentInSavings = 0;
double total = calculateTotalAmount(bank);
percentInSavings = (bank.getSavingsAmount() / total) * 100;
return percentInSavings;
}
public double calculatePercentInCheckings(Bank bank) {
double percentInCheckings = 0;
double total = calculateTotalAmount(bank);
percentInCheckings = (bank.getCheckingsAmount() / total) * 100;
return percentInCheckings;
}
public boolean determineAccountTypeIsStudent(Bank bank) {
if (bank.getAge() < 22) {
return true;
} else {
return false;
}
}
}
| [
"60369190+ejmanning@users.noreply.github.com"
] | 60369190+ejmanning@users.noreply.github.com |
8f7c679a71d1b16e2d40542c9ec5b83c7aea3923 | 0dce09776211c808e1c1baae2318b949496bc3c7 | /src/com/mx/xozello/main/NumericStreamExample.java | 3f333829c452ba6adc856c6f8d0a6269d53e077a | [] | no_license | ojuarass/JavaEightCourse | 8a14b523ef960ee526dde7ec5cc5f91a20420cb4 | 842793b6deafe3301d0978a3dda14967693b268c | refs/heads/master | 2020-09-06T19:12:01.256062 | 2020-03-09T23:59:24 | 2020-03-09T23:59:24 | 220,519,767 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,411 | java | package com.mx.xozello.main;
import java.util.List;
import java.util.OptionalInt;
import java.util.stream.IntStream;
import java.util.stream.Stream;
import com.mx.xozello.apple.streams.DishProvider;
import com.mx.xozello.model.Dish;
public class NumericStreamExample {
public static void main(String[] args) {
List<Dish> menu = DishProvider.getMenu();
System.out.println(menu.stream().mapToInt(Dish::getCalories).sum());
OptionalInt maxCalories = menu.stream().mapToInt(Dish::getCalories).max();
System.out.println(maxCalories.orElse(1));
IntStream evenNumbers = IntStream.rangeClosed(1, 100).filter(n -> n % 2 == 0);
System.out.println(evenNumbers.count());
// Pythagorean triples
Stream<int[]> pythagoreanTriples = IntStream.rangeClosed(1, 100).boxed()
.flatMap(a -> IntStream.rangeClosed(a, 100).filter(b -> Math.sqrt(a * a + b * b) % 1 == 0)
.mapToObj(b -> new int[] { a, b, (int) Math.sqrt(a * a + b * b) }));
pythagoreanTriples.limit(5).forEach(t -> System.out.println(t[0] + ", " + t[1] + ", " + t[2]));
// Better Pythagorean triples
Stream<double[]> pythagoreanTriples2 = IntStream.rangeClosed(1, 100).boxed()
.flatMap(a -> IntStream.rangeClosed(a, 100)
.mapToObj(b -> new double[] { a, b, Math.sqrt(a * a + b * b) }).filter(t -> t[2] % 1 == 0));
pythagoreanTriples2.limit(5).forEach(t -> System.out.println(t[0] + ", " + t[1] + ", " + t[2]));
}
}
| [
"ojuarass@gmail.com"
] | ojuarass@gmail.com |
a1d39d89bab98b759dc88e048cc94dde5117ee75 | 872bfe0093d8c4fc5cb1a66a9499d01f6d3fee28 | /BD-CRUD/Tabla/src/tabla/Consultar.java | 69a5e456a4faef67bfbefd48476feb34e04fb40b | [] | no_license | EmanuelHenao/RecursosJava | 6ee393c272d5946aa0bf16bf69ae287480a7d684 | 1b09ccc7d15c7f8cb15dc1d5946be12b32042793 | refs/heads/master | 2023-01-24T11:29:03.512766 | 2020-12-03T14:52:23 | 2020-12-03T14:52:23 | 282,561,238 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,932 | java | package tabla;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
import static tabla.CrearPersona.isNumeric;
public class Consultar extends javax.swing.JInternalFrame {
private Object[][] datosC = {};
private String[] columNamesC = {"CEDULA", "NOMBRE", "DIRECCION", "TELEFONO"};
private DefaultTableModel modelo;
private int Indice;
public Consultar() {
initComponents();
Indice=0;
modelo = new DefaultTableModel(datosC, columNamesC);
//fill
if (Inter.personas != null) {
System.out.println("entre");
for (int i = 0; i < Inter.personas.size(); i++) {
String[] te = {String.valueOf(Inter.personas.get(i).getCedula()), Inter.personas.get(i).getNombre(),
Inter.personas.get(i).getDireccion(), Inter.personas.get(i).getTelefono()};
modelo.addRow(te);
}
}
jTConsulta.setModel(modelo);
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jSeparator1 = new javax.swing.JSeparator();
jScrollPane2 = new javax.swing.JScrollPane();
jScrollPane1 = new javax.swing.JScrollPane();
jTConsulta = new javax.swing.JTable();
jLabel2 = new javax.swing.JLabel();
jTCodConsulta = new javax.swing.JTextField();
jbConsultar = new javax.swing.JButton();
jbModificar = new javax.swing.JButton();
setBackground(new java.awt.Color(255, 255, 255));
setClosable(true);
setIconifiable(true);
setMaximizable(true);
jLabel1.setFont(new java.awt.Font("Decker", 1, 36)); // NOI18N
jLabel1.setText("Consultar Persona");
jSeparator1.setBackground(new java.awt.Color(0, 0, 0));
jTConsulta.setFont(new java.awt.Font("Decker", 0, 10)); // NOI18N
jTConsulta.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{},
{},
{},
{}
},
new String [] {
}
));
jScrollPane1.setViewportView(jTConsulta);
jScrollPane2.setViewportView(jScrollPane1);
jLabel2.setFont(new java.awt.Font("Decker", 0, 14)); // NOI18N
jLabel2.setText("Cedula:");
jTCodConsulta.setFont(new java.awt.Font("Decker", 0, 14)); // NOI18N
jbConsultar.setFont(new java.awt.Font("Decker", 0, 14)); // NOI18N
jbConsultar.setText("Consultar");
jbConsultar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbConsultarActionPerformed(evt);
}
});
jbModificar.setFont(new java.awt.Font("Decker", 0, 14)); // NOI18N
jbModificar.setText("Modificar");
jbModificar.setEnabled(false);
jbModificar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbModificarActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 548, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(159, 159, 159)
.addComponent(jLabel1))
.addGroup(layout.createSequentialGroup()
.addGap(125, 125, 125)
.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 387, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(93, 93, 93)
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jTCodConsulta, javax.swing.GroupLayout.PREFERRED_SIZE, 220, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jbConsultar)
.addGap(18, 18, 18)
.addComponent(jbModificar))))
.addContainerGap(39, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 13, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(24, 24, 24)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(jTCodConsulta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jbConsultar)
.addComponent(jbModificar, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 42, Short.MAX_VALUE)
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(31, 31, 31))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jbConsultarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbConsultarActionPerformed
jbModificar.setEnabled(false);
if (!jTCodConsulta.getText().equals("")) {
if (isNumeric(jTCodConsulta.getText())) {
boolean encontro = false;
int cod = Integer.parseInt(jTCodConsulta.getText());
for (int i = 0; i < Inter.personas.size(); i++) {
if (Inter.personas.get(i).getCedula() == cod) {
encontro = true;
Clear_Table1();
String[] te = {String.valueOf(Inter.personas.get(i).getCedula()), Inter.personas.get(i).getNombre(),
Inter.personas.get(i).getDireccion(), Inter.personas.get(i).getTelefono()};
modelo.addRow(te);
jTConsulta.setModel(modelo);
jbModificar.setEnabled(true);
Indice=i;
}
}
if (!encontro) {
JOptionPane.showMessageDialog(null, "El registro con numero:" + cod + " NO se encuentra", "Error", JOptionPane.INFORMATION_MESSAGE);
}
} else {
JOptionPane.showMessageDialog(null, "el formato de la cedula no es adecuadao", "Error: tipo de dato invalido", JOptionPane.ERROR_MESSAGE);
}
}
}//GEN-LAST:event_jbConsultarActionPerformed
private void jbModificarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbModificarActionPerformed
Inter.jDesktopPane1.removeAll();
Inter.jDesktopPane1.repaint();
Modificar a = new Modificar(Indice);
Inter.jDesktopPane1.add(a);
a.show();
this.dispose();
}//GEN-LAST:event_jbModificarActionPerformed
private void Clear_Table1() {
for (int i = 0; i < jTConsulta.getRowCount(); i++) {
modelo.removeRow(i);
i -= 1;
}
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JTextField jTCodConsulta;
private javax.swing.JTable jTConsulta;
private javax.swing.JButton jbConsultar;
private javax.swing.JButton jbModificar;
// End of variables declaration//GEN-END:variables
}
| [
"emanuelhenaogiraldo@gmail.com"
] | emanuelhenaogiraldo@gmail.com |
0e4d2f018f423a7ac1e73b6015bd08d46d9d1448 | 13ea5da0b7b8d4ba87d622a5f733dcf6b4c5f1e3 | /crash-reproduction-ws/results/XRENDERING-418-34-24-Single_Objective_GGA-WeightedSum/org/xwiki/rendering/wikimodel/xhtml/XhtmlParser_ESTest.java | abc5982217898c9e40ebc2452053400b2b9befc8 | [
"MIT",
"CC-BY-4.0"
] | permissive | STAMP-project/Botsing-basic-block-coverage-application | 6c1095c6be945adc0be2b63bbec44f0014972793 | 80ea9e7a740bf4b1f9d2d06fe3dcc72323b848da | refs/heads/master | 2022-07-28T23:05:55.253779 | 2022-04-20T13:54:11 | 2022-04-20T13:54:11 | 285,771,370 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 564 | java | /*
* This file was automatically generated by EvoSuite
* Tue Mar 31 06:37:09 UTC 2020
*/
package org.xwiki.rendering.wikimodel.xhtml;
import org.junit.Test;
import static org.junit.Assert.*;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.junit.runner.RunWith;
@RunWith(EvoRunner.class) @EvoRunnerParameters(useVFS = true, useJEE = true)
public class XhtmlParser_ESTest extends XhtmlParser_ESTest_scaffolding {
@Test
public void notGeneratedAnyTest() {
// EvoSuite did not generate any tests
}
}
| [
"pouria.derakhshanfar@gmail.com"
] | pouria.derakhshanfar@gmail.com |
a76db43e6904ff7d0774046d9bcf4aa9fbead4e0 | ab98581b2cda55e55c855d0c8089cfe03a264f1d | /thrift/compiler/test/fixtures/complex-union/gen-java/ValUnion.java | 7a2b7ad02672edb4d075207b3b9a046b59be1d5b | [
"Apache-2.0"
] | permissive | malmerey/fbthrift | ceb4ac8e4c8ac97534e072f043d283ba121e3778 | 2984cccced9aa5f430598974b6256fcca73e500a | refs/heads/master | 2020-06-12T01:11:47.779381 | 2019-06-27T16:49:45 | 2019-06-27T16:53:04 | 194,147,059 | 0 | 0 | Apache-2.0 | 2019-06-27T18:48:31 | 2019-06-27T18:48:30 | null | UTF-8 | Java | false | false | 7,788 | java | /**
* Autogenerated by Thrift
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.Set;
import java.util.HashSet;
import java.util.Collections;
import java.util.BitSet;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.facebook.thrift.*;
import com.facebook.thrift.async.*;
import com.facebook.thrift.meta_data.*;
import com.facebook.thrift.server.*;
import com.facebook.thrift.transport.*;
import com.facebook.thrift.protocol.*;
@SuppressWarnings({ "unused", "serial", "unchecked" })
public class ValUnion extends TUnion<ValUnion> implements Comparable<ValUnion> {
public static boolean DEFAULT_PRETTY_PRINT = true;
private static final TStruct STRUCT_DESC = new TStruct("ValUnion");
private static final TField V1_FIELD_DESC = new TField("v1", TType.STRUCT, (short)1);
private static final TField V2_FIELD_DESC = new TField("v2", TType.STRUCT, (short)2);
public static final int V1 = 1;
public static final int V2 = 2;
public static final Map<Integer, FieldMetaData> metaDataMap;
static {
Map<Integer, FieldMetaData> tmpMetaDataMap = new HashMap<Integer, FieldMetaData>();
tmpMetaDataMap.put(V1, new FieldMetaData("v1", TFieldRequirementType.DEFAULT,
new StructMetaData(TType.STRUCT, Val.class)));
tmpMetaDataMap.put(V2, new FieldMetaData("v2", TFieldRequirementType.DEFAULT,
new StructMetaData(TType.STRUCT, Val.class)));
metaDataMap = Collections.unmodifiableMap(tmpMetaDataMap);
}
public ValUnion() {
super();
}
public ValUnion(int setField, Object value) {
super(setField, value);
}
public ValUnion(ValUnion other) {
super(other);
}
public ValUnion deepCopy() {
return new ValUnion(this);
}
public static ValUnion v1(Val value) {
ValUnion x = new ValUnion();
x.setV1(value);
return x;
}
public static ValUnion v2(Val value) {
ValUnion x = new ValUnion();
x.setV2(value);
return x;
}
@Override
protected void checkType(short setField, Object value) throws ClassCastException {
switch (setField) {
case V1:
if (value instanceof Val) {
break;
}
throw new ClassCastException("Was expecting value of type Val for field 'v1', but got " + value.getClass().getSimpleName());
case V2:
if (value instanceof Val) {
break;
}
throw new ClassCastException("Was expecting value of type Val for field 'v2', but got " + value.getClass().getSimpleName());
default:
throw new IllegalArgumentException("Unknown field id " + setField);
}
}
@Override
public void read(TProtocol iprot) throws TException {
setField_ = 0;
value_ = null;
iprot.readStructBegin(metaDataMap);
TField field = iprot.readFieldBegin();
if (field.type != TType.STOP)
{
value_ = readValue(iprot, field);
if (value_ != null)
{
switch (field.id) {
case V1:
if (field.type == V1_FIELD_DESC.type) {
setField_ = field.id;
}
break;
case V2:
if (field.type == V2_FIELD_DESC.type) {
setField_ = field.id;
}
break;
}
}
iprot.readFieldEnd();
iprot.readFieldBegin();
iprot.readFieldEnd();
}
iprot.readStructEnd();
}
@Override
protected Object readValue(TProtocol iprot, TField field) throws TException {
switch (field.id) {
case V1:
if (field.type == V1_FIELD_DESC.type) {
Val v1;
v1 = new Val();
v1.read(iprot);
return v1;
} else {
TProtocolUtil.skip(iprot, field.type);
return null;
}
case V2:
if (field.type == V2_FIELD_DESC.type) {
Val v2;
v2 = new Val();
v2.read(iprot);
return v2;
} else {
TProtocolUtil.skip(iprot, field.type);
return null;
}
default:
TProtocolUtil.skip(iprot, field.type);
return null;
}
}
@Override
protected void writeValue(TProtocol oprot, short setField, Object value) throws TException {
switch (setField) {
case V1:
Val v1 = (Val)getFieldValue();
v1.write(oprot);
return;
case V2:
Val v2 = (Val)getFieldValue();
v2.write(oprot);
return;
default:
throw new IllegalStateException("Cannot write union with unknown field " + setField);
}
}
@Override
protected TField getFieldDesc(int setField) {
switch (setField) {
case V1:
return V1_FIELD_DESC;
case V2:
return V2_FIELD_DESC;
default:
throw new IllegalArgumentException("Unknown field id " + setField);
}
}
@Override
protected TStruct getStructDesc() {
return STRUCT_DESC;
}
public Val getV1() {
if (getSetField() == V1) {
return (Val)getFieldValue();
} else {
throw new RuntimeException("Cannot get field 'v1' because union is currently set to " + getFieldDesc(getSetField()).name);
}
}
public void setV1(Val value) {
if (value == null) throw new NullPointerException();
setField_ = V1;
value_ = value;
}
public Val getV2() {
if (getSetField() == V2) {
return (Val)getFieldValue();
} else {
throw new RuntimeException("Cannot get field 'v2' because union is currently set to " + getFieldDesc(getSetField()).name);
}
}
public void setV2(Val value) {
if (value == null) throw new NullPointerException();
setField_ = V2;
value_ = value;
}
public boolean equals(Object other) {
if (other instanceof ValUnion) {
return equals((ValUnion)other);
} else {
return false;
}
}
public boolean equals(ValUnion other) {
return equalsNobinaryImpl(other);
}
@Override
public int compareTo(ValUnion other) {
return compareToImpl(other);
}
/**
* If you'd like this to perform more respectably, use the hashcode generator option.
*/
@Override
public int hashCode() {
return 0;
}
@Override
public String toString() {
return toString(DEFAULT_PRETTY_PRINT);
}
@Override
public String toString(boolean prettyPrint) {
return toString(1, prettyPrint);
}
@Override
public String toString(int indent, boolean prettyPrint) {
String indentStr = prettyPrint ? TBaseHelper.getIndentedString(indent) : "";
String newLine = prettyPrint ? "\n" : "";
String space = prettyPrint ? " " : "";
StringBuilder sb = new StringBuilder("ValUnion");
sb.append(space);
sb.append("(");
sb.append(newLine);
boolean first = true;
// Only print this field if it is the set field
if (getSetField() == V1)
{
sb.append(indentStr);
sb.append("v1");
sb.append(space);
sb.append(":").append(space);
if (this.getV1() == null) {
sb.append("null");
} else {
sb.append(TBaseHelper.toString(this.getV1(), indent + 1, prettyPrint));
}
first = false;
}
// Only print this field if it is the set field
if (getSetField() == V2)
{
if (!first) sb.append("," + newLine);
sb.append(indentStr);
sb.append("v2");
sb.append(space);
sb.append(":").append(space);
if (this.getV2() == null) {
sb.append("null");
} else {
sb.append(TBaseHelper.toString(this.getV2(), indent + 1, prettyPrint));
}
first = false;
}
sb.append(newLine + TBaseHelper.reduceIndent(indentStr));
sb.append(")");
return sb.toString();
}
}
| [
"facebook-github-bot@users.noreply.github.com"
] | facebook-github-bot@users.noreply.github.com |
8e621824384eeab7e3b67d8c06acb9372bb609a0 | ca462fc5d13db0ed8f2b63f3bfe239ec6bbcdfac | /app/src/main/java/me/caelumterrae/fbunewsapp/utility/Keyboard.java | 2ee4dad3e2f41834ab124b95b73d9b16206654fc | [
"MIT"
] | permissive | SomethingKindaWitty/FBU_Summer_Project | ecf42b8c1056e38515fd0b5ead27afb17d4834c3 | 077bb21816bcb9b4ed0af45dac672f3feb556dd4 | refs/heads/master | 2020-03-23T00:39:25.380100 | 2018-08-14T00:46:49 | 2018-08-14T00:46:49 | 140,876,952 | 0 | 0 | null | 2018-08-14T00:46:50 | 2018-07-13T17:48:14 | Java | UTF-8 | Java | false | false | 566 | java | package me.caelumterrae.fbunewsapp.utility;
import android.app.Activity;
import android.view.inputmethod.InputMethodManager;
public class Keyboard {
// Used in login activity -- when loading splash screen
public static void hideSoftKeyboard(Activity activity) {
InputMethodManager inputMethodManager =
(InputMethodManager) activity.getSystemService(
Activity.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(
activity.getCurrentFocus().getWindowToken(), 0);
}
}
| [
"maddiew@fb.com"
] | maddiew@fb.com |
1f84c21d12eec467c40a1f805c6c3a35ac73aa5c | 60ae2386b94aef43cbbcc26e90fd157566f51454 | /src/test/java/pageObject/ShoppingCartAddress.java | d8bad770576ec922245768cd74fc979b9a4e843d | [] | no_license | goonersFTW/Essex | fa37d6ee493f109d864bbc216861658658a3e643 | ff34f6a8d56c408a39cb35c750f6331a087d50b1 | refs/heads/master | 2021-06-29T18:46:49.409543 | 2017-09-13T10:33:25 | 2017-09-13T10:33:25 | 103,385,589 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 426 | java | package pageObject;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import webDriver.Driver;
public class ShoppingCartAddress {
public WebElement addressesHeader() {
return Driver.findElement(By.xpath("//h1[contains(text(),'Addresses')]"));
}
public WebElement proceedToCheckoutBtn() {
return Driver.findElement(By.cssSelector("button[name='processAddress']"));
}
}
| [
"TIJESU@victors-air.home"
] | TIJESU@victors-air.home |
ce70cb21e5dcea0b8382c89046749364ba3b9199 | b2fa66ec49f50b4bb92fee6494479238c8b46876 | /src/main/java/fi/riista/feature/natura/NaturaAreaInfoFeature.java | 1d9eb41aae5e833042852b9fe84b1468d6a7890f | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | suomenriistakeskus/oma-riista-web | f007a9dc663317956ae672ece96581f1704f0e85 | f3550bce98706dfe636232fb2765a44fa33f78ca | refs/heads/master | 2023-04-27T12:07:50.433720 | 2023-04-25T11:31:05 | 2023-04-25T11:31:05 | 77,215,968 | 16 | 4 | MIT | 2023-04-25T11:31:06 | 2016-12-23T09:49:44 | Java | UTF-8 | Java | false | false | 2,317 | java | package fi.riista.feature.natura;
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.util.EntityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import org.springframework.web.util.UriComponentsBuilder;
import javax.annotation.Resource;
import java.io.IOException;
import java.net.URI;
@Service
public class NaturaAreaInfoFeature {
private static Logger LOG = LoggerFactory.getLogger(NaturaAreaInfoFeature.class);
@Resource
private CloseableHttpClient httpClient;
@Value("${natura.area.info.url.template}")
private String uriTemplate;
public NaturaAreaInfoDTO getNaturaAreaInfo(final int zoomLevel,
final int tileX,
final int tileY,
final int pixelX,
final int pixelY) throws IOException {
if (uriTemplate.isEmpty()) {
LOG.warn("No Natura area info available due no URL template defined");
return null;
}
final URI uri = UriComponentsBuilder.fromUriString(uriTemplate)
.buildAndExpand(zoomLevel, tileX, tileY, pixelX, pixelY)
.toUri();
final HttpGet request = new HttpGet(uri);
return httpClient.execute(request, response -> {
final int code = response.getStatusLine().getStatusCode();
if (code != HttpStatus.OK.value()) {
throw new IOException(String.format("Incorrect status code when requesting Natura area info. URL:%s, code %d", uri, code));
}
final HttpEntity entity = response.getEntity();
final String content = EntityUtils.toString(entity);
if (content.length() == 0) {
return null;
}
final XmlMapper xmlMapper = new XmlMapper();
return xmlMapper.readValue(content, NaturaAreaInfoDTO.class);
});
}
}
| [
"56720623+tleppikangas@users.noreply.github.com"
] | 56720623+tleppikangas@users.noreply.github.com |
d94ad9850848c8517c6d8b09d5c94252c4063292 | fb194861ab71a0730d4898d9f27bac074c0fd888 | /app/src/test/java/com/solveml/Travelmantics/ExampleUnitTest.java | 1683f87fe8c67293c4629dfea0fe6874c522a774 | [] | no_license | mvisionai/ALC_PHASE_2 | fd63ee0274bfe9c2dbb8d4de7cdd7ef6a4d17910 | c891c24557056b609d37882025df75ab32ac9403 | refs/heads/master | 2020-06-30T00:03:25.376887 | 2019-08-07T08:48:47 | 2019-08-07T08:48:47 | 200,662,853 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 386 | java | package com.solveml.Travelmantics;
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() {
assertEquals(4, 2 + 2);
}
} | [
"vision2bernard2015@gmail.com"
] | vision2bernard2015@gmail.com |
523d155437dd6381f2e96625adf2d0435a2b4dee | 7b5a744665462c985652bd05685b823a0c6d64f6 | /zttx-tradecore/src/main/java/com/zttx/web/module/common/mapper/ProductCountMapper.java | b4e011b754add5c55dd8c126c3edc7553def23aa | [] | no_license | isoundy000/zttx-trading | d8a7de3d846e1cc2eb0b193c31d45d36b04f7372 | 1eee959fcf1d460fe06dfcb7c79c218bcb6f5872 | refs/heads/master | 2021-01-14T01:07:42.580121 | 2016-01-10T04:12:40 | 2016-01-10T04:12:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 978 | java | /*
* Copyright 2015 Zttx, Inc. All rights reserved. 8637.com
* PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package com.zttx.web.module.common.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.zttx.sdk.annotation.MyBatisDao;
import com.zttx.sdk.core.GenericMapper;
import com.zttx.web.module.common.entity.ProductCount;
/**
* 产品计数信息 持久层接口
* <p>File:ProductCountDao.java </p>
* <p>Title: ProductCountDao </p>
* <p>Description:ProductCountDao </p>
* <p>Copyright: Copyright (c) May 26, 2015</p>
* <p>Company: 8637.com</p>
* @author Playguy
* @version 1.0
*/
@MyBatisDao
public interface ProductCountMapper extends GenericMapper<ProductCount>
{
/**
* 最前一个小时类变更过的所有产品统计信息
*
* @param past
* @param now
* @return {@link List}
*/
List<String> getProductCountMaps(@Param("past") Long past, @Param("now") Long now);
}
| [
"ngds@maybedeMacBook-Air.local"
] | ngds@maybedeMacBook-Air.local |
48ddfe0e0293f8ded6eccba3e83f375b0308f619 | ee602e8db370c3ed4f81d05f0db77d0485a22de7 | /Juego/HundirLaPutaFlotaJoder (1)/HundirLaPutaFlotaJoder/src/gui/Menu.java | 189312f77164853a45db522139922fa97f435461 | [] | no_license | Ar3kkusu2/Programazioa-DAM | f1255addb1af9e5f609a2740b230f3400dc60b0f | db490f6a695fcc2318cc4642d4464e2ffe984e2e | refs/heads/main | 2023-04-06T23:04:48.729154 | 2021-04-26T06:39:50 | 2021-04-26T06:39:50 | 361,640,151 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,882 | 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 gui;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import model.*;
public class Menu {
private static Tablero t_player1 = Player.tablero1;
private static Tablero t_player2 = Player.tablero2;
private static Tablero t_temp = Player.temp;
private static Ventana opciones = new Ventana();
private static Texto texto = opciones.texto;
private static int turn;
private static int bucle = 1;
public static void main(String s[]) {
start();
Ventana.SB.addActionListener(e -> {
t_temp.showShip(t_player1, t_player2, turn);
});
Ventana.RB.addActionListener(e -> {
});
Ventana.EB.addActionListener(e -> {
System.exit(0);
});
texto.setTexto("El jugador 1 esta colocando los barcos.");
colocarBarco(Player.tablero1, 5);
colocarBarco(Player.tablero1, 4);
colocarBarco(Player.tablero1, 4);
colocarBarco(Player.tablero1, 3);
colocarBarco(Player.tablero1, 3);
texto.setTexto("El jugador 2 esta colocando los barcos.");
colocarBarco(Player.tablero2, 5);
colocarBarco(Player.tablero2, 4);
colocarBarco(Player.tablero2, 4);
colocarBarco(Player.tablero2, 3);
colocarBarco(Player.tablero2, 3);
change();
while (bucle == 1) {
turno();
}
}
public static void start() {
Player player1 = new Player(1);
Player player2 = new Player(2);
}
public static void colocarBarco(Tablero tabla, int cant) {
tabla.anadirBarco(cant);
while (tabla.proceso == 1) {
waiter(1);
}
}
public static void waiter(int num) {
try{
Thread.sleep(num);
} catch (Exception e) {
System.out.println("Issue");
//This can be anything to let the user/programmer know something's wrong
}
}
public static void change() {
for(int x = 0; x<100;x++) {
t_temp.boton[x].setActivo(t_player1.boton[x].getActivo());
t_temp.boton[x].setTocado(t_player1.boton[x].getTocado());
t_player1.boton[x].setActivo(false);
t_player1.boton[x].setTocado(false);
t_player1.boton[x].setColorDefault();
t_player1.boton[x].setActivo(t_player2.boton[x].getActivo());
t_player1.boton[x].setTocado(t_player2.boton[x].getTocado());
t_player2.boton[x].setActivo(false);
t_player2.boton[x].setTocado(false);
t_player2.boton[x].setColorDefault();
t_player2.boton[x].setActivo(t_temp.boton[x].getActivo());
t_player2.boton[x].setTocado(t_temp.boton[x].getTocado());
}
}
public static void turno()
{
int contador1 = 0;
int contador2 = 0;
turn = 1;
int casilla = 0;
texto.setTexto("El jugador 1 esta escogiendo casilla.");
t_player1.elegirCasilla();
while(t_player1.proceso==1)
{
waiter(1);
}
//-------------------------------------------------------------
for(int x = 0; x<100;x++) {
if(t_player1.boton[x].getActivo())
{
contador1++;
}
if(t_player1.boton[x].getTocado())
{
contador2++;
}
}
if(contador1==contador2)
{
bucle = 0;
texto.setTexto("El jugador 1 ha ganado.");
}
//--------------------------------------------------------------
if(contador1!=contador2)
{
texto.setTexto("El jugador 2 esta escogiendo casilla.");
contador1 =0;
contador2 = 0;
turn = 2;
t_player2.elegirCasilla();
while(t_player2.proceso==1)
{
waiter(1);
}
for(int x = 0; x<100;x++) {
if(t_player2.boton[x].getActivo())
{
contador1++;
}
if(t_player2.boton[x].getTocado())
{
contador2++;
}
}
if(contador1==contador2)
{
bucle = 0;
texto.setTexto("El jugador 2 ha ganado.");
}
}
}
}
| [
"moreno.manuel@uni.lan"
] | moreno.manuel@uni.lan |
2aa2ffe62b8380cfdd2a9b6fbeba44c5e91a7e0f | 9623f83defac3911b4780bc408634c078da73387 | /powercraft/src/common/net/minecraft/src/StructureVillageStart.java | a16b2fc0cd3e02e6243168a9776805a4fe8c9823 | [] | no_license | BlearStudio/powercraft-legacy | 42b839393223494748e8b5d05acdaf59f18bd6c6 | 014e9d4d71bd99823cf63d4fbdb65c1b83fde1f8 | refs/heads/master | 2021-01-21T21:18:55.774908 | 2015-04-06T20:45:25 | 2015-04-06T20:45:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,977 | java | package net.minecraft.src;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Random;
class StructureVillageStart extends StructureStart
{
private boolean hasMoreThanTwoComponents = false;
public StructureVillageStart(World par1World, Random par2Random, int par3, int par4, int par5)
{
ArrayList var6 = StructureVillagePieces.getStructureVillageWeightedPieceList(par2Random, par5);
ComponentVillageStartPiece var7 = new ComponentVillageStartPiece(par1World.getWorldChunkManager(), 0, par2Random, (par3 << 4) + 2, (par4 << 4) + 2, var6, par5);
this.components.add(var7);
var7.buildComponent(var7, this.components, par2Random);
ArrayList var8 = var7.field_74930_j;
ArrayList var9 = var7.field_74932_i;
int var10;
while (!var8.isEmpty() || !var9.isEmpty())
{
StructureComponent var11;
if (var8.isEmpty())
{
var10 = par2Random.nextInt(var9.size());
var11 = (StructureComponent)var9.remove(var10);
var11.buildComponent(var7, this.components, par2Random);
}
else
{
var10 = par2Random.nextInt(var8.size());
var11 = (StructureComponent)var8.remove(var10);
var11.buildComponent(var7, this.components, par2Random);
}
}
this.updateBoundingBox();
var10 = 0;
Iterator var13 = this.components.iterator();
while (var13.hasNext())
{
StructureComponent var12 = (StructureComponent)var13.next();
if (!(var12 instanceof ComponentVillageRoadPiece))
{
++var10;
}
}
this.hasMoreThanTwoComponents = var10 > 2;
}
public boolean isSizeableStructure()
{
return this.hasMoreThanTwoComponents;
}
}
| [
"rapus95@gmail.com@ed9f5d1b-00bb-0f29-faab-e8ebad1a710c"
] | rapus95@gmail.com@ed9f5d1b-00bb-0f29-faab-e8ebad1a710c |
58c30836308754dcf2bbe9f6f2ef49c4eb1d4d78 | 29d04bcf5a447906b9e7468fbdc8109afbd25ee0 | /app/src/main/java/com/americanairlines/myfifthapp/model/db/PizzaDatabaseHelper.java | 92d74ae6ab5b41e7737877eeb752bde423448655 | [] | no_license | Dalo-Chinkhwangwa-Prof/SQLiteIntroduction | 3d0d1297c65bd07b9f8660693ffec2daba0eeb8b | 8f97c97194f53aff149504d2c12fa5d002dd95fc | refs/heads/master | 2023-02-09T13:03:31.346288 | 2021-01-06T16:50:47 | 2021-01-06T16:50:47 | 327,373,825 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,720 | java | package com.americanairlines.myfifthapp.model.db;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import androidx.annotation.Nullable;
import com.americanairlines.myfifthapp.model.data.Pizza;
public class PizzaDatabaseHelper extends SQLiteOpenHelper {
public static final String DATABASE_NAME = "pizza_orders.db";
public static int DATABASE_VERSION = 1;
public static final String PIZZA_TABLE_NAME = "PIZZA_ORDERS";
public static final String COLUMN_ORDER_ID = "order_id";
public static final String COLUMN_PIZZA_FLAVOR = "pizza_flavor";
public static final String COLUMN_PIZZA_PRICE = "pizza_price";
public static final String COLUMN_PIZZA_CALORIES = "pizza_calories";
// public static final String COLUMN_PIZZA_INGREDIENTS = "pizza_ingredients";
public static final String COLUMN_IMAGE_URL = "pizza_image";
public PizzaDatabaseHelper(@Nullable Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase sqLiteDatabase) {
String CREATE_TABLE = "CREATE TABLE " + PIZZA_TABLE_NAME
+ " ("+COLUMN_ORDER_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
+ COLUMN_PIZZA_FLAVOR + " TEXT, "
+ COLUMN_PIZZA_PRICE + " TEXT, "
+ COLUMN_PIZZA_CALORIES + " INTEGER, "
+ COLUMN_IMAGE_URL + " TEXT)";
sqLiteDatabase.execSQL(CREATE_TABLE);
}
@Override
public void onUpgrade(SQLiteDatabase sqLiteDatabase, int oldVersion, int newVersion) {
String update = "DROP TABLE IF EXISTS "+ PIZZA_TABLE_NAME;
sqLiteDatabase.execSQL(update);
DATABASE_VERSION = newVersion;
onCreate(sqLiteDatabase);
}
public void insertPizzaOrder(Pizza pizzaOrdered){
ContentValues pizzaContent = new ContentValues();
pizzaContent.put(COLUMN_PIZZA_FLAVOR, pizzaOrdered.getPizzaFlavor());
pizzaContent.put(COLUMN_PIZZA_PRICE, pizzaOrdered.getPizzaPrice());
pizzaContent.put(COLUMN_PIZZA_CALORIES, pizzaOrdered.getCalories());
pizzaContent.put(COLUMN_IMAGE_URL, pizzaOrdered.getImageUrl());
SQLiteDatabase database = getWritableDatabase();
database.insert(PIZZA_TABLE_NAME, null, pizzaContent);
}
public Cursor getAllPizzaOrders(){//TODO: return an array list instead of cursor
Cursor allPizzaOrders = getReadableDatabase().rawQuery("SELECT * FROM "+ PIZZA_TABLE_NAME,
null, null);
return allPizzaOrders;
}
}
| [
"Dalo.chinkhwangwa@outlook.com"
] | Dalo.chinkhwangwa@outlook.com |
ed84611621c48cd4baba6ff1812cee77eab3afd2 | ddcfdbf3aa0e92d5fce4baa6698d91191d8c00a8 | /src/main/java/sr/unasat/fizzbuzz/FizzMaster2.java | cc9fe5706703101f832ac1908be6c2ffb2319769 | [] | no_license | KishanSital/TDD | d55c65eac3f4472ae7b4d56ede3f6c129df32129 | 6962599c353a23416301083d5f1741406b2dafda | refs/heads/master | 2023-04-22T07:30:01.509751 | 2021-05-08T02:26:15 | 2021-05-08T02:26:15 | 365,398,792 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 795 | java | package sr.unasat.fizzbuzz;
import java.util.List;
import java.util.ArrayList;
public class FizzMaster2 {
public static List<String> count(int number) {
List<String> numbers = new ArrayList<String>();
for(int i=1; i <= number; i++){
numbers.add(fizzIt(i));
}
return numbers;
}
public static String fizzIt(int number) {
if(isMultipleOf(number, 3) && isMultipleOf(number, 5)){
return "FizzBuzz";
}
else if(isMultipleOf(number, 3)){
return "Fizz";
} else if (isMultipleOf(number, 5)){
return "Buzz";
}
return String.valueOf(number);
}
public static boolean isMultipleOf(int number, int multiple){
return number % multiple == 0;
}
} | [
"ksital@qualogy.com"
] | ksital@qualogy.com |
d3fa8e1531541a14f788c2f8ea55f3ec8f434c68 | 13183cabec64cabee412f7074b5ec6a776ec357e | /src/main/java/io/zdp/node/storage/transfer/domain/TransferHeader.java | 2c1d79aef8e1a79efa244c754f64fbbec83121ef | [
"MIT"
] | permissive | zerodaypayments/zdp-node | 006af49b0e5aa7c1f1c9f1ffb3c4dad575610cab | 23f1a1716f51c8146cbf3b8ea670e5e98f5da0fa | refs/heads/master | 2020-03-16T18:18:00.909372 | 2018-05-30T07:45:56 | 2018-05-30T07:45:56 | 132,867,460 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,131 | java | package io.zdp.node.storage.transfer.domain;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import org.bouncycastle.util.encoders.Hex;
@SuppressWarnings("serial")
@Entity
@Table(name = "transfer")
public class TransferHeader implements Serializable {
@Id
@Column(name = "ID", nullable = false, updatable = false)
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
@Column(name = "UUID", columnDefinition = "BINARY(20)", nullable = false, unique = true)
private byte[] uuid;
public TransferHeader() {
super();
}
public TransferHeader(byte[] uuid) {
super();
this.uuid = uuid;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public byte[] getUuid() {
return uuid;
}
public void setUuid(byte[] uuid) {
this.uuid = uuid;
}
@Override
public String toString() {
return "TransferHeader [id=" + id + ", uuid=" + Hex.toHexString(uuid) + "]";
}
}
| [
"serg.nechaev@gmail.com"
] | serg.nechaev@gmail.com |
e9d3a3ed99736acf0aa12661f8644f607f8c5a05 | 5302e92f8226dff1273ea9c9b3cb01c5fd00660e | /src/main/java/com/yyl/config/spring/MyClassLoader.java | ce79bf8e7300973069150e27c75868618d17d554 | [] | no_license | yylstudy/spring | 7d0a6df572479e6c2bd971cbf49c11f969cc4a4a | 4fa6915399b52dda9b5c875098235f1296e6b0a4 | refs/heads/master | 2021-08-09T14:24:08.915349 | 2020-12-21T06:02:17 | 2020-12-21T06:02:17 | 147,061,104 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 309 | java | package com.yyl.config.spring;
import java.net.URL;
import java.net.URLClassLoader;
/**
* 自定义ClassLoader
* @Author: yyl
* @Date: 2019/3/11 14:22
*/
public class MyClassLoader extends URLClassLoader {
public MyClassLoader(ClassLoader parent, URL... urls) {
super(urls, parent);
}
}
| [
"1594818954@qq.com"
] | 1594818954@qq.com |
d5fc4b2769e496ddaf669bc6f841361b68c71cb7 | a17e524130041416702323b6d15c30c85c190abb | /Tracker/src/gov/nrel/nbc/tracker/client/LabelDTO.java | 5ccc2f436a005e16400ab027c82e3630bc8b8a8a | [] | no_license | Organus/TableDataCapture | 32facbb50388ac8874b31391436b9be4586a65c0 | b88814a419d8113e9e94cd05f17db621b13c5ad3 | refs/heads/master | 2021-01-01T18:12:10.263871 | 2012-12-13T23:37:48 | 2012-12-13T23:37:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,222 | java | package gov.nrel.nbc.tracker.client;
import java.io.Serializable;
/**
* A data transfer object or DTO for label information.
*
* @author jalbersh
*
*/
public class LabelDTO implements Serializable {
private static final long serialVersionUID = -5241686588353206549L;
private String ownerName;
private String entryDate;
private String sampleId;
private String trbNum;
private String trbPage;
private String trackingId;
private String feedstock;
private String treatment;
private String fraction;
private String description;
private String fire;
private String reactivity;
private String specific;
private String health;
private boolean printed;
private String strain;
private String form;
private String destination;
private String custodian;
private String composition;
private String workId;
/**
* @return the ownerName
*/
public String getOwnerName() {
return ownerName;
}
/**
* @param ownerName the ownerName to set
*/
public void setOwnerName(String ownerName) {
this.ownerName = ownerName;
}
/**
* @return the entryDate
*/
public String getEntryDate() {
return entryDate;
}
/**
* @param entryDate the entryDate to set
*/
public void setEntryDate(String entryDate) {
this.entryDate = entryDate;
}
/**
* @return the sampleId
*/
public String getSampleId() {
return sampleId;
}
/**
* @param sampleId the sampleId to set
*/
public void setSampleId(String sampleId) {
this.sampleId = sampleId;
}
/**
* @return the trbNum
*/
public String getTrbNum() {
return trbNum;
}
/**
* @param trbNum the trbNum to set
*/
public void setTrbNum(String trbNum) {
this.trbNum = trbNum;
}
/**
* @return the trbPage
*/
public String getTrbPage() {
return trbPage;
}
/**
* @param trbPage the trbPage to set
*/
public void setTrbPage(String trbPage) {
this.trbPage = trbPage;
}
/**
* @return the trackingId
*/
public String getTrackingId() {
return trackingId;
}
/**
* @param trackingId the trackingId to set
*/
public void setTrackingId(String trackingId) {
this.trackingId = trackingId;
}
/**
* @return the printed
*/
public boolean isPrinted() {
return printed;
}
/**
* @param printed the printed to set
*/
public void setPrinted(boolean printed) {
this.printed = printed;
}
/**
* @return the feedstock
*/
public String getFeedstock() {
return feedstock;
}
/**
* @param feedstock the feedstock to set
*/
public void setFeedstock(String feedstock) {
this.feedstock = feedstock;
}
/**
* @return the treatment
*/
public String getTreatment() {
return treatment;
}
/**
* @param treatment the treatment to set
*/
public void setTreatment(String treatment) {
this.treatment = treatment;
}
/**
* @return the fraction
*/
public String getFraction() {
return fraction;
}
/**
* @param fraction the fraction to set
*/
public void setFraction(String fraction) {
this.fraction = fraction;
}
/**
* @return the description
*/
public String getDescription() {
return description;
}
/**
* @param description the description to set
*/
public void setDescription(String description) {
this.description = description;
}
/**
* @param fire the fire to set
*/
public void setFire(String fire) {
this.fire = fire;
}
/**
* @return the fire
*/
public String getFire() {
return fire;
}
/**
* @param reactivity the reactivity to set
*/
public void setReactivity(String reactivity) {
this.reactivity = reactivity;
}
/**
* @return the reactivity
*/
public String getReactivity() {
return reactivity;
}
/**
* @param specific the specific to set
*/
public void setSpecific(String specific) {
this.specific = specific;
}
/**
* @return the specific
*/
public String getSpecific() {
return specific;
}
/**
* @param health the health to set
*/
public void setHealth(String health) {
this.health = health;
}
/**
* @return the health
*/
public String getHealth() {
return health;
}
/**
* @return the strain
*/
public String getStrain() {
return strain;
}
/**
* @param strain the strain to set
*/
public void setStrain(String strain) {
this.strain = strain;
}
/**
* @return the form
*/
public String getForm() {
return form;
}
/**
* @param form the form to set
*/
public void setForm(String form) {
this.form = form;
}
/**
* @return the destination
*/
public String getDestination() {
return destination;
}
/**
* @param destination the destination to set
*/
public void setDestination(String destination) {
this.destination = destination;
}
/**
* @return the custodian
*/
public String getCustodian() {
return custodian;
}
/**
* @param custodian the custodian to set
*/
public void setCustodian(String custodian) {
this.custodian = custodian;
}
/**
* @param composition the composition to set
*/
public void setComposition(String composition) {
this.composition = composition;
}
/**
* @return the composition
*/
public String getComposition() {
return composition;
}
public void setWorkId(String workId) {
this.workId = workId;
}
public String getWorkId() {
return workId;
}
}
| [
"david.crocker@nrel.gov"
] | david.crocker@nrel.gov |
79f1ef61291ec2c2bf126aa6db22841348e729ed | d7049b9f63c661d854c2adcdf347eba85c9bc9db | /src/string/单词接龙.java | 0801c81fd600ce800f60196c39470deb180bc30e | [] | no_license | ScorpioGu/Leetcode | 47f1b84d11eaa9168406b9180ec585b6e1d80521 | 099e44ed89a75d419da3ed9d937a94891e142ed1 | refs/heads/master | 2020-03-28T03:38:11.261842 | 2019-09-23T11:42:34 | 2019-09-23T11:42:34 | 147,659,767 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,124 | java | package string;
import java.util.*;
/**
* @Desc https://leetcode.com/problems/word-ladder/description/
*
* Example 1:
*
* Input:
* beginWord = "hit",
* endWord = "cog",
* wordList = ["hot","dot","dog","lot","log","cog"]
*
* Output: 5
*
* Explanation: As one shortest transformation is "hit" -> "hot" -> "dot" -> "dog" -> "cog",
* return its length 5.
* @Author gcc
* @Date 18-11-11 下午5:10
**/
public class 单词接龙 {
/**
* 双端BFS来做减少事件复杂度
* @param beginWord
* @param endWord
* @param wordList
* @return
*/
public int ladderLength(String beginWord, String endWord, List<String> wordList) {
if (wordList == null || wordList.size() == 0 || !wordList.contains(endWord)) {
return 0;
}
int strLen = beginWord.length();
Set<String> start = new HashSet<>();
Set<String> end = new HashSet<>();
start.add(beginWord);
end.add(endWord);
int len = 1;
while (!start.isEmpty() && !end.isEmpty()) {
//交换,保持start与end是size接近,能减少时间复杂度
if (start.size() > end.size()) {
Set<String> tmp = start;
start = end;
end = tmp;
}
//set是无序的,所以用队列中常使用的记录size判断这一层是否结束是不可行的,不像队列每次都插入到尾部
//用一个tmp存储下一层的节点,当这一层遍历结束之后,移动start指针指向下一层的set
Set<String> tmp = new HashSet<>();
for (String s : start) {
char[] chars = s.toCharArray();
for (int i = 0; i < strLen; i++) {
for (char c = 'a'; c <= 'z'; c++) {
char pre = chars[i];
chars[i] = c;
String newS = String.valueOf(chars);
if (end.contains(newS)) {
return len + 1;
}
if (wordList.contains(newS)) {
tmp.add(newS);
wordList.remove(newS);
}
chars[i] = pre;
}
}
}
start = tmp;
len++;
}
return 0;
}
/**
* 用队列做一样也是可以的
* @param beginWord
* @param endWord
* @param wordList
* @return
*/
public int ladderLength2(String beginWord, String endWord, List<String> wordList) {
if (wordList == null || wordList.size() == 0 || !wordList.contains(endWord)) {
return 0;
}
Set<String> wordSet = new HashSet<>(wordList);
Queue<String> start = new LinkedList<>();
Queue<String> end = new LinkedList<>();
int len = 1;
int strLen = beginWord.length();
start.offer(beginWord);
end.offer(endWord);
while (!start.isEmpty() && !end.isEmpty()) {
if (start.size() > end.size()) {
Queue<String> set = start;
start = end;
end = set;
}
int size = start.size();
for (int j=0; j<size; j++) {
String word = start.poll();
char[] chs = word.toCharArray();
for (int i = 0; i < chs.length; i++) {
for (char c = 'a'; c <= 'z'; c++) {
char old = chs[i];
chs[i] = c;
String target = String.valueOf(chs);
if (end.contains(target)) {
return len + 1;
}
if (wordSet.contains(target)) {
start.offer(target);
wordSet.remove(target);
}
chs[i] = old;
}
}
}
len++;
}
return 0;
}
}
| [
"xdugucc@sina.com"
] | xdugucc@sina.com |
7081890b6eab3cac2d6500e38f7c5264519ae15e | f651581db912733c0ed5ffae8e4702e5796c61c8 | /src/test/java/com/ccsip/coap/master/metadata/ScomMetricServiceTests.java | 4ef1f7a21342ce75e8634aed004a47b536a9ff20 | [] | no_license | genkimaru/spring-boot-security | 2b71048be26d593c7b1e8e54797450ad008c6a34 | 7b6e1b1c0938328c607e5236e9f0ec1ade548376 | refs/heads/master | 2020-05-04T21:23:15.468368 | 2019-04-04T11:01:41 | 2019-04-04T11:01:41 | 179,474,595 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 788 | java | package com.ccsip.coap.master.metadata;
import static org.junit.Assert.assertEquals;
import java.util.List;
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 com.ccsip.coap.master.metadata.domain.metadata.ScomMetric;
import com.ccsip.coap.master.metadata.service.ScomMetricService;
@RunWith(SpringRunner.class)
@SpringBootTest
public class ScomMetricServiceTests {
@Autowired
ScomMetricService scomMetricService;
@Test
public void testfindAllKeyIsNull() {
List<ScomMetric> scomMetricMap = scomMetricService.findAllKeyIsNull();
assertEquals(scomMetricMap.size() , 5);
}
}
| [
"guan.c.wang@accenture.com"
] | guan.c.wang@accenture.com |
a0a2bd34a186430fa8100271da297c85112459b9 | 5c60f26da9f89852453bc2863b10c2fa6a857b40 | /src/main/java/com/archyx/instanceguard/commands/RegionCreateCommand.java | dbfa2ba6f657458cfc2a3c44268120038d2ba17c | [] | no_license | Archy-X/InstanceGuard | 2ba345395e562febd77295590118ac14dc1a0ce4 | 4e7aef88fbed931455bad980105445d4e7551175 | refs/heads/main | 2023-06-24T04:47:13.224675 | 2021-07-10T07:25:29 | 2021-07-10T07:25:29 | 349,931,273 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,648 | java | package com.archyx.instanceguard.commands;
import com.archyx.instanceguard.InstanceGuard;
import com.archyx.instanceguard.player.PlayerData;
import com.archyx.instanceguard.region.CuboidRegion;
import com.archyx.instanceguard.region.RegionManager;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import net.minestom.server.command.CommandSender;
import net.minestom.server.command.builder.Command;
import net.minestom.server.command.builder.CommandContext;
import net.minestom.server.command.builder.arguments.ArgumentString;
import net.minestom.server.command.builder.arguments.ArgumentType;
import net.minestom.server.entity.Player;
import net.minestom.server.instance.Instance;
import net.minestom.server.utils.BlockPosition;
public class RegionCreateCommand extends Command {
public RegionCreateCommand(InstanceGuard extension) {
super("create");
ArgumentString idArgument = ArgumentType.String("id");
setDefaultExecutor(this::usage);
addSyntax((sender, context) -> {
if (!sender.isPlayer()) {
sender.sendMessage(Component.text("Only players can execute this command!", NamedTextColor.YELLOW));
return;
}
Player player = sender.asPlayer();
String id = context.get(idArgument);
PlayerData playerData = extension.getPlayerManager().getPlayerData(player);
BlockPosition firstPosition = playerData.getFirstPosition();
BlockPosition secondPosition = playerData.getSecondPosition();
if (firstPosition == null || secondPosition == null) {
player.sendMessage(Component.text("You do not have a region selected, use the wand to create a selection", NamedTextColor.YELLOW));
return;
}
Instance instance = player.getInstance();
RegionManager regionManager = extension.getRegionManager(instance);
if (regionManager == null) {
player.sendMessage(Component.text("There are no chunks loaded in this instance!", NamedTextColor.YELLOW));
return;
}
if (regionManager.getRegion(id) != null) {
player.sendMessage(Component.text("There is already a region in this instance with the id " + id, NamedTextColor.YELLOW));
return;
}
int tempX;
if (secondPosition.getX() < firstPosition.getX()) {
tempX = secondPosition.getX();
secondPosition.setX(firstPosition.getX());
firstPosition.setX(tempX);
}
int tempY;
if (secondPosition.getY() < firstPosition.getY()) {
tempY = secondPosition.getY();
secondPosition.setY(firstPosition.getY());
firstPosition.setY(tempY);
}
int tempZ;
if (secondPosition.getZ() < firstPosition.getZ()) {
tempZ = secondPosition.getZ();
secondPosition.setZ(firstPosition.getZ());
firstPosition.setZ(tempZ);
}
regionManager.addRegion(new CuboidRegion(id, firstPosition, secondPosition));
player.sendMessage(Component.text("Successfully created region with id " + id, NamedTextColor.DARK_AQUA));
}, idArgument);
}
private void usage(CommandSender sender, CommandContext context) {
sender.sendMessage(Component.text("Usage: ", NamedTextColor.WHITE)
.append(Component.text("/region create <id>", NamedTextColor.YELLOW)));
}
}
| [
"archydevelopment@gmail.com"
] | archydevelopment@gmail.com |
ee918d3bc1459673b9ecf8b3bc4f8c7b9b82cfa4 | 37d253a98081e70b9fc745db9b0ea373bfa1f6d4 | /DarkFieldGrid3DTensor.java | 49be530252ffd77e58f8a94d7cec07456f6f3bcf | [] | no_license | ShiyangHu/FlorianDarkField | 943078b59cfe5daca140a90c8999f751e626e570 | 3a977b63bbeed9d98960fc7a41b0777938362c4d | refs/heads/master | 2021-01-16T22:41:02.794378 | 2015-08-18T14:57:34 | 2015-08-18T14:57:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,642 | java | // This code was developed in a collaboration with ECAP, Erlangen, Germany.
// This part of the code is not to be published under GPL before Oct 31st 2017.
// author@ Florian Schiffers July 1st, 2015
//
package edu.stanford.rsl.science.darkfield.FlorianDarkField;
import ij.IJ;
import ij.ImagePlus;
import ij.ImageStack;
import ij.measure.Calibration;
import weka.core.pmml.jaxbbindings.SetPredicate;
import edu.stanford.rsl.conrad.data.Grid;
import edu.stanford.rsl.conrad.data.numeric.Grid3D;
import edu.stanford.rsl.conrad.data.numeric.Grid4D;
import edu.stanford.rsl.conrad.data.numeric.MultiChannelGrid3D;
import edu.stanford.rsl.conrad.geometry.General;
import edu.stanford.rsl.conrad.numerics.SimpleVector;
import edu.stanford.rsl.conrad.utils.ImageUtil;
/**
*
*
* @author Florian Schiffers
*
*/
public class DarkFieldGrid3DTensor extends Grid4D {
// Defines dimension of volume box
public int imgSizeX;
public int imgSizeY;
public int imgSizeZ;
/**
* @param imgSizeX - [px]
* @param imgSizeY - [px]
* @param imgSizeZ - [px]
* @param numChannels
*/
public DarkFieldGrid3DTensor(int imgSizeX, int imgSizeY, int imgSizeZ, int numChannels){
// Call constructor of MultiChannelGrid3D
super(imgSizeX, imgSizeY, imgSizeZ, numChannels);
this.imgSizeX=imgSizeX;
this.imgSizeY=imgSizeY;
this.imgSizeZ=imgSizeZ;
}
/**
* write3DTensor writes the volume to a given file specified by filePath
* The name of the Image is not further defined, so default ""
* @param filePath - Path where Volume should be saved
*/
public void write3DTensorToImage(String filePath){
write3DTensorToImage(filePath, "");
}
/**
* @param filePath - Path where Volume should be saved
* @param volumeName - Name of the image
*/
public void write3DTensorToImage(String filePath, String volumeName){
ImagePlus myImage = wrapDarkFieldGrid3DTensorToImagePlus(this, volumeName);
IJ.save(myImage,filePath);
}
/**
* Multiplies the whole grid with a given factor
* @param factor
*/
public void multiply(float factor){
for(int x = 0; x <this.getSize()[0]; x++){
for(int y = 0; y <this.getSize()[1]; y++){
for(int z = 0; z <this.getSize()[0]; z++){
multiplyAtIndexDarkfield(x,y,z,factor);
} // End loop z
} // End loop y
} // End loop z
}
/**
* indexToPhysical calculates the world coordinate of a voxel element at (x,y,z)
* @param x
* @param y
* @param z
* @return Array of physical world coordinates of one voxel element
*/
public double[] indexToPhysical(double x, double y, double z) {
return new double[] { x * this.spacing[0] + this.origin[0],
y * this.spacing[1] + this.origin[1],
z * this.spacing[2] + this.origin[2]
};
}
/**
* @return Number of channels (e.g. scatterDirections)
*/
public int getNumberOfChannels(){
// Return size of the last element of getSize()
// This is the number of channels
return this.getSize()[3];
}
/**
* Multiplies the complete given grid tensor vector with a scalar value factor
* @param x
* @param y
* @param z
* @param factor
*/
public void multiplyAtIndexDarkfield(int x, int y, int z, float factor){
// Loop through all channels and multiply with factor
for (int channel = 0; channel < this.getNumberOfChannels() ; channel++){
// Multiply current value with factor
float value = getAtIndex(x,y,z,channel);
value = value*factor;
setAtIndex(x,y,z,channel,value);
}
}
/**
* Multiplies the entry of a given channel with a scalar value
* @param x
* @param y
* @param z
* @param channel
* @param val
*/
public void multiplyAtIndexDarkfield(int x, int y, int z, int channel, float val){
setAtIndex(x, y,z, channel,getAtIndex(x, y, z, channel) *val);
}
@Override
/**
* Stores a channel value to given channel
* @param x
* @param y
* @param z
* @param channel
* @param value
*/
public void setAtIndex(int x, int y, int z, int channel, float value){
super.setAtIndex(x,y,z,channel,value);
}
/**
* Adds a given value to point at channel n
* @param x
* @param y
* @param z
* @param channel
* @param val
*/
public void addAtIndexDarkfield(int x, int y, int z, int channel, float val){
setAtIndex(x, y,z, channel,getAtIndex(x, y,z, channel) + val);
}
/**
* Stores a whole tensor vector into grid point
* @param x
* @param y
* @param z
* @param values
*/
public void setDarkFieldScatterTensor(int x, int y, int z, float[] values) {
// Check if dimension of input and to be saved values are the same
if( values.length != this.getNumberOfChannels() ){
throw new ArithmeticException("Dimension of input vector and vector to be set not equal.");
}
// Loop through all channels and set value
for (int channel = 0; channel < values.length; channel++){
setAtIndex(x,y,z,channel,values[channel]);
}
}
/**
* stores a tensor vector into the given grid point at (x,y,z)
* @param x
* @param y
* @param z
* @param values
*/
public void setDarkFieldScatterTensor(int x, int y, int z, SimpleVector values) {
// Check if dimension of input and to be saved values are the same
if( values.getLen() != this.getNumberOfChannels() ){
throw new ArithmeticException("Dimension of input vector and vector to be set not equal.");
}
// Loop through all channels and set value
for (int channel = 0; channel < values.getLen(); channel++){
setAtIndex(x,y,z,channel,(float)values.getElement(channel));
}
}
/**
* returns the tensor vector at a given voxel point
* @param x
* @param y
* @param z
* @return - vector
*/
public float[] getVectorAtIndex(int x, int y, int z) {
float[] myVec = new float[getNumberOfChannels()];
for (int channel = 0; channel < getNumberOfChannels(); channel++){
myVec[channel] = getAtIndex(x, y, z, channel);
}
return myVec;
}
/**
* returns the tensor vector at a given voxel point
* @param x
* @param y
* @param z
* @return - vector
*/
public SimpleVector getSimpleVectorAtIndex(int x, int y, int z) {
SimpleVector myVec = new SimpleVector(getNumberOfChannels());
for (int channel = 0; channel < getNumberOfChannels(); channel++){
myVec.setElementValue(channel, getAtIndex(x, y, z, channel));
}
return myVec;
}
/**
* Set's the all values of the tensor vector to a specific value
* @param x
* @param y
* @param z
* @param val
*/
public void setAtIndex(int x, int y, int z, float val) {
for(int channel = 0; channel < this.getNumberOfChannels(); channel++){
setAtIndex(x, y, z, channel, val);
}
}
/**
* Add a given tensor vector on top of a grid point
* @param x
* @param y
* @param z
* @param values
*/
public void subAtDarkFieldScatterTensor(int x, int y, int z, float[] values) {
// Check if dimension of input and to be saved values are the same
if( values.length != this.getNumberOfChannels() ){
throw new ArithmeticException("Dimension of input vector and vector to be set not equal.");
}
// Loop through all channels and add value
for (int channel = 0; channel < values.length; channel++){
setAtIndex(x,y,z,channel,getAtIndex(x, y,z, channel) - values[channel]);
}
}
/**
* Adds a given tensor vector on top of a grid point
* @param x
* @param y
* @param z
* @param values
*/
public void addAtDarkFieldScatterTensor(int x, int y, int z, float[] values) {
// Check if dimension of input and to be saved values are the same
if( values.length != this.getNumberOfChannels() ){
throw new ArithmeticException("Dimension of input vector and vector to be set not equal.");
}
// Loop through all channels and add value
for (int channel = 0; channel < this.getNumberOfChannels(); channel++){
float val = getAtIndex(x, y, z, channel) + values[channel];
setAtIndex(x,y,z,channel,val);
}
}
/** (non-Javadoc)
* overrides the show() method of Grid4D to deal with DarkFieldGrid3DTensor Data
*/
@Override
public void show(){
show("");
}
/** (non-Javadoc)
* overrides the show() method of Grid4D to deal with DarkFieldGrid3DTensor Data
* @param title is the title of the image to be shown
*/
@Override
public void show(String title){
wrapDarkFieldGrid3DTensorToImagePlus(this, title).show();
}
/**
* Displays each scatter direction component of the Grid4D as an own image
* All of them are Grid3D, which then can be displayed as a volume
* by the volume viewer.
*
*/
public void showComponents(){
for(int channel = 0; channel < getNumberOfChannels(); channel++){
String myTitle = "Volume at channel " + channel;
getSubGrid(channel).show(myTitle);
}
}
/**
* Displays a specific scatter direction component (this is a Grid3D)
* @param channel
*/
public void showComponent(int channel){
String myTitle = "Volume at channel " + channel;
getSubGrid(channel).show(myTitle);
}
/**
* Writes calibration for the imagePlus of a given DarkFieldGrid3DTensor
* @param imagePlus
* @param grid
*/
private static void setCalibrationToImagePlus(ImagePlus imagePlus, DarkFieldGrid3DTensor grid){
Calibration calibration = imagePlus.getCalibration();
calibration.xOrigin = General.worldToVoxel(0, grid.getSpacing()[0], grid.getOrigin()[0]);
calibration.yOrigin = General.worldToVoxel(0, grid.getSpacing()[1], grid.getOrigin()[1]);
calibration.zOrigin = General.worldToVoxel(0, grid.getSpacing()[2], grid.getOrigin()[2]);
calibration.pixelWidth = grid.getSpacing()[0];
calibration.pixelHeight = grid.getSpacing()[1];
calibration.pixelDepth = grid.getSpacing()[2];
}
/**
* @param grid
* @param title
* @return
*/
public static ImagePlus wrapDarkFieldGrid3DTensorToImagePlus(DarkFieldGrid3DTensor grid, String title){
if (grid != null) {
//ImageStack stack = new ImageStack(grid.getSize()[0], grid.getSize()[1], grid.getSize()[2]);
// Create a new ImagePlus
ImagePlus hyper = new ImagePlus();
// Create an hyperStack
ImageStack hyperStack = new ImageStack(grid.imgSizeX, grid.imgSizeY);
// Go through all elements of 4th component
for (int channel = 0; channel < grid.getNumberOfChannels(); channel++) {
for (int z = 0; z < grid.imgSizeZ; z++) {
hyperStack.addSlice("", ImageUtil.wrapGrid2D(grid.getSubGrid(channel).getSubGrid(z)));
}
}
setCalibrationToImagePlus(hyper, grid);
hyper.setStack(title, hyperStack);
hyper.setDimensions(1, grid.imgSizeZ, grid.getNumberOfChannels());
hyper.setOpenAsHyperStack(true);
return hyper;
} else
return null;
}
}
| [
"florianschiffers@gmx.de"
] | florianschiffers@gmx.de |
91c5482231f408ae0e2f85f6c3f99e0a91ee181d | e844c51691b46132a6e445ecca5193480bb8dd6d | /src/kujiin/util/table/AmbienceSongWithNumber.java | 1f3e22c97d1b9c031f141d0913e3708741505137 | [
"MIT"
] | permissive | calebtrahan/KujiIn_Java | 77782049e2fc82f3169879d887b91fb41ea31809 | 962e5b1c5f60328fd317067bb24146b46f35f15f | refs/heads/master | 2021-01-24T11:01:28.737342 | 2018-06-05T20:52:59 | 2018-06-05T20:52:59 | 45,854,437 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,545 | java | package kujiin.util.table;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.util.Duration;
import kujiin.util.Util;
import kujiin.xml.SoundFile;
import java.io.File;
public class AmbienceSongWithNumber {
public IntegerProperty number;
public StringProperty name;
public StringProperty length;
private File file;
private double duration;
public AmbienceSongWithNumber(int id, SoundFile soundFile) {
number = new SimpleIntegerProperty(id);
name = new SimpleStringProperty(soundFile.getName());
file = soundFile.getFile();
duration = soundFile.getDuration();
length = new SimpleStringProperty(Util.formatdurationtoStringDecimalWithColons(Duration.millis(duration)));
}
public AmbienceSongWithNumber(int id, AmbienceSong ambienceSong) {
number = new SimpleIntegerProperty(id);
name = new SimpleStringProperty(ambienceSong.getName());
file = ambienceSong.getFile();
duration = ambienceSong.getDuration();
length = new SimpleStringProperty(Util.formatdurationtoStringDecimalWithColons(Duration.millis(duration)));
}
public String getName() {
return name.getValue();
}
public File getFile() {
return file;
}
public double getDuration() {return duration;}
public void setNumber(int number) {
this.number.set(number);
}
}
| [
"calebtr1@gmail.com"
] | calebtr1@gmail.com |
219d7ecff581491086a2d6ada7bca1739a7c2a54 | 38269ef42d042c986cc299b57a651a11af18494a | /rule-engine/rule-engine-front/src/main/java/com/foxconn/core/pro/server/rule/engine/front/dto/NoticeDto.java | 7a065f1344015e1677cfd7c560aa48e18fdb5009 | [] | no_license | walh1314/myproject | 152c8f40350e1cbf25388564f3f2d3a7992ff427 | 600e47d21e07298f19cd88acbf2f8da65cb689b4 | refs/heads/master | 2020-03-28T22:05:30.522922 | 2018-09-18T00:21:31 | 2018-09-18T00:21:31 | 149,204,527 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,057 | java | /**
* Project Name:rule-engine-front
* File Name:NoticeDto.java
* Package Name:com.foxconn.core.pro.server.rule.engine.front.dto
* Date:2018年9月11日下午4:17:22
* Copyright (c) 2018, Foxconn All Rights Reserved.
*
*/
package com.foxconn.core.pro.server.rule.engine.front.dto;
import java.io.Serializable;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Getter;
import lombok.Setter;
/**
* ClassName:NoticeDto <br/>
* Function: TODO ADD FUNCTION. <br/>
* Reason: TODO ADD REASON. <br/>
* Date: 2018年9月11日 下午4:17:22 <br/>
* @author liupingan
* @version
* @since JDK 1.8
* @see
*/
@Setter
@Getter
public class NoticeDto implements Serializable
{
/**
* serialVersionUID:TODO(用一句话描述这个变量表示什么).
* @since JDK 1.8
*/
private static final long serialVersionUID = -6497951500306246382L;
@JSONField(name="tenantId")
private Integer tenantId;
@JSONField(name="databaseType")
private String databaseType;
@JSONField(name="dbName")
private String dbName;
}
| [
"522985342@qqq.com"
] | 522985342@qqq.com |
209d254bde1357fd76fdd0fbec14aa0cca51b63d | 551224fd63857b432d5e7d828dc1768e93ce209c | /m3-java-capstone/src/test/java/com/techelevator/npgeek/pageObject/HomePage.java | ef7a5af70f3887c72990c85cc9804e584ab39a1e | [] | no_license | handoniumumumum/NationalParkGeek | 4e50d44b6e7e0917374178d8f27ab96892c48973 | b3d34fcd0fc041db52b3319c29697dc99d12fc85 | refs/heads/master | 2020-08-01T15:09:13.959644 | 2016-11-12T19:53:19 | 2016-11-12T19:53:19 | 73,574,479 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 472 | java | package com.techelevator.npgeek.pageObject;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
public class HomePage {
private WebDriver webDriver;
public HomePage(WebDriver webDriver) {
this.webDriver=webDriver;
}
public ParkDetailPage clickableLink(String parkName) {
WebElement parkLink = webDriver.findElement(By.id(parkName));
parkLink.click();
return new ParkDetailPage(webDriver);
}
}
| [
"leon0418@sbcglobal.net"
] | leon0418@sbcglobal.net |
c43c58bc95cd7eb40dd35597c28b6de9bdc9a0d3 | 6977dc1bbdfa5fd29a3fff7437f4657fe8c7f691 | /src/chap07/textbook/s070702/Car.java | c0480ec446858af7b64d1f7eb7ce5bf3ed934a9e | [] | no_license | yeoli/java20200929 | 6f6ff6cd84addd7ad33097cc4552b9494ea4eb18 | 98841e8f9437f6196ce3d15b9fde996ad3432d2b | refs/heads/master | 2023-01-08T05:42:46.490881 | 2020-11-07T05:23:33 | 2020-11-07T05:23:33 | 299,485,593 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 629 | java | package chap07.textbook.s070702;
public class Car {
Tire frontLeftTire = new Tire("앞왼쪽", 6);
Tire frontRightTire = new Tire("앞오른쪽", 2);
Tire backLeftTire = new Tire("뒤왼쪽", 3);
Tire backRightTire = new Tire("뒤오른쪽", 4);
int run() {
System.out.println("[자동차가 달립니다.]");
if(frontLeftTire.roll()==false) { stop(); return 1;}
if(frontRightTire.roll()==false) { stop(); return 2;}
if(backLeftTire.roll()==false) { stop(); return 3;}
if(backRightTire.roll()==false) { stop(); return 4;}
return 0;
}
void stop() {
System.out.println("자동차가 멈춥니다.");
}
}
| [
"yeo3580@naver.com"
] | yeo3580@naver.com |
ec7ee2a19084659469163426e4ae89c24bb7b0ef | d44b2e95c301b12ac01bde87f526f7d3514a49d9 | /chapter2/src/main/java/com/example/chapter2/MainActivity.java | d13738feb373d8b828fb43d27da5d84dbfa4af21 | [] | no_license | panq-jack/androidArtResourceDemo | 2e7754a7b17c5004e8283fd3641481f4dc8730d5 | b7d27a58168b4b382b5ad50dd527be4986407be8 | refs/heads/master | 2020-03-19T05:11:14.097686 | 2018-06-10T06:39:48 | 2018-06-10T06:39:48 | 135,907,449 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,731 | java | package com.example.chapter2;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import com.example.chapter2.aidl.Book;
import com.example.chapter2.manager.UserManager;
import com.example.chapter2.model.User;
import com.example.mylibrary.utils.MyUtils;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.Serializable;
/**
* 测试跨进程 intent方式
*/
public class MainActivity extends Activity {
private static final String TAG = "ppp_MainActivity";
public static final String dirPath = MyApplication.instance.getExternalCacheDir()+File.separator+"chapter2";
public static final String filePath = dirPath+File.separator+"userCache";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
UserManager.sUserId = 2;
findViewById(R.id.button1).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent();
intent.setClass(MainActivity.this, SecondActivity.class);
User user = new User(0, "jake", true);
user.book = new Book();
intent.putExtra("extra_user", (Serializable) user);
startActivity(intent);
}
});
}
@Override
protected void onResume() {
Log.d(TAG, "UserManage.sUserId=" + UserManager.sUserId);
persistToFile();
super.onResume();
}
private void persistToFile() {
new Thread(new Runnable() {
@Override
public void run() {
User user = new User(1, "hello world", false);
// File dir = new File(MyConstants.CHAPTER_2_PATH);
File dir = new File(dirPath);
if (!dir.exists()) {
dir.mkdirs();
}
File cachedFile = new File(filePath);
ObjectOutputStream objectOutputStream = null;
try {
objectOutputStream = new ObjectOutputStream(
new FileOutputStream(cachedFile));
objectOutputStream.writeObject(user);
Log.d(TAG, "persist user:" + user);
} catch (IOException e) {
e.printStackTrace();
} finally {
MyUtils.close(objectOutputStream);
}
}
}).start();
}
}
| [
"1248499657@qq.com"
] | 1248499657@qq.com |
7004de34b04d2fab179720346d77a9765d22bba3 | 0e173b1b4066a34ef4c6cea2dd8609d83ed4e97d | /kodilla-stream/src/main/java/com/kodilla/stream/book/BookDirectory.java | 7ee83ef0859efe989cee581d53603b9e99c2a0c9 | [] | no_license | agammkrawczyk/agnieszkakrawczyk | f33d968edbb9dd1d3ca007af31cad2d98a84a700 | e24562d9cef95cf1e0bb910442a88e855f6ed426 | refs/heads/master | 2020-03-17T07:36:08.125156 | 2018-12-15T20:00:55 | 2018-12-15T20:00:55 | 133,405,118 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,047 | java | package com.kodilla.stream.book;
import java.util.ArrayList;
import java.util.List;
public final class BookDirectory {
private final List<Book> theBookList = new ArrayList<>();
public BookDirectory() {
theBookList.add(new Book("Dylan Murphy", "Wolf of the mountain",
2003, "0001"));
theBookList.add(new Book("Phoebe Pearson", "Slaves of dreams",
2012, "0002"));
theBookList.add(new Book("Morgan Walsh", "Obliteration of heaven",
2001, "0003"));
theBookList.add(new Book("Aimee Murphy", "Rejecting the night",
2015, "0004"));
theBookList.add(new Book("Ryan Talley", "Gangsters and kings",
2007, "0005"));
theBookList.add(new Book("Madelynn Carson", "Unity without duty",
2007, "0006"));
theBookList.add(new Book("Giancarlo Guerrero", "Enemies of eternity",
2009, "0007"));
}
public List<Book> getList() {
return new ArrayList<>( theBookList );
}
}
| [
"agammkrawczyk@gmail.com"
] | agammkrawczyk@gmail.com |
b89996efa15911384c00056339e2a8dc7ac094f6 | a584d44b0fc952cddbada9b15296a1b5adaa7c9c | /app/src/main/java/com/example/recyclerandcardview/doctor_activity/MainActivity.java | e0022a017a1f1a94e6af2ab345c90874f6ad28bf | [] | no_license | asifshahriar/RecyclerandCardView | 22f14f564f44b34aaa92e18000421c07327e5d53 | c5beaf864e739760ae936391ff9403c47d8f288e | refs/heads/master | 2020-07-17T11:56:01.417157 | 2019-09-08T06:57:12 | 2019-09-08T06:57:12 | 205,923,445 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,074 | java | package com.example.recyclerandcardview.doctor_activity;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import com.example.recyclerandcardview.R;
import com.example.recyclerandcardview.adapter.MyAdapter;
import com.example.recyclerandcardview.others_activity.Profile;
public class MainActivity extends AppCompatActivity {
MyAdapter myAdapter;
int[] images = {R.drawable.splash_logo,R.drawable.splash_logo,R.drawable.splash_logo,R.drawable.splash_logo,R.drawable.splash_logo,R.drawable.splash_logo,R.drawable.splash_logo};
String[] DrName, DrDesc, phone, details;
private RecyclerView recycler;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
recycler = findViewById(R.id.recyclerId);
DrName = getResources().getStringArray(R.array.Cardiology_name);
DrDesc = getResources().getStringArray(R.array.Cardiology_desc);
details = getResources().getStringArray(R.array.Cardiology_details);
phone = getResources().getStringArray(R.array.Cardiology_Phone);
myAdapter = new MyAdapter(getApplicationContext(), images, DrName, DrDesc);
recycler.setAdapter(myAdapter);
recycler.setLayoutManager(new LinearLayoutManager(this));
myAdapter.setOnItemClickListener(new MyAdapter.ClickListener() {
@Override
public void onItemClick(int i, View v) {
Intent intent = new Intent(MainActivity.this, Profile.class);
intent.putExtra("name", DrName[i]);
intent.putExtra("images",images[i]);
intent.putExtra("desc",DrDesc[i]);
intent.putExtra("details",details[i]);
intent.putExtra("phone",phone[i]);
startActivity(intent);
}
});
}
}
| [
"iamasif.bd@gmailcom"
] | iamasif.bd@gmailcom |
5cf80135875b8697a3c78a548a622d9cf8fe018c | 93292c554781ae4609c8b21f508d74897fc33820 | /Thread/src/cn/test/extend/TestJvm.java | ff551bc459a492db5e1b0cb4ee378b322f4f0ed1 | [] | no_license | 25506432/testThread | 7180c3c42b5d79641b37c01a25db95f4912658be | cfa592029ac67937e84b48d73dca1d7b095907c1 | refs/heads/master | 2020-04-06T13:45:23.839232 | 2018-11-14T08:28:49 | 2018-11-14T08:28:49 | 157,513,366 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 183 | java | package cn.test.extend;
public class TestJvm {
public static void main(String[] args) {
}
public void testJvm(int a){
int b = 0;
int sum = a + b;
}
}
| [
"25506432@qq.com"
] | 25506432@qq.com |
6857d8cd3e1c92870f731997848b8b49e26f7bce | 5a9fdd57a03f49b3f6d753fe1282a63e9a889391 | /app/src/main/java/com/utsman/kucingapes/mobilelearningprodisejarah/Favorit/RcGetter.java | bb910bc4d8f2acd8a3c9d5eca5e5091949ae3608 | [] | no_license | utsmannn/BelajarSejarah | ce98a059da9549e6a0f42aba04128eb0233e0f80 | c1be9a57d828eb8d3eb9be6107431ae45f663685 | refs/heads/master | 2020-03-17T03:22:11.758776 | 2018-10-15T02:34:13 | 2018-10-15T02:34:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,946 | java | package com.utsman.kucingapes.mobilelearningprodisejarah.Favorit;
public class RcGetter {
private int idCat;
private String nameCat;
private String titleCat;
private String cat;
private int id;
private String img;
private String imgCat;
private String title;
private String body;
public RcGetter(int idCat, String nameCat, String titleCat, String cat, int id, String img, String imgCat, String title, String body) {
this.idCat = idCat;
this.nameCat = nameCat;
this.titleCat = titleCat;
this.cat = cat;
this.id = id;
this.img = img;
this.imgCat = imgCat;
this.title = title;
this.body = body;
}
public RcGetter() {
}
public int getIdCat() {
return idCat;
}
public void setIdCat(int idCat) {
this.idCat = idCat;
}
public String getNameCat() {
return nameCat;
}
public void setNameCat(String nameCat) {
this.nameCat = nameCat;
}
public String getTitleCat() {
return titleCat;
}
public void setTitleCat(String titleCat) {
this.titleCat = titleCat;
}
public String getCat() {
return cat;
}
public void setCat(String cat) {
this.cat = cat;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getImg() {
return img;
}
public void setImg(String img) {
this.img = img;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getBody() {
return body;
}
public void setBody(String body) {
this.body = body;
}
public String getImgCat() {
return imgCat;
}
public void setImgCat(String imgCat) {
this.imgCat = imgCat;
}
}
| [
"kucingapes@gmail.com"
] | kucingapes@gmail.com |
527ae0d468a03fb294337f1a698f78c6e35eeb58 | cd2c6721b6c81b9d7355d566ca83abbafc44b912 | /src/com/startjava/Lesson_4/guessNumberArray/GuessNumberArray.java | dadaec6a200a40d9e036b3434c0e5addabb76c52 | [] | no_license | SaylarV/StartJava | 664b32a58bf32af0617049d0eafd0809db177466 | fe3c8a3a53a167bffc55ef3ff7e2c2a025a220e1 | refs/heads/master | 2020-08-04T10:07:45.068796 | 2019-10-06T14:17:05 | 2019-10-06T14:17:05 | 212,101,116 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,611 | java | package com.startjava.Lesson_4.guessNumberArray;
import java.util.ArrayList;
import java.util.Scanner;
public class GuessNumberArray {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("Tell your name, first player");
String firstPlayerName = scanner.next();
System.out.println("Tell your name, second player");
String secondPlayerName = scanner.next();
System.out.println("Let's play a game! Guess number from 0 to 100! Everyone can try 10 times!");
GuessNumber game = new GuessNumber();
Player playerOne = new Player(firstPlayerName);
Player playerTwo = new Player(secondPlayerName);
int countTry = 1;
String answer = "yes";
ArrayList<Integer> playerOneNumbers = new ArrayList<>();
ArrayList<Integer> playerTwoNumbers = new ArrayList<>();
while(answer.equals("yes")) {
while (!game.getWin()) {
System.out.println(firstPlayerName + ", guess number");
game.guess();
playerOneNumbers.add(game.getNumber());
if (game.getWin()) {
System.out.println("Player " + firstPlayerName + " guessed a number " + game.getNumber() +
" from " + countTry + " attempt" + ", congratulations!");
System.out.println("His numbers: ");
for (Integer playerOneNumber : playerOneNumbers) {
System.out.print(playerOneNumber + " ");
}
break;
}
System.out.println(secondPlayerName + ", guess number");
game.guess();
playerTwoNumbers.add(game.getNumber());
if (game.getWin()) {
System.out.println("Player " + secondPlayerName + " guessed a number " + game.getNumber() +
" from " + countTry + " attempt" + ", congratulations!");
System.out.print("His numbers: ");
for (Integer playerTwoNumber : playerTwoNumbers) {
System.out.print(playerTwoNumber + " ");
}
break;
}
countTry++;
if (countTry > 10) {
System.out.println("Too hard to say, but players ran out of attempts...");
break;
}
}
System.out.println();
System.out.println("Would you like next? Enter yes/no");
countTry = 1;
playerOneNumbers.clear();
playerTwoNumbers.clear();
game.setWin(false);
answer = scanner.next();
}
}
public static class GuessNumber{
int number;
Scanner scanner = new Scanner(System.in);
int rand = (int) (100*Math.random()+1);
boolean win = false;
public void guess() {
number = scanner.nextInt();
if (number > rand) System.out.println("No, number is lower");
else if (number < rand) System.out.println("No, number is bigger");
else {
System.out.println("You won!");
win = true;
rand = (int) (100*Math.random()+1);
}
}
int getNumber (){
return number;
}
boolean getWin (){
return win;
}
public void setWin(boolean win) {
this.win = win;
}
}
public static class Player{
String name;
public Player(String name){
this.name = name;
}
}
}
// Модифицируйте программу Угадай число, используя для хранения, названных игроками чисел, массивы:
// перед началом игры выведите сообщение: У вас 10 попыток
// по окончанию игры отобразите, в две строки через пробел, все названные игроками числа
// если массив полностью не заполнен, т.е. пользователь угадал число менее чем за 10 попыток, то выводить весь массив не нужно
// в конце игры выведите сообщение "Игрок " + имя + " угадал число " + число + " с " + номер + " попытки"
// если игроки не угадали число за 10 попыток, то отобразите сообщение: "У " + имя + " закончились попытки"
//
// Создайте дополнительное поле в классе Player, которое будет хранить введенные пользователем числа
// Для считывания части массива используйте метод Arrays.copyOf
// Для обнуления массивов игроков, при повторном запуске игры, используйте метод Arrays.fill().
// При этом обнуляйте только те ячейки, где хранятся, названные игроками числа
// Попробуйте улучшить читаемость кода, разделив его на небольшие методы (рефакторинг) | [
"vazhuravlevwork@gmail.com"
] | vazhuravlevwork@gmail.com |
e881203e2bd35e6d846d2dd606e37cd7c8b9be4a | 65a09ca89466acbdc3e2e727796922380cd2a900 | /src/main/java/com/balance/service/CityService.java | e08c35a5ddc1a55db9e582809128e5ff34886698 | [] | no_license | clarkprince/balance-app | 6e19fe7d40ae27e1ba8bd424801f1fa5be91befa | 2da55991d347eb09a6764f2d5c0f68647effea5f | refs/heads/master | 2023-07-11T11:19:35.608603 | 2021-08-05T13:41:59 | 2021-08-05T13:41:59 | 390,680,382 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 996 | java | package com.balance.service;
import com.balance.model.City;
import com.balance.model.dto.CityDTO;
import com.balance.repository.CityRepository;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.stream.Collectors;
@Component
public class CityService {
private final CityRepository cityRepository;
public CityService(CityRepository cityRepository) {
this.cityRepository = cityRepository;
}
public CityDTO addCity(CityDTO cityDTO) {
City city = createCity(cityDTO.getName());
City save = cityRepository.save(city);
cityDTO.setCityId(save.getId());
return cityDTO;
}
public List<CityDTO> getAllCities() {
return cityRepository.findAll()
.stream()
.map(city -> new CityDTO(city.getId(), city.getName()))
.collect(Collectors.toList());
}
private City createCity(String name) {
City city = new City();
city.setName(name);
return city;
}
}
| [
"lqhung97@gmail.com"
] | lqhung97@gmail.com |
13ff699e4a63d94b2d31fc1d7e5ee05f0467a3f1 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/7/7_e665620b0166f8386be70537ea7898510ceed4fa/ExchangeRatesFragment/7_e665620b0166f8386be70537ea7898510ceed4fa_ExchangeRatesFragment_t.java | 25c7a17ab77b16467f2a230e8d519148b0865f65 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 8,088 | java | /*
* Copyright 2011-2013 the original author or authors.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.schildbach.wallet.ui;
import java.math.BigInteger;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.database.Cursor;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.LoaderManager;
import android.support.v4.content.CursorLoader;
import android.support.v4.content.Loader;
import android.support.v4.widget.CursorAdapter;
import android.support.v4.widget.ResourceCursorAdapter;
import android.view.View;
import android.widget.BaseAdapter;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;
import com.actionbarsherlock.app.SherlockListFragment;
import com.actionbarsherlock.view.ActionMode;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem;
import com.google.bitcoin.core.Utils;
import com.google.bitcoin.core.Wallet;
import com.google.bitcoin.core.Wallet.BalanceType;
import de.schildbach.wallet.Constants;
import de.schildbach.wallet.ExchangeRatesProvider;
import de.schildbach.wallet.ExchangeRatesProvider.ExchangeRate;
import de.schildbach.wallet.WalletApplication;
import de.schildbach.wallet.util.ThrottelingWalletChangeListener;
import de.schildbach.wallet.util.WalletUtils;
import de.schildbach.wallet_test.R;
/**
* @author Andreas Schildbach
*/
public final class ExchangeRatesFragment extends SherlockListFragment implements LoaderManager.LoaderCallbacks<Cursor>,
OnSharedPreferenceChangeListener
{
private AbstractWalletActivity activity;
private WalletApplication application;
private SharedPreferences prefs;
private LoaderManager loaderManager;
private CursorAdapter adapter;
private BigInteger balance;
private String defaultCurrency;
private final ThrottelingWalletChangeListener walletChangeListener = new ThrottelingWalletChangeListener()
{
@Override
public void onThrotteledWalletChanged()
{
updateView();
}
};
@Override
public void onAttach(final Activity activity)
{
super.onAttach(activity);
this.activity = (AbstractWalletActivity) activity;
this.application = (WalletApplication) activity.getApplication();
this.prefs = PreferenceManager.getDefaultSharedPreferences(activity);
this.loaderManager = getLoaderManager();
}
@Override
public void onCreate(final Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
final Wallet wallet = application.getWallet();
wallet.addEventListener(walletChangeListener);
}
@Override
public void onActivityCreated(final Bundle savedInstanceState)
{
super.onActivityCreated(savedInstanceState);
setEmptyText(getString(R.string.exchange_rates_fragment_empty_text));
adapter = new ResourceCursorAdapter(activity, R.layout.exchange_rate_row, null, true)
{
@Override
public void bindView(final View view, final Context context, final Cursor cursor)
{
final ExchangeRate exchangeRate = ExchangeRatesProvider.getExchangeRate(cursor);
final boolean isDefaultCurrency = exchangeRate.currencyCode.equals(defaultCurrency);
view.setBackgroundResource(isDefaultCurrency ? R.color.bg_less_bright : R.color.bg_bright);
final View defaultView = view.findViewById(R.id.exchange_rate_row_default);
defaultView.setVisibility(isDefaultCurrency ? View.VISIBLE : View.INVISIBLE);
final TextView currencyCodeView = (TextView) view.findViewById(R.id.exchange_rate_row_currency_code);
currencyCodeView.setText(exchangeRate.currencyCode);
final CurrencyTextView rateView = (CurrencyTextView) view.findViewById(R.id.exchange_rate_row_rate);
rateView.setPrecision(Constants.LOCAL_PRECISION);
rateView.setAmount(WalletUtils.localValue(Utils.COIN, exchangeRate.rate));
final CurrencyTextView walletView = (CurrencyTextView) view.findViewById(R.id.exchange_rate_row_balance);
walletView.setPrecision(Constants.LOCAL_PRECISION);
walletView.setAmount(WalletUtils.localValue(balance, exchangeRate.rate));
walletView.setStrikeThru(Constants.TEST);
walletView.setTextColor(getResources().getColor(R.color.fg_less_significant));
}
};
setListAdapter(adapter);
loaderManager.initLoader(0, null, this);
}
@Override
public void onResume()
{
super.onResume();
defaultCurrency = prefs.getString(Constants.PREFS_KEY_EXCHANGE_CURRENCY, Constants.DEFAULT_EXCHANGE_CURRENCY);
prefs.registerOnSharedPreferenceChangeListener(this);
updateView();
}
@Override
public void onPause()
{
prefs.unregisterOnSharedPreferenceChangeListener(this);
super.onPause();
}
@Override
public void onDestroy()
{
application.getWallet().removeEventListener(walletChangeListener);
walletChangeListener.removeCallbacks();
super.onDestroy();
}
@Override
public void onListItemClick(final ListView l, final View v, final int position, final long id)
{
final Cursor cursor = (Cursor) adapter.getItem(position);
final ExchangeRate exchangeRate = ExchangeRatesProvider.getExchangeRate(cursor);
activity.startActionMode(new ActionMode.Callback()
{
public boolean onCreateActionMode(final ActionMode mode, final Menu menu)
{
final MenuInflater inflater = mode.getMenuInflater();
inflater.inflate(R.menu.exchange_rates_context, menu);
return true;
}
public boolean onPrepareActionMode(final ActionMode mode, final Menu menu)
{
mode.setTitle(exchangeRate.currencyCode);
mode.setSubtitle(getString(R.string.exchange_rates_fragment_source, exchangeRate.source));
return true;
}
public boolean onActionItemClicked(final ActionMode mode, final MenuItem item)
{
switch (item.getItemId())
{
case R.id.exchange_rates_context_set_as_default:
handleSetAsDefault(exchangeRate.currencyCode);
mode.finish();
return true;
}
return false;
}
public void onDestroyActionMode(final ActionMode mode)
{
}
private void handleSetAsDefault(final String currencyCode)
{
prefs.edit().putString(Constants.PREFS_KEY_EXCHANGE_CURRENCY, currencyCode).commit();
}
});
}
public void onSharedPreferenceChanged(final SharedPreferences sharedPreferences, final String key)
{
if (Constants.PREFS_KEY_EXCHANGE_CURRENCY.equals(key))
{
defaultCurrency = prefs.getString(Constants.PREFS_KEY_EXCHANGE_CURRENCY, Constants.DEFAULT_EXCHANGE_CURRENCY);
updateView();
}
}
private void updateView()
{
balance = application.getWallet().getBalance(BalanceType.ESTIMATED);
final ListAdapter adapter = getListAdapter();
if (adapter != null)
((BaseAdapter) adapter).notifyDataSetChanged();
}
public Loader<Cursor> onCreateLoader(final int id, final Bundle args)
{
return new CursorLoader(activity, ExchangeRatesProvider.contentUri(activity.getPackageName()), null, null, null, null);
}
public void onLoadFinished(final Loader<Cursor> loader, final Cursor data)
{
adapter.swapCursor(data);
}
public void onLoaderReset(final Loader<Cursor> loader)
{
adapter.swapCursor(null);
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
fb3c77ca2e9660481adf501a7ac4c97b5d21e190 | 319b6fac5f0e8872bdc569b11c9adde66e8eefef | /src/main/java/com/bhuwan/spring/di/autowire/annotation/inject/Client.java | 69ca9ca3024f8d8f91109e36acf50c5c3e6756bb | [] | no_license | bhuwang/spring_playground | 2613a40706d424bee44a6cb9db76c75538483319 | 5a2a8bbbdcb43310e6d177e49d06eed61cb0c2e1 | refs/heads/master | 2021-01-20T21:01:01.238271 | 2016-06-13T04:25:47 | 2016-06-13T04:25:47 | 60,771,327 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 482 | java | /**
*
*/
package com.bhuwan.spring.di.autowire.annotation.inject;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
/**
* @author bhuwan
*
*/
public class Client {
public static void main(String[] args) {
ApplicationContext context = new ClassPathXmlApplicationContext("autowire_annotation_inject.xml");
Car c = (Car) context.getBean("car");
c.printData();
}
}
| [
"bhuwangautam@lftechnology.com"
] | bhuwangautam@lftechnology.com |
9794f2ccd526ce35f3f3ed6d447ae1cd33a4779d | ec6c79b33308ca2e68c67be07dff40e47d7deea8 | /app/src/main/java/com/cnergee/mypage/caller/LogOutCaller.java | 78bfcc55f6e80326d5fdddebb8c31da6f50a9875 | [] | no_license | ashwini-cnergee/ODiGitel | 7edf8cc8dbf0d4ab4bb7ccbfb442500724ba86d8 | b2b3442b6d822d76d08fc18663358aed072f64a4 | refs/heads/master | 2022-04-07T22:13:41.001506 | 2020-03-26T06:08:58 | 2020-03-26T06:08:58 | 250,175,163 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,844 | java | package com.cnergee.mypage.caller;
import java.net.SocketException;
import java.net.SocketTimeoutException;
import com.cnergee.mypage.Complaints;
import com.cnergee.mypage.SelfResolution;
import com.cnergee.mypage.SOAP.LogOutSOAP;
public class LogOutCaller extends Thread {
private String WSDL_TARGET_NAMESPACE;
private String SOAP_URL;
private String METHOD_NAME;
private String MemberId,MemberLoginId,MobileNumber;
LogOutSOAP logOutSOAP;
boolean is_24_ol;
public LogOutCaller(String WSDL_TARGET_NAMESPACE, String SOAP_URL,
String METHOD_NAME,boolean is_24_ol) {
this.WSDL_TARGET_NAMESPACE = WSDL_TARGET_NAMESPACE;
this.SOAP_URL = SOAP_URL;
this.METHOD_NAME = METHOD_NAME;
this.is_24_ol=is_24_ol;
}
public void run() {
try{
logOutSOAP = new LogOutSOAP(WSDL_TARGET_NAMESPACE, SOAP_URL,METHOD_NAME);
if(is_24_ol){
Complaints.rsltLogOut = logOutSOAP.logOut(MemberId,MemberLoginId);
Complaints.statusResponseForLogOut=logOutSOAP.getResponse();
}
else{
SelfResolution.rsltLogOut = logOutSOAP.logOut(MemberId,MemberLoginId);
SelfResolution.statusResponseForLogOut=logOutSOAP.getResponse();
}
//Utils.log("Complaint Logout caller",""+Complaints.statusResponseForLogOut);
//Utils.log("Complaint Logout Result",""+Complaints.rsltLogOut);
}catch (SocketException e) {
e.printStackTrace();
SelfResolution.rsltLogOut = "Internet connection not available!!";
}catch (SocketTimeoutException e) {
e.printStackTrace();
SelfResolution.rsltLogOut = "Internet connection not available!!";
}catch (Exception e) {
SelfResolution.rsltLogOut = "Invalid web-service response.<br>"+e.toString();
}
}
public void setMemberId(String MemberId){
this.MemberId=MemberId;
}
public void setMemberLoginId(String MemberLoginId){
this.MemberLoginId=MemberLoginId;
}
}
| [
"jyoti@cnergee.com"
] | jyoti@cnergee.com |
6b188ebe1c211c7047e9cac68eb4506156053ea0 | 86752fe36c5040f07c53ea8741a3edc7ed10b228 | /geeksforgeeks/src/main/java/searching/PeakElement.java | dba6011b828ceb5ded2a4e3f7ba2f7cea60edeb5 | [] | no_license | ManojPonugupati/dsalgo | 04119ca8cd71a88841fdba041216f7fbe12dbcb1 | 7ca226a5050dfc476d6e8dbae5b150be21163c39 | refs/heads/master | 2023-05-12T09:37:40.184701 | 2023-05-06T07:38:57 | 2023-05-06T07:38:57 | 209,869,899 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,181 | java | package searching;
public class PeakElement {
public static void main(String[] args) {
int[] arr = {1, 2, 3, 4, 5, 6, 7, 8};
int[] arr2 = {10,27,25,24,23};
int[] arr3 = {988,857,744,492,228,366,860,937,433,552,438,229,276,408,475};
System.out.println(peakElement(arr3,arr3.length));
}
static int peakElement(int[] a, int n){
int low =0;
int high = n-1;
int mid = high/2;
while(low <= high){
if (mid == high){
if(a[mid] > a[mid -1]){
return mid;
}
} else if (mid == low){
if (a[mid] > a[mid + 1]){
return mid;
}
}
if((mid== 0 || a[mid] >= a[mid - 1]) && (mid == high ||
a[mid] > a[mid + 1])){
return mid;
}else if (mid > 0 && a[mid] < a[mid + 1]){
low = mid + 1;
mid = low + (high - low)/2;
} else if(mid > 0 && a[mid] < a[mid -1]){
high = mid -1;
mid = low + (high - low)/2;
}
}
return mid;
}
}
| [
"Srik8905@gmail.com"
] | Srik8905@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.