blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
listlengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
listlengths
1
1
author
stringlengths
0
161
6891291d9bf9fdbfd2e08f0c026a169d7263132e
eb723658cd355b937573bd05794da38d441414cf
/src/main/java/com/xy/boot/open/entity/TBrandInfo.java
2a4dfd52eb82b825270fc4e07fa67a9467754c23
[]
no_license
CaoBing0824/docker_images_test
9806bd2c7e2456195bfe6c8efc7b2b3d1afba345
f16252a3aef8fec44c1638bb8fed51b8327dd98a
refs/heads/master
2022-06-30T00:41:53.363845
2020-01-13T08:11:57
2020-01-13T08:11:57
230,181,690
0
0
null
2021-04-26T19:49:38
2019-12-26T02:34:25
Java
UTF-8
Java
false
false
2,154
java
package com.xy.boot.open.entity; import com.baomidou.mybatisplus.annotations.TableField; import com.baomidou.mybatisplus.annotations.TableName; import com.xy.boot.common.base.entity.BaseEntity; import java.io.Serializable; import java.util.Date; @TableName("t_open_api_brand_data") public class TBrandInfo extends BaseEntity<TBrandInfo> { /** * 品牌名称 */ @TableField("brand_name") private String brandName; /** * 品牌代码 */ @TableField("brand_code") private String brandCode; /** * 数据状态 */ @TableField("status") private int status = 1;//默认有效 /** * 创建时间 */ @TableField("created") private Date created; /** * 更新时间 */ @TableField("updated") private Date updated; /** * 创建人 */ @TableField("created_by") private String createdBy; /** * 更新人 */ @TableField("updated_by") private String updatedBy; @Override protected Serializable pkVal() { return null; } public String getBrandName() { return brandName; } public void setBrandName(String brandName) { this.brandName = brandName; } public String getBrandCode() { return brandCode; } public void setBrandCode(String brandCode) { this.brandCode = brandCode; } public Date getCreated() { return created; } public void setCreated(Date created) { this.created = created; } public Date getUpdated() { return updated; } public void setUpdated(Date updated) { this.updated = updated; } public String getCreatedBy() { return createdBy; } public void setCreatedBy(String createdBy) { this.createdBy = createdBy; } public String getUpdatedBy() { return updatedBy; } public void setUpdatedBy(String updatedBy) { this.updatedBy = updatedBy; } public int getStatus() { return status; } public void setStatus(int status) { this.status = status; } }
[ "498131488@qq.com" ]
498131488@qq.com
dc78b4a9e6fbbd4c1f4f85819b89d296e5b289e5
ca2bf2701803e24fedaaf180b37bcfee1af8b437
/src/main/java/br/com/enjoei2/perfil/configuration/SpringCorsFilter.java
19f8f8a0c51636c9d5632383d9d6b296d62b93d7
[]
no_license
faxthelm/perfil
8f881d11d269c05d156d25c2779dfd9a1201be8a
d1f902cbce69301cd7391255edecf26550ab69d0
refs/heads/master
2020-03-31T03:23:04.603632
2018-12-05T23:48:59
2018-12-05T23:48:59
151,862,818
0
0
null
null
null
null
UTF-8
Java
false
false
1,016
java
package br.com.enjoei2.perfil.configuration; import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.cors.CorsConfiguration; import org.springframework.web.cors.UrlBasedCorsConfigurationSource; import org.springframework.web.filter.CorsFilter; @Configuration public class SpringCorsFilter { @Bean public FilterRegistrationBean corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = new CorsConfiguration(); config.setAllowCredentials(true); config.addAllowedOrigin("*"); config.addAllowedHeader("*"); config.addAllowedMethod("*"); source.registerCorsConfiguration("/**", config); FilterRegistrationBean bean = new FilterRegistrationBean(new CorsFilter(source)); bean.setOrder(0); return bean; } }
[ "fernando.axthelm@usp.br" ]
fernando.axthelm@usp.br
c8a078760752fcaa078669042ace235ab26fa6a1
11fddf29479a1b3c2ee24f87c3264247a3a37a2c
/LayoutGenerator/app/src/main/java/layout/layoutgenerator/Adapters/MyRecyclerViewAdapter.java
603043569f0d87f02d4ef83c13c80a15457d11e3
[]
no_license
chandragithub2014/LayoutGenerator
6af14334a470c37782ee156f013d4c0503337dcb
af1cf6c7aa5536a842c934ab2f038494fdf1d06e
refs/heads/master
2021-01-21T14:07:35.987920
2016-05-16T20:11:22
2016-05-16T20:11:22
50,794,843
0
0
null
null
null
null
UTF-8
Java
false
false
3,127
java
package layout.layoutgenerator.Adapters; /** * Created by CHANDRASAIMOHAN on 2/27/2016. */ import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageButton; import android.widget.TextView; import java.util.ArrayList; import layout.layoutgenerator.DTO.DataObject; import layout.layoutgenerator.R; import layout.layoutgenerator.interfaces.MyClickListener; public class MyRecyclerViewAdapter extends RecyclerView .Adapter<MyRecyclerViewAdapter .DataObjectHolder> { private static String LOG_TAG = "MyRecyclerViewAdapter"; private ArrayList<DataObject> mDataset; private static MyClickListener myClickListener; public static class DataObjectHolder extends RecyclerView.ViewHolder implements View .OnClickListener { TextView label; ImageButton infoImgBtn; public DataObjectHolder(View itemView) { super(itemView); label = (TextView) itemView.findViewById(R.id.textView); infoImgBtn = (ImageButton)itemView.findViewById(R.id.info); Log.i(LOG_TAG, "Adding Listener"); itemView.setOnClickListener(this); infoImgBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { int tag = (Integer) v.getTag(); Log.d(LOG_TAG,"Clicked on info Button"+tag); myClickListener.onSpecificViewOnItemClick(tag,v); } }); } @Override public void onClick(View v) { myClickListener.onItemClick(getAdapterPosition(),v); } } public void setOnItemClickListener(MyClickListener myClickListener) { this.myClickListener = myClickListener; } public MyRecyclerViewAdapter(ArrayList<DataObject> myDataset,MyClickListener myClickListener) { mDataset = myDataset; this.myClickListener = myClickListener; } @Override public DataObjectHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()) .inflate(R.layout.layoutlistitem, parent, false); DataObjectHolder dataObjectHolder = new DataObjectHolder(view); return dataObjectHolder; } @Override public void onBindViewHolder(DataObjectHolder holder, int position) { holder.label.setText(mDataset.get(position).getmText1()); holder.infoImgBtn.setTag(position); } public void addItem(DataObject dataObj, int index) { mDataset.add(dataObj); notifyItemInserted(index); } public void deleteItem(int index) { mDataset.remove(index); notifyItemRemoved(index); } @Override public int getItemCount() { return mDataset.size(); } }
[ "b.chandrasaimohan@gmail.com" ]
b.chandrasaimohan@gmail.com
28f6a68407db2068627d69bc4590e0a67e3c1d14
75a0eb6152c8698adab583c9272ba9f31ea142ba
/src/main/java/br/com/knopsistemas/service/Tipo_EquipamentoService.java
0ffd28fa6d3591de93d3aa2c2b1955d90b2ad3a9
[]
no_license
jefersonknop/kgis-api
f9051e0daa37c8a3087274605979aab88c95e814
331c13cffff16c4b262577f86483c13f4610c23c
refs/heads/master
2020-08-05T16:46:40.640015
2019-10-22T03:25:27
2019-10-22T03:25:27
212,620,281
0
0
null
null
null
null
UTF-8
Java
false
false
3,264
java
package br.com.knopsistemas.service; import java.util.List; import java.util.Optional; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; import br.com.knopsistemas.entities.ResponseModel; import br.com.knopsistemas.entities.Tipo_Equipamento; import br.com.knopsistemas.repository.Tipo_EquipamentoRepository; @RestController @RequestMapping("/tipo_equipamentos") @CrossOrigin(origins = "*") public class Tipo_EquipamentoService { @Autowired private Tipo_EquipamentoRepository tipo_equipamentoRepository; @PostMapping(path = "/especial", consumes = "application/x-www-form-urlencoded") public @ResponseBody ResponseModel saveEspecial(Tipo_Equipamento tipo_equipamento) { try { this.tipo_equipamentoRepository.save(tipo_equipamento); return new ResponseModel(1,"Registro salvo com sucesso!"); }catch(Exception e) { return new ResponseModel(0,e.getMessage()); } } @PostMapping public @ResponseBody ResponseModel save(@RequestBody Tipo_Equipamento tipo_equipamento){ try { this.tipo_equipamentoRepository.save(tipo_equipamento); return new ResponseModel(1,"Registro salvo com sucesso!"); }catch(Exception e) { return new ResponseModel(0,e.getMessage()); } } @PutMapping public @ResponseBody ResponseModel update(@RequestBody Tipo_Equipamento tipo_equipamento){ try { this.tipo_equipamentoRepository.save(tipo_equipamento); return new ResponseModel(1,"Registro atualizado com sucesso!"); }catch(Exception e) { return new ResponseModel(0,e.getMessage()); } } @DeleteMapping("/{id}") public @ResponseBody ResponseModel delete(@PathVariable("id") Long id){ Optional <Tipo_Equipamento> tipo_equipamento = tipo_equipamentoRepository.findById(id); if (!tipo_equipamento.isPresent()) { return new ResponseModel(0, "Registro inexistente!"); } else { try { tipo_equipamentoRepository.delete(tipo_equipamento.get()); return new ResponseModel(1, "Registro excluido com sucesso!"); }catch(Exception e) { return new ResponseModel(0, e.getMessage()); } } } @GetMapping("/{id}") public ResponseEntity<Tipo_Equipamento> findById (@PathVariable Long id){ Optional<Tipo_Equipamento> tipo_equipamento = tipo_equipamentoRepository.findById(id); if (tipo_equipamento == null) return ResponseEntity.notFound().build(); else return ResponseEntity.ok(tipo_equipamento.get()); } @GetMapping public @ResponseBody List<Tipo_Equipamento> findAll(){ return this.tipo_equipamentoRepository.findAll(); } }
[ "jefersonknop@gmail.com" ]
jefersonknop@gmail.com
2b1dca0afd6e6c0b0ce0ac008cdee3befab9f675
c25f650ddf8c9a1527a2489b83b48c34203346e3
/src/com/bit2016/helloweb/servlet/JoinServlet.java
5f2224c8ee891cf6f959de1af2bd2888ce099aa7
[]
no_license
humility0310/helloweb
2781a3a95e5b42e4ee8aa450113c9171e1796935
72cd0aa20a8c3c5ee23d0506df7e8d1e2f6df16f
refs/heads/master
2020-02-26T15:40:28.789829
2016-10-12T06:56:49
2016-10-12T06:56:49
70,671,977
0
0
null
null
null
null
UTF-8
Java
false
false
1,217
java
package com.bit2016.helloweb.servlet; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @WebServlet("/join") public class JoinServlet extends HttpServlet { private static final long serialVersionUID = 1L; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // post방식 데이터로 넘어오는 파라미터 엔코딩 request.setCharacterEncoding("UTF-8"); String email = request.getParameter("email"); String pw = request.getParameter("pw"); String name = request.getParameter("name"); String gender = request.getParameter("gender"); String birthYear = request.getParameter("birth-year"); System.out.println(email); System.out.println(pw); System.out.println(name); System.out.println(gender); System.out.println(birthYear); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); } }
[ "bit-user@bit" ]
bit-user@bit
91db0da56e554122b489381d7632c64b42148f13
88024f33d73c84d4ef14dc540688d01139005eeb
/src/main/java/dev/tobiadegbuji/spotify_service/config/AppConfig.java
ec156f7ae8968322dfb827c96eda7b3664a2dd99
[]
no_license
tobi-alexanderr/jazzified-spotify-spotify-service
69b97c8cdb920891e09d49e71c7f8c7893bea419
e943c970aef48bb1d41b3af8cf5545bbe0b268fd
refs/heads/master
2023-03-16T07:36:52.137197
2021-03-08T00:45:55
2021-03-08T00:45:55
345,489,364
0
0
null
null
null
null
UTF-8
Java
false
false
399
java
package dev.tobiadegbuji.spotify_service.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.stereotype.Component; import org.springframework.web.client.RestTemplate; @Configuration public class AppConfig { @Bean public RestTemplate restTemplate(){ return new RestTemplate(); } }
[ "adegbuji_tobi@yahoo.com" ]
adegbuji_tobi@yahoo.com
1686dc16329d2a1030e11eb095ab0f208d8cdd8f
7df7991597c24cde845e5a307dc5655ad11ea3d4
/user-service/src/main/java/org/mdeforge/userservice/model/UserRepository.java
08d06de798cd98ba5a0030bbb3203890eba8c055
[]
no_license
carloselpapa10/MDEForge-generatedcode
04a5422b842d817ad69af3abda5d847061a78000
131230f24cdb92298f7d48800946a51d16868502
refs/heads/master
2020-03-27T17:43:46.815505
2018-08-31T10:59:33
2018-08-31T10:59:33
146,870,135
1
0
null
null
null
null
UTF-8
Java
false
false
245
java
package org.mdeforge.userservice.model; import org.springframework.data.mongodb.repository.MongoRepository; import org.springframework.stereotype.Repository; @Repository public interface UserRepository extends MongoRepository<User,String>{ }
[ "c.avendano10@gmail.com" ]
c.avendano10@gmail.com
13ddefb7c6ca6c7cf96281643602d3f9223adcd8
cb7b8487b41c3fc7d28969a1010cedb277ee3df6
/hotspot-evaluation/src/main/java/com/sk/project/evaluate/domain/score/model/dto/ScoreDto.java
2605b7e3344cee428a447b7b73ff40e04dc44860
[]
no_license
TwoFootDog/springboot
6b52a60d6cbb33ed6864e808f2f934890f0cfb2e
7e74d3a0ecca78aa5e314f3d8f87bf83c369b635
refs/heads/master
2020-06-15T10:45:00.051450
2020-02-05T05:35:38
2020-02-05T05:35:38
195,276,133
1
1
null
null
null
null
UTF-8
Java
false
false
345
java
package com.sk.project.evaluate.domain.score.model.dto; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @Data @AllArgsConstructor @NoArgsConstructor public class ScoreDto { private Long customerId; private Long storeId; private Long evaluationCategoryId; private Integer starCount; }
[ "ekfrl2815@gmail.com" ]
ekfrl2815@gmail.com
561923e4c46a7457fd94cfbc12dd8f7f48964b76
e12e83de12be8a7b7688a177ef4378f5e6b91eae
/mali-oglasi/src/main/java/levi/advertisements/model/User.java
316e78f5ef2e420c7175117c049154d7ce023652
[]
no_license
borisevm/modul3
502372f9690f8cb3ce24664c8853776d3401d24a
b58bc6f1e8cf1f1d2b092209183df19032743af3
refs/heads/master
2021-01-12T00:33:59.425320
2017-02-21T23:22:59
2017-02-21T23:22:59
77,488,644
0
0
null
null
null
null
UTF-8
Java
false
false
2,743
java
package levi.advertisements.model; import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; import org.hibernate.annotations.Type; import org.hibernate.validator.constraints.Email; @Entity @Table(name="USERS") public class User { @Id @GeneratedValue @Column(name="user_id") private Long id; @Column(name="user_name", nullable=false) private String userName; @Column(nullable=false) private String password; @Column(name="first_name", nullable=false) private String firstName; @Column(name="last_name", nullable=false) private String lastName; @Column(nullable=false) @Email private String email; private String phone; @Type(type="true_false") @Column(nullable=false) private boolean isAdmin; @Type(type="true_false") @Column(nullable=false) private boolean isApproved; @OneToMany(mappedBy="author",cascade=CascadeType.ALL) private List<Advertisement> advertisments; public User() { super(); } public User(String userName, String password, String firstName, String lastName, String email, String phone) { super(); this.userName = userName; this.password = password; this.firstName = firstName; this.lastName = lastName; this.email = email; this.phone = phone; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public boolean getIsAdmin() { return isAdmin; } public void setIsAdmin(boolean isAdmin) { this.isAdmin = isAdmin; } public boolean getIsApproved() { return isApproved; } public void setIsApproved(boolean isApproved) { this.isApproved = isApproved; } public List<Advertisement> getAdvertisments() { return advertisments; } public void setAdvertisments(List<Advertisement> advertisments) { this.advertisments = advertisments; } }
[ "bmiros@gmail.com" ]
bmiros@gmail.com
d31bc02e89fddf98ffaf5eaaf71eb24312cb3221
427ac8ea3eaf03ab340f675e34281946de456ca2
/src/main/lessons/d20210428/Main.java
dadaccd5af0dc6306a71b241801d3148e39d042a
[]
no_license
adams1508/nauka-java
027a91779260a2d4655def1fbf65500b3a248644
5dba2b7d625056fb8b65046b876bbea038513e7b
refs/heads/main
2023-06-25T13:11:55.342491
2021-07-26T19:04:18
2021-07-26T19:04:18
362,564,386
0
0
null
null
null
null
UTF-8
Java
false
false
1,868
java
package main.lessons.d20210428; public class Main { public static void main(String[] args) { Country france = new Country("France", 62_240_000, 643_801.0); Country greatBritain = new Country("Great Britain", 59_500_000, 242_495.0); Country germany = new Country("Germany", 81_540_000, 357_386.0); Country italy = new Country("Italy", 57_130_000, 301_340.0); Country poland = new Country("Poland", 38_190_000, 312_679.0); Country[] euCountries = {france, greatBritain, germany, italy}; Country[] euCountries2004 = new Country[euCountries.length + 1]; for (int i = 0; i < euCountries.length; i++) { euCountries2004[i] = euCountries[i]; } euCountries2004[euCountries2004.length - 1] = poland; Country[] countries = {france, germany}; countries = addCountry(countries, poland); System.out.println(countries[0].getName()); System.out.println(countries[1].getName()); System.out.println(countries[2].getName()); removeCountry(countries, germany); System.err.println(countries[0]); System.err.println(countries[1]); System.err.println(countries[2]); } public static Country[] addCountry(Country[] countries, Country countryToAdd) { Country[] newCountries = new Country[countries.length + 1]; for (int i = 0; i < countries.length; i++) { newCountries[i] = countries[i]; } newCountries[newCountries.length - 1] = countryToAdd; return newCountries; } public static void removeCountry(Country[] countries, Country countryToRemove) { for (int i = 0; i < countries.length; i++) { if (countries[i].getName().equals(countryToRemove.getName())) { countries[i] = null; } } } }
[ "adams15080@gmail.com" ]
adams15080@gmail.com
3345c345d59c8e029ca7ab66f084eb8de8472ab0
a2c2599e6c8400da85f7a0112c902d797d1c4059
/src/main/java/com/hekumok/falldamagesettings/FallDamageSettingsMod.java
a726ef6f562782cc5e0fcbcb2b2c648bbabae5ab
[]
no_license
Hekumok/FallDamageSettings_Mod
e16cbc3da52ef92240f747fa4ee19e7704139a5b
f9600bd6b44c3916885b3b7e4a94a0073fca3d01
refs/heads/master
2020-08-06T15:26:08.900537
2019-10-05T19:52:56
2019-10-05T19:52:56
213,056,621
0
0
null
null
null
null
UTF-8
Java
false
false
1,189
java
package com.hekumok.falldamagesettings; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.config.Config; import net.minecraftforge.common.config.ConfigManager; import net.minecraftforge.fml.client.event.ConfigChangedEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.apache.logging.log4j.Logger; @Mod(modid = FallDamageSettingsMod.MODID, useMetadata = true, acceptableRemoteVersions = "*") public class FallDamageSettingsMod { public static final String MODID = "@MODID@"; public static Logger logger; @EventHandler public void preInit(FMLPreInitializationEvent event) { logger = event.getModLog(); MinecraftForge.EVENT_BUS.register(this); } @SubscribeEvent public void onConfigChangedEvent(ConfigChangedEvent.OnConfigChangedEvent event) { if(event.getModID().equals(FallDamageSettingsMod.MODID)) { ConfigManager.sync(FallDamageSettingsMod.MODID, Config.Type.INSTANCE); } } }
[ "neki712@yandex.ru" ]
neki712@yandex.ru
ddd721e7eaa616e0ca9945b74d69e088c1cb616f
a052af7bc2330b68bde528c3f89aad228c979568
/scrollview_conflict/src/test/java/com/gmm/www/scrollview_conflict/ExampleUnitTest.java
10db9b81eff095307f961d20b38856d3380284c5
[]
no_license
LittleGentleman/practice
8bcedca89ed551d893f4f02e740c0c81444fbab4
8aa1ef9ec156aeb6f9691614bf8f25ce7b2df8e1
refs/heads/master
2022-12-19T14:05:59.733538
2020-09-22T09:33:28
2020-09-22T09:33:28
255,034,843
0
0
null
null
null
null
UTF-8
Java
false
false
392
java
package com.gmm.www.scrollview_conflict; 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); } }
[ "gongmaomin@qq.com" ]
gongmaomin@qq.com
2f5430d30d4e937110f03b70e73b9a60a6fa2bdd
4a636cedb38078e0ae49254c91ee9eeaf722e333
/ElectronMS/src/client/Skills/InnerSkillValueHolder.java
260e033dfb5115cf6b7ad15993532108a3fb44f1
[]
no_license
ARealDuck/ElectronMS-Ducks-Azure-Resto-Project
38a7bbe383022cefff21fcb5c33d4780900204df
4b7dacce5f7ffd1228eaab2286fb017111c6ee81
refs/heads/main
2023-08-27T06:46:25.953580
2021-10-18T21:47:14
2021-10-18T21:47:14
409,443,013
1
1
null
null
null
null
UTF-8
Java
false
false
645
java
package client.Skills; public class InnerSkillValueHolder { private int skillId; private byte skillLevel; private byte maxLevel; private byte rank; public InnerSkillValueHolder(int skillId, byte skillLevel, byte maxLevel, byte rank) { this.skillId = skillId; this.skillLevel = skillLevel; this.maxLevel = maxLevel; this.rank = rank; } public int getSkillId() { return skillId; } public byte getSkillLevel() { return skillLevel; } public byte getMaxLevel() { return maxLevel; } public byte getRank() { return rank; } }
[ "brandonnguyen3301@gmail.com" ]
brandonnguyen3301@gmail.com
a6affea86786edf85e0db5af8d874ea98406356d
620cf4d60b84cf60aaff3d02c52ad490a27a4c6e
/src/dctw/Agent3.java
cc92e72bc700f897b5a58fae96b52544c64c791a
[]
no_license
djawed-bkh/Multi-Agents-university-project
bc743d3c6deb268c6ebdb93aba46b8b721605fe0
1a87bc248248ee883a5f910a7e62b3851be2b4db
refs/heads/master
2023-03-31T09:39:14.423021
2021-04-02T15:28:28
2021-04-02T15:28:28
348,133,523
0
0
null
null
null
null
UTF-8
Java
false
false
2,383
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 dctw; import jade.core.AID; import jade.core.Agent; import jade.core.ProfileImpl; import jade.core.behaviours.CyclicBehaviour; import jade.core.behaviours.OneShotBehaviour; import jade.lang.acl.ACLMessage; import jade.wrapper.AgentController; import javax.swing.JOptionPane; /** * * @author DJAWED */ public class Agent3 extends Agent { private double poids; private double p; private double q; private double v; public Agent3(double poids, double p, double q, double v) { this.poids = poids; this.p = p; this.q = q; this.v = v; } public Agent3() { } public void lunchAgent3(jade.wrapper.AgentContainer container){ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { try { jade.core.Runtime runtime = jade.core.Runtime.instance(); ProfileImpl profileImpl = new ProfileImpl(false); profileImpl.setParameter(ProfileImpl.MAIN_HOST, "localhost"); AgentController agentController = container.createNewAgent("Agent3", "dctw.Agent3", null); agentController.start(); } catch (Exception e) { e.printStackTrace(); } } }); } public double getPoids() { return poids; } public void setPoids(double poids) { this.poids = poids; } public double getP() { return p; } public void setP(double p) { this.p = p; } public double getQ() { return q; } public void setQ(double q) { this.q = q; } public double getV() { return v; } public void setV(double v) { this.v = v; } @Override protected void setup() { addBehaviour(new CyclicBehaviour() { @Override public void action() { // reception de messages ACLMessage message= receive(); if(message != null) { JOptionPane.showMessageDialog(null,"Matrice de performance reçue avec succes"); }else block(); } }); } }
[ "bekhouchadjawed@gmail.com" ]
bekhouchadjawed@gmail.com
05ab71c6dd89edacb7f89bdd5bd63d0225ad4477
b5b0cc3c16f6c7bb453b6c0e322a649a45a77129
/CommonClasses/src/ptit/hungvu/cardgame/Card.java
2070cbfbb9da257c8bfa91053163839a73d51584
[]
no_license
hero1796/JavaSE
8cbc948cb0d129f180d840020baddbeb319f5ece
ee5a0670330f7ad6ee6838d3e3c0cbefe4220461
refs/heads/master
2021-10-10T20:57:17.841593
2019-01-17T07:20:44
2019-01-17T07:20:44
68,831,551
1
0
null
null
null
null
UTF-8
Java
false
false
2,576
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 ptit.hungvu.cardgame; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import javax.swing.JButton; /** * * @author HungVu */ public class Card extends JButton { private int value; private int type; private BufferedImage cardImage; public int getValue() { return value; } public void setValue(int value) { this.value = value; } public int getType() { return type; } public void setType(int type) { this.type = type; } public BufferedImage getCardImage() { return cardImage; } public void setCardImage(BufferedImage cardImage) { this.cardImage = cardImage; } public Card(int type, int value) { this.value = value; this.type = type; try { cardImage = ImageIO.read(new File("resource" + File.separator + type + "-" + value + ".PNG")); } catch (IOException ex) { ex.printStackTrace(); } } @Override public Dimension getPreferredSize() { return new Dimension(78, 99); } @Override protected void paintComponent(Graphics g) { Graphics2D g2d = (Graphics2D) g; drawCard(g2d); } public void drawCard(Graphics2D g) { g.drawImage(cardImage, 0, 0, this.getWidth(), this.getHeight(), this); } @Override public String toString() { return type + "-" + value; } public int comparePower(Card other) { int value1 = this.value; int value2 = other.getValue(); if (value1 == value2) { return 0; } else if (value1 == 2 && value2 != 2) { return 1; } else if (value1 != 2 && value2 == 2) { return -1; } else if (value1 == 1 && value2 != 1) { return 1; } else if (value1 != 1 && value2 == 1) { return -1; } else if (value1 != 2 && value1 != 1 && value2 != 2 && value2 != 1) { if (value1 < value2) { return -1; } else if (value1 > value2) { return 1; } } return 2; } public boolean isSameType(Card other) { return this.type == other.getType(); } }
[ "vuthehung17@gmail.com" ]
vuthehung17@gmail.com
ae39a59b0aea4af3bce25eb1766bb3ff47098585
d88bf37d2e9a131d875dc38690e5ef41e5513712
/src/app/Pro/src/com/bite/pro/AppWebView.java
481061893cb4cda21046785dd85c087635e41224
[]
no_license
qiaoenxin/scanbar
b8def82694e3518b25cc39462ce79aa42238b489
e094bcdb04bd54a313a92e3e25c85ed6e29c9682
refs/heads/master
2021-01-21T04:50:49.245999
2016-07-14T01:51:33
2016-07-14T01:51:33
52,087,857
0
0
null
null
null
null
UTF-8
Java
false
false
2,013
java
package com.bite.pro; import java.io.File; import android.annotation.SuppressLint; import android.content.Context; import android.webkit.WebChromeClient; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; public class AppWebView extends WebView{ public AppWebView(Context context) { super(context); } @SuppressWarnings("deprecation") @SuppressLint("SetJavaScriptEnabled") public void initWebView(){ setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY); WebSettings setting = getSettings(); setting.setJavaScriptEnabled(true); // setting.setSupportZoom(true); // setting.setBuiltInZoomControls(true); setting.setAllowFileAccess(true); setting.setJavaScriptCanOpenWindowsAutomatically(true); Context context = getContext(); setting.setDomStorageEnabled(true); setting.setCacheMode(WebSettings.LOAD_DEFAULT); setting.setDatabaseEnabled(true); File databasePath = context.getDir("web_dbpath", 0); if(!databasePath.exists()){ databasePath.mkdirs(); } setting.setDatabasePath(databasePath.getAbsolutePath()); File path = context.getDir("web_path", 0); if(!path.exists()){ path.mkdirs(); } setting.setAppCachePath(path.getAbsolutePath()); setting.setAppCacheEnabled(true); setting.setLoadsImagesAutomatically(true); setting.setSavePassword(false); // setting.setLightTouchEnabled(true); setWebViewClient(new Client()); setWebChromeClient(new Chrome()); addJavascriptInterface(new JSInterface(this), "_jscallapi"); } static class Chrome extends WebChromeClient{ } static class Client extends WebViewClient{ @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } } }
[ "qiaoenxin@sohu.com" ]
qiaoenxin@sohu.com
c236ebfcfc8e7504173e4c7b0eec4650178ccf62
cbfa916ce0391e137ea482d6da9248e53ff5493a
/src/main/java/org/eidos/kingchallenge/httpserver/handlers/package-info.java
49b3e79c21f8f404ff6a0e0d90a25ec00472de4b
[ "Apache-2.0" ]
permissive
eidos71/kingchallenge
4b85e606d08487947fc84260dc64b6afffbad393
fbc6e83b2fd9986e343c0ef91398009203a9b505
refs/heads/master
2020-05-30T12:06:15.154792
2014-09-22T22:15:21
2014-09-22T22:15:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
94
java
/** * */ /** * @author eidos71 * */ package org.eidos.kingchallenge.httpserver.handlers;
[ "eidos33@gmail.com" ]
eidos33@gmail.com
4c5e802f0faa029533c3997bae0375bca8432140
97755b49ee5df353601b0d9212234995c9c437aa
/sdk/src/main/java/org/zstack/sdk/iam2/entity/IAM2VirtualIDInventory.java
def1746ef1aaee95c2866ed24965c0d03d4cb595
[ "Apache-2.0" ]
permissive
weizai118/zstack
4589d0262897b9e3ba0bf48f97b687e47177539d
becb2fc255699e4e9d97c7dc4b8ccb6dad5329ba
refs/heads/master
2020-03-17T12:26:52.777454
2018-08-20T01:55:07
2018-08-20T01:55:07
133,588,891
0
0
Apache-2.0
2018-08-20T01:55:08
2018-05-16T00:39:27
Java
UTF-8
Java
false
false
1,592
java
package org.zstack.sdk.iam2.entity; import org.zstack.sdk.iam2.entity.State; public class IAM2VirtualIDInventory { public java.lang.String uuid; public void setUuid(java.lang.String uuid) { this.uuid = uuid; } public java.lang.String getUuid() { return this.uuid; } public java.lang.String name; public void setName(java.lang.String name) { this.name = name; } public java.lang.String getName() { return this.name; } public java.lang.String description; public void setDescription(java.lang.String description) { this.description = description; } public java.lang.String getDescription() { return this.description; } public State state; public void setState(State state) { this.state = state; } public State getState() { return this.state; } public java.sql.Timestamp createDate; public void setCreateDate(java.sql.Timestamp createDate) { this.createDate = createDate; } public java.sql.Timestamp getCreateDate() { return this.createDate; } public java.sql.Timestamp lastOpDate; public void setLastOpDate(java.sql.Timestamp lastOpDate) { this.lastOpDate = lastOpDate; } public java.sql.Timestamp getLastOpDate() { return this.lastOpDate; } public java.util.List attributes; public void setAttributes(java.util.List attributes) { this.attributes = attributes; } public java.util.List getAttributes() { return this.attributes; } }
[ "xin.zhang@mevoco.com" ]
xin.zhang@mevoco.com
2bdc30780b207e212751f822bac1aa2a8f19969e
6574455851b5ac51d791308bc00172aac091d5a2
/wicket-kendo-ui/src/main/java/com/googlecode/wicket/jquery/ui/kendo/datatable/DataTable.java
e30a4afa06aa09107357ab12c15822b52f7d890d
[ "Apache-2.0" ]
permissive
jitendra-khatri/wicket-jquery-ui
5bf8dc27bac7fbf0a3260714fe1a2a5194ba60f8
1a0e77ace1639718260a0dfa0084e4af73c567ef
refs/heads/master
2020-05-29T11:39:44.125980
2013-11-30T00:50:36
2013-11-30T00:50:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,137
java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.googlecode.wicket.jquery.ui.kendo.datatable; import java.util.Collections; import java.util.List; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.behavior.AbstractAjaxBehavior; import org.apache.wicket.markup.ComponentTag; import org.apache.wicket.markup.MarkupStream; import org.apache.wicket.markup.html.WebComponent; import org.apache.wicket.markup.repeater.data.IDataProvider; import com.googlecode.wicket.jquery.core.IJQueryWidget; import com.googlecode.wicket.jquery.core.JQueryBehavior; import com.googlecode.wicket.jquery.core.Options; import com.googlecode.wicket.jquery.core.ajax.IJQueryAjaxAware; import com.googlecode.wicket.jquery.ui.kendo.datatable.ButtonAjaxBehavior.ClickEvent; import com.googlecode.wicket.jquery.ui.kendo.datatable.column.IColumn; /** * Provides a Kendo UI data-table * * @param <T> the model object type * @author Sebastien Briquet - sebfz1 */ public class DataTable<T> extends WebComponent implements IJQueryWidget, IDataTableListener { private static final long serialVersionUID = 1L; /** The behavior that ajax-loads data */ private AbstractAjaxBehavior sourceBehavior; private final Options options; private final List<? extends IColumn> columns; private final IDataProvider<T> provider; private final long rows; /** * Constructor * * @param id the markup id * @param columns the list of {@link IColumn} * @param provider the {@link IDataProvider} * @param rows the number of rows per page to be displayed */ public DataTable(String id, final List<? extends IColumn> columns, final IDataProvider<T> provider, final long rows) { this(id, columns, provider, rows, new Options()); } /** * Main constructor * * @param id the markup id * @param columns the list of {@link IColumn} * @param provider the {@link IDataProvider} * @param rows the number of rows per page to be displayed * @param options the {@link Options} */ public DataTable(String id, final List<? extends IColumn> columns, final IDataProvider<T> provider, final long rows, Options options) { super(id); this.columns = columns; this.provider = provider; this.options = options; this.rows = rows; } // Methods // /** * Reloads data and refreshes the {@link DataTable} * * @param target the {@link AjaxRequestTarget} */ public void refresh(AjaxRequestTarget target) { target.appendJavaScript(String.format("var grid = jQuery('%s').data('kendoGrid'); grid.dataSource.read(); grid.refresh();", JQueryWidget.getSelector(this))); } // Properties // protected List<ColumnButton> getButtons() { return Collections.emptyList(); } // Events // @Override protected void onInitialize() { super.onInitialize(); this.add(this.sourceBehavior = this.newDataSourceBehavior(this.columns, this.provider)); this.add(JQueryWidget.newWidgetBehavior(this)); // cannot be in ctor as the markupId may be set manually afterward } @Override public void onConfigure(JQueryBehavior behavior) { // noop } @Override public void onBeforeRender(JQueryBehavior behavior) { // noop } @Override public void onComponentTagBody(final MarkupStream markupStream, final ComponentTag openTag) { this.replaceComponentTagBody(markupStream, openTag, ""); // Empty tag body; Fixes #45 } @Override public void onClick(AjaxRequestTarget target, ColumnButton button, String value) { // noop } // IJQueryWidget // @Override public JQueryBehavior newWidgetBehavior(String selector) { return new DataTableBehavior(selector, this.options) { private static final long serialVersionUID = 1L; @Override protected List<? extends IColumn> getColumns() { return DataTable.this.columns; } @Override protected long getRowCount() { return DataTable.this.rows; } @Override protected CharSequence getSourceCallbackUrl() { return DataTable.this.sourceBehavior.getCallbackUrl(); } // Events // @Override public void onClick(AjaxRequestTarget target, ColumnButton button, String value) { DataTable.this.onClick(target, button, value); } @Override protected ButtonAjaxBehavior newButtonAjaxBehavior(IJQueryAjaxAware source, ColumnButton button) { return DataTable.this.newButtonAjaxBehavior(source, button); } }; } // Factories // /** * Gets a new {@link DataSourceBehavior} * * @param columns the list of {@link IColumn} * @param provider the {@link IDataProvider} * @param rows the number of rows per page to be displayed * @return the {@link AbstractAjaxBehavior} */ protected AbstractAjaxBehavior newDataSourceBehavior(final List<? extends IColumn> columns, final IDataProvider<T> provider) { return new DataSourceBehavior<T>(columns, provider); } /** * Gets a new {@link ButtonAjaxBehavior} that will be called by the corresponding {@link ColumnButton}.<br/> * This method may be overridden to provide additional behaviors * * @param source the {@link IJQueryAjaxAware} source * @param button the button that is passed to the behavior so it can be retrieved via the {@link ClickEvent} * @return the {@link ButtonAjaxBehavior} */ protected ButtonAjaxBehavior newButtonAjaxBehavior(IJQueryAjaxAware source, ColumnButton button) { return new ButtonAjaxBehavior(source, button); } }
[ "sebfz1@gmail.com" ]
sebfz1@gmail.com
39a20bf63f19b04418e41f993ac116a115f9d3e1
b2fa5c72e6b4bc21d7cdc0fad0ddea2ad2012ced
/app/src/androidTest/java/edu/birzeit/mobileassigment2/ExampleInstrumentedTest.java
fc5d77b3e9d8f343396786dcff9374507e82498f
[]
no_license
adeimousa/Mobile-Assigment-2
0091d10e97d9de40751e39fdfbf898b2d78a74f8
9f3a694860df6ad098535a5dc489f185b76a637a
refs/heads/master
2023-05-07T15:11:51.195316
2021-05-24T21:14:00
2021-05-24T21:14:00
369,476,788
0
0
null
2021-05-24T21:14:01
2021-05-21T09:03:33
Java
UTF-8
Java
false
false
770
java
package edu.birzeit.mobileassigment2; import android.content.Context; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("edu.birzeit.mobileassigment2", appContext.getPackageName()); } }
[ "adeihim99@gmail.com" ]
adeihim99@gmail.com
7dc05bf8684f81137e1e3f0db8df43df5f61c7a2
e5ef5d781143f205d3517782bb8092cb06a77d5d
/app/src/main/java/com/moshiurcse/fragementretrofit/HomeFragment.java
c2cf30be5aa0d00980d4c0383a8b7f84e89991e2
[]
no_license
moshiur-cse/FragementRetrofitRecylerView
1f67c29b230bda6238e14df3f9f5ded48a77f01e
810f32929d1dce27ab3b8d32f02066da68fbef05
refs/heads/master
2021-01-05T15:27:07.947868
2020-02-17T08:58:12
2020-02-17T08:58:12
241,061,884
0
0
null
null
null
null
UTF-8
Java
false
false
1,972
java
package com.moshiurcse.fragementretrofit; import android.os.Bundle; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.navigation.Navigation; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.EditText; import android.widget.FrameLayout; /** * A simple {@link Fragment} subclass. */ public class HomeFragment extends Fragment { private Button goToBtn; private EditText initialET,monthET,yearET; public HomeFragment() { // Required empty public constructor } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_home, container, false); } @Override public void onViewCreated(@NonNull final View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); goToBtn=view.findViewById(R.id.goToBtn); initialET=view.findViewById(R.id.enterInitial); monthET=view.findViewById(R.id.enterMonth); yearET=view.findViewById(R.id.enderYear); goToBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String initial=initialET.getText().toString(); String month=monthET.getText().toString(); String year=yearET.getText().toString(); Bundle bundle=new Bundle(); bundle.putString("initial",initial); bundle.putString("month",month); bundle.putString("year",year); Navigation.findNavController(v).navigate(R.id.action_homeFragment_to_dataViewFragment,bundle); } }); } }
[ "moshiur_cse@hotmail.com" ]
moshiur_cse@hotmail.com
22ff420a8c9343949b484b0e2cc230ff73b53b3a
efddd96dfb8553c65ef7a53aee8defdbfa7bcafd
/hardy.jsptag/src/main/java/org/hardy/jsptag/tcp/TcpResultTag.java
9deb682303448267c94c9aced1acf01b6c92c104
[]
no_license
songshangkun/hardy_parent
6640ce7a59371a4ca677aa08a8a97253c07864e7
79d0800890d7356b4f9c6fca133fd014a4117649
refs/heads/master
2021-01-01T19:05:19.111430
2017-07-27T16:38:00
2017-07-27T16:38:00
98,504,136
0
0
null
null
null
null
UTF-8
Java
false
false
3,526
java
package org.hardy.jsptag.tcp; import java.io.IOException; import java.io.StringWriter; import javax.servlet.jsp.JspException; import javax.servlet.jsp.tagext.SimpleTagSupport; import org.hardy.jsptag.RenderScript; import org.hardy.jsptag.TagRespoire; import org.hardy.netty.tcp.TcpClient; /** * 应用于跨域GET访问URL的标签 * @author song * */ public class TcpResultTag extends SimpleTagSupport { private String tagKey; private String message; private String host; private int port; /** * 设置数据返回后的jsp渲染类 */ private String className ; private RenderScript rs ; private TcpClient tcpClient ; private TcpTageExcuteClient tcpTageExcuteClient; private PrepareMessage prepareMessage; /** * 设置预处理message发送信息的类,如果实现这个接口, * 实际发送的消息是接口返回的值 */ private String preClassName; public TcpResultTag(){ tcpClient = new TcpClient(); tcpClient.setDecoderType(TcpClient.JavaSerialize); this.tcpTageExcuteClient = new TcpTageExcuteClient(); tcpClient.setExcuteClient(this.tcpTageExcuteClient); tcpClient.setCloseAfterRead(true); } public void setTagKey(String tagKey) { this.tagKey = tagKey; this.tcpTageExcuteClient.setTagKey(this.tagKey); } public void setClassName(String className) { this.className = className; if(this.rs==null){ RenderScript rsn = TagRespoire.getRenderByTag(this.className); if(rsn!=null){ this.rs = rsn; }else{ try { Class<?> c = Class.forName(this.className); this.rs = (RenderScript)c.newInstance(); } catch (InstantiationException | IllegalAccessException|ClassNotFoundException e) { e.printStackTrace(); } } } this.tcpTageExcuteClient.setRenderScript(this.rs); } StringWriter sw = new StringWriter(); public void doTag() throws JspException, IOException{ tcpTageExcuteClient.setJsp(this.getJspContext()); Object sendMessage = message; if (message != null) { if(this.prepareMessage!=null)sendMessage = this.prepareMessage.prepare(message); this.tcpClient.setMessage(sendMessage); try { this.tcpClient.connect(host, port); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else { /* 从内容体中使用消息 */ getJspBody().invoke(sw); getJspContext().getOut().println(sw.toString()); } } public void setMessage(String message) { this.message = message; } public void setHost(String host) { this.host = host; } public void setPort(int port) { this.port = port; } public void setPreClassName(String preClassName) { this.preClassName = preClassName; if(this.prepareMessage==null){ PrepareMessage pmsg = TagRespoire.getPreMsgByTag(this.preClassName); if(pmsg!=null){ this.prepareMessage = pmsg; }else{ try { Class<?> c = Class.forName(this.preClassName); this.prepareMessage = (PrepareMessage)c.newInstance(); } catch (InstantiationException | IllegalAccessException|ClassNotFoundException e) { e.printStackTrace(); } } } } }
[ "13808875@qq.com" ]
13808875@qq.com
dbce13fe3273e8c4fc4ebffc4d1f031eeb4ad8d3
6ca8e37921c504815a2a490b1e864d9e8b7bf820
/app/src/main/java/com/rajat/simpleform/GoTo.java
d2116af171b4e321db006816c2e3c25cc4d15606
[]
no_license
razatg/SimpleForm
44ffb84de15429fe73661067462cb894c7612540
46d5161ce2698626d99520614554afb0e4286d1e
refs/heads/master
2021-01-01T18:33:31.639923
2015-09-01T15:14:13
2015-09-01T15:14:13
41,403,935
0
0
null
null
null
null
UTF-8
Java
false
false
684
java
package com.rajat.simpleform; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.widget.TextView; public class GoTo extends Activity { private TextView formData; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_go_to); formData = (TextView) findViewById(R.id.formData); Intent intent = getIntent(); Bundle bundle = intent.getExtras(); String firstName = bundle.getString("fnData"); formData.setText(firstName); } }
[ "girdhar.rajat@gmail.com" ]
girdhar.rajat@gmail.com
c2c936fa30be3b3c78d827fe3425bb7d5b8da407
4ccb48e6451ac927ea9c36ba2f54742b6dd23058
/Praice/User.java
bbda9dd784025c420b2b346f21e38b6857baf84c
[]
no_license
XiaoFanMie/javaCollection
8b5d93d2a1c7643c57d88fc736e7d69f1432eabd
9fe8d95813f40611d72d5da7c512cabf7a829540
refs/heads/main
2023-03-08T04:17:10.513219
2021-02-25T01:31:41
2021-02-25T01:31:41
340,568,390
1
0
null
null
null
null
UTF-8
Java
false
false
705
java
package Praice; public class User { private String num; private String passWord; public User(String num, String passWord) { this.num = num; this.passWord = passWord; } public String getNum() { return num; } public void setNum(String num) { this.num = num; } public String getPassWord() { return passWord; } public void setPassWord(String passWord) { this.passWord = passWord; } @Override public String toString() { return "User{" + "num='" + num + '\'' + ", passWord='" + passWord + '\'' + '}'; } }
[ "noreply@github.com" ]
noreply@github.com
ced2cb7044c97b8336430f51c196b07b86f0e521
cfe4a9aa2cee1bb2fa071a6c64dd0d69b1811105
/src/Clients/103/com/jagex/Class93.java
6c7569ecae2eac6d11e7e075fb45c07e29bbcd54
[ "MIT" ]
permissive
Rune-Status/Anadyr-OSRSe
1381df15a92b6af8583ddffccf7db8324e9d08c4
dbc5dd4751a6cefa19452212dc4c1a23cf3b2507
refs/heads/master
2021-06-08T04:15:59.294493
2016-09-12T20:02:22
2016-09-12T20:02:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,554
java
package com.jagex; import java.util.zip.CRC32; public class Class93 { public static Class71 aClass71_1335; public static int anInt1336 = 0; public static long aLong1337; public static int anInt1338 = 0; public static int anInt1339 = 0; public static byte aByte1340 = 0; public static Class121 aClass121_1342 = new Class121(); static Class127 aClass127_1343 = new Class127(4096); public static int anInt1344 = 0; public static Class127 aClass127_1345 = new Class127(4096); public static int anInt1346 = 0; public static Buffer aClass116_Sub14_1347 = new Buffer(8); public static Buffer aClass116_Sub14_1348; public static int anInt1349 = 0; public static CRC32 aCRC32_1350 = new CRC32(); public static Class99_Sub1[] aClass99_Sub1Array1351 = new Class99_Sub1[256]; public static Class127 aClass127_1352 = new Class127(32); public static int anInt1353 = 0; public static int anInt1354 = 0; public static Class127 aClass127_1357 = new Class127(4096); static final void method1265(int var0) { if(1121410397 * client.anInt2987 > 0) { method1270(-1305917269); } else { Class116_Sub12.method1983(40, (byte)44); Class41.aClass71_545 = Class38.bufferIn; Class38.bufferIn = null; } } static final void method1270(int var0) { if(null != Class38.bufferIn) { Class38.bufferIn.method1001(1654855997); Class38.bufferIn = null; } Timer.method1092((byte) 12); Class116_Sub11.groundItemController.clearTiles(); for(int var1 = 0; var1 < 4; ++var1) { client.aClass58Array2996[var1].method890(462555413); } System.gc(); Class76.method1082(2, (byte)49); client.anInt3172 = 277612363; client.aBool3159 = false; for(Class116_Sub8 var2 = (Class116_Sub8)Class116_Sub8.aClass117_1779.method1551(); null != var2; var2 = (Class116_Sub8)Class116_Sub8.aClass117_1779.method1553()) { if(null != var2.aClass116_Sub4_Sub2_1775) { Class50.aClass116_Sub4_Sub1_673.method2707(var2.aClass116_Sub4_Sub2_1775); var2.aClass116_Sub4_Sub2_1775 = null; } if(null != var2.aClass116_Sub4_Sub2_1780) { Class50.aClass116_Sub4_Sub1_673.method2707(var2.aClass116_Sub4_Sub2_1780); var2.aClass116_Sub4_Sub2_1780 = null; } } Class116_Sub8.aClass117_1779.method1545(); Class116_Sub12.method1983(10, (byte)22); } Class93() throws Throwable { throw new Error(); } }
[ "Anadyr@live.com" ]
Anadyr@live.com
c7fae550dfcdcac973d721e5d7ba68a247ec8199
1cc9c52e6405f67ce45df6809380b990b711faa1
/src/com/wwk/utils/JsonMap.java
bc4e3aa212332def71e6010f50aa3863a4c8567a
[]
no_license
xiaobai913/WechatPro
669387baebc80ede7878b257c17f2bfc0894eb89
d0aec5917db4ba0396260e154a391d259e69c3e7
refs/heads/master
2021-08-30T14:58:35.360871
2017-12-18T10:47:45
2017-12-18T10:56:59
114,629,384
0
0
null
null
null
null
UTF-8
Java
false
false
1,361
java
package com.wwk.utils; import java.util.HashMap; import java.util.Map; import net.sf.json.JSONObject; public class JsonMap { private String returnMsg;//返回信息 private String returnCode;//返回代码 private String retnrnJson;//返回数据 public JsonMap(String returnMsg ,String returnCode ,String retnrnJson){ this.returnMsg = returnMsg; this.returnCode = returnCode; this.retnrnJson = retnrnJson; } public JsonMap(){ } public String getReturnMsg() { return returnMsg; } public void setReturnMsg(String returnMsg) { this.returnMsg = returnMsg; } public String getReturnCode() { return returnCode; } public void setReturnCode(String returnCode) { this.returnCode = returnCode; } public String getRetnrnJson() { return retnrnJson; } public void setRetnrnJson(String retnrnJson) { this.retnrnJson = retnrnJson; } public String toString(){ JSONObject jsonObject = new JSONObject(); jsonObject.put("returnMsg", this.returnMsg); jsonObject.put("returnCode", this.returnCode); jsonObject.put("retnrnJson", this.retnrnJson); return jsonObject.toString() ; } public Map<String,Object> toMap(){ Map<String,Object> map = new HashMap<String,Object>(); map.put("returnMsg", this.returnMsg); map.put("returnCode", this.returnCode); map.put("retnrnJson", this.retnrnJson); return map; } }
[ "847683294@qq.com" ]
847683294@qq.com
ca4a6828914d0d5b8cd9f28ef49ada6e47856e2f
f2c2c0e9372fd5fb0189d88b91cc4ab28dd63363
/app/src/main/java/com/example/android/inventory/data/ProductDbHelper.java
34dfb3b83ffa3a4ebbbdd6c1ef83f3db954bbe64
[]
no_license
kazarmax/ProductInventory
8928b08227fc8ab89614a4f49dcba93b91a4a043
e1c7d6f20907f73a14320305d40b71335995362c
refs/heads/master
2020-04-05T12:33:59.209439
2017-07-23T07:34:05
2017-07-23T07:34:05
95,146,954
0
0
null
null
null
null
UTF-8
Java
false
false
2,070
java
package com.example.android.inventory.data; import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.util.Log; import com.example.android.inventory.data.ProductContract.ProductEntry; public class ProductDbHelper extends SQLiteOpenHelper{ private static final String DATABASE_NAME = "inventory.db"; private static final int DATABASE_VERSION = 1; private static final String LOG_TAG = ProductDbHelper.class.getSimpleName(); public ProductDbHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } @Override public void onCreate(SQLiteDatabase db) { String COMMA_SEP = ","; String SQL_CREATE_PRODUCTS_TABLE = "CREATE TABLE " + ProductEntry.TABLE_NAME + "(" + ProductEntry._ID + " INTEGER PRIMARY KEY AUTOINCREMENT" + COMMA_SEP + ProductEntry.COLUMN_PRODUCT_NAME + " TEXT NOT NULL" + COMMA_SEP + ProductEntry.COLUMN_PRODUCT_QUANTITY + " INTEGER NOT NULL" + COMMA_SEP + ProductEntry.COLUMN_PRODUCT_PRICE + " INTEGER NOT NULL" + COMMA_SEP + ProductEntry.COLUMN_PRODUCT_SUPPLIER_NAME + " TEXT NOT NULL" + COMMA_SEP + ProductEntry.COLUMN_PRODUCT_SUPPLIER_EMAIL + " TEXT NOT NULL" + COMMA_SEP + ProductEntry.COLUMN_PRODUCT_IMAGE + " BLOB NOT NULL" + ");"; db.execSQL(SQL_CREATE_PRODUCTS_TABLE); Log.v(LOG_TAG, "SQL script to create products table = \n" + SQL_CREATE_PRODUCTS_TABLE); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { // This database is only a cache for online data, so its upgrade policy is // to simply to discard the data and start over String SQL_DROP_PRODUCTS_TABLE = "DROP TABLE IF EXISTS " + ProductEntry.TABLE_NAME; db.execSQL(SQL_DROP_PRODUCTS_TABLE); onCreate(db); } }
[ "kazarmax@gmail.com" ]
kazarmax@gmail.com
a8660440c34687711b57b49c1455181c3773e1a5
23ae42a0968985e8577015a1e9579baeb9d2047b
/src/SystemNpruPool_Admin/Admin_Registermode.java
1259974a9cc658c1791e63c2f51c6c9f2eaf59f8
[]
no_license
nopindy135/adminform
5cf056e0c327adbfef07458bd91abd4d8c26e456
100fce3c0824feae97eff1d70e96c6358e58ea7d
refs/heads/master
2021-01-10T05:44:40.697942
2016-03-17T17:11:15
2016-03-17T17:11:15
53,333,433
0
0
null
null
null
null
UTF-8
Java
false
false
2,665
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 SystemNpruPool_Admin; import static SystemNpruPool.ConnectDB.passwordDB; import static SystemNpruPool.ConnectDB.urlConnection; import static SystemNpruPool.ConnectDB.usernameDB; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Statement; /** * * @author Godonlyknows */ public class Admin_Registermode { public int r_id ; public int r_type; public String r_time; public String r_date; public int u_id; public int c_id; public void EditRegister(int id , int uid ,int cid){ Connection connect = null; Statement stmt = null; try { Class.forName("com.mysql.jdbc.Driver"); connect = DriverManager.getConnection ( urlConnection,usernameDB,passwordDB); stmt = connect.createStatement(); String sql = "UPDATE register " + "SET R_Type = '" + id + "' " + ", U_ID = '" + uid + "' " + ", C_ID = '" + cid + "'"+ " WHERE R_ID = '" + id + "' "; stmt.execute(sql); System.out.println("Record Update Successfully"); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } // Close try { if(connect != null){ stmt.close(); connect.close(); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public void DeleteRegister(int rid){ Connection connect = null; Statement stmt = null; try { Class.forName("com.mysql.jdbc.Driver"); connect = DriverManager.getConnection ( urlConnection,usernameDB,passwordDB); stmt = connect.createStatement(); String sql = "DELETE FROM register " + " WHERE R_ID ='" + rid + "' "; stmt.execute(sql); System.out.println("Record Delete Member Successfully"); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } // Close try { if(connect != null){ stmt.close(); connect.close(); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
[ "mariokick@windowslive.com" ]
mariokick@windowslive.com
a084a22c02a9351844d126d7fd8fbd07358c6d8c
fc60f079bf6db117fce9e4e85b2103bdad554290
/adrecyclerview/src/main/java/zlonglove/cn/adrecyclerview/base/OnRecyclerItemLongClickListener.java
8dfd647d87c6c3fcac2052a5e0b72e873af82b6b
[]
no_license
zlonglove/MyTestProject
358aabed29ce83beebbff0c3342324453eaa2e0c
8b90aab4319f460300ef06d0cab8b0ac47f84ffd
refs/heads/master
2021-04-18T19:13:45.906269
2019-10-30T04:22:19
2019-10-30T04:22:19
126,919,242
2
0
null
null
null
null
UTF-8
Java
false
false
1,134
java
package zlonglove.cn.adrecyclerview.base; import android.view.View; /** * 描述:RecyclerView的条目长按单击监听器 * <p> * 作者:cjs * 创建时间:2017年10月18日 9:35 * 邮箱:chenjunsen@outlook.com * * @version 1.0 */ public interface OnRecyclerItemLongClickListener<RI extends BaseRecyclerItem> { /** * 列表条目被单击时 * @param v 当前条目的视图 * @param item 当前条目对应的数据 * @param position 当前条目在指定区域里面的位置 * @param segment 被点击时的区域<br> * {@link com.h6ah4i.android.widget.advrecyclerview.headerfooter.AbstractHeaderFooterWrapperAdapter#SEGMENT_TYPE_FOOTER} 处于footer<br> * {@link com.h6ah4i.android.widget.advrecyclerview.headerfooter.AbstractHeaderFooterWrapperAdapter#SEGMENT_TYPE_HEADER} 处于header<br> * {@link com.h6ah4i.android.widget.advrecyclerview.headerfooter.AbstractHeaderFooterWrapperAdapter#SEGMENT_TYPE_NORMAL} 处于正常的列表范围里面<br> */ void onItemLongClick(View v, RI item, int position, int segment); }
[ "wb-zhanglong@sdc.icbc.com.cn" ]
wb-zhanglong@sdc.icbc.com.cn
6fe451266afbc2b12bd19e8f91f54098f5dfb8aa
a7288af316afeed6c7e891d6d6b3c0ecf9133414
/src/AWT绘图/ColorTest.java
49ea3245bd0414dcec9623784a55f4ab1df3c028
[]
no_license
pengyoucongcode/java1
2cfe872ae03a667fd64a91d553c2c051205eca1d
97a2273543f5596532f2336a264e3f6eea678859
refs/heads/master
2020-05-30T12:22:33.795749
2019-08-15T08:29:16
2019-08-15T08:29:16
189,728,695
2
2
null
null
null
null
UTF-8
Java
false
false
1,064
java
// >= JDK 1.8 // encoding:utf-8 // @software:IntelliJ IDEA // @user:彭友聪 // @date:2019/08/14 // @time:下午 3:59 // @project:IDEA_JAVA // @file:ColorTest.java // @Author:御承扬 //@E-mail:2923616405@qq.com package AWT绘图; import javax.swing.*; import java.awt.*; public class ColorTest extends JFrame { static class CanvasTest extends Canvas { CanvasTest() { } public final void paint(Graphics g){ super.paint( g ); Graphics2D g2 = (Graphics2D) g; g2.setColor(Color.RED); g2.drawLine( 5, 30, 100, 30 ); } } private void initialize(){ this.setSize( 300,200 ); setDefaultCloseOperation( WindowConstants.EXIT_ON_CLOSE ); add(new CanvasTest()); // 设置窗体面板为绘图面板对象 this.setTitle("设置颜色"); } private ColorTest() { super(); initialize(); } public static void main(String[] args) { ColorTest frame = new ColorTest(); frame.setVisible( true ); } }
[ "2923616405@qq.com" ]
2923616405@qq.com
682bf1bf30cc9fad0d95b29243c214aa51e62267
ba23699b69d990303500a4be04e60326db63e925
/src/sample/register_login.java
ccced5886c8f78600b8ca3979314357dd8eae636
[]
no_license
eyesee420/login_and_register-form-with-mysql-source-code
b36b10a121afd2fd7c37ac70df4a9e30a88f7d33
0a31b12cd353fed3383025fe0c44f9552d5153b9
refs/heads/main
2023-01-24T16:45:36.714547
2020-12-09T10:36:46
2020-12-09T10:36:46
319,597,464
0
0
null
null
null
null
UTF-8
Java
false
false
16,822
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 sample; import java.awt.HeadlessException; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import javax.swing.JOptionPane; import javax.swing.UIManager; /** * * @author me */ public class register_login extends javax.swing.JFrame { Connection con = null; PreparedStatement pst = null; /** * Creates new form register_login */ public register_login() { initComponents(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jPanel1 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jTextField1 = new javax.swing.JTextField(); jPasswordField1 = new javax.swing.JPasswordField(); jTextField2 = new javax.swing.JTextField(); jTextField3 = new javax.swing.JTextField(); jTextField4 = new javax.swing.JTextField(); jPasswordField2 = new javax.swing.JPasswordField(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); jLabel10 = new javax.swing.JLabel(); jPanel2 = new javax.swing.JPanel(); jCheckBox1 = new javax.swing.JCheckBox(); jCheckBox2 = new javax.swing.JCheckBox(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); jButton3 = new javax.swing.JButton(); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 100, Short.MAX_VALUE) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 100, Short.MAX_VALUE) ); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); jLabel1.setText("already have an account."); getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 220, -1, -1)); getContentPane().add(jTextField1, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 90, 129, -1)); jPasswordField1.setText("jPasswordField1"); jPasswordField1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jPasswordField1ActionPerformed(evt); } }); getContentPane().add(jPasswordField1, new org.netbeans.lib.awtextra.AbsoluteConstraints(70, 270, 130, -1)); getContentPane().add(jTextField2, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 120, 129, -1)); getContentPane().add(jTextField3, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 150, 129, -1)); getContentPane().add(jTextField4, new org.netbeans.lib.awtextra.AbsoluteConstraints(70, 240, 129, -1)); jPasswordField2.setText("jPasswordField1"); jPasswordField2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jPasswordField2ActionPerformed(evt); } }); getContentPane().add(jPasswordField2, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 180, 130, -1)); jLabel2.setText("username:"); getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 150, -1, 20)); jLabel3.setText("email address:"); getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 120, -1, -1)); jLabel4.setText("nickname:"); getContentPane().add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 90, -1, -1)); jLabel5.setText("username:"); getContentPane().add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 240, -1, -1)); jLabel6.setText("password:"); getContentPane().add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 180, -1, -1)); jLabel7.setText("password:"); getContentPane().add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 270, -1, -1)); jLabel8.setFont(new java.awt.Font("Verdana", 0, 24)); // NOI18N jLabel8.setText("welcome ^_^"); getContentPane().add(jLabel8, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 20, -1, -1)); jLabel9.setText("register here."); getContentPane().add(jLabel9, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 70, -1, 10)); jLabel10.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sample/Donut-icon_24x24.png"))); // NOI18N getContentPane().add(jLabel10, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 10, -1, -1)); jCheckBox1.setText("show"); jCheckBox1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jCheckBox1ActionPerformed(evt); } }); jCheckBox2.setText("show"); jCheckBox2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jCheckBox2ActionPerformed(evt); } }); jButton1.setText("login"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jButton2.setText("clear"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); jButton3.setText("register"); jButton3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton3ActionPerformed(evt); } }); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap(203, Short.MAX_VALUE) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jButton1, javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() .addComponent(jCheckBox2, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(15, 15, 15))) .addGap(39, 39, 39)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jCheckBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap()))) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() .addContainerGap(88, Short.MAX_VALUE) .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jButton2) .addGap(30, 30, 30) .addComponent(jCheckBox1) .addGap(35, 35, 35) .addComponent(jButton1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jCheckBox2) .addGap(57, 57, 57)) ); getContentPane().add(jPanel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 310, 340)); pack(); setLocationRelativeTo(null); }// </editor-fold>//GEN-END:initComponents private void jPasswordField2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jPasswordField2ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jPasswordField2ActionPerformed private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed // TODO add your handling code here: try{ String query = "INSERT INTO `records`(`nicknames`, `email add`, `username`, `password`)" + " VALUES (?,?,?,?)"; con =DriverManager.getConnection("jdbc:mysql://localhost:3306/test2?useSSL=false","root","1234"); pst = con.prepareStatement(query); pst.setString(1,jTextField1.getText()); pst.setString(2,jTextField2.getText()); pst.setString(3,jTextField3.getText()); pst.setString(4,jPasswordField2.getText()); pst.executeUpdate(); JOptionPane.showMessageDialog(null,"register added"); } catch (HeadlessException | SQLException e){ JOptionPane.showMessageDialog(null,"allready in used"); } }//GEN-LAST:event_jButton3ActionPerformed private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed // TODO add your handling code here: jTextField1.setText(""); jTextField2.setText(""); jTextField3.setText(""); jTextField4.setText(""); jPasswordField1.setText(""); jPasswordField2.setText(""); }//GEN-LAST:event_jButton2ActionPerformed private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed try { con =DriverManager.getConnection("jdbc:mysql://localhost:3306/test2?useSSL=false","root","1234"); pst = con.prepareStatement("SELECT `nicknames`, `email add`, `username`, `password` FROM `records` WHERE `username` = ? AND `password`=?"); pst.setString(1, jTextField4.getText()); pst.setString(2, String.valueOf(jPasswordField1.getPassword())); ResultSet result = pst.executeQuery(); if(result.next()){ JOptionPane.showMessageDialog(null,"Login Successesfully"); sndpage may = new sndpage(); may.setVisible(true); this.dispose(); } else{ JOptionPane.showMessageDialog(null,"Login failed"); } } catch (SQLException ex) { } }//GEN-LAST:event_jButton1ActionPerformed private void jCheckBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox1ActionPerformed // TODO add your handling code here: if (jCheckBox1.isSelected()) { jPasswordField2.setEchoChar((char)0); //password = JPasswordField } else { jPasswordField2.setEchoChar('*'); } }//GEN-LAST:event_jCheckBox1ActionPerformed private void jCheckBox2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox2ActionPerformed // TODO add your handling code here: if (jCheckBox2.isSelected()) { jPasswordField1.setEchoChar((char)0); //password = JPasswordField } else { jPasswordField1.setEchoChar('*'); } }//GEN-LAST:event_jCheckBox2ActionPerformed private void jPasswordField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jPasswordField1ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jPasswordField1ActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { System.out.println("coded by: eyesee"); /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { com.jtattoo.plaf.acryl.AcrylLookAndFeel.setTheme("Red-Small-Font", "INSERT YOUR LICENSE KEY HERE", "my company"); UIManager.setLookAndFeel("com.jtattoo.plaf.acryl.AcrylLookAndFeel"); } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(register_login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(register_login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(register_login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(register_login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new register_login().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JButton jButton3; private javax.swing.JCheckBox jCheckBox1; private javax.swing.JCheckBox jCheckBox2; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JLabel jLabel9; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JPasswordField jPasswordField1; private javax.swing.JPasswordField jPasswordField2; private javax.swing.JTextField jTextField1; private javax.swing.JTextField jTextField2; private javax.swing.JTextField jTextField3; private javax.swing.JTextField jTextField4; // End of variables declaration//GEN-END:variables }
[ "noreply@github.com" ]
noreply@github.com
cecb00a76e94bf8f7a11b31939575e1aacea8c47
479ccbfa9bca1c7041a91bc69ecf7bfbe8db1964
/JavaDesignPatterns/Structural/com/pattern/composite/Triangle.java
2b1c77f0a2b46c3ed6c64794367aca3e6f7a4819
[]
no_license
gchetan13/PersonalSpace
0d293a16eed30166af72ea825da76cf0020f2aed
e5ea508ad4ba7884669a02d59d5fe0e4bdb5f578
refs/heads/main
2023-02-03T18:20:28.998500
2020-12-21T07:15:16
2020-12-21T07:15:16
323,255,490
0
0
null
null
null
null
UTF-8
Java
false
false
185
java
package com.pattern.composite; public class Triangle implements Shape { @Override public void draw(String color) { System.out.println("Drawing Triangle with color "+color); } }
[ "cgupta31@dxc.com" ]
cgupta31@dxc.com
729ce10ca2a97a8ab7141901e972444a713a196a
54fc340f6c58721c9eec0fa788649d3dcebe2185
/src/main/java/com/tangshengbo/book/prototype/example1/PersonalOrder.java
e2e49420e44e3e88279f4375d01b056732e82808
[]
no_license
tangshengbo/myproject-design
e3850783a3881db74273171ae9922eb517738ae2
20414c29d62f1846d01685f0613f1aa42ceaa061
refs/heads/master
2021-05-14T18:51:41.593919
2018-11-22T02:52:12
2018-11-22T02:52:12
116,090,048
0
0
null
null
null
null
UTF-8
Java
false
false
917
java
package com.tangshengbo.book.prototype.example1; /** * 个人订单对象 */ public class PersonalOrder implements OrderApi{ /** * 订购人员姓名 */ private String customerName; /** * 产品编号 */ private String productId; /** * 订单产品数量 */ private int orderProductNum = 0; public int getOrderProductNum() { return this.orderProductNum; } public void setOrderProductNum(int num) { this.orderProductNum = num; } public String getCustomerName() { return customerName; } public void setCustomerName(String customerName) { this.customerName = customerName; } public String getProductId() { return productId; } public void setProductId(String productId) { this.productId = productId; } public String toString(){ return "本个人订单的订购人是="+this.customerName+",订购产品是="+this.productId+",订购数量为="+this.orderProductNum; } }
[ "867850520tangbo@sina.com" ]
867850520tangbo@sina.com
11d9b2f33748ba8e6966718787bcc47360df7364
63efef2a78943970a3cefcbec4a7bd9d1c3b3793
/lis-commons-lang/src/test/java/com/link_intersystems/util/graph/GraphFacadeImpl_perPredicateNodeIteratorTest.java
86215d41a4b12dfec23e39d53f491fce16742fa6
[ "Apache-2.0" ]
permissive
renelink/lis-commons
5ae526fd2bcd142dfb914fd0f2b1207c72d48473
4a58042547475f0efb0e41c9db1656bdc37ffa8b
refs/heads/master
2020-03-18T08:52:10.358477
2017-11-19T15:07:06
2017-11-19T15:07:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,274
java
/** * Copyright 2011 Link Intersystems GmbH <rene.link@link-intersystems.com> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.link_intersystems.util.graph; import static java.util.Arrays.asList; import java.util.Iterator; import java.util.List; import org.apache.commons.collections4.Predicate; import org.junit.Before; import org.junit.Test; import com.link_intersystems.util.graph.AbstractNodeIteratorTest.TraverseAssertion; import com.link_intersystems.util.graph.GraphFacade.NodeIterateStrategy; public class GraphFacadeImpl_perPredicateNodeIteratorTest { NodeImpl A = new NodeImpl("A"); NodeImpl B = new NodeImpl("B"); NodeImpl C = new NodeImpl("C"); NodeImpl D = new NodeImpl("D"); NodeImpl E = new NodeImpl("E"); NodeImpl F = new NodeImpl("F"); NodeImpl G = new NodeImpl("G"); NodeImpl H = new NodeImpl("H"); NodeImpl I = new NodeImpl("I"); NodeImpl J = new NodeImpl("J"); NodeImpl K = new NodeImpl("K"); NodeImpl L = new NodeImpl("L"); NodeImpl M = new NodeImpl("M"); NodeImpl N = new NodeImpl("N"); private Predicate pred1; private Predicate pred2; private Predicate pred3; @Before public void createFacade() { /** * <pre> * A * +------------+------------+ * B C D * +----+----+ | +---+------------+ * E F G H I J K * +------+------+ * L M N * </pre> */ A.addReference(B); A.addReference(C); A.addReference(D); B.addReference(E); B.addReference(F); B.addReference(G); C.addReference(H); D.addReference(I); D.addReference(J); D.addReference(K); K.addReference(L); K.addReference(M); K.addReference(N); pred1 = new Predicate() { public boolean evaluate(Object object) { Node node = Node.class.cast(object); List<String> matchingNodes = asList("A", "C", "H", "D", "K"); Object userObject = node.getUserObject(); String userObjectAsString = userObject.toString(); return matchingNodes.contains(userObjectAsString); } }; pred2 = new Predicate() { public boolean evaluate(Object object) { Node node = Node.class.cast(object); List<String> matchingNodes = asList("A", "B", "E", "F"); Object userObject = node.getUserObject(); String userObjectAsString = userObject.toString(); return matchingNodes.contains(userObjectAsString); } }; pred3 = new Predicate() { public boolean evaluate(Object object) { Node node = Node.class.cast(object); List<String> matchingNodes = asList("D", "J", "M", "N"); Object userObject = node.getUserObject(); String userObjectAsString = userObject.toString(); return matchingNodes.contains(userObjectAsString); } }; } @Test public void breadth_first() { List<String> expectedOrder = asList("A", "C", "D", "H", "K", "A", "B", "E", "F", "D", "J", "M", "N"); TraverseAssertion traverseAssertion = new TraverseAssertion( expectedOrder); Iterator<Node> iterator = GraphFacade.perPredicateNodeIterator( NodeIterateStrategy.BREADTH_FIRST, A, pred1, pred2, pred3); GraphFacade.forAllDo(iterator, traverseAssertion); traverseAssertion.assertAllUserObjectsTraversed(); } @Test public void depth_first() { List<String> expectedOrder = asList("A", "C", "H", "D", "K", "A", "B", "E", "F", "D", "J", "M", "N"); TraverseAssertion traverseAssertion = new TraverseAssertion( expectedOrder); Iterator<Node> iterator = GraphFacade.perPredicateNodeIterator( NodeIterateStrategy.DEPTH_FIRST, A, pred1, pred2, pred3); GraphFacade.forAllDo(iterator, traverseAssertion); traverseAssertion.assertAllUserObjectsTraversed(); } }
[ "rene.link@link-intersystems.com" ]
rene.link@link-intersystems.com
89c52b903004c8e5bddf617ce0cf2b63a4949eaa
e40022756be12a05e226c3a01e638e6fb2f0ebda
/CampChallenge_java/003.JSPとサーブレット1/FortuneTelling.java
6dcd450ae2178f6c97e1feb97518b89771be8ef2
[]
no_license
mikity1017/GEEK-JOB_Challenge
5dd785a08cc7ae658c7e5566d880f1b567b1f163
66260bdbde622127b87584d3393d5bef8385bd4d
refs/heads/master
2020-05-23T22:51:09.592639
2017-04-08T06:13:22
2017-04-08T06:13:22
84,797,532
0
0
null
null
null
null
UTF-8
Java
false
false
3,471
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 org.camp.servlet; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.Random; /** * * @author yokoi miki */ public class FortuneTelling extends HttpServlet { /** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); //大吉、中吉、小吉、吉、半吉、末吉、末小吉、凶、小凶、半凶、末凶、大凶 String lucklist[]={"大吉","中吉","小吉","吉","半吉","末吉","末小吉","凶","小凶","半凶","末凶","大凶"}; //乱数クラスを生成 Random rand = new Random(); //nextIntメソッドで乱数(rand)を取得 Integer index = rand.nextInt(lucklist.length); try { /* TODO output your page here. You may use following sample code. */ out.println("<!DOCTYPE html>"); out.println("<html>"); out.println("<head>"); out.println("<title>本日の運勢</title>"); out.println("</head>"); out.println("<body>"); out.println("<h1>" + "今日のあなたの運勢は…" + lucklist[index] + "!" + "</h1>"); out.println("</body>"); out.println("</html>"); }finally{ out.close(); } } // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> /** * Handles the HTTP <code>GET</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Handles the HTTP <code>POST</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Returns a short description of the servlet. * * @return a String containing servlet description */ @Override public String getServletInfo() { return "Short description"; }// </editor-fold> }
[ "mmk.eny2x@gmail.com" ]
mmk.eny2x@gmail.com
acd27c9c7af361e62a24b663b52b9de102f081ad
f4d739b7f4206ece786724e2a72a3257ee0bc501
/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandScaleMaxWidthAndHeight.java
7d31e01fd14fee3128b9f883e823a869519b8596
[ "Apache-2.0" ]
permissive
mercurio123/umldoclet
2cf809ef2043480d5591275c4b8f7d54ae96dabb
fbd5206dd120afcde0efbaf1d69c979903b016ae
refs/heads/master
2023-08-22T00:16:14.001525
2021-08-22T13:33:01
2021-08-22T13:33:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,510
java
/* ======================================================================== * PlantUML : a free UML diagram generator * ======================================================================== * * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: https://plantuml.com * * If you like this project or if you find it useful, you can support us at: * * https://plantuml.com/patreon (only 1$ per month!) * https://plantuml.com/paypal * * This file is part of PlantUML. * * 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. * * * Original Author: Arnaud Roques */ package net.sourceforge.plantuml.command; import net.sourceforge.plantuml.AbstractPSystem; import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.ScaleMaxWidthAndHeight; import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; public class CommandScaleMaxWidthAndHeight extends SingleLineCommand2<AbstractPSystem> { public CommandScaleMaxWidthAndHeight() { super(getRegexConcat()); } static IRegex getRegexConcat() { return RegexConcat.build(CommandScaleMaxWidthAndHeight.class.getName(), RegexLeaf.start(), // new RegexLeaf("scale"), // RegexLeaf.spaceOneOrMore(), // new RegexLeaf("max"), // RegexLeaf.spaceOneOrMore(), // new RegexLeaf("WIDTH", "([0-9.]+)"), // RegexLeaf.spaceZeroOrMore(), // new RegexLeaf("[*x]"), // RegexLeaf.spaceZeroOrMore(), // new RegexLeaf("HEIGHT", "([0-9.]+)"), RegexLeaf.end()); // } @Override protected CommandExecutionResult executeArg(AbstractPSystem diagram, LineLocation location, RegexResult arg) { final double width = Double.parseDouble(arg.get("WIDTH", 0)); final double height = Double.parseDouble(arg.get("HEIGHT", 0)); diagram.setScale(new ScaleMaxWidthAndHeight(width, height)); return CommandExecutionResult.ok(); } }
[ "noreply@github.com" ]
noreply@github.com
b890e59faab123debd269f1c4c7b23da63700196
606cd7931bc5288ffe91cf58f45d3e4f64a9b3df
/pk-ejb/src/java/com/pelindo/ebtos/model/db/PerhitunganPenumpukan.java
3bdc2dc093c9966ca11cd4104fa5d2d54219f891
[]
no_license
surachman/iconos-tarakan
5655284ac69059935922d92ee856b6926b656d1d
d7fa1c120d22d391983dab95c5654cb63b27e1f7
refs/heads/master
2021-01-20T20:21:40.937285
2016-06-27T14:51:22
2016-06-27T14:51:22
61,995,382
0
0
null
null
null
null
UTF-8
Java
false
false
11,114
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.pelindo.ebtos.model.db; import com.qtasnim.persistence.AuditTrailEntityListener; import com.qtasnim.persistence.EntityAuditable; import com.pelindo.ebtos.model.db.master.MasterActivity; import com.pelindo.ebtos.model.db.master.MasterCustomer; import java.io.Serializable; import java.math.BigDecimal; import java.util.Date; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EntityListeners; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.JoinColumns; import javax.persistence.ManyToOne; import javax.persistence.NamedNativeQueries; import javax.persistence.NamedNativeQuery; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.OneToOne; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; /** * * @author senoanggoro */ @Entity @EntityListeners({AuditTrailEntityListener.class}) @Table(name = "perhitungan_penumpukan") @NamedQueries({ @NamedQuery(name = "PerhitunganPenumpukan.findAll", query = "SELECT p FROM PerhitunganPenumpukan p"), @NamedQuery(name = "PerhitunganPenumpukan.findById", query = "SELECT p FROM PerhitunganPenumpukan p WHERE p.id = :id"), @NamedQuery(name = "PerhitunganPenumpukan.findByContNo", query = "SELECT p FROM PerhitunganPenumpukan p WHERE p.contNo = :contNo"), @NamedQuery(name = "PerhitunganPenumpukan.findByBlNo", query = "SELECT p FROM PerhitunganPenumpukan p WHERE p.blNo = :blNo"), @NamedQuery(name = "PerhitunganPenumpukan.updateNoPpkb", query = "UPDATE PerhitunganPenumpukan p SET p.noPpkb = :newValue WHERE p.noPpkb = :oldValue"), @NamedQuery(name = "PerhitunganPenumpukan.deleteByContNoAndNoReg", query = "DELETE FROM PerhitunganPenumpukan p WHERE p.contNo = :contNo AND p.registration.noReg = :noReg"), @NamedQuery(name = "PerhitunganPenumpukan.findByContNoAndNoReg", query = "SELECT p FROM PerhitunganPenumpukan p WHERE p.contNo = :contNo AND p.registration.noReg = :noReg"), @NamedQuery(name = "PerhitunganPenumpukan.deleteByNoReg", query = "DELETE FROM PerhitunganPenumpukan p WHERE p.registration.noReg = :noReg"), @NamedQuery(name = "PerhitunganPenumpukan.findByCharge", query = "SELECT p FROM PerhitunganPenumpukan p WHERE p.charge = :charge"), @NamedQuery(name = "PerhitunganPenumpukan.deleteByNoPpkbReceivingOnly", query = "DELETE FROM PerhitunganPenumpukan p WHERE p.receivingService.planningVessel.noPpkb = :noPpkb")}) @NamedNativeQueries({ @NamedNativeQuery(name = "PerhitunganPenumpukan.Native.findInvoice", query = "SELECT id FROM perhitungan_penumpukan WHERE cont_no = ? AND no_ppkb = ? AND no_reg = ?"), @NamedNativeQuery(name = "PerhitunganPenumpukan.Native.findByReg", query = "SELECT id FROM perhitungan_penumpukan WHERE no_reg = ?"), @NamedNativeQuery(name = "PerhitunganPenumpukan.Native.findByCancelInvoice", query = "SELECT id FROM perhitungan_penumpukan WHERE no_reg = ? AND no_ppkb = ?")}) public class PerhitunganPenumpukan implements Serializable, EntityAuditable { @OneToOne(mappedBy = "perhitunganPenumpukan") private CancelDocumentService cancelDocumentService; private static final long serialVersionUID = 1L; @Id @Basic(optional = false) @Column(name = "id", nullable = false) //@GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; @Column(name = "cont_no", length = 11) private String contNo; @Column(name = "bl_no") private String blNo; @Column(name = "charge", precision = 19, scale = 2) private BigDecimal charge = BigDecimal.ZERO; @Column(name = "no_ppkb", length = 30) private String noPpkb; @Column(name = "charge_m1", precision = 19, scale = 2) private BigDecimal chargeM1 = BigDecimal.ZERO; @Column(name = "charge_m2", precision = 19, scale = 2) private BigDecimal chargeM2 = BigDecimal.ZERO; @Column(name = "charge_m3", precision = 19, scale = 2) private BigDecimal chargeM3 = BigDecimal.ZERO; @Column(name = "total_charge", precision = 19, scale = 2) private BigDecimal totalCharge = BigDecimal.ZERO; @Column(name = "jasa_dermaga", precision = 19, scale = 2) private BigDecimal jasaDermaga = BigDecimal.ZERO; @Column(name = "curr_code", length = 5) private String currCode; @JoinColumn(name = "no_reg", referencedColumnName = "no_reg") @ManyToOne private Registration registration; @JoinColumn(name = "activity_code", referencedColumnName = "activity_code") @ManyToOne private MasterActivity masterActivity; @Column(name = "payment_date") @Temporal(TemporalType.TIMESTAMP) private Date paymentDate; @Column(name = "masa_1") private Short masa1 = 0; @Column(name = "masa_2") private Short masa2 = 0; @Column(name = "masa_3") private Short masa3 = 0; @Basic(optional = false) @Column(name = "created_by", nullable = false, length = 256) private String createdBy; @Basic(optional = false) @Column(name = "created_date", nullable = false) @Temporal(TemporalType.TIMESTAMP) private Date createdDate; @Column(name = "modified_by", length = 256) private String modifiedBy; @Column(name = "modified_date") @Temporal(TemporalType.TIMESTAMP) private Date modifiedDate; @JoinColumns(value = { @JoinColumn(name = "no_reg", referencedColumnName = "no_reg", insertable = false, updatable = false), @JoinColumn(name = "cont_no", referencedColumnName = "cont_no", insertable = false, updatable = false), @JoinColumn(name = "no_ppkb", referencedColumnName = "no_ppkb", insertable = false, updatable = false) }) @OneToOne private ReceivingService receivingService; @JoinColumn(name = "mlo", referencedColumnName = "cust_code") @ManyToOne private MasterCustomer mlo; public PerhitunganPenumpukan() { } public PerhitunganPenumpukan(Integer id) { this.id = id; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getContNo() { return contNo; } public void setContNo(String contNo) { this.contNo = contNo; } public String getBlNo() { return blNo; } public void setBlNo(String blNo) { this.blNo = blNo; } public BigDecimal getCharge() { return charge; } public void setCharge(BigDecimal charge) { this.charge = charge; } public Registration getRegistration() { return registration; } public void setRegistration(Registration registration) { this.registration = registration; } public MasterActivity getMasterActivity() { return masterActivity; } public void setMasterActivity(MasterActivity masterActivity) { this.masterActivity = masterActivity; } public String getNoPpkb() { return noPpkb; } public void setNoPpkb(String noPpkb) { this.noPpkb = noPpkb; } public BigDecimal getChargeM1() { return chargeM1; } public void setChargeM1(BigDecimal chargeM1) { this.chargeM1 = chargeM1; } public BigDecimal getChargeM2() { return chargeM2; } public void setChargeM2(BigDecimal chargeM2) { this.chargeM2 = chargeM2; } public BigDecimal getChargeM3() { return chargeM3; } public void setChargeM3(BigDecimal chargeM3) { this.chargeM3 = chargeM3; } public BigDecimal getTotalCharge() { return totalCharge; } public void setTotalCharge(BigDecimal totalCharge) { this.totalCharge = totalCharge; } /** * @return the jasaDermaga */ public BigDecimal getJasaDermaga() { return jasaDermaga; } /** * @param jasaDermaga the jasaDermaga to set */ public void setJasaDermaga(BigDecimal jasaDermaga) { this.jasaDermaga = jasaDermaga; } public String getCurrCode() { return currCode; } public void setCurrCode(String currCode) { this.currCode = currCode; } public String getCreatedBy() { return createdBy; } public void setCreatedBy(String createdBy) { this.createdBy = createdBy; } public Date getCreatedDate() { return createdDate; } public void setCreatedDate(Date createdDate) { this.createdDate = createdDate; } public String getModifiedBy() { return modifiedBy; } public void setModifiedBy(String modifiedBy) { this.modifiedBy = modifiedBy; } public Date getModifiedDate() { return modifiedDate; } public void setModifiedDate(Date modifiedDate) { this.modifiedDate = modifiedDate; } public ReceivingService getReceivingService() { return receivingService; } public void setReceivingService(ReceivingService receivingService) { this.receivingService = receivingService; } /** * @return the mlo */ public MasterCustomer getMlo() { return mlo; } /** * @param mlo the mlo to set */ public void setMlo(MasterCustomer mlo) { this.mlo = mlo; } public Date getPaymentDate() { return paymentDate; } public void setPaymentDate(Date paymentDate) { this.paymentDate = paymentDate; } public Short getMasa1() { return masa1; } public void setMasa1(Short masa1) { this.masa1 = masa1; } public Short getMasa2() { return masa2; } public void setMasa2(Short masa2) { this.masa2 = masa2; } public Short getMasa3() { return masa3; } public void setMasa3(Short masa3) { this.masa3 = masa3; } @Override public int hashCode() { int hash = 0; hash += (id != null ? id.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof PerhitunganPenumpukan)) { return false; } PerhitunganPenumpukan other = (PerhitunganPenumpukan) object; if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { return false; } return true; } @Override public String toString() { return "com.pelindo.ebtos.model.db.PerhitunganPenumpukan[id=" + id + "]"; } public CancelDocumentService getCancelDocumentService() { return cancelDocumentService; } public void setCancelDocumentService(CancelDocumentService cancelDocumentService) { this.cancelDocumentService = cancelDocumentService; } }
[ "surachman026@gmail.com" ]
surachman026@gmail.com
67023aa55efdd107b6dc5661b0a3d67d745ee4ef
62474395eba162829f87985a2666c4f8f24f115d
/app/src/main/java/com/example/apple/picturepickerdemo/view/HackyViewPager.java
a237d3b7583b05478d59ee2733c8cd321e111845
[]
no_license
AndroidStudy2015/PicturePickerDemo
c0ea1c10320c3c5f823a40674e2ba627c028c027
1645116a2934c7c63162de57b9f36599988427ff
refs/heads/master
2021-01-20T10:15:53.961206
2017-08-30T00:57:12
2017-08-30T00:57:12
101,623,735
0
0
null
null
null
null
UTF-8
Java
false
false
1,894
java
package com.example.apple.picturepickerdemo.view; /** * Found at http://stackoverflow.com/questions/7814017/is-it-possible-to-disable-scrolling-on-a-viewpager. * Convenient way to temporarily disable ViewPager navigation while interacting with ImageView. * * Julia Zudikova */ import android.content.Context; import android.support.v4.view.ViewPager; import android.util.AttributeSet; import android.view.MotionEvent; /** * Hacky fix for Issue #4 and * http://code.google.com/p/android/issues/detail?id=18990 * <p/> * ScaleGestureDetector seems to mess up the touch events, which means that * ViewGroups which make use of onInterceptTouchEvent throw a lot of * IllegalArgumentException: pointerIndex out of range. * <p/> * There's not much I can do in my code for now, but we can mask the result by * just catching the problem and ignoring it. * * @author Chris Banes */ public class HackyViewPager extends ViewPager { private boolean isLocked; public HackyViewPager(Context context) { super(context); isLocked = false; } public HackyViewPager(Context context, AttributeSet attrs) { super(context, attrs); isLocked = false; } @Override public boolean onInterceptTouchEvent(MotionEvent ev) { if (!isLocked) { try { return super.onInterceptTouchEvent(ev); } catch (IllegalArgumentException e) { e.printStackTrace(); return false; } } return false; } @Override public boolean onTouchEvent(MotionEvent event) { return !isLocked && super.onTouchEvent(event); } public void toggleLock() { isLocked = !isLocked; } public void setLocked(boolean isLocked) { this.isLocked = isLocked; } public boolean isLocked() { return isLocked; } }
[ "1" ]
1
bdc6e09bb4c7262e3501c348e93a77d1c996823f
3c379114643fc0d8287dcfb3294bcb417dc6621c
/test/BDTests/TestsBDConexion.java
99744daee86790c3f077bc1a54c0bb1fbbf17363
[]
no_license
Alexevh/OBDDA2018
6ac2cb5c8538d12a81ce172a68907306583484b6
69a0c909bf5e3d01b6e40427e1020f692bdec9e6
refs/heads/master
2020-03-14T08:14:25.792627
2018-07-04T22:52:41
2018-07-04T22:52:41
131,520,639
0
0
null
null
null
null
UTF-8
Java
false
false
1,904
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 BDTests; import mapeadores.MapeadorJugador; import com.mysql.jdbc.Connection; import java.util.ArrayList; import mapeadores.MapeadorJuego; import modelo.Juego; import modelo.Jugador; import org.junit.Test; import persistencia.BaseDatos; import persistencia.Mapeador; import persistencia.Persistencia; /** * * @author alex */ public class TestsBDConexion { @Test public void probarConexion(){ BaseDatos.getInstancia().conectar("pokerGame", "root", "root"); } @Test public void probarInsertarJugador(){ Jugador j = new Jugador("Amanda A", "amanda", "password", 1000); Mapeador m = new MapeadorJugador(j); Persistencia.getInstancia().guardar(m); } @Test public void probarModificarJugador(){ Jugador j = new Jugador("Peter P", "peter", "password", 400); j.setOid(4); Mapeador m = new MapeadorJugador(j); Persistencia.getInstancia().guardar(m); } @Test public void probarBuscarJugadores(){ Jugador j = new Jugador("Peter P", "peter", "password", 400); Mapeador m = new MapeadorJugador(j); ArrayList<Jugador> lista = Persistencia.getInstancia().todos(m); System.out.println("La lista tiene "+lista.size()+" elementos"); } @Test public void probarBuscarPartidas(){ Juego j = new Juego(); Mapeador m = new MapeadorJuego(j); ArrayList<Juego> lista = Persistencia.getInstancia().todosJuegos(m); System.out.println("La lista tiene "+lista.size()+" elementos"); } }
[ "alex@Varian" ]
alex@Varian
95dd92eca55ebdf1caa05034aca3ec7cf8785d8b
95bca8b42b506860014f5e7f631490f321f51a63
/dhis-2/dhis-support/dhis-support-jdbc-test/src/test/java/org/hisp/dhis/jdbc/batchhandler/GroupSetBatchHandlerTest.java
38556f991593f9c556ba21a64d34011595b5301a
[ "BSD-3-Clause" ]
permissive
hispindia/HP-2.7
d5174d2c58423952f8f67d9846bec84c60dfab28
bc101117e8e30c132ce4992a1939443bf7a44b61
refs/heads/master
2022-12-25T04:13:06.635159
2020-09-29T06:32:53
2020-09-29T06:32:53
84,940,096
0
0
BSD-3-Clause
2022-12-15T23:53:32
2017-03-14T11:13:27
Java
UTF-8
Java
false
false
5,719
java
package org.hisp.dhis.jdbc.batchhandler; /* * Copyright (c) 2004-2012, University of Oslo * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * Neither the name of the HISP project nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertFalse; import static junit.framework.Assert.assertNotNull; import static junit.framework.Assert.assertTrue; import java.util.Collection; import org.amplecode.quick.BatchHandler; import org.amplecode.quick.BatchHandlerFactory; import org.hisp.dhis.DhisTest; import org.hisp.dhis.organisationunit.OrganisationUnitGroupService; import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; /** * @author Lars Helge Overland * @version $Id: GroupSetBatchHandlerTest.java 4949 2008-04-21 07:59:54Z larshelg $ */ public class GroupSetBatchHandlerTest extends DhisTest { @Autowired private BatchHandlerFactory batchHandlerFactory; private BatchHandler<OrganisationUnitGroupSet> batchHandler; private OrganisationUnitGroupSet groupSetA; private OrganisationUnitGroupSet groupSetB; private OrganisationUnitGroupSet groupSetC; // ------------------------------------------------------------------------- // Fixture // ------------------------------------------------------------------------- @Override public void setUpTest() { organisationUnitGroupService = (OrganisationUnitGroupService) getBean( OrganisationUnitGroupService.ID ); batchHandler = batchHandlerFactory.createBatchHandler( GroupSetBatchHandler.class ); batchHandler.init(); groupSetA = createOrganisationUnitGroupSet( 'A' ); groupSetB = createOrganisationUnitGroupSet( 'B' ); groupSetC = createOrganisationUnitGroupSet( 'C' ); } @Override public void tearDownTest() { batchHandler.flush(); } @Override public boolean emptyDatabaseAfterTest() { return true; } // ------------------------------------------------------------------------- // Tests // ------------------------------------------------------------------------- @Test public void testAddObject() { batchHandler.addObject( groupSetA ); batchHandler.addObject( groupSetB ); batchHandler.addObject( groupSetC ); batchHandler.flush(); Collection<OrganisationUnitGroupSet> groupSets = organisationUnitGroupService.getAllOrganisationUnitGroupSets(); assertTrue( groupSets.add( groupSetA ) ); assertTrue( groupSets.add( groupSetB ) ); assertTrue( groupSets.add( groupSetC ) ); } @Test public void testInsertObject() { int idA = batchHandler.insertObject( groupSetA, true ); int idB = batchHandler.insertObject( groupSetB, true ); int idC = batchHandler.insertObject( groupSetC, true ); assertNotNull( organisationUnitGroupService.getOrganisationUnitGroupSet( idA ) ); assertNotNull( organisationUnitGroupService.getOrganisationUnitGroupSet( idB ) ); assertNotNull( organisationUnitGroupService.getOrganisationUnitGroupSet( idC ) ); } @Test public void testUpdateObject() { int id = batchHandler.insertObject( groupSetA, true ); groupSetA.setId( id ); groupSetA.setName( "UpdatedName" ); batchHandler.updateObject( groupSetA ); assertEquals( "UpdatedName", organisationUnitGroupService.getOrganisationUnitGroupSet( id ).getName() ); } @Test public void testGetObjectIdentifier() { int referenceId = organisationUnitGroupService.addOrganisationUnitGroupSet( groupSetA ); int retrievedId = batchHandler.getObjectIdentifier( "OrganisationUnitGroupSetA" ); assertEquals( referenceId, retrievedId ); } @Test public void testObjectExists() { organisationUnitGroupService.addOrganisationUnitGroupSet( groupSetA ); assertTrue( batchHandler.objectExists( groupSetA ) ); assertFalse( batchHandler.objectExists( groupSetB ) ); } }
[ "mithilesh.hisp@gmail.com" ]
mithilesh.hisp@gmail.com
20b0b89e6ed014e17a5c7b1da998e5dd2593d2c8
9b3a40e2293d945a3c84fd566d62044d9745ef57
/src/main/java/io/temporal/internal/sync/ExternalWorkflowStubImpl.java
66d95a66ee265f1211fb0e2c97379b2b7b07c621
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
ChaithanyaGK/java-sdk
fbb14ae053f76cbfca4075e5094df9ff646d90d2
915087100e8720f67a51153ac72b7dd73392d647
refs/heads/master
2022-11-18T16:07:24.531984
2020-07-14T00:28:43
2020-07-14T00:28:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,811
java
/* * Copyright (C) 2020 Temporal Technologies, Inc. All Rights Reserved. * * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Modifications copyright (C) 2017 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not * use this file except in compliance with the License. A copy of the License is * located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file 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 io.temporal.internal.sync; import io.temporal.api.common.v1.WorkflowExecution; import io.temporal.common.interceptors.WorkflowOutboundCallsInterceptor; import io.temporal.workflow.CancelExternalWorkflowException; import io.temporal.workflow.ExternalWorkflowStub; import io.temporal.workflow.Promise; import io.temporal.workflow.SignalExternalWorkflowException; import java.util.Objects; /** Dynamic implementation of a strongly typed child workflow interface. */ class ExternalWorkflowStubImpl implements ExternalWorkflowStub { private final WorkflowOutboundCallsInterceptor decisionContext; private final WorkflowExecution execution; public ExternalWorkflowStubImpl( WorkflowExecution execution, WorkflowOutboundCallsInterceptor decisionContext) { this.decisionContext = Objects.requireNonNull(decisionContext); this.execution = Objects.requireNonNull(execution); } @Override public WorkflowExecution getExecution() { return execution; } @Override public void signal(String signalName, Object... args) { Promise<Void> signaled = decisionContext.signalExternalWorkflow(execution, signalName, args); if (AsyncInternal.isAsync()) { AsyncInternal.setAsyncResult(signaled); return; } try { signaled.get(); } catch (SignalExternalWorkflowException e) { // Reset stack to the current one. Otherwise it is very confusing to see a stack of // an event handling method. e.setStackTrace(Thread.currentThread().getStackTrace()); throw e; } } @Override public void cancel() { Promise<Void> cancelRequested = decisionContext.cancelWorkflow(execution); if (AsyncInternal.isAsync()) { AsyncInternal.setAsyncResult(cancelRequested); return; } try { cancelRequested.get(); } catch (CancelExternalWorkflowException e) { // Reset stack to the current one. Otherwise it is very confusing to see a stack of // an event handling method. e.setStackTrace(Thread.currentThread().getStackTrace()); throw e; } } }
[ "noreply@github.com" ]
noreply@github.com
f6d74744997e63b186625c472deda9ad4cf9a547
b874892335cfd25d496fc31615e879eae6557862
/aggregates/src/main/java/org/fuin/cqrs4j/example/aggregates/package-info.java
f486708a69b37549d2b50bd7c6d9d9a7f21a7f1a
[ "Apache-2.0" ]
permissive
ElaineChi/ddd-cqrs-4-java-example
ffd75d4c899a6800c0b4b007fe04d95edae6be3d
eeca95221f56886326f7248398f069d980ede841
refs/heads/master
2023-08-25T09:58:57.736394
2021-10-23T12:54:34
2021-10-23T12:54:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
889
java
/** * Copyright (C) 2015 Michael Schnell. All rights reserved. http://www.fuin.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 3 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, see * http://www.gnu.org/licenses/. */ package org.fuin.cqrs4j.example.aggregates; /** * Domain specific code like aggregate root classes and their repositories. */
[ "michael@fuin.org" ]
michael@fuin.org
1aef02858e7bf6a6b10426628484946480478f41
72ab9bafc4ff280b7ef8d0bf1daf409172cc1db8
/src/io/github/galaipa/sw2/SkyWarsGE2.java
adaa2f1abf19230ce66c95d769fb816f53569ecb
[]
no_license
GameErauntsia/SkyWarsGE
607108805e62839f539d9e88e39ee769a4a3dab6
f0afec58a9beb80d60922230ec916a51e4a4e5a5
refs/heads/master
2020-04-09T17:35:09.712888
2016-11-29T20:39:46
2016-11-29T20:39:46
41,149,931
0
0
null
null
null
null
UTF-8
Java
false
false
14,746
java
package io.github.galaipa.sw2; import de.goldengamerzone.worldreset.WorldReset; import static io.github.galaipa.sw2.GameListener.exPlayers; import java.util.ArrayList; import java.util.Random; import net.minecraft.server.v1_11_R1.IChatBaseComponent; import net.minecraft.server.v1_11_R1.PacketPlayOutTitle; import net.minecraft.server.v1_11_R1.PlayerConnection; import org.black_ixx.playerpoints.PlayerPoints; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scoreboard.DisplaySlot; import org.bukkit.scoreboard.Objective; import org.bukkit.scoreboard.Score; import org.bukkit.scoreboard.Scoreboard; import org.bukkit.scoreboard.ScoreboardManager; public class SkyWarsGE2 extends JavaPlugin { ArrayList <Team> teams = new ArrayList<>(); ArrayList <Player> Jokalariak = new ArrayList<>(); Location spawn; Location lobby; Boolean inGame, bozketa,map; int taldeKopurua, bozkaKopurua; Objective objective; ScoreboardManager manager; Scoreboard board; Score jokalariKopurua; String arena; @Override public void onEnable() { getConfig().options().copyDefaults(true); saveConfig(); manager = Bukkit.getScoreboardManager(); board = manager.getNewScoreboard(); objective = board.registerNewObjective(ChatColor.DARK_GREEN.BOLD + "SkyWars", "dummy"); defaultValues(); getServer().getPluginManager().registerEvents(new GameListener(this), this); getServer().getPluginManager().registerEvents(new Gui(this), this); getServer().getPluginManager().registerEvents(new SignListener(this), this); hookPlayerPoints(); } @Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){ Player p = (Player) sender; if (cmd.getName().equalsIgnoreCase("skywarsadmin")){ if(!p.hasPermission("sw.admin")){ sender.sendMessage(ChatColor.GREEN +"[Sky Wars] " + ChatColor.RED + "Ez daukazu hori egiteko baimenik"); }else if (args[0].equalsIgnoreCase("spawnpoint")){ SaveSpawn(args[1],p.getLocation(),args[2]); sender.sendMessage("Location: " + p.getLocation()); }else if (args[0].equalsIgnoreCase("start")){ sender.sendMessage(ChatColor.GREEN +"[Sky Wars] " + ChatColor.GREEN + "Jokoa orain hasiko da"); hasiera(); }else if (args[0].equalsIgnoreCase("join")){ join(getServer().getPlayer(args[1])); }else if (args[0].equalsIgnoreCase("proba")){ amaiera(); } }else if (cmd.getName().equalsIgnoreCase("skywars")){ if(args.length < 1){ }else if (args[0].equalsIgnoreCase("join")){ p.sendMessage(ChatColor.GREEN +"[Sky Wars] " + ChatColor.RED + "Kartela erabili jokoan sartzeko"); // Gui.openGui(p); }else if (args[0].equalsIgnoreCase("leave")){ resetPlayer(p); p.teleport(lobby); p.sendMessage(ChatColor.GREEN +"[Sky Wars] " + ChatColor.RED + "Jokotik irten zara"); }/*else if (args[0].equalsIgnoreCase("start")){ sender.sendMessage(ChatColor.GREEN +"[Sky Wars] " + ChatColor.GREEN + "Jokoa orain hasiko da"); if(taldeKopurua == 1){ sender.sendMessage(ChatColor.GREEN +"[Sky Wars] " + ChatColor.RED + "Bi jokalari behar dira gutxienez jokoa hasteko"); }else{ hasiera(); } }*/ } return true; } public void SaveSpawn(String arena, Location l,String t){ getConfig().set("Spawns." + arena + "." + t + ".World", l.getWorld().getName()); getConfig().set("Spawns." + arena + "."+ t + ".X", l.getX()); getConfig().set("Spawns." + arena + "."+ t + ".Y", l.getY()); getConfig().set("Spawns." + arena + "."+ t + ".Z", l.getZ()); saveConfig(); } public void resetPlayer(Player p){ loadLobby(); Jokalariak.remove(p); Team t = getTeam(p); teams.remove(t); taldeKopurua--; p.getInventory().clear(); p.getInventory().setArmorContents(null); if(inGame){ jokalariKopurua.setScore(Jokalariak.size()); for(Player p2 : Jokalariak){ p2.setScoreboard(board); } if(GameListener.exPlayers.contains(p)){ GameListener.exPlayers.remove(p); p.teleport(lobby); p.setGameMode(GameMode.SURVIVAL); } if(taldeKopurua == 1){ GameListener.p2 = p; GameListener.respawnPlayer(p); for(Player p2 : Jokalariak){ p2.getInventory().clear(); p2.getInventory().setArmorContents(null); p2.teleport(lobby); p2.sendMessage(ChatColor.GREEN +"[SkyWars] " + ChatColor.YELLOW +"Zorionak! SkyWars irabazi duzu." + ChatColor.GREEN + ("(+50 puntu)")); playerPoints.getAPI().give(p2.getUniqueId(), 50); } amaiera(); }else{ exPlayers.add(p); GameListener.respawnPlayer(p); } } } public void amaiera(){ for(Player p : GameListener.exPlayers){ p.teleport(lobby); p.setGameMode(GameMode.SURVIVAL); p.sendMessage(ChatColor.GREEN +"[SkyWars] " + ChatColor.YELLOW +"Mila esker jolasteagatik"); } defaultValues(); WorldReset.resetWorld("SkyWars"); } public void loadSpawn(String arena, Team team){ String w = getConfig().getString("Spawns."+ arena + "." + Integer.toString(team.getID()) + ".World"); Double x = getConfig().getDouble("Spawns." + arena + "." + Integer.toString(team.getID()) + ".X"); Double y = getConfig().getDouble("Spawns." + arena + "." + Integer.toString(team.getID()) + ".Y"); Double z = getConfig().getDouble("Spawns." + arena + "." + Integer.toString(team.getID()) + ".Z"); Location SpawnPoint = new Location(Bukkit.getServer().getWorld(w),x,y,z); team.setSpawnPoint(SpawnPoint); } public void loadSpawn2(String arena){ String w = getConfig().getString("Spawns."+ arena + ".0.World"); Double x = getConfig().getDouble("Spawns." + arena + ".0.X"); Double y = getConfig().getDouble("Spawns." + arena + ".0.Y"); Double z = getConfig().getDouble("Spawns." + arena + ".0.Z"); Location SpawnPoint = new Location(Bukkit.getServer().getWorld(w),x,y,z); spawn = SpawnPoint; } public void loadLobby(){ String w = getConfig().getString("Spawns.Spawn.World"); Double x = getConfig().getDouble("Spawns.Spawn.X"); Double y = getConfig().getDouble("Spawns.Spawn.Y"); Double z = getConfig().getDouble("Spawns.Spawn.Z"); Location SpawnPoint2 = new Location(Bukkit.getServer().getWorld(w),x,y,z); lobby = SpawnPoint2; } public void defaultValues(){ inGame = false; bozketa = false; Jokalariak.clear(); bozkaKopurua = 0; taldeKopurua = 0; teams.clear(); GameListener.exPlayers.clear(); } public void allPlayers(){ for(Team team : teams){ Player a = team.getPlayer(); if(!Jokalariak.contains(a)){ Jokalariak.add(a); } } } public void Broadcast(String s){ allPlayers(); for(Player p : Jokalariak){ p.sendMessage(s); } } public void sendTitleAll(Integer fadeIn, Integer stay, Integer fadeOut, String title, String subtitle){ for(Player p : Jokalariak){ sendTitle(p,fadeIn,stay,fadeOut,title,subtitle); } } public static void sendTitle(Player player, Integer fadeIn, Integer stay, Integer fadeOut, String title, String subtitle) { PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection; PacketPlayOutTitle packetPlayOutTimes = new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.TIMES, null, fadeIn, stay, fadeOut); connection.sendPacket(packetPlayOutTimes); if (subtitle != null) { subtitle = subtitle.replaceAll("%player%", player.getDisplayName()); subtitle = ChatColor.translateAlternateColorCodes('&', subtitle); IChatBaseComponent titleSub = IChatBaseComponent.ChatSerializer.a("{\"text\": \"" + subtitle + "\"}"); PacketPlayOutTitle packetPlayOutSubTitle = new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.SUBTITLE, titleSub); connection.sendPacket(packetPlayOutSubTitle); } if (title != null) { title = title.replaceAll("%player%", player.getDisplayName()); title = ChatColor.translateAlternateColorCodes('&', title); IChatBaseComponent titleMain = IChatBaseComponent.ChatSerializer.a("{\"text\": \"" + title + "\"}"); PacketPlayOutTitle packetPlayOutTitle = new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.TITLE, titleMain); connection.sendPacket(packetPlayOutTitle); } } public void join(Player p){ allPlayers(); for(Player a : Jokalariak){ if(a == p ){ p.sendMessage(ChatColor.GREEN +"[Sky Wars] " + ChatColor.RED + "Dagoeneko bazaude sartuta"); return; } } if(inGame){ p.sendMessage(ChatColor.GREEN +"[Sky Wars]" + ChatColor.RED + "Jokoa hasita dago dagoeneko");; } else{ taldeKopurua++; Broadcast(ChatColor.GREEN +"[Sky Wars] " + ChatColor.YELLOW + p.getName() + " sartu da"); Team team = new Team(taldeKopurua); teams.add(team); team.addPlayer(p); if(taldeKopurua == 1){ Random rand = new Random(); int randomNum = rand.nextInt((4 - 1) + 1) + 1; arena = Integer.toString(randomNum); loadSpawn2(arena); } loadSpawn(arena,team); p.teleport(team.getSpawnPoint()); p.sendMessage(ChatColor.GREEN +"[Sky Wars] " + ChatColor.YELLOW + "Jokoan sartu zara"); p.getInventory().clear(); p.getInventory().setArmorContents(null); p.setGameMode(GameMode.SURVIVAL); allPlayers(); Gui.maingui(p); return; } } public Team getTeam(Player p){ for(Team t : teams){ if(t.getPlayer() == p){ return t; } } return null; } public void health(){ BukkitRunnable task;task = new BukkitRunnable() { int countdown = 3; public void run(){ if(countdown == 0){ for(Player p : Jokalariak){ p.setHealth(p.getMaxHealth()); } this.cancel(); } } };task.runTaskTimer(this, 0L, 20L);} public void hasiera(){ loadLobby(); allPlayers(); BukkitRunnable task;task = new BukkitRunnable() { int countdown = 10; @Override public void run(){ for(Player p : Jokalariak){ p.setLevel(countdown); //p.sendMessage(ChatColor.GREEN + " " + countdown); p.getWorld().playSound(p.getLocation(),Sound.BLOCK_NOTE_BASS, 10, 1); sendTitle(p,20,40,20,ChatColor.YELLOW +Integer.toString(countdown),""); } countdown--; if (countdown < 0) { inGame = true; Broadcast(ChatColor.YELLOW + "----------------------------------------------------"); Broadcast(ChatColor.BOLD + "" + ChatColor.GREEN + " Sky Wars Game Erauntsia "); Broadcast(ChatColor.BLUE + " Zorte on guztiei!"); Broadcast(ChatColor.YELLOW + "----------------------------------------------------"); sendTitleAll(20,40,20,ChatColor.GREEN.toString() + "Zorte on",""); objective.setDisplaySlot(DisplaySlot.SIDEBAR); jokalariKopurua = objective.getScore(ChatColor.YELLOW + "Jokalari kopurua: " ); jokalariKopurua.setScore(Jokalariak.size()); Score ge = objective.getScore(ChatColor.GREEN + "GAME ERAUNTSIA" ); ge.setScore(0); for(Team team : teams){ team.getPlayer().getWorld().playSound(team.getPlayer().getLocation(),Sound.BLOCK_NOTE_BASS, 10, 1); team.getPlayer().setScoreboard(board); Block b = team.getPlayer().getLocation().getBlock().getRelative(BlockFace.DOWN); b.setType(Material.AIR); Gui.giveKit(team.getPlayer()); } health(); this.cancel(); } } }; task.runTaskTimer(this, 0L, 20L); } public PlayerPoints playerPoints; private boolean hookPlayerPoints() { final Plugin plugin = this.getServer().getPluginManager().getPlugin("PlayerPoints"); playerPoints = PlayerPoints.class.cast(plugin); return playerPoints != null; } }
[ "bingalipa@gmail.com" ]
bingalipa@gmail.com
638814fa14b3ed3f602100f174d6a2f6ee63e9d2
a30aaa6c33880bb4d332b4bc37352e195497ee47
/src/main/java/com/spring/core/basic/oop/discount/FixDiscountPolicy.java
10063d005f30528c20b4d7ed0104b4dd37fe286c
[]
no_license
Claude94/spring-core-study
41efcacb513435cdefc23fde91d37c3af7d80263
d34dfab27ee5d5036da4542126626e8b62fa0d77
refs/heads/master
2023-04-15T20:01:28.531796
2021-04-29T07:00:03
2021-04-29T07:00:03
362,012,157
0
0
null
null
null
null
UTF-8
Java
false
false
570
java
package com.spring.core.basic.oop.discount; import com.spring.core.basic.oop.member.Grade; import com.spring.core.basic.oop.member.Member; //정액 할인 정책 //역할 : VIP회원에게만 고정된 할인액을 적용해준다 public class FixDiscountPolicy implements DiscountPolicy { // 고정 할인액 public static final int FIX_AMOUNT = 3000; @Override public int discount (Member member, int itemPrice) { if (member.getGrade() == Grade.VIP) { return FIX_AMOUNT; } else { return 0; } } }
[ "1claude1994@gmail.com" ]
1claude1994@gmail.com
271d69c815a221282b023cbad13f37213bc4f057
19925c71bc573c7bfb9d29e8db08e2a7b138ee77
/src/main/java/org/babich/street/service/StreetTreeService.java
562f5d3444281684b041bbe503b8dfc556f1764c
[]
no_license
VadimBabich/nyc-open-data
c54544e5e5608fa360ba29fad93242c93231f9b9
5577bfad8b5ccbc0d58acafd8c8b95a34e43ba5d
refs/heads/main
2023-06-23T02:33:05.215063
2021-04-23T06:36:30
2021-04-23T06:36:30
338,441,444
0
0
null
2023-09-08T12:21:48
2021-02-12T21:51:09
Java
UTF-8
Java
false
false
698
java
package org.babich.street.service; import org.babich.street.exception.ServiceExecutingException; import org.babich.street.geometry.ShapePredicate; import java.util.Map; /** * Service for fetching, filtering and aggregating data on street trees. * @author Vadim Babich */ public interface StreetTreeService { /** * Makes an aggregated search of trees. * @param shapeArea used as a dataset filter that cuts it out as a specific shape. * @return Aggregation presented in the form of a map - 'common name': count * @throws ServiceExecutingException */ Map<String, Integer> getAggregatedByNameTreesIn(ShapePredicate shapeArea) throws ServiceExecutingException; }
[ "vadimbabich@vadims-Air.fritz.box" ]
vadimbabich@vadims-Air.fritz.box
d80538f39e0e87f263876d303c6f11d44997818a
c683a4056e51561fe09017ab7e7ac4984e3cd2f5
/LakshmiMarriageBureau/app/src/main/java/com/example/lakshmimarriagebureau/viewBiodata.java
190e38f5257c9e76ea4dc34d96a9c8bc50cd62c9
[]
no_license
dikshu11/Marriage_bureau_app
df0de9c5d99200a3c764589e8093c9b528d637a2
26e6764c1bad1f31bb53cb4ec2e0d081e15e2dd5
refs/heads/main
2023-01-24T19:15:47.098310
2020-11-16T08:17:38
2020-11-16T08:17:38
313,229,512
0
0
null
null
null
null
UTF-8
Java
false
false
4,086
java
package com.example.lakshmimarriagebureau; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.ArrayAdapter; import android.widget.AutoCompleteTextView; import android.widget.CheckBox; import android.widget.EditText; import androidx.appcompat.app.AppCompatActivity; public class viewBiodata extends AppCompatActivity { static EditText dobEditText1; CheckBox maleCheckBox1; CheckBox femaleCheckBox1; CheckBox divorceeCheckBox1; CheckBox mangalikCheckBox1; CheckBox buisnessCheckBox1; CheckBox jobChechBox1; AutoCompleteTextView locationAutoCompleteTextView1; EditText nameEditText1; EditText incomeEditText1; EditText minAgeEditText1; EditText maxAgeEditText1; EditText budgetEditText1; public void onClickButton(View view) { String name = nameEditText1.getText().toString(); String gender = ""; Boolean divorcee = false; Boolean mangalik = false; Boolean buisness = false; Boolean job = false; String location = locationAutoCompleteTextView1.getText().toString(); String income = incomeEditText1.getText().toString(); Integer minAge = 0; Integer maxAge = 100; Long budget = (long) 0; try { budget = Long.parseLong(budgetEditText1.getText().toString()); } catch (Exception e) { e.printStackTrace(); } if (jobChechBox1.isChecked()) job = true; if (buisnessCheckBox1.isChecked()) buisness = true; if (maleCheckBox1.isChecked()) gender = "M"; if (femaleCheckBox1.isChecked()) gender = "F"; if (divorceeCheckBox1.isChecked()) divorcee = true; if (mangalikCheckBox1.isChecked()) mangalik = true; try { minAge = Integer.parseInt(minAgeEditText1.getText().toString()); } catch (Exception e) { minAge = 0; // e.printStackTrace(); } try { maxAge = Integer.parseInt(maxAgeEditText1.getText().toString()); } catch (NumberFormatException e) { maxAge = 100; // e.printStackTrace(); } Intent intent = new Intent(getApplicationContext(), showBiodata.class); intent.putExtra("name", name); intent.putExtra("gender", gender); intent.putExtra("divorcee", divorcee); intent.putExtra("mangalik", mangalik); intent.putExtra("location", location); intent.putExtra("income", income); intent.putExtra("min age", minAge); intent.putExtra("max age", maxAge); intent.putExtra("budget", budget); intent.putExtra("job", job); intent.putExtra("buisness", buisness); startActivity(intent); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_view_biodata); setTitle("View Profile"); maleCheckBox1 = findViewById(R.id.maleCheckBox1); femaleCheckBox1 = findViewById(R.id.femaleCheckBox1); divorceeCheckBox1 = findViewById(R.id.divorceeCheckBox1); mangalikCheckBox1 = findViewById(R.id.mangalikCheckBox1); buisnessCheckBox1 = findViewById(R.id.buisnessCheckBox1); jobChechBox1 = findViewById(R.id.jobCheckBox1); budgetEditText1 = findViewById(R.id.budgetEditText1); nameEditText1 = findViewById(R.id.nameEditText1); incomeEditText1 = findViewById(R.id.incomeEditText1); minAgeEditText1 = findViewById(R.id.minAgeEditText1); maxAgeEditText1 = findViewById(R.id.maxAgeEditText1); locationAutoCompleteTextView1 = findViewById(R.id.locationAutoCompleteTextView1); cities cityList = new cities(); ArrayAdapter<String> cityAdapter = new ArrayAdapter<>(this, android.R.layout.select_dialog_item, cities.getCity()); locationAutoCompleteTextView1.setAdapter(cityAdapter); } }
[ "bdiksha1108@gmail.com" ]
bdiksha1108@gmail.com
c5c5cb14c8a9d6e5e98d84bb64210d9d1e49ce69
e54ce7a603a6891fe143249914072673297e8365
/Eprothomalo/app/src/test/java/com/example/udaybanik/eprothomalo/ExampleUnitTest.java
42fe42fd900281b99a1cc0d9c17a91d066a654a6
[]
no_license
UdayBanik/Eprothom-alo
fe2276fe3e15a5b8876ca86832b200b31146b59e
dc3a7a86a254b72b7c60e7322b3e49d60108d421
refs/heads/master
2020-04-11T11:44:24.839296
2018-12-14T08:58:57
2018-12-14T08:58:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
411
java
package com.example.udaybanik.eprothomalo; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "tweetucs@gmail.com" ]
tweetucs@gmail.com
b15f9397a882d18adb54d82f50e76b99acb3aa0e
eca4a253fe0eba19f60d28363b10c433c57ab7a1
/server/openjacob.engine/java/de/tif/jacob/screen/impl/html/ContextMenuEntryServerSide.java
d4691aba152619a3c6d7536aa47c21b4718e0822
[]
no_license
freegroup/Open-jACOB
632f20575092516f449591bf6f251772f599e5fc
84f0a6af83876bd21c453132ca6f98a46609f1f4
refs/heads/master
2021-01-10T11:08:03.604819
2015-05-25T10:25:49
2015-05-25T10:25:49
36,183,560
0
0
null
null
null
null
UTF-8
Java
false
false
3,044
java
/******************************************************************************* * This file is part of Open-jACOB * Copyright (C) 2005-2006 Tarragon GmbH * * 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; version 2 of the License. * * 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, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA *******************************************************************************/ package de.tif.jacob.screen.impl.html; import java.io.Writer; import de.tif.jacob.core.definition.IContextMenuEntry; import de.tif.jacob.core.definition.impl.ContextMenuEntryDefinition; import de.tif.jacob.screen.IApplication; import de.tif.jacob.util.StringUtil; public class ContextMenuEntryServerSide extends ContextMenuEntry { static public final transient String RCS_ID = "$Id: ContextMenuEntryServerSide.java,v 1.3 2007/06/19 14:04:51 freegroup Exp $"; static public final transient String RCS_REV = "$Revision: 1.3 $"; private final ContextMenuEntryDefinition definition; protected ContextMenuEntryServerSide(IApplication app, String labelId) { super(app, "", labelId, true, null, null); this.definition=null; } protected ContextMenuEntryServerSide(IApplication app, IContextMenuEntry entry) { super(app, entry.getName(), entry.getLabel(), true, null, entry.getActionType()); this.definition=(ContextMenuEntryDefinition)entry; } /* * @see de.tif.jacob.screen.GUIElement#renderHTML(java.io.Writer) */ public void calculateHTML(ClientContext c) throws Exception { if(getCache()==null) { Writer w = newCache(); w.write("<tr><td class='contextMenuItem'>"); if(isEnabled()) { w.write("<a class='contextMenuItem' href='#' onClick=\""); w.write("FireEvent('"); w.write(Integer.toString(getId())); w.write("','click')\">"); w.write(StringUtil.htmlEncode(getI18NLabel(c.getLocale()))); w.write("</a>\n"); } else { w.write("<a class='contextMenuItemDisabled'>"); w.write(StringUtil.htmlEncode(getI18NLabel(c.getLocale()))); w.write("</a>"); } w.write("</td></tr>\n"); } } /** * */ public void resetCache() { // the parent caches the HTML from the menu entries. If the child invalidate the parent must too. // parent.resetCache(); super.resetCache(); } public String getEventHandlerReference() { if(definition==null) return null; return definition.getEventHandler(); } }
[ "a.herz@freegroup.de" ]
a.herz@freegroup.de
44a3e8c4d9fab88d5f2c7ee5feae5e85caa79282
d1fd7de283425854c802c4808785ae4593e0a06a
/module/ConsoleModuleSpecManagerFactory.java
2efe8744c46c490a60f7b76e10f97aa411c91c6c
[]
no_license
jamespharaoh/jpstack-console
c349e5fad9b98419f43d21386676eeae7edcb053
19fb0942a7ab28c4f3c6b899606b93cb361b8a26
refs/heads/master
2020-12-08T08:57:52.706196
2017-08-17T12:04:12
2017-08-17T12:04:12
99,678,477
0
0
null
null
null
null
UTF-8
Java
false
false
5,618
java
package wbs.console.module; import static wbs.utils.etc.Misc.contains; import static wbs.utils.etc.OptionalUtils.optionalGetRequired; import static wbs.utils.etc.OptionalUtils.optionalIsNotPresent; import static wbs.utils.etc.TypeUtils.genericCastUnchecked; import static wbs.utils.string.StringUtils.stringFormat; import static wbs.utils.string.StringUtils.stringNotEqualSafe; import static wbs.utils.string.StringUtils.stringReplaceAllSimple; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import com.google.common.base.Optional; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Ordering; import lombok.NonNull; import lombok.experimental.Accessors; import wbs.framework.component.annotations.ClassSingletonDependency; import wbs.framework.component.annotations.ComponentInterface; import wbs.framework.component.annotations.PrototypeDependency; import wbs.framework.component.annotations.SingletonComponent; import wbs.framework.component.annotations.SingletonDependency; import wbs.framework.component.manager.ComponentProvider; import wbs.framework.component.scaffold.PluginConsoleModuleSpec; import wbs.framework.component.scaffold.PluginManager; import wbs.framework.component.scaffold.PluginSpec; import wbs.framework.component.tools.ComponentFactory; import wbs.framework.data.tools.DataFromXml; import wbs.framework.data.tools.DataFromXmlBuilder; import wbs.framework.logging.LogContext; import wbs.framework.logging.OwnedTaskLogger; import wbs.framework.logging.TaskLogger; @Accessors (fluent = true) @SingletonComponent ("consoleModuleSpecManager") @ComponentInterface (ConsoleModuleSpecManager.class) public class ConsoleModuleSpecManagerFactory implements ComponentFactory <ConsoleModuleSpecManager> { // singleton dependencies @ClassSingletonDependency LogContext logContext; @SingletonDependency PluginManager pluginManager; // prototype dependencies @PrototypeDependency Map <Class <?>, ComponentProvider <ConsoleSpec>> consoleModuleSpecProviders; @PrototypeDependency ComponentProvider <DataFromXmlBuilder> dataFromXmlBuilderProvider; // state DataFromXml dataFromXml; List <ConsoleModuleSpec> specs = new ArrayList<> (); Map <String, ConsoleModuleSpec> specsByName = new HashMap<> (); // public implementation @Override public ConsoleModuleSpecManager makeComponent ( @NonNull TaskLogger parentTaskLogger) { try ( OwnedTaskLogger taskLogger = logContext.nestTaskLogger ( parentTaskLogger, "makeComponent"); ) { dataFromXml = dataFromXmlBuilderProvider.provide ( taskLogger) .registerBuilders ( taskLogger, consoleModuleSpecProviders) .build ( taskLogger) ; pluginManager.plugins ().forEach ( pluginSpec -> loadSpecsForPlugin ( taskLogger, pluginSpec)); taskLogger.makeException (); Collections.sort ( specs, Ordering.natural ().onResultOf ( ConsoleModuleSpec::name)); return new ConsoleModuleSpecManager () .specs ( ImmutableList.copyOf ( specs)) .specsByName ( ImmutableMap.copyOf ( specsByName)) ; } } // private implementation private void loadSpecsForPlugin ( @NonNull TaskLogger parentTaskLogger, @NonNull PluginSpec pluginSpec) { try ( OwnedTaskLogger taskLogger = logContext.nestTaskLogger ( parentTaskLogger, "loadSpecsForPlugin"); ) { pluginSpec.consoleModules ().forEach ( pluginConsoleModuleSpec -> loadSpec ( parentTaskLogger, pluginSpec, pluginConsoleModuleSpec)); } } private void loadSpec ( @NonNull TaskLogger parentTaskLogger, @NonNull PluginSpec pluginSpec, @NonNull PluginConsoleModuleSpec pluginConsoleModuleSpec) { try ( OwnedTaskLogger taskLogger = logContext.nestTaskLogger ( parentTaskLogger, "loadSpec"); ) { String consoleModuleResourseName = stringFormat ( "/%s/console/%s-console.xml", stringReplaceAllSimple ( ".", "/", pluginSpec.packageName ()), pluginConsoleModuleSpec.name ()); Optional <ConsoleModuleSpec> consoleModuleSpecOptional = loadFromResource ( taskLogger, consoleModuleResourseName); if ( optionalIsNotPresent ( consoleModuleSpecOptional) ) { return; } ConsoleModuleSpec consoleModuleSpec = optionalGetRequired ( consoleModuleSpecOptional); if ( stringNotEqualSafe ( pluginConsoleModuleSpec.name (), consoleModuleSpec.name ()) ) { taskLogger.errorFormat ( "Console module %s ", consoleModuleResourseName, "has name %s ", consoleModuleSpec.name (), "but expected %s", pluginConsoleModuleSpec.name ()); return; } if ( contains ( specsByName, consoleModuleSpec.name ()) ) { taskLogger.errorFormat ( "Duplicated console module name: %s", consoleModuleSpec.name ()); return; } specs.add ( consoleModuleSpec); specsByName.put ( consoleModuleSpec.name (), consoleModuleSpec); } } private Optional <ConsoleModuleSpec> loadFromResource ( @NonNull TaskLogger parentTaskLogger, @NonNull String xmlResourceName) { try ( OwnedTaskLogger taskLogger = logContext.nestTaskLogger ( parentTaskLogger, "readClasspath"); ) { return genericCastUnchecked ( dataFromXml.readClasspath ( taskLogger, xmlResourceName)); } } }
[ "james@pharaoh.uk" ]
james@pharaoh.uk
f90d199696f8d61f0978b4427e025198bb0febbf
9f71812c9574e56c3ed4fb72904732094e124581
/src/test/java/ua/com/serzh/itrx/chapter3/leaving/ForEachExample.java
9443b78f6973793bb2aab4e23551bedf2b9734a3
[]
no_license
Just-Fun/DesignPatterns
a0fe9cde6b26ba117e98738f6f572cca8bc142b6
44faf7d9eafb1eb1fd95a05fb94df313412acff5
refs/heads/master
2020-09-15T23:23:29.433031
2017-11-05T11:51:56
2017-11-05T11:51:56
65,902,933
0
0
null
null
null
null
UTF-8
Java
false
false
4,346
java
/******************************************************************************* * Copyright (c) 2015 Christos Froussios * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * *******************************************************************************/ package ua.com.serzh.itrx.chapter3.leaving; import static org.junit.Assert.*; import java.lang.Thread.State; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.concurrent.TimeUnit; import org.junit.Test; import rx.Observable; import rx.schedulers.Schedulers; import rx.schedulers.TestScheduler; public class ForEachExample { public void exampleObservableForEach() { Observable<Long> values = Observable.interval(100, TimeUnit.MILLISECONDS); values .take(5) .forEach( v -> System.out.println(v)); System.out.println("Subscribed"); // Subscribed // 0 // 1 // 2 // 3 // 4 } public void exampleBlockingForEach() { Observable<Long> values = Observable.interval(100, TimeUnit.MILLISECONDS); values .take(5) .toBlocking() .forEach( v -> System.out.println(v)); System.out.println("Subscribed"); // 0 // 1 // 2 // 3 // 4 // Subscribed } public void exampleBlockingForEachError() { Observable<Long> values = Observable.error(new Exception("Oops")); try { values .take(5) .toBlocking() .forEach( v -> System.out.println(v)); } catch (Exception e) { System.out.println("Caught: " + e.getMessage()); } System.out.println("Subscribed"); // Caught: java.lang.Exception: Oops // Subscribed } // // Tests // @Test public void testObservableForEach() { List<Long> received = new ArrayList<>(); TestScheduler scheduler = Schedulers.test(); Observable<Long> values = Observable.interval(100, TimeUnit.MILLISECONDS, scheduler); values .take(5) .forEach( i -> received.add(i)); received.add(-1L); // Mark that forEach statement returned assertEquals(received, Arrays.asList(-1L)); scheduler.advanceTimeBy(1, TimeUnit.SECONDS); assertEquals(received, Arrays.asList(-1L, 0L, 1L, 2L, 3L, 4L)); } @Test public void testBlockingForEach() throws InterruptedException { List<Long> received = new ArrayList<>(); TestScheduler scheduler = Schedulers.test(); Observable<Long> values = Observable.interval(100, TimeUnit.MILLISECONDS, scheduler); // Blocking call on new thread Thread thread = new Thread(() -> { values .take(5) .toBlocking() .forEach( i -> received.add(i)); received.add(-1L); // Mark that forEach statement returned }); thread.start(); assertEquals(received, Arrays.asList()); // Wait for blocking call to block before producing values while (thread.getState() != State.WAITING) Thread.sleep(1); scheduler.advanceTimeBy(1, TimeUnit.SECONDS); // Wait for processing to complete thread.join(50); assertEquals(received, Arrays.asList(0L, 1L, 2L, 3L, 4L, -1L)); } @Test(expected = Exception.class) public void testBlockingForEachError() { Observable<Long> values = Observable.error(new Exception("Oops")); values .take(5) .toBlocking() .forEach( v -> {}); } }
[ "serzhcello@gmail.com" ]
serzhcello@gmail.com
470f569562531892d88cb0ad247bf3f584f76b1b
e038c2a90dde05280f4705d4f9e8378ebdab5edf
/bc_mysql/src/gens/java/org/brewchain/backend/ordbgens/bc/rest/BCTransactonAddressCtrl.java
a62707ea91d73348bf68dbcb0abebd046d6ea17d
[]
no_license
CryptoWorldChain/backend
c8e2561c84baf1879a55d9a161dca49a6f784f87
a387bd8bd02717c4d0789943875a5c2653db8d7a
refs/heads/master
2020-03-17T11:02:58.394707
2018-08-29T08:40:49
2018-08-29T08:40:49
133,535,821
0
1
null
null
null
null
UTF-8
Java
false
false
8,371
java
package org.brewchain.backend.ordbgens.bc.rest; import java.util.ArrayList; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang3.StringUtils; import org.fc.zippo.ordbutils.bean.ListInfo; import org.fc.zippo.ordbutils.bean.ReturnInfo; import org.fc.zippo.ordbutils.rest.BaseRestCtrl; import org.fc.zippo.ordbutils.rest.FieldUtils; import org.fc.zippo.ordbutils.rest.StringHelper; import org.fc.zippo.ordbutils.bean.FieldsMapperBean.SearchField; import org.fc.zippo.ordbutils.rest.FieldsMapperResolver; import lombok.extern.slf4j.Slf4j; import onight.tfw.ojpa.ordb.StaticTableDaoSupport; import onight.tfw.ojpa.ordb.loader.CommonSqlMapper; import onight.tfw.outils.serialize.JsonSerializer; import onight.tfw.outils.serialize.UUIDGenerator; import org.fc.zippo.ordbutils.rest.ExcelDownload; import org.brewchain.backend.ordbgens.bc.entity.BCTransactonAddress; import org.brewchain.backend.ordbgens.bc.entity.BCTransactonAddressKey; import org.brewchain.backend.ordbgens.bc.entity.BCTransactonAddressExample; @Slf4j @SuppressWarnings({ "rawtypes", "unchecked" }) public class BCTransactonAddressCtrl extends BaseRestCtrl { public BCTransactonAddressCtrl(StaticTableDaoSupport dao, CommonSqlMapper mapper) { super(dao, mapper,false); } public String get(String key, HttpServletRequest req,HttpServletResponse res) { boolean page = StringHelper.toBool(req.getParameter("page")); try { if (StringUtils.isNotBlank(key)) { String allkeys[] = key.split(","); String fields = req.getParameter("fields"); BCTransactonAddressExample example = new BCTransactonAddressExample(); List<String> keylist = new ArrayList<>(); for (String akey : allkeys) { if(StringUtils.isNotBlank(akey)) { keylist.add(akey.trim()); } } if(keylist.size()==0)return "{}"; example.createCriteria().andTxidIn(keylist); if (StringUtils.isNoneBlank(fields)) { StringBuffer sb = new StringBuffer(); for (SearchField sf : FieldsMapperResolver.genQueryMapper(fields).getFields()) { if(sf.getShow()>0) { sb.append(FieldUtils.field2SqlColomn(sf.getFieldName())).append(","); } } example.setSelectCols(sb.substring(0, sb.length() - 1)); } if (allkeys.length == 1) { List list = dao.selectByExample(example); if (list != null && list.size() == 1) { return JsonSerializer.formatToString(list.get(0)); } else { return "{}"; } } return JsonSerializer.formatToString(dao.selectByExample(example)); } else { return getBySql(BCTransactonAddress.class, BCTransactonAddressKey.class, "BC_TRANSACTON_ADDRESS", req); } } catch (ExcelDownload ed) { throw ed; } catch (Exception e) { log.warn("BCTransactonAddressCtrl get by key error..", e); } if (page) { return JsonSerializer.formatToString(new ListInfo<>(0, null, 0, -1)); } else { return "{}"; } } public String post(byte[] bodies, HttpServletRequest req,HttpServletResponse res) { try { int size; Object obj=null; if (bodies[0] == '[' && bodies[bodies.length - 1] == ']') { List<BCTransactonAddress> items = JsonSerializer.getInstance().deserializeArray(bodies, BCTransactonAddress.class); for (BCTransactonAddress item : items) { if (item.getTxid() == null) { item.setTxid(UUIDGenerator.generate()); } } obj=items; size = dao.batchInsert(items); if("2".equals(req.getParameter("retobj"))){ List<Object> keysid = new ArrayList<>(); for(BCTransactonAddress it:items){ keysid.add(it.getTxid()); } return JsonSerializer.formatToString(new ReturnInfo("Success", -1, keysid, true)); } } else { BCTransactonAddress item = JsonSerializer.getInstance().deserialize(bodies, BCTransactonAddress.class); if (item.getTxid() == null) { item.setTxid(UUIDGenerator.generate()); } obj=item; size = dao.insertSelective(item); if("2".equals(req.getParameter("retobj"))){ return JsonSerializer.formatToString(new ReturnInfo("Success", -1, item.getTxid(), true)); } } if("1".equals(req.getParameter("retobj"))){ return JsonSerializer.formatToString(new ReturnInfo("Success", -1, obj, true)); } else { return JsonSerializer.formatToString(new ReturnInfo("Success", -1, size, true)); } } catch (Exception e) { log.debug("post ERROR:", e); return JsonSerializer.formatToString(new ReturnInfo("Failed:" + e.getMessage(), -1, null, false)); } } public String put(String key, byte[] bodies, HttpServletRequest req,HttpServletResponse res) { try { int size; if (StringUtils.isNotBlank(key)) { BCTransactonAddress item = JsonSerializer.getInstance().deserialize(bodies, BCTransactonAddress.class); String allkeys[] = key.split(","); if(allkeys.length>1){ BCTransactonAddressExample example=new BCTransactonAddressExample(); List<String> keylist = new ArrayList<>(); for (String akey : allkeys) { if(StringUtils.isNotBlank(akey)) { keylist.add(akey.trim()); } } if(keylist.size()>0){ example.createCriteria().andTxidIn(keylist); size=dao.updateByExampleSelective(item,example); }else{ size = 0; } }else{ item.setTxid(key); size = dao.updateByPrimaryKeySelective(item); } } else { if (bodies[0] == '[' && bodies[bodies.length - 1] == ']') { List<BCTransactonAddress> items = JsonSerializer.getInstance().deserializeArray(bodies, BCTransactonAddress.class); size = dao.batchUpdate(items); } else { String example = req.getParameter("example"); BCTransactonAddress item = JsonSerializer.getInstance().deserialize(bodies, BCTransactonAddress.class); if (StringUtils.isNotBlank(example)) { BCTransactonAddress exampleitem = JsonSerializer.getInstance().deserialize(example.getBytes("UTF-8"), BCTransactonAddress.class); size = dao.updateByExampleSelective(item, dao.getExample(exampleitem)); } else { size = dao.updateByPrimaryKeySelective(item); } } } return JsonSerializer.formatToString(new ReturnInfo("Success", -1, size, true)); } catch (Exception e) { log.debug("post ERROR:", e); return JsonSerializer.formatToString(new ReturnInfo("Failed:" + e.getMessage(), -1, null, false)); } } public String delete(String key, byte[] bodies, HttpServletRequest req,HttpServletResponse res) { try { int size; if (StringUtils.isNotBlank(key)) { String allkeys[] = key.split(","); if(allkeys.length>1){ BCTransactonAddressExample example=new BCTransactonAddressExample(); List<String> keylist = new ArrayList<>(); for (String akey : allkeys) { if(StringUtils.isNotBlank(akey)) { keylist.add(akey.trim()); } } if(keylist.size()>0){ example.createCriteria().andTxidIn(keylist); size=dao.deleteByExample(example); }else{ size = 0; } }else{ size = dao.deleteByPrimaryKey(new BCTransactonAddressKey(key)); } } else { if (bodies[0] == '[' && bodies[bodies.length - 1] == ']') { List<BCTransactonAddress> items = JsonSerializer.getInstance().deserializeArray(bodies, BCTransactonAddress.class); size = dao.batchDelete(items); } else { if(!deleteByExampleEnabled){ return JsonSerializer.formatToString(new ReturnInfo("Failed:Forbiddend DeleteByExample", -1, null, false)); } String example = req.getParameter("example"); BCTransactonAddress item=null; if (StringUtils.isNotBlank(example)) { item = JsonSerializer.getInstance().deserialize(bodies, BCTransactonAddress.class); } else { if (bodies.length > 10) { item = JsonSerializer.getInstance().deserialize(bodies, BCTransactonAddress.class); } } if(item!=null) { size = dao.deleteByExample(dao.getExample(item)); }else{ size = 0; } } } return JsonSerializer.formatToString(new ReturnInfo("Success", -1, size, true)); } catch (Exception e) { log.debug("post ERROR:", e); return JsonSerializer.formatToString(new ReturnInfo("Failed:" + e.getMessage(), -1, null, false)); } } }
[ "brewcwv@gmail.com" ]
brewcwv@gmail.com
11dd064e6567ac93a4a9eb3c2d0f5c8da67b0485
dde37b458a32176adfa4fc900e466e840c3dea45
/src/main/java/pl/norb/CarFactory/repository/EquipmentRepository.java
f1c6882c1c7004f20b4ae2dfb7350b2315ac9698
[]
no_license
nmatrzak/CarFactory_v1.0
2c92cd85ae6695de58a5fa95fe5f1069f36a791a
601012d7d306fd74009eda6d7085bfa43ba57d64
refs/heads/master
2020-05-25T00:17:33.842871
2019-05-19T22:19:49
2019-05-19T22:19:49
187,530,679
0
0
null
null
null
null
UTF-8
Java
false
false
1,077
java
package pl.norb.CarFactory.repository; import java.util.ArrayList; import java.util.List; import pl.norb.CarFactory.model.Equipment; public class EquipmentRepository { List<Equipment> equipments; public EquipmentRepository() { equipments = new ArrayList<>(); Equipment equipmentOne = new Equipment(); Equipment equipmentTwo = new Equipment(); Equipment equipmentThree = new Equipment(); equipmentOne.setIdEquipment(11); equipmentTwo.setIdEquipment(12); equipmentThree.setIdEquipment(13); equipmentOne.setNameEquipment("klimatyzacja"); equipmentTwo.setNameEquipment("radio"); equipmentThree.setNameEquipment("zlote klamki"); equipments.add(equipmentOne); equipments.add(equipmentTwo); equipments.add(equipmentThree); } public List<Equipment> getEquipments() { return equipments; } public Equipment getEquipment(int id) { for (Equipment equipment : equipments) if (equipment.getIdEquipment() == id) { return equipment; } return null; } public void createEquipment(Equipment equipment) { equipments.add(equipment); } }
[ "37778736+nmatrzak@users.noreply.github.com" ]
37778736+nmatrzak@users.noreply.github.com
20a0d983c33fbe4173b351a9fee3c8180c875f19
d14e3937fc34ac258c91fc5fbf46031b14a20a99
/src/main/java/com/sda/box/BoxApp.java
98ee29d1cd1a1a77fa0a0e18a6d77be556c34873
[]
no_license
TheBluetouch/java2
f2e8d794dc108776e264cf1ed39b242e0c15e2c3
972d897322ab3aa8805bf3cc3fe46317b44e1aa8
refs/heads/master
2022-09-05T18:36:21.849909
2020-05-26T15:04:27
2020-05-26T15:04:27
266,493,309
0
0
null
null
null
null
UTF-8
Java
false
false
509
java
package com.sda.box; import java.time.LocalDate; public class BoxApp { public static void main(String[] args) { Box<String> nameBox = new Box<>("Kacper"); String element = nameBox.get(); System.out.println(element); Box<LocalDate> dateBox= new Box<>(LocalDate.now()); LocalDate date= dateBox.get(); System.out.println(date); // Box rawBox = new Box("Karol"); // Object string = rawBox.get(); // System.out.println(string); } }
[ "bogusz28@wp.pl" ]
bogusz28@wp.pl
1098ab694554a37e5d3eee0ec8f6527bfc27cd9d
2eac1dd7bcbf33b62c1f8b68f42beffce58521c9
/app/src/main/java/me/tq/asobiandroid/exception/UnknownPresenterTypeException.java
b1e35f0017bb4902e49babc90f8a8b092f9b401f
[]
no_license
xiongtianqi/wanAndroid-Asobi
70f8a90980f2db782ee94aa88e71bf1d44e7c6d4
b58c40c818cca0554c3e8552cc19b8870e9b05fc
refs/heads/master
2020-04-29T07:15:20.152455
2019-03-17T15:40:45
2019-03-17T15:40:45
175,945,785
0
0
null
null
null
null
UTF-8
Java
false
false
242
java
package me.tq.asobiandroid.exception; /** * author:Tianqi * date:2019/3/16 */ public class UnknownPresenterTypeException extends Exception { public UnknownPresenterTypeException() { super("unknown presenter type!"); } }
[ "414712569@qq.com" ]
414712569@qq.com
4adc4b8944bbf0d3eebdbbfe4b6c61ded425457b
9521ff3472fc8199379bd2ce4b2a9ff1cea1d016
/MVC/MVC/src/hbm/clases/Countries.java
329f4554eac46966bb8b3add89e92d345a43e0f1
[]
no_license
acandalez/Ordenar_Proyectos
e8c7370df385d99e106528765d4bf5141cecbeb0
32fc3f337dd700acc6ae98060f0c3b98a5bd1410
refs/heads/master
2016-09-05T20:03:55.632857
2015-08-28T18:35:47
2015-08-28T18:35:47
41,562,809
0
0
null
null
null
null
UTF-8
Java
false
false
1,274
java
// default package // Generated 09-jun-2015 15:56:59 by Hibernate Tools 3.4.0.CR1 package hbm.clases; import java.util.HashSet; import java.util.Set; /** * Countries generated by hbm2java */ public class Countries implements java.io.Serializable { private String countryId; private Regions regions; private String countryName; private Set locationses = new HashSet(0); public Countries() { } public Countries(String countryId) { this.countryId = countryId; } public Countries(String countryId, Regions regions, String countryName, Set locationses) { this.countryId = countryId; this.regions = regions; this.countryName = countryName; this.locationses = locationses; } public String getCountryId() { return this.countryId; } public void setCountryId(String countryId) { this.countryId = countryId; } public Regions getRegions() { return this.regions; } public void setRegions(Regions regions) { this.regions = regions; } public String getCountryName() { return this.countryName; } public void setCountryName(String countryName) { this.countryName = countryName; } public Set getLocationses() { return this.locationses; } public void setLocationses(Set locationses) { this.locationses = locationses; } }
[ "acandalez@gmail.com" ]
acandalez@gmail.com
05f2176dc7ffc533a08773d29056ec29e9ac4667
0af8b92686a58eb0b64e319b22411432aca7a8f3
/large-multiproject/project73/src/main/java/org/gradle/test/performance73_3/Production73_225.java
d88d2eaaf7909545c94b706c6352e815a1abac8d
[]
no_license
gradle/performance-comparisons
b0d38db37c326e0ce271abebdb3c91769b860799
e53dc7182fafcf9fedf07920cbbea8b40ee4eef4
refs/heads/master
2023-08-14T19:24:39.164276
2022-11-24T05:18:33
2022-11-24T05:18:33
80,121,268
17
15
null
2022-09-30T08:04:35
2017-01-26T14:25:33
null
UTF-8
Java
false
false
305
java
package org.gradle.test.performance73_3; public class Production73_225 extends org.gradle.test.performance16_3.Production16_225 { private final String property; public Production73_225() { this.property = "foo"; } public String getProperty() { return property; } }
[ "cedric.champeau@gmail.com" ]
cedric.champeau@gmail.com
b463a5841267b9f49f8f9f9a509ffe4f9c2e5754
598a2e982d6aa3b371147eea77534a35732c33df
/Test Review/src/arrays.java
efc5a851c66a6bad4e74dc2109ef892c444f03c5
[]
no_license
noarogo/APCSRogoszinski
ee070e8936f44d5ddb0a0b84baf719dde4d0ddcc
fa96709f1724b1ce96e0fb26ba5f8fef2dff6618
refs/heads/master
2020-03-29T07:08:23.529290
2019-09-14T22:31:41
2019-09-14T22:31:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
397
java
public class arrays { public static void main(String[] args) { int[] list = new int[10]; for(int i = 0; i<10; i++){ list[i] = i+1; System.out.print(list[i] + " "); } System.out.println(getMax(list)); } public static double getMax(int[] list) { int last = list[0]; for(int i = 0; i<list.length; i++){ if(last < list[i]) last = list[i]; } return last; } }
[ "nrogoszinski19@ssdsnassau.org" ]
nrogoszinski19@ssdsnassau.org
50085807de4a2cfc37e154e1c3d0a8a6a11e62c9
79ed1f3d2441d0657c8b167ea1b6651ef790c47e
/src/test/java/tech/aroma/application/service/reactions/matchers/MatchBehavior.java
03706f9c39ce969aaf5365e11bf4b53b391b4146
[ "Apache-2.0" ]
permissive
RedRoma/aroma-application-service
83158932eb44ce681f50074d1234ea6c1cea0cf0
7734e6665613a79d02699535e645feb1e93df688
refs/heads/develop
2020-04-06T03:48:09.638729
2018-09-25T13:51:18
2018-09-25T13:51:18
48,427,785
1
0
null
2017-05-06T16:25:32
2015-12-22T11:13:44
Java
UTF-8
Java
false
false
2,578
java
/* * Copyright 2017 RedRoma, Inc. * * 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 tech.aroma.application.service.reactions.matchers; import java.util.List; import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import sir.wellington.alchemy.collections.maps.Maps; import tech.aroma.thrift.Message; import tech.aroma.thrift.reactions.AromaMatcher; import tech.sirwellington.alchemy.annotations.access.Internal; import tech.sirwellington.alchemy.generator.AlchemyGenerator; import static org.mockito.Mockito.*; import static tech.aroma.thrift.generators.ReactionGenerators.matchers; import static tech.sirwellington.alchemy.generator.AlchemyGenerator.Get.one; import static tech.sirwellington.alchemy.generator.BooleanGenerators.alternatingBooleans; import static tech.sirwellington.alchemy.generator.CollectionGenerators.listOf; /** * * @author SirWellington */ @Internal final class MatchBehavior { private final static Logger LOG = LoggerFactory.getLogger(MatchBehavior.class); static Map<AromaMatcher, MessageMatcher> createMatchersThatSometimesMatchFor(Message message) { return createMatchersFor(message, alternatingBooleans()); } static Map<AromaMatcher, MessageMatcher> createMatchersThatAlwaysMatchFor(Message message) { return createMatchersFor(message, () -> true); } static Map<AromaMatcher, MessageMatcher> createMatchersThatNeverMatchFor(Message message) { return createMatchersFor(message, () -> false); } static Map<AromaMatcher, MessageMatcher> createMatchersFor(Message message, AlchemyGenerator<Boolean> booleans) { Map<AromaMatcher, MessageMatcher> result = Maps.create(); List<AromaMatcher> matchers = listOf(matchers(), 20); for (AromaMatcher matcher : matchers) { MessageMatcher mock = mock(MessageMatcher.class); when(mock.matches(message)).thenReturn(one(booleans)); result.put(matcher, mock); } return result; } }
[ "jwellington.moreno@gmail.com" ]
jwellington.moreno@gmail.com
bb9e90be6c69d3fc41d301aafacafcf8503f027a
0d10062e765a25277412ec611d749801446348b5
/app/src/main/java/io/github/ryanhoo/music/ui/local/all/AllLocalMusicFragment.java
28241085ec45520433356bec934d8782aea5c1a1
[ "MIT" ]
permissive
WeixiongLin/HiC-AndroidAPP
9bd7a1b22fc9f647fb5e88801e338b11e4534c52
dcf043c38d5cf62b6ab6d132e30ccaac6cef77be
refs/heads/master
2023-02-02T21:32:53.828456
2020-12-19T04:00:33
2020-12-19T04:00:33
260,701,721
0
0
null
null
null
null
UTF-8
Java
false
false
5,046
java
package io.github.ryanhoo.music.ui.local.all; import android.os.Bundle; import androidx.annotation.Nullable; import androidx.recyclerview.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ProgressBar; import android.widget.TextView; import android.widget.Toast; import butterknife.BindView; import butterknife.ButterKnife; import io.github.ryanhoo.music.R; import io.github.ryanhoo.music.RxBus; import io.github.ryanhoo.music.data.model.Song; import io.github.ryanhoo.music.data.source.AppRepository; import io.github.ryanhoo.music.event.PlayListUpdatedEvent; import io.github.ryanhoo.music.event.PlaySongEvent; import io.github.ryanhoo.music.ui.base.BaseFragment; import io.github.ryanhoo.music.ui.base.adapter.OnItemClickListener; import io.github.ryanhoo.music.ui.common.DefaultDividerDecoration; import io.github.ryanhoo.music.ui.details.PlayListDetailsActivity; import io.github.ryanhoo.music.ui.widget.RecyclerViewFastScroller; import rx.Subscription; import rx.android.schedulers.AndroidSchedulers; import rx.functions.Action1; import java.util.List; /** * Created with Android Studio. * User: ryan.hoo.j@gmail.com * Date: 9/1/16 * Time: 9:58 PM * Desc: LocalFilesFragment */ public class AllLocalMusicFragment extends BaseFragment implements LocalMusicContract.View { @BindView(R.id.recycler_view) RecyclerView recyclerView; //滚动页面 @BindView(R.id.fast_scroller) RecyclerViewFastScroller fastScroller; //右侧滚轮 @BindView(R.id.progress_bar) ProgressBar progressBar; //进度条没有visible的,不显示 @BindView(R.id.text_view_empty) View emptyView; //没有歌曲时显示无歌曲 LocalMusicAdapter mAdapter; //是一个List<song> LocalMusicContract.Presenter mPresenter; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_all_local_music, container, false); }//设置页面、简单容器、无bundle保存数据 @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); ButterKnife.bind(this, view); mAdapter = new LocalMusicAdapter(getActivity(), null); //(context,song),传入当前函数的上下文,song就是歌曲的地址和其他信息打包的结构体.到mAdapter里面去读已经读好的文件,注意读文件并不在此,在后面 mAdapter.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(int position) { //点击音频项目,读取音乐文件并且播放了!position哪来的? Song song = mAdapter.getItem(position); //读取歌曲,见LocalMusicAdapter。但不是读文件 PlayListDetailsActivity.current_songpath=song.getPath(); Log.e("修改2","搜索选择的歌曲路径:"+song.getPath()); RxBus.getInstance().post(new PlaySongEvent(song)); //播放音乐 } }); recyclerView.setAdapter(mAdapter);//Adapter里面的数据是怎么得到MusicPresenter读到的文件的? 靠这个setAdapter吗 recyclerView.addItemDecoration(new DefaultDividerDecoration()); fastScroller.setRecyclerView(recyclerView); new LocalMusicPresenter(AppRepository.getInstance(), this).loadLocalMusic(); //这里读取了内存音乐文件! } // RxBus Events @Override protected Subscription subscribeEvents() { return RxBus.getInstance().toObservable() .observeOn(AndroidSchedulers.mainThread()) .doOnNext(new Action1<Object>() { @Override public void call(Object o) { if (o instanceof PlayListUpdatedEvent) { mPresenter.loadLocalMusic(); } } }) .subscribe(); } // MVP View @Override public void showProgress() { progressBar.setVisibility(View.VISIBLE); } @Override public void hideProgress() { progressBar.setVisibility(View.GONE); } @Override public void emptyView(boolean visible) { emptyView.setVisibility(visible ? View.VISIBLE : View.GONE); fastScroller.setVisibility(visible ? View.GONE : View.VISIBLE); } @Override public void handleError(Throwable error) { Toast.makeText(getActivity(), error.getMessage(), Toast.LENGTH_SHORT).show(); } @Override public void onLocalMusicLoaded(List<Song> songs) { mAdapter.setData(songs); mAdapter.notifyDataSetChanged(); } @Override public void setPresenter(LocalMusicContract.Presenter presenter) { mPresenter = presenter; } }
[ "wx_lin@sjtu.edu.cn" ]
wx_lin@sjtu.edu.cn
0b10ff3044e5269074f0320c82d11399ead10671
5a645eb893cadc000a15e3bf8fcc1480680cb020
/BooleanDivider.java
0f60fd107b166a5e906795e7a411354bc5b8eb1d
[]
no_license
anjelafilipova/Filipova
e666d5180729a2df692cde84708e95a11216af46
81dc8d12aa1dd0979641a27d082fdb2251f178ff
refs/heads/master
2020-03-31T21:48:24.649941
2018-10-11T13:36:46
2018-10-11T13:36:46
152,594,587
0
0
null
null
null
null
UTF-8
Java
false
false
963
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 booleandivider; import java.util.Scanner; /** * * @author Miss Filipova */ public class BooleanDivider { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here Scanner sc=new Scanner(System.in); int N=sc.nextInt();//въведено число int div=2;//делител, ако се дели значи не е просто int MaxDiv= (int) Math.sqrt(N);//проверка boolean prime=true; if (div<=MaxDiv) {// if (N % div == 0) { prime=false; } //div++; System.out.println(prime); } } }
[ "noreply@github.com" ]
noreply@github.com
d1838f4da6748a8bbd00c76101c571dc936a76b1
7771b996533dd4bbaaa83fe848a382691a32c31e
/src/finalproject/ElGamalAlice.java
b7dcf59311e3d20e4c9865592c9871f4a0461eea
[]
no_license
chuyuwang/information-security-and-privacy
7058771755eb15712ab1d73212cf853f0d774097
b2c115435e6566b3b038eacd8a780c56a5ac6390
refs/heads/master
2021-01-10T13:43:09.220637
2016-03-20T18:50:54
2016-03-20T18:50:54
54,334,444
0
0
null
null
null
null
UTF-8
Java
false
false
3,340
java
package finalproject; import java.io.*; import java.net.*; import java.security.*; import java.math.BigInteger; public class ElGamalAlice { private static BigInteger computeY(BigInteger p, BigInteger g, BigInteger d) { // IMPLEMENT THIS FUNCTION; BigInteger computeY = g.modPow(d, p); //compute y = g^d mod p return computeY; } private static BigInteger computeK(BigInteger p) { // IMPLEMENT THIS FUNCTION; BigInteger pOne = BigInteger.valueOf(1); //define p-1 BigInteger pMinusOne = p.subtract(pOne); SecureRandom rnd = new SecureRandom(); //generate a random number int numbits = 1024; BigInteger computeK = new BigInteger(numbits,rnd); //choose k that is relatively prime to (p-1) while(computeK.gcd(pMinusOne).equals(pOne)!=true) { computeK = new BigInteger(numbits,rnd); } return computeK; } private static BigInteger computeA(BigInteger p, BigInteger g, BigInteger k) { // IMPLEMENT THIS FUNCTION; BigInteger computeA = g.modPow(k, p); //compute a = g^k mod p return computeA; } private static BigInteger computeB( String message, BigInteger d, BigInteger a, BigInteger k, BigInteger p) throws NoSuchAlgorithmException { // IMPLEMENT THIS FUNCTION; BigInteger pOne = BigInteger.valueOf(1); BigInteger pMinusOne = p.subtract(pOne); // define p-1 BigInteger h = k.modInverse(pMinusOne); //compute h = k.modInverse(p-1) MessageDigest messagedigest = MessageDigest.getInstance("SHA");//digest the message byte[] bytes = messagedigest.digest(message.getBytes()); BigInteger m = new BigInteger(bytes); BigInteger num = d.multiply(a);//compute b=((m-da)*h) mod (p-1) BigInteger res1 = m.subtract(num); BigInteger res2 = res1.multiply(h); BigInteger computeB = res2.mod(pMinusOne); return computeB; } public static void main(String[] args) throws Exception { String message = "The quick brown fox jumps over the lazy dog."; String host = "127.0.0.1"; int port = 7999; Socket s = new Socket(host, port); ObjectOutputStream os = new ObjectOutputStream(s.getOutputStream()); // You should consult BigInteger class in Java API documentation to find out what it is. BigInteger y, g, p; // public key BigInteger d; // private key int mStrength = 1024; // key bit length SecureRandom mSecureRandom = new SecureRandom(); // a cryptographically strong pseudo-random number // Create a BigInterger with mStrength bit length that is highly likely to be prime. // (The '16' determines the probability that p is prime. Refer to BigInteger documentation.) p = new BigInteger(mStrength, 16, mSecureRandom); // Create a randomly generated BigInteger of length mStrength-1 g = new BigInteger(mStrength-1, mSecureRandom); d = new BigInteger(mStrength-1, mSecureRandom); y = computeY(p, g, d); // At this point, you have both the public key and the private key. Now compute the signature. BigInteger k = computeK(p); BigInteger a = computeA(p, g, k); BigInteger b = computeB(message, d, a, k, p); // send public key os.writeObject(y); os.writeObject(g); os.writeObject(p); // send message os.writeObject(message); // send signature os.writeObject(a); os.writeObject(b); s.close(); } }
[ "chuyuwang@ChuyuWangs-MacBook-Air.local" ]
chuyuwang@ChuyuWangs-MacBook-Air.local
d6b72c1810f8730739fbdc5cc04c9b42849029fa
7acd36374c48766d8de3162119973663de19e58a
/RandomStuff_Labs_Lectures_Etc/Test/src/lab02/TimingExperiment04.java
33e2fae5c7915cedb360c2db73c76b08f013d0cc
[]
no_license
DanRuley/CS2420_Intro_DataStructs_Algos
cfa6e853632bf6f9b74d8def53b0bcc2adc93cf6
8a529fbc444b43932aa9ff82b3ea3f472050ed91
refs/heads/main
2023-02-28T04:19:01.290967
2021-02-08T03:11:26
2021-02-08T03:11:26
336,945,344
0
1
null
null
null
null
UTF-8
Java
false
false
795
java
package lab02; /** * This program loops 100 times looking for changes in the current time.  If * time advances in one-nanosecond increments, then this code should complete in * 100 nanoseconds. * * @author Erin Parker * @version January 18, 2019 */ public class TimingExperiment04 { public static void main(String[] args) { long lastTime = System.nanoTime(); int advanceCount = 0; long[] advanceAmounts = new long[100]; while (advanceCount < 100) { long currentTime = System.nanoTime(); if (currentTime == lastTime) continue; advanceAmounts[advanceCount++] = currentTime - lastTime; lastTime = currentTime; } for (int i = 0; i < 100; i++) System.out.println("Time advanced " + advanceAmounts[i] + " nanoseconds."); } }
[ "59448445+DanRuley@users.noreply.github.com" ]
59448445+DanRuley@users.noreply.github.com
873c5542dd72192c0f3b499b4c82e71f3af9c119
b9a9ac1f82cfdcfe4c28f32aecd680ff9b41eb4e
/app/src/main/java/org/yun/net/core/http/YunHttpFactory.java
082fc4394515586c0c2c3c9c1d467823f5efe26b
[]
no_license
yunyeLoveYoona/YunNet
f8dc52ec5cdb08613cb8c9991a6dcb43811d6ffe
7a544328efbe775e558be7f87d591419010920d2
refs/heads/master
2020-05-07T10:01:29.826464
2015-09-16T03:26:39
2015-09-16T03:26:39
37,315,185
0
0
null
null
null
null
UTF-8
Java
false
false
469
java
package org.yun.net.core.http; import android.os.Build; import java.util.HashMap; /** * * Created by yunye on 15-6-12. */ public class YunHttpFactory { public static YunHttp createYunHttp(HashMap<String,String> httpHeadMap){ YunHttp yunHttp; if(Build.VERSION.SDK_INT<9){ yunHttp = new YunHttpClient(httpHeadMap); }else{ yunHttp = new YunHttpUrlConnection(httpHeadMap); } return yunHttp; } }
[ "550752356@qq.com" ]
550752356@qq.com
664dfdcfe3720df151f5f0a5c503b5970f9fdb6f
5b0c5bc2d609615522a2b3cf1085899a9f3f59b4
/day14/src/cn/itcast/web/jdbc/dataSource/Demo2.java
0931c22d26397ada6004b1e5ed639a7411e4a7ae
[]
no_license
clncon/javaweb
b21aee9744f9a68b6f55770e947c33208854215e
ac88a572bbe50e1c8552487758dcd0c2973cf133
refs/heads/master
2020-12-14T06:17:21.931227
2017-03-04T02:35:56
2017-03-04T02:35:56
83,633,624
0
0
null
null
null
null
GB18030
Java
false
false
647
java
package cn.itcast.web.jdbc.dataSource; import java.sql.Connection; import java.sql.SQLException; import com.mchange.v2.c3p0.ComboPooledDataSource; public class Demo2 { public static void main(String[] args) throws Exception { Connection conn = null; Long start = System.currentTimeMillis(); ComboPooledDataSource cds = new ComboPooledDataSource(); for(int i = 0;i<100000;i++) { conn =cds.getConnection(); if(conn!=null){ System.out.println(i+"取得连接"); } conn.close(); } Long end = System.currentTimeMillis(); System.out.println("共用"+(end-start)/1000+"s"); } }
[ "clncon@163.com" ]
clncon@163.com
2c4fa5fc28b1fafafc01c044476f0e3128f9e95c
360203603c0b0a46bbd75999ff3792c5a7f47539
/springApp1/src/main/java/com/capgemini/springApp1/models/Session.java
4efcb1435ccc008f0233604fa349cd16558f65ba
[]
no_license
arunajava567/springapp1
7d47cb5ae717c226faf401650e00f260256e3ac8
bf20efa7971b76af8130c643a80611cad0fea2fa
refs/heads/master
2023-04-12T08:24:26.369907
2021-05-17T12:52:38
2021-05-17T12:52:38
368,176,096
0
0
null
null
null
null
UTF-8
Java
false
false
1,603
java
package com.capgemini.springApp1.models; import java.util.List; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinTable; import javax.persistence.ManyToMany; import javax.persistence.Table; import javax.persistence.JoinColumn; @Entity @Table(name="sessions") public class Session { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private Long session_id; private String session_name; private String session_description; private Integer session_length; @ManyToMany @JoinTable( name="session_speaker", joinColumns=@JoinColumn(name="session_id"), inverseJoinColumns=@JoinColumn(name="speaker_id")) private List<Speaker> speakers; public List<Speaker> getSpeakers() { return speakers; } public void setSpeakers(List<Speaker> speakers) { this.speakers = speakers; } public Session() { } public Long getSession_id() { return session_id; } public void setSession_id(Long session_id) { this.session_id = session_id; } public String getSession_name() { return session_name; } public void setSession_name(String session_name) { this.session_name = session_name; } public String getSession_description() { return session_description; } public void setSession_description(String session_description) { this.session_description = session_description; } public Integer getSession_length() { return session_length; } public void setSession_length(Integer session_length) { this.session_length = session_length; } }
[ "arunajava567@example.com" ]
arunajava567@example.com
4024c3e346cb6cdc2c2b233ea83ddab69d31f6e3
27ce359ef8e18f1548896c0493e4e64e3c287fed
/design-patterns/behavioral/iterator/Iterator.java
9286a9b41a1498842824f250e7d9029f3d9e75ab
[]
no_license
gavin-kim/study
0e95a4dd7558f311aca4df534e2e200c46f8db2c
67be5c3b414192fce08b9aa0f398c06b3b5b60bc
refs/heads/master
2021-03-22T02:16:17.813438
2017-01-23T02:22:26
2017-01-23T02:22:26
73,941,931
0
0
null
null
null
null
UTF-8
Java
false
false
1,093
java
package behavioral.iterator; import java.util.NoSuchElementException; /** * Iterator has two type of a snapshot iterator and lazy iterator. * Iterator is used for inner class to directly access parent's elements. * * A class that implements Iterable<T> class must support Iterator<E>. * * Snapshot: creates the sequence of elements once the iterator is created. * Lazy: Iterator has position that points the element. * * */ public interface Iterator<E> { /** * Return true if the iterator has more elements. * * @return true if the iterator has more elements */ boolean hasNext(); /** * Returns the next element in the iterator. * * @return the next element in the iterator. * @throws NoSuchElementException if the iterator has no more elements. */ E next() throws NoSuchElementException; /** * Removes from the underlying collection the last element returned * by this iterator (optional operation) */ default void remove() { throw new UnsupportedOperationException("remove"); } }
[ "kyk0704@hotmail.com" ]
kyk0704@hotmail.com
9bb8d2e79fe6d66924625425e51f2eaec57c836b
9e21fcd010e7e62f6aaa0b3dff9eb889efc4c572
/src/main/java/com/danlu/service/impl/DemoServiceImpl.java
c8cb53db5335703bdfeb3a544cf430aa272618fb
[]
no_license
Nammu520/springMVC-demo
5bd0d6bf58431f5379c269a8f9b0fa7aa94ba2cb
cb9f5aefa9b27a7d76dfe0c6aa961ec63a957e5f
refs/heads/master
2021-09-01T13:19:15.573359
2017-12-27T06:50:17
2017-12-27T06:50:17
114,945,868
0
0
null
null
null
null
UTF-8
Java
false
false
574
java
package com.danlu.service.impl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.danlu.core.DemoManager; import com.danlu.persist.entity.User; import com.danlu.service.DemoService; @Service public class DemoServiceImpl implements DemoService{ @Autowired DemoManager demoManager; public boolean checkLogin(String username,String password) { return demoManager.checkLogin(username, password); } public User selectByPrimaryKey(int id){ return demoManager.selectByPrimaryKey(id); } }
[ "1848370794@qq.com" ]
1848370794@qq.com
5dd9dd453fb75792e918d7ee0d432ac649114187
16c5b6948966659e28bdcad1a332aae073fbbfe3
/debezium-connector-sqlserver/src/main/java/io/debezium/connector/sqlserver/SqlServerConnection.java
179d218ae71a2a0af9d79973208d2a7615f32afb
[ "Apache-2.0" ]
permissive
wangzheng422/debezium-incubator
649e041b13e69528cfe592036cb0884753f56789
fc45b541681dead2c41ccec12df8cc13ac7e709f
refs/heads/master
2020-03-26T08:18:38.610604
2018-10-25T06:43:32
2018-10-25T06:43:32
144,695,287
0
1
Apache-2.0
2018-11-22T03:43:32
2018-08-14T09:00:27
Java
UTF-8
Java
false
false
9,192
java
/* * Copyright Debezium Authors. * * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package io.debezium.connector.sqlserver; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Timestamp; import java.time.Instant; import java.util.Objects; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import io.debezium.config.Configuration; import io.debezium.jdbc.JdbcConnection; import io.debezium.relational.TableId; import io.debezium.util.IoUtil; /** * {@link JdbcConnection} extension to be used with Microsoft SQL Server * * @author Horia Chiorean (hchiorea@redhat.com), Jiri Pechanec * */ public class SqlServerConnection extends JdbcConnection { private static Logger LOGGER = LoggerFactory.getLogger(SqlServerConnection.class); private static final String STATEMENTS_PLACEHOLDER = "#"; private static final String ENABLE_DB_CDC = "IF EXISTS(select 1 from sys.databases where name='#' AND is_cdc_enabled=0)\n" + "EXEC sys.sp_cdc_enable_db"; private static final String DISABLE_DB_CDC = "IF EXISTS(select 1 from sys.databases where name='#' AND is_cdc_enabled=1)\n" + "EXEC sys.sp_cdc_disable_db"; private static final String ENABLE_TABLE_CDC = "IF EXISTS(select 1 from sys.tables where name = '#' AND is_tracked_by_cdc=0)\n" + "EXEC sys.sp_cdc_enable_table @source_schema = N'dbo', @source_name = N'#', @role_name = NULL, @supports_net_changes = 0"; private static final String CDC_WRAPPERS_DML; private static final String GET_MAX_LSN = "SELECT sys.fn_cdc_get_max_lsn()"; private static final String LOCK_TABLE = "SELECT * FROM # WITH (TABLOCKX)"; private static final String LSN_TO_TIMESTAMP = "SELECT sys.fn_cdc_map_lsn_to_time(?)"; private static final String INCREMENT_LSN = "SELECT sys.fn_cdc_increment_lsn(?)"; private static final String GET_ALL_CHANGES_FOR_TABLE = "SELECT * FROM cdc.fn_cdc_get_all_changes_#(ISNULL(?,sys.fn_cdc_get_min_lsn('#')), ?, N'all update old')"; static { try { ClassLoader classLoader = SqlServerConnection.class.getClassLoader(); CDC_WRAPPERS_DML = IoUtil.read(classLoader.getResourceAsStream("generate_cdc_wrappers.sql")); } catch (Exception e) { throw new RuntimeException("Cannot load SQL Server statements", e); } } private static interface ResultSetExtractor<T> { T apply(ResultSet rs) throws SQLException; } /** * Creates a new connection using the supplied configuration. * * @param config * {@link Configuration} instance, may not be null. * @param factory a factory building the connection string */ public SqlServerConnection(Configuration config, ConnectionFactory factory) { super(config, factory); } /** * Enables CDC for a given database, if not already enabled. * * @param name * the name of the DB, may not be {@code null} * @throws SQLException * if anything unexpected fails */ public void enableDbCdc(String name) throws SQLException { Objects.requireNonNull(name); execute(ENABLE_DB_CDC.replace(STATEMENTS_PLACEHOLDER, name)); } /** * Disables CDC for a given database, if not already disabled. * * @param name * the name of the DB, may not be {@code null} * @throws SQLException * if anything unexpected fails */ public void disableDbCdc(String name) throws SQLException { Objects.requireNonNull(name); execute(DISABLE_DB_CDC.replace(STATEMENTS_PLACEHOLDER, name)); } /** * Enables CDC for a table if not already enabled and generates the wrapper * functions for that table. * * @param name * the name of the table, may not be {@code null} * @throws SQLException if anything unexpected fails */ public void enableTableCdc(String name) throws SQLException { Objects.requireNonNull(name); String enableCdcForTableStmt = ENABLE_TABLE_CDC.replace(STATEMENTS_PLACEHOLDER, name); String generateWrapperFunctionsStmts = CDC_WRAPPERS_DML.replaceAll(STATEMENTS_PLACEHOLDER, name); execute(enableCdcForTableStmt, generateWrapperFunctionsStmts); } /** * @return the current largest log sequence number */ public Lsn getMaxLsn() throws SQLException { return queryAndMap(GET_MAX_LSN, singleResultMapper(rs -> { final Lsn ret = Lsn.valueOf(rs.getBytes(1)); LOGGER.trace("Current maximum lsn is {}", ret); return ret; }, "Maximum LSN query must return exactly one value")); } /** * Provides all changes recorded by the SQL Server CDC capture process for a given table. * * @param tableId - the requested table changes * @param fromLsn - closed lower bound of interval of changes to be provided * @param toLsn - closed upper bound of interval of changes to be provided * @param consumer - the change processor * @throws SQLException */ public void getChangesForTable(TableId tableId, Lsn fromLsn, Lsn toLsn, ResultSetConsumer consumer) throws SQLException { final String query = GET_ALL_CHANGES_FOR_TABLE.replace(STATEMENTS_PLACEHOLDER, cdcNameForTable(tableId)); prepareQuery(query, statement -> { statement.setBytes(1, fromLsn.getBinary()); statement.setBytes(2, toLsn.getBinary()); }, consumer); } /** * Provides all changes recorder by the SQL Server CDC capture process for a set of tables. * * @param tableIds - the requested tables to obtain changes for * @param fromLsn - closed lower bound of interval of changes to be provided * @param toLsn - closed upper bound of interval of changes to be provided * @param consumer - the change processor * @throws SQLException */ public void getChangesForTables(TableId[] tableIds, Lsn fromLsn, Lsn toLsn, BlockingMultiResultSetConsumer consumer) throws SQLException, InterruptedException { final String[] queries = new String[tableIds.length]; int idx = 0; for (TableId tableId: tableIds) { final String query = GET_ALL_CHANGES_FOR_TABLE.replace(STATEMENTS_PLACEHOLDER, cdcNameForTable(tableId)); queries[idx++] = query; LOGGER.trace("Getting changes for table {} in range[{}, {}]", tableId, fromLsn, toLsn); } prepareQuery(queries, statement -> { statement.setBytes(1, fromLsn.getBinary()); statement.setBytes(2, toLsn.getBinary()); }, consumer); } /** * Obtain the next available position in the database log. * * @param lsn - LSN of the current position * @return LSN of the next position in the database * @throws SQLException */ public Lsn incrementLsn(Lsn lsn) throws SQLException { final String query = INCREMENT_LSN; return prepareQueryAndMap(query, statement -> { statement.setBytes(1, lsn.getBinary()); }, singleResultMapper(rs -> { final Lsn ret = Lsn.valueOf(rs.getBytes(1)); LOGGER.trace("Increasing lsn from {} to {}", lsn, ret); return ret; }, "Increment LSN query must return exactly one value")); } /** * Map a commit LSN to a point in time when the commit happened. * * @param lsn - LSN of the commit * @return time when the commit was recorded into the database log * @throws SQLException */ public Instant timestampOfLsn(Lsn lsn) throws SQLException { final String query = LSN_TO_TIMESTAMP; if (lsn.getBinary() == null) { return null; } return prepareQueryAndMap(query, statement -> { statement.setBytes(1, lsn.getBinary()); }, singleResultMapper(rs -> { final Timestamp ts = rs.getTimestamp(1); final Instant ret = (ts == null) ? null : ts.toInstant(); LOGGER.trace("Timestamp of lsn {} is {}", lsn, ret); return ret; }, "LSN to timestamp query must return exactly one value")); } /** * Creates an exclusive lock for a given table. * * @param tableId to be locked * @throws SQLException */ public void lockTable(TableId tableId) throws SQLException { final String lockTableStmt = LOCK_TABLE.replace(STATEMENTS_PLACEHOLDER, tableId.table()); execute(lockTableStmt); } private String cdcNameForTable(TableId tableId) { return tableId.schema() + '_' + tableId.table(); } private <T> ResultSetMapper<T> singleResultMapper(ResultSetExtractor<T> extractor, String error) throws SQLException { return (rs) -> { if (rs.next()) { final T ret = extractor.apply(rs); if (!rs.next()) { return ret; } } throw new IllegalStateException(error); }; } }
[ "gunnar.morling@googlemail.com" ]
gunnar.morling@googlemail.com
814701b93fbf2bf79877279e51134b4af64b7e2d
a1b3349d1ac4509949bf3ce6cfa7cb1009b00763
/src/com/imayam/logging/Log4jInit.java
505259e814703c8bfe09a65de2496b1e5418cf40
[]
no_license
Aasi-solutions/isai
b21661f6b8ab074a033cca3f6bec03039e567543
78363c3cef5a000127fa78b265e9bc1282bf4b3c
refs/heads/master
2021-01-20T06:59:40.758906
2013-09-24T07:21:06
2013-09-24T07:21:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
656
java
package com.imayam.logging; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.log4j.PropertyConfigurator; public class Log4jInit extends HttpServlet { public void init() { String prefix = getServletContext().getRealPath("/"); String file = getInitParameter("log4j-init-file"); // if the log4j-init-file is not set, then no point in trying if (file != null) { PropertyConfigurator.configure(prefix + file); } } public void doGet(HttpServletRequest req, HttpServletResponse res) { } }
[ "aasisolutions@gmail.com" ]
aasisolutions@gmail.com
75b98a6279ea836d24848bb32dbda082f7ccdb6c
a3953494fea919562039d61eb00b0e34dda3f080
/app/src/main/java/com/example/hp/digitalwallet/budged_db.java
f10f868437273bd152ac6e11eb990e49aa6262c9
[]
no_license
Aazka/Digital-Wallet
bf49a7ebe9bb68383a53459b23bcbfbc3630b9f6
799dc01af761f8b296da2b895dc681c136d3411c
refs/heads/master
2022-11-28T23:26:20.149076
2020-08-04T17:04:12
2020-08-04T17:04:12
285,044,872
0
0
null
null
null
null
UTF-8
Java
false
false
3,132
java
package com.example.hp.digitalwallet; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; public class budged_db extends SQLiteOpenHelper { public static final String databaseName="User.db"; //user_table public static final String table1="User_info"; public static final String T1col1="FirstName"; public static final String T1col2="LastName"; public static final String T1col3="Email"; public static final String T1col4="Password"; public static final String T1col5="Gender"; //budged public static final String table2="budged_datail"; public static final String T2col1="Email"; public static final String T2col2="CurrentDate"; public static final String T2col3="TargetDate"; public static final String T2col4="TotalAmount"; private String SQLString1=("create table " +table1+ "(" +T1col1+ " text ," +T1col2+ " text, " +T1col3+ " text primary key," +T1col4+ " text, " +T1col5+ " text "+ ")"); private String SQLString2 ="create table " + table2 + "(" + T2col1 + " Text, " + T2col2 + " Date, " + T2col3 + " Date, " + T2col4 + " integer, " + "foreign key("+T2col1+") References "+table1+"("+T1col3+")" + ")"; public budged_db(Context context) { super(context,databaseName,null,1); SQLiteDatabase db=this.getReadableDatabase(); } @Override public void onCreate(SQLiteDatabase db) { db.execSQL(SQLString1); db.execSQL(SQLString2); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { db.execSQL("drop table if exists "+ table1); db.execSQL("drop table if exists "+ table2); onCreate(db); } public Cursor If_balance() { SQLiteDatabase db=this.getWritableDatabase(); Cursor res=db.rawQuery("Select * from " + table2,null); return res; } public Cursor onCheck(String email) { SQLiteDatabase db =this.getWritableDatabase(); Cursor result = db.rawQuery("SELECT * FROM table2 WHERE Email = '"+email+"'",null ); return result; } public boolean insertDataBudged(String CurrentD,String TargetD,String Amount) { SQLiteDatabase db=this.getWritableDatabase(); ContentValues ourContent = new ContentValues(); ourContent.put(T2col2,CurrentD); ourContent.put(T2col3,TargetD); ourContent.put(T2col4,Amount); long result=db.insert(table2,null,ourContent); if(result==-1) { return false; } else { return true; } } /*public String get_email() { SQLiteDatabase db=this.getWritableDatabase(); Cursor res=db.rawQuery("Select * from " + table2,null); int i=0; while(res.moveToNext()) { } }*/ }
[ "aazka.iqbal5249@gmail.com" ]
aazka.iqbal5249@gmail.com
2ffd47d1e474b953b418c9be7c436da75a8d996b
bb8f5f69e70a97be00820cc48279bd1fe6e156f1
/app/src/main/java/com/mayank/macidtest/MainActivity.java
5f249f4396c16b7bedff3ce42db7b0749271249e
[]
no_license
agarwalmayank199632/Get_MacID_Test
6124eeb747c8ffd107a3e85c5a13a376eb6d1b21
8d27fbcb61c907b5757b6e9792c666562ecf3312
refs/heads/master
2020-02-26T14:51:05.786445
2016-07-24T15:32:32
2016-07-24T15:32:32
64,072,243
1
0
null
null
null
null
UTF-8
Java
false
false
1,670
java
package com.mayank.macidtest; import android.content.Context; import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.Toast; import java.net.NetworkInterface; import java.util.Collections; import java.util.List; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toast.makeText(MainActivity.this,getMacAddr(),Toast.LENGTH_LONG).show(); } public String getMacAddr() { try { List<NetworkInterface> all = Collections.list(NetworkInterface.getNetworkInterfaces()); for (NetworkInterface nif : all) { if (!nif.getName().equalsIgnoreCase("wlan0")) continue; byte[] macBytes = nif.getHardwareAddress(); if (macBytes == null) { return ""; } StringBuilder res1 = new StringBuilder(); for (byte b : macBytes) { res1.append(String.format("%02X:",b)); } if (res1.length() > 0) { res1.deleteCharAt(res1.length() - 1); } return res1.toString(); } } catch (Exception e) { e.printStackTrace(); } WifiManager wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE); WifiInfo wInfo = wifiManager.getConnectionInfo(); return wInfo.getMacAddress(); } }
[ "agarwal.mayank32@gmail.com" ]
agarwal.mayank32@gmail.com
b07a96de96cc8088cf80843f78991eca57c2d24b
890610817f527a6517af2e589cd10c99ee7c7b80
/src/kpi/laba2/SortByName.java
31b9dde45c681aeb51204c2384d183ca18325d7b
[]
no_license
Anna-122/Project1
5dcceb5c4769f6f23dcd2c26d12fc638fc64f78b
ae8502a988044805a778ee9b0ca2f5b97b7656c6
refs/heads/master
2020-07-27T14:48:30.634059
2019-11-24T14:40:00
2019-11-24T14:40:00
209,129,864
0
5
null
2019-11-24T14:28:05
2019-09-17T18:34:59
Java
UTF-8
Java
false
false
292
java
package kpi.laba2; import java.util.Comparator; public class SortByName implements Comparator<Zoo> { @Override public int compare( Zoo o1, Zoo o2 ) { String n1=o1.name; String n2=o2.name; return n1.compareTo(n2); } }
[ "anna.s.goncharova.2001@gmail.com" ]
anna.s.goncharova.2001@gmail.com
175ba2ba91cf80cd31c48dc04fc71ab8b36a6a45
9bbe9827880ecc2585ddba5edc44767665ee41e3
/src/programmers/level2/소수만들기.java
30f9d538e493dde1272f63f0c9dce5c71267b14f
[]
no_license
hyeyeon2964/algo_study
2f703d015980648a392868cf86e8b7bcb063c4ba
6ba73a6f38453dcadd879cbc6212eae85c58e0bc
refs/heads/master
2022-05-17T23:57:39.102580
2022-03-21T13:09:50
2022-03-21T13:09:50
285,786,048
1
0
null
null
null
null
UTF-8
Java
false
false
1,355
java
package programmers.level2; import javax.swing.text.StyledEditorKit; import java.util.Map; public class 소수만들기 { public static int solution(int[] nums) { int answer = 0; boolean isPrime = true; for(int i = 0; i< nums.length; i++) { for(int j = 0; j< nums.length; j++) { if (i == j) { continue; } for(int k = 0; k<nums.length; k++) { if(k == j || k == i) { continue; } int num = nums[i] + nums[j] + nums[k]; int sqrt = (int)Math.sqrt(num); isPrime = true; for(int l = 2; l<=sqrt; l++) { if(num % l == 0) { isPrime = false; break; } } if(isPrime == true) { answer++; } } } } return answer; } public static void main(String[] args) { int[] arr = {11,2,3,4}; System.out.println(solution(arr)); } }
[ "hyeyeon2964@hanmail.net" ]
hyeyeon2964@hanmail.net
3d36a27e05d0974d6c72b67bc136c67280a8d4ee
4de47504d1c5fadad95ad643a506acc25f401cfd
/qifei/src/com/qifei/service/impl/DimUnitServiceImpl.java
06a1e996d65aa9eac454baae35255846212581b8
[]
no_license
qifei2016/qifei
28009303ebb666e3829219ee1c66f3e924fbe817
b38ceee1591807e23741fed813b0010249ec2caf
refs/heads/master
2021-01-10T04:45:15.822812
2016-02-29T09:19:42
2016-02-29T09:19:42
50,491,916
0
0
null
null
null
null
UTF-8
Java
false
false
1,089
java
package com.qifei.service.impl; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.qifei.dao.DimUnitDAO; import com.qifei.model.DimUnit; import com.qifei.service.DimUnitService; @Service public class DimUnitServiceImpl implements DimUnitService { @Autowired DimUnitDAO dimUnitDao; @Override public List<DimUnit> getAllDimUnits() { return dimUnitDao.getAllDimUnits(); } @Override @Transactional public void deleteDimUnit(List<DimUnit> dimUnits) { for (DimUnit dimUnit : dimUnits) { dimUnitDao.deleteEntity(dimUnit); } } @Override @Transactional public void saveDimUnit(List<DimUnit> dimUnits) { for (DimUnit dimUnit : dimUnits) { dimUnitDao.saveOrUpdateEntity(dimUnit); } } @Override public int getMaxUnitId() { return dimUnitDao.getMaxUnitId(); } @Override public DimUnit getUnitByName(String name) { // TODO Auto-generated method stub return dimUnitDao.getUnitByName(name); } }
[ "414331241@qq.com" ]
414331241@qq.com
6a9d9cf8537e5fcbe77de803c36b9b2ab74719c0
939cfc256a6e11ff318504700c0b88f6e30f87e4
/Threads/Process.java
8193bc5c0a1433f7659194194abc917941fde4ae
[]
no_license
joeant1989/prom1
e190b6585365fc4a2a4e19c35558b0d8930a8c2c
95a4a7024cea9bab8185b2396c590ed956b7bc5b
refs/heads/master
2021-01-01T17:29:19.393330
2017-08-12T10:12:04
2017-08-12T10:12:04
98,083,135
0
0
null
null
null
null
UTF-8
Java
false
false
362
java
package thread; public class Process extends Inputs { static int sum; public void run() { sum = Inputs.a + Inputs.b; System.out.println("THE SUM = " + sum); } public static void main(String[] args) throws InterruptedException { Inputs x = new Inputs(); Process y = new Process(); x.start(); x.join(); y.start(); } }
[ "noreply@github.com" ]
noreply@github.com
af1eeb5c3ac657b669594c0ccefeefcce86d36ee
88d3667bb04aeaa623f5179b0a3462c389c2a901
/jmx-base/src/main/java/com/focustech/jmx/DAO/JmxDatabaseDAO.java
345d9a43003a462f3d3a5184eb57396c97160ec4
[]
no_license
jsycwangwei/jmx-watcher
5b5e289abc32a40a982144d0df0ef1ef3c181adb
3999af65ddb7bd5b12c563c7029d5d6c4fa44dd3
refs/heads/master
2021-01-21T13:21:02.366009
2016-02-02T12:15:18
2016-02-02T12:15:18
50,566,408
1
1
null
null
null
null
UTF-8
Java
false
false
903
java
package com.focustech.jmx.DAO; import java.util.Date; import java.util.List; import org.apache.ibatis.annotations.Param; import com.focustech.jmx.po.JmxDatabase; import com.focustech.jmx.pojo.JmxDatabasePOJO; public interface JmxDatabaseDAO { int insertDatabaseInfo(JmxDatabase database); int updateDatabaseInfo(@Param("po") JmxDatabase database); List<JmxDatabase> selectDatabaseInfoByDate(@Param("appId") Integer appId, @Param("hostId") Integer serverId, @Param("from") Date from, @Param("to") Date to); JmxDatabase selectLastestDatabaseInfo(@Param("appId") Integer appId, @Param("hostId") Integer serverId); /*** * 获取所有应用的当前数据库Active的连接数量 * * @return */ List<JmxDatabasePOJO> selectDBActiveConn(); JmxDatabase getDBInfoByPrimaryKey(@Param("recId") Integer recId); }
[ "jsycwangwei@icloud.com" ]
jsycwangwei@icloud.com
b574da9b9f4ff85877d727757b961d76fa06cf7c
100593700fa9dfdf2007159da8c52a6d265ef762
/jt/jt-common/src/main/java/com/jt/anno/CacheFind.java
f12d433676ccedb20dcb62d3a0fa420b6c1167f5
[ "Apache-2.0" ]
permissive
ljk18512296771/LearnGit
067362bf017cdfe5d8bd72211f5800d33c3a3eed
256115077fd74c04de51192bef3dcde65212182b
refs/heads/master
2022-12-02T00:17:49.120257
2020-08-18T12:50:14
2020-08-18T12:50:14
288,453,479
0
0
null
null
null
null
UTF-8
Java
false
false
486
java
package com.jt.anno; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Target(ElementType.METHOD) //标识注解 对谁生效 @Retention(RetentionPolicy.RUNTIME) //注解使用的有效期 public @interface CacheFind { public String key(); //标识存入redis的key的前缀 public int seconds() default 0; //标识保存的时间 单位是秒 }
[ "ljk971023@126.com" ]
ljk971023@126.com
7dee1fbabddcdb72a30ffde7150e7740104f1817
6f323487c1c877ef10d21940fb75319d0bfaa3e6
/Week_6/src/mainpackage/Account.java
24aeb78071531e7468768edf950a0177deddd313
[]
no_license
Tyaisurm/Olio-Ohjelmointi_K2016
fff35b6c6b9dd7414da82cc3c45dd5ee775126a6
98a6a38cc75a2ae0e9047517880f2e48bf6b3dc6
refs/heads/master
2021-01-20T20:15:05.938945
2016-07-01T11:37:32
2016-07-01T11:37:32
60,091,044
0
0
null
null
null
null
UTF-8
Java
false
false
814
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 mainpackage; /** * * @author m7942 */ public abstract class Account { protected int money; protected String accountName; public Account() { money = 0; accountName = ""; } } class Credit extends Account { int credit = 0; public Credit(String tili, int raha, int luotto) { accountName = tili; money = raha; credit = luotto; System.out.println("Tili luotu."); } } class Normal extends Account { public Normal(String tili, int raha) { accountName = tili; money = raha; System.out.println("Tili luotu."); } }
[ "m7942@lut1824.pc.lut.fi" ]
m7942@lut1824.pc.lut.fi
3741048195b661880053019bc365974838f041ff
50510258d82d7bbcd9f95ac23b9d839aace31a74
/test04.tar1.3/src/com/company/Element.java
0eec421ab274d9e306d040446cdd0e2d015d83a9
[]
no_license
Shirahzilber12/hackeru_java
4f08909754146a4ada300c2754889b9f026c5b2c
e8544d2669cba8d92aa9177853a26fa39001da80
refs/heads/master
2021-01-12T10:40:09.682622
2017-03-09T10:50:00
2017-03-09T10:50:00
81,721,721
0
0
null
null
null
null
UTF-8
Java
false
false
485
java
package com.company; /** * Created by eladlavi on 20/02/2017. */ public class Element implements Comparable<Element> { int value; int row; int col; public Element(int value, int row, int col) { this.value = value; this.row = row; this.col = col; } @Override public int compareTo(Element o) { if(this.value > o.value) return 1; if(this.value < o.value) return -1; return 0; } }
[ "shirah.zilber12@gmail.com" ]
shirah.zilber12@gmail.com
fea4d03a44dd640cfcde4bafc0d0ff8daf23ee2a
4c0c8d1c709ff3b17079254d6c168e931023fd5e
/naming/src/test/java/com/alibaba/nacos/naming/push/v2/executor/PushExecutorUdpImplTest.java
b1c570d43e0025f4a04c4118c54dee559b3ea528
[ "Apache-2.0" ]
permissive
alibaba/nacos
b46e8f58c1dcf0314b20d3ec823aab5f8564b004
e4190a8c862f99ab3ce6e969cdd1f13703d15868
refs/heads/develop
2023-08-30T23:26:24.747553
2023-08-30T07:21:15
2023-08-30T07:21:15
137,451,403
29,642
13,818
Apache-2.0
2023-09-14T04:06:41
2018-06-15T06:49:27
Java
UTF-8
Java
false
false
3,950
java
/* * Copyright 1999-2020 Alibaba Group Holding Ltd. * * 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.alibaba.nacos.naming.push.v2.executor; import com.alibaba.nacos.api.naming.pojo.Instance; import com.alibaba.nacos.api.naming.pojo.ServiceInfo; import com.alibaba.nacos.api.remote.PushCallBack; import com.alibaba.nacos.naming.core.v2.metadata.ServiceMetadata; import com.alibaba.nacos.naming.pojo.Subscriber; import com.alibaba.nacos.naming.push.UdpPushService; import com.alibaba.nacos.naming.push.v2.PushDataWrapper; import com.alibaba.nacos.naming.push.v2.task.NamingPushCallback; import com.alibaba.nacos.naming.selector.SelectorManager; import com.alibaba.nacos.sys.utils.ApplicationUtils; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.invocation.InvocationOnMock; import org.mockito.junit.MockitoJUnitRunner; import org.mockito.stubbing.Answer; import org.springframework.context.ConfigurableApplicationContext; import java.util.List; import static org.junit.Assert.assertEquals; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @RunWith(MockitoJUnitRunner.class) public class PushExecutorUdpImplTest { private final String rpcClientId = "1.1.1.1:10000"; @Mock private UdpPushService pushService; @Mock private Subscriber subscriber; @Mock private NamingPushCallback pushCallBack; @Mock private SelectorManager selectorManager; @Mock private ConfigurableApplicationContext context; private PushDataWrapper pushData; private PushExecutorUdpImpl pushExecutor; private ServiceMetadata serviceMetadata; @Before public void setUp() throws Exception { serviceMetadata = new ServiceMetadata(); pushData = new PushDataWrapper(serviceMetadata, new ServiceInfo("G@@S")); pushExecutor = new PushExecutorUdpImpl(pushService); doAnswer(new CallbackAnswer()).when(pushService) .pushDataWithCallback(eq(subscriber), any(ServiceInfo.class), eq(pushCallBack)); ApplicationUtils.injectContext(context); when(context.getBean(SelectorManager.class)).thenReturn(selectorManager); when(selectorManager.select(any(), any(), any())) .then((Answer<List<Instance>>) invocationOnMock -> invocationOnMock.getArgument(2)); } @Test public void testDoPush() { pushExecutor.doPush(rpcClientId, subscriber, pushData); verify(pushService).pushDataWithoutCallback(eq(subscriber), any(ServiceInfo.class)); } @Test public void testDoPushWithCallback() { pushExecutor.doPushWithCallback(rpcClientId, subscriber, pushData, pushCallBack); verify(pushCallBack).onSuccess(); } private static class CallbackAnswer implements Answer<Void> { @Override public Void answer(InvocationOnMock invocationOnMock) throws Throwable { ServiceInfo serviceInfo = invocationOnMock.getArgument(1); assertEquals("G@@S", serviceInfo.getName()); PushCallBack callBack = invocationOnMock.getArgument(2); callBack.onSuccess(); return null; } } }
[ "noreply@github.com" ]
noreply@github.com
8411cb529495f64dc88c8f206c1ce5f1a36ff75b
e120b3b594a7791f600f183274e91c94539e8c61
/unimall/unimall-app-api/src/main/java/com/iotechn/unimall/app/api/order/OrderServiceImpl.java
f2bea7b978fc66c88577dcb0eb3d07694055fa52
[]
no_license
yaowei1107/demo
c5d4f3fb5c75563745a4a41c33c189e0a84e93ad
814272eea5d13db3631eb578953b8a7aa5c1fb4b
refs/heads/master
2023-01-02T20:47:00.423119
2020-10-28T05:12:29
2020-10-28T05:12:29
307,892,198
0
1
null
null
null
null
UTF-8
Java
false
false
41,914
java
package com.iotechn.unimall.app.api.order; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest; import com.github.binarywang.wxpay.constant.WxPayConstants; import com.github.binarywang.wxpay.exception.WxPayException; import com.github.binarywang.wxpay.service.WxPayService; import com.iotechn.unimall.biz.executor.GlobalExecutor; import com.iotechn.unimall.biz.service.address.AddressBizService; import com.iotechn.unimall.biz.service.cart.CartBizService; import com.iotechn.unimall.biz.service.coupon.CouponBizService; import com.iotechn.unimall.biz.service.freight.FreightTemplateBizService; import com.iotechn.unimall.biz.service.groupshop.GroupShopBizService; import com.iotechn.unimall.biz.service.notify.AdminNotifyBizService; import com.iotechn.unimall.biz.service.order.OrderBizService; import com.iotechn.unimall.biz.service.product.ProductBizService; import com.iotechn.unimall.core.exception.AppServiceException; import com.iotechn.unimall.core.exception.ExceptionDefinition; import com.iotechn.unimall.core.exception.ServiceException; import com.iotechn.unimall.core.util.GeneratorUtil; import com.iotechn.unimall.data.component.CacheComponent; import com.iotechn.unimall.data.component.LockComponent; import com.iotechn.unimall.data.constant.CacheConst; import com.iotechn.unimall.data.constant.LockConst; import com.iotechn.unimall.data.domain.AddressDO; import com.iotechn.unimall.data.domain.OrderDO; import com.iotechn.unimall.data.domain.OrderSkuDO; import com.iotechn.unimall.data.domain.SpuDO; import com.iotechn.unimall.data.dto.CouponUserDTO; import com.iotechn.unimall.data.dto.UserDTO; import com.iotechn.unimall.data.dto.freight.ShipTraceDTO; import com.iotechn.unimall.data.dto.goods.GroupShopDTO; import com.iotechn.unimall.data.dto.goods.GroupShopSkuDTO; import com.iotechn.unimall.data.dto.goods.SkuDTO; import com.iotechn.unimall.data.dto.order.OrderDTO; import com.iotechn.unimall.data.dto.order.OrderRequestDTO; import com.iotechn.unimall.data.dto.order.OrderRequestSkuDTO; import com.iotechn.unimall.data.enums.*; import com.iotechn.unimall.data.mapper.OrderMapper; import com.iotechn.unimall.data.mapper.OrderSkuMapper; import com.iotechn.unimall.data.mapper.SkuMapper; import com.iotechn.unimall.data.model.FreightCalcModel; import com.iotechn.unimall.data.model.OrderCalcSkuModel; import com.iotechn.unimall.data.model.Page; import com.iotechn.unimall.data.model.SkuStockInfoModel; import com.iotechn.unimall.biz.mq.DelayedMessageQueue; import com.iotechn.unimall.data.properties.UnimallOrderProperties; import com.iotechn.unimall.data.properties.UnimallWxAppProperties; import com.iotechn.unimall.data.util.SessionUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.Assert; import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; import java.util.*; import java.util.stream.Collectors; /** * Created by rize on 2019/7/4. */ @Service public class OrderServiceImpl implements OrderService { private static final Logger logger = LoggerFactory.getLogger(OrderServiceImpl.class); @Autowired private SkuMapper skuMapper; @Autowired private CouponBizService couponBizService; @Autowired private OrderMapper orderMapper; @Autowired private OrderSkuMapper orderSkuMapper; @Autowired private CartBizService cartBizService; @Autowired private WxPayService wxPayService; @Autowired private LockComponent lockComponent; @Autowired private AddressBizService addressBizService; @Autowired private OrderBizService orderBizService; @Autowired private FreightTemplateBizService freightTemplateBizService; @Autowired private GroupShopBizService groupShopBizService; @Autowired private AdminNotifyBizService adminNotifyBizService; @Autowired private CacheComponent cacheComponent; @Autowired private ProductBizService productBizService; @Autowired private DelayedMessageQueue delayedMessageQueue; @Value("${com.iotechn.unimall.machine-no}") private String MACHINE_NO; @Value("${com.iotechn.unimall.env}") private String ENV; @Autowired private UnimallWxAppProperties unimallWxAppProperties; @Autowired private UnimallOrderProperties unimallOrderProperties; @Override @Transactional(rollbackFor = Exception.class) public String takeOrder(OrderRequestDTO orderRequest, String channel, Long userId) throws ServiceException { if (lockComponent.tryLock(LockConst.TAKE_ORDER_LOCK + userId, 20)) { //加上乐观锁,防止用户重复提交订单 List<OrderRequestSkuDTO> skuList = orderRequest.getSkuList(); boolean calcStockFlag = false; try { //用户会员等级 Integer userLevel = SessionUtil.getUser().getLevel(); // 对Sku排序,防止相互拿锁,两边都无法结算的情况。 orderRequest.getSkuList().sort((o1, o2) -> (int) (o1.getSkuId() - o2.getSkuId())); //参数强校验 START if (CollectionUtils.isEmpty(skuList) || orderRequest.getTotalPrice() == null) { throw new AppServiceException(ExceptionDefinition.PARAM_CHECK_FAILED); } if (orderRequest.getTotalPrice() <= 0) { throw new AppServiceException(ExceptionDefinition.ORDER_PRICE_MUST_GT_ZERO); } // 若是卖虚拟物品,不需要收货地址,可以将此行注释掉 if (orderRequest.getAddressId() == null) { throw new AppServiceException(ExceptionDefinition.ORDER_ADDRESS_CANNOT_BE_NULL); } // 收货地址对象 AddressDO addressDO = addressBizService.getAddressById(orderRequest.getAddressId()); // 库存不足列表,用于提示前端 List<SkuStockInfoModel> stockErrorSkuList = new LinkedList<>(); // 商品状态异常列表,用于提示前端 List<Long> statusErrorSkuList = new LinkedList<>(); // 从缓存读取,用于计算的列表。属于SkuDO的部分属性。 List<OrderCalcSkuModel> calcSkuList = new ArrayList<>(); // 将SkuIds 查取出来 List<Long> skuIds = new ArrayList<>(); for (OrderRequestSkuDTO orderRequestSkuDTO : skuList) { Long skuId = orderRequestSkuDTO.getSkuId(); skuIds.add(skuId); OrderCalcSkuModel orderCalcSpuDTO = cacheComponent.getHashObj(CacheConst.PRT_SPU_HASH_BUCKET, "P" + orderRequestSkuDTO.getSpuId(), OrderCalcSkuModel.class); if (orderCalcSpuDTO == null) { // 尝试从DB中读取 SpuDO spuFromDB = productBizService.getProductByIdFromDB(orderRequestSkuDTO.getSpuId()); if (spuFromDB == null || (spuFromDB.getStatus() == SpuStatusType.STOCK.getCode())) { // 不存在的或下架的商品 statusErrorSkuList.add(skuId); continue; } else { orderCalcSpuDTO = new OrderCalcSkuModel(); BeanUtils.copyProperties(spuFromDB, orderCalcSpuDTO); } } long surplus = cacheComponent.decrementHashKey(CacheConst.PRT_SKU_STOCK_BUCKET, "K" + skuId, orderRequestSkuDTO.getNum()); if (surplus < 0) { // 若余量小于0,则表示该商品不存在或库存不足。 SkuStockInfoModel skuStockInfo = new SkuStockInfoModel(); skuStockInfo.setSkuId(skuId); skuStockInfo.setExpect(orderRequestSkuDTO.getNum()); // 扣减之后的余量 + 用户期望量 = 扣减之前的余量 skuStockInfo.setSurplus((int) surplus + orderRequestSkuDTO.getNum()); stockErrorSkuList.add(skuStockInfo); continue; } // 将SkuId设置进去 orderCalcSpuDTO.setSkuId(skuId); orderCalcSpuDTO.setNum(orderRequestSkuDTO.getNum()); calcSkuList.add(orderCalcSpuDTO); } calcStockFlag = true; // 商品库存不足列表,用于前端提示 使用异常的Attach方法 if (!CollectionUtils.isEmpty(stockErrorSkuList)) { throw new AppServiceException(ExceptionDefinition.ORDER_SKU_STOCK_NOT_ENOUGH).attach(stockErrorSkuList); } // 状态错误列表,用于前端提示 if (!CollectionUtils.isEmpty(statusErrorSkuList)) { throw new AppServiceException(ExceptionDefinition.ORDER_SKU_NOT_EXIST).attach(statusErrorSkuList); } Date now = new Date(); // 若库存充足,也没下架,则获取所有sku实体对象 List<SkuDTO> skuDTOListOfAll = productBizService.getSkuListByIds(skuIds); // 优惠券实例 CouponUserDTO couponUserDTO = null; if (orderRequest.getCouponId() != null) { couponUserDTO = couponBizService.getCouponUserById(orderRequest.getCouponId(), userId); if (couponUserDTO == null || couponUserDTO.getGmtUsed() != null) { throw new AppServiceException(ExceptionDefinition.ORDER_COUPON_NOT_EXIST); } } List<OrderCalcSkuModel> orderCalcSkuList = calcSkuList; // 进行主键排序 orderCalcSkuList.sort((o1, o2) -> (int) (o1.getSkuId() - o2.getSkuId())); // 查出来的数据是按主键排序的 List<SkuDTO> skuDTOList = skuDTOListOfAll; skuDTOList.sort((o1, o2) -> (int) (o1.getId() - o2.getId())); // 商品总价 = 普通商品价格 + 团购商品价格 (暂未使用) int totalSkuPrice = 0; // 普通商品价格 int skuPrice = 0; int skuOriginalPrice = 0; // 团购商品价格映射 Map<Long, Integer> groupShopPriceMap = new HashMap<>(); Map<Long, Integer> groupShopOriginalPriceMap = new HashMap<>(); for (int i = 0; i < skuDTOList.size(); i++) { OrderCalcSkuModel orderCalcSkuDTO = orderCalcSkuList.get(i); SkuDTO skuDTO = skuDTOList.get(i); Integer originalPrice = skuDTO.getOriginalPrice(); // FIXME 对于活动价格,需要在skuDTO中覆盖掉之前价格 // FIXME 对于参加活动的商品,商品的非活动价格已经无参考价值 if ((skuDTO.getActivityType() != null && skuDTO.getActivityType() == SpuActivityType.GROUP_SHOP.getCode() && skuDTO.getGmtActivityStart() != null && skuDTO.getGmtActivityEnd() != null && skuDTO.getGmtActivityStart().getTime() < now.getTime() && skuDTO.getGmtActivityEnd().getTime() > now.getTime())) { // 这个判断,表示该商品与正在进行的团购活动 GroupShopDTO groupShopActivity = groupShopBizService.getGroupShopById(skuDTO.getActivityId()); if (groupShopActivity == null) { throw new AppServiceException(ExceptionDefinition.ORDER_GROUP_SHOP_ACTIVITY_HAS_OVER); } // 有可能两个SKU是同一个团购活动,所以需要将这两个活动价格合并 Integer oldPrice = groupShopPriceMap.get(groupShopActivity.getId()); Integer oldOriginalPrice = groupShopOriginalPriceMap.get(groupShopActivity.getId()); Map<Long, GroupShopSkuDTO> groupShopSkuMap = groupShopActivity.getGroupShopSkuDTOList().stream().collect(Collectors.toMap(GroupShopSkuDTO::getSkuId, v -> v)); // 累加商品总价 totalSkuPrice += groupShopSkuMap.get(skuDTO.getId()).getSkuGroupShopPrice() * orderCalcSkuDTO.getNum(); // 将价格覆盖掉 skuDTO.setPrice(groupShopSkuMap.get(skuDTO.getId()).getSkuGroupShopPrice()); skuDTO.setVipPrice(groupShopSkuMap.get(skuDTO.getId()).getSkuGroupShopPrice()); if (oldPrice != null) { groupShopPriceMap.put(groupShopActivity.getId(), oldPrice + (groupShopSkuMap.get(skuDTO.getId()).getSkuGroupShopPrice() * orderCalcSkuDTO.getNum())); } else { groupShopPriceMap.put(groupShopActivity.getId(), groupShopSkuMap.get(skuDTO.getId()).getSkuGroupShopPrice() * orderCalcSkuDTO.getNum()); } if (oldOriginalPrice != null) { groupShopOriginalPriceMap.put(groupShopActivity.getId(), oldOriginalPrice + (skuDTO.getOriginalPrice() * orderCalcSkuDTO.getNum())); } else { groupShopOriginalPriceMap.put(groupShopActivity.getId(), skuDTO.getOriginalPrice() * orderCalcSkuDTO.getNum()); } } else if (userLevel == UserLevelType.VIP.getCode()) { skuOriginalPrice += originalPrice * orderCalcSkuDTO.getNum(); skuPrice += skuDTO.getVipPrice() * orderCalcSkuDTO.getNum(); totalSkuPrice += skuDTO.getVipPrice() * orderCalcSkuDTO.getNum(); } else { skuOriginalPrice += originalPrice * orderCalcSkuDTO.getNum(); skuPrice += skuDTO.getPrice() * orderCalcSkuDTO.getNum(); totalSkuPrice += skuDTO.getPrice() * orderCalcSkuDTO.getNum(); } // 将DB中的价格,重量赋值给计算模型 orderCalcSkuDTO.setFreightTemplateId(skuDTO.getFreightTemplateId()); orderCalcSkuDTO.setWeight(skuDTO.getWeight()); orderCalcSkuDTO.setPrice(skuDTO.getPrice()); orderCalcSkuDTO.setVipPrice(skuDTO.getVipPrice()); } // 拆分单序号 int childIndex = 1; // 获取邮费 FreightCalcModel freightCalcModel = new FreightCalcModel(); // 将SKU按照不同的运费模板进行分组 Map<Long, List<OrderCalcSkuModel>> freightTemplateCalcMap = orderCalcSkuList .stream() .collect(Collectors.groupingBy(OrderCalcSkuModel::getFreightTemplateId)); // 获取SKU数量映射表 List<FreightCalcModel.FreightAndWeight> faws = new LinkedList<>(); freightTemplateCalcMap.forEach((k, v) -> { FreightCalcModel.FreightAndWeight faw = new FreightCalcModel.FreightAndWeight(); faw.setId(k); int weight = 0; int price = 0; for (OrderCalcSkuModel orderCalcSkuModel : v) { weight += orderCalcSkuModel.getWeight() * orderCalcSkuModel.getNum(); price += (userLevel == UserLevelType.VIP.getCode() ? orderCalcSkuModel.getVipPrice() : orderCalcSkuModel.getPrice()) * orderCalcSkuModel.getNum(); } faw.setPrice(price); faw.setWeight(weight); faws.add(faw); }); freightCalcModel.setFreightAndWeights(faws); Integer freightPrice = freightTemplateBizService.computePostage(freightCalcModel); // 是否已经计算过单次费用,例如优惠券、运费。同一个商家只计算一次(因为团购订单可能会被拆为两单,但是邮费只应该计算一次) boolean singleFee = false; // 使用优惠券的订单 Long useCouponOrderId = null; // 生成一个父单号 String parentOrderNo = GeneratorUtil.genOrderId(this.MACHINE_NO, this.ENV); if (skuPrice > 0) { // 这是普通商品 // 将普通商品(非团购等需要单独拆单的商品)的SkuList过滤出来 List<SkuDTO> commonSkuList = new ArrayList<>(); List<OrderCalcSkuModel> commonOrderCalcSkuList = new ArrayList<>(); for (int i = 0; i < skuDTOList.size(); i++) { SkuDTO item = skuDTOList.get(i); if (!(item.getActivityType() != null && item.getActivityType() == SpuActivityType.GROUP_SHOP.getCode() && item.getGmtActivityStart() != null && item.getGmtActivityEnd() != null && item.getGmtActivityStart().getTime() < now.getTime() && item.getGmtActivityEnd().getTime() > now.getTime())) { commonSkuList.add(item); commonOrderCalcSkuList.add(orderCalcSkuList.get(i)); } } // 保存订单 OrderDO o = save(skuOriginalPrice, skuPrice, channel, freightPrice, couponUserDTO, orderRequest, parentOrderNo, childIndex, userId, now, addressDO, commonSkuList, commonOrderCalcSkuList, userLevel, null, null); useCouponOrderId = o.getId(); // 标记已经计算过运费和优惠券了 singleFee = true; } if (groupShopPriceMap.size() > 0) { // 存在团购商品,分别分单处理团购商品 Set<Long> groupShopIds = groupShopPriceMap.keySet(); for (Long groupShopId : groupShopIds) { Integer groupShopSkuOriginalPrice = groupShopOriginalPriceMap.get(groupShopId); Integer groupShopSkuPrice = groupShopPriceMap.get(groupShopId); // 过滤出当前团购的团购商品,即SkuDTOList List<SkuDTO> groupShopSkuList = new ArrayList<>(); List<OrderCalcSkuModel> groupShopOrderCalcSkuList = new ArrayList<>(); for (int i = 0; i < skuDTOList.size(); i++) { SkuDTO item = skuDTOList.get(i); if (item.getActivityType() != null && item.getActivityType() == SpuActivityType.GROUP_SHOP.getCode() && item.getGmtActivityStart() != null && item.getActivityId().longValue() == groupShopId.longValue() && item.getGmtActivityEnd() != null && item.getGmtActivityStart().getTime() < now.getTime() && item.getGmtActivityEnd().getTime() > now.getTime()) { groupShopSkuList.add(item); groupShopOrderCalcSkuList.add(calcSkuList.get(i)); } } if (singleFee) { // 保存子单前,将子单序列累加 childIndex++; save(groupShopSkuOriginalPrice, groupShopSkuPrice, channel, 0, couponUserDTO, orderRequest, parentOrderNo, childIndex, userId, now, addressDO, groupShopSkuList, groupShopOrderCalcSkuList, userLevel, SpuActivityType.GROUP_SHOP.getCode(), groupShopId); } else { // 保存子单前,将子单序列累加 childIndex++; save(groupShopSkuOriginalPrice, groupShopSkuPrice, channel, freightPrice, couponUserDTO, orderRequest, parentOrderNo, childIndex, userId, now, addressDO, groupShopSkuList, groupShopOrderCalcSkuList, userLevel, SpuActivityType.GROUP_SHOP.getCode(), groupShopId); // 只收一次运费 singleFee = true; } } } Map<Long, Integer> skuStockMap = skuList.stream().collect(Collectors.toMap(OrderRequestSkuDTO::getSkuId, OrderRequestSkuDTO::getNum)); // 减少商品库存,microFix。使用事务通知 productBizService.decSkuStock(skuStockMap); // 扣除优惠券,microFix。使用事务通知 if (couponUserDTO != null) { couponBizService.useCoupon(orderRequest.getCouponId(), useCouponOrderId); } // 若购物车结算,删除这些购物车的商品 if (orderRequest.getTakeWay().equals("cart")) { cartBizService.deleteBySkuId(skuIds, userId); } // 与前端预览的金额比对,若因为时间差不一致,则告诉用户 if (orderRequest.getExceptPrice() != null) { int exceptPrice = this.checkPrepay(parentOrderNo, null, userId); if (exceptPrice != orderRequest.getExceptPrice().intValue()) { throw new AppServiceException(ExceptionDefinition.ORDER_PRODUCT_PRICE_HAS_BEEN_CHANGED); } } // 日志 & 发送一个订单自动取消定时任务 for (int i = 1; i <= childIndex; i++) { String childOrderNo = parentOrderNo + "S" + ((1000) + i); logger.info("订单创建成功:" + childOrderNo); delayedMessageQueue.publishTask(DMQHandlerType.ORDER_AUTO_CANCEL.getCode(), childOrderNo, unimallOrderProperties.getAutoCancelTime().intValue()); } return parentOrderNo; } catch (Exception e) { if (calcStockFlag) { for (OrderRequestSkuDTO orderRequestSkuDTO : skuList) { cacheComponent.incrementHashKey(CacheConst.PRT_SKU_STOCK_BUCKET, "K" + orderRequestSkuDTO.getSkuId(), orderRequestSkuDTO.getNum()); } } if (e instanceof ServiceException) { // 服务异常 throw e; } // 未知异常 logger.error("[提交订单] 异常", e); throw e; } finally { lockComponent.release(LockConst.TAKE_ORDER_LOCK + userId); } } throw new AppServiceException(ExceptionDefinition.ORDER_SYSTEM_BUSY); } @Override public Page<OrderDTO> getOrderPage(Integer pageNo, Integer pageSize, Integer status, Long userId) throws ServiceException { List<OrderDTO> orderDTOList = orderMapper.selectOrderPage(status, (pageNo - 1) * pageSize, pageSize, userId); Long count = orderMapper.countOrder(status, (pageNo - 1) * pageSize, pageSize, userId); //封装SKU orderDTOList.forEach(item -> { item.setSkuList(orderSkuMapper.selectList(new QueryWrapper<OrderSkuDO>().eq("order_id", item.getId()))); }); return new Page<>(orderDTOList, pageNo, pageSize, count); } @Override public OrderDTO getOrderDetail(Long orderId, Long userId) throws ServiceException { return orderBizService.getOrderDetail(orderId, userId); } @Override @Transactional(rollbackFor = Exception.class) public Object wxPrepay(String parentOrderNo, String orderNo, String ip, Long userId) throws ServiceException { int actualPrice = this.checkPrepay(parentOrderNo, orderNo, userId); Integer loginType = SessionUtil.getUser().getLoginType(); String appId; String tradeType; if (UserLoginType.MP_WEIXIN.getCode() == loginType) { appId = unimallWxAppProperties.getMiniAppId(); tradeType = WxPayConstants.TradeType.JSAPI; } else if (UserLoginType.APP_WEIXIN.getCode() == loginType || UserLoginType.REGISTER.getCode() == loginType) { appId = unimallWxAppProperties.getAppId(); tradeType = WxPayConstants.TradeType.APP; } else if (UserLoginType.H5_WEIXIN.getCode() == loginType) { appId = unimallWxAppProperties.getH5AppId(); tradeType = WxPayConstants.TradeType.JSAPI; } else { throw new AppServiceException(ExceptionDefinition.ORDER_LOGIN_TYPE_NOT_SUPPORT_WXPAY); } try { WxPayUnifiedOrderRequest orderRequest = new WxPayUnifiedOrderRequest(); // 设置微信请求基本信息 orderRequest.setAppid(appId); // 区分回调 直接通过 S 来判断 orderRequest.setOutTradeNo(StringUtils.isEmpty(parentOrderNo) ? orderNo : parentOrderNo); orderRequest.setOpenid(SessionUtil.getUser().getOpenId()); orderRequest.setBody("buy_" + (StringUtils.isEmpty(parentOrderNo) ? orderNo : parentOrderNo)); orderRequest.setTotalFee(actualPrice); orderRequest.setSpbillCreateIp(ip); orderRequest.setTradeType(tradeType); return wxPayService.createOrder(orderRequest); } catch (WxPayException e) { logger.error("[微信支付] 异常", e); throw new AppServiceException(e.getErrCodeDes(), ExceptionDefinition.THIRD_PART_SERVICE_EXCEPTION.getCode()); } catch (Exception e) { logger.error("[预付款异常]", e); throw new AppServiceException(ExceptionDefinition.ORDER_UNKNOWN_EXCEPTION); } } private int checkPrepay(String parentOrderNo, String orderNo, Long userId) throws ServiceException { // 两个都为空 和 两个都不为空是不合法的 if ((StringUtils.isEmpty(parentOrderNo) && StringUtils.isEmpty(orderNo)) || (!StringUtils.isEmpty(parentOrderNo) && !StringUtils.isEmpty(orderNo))) { throw new AppServiceException(ExceptionDefinition.ORDER_PARAM_CHECK_FAILED); } List<OrderDO> orderList; if (!StringUtils.isEmpty(parentOrderNo)) orderList = orderBizService.checkOrderExistByParentNo(parentOrderNo, userId); else orderList = orderBizService.checkOrderExistByNo(orderNo, userId); // 检测订单状态 int actualPrice = 0; for (OrderDO orderDO : orderList) { Integer status = orderDO.getStatus(); if (status != OrderStatusType.UNPAY.getCode()) { throw new AppServiceException(ExceptionDefinition.ORDER_STATUS_NOT_SUPPORT_PAY); } actualPrice += orderDO.getActualPrice(); } return actualPrice; } @Override @Transactional(rollbackFor = Exception.class) public Object offlinePrepay(String parentOrderNo, String orderNo, Long userId) throws ServiceException { // 两个都为空 和 两个都不为空是不合法的 if ((StringUtils.isEmpty(parentOrderNo) && StringUtils.isEmpty(orderNo)) || (!StringUtils.isEmpty(parentOrderNo) && !StringUtils.isEmpty(orderNo))) { throw new AppServiceException(ExceptionDefinition.ORDER_PARAM_CHECK_FAILED); } List<OrderDO> orderList; if (!StringUtils.isEmpty(parentOrderNo)) orderList = orderBizService.checkOrderExistByParentNo(parentOrderNo, userId); else orderList = orderBizService.checkOrderExistByNo(orderNo, userId); // 检测订单状态 for (OrderDO orderDO : orderList) { Integer status = orderDO.getStatus(); if (status != OrderStatusType.UNPAY.getCode()) { throw new AppServiceException(ExceptionDefinition.ORDER_STATUS_NOT_SUPPORT_PAY); } } Date now = new Date(); for (OrderDO orderDO : orderList) { List<OrderSkuDO> orderSkuDOList = orderSkuMapper.selectList(new QueryWrapper<OrderSkuDO>().eq("order_id", orderDO.getId())); List<OrderSkuDO> groupShopSkuList = orderSkuDOList.stream().filter(item -> (item.getActivityType() != null && item.getActivityType() == SpuActivityType.GROUP_SHOP.getCode())).collect(Collectors.toList()); if (groupShopSkuList.size() > 0) { // 订单中是否是团购商品 OrderDO groupShopUpdateDO = new OrderDO(); groupShopUpdateDO.setPayId("OFFLINE"); groupShopUpdateDO.setPayChannel(PayChannelType.OFFLINE.getCode()); groupShopUpdateDO.setPayPrice(orderDO.getActualPrice()); groupShopUpdateDO.setGmtPay(now); groupShopUpdateDO.setGmtUpdate(now); groupShopUpdateDO.setStatus(OrderStatusType.GROUP_SHOP_WAIT.getCode()); groupShopUpdateDO.setSubPay(1); // 增加buyer count for (OrderSkuDO orderSkuDO : groupShopSkuList) { groupShopBizService.incGroupShopNum(orderSkuDO.getActivityId(), orderSkuDO.getNum()); } orderBizService.changeOrderSubStatus(orderDO.getOrderNo(), OrderStatusType.UNPAY.getCode(), groupShopUpdateDO); } else { OrderDO updateOrderDO = new OrderDO(); updateOrderDO.setPayChannel(PayChannelType.OFFLINE.getCode()); updateOrderDO.setStatus(OrderStatusType.WAIT_STOCK.getCode()); updateOrderDO.setGmtUpdate(new Date()); boolean succ = orderBizService.changeOrderSubStatus(orderDO.getOrderNo(), OrderStatusType.UNPAY.getCode(), updateOrderDO); if (!succ) { throw new AppServiceException(ExceptionDefinition.ORDER_STATUS_CHANGE_FAILED); } } // 增加商品销量 Map<Long, Integer> salesMap = orderSkuDOList.stream().collect(Collectors.toMap(OrderSkuDO::getSpuId, OrderSkuDO::getNum, (k1, k2) -> k1.intValue() + k2.intValue())); productBizService.incSpuSales(salesMap); } // 删除自动取消订单消息 delayedMessageQueue.deleteTask(DMQHandlerType.ORDER_AUTO_CANCEL.getCode(), orderNo); return "ok"; } @Override @Transactional(rollbackFor = Exception.class) public String refund(String orderNo, String reason, Long userId) throws ServiceException { OrderDO orderDO = orderBizService.checkOrderExistByNo(orderNo, userId).get(0); if (PayChannelType.OFFLINE.getCode().equals(orderDO.getPayChannel())) { throw new AppServiceException(ExceptionDefinition.ORDER_PAY_CHANNEL_NOT_SUPPORT_REFUND); } if (OrderStatusType.refundable(orderDO.getStatus())) { OrderDO updateOrderDO = new OrderDO(); updateOrderDO.setRefundReason(reason); updateOrderDO.setStatus(OrderStatusType.REFUNDING.getCode()); orderBizService.changeOrderSubStatus(orderNo, orderDO.getStatus(), updateOrderDO); GlobalExecutor.execute(() -> { OrderDTO orderDTO = new OrderDTO(); BeanUtils.copyProperties(orderDO, orderDTO); List<OrderSkuDO> orderSkuList = orderSkuMapper.selectList(new QueryWrapper<OrderSkuDO>().eq("order_no", orderDO.getOrderNo())); orderDTO.setSkuList(orderSkuList); adminNotifyBizService.refundOrder(orderDTO); }); return "ok"; } throw new AppServiceException(ExceptionDefinition.ORDER_STATUS_NOT_SUPPORT_REFUND); } @Override @Transactional(rollbackFor = Exception.class) public String cancel(String orderNo, Long userId) throws ServiceException { OrderDO orderDO = orderBizService.checkOrderExistByNo(orderNo, userId).get(0); if (orderDO.getStatus() != OrderStatusType.UNPAY.getCode()) { throw new AppServiceException(ExceptionDefinition.ORDER_STATUS_NOT_SUPPORT_CANCEL); } OrderDO updateOrderDO = new OrderDO(); updateOrderDO.setStatus(OrderStatusType.CANCELED.getCode()); updateOrderDO.setGmtUpdate(new Date()); List<OrderSkuDO> orderSkuList = orderSkuMapper.selectList(new QueryWrapper<OrderSkuDO>().eq("order_id", orderDO.getId())); orderSkuList.forEach(item -> { skuMapper.returnSkuStock(item.getSkuId(), item.getNum()); }); orderBizService.changeOrderSubStatus(orderNo, OrderStatusType.UNPAY.getCode(), updateOrderDO); delayedMessageQueue.deleteTask(DMQHandlerType.ORDER_AUTO_CANCEL.getCode(), orderNo); return "ok"; } @Override @Transactional(rollbackFor = Exception.class) public String confirm(String orderNo, Long userId) throws ServiceException { OrderDO orderDO = orderBizService.checkOrderExistByNo(orderNo, userId).get(0); if (orderDO.getStatus() != OrderStatusType.WAIT_CONFIRM.getCode()) { throw new AppServiceException(ExceptionDefinition.ORDER_STATUS_NOT_SUPPORT_CONFIRM); } OrderDO updateOrderDO = new OrderDO(); updateOrderDO.setStatus(OrderStatusType.WAIT_APPRAISE.getCode()); updateOrderDO.setGmtUpdate(new Date()); orderBizService.changeOrderSubStatus(orderNo, OrderStatusType.WAIT_CONFIRM.getCode(), updateOrderDO); delayedMessageQueue.deleteTask(DMQHandlerType.ORDER_AUTO_CONFIRM.getCode(), orderNo); return "ok"; } @Override public ShipTraceDTO queryShip(String orderNo, Long userId) throws ServiceException { OrderDO orderDO = orderBizService.checkOrderExistByNo(orderNo, userId).get(0); if (orderDO.getStatus() < OrderStatusType.WAIT_CONFIRM.getCode()) { throw new AppServiceException(ExceptionDefinition.ORDER_HAS_NOT_SHIP); } if (StringUtils.isEmpty(orderDO.getShipCode()) || StringUtils.isEmpty(orderDO.getShipNo())) { throw new AppServiceException(ExceptionDefinition.ORDER_DID_NOT_SET_SHIP); } ShipTraceDTO shipTraceList = freightTemplateBizService.getShipTraceList(orderDO.getShipNo(), orderDO.getShipCode()); if (CollectionUtils.isEmpty(shipTraceList.getTraces())) { throw new AppServiceException(ExceptionDefinition.ORDER_DO_NOT_EXIST_SHIP_TRACE); } return shipTraceList; } @Override public Integer previewFreight(OrderRequestDTO orderRequest, Long userId) throws ServiceException { List<OrderRequestSkuDTO> skuList = orderRequest.getSkuList(); AddressDO addressDO = null; if (orderRequest.getAddressId() != null) { addressDO = addressBizService.getAddressById(orderRequest.getAddressId()); } FreightCalcModel calcModel = new FreightCalcModel(); if (addressDO == null) { // 若没穿省份,则传一个不存在的省份。系统会默认他是全国。 calcModel.setProvince("一个不存在的地址"); } else { calcModel.setProvince(addressDO.getProvince()); } // 由于是预览,此处可详细用户从前端传入进来的 商品运费模板Id 重量 价格等信息 UserDTO user = SessionUtil.getUser(); // 将SKU按照运费模板分组 Map<Long, List<OrderRequestSkuDTO>> calcMap = skuList.stream().collect(Collectors.groupingBy(OrderRequestSkuDTO::getFreightTemplateId)); List<FreightCalcModel.FreightAndWeight> faws = new LinkedList<>(); calcMap.forEach((k, v) -> { FreightCalcModel.FreightAndWeight faw = new FreightCalcModel.FreightAndWeight(); faw.setId(k); int weight = 0; int price = 0; for (OrderRequestSkuDTO skuDTO : v) { weight += skuDTO.getWeight() * skuDTO.getNum(); price += (user.getLevel() == UserLevelType.VIP.getCode() ? skuDTO.getVipPrice() : skuDTO.getPrice()) * skuDTO.getNum(); } faw.setWeight(weight); faw.setPrice(price); faws.add(faw); }); calcModel.setFreightAndWeights(faws); int sum = freightTemplateBizService.computePostage(calcModel); return sum; } /** * 保存订单抽取接口 * * @param skuOriginalPrice * @param skuPrice * @param channel * @param freightPrice * @param couponUserDTO * @param orderRequest * @param parentOrderNo * @param childIndex * @param userId * @param now * @param addressDO * @param skuDTOList * @param orderCalcSkuList * @param userLevel * @param activityType * @param activityId * @return * @throws ServiceException */ private OrderDO save(int skuOriginalPrice, int skuPrice, String channel, int freightPrice, CouponUserDTO couponUserDTO, OrderRequestDTO orderRequest, String parentOrderNo, int childIndex, Long userId, Date now, AddressDO addressDO, List<SkuDTO> skuDTOList, List<OrderCalcSkuModel> orderCalcSkuList, Integer userLevel, Integer activityType, Long activityId) throws ServiceException { OrderDO orderDO = new OrderDO(); // 设置商品原价,总价 orderDO.setSkuOriginalTotalPrice(skuOriginalPrice); orderDO.setSkuTotalPrice(skuPrice); // 下单渠道 orderDO.setChannel(channel); // 计算订单价格 orderDO.setFreightPrice(freightPrice); // 计算订单优惠券价格 int couponPrice = 0; if (couponUserDTO != null) { couponPrice = couponUserDTO.getDiscount(); // 这里根据实际情况决定是否需要将邮费加入到优惠券计算中 if (couponUserDTO.getMin() > skuPrice) { throw new AppServiceException(ExceptionDefinition.ORDER_COUPON_PRICE_NOT_ENOUGH); } } orderDO.setCouponPrice(couponPrice); orderDO.setActualPrice(skuPrice + freightPrice - couponPrice); orderDO.setMono(orderRequest.getMono()); orderDO.setParentOrderNo(parentOrderNo); orderDO.setOrderNo(parentOrderNo + "S" + (1000 + childIndex)); orderDO.setUserId(userId); orderDO.setStatus(OrderStatusType.UNPAY.getCode()); orderDO.setGmtUpdate(now); orderDO.setGmtCreate(now); if (!userId.equals(addressDO.getUserId())) { throw new AppServiceException(ExceptionDefinition.ORDER_ADDRESS_NOT_BELONGS_TO_YOU); } orderDO.setConsignee(addressDO.getConsignee()); orderDO.setPhone(addressDO.getPhone()); orderDO.setProvince(addressDO.getProvince()); orderDO.setCity(addressDO.getCity()); orderDO.setCounty(addressDO.getCounty()); orderDO.setAddress(addressDO.getAddress()); // 冗余一个团购信息 if (activityType != null && activityType == SpuActivityType.GROUP_SHOP.getCode()) { orderDO.setGroupShopId(activityId); } orderMapper.insert(orderDO); for (int i = 0; i < skuDTOList.size(); i++) { OrderCalcSkuModel orderCalcSpuDTO = orderCalcSkuList.get(i); SkuDTO skuDTO = skuDTOList.get(i); Assert.isTrue(orderCalcSpuDTO.getSkuId().longValue() == skuDTO.getId().longValue(), "断言失败!"); OrderSkuDO orderSkuDO = new OrderSkuDO(); orderSkuDO.setBarCode(skuDTO.getBarCode()); orderSkuDO.setTitle(skuDTO.getTitle()); orderSkuDO.setUnit(skuDTO.getUnit()); orderSkuDO.setSpuTitle(skuDTO.getSpuTitle()); orderSkuDO.setImg(skuDTO.getImg() == null ? skuDTO.getSpuImg() : skuDTO.getImg()); orderSkuDO.setNum(orderCalcSpuDTO.getNum()); orderSkuDO.setOriginalPrice(skuDTO.getOriginalPrice()); orderSkuDO.setPrice(skuDTO.getPrice()); if (userLevel == UserLevelType.VIP.getCode()) { orderSkuDO.setPrice(skuDTO.getVipPrice()); } else { orderSkuDO.setPrice(skuDTO.getPrice()); } orderSkuDO.setSkuId(skuDTO.getId()); orderSkuDO.setSpuId(skuDTO.getSpuId()); orderSkuDO.setOrderNo(orderDO.getOrderNo()); orderSkuDO.setOrderId(orderDO.getId()); orderSkuDO.setGmtCreate(now); orderSkuDO.setGmtUpdate(now); // 考虑到有的活动又不需要拆单,所以这里活动就只能关联到订单商品。也就是商品参加促销活动,而非订单参加。 orderSkuDO.setActivityType(activityType); orderSkuDO.setActivityId(activityId); orderSkuMapper.insert(orderSkuDO); } return orderDO; } }
[ "1442916269@qq.com" ]
1442916269@qq.com
5ba502d4568f7429539d70c71bd00cca78a1a3a9
1dbd2f1f229ad79dafee7228f3af42e4c52a385d
/CollateralLoanRiskManagementProject/loan-management/src/main/java/com/cts/training/feign/CollateralFeign.java
102ceec0d99ff9e12835b284064c940a0c794834
[]
no_license
SunmeetOberoi/Enhancement-Project
81d45ae6e246f51ac033f8be1e981f4f978e9a9f
bbb104a69c2c2719b3ff9c354c2ccbda5c3ec7e1
refs/heads/main
2023-06-05T19:13:28.194491
2021-07-05T14:26:43
2021-07-05T14:26:43
383,167,166
0
0
null
null
null
null
UTF-8
Java
false
false
1,155
java
package com.cts.training.feign; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestHeader; import com.cts.training.pojo.CashDeposit; import com.cts.training.pojo.RealEstate; /** * Collateral Feign used for connection with collateral management */ @FeignClient(name = "collateral-management", url = "http://localhost:8000/collateral") public interface CollateralFeign { /** * For accessing the saveRealEstateCollateral * * @param token * @param re * @return */ @PostMapping("/realEstate") public ResponseEntity<String> saveRealEstateCollateral(@RequestHeader(name = "Authorization") String token, @RequestBody RealEstate re); /** * For Accessing SaveCashDepositCollateral * * @param token * @param cd * @return */ @PostMapping("/cashDeposit") public ResponseEntity<String> saveCashDepositCollateral(@RequestHeader(name = "Authorization") String token, @RequestBody CashDeposit cd); }
[ "sunmeet.oberoi@gmail.com" ]
sunmeet.oberoi@gmail.com
b1ba1ffb36f907021c60196f09518f06ed47c7f3
83e81c25b1f74f88ed0f723afc5d3f83e7d05da8
/tools/powermodel/src/com/android/powermodel/ComponentActivity.java
407f9f8271af918cbc88e2975f1cc523d0ff3e07
[ "Apache-2.0", "LicenseRef-scancode-unicode" ]
permissive
Ankits-lab/frameworks_base
8a63f39a79965c87a84e80550926327dcafb40b7
150a9240e5a11cd5ebc9bb0832ce30e9c23f376a
refs/heads/main
2023-02-06T03:57:44.893590
2020-11-14T09:13:40
2020-11-14T09:13:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,563
java
/* * Copyright (C) 2018 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.powermodel; /** * Encapsulates the work done by an app (including synthetic apps) that costs power. */ public class ComponentActivity { public AttributionKey attribution; protected ComponentActivity(AttributionKey attribution) { this.attribution = attribution; } // TODO: Can we refactor what goes into the activities so this function // doesn't need the global state? /** * Apply the power profile for this component. Subclasses should implement this * to do the per-component calculatinos. The default implementation returns null. * If this method returns null, then there will be no power associated for this * component, which, for example is true with some of the GLOBAL activities. */ public ComponentPower applyProfile(ActivityReport activityReport, PowerProfile profile) { return null; } }
[ "keneankit01@gmail.com" ]
keneankit01@gmail.com
e53c60cec6199369ccdf79f92083ff3cc4c12ff7
95c2e2f8586870ff4da8540b96ed53ae7001acd9
/src/org/usfirst/frc/team6851/robot/commands/vision/VisionFilterConfiguration.java
237de72e80d5286ddee3f12a5200346b47d5996d
[]
no_license
Dracir/NoRioVision
8d32b33b22572b429b74b37943697fb7e0b5e0ed
143d90bf8417d4c64a9fc9308513eae55b2af717
refs/heads/master
2021-09-03T05:55:34.890469
2018-01-06T03:28:31
2018-01-06T03:28:31
116,165,073
0
0
null
null
null
null
UTF-8
Java
false
false
1,140
java
package org.usfirst.frc.team6851.robot.commands.vision; import org.opencv.core.Size; import org.usfirst.frc.team6851.robot.utils.Range; public class VisionFilterConfiguration { //The size to work on, the smaller the faster but also less precise public Size workingImageSize = new Size(320,240); //HSV //lunette //public Range hueRange = new Range(0,12); //public Range saturationRange = new Range(80,255); //public Range valueRange = new Range(50,255); //Cehveux public Range hueRange = new Range(43,63); public Range saturationRange = new Range(44,99); public Range valueRange = new Range(155,255); //blur public Range blur = new Range(4, 4); public boolean externalContourOnly = true; //filter contours public Range targetWidth = new Range(23,1000); public Range targetHeight = new Range(10,1000); public Range targetPerimeter = new Range(0,1000); public Range targetArea = new Range(0,10000); public Range targetSolidity = new Range(0,100); public Range targetVertexCount = new Range(4, 100000); public Range targetRatio = new Range(0, 100); public long msInterval; // 4 times per second }
[ "Rail.rich@gmail.com" ]
Rail.rich@gmail.com
5fbc5f7dc9822e30351c19393743997176e51dc1
19a9a527c5a5377a6bc06e6112f9158793c7151d
/app/src/main/java/com/geekstorming/storymapper/adapters/FactionAdapter.java
a2bffe90c89a614e7c29851648562b1885acb57b
[]
no_license
Beelzenef/storyMapper
f8201fdc177ad334081d785ad4b817b823c21eb6
dd350d01a06f8d4d882b2f52987b738d0b554463
refs/heads/master
2021-05-08T02:56:11.634735
2018-04-19T09:08:51
2018-04-19T09:08:51
108,099,009
4
1
null
null
null
null
UTF-8
Java
false
false
2,092
java
package com.geekstorming.storymapper.adapters; import android.content.Context; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; import com.geekstorming.storymapper.R; import com.geekstorming.storymapper.data.pojo.Book; import com.geekstorming.storymapper.data.pojo.Faction; import com.geekstorming.storymapper.data.repos.FactionRepository; import com.github.ivbaranov.mli.MaterialLetterIcon; /** * Faction Adapter * @author Elena Guzman Blanco (Beelzenef) - 3d10Mundos */ public class FactionAdapter extends ArrayAdapter<Faction> { public FactionAdapter(@NonNull Context context, Book book) { super(context, R.layout.item_faction, FactionRepository.getInstance().getFactions(book)); } @NonNull @Override public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) { FactionHolder factionHolder; View view = convertView; if (view == null) { LayoutInflater inflador = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); // Inflate views view = inflador.inflate(R.layout.item_faction, null); factionHolder = new FactionHolder(); // Get views from layout factionHolder.txtV_FactionName = (TextView) view.findViewById(R.id.txtV_FactionName); factionHolder.FactionIcon = (MaterialLetterIcon) view.findViewById(R.id.materialLetterIcon); view.setTag(factionHolder); } else { factionHolder = (FactionHolder) view.getTag(); } factionHolder.txtV_FactionName.setText(getItem(position).getFactionName()); factionHolder.FactionIcon.setLetter(getItem(position).getFactionName().substring(0, 1)); return view; } class FactionHolder { MaterialLetterIcon FactionIcon; TextView txtV_FactionName; } }
[ "elena.guzbla@gmail.com" ]
elena.guzbla@gmail.com
74319ef281da2e8b0f2dfb6cb4bbc0026e88b66d
52c1a1454b2f5f798f7e3f6c7c155ddf23cb7bd1
/app/src/main/java/com/cxmedia/goods/MVP/view/ICustomerView.java
8dc3188e4d2c94a8263401b4ce50c47ca4eb8166
[]
no_license
Swordce/Code
14e3bdc0531543eec6ebd181405f59e5a788e667
7002d0ac6d9e4bc1cfe7705953293b26355c1a9b
refs/heads/master
2020-07-10T00:16:56.545025
2019-10-08T02:02:34
2019-10-08T02:02:34
204,117,234
1
0
null
null
null
null
UTF-8
Java
false
false
535
java
package com.cxmedia.goods.MVP.view; import com.cxmedia.goods.MVP.IBaseView; import com.cxmedia.goods.MVP.model.CustomerListResult; import com.cxmedia.goods.MVP.presenter.CustomerPresenter; import java.util.List; public interface ICustomerView extends IBaseView<CustomerPresenter> { void addCustomerResult(String result); void editCustomerResult(String result); void deleteCustomerResult(String result); void customerListResult(List<CustomerListResult.ListBean> result); void customerErrorResult(String error); }
[ "wenjiexi0814@gmail.com" ]
wenjiexi0814@gmail.com
39e933ee7e77f3b7c095bb63c34ff17a749b2bf9
cc77367ecf97b96e5e13925ad01e70113696d67c
/app/src/main/java/com/example/kingsoft/aldllibs/User.java
5284ca45a2c2f100514b4b999b7c4dd86f01df35
[]
no_license
qiubowang/example
619262c97eabd8b472035dab419cb98d1de58019
f586c88d349ffe244de16d80d6994b3b99e15549
refs/heads/master
2021-01-19T23:57:30.915991
2017-08-31T06:39:53
2017-08-31T06:39:53
89,056,544
0
0
null
null
null
null
UTF-8
Java
false
false
1,092
java
package com.example.kingsoft.aldllibs; import android.os.Parcel; import android.os.Parcelable; /** * Created by kingsoft on 2017/6/19. */ public class User implements Parcelable { private String mName; private int mAge; private String mAddress; private String mSex; public User(){}; public User(Parcel parcelIn){ mName = parcelIn.readString(); mAge = parcelIn.readInt(); mAddress = parcelIn.readString(); mSex = parcelIn.readString(); } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel parcel, int i) { parcel.writeString(mName); parcel.writeInt(mAge); parcel.writeString(mAddress); parcel.writeString(mSex); } public final static Creator<User> CREATOR = new Creator<User>() { @Override public User createFromParcel(Parcel parcel) { return new User(parcel); } @Override public User[] newArray(int i) { return new User[0]; } }; }
[ "wangqiubo@kingsoft.com" ]
wangqiubo@kingsoft.com
c539cdec1774aa4ef7b35b2b8be6461667c021d3
466af98a059b5cbe0f6264accbdcebc055bdbf28
/src/main/java/com/talkingdata/sdmk/design/pattern/adapterpattern/AudioPlayer.java
64a66a9b34734acce323857e0dc871b00561b3c6
[]
no_license
1242157902/springbootStudy
691e13fa959c57e13d01725de7593b0e4266a312
768c393d0f8b10e2e0377aef2c8ce720f61cd1e3
refs/heads/master
2020-04-15T14:53:56.356388
2019-01-09T06:31:48
2019-01-09T06:31:48
164,772,254
0
0
null
null
null
null
UTF-8
Java
false
false
702
java
package com.talkingdata.sdmk.design.pattern.adapterpattern; /** * User: ysl * Date: 2017/12/26 * Time: 20:04 */ public class AudioPlayer implements MediaPlayer { MediaAdapter mediaAdapter; @Override public void pay(String audioType, String fileName) { if(audioType.equals("mp3")){ System.out.println("Playing mp3 file.Name: " + fileName); }else if(audioType.equalsIgnoreCase("vlc") || audioType.equalsIgnoreCase("mp4")){ mediaAdapter = new MediaAdapter(audioType); mediaAdapter.pay(audioType,fileName); }else{ System.out.println("Invlid media." + audioType + " format not support"); } } }
[ "shuangliang.yang@tendcloud.com" ]
shuangliang.yang@tendcloud.com
5cdb72577d65490b64bcf0900c9c971d05108ac2
6faabcf12a0793aa6437d2247822d1d5acd09beb
/app/src/main/java/id/stemi/pemuda/SplashActivity.java
77c414212290da27dd39500e03d355e7ab4917a3
[]
no_license
rolandokaizer/stemi-indo
2bb8b854aabcde983557d4bb17b594c7a2633650
c8c8620edb4374e1c20a55061c4a4e9022dc6b01
refs/heads/master
2021-01-22T18:58:00.680806
2017-03-16T01:42:36
2017-03-16T01:42:36
85,138,607
0
0
null
null
null
null
UTF-8
Java
false
false
332
java
package id.stemi.pemuda; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class SplashActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); } }
[ "asdjkl" ]
asdjkl
22d8d94fec27b7051dc1e853e8508c4c7821cd85
86d5c74347ee4c65fd3c8292866f2cedd40d9409
/testCorejava/src/com/test/corejava/testingDate.java
aa3f2dc9a90ea3ee78d11ec71382ec7dbade4360
[]
no_license
saurabhbamity/localproject
1f531a3bd0de08c69ace446768d25c8e896f85b6
6cb523388fa7face34597b3d752ae02f18b090b4
refs/heads/master
2022-12-27T15:33:03.240696
2019-11-27T07:13:19
2019-11-27T07:13:19
224,218,068
0
0
null
2022-12-16T04:43:49
2019-11-26T14:58:07
Roff
UTF-8
Java
false
false
1,240
java
package com.test.corejava; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; import javax.xml.datatype.DatatypeConstants; import javax.xml.datatype.DatatypeFactory; import javax.xml.datatype.XMLGregorianCalendar; public class testingDate { public static void main(String[] args) { try{ Date dob = null; DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); dob = df.parse("1941-09-30 23:10:08"); GregorianCalendar cal = new GregorianCalendar(); cal.setTime(dob); XMLGregorianCalendar xmlDate3 = DatatypeFactory.newInstance().newXMLGregorianCalendar(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH)+1, cal.get(Calendar.DAY_OF_MONTH),dob.getHours(),dob.getMinutes(),dob.getSeconds(),DatatypeConstants.FIELD_UNDEFINED, DatatypeConstants.FIELD_UNDEFINED); System.out.println(xmlDate3); }catch(Exception e) { System.out.println("abc"); } } protected void gettest() throws ClassNotFoundException{ } } class A extends testingDate{ @Override protected void gettest() { } }
[ "saurabh.bhardwaj@irissoftware.com" ]
saurabh.bhardwaj@irissoftware.com
ceb7da2a3c1a5bb78ec8bf659a845033d68a2a61
ca018c6e8c8e3e969a1a9499da538392f859cd7f
/mobile/src/com/drone/trackme/serverCommunicator.java
2ef28999c9088e5e711cd52284513fb5203a1730
[]
no_license
mitio/TrackMe
a752bd950370391372a0707ebf693e075ca17a09
25e9726223fd4d926cc64c6af06b88db2cf89538
refs/heads/master
2016-09-06T00:02:00.782929
2010-07-02T13:25:15
2010-07-02T13:25:15
586,956
3
2
null
null
null
null
UTF-8
Java
false
false
3,776
java
package com.drone.trackme; import java.io.IOException; import java.io.InputStream; import java.util.List; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.StatusLine; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import com.drone.trackme.exceptions.*; /** * Represents a class that is used to send and receive data from server. * * @author miroslava.nikolova */ public class ServerCommunicator { /** * Receives data from server. * Executes http post request to server supplying a list of {@link NameValuePair} * and returns xml as an {@link InputStream} if status is OK. * If user provides wrong username and/or password, an {@link LoginException} is * thrown with an appropriate message. In case of status that is not OK, another * {@link LoginException} is thrown with error message. * * @author miroslava.nikolova * @param parameters list of {@link NameValuePair} that are sent to server * @param url url used to send data to server * @return * @throws ClientProtocolException if an client protocol exception occured * @throws IOException if an input or output exception occured * @throws LoginException if user provides wrong username and/or password * @see InputStream */ public static InputStream receiveDataFromServer(List<NameValuePair> parameters, String url) throws ClientProtocolException, IOException, LoginException { InputStream result = null; HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(url); httppost.setEntity(new UrlEncodedFormEntity(parameters)); // Execute HTTP Post Request HttpResponse response = httpclient.execute(httppost); //Header[] headers = response.getAllHeaders(); StatusLine status = response.getStatusLine(); int statusCode = status.getStatusCode(); //HttpEntity httpEntity = response.getEntity(); InputStream inputStream = response.getEntity().getContent(); if(statusCode == 200) { result = inputStream; } else if (statusCode == 401) { throw new LoginException("Wrong username and/or password."); } else { throw new LoginException("Oops! An error occured."); } return result; } /** * Sends data to server. * This method sends list of {@link NameValuePair} to server * and returns status code of executed request. * Http post request is executed. * * @author miroslava.nikolova * @param parameters list of {@link NameValuePair} that are sent to server * @param url url used to send data to server * @return status code of http request used to send data to server * @throws ClientProtocolException if an client protocol exception occured * @throws IOException if an input or output exception occured * @see NameValuePair */ public static int sendDataToServer(List<NameValuePair> parameters, String url) throws ClientProtocolException, IOException { HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(url); httppost.setEntity(new UrlEncodedFormEntity(parameters)); // Execute HTTP Post Request HttpResponse response = httpclient.execute(httppost); StatusLine status = response.getStatusLine(); int statusCode = status.getStatusCode(); return statusCode; } }
[ "wireman@gmail.com" ]
wireman@gmail.com
e515a18302686c89a6fc1191cce786e1238122c0
b3143b62fbc869674392b3f536b1876af0b2611f
/jsf-worker-parent/jsf-worker-service/src/main/java/com/ipd/jsf/worker/thread/onoff/IfaceOnoffStatAlarmWorker.java
1f377ad4091363f38d609346947a4c06c6f61afb
[ "Apache-2.0" ]
permissive
Mr-L7/jsf-core
6630b407caf9110906c005b2682d154da37d4bfd
90c8673b48ec5fd9349e4ef5ae3b214389a47f65
refs/heads/master
2020-03-18T23:26:17.617172
2017-12-14T05:52:55
2017-12-14T05:52:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,822
java
/** * Copyright 2004-2048 . * * 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.ipd.jsf.worker.thread.onoff; import java.util.Date; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; import java.util.concurrent.atomic.AtomicInteger; import com.ipd.jsf.worker.domain.JsfAlarmHistory; import com.ipd.jsf.worker.manager.AlarmManager; import com.ipd.jsf.worker.manager.SysParamManager; import com.ipd.jsf.worker.service.common.URL; import com.ipd.jsf.worker.service.common.cache.IfaceOnoffCache; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import com.ipd.jsf.common.enumtype.AlarmType; import com.ipd.jsf.worker.common.SingleWorker; import com.ipd.jsf.worker.util.WorkerAppConstant; /** * Title: <br> * * Description: 统计接口半小时内的上下线次数, 超过阀值的话,报警 * */ public class IfaceOnoffStatAlarmWorker extends SingleWorker{ private final static Logger logger = LoggerFactory.getLogger(IfaceOnoffStatAlarmWorker.class); private final int spaceInteval = 30 * 60; private int SAF_TRACELOG_THRESHOLD_KEY_VALUE; private int SAF_TRACELOG_THRESHOLD_KEY_IFVALUE; @Autowired SysParamManager sysParamManager; @Autowired AlarmManager alarmManager; private void checkTraceLogAlarm(){ try { //单个实例的上下线数量 SAF_TRACELOG_THRESHOLD_KEY_VALUE = Integer.parseInt(sysParamManager.findValueBykey(WorkerAppConstant.SAF_TRACELOG_THRESHOLD_KEY)); // 整个接口的上下线数量 SAF_TRACELOG_THRESHOLD_KEY_IFVALUE = Integer.parseInt(sysParamManager.findValueBykey(WorkerAppConstant.SAF_TRACELOG_THRESHOLD_IFKEY)); Map<String, AtomicInteger> map = null; synchronized (IfaceOnoffCache.traceLogChangeMap) { map = new HashMap<String, AtomicInteger>(IfaceOnoffCache.traceLogChangeMap); logger.info("上下线统计: {}", map.toString()); IfaceOnoffCache.traceLogChangeMap.clear(); } checkAlarmByNode(map); //实例上下线 checkAlarmByInterface(map); //接口上下线 } catch (Throwable e) { logger.error(e.getMessage(), e); } } private void checkAlarmByNode(Map<String, AtomicInteger> map) { for(Entry<String, AtomicInteger> entry : map.entrySet()){ URL url= URL.valueOf(entry.getKey()); Object[] objects = new Object[]{entry.getKey(), spaceInteval/60, entry.getValue().get()}; if(url.getParameter("isonline").equals("1")){ logger.info("上下线报警统计: {}在{}分钟内上线{}次", objects); }else { logger.info("上下线报警统计: {}在{}分钟内下线{}次", objects); } if(entry.getValue().get() >= SAF_TRACELOG_THRESHOLD_KEY_VALUE){ //TODO 功能开关 saveAlarm(url, entry.getValue().get()); } } } private void checkAlarmByInterface(Map<String, AtomicInteger> map) { Map<String, Integer> changeMap = new HashMap<String, Integer>(); for(Entry<String, AtomicInteger> entry : map.entrySet()){ URL url = URL.valueOf(entry.getKey()); Map<String, String> param = new HashMap<String, String>(); param.put("isprovider", String.valueOf(url.getParameter("isprovider"))); param.put("isonline", String.valueOf(url.getParameter("isonline"))); URL tmpUrl = new URL("tmp", "1.1.1.1", 0, url.getServiceInterface(), param); String key = tmpUrl.toFullString(); if(changeMap.get(key) == null){ changeMap.put(key, 1); }else { changeMap.put(key, changeMap.get(key) + 1); } } for(Entry<String, Integer> entry : changeMap.entrySet()){ URL url = URL.valueOf(entry.getKey()); Object[] objects = new Object[]{entry.getKey(), spaceInteval/60/1000, entry.getValue()}; if(url.getParameter("isonline").equals("1")){ logger.info("上下线报警统计: {}在{}分钟内上线{}次", objects); }else { logger.info("上下线报警统计: {}在{}分钟内下线{}次", objects); } if(entry.getValue() >= SAF_TRACELOG_THRESHOLD_KEY_IFVALUE){ //TODO 功能开关 saveAlarm(url, entry.getValue()); } } } private void saveAlarm(URL url, Integer value) { boolean isProvider = url.getParameter("isprovider").equals("1") ? true : false; boolean isOnline = url.getParameter("isonline").equals("1") ? true : false; String text = getAlarmText(url, value, isProvider, isOnline); try { JsfAlarmHistory alarmHistory = new JsfAlarmHistory(); alarmHistory.setAlarmKey(WorkerAppConstant.SAF_ONOFF_STAT_ALARMKEY); alarmHistory.setErps(sysParamManager.findValueBykey(WorkerAppConstant.ALARM_ADMIN_ADDRESS)); alarmHistory.setIsAlarmed((byte)0); alarmHistory.setCreateTime(new Date()); alarmHistory.setContent(text); alarmHistory.setAlarmType((byte)AlarmType.IFACEONOFFSTAT.getValue()); alarmManager.insert(alarmHistory); } catch (Exception e) { logger.error(e.getMessage(), e); } } private String getAlarmText(URL url, long value, boolean isProvider, boolean isOnline) { String onlineTag = isOnline ? "上线" : "下线"; String interfaceName = url.getServiceInterface(); interfaceName = interfaceName.substring(interfaceName.lastIndexOf(".")+1); String protocol = url.getProtocol(); StringBuilder sb = new StringBuilder("[JSF]"); String tag = null; if (protocol.equals("tmp")) { if (isProvider) { tag = "提供端"; } else { tag = "调用端"; } } else { String host = url.getHost(); int port = url.getPort(); if (isProvider) { tag = "提供端, 服务器:" + host + ",端口:" + port; } else { tag = "调用端, 服务器:" + host; } } sb.append(interfaceName).append("在").append(spaceInteval / 60) .append("分钟内").append(onlineTag).append("次数为:").append(value) .append(",").append(tag); return sb.toString(); } @Override public boolean run() { try { //TODO 如何控制开关? checkTraceLogAlarm(); return true; } catch (Exception e) { logger.error("上下线统计worker异常:"+e.getMessage(), e); return false; } } @Override public String getWorkerType() { return "ifaceOnoffStatAlarmWorker"; } }
[ "yangzhiwei@jd.com" ]
yangzhiwei@jd.com
0eed2118776aaaa3e209084f3f4b44accedf6c02
104e2c4d340ff920f591538bf9082fc705c059af
/upload_프레임워크_게시물/src/main/java/com/celab/toilet/view/ViewController.java
004c8e23b1c95efc20b9caf5635693b4058f45d0
[]
no_license
hyun22/haha
9ee020192149713c483d5a2faa5da4e52ce35f1e
e6d07dbfaddc3d44fb72bc2e71e8816671b6d45c
refs/heads/master
2021-01-21T21:26:05.028094
2017-06-20T07:44:47
2017-06-20T07:44:47
94,839,773
0
0
null
null
null
null
UTF-8
Java
false
false
2,296
java
package com.celab.toilet.view; import java.util.ArrayList; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; import com.celab.toilet.info.toilet; import com.celab.toilet.service.toiletService; @Controller public class ViewController { @Autowired toiletService toiletService; @RequestMapping("지도") public ModelAndView 지도(){ ModelAndView ModelAndView =new ModelAndView(); ModelAndView.setViewName("게시물목록"); return ModelAndView; } @RequestMapping("화장실표시") public@ResponseBody ArrayList<toilet> 화장실표시( @RequestParam("Nlatitude") double Nlatitude,@RequestParam("Nlongitude") double Nlongitude, @RequestParam("Slatitude") double Slatitude,@RequestParam("Slongitude") double Slongitude){ ArrayList<toilet> 화장실정보들= toiletService.화장실들불러오다(Nlatitude,Nlongitude,Slatitude,Slongitude); return 화장실정보들; } @RequestMapping("화장실정보받다") public@ResponseBody toilet 화장실정보받다(@RequestParam("no") long no){ toilet 화장실1 =new toilet(); 화장실1.setNo(1); 화장실1.setTitle("왕십리황소곱창화장실"); 화장실1.setLatitude(37.566056407918865); 화장실1.setLongitude(127.03026118764767); toilet 화장실2 =new toilet(); 화장실2.setNo(2); 화장실2.setTitle("도로화장실"); 화장실2.setLatitude(37.56487608575024); 화장실2.setLongitude(127.03032862276235); toilet 화장실3 =new toilet(); 화장실3.setNo(3); 화장실3.setTitle("우체국화장실"); 화장실3.setLatitude(37.56643452460645); 화장실3.setLongitude(127.03141587835236); ArrayList<toilet> 화장실정보들=new ArrayList<toilet>(); 화장실정보들.add(화장실1); 화장실정보들.add(화장실2); 화장실정보들.add(화장실3); toilet 화장실=화장실정보들.get((int)no-1); return 화장실; } }
[ "wjdgus8534@naver.com" ]
wjdgus8534@naver.com
f52d1f8a9cf5e48813148295db18442108ebc6df
9a32b1a34769f7566fe092719cde48688bd1dbfe
/Ejercicios_Conceptos_Basicos/src/T6_Collections__Introduccion/UsoColecciones.java
345407613f3311d4e156b30b52eec456a3086108
[]
no_license
llbstudent/RepasoJava
f6c7a2d204c1fdbfe40baa69a60eae36dcd003d5
a53f24856277992f637e06c5ff0571bbd56f46af
refs/heads/main
2022-12-29T01:08:28.439220
2020-10-20T15:48:19
2020-10-20T15:48:19
300,390,911
0
0
null
null
null
null
ISO-8859-1
Java
false
false
2,493
java
package T6_Collections__Introduccion; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.ListIterator; public class UsoColecciones { public static void main(String[] args) { //Nos creamos las instancias //3 Novelas Novela n1 = new Novela(250, true, "El Valle sordo", 14, "Histórico-Drama"); Novela n2 = new Novela(180, false, "El gran Berlinski", 22, "Fantasía"); Novela n3 = new Novela(80, true, "Canción para un pingüino", 7, "Comedia"); //3 Tomos Tomo t1 = new Tomo(80, true, "Tekkenent", 2, 5); Tomo t2 = new Tomo(90, true, "Bakuto, el ninja", 10, 6); Tomo t3 = new Tomo(80, false, "Una Pieza de Pirata", 1000, 4); //--------------------- //List //--------------------- //----------- //ArrayList //----------- List librosLista = new ArrayList(); //Añadir elemntos: librosLista.add(t1); librosLista.add(t2); librosLista.add(t3); librosLista.add(n2); //Eliminar un elemento librosLista.remove(t1); //Vaciar el listado librosLista.clear(); //Tamaño de la lista int tam = librosLista.size(); //Convertir en Array: // Libro[] arrLibros = (Libro[]) librosLista.toArray(); //Nos dice si la lista está vacia o no boolean estaVacia = librosLista.isEmpty(); //----------- //LinkedList //----------- //A diferencia de ArrayList en LinkedList se pueden insertar elementos en muchos mas lugares: // add() Añade normal // addAll() Añade varios // add(i, objeto) Añade a el objeto en una posicion concreta 'i' // addFirst() Adds an item to the beginning of the list. // addLast() Add an item to the end of the list // removeFirst() Remove an item from the beginning of the list. // removeLast() Remove an item from the end of the list // getFirst() Get the item at the beginning of the list // getLast() Get the item at the end of the list //Tanto los ArrayList como los LinkedList se recorren con 'for' o con el listIterator System.out.println("Recorrer un LinkedList con ListIterator"); //Nos creamos el linkedList LinkedList<String> nombreAlumnos = new LinkedList<String>(); nombreAlumnos.add("Pedro"); nombreAlumnos.add("Elisa"); nombreAlumnos.add("Eva"); nombreAlumnos.addFirst("Laura"); nombreAlumnos.addLast("Israel"); ListIterator<String> listaIt = nombreAlumnos.listIterator(); while(listaIt.hasNext()) { System.out.println(listaIt.next()); } } }
[ "llucbue379@iesalmunia.com" ]
llucbue379@iesalmunia.com
df17d9fe25f8e99e6081112e93b37dfd34044357
5f7da95996c3a2caa501c798bb95e8c25378d5ad
/miru-sync-deployable/src/main/java/com/jivesoftware/os/miru/sync/deployable/MiruSyncSenderConfigProvider.java
3318f24fac7af4535e2dc1d447acd4ac3dacb3d4
[ "Apache-2.0" ]
permissive
jivesoftware/miru
7325f0b8ddc21a1bbb31a9854350fd665ef9c872
a23a6221d8b2b4287c13cdad2b3234a62b7eae53
refs/heads/master
2021-01-23T17:43:39.184716
2018-03-22T23:06:30
2018-03-22T23:06:30
22,760,763
12
10
Apache-2.0
2018-03-22T23:00:02
2014-08-08T14:39:01
Java
UTF-8
Java
false
false
303
java
package com.jivesoftware.os.miru.sync.deployable; import com.jivesoftware.os.miru.sync.api.MiruSyncSenderConfig; import java.util.Map; /** * Created by jonathan.colt on 12/22/16. */ public interface MiruSyncSenderConfigProvider { Map<String, MiruSyncSenderConfig> getAll() throws Exception; }
[ "jonathan.colt@jivesoftware.com" ]
jonathan.colt@jivesoftware.com
616f336c9717c91e8833062373b7f670f7b3d067
3cee0a4569e07a060c513aacfcf6131d042ae616
/app/src/androidTest/java/br/ufjf/ice/ex01/ExampleInstrumentedTest.java
69d4da565702fcabc7bf529b6de9b574a6ec714b
[]
no_license
ufjf-dcc196/dcc196-2018-3-exr01-jgabrielmaia
d2f4d18a2753bc24c3e61cf534356ec5f9e65105
1c7729984ab48a46baadbf06a14b51237d80d0f9
refs/heads/master
2020-03-28T13:40:00.974451
2018-09-15T01:43:14
2018-09-15T01:43:14
148,415,908
0
0
null
null
null
null
UTF-8
Java
false
false
716
java
package br.ufjf.ice.ex01; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("br.ufjf.ice.ex01", appContext.getPackageName()); } }
[ "jonagabriel@gmail.com" ]
jonagabriel@gmail.com
9aff3d86063fff09b8701fefce5f128255502ce6
28c17bce11196486c299c76a5c8a8db994b9542a
/hosted-api/src/test/java/ai/vespa/hosted/api/MultiPartStreamerTest.java
a55c0d91cd3471645d176229b14739559a0a77b7
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
ohad7/vespa
733ef8247e8dc4da9f297da762c3bc6d71661c18
ea65fbd5cf342cb2a79c2972727bf1d68bfef9fa
refs/heads/master
2020-05-01T01:50:40.819377
2019-11-21T14:41:40
2019-11-21T14:41:40
177,204,224
0
0
null
2019-03-22T20:20:25
2019-03-22T20:20:25
null
UTF-8
Java
false
false
2,817
java
// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package ai.vespa.hosted.api; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; import java.io.IOException; import java.net.URI; import java.net.http.HttpRequest; import java.nio.file.Files; import java.nio.file.Path; import java.util.List; import static org.junit.Assert.assertEquals; public class MultiPartStreamerTest { @Rule public TemporaryFolder tmp = new TemporaryFolder(); @Test public void test() throws IOException { Path file = tmp.newFile().toPath(); Files.write(file, new byte[]{0x48, 0x69}); MultiPartStreamer streamer = new MultiPartStreamer("My boundary"); assertEquals("--My boundary--", new String(streamer.data().readAllBytes())); streamer.addData("data", "uss/enterprise", "lore") .addJson("json", "{\"xml\":false}") .addText("text", "Hello!") .addFile("file", file); String expected = "--My boundary\r\n" + "Content-Disposition: form-data; name=\"data\"\r\n" + "Content-Type: uss/enterprise\r\n" + "\r\n" + "lore\r\n" + "--My boundary\r\n" + "Content-Disposition: form-data; name=\"json\"\r\n" + "Content-Type: application/json\r\n" + "\r\n" + "{\"xml\":false}\r\n" + "--My boundary\r\n" + "Content-Disposition: form-data; name=\"text\"\r\n" + "Content-Type: text/plain\r\n" + "\r\n" + "Hello!\r\n" + "--My boundary\r\n" + "Content-Disposition: form-data; name=\"file\"; filename=\"" + file.getFileName() + "\"\r\n" + "Content-Type: application/octet-stream\r\n" + "\r\n" + "Hi\r\n" + "--My boundary--"; assertEquals(expected, new String(streamer.data().readAllBytes())); // Verify that all data is read again for a new builder. assertEquals(expected, new String(streamer.data().readAllBytes())); assertEquals(List.of("multipart/form-data; boundary=My boundary; charset: utf-8"), streamer.streamTo(HttpRequest.newBuilder(), Method.POST) .uri(URI.create("https://uri/path")) .build().headers().allValues("Content-Type")); } }
[ "jvenstad@yahoo-inc.com" ]
jvenstad@yahoo-inc.com
be344c6ba974fd706f2fc41660aa041a572b1f57
214a725474e3f332d3a11d1eb07c505ed218e640
/work/Catalina/localhost/proj1/org/apache/jsp/JSPExample2_jsp.java
d37345d79091c03aa65b534ce75aa7851a6cde3c
[]
no_license
zturchan/391
efa7bc352671f9c42663eaa31e8ece60410a2ffe
15a34730c9f2eb970c50185f09bf5e4ab4844acf
refs/heads/master
2021-01-22T14:24:48.333714
2013-04-05T20:11:10
2013-04-05T20:11:10
8,660,190
1
0
null
null
null
null
UTF-8
Java
false
false
2,415
java
package org.apache.jsp; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; public final class JSPExample2_jsp extends org.apache.jasper.runtime.HttpJspBase implements org.apache.jasper.runtime.JspSourceDependent { private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory(); private static java.util.List _jspx_dependants; private javax.el.ExpressionFactory _el_expressionfactory; private org.apache.AnnotationProcessor _jsp_annotationprocessor; public Object getDependants() { return _jspx_dependants; } public void _jspInit() { _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory(); _jsp_annotationprocessor = (org.apache.AnnotationProcessor) getServletConfig().getServletContext().getAttribute(org.apache.AnnotationProcessor.class.getName()); } public void _jspDestroy() { } 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; out.write("<HTML> \n"); out.write(" <BODY> \n"); out.write("\tHello! The time is now \n"); out.write("\t"); out.print( new java.util.Date() ); out.write(" \n"); out.write(" </BODY> \n"); out.write("</HTML> "); } catch (Throwable t) { if (!(t instanceof SkipPageException)){ out = _jspx_out; if (out != null && out.getBufferSize() != 0) try { out.clearBuffer(); } catch (java.io.IOException e) {} if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); } } finally { _jspxFactory.releasePageContext(_jspx_page_context); } } }
[ "zturchan@ualberta.ca" ]
zturchan@ualberta.ca
c254f212b3a188d0594a8163dc21247f667cde1a
a71f66f5f83bcaa52d6392e0f5055b9726054535
/src/main/java/com/cafjo/carjo/api/cpanel/controller/PostController.java
63088fafabd103e94828a3774f4add91a0e0a7d9
[]
no_license
Carjo2020/CarJoApi
1a5fbae66f0db22bd0c39a5396e307364a776ade
43e5640a36762de65a92da86be8ead8df3a61302
refs/heads/master
2021-04-14T18:03:05.346956
2020-03-22T19:11:03
2020-03-22T19:11:03
249,253,078
0
0
null
null
null
null
UTF-8
Java
false
false
1,798
java
package com.cafjo.carjo.api.cpanel.controller; import com.cafjo.carjo.api.cpanel.service.PostService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import java.io.IOException; @CrossOrigin(maxAge = 3600) @RestController @RequestMapping("/cpanel/posts") public class PostController { @Autowired private PostService service; @PostMapping(value = "/add") public boolean addPost(@RequestParam(value = "title", required = false, defaultValue = "null") String title, @RequestParam(value = "id_category", required = false, defaultValue = "null") String id_category, @RequestParam(value = "post_id", required = false, defaultValue = "null") String post_id, @RequestParam(value = "text", required = false, defaultValue = "null") String text, @RequestParam(value = "url_picture", required = false, defaultValue = "null") String url_picture, @RequestParam(value = "url_video", required = false, defaultValue = "null") String url_video, @RequestParam(value = "file_picture", required = false) MultipartFile file_picture, @RequestParam(value = "file_video", required = false) MultipartFile file_video ) throws IOException { return service.addPost(post_id, title.replaceAll("'", "''"), id_category, text.replaceAll("'", "''"), url_picture, url_video, file_picture, file_video); } @DeleteMapping(value = "/delete/{post_id}") public boolean deletePost(@PathVariable String post_id) throws IOException { return service.deletePost(post_id); } }
[ "fuad-_-_-_-1997@hotmail.com" ]
fuad-_-_-_-1997@hotmail.com
ab279d3980d4427d75dc14d75b465442adf7ef96
53dc0aa257a60c2663b8743bca6da638901a113a
/beauty/src/main/java/cn/ouctechnology/oodb/beauty/util/BeanUtil.java
f5bda44aca82ee38f743f39ff10f1d3660004fac
[ "MIT" ]
permissive
youxiho1/beauty
8f9c488580e59a9d5ef151b1cb2ece08bb7c781d
e0afbcd0688f73c67525b43b9e94669b33ae2f75
refs/heads/master
2022-03-04T19:52:52.464077
2019-06-03T09:04:26
2019-06-03T09:04:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,082
java
package cn.ouctechnology.oodb.beauty.util; import cn.ouctechnology.oodb.beauty.cache.Cache; import cn.ouctechnology.oodb.beauty.exception.BeautifulException; import java.beans.BeanInfo; import java.beans.IntrospectionException; import java.beans.Introspector; import java.beans.PropertyDescriptor; import java.lang.reflect.*; import java.util.*; /** * @program: oodb * @author: ZQX * @create: 2018-11-13 21:28 * @description: TODO **/ public class BeanUtil { public static List<String> getColumnList(Object object, String parent) { Class<?> clz = object.getClass(); List<String> columnList = new ArrayList<>(); try { BeanInfo beanInfo = Introspector.getBeanInfo(clz); PropertyDescriptor[] pds = beanInfo.getPropertyDescriptors(); for (PropertyDescriptor pd : pds) { Class<?> propertyType = pd.getPropertyType(); Method writeMethod = pd.getWriteMethod(); if (writeMethod == null) continue; Method readMethod = pd.getReadMethod(); if (readMethod == null) continue; Object value = readMethod.invoke(object); //基本类型被null的bootstrap类加载器加载 if (propertyType.getClassLoader() != null) { if (value == null) value = propertyType.newInstance(); columnList.addAll(getColumnList(value, pd.getName() + ".")); } else { columnList.add(parent + pd.getName()); } } return columnList; } catch (IntrospectionException | InvocationTargetException | IllegalAccessException | InstantiationException e) { e.printStackTrace(); throw new BeautifulException(e); } } public static List<Object> getValueList(Object object) { Class<?> clz = object.getClass(); List<Object> valueList = new ArrayList<>(); try { BeanInfo beanInfo = Introspector.getBeanInfo(clz); PropertyDescriptor[] pds = beanInfo.getPropertyDescriptors(); for (PropertyDescriptor pd : pds) { Class<?> propertyType = pd.getPropertyType(); Method writeMethod = pd.getWriteMethod(); if (writeMethod == null) continue; Method readMethod = pd.getReadMethod(); if (readMethod == null) continue; Object value = readMethod.invoke(object); //基本类型被null的bootstrap类加载器加载 if (propertyType.getClassLoader() != null) { if (value == null) value = propertyType.newInstance(); valueList.addAll(getValueList(value)); } else if (propertyType == List.class) { String pdName = pd.getName(); Field field = clz.getDeclaredField(pdName); Type type = field.getGenericType(); if (type instanceof ParameterizedType) { ParameterizedType parameterizedType = (ParameterizedType) type; Class listClass = (Class) parameterizedType.getActualTypeArguments()[0]; if (listClass.getClassLoader() != null) { List mapList = (List) value; StringBuilder sb = new StringBuilder(); sb.append("["); String separator = ""; for (int i = 0; i < mapList.size(); i++) { Object obj = mapList.get(i); sb.append(separator); List<String> columns = getColumnList(obj, field.getName() + "." + i + "."); List<Object> values = getValueList(obj); sb.append("("); String subSeparator = ""; for (int j = 0; j < columns.size(); j++) { sb.append(subSeparator); String column = columns.get(j); Object subValue = values.get(j); sb.append(column).append(":"); sb.append(subValue.toString()); subSeparator = ","; } sb.append(")"); separator = ","; } sb.append("]"); valueList.add(sb.toString()); } else { valueList.add(value); } continue; } throw new BeautifulException("list type error"); } else { if (value instanceof String) { valueList.add("'" + value + "'"); } else { valueList.add(value); } } } return valueList; } catch (IntrospectionException | InvocationTargetException | IllegalAccessException | InstantiationException | NoSuchFieldException e) { e.printStackTrace(); throw new BeautifulException(e); } } /** * 多表查询不做缓存 */ public static String getTableNameFromSelect(String oql) { if (!oql.startsWith("select")) return null; if (oql.contains("join")) return null; int from = oql.indexOf("from"); oql = oql.substring(from + 5); int index = oql.indexOf(" "); String tableName = oql.substring(0, index); oql = oql.substring(index + 1); int where = oql.indexOf("where"); int limit = oql.indexOf("limit"); int order = oql.indexOf("order"); int group = oql.indexOf("group"); List<Integer> list = Arrays.asList(where, limit, order, group); Optional<Integer> min = list.stream().filter(l -> l != -1).min(Integer::compareTo); int minIndex = oql.length(); if (min.isPresent()) { minIndex = min.get(); } oql = oql.substring(0, minIndex); if (oql.contains(",")) return null; return tableName; } public static String getTableNameFromUpdate(String oql) { if (!oql.startsWith("update")) return null; oql = oql.substring(7); return oql.substring(0, oql.indexOf(" ")); } public static String getTableNameFromDelete(String oql) { if (!oql.startsWith("delete")) return null; int from = oql.indexOf("from"); oql = oql.substring(from + 5); int index = oql.indexOf(" "); return oql.substring(0, index); } public static String getTableNameFromInsert(String oql) { if (!oql.startsWith("insert")) return null; int from = oql.indexOf("into"); oql = oql.substring(from + 5); int index = oql.indexOf(" "); return oql.substring(0, index); } public static Object getFromCache(Cache<String, Map<String, Object>> cache, String tableName, String oql) { Map<String, Object> objectMap = cache.get(tableName); if (objectMap != null) { Object value = objectMap.get(oql); //一级缓存有直接返回 if (value != null) { return value; } } return null; } public static void putIntoCache(Cache<String, Map<String, Object>> cache, String tableName, String oql, Object response) { Map<String, Object> objectMap = cache.get(tableName); if (objectMap == null) { objectMap = new HashMap<>(); objectMap.put(oql, response); cache.put(tableName, objectMap); } else { objectMap.put(oql, response); } } }
[ "zhangqinxian@stu.ouc.edu.cn" ]
zhangqinxian@stu.ouc.edu.cn