blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
132 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
28 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
352
ebf821f973b2e6da6fbd8ba3b74f62937bb58f49
a704102454a6b30c441e2562296473ef634f720f
/codigo_gerado/ensinet/Educador.java
13036e00c605bb0d5efcbc3b8a8432f1dfdb01dd
[]
no_license
lucasg-mm/ensinet
98d358842f248eea90e7b1695b11033d66025a20
a15d9f42dc01dde6356d257c0ebc18526d8e7320
refs/heads/master
2023-02-05T05:25:38.798683
2020-12-30T18:57:33
2020-12-30T18:57:33
310,128,343
0
0
null
null
null
null
UTF-8
Java
false
false
1,104
java
package ensinet; import java.io.File; /** * @generated */ public class Educador extends Estudante { /** * @generated */ private Disciplina disciplina; /** * @generated */ private Set<Aula> aula; /** * @generated */ public Disciplina getDisciplina() { return this.disciplina; } /** * @generated */ public Disciplina setDisciplina(Disciplina disciplina) { this.disciplina = disciplina; } /** * @generated */ public Set<Aula> getAula() { if (this.aula == null) { this.aula = new HashSet<Aula>(); } return this.aula; } /** * @generated */ public Set<Aula> setAula(Aula aula) { this.aula = aula; } // Operations /** * @generated */ public int disponibilizarAula(String nomeDaAula, String descricao, File video, long idDisciplina) { //TODO return 0; } }
[ "lucasalternativo.lg@gmail.com" ]
lucasalternativo.lg@gmail.com
c428c49e3378581c9f1e1537995b6a3bfdce1d59
3d5998da8132ada28daccbcb7e27d578a36e8ad6
/src/main/java/com/financeiro/web/controller/RolePermissaoController.java
80c501fe417ca2f10afffb5edf22cf1e25405874
[]
no_license
fsergio-santos/financeiro
88e33e8f4537e85ac1cefe2eb0d66b112e3ef499
8a5bec4469f4dbe312613d01a606bb4aeeb93027
refs/heads/master
2023-05-14T16:25:42.546545
2020-03-12T12:36:12
2020-03-12T12:36:12
183,628,778
2
0
null
2023-04-30T23:57:39
2019-04-26T12:57:16
CSS
UTF-8
Java
false
false
8,909
java
package com.financeiro.web.controller; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Objects; import javax.servlet.http.HttpServletRequest; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.propertyeditors.CustomDateEditor; import org.springframework.data.domain.Pageable; import org.springframework.data.web.PageableDefault; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.validation.BindingResult; import org.springframework.web.bind.ServletRequestDataBinder; import org.springframework.web.bind.annotation.InitBinder; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import com.financeiro.model.dto.ListaRolePermissao; import com.financeiro.model.security.Escopo; import com.financeiro.model.security.Permissao; import com.financeiro.model.security.Role; import com.financeiro.model.security.RolePermissao; import com.financeiro.model.security.RolePermissaoId; import com.financeiro.repository.RolePermissaoRepository; import com.financeiro.repository.filtros.RolePermissaoFiltro; import com.financeiro.service.EscopoService; import com.financeiro.service.PermissaoService; import com.financeiro.service.RolePermissaoService; import com.financeiro.service.RoleService; import com.financeiro.web.page.PageWrapper; @Controller @RequestMapping(value="/direitos") public class RolePermissaoController { @Autowired private RolePermissaoService rolePermissaoService; @Autowired private PermissaoService permissaoService; @Autowired private RoleService roleService; @Autowired private EscopoService escopoService; private List<Permissao> listaPermissao; @InitBinder protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception { SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy"); binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true)); } @RequestMapping(value="/pesquisar",method=RequestMethod.GET) public String listarRolePermissao(RolePermissaoFiltro rolePermissaoFiltro, @PageableDefault(size=5) Pageable pageable, HttpServletRequest httpServletRequest, ModelMap model) { PageWrapper<RolePermissao> pagina = new PageWrapper<>(rolePermissaoService.listRolePermissaoWithPagination(rolePermissaoFiltro, pageable), httpServletRequest); model.addAttribute("pagina", pagina); return "/direitos/lista"; } @RequestMapping(value="/incluir") public ModelAndView incluirRolePermissao(ListaRolePermissao rolepermissao) { ModelAndView mv = new ModelAndView("/direitos/incluir"); mv.addObject("rolepermissao",rolepermissao); return mv; } @RequestMapping(value="/alterar") public ModelAndView alterarRolePermissao(ListaRolePermissao rolepermissao) { ModelAndView mv = new ModelAndView("/direitos/alterar"); mv.addObject("rolepermissao",rolepermissao); return mv; } @RequestMapping(value="/salvar", method=RequestMethod.POST,params="action=salvar") public ModelAndView salvar(@Valid ListaRolePermissao rolepermissao, BindingResult result, RedirectAttributes attr) { if (result.hasErrors()) { return incluirRolePermissao(rolepermissao); } registrarRolePermissao(rolepermissao); ModelAndView mv = new ModelAndView("/direitos/incluir"); ListaRolePermissao rolePermissao = new ListaRolePermissao(); mv.addObject("success", "Registro inserido com sucesso."); mv.addObject("rolepermissao", rolePermissao); return mv; } @RequestMapping(value="/editar/{permissao_id}/{role_id}/{escopo_id}", method=RequestMethod.GET) public String editar(@PathVariable("permissao_id") Integer permissao_id, @PathVariable("role_id") Integer role_id, @PathVariable("escopo_id") Integer escopo_id, ModelMap model) { ListaRolePermissao rolepermissao = new ListaRolePermissao(); rolepermissao = rolePermissaoService.findByRolePermissao(role_id, escopo_id); listaPermissao = new ArrayList<>(); for (Permissao lista: rolepermissao.getListaPermissoes()) { listaPermissao.add(lista); } model.addAttribute("rolepermissao", rolepermissao); return "/direitos/alterar"; } @RequestMapping(value="/editar", method=RequestMethod.POST, params="action=salvar") public ModelAndView editarRolePermissao(ListaRolePermissao rolepermissao, RedirectAttributes attr) { /*if (result.hasErrors()) { return alterarRolePermissao(rolepermissao); }*/ ModelAndView model = new ModelAndView("/direitos/alterar"); model.addObject("success","Resgistro alterado com sucesso."); if (!Objects.isNull(listaPermissao)) { if ( rolepermissao.getListaPermissoes().size() < listaPermissao.size()) { for ( int i = 0 ; i < listaPermissao.size(); i++) { Permissao permissao = listaPermissao.get(i); if (!rolepermissao.getListaPermissoes().contains(permissao)) { RolePermissaoId id = new RolePermissaoId(); id.setRole_id(rolepermissao.getId().getRole_id()); id.setEscopo_id(rolepermissao.getId().getEscopo_id()); id.setPermissao_id(permissao.getId()); rolePermissaoService.delete(id); } } }else { registrarRolePermissao(rolepermissao); } } rolepermissao = rolePermissaoService.findByRolePermissao(rolepermissao.getId().getRole_id(), rolepermissao.getId().getEscopo_id()); model.addObject("rolepermissao", rolepermissao); return model; } @RequestMapping(value="/excluir/{permissao_id}/{role_id}/{escopo_id}", method=RequestMethod.GET) public ModelAndView excluir(@PathVariable("permissao_id") Integer permissao_id, @PathVariable("role_id") Integer role_id, @PathVariable("escopo_id") Integer escopo_id) { ListaRolePermissao rolepermissao = new ListaRolePermissao(); rolepermissao = rolePermissaoService.findByRolePermissao(role_id, escopo_id); ModelAndView model = new ModelAndView("/direitos/excluir"); model.addObject("rolepermissao", rolepermissao); return model; } @RequestMapping(value="/excluir", method=RequestMethod.POST, params="action=excluir") public ModelAndView excluirRolePermissao(ListaRolePermissao rolepermissao, RedirectAttributes attr) { for (Permissao permissao : rolepermissao.getListaPermissoes()) { RolePermissaoId rpId = new RolePermissaoId(); rpId.setPermissao_id(permissao.getId()); rpId.setRole_id(rolepermissao.getRole().getId()); rpId.setEscopo_id(rolepermissao.getScope().getId()); RolePermissao rolePermissao = new RolePermissao(); rolePermissao.setId(rpId); rolePermissaoService.delete(rolePermissao.getId()); } rolepermissao = new ListaRolePermissao(); ModelAndView model = new ModelAndView("/direitos/excluir"); model.addObject("success","Registros removido com sucesso."); return model; } @RequestMapping(value="/consultar/{permissao_id}/{role_id}/{escopo_id}", method=RequestMethod.GET) public String consulta(@PathVariable("permissao_id") Integer permissao_id, @PathVariable("role_id") Integer role_id, @PathVariable("escopo_id") Integer escopo_id, ModelMap model) { ListaRolePermissao rolepermissao = new ListaRolePermissao(); rolepermissao = rolePermissaoService.findByRolePermissao(role_id, escopo_id); model.addAttribute("rolepermissao", rolepermissao); return "/direitos/consultar"; } @RequestMapping(value= {"/salvar","/editar","/excluir","/consultar"}, method=RequestMethod.POST, params="action=cancelar") public String cancelarCadastroRolePermissao() { return "redirect:/direitos/pesquisar"; } @ModelAttribute("roles") public List<Role> listaRoles(){ return roleService.listarTodosRoles(); } @ModelAttribute("permissoes") public List<Permissao> listaPermissoes(){ return permissaoService.getAllPermissao(); } @ModelAttribute("scopes") public List<Escopo> getScopes() { return escopoService.listarTodasEscopos(); } private void registrarRolePermissao(ListaRolePermissao rolepermissao) { for ( Permissao permissao :rolepermissao.getListaPermissoes()) { RolePermissaoId rpId = new RolePermissaoId(); rpId.setPermissao_id(permissao.getId()); rpId.setRole_id(rolepermissao.getRole().getId()); rpId.setEscopo_id(rolepermissao.getScope().getId()); RolePermissao rolePermissao = new RolePermissao(); rolePermissao.setId(rpId); rolePermissao.setDataCadastro(rolepermissao.getDataCadastro()); rolePermissaoService.salvar(rolePermissao); } } }
[ "fsergio.santos@hotmail.com" ]
fsergio.santos@hotmail.com
cf81f99d0e9b6ba2cbcb949822894c356020d420
2e0016218fecdba70f0725f7d119851582cfe302
/src/main/java/com/microwill/framework/weix/WeixBaseController.java
5deff487b824cc1ec8a68c58c49e6da52e83d330
[]
no_license
eric8376/WebDevelope
9aa70f50d6bc4564c7585e74f710645ac757c335
57f919d57c9d5f66fcdf61c648b1d38fc7b026ae
refs/heads/master
2021-01-15T09:32:26.911479
2016-10-04T04:01:38
2016-10-04T04:01:38
12,031,552
0
0
null
null
null
null
UTF-8
Java
false
false
3,136
java
/** * */ package com.microwill.framework.weix; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import javax.annotation.PostConstruct; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.ui.Model; import com.microwill.framework.web.BaseMultiActionController; import com.microwill.framework.weix.svc.msg.XmlMsgUtil; import com.microwill.framework.weix.svc.msg.user.BaseMsg; import com.microwill.framework.weix.svc.msg.user.RespMsg; /** * @author lizhen * */ public abstract class WeixBaseController extends BaseMultiActionController { protected SignUtil signUtil; protected abstract String getAppToken(); protected abstract RespMsg onResponse(BaseMsg msg); @PostConstruct public void init(){ signUtil=new SignUtil(getAppToken()); } public String doService(Model model,HttpServletRequest request, HttpServletResponse response) throws Exception { if (request.getMethod().equals("GET")) { return doGet(request, response); } else if (request.getMethod().equals("POST")) { return doPost( model,request, response); } return null; } private String getHttpBody(HttpServletRequest request) throws IOException { String charset = request.getCharacterEncoding(); if (charset == null) { charset = EnCodingType.UTF_8; } BufferedReader in = new BufferedReader(new InputStreamReader( request.getInputStream(), charset)); String line = null; StringBuilder result = new StringBuilder(); while ((line = in.readLine()) != null) { result.append(line); } in.close(); return result.toString(); } public String doPost(Model model,HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String reqBody = getHttpBody(request); BaseMsg msg = XmlMsgUtil.xml2Bean(reqBody); RespMsg result = this.onResponse(msg); model.addAttribute("result", result); return "xmlview"; } private String doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { // 微信加密签名 String signature = request.getParameter("signature"); // 时间戳 String timestamp = request.getParameter("timestamp"); // 随机数 String nonce = request.getParameter("nonce"); // 随机字符串 String echostr = request.getParameter("echostr"); // 通过检验signature对请求进行校验,若校验成功则原样返回echostr,表示接入成功,否则接入失败 if (signUtil.checkSignature(signature, timestamp, nonce)) { try { response.getWriter().print(echostr); response.getWriter().flush(); } finally { response.getWriter().close(); } } else { // logger.error("checkSignature failed for request address:{}", // request.getRemoteAddr()); // logger.error("signature={},timestamp={},nonce={},echostr={}", // signature, timestamp, nonce, echostr); } return null; } }
[ "Administrator@AM-20131103TJTH" ]
Administrator@AM-20131103TJTH
8b230b84e48a622da0ce66b0da6dad1616f7df71
6a1c38c64481e05200d140b444d02632ccab86b2
/Mail Client V2/src/xml/crypto/AsymmetricKeyEncryption.java
30d0d428339aaecdfbf1d716f782ea4ac2690941
[]
no_license
SinisaPaskulov/informacionaBezbednostFTN
2aaf4dd117ba850c5b2b555c23dd7eff733263fb
83cd489e16373de703f7796fab16df18fbfefb61
refs/heads/master
2022-12-10T05:45:51.787788
2020-09-18T07:00:00
2020-09-18T07:00:00
295,743,744
0
0
null
null
null
null
UTF-8
Java
false
false
5,805
java
package xml.crypto; import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.security.KeyStore; import java.security.NoSuchAlgorithmException; import java.security.Security; import java.security.cert.Certificate; import javax.crypto.KeyGenerator; import javax.crypto.SecretKey; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import org.apache.xml.security.encryption.EncryptedData; import org.apache.xml.security.encryption.EncryptedKey; import org.apache.xml.security.encryption.XMLCipher; import org.apache.xml.security.keys.KeyInfo; import org.bouncycastle.jce.provider.BouncyCastleProvider; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; //Generise tajni kljuc //Kriptije sadrzaj elementa student tajnim kljucem //Kriptuje tajni kljuc javnim kljucem //Kriptovani tajni kljuc se stavlja kao KeyInfo kriptovanog elementa public class AsymmetricKeyEncryption { private static final String IN_FILE = "./data/univerzitet.xml"; private static final String OUT_FILE = "./data/univerzitet_enc2.xml"; private static final String KEY_STORE_FILE = "./data/primer.jks"; static { // staticka inicijalizacija Security.addProvider(new BouncyCastleProvider()); org.apache.xml.security.Init.init(); } /*public void testIt() { // ucitava se dokument Document doc = loadDocument(IN_FILE); // generise tajni session kljuc System.out.println("Generating secret key ...."); SecretKey secretKey = generateDataEncryptionKey(); // ucitava sertifikat za kriptovanje tajnog kljuca Certificate cert = readCertificate(); // kriptuje se dokument System.out.println("Encrypting...."); doc = encrypt(doc, secretKey, cert); // snima se tajni kljuc // snima se dokument saveDocument(doc, OUT_FILE); System.out.println("Encryption done"); }*/ /** * Kreira DOM od XML dokumenta */ private Document loadDocument(String file) { try { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); DocumentBuilder db = dbf.newDocumentBuilder(); Document document = db.parse(new File(file)); return document; } catch (Exception e) { e.printStackTrace(); return null; } } /** * Ucitava sertifikat is KS fajla alias primer */ public static Certificate readCertificate(String keyStorePath, String keyStorePassword, String alias) { try { //kreiramo instancu KeyStore KeyStore ks = KeyStore.getInstance("JKS", "SUN"); //ucitavamo podatke BufferedInputStream in = new BufferedInputStream(new FileInputStream(keyStorePath)); ks.load(in, keyStorePassword.toCharArray()); if(ks.containsAlias(alias)) { Certificate cert = ks.getCertificate(alias); return cert; } else return null; } catch (Exception e) { e.printStackTrace(); return null; } } /** * Snima DOM u XML fajl */ public static void saveDocument(Document doc, String fileName) { try { File outFile = new File(fileName); FileOutputStream f = new FileOutputStream(outFile); TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(); DOMSource source = new DOMSource(doc); StreamResult result = new StreamResult(f); transformer.transform(source, result); f.close(); } catch (Exception e) { e.printStackTrace(); } } /** * Generise tajni kljuc */ public static SecretKey generateDataEncryptionKey() { try { KeyGenerator keyGenerator = KeyGenerator.getInstance("DESede"); // Triple // DES return keyGenerator.generateKey(); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); return null; } } /** * Kriptuje sadrzaj prvog elementa odsek */ public static Document encrypt(Document doc, SecretKey key, Certificate certificate) { try { // cipher za kriptovanje XML-a XMLCipher xmlCipher = XMLCipher.getInstance(XMLCipher.TRIPLEDES); // inicijalizacija za kriptovanje xmlCipher.init(XMLCipher.ENCRYPT_MODE, key); // cipher za kriptovanje tajnog kljuca, // Koristi se Javni RSA kljuc za kriptovanje XMLCipher keyCipher = XMLCipher.getInstance(XMLCipher.RSA_v1dot5); // inicijalizacija za kriptovanje tajnog kljuca javnim RSA kljucem keyCipher.init(XMLCipher.WRAP_MODE, certificate.getPublicKey()); // kreiranje EncryptedKey objekta koji sadrzi enkriptovan tajni (session) kljuc EncryptedKey encryptedKey = keyCipher.encryptKey(doc, key); // u EncryptedData element koji se kriptuje kao KeyInfo stavljamo // kriptovan tajni kljuc // ovaj element je koreni elemnt XML enkripcije EncryptedData encryptedData = xmlCipher.getEncryptedData(); // kreira se KeyInfo element KeyInfo keyInfo = new KeyInfo(doc); // postavljamo naziv keyInfo.addKeyName("Kriptovani tajni kljuc"); // postavljamo kriptovani kljuc keyInfo.add(encryptedKey); // postavljamo KeyInfo za element koji se kriptuje encryptedData.setKeyInfo(keyInfo); // trazi se element ciji sadrzaj se kriptuje //NodeList odseci = doc.getElementsByTagName("odsek"); //Element odsek = (Element) odseci.item(0); xmlCipher.doFinal(doc, doc.getDocumentElement(), true); // kriptuje sa sadrzaj return doc; } catch (Exception e) { e.printStackTrace(); return null; } } /*public static void main(String[] args) { AsymmetricKeyEncryption encrypt = new AsymmetricKeyEncryption(); encrypt.testIt(); }*/ }
[ "sinishamarini@gmail.com" ]
sinishamarini@gmail.com
8b3b25dfd8c19af9d3c328a00c257919f2af13c5
d84b812db1dc550f70739e7bd4ef5ee052f8d9ed
/tangbeibeihotel/src/com/isoft/beibeihotel/control/RoomControl.java
a2f11072f304788669797eb572df75181ecab552
[]
no_license
acuteMouse/repo
a29f5a454d99047de85ec7cd3f65697d9def851a
7b8dadc3e4472a1c0991226fe8a55ab1de1429ba
refs/heads/master
2020-04-02T13:19:39.512638
2016-06-11T11:04:12
2016-06-11T11:04:12
60,902,565
0
0
null
null
null
null
UTF-8
Java
false
false
3,283
java
package com.isoft.beibeihotel.control; import java.util.Map; import com.isoft.beibeihotel.biz.RoomBiz; import com.isoft.beibeihotel.entity.Room; import com.isoft.beibeihotel.view.Input; import com.isoft.beibeihotel.view.Output; public class RoomControl { private Map<String, Room> map; private Input input; private Output output; private RoomBiz roomBiz; public RoomControl(){ input = new Input(); output = new Output(); roomBiz = new RoomBiz(); map = roomBiz.searchRoom(); } //添加房间 public void addRoom(){ Room room = input.getRoom(); if (map.containsKey(room.getRoomNumber())) { System.err.println("此房间已经存在!!"); }else{ roomBiz.addRoom(room); map=roomBiz.searchRoom(); } } //修改房间信息 public void updateRoom(){ //输入你要修改的房间号 String roomNumber=input.getStringInfo("请输入房间号"); //:判断此房间是否存在 if(!map.containsKey(roomNumber)){ System.err.println("此房间已经存在!!"); return; } //:显示要修改的信息 Room room=map.get(roomNumber); output.showRoom(room); //选择修改的地方 boolean flag=false; end: while(true){ //显示修改菜单 output.showMenu(output.UPDATEFINISHED); output.showMenu(output.UPDATEFINISH); switch(input.getIntInfo("输入你要选择修改的选项")){ case 1: room.setRoomType(input.getStringInfo("请输入新的房间类型")); flag=true; break; case 2: room.setRoomPrince(input.getFloatInfo("请输入新的房间价格")); flag=true; break; /*case 3: room.setRoomNumber(input.getStringInfo("请输入新的房间号")); flag=true; break;*/ /*case 3: room.setJoinTime(input.getStringInfo("请输入新的入住时间")); flag=true; break;*/ /*case 4: room.setJoin(input.getBooleanInfo("请输入新的是否入住")); flag=true; break;*/ /*case 5: room.setRentMOney(input.getFloatInfo("请输入新的入住押金")); flag=true; break;*/ //退出 case 0:break end; } } //如果修改了,把修改的内容放到map集合中 if(flag){ map.put(room.getRoomNumber(), room); roomBiz.updateRoomInfo(map); } } //选择住房通过房间号自动修改住房状态 public void joinInUpdateRoom(String roomNumber){ Room room=map.get(roomNumber); room.setJoin(true); map.put(room.getRoomNumber(), room); roomBiz.updateRoomInfo(map); } public void joinOutUpdateRoom(String roomNumber){ Room room=map.get(roomNumber); // output.showRoom(room); room.setJoin(false); map.put(room.getRoomNumber(), room); roomBiz.updateRoomInfo(map); } //通过房间号返回住房状态 public boolean getJoinInfo(String roomNumber){ Room room=map.get(roomNumber); if (null==room) { return false; } return room.isJoin(); } //返回flaot类型的房间价格 public float getRoomPrince(String roomNumber){ Room room=map.get(roomNumber); return room.getRoomPrince(); } }
[ "1012592349@qq.com" ]
1012592349@qq.com
8d6a864f74e3cb3c733c2eb4284608dfeb945915
79a0bd65896174637fa85289888d32e89fdbfce9
/dubboServer/bpm/com/ztesoft/crmpub/bpm/util/WoTaskHelper.java
cc5dfa99c77e9c0928faa6c2879da1df91e5e791
[]
no_license
checkyouWW/First
000c49068e547478a39c5318a79a93aa1c322dae
f15a0eb843866e5b025f5472d9c7f500d9cc8206
refs/heads/master
2021-01-01T11:58:27.121768
2017-07-18T08:57:41
2017-07-18T08:57:41
97,577,816
0
0
null
null
null
null
UTF-8
Java
false
false
21,443
java
package com.ztesoft.crmpub.bpm.util; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.HashMap; import java.util.List; import java.util.Map; import com.ztesoft.common.util.DateUtil; import com.ztesoft.common.util.StringUtil; import com.ztesoft.crm.business.common.utils.StrTools; import com.ztesoft.crmpub.bpm.BpmContext; import com.ztesoft.crmpub.bpm.attr.util.SqlValUtil; import com.ztesoft.crmpub.bpm.consts.BPMConsts; import com.ztesoft.crmpub.bpm.consts.MsgConsts; import com.ztesoft.crmpub.bpm.handler.ICallBackHandler; import com.ztesoft.crmpub.bpm.task.FetchValueClass; import com.ztesoft.crmpub.bpm.task.IWoTaskEngine; import com.ztesoft.crmpub.bpm.task.impl.WoTaskEngineImpl; import com.ztesoft.crmpub.bpm.vo.MsgBean; import com.ztesoft.crmpub.bpm.vo.model.MBpmBoFlowInst; import com.ztesoft.crmpub.bpm.vo.model.MBpmWoTask; import com.ztesoft.crmpub.bpm.vo.model.MBpmWoTaskExec; import com.ztesoft.crmpub.bpm.vo.spec.SBpmBoFlowTache; import com.ztesoft.crmpub.bpm.vo.spec.SBpmWoDispatchRule; import com.ztesoft.crmpub.bpm.vo.spec.SBpmWoType; import appfrm.app.util.ListUtil; import appfrm.app.util.SeqUtil; import appfrm.app.util.StrUtil; import appfrm.app.vo.IVO; import appfrm.resource.dao.impl.DAO; import appfrm.resource.dao.impl.DaoUtils; import exception.CoopException; /** * 工单帮助类 * * @author lirx * */ public class WoTaskHelper { /** * 回单时的入口函数(审核也是回单的一种) joshui * 工单回单 正常WO_FINISH /异常WO_FAIL * @param params * 回单运行参数对象 * @param callBackHandler * 回调函数 * @return boolean */ public static Map returnWoTask(Map params, ICallBackHandler callBackHandler) throws Exception { Map retMap = new HashMap(); Boolean result = false; if (params==null || params.size() <=0 ) { throw new RuntimeException("传入的回单参数为空,params为空!"); } // 查询流程定义 MsgBean msg = new MsgBean(); String woId = (String) params.get("wo_id"); Map flowGrade = (Map) params.get("gradedata"); //如果工单为空 if( StrUtil.isEmpty(woId) ){ List<MBpmWoTask> taskList = (List) MBpmWoTask.getDAO().newQuerySQL( " bo_id=? and bo_type_id=? ").findByCond( (String) params.get("bo_id"), (String) params.get("bo_type_id")); //TODO 目前先这样做,取第一个工单标识 if( null != taskList && taskList.size() >= 1 ){ msg.setWoId(taskList.get(0).wo_id); } }else{ msg.setWoId((String) params.get("wo_id")); } msg.setFlowGrade(flowGrade);//评分Map msg.setBoId((String) params.get("bo_id"));// 业务单ID msg.setOperId((String) params.get("oper_id"));// 回单人 msg.setCallBackHandler(callBackHandler);// 业务回调函数 msg.setMsgAction((String) params.get("action"));// 新建流程动作 WO_FINISH // /WO_FAIL msg.setMsgType(MsgConsts.MSG_TYPE_TASK); msg.setBackToFirst(StringUtil.getStrValue(params, "toFirst")); msg.setBackToTacheCode(StringUtil.getStrValue(params, "backToTacheCode")); msg.setIsNormal(StringUtil.getStrValue(params, "isNormal")); //是否正常归档,撤单action用到 msg.setWithdrawType(StringUtil.getStrValue(params, "withdrawType")); msg.setMsgHandleWay(MsgConsts.MSG_HANDLE_SYNC);// 消息同步处理 msg.setAttrList((List) params.get("attrList")); msg.setRespContent((String) params.get("resp_content")); msg.setNeed_sms((String)params.get("need_sms")); msg.setFlowId((String)params.get("flow_id")); msg.setBoTypeId(StrTools.getStrValue(params, "bo_type_id")); msg.setTaskTitle(StringUtil.getStrValue(params, "task_title")); // 工单名称,必须要以“-”分隔 msg.setWorkerType(StringUtil.getStrValue(params, "worker_type")); String var_bo_type_id = BpmContext.getVar("bo_type_id"); if(StrTools.isEmpty(var_bo_type_id)){ BpmContext.putVar("bo_type_id", StrTools.getStrValue(params, "bo_type_id")); } // 2.获取当前流程实例 MBpmBoFlowInst flowInst = msg.getFlowInst(); if (flowInst == null) { flowInst = (MBpmBoFlowInst) MBpmBoFlowInst.getDAO().findById(msg.getFlowId()); msg.setFlowInst(flowInst); } if(flowInst != null){ BpmContext.putVar(BPMConsts.CTX_VAR.BO_CREATOR, flowInst.create_oper_id); } IWoTaskEngine woTaskEngine = new WoTaskEngineImpl(); result = woTaskEngine.putMsg(msg); retMap.put("result", result); retMap.put("flowId", msg.getFlowId()); return retMap; } /** * 生成任务单实例 * * @param flowTache * @param msg * @return FlowWorkOrder * @throws Exception */ private static MBpmWoTask genWorkOrderTask(String woTypeId, MBpmBoFlowInst flowInst, SBpmBoFlowTache flowTache, MsgBean msg) throws Exception { String curDbTime = DaoUtils.getDBCurrentTime(); MBpmWoTask workOrder = new MBpmWoTask(); workOrder.wo_id = SeqUtil.getInst().getNext("BPM_WO_TASK", "WO_ID"); workOrder.wo_type_id = woTypeId; workOrder.work_type = flowTache.work_type; workOrder.task_type = flowTache.task_type; // 要兼容之前审核不通过时,工单状态的设置逻辑 joshui workOrder.wo_state = BPMConsts.WO_STATE_READY; if (MsgConsts.ACTION_WO_FAIL.equals(msg.getMsgAction()) && flowInst.getFlowDef().isFirstTache(workOrder.tache_code) ) { workOrder.set("wo_state", BPMConsts.WO_STATE_FAIL); } workOrder.state_date = curDbTime; workOrder.task_title = StrUtil.isNotEmpty(msg.getTaskTitle()) ? msg.getTaskTitle() : msg.getBoTitle() + "-" + flowTache.tache_name; workOrder.task_content = msg.getBoTitle(); workOrder.tache_code = flowTache.tache_code; workOrder.tache_name = flowTache.tache_name; workOrder.flow_id = flowInst.flow_id; workOrder.bo_id = flowInst.bo_id; workOrder.bo_type_id = flowInst.bo_type_id; workOrder.create_date = curDbTime; workOrder.create_oper_id = flowInst.create_oper_id;// 流程创建人 workOrder.dispatch_date = curDbTime; workOrder.dispatch_oper_id = msg.getOperId();// 上一环节处理人 workOrder.dispatch_tache_code = msg.getWoTask() == null ? "" : msg.getWoTask().tache_code; // 上一环节 //获取表单中的完成时限 /*String attrSql="select b.attr_id from bpm_wo_type a ,bpm_template_attr b where a.template_id=b.template_id and b.field_name='deadline' and a.bo_type_id=? and a.tache_code=?"; String attrId=DAO.querySingleValue(attrSql,new String[]{flowTache.bo_type_id,workOrder.dispatch_tache_code}); List<HashMap> attrList=msg.getAttrList(); if(attrList!=null&&attrList.size()>0&&StrUtil.isNotEmpty(attrId)){ for(Map map:attrList){ if(StrTools.getStrValue(map,"name").equals(attrId)){ workOrder.limit_date=StrTools.getStrValue(map,"value"); } } } if(StrUtil.isEmpty(workOrder.limit_date)) { // 计算工单要求完成时间。其实目前环节与环节类型是一对一的 joshui SBpmWoType woType = flowTache.getWorkOrderType(); if (StrUtil.isNotEmpty(woType.limit_interval_type) && StrUtil.isNotEmpty(woType.limit_interval_value)) { // 根据本环节设置的时长计算 if ("001".equals(woType.limit_interval_type)) { workOrder.limit_date = WorkDateUtil.getInstance().getOverTime(curDbTime, woType.limit_interval_value); } else if ("002".equals(woType.limit_interval_type)) { // 跟其他环节的完成时间一样,比如外包转派 // @TODO-joshui 需求暂没明确要求这样 } } }*/ workOrder.getDao().insert(workOrder); return workOrder; } /** * 生成工单执行者 * 可以配置多种派单规则,只要满足了派单规则,就生成该派单规则对应的处理人。 modified by joshui * @param next_flowTache * @param msg * @param next_flowTache * @return FlowWorkOrder */ private static List<MBpmWoTaskExec> genWorkOrderExecutor(String next_woTypeId, MBpmWoTask next_workOrder, SBpmBoFlowTache next_flowTache, MsgBean msg) throws Exception { List<MBpmWoTaskExec> execs = new ArrayList<MBpmWoTaskExec>(); List<SBpmWoDispatchRule> ruleL = next_flowTache.getDispatchRule(next_woTypeId); if (ruleL.isEmpty()) { throw new RuntimeException( "dispatch error! 找不到派单规则,请检查派单规则是否配置!wo_type_Id = " + next_woTypeId); } for (SBpmWoDispatchRule dispatchRule : ruleL) { String destMethod = dispatchRule.dest_method; String destWorkerExpr = dispatchRule.dest_worker; String destWorkerType = dispatchRule.dest_worker_type; String dispatchWay = dispatchRule.dispatch_way;// 派单方式 if(StringUtil.isNotEmpty(msg.getWorkerType())){ //已页面传进来为准 destWorkerType = msg.getWorkerType(); } if (BPMConsts.DISPATCH_WAY_MANUAL.equals(dispatchWay)) { // 人工派单 if (BPMConsts.VALUE_METHOD.ATTR.equalsIgnoreCase(destMethod)) { // 从界面传入目标执行者的值 List<HashMap> attrList = msg.getAttrList(); // destWorkerType的可能值为BPMConsts.WORKER_TYPE_STAFF、WORKER_TYPE_TEAM、WORKER_TYPE_ORG、WORKER_TYPE_STAFF_MULTI等 for (HashMap<String, String> attrMap : attrList) { if (destWorkerExpr.equalsIgnoreCase(attrMap.get("name")) && StrUtil.isNotEmpty(attrMap.get("value"))) { if (BPMConsts.WORKER_TYPE_STAFF_MULTI.equals(destWorkerType)) { // 多选人员,并行派单,每个人有自己对应的工单 joshui String[] valArr = attrMap.get("value").split(BPMConsts.WORKER_TYPE_STAFF_MULTI_SPLIT); for (int i = 0; i < valArr.length; i++) { execs.add(buildTaskExecutor(valArr[i], destWorkerType, next_workOrder)); } }else{ execs.add(buildTaskExecutor(attrMap.get("value"), destWorkerType, next_workOrder)); } } } } } else if ((BPMConsts.DISPATCH_WAY_AUTO.equals(dispatchWay) || "".equals(dispatchWay))) { // 自动派单 // 审批不通过时,不需要通过自动方式指定执行人,除非是004类型的路由。 if(MsgConsts.ACTION_WO_FAIL.equals(msg.getMsgAction()) && !BPMConsts.VALUE_METHOD.ROUTE.equalsIgnoreCase(destMethod)){ continue; } if (BPMConsts.VALUE_METHOD.SQL.equalsIgnoreCase(destMethod)) { List<Map> workers = SqlValUtil.fetch(destWorkerExpr); for (Map woker : workers) { String taskWorker = (String) woker.get("attr_id"); execs.add(buildTaskExecutor(taskWorker, destWorkerType, next_workOrder)); } } if (BPMConsts.VALUE_METHOD.VAR.equalsIgnoreCase(destMethod)) { String taskWorker = BpmContext.getVar(destWorkerExpr); execs.add(buildTaskExecutor(taskWorker, destWorkerType, next_workOrder)); } if (BPMConsts.VALUE_METHOD.CONST.equalsIgnoreCase(destMethod)) { String taskWorker = destWorkerType; if( "SELF".equals(destWorkerExpr) ){ taskWorker = msg.getOperId(); } execs.add(buildTaskExecutor(taskWorker, destWorkerType, next_workOrder)); } if (BPMConsts.VALUE_METHOD.CLASS.equalsIgnoreCase(destMethod)) { String className = destWorkerExpr; Class clazz = Class.forName(className); FetchValueClass fetchValue = (FetchValueClass) clazz.newInstance(); fetchValue.setMsg(msg); String taskWorker = fetchValue.execute(); // 通过BpmContext获取变量值 execs.add(buildTaskExecutor(taskWorker, destWorkerType, next_workOrder)); } if (BPMConsts.VALUE_METHOD.ROUTE.equalsIgnoreCase(destMethod)) { //找目标环节对应的已完成的最新工单执行人,目前只针对route等于004这种情况 joshui String sql = "select COUNT(1) AS flag from bpm_tache_route t " + "where t.type = ? AND t.bo_type_id = ? AND t.src_tache_code = ? AND t.tar_tache_code = ? AND t.route_id = ?"; List<Map<String, String>> countL = DAO.queryForMap(sql, new String[]{MsgConsts.BPM_TACHE_ROUTE_TYPE_004, next_workOrder.bo_type_id, msg.getFlowTache().tache_code, next_flowTache.tache_code, destWorkerExpr}); if (!"0".equals(countL.get(0).get("flag"))) { execs.addAll(buildExecutorByTache(next_workOrder, next_flowTache)); } } } } // 如果是审核不通过,直接找打回环节的最新工单执行人,旧的代码是这种逻辑,后续也可以做成支持可以选择打回环节的处理人 joshui if (execs.isEmpty() && MsgConsts.ACTION_WO_FAIL.equals(msg.getMsgAction())) { execs.addAll(buildExecutorByTache(next_workOrder, next_flowTache)); //return execs; } return execs; } /** * 目标环节已执行U哦,找目标环节对应的已完成的最新工单执行人。目标环节可能有多条bpm_wo_task,所以需要取max * @param next_workOrder * @param next_flowTache * Author : joshui * Date :2014-11-26 */ private static List<MBpmWoTaskExec> buildExecutorByTache(MBpmWoTask next_workOrder, SBpmBoFlowTache next_flowTache) { List<MBpmWoTaskExec> execs = new ArrayList<MBpmWoTaskExec>(); String sql = "select a.task_worker, a.worker_type from bpm_wo_task_exec a where a.worker_type in('STAFF','STAFF_POS') AND a.wo_id = ( " + " SELECT MAX(t.wo_id) FROM bpm_wo_task t WHERE T.wo_id <> ? AND t.flow_id = ? AND t.tache_code = ? " + ")"; List<Map<String, String>> workerL = DAO.queryForMap(sql, new String[]{next_workOrder.wo_id, next_workOrder.flow_id, next_flowTache.tache_code}); for (Map<String, String> worker : workerL) { execs.add(buildTaskExecutor(worker.get("task_worker"), worker.get("worker_type"), next_workOrder)); } return execs; } /** * 构造任务单执行者 * * @param workOrder * @param msg * @return FlowWorkOrderExecutor */ private static MBpmWoTaskExec buildTaskExecutor(String taskWorker, String workerType, MBpmWoTask workOrder) { if (StrUtil.isEmpty(taskWorker)) { throw new RuntimeException("创建任务执行者记录失败,原因:传入的处理人taskWorker为空!" ); } MBpmWoTaskExec taskExecutor = new MBpmWoTaskExec(); taskExecutor.wo_id = workOrder.wo_id; taskExecutor.bo_id = workOrder.bo_id;//业务单ID taskExecutor.bo_type_id = workOrder.bo_type_id;//业务单类型 taskExecutor.work_type = workOrder.work_type;//工作类型 taskExecutor.task_type = workOrder.task_type;//任务类型 taskExecutor.task_title = workOrder.task_title;//任务标题 taskExecutor.task_content = workOrder.task_content;//任务内容 taskExecutor.tache_code = workOrder.tache_code;//环节编码 taskExecutor.tache_name = workOrder.tache_name;//环节名称 taskExecutor.flow_id = workOrder.flow_id;//流程实例ID taskExecutor.exec_state = BPMConsts.WO_STATE_READY; // 执行人状态 joshui String curDate = DaoUtils.getDBCurrentTime(); taskExecutor.dispatch_date = curDate;//派单时间 taskExecutor.dispatch_oper_id = workOrder.dispatch_oper_id;//派单人 = 上一环节处理人) 这个地方可能有问题,应该取当前回单人 @TODO-joshui taskExecutor.task_worker = taskWorker;//工单指定者标识 taskExecutor.worker_type_original = workerType; //原始的工单执行者类型 joshui taskExecutor.worker_type = BPMConsts.WORKER_TYPE_STAFF_MULTI.equals(workerType) ? BPMConsts.WORKER_TYPE_STAFF : workerType; //工单执行者类型 modified by joshui //taskExecutor.getDao().insert(taskExecutor); return taskExecutor; } /** *更新工单执行人状态 * xu.zhaomin */ public static void updateWorkTaskExecState(String task_exec_id,String state) throws Exception{ if (StrUtil.isEmpty(state)) { throw new RuntimeException("更新工单状态失败,原因:state为空!" ); } MBpmWoTaskExec exec=(MBpmWoTaskExec)MBpmWoTaskExec.getDAO().findById(task_exec_id); if(exec!=null) { exec.set("exec_date", DateUtil.getFormatedDateTime()); exec.set("exec_state", state); exec.getDAO().updateParmamFieldsByIdSQL(exec.updateFieldSet.toArray(new String[]{})).update(exec); } } /** * 根据参数生成工单执行人 * xu.zhaomin * @param params */ public static void genWorkTeamExec(Map params){ String wo_id=(String)params.get("wo_id"); String taskWorker=(String)params.get("task_worker"); String workerType=(String)params.get("worker_type"); if (StrUtil.isEmpty(wo_id)) { throw new RuntimeException("生成工单失败,原因:wo_id为空!" ); } if (StrUtil.isEmpty(taskWorker)) { throw new RuntimeException("生成工单失败,原因:task_worker为空!" ); } if (StrUtil.isEmpty(workerType)) { throw new RuntimeException("生成工单失败,原因:worker_type为空!" ); } MBpmWoTask workOrder=(MBpmWoTask)MBpmWoTask.getDAO().findById(wo_id); if(workOrder!=null) { MBpmWoTaskExec taskExec=buildTaskExecutor(taskWorker, workerType, workOrder); taskExec.getDao().insert(taskExec); } } /** * 生成工单,并按派单规则、输入的派单目标进行派单 * 新增动作、完成动作调用 joshui * @param flowInst * @param nextTache * @param msg * @throws Exception */ public static void genWorkerOrderAndDispatch(MBpmBoFlowInst flowInst, SBpmBoFlowTache nextTache, MsgBean msg) throws Exception { SBpmWoType nextWoType = nextTache.getWorkOrderType(); List<MBpmWoTaskExec> execs = new ArrayList<MBpmWoTaskExec>(); List<MBpmWoTask> tasks = new ArrayList<MBpmWoTask>(); // 按照目前的实现,环节与woType是1对1关系 joshui MBpmWoTask nextWorkOrder = genWorkOrderTask(nextWoType.wo_type_id, flowInst, nextTache, msg); execs = genWorkOrderExecutor(nextWoType.wo_type_id, nextWorkOrder, nextTache, msg); if(ListUtil.isEmpty(execs)){ throw new CoopException(CoopException.INFO, "处理人不能为空!", null); } tasks.add(nextWorkOrder); msg.setWoId(nextWorkOrder.wo_id); /* * 应该是先生成执行人,再生成工单。 * 在共享模式下,一个环节一条工单,一个群组的人看到的是同一个工单,但只要群组内某个人抢单然后回单后,就走到了下一环节。 * 在并行模式下,一个环节多条工单,好几个人看到各自对应的工单,只有所有人都回完各自的工单,才能走到下一环节。 * 一般模式下,一个环节一条工单,也就是之前老的流程处理方式,一个环节只会生成一条工单,可能会有多个执行人,有一人回单后,就继续流转到下环节。 @TODO-joshui */ // 保存工单执行人 for (MBpmWoTaskExec exec : execs) { // 如果是并行模式,每个执行人都需要有对应的工单,且工单的类型为BPMConsts.TASK_TYPE_MULTI_TASK_AND if (BPMConsts.WORKER_TYPE_STAFF_MULTI.equals(exec.worker_type_original)) { if (!BPMConsts.TASK_TYPE_MULTI_TASK_AND.equals(nextWorkOrder.task_type)) { nextWorkOrder.task_type = BPMConsts.TASK_TYPE_MULTI_TASK_AND; }else{ MBpmWoTask task = new MBpmWoTask(); task.readFromMap(nextWorkOrder.saveToMap()); task.task_type = BPMConsts.TASK_TYPE_MULTI_TASK_AND; task.wo_id = SeqUtil.getInst().getNext("BPM_WO_TASK", "WO_ID"); tasks.add(task); exec.wo_id = task.wo_id; } exec.task_type = BPMConsts.TASK_TYPE_MULTI_TASK_AND; } exec.getDao().insert(exec); } //保存工单 for (MBpmWoTask task : tasks) { //task.getDao().insert(task); } flowInst.getWorkOrders().addAll(tasks); } /** * 拽回工单,上一个环节工单,上一个环节工单处理人,不走派单规则表 * @param flowInst * @param nextTache * @param msg * @throws Exception */ public static void genWorkerOrderByOper(MBpmBoFlowInst flowInst, SBpmBoFlowTache nextTache, MsgBean msg) throws Exception { List<IVO> workOrderTypes = nextTache.getWorkOrderTypes(); String taskWorker = msg.getTaskWorker(); if (StringUtil.isEmpty(taskWorker)) { throw new RuntimeException("处理人taskWorkder不能为空!"); } for(IVO vo:workOrderTypes ){ SBpmWoType nextWoType = (SBpmWoType) vo; String wo_type_id = nextWoType.wo_type_id; MBpmWoTask woTask = genWorkOrderTask(wo_type_id, flowInst, nextTache, msg); List<SBpmWoDispatchRule> rule = nextTache.getDispatchRule(wo_type_id); if (rule.isEmpty()) { throw new RuntimeException( "dispatch error! 找不到派单规则,请检查派单规则是否配置!wo_type_id = " + wo_type_id); } String destWorkerType = null; if(StringUtil.isNotEmpty(msg.getWorkerType())){ //已页面传进来为准 destWorkerType = msg.getWorkerType(); } else { for (SBpmWoDispatchRule dispatchRule : rule) { destWorkerType = dispatchRule.dest_worker_type; break; } } MBpmWoTaskExec taskExec=buildTaskExecutor(taskWorker, destWorkerType, woTask); taskExec.getDao().insert(taskExec); flowInst.getWorkOrders().add(woTask); msg.setWoId(woTask.wo_id); } } }
[ "153472234@qq.com" ]
153472234@qq.com
2eedea9c37c03826c83df49460c87aa7e328c361
5264a283bc625b6456bf7f611683cc9bab129ef6
/src/main/java/duke/task/TimedTask.java
00071f9a5ed417de27674ca3376674ae2be931fd
[]
no_license
luffingluffy/ip
d6c5b9e6ced99f1592635369c9cdb7b7104659aa
37888be40fe16f6c7ac077bea0f252eb5d023636
refs/heads/master
2023-08-15T07:10:27.562058
2021-09-14T18:37:29
2021-09-14T18:37:29
397,461,076
0
0
null
2021-09-07T15:17:40
2021-08-18T03:29:35
Java
UTF-8
Java
false
false
302
java
package duke.task; public abstract class TimedTask extends Task { public TimedTask(String description) { super(description); } public TimedTask(String description, boolean isDone) { super(description, isDone); } public abstract void changeDate(String newDate); }
[ "luffingluffy@gmail.com" ]
luffingluffy@gmail.com
02f6923bb0d9091ff9725fb76bc4c9d60ebc17bc
a07f5ac20bec8e0daa33f7d157035907d1ba1440
/bizcore/WEB-INF/demodata_core_src/com/test/demodata/formaction/FormActionManagerException.java
b3229ea6a14af68bc836cc729b6182639e0ec45c
[]
no_license
retail-ecommerce/demodata-biz-suite
8da63ae11ce5effe644840f91d3aa94b9a51346b
a4325887a5abcad9ec78273235bfad29b6c13334
refs/heads/master
2020-07-13T09:04:34.887504
2019-02-21T09:42:59
2019-02-21T09:42:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
562
java
package com.test.demodata.formaction; //import com.test.demodata.EntityNotFoundException; import com.test.demodata.DemodataException; import com.test.demodata.Message; import java.util.List; public class FormActionManagerException extends DemodataException { private static final long serialVersionUID = 1L; public FormActionManagerException(String string) { super(string); } public FormActionManagerException(Message message) { super(message); } public FormActionManagerException(List<Message> messageList) { super(messageList); } }
[ "philip_chang@163.com" ]
philip_chang@163.com
b25ecba2db4c3093665ee0f8184d4e2b4f0b932b
16e6fea7f051de1a31636dff105eda4c2ae27291
/src/com/app/bookcart/service/BookCartService.java
849719e7e269021dc6fa59c6d257cfc4f19b50f4
[]
no_license
Aparna-ck/ShoppingBookCart
b0b0b033ea8738ff62d0782a26e24bd0be788429
74cf6361d829f4f5cc4028961be89eef2dd2f8e6
refs/heads/master
2023-03-19T14:56:33.322172
2021-03-13T07:51:15
2021-03-13T07:51:15
347,307,477
0
0
null
null
null
null
UTF-8
Java
false
false
326
java
package com.app.bookcart.service; import java.util.List; import com.app.bookcart.entity.BookCart; import com.app.bookcart.entity.Order; public interface BookCartService { public List<BookCart> getBooks(); public BookCart getBookCart(int theId); public void saveOrder(Order theOrder); public long generateOrderId(); }
[ "ustjava07@iiht.tech" ]
ustjava07@iiht.tech
f23b477252c0ab4acae2968700e218fde7a31613
945766d0240baf19156dfa7dbb7bc0a7fdd9b8a5
/src/main/java/com/cacoota/porter/work/IWork.java
e587e159252b0f68d169a0fc5df1e94d0ad9fd55
[ "MIT" ]
permissive
yacoota/spring-boot-porter
ae7417f36f69f85342771f319ac1e5200ad157d7
6df3d7bb2aca2351fdf1a4a0e6883ed8e35d12d7
refs/heads/master
2022-04-23T16:31:23.095299
2020-04-28T12:00:05
2020-04-28T12:00:05
258,965,406
0
0
null
null
null
null
UTF-8
Java
false
false
57
java
package com.cacoota.porter.work; public class IWork { }
[ "gao_20022002@126.com" ]
gao_20022002@126.com
65e5c8e18671c49e18cdee68c847bea7efaaebe7
16959a628f3eb1923d77ac31e21ffed188801564
/singletonpattern/src/main/java/cn/com/datu/yangheng/demo/createHuman/HumanFactory.java
2701ffae64ef17490c8488cd6b3ef04735f716f7
[]
no_license
yh740018154/design-pattern
e1a01904861e5b7c1328912ac5da90ee9cbc50bf
92959828168289e941312d03995f73f425626625
refs/heads/master
2021-07-16T19:06:26.705543
2019-10-31T05:38:56
2019-10-31T05:38:56
217,418,308
0
0
null
2020-10-13T16:58:58
2019-10-25T00:25:36
Java
UTF-8
Java
false
false
309
java
package cn.com.datu.yangheng.demo.createHuman; /** * @author yangheng * @Classname HumanFactory * @Description 工厂模式的一般实现 * @Date 2019/10/30 15:07 * @group smart video north */ public interface HumanFactory { default Human creatHuman(Human human) { return null; } }
[ "yangheng@dragonsoft.com.cn" ]
yangheng@dragonsoft.com.cn
a21cd620bcd7d71676847ff74680aeee402615d0
27e111f3910ea4906b8fe2df9997a8647832443c
/src/com/coreJava/practice/constructorConcept/Contructor_Car_Apply.java
48c131e6d43f4e1785d107e63b805c7c162f6762
[]
no_license
KartickSaha/JAVA_PRACTICE_FOR_INTELLIJ
8c7fe01ba1ea82864f2b6f189542b0399f26024a
f75d33b178a226d02b88dc42d5881fc82e87cd5a
refs/heads/master
2022-11-24T13:40:42.203653
2020-07-29T06:35:47
2020-07-29T06:35:47
279,647,877
0
0
null
2020-07-27T03:55:03
2020-07-14T17:15:41
Java
UTF-8
Java
false
false
676
java
package com.coreJava.practice.constructorConcept; public class Contructor_Car_Apply { Constructor_Car car = new Constructor_Car(); public static void main(String[] args) { Constructor_Car car = new Constructor_Car(); car.setMake("BMW"); System.out.println("Result is : "+car.getMake()); System.out.println("Gear is : "+car.gear); System.out.println("Speed is : "+car.speed); System.out.println("***********************************"); Constructor_Car car2 = new Constructor_Car(2,35); System.out.println("Gear is : "+ car2.gear); System.out.println("Speed is : "+ car2.speed); } }
[ "kartick01@yahoo.com" ]
kartick01@yahoo.com
d1a6a1cc9f6d323ec55c4ac0f08ed34880c1779c
c69bcd09fda2fb4cdafb60dcbed065d37a6ab656
/dts-datasource/src/main/java/io/dts/datasource/AbstractDtsConnection.java
b11c48c8372e508914fbed5939e55171cbe3251c
[ "Apache-2.0" ]
permissive
henrypoter/dts
d354f2f92cf57739fcdf2666b114c319fce9f268
2c88e88f25b9575d3e40a344147828ce5f28a38e
refs/heads/master
2020-03-28T13:57:58.308291
2018-07-31T08:07:20
2018-07-31T08:09:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,590
java
package io.dts.datasource; import java.sql.Array; import java.sql.Blob; import java.sql.Clob; import java.sql.DatabaseMetaData; import java.sql.NClob; import java.sql.SQLClientInfoException; import java.sql.SQLException; import java.sql.SQLWarning; import java.sql.SQLXML; import java.sql.Savepoint; import java.sql.Struct; import java.util.Map; import java.util.Properties; import java.util.concurrent.Executor; import io.dts.resourcemanager.api.IDtsConnection; /** * Created by guoyubo on 2017/9/20. */ public abstract class AbstractDtsConnection implements IDtsConnection { @Override public void rollback(final Savepoint savepoint) throws SQLException { getRawConnection().rollback(savepoint); } @Override public boolean isWrapperFor(Class<?> iface) throws SQLException { return getRawConnection().isWrapperFor(iface); } @Override public <T> T unwrap(Class<T> iface) throws SQLException { return getRawConnection().unwrap(iface); } @Override public void clearWarnings() throws SQLException { getRawConnection().clearWarnings(); } @Override public Array createArrayOf(String typeName, Object[] elements) throws SQLException { return getRawConnection().createArrayOf(typeName, elements); } @Override public Blob createBlob() throws SQLException { return getRawConnection().createBlob(); } @Override public Clob createClob() throws SQLException { return getRawConnection().createClob(); } @Override public NClob createNClob() throws SQLException { return getRawConnection().createNClob(); } @Override public SQLXML createSQLXML() throws SQLException { return getRawConnection().createSQLXML(); } @Override public Struct createStruct(String typeName, Object[] attributes) throws SQLException { return getRawConnection().createStruct(typeName, attributes); } @Override public boolean getAutoCommit() throws SQLException { return getRawConnection().getAutoCommit(); } @Override public String getCatalog() throws SQLException { return getRawConnection().getCatalog(); } @Override public Properties getClientInfo() throws SQLException { return getRawConnection().getClientInfo(); } @Override public String getClientInfo(String name) throws SQLException { return getRawConnection().getClientInfo(name); } @Override public void setClientInfo(final String name, final String value) throws SQLClientInfoException { try { getRawConnection().setClientInfo(name, value); } catch (SQLException e) { throw new SQLClientInfoException(); } } @Override public int getHoldability() throws SQLException { return getRawConnection().getHoldability(); } @Override public DatabaseMetaData getMetaData() throws SQLException { return getRawConnection().getMetaData(); } @Override public int getTransactionIsolation() throws SQLException { return getRawConnection().getTransactionIsolation(); } @Override public Map<String, Class<?>> getTypeMap() throws SQLException { return getRawConnection().getTypeMap(); } @Override public SQLWarning getWarnings() throws SQLException { return getRawConnection().getWarnings(); } @Override public boolean isClosed() throws SQLException { return getRawConnection().isClosed(); } @Override public boolean isReadOnly() throws SQLException { return getRawConnection().isReadOnly(); } @Override public boolean isValid(int timeout) throws SQLException { return getRawConnection().isValid(timeout); } @Override public String nativeSQL(String sql) throws SQLException { return getRawConnection().nativeSQL(sql); } @Override public void releaseSavepoint(Savepoint savepoint) throws SQLException { getRawConnection().releaseSavepoint(savepoint); } @Override public void setCatalog(String catalog) throws SQLException { getRawConnection().setCatalog(catalog); } @Override public void setClientInfo(Properties properties) throws SQLClientInfoException { try { getRawConnection().setClientInfo(properties); } catch (SQLException e) { throw new SQLClientInfoException(); } } @Override public void setHoldability(int holdability) throws SQLException { getRawConnection().setHoldability(holdability); } @Override public void setReadOnly(boolean readOnly) throws SQLException { getRawConnection().setReadOnly(readOnly); } @Override public Savepoint setSavepoint() throws SQLException { return getRawConnection().setSavepoint(); } @Override public Savepoint setSavepoint(String name) throws SQLException { return getRawConnection().setSavepoint(name); } @Override public void setTransactionIsolation(int level) throws SQLException { getRawConnection().setTransactionIsolation(level); } @Override public void setTypeMap(Map<String, Class<?>> map) throws SQLException { getRawConnection().setTypeMap(map); } public void setSchema(String schema) throws SQLException { throw new UnsupportedOperationException(); } public String getSchema() throws SQLException { throw new UnsupportedOperationException(); } public void abort(Executor executor) throws SQLException { throw new UnsupportedOperationException(); } public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException { throw new UnsupportedOperationException(); } public int getNetworkTimeout() throws SQLException { throw new UnsupportedOperationException(); } }
[ "shiming.liu@dianrong.com" ]
shiming.liu@dianrong.com
59cc83f3e910ee7ee4bbbb72c5b321f207389806
dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9
/data_defect4j/preprossed_method_corpus/Chart/2/org/jfree/chart/axis/CategoryAxis_refreshTicks_1082.java
1bde4daef3e3c29bc0beaa700e1fd5c3d01a3d09
[]
no_license
hvdthong/NetML
dca6cf4d34c5799b400d718e0a6cd2e0b167297d
9bb103da21327912e5a29cbf9be9ff4d058731a5
refs/heads/master
2021-06-30T15:03:52.618255
2020-10-07T01:58:48
2020-10-07T01:58:48
150,383,588
1
1
null
2018-09-26T07:08:45
2018-09-26T07:08:44
null
UTF-8
Java
false
false
3,342
java
org jfree chart axi axi displai categori categori axi categoryaxi axi cloneabl serializ creat temporari list tick draw axi param graphic devic font measur param state axi state param data area dataarea area insid ax param edg locat axi list tick list refresh tick refreshtick graphics2 graphics2d axi state axisst state rectangle2 rectangle2d data area dataarea rectangl edg rectangleedg edg list tick java util arrai list arraylist saniti check data area data area dataarea height getheight data area dataarea width getwidth tick categori plot categoryplot plot categori plot categoryplot plot getplot list categori plot categori axi getcategoriesforaxi max categori categori label posit categorylabelposit posit categori label posit categorylabelposit label posit getlabelposit edg maximum categori label width ratio maximumcategorylabelwidthratio posit width ratio getwidthratio posit width type getwidthtyp categori label width type categorylabelwidthtyp categori calcul categori size calculatecategorys categori size data area dataarea edg rectangl edg rectangleedg left isleftorright edg data area dataarea width getwidth data area dataarea height getheight categori index categoryindex iter iter categori iter iter hasnext compar categori compar iter set font setfont tick label font getticklabelfont categori text block textblock label creat label createlabel categori edg edg rectangl edg rectangleedg top edg rectangl edg rectangleedg bottom max math max max calcul text block height calculatetextblockheight label posit edg rectangl edg rectangleedg left edg rectangl edg rectangleedg max math max max calcul text block width calculatetextblockwidth label posit tick tick categori tick categorytick categori label posit label anchor getlabelanchor posit rotat anchor getrotationanchor posit angl getangl tick add tick categori index categoryindex categori index categoryindex state set max setmax max tick
[ "hvdthong@gmail.com" ]
hvdthong@gmail.com
5b3f379f571d2d440a78308210d9d4323305afde
397a5a62c0115feef5e7c82912e286c3b636edc3
/src/main/java/com/ars/airlinereservationsystem/service/impl/MessageServicesImpl.java
95e0f3ebc300653e0610ec060a430e892cf0510d
[]
no_license
Lor-barh/Airline-Reservation-System
c03336f8ebaaf7fd448b4cfd1d906da9a00b4192
3c488cdff78df0d6b72561a7c5d525d64d22069d
refs/heads/main
2023-08-10T11:48:32.054818
2021-09-20T21:45:36
2021-09-20T21:45:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
959
java
package com.ars.airlinereservationsystem.service.impl; import com.ars.airlinereservationsystem.models.Message; import com.ars.airlinereservationsystem.repositories.MessageRepository; import com.ars.airlinereservationsystem.service.MessageServices; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service public class MessageServicesImpl implements MessageServices { @Autowired private MessageRepository messageRepository; @Override public void saveMessage(Message message) { messageRepository.save(message); } @Override public List<Message> getAllMessage() { return messageRepository.findAll(); } @Override public Message getMessageById(Integer MessageId) { return null; } @Override public void deleteMessageById(Integer messageId) { messageRepository.deleteById(messageId); } }
[ "mac@Goodluck.local" ]
mac@Goodluck.local
59e911b1e0edde614bd6fe3edee3c34a19a508aa
d754f8c07571c35530069e8cd43a41898ad3402c
/src/main/java/com/ml_text_utils/shell/BuildWiredItFileSystemCorpusShell.java
c8a597d59fec9fe3bb39fadd7f6a8889cbc923fa
[ "Apache-2.0" ]
permissive
ahmedyes2000/wired-it-text-classification-ml
381d80e3405f088db7a2f0a41c989d6c6ac1cd8b
4bd4a6e8cdaeedafaabbf5176e95a35309775f29
refs/heads/master
2022-12-28T20:27:45.493396
2019-09-20T08:14:20
2019-09-20T08:14:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,770
java
/* * Copyright 2019 Piercarlo Slavazza * * 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.ml_text_utils.shell; import com.fasterxml.jackson.databind.ObjectMapper; import com.lexicalscope.jewel.cli.CliFactory; import com.lexicalscope.jewel.cli.Option; import com.ml_text_utils.TextDocumentsStream; import com.ml_text_utils.corpus.CorpusClassStatistics; import com.ml_text_utils.corpus.CorpusConstraints; import com.ml_text_utils.corpus.CorpusStatistics; import com.ml_text_utils.corpus.FileSystemCorpusBuilder; import com.ml_text_utils.impl.wired_it.WiredItCreativeCommonsArticlesTextStream; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.File; import java.io.IOException; import java.util.Collections; import java.util.Optional; import java.util.Set; import java.util.function.Predicate; interface BuildWiredItFileSystemCorpusShellConfig { @Option File getWiredItArticlesJsonFile(); @Option File getSplitCorpusOutputFolder(); @Option Integer getMinDocsPerClass(); @Option Integer getMaxDocsPerClass(); @SuppressWarnings("unused") boolean isMaxDocsPerClass(); @Option double getTrainingSetRate(); } public class BuildWiredItFileSystemCorpusShell { private final static Logger log = LoggerFactory.getLogger(BuildWiredItFileSystemCorpusShell.class); private static final Predicate<CorpusClassStatistics> IS_TRAIN_TEST_SPLIT_VALID = corpusClassStatistics -> { if (corpusClassStatistics.getTrainingDocumentsCount() == 0) return false; return corpusClassStatistics.getTestDocumentsCount() > 0; }; private static Predicate<CorpusClassStatistics> buildClassesFilter(Set<String> skipClasses) { return corpusClassStatistics -> !skipClasses.contains(corpusClassStatistics.getClassLabel().getName()) && IS_TRAIN_TEST_SPLIT_VALID.test(corpusClassStatistics); } public static void main(String[] args) throws IOException { BuildWiredItFileSystemCorpusShellConfig config = CliFactory.parseArguments(BuildWiredItFileSystemCorpusShellConfig.class, args); log.info("start|configs" + config.toString()); assert config.getWiredItArticlesJsonFile().exists(); assert config.getSplitCorpusOutputFolder().isDirectory(); TextDocumentsStream textDocumentsStream = WiredItCreativeCommonsArticlesTextStream.createStreamFromJSON(config.getWiredItArticlesJsonFile()); Predicate<CorpusClassStatistics> classesFilter = buildClassesFilter(Collections.emptySet()); FileSystemCorpusBuilder fileSystemCorpusBuilder = new FileSystemCorpusBuilder(classesFilter); CorpusConstraints corpusConstraints = new CorpusConstraints(config.getMinDocsPerClass(), Optional.ofNullable(config.getMaxDocsPerClass())); CorpusStatistics corpusStatistics = fileSystemCorpusBuilder.buildCorpusBySplittingTrainingAndTestSet(textDocumentsStream, config.getSplitCorpusOutputFolder(), config.getTrainingSetRate(), corpusConstraints); File corpusStatisticsFile = new File(config.getSplitCorpusOutputFolder().getParentFile().getPath() + File.separator + config.getSplitCorpusOutputFolder().getName() + ".json"); new ObjectMapper().writerWithDefaultPrettyPrinter().writeValue(corpusStatisticsFile, corpusStatistics); } }
[ "p.slavazza@kie-services.com" ]
p.slavazza@kie-services.com
b40eed65282b46f6a44159a48a3f554638c545d3
a6c4c610954f19d4b144d47352a4527f7d7b404a
/src/main/java/com/minibootcamp/ada/Line.java
2e90f0a205b83b3292ae0fc2cb11c55d09af0a37
[]
no_license
YudoWorks/Geometry
7a25d63d5bdc432e0e9845055ebca6f9d1f089f4
6169338c9936c596acab8d1b6e609eab7caebbb4
refs/heads/main
2023-08-29T11:21:18.349420
2021-09-23T05:18:44
2021-09-23T05:18:44
409,458,386
0
0
null
null
null
null
UTF-8
Java
false
false
851
java
package com.minibootcamp.ada; public class Line { private Point firstPoint; private Point secondPoint; public Line(Point firstPoint, Point secondPoint) { this.firstPoint = firstPoint; this.secondPoint = secondPoint; } static public boolean isEqual(Line firstLine, Line secondLine) { return true; } public int getLength() { if (this.firstPoint.y == this.secondPoint.y) { if (this.firstPoint.x < this.secondPoint.x) { return secondPoint.x - firstPoint.x; } else if (this.firstPoint.x > this.secondPoint.x) { return firstPoint.x - secondPoint.x; } } else if (this.firstPoint.y > this.secondPoint.y) { return firstPoint.y - secondPoint.y; } return secondPoint.y - firstPoint.y; } }
[ "yudoworks@gmail.com" ]
yudoworks@gmail.com
8dadfd9cf13a7b64d3998f416d1265343c48a333
f18b3dd415b80130ad779b611c2d0ea777915f16
/02. OOP/04. Abstract Classes and Interfaces/In-class activity/Polymorphism/Solution/src/com/telerikacademy/Board.java
037fd19fe9adb2725a4ce8d8ce28f70323d4c921
[]
no_license
GabrielaGeorgieva1/Generic
08fa9d4c5eff30c51e514fb71009a4385c5db3a6
85d365cb8e29d620513fa1ef0c37442dca05d090
refs/heads/main
2023-07-10T21:50:49.346019
2021-08-03T10:10:59
2021-08-03T10:10:59
391,967,375
0
0
null
null
null
null
UTF-8
Java
false
false
599
java
package com.telerikacademy; import java.util.ArrayList; import java.util.List; public class Board { private final List<BoardItem> items; public Board() { items = new ArrayList<>(); } public void addItem(BoardItem item) { if (items.contains(item)) { throw new IllegalArgumentException("Item already in the list"); } items.add(item); } public int totalItems() { return items.size(); } public void displayHistory() { for (BoardItem item : items) { item.displayHistory(); } } }
[ "vladimir@telerikacademy.com" ]
vladimir@telerikacademy.com
cd52a82e6f2f41ab5ccb74b18ef9f9d2d6df1828
62efd3b52e2c4f277d74c7d30e66dd9daa29287e
/Version control/src for vid 7 Images!/dev/algorythmic/KoC/Game.java
3ed8e1df5cf476af39b2a5f1dade8ac655ab464d
[]
no_license
stjohnj0331/Knights-of-Camelot
2768666a5ab178d5275e1bba22367a6971f7b087
f02d2aaa3e74673229ab06a76e741fc761509877
refs/heads/master
2021-06-16T11:02:05.835601
2021-04-27T17:53:09
2021-04-27T17:53:09
197,420,193
0
0
null
null
null
null
UTF-8
Java
false
false
3,257
java
package dev.algorythmic.KoC; import dev.algorythmic.KoC.display.Display; import dev.algorythmic.KoC.gfx.ImageLoader; import java.awt.Color; import java.awt.Graphics; import java.awt.image.BufferStrategy; import java.awt.image.BufferedImage; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open thes template in the editor. */ /** * * @author justin * The main class of our game * it will open, run, and close our game. */ public class Game implements Runnable{ //CLASS VARIABLES private Display display; public int width, height; public String title; private boolean running = false;//FOR OUR THREAD private BufferStrategy bs; private Graphics g; //TEST CODE private BufferedImage image; //CONSTRUCTOR public Game(String title, int width, int height){ this.width = width; this.height = height; this.title = title; } //OTHER METHODS /** * Used to run all of our graphics * called in the start() method */ private void init(){ display = new Display(title,width,height); image = ImageLoader.loadImage("/textures/anime.png"); } /** * tick() will update our variables */ private void tick(){ } /** * render() will render our game or draw to the screen */ private void render(){ bs = display.getCanvas().getBufferStrategy(); if(bs == null){ display.getCanvas().createBufferStrategy(3); return; } g = bs.getDrawGraphics();//our paint brush //CLEAR THE SCREEN g.clearRect(0, 0, width, height); //DRAW HERE (order matters) g.drawImage(image, 0, 0, null); //END OF DRAWING MUST DO!!!! bs.show(); g.dispose(); } /** * used to run the game loop */ @Override public void run() { init(); while(running){ tick(); render(); } stop(); } //THREAD CODE /** * threads are mini programs that run separately from the rest of the code in our application */ private Thread thread; /** * we always use synchronized methods when working with threads * checks for an instance of our game and starts it if running is false */ public synchronized void start(){ if(running) return; running = true; thread = new Thread(this); thread.start();//calls the run method above } /** * thread.join must be surrounded by a try/catch for exception handling * checks for an instance of our game and stops it if running is true */ public synchronized void stop(){ if(!running) return; running = false; try { thread.join(); } catch (InterruptedException ex) { ex.printStackTrace(); } } }
[ "stjohnjustin26@gmail.com" ]
stjohnjustin26@gmail.com
2e0b3f46155a197fe75e73eba4c2810862ab64e4
3219d84e62ef3d5cc4bb30014e6d7e6f9e0c60e0
/src/main/java/com/zzz/designPatterns/prototype/Main.java
8d261eceeb951e7f5578a8bfa8aa0bec7c5624f6
[]
no_license
KeKeKuKi/DesignPatterns
59f7bf92e4b1b16e116ba7f2586c34c3d954a8c1
1c312ce7bcd8494d1e62a48214f4616eb06c4f17
refs/heads/main
2023-06-25T01:33:41.975775
2021-08-02T01:23:00
2021-08-02T01:23:00
391,781,660
1
0
null
null
null
null
UTF-8
Java
false
false
3,304
java
package com.zzz.designPatterns.prototype; import java.util.Date; /** * @author ZhaoZezhong * date 2021/7/28 18:37 * * 原型模式 * * 意图:用原型实例指定创建对象的种类,并且通过拷贝这些原型创建新的对象。 * 主要解决:在运行期建立和删除原型。 * 何时使用: * 1、当一个系统应该独立于它的产品创建,构成和表示时。 * 2、当要实例化的类是在运行时刻指定时,例如,通过动态装载。 * 3、为了避免创建一个与产品类层次平行的工厂类层次时。 * 4、当一个类的实例只能有几个不同状态组合中的一种时。建立相应数目的原型并克隆它们可能比每次用合适的状态手工实例化该类更方便一些。 * 如何解决:利用已有的一个原型对象,快速地生成和原型对象一样的实例。 * 关键代码: * 1、实现克隆操作,在 JAVA 继承 Cloneable,重写 clone(),实现深拷贝 * 2、原型模式同样用于隔离类对象的使用者和具体类型(易变类)之间的耦合关系,它同样要求这些"易变类"拥有稳定的接口。 * 应用实例: 1、细胞分裂。 2、JAVA 中的 Object clone() 方法。 * 优点: 1、性能提高。 2、逃避构造函数的约束。 * 缺点: * 1、配备克隆方法需要对类的功能进行通盘考虑,这对于全新的类不是很难,但对于已有的类不一定很容易, * 特别当一个类引用不支持串行化的间接对象,或者引用含有循环结构的时候。 * 2、必须实现 Cloneable 接口。 * 使用场景: * 1、资源优化场景。 * 2、类初始化需要消化非常多的资源,这个资源包括数据、硬件资源等。 * 3、性能和安全要求的场景。 * 4、通过 new 产生一个对象需要非常繁琐的数据准备或访问权限,则可以使用原型模式。 * 5、一个对象多个修改者的场景。 * 6、一个对象需要提供给其他对象访问,而且各个调用者可能都需要修改其值时,可以考虑使用原型模式拷贝多个对象供调用者使用。 * 7、在实际项目中,原型模式很少单独出现,一般是和工厂方法模式一起出现,通过 clone 的方法创建一个对象,然后由工厂方法提供给调用者。 * 原型模式已经与 Java 融为浑然一体,大家可以随手拿来使用。 * 注意事项: * 与通过对一个类进行实例化来构造新对象不同的是,原型模式是通过拷贝一个现有对象生成新对象的。 * 浅拷贝实现 Cloneable,重写,深拷贝是通过实现 Serializable 读取二进制流。 */ public class Main { public static void main(String[] args) throws CloneNotSupportedException { Video video = new Video(); video.setName("hello"); video.setCreatedDate(new Date(54654544)); Video video1 = (Video)video.clone(); System.out.println("video :" + video.toString()); System.out.println("video1 :" + video1.toString()); video.setCreatedDate(new Date(11111)); System.out.println("------------------------"); System.out.println("video :" + video.toString()); System.out.println("video1 :" + video1.toString()); } }
[ "2669918628@qq.com" ]
2669918628@qq.com
446898810029d47231a307447b55c10cac321665
d96d62b10f84bd0a0900ac3554557128bd968a9b
/src/com/asus/kptaipei/RealManKP.java
5d3ee54814ffce100992dc08cb5e8dd0e77d9029
[]
no_license
shinjikao/kptaipei
a2656dd25c3ff4ff55f2d7a5e1fbf8b646579586
0d77528e22fd907b819491253b98deb6978640c7
refs/heads/master
2020-04-26T18:13:48.505718
2015-06-27T08:09:57
2015-06-27T08:09:57
24,219,831
0
0
null
null
null
null
UTF-8
Java
false
false
6,124
java
package com.asus.kptaipei; import java.util.ArrayList; import java.util.HashMap; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.app.Fragment; import android.app.FragmentManager; import android.app.ListFragment; import android.app.ProgressDialog; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ListAdapter; import android.widget.ListView; import android.widget.SimpleAdapter; import android.widget.TextView; import android.widget.Toast; import com.android.volley.Request.Method; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.VolleyLog; import com.android.volley.toolbox.JsonObjectRequest; import com.asus.kptaipei.app.AppController; public class RealManKP extends ListFragment { private static String TAG = "KP"; private static String urlPolitics = ""; private static String urlRealMan = ""; private static String urlNews = ""; private String page = ""; private String page_size = ""; // Progress dialog private ProgressDialog pDialog; private TextView txtResponse; private String jsonResponse; public static String tag_isSuccess = "isSuccess"; public static String tag_id = "id"; public static String tag_title = "title"; public static String tag_post_date = "post_date"; public static String tag_author = "author"; public static String tag_last_modify = "last_modify"; public static String tag_url = "url"; public static String tag_category_name = "category_name"; public static String tag_category_id = "category_id"; public static String tag_content = "content"; // Hashmap for ListView public ArrayList<HashMap<String, String>> politicsList; @Override public void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Log.i(TAG, "onCreateView[RealManKP]"); // get json data urlRealMan = getResources().getString(R.string.urlRealMan); politicsList = new ArrayList<HashMap<String, String>>(); pDialog = new ProgressDialog(getActivity()); pDialog.setMessage("Please wait..."); pDialog.setCancelable(false); makeJsonObjectRequest(); View rootView = inflater.inflate(R.layout.fragment_realman, container, false); return rootView; } private void makeJsonObjectRequest() { showDialog(); JsonObjectRequest jsonObjReq = new JsonObjectRequest(Method.GET, urlRealMan, null, new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { try { Log.d(TAG, String.valueOf(response.length())); String isScccuess = response.getString(tag_isSuccess); JSONArray data = response.getJSONArray("data"); String idd = ""; String title = ""; String post_date = ""; String url = ""; String author = ""; String category_name = ""; String content = ""; for (int i = 0; i < data.length(); i++) { JSONObject _politics = (JSONObject) data.get(i); idd = _politics.getString("id"); title = _politics.getString("title"); post_date = _politics.getString("post_date"); url = _politics.getString("url"); author = _politics.getString("author"); category_name = _politics .getString("category_name"); content = _politics.getString("content"); HashMap<String, String> retVal = new HashMap<String, String>(); retVal.put(tag_id, idd); retVal.put(tag_title, title); retVal.put(tag_post_date, post_date); retVal.put(tag_url, url); retVal.put(tag_author, author); retVal.put(tag_url, url); retVal.put(tag_content, content); retVal.put(tag_category_name, category_name); politicsList.add(retVal); } ListAdapter adapter = new SimpleAdapter(getActivity(), politicsList, R.layout.list_item_rkp, new String[] { tag_id, tag_title, tag_post_date, tag_category_name, tag_url }, new int[] { R.id.id, R.id.title, R.id.post_date, R.id.category, R.id.url }); setListAdapter(adapter); ListView lv = getListView(); // listening to single list item on click lv.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // to single page Fragment fragment = null; fragment = new SingleListItem_RealManKP( politicsList.get(position)); if (fragment != null) { FragmentManager fragmentManager = getFragmentManager(); fragmentManager .beginTransaction() .replace(R.id.frame_container, fragment) .addToBackStack(null) .commit(); } else { Log.e(TAG, "Error in create fragment"); } } }); } catch (JSONException e) { e.printStackTrace(); Toast.makeText(getActivity(), "Error " + e.getMessage(), Toast.LENGTH_LONG).show(); } hideDialog(); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { VolleyLog.d(TAG, "Error " + error.getMessage()); Toast.makeText(getActivity(), error.getMessage(), Toast.LENGTH_SHORT).show(); hideDialog(); } }); AppController.getInstance().addToRequestQueue(jsonObjReq); } private void showDialog() { if (!pDialog.isShowing()) pDialog.show(); } private void hideDialog() { if (pDialog.isShowing()) pDialog.dismiss(); } }
[ "shinjikao@gmail.com" ]
shinjikao@gmail.com
101dad4df153bd79462dd893ace783d1394d19d9
11d836bfdf345d90fd1aa41f4a148a31af1727da
/classes/android/support/v4/g/c.java
02c1481a41c7415ae86c22e4113b458ced0a79f1
[]
no_license
BoUnCe587/Real3DOPlayer
ef24cfb561f9df403679dc7d815e8b3004dccf59
a6eb74831fc22bf1d8716e6006c5d20541447b01
refs/heads/master
2020-11-28T01:27:30.544544
2019-12-23T04:14:09
2019-12-23T04:14:09
198,389,583
0
0
null
null
null
null
UTF-8
Java
false
false
10,783
java
package android.support.v4.g; import java.util.LinkedHashMap; public class c<K, V> extends Object { private final LinkedHashMap<K, V> a; private int b; private int c; private int d; private int e; private int f; private int g; private int h; public c(int paramInt) { if (paramInt <= 0) throw new IllegalArgumentException("maxSize <= 0"); this.c = paramInt; this.a = new LinkedHashMap(0, 0.75F, true); } private int c(K paramK, V paramV) { int i = b(paramK, paramV); if (i < 0) throw new IllegalStateException("Negative size: " + paramK + "=" + paramV); return i; } public final V a(K paramK) { // Byte code: // 0: aload_1 // 1: ifnonnull -> 14 // 4: new java/lang/NullPointerException // 7: dup // 8: ldc 'key == null' // 10: invokespecial <init> : (Ljava/lang/String;)V // 13: athrow // 14: aload_0 // 15: monitorenter // 16: aload_0 // 17: getfield a : Ljava/util/LinkedHashMap; // 20: aload_1 // 21: invokevirtual get : (Ljava/lang/Object;)Ljava/lang/Object; // 24: astore_2 // 25: aload_2 // 26: ifnull -> 43 // 29: aload_0 // 30: aload_0 // 31: getfield g : I // 34: iconst_1 // 35: iadd // 36: putfield g : I // 39: aload_0 // 40: monitorexit // 41: aload_2 // 42: areturn // 43: aload_0 // 44: aload_0 // 45: getfield h : I // 48: iconst_1 // 49: iadd // 50: putfield h : I // 53: aload_0 // 54: monitorexit // 55: aload_0 // 56: aload_1 // 57: invokevirtual b : (Ljava/lang/Object;)Ljava/lang/Object; // 60: astore_2 // 61: aload_2 // 62: ifnonnull -> 72 // 65: aconst_null // 66: areturn // 67: astore_1 // 68: aload_0 // 69: monitorexit // 70: aload_1 // 71: athrow // 72: aload_0 // 73: monitorenter // 74: aload_0 // 75: aload_0 // 76: getfield e : I // 79: iconst_1 // 80: iadd // 81: putfield e : I // 84: aload_0 // 85: getfield a : Ljava/util/LinkedHashMap; // 88: aload_1 // 89: aload_2 // 90: invokevirtual put : (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; // 93: astore_3 // 94: aload_3 // 95: ifnull -> 124 // 98: aload_0 // 99: getfield a : Ljava/util/LinkedHashMap; // 102: aload_1 // 103: aload_3 // 104: invokevirtual put : (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; // 107: pop // 108: aload_0 // 109: monitorexit // 110: aload_3 // 111: ifnull -> 147 // 114: aload_0 // 115: iconst_0 // 116: aload_1 // 117: aload_2 // 118: aload_3 // 119: invokevirtual a : (ZLjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V // 122: aload_3 // 123: areturn // 124: aload_0 // 125: aload_0 // 126: getfield b : I // 129: aload_0 // 130: aload_1 // 131: aload_2 // 132: invokespecial c : (Ljava/lang/Object;Ljava/lang/Object;)I // 135: iadd // 136: putfield b : I // 139: goto -> 108 // 142: astore_1 // 143: aload_0 // 144: monitorexit // 145: aload_1 // 146: athrow // 147: aload_0 // 148: aload_0 // 149: getfield c : I // 152: invokevirtual a : (I)V // 155: aload_2 // 156: areturn // Exception table: // from to target type // 16 25 67 finally // 29 41 67 finally // 43 55 67 finally // 68 70 67 finally // 74 94 142 finally // 98 108 142 finally // 108 110 142 finally // 124 139 142 finally // 143 145 142 finally } public final V a(K paramK, V paramV) { // Byte code: // 0: aload_1 // 1: ifnull -> 8 // 4: aload_2 // 5: ifnonnull -> 18 // 8: new java/lang/NullPointerException // 11: dup // 12: ldc 'key == null || value == null' // 14: invokespecial <init> : (Ljava/lang/String;)V // 17: athrow // 18: aload_0 // 19: monitorenter // 20: aload_0 // 21: aload_0 // 22: getfield d : I // 25: iconst_1 // 26: iadd // 27: putfield d : I // 30: aload_0 // 31: aload_0 // 32: getfield b : I // 35: aload_0 // 36: aload_1 // 37: aload_2 // 38: invokespecial c : (Ljava/lang/Object;Ljava/lang/Object;)I // 41: iadd // 42: putfield b : I // 45: aload_0 // 46: getfield a : Ljava/util/LinkedHashMap; // 49: aload_1 // 50: aload_2 // 51: invokevirtual put : (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; // 54: astore_3 // 55: aload_3 // 56: ifnull -> 74 // 59: aload_0 // 60: aload_0 // 61: getfield b : I // 64: aload_0 // 65: aload_1 // 66: aload_3 // 67: invokespecial c : (Ljava/lang/Object;Ljava/lang/Object;)I // 70: isub // 71: putfield b : I // 74: aload_0 // 75: monitorexit // 76: aload_3 // 77: ifnull -> 88 // 80: aload_0 // 81: iconst_0 // 82: aload_1 // 83: aload_3 // 84: aload_2 // 85: invokevirtual a : (ZLjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V // 88: aload_0 // 89: aload_0 // 90: getfield c : I // 93: invokevirtual a : (I)V // 96: aload_3 // 97: areturn // 98: astore_1 // 99: aload_0 // 100: monitorexit // 101: aload_1 // 102: athrow // Exception table: // from to target type // 20 55 98 finally // 59 74 98 finally // 74 76 98 finally // 99 101 98 finally } public void a(int paramInt) { // Byte code: // 0: aload_0 // 1: monitorenter // 2: aload_0 // 3: getfield b : I // 6: iflt -> 26 // 9: aload_0 // 10: getfield a : Ljava/util/LinkedHashMap; // 13: invokevirtual isEmpty : ()Z // 16: ifeq -> 64 // 19: aload_0 // 20: getfield b : I // 23: ifeq -> 64 // 26: new java/lang/IllegalStateException // 29: dup // 30: new java/lang/StringBuilder // 33: dup // 34: invokespecial <init> : ()V // 37: aload_0 // 38: invokevirtual getClass : ()Ljava/lang/Class; // 41: invokevirtual getName : ()Ljava/lang/String; // 44: invokevirtual append : (Ljava/lang/String;)Ljava/lang/StringBuilder; // 47: ldc '.sizeOf() is reporting inconsistent results!' // 49: invokevirtual append : (Ljava/lang/String;)Ljava/lang/StringBuilder; // 52: invokevirtual toString : ()Ljava/lang/String; // 55: invokespecial <init> : (Ljava/lang/String;)V // 58: athrow // 59: astore_2 // 60: aload_0 // 61: monitorexit // 62: aload_2 // 63: athrow // 64: aload_0 // 65: getfield b : I // 68: iload_1 // 69: if_icmple -> 82 // 72: aload_0 // 73: getfield a : Ljava/util/LinkedHashMap; // 76: invokevirtual isEmpty : ()Z // 79: ifeq -> 85 // 82: aload_0 // 83: monitorexit // 84: return // 85: aload_0 // 86: getfield a : Ljava/util/LinkedHashMap; // 89: invokevirtual entrySet : ()Ljava/util/Set; // 92: invokeinterface iterator : ()Ljava/util/Iterator; // 97: invokeinterface next : ()Ljava/lang/Object; // 102: checkcast java/util/Map$Entry // 105: astore_3 // 106: aload_3 // 107: invokeinterface getKey : ()Ljava/lang/Object; // 112: astore_2 // 113: aload_3 // 114: invokeinterface getValue : ()Ljava/lang/Object; // 119: astore_3 // 120: aload_0 // 121: getfield a : Ljava/util/LinkedHashMap; // 124: aload_2 // 125: invokevirtual remove : (Ljava/lang/Object;)Ljava/lang/Object; // 128: pop // 129: aload_0 // 130: aload_0 // 131: getfield b : I // 134: aload_0 // 135: aload_2 // 136: aload_3 // 137: invokespecial c : (Ljava/lang/Object;Ljava/lang/Object;)I // 140: isub // 141: putfield b : I // 144: aload_0 // 145: aload_0 // 146: getfield f : I // 149: iconst_1 // 150: iadd // 151: putfield f : I // 154: aload_0 // 155: monitorexit // 156: aload_0 // 157: iconst_1 // 158: aload_2 // 159: aload_3 // 160: aconst_null // 161: invokevirtual a : (ZLjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V // 164: goto -> 0 // Exception table: // from to target type // 2 26 59 finally // 26 59 59 finally // 60 62 59 finally // 64 82 59 finally // 82 84 59 finally // 85 156 59 finally } protected void a(boolean paramBoolean, K paramK, V paramV1, V paramV2) {} protected int b(K paramK, V paramV) { return 1; } protected V b(K paramK) { return null; } public final String toString() { // Byte code: // 0: iconst_0 // 1: istore_1 // 2: aload_0 // 3: monitorenter // 4: aload_0 // 5: getfield g : I // 8: aload_0 // 9: getfield h : I // 12: iadd // 13: istore_2 // 14: iload_2 // 15: ifeq -> 28 // 18: aload_0 // 19: getfield g : I // 22: bipush #100 // 24: imul // 25: iload_2 // 26: idiv // 27: istore_1 // 28: ldc 'LruCache[maxSize=%d,hits=%d,misses=%d,hitRate=%d%%]' // 30: iconst_4 // 31: anewarray java/lang/Object // 34: dup // 35: iconst_0 // 36: aload_0 // 37: getfield c : I // 40: invokestatic valueOf : (I)Ljava/lang/Integer; // 43: aastore // 44: dup // 45: iconst_1 // 46: aload_0 // 47: getfield g : I // 50: invokestatic valueOf : (I)Ljava/lang/Integer; // 53: aastore // 54: dup // 55: iconst_2 // 56: aload_0 // 57: getfield h : I // 60: invokestatic valueOf : (I)Ljava/lang/Integer; // 63: aastore // 64: dup // 65: iconst_3 // 66: iload_1 // 67: invokestatic valueOf : (I)Ljava/lang/Integer; // 70: aastore // 71: invokestatic format : (Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String; // 74: astore_3 // 75: aload_0 // 76: monitorexit // 77: aload_3 // 78: areturn // 79: astore_3 // 80: aload_0 // 81: monitorexit // 82: aload_3 // 83: athrow // Exception table: // from to target type // 4 14 79 finally // 18 28 79 finally // 28 75 79 finally } }
[ "James_McNamee123@hotmail.com" ]
James_McNamee123@hotmail.com
7767f642048bd0921c66d40ed76d7ff10faab579
18653f5af6cabf0647fd946cac63bd9011c00ffc
/src/main/java/com/sm/po/Role.java
a770fae001f8d5823773e7a9016ecf15552ed005
[]
no_license
gzhaoguoqing/society_manager
419bbab27de664c7b8bb72006b5ec42d45d00425
71489fee5d70c117f12bfb7d6bd0063e12f58638
refs/heads/master
2022-07-03T02:57:44.541793
2019-06-17T14:55:57
2019-06-17T14:55:57
185,556,990
2
0
null
2022-06-21T01:06:50
2019-05-08T07:41:14
Java
UTF-8
Java
false
false
651
java
package com.sm.po; public class Role { private String id; private String name; private String permissionIds; public String getId() { return id; } public void setId(String id) { this.id = id == null ? null : id.trim(); } public String getName() { return name; } public void setName(String name) { this.name = name == null ? null : name.trim(); } public String getPermissionIds() { return permissionIds; } public void setPermissionIds(String permissionIds) { this.permissionIds = permissionIds == null ? null : permissionIds.trim(); } }
[ "930574465@qq.com" ]
930574465@qq.com
e6d8ac3393275f6f71a580f0d515572fae8a0aa4
750915fe2d94e2f7b5bc3470de5a310450045aca
/feature/setting/touchcapture/src/com/freeme/camera/feature/setting/touchcapture/TouchCaptureSettingView.java
a16b6fd8ffb4949b0ca1b022b22a1ee5800ba574
[]
no_license
AllenZhang2019/Camera2-refect
8e1533042898711391e7217fb03482b501ade68a
f029e6eb9f561c9ce560104d72a1a6c5e9fde93e
refs/heads/master
2021-01-02T15:56:54.630751
2018-10-15T02:11:43
2018-10-15T02:11:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,529
java
/* * Copyright Statement: * * This software/firmware and related documentation ("MediaTek Software") are * protected under relevant copyright laws. The information contained herein is * confidential and proprietary to MediaTek Inc. and/or its licensors. Without * the prior written permission of MediaTek inc. and/or its licensors, any * reproduction, modification, use or disclosure of MediaTek Software, and * information contained herein, in whole or in part, shall be strictly * prohibited. * * MediaTek Inc. (C) 2016. All rights reserved. * * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER * ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR * NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH * RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, * INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES * TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. * RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO * OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK * SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE * RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S * ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE * RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE * MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE * CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. * * The following software/firmware and/or related documentation ("MediaTek * Software") have been modified by MediaTek Inc. All revisions are subject to * any receiver's applicable license agreements with MediaTek Inc. */ package com.freeme.camera.feature.setting.touchcapture; import android.preference.Preference; import android.preference.PreferenceFragment; import android.preference.PreferenceGroup; import com.freeme.camera.R; import com.freeme.camera.common.debug.LogHelper; import com.freeme.camera.common.debug.LogUtil; import com.freeme.camera.common.preference.SwitchPreference; import com.freeme.camera.common.setting.ICameraSettingView; import java.util.List; /** * EIS setting view. */ public class TouchCaptureSettingView implements ICameraSettingView { private static final LogUtil.Tag TAG = new LogUtil.Tag(TouchCaptureSettingView.class.getSimpleName()); private OnVolumeCaptureClickListener mListener; private SwitchPreference mPref; private boolean mChecked; private String mKey; private boolean mEnabled; /** * Listener to listen zsd is clicked. */ public interface OnVolumeCaptureClickListener { /** * Callback when zsd item is clicked by user. * * @param checked True means zsd is opened, false means zsd is closed. */ void onVolumeCaptureClicked(boolean checked); } /** * Zsd setting view constructor. * * @param key The key of setting. */ public TouchCaptureSettingView(String key) { mKey = key; } @Override public void loadView(PreferenceFragment fragment) { fragment.addPreferencesFromResource(R.xml.touch_capture_preference); mPref = (SwitchPreference) fragment.findPreference(mKey); mPref.setRootPreference(fragment.getPreferenceScreen()); mPref.setId(R.id.touchcapture_setting); mPref.setContentDescription(fragment.getActivity().getResources() .getString(R.string.touch_capture_content_description)); mPref.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object o) { boolean checked = (Boolean) o; mChecked = checked; mListener.onVolumeCaptureClicked(checked); return true; } }); mPref.setEnabled(mEnabled); } @Override public void refreshView() { if (mPref != null) { mPref.setChecked(mChecked); mPref.setEnabled(mEnabled); } } @Override public void unloadView() { LogHelper.d(TAG, "[unloadView]"); } @Override public void setEnabled(boolean enabled) { mEnabled = enabled; } @Override public boolean isEnabled() { return mEnabled; } @Override public String getKey() { return mKey; } /** * Set listener to listen zsd is clicked. * * @param listener The instance of {@link OnVolumeCaptureClickListener}. */ public void setTouchCaptureOnClickListener(OnVolumeCaptureClickListener listener) { mListener = listener; } /** * Set zsd state. * * @param checked True means zsd is opened, false means zsd is closed. */ public void setChecked(boolean checked) { mChecked = checked; } }
[ "luoran@droi.com" ]
luoran@droi.com
55c2b45e0bf9d1be1232d824a98341991734fc2b
31f37346dc7d6032d517fbad2ce361dcdff8ae2a
/assignment3/src/assignment3/EmployeeDB.java
da93b4711c12377eb4c5fa21f13c35ef38f2a7bd
[]
no_license
heben2/Java_course
a9cda4af583c982902d8874d389d34139a3ca108
566bd9992ee107d3379b9eb7be5ca82e0b1dc338
refs/heads/master
2020-12-25T14:32:38.039357
2016-06-16T12:36:04
2016-06-16T12:36:04
61,291,307
0
0
null
null
null
null
UTF-8
Java
false
false
1,010
java
package assignment3; import java.util.List; /** * EmployeeDB declares the methods that the clients can invoke to interact with * the employee database server * * @author bonii * */ public interface EmployeeDB { /** * Add an employee in the employee database * * @param emp */ public void addEmployee(Employee emp); /** * List all employees in the employee database * * @return */ public List<Employee> listAllEmployees(); /** * List all the employees in a department * * @return */ public List<Employee> listEmployeesInDept(List<Integer> departmentIds); /** * Increments salaries of all employees in the department. Ensure salaries * of all employees are incremented or for none of them are incremented, * errors through appropriate Exception * * @param salaryIncrements * @return */ public void incrementSalaryOfDepartment( List<SalaryIncrement> salaryIncrement) throws DepartmentNotFoundException, NegativeSalaryIncrementException; }
[ "henrik.bendt@gmail.com" ]
henrik.bendt@gmail.com
6be30c20c11034d886839c6ec398e6682b3e9a39
beeaa2960103e08ade1eaf2a95b316a4a6580bca
/videos-dev-pojo/src/main/java/com/videos/pojo/Users.java
ff5d24d98af5d52f078ff761aa315cfe71114896
[]
no_license
cyj-295/videos-dev
af2de20e9954650daf013ee6ae8b2722c40c8a50
99a9f132ea1acdeb4d112cf6de849bf1f5e1310d
refs/heads/master
2023-04-04T19:14:02.595525
2021-04-14T09:52:53
2021-04-14T09:52:53
356,169,983
0
0
null
null
null
null
UTF-8
Java
false
false
4,643
java
package com.videos.pojo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.persistence.*; @ApiModel(value="用户对象", description="这是用户对象") public class Users { @ApiModelProperty(hidden=true) @Id private String id; /** * 用户名 */ @ApiModelProperty(value="用户名", name="username", example="videosuser", required=true) private String username; /** * 密码 */ @ApiModelProperty(value="密码", name="password", example="123456", required=true) private String password; /** * 我的头像,如果没有默认给一张 */ @ApiModelProperty(hidden=true) @Column(name = "face_image") private String faceImage; /** * 昵称 */ @ApiModelProperty(hidden=true) private String nickname; /** * 我的粉丝数量 */ @ApiModelProperty(hidden=true) @Column(name = "fans_counts") private Integer fansCounts; /** * 我关注的人总数 */ @ApiModelProperty(hidden=true) @Column(name = "follow_counts") private Integer followCounts; /** * 我接受到的赞美/收藏 的数量 */ @ApiModelProperty(hidden=true) @Column(name = "receive_like_counts") private Integer receiveLikeCounts; public Users() { super(); } public Users(String id, String username, String password, String faceImage, String nickname, Integer fansCounts, Integer followCounts, Integer receiveLikeCounts) { super(); this.id = id; this.username = username; this.password = password; this.faceImage = faceImage; this.nickname = nickname; this.fansCounts = fansCounts; this.followCounts = followCounts; this.receiveLikeCounts = receiveLikeCounts; } /** * @return id */ public String getId() { return id; } /** * @param id */ public void setId(String id) { this.id = id; } /** * 获取用户名 * * @return username - 用户名 */ public String getUsername() { return username; } /** * 设置用户名 * * @param username 用户名 */ public void setUsername(String username) { this.username = username; } /** * 获取密码 * * @return password - 密码 */ public String getPassword() { return password; } /** * 设置密码 * * @param password 密码 */ public void setPassword(String password) { this.password = password; } /** * 获取我的头像,如果没有默认给一张 * * @return face_image - 我的头像,如果没有默认给一张 */ public String getFaceImage() { return faceImage; } /** * 设置我的头像,如果没有默认给一张 * * @param faceImage 我的头像,如果没有默认给一张 */ public void setFaceImage(String faceImage) { this.faceImage = faceImage; } /** * 获取昵称 * * @return nickname - 昵称 */ public String getNickname() { return nickname; } /** * 设置昵称 * * @param nickname 昵称 */ public void setNickname(String nickname) { this.nickname = nickname; } /** * 获取我的粉丝数量 * * @return fans_counts - 我的粉丝数量 */ public Integer getFansCounts() { return fansCounts; } /** * 设置我的粉丝数量 * * @param fansCounts 我的粉丝数量 */ public void setFansCounts(Integer fansCounts) { this.fansCounts = fansCounts; } /** * 获取我关注的人总数 * * @return follow_counts - 我关注的人总数 */ public Integer getFollowCounts() { return followCounts; } /** * 设置我关注的人总数 * * @param followCounts 我关注的人总数 */ public void setFollowCounts(Integer followCounts) { this.followCounts = followCounts; } /** * 获取我接受到的赞美/收藏 的数量 * * @return receive_like_counts - 我接受到的赞美/收藏 的数量 */ public Integer getReceiveLikeCounts() { return receiveLikeCounts; } /** * 设置我接受到的赞美/收藏 的数量 * * @param receiveLikeCounts 我接受到的赞美/收藏 的数量 */ public void setReceiveLikeCounts(Integer receiveLikeCounts) { this.receiveLikeCounts = receiveLikeCounts; } }
[ "chenyongjie@deerma.cn" ]
chenyongjie@deerma.cn
b46e614e4a4ac5979bdd5f18f622a8f27608896f
d6140cc9726c4d3fb0f5f847bce38c199668df10
/src/main/java/com/glove/base/BaseController.java
814fe8a60a2b00f763e78bbd69cb03a38fbeb40e
[]
no_license
blueflowers/framework
99152e321daea7dc196a9993dc8d21cd55ee00f7
f53b18d4c6127a1db5aaf462a9d6e9b59cf66c78
refs/heads/master
2021-01-10T14:18:14.318890
2015-10-22T09:47:11
2015-10-22T09:47:11
44,584,718
0
0
null
null
null
null
UTF-8
Java
false
false
101
java
package com.glove.base; /** * Created by Frank on 2015/10/21. */ public class BaseController { }
[ "fei*2120219" ]
fei*2120219
db53ab8a13350f61e3ce0a97f9dd40ba3ba751ac
a0b732448e08291c894e7edf73a2d0c01124016a
/templates/jshvarts-offline/app/src/main/java/com/example/offline/domain/services/jobs/GcmJobService.java
c4dd15284b38d684a831917b7a4c78c3b4a801b4
[ "MIT", "Apache-2.0" ]
permissive
androidstarters/androidstarters.com
5c29f99ccd696118f75bedb41783347077db388a
010258565bc3e941d73f9ab3950f8bae0ad38e7b
refs/heads/develop
2023-08-22T11:56:29.637058
2018-09-27T05:13:01
2018-09-27T05:13:01
95,357,887
299
28
MIT
2021-01-07T13:41:32
2017-06-25T12:18:07
Java
UTF-8
Java
false
false
399
java
package <%= appPackage %>.domain.services.jobs; import android.support.annotation.NonNull; import com.birbit.android.jobqueue.JobManager; import com.birbit.android.jobqueue.scheduling.GcmJobSchedulerService; public class GcmJobService extends GcmJobSchedulerService { @NonNull @Override protected JobManager getJobManager() { return JobManagerFactory.getJobManager(); } }
[ "ravidsrk@gmail.com" ]
ravidsrk@gmail.com
316573a10064c5c2c26e4b8359057631839ca2a0
400c5181be23b9bf7237ece4c0e3aba0b749cf46
/src/main/java/com/vineeth/ems/entities/Counter.java
3d4bf1871cd1e7dc3a8efbf4d181072b23031e95
[]
no_license
vineethguna/employee-management-system
49c94fdb1b4afa114beaf143859993044ec14e3b
625f3adf4f051810df1a3c8e57365cf769449f07
refs/heads/master
2022-11-10T05:16:22.695572
2020-06-22T04:51:12
2020-06-22T04:51:12
273,004,322
0
0
null
null
null
null
UTF-8
Java
false
false
398
java
package com.vineeth.ems.entities; import lombok.Getter; import lombok.Setter; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @Entity @Getter @Setter public class Counter { @Id @GeneratedValue private Long id; @Column(unique = true) private String username; private int counter; }
[ "vineethguna@ADMINs-MacBook-Pro-9.local" ]
vineethguna@ADMINs-MacBook-Pro-9.local
8e9f8d0cac88694e1252bac2f2e9bf17b0e8b02a
f3878f6f3be406e79fe9ba6b91b092b871c54602
/src/ecopang/model/MypageDAO.java
a5a525f55e82033aa7c48771844e06585c4659d7
[]
no_license
hayoy/EcoPang
946028bc7b2ca3ff786c86c392c324214c8d08cc
628c55b8de5cc1c1713cbc38b98a462244fdb9b6
refs/heads/master
2023-09-03T21:18:23.855984
2021-11-06T08:45:48
2021-11-06T08:45:48
422,189,326
0
0
null
null
null
null
UTF-8
Java
false
false
18,670
java
package ecopang.model; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.ArrayList; import java.util.List; import javax.naming.Context; import javax.naming.InitialContext; import javax.sql.DataSource; public class MypageDAO { // 커넥션 메서드 private Connection getConnection() throws Exception{ Context ctx = new InitialContext(); Context env = (Context)ctx.lookup("java:comp/env"); DataSource ds = (DataSource)env.lookup("jdbc/orcl"); return ds.getConnection(); } //참여중인 활동 카운트 public int myActCount(String userID) { int count = 0; Connection conn = null; PreparedStatement pstmt = null; ResultSet rs = null; try { conn= getConnection(); String sql = "select count(*) from (select C.*, rownum r from (select B.* from activityjoin A, activities B " + "where (A.act_num = B.act_num) and A.userID like ? order by act_date desc)C " + "where to_date(C.act_date,'YYYY-mm-dd') >= (sysdate-1))"; pstmt= conn.prepareStatement(sql); pstmt.setString(1, userID); rs = pstmt.executeQuery(); if(rs.next()) { count = rs.getInt(1);//총 글의 개수를 담는다는것 } }catch(Exception e ) { e.printStackTrace(); }finally { if(rs != null)try {rs.close();}catch(Exception e ) {e.printStackTrace();} if(pstmt != null)try {pstmt.close();}catch(Exception e ) {e.printStackTrace();} if(conn != null)try {conn.close();}catch(Exception e ) {e.printStackTrace();} } return count; } //참여중인 활동 목록 public List myAct(String userID, int startRow, int endRow) { Connection conn = null; PreparedStatement pstmt = null; ResultSet rs = null;//sql문 실행 결과를 받아올 ResultSet타입의 rs변수 미리선언 List list = null;//담을 리스트 변수 필요 try { String sql = "select * from (select C.*, rownum r from " + "(select B.* from activityjoin A, activities B " + "where (A.act_num = B.act_num) and A.userID like ? order by act_date desc)C " + "where to_date(C.act_date,'YYYY-mm-dd') >= (sysdate-1)) where r >= ? and r <= ? "; conn = getConnection(); pstmt=conn.prepareStatement(sql); pstmt.setString(1, userID); pstmt.setInt(2, startRow); pstmt.setInt(3, endRow); rs = pstmt.executeQuery(); if(rs.next()) { list = new ArrayList();//list 객체생성해줌 do {//확인용 rs.next()로 한칸 이미 내려간 상태 // ->바로 do~while문 사용 ActDTO activity = new ActDTO(); //activites 에 얻은 값 셋팅 해주기 //컬럼 9개 ㅅ세팅 activity.setAct_num(rs.getInt("act_num")); activity.setGroup_num(rs.getInt("group_num")); activity.setAct_title(rs.getString("act_title")); activity.setPlace(rs.getString("place")); activity.setAct_date(rs.getString("act_date")); activity.setAct_time(rs.getString("act_time")); activity.setMax_user(rs.getInt("max_user")); activity.setUser_nickname(rs.getString("user_nickname")); activity.setUserID(rs.getString("userID")); System.out.println("3번 소모임 활동 제목 확인용 출력 : " + rs.getString("act_title"));//확인용 list.add(activity);//리턴 해줄 데이터 }while(rs.next()); } }catch(Exception e) { e.printStackTrace(); }finally { if(rs!=null)try {rs.close();}catch(Exception e) {e.printStackTrace();} if(pstmt!=null)try {pstmt.close();}catch(Exception e) {e.printStackTrace();} if(conn!=null)try {conn.close();}catch(Exception e) {e.printStackTrace();} } return list;// 리턴 void -> List로 수정 } //완료된 활동 카운트 public int myEndActCount(String userID) { int count = 0; Connection conn = null; PreparedStatement pstmt = null; ResultSet rs = null; try { conn= getConnection(); String sql = "select count(*) from (select C.*, rownum r from (select B.* from activityjoin A, activities B " + "where (A.act_num = B.act_num) and A.userID like ? order by act_date desc)C " + "where to_date(C.act_date,'YYYY-mm-dd') < (sysdate-1))"; pstmt= conn.prepareStatement(sql); pstmt.setString(1, userID); rs = pstmt.executeQuery(); if(rs.next()) { count = rs.getInt(1);//총 글의 개수를 담는다는것 } }catch(Exception e ) { e.printStackTrace(); }finally { if(rs != null)try {rs.close();}catch(Exception e ) {e.printStackTrace();} if(pstmt != null)try {pstmt.close();}catch(Exception e ) {e.printStackTrace();} if(conn != null)try {conn.close();}catch(Exception e ) {e.printStackTrace();} } return count; } //완료된 활동 목록 public List myEndAct(String userID, int start, int end) { Connection conn = null; PreparedStatement pstmt = null; List endlist = null; ResultSet rs = null; try {//1~3개 까지 conn = getConnection(); String sql= "select * from (select C.*, rownum r from " + "(select B.* from activityjoin A, activities B " + "where (A.act_num = B.act_num) and A.userID like ? order by act_date desc)C " + "where to_date(C.act_date,'YYYY-mm-dd') < (sysdate-1)) where r >= ? and r <= ?"; pstmt= conn.prepareStatement(sql); pstmt.setString(1, userID); pstmt.setInt(2, start);//rownum정렬 1부터 pstmt.setInt(3, end);// rs = pstmt.executeQuery(); if(rs.next()) { //한칸 이미 내려간 상태 // ->바로 do~while문 사용 endlist = new ArrayList(); do { ActDTO activity = new ActDTO(); //컬럼 9개 셋팅 해주기 activity.setAct_num(rs.getInt("act_num")); activity.setGroup_num(rs.getInt("group_num")); activity.setAct_title(rs.getString("act_title")); activity.setPlace(rs.getString("place")); activity.setAct_date(rs.getString("act_date")); activity.setAct_time(rs.getString("act_time")); activity.setMax_user(rs.getInt("max_user")); activity.setUser_nickname(rs.getString("user_nickname")); activity.setUserID(rs.getString("userID")); endlist.add(activity);//리턴 }while(rs.next()); } }catch(Exception e ) { e.printStackTrace(); }finally{ if(rs != null)try {rs.close();}catch(Exception e ) {e.printStackTrace();} if(pstmt != null)try {pstmt.close();}catch(Exception e ) {e.printStackTrace();} if(conn != null)try {conn.close();}catch(Exception e ) {e.printStackTrace();} } return endlist; } //좋아요 누른 게시물 카운트 public int myLikeContentCount(String userID) { Connection conn = null; PreparedStatement pstmt = null; ResultSet rs = null;//sql문 실행 결과를 받아올 ResultSet타입의 rs변수 미리선언 int count = 0;//담을 리스트 변수 필요 try { String sql = "select count(*) from (select l.*, rownum r from (select d1.cate cate, t1.tpc_num num, t1.tpc_title title, t1.tpc_content content, t1.tpc_reg reg from (select t.* from topics t, topiclikes tl where t.tpc_num = tl.tpc_num and tl.userid = ? )t1,(select 'topic'cate from dual)d1 union " + "select d2.cate cate, g1.group_num num, g1.group_title title, g1.group_content content, g1.group_reg reg from (select g.* from groups g, grouplikes gl where g.group_num = gl.group_num and gl.userid = ? )g1, (select 'group' cate from dual)d2 union " + "select d3.cate cate, r2.rev_num num, r2.group_title title, r2.rev_content content, r2.rev_reg reg from(select r1.rev_num, g2.group_title, r1.rev_content, r1.rev_reg from (select r.* from reviews r, reviewlikes rl where r.rev_num = rl.rev_num and rl.userid = ?)r1, (select group_num, group_title from groups)g2 where r1.group_num = g2.group_num)r2, (select 'review' cate from dual)d3)l)"; conn = getConnection(); pstmt=conn.prepareStatement(sql); pstmt.setString(1, userID); pstmt.setString(2, userID); pstmt.setString(3, userID); rs = pstmt.executeQuery(); if(rs.next()) { count = rs.getInt(1); } }catch(Exception e) { e.printStackTrace(); }finally { if(rs!=null)try {rs.close();}catch(Exception e) {e.printStackTrace();} if(pstmt!=null)try {pstmt.close();}catch(Exception e) {e.printStackTrace();} if(conn!=null)try {conn.close();}catch(Exception e) {e.printStackTrace();} } return count;// 리턴 void -> List로 수정 } //좋아요 누른 게시물 목록 public List myLikeContent(String userID, int startRow, int endRow) { Connection conn = null; PreparedStatement pstmt = null; ResultSet rs = null;//sql문 실행 결과를 받아올 ResultSet타입의 rs변수 미리선언 List list = null;//담을 리스트 변수 필요 try { String sql = "select * from (select l.*, rownum r from (select d1.cate cate, t1.tpc_num num, t1.tpc_title title, t1.tpc_content content, t1.tpc_reg reg from (select t.* from topics t, topiclikes tl where t.tpc_num = tl.tpc_num and tl.userid = ?)t1,(select '게시글'cate from dual)d1 union " + "select d2.cate cate, g1.group_num num, g1.group_title title, g1.group_content content, g1.group_reg reg from (select g.* from groups g, grouplikes gl where g.group_num = gl.group_num and gl.userid = ?)g1, (select '소모임' cate from dual)d2 union "+ "select d3.cate cate, r2.group_num num, r2.group_title title, r2.rev_content content, r2.rev_reg reg from(select g2.group_num, g2.group_title, r1.rev_content, r1.rev_reg from (select r.* from reviews r, reviewlikes rl where r.rev_num = rl.rev_num and rl.userid = ?)r1, (select group_num, group_title from groups)g2 where r1.group_num = g2.group_num)r2, (select '후기' cate from dual)d3)l) where r >= ? and r <= ?"; conn = getConnection(); pstmt=conn.prepareStatement(sql); pstmt.setString(1, userID); pstmt.setString(2, userID); pstmt.setString(3, userID); pstmt.setInt(4, startRow); pstmt.setInt(5, endRow); rs = pstmt.executeQuery(); if(rs.next()) { list = new ArrayList();//list 객체생성해줌 do {//확인용 rs.next()로 한칸 이미 내려간 상태 // ->바로 do~while문 사용 String[] str = new String[5]; str[0] = rs.getString("cate"); str[1] = rs.getString("num"); str[2] = rs.getString("title"); str[3] = rs.getString("content"); str[4] = rs.getString("reg"); list.add(str);//리턴 해줄 데이터 }while(rs.next()); } }catch(Exception e) { e.printStackTrace(); }finally { if(rs!=null)try {rs.close();}catch(Exception e) {e.printStackTrace();} if(pstmt!=null)try {pstmt.close();}catch(Exception e) {e.printStackTrace();} if(conn!=null)try {conn.close();}catch(Exception e) {e.printStackTrace();} } return list;// 리턴 void -> List로 수정 } //내가 작성한 글 카운트 public int myContentCount(String userID) { Connection conn = null; PreparedStatement pstmt = null; ResultSet rs = null;//sql문 실행 결과를 받아올 ResultSet타입의 rs변수 미리선언 int count = 0;//담을 리스트 변수 필요 try { String sql = "select count(*) from(select l.*, rownum r from(select d.cate cate, t.tpc_num num, t.tpc_title title, t.tpc_content content, t.tpc_reg reg " + "from(select * from topics where userid = ?)t,(select '게시글'cate from dual)d " + "union " + "select d.cate cate, r2.group_num num, r2.group_title title, r2.rev_content content, r2.rev_reg reg " + "from (select r.group_num, g.group_title, r.rev_content, r.rev_reg from (select * from reviews where userId = ?)r, groups g where r.group_num = g.group_num)r2,(select '후기'cate from dual)d " + "union " + "select d.cate cate, g.group_num num, g.group_title title, g.group_content content, g.group_reg reg " + "from (select * from groups where userid = ?)g, (select '소모임'cate from dual)d)l)"; conn = getConnection(); pstmt=conn.prepareStatement(sql); pstmt.setString(1, userID); pstmt.setString(2, userID); pstmt.setString(3, userID); rs = pstmt.executeQuery(); if(rs.next()) { count = rs.getInt(1); } }catch(Exception e) { e.printStackTrace(); }finally { if(rs!=null)try {rs.close();}catch(Exception e) {e.printStackTrace();} if(pstmt!=null)try {pstmt.close();}catch(Exception e) {e.printStackTrace();} if(conn!=null)try {conn.close();}catch(Exception e) {e.printStackTrace();} } return count;// 리턴 void -> List로 수정 } //내가 작성한 글 목록 public List myContents(String userID, int startRow, int endRow) { Connection conn = null; PreparedStatement pstmt = null; ResultSet rs = null;//sql문 실행 결과를 받아올 ResultSet타입의 rs변수 미리선언 List list = null;//담을 리스트 변수 필요 try { String sql = "select * from(select l.*, rownum r from(select d.cate cate, t.tpc_num num, t.tpc_title title, t.tpc_content content, t.tpc_reg reg " + "from(select * from topics where userid = ?)t,(select '게시글'cate from dual)d " + "union " + "select d.cate cate, r2.group_num num, r2.group_title title, r2.rev_content content, r2.rev_reg reg " + "from (select r.group_num, g.group_title, r.rev_content, r.rev_reg from (select * from reviews where userId = ?)r, groups g where r.group_num = g.group_num)r2,(select '후기'cate from dual)d " + "union " + "select d.cate cate, g.group_num num, g.group_title title, g.group_content content, g.group_reg reg " + "from (select * from groups where userid = ?)g, (select '소모임'cate from dual)d)l) where r >= ? and r <= ?"; conn = getConnection(); pstmt=conn.prepareStatement(sql); pstmt.setString(1, userID); pstmt.setString(2, userID); pstmt.setString(3, userID); pstmt.setInt(4, startRow); pstmt.setInt(5, endRow); rs = pstmt.executeQuery(); if(rs.next()) { list = new ArrayList();//list 객체생성해줌 do {//확인용 rs.next()로 한칸 이미 내려간 상태 // ->바로 do~while문 사용 String[] str = new String[5]; str[0] = rs.getString("cate"); str[1] = rs.getString("num"); str[2] = rs.getString("title"); str[3] = rs.getString("content"); str[4] = rs.getString("reg"); list.add(str);//리턴 해줄 데이터 }while(rs.next()); } }catch(Exception e) { e.printStackTrace(); }finally { if(rs!=null)try {rs.close();}catch(Exception e) {e.printStackTrace();} if(pstmt!=null)try {pstmt.close();}catch(Exception e) {e.printStackTrace();} if(conn!=null)try {conn.close();}catch(Exception e) {e.printStackTrace();} } return list;// 리턴 void -> List로 수정 } //내가 작성한 댓글 카운트 public int myCommentCount(String userID) { Connection conn = null; PreparedStatement pstmt = null; ResultSet rs = null;//sql문 실행 결과를 받아올 ResultSet타입의 rs변수 미리선언 int count = 0;//담을 리스트 변수 필요 try { String sql = "select count(*) from(select l.*, rownum r from(select cate, eve_num num, eve_title title,eve_comment content, eve_reg reg " + "from(select * from (select e.eve_num, e.eve_title, ec.eve_comment, ec.eve_reg " + "from eventComments ec, eventlist e where ec.userId = ? and e.eve_num = ec.eve_num),(select '이벤트'cate from dual)d) " + "union " + "select cate, tpc_num num, tpc_title title,tpc_com_content content, tpc_com_reg reg " + "from(select * from (select t.tpc_num, t.tpc_title, tc.tpc_com_content, tc.tpc_com_reg " + "from topicComments tc, topics t where tc.userId = ? and t.tpc_num = tc.tpc_num),(select '게시글'cate from dual)d))l)"; conn = getConnection(); pstmt=conn.prepareStatement(sql); pstmt.setString(1, userID); pstmt.setString(2, userID); rs = pstmt.executeQuery(); if(rs.next()) { count = rs.getInt(1); } }catch(Exception e) { e.printStackTrace(); }finally { if(rs!=null)try {rs.close();}catch(Exception e) {e.printStackTrace();} if(pstmt!=null)try {pstmt.close();}catch(Exception e) {e.printStackTrace();} if(conn!=null)try {conn.close();}catch(Exception e) {e.printStackTrace();} } return count;// 리턴 void -> List로 수정 } //내가 작성한 댓글목록 public List myCommentList(String userID, int startRow, int endRow) { Connection conn = null; PreparedStatement pstmt = null; ResultSet rs = null;//sql문 실행 결과를 받아올 ResultSet타입의 rs변수 미리선언 List list = null;//담을 리스트 변수 필요 try { String sql = "select * from(select l.*, rownum r from(select cate, eve_num num, eve_title title,eve_comment content, eve_reg reg " + "from(select * from (select e.eve_num, e.eve_title, ec.eve_comment, ec.eve_reg " + "from eventComments ec, eventlist e where ec.userId = ? and e.eve_num = ec.eve_num),(select '이벤트'cate from dual)d) " + "union " + "select cate, tpc_num num, tpc_title title,tpc_com_content content, tpc_com_reg reg " + "from(select * from (select t.tpc_num, t.tpc_title, tc.tpc_com_content, tc.tpc_com_reg " + "from topicComments tc, topics t where tc.userId = ? and t.tpc_num = tc.tpc_num),(select '게시글'cate from dual)d))l) where r >= ? and r <= ?"; conn = getConnection(); pstmt=conn.prepareStatement(sql); pstmt.setString(1, userID); pstmt.setString(2, userID); pstmt.setInt(3, startRow); pstmt.setInt(4, endRow); rs = pstmt.executeQuery(); if(rs.next()) { list = new ArrayList();//list 객체생성해줌 do {//확인용 rs.next()로 한칸 이미 내려간 상태 // ->바로 do~while문 사용 String[] str = new String[5]; str[0] = rs.getString("cate"); str[1] = rs.getString("num"); str[2] = rs.getString("title"); str[3] = rs.getString("content"); str[4] = rs.getString("reg"); list.add(str);//리턴 해줄 데이터 }while(rs.next()); } }catch(Exception e) { e.printStackTrace(); }finally { if(rs!=null)try {rs.close();}catch(Exception e) {e.printStackTrace();} if(pstmt!=null)try {pstmt.close();}catch(Exception e) {e.printStackTrace();} if(conn!=null)try {conn.close();}catch(Exception e) {e.printStackTrace();} } return list;// 리턴 void -> List로 수정 } }
[ "hohoyoung00@naver.com" ]
hohoyoung00@naver.com
094182b56f0c106bb59076214dcc124938685c73
9ffb748cdd4b7eb498b581800a7b8eeaf7b6a3ef
/garage-web/src/main/java/fr/garage/servlet/client/AjouterClientServlet.java
b601cdc45f978fede099fd57acd15233b447b3f0
[]
no_license
cedric-chape/garage
05fba808d34848fffac59e2a98355aa5f78700eb
cdb393a1c87ff74ca3eadee0054d593916916919
refs/heads/master
2023-06-03T13:55:10.576446
2021-06-18T07:03:26
2021-06-18T07:03:26
364,262,469
0
0
null
null
null
null
UTF-8
Java
false
false
1,802
java
package fr.garage.servlet.client; 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; import fr.garage.model.Client; import fr.garage.model.Fidelite; import fr.garage.model.TypeClient; import fr.garage.service.ClientService; import fr.garage.service.VehiculeService; @WebServlet("/ajouter-client") public class AjouterClientServlet extends HttpServlet{ @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { ClientService srvClient = new ClientService(); VehiculeService srvVehicule = new VehiculeService(); req.setAttribute("clients", srvClient.findAll()); req.setAttribute("vehicules", srvVehicule.findAll()); this .getServletContext() .getRequestDispatcher("/WEB-INF/form-client.jsp") .forward(req, resp); } @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String nom = req.getParameter("nom"); String prenom = req.getParameter("prenom"); String raisonSociale = req.getParameter("raisonSociale"); String typeO = req.getParameter("type"); String fideliteO = req.getParameter("fidelite"); TypeClient type = TypeClient.valueOf(typeO); Fidelite fidelite = Fidelite.valueOf(fideliteO); Client client = new Client(); client.setNom(nom); client.setPrenom(prenom); client.setRaisonSociale(raisonSociale); client.setTypeClient(type); client.setFidelite(fidelite); ClientService srvClient = new ClientService(); srvClient.add(client); resp.sendRedirect("liste-client?clientAjout=true"); } }
[ "cedric-chape@live.fr" ]
cedric-chape@live.fr
c2e8afda5815829164161283c364c96ce48d667f
0c426ed9cae0b7638884911ef83766ea9b3c73c1
/reddit-clone/src/main/java/com/tamimtechnology/redditclone/controllers/CommentsController.java
bcb37d523cb3dd78610166b142b392e502ca23ce
[]
no_license
TamimC/reddit_clone
da35f5c95cf0dd24aa53811d2eae66b1858a86ef
09da074ba4848101261ec0ac226f54715801e1cf
refs/heads/master
2022-12-15T03:44:15.766896
2020-09-11T02:41:30
2020-09-11T02:41:30
294,219,251
0
0
null
null
null
null
UTF-8
Java
false
false
1,306
java
package com.tamimtechnology.redditclone.controllers; import com.tamimtechnology.redditclone.dto.CommentsDTO; import com.tamimtechnology.redditclone.services.CommentService; import lombok.AllArgsConstructor; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import java.util.List; import static org.springframework.http.HttpStatus.CREATED; import static org.springframework.http.HttpStatus.OK; @RestController @RequestMapping("/api/comments/") @AllArgsConstructor public class CommentsController { private final CommentService commentService; @PostMapping public ResponseEntity<Void> createComment(@RequestBody CommentsDTO commentsDto) { commentService.save(commentsDto); return new ResponseEntity<>(CREATED); } @GetMapping("/by-post/{postId}") public ResponseEntity<List<CommentsDTO>> getAllCommentsForPost(@PathVariable Long postId) { return ResponseEntity.status(OK) .body(commentService.getAllCommentsForPost(postId)); } @GetMapping("/by-user/{userName}") public ResponseEntity<List<CommentsDTO>> getAllCommentsForUser(@PathVariable String userName) { return ResponseEntity.status(OK) .body(commentService.getAllCommentsForUser(userName)); } }
[ "TamimChowdhury@live.com" ]
TamimChowdhury@live.com
2131faeae5f6c8a094eae9f677fb7001a6fed1b0
f9849fd3e40cc932faf9374d9ea031b2fa419c5c
/TAP/src/practicasu3/CarreraFinal2.java
1bff5e9d93f6d17357ad75fc2681a42a617bef1c
[]
no_license
DiegoBernal17/varios-java
30a77c25a51a2a6bb7ec3e0d136de80a02187ea8
5dbb0efec178495ed35a92f8cfa993ca5a1a3000
refs/heads/master
2020-05-20T15:54:45.981917
2019-05-08T18:30:13
2019-05-08T18:30:13
185,653,326
0
0
null
null
null
null
UTF-8
Java
false
false
1,014
java
package practicasu3; import java.applet.Applet; import java.awt.Button; import java.awt.Color; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class CarreraFinal2 extends Applet { private Button inicio; public void init() { inicio = new Button("Iniciar"); add(inicio); Graphics g = getGraphics(); inicio.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ g.setColor(Color.BLACK); g.fillRect(860, 60, 40, 40); g.setColor(Color.WHITE); g.fillRect(860, 100, 40, 40); g.setColor(Color.BLACK); g.fillRect(860, 140, 40, 40); g.setColor(Color.WHITE); g.fillRect(860, 180, 40, 40); g.setColor(Color.BLACK); g.fillRect(860, 220, 40, 40); LiebreGrafica liebre = new LiebreGrafica(g); TortugaGrafica tortuga = new TortugaGrafica(g); liebre.start(); tortuga.start(); remove(inicio); } }); } }
[ "diego.bernal17@gmail.com" ]
diego.bernal17@gmail.com
86084dc2a6a94d12f4a159c7e030f25fb256b5a0
2729abb341c3c5bb11d9d8bce4a54c4adfc89de5
/src/com/dhcc/ftp/dao/UL04DAO.java
30358423f14e13e84803e7323dde7b8c9a53aeda
[]
no_license
mygithut/mytest2
445d8c3ab4034e4be61e34c78e047d55fb18a242
6486fc8acf87cd9fc87e60f3bb723808b5888329
refs/heads/master
2020-05-02T05:26:21.576381
2019-03-26T13:56:58
2019-03-26T13:56:58
177,771,651
0
0
null
null
null
null
GB18030
Java
false
false
4,799
java
package com.dhcc.ftp.dao; /** * @desc:收益率曲线维护DAO * @author :孙红玉 * @date :2012-04-16 */ import java.util.List; import com.dhcc.ftp.bo.ReportBO; import com.dhcc.ftp.entity.TelMst; import com.dhcc.ftp.util.FtpUtil; import com.dhcc.ftp.util.PageUtil; public class UL04DAO extends DaoFactory { private PageUtil UL04Util = null; private int pageSize; private String sql = null; public PageUtil dofind(int page, Integer rowsCount, String brNo, String curveMarketType, String curveAssetsType, String curveDate, TelMst telMst) { String pageName = ""; pageSize = 6; sql = "select m.*,b.br_name from (select substr(t.curve_no,1,4) curveNo, substr(t.curve_name,1,13), " + "t.curve_market_type, t.curve_assets_type, t.curve_date,t.br_no, " + "row_number() over(partition by br_no,substr(curve_no,1,4) order by curve_date desc, curve_No ) rn" + " from ftp.ftp_yield_curve t where 1=1 "; if (curveDate != null && !curveDate.equals("") && !curveDate.equals("null")) { sql += " and curve_date <= "+curveDate; } sql +=") m left join ftp.br_mst b on b.br_no=m.br_no where rn=1 "; //sql = "select distinct substr(curve_no,1,4) curveNo, substr(curve_name,1,13), curve_market_type, curve_assets_type, curve_date from ftp_yield_curve where 1 = 1"; if (brNo != null && !brNo.equals("") && !brNo.equals("null")) { sql += " and m.br_no = '"+brNo+"'"; }else if(Integer.valueOf(telMst.getBrMst().getManageLvl())<=2){//如果不是省联社,要获取对应的县联社机构 sql += " and m.br_no = '"+FtpUtil.getXlsBrNo(telMst.getBrMst().getBrNo(), telMst.getBrMst().getManageLvl())+"'"; } if (curveMarketType != null && !curveMarketType.equals("") && !curveMarketType.equals("null")) { sql += " and curve_market_type = '"+curveMarketType+"'"; } if (curveAssetsType != null && !curveAssetsType.equals("") && !curveAssetsType.equals("null")) { sql += " and curve_assets_type = '"+curveAssetsType+"'"; } sql += " order by m.br_no, curve_date desc, curveNo"; pageName = "SYLQXLSCK_history_list.action?brNo="+brNo+"&curveMarketType="+curveMarketType+"&curveAssetsType="+curveAssetsType+"&curveDate="+curveDate; UL04Util = this.queryPage(sql, null, pageSize, page, rowsCount,pageName); return UL04Util; } public PageUtil queryPage(String sql, Object[] values, int pageSize, int currentPage, int rowsCount, String pageName) { // TODO Auto-generated method stub DaoFactory df = new DaoFactory(); if(rowsCount<0){ rowsCount=df.query1(sql, values).size(); } pageSize=pageSize<1?12:pageSize; currentPage=currentPage<1?1:currentPage; int pageCount=rowsCount/pageSize; pageCount=pageCount<1?1:pageCount; pageCount=pageCount*pageSize<rowsCount?pageCount+1:pageCount; currentPage=currentPage>pageCount?pageCount:currentPage; List list=df.query1(sql, values, pageSize, currentPage); String pageLine=this.formartPageLine(pageSize, currentPage, rowsCount, pageName); return new PageUtil(list,pageLine); } public String formartPageLine(int pageSize, int currentPage, int rowsCount,String pageName){ pageSize=pageSize<1?12:pageSize; currentPage=currentPage<1?1:currentPage; StringBuffer buffer=new StringBuffer(); int pageCount=rowsCount/pageSize; pageCount=pageCount<1?1:pageCount; pageCount=pageCount*pageSize<rowsCount?pageCount+1:pageCount; currentPage=currentPage>pageCount?pageCount:currentPage; //System.out.println("currentPage"+currentPage); if(currentPage==1){ buffer.append("首页&nbsp;"); buffer.append("上一页&nbsp;"); } else{ buffer.append("<a href=\""+ pageName +"&page=1&rowsCount="+ rowsCount +"\">首页</a>&nbsp;"); buffer.append("<a href=\""+ pageName +"&page="+ (currentPage-1) +"&rowsCount="+ rowsCount +"\">上一页</a>&nbsp;"); } if(currentPage==pageCount){ buffer.append("下一页&nbsp;"); buffer.append("末页"); } else{ buffer.append("<a href=\""+ pageName +"&page="+ (currentPage+1) +"&rowsCount="+ rowsCount +"\">下一页</a>&nbsp;"); buffer.append("<a href=\""+ pageName +"&page="+ pageCount +"&rowsCount="+ rowsCount +"\">末页</a>&nbsp;"); } buffer.append("&nbsp;&nbsp;共检索出"+ rowsCount +"条数据,每页"+ pageSize +"条数据,页次<font color='red'>"+ currentPage+"</font>/"+ pageCount); //buffer.setLength(0); buffer.append("&nbsp;&nbsp;跳转到:"); buffer.append("\r\n<select onchange=\"window.location.replace('"+ pageName + "page='+this.value+'&rowsCount='+"+ rowsCount +")\">\r\n"); for(int i=0;i<pageCount;i++){ String selected=""; if(i==currentPage-1){ selected="selected"; } buffer.append("<option "+ selected +" value=\""+ (i+1) +"\">第"+ (i+1) +"页</option>\r\n"); } buffer.append("</select>"); return buffer.toString(); } }
[ "lifeisshort888@gmail.com" ]
lifeisshort888@gmail.com
758f1585cbbdff4905d9926c63dfc4bdebce9c44
baad223ab09b55d19a0ec18300262ccf8267e555
/src/java8/example/FunctionInterface/UnaryOperator/Java8UnaryOperator3.java
687db20ffaef685756e580829146371ea55e7a58
[]
no_license
remziusta/JavaFeatures
d5e178d3d7f4cfd185a1e1fe7e0b2ffe54ce25b4
237481a1b0a01e8b82157fc201aa1a6987a582a9
refs/heads/main
2023-04-19T23:31:55.453657
2021-05-11T21:10:47
2021-05-11T21:10:47
365,852,590
0
0
null
null
null
null
UTF-8
Java
false
false
691
java
package java8.example.FunctionInterface.UnaryOperator; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class Java8UnaryOperator3 { public static void main(String[] args) { List<Integer> list = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); List<Integer> result = math(list, x -> x * 2, x -> x + 1); System.out.println("Result : " + result); } public static <T> List<T> math(List<T> list, UnaryOperator<T> uo, UnaryOperator<T> uo2) { List<T> result = new ArrayList<>(); for (T t : list) result.add(uo.andThen(uo2).apply(t)); return result; } }
[ "37660677+remziusta@users.noreply.github.com" ]
37660677+remziusta@users.noreply.github.com
f8670835d180e30ee40b2d815bd2e5ef89b28d8d
ea9d3be8dde2b7764257583cca85ab804f0ebb16
/src/test/java/cz/benes/database/dao/AttendanceDAOImplTest.java
cfc199744929f8f4df49978673b6a1376528ebd8
[]
no_license
Beny406/Dochazka
89021a749c9a145e64d756896427ed7e5ec246a6
ec7e45937c5ac3c8e6352812ba9f69b698800b49
refs/heads/master
2021-01-12T07:19:36.731923
2017-01-09T23:08:12
2017-01-09T23:08:12
76,946,307
0
0
null
null
null
null
UTF-8
Java
false
false
2,481
java
package cz.benes.database.dao; import com.google.inject.Inject; import cz.benes.CommonTest; import cz.benes.database.domain.AttendanceRecord; import cz.benes.database.domain.CheckableMonth; import cz.benes.database.domain.Employee; import cz.benes.database.domain.RecordType; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import junit.framework.Assert; import org.junit.Test; import java.time.Duration; import java.time.LocalDate; import java.util.ArrayList; import java.util.List; public class AttendanceDAOImplTest extends CommonTest { @Inject Employee employee; @Inject AttendanceDAO attendanceDAO; @Inject DBInitiator dbInitiator; @Test public void insert() throws Exception { Assert.assertTrue("", attendanceDAO.insert(employee, null, null, RecordType.IN)); } @Test public void getByLoginAndDate() throws Exception { Assert.assertTrue(!attendanceDAO.getByLoginAndDate(employee, "12", "2016").isEmpty()); } @Test public void getThisMonth() throws Exception { Assert.assertTrue(!attendanceDAO.getThisMonth().isEmpty()); } @Test public void getLastMonth() throws Exception { Assert.assertTrue(!attendanceDAO.getLastMonth().isEmpty()); } @Test public void getLastRecord() throws Exception { Assert.assertTrue(attendanceDAO.getLastRecord() != null); } @Test public void getThisMonthWithCondition() throws Exception { Assert.assertTrue(!attendanceDAO.getThisMonthWithCondition(RecordType.IN).isEmpty()); } @Test public void deleteWithCondition() throws Exception { Assert.assertTrue(!attendanceDAO.deleteWithCondition(RecordType.IN)); } @Test public void countDurationWorked() throws Exception { List<AttendanceRecord> thisMonthAttendance = attendanceDAO.getThisMonthWithCondition(RecordType.IN, RecordType.OUT); Duration duration = attendanceDAO.countDurationWorked(thisMonthAttendance); // TODO assert } @Test public void deleteRecords() throws Exception { ArrayList<CheckableMonth> checkableMonths = new ArrayList<>(); checkableMonths.add(new CheckableMonth(LocalDate.now().withMonth(12), true)); ObservableList<CheckableMonth> checkableMonths1 = FXCollections.observableArrayList(checkableMonths); Assert.assertTrue(attendanceDAO.deleteRecords(checkableMonths1, "2016") > 0); } }
[ "beny406@seznam.cz" ]
beny406@seznam.cz
0919ea40a49f49463766c5336e58941f326396b4
e3d183cec6dd9d7378ae3012e7a7e8e370456584
/app/src/main/java/cn/qiuc/org/igoogleplay/global/IGooglePlayApplication.java
6cd3b3252dbcf274d1166fe9e9ed9efc1d8b03ed
[]
no_license
youshanmomei/IGooglePlay
8f0fb0fe8b4d2eddde7329b4015c2d548f90f9ab
0676fdba4b421d79ec26b5d514b753ea204d8e5a
refs/heads/master
2021-01-21T15:21:56.527852
2016-06-19T22:24:30
2016-06-19T22:24:30
57,876,911
0
0
null
null
null
null
UTF-8
Java
false
false
1,480
java
package cn.qiuc.org.igoogleplay.global; import android.app.Application; import android.content.Context; import android.os.Handler; import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator; import com.nostra13.universalimageloader.core.ImageLoader; import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; import com.nostra13.universalimageloader.core.assist.QueueProcessingType; /** * Created by admin on 2016/5/13. */ public class IGooglePlayApplication extends Application{ private static Context context; private static Handler mHandler; @Override public void onCreate() { super.onCreate(); context = this; mHandler = new Handler(); initImageLoader(getApplicationContext()); } public static Handler getMainHandler() { return mHandler; } public static Context getContext() { return context; } public static void initImageLoader(Context context) { ImageLoaderConfiguration.Builder config = new ImageLoaderConfiguration.Builder(context); config.threadPriority(Thread.NORM_PRIORITY - 2); config.denyCacheImageMultipleSizesInMemory(); config.diskCacheFileNameGenerator(new Md5FileNameGenerator()); config.diskCacheSize(50 * 1024 * 1024); //50MB config.tasksProcessingOrder(QueueProcessingType.LIFO); config.writeDebugLogs(); ImageLoader.getInstance().init(config.build()); } }
[ "1142041743@qq.com" ]
1142041743@qq.com
b7623548278800843a81a14c6aa5e8f706a43c39
aa898502eba911d4c9b5f8c0666a821c3f890a6f
/SpringMvcCrud/src/main/java/com/app/service/StudServiceImpl.java
9af50ad9dfd36cf0506f45af8a9225b149638b9d
[]
no_license
madhuribh/madhuripune
df224389dec4e8a5732e3a1f9c87bf5e2c3538cb
d5a2704d9df9c2fbf7f06726b217e09388897f5c
refs/heads/master
2020-04-17T07:35:48.152095
2019-01-18T09:20:23
2019-01-18T09:20:23
166,376,590
0
0
null
null
null
null
UTF-8
Java
false
false
1,117
java
package com.app.service; import java.util.Iterator; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.app.dao.StudDao; import com.app.model.Student; @Service public class StudServiceImpl implements StudService { @Autowired private StudDao sd; @Override public int addStudent(Student student) { return sd.addStudent(student); } @Override public List<Student> showList() { return sd.showList(); } @Override public Student editStudent(int id) { return sd.editStudent(id); } @Override public void updateStudent(Student student) { sd.updateStudent(student); } @Override public int deleteStudent(int id) { return sd.deleteStudent(id); } @Override public List<Student> login(Student student) { List list=sd.login(); Iterator itr=list.iterator(); while(itr.hasNext()) { Student student2=(Student)itr.next(); if(student.getUsername().equals(student2.getUsername())&&student.getPassword().equals(student2.getPassword())) { return list; } } return null; } }
[ "madhuri173@gmail.com" ]
madhuri173@gmail.com
d053d0365628f301792e7ce25bbbf47b8ecb01ac
2ca2b6ddbbfca963c297ce29c598a4238496dc23
/ThreadLockAnalysis/src/main/java/com/dynatrace/threadlock/objects/SankyObject.java
9e2a005c08842d4399c42e505006ffc11470f7e0
[]
no_license
ahmedhagii/thread-lock-analysis
7cdb44520a8a0982fca1c52d53333a184216336b
03e9db7c57c541f2e353117b94aa084b63a85467
refs/heads/master
2021-05-10T19:00:11.447952
2018-03-16T18:42:45
2018-03-16T18:42:45
118,141,313
0
0
null
null
null
null
UTF-8
Java
false
false
73
java
package com.dynatrace.threadlock.objects; public class SankyObject { }
[ "a.akram93@gmail.com" ]
a.akram93@gmail.com
40698e1df7943f020f15befa029822fc32964e27
5bfe45fbeed6f3df3041ab2d1ef7c26555e5a160
/game/Piece.java
dcdd6d78bda093fda45f892655fda00e77f6a6f4
[]
no_license
everlastingwonder/PChess
2da450109a66df0ba88ec353d8e65ee760643fc0
95032971cd8d3543e44595e78fe0d5a64416065a
refs/heads/master
2021-01-19T15:20:57.588316
2017-08-21T15:22:30
2017-08-21T15:22:30
100,963,310
0
0
null
null
null
null
UTF-8
Java
false
false
106
java
package game; public abstract class Piece { public int row, col; public abstract Boolean isValid(); }
[ "guswiedey@desktopmetal.com" ]
guswiedey@desktopmetal.com
dfc0115ae0a933226d4f79d20e146a7094c58498
78197e12219ed627aec20c6b4d51a873c62e6820
/zbg-java-sdk-api/src/main/java/com/dd/api/websocket/WebSocket.java
105f179f927074d5248b8213cf984693b7b33cd6
[]
no_license
zbgapi/zbg-api-v1-sdk
05a3301491c2f70bd31c902aff6a46522bbee29e
f57d733e3b4791dd8ef815537aad62023ff8f260
refs/heads/master
2020-12-03T13:25:55.719009
2020-10-11T06:52:40
2020-10-11T06:52:40
231,334,926
2
1
null
2020-10-13T18:34:42
2020-01-02T08:00:27
Java
UTF-8
Java
false
false
815
java
package com.dd.api.websocket; import com.dd.api.enums.SocketTopicEnum; /** * @author zhangzp */ public interface WebSocket { /** * 连接服务器 */ void connect(); /** * 关闭连接 */ void close(); /** * 用户测试是否连接 */ void ping(); /** * 订阅主题, * * @param topic 主题名:如 336_ENTRUST_ADD_ZT_USDT * @param size 返回数据大小,有些主题这个字段没用,如 {@link SocketTopicEnum#DEPTH},{@link SocketTopicEnum#TICKERS} * @see SocketTopicEnum */ void subscribe(String topic, int size); /** * 取消订阅 * * @param topic 主题名:如 336_ENTRUST_ADD_ZT_USDT * @see com.dd.api.enums.SocketTopicEnum */ void unsubscribe(String topic); }
[ "zhangzhipeng@163.com" ]
zhangzhipeng@163.com
dba36371490dd676b3b7af847097ea1119effeac
57166a8c4ed83f6e644755a76bcd925b03067072
/app/src/main/java/com/share/found/bean/UserModel.java
b4523accefc420467dc35432d6b7c14c6015fa4b
[]
no_license
govzz/Found-master
6beb9b662d564d2eb5b4f30c640b651f6b25dbbb
725e0dd8e014f14f1a16d202ba5911b2cf8ae8e0
refs/heads/master
2020-05-02T12:35:25.766178
2019-03-28T14:40:16
2019-03-28T14:40:16
177,710,985
0
0
null
null
null
null
UTF-8
Java
false
false
7,690
java
package com.share.found.bean; import android.text.TextUtils; import com.orhanobut.logger.Logger; import com.share.found.bean.i.QueryUserListener; import com.share.found.bean.i.UpdateCacheListener; import java.util.List; import cn.bmob.newim.BmobIM; import cn.bmob.newim.bean.BmobIMConversation; import cn.bmob.newim.bean.BmobIMMessage; import cn.bmob.newim.bean.BmobIMUserInfo; import cn.bmob.newim.event.MessageEvent; import cn.bmob.v3.BmobQuery; import cn.bmob.v3.BmobUser; import cn.bmob.v3.exception.BmobException; import cn.bmob.v3.listener.FindListener; import cn.bmob.v3.listener.LogInListener; import cn.bmob.v3.listener.SaveListener; public class UserModel extends BaseModel { private static UserModel ourInstance = new UserModel(); public static UserModel getInstance() { return ourInstance; } private UserModel() { } /** * TODO 用户管理:2.1、注册 * * @param username * @param password * @param pwdagain * @param listener */ public void register(String username, String password, String pwdagain, final LogInListener listener) { if (TextUtils.isEmpty(username)) { listener.done(null, new BmobException(CODE_NULL, "Enter user name.")); return; } if (TextUtils.isEmpty(password)) { listener.done(null, new BmobException(CODE_NULL, "Enter password.")); return; } if (TextUtils.isEmpty(pwdagain)) { listener.done(null, new BmobException(CODE_NULL, "Account or password error. Enter again.")); return; } if (!password.equals(pwdagain)) { listener.done(null, new BmobException(CODE_NULL, "Different password. Enter again.")); return; } final User user = new User(); user.setUsername(username); user.setPassword(password); user.signUp(new SaveListener<User>() { @Override public void done(User user, BmobException e) { if (e == null) { listener.done(null, null); } else { listener.done(null, e); } } }); } /** * TODO 用户管理:2.2、登录 * * @param username * @param password * @param listener */ public void login(String username, String password, final LogInListener listener) { if (TextUtils.isEmpty(username)) { listener.done(null, new BmobException(CODE_NULL, "Enter user name.")); return; } if (TextUtils.isEmpty(password)) { listener.done(null, new BmobException(CODE_NULL, "Enter password.")); return; } final User user = new User(); user.setUsername(username); user.setPassword(password); user.login(new SaveListener<User>() { @Override public void done(User user, BmobException e) { if (e == null) { listener.done(getCurrentUser(), null); } else { listener.done(user, e); } } }); } /** * TODO 用户管理:2.3、退出登录 */ public void logout() { BmobUser.logOut(); } /** * TODO 用户管理:2.4、获取当前用户 * * @return */ public User getCurrentUser() { return BmobUser.getCurrentUser(User.class); } /** * TODO 用户管理:2.5、查询用户 * * @param limit * @param listener */ public void queryUsers( final int limit, final FindListener<User> listener) { BmobQuery<User> query = new BmobQuery<>(); //去掉当前用户 try { BmobUser user = BmobUser.getCurrentUser(); query.addWhereNotEqualTo("username", user.getUsername()); } catch (Exception e) { e.printStackTrace(); } query.setLimit(limit); query.order("-createdAt"); query.findObjects(new FindListener<User>() { @Override public void done(List<User> list, BmobException e) { if (e == null) { if (list != null && list.size() > 0) { listener.done(list, e); } else { listener.done(list, new BmobException(CODE_NULL, "No result")); } } else { listener.done(list, e); } } }); } /** * TODO 用户管理:2.6、查询指定用户信息 * * @param objectId * @param listener */ public void queryUserInfo(String objectId, final QueryUserListener listener) { BmobQuery<User> query = new BmobQuery<>(); query.addWhereEqualTo("objectId", objectId); query.findObjects( new FindListener<User>() { @Override public void done(List<User> list, BmobException e) { if (e == null) { if (list != null && list.size() > 0) { listener.done(list.get(0), null); } else { listener.done(null, new BmobException(000, "No result")); } } else { listener.done(null, e); } } }); } /** * 更新用户资料和会话资料 * * @param event * @param listener */ public void updateUserInfo(MessageEvent event, final UpdateCacheListener listener) { final BmobIMConversation conversation = event.getConversation(); final BmobIMUserInfo info = event.getFromUserInfo(); final BmobIMMessage msg = event.getMessage(); String username = info.getName(); String avatar = info.getAvatar(); String title = conversation.getConversationTitle(); String icon = conversation.getConversationIcon(); //SDK内部将新会话的会话标题用objectId表示,因此需要比对用户名和私聊会话标题,后续会根据会话类型进行判断 if (!username.equals(title) || (avatar != null && !avatar.equals(icon))) { UserModel.getInstance().queryUserInfo(info.getUserId(), new QueryUserListener() { @Override public void done(User s, BmobException e) { if (e == null) { String name = s.getUsername(); String avatar = s.getAvatar(); conversation.setConversationIcon(avatar); conversation.setConversationTitle(name); info.setName(name); info.setAvatar(avatar); //TODO 用户管理:2.7、更新用户资料,用于在会话页面、聊天页面以及个人信息页面显示 BmobIM.getInstance().updateUserInfo(info); //TODO 会话:4.7、更新会话资料-如果消息是暂态消息,则不更新会话资料 if (!msg.isTransient()) { BmobIM.getInstance().updateConversation(conversation); } } else { Logger.e(e); } listener.done(null); } }); } else { listener.done(null); } } }
[ "693620471@qq.com" ]
693620471@qq.com
82e7b21b10ed9a94af9a354726c82590e0ed7056
de46e6bebf91f6872d83bea6b48861305992582d
/src/main/java/com/example/pattern_in_action/acyclic_visitor/StringData.java
bcb02e5fcdb251c012fe81047ff29bb69409d6c7
[]
no_license
onionyuyixi/pattern_in_action
6b185065fee4e374028eaed055d3b0f386548c56
7ec3f894b94f531223245cdb2a73b07bd7b46c6c
refs/heads/main
2023-06-21T20:32:15.189365
2021-07-14T18:44:43
2021-07-14T18:44:43
276,336,588
0
0
null
null
null
null
UTF-8
Java
false
false
373
java
package com.example.pattern_in_action.acyclic_visitor; import lombok.AllArgsConstructor; import lombok.Getter; @Getter @AllArgsConstructor public class StringData extends Data{ String data; @Override public void accept(Visitor visitor) { if(visitor instanceof StringVisitor){ ((StringVisitor) visitor).visitString(this); } } }
[ "qingluanxi@gmail.com" ]
qingluanxi@gmail.com
c34aa28b3954d1101edd5f3f97b8ca5c2f9b6e63
373c43b102d5c391ac77360539d98438ae8e670c
/test/org/ice4j/pseudotcp/PseudoTcpTestPingPong.java
4cf34432f1c324778169ce12e04571918ac759d6
[]
no_license
sroze/ice4j
07ee07924a1e97a931e163e5bb87a19a78430e25
1da14ec53f8e82abb84d4b1925a7d97e01c53aa6
refs/heads/master
2023-08-14T03:40:09.714786
2013-07-15T15:39:30
2013-07-15T15:39:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
10,606
java
/* * ice4j, the OpenSource Java Solution for NAT and Firewall Traversal. * Maintained by the Jitsi community (https://jitsi.org). * * Distributable under LGPL license. * See terms of license at gnu.org. */ package org.ice4j.pseudotcp; import java.io.*; import java.util.logging.*; import org.ice4j.pseudotcp.util.*; import static org.junit.Assert.*; import org.junit.*; /** * This class implements test for two way transfers * * @author Pawel Domas */ public class PseudoTcpTestPingPong extends PseudoTcpTestBase { /** * The logger. */ private static final Logger logger = Logger.getLogger(PseudoTCPBase.class.getName()); /** * The sender */ private PseudoTCPBase sender; /** * The receiver */ private PseudoTCPBase receiver; /** * How much data is sent per ping */ private int bytesPerSend; /** * Iterations count */ private int iterationsRemaining; public PseudoTcpTestPingPong() { } public void setBytesPerSend(int bytes_per_send) { this.bytesPerSend = bytes_per_send; } /** * The send stream buffer */ ByteFifoBuffer send_stream; /** * The receive stream buffer */ ByteFifoBuffer recv_stream; /** * Performs ping-pong test for <tt>iterations</tt> with packets of * <tt>size</tt> bytes * * @param size * @param iterations */ public void doTestPingPong(int size, int iterations) { Thread.setDefaultUncaughtExceptionHandler(this); long start, end; iterationsRemaining = iterations; receiver = getRemoteTcp(); sender = getLocalTcp(); // Create some dummy data byte[] dummy = createDummyData(size); send_stream = new ByteFifoBuffer(size); send_stream.write(dummy, size); //Prepare the receive stream recv_stream = new ByteFifoBuffer(size); //Connect and wait until connected start = PseudoTCPBase.now(); startClocks(); try { connect(); } catch (IOException ex) { ex.printStackTrace(); fail(ex.getMessage()); } //assert Connect() == 0; assert_Connected_wait(kConnectTimeoutMs); // Sending will start from OnTcpWriteable and stop when the required // number of iterations have completed. assert_Disconnected_wait(kMinTransferRate); long elapsed = PseudoTCPBase.now() - start; stopClocks(); logger.log(Level.INFO, "Performed " + iterations + " pings in " + elapsed + " ms"); } /** * Catches onTcpReadable event for receiver * * @param tcp */ public void onTcpReadable(PseudoTCPBase tcp) { assertEquals("Unexpected onTcpReadable", receiver, tcp); try { // Stream bytes to the recv stream as they arrive. readData(); } catch (IOException ex) { //will be caught by default handler and test will fail throw new RuntimeException(ex); } // If we've received the desired amount of data, rewind things // and send it back the other way! int recvd = recv_stream.getBuffered(); int required = send_stream.length(); if (logger.isLoggable(Level.FINER)) { logger.log(Level.FINER, "test - receivied: " + recvd + " required: " + required); } if (recvd == required) { if (receiver == getLocalTcp() && --iterationsRemaining == 0) { close(); // TODO: Fake OnTcpClosed() on the receiver for now. onTcpClosed(getRemoteTcp(), null); return; } //switches receivier with sender and performs test the other way PseudoTCPBase tmp = receiver; receiver = sender; sender = tmp; send_stream.resetReadPosition(); send_stream.consumeWriteBuffer(send_stream.getWriteRemaining()); recv_stream.resetWritePosition(); onTcpWriteable(sender); } } /** * Catches the ontcpWriteable event for sender * * @param tcp */ public void onTcpWriteable(PseudoTCPBase tcp) { if (tcp != sender) { return; } // Write bytes from the send stream when we can. // Shut down when we've sent everything. logger.log(Level.FINER, "Flow Control Lifted"); try { writeData(); } catch (IOException ex) { throw new RuntimeException(ex); } } /** * Reads the data in loop until is something available * * @throws IOException */ private void readData() throws IOException { byte[] block = new byte[kBlockSize]; int rcvd = 0; do { rcvd = receiver.recv(block, block.length); if (rcvd > 0) { recv_stream.write(block, rcvd); if (logger.isLoggable(Level.FINE)) { logger.log(Level.FINE, "Receivied: " + recv_stream.getBuffered()); } } } while (rcvd > 0); } /** * Writes all data to the receiver * * @throws IOException */ private void writeData() throws IOException { int tosend; int sent = 0; byte[] block = new byte[kBlockSize]; do { tosend = bytesPerSend != 0 ? bytesPerSend : block.length; tosend = send_stream.read(block, tosend); if (tosend > 0) { sent = sender.send(block, tosend); updateLocalClock(); if (sent != -1) { if(logger.isLoggable(Level.FINE)) { logger.log(Level.FINE, "Sent: " + sent); } } else { logger.log(Level.FINE, "Flow controlled"); } } else { sent = tosend = 0; } } while (sent > 0); } /** * * Ping-pong (request/response) tests * */ /** * Test sending <= 1x MTU of data in each ping/pong. Should take <10ms. */ public void testPingPong1xMtu() { //logger.log(Level.INFO, "Test ping - pong 1xMTU"); PseudoTcpTestPingPong test = new PseudoTcpTestPingPong(); test.setLocalMtu(1500); test.setRemoteMtu(1500); test.doTestPingPong(100, 100); } /** * Test sending 2x-3x MTU of data in each ping/pong. Should take <10ms. */ public void testPingPong3xMtu() { //logger.log(Level.INFO, "Test ping - pong 3xMTU"); PseudoTcpTestPingPong test = new PseudoTcpTestPingPong(); test.setLocalMtu(1500); test.setRemoteMtu(1500); test.doTestPingPong(400, 100); } /** * Test sending 1x-2x MTU of data in each ping/pong. Should take ~1s, due to * interaction between Nagling and Delayed ACK. */ public void testPingPong2xMtu() { //logger.log(Level.INFO, "Test ping - pong 2xMTU"); PseudoTcpTestPingPong test = new PseudoTcpTestPingPong(); test.setLocalMtu(1500); test.setRemoteMtu(1500); test.doTestPingPong(2000, 5); } /** * Test sending 1x-2x MTU of data in each ping/pong with Delayed ACK off. * Should take <10ms. */ public void testPingPong2xMtuWithAckDelayOff() { //logger.log(Level.INFO, "Test ping - pong 2xMTU ack delay off"); PseudoTcpTestPingPong test = new PseudoTcpTestPingPong(); test.setLocalMtu(1500); test.setRemoteMtu(1500); test.setOptAckDelay(0); test.doTestPingPong(2000, 100); } /** * Test sending 1x-2x MTU of data in each ping/pong with Nagling off. Should * take <10ms. */ public void testPingPong2xMtuWithNaglingOff() { //logger.log(Level.INFO, "Test ping - pong 2xMTU nagling off"); PseudoTcpTestPingPong test = new PseudoTcpTestPingPong(); test.setLocalMtu(1500); test.setRemoteMtu(1500); test.setOptNagling(false); test.doTestPingPong(2000, 5); } /** * Test sending a ping as pair of short (non-full) segments. Should take * ~1s, due to Delayed ACK interaction with Nagling. */ public void testPingPongShortSegments() { //logger.log(Level.INFO, "Test ping - pong short segments"); PseudoTcpTestPingPong test = new PseudoTcpTestPingPong(); test.setLocalMtu(1500); test.setRemoteMtu(1500); test.setOptAckDelay(5000); test.setBytesPerSend(50); // i.e. two Send calls per payload test.doTestPingPong(100, 5); } /** * Test sending ping as a pair of short (non-full) segments, with Nagling * off. Should take <10ms. */ public void testPingPongShortSegmentsWithNaglingOff() { //logger.log(Level.INFO, "Test ping - pong short segments nagling off"); PseudoTcpTestPingPong test = new PseudoTcpTestPingPong(); test.setLocalMtu(1500); test.setRemoteMtu(1500); test.setOptNagling(false); test.setBytesPerSend(50); // i.e. two Send calls per payload test.doTestPingPong(100, 5); } /** * Test sending <= 1x MTU of data ping/pong, in two segments, no Delayed * ACK. Should take ~1s. */ public void testPingPongShortSegmentsWithAckDelayOff() { //logger.log(Level.INFO, "Test ping - pong short segments nagling off"); PseudoTcpTestPingPong test = new PseudoTcpTestPingPong(); test.setLocalMtu(1500); test.setRemoteMtu(1500); test.setBytesPerSend(50); // i.e. two Send calls per payload test.setOptAckDelay(0); test.doTestPingPong(100, 5); } }
[ "paweldomas@gmail.com" ]
paweldomas@gmail.com
0604adcd9e8eef5b415f6edade9df01a9e06d3c9
b348eb43aadad4232d2c09f2f79aa6e656fc9d53
/src/ru/job4j/loop/Mortgage.java
ddbdc499811453ff257fbdaab7badc1750ee74e5
[]
no_license
asolodova/job4j_elementary
e745c2ac8471c611b0b5457dbaca0bb5269d5183
bb45d8f620ab1df45e7293c74850de2a2ea8cff1
refs/heads/master
2022-07-09T17:05:35.476135
2020-05-12T16:15:47
2020-05-12T16:15:47
260,009,106
0
0
null
2020-04-29T18:27:14
2020-04-29T18:27:13
null
UTF-8
Java
false
false
294
java
package ru.job4j.loop; public class Mortgage { public int year(int amount, int salary, double percent) { int year = 0; while (amount > 0) { year += 1; amount = (int) (amount + amount * percent / 100) - salary; } return year; } }
[ "a.solodova@adsterratech.com" ]
a.solodova@adsterratech.com
0629abe9f7d8d2128c4dc678cd54a5c1fa1e89bf
80e6491876cef408fcb5a42847a7aea5e4fbf1ce
/server/src/main/java/com/springserver/server/model/BaseEntity.java
cc3cf023748c18bf7d5c4062031f7b1740773b1f
[]
no_license
Pinyoke/EgeszsegugyetTamogatoMobilAlkalmatasKulsoSzerverrel
48c6207228b0298b2beff0c5d9523033dc864af3
3995b519fb702eab162dc0b07bb06715306c658a
refs/heads/master
2022-11-26T23:42:56.877684
2020-08-13T17:09:49
2020-08-13T17:09:49
287,082,431
0
0
null
null
null
null
UTF-8
Java
false
false
968
java
package com.springserver.server.model; import javax.persistence.*; import java.time.LocalDateTime; @MappedSuperclass public class BaseEntity { @Id @GeneratedValue(strategy = GenerationType.AUTO) protected Long id; @Column(updatable = false) protected LocalDateTime createdAt; @Column protected LocalDateTime modifiedAt; public BaseEntity() { LocalDateTime now = LocalDateTime.now(); this.createdAt = now; this.modifiedAt = now; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public LocalDateTime getCreatedAt() { return createdAt; } public void setCreatedAt(LocalDateTime createdAt) { this.createdAt = createdAt; } public LocalDateTime getModifiedAt() { return modifiedAt; } public void setModifiedAt(LocalDateTime modifiedAt) { this.modifiedAt = modifiedAt; } }
[ "pinyoke55@gmail.com" ]
pinyoke55@gmail.com
c7e273a0b25b10e559f3aa1fe5f408ab15743f46
65b789230fce83529ab0d6a55b41ad8a4d77eac4
/src/main/java/screen/AT2MDMRM0017/AT2MDMRM0017Test.java
4073aa51c28bd8b157727d961682fbd3bd1fb55b
[]
no_license
a24otorandell/ProjectAutotest
251731182971e38172e5b989635a566689e0ef72
e5de9a21c2ada5f0a7ca5c138da78b505c4b58a6
refs/heads/main
2021-01-21T14:58:02.976802
2017-01-12T09:53:16
2017-01-12T09:53:16
59,011,549
1
3
null
2016-05-30T10:25:21
2016-05-17T10:04:13
Java
UTF-8
Java
false
false
58,284
java
package screen.AT2MDMRM0017; import core.CommonActions.CommonProcedures; import core.CommonActions.Functions; import core.TestDriver.TestDriver; import core.recursiveData.recursiveXPaths; import java.util.Random; /** * Created by jmrios on 13/12/2016. */ public class AT2MDMRM0017Test { protected AT2MDMRM0017Locators locators; protected AT2MDMRM0017Data data; public AT2MDMRM0017Test() { } public AT2MDMRM0017Locators getLocators() { return locators; } public void setLocators(AT2MDMRM0017Locators locators) { this.locators = locators; } public AT2MDMRM0017Data getData() { return data; } public void setData(AT2MDMRM0017Data data) { this.data = data; } public void start(TestDriver driver) { setScreenInfo(driver); CommonProcedures.goToScreen(driver); } protected void setScreenInfo(TestDriver driver) { driver.getTestdetails().setMainmenu("Master Data Management"); driver.getTestdetails().setSubmenu("Market"); driver.getTestdetails().setScreen("HB Labels Maintenance"); } protected String getElements(String key) { return String.valueOf(this.locators.getElements().get(key)); } protected String getData(String key) { return String.valueOf(this.data.getData().get(key)); } protected boolean testCSED(TestDriver driver) { //HB LABELS MAINTENANCE if (!interaction_record_hblabels_MDM(driver)) return false; if (!search_MDM(driver)) return false; if (!interaction_edit_hblabels_MDM(driver)) return false; if (!qbe_hblabels_MDM(driver)) return false; if (!others_actions_hblabels_MDM(driver)) return false; //DICTIONARY if (!interaction_record_dct_MDM(driver)) return false; if (!qbe_dct_MDM(driver)) return false; if (!interaction_edit_dct_MDM(driver)) return false; if (!qbe_dct_MDM(driver)) return false; if (!others_actions_dct_MDM(driver)) return false; //DICTIONARY MULTI-LANGUAGES if (!interaction_record_dmulti_MDM(driver)) return false; if (!qbe_dmulti_MDM(driver)) return false; if (!interaction_edit_dmulti_MDM(driver)) return false; if (!qbe_dmulti_MDM(driver)) return false; if (!others_actions_dmulti_MDM(driver)) return false; //CHANGE TAB if (!first_change_tab(driver)) return false; //HELP if (!interaction_record_hlp_MDM(driver)) return false; if (!qbe_hlp_MDM(driver)) return false; if (!interaction_edit_hlp_MDM(driver)) return false; if (!qbe_hlp_MDM(driver)) return false; if (!others_actions_hlp_MDM(driver)) return false; //HELP MULTI-LANGUAGES if (!interaction_record_hmulti_MDM(driver)) return false; if (!qbe_hmulti_MDM(driver)) return false; if (!interaction_edit_hmulti_MDM(driver)) return false; if (!qbe_hmulti_MDM(driver)) return false; if (!others_actions_hmulti_MDM(driver)) return false; //CHANGE TAB if (!second_change_tab(driver)) return false; //BANNER if (!interaction_record_bnnr_MDM(driver)) return false; if (!qbe_bnnr_MDM(driver)) return false; if (!interaction_edit_bnnr_MDM(driver)) return false; if (!qbe_bnnr_MDM(driver)) return false; if (!others_actions_bnnr_MDM(driver)) return false; //CHANGE TAB if (!third_change_tab(driver)) return false; //HEADER if (!interaction_record_hdr_MDM(driver)) return false; if (!qbe_hdr_MDM(driver)) return false; if (!interaction_edit_hdr_MDM(driver)) return false; if (!qbe_hdr_MDM(driver)) return false; if (!others_actions_hdr_MDM(driver)) return false; //HEADER MULTI-LANGUAGES if (!interaction_record_hdmulti_MDM(driver)) return false; if (!qbe_hdmulti_MDM(driver)) return false; if (!interaction_edit_hdmulti_MDM(driver)) return false; if (!qbe_hdmulti_MDM(driver)) return false; if (!others_actions_hdmulti_MDM(driver)) return false; if (!delete_hdmulti_MDM(driver)) return false; //HEADER if (!delete_hdr_MDM(driver)) return false; //CHANGE TAB if (!second_change_tab(driver)) return false; //BANNER if (!delete_bnnr_MDM(driver)) return false; //CHANGE TAB if (!first_change_tab(driver)) return false; //HELP MULTI-LANGUAGES if (!delete_hmulti_MDM(driver)) return false; //HELP if (!delete_hlp_MDM(driver)) return false; //CHANGE TAB if (!fourth_change_tab(driver)) return false; //DICTIONARY MULTI-LANGUAGES if (!delete_dmulti_MDM(driver)) return false; //DICTIONARY if (!delete_dct_MDM(driver)) return false; //HB LABELS MAINTENANCE if (!delete_hblabels_MDM(driver)) return false; return false; } private boolean interaction_record_hblabels_MDM(TestDriver driver) { driver.getReport().addHeader("CREATION RECORD", 3, false); String where = " on CREATION"; Functions.break_time(driver, 30, 500); if (!Functions.checkClick(driver, new String[]{"MDM_hblabels_b_add", getElements("MDM_hblabels_b_add")}, //element to click recursiveXPaths.glass, //element expected to appear where)) { return false; } if (!Functions.insertInput(driver, new String[]{"add_hblabels_i_page", getElements("add_hblabels_i_page")}, // element path "page", getData("page"), where)) { return false; } if (!Functions.insertInput(driver, new String[]{"add_hblabels_i_description", getElements("add_hblabels_i_description")}, // element path "hblabels_description", getData("hblabels_description"), where)) { return false; } if (!Functions.checkClickByAbsence(driver, new String[]{"add_hblabels_b_save", getElements("add_hblabels_b_save")}, //element to click recursiveXPaths.glass, //element expected to disappear where)) { return false; } return true; } private boolean search_MDM(TestDriver driver) { driver.getReport().addHeader("SEARCH RECORD", 3, false); String where = " on SEARCH"; if (!Functions.insertInput(driver, new String[]{"search_i_page", getElements("search_i_page")}, // element path "page", getData("page"), where)) { return false; } if (!Functions.insertInput(driver, new String[]{"search_i_description", getElements("search_i_description")}, // element path "hblabels_description", getData("hblabels_description"), where)) { return false; } if (!Functions.clickSearchAndResult(driver, new String[]{"search_b_search", getElements("search_b_search")}, //search button new String[]{"MDM_hblabels_e_result", getElements("MDM_hblabels_e_result")}, //result element where)) { return false; } return true; } private boolean interaction_edit_hblabels_MDM(TestDriver driver) { driver.getReport().addHeader("EDITION RECORD", 3, false); String where = " on EDITION"; Functions.break_time(driver, 30, 500); if (!Functions.checkClick(driver, new String[]{"MDM_hblabels_b_edit", getElements("MDM_hblabels_b_edit")}, //element to click recursiveXPaths.glass, //element expected to appear where)) { return false; } if (!Functions.insertInput(driver, new String[]{"add_hblabels_i_page", getElements("add_hblabels_i_page")}, // element path "page", getData("page_edit"), where)) { return false; } if (!Functions.insertInput(driver, new String[]{"add_hblabels_i_description", getElements("add_hblabels_i_description")}, // element path "hblabels_description", getData("hblabels_description_edit"), where)) { return false; } if (!Functions.checkClickByAbsence(driver, new String[]{"add_hblabels_b_save", getElements("add_hblabels_b_save")}, //element to click recursiveXPaths.glass, //element expected to disappear where)) { return false; } return true; } private boolean qbe_hblabels_MDM(TestDriver driver) { driver.getReport().addHeader("QBE RECORD", 3, false); String where = " on QBE"; if (!Functions.simpleClick(driver, new String[]{"search_b_reset", getElements("search_b_reset")}, //element to click where)) { return false; } Functions.break_time(driver, 30, 500); if (!Functions.clickQbE(driver, new String[]{"MDM_hblabels_b_qbe", getElements("MDM_hblabels_b_qbe")},// query button new String[]{"qbe_hblabels_i_page", getElements("qbe_hblabels_i_page")},//any query input where)) { return false; } if (!Functions.insertInput(driver, new String[]{"qbe_hblabels_i_page", getElements("qbe_hblabels_i_page")}, // element path "page", getData("page"), where)) { return false; } if (!Functions.insertInput(driver, new String[]{"qbe_hblabels_i_description", getElements("qbe_hblabels_i_description")}, // element path "hblabels_description", getData("hblabels_description"), where)) { return false; } if (!Functions.enterQueryAndClickResult(driver, new String[]{"qbe_hblabels_i_page", getElements("qbe_hblabels_i_page")}, //search button new String[]{"MDM_hblabels_e_result", getElements("MDM_hblabels_e_result")}, //result element where)) { return false; } return true; } private boolean others_actions_hblabels_MDM(TestDriver driver) { driver.getReport().addHeader("OTHER ACTIONS - AUDIT DATA", 3, false); String where = " on AUDIT DATA"; if (!Functions.auditData(driver, new String[]{"MDM_hblabels_b_actions", getElements("MDM_hblabels_b_actions")}, //actions button new String[]{"MDM_hblabels_b_actions_audit_data", getElements("MDM_hblabels_b_actions_audit_data")}, //audit button new String[]{"audit_b_ok", recursiveXPaths.audit_b_ok}, //audit_b_ok where)) { return false; } driver.getReport().addHeader("OTHER ACTIONS - DETACH", 3, false); where = " on DETACH"; if (!Functions.detachTable(driver, new String[]{"MDM_hblabels_b_detach", getElements("MDM_hblabels_b_detach")}, //detach button true, //screenshot?? where)) { return false; } return true; } private boolean interaction_record_dct_MDM(TestDriver driver) { driver.getReport().addHeader("CREATION RECORD", 3, false); String where = " on CREATION"; Functions.break_time(driver, 30, 500); if (!Functions.checkClick(driver, new String[]{"MDM_dct_b_add", getElements("MDM_dct_b_add")}, //element to click recursiveXPaths.glass, //element expected to appear where)) { return false; } if (!Functions.insertInput(driver, new String[]{"add_dct_i_code", getElements("add_dct_i_code")}, // element path "code", getData("code"), where)) { return false; } if (!Functions.checkClickByAbsence(driver, new String[]{"add_dct_b_save", getElements("add_dct_b_save")}, //element to click recursiveXPaths.glass, //element expected to disappear where)) { return false; } return true; } private boolean interaction_edit_dct_MDM(TestDriver driver) { driver.getReport().addHeader("EDITION RECORD", 3, false); String where = " on EDITION"; Functions.break_time(driver, 30, 500); if (!Functions.checkClick(driver, new String[]{"MDM_dct_b_edit", getElements("MDM_dct_b_edit")}, //element to click recursiveXPaths.glass, //element expected to appear where)) { return false; } if (!Functions.insertInput(driver, new String[]{"add_dct_i_code", getElements("add_dct_i_code")}, // element path "code", getData("code_edit"), where)) { return false; } if (!Functions.checkClickByAbsence(driver, new String[]{"add_dct_b_save", getElements("add_dct_b_save")}, //element to click recursiveXPaths.glass, //element expected to disappear where)) { return false; } return true; } private boolean qbe_dct_MDM(TestDriver driver) { driver.getReport().addHeader("QBE RECORD", 3, false); String where = " on QBE"; Functions.break_time(driver, 30, 500); if (!Functions.clickQbE(driver, new String[]{"MDM_dct_b_qbe", getElements("MDM_dct_b_qbe")},// query button new String[]{"qbe_dct_i_code", getElements("qbe_dct_i_code")},//any query input where)) { return false; } if (!Functions.insertInput(driver, new String[]{"qbe_dct_i_code", getElements("qbe_dct_i_code")}, "code", getData("code"), where)) { return false; } if (!Functions.enterQueryAndClickResult(driver, new String[]{"qbe_dct_i_code", getElements("qbe_dct_i_code")}, //search button new String[]{"MDM_dct_e_result", getElements("MDM_dct_e_result")}, //result element where)) { return false; } return true; } private boolean others_actions_dct_MDM(TestDriver driver) { driver.getReport().addHeader("OTHER ACTIONS - AUDIT DATA", 3, false); String where = " on AUDIT DATA"; if (!Functions.auditData(driver, new String[]{"MDM_dct_b_actions", getElements("MDM_dct_b_actions")}, //actions button new String[]{"MDM_dct_b_actions_audit_data", getElements("MDM_dct_b_actions_audit_data")}, //audit button new String[]{"audit_b_ok", recursiveXPaths.audit_b_ok}, //audit_b_ok where)) { return false; } driver.getReport().addHeader("OTHER ACTIONS - DETACH", 3, false); where = " on DETACH"; if (!Functions.detachTable(driver, new String[]{"MDM_dct_b_detach", getElements("MDM_dct_b_detach")}, //detach button true, //screenshot?? where)) { return false; } return true; } private boolean interaction_record_dmulti_MDM(TestDriver driver) { driver.getReport().addHeader("CREATION RECORD", 3, false); String where = " on CREATION"; Functions.break_time(driver, 30, 500); if (!Functions.checkClick(driver, new String[]{"MDM_dmulti_b_add", getElements("MDM_dmulti_b_add")}, //element to click recursiveXPaths.glass, //element expected to appear where)) { return false; } if(!Functions.createLov(driver, new String[]{"add_dmulti_lov_language",getElements("add_dmulti_lov_language")}, // b_lov new String[]{"add_dmulti_i_language", getElements("add_dmulti_i_language")}, // i_lov recursiveXPaths.lov_b_search, // lov b search recursiveXPaths.lov_e_result, // lov result recursiveXPaths.lov_b_ok, //lov b ok "dmulti_language", //Data name where)){ return false; } if (!Functions.insertInput(driver, new String[]{"add_dmulti_i_description", getElements("add_dmulti_i_description")}, // element path "dmulti_description", getData("dmulti_description"), where)) { return false; } if (!Functions.checkClickByAbsence(driver, new String[]{"add_dmulti_b_save", getElements("add_dmulti_b_save")}, //element to click recursiveXPaths.glass, //element expected to disappear where)) { return false; } return true; } private boolean interaction_edit_dmulti_MDM(TestDriver driver) { driver.getReport().addHeader("EDITION RECORD", 3, false); String where = " on EDITION"; Functions.break_time(driver, 30, 500); if (!Functions.checkClick(driver, new String[]{"MDM_dmulti_b_edit", getElements("MDM_dmulti_b_edit")}, //element to click recursiveXPaths.glass, //element expected to appear where)) { return false; } if(!Functions.createLov(driver, new String[]{"add_dmulti_lov_language",getElements("add_dmulti_lov_language")}, // b_lov new String[]{"add_dmulti_i_language", getElements("add_dmulti_i_language")}, // i_lov recursiveXPaths.lov_b_search, // lov b search recursiveXPaths.lov_e_altresult, // lov result recursiveXPaths.lov_b_ok, //lov b ok "dmulti_language", //Data name where)){ return false; } if (!Functions.insertInput(driver, new String[]{"add_dmulti_i_description", getElements("add_dmulti_i_description")}, // element path "dmulti_description", getData("dmulti_description_edit"), where)) { return false; } if (!Functions.checkClickByAbsence(driver, new String[]{"add_dmulti_b_save", getElements("add_dmulti_b_save")}, //element to click recursiveXPaths.glass, //element expected to disappear where)) { return false; } return true; } private boolean qbe_dmulti_MDM(TestDriver driver) { driver.getReport().addHeader("QBE RECORD", 3, false); String where = " on QBE"; Functions.break_time(driver, 30, 500); if (!Functions.clickQbE(driver, new String[]{"MDM_dmulti_b_qbe", getElements("MDM_dmulti_b_qbe")},// query button new String[]{"qbe_dmulti_i_language", getElements("qbe_dmulti_i_language")},//any query input where)) { return false; } if (!Functions.insertInput(driver, new String[]{"qbe_dmulti_i_language", getElements("qbe_dmulti_i_language")}, "dmulti_language", getData("dmulti_language"), where)) { return false; } if (!Functions.insertInput(driver, new String[]{"qbe_dmulti_i_description", getElements("qbe_dmulti_i_description")}, "dmulti_description", getData("dmulti_description"), where)) { return false; } if (!Functions.enterQueryAndClickResult(driver, new String[]{"qbe_dmulti_i_language", getElements("qbe_dmulti_i_language")}, //search button new String[]{"MDM_dmulti_e_result", getElements("MDM_dmulti_e_result")}, //result element where)) { return false; } return true; } private boolean others_actions_dmulti_MDM(TestDriver driver) { driver.getReport().addHeader("OTHER ACTIONS - AUDIT DATA", 3, false); String where = " on AUDIT DATA"; if (!Functions.auditData(driver, new String[]{"MDM_dmulti_b_actions", getElements("MDM_dmulti_b_actions")}, //actions button new String[]{"MDM_dmulti_b_actions_audit_data", getElements("MDM_dmulti_b_actions_audit_data")}, //audit button new String[]{"audit_b_ok", recursiveXPaths.audit_b_ok}, //audit_b_ok where)) { return false; } driver.getReport().addHeader("OTHER ACTIONS - DETACH", 3, false); where = " on DETACH"; if (!Functions.detachTable(driver, new String[]{"MDM_dmulti_b_detach", getElements("MDM_dmulti_b_detach")}, //detach button true, //screenshot?? where)) { return false; } return true; } private boolean first_change_tab(TestDriver driver) { driver.getReport().addHeader("CHANGE TAB RECORD", 3, false); String where = " on CHANGING TAB"; Functions.break_time(driver, 30, 500); Functions.zoomOut(driver); if (!Functions.checkClick(driver, new String[]{"MDM_b_help", getElements("MDM_b_help")}, //element to click new String[]{"MDM_hlp_b_add", getElements("MDM_hlp_b_add")}, //element expected to appear where)) { return false; } Functions.zoomIn(driver); return true; } private boolean interaction_record_hlp_MDM(TestDriver driver) { driver.getReport().addHeader("CREATION RECORD", 3, false); String where = " on CREATION"; Functions.break_time(driver, 30, 500); if (!Functions.checkClick(driver, new String[]{"MDM_hlp_b_add", getElements("MDM_hlp_b_add")}, //element to click recursiveXPaths.glass, //element expected to appear where)) { return false; } if (!Functions.insertInput(driver, new String[]{"add_hlp_i_detail", getElements("add_hlp_i_detail")}, // element path "detail", getData("detail"), where)) { return false; } String list_options[] = {"Description", "image", "text"}; if (!Functions.selectTextRandom(driver, new String[]{"add_hlp_sl_type", getElements("add_hlp_sl_type")}, list_options, "type", where)) { return false; } if (!Functions.checkClickByAbsence(driver, new String[]{"add_hlp_b_save", getElements("add_hlp_b_save")}, //element to click recursiveXPaths.glass, //element expected to disappear where)) { return false; } return true; } private boolean interaction_edit_hlp_MDM(TestDriver driver) { driver.getReport().addHeader("EDITION RECORD", 3, false); String where = " on EDITION"; Functions.break_time(driver, 30, 500); if (!Functions.checkClick(driver, new String[]{"MDM_hlp_b_edit", getElements("MDM_hlp_b_edit")}, //element to click recursiveXPaths.glass, //element expected to appear where)) { return false; } if (!Functions.insertInput(driver, new String[]{"add_hlp_i_detail", getElements("add_hlp_i_detail")}, // element path "detail", getData("detail_edit"), where)) { return false; } String list_options[] = {"Description", "image", "text"}; if (!Functions.selectTextRandom(driver, new String[]{"add_hlp_sl_type", getElements("add_hlp_sl_type")}, list_options, "type", where)) { return false; } if (!Functions.checkClickByAbsence(driver, new String[]{"add_hlp_b_save", getElements("add_hlp_b_save")}, //element to click recursiveXPaths.glass, //element expected to disappear where)) { return false; } return true; } private boolean qbe_hlp_MDM(TestDriver driver) { driver.getReport().addHeader("QBE RECORD", 3, false); String where = " on QBE"; Functions.break_time(driver, 30, 500); if (!Functions.clickQbE(driver, new String[]{"MDM_hlp_b_qbe", getElements("MDM_hlp_b_qbe")},// query button new String[]{"qbe_hlp_i_detail", getElements("qbe_hlp_i_detail")},//any query input where)) { return false; } if (!Functions.insertInput(driver, new String[]{"qbe_hlp_i_detail", getElements("qbe_hlp_i_detail")}, "detail", getData("detail"), where)) { return false; } if (!Functions.selectText(driver, new String[]{"qbe_hlp_sl_type",getElements("qbe_hlp_sl_type")}, getData("type"), "type", where)) { return false; } if (!Functions.enterQueryAndClickResult(driver, new String[]{"qbe_hlp_i_detail", getElements("qbe_hlp_i_detail")}, //search button new String[]{"MDM_hlp_e_result", getElements("MDM_hlp_e_result")}, //result element where)) { return false; } return true; } private boolean others_actions_hlp_MDM(TestDriver driver) { driver.getReport().addHeader("OTHER ACTIONS - AUDIT DATA", 3, false); String where = " on AUDIT DATA"; if (!Functions.auditData(driver, new String[]{"MDM_hlp_b_actions", getElements("MDM_hlp_b_actions")}, //actions button new String[]{"MDM_hlp_b_actions_audit_data", getElements("MDM_hlp_b_actions_audit_data")}, //audit button new String[]{"audit_b_ok", recursiveXPaths.audit_b_ok}, //audit_b_ok where)) { return false; } driver.getReport().addHeader("OTHER ACTIONS - DETACH", 3, false); where = " on DETACH"; Functions.break_time(driver, 30, 500); if (!Functions.checkClick(driver, new String[]{"MDM_hmulti_b_detach_show", getElements("MDM_hmulti_b_detach_show")}, //element to click new String[]{"MDM_hmulti_b_detach", getElements("MDM_hmulti_b_detach")}, //element expected to appear where)) { return false; } if (!Functions.detachTable(driver, new String[]{"MDM_hlp_b_detach", getElements("MDM_hlp_b_detach")}, //detach button true, //screenshot?? where)) { return false; } return true; } private boolean interaction_record_hmulti_MDM(TestDriver driver) { driver.getReport().addHeader("CREATION RECORD", 3, false); String where = " on CREATION"; Functions.break_time(driver, 30, 500); if (!Functions.checkClick(driver, new String[]{"MDM_hmulti_b_add", getElements("MDM_hmulti_b_add")}, //element to click recursiveXPaths.glass, //element expected to appear where)) { return false; } if(!Functions.createLov(driver, new String[]{"add_hmulti_lov_language",getElements("add_hmulti_lov_language")}, // b_lov new String[]{"add_hmulti_i_language", getElements("add_hmulti_i_language")}, // i_lov recursiveXPaths.lov_b_search, // lov b search recursiveXPaths.lov_e_result, // lov result recursiveXPaths.lov_b_ok, //lov b ok "hmulti_language", //Data name where)){ return false; } if (!Functions.insertInput(driver, new String[]{"add_hmulti_i_concept", getElements("add_hmulti_i_concept")}, // element path "hmulti_concept", getData("hmulti_concept"), where)) { return false; } if (!Functions.insertInput(driver, new String[]{"add_hmulti_i_description", getElements("add_hmulti_i_description")}, // element path "hmulti_description", getData("hmulti_description"), where)) { return false; } if (!Functions.checkClickByAbsence(driver, new String[]{"add_hmulti_b_save", getElements("add_hmulti_b_save")}, //element to click recursiveXPaths.glass, //element expected to disappear where)) { return false; } return true; } private boolean interaction_edit_hmulti_MDM(TestDriver driver) { driver.getReport().addHeader("EDITION RECORD", 3, false); String where = " on EDITION"; Functions.break_time(driver, 30, 500); if (!Functions.checkClick(driver, new String[]{"MDM_hmulti_b_edit", getElements("MDM_hmulti_b_edit")}, //element to click recursiveXPaths.glass, //element expected to appear where)) { return false; } if(!Functions.createLov(driver, new String[]{"add_hmulti_lov_language",getElements("add_hmulti_lov_language")}, // b_lov new String[]{"add_hmulti_i_language", getElements("add_hmulti_i_language")}, // i_lov recursiveXPaths.lov_b_search, // lov b search recursiveXPaths.lov_e_altresult, // lov result recursiveXPaths.lov_b_ok, //lov b ok "hmulti_language", //Data name where)){ return false; } if (!Functions.insertInput(driver, new String[]{"add_hmulti_i_concept", getElements("add_hmulti_i_concept")}, // element path "hmulti_concept", getData("hmulti_concept_edit"), where)) { return false; } if (!Functions.insertInput(driver, new String[]{"add_hmulti_i_description", getElements("add_hmulti_i_description")}, // element path "hmulti_description", getData("hmulti_description_edit"), where)) { return false; } if (!Functions.checkClickByAbsence(driver, new String[]{"add_hmulti_b_save", getElements("add_hmulti_b_save")}, //element to click recursiveXPaths.glass, //element expected to disappear where)) { return false; } return true; } private boolean qbe_hmulti_MDM(TestDriver driver) { driver.getReport().addHeader("QBE RECORD", 3, false); String where = " on QBE"; Functions.break_time(driver, 30, 500); if (!Functions.clickQbE(driver, new String[]{"MDM_hmulti_b_qbe", getElements("MDM_hmulti_b_qbe")},// query button new String[]{"qbe_hmulti_i_language", getElements("qbe_hmulti_i_language")},//any query input where)) { return false; } if (!Functions.insertInput(driver, new String[]{"qbe_hmulti_i_language", getElements("qbe_hmulti_i_language")}, "hmulti_language", getData("hmulti_language"), where)) { return false; } if (!Functions.insertInput(driver, new String[]{"qbe_hmulti_i_concept", getElements("qbe_hmulti_i_concept")}, "hmulti_concept", getData("hmulti_concept"), where)) { return false; } if (!Functions.insertInput(driver, new String[]{"qbe_hmulti_i_description", getElements("qbe_hmulti_i_description")}, "hmulti_description", getData("hmulti_description"), where)) { return false; } if (!Functions.enterQueryAndClickResult(driver, new String[]{"qbe_hmulti_i_language", getElements("qbe_hmulti_i_language")}, //search button new String[]{"MDM_hmulti_e_result", getElements("MDM_hmulti_e_result")}, //result element where)) { return false; } return true; } private boolean others_actions_hmulti_MDM(TestDriver driver) { driver.getReport().addHeader("OTHER ACTIONS - AUDIT DATA", 3, false); String where = " on AUDIT DATA"; if (!Functions.auditData(driver, new String[]{"MDM_hmulti_b_actions", getElements("MDM_hmulti_b_actions")}, //actions button new String[]{"MDM_hmulti_b_actions_audit_data", getElements("MDM_hmulti_b_actions_audit_data")}, //audit button new String[]{"audit_b_ok", recursiveXPaths.audit_b_ok}, //audit_b_ok where)) { return false; } driver.getReport().addHeader("OTHER ACTIONS - DETACH", 3, false); where = " on DETACH"; if (!Functions.detachTable(driver, new String[]{"MDM_hmulti_b_detach", getElements("MDM_hmulti_b_detach")}, //detach button true, //screenshot?? where)) { return false; } return true; } private boolean second_change_tab(TestDriver driver) { driver.getReport().addHeader("CHANGE TAB RECORD", 3, false); String where = " on CHANGING TAB"; Functions.break_time(driver, 30, 500); if (!Functions.checkClick(driver, new String[]{"MDM_b_banner", getElements("MDM_b_banner")}, //element to click new String[]{"MDM_bnnr_b_add", getElements("MDM_bnnr_b_add")}, //element expected to appear where)) { return false; } return true; } private boolean interaction_record_bnnr_MDM(TestDriver driver) { driver.getReport().addHeader("CREATION RECORD", 3, false); String where = " on CREATION"; Functions.break_time(driver, 30, 500); if (!Functions.checkClick(driver, new String[]{"MDM_bnnr_b_add", getElements("MDM_bnnr_b_add")}, //element to click recursiveXPaths.glass, //element expected to appear where)) { return false; } if (!Functions.insertInput(driver, new String[]{"add_bnnr_i_code", getElements("add_bnnr_i_code")}, // element path "bnnr_code", getData("bnnr_code"), where)) { return false; } if(!Functions.createLov(driver, new String[]{"add_bnnr_lov_language",getElements("add_bnnr_lov_language")}, // b_lov new String[]{"add_bnnr_i_language", getElements("add_bnnr_i_language")}, // i_lov recursiveXPaths.lov_b_search, // lov b search recursiveXPaths.lov_e_result, // lov result recursiveXPaths.lov_b_ok, //lov b ok "bnnr_language", //Data name where)){ return false; } if (!Functions.insertInput(driver, new String[]{"add_bnnr_i_description", getElements("add_bnnr_i_description")}, // element path "bnnr_description", getData("bnnr_description"), where)) { return false; } Random booleanValue = new Random(); boolean getRandomBoolean = booleanValue.nextBoolean(); String booleanText; if (getRandomBoolean){ booleanText = "Yes"; if(!Functions.checkboxValue(driver, getElements("add_bnnr_cb_status"), "status", true, true, where)) { return false; } } else { booleanText = "No"; if(!Functions.checkboxValue(driver, getElements("add_bnnr_cb_status"), "status", false, true, where)){ return false; } } if (!Functions.checkClickByAbsence(driver, new String[]{"add_bnnr_b_save", getElements("add_bnnr_b_save")}, //element to click recursiveXPaths.glass, //element expected to disappear where)) { return false; } return true; } private boolean interaction_edit_bnnr_MDM(TestDriver driver) { driver.getReport().addHeader("EDITION RECORD", 3, false); String where = " on EDITION"; Functions.break_time(driver, 30, 500); if (!Functions.checkClick(driver, new String[]{"MDM_bnnr_b_edit", getElements("MDM_bnnr_b_edit")}, //element to click recursiveXPaths.glass, //element expected to appear where)) { return false; } if (!Functions.insertInput(driver, new String[]{"add_bnnr_i_code", getElements("add_bnnr_i_code")}, // element path "bnnr_code", getData("bnnr_code_edit"), where)) { return false; } if(!Functions.createLov(driver, new String[]{"add_bnnr_lov_language",getElements("add_bnnr_lov_language")}, // b_lov new String[]{"add_bnnr_i_language", getElements("add_bnnr_i_language")}, // i_lov recursiveXPaths.lov_b_search, // lov b search recursiveXPaths.lov_e_altresult, // lov result recursiveXPaths.lov_b_ok, //lov b ok "bnnr_language", //Data name where)){ return false; } if (!Functions.insertInput(driver, new String[]{"add_bnnr_i_description", getElements("add_bnnr_i_description")}, // element path "bnnr_description", getData("bnnr_description_edit"), where)) { return false; } Random booleanValue = new Random(); boolean getRandomBoolean = booleanValue.nextBoolean(); String booleanText; if (getRandomBoolean){ booleanText = "Yes"; if(!Functions.checkboxValue(driver, getElements("add_bnnr_cb_status"), "status", true, true, where)) { return false; } } else { booleanText = "No"; if(!Functions.checkboxValue(driver, getElements("add_bnnr_cb_status"), "status", false, true, where)){ return false; } } if (!Functions.checkClickByAbsence(driver, new String[]{"add_bnnr_b_save", getElements("add_bnnr_b_save")}, //element to click recursiveXPaths.glass, //element expected to disappear where)) { return false; } return true; } private boolean qbe_bnnr_MDM(TestDriver driver) { driver.getReport().addHeader("QBE RECORD", 3, false); String where = " on QBE"; Functions.break_time(driver, 30, 500); if (!Functions.clickQbE(driver, new String[]{"MDM_bnnr_b_qbe", getElements("MDM_bnnr_b_qbe")},// query button new String[]{"qbe_bnnr_i_code", getElements("qbe_bnnr_i_code")},//any query input where)) { return false; } if (!Functions.insertInput(driver, new String[]{"qbe_bnnr_i_code", getElements("qbe_bnnr_i_code")}, "bnnr_code", getData("bnnr_code"), where)) { return false; } if (!Functions.insertInput(driver, new String[]{"qbe_bnnr_i_language", getElements("qbe_bnnr_i_language")}, "bnnr_language", getData("bnnr_language"), where)) { return false; } if (!Functions.insertInput(driver, new String[]{"qbe_bnnr_i_description", getElements("qbe_bnnr_i_description")}, "bnnr_description", getData("bnnr_description"), where)) { return false; } if (!Functions.selectText(driver, new String[]{"qbe_bnnr_sl_status",getElements("qbe_bnnr_sl_status")}, getData("status"), "status", where)) { return false; } if (!Functions.enterQueryAndClickResult(driver, new String[]{"qbe_bnnr_i_code", getElements("qbe_bnnr_i_code")}, //search button new String[]{"MDM_bnnr_e_result", getElements("MDM_bnnr_e_result")}, //result element where)) { return false; } return true; } private boolean others_actions_bnnr_MDM(TestDriver driver) { driver.getReport().addHeader("OTHER ACTIONS - AUDIT DATA", 3, false); String where = " on AUDIT DATA"; if (!Functions.auditData(driver, new String[]{"MDM_bnnr_b_actions", getElements("MDM_bnnr_b_actions")}, //actions button new String[]{"MDM_bnnr_b_actions_audit_data", getElements("MDM_bnnr_b_actions_audit_data")}, //audit button new String[]{"audit_b_ok", recursiveXPaths.audit_b_ok}, //audit_b_ok where)) { return false; } driver.getReport().addHeader("OTHER ACTIONS - DETACH", 3, false); where = " on DETACH"; if (!Functions.detachTable(driver, new String[]{"MDM_bnnr_b_detach", getElements("MDM_bnnr_b_detach")}, //detach button true, //screenshot?? where)) { return false; } return true; } private boolean third_change_tab(TestDriver driver) { driver.getReport().addHeader("CHANGE TAB RECORD", 3, false); String where = " on CHANGING TAB"; Functions.break_time(driver, 30, 500); if (!Functions.checkClick(driver, new String[]{"MDM_b_header", getElements("MDM_b_header")}, //element to click new String[]{"MDM_hdr_b_add", getElements("MDM_hdr_b_add")}, //element expected to appear where)) { return false; } return true; } private boolean interaction_record_hdr_MDM(TestDriver driver) { driver.getReport().addHeader("CREATION RECORD", 3, false); String where = " on CREATION"; Functions.break_time(driver, 30, 500); if (!Functions.checkClick(driver, new String[]{"MDM_hdr_b_add", getElements("MDM_hdr_b_add")}, //element to click recursiveXPaths.glass, //element expected to appear where)) { return false; } if (!Functions.insertInput(driver, new String[]{"add_hdr_i_number", getElements("add_hdr_i_number")}, // element path "number", getData("number"), where)) { return false; } if (!Functions.checkClickByAbsence(driver, new String[]{"add_hdr_b_save", getElements("add_hdr_b_save")}, //element to click recursiveXPaths.glass, //element expected to disappear where)) { return false; } return true; } private boolean interaction_edit_hdr_MDM(TestDriver driver) { driver.getReport().addHeader("EDITION RECORD", 3, false); String where = " on EDITION"; Functions.break_time(driver, 30, 500); if (!Functions.checkClick(driver, new String[]{"MDM_hdr_b_edit", getElements("MDM_hdr_b_edit")}, //element to click recursiveXPaths.glass, //element expected to appear where)) { return false; } if (!Functions.insertInput(driver, new String[]{"add_hdr_i_number", getElements("add_hdr_i_number")}, // element path "number", getData("number_edit"), where)) { return false; } if (!Functions.checkClickByAbsence(driver, new String[]{"add_hdr_b_save", getElements("add_hdr_b_save")}, //element to click recursiveXPaths.glass, //element expected to disappear where)) { return false; } return true; } private boolean qbe_hdr_MDM(TestDriver driver) { driver.getReport().addHeader("QBE RECORD", 3, false); String where = " on QBE"; Functions.break_time(driver, 30, 500); if (!Functions.clickQbE(driver, new String[]{"MDM_hdr_b_qbe", getElements("MDM_hdr_b_qbe")},// query button new String[]{"qbe_hdr_i_number", getElements("qbe_hdr_i_number")},//any query input where)) { return false; } if (!Functions.insertInput(driver, new String[]{"qbe_hdr_i_number", getElements("qbe_hdr_i_number")}, "number", getData("number"), where)) { return false; } if (!Functions.enterQueryAndClickResult(driver, new String[]{"qbe_hdr_i_number", getElements("qbe_hdr_i_number")}, //search button new String[]{"MDM_hdr_e_result", getElements("MDM_hdr_e_result")}, //result element where)) { return false; } return true; } private boolean others_actions_hdr_MDM(TestDriver driver) { driver.getReport().addHeader("OTHER ACTIONS - AUDIT DATA", 3, false); String where = " on AUDIT DATA"; if (!Functions.auditData(driver, new String[]{"MDM_hdr_b_actions", getElements("MDM_hdr_b_actions")}, //actions button new String[]{"MDM_hdr_b_actions_audit_data", getElements("MDM_hdr_b_actions_audit_data")}, //audit button new String[]{"audit_b_ok", recursiveXPaths.audit_b_ok}, //audit_b_ok where)) { return false; } driver.getReport().addHeader("OTHER ACTIONS - DETACH", 3, false); where = " on DETACH"; if (!Functions.detachTable(driver, new String[]{"MDM_hdr_b_detach", getElements("MDM_hdr_b_detach")}, //detach button true, //screenshot?? where)) { return false; } return true; } private boolean interaction_record_hdmulti_MDM(TestDriver driver) { driver.getReport().addHeader("CREATION RECORD", 3, false); String where = " on CREATION"; Functions.break_time(driver, 30, 500); if (!Functions.checkClick(driver, new String[]{"MDM_hdmulti_b_add", getElements("MDM_hdmulti_b_add")}, //element to click recursiveXPaths.glass, //element expected to appear where)) { return false; } if(!Functions.createLov(driver, new String[]{"add_hdmulti_lov_language",getElements("add_hdmulti_lov_language")}, // b_lov new String[]{"add_hdmulti_i_language", getElements("add_hdmulti_i_language")}, // i_lov recursiveXPaths.lov_b_search, // lov b search recursiveXPaths.lov_e_result, // lov result recursiveXPaths.lov_b_ok, //lov b ok "hdmulti_language", //Data name where)){ return false; } if (!Functions.insertInput(driver, new String[]{"add_hdmulti_i_header_description", getElements("add_hdmulti_i_header_description")}, // element path "hdmulti_description", getData("hdmulti_description"), where)) { return false; } if (!Functions.checkClickByAbsence(driver, new String[]{"add_hdmulti_b_save", getElements("add_hdmulti_b_save")}, //element to click recursiveXPaths.glass, //element expected to disappear where)) { return false; } return true; } private boolean interaction_edit_hdmulti_MDM(TestDriver driver) { driver.getReport().addHeader("EDITION RECORD", 3, false); String where = " on EDITION"; Functions.break_time(driver, 30, 500); if (!Functions.checkClick(driver, new String[]{"MDM_hdmulti_b_edit", getElements("MDM_hdmulti_b_edit")}, //element to click recursiveXPaths.glass, //element expected to appear where)) { return false; } if(!Functions.createLov(driver, new String[]{"add_hdmulti_lov_language",getElements("add_hdmulti_lov_language")}, // b_lov new String[]{"add_hdmulti_i_language", getElements("add_hdmulti_i_language")}, // i_lov recursiveXPaths.lov_b_search, // lov b search recursiveXPaths.lov_e_altresult, // lov result recursiveXPaths.lov_b_ok, //lov b ok "hdmulti_language", //Data name where)){ return false; } if (!Functions.insertInput(driver, new String[]{"add_hdmulti_i_header_description", getElements("add_hdmulti_i_header_description")}, // element path "hdmulti_description", getData("hdmulti_description_edit"), where)) { return false; } if (!Functions.checkClickByAbsence(driver, new String[]{"add_hdmulti_b_save", getElements("add_hdmulti_b_save")}, //element to click recursiveXPaths.glass, //element expected to disappear where)) { return false; } return true; } private boolean qbe_hdmulti_MDM(TestDriver driver) { driver.getReport().addHeader("QBE RECORD", 3, false); String where = " on QBE"; Functions.break_time(driver, 30, 500); if (!Functions.clickQbE(driver, new String[]{"MDM_hdmulti_b_qbe", getElements("MDM_hdmulti_b_qbe")},// query button new String[]{"qbe_hdmulti_i_language", getElements("qbe_hdmulti_i_language")},//any query input where)) { return false; } if (!Functions.insertInput(driver, new String[]{"qbe_hdmulti_i_language", getElements("qbe_hdmulti_i_language")}, "hdmulti_language", getData("hdmulti_language"), where)) { return false; } if (!Functions.insertInput(driver, new String[]{"qbe_hdmulti_i_header_description", getElements("qbe_hdmulti_i_header_description")}, "hdmulti_description", getData("hdmulti_description"), where)) { return false; } if (!Functions.enterQueryAndClickResult(driver, new String[]{"qbe_hdmulti_i_language", getElements("qbe_hdmulti_i_language")}, //search button new String[]{"MDM_hdmulti_e_result", getElements("MDM_hdmulti_e_result")}, //result element where)) { return false; } return true; } private boolean others_actions_hdmulti_MDM(TestDriver driver) { driver.getReport().addHeader("OTHER ACTIONS - AUDIT DATA", 3, false); String where = " on AUDIT DATA"; if (!Functions.auditData(driver, new String[]{"MDM_hdmulti_b_actions", getElements("MDM_hdmulti_b_actions")}, //actions button new String[]{"MDM_hdmulti_b_actions_audit_data", getElements("MDM_hdmulti_b_actions_audit_data")}, //audit button new String[]{"audit_b_ok", recursiveXPaths.audit_b_ok}, //audit_b_ok where)) { return false; } driver.getReport().addHeader("OTHER ACTIONS - DETACH", 3, false); where = " on DETACH"; if (!Functions.detachTable(driver, new String[]{"MDM_hdmulti_b_detach", getElements("MDM_hdmulti_b_detach")}, //detach button true, //screenshot?? where)) { return false; } return true; } private boolean delete_hdmulti_MDM(TestDriver driver) { driver.getReport().addHeader("DELETE DATA", 3, false); String where = " on DELETE DATA"; if (!Functions.simpleClick(driver, new String[]{"MDM_hdmulti_e_result", getElements("MDM_hdmulti_e_result")}, //element to click where)) { return false; } Functions.break_time(driver, 30, 500); if (!Functions.doDeleteNCheck(driver, new String[]{"MDM_hdmulti_b_delete", getElements("MDM_hdmulti_b_delete")}, new String[]{"MDM_hdmulti_e_records", getElements("MDM_hdmulti_e_records")}, new String[]{"MDM_hdmulti_b_delete_ok", getElements("MDM_hdmulti_b_delete_ok")}, //delete button yes where)) { return false; } Functions.break_time(driver, 30, 500); return true; } private boolean delete_hdr_MDM(TestDriver driver) { driver.getReport().addHeader("DELETE DATA", 3, false); String where = " on DELETE DATA"; if (!Functions.simpleClick(driver, new String[]{"MDM_hdr_e_result", getElements("MDM_hdr_e_result")}, //element to click where)) { return false; } Functions.break_time(driver, 30, 500); if(!Functions.doDelete(driver, new String[]{"MDM_hdr_b_delete", getElements("MDM_hdr_b_delete")},//delete button new String[]{"MDM_hdr_b_delete_ok", getElements("MDM_hdr_b_delete_ok")},//delete button where)) { return false; } Functions.break_time(driver, 30, 500); return true; } private boolean delete_bnnr_MDM(TestDriver driver) { driver.getReport().addHeader("DELETE DATA", 3, false); String where = " on DELETE DATA"; Functions.break_time(driver, 30, 500); if (!Functions.doDeleteNCheck(driver, new String[]{"MDM_bnnr_b_delete", getElements("MDM_bnnr_b_delete")}, new String[]{"MDM_bnnr_e_records", getElements("MDM_bnnr_e_records")}, new String[]{"MDM_bnnr_b_delete_ok", getElements("MDM_bnnr_b_delete_ok")}, //delete button yes where)) { return false; } Functions.break_time(driver, 30, 500); return true; } private boolean delete_hmulti_MDM(TestDriver driver) { driver.getReport().addHeader("DELETE DATA", 3, false); String where = " on DELETE DATA"; if (!Functions.simpleClick(driver, new String[]{"MDM_hmulti_e_result", getElements("MDM_hmulti_e_result")}, //element to click where)) { return false; } Functions.break_time(driver, 30, 500); if (!Functions.doDeleteNCheck(driver, new String[]{"MDM_hmulti_b_delete", getElements("MDM_hmulti_b_delete")}, new String[]{"MDM_hmulti_e_records", getElements("MDM_hmulti_e_records")}, new String[]{"MDM_hmulti_b_delete_ok", getElements("MDM_hmulti_b_delete_ok")}, //delete button yes where)) { return false; } Functions.break_time(driver, 30, 500); return true; } private boolean delete_hlp_MDM(TestDriver driver) { driver.getReport().addHeader("DELETE DATA", 3, false); String where = " on DELETE DATA"; if (!Functions.simpleClick(driver, new String[]{"MDM_hlp_e_result", getElements("MDM_hlp_e_result")}, //element to click where)) { return false; } Functions.break_time(driver, 30, 500); if(!Functions.doDelete(driver, new String[]{"MDM_hlp_b_delete", getElements("MDM_hlp_b_delete")},//delete button new String[]{"MDM_hlp_b_delete_ok", getElements("MDM_hlp_b_delete_ok")},//delete button where)) { return false; } Functions.break_time(driver, 30, 500); return true; } private boolean fourth_change_tab(TestDriver driver) { driver.getReport().addHeader("CHANGE TAB RECORD", 3, false); String where = " on CHANGING TAB"; Functions.break_time(driver, 30, 500); if (!Functions.checkClick(driver, new String[]{"MDM_b_dictionary", getElements("MDM_b_dictionary")}, //element to click new String[]{"MDM_dct_b_add", getElements("MDM_dct_b_add")}, //element expected to appear where)) { return false; } Functions.break_time(driver, 30, 500); return true; } private boolean delete_dmulti_MDM(TestDriver driver) { driver.getReport().addHeader("DELETE DATA", 3, false); String where = " on DELETE DATA"; if (!Functions.simpleClick(driver, new String[]{"MDM_dmulti_e_result", getElements("MDM_dmulti_e_result")}, //element to click where)) { return false; } Functions.break_time(driver, 30, 500); if (!Functions.doDeleteNCheck(driver, new String[]{"MDM_dmulti_b_delete", getElements("MDM_dmulti_b_delete")}, new String[]{"MDM_dmulti_e_records", getElements("MDM_dmulti_e_records")}, new String[]{"MDM_dmulti_b_delete_ok", getElements("MDM_dmulti_b_delete_ok")}, //delete button yes where)) { return false; } Functions.break_time(driver, 30, 500); return true; } private boolean delete_dct_MDM(TestDriver driver) { driver.getReport().addHeader("DELETE DATA", 3, false); String where = " on DELETE DATA"; if (!Functions.simpleClick(driver, new String[]{"MDM_dct_e_result", getElements("MDM_dct_e_result")}, //element to click where)) { return false; } Functions.break_time(driver, 30, 500); if (!Functions.doDeleteNCheck(driver, new String[]{"MDM_dct_b_delete", getElements("MDM_dct_b_delete")}, new String[]{"MDM_dct_e_records", getElements("MDM_dct_e_records")}, new String[]{"MDM_dct_b_delete_ok", getElements("MDM_dct_b_delete_ok")}, //delete button yes where)) { return false; } Functions.break_time(driver, 30, 500); return true; } private boolean delete_hblabels_MDM(TestDriver driver) { driver.getReport().addHeader("DELETE DATA", 3, false); String where = " on DELETE DATA"; Functions.break_time(driver, 30, 500); if (!Functions.doDeleteNCheck(driver, new String[]{"MDM_hblabels_b_delete", getElements("MDM_hblabels_b_delete")}, new String[]{"MDM_hblabels_e_records", getElements("MDM_hblabels_e_records")}, new String[]{"MDM_hblabels_b_delete_ok", getElements("MDM_hblabels_b_delete_ok")}, //delete button yes where)) { return false; } Functions.break_time(driver, 30, 500); return true; } }
[ "jmrios@angel24.es" ]
jmrios@angel24.es
372f5423c171b0ebf92cf2e53e65ac7413ab725f
ecb434ec91149210acc30a44fa331c88107a1e8b
/MMI3/src/main/java/tools/log4j2/MyDbProvider.java
d8edf8b53cda6641e042472cf434d4404a33c097
[]
no_license
elniko/TestProjects
98689fabb47d55faaf2ba90d00864a8d2dc8f305
209e2b06c55b6bdbba2051442408275f9efe7c2d
refs/heads/master
2020-04-04T15:25:19.805944
2015-04-17T09:37:11
2015-04-17T09:37:11
26,648,710
0
0
null
2014-12-08T14:08:34
2014-11-14T17:07:52
Java
UTF-8
Java
false
false
975
java
package tools.log4j2; import entity.LogEntity; import entity.ProcessEntity; import org.apache.logging.log4j.core.LogEvent; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import service.interfaces.LogService; /** * Created by stagiaire on 18/12/2014. */ @Component public class MyDbProvider { @Autowired LogService logService; //@Override public void execQuery(LogEvent event) { // System.out.println("test" + event.getMessage()); //LogService logService = ctx.getBean(ILogService.class); LogEntity e = new LogEntity(); e.setMessage(event.getMessage().getFormattedMessage()); // e.setLineCount(Long.valueOf(event.getContextMap().get("line_count"))); ProcessEntity pe = new ProcessEntity(); pe.setId(Integer.valueOf(event.getContextMap().get("process_id"))); e.setProcess(pe); logService.addMessage(e); } }
[ "stag@mail.com" ]
stag@mail.com
8b8eb0957626477d72e2dd7de8630f315e226592
724b913546e3f1fc3ca636a0e9390761fa23b7fd
/java/src/main/java/com/year2018/concurrency/chapter05/ProcessData.java
15b8cfc32ef3aecfb921f8270811a45de8f87a94
[]
no_license
ecit010223/DesignPatterns
cb0fe2f22fafbf09090a90b8c8bf1a33c9545294
2287ecdb45be33fd3326f14f5d6f72590e6dc104
refs/heads/master
2020-04-05T01:55:56.092033
2018-11-28T11:53:00
2018-11-28T11:53:00
130,223,894
0
0
null
null
null
null
UTF-8
Java
false
false
1,148
java
package com.year2018.concurrency.chapter05; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantReadWriteLock; /** * Author: zyh * Date: 2018/11/9 9:06 */ public class ProcessData { private static final ReentrantReadWriteLock rwl = new ReentrantReadWriteLock(); private static final Lock readLock = rwl.readLock(); private static final Lock writeLock = rwl.writeLock(); private volatile boolean update = false; public void processData() { readLock.lock(); if (!update) { // 必须先释放读锁 readLock.unlock(); // 锁降级从写锁获取到开始 writeLock.lock(); try { if (!update) { // 准备数据的流程(略) update = true; } readLock.lock(); } finally { writeLock.unlock(); } // 锁降级完成,写锁降级为读锁 } try { // 使用数据的流程(略) } finally { readLock.unlock(); } } }
[ "zyh2018" ]
zyh2018
d6919947355fb5344980272acc9ff7cec01c8882
ff98507aace1239bac5dc77bce998ae35e0345ac
/org/stepic/textanalyzer/TextAnalyzer.java
e5f470adb11b132f6707d3bfe6c61303f93ee102
[]
no_license
budilovskiy/Text-Analyzer
c1464e262e1313db93236d22788fda08df6a3e17
d474e3082acab5a87898eb4df698f6e95585ae5a
refs/heads/master
2021-01-10T12:55:11.054050
2015-09-30T18:09:11
2015-09-30T18:09:11
43,449,710
0
0
null
null
null
null
UTF-8
Java
false
false
94
java
package org.stepic.textanalyzer; interface TextAnalyzer { Label processText(String text); }
[ "maksim.budilovskiy@gmail.com" ]
maksim.budilovskiy@gmail.com
9091b3f8b90a0468b81bd8e93155cadf68ed9753
47067ff3b47fd35e864ef0922ed17ac323b5a527
/NewEAD_EAR-war/src/java/repository/FileUpload.java
b53698ff36a9d42ad8e33f9143673297e0bcacf3
[]
no_license
quocq6hcm/NewEAD_EAR
caa1939be08e771d625b80a1b0bb94b5cb535295
296fd43475b26c68b1d183ed1db4a60a93cd3b38
refs/heads/master
2021-05-03T23:55:02.628811
2018-02-28T14:29:42
2018-02-28T14:29:42
120,402,465
0
0
null
null
null
null
UTF-8
Java
false
false
288
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 repository; /** * * @author quocq */ public class FileUpload { final String PATH=""; }
[ "quocq6hcm@hotmail.com" ]
quocq6hcm@hotmail.com
579e7a1a94d00b0cba8417d45029a3d5cee46738
da19a2be2471a92c9dc0e81d703d489c2a90eded
/matches/src/main/java/com/project/matches/mymatches/repository/MyMatchesRepository.java
b7fe82874d6b4c2cb237faf804b2caba2af5131c
[]
no_license
sajeshkumar1711/sportsgeek-microservices
9506549a2cb760a5937cf30b56163cea41e1f6fe
46589b73d5085ab5dd33efe59a788408bc01e046
refs/heads/main
2023-04-07T22:37:41.259534
2021-04-22T05:30:12
2021-04-22T05:30:12
359,364,386
0
0
null
2021-04-22T05:30:12
2021-04-19T07:15:49
Java
UTF-8
Java
false
false
508
java
package com.project.matches.mymatches.repository; import com.project.matches.mymatches.model.MyMatches; import org.springframework.stereotype.Repository; import java.util.List; @Repository(value = "myMatchesRepo") public interface MyMatchesRepository { public List<MyMatches> findUpcomingContestByUserId(int userId) throws Exception; public List<MyMatches> findLiveContestByUserId(int userId) throws Exception; public List<MyMatches> findResultContestByUserId(int userId) throws Exception; }
[ "sajeshkumar1711@gmail.com" ]
sajeshkumar1711@gmail.com
0eb94159e48c75b9d47c945cbd17fb5ef705f8a9
d3c5b70ef5886983f765e177ac23a9303370b9ba
/Pokemon/src/Rpg/Squirtle.java
dab81eef12380739f725e95aef4d23ee8fa9cc1b
[]
no_license
MarcusViniciusO/Projeto_Final_de_Java
d2dd14397bf1e9d1051db848afd06ee9e1791398
c6f3d14581631d3d7fc4fcd489c8febc801240d7
refs/heads/main
2023-01-12T21:10:23.930582
2020-11-06T14:13:04
2020-11-06T14:13:04
309,747,600
0
0
null
null
null
null
UTF-8
Java
false
false
1,791
java
package Rpg; public class Squirtle extends PokemonAgua { private int nivel = 0; private double ataqueEspecial = 50; private String dono; private String[] nomes = {"Squirtle","Wartortle","Blastoise"}; public Squirtle(String dono) { super( "Squirtle", 112, // vida 94, // ataque 121, // defesa 0, // velocidade 0.9, // peso 0.5, // altura 0, // xpMIn - escluir 100 ); this.dono=dono; } public int getNivel() { return nivel; } public void setNivel(int nivel) { this.nivel = nivel; } public String getDono() { return dono; } public void setDono(String dono) { this.dono = dono; } public void recebeXp(int xp){ //atualizar nivel this.setXpMin( this.getXpMin() + xp ); if( this.getXpMin() >= this.getXpMax() && (this.nomes.length-1)>this.nivel) { this.setXpMin(0); this.nivel++; involuir(nivel); } } public void involuir(int nivel) { this.setNome(nomes[nivel]); switch(nivel) { case 1: this.setVida(132); this.setAtaque(126); this.setDefesa(155); this.setAltura(1); this.setPeso(22.5); break; case 2: this.setVida(160); this.setAtaque(171); this.setDefesa(207); this.setAltura(1.6); this.setPeso(85.5); break; } } public double ataque(String tipo){ return (((((20*(this.getNivel()+1) )/7)*this.getAtaque()*this.ataqueEspecial/this.getDefesa())/50)+2)*(1.5)*this.validarTipo(tipo)*(1*(this.rand(1, 0.15))); } public void recebeDano(double dano) { if( (this.getVida() - dano) > 0) { this.setVida( this.getVida() - dano ); }else { this.setVida(0); } } public String ultimaForma() { return this.nomes[this.nomes.length - 1 ]; } private double rand(double i, double j) { return (i) - ( Math.random() * (j) ); } }
[ "marcusviniciuso@outlook.com.br" ]
marcusviniciuso@outlook.com.br
7c6428358976fddd95314772f37a070a375610b8
604426ef05222efebb8d9a146040e8ba882ef053
/src/com/theironyard/charlotte/User.java
c85b18decf6797efd2a74d873e0ed2051878db1a
[]
no_license
KeithAgarcia/streams-assignment
dbe4bd9b0d4c84923fd1047ef3e9dd544accc1db
feddcc299fefbb686e96bd739e6206b6cb2d7e17
refs/heads/master
2021-01-21T21:38:14.596825
2017-05-25T01:52:32
2017-05-25T01:52:32
92,322,576
0
0
null
2017-05-24T18:12:19
2017-05-24T18:12:19
null
UTF-8
Java
false
false
1,653
java
package com.theironyard.charlotte; import com.github.javafaker.Faker; public class User { private String name; private String streetAddress; private String city; private String state; private String phoneNumber; private int age; // overriding default constructor // making it so nobody can create a user // object using the "new" keyword private User() { } /** * Creates a user based off fakes data. * @return new random user object */ public static User createUser() { Faker f = new Faker(); User u = new User(); u.name = f.name().fullName(); u.streetAddress = f.address().streetAddress(); u.city = f.address().city(); u.state = f.address().state(); u.phoneNumber = f.phoneNumber().phoneNumber(); u.age = (int)(Math.random() * 100); return u; } public String getName() { return name; } public String getStreetAddress() { return streetAddress; } public String getCity() { return city; } public String getState() { return state; } public String getPhoneNumber() { return phoneNumber; } public int getAge() { return age; } @Override public String toString() { return "User{" + "name='" + name + '\'' + ", streetAddress='" + streetAddress + '\'' + ", city='" + city + '\'' + ", state='" + state + '\'' + ", phoneNumber='" + phoneNumber + '\'' + ", age=" + age + '}'; } }
[ "raynjamin@gmail.com" ]
raynjamin@gmail.com
5cef0417161222677a1f695d967e23e05da74551
4431f513b154a36bf54632b2ae570d7671d60a45
/hystrixDemo/microservice-consumer-purchase-feign-with-hystrix/src/main/java/com/itmuch/cloud/feign/UserFeignClient.java
5188a735201f949c04d7e0f04100eeefdb02f299
[ "Apache-2.0" ]
permissive
technologyexplore/Hystrix-demo
1685e39bb8ba664c42ef92aba84694ecea9adf1b
8d1989cdb6deb2310e7f0dc63214eaa8b4309ba2
refs/heads/master
2022-04-20T07:11:08.857035
2020-04-20T05:50:54
2020-04-20T05:51:17
257,166,885
0
0
null
null
null
null
UTF-8
Java
false
false
633
java
package com.itmuch.cloud.feign; import org.springframework.cloud.netflix.feign.FeignClient; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import com.itmuch.cloud.entity.User; import org.springframework.web.bind.annotation.RestController; @FeignClient(name = "microservice-provider-user", fallback = HystrixClientFallback.class) public interface UserFeignClient { @RequestMapping(value = "/findById/{id}", method = RequestMethod.GET) public User findById(@PathVariable("id") Long id); }
[ "zhangchuan@shein.com" ]
zhangchuan@shein.com
1b354eb1866ada524f635a685cb2c8160a8a2ee7
640074c586c43577250372801f6716ec4e989feb
/src/test/java/cn/gz/rd/datacollection/controller/JkwwDelDataTest.java
eabf55876fd2e660f7f1a4f6dabde611863962a5
[]
no_license
Cocapan/datacollection
ec2cbac34ad48cba371d26f4453bdaa5fef93fba
5af0fe182d42a6c7aa6b2a9c9c56c5303c3908ca
refs/heads/master
2020-04-12T14:11:08.059219
2018-12-20T07:52:38
2018-12-20T07:52:38
162,545,053
0
0
null
null
null
null
UTF-8
Java
false
false
1,673
java
package cn.gz.rd.datacollection.controller; import cn.gz.rd.datacollection.DataCenterApplicationTests; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.JdbcTemplate; public class JkwwDelDataTest extends DataCenterApplicationTests { @Autowired private JdbcTemplate jdbcTemplate; /** * 删除某一季度下的所有业务数据(教科文卫相关的) */ @Test public void testDelAllBoData() { String statPeriod = "'2018Q2'"; jdbcTemplate.execute("DELETE FROM `jkwww_gyxghlafdjbqkmcb` WHERE tjzq = " + statPeriod); jdbcTemplate.execute("DELETE FROM `jkwww_gzscgjxxqqdjlsylwtgztzylb` WHERE tjzq = " + statPeriod); jdbcTemplate.execute("DELETE FROM `jkwww_jjlsylwtjdb` WHERE tjzq = " + statPeriod); jdbcTemplate.execute("DELETE FROM `jkwww_jzqptssjsyjlsylwttz` WHERE tjzq = " + statPeriod); jdbcTemplate.execute("DELETE FROM `jkwww_msjcssbjghjqssfazdssqkb` WHERE tjzq = " + statPeriod); jdbcTemplate.execute("DELETE FROM `jkwww_sjcj_ztztxxb` WHERE sjtjzq = " + statPeriod); jdbcTemplate.execute("DELETE FROM `jkwww_sswsqsbjshmsjcssjhzxqk` WHERE tjzq = " + statPeriod); jdbcTemplate.execute("DELETE FROM `jkwww_sswsqsbjshmsjcssjsxmjdzb` WHERE tjzq = " + statPeriod); jdbcTemplate.execute("DELETE FROM `jkwww_sswsqsbjshmsjcssjsxmjdzb_hzb` WHERE tjzq = " + statPeriod); jdbcTemplate.execute("DELETE FROM `jkwww_sswsqsbjshmsjcssndjhb` WHERE tjzq = " + statPeriod); jdbcTemplate.execute("DELETE FROM `jkwww_xyjybxtjjlsylwtxfwtyljgylb` WHERE tjzq = " + statPeriod); } }
[ "panxuan092@163.com" ]
panxuan092@163.com
33e033590cb5ce142bcc79373deb14a45b4f94bb
ed3431b1d0aa74de390c8ea7a806776400379b4f
/src/application/Main.java
978946c7dd694acb9bc3c16819e55624347b1e6a
[ "MIT" ]
permissive
KentErlend/3DProject
8b20613a0b37ea05034c44321878e011b77ac3b6
8f58ad57abf3a7d9072c8f79a82ce59fd9a1f425
refs/heads/master
2020-03-21T23:30:19.438409
2018-06-29T21:01:12
2018-06-29T21:34:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,327
java
package application; import java.util.List; import javafx.animation.AnimationTimer; import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.canvas.Canvas; import javafx.scene.image.PixelWriter; import javafx.scene.input.MouseEvent; import javafx.scene.input.ScrollEvent; import javafx.scene.layout.Pane; import javafx.scene.paint.Color; import javafx.stage.Stage; import model.Camera; import model.Mesh; import model.font.CustomFont; public class Main extends Application { private Stage stage; private Scene scene; private Pane root; private Canvas canvas; private Camera camera; private Mesh meshBox; private Mesh meshStar; private AnimationTimer at; private double hFov; private double distance; private double previousX; /* * OffsetX and OffsetY are used together with demoText for defining * where the text shall start. */ private List<List<Double>> demoText; private int offsetX; private double offsetY[]; private double scanline; private PixelWriter px; public static void main(String[] args) { Application.launch(args); } @Override public void start(Stage ps) throws Exception { canvas = new Canvas(800, 600); root = new Pane(canvas); scene = new Scene(root); scene.setFill(Color.color(0.03, 0.06, 0.09, 1)); ps.setScene(scene); ps.show(); stage = ps; px = canvas.getGraphicsContext2D().getPixelWriter(); initializeListeners(); startAnimation(); } private void initializeListeners() { scene.widthProperty() .addListener((obsv, oldv, newv) -> { canvas.setWidth (newv.doubleValue()); camera.update(); updateSinusTable(); }); scene.heightProperty().addListener((obsv, oldv, newv) -> { canvas.setHeight(newv.doubleValue()); camera.update(); updateSinusTable(); }); scene.setOnScroll((ScrollEvent se) -> { if(se.getDeltaY() < 0 ) { if(distance > 0) distance -= 10; } else { if(distance < 1000) distance += 10; } camera.setHorizontalFov(hFov, distance); stage.setTitle("View cone: " + hFov + " / distance: " + distance); }); scene.setOnMousePressed((MouseEvent me) -> { previousX = me.getX(); }); scene.setOnMouseDragged((MouseEvent me) -> { if((me.getX() - previousX) < 0) { if(hFov < 180) hFov += 1; } else { if(hFov > 0) hFov -= 1; } camera.setHorizontalFov(hFov, distance); previousX = me.getX(); stage.setTitle("View cone: " + hFov + " / distance: " + distance); }); } private double s = 0; private byte t = 0; private void startAnimation() { demoText = CustomFont.getInstance().setText("Welcome to my spinning fantasy world"); updateSinusTable(); meshBox = model.Meshes.meshBox2(); meshStar = model.Meshes.meshStar(); distance = 350; hFov = 100; stage.setTitle("View cone: " + hFov + " / distance: " + distance); camera = new Camera(canvas); camera.addMesh(meshBox); camera.addMesh(meshStar); camera.setHorizontalFov(hFov, distance); camera.render(); at = new AnimationTimer() { @Override public void handle(long now) { meshBox.rotateXaxis(Math.sin(s/200)); meshBox.rotateYaxis(0.002); meshBox.rotateZaxis(0.004); meshStar.rotateYaxis(-0.001); camera.render(); drawText(); if(t == 0) s += 0.01; else s -= 0.01; if(s > (Math.PI)) t = 1; if(s < (-Math.PI)) t = 0; offsetX-= 3; if(offsetX < -demoText.get(0).size()) offsetX = (int) canvas.getWidth(); } }; at.start(); } private void drawText() { double opacity; for(int x = 0; x < demoText.get(0).size(); x++) { if((offsetX + x) < canvas.getWidth() && (offsetX + x) > 0) { for(int y = 0; y < demoText.size(); y++) { opacity = demoText.get(y).get(x); if(opacity != 0) px.setColor(offsetX + x, (int)(scanline + y + offsetY[offsetX + x]), Color.color(1, 1, 1, opacity)); } } } } public void updateSinusTable() { double alpha = 0; scanline = canvas.getHeight() - (64+80); offsetY = new double[(int)canvas.getWidth()]; for(int i=0;i<offsetY.length;i++) { offsetY[i] = 32 * Math.sin(alpha); alpha += ((4 * Math.PI) / canvas.getWidth()); } } }
[ "s300358@stud.hioa.no" ]
s300358@stud.hioa.no
ecf6e40c2ae2368e2c0a53c82efac0c797e249df
a9f05bfec6a5fbd9eec705d8580f6c2e5729520b
/solrup-persistence/core/src/test/java/com/solrup/persistence/store/TestJacksonStore.java
ac7823786fdfabfccd6c1108618551667a71846a
[]
no_license
srinivas230/solrup-project
43ba92da9f1f2f797b11c5f2f21bc33cd997f8b5
1039755f195ed778ac48916d6b788938b04e5157
refs/heads/master
2020-07-25T01:02:17.450154
2019-04-27T12:41:46
2019-04-27T12:41:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,004
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.solrup.persistence.store; import static org.apache.gora.examples.WebPageDataCreator.URLS; import static org.apache.gora.examples.WebPageDataCreator.URL_INDEXES; import static org.apache.gora.examples.WebPageDataCreator.createWebPageData; import java.io.IOException; import org.apache.gora.avro.store.AvroStore.CodecType; import org.apache.gora.examples.generated.Employee; import org.apache.gora.examples.generated.WebPage; import org.apache.gora.query.Query; import org.apache.gora.query.Result; import org.apache.gora.store.DataStore; import org.apache.gora.store.DataStoreFactory; import org.apache.gora.store.DataStoreTestUtil; import org.apache.gora.util.GoraException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; import org.junit.After; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.assertEquals; /** * Test case for {@link AvroStore}. */ public class TestJacksonStore { public static final String EMPLOYEE_OUTPUT = System.getProperty("test.build.data") + "/testavrostore/employee.data"; public static final String WEBPAGE_OUTPUT = System.getProperty("test.build.data") + "/testavrostore/webpage.data"; protected JacksonStore<String,Employee> employeeStore; protected JacksonStore<String,WebPage> webPageStore; protected Configuration conf = new Configuration(); @Before public void setUp() throws Exception { employeeStore = createEmployeeDataStore(); employeeStore.initialize(String.class, Employee.class, DataStoreFactory.createProps()); employeeStore.setOutputPath(EMPLOYEE_OUTPUT); employeeStore.setInputPath(EMPLOYEE_OUTPUT); webPageStore = new JacksonStore<>(); webPageStore.initialize(String.class, WebPage.class, DataStoreFactory.createProps()); webPageStore.setOutputPath(WEBPAGE_OUTPUT); webPageStore.setInputPath(WEBPAGE_OUTPUT); } @SuppressWarnings("unchecked") protected JacksonStore<String, Employee> createEmployeeDataStore() throws GoraException { return DataStoreFactory.getDataStore( JacksonStore.class, String.class, Employee.class, conf); } protected JacksonStore<String, WebPage> createWebPageDataStore() { return new JacksonStore<>(); } @After public void tearDown() throws Exception { deletePath(employeeStore.getOutputPath()); deletePath(webPageStore.getOutputPath()); employeeStore.close(); webPageStore.close(); } private void deletePath(String output) throws IOException { if(output != null) { Path path = new Path(output); path.getFileSystem(conf).delete(path, true); } } @Test public void testNewInstance() throws Exception { DataStoreTestUtil.testNewPersistent(employeeStore); } @Test public void testCreateSchema() throws Exception { DataStoreTestUtil.testCreateEmployeeSchema(employeeStore); } @Test public void testAutoCreateSchema() throws Exception { DataStoreTestUtil.testAutoCreateSchema(employeeStore); } @Test public void testPut() throws Exception { DataStoreTestUtil.testPutEmployee(employeeStore); } @Test public void testQuery() throws Exception { createWebPageData(webPageStore); webPageStore.close(); webPageStore.setInputPath(webPageStore.getOutputPath()); testQueryWebPages(webPageStore); } @Test public void testQueryBinaryEncoder() throws Exception { webPageStore.setCodecType(CodecType.BINARY); webPageStore.setInputPath(webPageStore.getOutputPath()); createWebPageData(webPageStore); webPageStore.close(); testQueryWebPages(webPageStore); } //AvroStore should be closed so that Hadoop file is completely flushed, //so below test is copied and modified to close the store after pushing data public static void testQueryWebPages(DataStore<String, WebPage> store) throws Exception { Query<String, WebPage> query = store.newQuery(); Result<String, WebPage> result = query.execute(); int i=0; while(result.next()) { WebPage page = result.get(); DataStoreTestUtil.assertWebPage(page, URL_INDEXES.get(page.getUrl().toString())); i++; } assertEquals(i, URLS.length); } }
[ "bill.tsay@solrup.com" ]
bill.tsay@solrup.com
39da9600fea6df5588238b4d078cf238a8f8e823
ecf0bcd783583b4331cee0861691576f47be9bdf
/app/src/main/java/com/zhangxin/study/utils/SharedPreferencesUtil.java
85ac656866c081619d208c1861caec59db4e19ee
[ "Apache-2.0" ]
permissive
huoqiling/ShopCarStudy
2fa4868e1e7631bd926352ef9206d715235b4e0a
45c6ed9f77659307780f1997b4a59b04bff4ecb1
refs/heads/master
2021-07-03T17:40:07.757480
2020-09-08T02:29:19
2020-09-08T02:29:19
158,659,011
0
0
null
null
null
null
UTF-8
Java
false
false
4,893
java
package com.zhangxin.study.utils; import android.content.Context; import android.content.SharedPreferences; import com.zhangxin.study.MyApplication; import java.lang.reflect.Method; import java.util.Map; /** * @date 2019/6/27 @author zhangxin @desc * **/ public class SharedPreferencesUtil { /** * 保存在手机里面的文件名 */ public static final String FILE_NAME = "share_data"; /** * 保存数据的方法,我们需要拿到保存数据的具体类型,然后根据类型调用不同的保存方法 * * @param key * @param object */ public static void put(String key, Object object) { SharedPreferences sp = MyApplication.getInstance().getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE); SharedPreferences.Editor editor = sp.edit(); if (object instanceof String) { editor.putString(key, (String) object); } else if (object instanceof Integer) { editor.putInt(key, (Integer) object); } else if (object instanceof Boolean) { editor.putBoolean(key, (Boolean) object); } else if (object instanceof Float) { editor.putFloat(key, (Float) object); } else if (object instanceof Long) { editor.putLong(key, (Long) object); } else { editor.putString(key, object.toString()); } SharedPreferencesCompat.apply(editor); } /** * 得到保存数据的方法,我们根据默认值得到保存的数据的具体类型,然后调用相对于的方法获取值 * * @param key * @param defaultObject * @return */ public static Object get(String key, Object defaultObject) { SharedPreferences sp = MyApplication.getInstance().getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE); if (defaultObject instanceof String) { return sp.getString(key, (String) defaultObject); } else if (defaultObject instanceof Integer) { return sp.getInt(key, (Integer) defaultObject); } else if (defaultObject instanceof Boolean) { return sp.getBoolean(key, (Boolean) defaultObject); } else if (defaultObject instanceof Float) { return sp.getFloat(key, (Float) defaultObject); } else if (defaultObject instanceof Long) { return sp.getLong(key, (Long) defaultObject); } return null; } /** * 移除某个key值已经对应的值 * * @param key */ public static void remove(String key) { SharedPreferences sp = MyApplication.getInstance().getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE); SharedPreferences.Editor editor = sp.edit(); editor.remove(key); SharedPreferencesCompat.apply(editor); } /** * 清除所有数据 * */ public static void clear() { SharedPreferences sp = MyApplication.getInstance().getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE); SharedPreferences.Editor editor = sp.edit(); editor.clear(); SharedPreferencesCompat.apply(editor); } /** * 查询某个key是否已经存在 * * @param key * @return */ public static boolean contains(String key) { SharedPreferences sp = MyApplication.getInstance().getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE); return sp.contains(key); } /** * 返回所有的键值对 * * @return */ public static Map<String, ?> getAll() { SharedPreferences sp = MyApplication.getInstance().getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE); return sp.getAll(); } /** * 创建一个解决SharedPreferencesCompat.apply方法的一个兼容类 * * @author zhy */ private static class SharedPreferencesCompat { private static final Method sApplyMethod = findApplyMethod(); /** * 反射查找apply的方法 * * @return */ @SuppressWarnings({"unchecked", "rawtypes"}) private static Method findApplyMethod() { try { Class clz = SharedPreferences.Editor.class; return clz.getMethod("apply"); } catch (Exception e) { e.printStackTrace(); } return null; } /** * 如果找到则使用apply执行,否则使用commit * * @param editor */ public static void apply(SharedPreferences.Editor editor) { try { if (sApplyMethod != null) { sApplyMethod.invoke(editor); return; } } catch (Exception e) { e.printStackTrace(); } editor.commit(); } } }
[ "zhangxin@123" ]
zhangxin@123
c60262c473cd177dde1bd7362397cfbfdd3589fc
4d6553cae3c28f2af5e6e67baa5a7288ff240f3d
/src/main/java/dixie/util/ValidateUtil.java
5814929e1bd1cc11e09e206a4a77a0d195f56c6c
[]
no_license
jmferland/dixie
cd38180b9a560192605041fa7e1adca3cd5276f8
b10e39e9ae83e514fd2422dea37efdd8ea53efdc
refs/heads/master
2021-03-12T21:58:55.410397
2012-10-22T01:59:34
2012-10-22T01:59:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,719
java
package dixie.util; import java.util.regex.Pattern; import net.sourceforge.stripes.validation.ScopedLocalizableError; import net.sourceforge.stripes.validation.ValidationErrors; /** * * @author jferland */ public class ValidateUtil { /** * If the given {@code value} contains any of the {@code illegalChars} * given, an error is added to the {@code ValidationErrors} given. * * @param errors * @param field * @param value * @param illegalChars */ public static void checkChars(ValidationErrors errors, String field, String value, CharSequence illegalChars) { if (value != null && illegalChars != null && illegalChars.length() > 0 && value.contains(illegalChars)) { StringBuffer tmp = new StringBuffer(); for (int i = 0; i < illegalChars.length(); i++) { tmp.append(illegalChars.charAt(i)); tmp.append(" "); } tmp.deleteCharAt(tmp.length()); errors.add(field, new ScopedLocalizableError("validation", "illegalCharacters", tmp)); } } /** * If the given {@code value} does not match the given {@code pattern} then * a an error is added to the {@code ValidationErrors} given. Note that if * the {@code value} or {@code pattern} are {@code null} then they do not * match and an error will be added. * * @param errors * @param field * @param value * @param pattern * @param patternDescription */ public static void matchPattern(ValidationErrors errors, String field, String value, Pattern pattern, String patternDescription) { boolean matched = value != null && pattern.matcher(value).matches(); if (!matched) { errors.add(field, new ScopedLocalizableError("validation", "patternNotMatched", patternDescription)); } } }
[ "jferland@ualberta.ca" ]
jferland@ualberta.ca
f71de2cc0df0dbeedb0fc893fd0332e49e0f693a
a744882fb7cf18944bd6719408e5a9f2f0d6c0dd
/sourcecode8/src/java/lang/management/MemoryManagerMXBean.java
c01b6d02b07b42e9281159fabafa432c76b4b55a
[ "Apache-2.0" ]
permissive
hanekawasann/learn
a39b8d17fd50fa8438baaa5b41fdbe8bd299ab33
eef678f1b8e14b7aab966e79a8b5a777cfc7ab14
refs/heads/master
2022-09-13T02:18:07.127489
2020-04-26T07:58:35
2020-04-26T07:58:35
176,686,231
0
0
Apache-2.0
2022-09-01T23:21:38
2019-03-20T08:16:05
Java
UTF-8
Java
false
false
3,281
java
/* * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package java.lang.management; /** * The management interface for a memory manager. * A memory manager manages one or more memory pools of the * Java virtual machine. * * <p> A Java virtual machine has one or more memory managers. * An instance implementing this interface is * an <a href="ManagementFactory.html#MXBean">MXBean</a> * that can be obtained by calling * the {@link ManagementFactory#getMemoryManagerMXBeans} method or * from the {@link ManagementFactory#getPlatformMBeanServer * platform <tt>MBeanServer</tt>} method. * * <p>The <tt>ObjectName</tt> for uniquely identifying the MXBean for * a memory manager within an MBeanServer is: * <blockquote> * {@link ManagementFactory#MEMORY_MANAGER_MXBEAN_DOMAIN_TYPE * <tt>java.lang:type=MemoryManager</tt>}<tt>,name=</tt><i>manager's name</i> * </blockquote> * <p> * It can be obtained by calling the * {@link PlatformManagedObject#getObjectName} method. * * @author Mandy Chung * @see ManagementFactory#getPlatformMXBeans(Class) * @see MemoryMXBean * @see <a href="../../../javax/management/package-summary.html"> * JMX Specification.</a> * @see <a href="package-summary.html#examples"> * Ways to Access MXBeans</a> * @since 1.5 */ public interface MemoryManagerMXBean extends PlatformManagedObject { /** * Returns the name representing this memory manager. * * @return the name of this memory manager. */ String getName(); /** * Tests if this memory manager is valid in the Java virtual * machine. A memory manager becomes invalid once the Java virtual * machine removes it from the memory system. * * @return <tt>true</tt> if the memory manager is valid in the * Java virtual machine; * <tt>false</tt> otherwise. */ boolean isValid(); /** * Returns the name of memory pools that this memory manager manages. * * @return an array of <tt>String</tt> objects, each is * the name of a memory pool that this memory manager manages. */ String[] getMemoryPoolNames(); }
[ "763803382@qq.com" ]
763803382@qq.com
7e17339d19cf2c11f8032caec109dbdbb974ddbb
37515a0a63e3e6e62ba5104567201d2f14360f13
/edu.fudan.langlab.edl.domain/src/main/java/edu/fudan/langlab/domain/organization/RoleManager.java
d08300d809f816238865548c3befb8ccdbf0ffa0
[]
no_license
rockguo2015/newmed
9d95e161ba7cb9c59b24c4fb0bec2eb328214831
b4818912e5bbc6e0147d47e8ba475c0ac5c80c2e
refs/heads/master
2021-01-10T05:16:25.491087
2015-05-29T10:03:23
2015-05-29T10:03:23
36,384,873
0
0
null
null
null
null
UTF-8
Java
false
false
198
java
package edu.fudan.langlab.domain.organization; import java.util.Collection; import edu.fudan.langlab.domain.security.AppRole; public interface RoleManager { Collection<AppRole> getAllRoles(); }
[ "rock.guo@me.com" ]
rock.guo@me.com
d432bcd036cdc7b45f2483d85dc1b612a624898f
d73d945ed709876cf2aca87ed3a120cd589084e9
/app/src/main/java/com/qq986945193/androidbaseproject/utils/ToastUtils.java
4cf080e3a77aa8650fc65e9d0c5815ba0dbbb62e
[]
no_license
yesEric/AndroidBaseProject
08b81160ab17476442450fe120eb1ff3a06bcfa3
425c82337bf8ed4846817fdf37ea06a0937ed563
refs/heads/master
2021-04-06T08:17:18.808013
2017-01-17T02:14:47
2017-01-17T02:14:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,535
java
package com.qq986945193.androidbaseproject.utils; import android.content.Context; import android.view.Gravity; import android.widget.Toast; /** * @author :程序员小冰 * @新浪微博 :http://weibo.com/mcxiaobing * @CSDN博客: http://blog.csdn.net/qq_21376985 * @交流Qq :986945193 * @GitHub: https://github.com/QQ986945193 */ /** * 弹出Toast 封装类 */ public class ToastUtils { private ToastUtils() { /* cannot be instantiated */ throw new UnsupportedOperationException("cannot be instantiated"); } public static boolean isShow = true; /** * 短时间显示Toast */ public static void showShort(Context context, CharSequence message) { if (isShow) Toast.makeText(context, message, Toast.LENGTH_SHORT).show(); } /** * 短时间显示Toast 这里message 代表的是的CharSequence路径 */ public static void showShort(Context context, int message) { if (isShow) Toast.makeText(context, message, Toast.LENGTH_SHORT).show(); } /** * 长时间显示Toast */ public static void showLong(Context context, CharSequence message) { if (isShow) Toast.makeText(context, message, Toast.LENGTH_LONG).show(); } /** * 长时间显示Toast 这里message 代表的是的CharSequence路径 */ public static void showLong(Context context, int message) { if (isShow) Toast.makeText(context, message, Toast.LENGTH_LONG).show(); } /** * 自定义显示Toast时间 */ public static void show(Context context, CharSequence message, int duration) { if (isShow) Toast.makeText(context, message, duration).show(); } /** * 自定义显示Toast时间 这里message 代表的是的CharSequence路径 */ public static void show(Context context, int message, int duration) { if (isShow) Toast.makeText(context, message, duration).show(); } /** * Toast中间显示 **/ public static void middleShow(Context content, String message) { Toast toast = Toast.makeText(content, message, Toast.LENGTH_SHORT); toast.setGravity(Gravity.CENTER, 0, 0); /* LinearLayout toastView = (LinearLayout) toast.getView(); ImageView imageCodeProject = new ImageView(getApplicationContext()); imageCodeProject.setImageResource(R.drawable.icon); toastView.addView(imageCodeProject, 0);*/ toast.show(); } }
[ "986945193@qq.com" ]
986945193@qq.com
02fe954ea1007b37f4fcaa04ddd9e461fb191ca0
09695958fbe781e798c0bbad19e56f4bf1e71e1e
/src/IntersectingNodeFinder.java
00e9b08bed60b67b2a343d12721ef3633a6e19ba
[]
no_license
jggruber247/DailyCodingChallenge
b5e23de495a3dcfa5988de4a6e13fc75ef7faf25
31da41932a4dc8f5da2dc60375e9c8a3f7a83655
refs/heads/master
2020-06-23T16:08:24.407476
2019-10-03T18:23:45
2019-10-03T18:23:45
198,673,808
1
0
null
null
null
null
UTF-8
Java
false
false
653
java
/* --------------------------------------------------------- * James Garrett Gruber * Daily Coding Challenge * August 16, 2019 * * PROBLEM: * Given two singly linked lists that intersect at some point, * find the intersecting node. The lists are non-cyclical. * For example, given A = 3 -> 7 -> 8 -> 10 and B = 99 -> 1 -> 8 -> 10, * return the node with value 8. In this example, assume nodes with * the same value are the exact same node objects. * --------------------------------------------------------- */ public class IntersectingNodeFinder { public static void main(String[] args) { // TODO Auto-generated method stub } }
[ "jggruber247@gmail.com" ]
jggruber247@gmail.com
c28ec993ddedb8cb8c5627d482c55b5a82002028
04c1d2fa89e15b018a8b09cffb545aaa825a7876
/app/src/main/java/eu/atos/atosreader/mlkit/VisionProcessorBase.java
4be23287d8949af5ea82ae812d3e8974435fe581
[ "Apache-2.0" ]
permissive
aolmez/eMRTD-reader
b16658e503b729cc5b141ac1c9a2c3c3354b3e32
472a4b6b477ea90be5e49a056a6e4850f9a8b4a0
refs/heads/main
2023-06-29T21:23:23.954054
2021-07-02T11:22:15
2021-07-02T11:22:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,284
java
// // Copyright (C) 2020 Atos Spain SA // // Copyright 2018 Google LLC // // 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 eu.atos.atosreader.mlkit; import android.graphics.Bitmap; import android.media.Image; import androidx.annotation.NonNull; import com.google.android.gms.tasks.OnFailureListener; import com.google.android.gms.tasks.OnSuccessListener; import com.google.android.gms.tasks.Task; import com.google.firebase.ml.vision.common.FirebaseVisionImage; import com.google.firebase.ml.vision.common.FirebaseVisionImageMetadata; //import com.google.firebase.ml.vision.text.FirebaseVisionText; import org.jmrtd.lds.icao.MRZInfo; import java.nio.ByteBuffer; import java.util.concurrent.atomic.AtomicBoolean; import io.fotoapparat.preview.Frame; public abstract class VisionProcessorBase<T> implements VisionImageProcessor { // Whether we should ignore process(). This is usually caused by feeding input data faster than // the model can handle. private final AtomicBoolean shouldThrottle = new AtomicBoolean(false); public VisionProcessorBase() { } @Override public void process( ByteBuffer data, final FrameMetadata frameMetadata, OcrListener ocrListener) { if (shouldThrottle.get()) { return; } FirebaseVisionImageMetadata metadata = new FirebaseVisionImageMetadata.Builder() .setFormat(FirebaseVisionImageMetadata.IMAGE_FORMAT_NV21) .setWidth(frameMetadata.getWidth()) .setHeight(frameMetadata.getHeight()) .setRotation(frameMetadata.getRotation()) .build(); detectInVisionImage( FirebaseVisionImage.fromByteBuffer(data, metadata), frameMetadata, ocrListener); } // Bitmap version @Override public void process(Bitmap bitmap, OcrListener ocrListener) { if (shouldThrottle.get()) { return; } detectInVisionImage(FirebaseVisionImage.fromBitmap(bitmap), null, ocrListener); } /** * Detects feature from given media.Image * * @return created FirebaseVisionImage */ @Override public void process(Image image, int rotation, OcrListener ocrListener) { if (shouldThrottle.get()) { return; } // This is for overlay display's usage FrameMetadata frameMetadata = new FrameMetadata.Builder().setWidth(image.getWidth()).setHeight(image.getHeight ()).build(); FirebaseVisionImage fbVisionImage = FirebaseVisionImage.fromMediaImage(image, rotation); detectInVisionImage(fbVisionImage, frameMetadata, ocrListener); } @Override public void process(Frame frame, int rotation, OcrListener ocrListener) { if (shouldThrottle.get()) { return; } FrameMetadata frameMetadata = new FrameMetadata.Builder().setWidth(frame.getSize().width).setHeight(frame.getSize().height).setRotation(rotation).build(); FirebaseVisionImageMetadata metadata = new FirebaseVisionImageMetadata.Builder() .setFormat(FirebaseVisionImageMetadata.IMAGE_FORMAT_NV21) .setWidth(frameMetadata.getWidth()) .setHeight(frameMetadata.getHeight()) .setRotation(frameMetadata.getRotation()) //?? .build(); FirebaseVisionImage fbVisionImage = FirebaseVisionImage.fromByteArray( frame.getImage(),metadata); detectInVisionImage(fbVisionImage,frameMetadata,ocrListener); } private void detectInVisionImage( FirebaseVisionImage image, final FrameMetadata metadata, final OcrListener ocrListener) { final long start = System.currentTimeMillis(); detectInImage(image) .addOnSuccessListener( new OnSuccessListener<T>() { @Override public void onSuccess(T results) { shouldThrottle.set(false); long timeRequired = System.currentTimeMillis() - start; VisionProcessorBase.this.onSuccess(results, metadata, timeRequired, ocrListener); } }) .addOnFailureListener( new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { shouldThrottle.set(false); long timeRequired = System.currentTimeMillis() - start; VisionProcessorBase.this.onFailure(e, timeRequired, ocrListener); } }); // Begin throttling until this frame of input has been processed, either in onSuccess or // onFailure. shouldThrottle.set(true); } @Override public void stop() { } protected abstract Task<T> detectInImage(FirebaseVisionImage image); protected abstract void onSuccess( @NonNull T results, @NonNull FrameMetadata frameMetadata, long timeRequired, @NonNull OcrListener ocrListener); protected abstract void onFailure(@NonNull Exception e, long timeRequired, OcrListener ocrListener); public interface OcrListener{ void onMRZRead(MRZInfo mrzInfo, long timeRequired); void onMRZReadFailure(long timeRequired); void onFailure(Exception e, long timeRequired); } }
[ "raquel.cortes@atos.net" ]
raquel.cortes@atos.net
333d457cc330e6e1983de9f1b3e9a7a75a769abb
a3fe5376c36e8161e2b10c739e67f7d4f3c3f8c2
/src/stonevox/tools/ToolSelection.java
ffac56d175100afab512d10b856bf6a96ac73842
[]
no_license
chimeforest/stonevox3d
796cc2ed9d96a417ee0545d66104391ca0b0bc1d
c0e93856e786db96083ce2cbe7210c552e3adc06
refs/heads/master
2021-01-21T05:43:41.801029
2014-11-26T00:55:36
2014-11-26T00:55:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
985
java
package stonevox.tools; import stonevox.data.RayHitPoint; public class ToolSelection implements Tool { public boolean active; public boolean isActive() { return active; } public void init() { // TODO Auto-generated method stub } public void activate() { // TODO Auto-generated method stub } public void deactivate() { // TODO Auto-generated method stub } public boolean repeatTest(RayHitPoint hit) { // TODO Auto-generated method stub return false; } public void logic() { // TODO Auto-generated method stub } public void use(RayHitPoint hit) { // TODO Auto-generated method stub } public void undo() { // TODO Auto-generated method stub } public void redo() { // TODO Auto-generated method stub } public int hotKey() { // TODO Auto-generated method stub return 0; } public void render() { // TODO Auto-generated method stub } public void setState(int id) { // TODO Auto-generated method stub } }
[ "honestabelink@hotmail.com" ]
honestabelink@hotmail.com
fb0891b6958cafadde46bfff0b865e7e0d235182
9c3b24cd9bb4721146b70429253e32bed625cad1
/src/main/java/com/usit/util/EtcUtil.java
c955b536fe536f33b2d89b0d899ddc13e3edb369
[]
no_license
lsc15/usit_api
3f243cbe80802e8818ebe6a4e6c9e50b3042900d
f8025c0a28716146f75dcb5901e1b3e90117e30c
refs/heads/master
2020-03-19T23:48:31.149139
2019-11-07T06:58:35
2019-11-07T06:58:35
137,020,484
0
0
null
null
null
null
UTF-8
Java
false
false
4,153
java
package com.usit.util; import java.io.IOException; import java.security.SecureRandom; import java.util.ArrayList; import java.util.List; import java.util.Map; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; public class EtcUtil { /** * 특정숫자 집합에서 랜덤 숫자를 구하는 기능 시작숫자와 종료숫자 사이에서 구한 랜덤 숫자를 반환. * @param startNum * @param endNum * @return */ public int getRandomNum(int startNum, int endNum) { int randomNum = 0; try { // 랜덤 객체 생성 SecureRandom rnd = new SecureRandom(); do { // 종료숫자내에서 랜덤 숫자를 발생시킨다. randomNum = rnd.nextInt(endNum + 1); } while (randomNum < startNum); // 랜덤 숫자가 시작숫자보다 작을경우 다시 랜덤숫자를 // 발생시킨다. } catch (Exception e) { // e.printStackTrace(); throw new RuntimeException(e); // 2011.10.10 보안점검 후속조치 } return randomNum; } /** * Map을 json으로 변환한다. * * @param map Map<String, Object>. * @return JSONObject. */ public JSONObject getJsonStringFromMap( Map<String, Object> map ) { JSONObject jsonObject = new JSONObject(); for( Map.Entry<String, Object> entry : map.entrySet() ) { String key = entry.getKey(); Object value = entry.getValue(); jsonObject.put(key, value); } return jsonObject; } /** * List<Map>을 jsonArray로 변환한다. * * @param list List<Map<String, Object>>. * @return JSONArray. */ public JSONArray getJsonArrayFromList( List<Map<String, Object>> list ) { JSONArray jsonArray = new JSONArray(); for( Map<String, Object> map : list ) { jsonArray.add( getJsonStringFromMap( map ) ); } return jsonArray; } /** * List<Map>을 jsonString으로 변환한다. * * @param list List<Map<String, Object>>. * @return String. */ public String getJsonStringFromList( List<Map<String, Object>> list ) { JSONArray jsonArray = getJsonArrayFromList( list ); return jsonArray.toJSONString(); } /** * JsonObject를 Map<String, String>으로 변환한다. * * @param jsonObj JSONObject. * @return Map<String, Object>. */ @SuppressWarnings("unchecked") public Map<String, String> getMapFromJsonObject( JSONObject jsonObj ) { Map<String, String> map = null; try { map = new ObjectMapper().readValue(jsonObj.toJSONString(), Map.class) ; } catch (JsonParseException e) { e.printStackTrace(); } catch (JsonMappingException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return map; } /** * JsonArray를 List<Map<String, String>>으로 변환한다. * * @param jsonArray JSONArray. * @return List<Map<String, Object>>. */ public List<Map<String, String>> getListMapFromJsonArray( JSONArray jsonArray ) { List<Map<String, String>> list = new ArrayList<Map<String, String>>(); if( jsonArray != null ) { int jsonSize = jsonArray.size(); for( int i = 0; i < jsonSize; i++ ) { Map<String, String> map = getMapFromJsonObject( ( JSONObject ) jsonArray.get(i) ); list.add( map ); } } return list; } }
[ "lastsword15@gamil.com" ]
lastsword15@gamil.com
f86fca72907679134cda9b60d57ff71a7fa61827
071a9fa7cfee0d1bf784f6591cd8d07c6b2a2495
/corpus/class/log4j/265.java
7e5d3caa11e4351716c2a7b55f12f007f82b01c1
[ "MIT" ]
permissive
masud-technope/ACER-Replication-Package-ASE2017
41a7603117f01382e7e16f2f6ae899e6ff3ad6bb
cb7318a729eb1403004d451a164c851af2d81f7a
refs/heads/master
2021-06-21T02:19:43.602864
2021-02-13T20:44:09
2021-02-13T20:44:09
187,748,164
0
0
null
null
null
null
UTF-8
Java
false
false
4,068
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 org.apache.log4j; import org.apache.log4j.spi.ErrorHandler; import org.apache.log4j.spi.LoggingEvent; import java.util.Vector; /** * Utility class used in testing to capture errors dispatched * by appenders. * * @author Curt Arnold */ public final class VectorErrorHandler implements ErrorHandler { /** * Logger. */ private Logger logger; /** * Appender. */ private Appender appender; /** * Backup appender. */ private Appender backupAppender; /** * Array of processed errors. */ private final Vector errors = new Vector(); /** * Default constructor. */ public VectorErrorHandler() { } /** * {@inheritDoc} */ public void setLogger(final Logger logger) { this.logger = logger; } /** * Gets last logger specified by setLogger. * @return logger. */ public Logger getLogger() { return logger; } /** * {@inheritDoc} */ public void activateOptions() { } /** * {@inheritDoc} */ public void error(final String message, final Exception e, final int errorCode) { error(message, e, errorCode, null); } /** * {@inheritDoc} */ public void error(final String message) { error(message, null, -1, null); } /** * {@inheritDoc} */ public void error(final String message, final Exception e, final int errorCode, final LoggingEvent event) { errors.addElement(new Object[] { message, e, new Integer(errorCode), event }); } /** * Gets message from specified error. * * @param index index. * @return message, may be null. */ public String getMessage(final int index) { return (String) ((Object[]) errors.elementAt(index))[0]; } /** * Gets exception from specified error. * * @param index index. * @return exception. */ public Exception getException(final int index) { return (Exception) ((Object[]) errors.elementAt(index))[1]; } /** * Gets error code from specified error. * * @param index index. * @return error code, -1 if not specified. */ public int getErrorCode(final int index) { return ((Integer) ((Object[]) errors.elementAt(index))[2]).intValue(); } /** * Gets logging event from specified error. * * @param index index. * @return exception. */ public LoggingEvent getEvent(final int index) { return (LoggingEvent) ((Object[]) errors.elementAt(index))[3]; } /** * Gets number of errors captured. * @return number of errors captured. */ public int size() { return errors.size(); } /** * {@inheritDoc} */ public void setAppender(final Appender appender) { this.appender = appender; } /** * Get appender. * @return appender, may be null. */ public Appender getAppender() { return appender; } /** * {@inheritDoc} */ public void setBackupAppender(final Appender appender) { this.backupAppender = appender; } /** * Get backup appender. * @return backup appender, may be null. */ public Appender getBackupAppender() { return backupAppender; } }
[ "masudcseku@gmail.com" ]
masudcseku@gmail.com
e12f455574e08ac4bb67c65b2ddc7ab1f3da6886
d7ba5448f16bf92df940b7ebfb54d873c0ed8f1f
/src/test/java/org/string_db/psicquic/index/RogidFieldApenderTest.java
3422c3e59fc8185bfff2566fc44f45278e0039de
[ "Apache-2.0", "BSD-2-Clause" ]
permissive
meringlab/stringdb-psicquic
0cca2e6a22248c793b5dcfc0ed84a38ede5b0475
d22f38496d11c9b097e73e1ae4f6de5d8457f649
refs/heads/master
2021-01-21T18:28:10.947262
2017-05-29T20:24:52
2017-05-29T20:24:52
19,694,172
1
0
null
null
null
null
UTF-8
Java
false
false
3,260
java
/* * Copyright 2014 University of Zürich, SIB, and others. * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.string_db.psicquic.index; import com.google.common.collect.ImmutableMap; import org.hupo.psi.calimocho.model.Row; import org.junit.Test; import uk.ac.ebi.intact.irefindex.seguid.RogidGenerator; import static org.junit.Assert.assertEquals; import static org.string_db.psicquic.index.RowBuilderTest.assertRowsEquals; /** * @author Milan Simonovic <milan.simonovic@imls.uzh.ch> */ public class RogidFieldApenderTest { final FieldBuilder rogidBuilder = new RogidFieldBuilder( 9606, ImmutableMap.of( 975673, "MGLTVSALFSRIFGKKQMRILMVGLDAAGKTTILYKLKLGEIVTTIPTIGFNVETVEYKN" + "ICFTVWDVGGQDKIRPLWRHYFQNTQGLIFVVDSNDRERVQESADELQKMLQEDELRDAV" + "LLVFANKQDMPNAMPVSELTDKLGLQHLRSRTWYVQATCATQGTGLYDGLDWLSHELSKR", 978054, "MTDGILGKAATMEIPIHGNGEARQLPEDDGLEQDLQQVMVSGPNLNETSIVSGGYGGSGD" + "GLIPTGSGRHPSHSTTPSGPGDEVARGIAGEKFDIVKKWGINTYKCTKQLLSERFGRGSR" + "TVDLELELQIELLRETKRKYESVLQLGRALTAHLYSLLQTQHALGDAFADLSQKSPELQE" + "EFGYNAETQKLLCKNGETLLGAVNFFVSSINTLVTKTMEDTLMTVKQYEAARLEYDAYRT" + "DLEELSLGPRDAGTRGRLESAQATFQAHRDKYEKLRGDVAIKLKFLEENKIKVMHKQLLL" + "FHNAVSAYFAGNQKQLEQTLQQFNIKLRPPGAEKPSWLEEQ" ) ); final Row expected = new RowBuilder() .withChecksumA("da8exbGR3MGxZ6CPZqLvqJbyUYI9606") .withChecksumB("q3QMUWlBIW82Szrv9jbMR6ikOZg9606") .build(); final RowBuilder recorder = new RowBuilder(); @Test public void both_columns() throws Exception { rogidBuilder.proteins(975673, 978054).addTo(recorder); assertRowsEquals(expected, recorder.build()); } @Test public void testRogid() throws Exception { RogidGenerator rogidGenerator = new RogidGenerator(); final String rogid = rogidGenerator.calculateRogid("MTDGILGKAATMEIPIHGNGEARQLPEDDGLEQDLQQVMVSGPNLNETSIVSGGYGGSGD" + "GLIPTGSGRHPSHSTTPSGPGDEVARGIAGEKFDIVKKWGINTYKCTKQLLSERFGRGSR" + "TVDLELELQIELLRETKRKYESVLQLGRALTAHLYSLLQTQHALGDAFADLSQKSPELQE" + "EFGYNAETQKLLCKNGETLLGAVNFFVSSINTLVTKTMEDTLMTVKQYEAARLEYDAYRT" + "DLEELSLGPRDAGTRGRLESAQATFQAHRDKYEKLRGDVAIKLKFLEENKIKVMHKQLLL" + "FHNAVSAYFAGNQKQLEQTLQQFNIKLRPPGAEKPSWLEEQ", "9606"); assertEquals("q3QMUWlBIW82Szrv9jbMR6ikOZg9606", rogid); } }
[ "mbsimonovic@gmail.com" ]
mbsimonovic@gmail.com
ec29cf160882cfee962ad94c606488c13e7e4c65
509316349964396d50e7c6d5f98417aaed29bfca
/spring-cloud-config-server/src/main/java/com/seavus/codetalks/springcloudconfigserver/SpringCloudConfigServerApplication.java
154bd7dca83170f9a7b95c9712d2020609f61b57
[]
no_license
drazen-nikolic/spring-cloud-example
e03e97f165ae43de9946b8fbf94bbb80ddbab5ae
dc2bb52f3a192429d4e83bb6837f10a34c584908
refs/heads/master
2020-03-16T22:37:16.105359
2018-05-11T15:11:29
2018-05-11T15:11:29
133,046,214
0
0
null
null
null
null
UTF-8
Java
false
false
457
java
package com.seavus.codetalks.springcloudconfigserver; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.config.server.EnableConfigServer; @EnableConfigServer @SpringBootApplication public class SpringCloudConfigServerApplication { public static void main(String[] args) { SpringApplication.run(SpringCloudConfigServerApplication.class, args); } }
[ "extncd@audatex.com" ]
extncd@audatex.com
de1ece111beba113e4074546bf8b3d41bdc35be8
19e89ed0e966d7f9e1cf93ff17a7622e205c82c2
/DesignPatternsJava/src/main/java/com/memento/Memento.java
f5ac849e1d6e3437fd79c8afc7440edc420d03c6
[]
no_license
sarkershantonu/blog-projects
511bd04c6c192994ef59edfcc3ae7d8a2a32c17e
16929bdf619d9a8ee7822081d474b97e09379436
refs/heads/master
2021-07-03T03:01:55.583879
2020-05-18T03:06:30
2020-05-18T03:06:30
55,711,975
1
0
null
2020-10-13T06:48:44
2016-04-07T16:53:52
Java
UTF-8
Java
false
false
286
java
package com.memento; public class Memento { private String state = "Not initiated"; public Memento(String aState){ state=aState; System.out.println("A memento is created"); } public String getState(){ System.out.println("State from Memento "+ state); return state; } }
[ "shantonu_oxford@yahoo.com" ]
shantonu_oxford@yahoo.com
4b834eb16202213dac6ca7019c5c84cfb4a1ce13
d7c5121237c705b5847e374974b39f47fae13e10
/airspan.netspan/src/main/java/Netspan/NBI_15_2/Backhaul/RelayProfileUpdateResponse.java
52518aecdd5fd3b44aa5693800f096ba59e3078e
[]
no_license
AirspanNetworks/SWITModules
8ae768e0b864fa57dcb17168d015f6585d4455aa
7089a4b6456621a3abd601cc4592d4b52a948b57
refs/heads/master
2022-11-24T11:20:29.041478
2020-08-09T07:20:03
2020-08-09T07:20:03
184,545,627
1
0
null
2022-11-16T12:35:12
2019-05-02T08:21:55
Java
UTF-8
Java
false
false
1,823
java
package Netspan.NBI_15_2.Backhaul; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for anonymous complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType&gt; * &lt;complexContent&gt; * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt; * &lt;sequence&gt; * &lt;element name="RelayProfileUpdateResult" type="{http://Airspan.Netspan.WebServices}ProfileResponse" minOccurs="0"/&gt; * &lt;/sequence&gt; * &lt;/restriction&gt; * &lt;/complexContent&gt; * &lt;/complexType&gt; * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "relayProfileUpdateResult" }) @XmlRootElement(name = "RelayProfileUpdateResponse") public class RelayProfileUpdateResponse { @XmlElement(name = "RelayProfileUpdateResult") protected ProfileResponse relayProfileUpdateResult; /** * Gets the value of the relayProfileUpdateResult property. * * @return * possible object is * {@link ProfileResponse } * */ public ProfileResponse getRelayProfileUpdateResult() { return relayProfileUpdateResult; } /** * Sets the value of the relayProfileUpdateResult property. * * @param value * allowed object is * {@link ProfileResponse } * */ public void setRelayProfileUpdateResult(ProfileResponse value) { this.relayProfileUpdateResult = value; } }
[ "dshalom@airspan.com" ]
dshalom@airspan.com
b9096f53fa282d032aa7cd4762d275bcb0f93687
2786b46a95e4666daad65749122fee84cc24116f
/src/main/java/com/fona/persistence/service/ILigneOperationService.java
aaa8e837664314a161d75aa93dfb181c5162d8c6
[]
no_license
samuel2/ets-fona
0407f51c552326fefc5e24d8044d22d01421e703
95f0e77f8220287b48f91cda68c861b47beeccde
refs/heads/master
2021-01-21T04:50:28.208558
2016-06-20T08:08:01
2016-06-20T08:08:01
54,561,737
0
0
null
null
null
null
UTF-8
Java
false
false
940
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.fona.persistence.service; import com.fona.persistence.IOperations; import com.fona.persistence.model.LigneOperation; import java.util.Date; import java.util.List; import org.springframework.data.domain.Page; /** * * @author Brice GUEMKAM <briceguemkam@gmail.com> */ public interface ILigneOperationService extends IOperations<LigneOperation> { public List<LigneOperation> filterByOperation(Long id); public Page<LigneOperation> findByFourniture(final long id, int page, int size); public Page<LigneOperation> findByFourniture(final long id, final String typeOperation, Date debut, Date fin, int page, int size); public Page<LigneOperation> findByFourniture(final long id, Date debut, Date fin, int page, int size); }
[ "smlfolong@gmail.com" ]
smlfolong@gmail.com
c818883f1ae294acfdb9f8f2747e6f1183572526
918636910b7ee4f3f172a399dedbf9ad2134044d
/src/main/java/gakugeiJob/db/bsbhv/BsEnterpriseFavoBhv.java
21fba6ea199d47b52d40c4d18d04cb4d9e083c50
[]
no_license
mytheta/gakugeiJob
b3233c06c697ff5f23d394ce29ec5a2b9cef3992
91decfde67861049095a980d9aa5902daf761aa5
refs/heads/master
2021-06-16T08:43:02.215560
2017-06-03T02:36:12
2017-06-03T02:36:12
null
0
0
null
null
null
null
UTF-8
Java
false
false
61,243
java
package gakugeiJob.db.bsbhv; import java.util.List; import org.seasar.dbflute.*; import org.seasar.dbflute.bhv.*; import org.seasar.dbflute.cbean.*; import org.seasar.dbflute.dbmeta.DBMeta; import org.seasar.dbflute.outsidesql.executor.*; import gakugeiJob.db.exbhv.*; import gakugeiJob.db.exentity.*; import gakugeiJob.db.bsentity.dbmeta.*; import gakugeiJob.db.cbean.*; /** * The behavior of enterprise_favo as TABLE. <br /> * <pre> * [primary key] * job_offer_id, student_id * * [column] * job_offer_id, student_id * * [sequence] * * * [identity] * * * [version-no] * * * [foreign table] * enterprise_offer, student * * [referrer table] * * * [foreign property] * enterpriseOffer, student * * [referrer property] * * </pre> * @author DBFlute(AutoGenerator) */ public abstract class BsEnterpriseFavoBhv extends AbstractBehaviorWritable { // =================================================================================== // Definition // ========== /*df:beginQueryPath*/ /*df:endQueryPath*/ // =================================================================================== // Table name // ========== /** @return The name on database of table. (NotNull) */ public String getTableDbName() { return "enterprise_favo"; } // =================================================================================== // DBMeta // ====== /** @return The instance of DBMeta. (NotNull) */ public DBMeta getDBMeta() { return EnterpriseFavoDbm.getInstance(); } /** @return The instance of DBMeta as my table type. (NotNull) */ public EnterpriseFavoDbm getMyDBMeta() { return EnterpriseFavoDbm.getInstance(); } // =================================================================================== // New Instance // ============ /** {@inheritDoc} */ public Entity newEntity() { return newMyEntity(); } /** {@inheritDoc} */ public ConditionBean newConditionBean() { return newMyConditionBean(); } /** @return The instance of new entity as my table type. (NotNull) */ public EnterpriseFavo newMyEntity() { return new EnterpriseFavo(); } /** @return The instance of new condition-bean as my table type. (NotNull) */ public EnterpriseFavoCB newMyConditionBean() { return new EnterpriseFavoCB(); } // =================================================================================== // Count Select // ============ /** * Select the count of uniquely-selected records by the condition-bean. {IgnorePagingCondition, IgnoreSpecifyColumn}<br /> * SpecifyColumn is ignored but you can use it only to remove text type column for union's distinct. * <pre> * EnterpriseFavoCB cb = new EnterpriseFavoCB(); * cb.query().setFoo...(value); * int count = enterpriseFavoBhv.<span style="color: #FD4747">selectCount</span>(cb); * </pre> * @param cb The condition-bean of EnterpriseFavo. (NotNull) * @return The selected count. */ public int selectCount(EnterpriseFavoCB cb) { return doSelectCountUniquely(cb); } protected int doSelectCountUniquely(EnterpriseFavoCB cb) { // called by selectCount(cb) assertCBStateValid(cb); return delegateSelectCountUniquely(cb); } protected int doSelectCountPlainly(EnterpriseFavoCB cb) { // called by selectPage(cb) assertCBStateValid(cb); return delegateSelectCountPlainly(cb); } @Override protected int doReadCount(ConditionBean cb) { return selectCount(downcast(cb)); } // =================================================================================== // Cursor Select // ============= /** * Select the cursor by the condition-bean. * <pre> * EnterpriseFavoCB cb = new EnterpriseFavoCB(); * cb.query().setFoo...(value); * enterpriseFavoBhv.<span style="color: #FD4747">selectCursor</span>(cb, new EntityRowHandler&lt;EnterpriseFavo&gt;() { * public void handle(EnterpriseFavo entity) { * ... = entity.getFoo...(); * } * }); * </pre> * @param cb The condition-bean of EnterpriseFavo. (NotNull) * @param entityRowHandler The handler of entity row of EnterpriseFavo. (NotNull) */ public void selectCursor(EnterpriseFavoCB cb, EntityRowHandler<EnterpriseFavo> entityRowHandler) { doSelectCursor(cb, entityRowHandler, EnterpriseFavo.class); } protected <ENTITY extends EnterpriseFavo> void doSelectCursor(EnterpriseFavoCB cb, EntityRowHandler<ENTITY> entityRowHandler, Class<ENTITY> entityType) { assertCBStateValid(cb); assertObjectNotNull("entityRowHandler<EnterpriseFavo>", entityRowHandler); assertObjectNotNull("entityType", entityType); assertSpecifyDerivedReferrerEntityProperty(cb, entityType); delegateSelectCursor(cb, entityRowHandler, entityType); } // =================================================================================== // Entity Select // ============= /** * Select the entity by the condition-bean. * <pre> * EnterpriseFavoCB cb = new EnterpriseFavoCB(); * cb.query().setFoo...(value); * EnterpriseFavo enterpriseFavo = enterpriseFavoBhv.<span style="color: #FD4747">selectEntity</span>(cb); * if (enterpriseFavo != null) { * ... = enterpriseFavo.get...(); * } else { * ... * } * </pre> * @param cb The condition-bean of EnterpriseFavo. (NotNull) * @return The selected entity. (NullAllowed: If the condition has no data, it returns null) * @exception org.seasar.dbflute.exception.EntityDuplicatedException When the entity has been duplicated. * @exception org.seasar.dbflute.exception.SelectEntityConditionNotFoundException When the condition for selecting an entity is not found. */ public EnterpriseFavo selectEntity(EnterpriseFavoCB cb) { return doSelectEntity(cb, EnterpriseFavo.class); } protected <ENTITY extends EnterpriseFavo> ENTITY doSelectEntity(final EnterpriseFavoCB cb, final Class<ENTITY> entityType) { assertCBStateValid(cb); return helpSelectEntityInternally(cb, new InternalSelectEntityCallback<ENTITY, EnterpriseFavoCB>() { public List<ENTITY> callbackSelectList(EnterpriseFavoCB cb) { return doSelectList(cb, entityType); } }); } @Override protected Entity doReadEntity(ConditionBean cb) { return selectEntity(downcast(cb)); } /** * Select the entity by the condition-bean with deleted check. * <pre> * EnterpriseFavoCB cb = new EnterpriseFavoCB(); * cb.query().setFoo...(value); * EnterpriseFavo enterpriseFavo = enterpriseFavoBhv.<span style="color: #FD4747">selectEntityWithDeletedCheck</span>(cb); * ... = enterpriseFavo.get...(); <span style="color: #3F7E5E">// the entity always be not null</span> * </pre> * @param cb The condition-bean of EnterpriseFavo. (NotNull) * @return The selected entity. (NotNull) * @exception org.seasar.dbflute.exception.EntityAlreadyDeletedException When the entity has already been deleted. * @exception org.seasar.dbflute.exception.EntityDuplicatedException When the entity has been duplicated. * @exception org.seasar.dbflute.exception.SelectEntityConditionNotFoundException When the condition for selecting an entity is not found. */ public EnterpriseFavo selectEntityWithDeletedCheck(EnterpriseFavoCB cb) { return doSelectEntityWithDeletedCheck(cb, EnterpriseFavo.class); } protected <ENTITY extends EnterpriseFavo> ENTITY doSelectEntityWithDeletedCheck(final EnterpriseFavoCB cb, final Class<ENTITY> entityType) { assertCBStateValid(cb); return helpSelectEntityWithDeletedCheckInternally(cb, new InternalSelectEntityWithDeletedCheckCallback<ENTITY, EnterpriseFavoCB>() { public List<ENTITY> callbackSelectList(EnterpriseFavoCB cb) { return doSelectList(cb, entityType); } }); } @Override protected Entity doReadEntityWithDeletedCheck(ConditionBean cb) { return selectEntityWithDeletedCheck(downcast(cb)); } /** * Select the entity by the primary-key value. * @param jobOfferId The one of primary key. (NotNull) * @param studentId The one of primary key. (NotNull) * @return The selected entity. (NullAllowed: If the primary-key value has no data, it returns null) * @exception org.seasar.dbflute.exception.EntityDuplicatedException When the entity has been duplicated. * @exception org.seasar.dbflute.exception.SelectEntityConditionNotFoundException When the condition for selecting an entity is not found. */ public EnterpriseFavo selectByPKValue(Integer jobOfferId, Integer studentId) { return doSelectByPKValue(jobOfferId, studentId, EnterpriseFavo.class); } protected <ENTITY extends EnterpriseFavo> ENTITY doSelectByPKValue(Integer jobOfferId, Integer studentId, Class<ENTITY> entityType) { return doSelectEntity(buildPKCB(jobOfferId, studentId), entityType); } /** * Select the entity by the primary-key value with deleted check. * @param jobOfferId The one of primary key. (NotNull) * @param studentId The one of primary key. (NotNull) * @return The selected entity. (NotNull) * @exception org.seasar.dbflute.exception.EntityAlreadyDeletedException When the entity has already been deleted. * @exception org.seasar.dbflute.exception.EntityDuplicatedException When the entity has been duplicated. * @exception org.seasar.dbflute.exception.SelectEntityConditionNotFoundException When the condition for selecting an entity is not found. */ public EnterpriseFavo selectByPKValueWithDeletedCheck(Integer jobOfferId, Integer studentId) { return doSelectByPKValueWithDeletedCheck(jobOfferId, studentId, EnterpriseFavo.class); } protected <ENTITY extends EnterpriseFavo> ENTITY doSelectByPKValueWithDeletedCheck(Integer jobOfferId, Integer studentId, Class<ENTITY> entityType) { return doSelectEntityWithDeletedCheck(buildPKCB(jobOfferId, studentId), entityType); } private EnterpriseFavoCB buildPKCB(Integer jobOfferId, Integer studentId) { assertObjectNotNull("jobOfferId", jobOfferId);assertObjectNotNull("studentId", studentId); EnterpriseFavoCB cb = newMyConditionBean(); cb.query().setJobOfferId_Equal(jobOfferId);cb.query().setStudentId_Equal(studentId); return cb; } // =================================================================================== // List Select // =========== /** * Select the list as result bean. * <pre> * EnterpriseFavoCB cb = new EnterpriseFavoCB(); * cb.query().setFoo...(value); * cb.query().addOrderBy_Bar...(); * ListResultBean&lt;EnterpriseFavo&gt; enterpriseFavoList = enterpriseFavoBhv.<span style="color: #FD4747">selectList</span>(cb); * for (EnterpriseFavo enterpriseFavo : enterpriseFavoList) { * ... = enterpriseFavo.get...(); * } * </pre> * @param cb The condition-bean of EnterpriseFavo. (NotNull) * @return The result bean of selected list. (NotNull) * @exception org.seasar.dbflute.exception.DangerousResultSizeException When the result size is over the specified safety size. */ public ListResultBean<EnterpriseFavo> selectList(EnterpriseFavoCB cb) { return doSelectList(cb, EnterpriseFavo.class); } protected <ENTITY extends EnterpriseFavo> ListResultBean<ENTITY> doSelectList(EnterpriseFavoCB cb, Class<ENTITY> entityType) { assertCBStateValid(cb); assertObjectNotNull("entityType", entityType); assertSpecifyDerivedReferrerEntityProperty(cb, entityType); return helpSelectListInternally(cb, entityType, new InternalSelectListCallback<ENTITY, EnterpriseFavoCB>() { public List<ENTITY> callbackSelectList(EnterpriseFavoCB cb, Class<ENTITY> entityType) { return delegateSelectList(cb, entityType); } }); } @Override protected ListResultBean<? extends Entity> doReadList(ConditionBean cb) { return selectList(downcast(cb)); } // =================================================================================== // Page Select // =========== /** * Select the page as result bean. <br /> * (both count-select and paging-select are executed) * <pre> * EnterpriseFavoCB cb = new EnterpriseFavoCB(); * cb.query().setFoo...(value); * cb.query().addOrderBy_Bar...(); * cb.<span style="color: #FD4747">paging</span>(20, 3); <span style="color: #3F7E5E">// 20 records per a page and current page number is 3</span> * PagingResultBean&lt;EnterpriseFavo&gt; page = enterpriseFavoBhv.<span style="color: #FD4747">selectPage</span>(cb); * int allRecordCount = page.getAllRecordCount(); * int allPageCount = page.getAllPageCount(); * boolean isExistPrePage = page.isExistPrePage(); * boolean isExistNextPage = page.isExistNextPage(); * ... * for (EnterpriseFavo enterpriseFavo : page) { * ... = enterpriseFavo.get...(); * } * </pre> * @param cb The condition-bean of EnterpriseFavo. (NotNull) * @return The result bean of selected page. (NotNull) * @exception org.seasar.dbflute.exception.DangerousResultSizeException When the result size is over the specified safety size. */ public PagingResultBean<EnterpriseFavo> selectPage(EnterpriseFavoCB cb) { return doSelectPage(cb, EnterpriseFavo.class); } protected <ENTITY extends EnterpriseFavo> PagingResultBean<ENTITY> doSelectPage(EnterpriseFavoCB cb, Class<ENTITY> entityType) { assertCBStateValid(cb); assertObjectNotNull("entityType", entityType); return helpSelectPageInternally(cb, entityType, new InternalSelectPageCallback<ENTITY, EnterpriseFavoCB>() { public int callbackSelectCount(EnterpriseFavoCB cb) { return doSelectCountPlainly(cb); } public List<ENTITY> callbackSelectList(EnterpriseFavoCB cb, Class<ENTITY> entityType) { return doSelectList(cb, entityType); } }); } @Override protected PagingResultBean<? extends Entity> doReadPage(ConditionBean cb) { return selectPage(downcast(cb)); } // =================================================================================== // Scalar Select // ============= /** * Select the scalar value derived by a function from uniquely-selected records. <br /> * You should call a function method after this method called like as follows: * <pre> * enterpriseFavoBhv.<span style="color: #FD4747">scalarSelect</span>(Date.class).max(new ScalarQuery() { * public void query(EnterpriseFavoCB cb) { * cb.specify().<span style="color: #FD4747">columnFooDatetime()</span>; <span style="color: #3F7E5E">// required for a function</span> * cb.query().setBarName_PrefixSearch("S"); * } * }); * </pre> * @param <RESULT> The type of result. * @param resultType The type of result. (NotNull) * @return The scalar value derived by a function. (NullAllowed) */ public <RESULT> SLFunction<EnterpriseFavoCB, RESULT> scalarSelect(Class<RESULT> resultType) { return doScalarSelect(resultType, newMyConditionBean()); } protected <RESULT, CB extends EnterpriseFavoCB> SLFunction<CB, RESULT> doScalarSelect(Class<RESULT> resultType, CB cb) { assertObjectNotNull("resultType", resultType); assertCBStateValid(cb); cb.xsetupForScalarSelect(); cb.getSqlClause().disableSelectIndex(); // for when you use union return new SLFunction<CB, RESULT>(cb, resultType); } // =================================================================================== // Sequence // ======== @Override protected Number doReadNextVal() { String msg = "This table is NOT related to sequence: " + getTableDbName(); throw new UnsupportedOperationException(msg); } // =================================================================================== // Pull out Foreign // ================ /** * Pull out the list of foreign table 'EnterpriseOffer'. * @param enterpriseFavoList The list of enterpriseFavo. (NotNull) * @return The list of foreign table. (NotNull) */ public List<EnterpriseOffer> pulloutEnterpriseOffer(List<EnterpriseFavo> enterpriseFavoList) { return helpPulloutInternally(enterpriseFavoList, new InternalPulloutCallback<EnterpriseFavo, EnterpriseOffer>() { public EnterpriseOffer getFr(EnterpriseFavo e) { return e.getEnterpriseOffer(); } public boolean hasRf() { return true; } public void setRfLs(EnterpriseOffer e, List<EnterpriseFavo> ls) { e.setEnterpriseFavoList(ls); } }); } /** * Pull out the list of foreign table 'Student'. * @param enterpriseFavoList The list of enterpriseFavo. (NotNull) * @return The list of foreign table. (NotNull) */ public List<Student> pulloutStudent(List<EnterpriseFavo> enterpriseFavoList) { return helpPulloutInternally(enterpriseFavoList, new InternalPulloutCallback<EnterpriseFavo, Student>() { public Student getFr(EnterpriseFavo e) { return e.getStudent(); } public boolean hasRf() { return true; } public void setRfLs(Student e, List<EnterpriseFavo> ls) { e.setEnterpriseFavoList(ls); } }); } // =================================================================================== // Entity Update // ============= /** * Insert the entity. * <pre> * EnterpriseFavo enterpriseFavo = new EnterpriseFavo(); * <span style="color: #3F7E5E">// if auto-increment, you don't need to set the PK value</span> * enterpriseFavo.setFoo...(value); * enterpriseFavo.setBar...(value); * <span style="color: #3F7E5E">// you don't need to set values of common columns</span> * <span style="color: #3F7E5E">//enterpriseFavo.setRegisterUser(value);</span> * <span style="color: #3F7E5E">//enterpriseFavo.set...;</span> * enterpriseFavoBhv.<span style="color: #FD4747">insert</span>(enterpriseFavo); * ... = enterpriseFavo.getPK...(); <span style="color: #3F7E5E">// if auto-increment, you can get the value after</span> * </pre> * @param enterpriseFavo The entity of insert target. (NotNull) * @exception org.seasar.dbflute.exception.EntityAlreadyExistsException When the entity already exists. (Unique Constraint Violation) */ public void insert(EnterpriseFavo enterpriseFavo) { doInsert(enterpriseFavo, null); } protected void doInsert(EnterpriseFavo enterpriseFavo, InsertOption<EnterpriseFavoCB> option) { assertObjectNotNull("enterpriseFavo", enterpriseFavo); prepareInsertOption(option); delegateInsert(enterpriseFavo, option); } protected void prepareInsertOption(InsertOption<EnterpriseFavoCB> option) { if (option == null) { return; } assertInsertOptionStatus(option); } @Override protected void doCreate(Entity entity, InsertOption<? extends ConditionBean> option) { if (option == null) { insert(downcast(entity)); } else { varyingInsert(downcast(entity), downcast(option)); } } /** * Update the entity modified-only. {UpdateCountZeroException, ExclusiveControl} * <pre> * EnterpriseFavo enterpriseFavo = new EnterpriseFavo(); * enterpriseFavo.setPK...(value); <span style="color: #3F7E5E">// required</span> * enterpriseFavo.setFoo...(value); <span style="color: #3F7E5E">// you should set only modified columns</span> * <span style="color: #3F7E5E">// you don't need to set values of common columns</span> * <span style="color: #3F7E5E">//enterpriseFavo.setRegisterUser(value);</span> * <span style="color: #3F7E5E">//enterpriseFavo.set...;</span> * <span style="color: #3F7E5E">// if exclusive control, the value of exclusive control column is required</span> * enterpriseFavo.<span style="color: #FD4747">setVersionNo</span>(value); * try { * enterpriseFavoBhv.<span style="color: #FD4747">update</span>(enterpriseFavo); * } catch (EntityAlreadyUpdatedException e) { <span style="color: #3F7E5E">// if concurrent update</span> * ... * } * </pre> * @param enterpriseFavo The entity of update target. (NotNull) {PrimaryKeyRequired, ConcurrencyColumnRequired} * @exception org.seasar.dbflute.exception.EntityAlreadyDeletedException When the entity has already been deleted. * @exception org.seasar.dbflute.exception.EntityDuplicatedException When the entity has been duplicated. * @exception org.seasar.dbflute.exception.EntityAlreadyExistsException When the entity already exists. (Unique Constraint Violation) */ public void update(final EnterpriseFavo enterpriseFavo) { doUpdate(enterpriseFavo, null); } protected void doUpdate(EnterpriseFavo enterpriseFavo, final UpdateOption<EnterpriseFavoCB> option) { assertObjectNotNull("enterpriseFavo", enterpriseFavo); prepareUpdateOption(option); helpUpdateInternally(enterpriseFavo, new InternalUpdateCallback<EnterpriseFavo>() { public int callbackDelegateUpdate(EnterpriseFavo entity) { return delegateUpdate(entity, option); } }); } protected void prepareUpdateOption(UpdateOption<EnterpriseFavoCB> option) { if (option == null) { return; } assertUpdateOptionStatus(option); if (option.hasSelfSpecification()) { option.resolveSelfSpecification(createCBForVaryingUpdate()); } if (option.hasSpecifiedUpdateColumn()) { option.resolveUpdateColumnSpecification(createCBForSpecifiedUpdate()); } } protected EnterpriseFavoCB createCBForVaryingUpdate() { EnterpriseFavoCB cb = newMyConditionBean(); cb.xsetupForVaryingUpdate(); return cb; } protected EnterpriseFavoCB createCBForSpecifiedUpdate() { EnterpriseFavoCB cb = newMyConditionBean(); cb.xsetupForSpecifiedUpdate(); return cb; } @Override protected void doModify(Entity entity, UpdateOption<? extends ConditionBean> option) { if (option == null) { update(downcast(entity)); } else { varyingUpdate(downcast(entity), downcast(option)); } } @Override protected void doModifyNonstrict(Entity entity, UpdateOption<? extends ConditionBean> option) { doModify(entity, option); } /** * Insert or update the entity modified-only. {ExclusiveControl(when update)} * @param enterpriseFavo The entity of insert or update target. (NotNull) * @exception org.seasar.dbflute.exception.EntityAlreadyDeletedException When the entity has already been deleted. * @exception org.seasar.dbflute.exception.EntityDuplicatedException When the entity has been duplicated. * @exception org.seasar.dbflute.exception.EntityAlreadyExistsException When the entity already exists. (Unique Constraint Violation) */ public void insertOrUpdate(EnterpriseFavo enterpriseFavo) { doInesrtOrUpdate(enterpriseFavo, null, null); } protected void doInesrtOrUpdate(EnterpriseFavo enterpriseFavo, final InsertOption<EnterpriseFavoCB> insertOption, final UpdateOption<EnterpriseFavoCB> updateOption) { helpInsertOrUpdateInternally(enterpriseFavo, new InternalInsertOrUpdateCallback<EnterpriseFavo, EnterpriseFavoCB>() { public void callbackInsert(EnterpriseFavo entity) { doInsert(entity, insertOption); } public void callbackUpdate(EnterpriseFavo entity) { doUpdate(entity, updateOption); } public EnterpriseFavoCB callbackNewMyConditionBean() { return newMyConditionBean(); } public int callbackSelectCount(EnterpriseFavoCB cb) { return selectCount(cb); } }); } @Override protected void doCreateOrModify(Entity entity, InsertOption<? extends ConditionBean> insertOption, UpdateOption<? extends ConditionBean> updateOption) { if (insertOption == null && updateOption == null) { insertOrUpdate(downcast(entity)); } else { insertOption = insertOption == null ? new InsertOption<EnterpriseFavoCB>() : insertOption; updateOption = updateOption == null ? new UpdateOption<EnterpriseFavoCB>() : updateOption; varyingInsertOrUpdate(downcast(entity), downcast(insertOption), downcast(updateOption)); } } @Override protected void doCreateOrModifyNonstrict(Entity entity, InsertOption<? extends ConditionBean> insertOption, UpdateOption<? extends ConditionBean> updateOption) { doCreateOrModify(entity, insertOption, updateOption); } /** * Delete the entity. {UpdateCountZeroException, ExclusiveControl} * <pre> * EnterpriseFavo enterpriseFavo = new EnterpriseFavo(); * enterpriseFavo.setPK...(value); <span style="color: #3F7E5E">// required</span> * <span style="color: #3F7E5E">// if exclusive control, the value of exclusive control column is required</span> * enterpriseFavo.<span style="color: #FD4747">setVersionNo</span>(value); * try { * enterpriseFavoBhv.<span style="color: #FD4747">delete</span>(enterpriseFavo); * } catch (EntityAlreadyUpdatedException e) { <span style="color: #3F7E5E">// if concurrent update</span> * ... * } * </pre> * @param enterpriseFavo The entity of delete target. (NotNull) {PrimaryKeyRequired, ConcurrencyColumnRequired} * @exception org.seasar.dbflute.exception.EntityAlreadyDeletedException When the entity has already been deleted. * @exception org.seasar.dbflute.exception.EntityDuplicatedException When the entity has been duplicated. */ public void delete(EnterpriseFavo enterpriseFavo) { doDelete(enterpriseFavo, null); } protected void doDelete(EnterpriseFavo enterpriseFavo, final DeleteOption<EnterpriseFavoCB> option) { assertObjectNotNull("enterpriseFavo", enterpriseFavo); prepareDeleteOption(option); helpDeleteInternally(enterpriseFavo, new InternalDeleteCallback<EnterpriseFavo>() { public int callbackDelegateDelete(EnterpriseFavo entity) { return delegateDelete(entity, option); } }); } protected void prepareDeleteOption(DeleteOption<EnterpriseFavoCB> option) { if (option == null) { return; } assertDeleteOptionStatus(option); } @Override protected void doRemove(Entity entity, DeleteOption<? extends ConditionBean> option) { if (option == null) { delete(downcast(entity)); } else { varyingDelete(downcast(entity), downcast(option)); } } @Override protected void doRemoveNonstrict(Entity entity, DeleteOption<? extends ConditionBean> option) { doRemove(entity, option); } // =================================================================================== // Batch Update // ============ /** * Batch-insert the list. <br /> * This method uses 'Batch Update' of java.sql.PreparedStatement. <br /> * All columns are insert target. (so default constraints are not available) <br /> * And if the table has an identity, entities after the process do not have incremented values. * (When you use the (normal) insert(), an entity after the process has an incremented value) * @param enterpriseFavoList The list of the entity. (NotNull) * @return The array of inserted count. */ public int[] batchInsert(List<EnterpriseFavo> enterpriseFavoList) { return doBatchInsert(enterpriseFavoList, null); } protected int[] doBatchInsert(List<EnterpriseFavo> enterpriseFavoList, InsertOption<EnterpriseFavoCB> option) { assertObjectNotNull("enterpriseFavoList", enterpriseFavoList); prepareInsertOption(option); return delegateBatchInsert(enterpriseFavoList, option); } @Override protected int[] doLumpCreate(List<Entity> ls, InsertOption<? extends ConditionBean> option) { if (option == null) { return batchInsert(downcast(ls)); } else { return varyingBatchInsert(downcast(ls), downcast(option)); } } /** * Batch-update the list. <br /> * This method uses 'Batch Update' of java.sql.PreparedStatement. <br /> * All columns are update target. {NOT modified only} * @param enterpriseFavoList The list of the entity. (NotNull) * @return The array of updated count. * @exception org.seasar.dbflute.exception.EntityAlreadyDeletedException When the entity has already been deleted. */ public int[] batchUpdate(List<EnterpriseFavo> enterpriseFavoList) { return doBatchUpdate(enterpriseFavoList, null); } protected int[] doBatchUpdate(List<EnterpriseFavo> enterpriseFavoList, UpdateOption<EnterpriseFavoCB> option) { assertObjectNotNull("enterpriseFavoList", enterpriseFavoList); prepareUpdateOption(option); return delegateBatchUpdate(enterpriseFavoList, option); } @Override protected int[] doLumpModify(List<Entity> ls, UpdateOption<? extends ConditionBean> option) { if (option == null) { return batchUpdate(downcast(ls)); } else { return varyingBatchUpdate(downcast(ls), downcast(option)); } } /** * Batch-update the list. <br /> * This method uses 'Batch Update' of java.sql.PreparedStatement. <br /> * You can specify update columns used on set clause of update statement. * However you do not need to specify common columns for update * and an optimistick lock column because they are specified implicitly. * @param enterpriseFavoList The list of the entity. (NotNull) * @param updateColumnSpec The specification of update columns. (NotNull) * @return The array of updated count. * @exception org.seasar.dbflute.exception.EntityAlreadyDeletedException When the entity has already been deleted. */ public int[] batchUpdate(List<EnterpriseFavo> enterpriseFavoList, SpecifyQuery<EnterpriseFavoCB> updateColumnSpec) { return doBatchUpdate(enterpriseFavoList, createSpecifiedUpdateOption(updateColumnSpec)); } @Override protected int[] doLumpModifyNonstrict(List<Entity> ls, UpdateOption<? extends ConditionBean> option) { return doLumpModify(ls, option); } /** * Batch-delete the list. <br /> * This method uses 'Batch Update' of java.sql.PreparedStatement. * @param enterpriseFavoList The list of the entity. (NotNull) * @return The array of deleted count. * @exception org.seasar.dbflute.exception.EntityAlreadyDeletedException When the entity has already been deleted. */ public int[] batchDelete(List<EnterpriseFavo> enterpriseFavoList) { return doBatchDelete(enterpriseFavoList, null); } protected int[] doBatchDelete(List<EnterpriseFavo> enterpriseFavoList, DeleteOption<EnterpriseFavoCB> option) { assertObjectNotNull("enterpriseFavoList", enterpriseFavoList); prepareDeleteOption(option); return delegateBatchDelete(enterpriseFavoList, option); } @Override protected int[] doLumpRemove(List<Entity> ls, DeleteOption<? extends ConditionBean> option) { if (option == null) { return batchDelete(downcast(ls)); } else { return varyingBatchDelete(downcast(ls), downcast(option)); } } @Override protected int[] doLumpRemoveNonstrict(List<Entity> ls, DeleteOption<? extends ConditionBean> option) { return doLumpRemove(ls, option); } // =================================================================================== // Query Update // ============ /** * Insert the several entities by query (modified-only for fixed value). * <pre> * enterpriseFavoBhv.<span style="color: #FD4747">queryInsert</span>(new QueryInsertSetupper&lt;EnterpriseFavo, EnterpriseFavoCB&gt;() { * public ConditionBean setup(enterpriseFavo entity, EnterpriseFavoCB intoCB) { * FooCB cb = FooCB(); * cb.setupSelect_Bar(); * * <span style="color: #3F7E5E">// mapping</span> * intoCB.specify().columnMyName().mappedFrom(cb.specify().columnFooName()); * intoCB.specify().columnMyCount().mappedFrom(cb.specify().columnFooCount()); * intoCB.specify().columnMyDate().mappedFrom(cb.specify().specifyBar().columnBarDate()); * entity.setMyFixedValue("foo"); <span style="color: #3F7E5E">// fixed value</span> * <span style="color: #3F7E5E">// you don't need to set values of common columns</span> * <span style="color: #3F7E5E">//entity.setRegisterUser(value);</span> * <span style="color: #3F7E5E">//entity.set...;</span> * <span style="color: #3F7E5E">// you don't need to set a value of exclusive control column</span> * <span style="color: #3F7E5E">//entity.setVersionNo(value);</span> * * return cb; * } * }); * </pre> * @param setupper The setup-per of query-insert. (NotNull) * @return The inserted count. */ public int queryInsert(QueryInsertSetupper<EnterpriseFavo, EnterpriseFavoCB> setupper) { return doQueryInsert(setupper, null); } protected int doQueryInsert(QueryInsertSetupper<EnterpriseFavo, EnterpriseFavoCB> setupper, InsertOption<EnterpriseFavoCB> option) { assertObjectNotNull("setupper", setupper); prepareInsertOption(option); EnterpriseFavo entity = new EnterpriseFavo(); EnterpriseFavoCB intoCB = createCBForQueryInsert(); ConditionBean resourceCB = setupper.setup(entity, intoCB); return delegateQueryInsert(entity, intoCB, resourceCB, option); } protected EnterpriseFavoCB createCBForQueryInsert() { EnterpriseFavoCB cb = newMyConditionBean(); cb.xsetupForQueryInsert(); return cb; } @Override protected int doRangeCreate(QueryInsertSetupper<? extends Entity, ? extends ConditionBean> setupper, InsertOption<? extends ConditionBean> option) { if (option == null) { return queryInsert(downcast(setupper)); } else { return varyingQueryInsert(downcast(setupper), downcast(option)); } } /** * Update the several entities by query non-strictly modified-only. {NonExclusiveControl} * <pre> * EnterpriseFavo enterpriseFavo = new EnterpriseFavo(); * <span style="color: #3F7E5E">// you don't need to set PK value</span> * <span style="color: #3F7E5E">//enterpriseFavo.setPK...(value);</span> * enterpriseFavo.setFoo...(value); <span style="color: #3F7E5E">// you should set only modified columns</span> * <span style="color: #3F7E5E">// you don't need to set values of common columns</span> * <span style="color: #3F7E5E">//enterpriseFavo.setRegisterUser(value);</span> * <span style="color: #3F7E5E">//enterpriseFavo.set...;</span> * <span style="color: #3F7E5E">// you don't need to set a value of exclusive control column</span> * <span style="color: #3F7E5E">// (auto-increment for version number is valid though non-exclusive control)</span> * <span style="color: #3F7E5E">//enterpriseFavo.setVersionNo(value);</span> * EnterpriseFavoCB cb = new EnterpriseFavoCB(); * cb.query().setFoo...(value); * enterpriseFavoBhv.<span style="color: #FD4747">queryUpdate</span>(enterpriseFavo, cb); * </pre> * @param enterpriseFavo The entity that contains update values. (NotNull, PrimaryKeyNullAllowed) * @param cb The condition-bean of EnterpriseFavo. (NotNull) * @return The updated count. * @exception org.seasar.dbflute.exception.NonQueryUpdateNotAllowedException When the query has no condition. */ public int queryUpdate(EnterpriseFavo enterpriseFavo, EnterpriseFavoCB cb) { return doQueryUpdate(enterpriseFavo, cb, null); } protected int doQueryUpdate(EnterpriseFavo enterpriseFavo, EnterpriseFavoCB cb, UpdateOption<EnterpriseFavoCB> option) { assertObjectNotNull("enterpriseFavo", enterpriseFavo); assertCBStateValid(cb); prepareUpdateOption(option); return delegateQueryUpdate(enterpriseFavo, cb, option); } @Override protected int doRangeModify(Entity entity, ConditionBean cb, UpdateOption<? extends ConditionBean> option) { if (option == null) { return queryUpdate(downcast(entity), (EnterpriseFavoCB)cb); } else { return varyingQueryUpdate(downcast(entity), (EnterpriseFavoCB)cb, downcast(option)); } } /** * Delete the several entities by query. {NonExclusiveControl} * <pre> * EnterpriseFavoCB cb = new EnterpriseFavoCB(); * cb.query().setFoo...(value); * enterpriseFavoBhv.<span style="color: #FD4747">queryDelete</span>(enterpriseFavo, cb); * </pre> * @param cb The condition-bean of EnterpriseFavo. (NotNull) * @return The deleted count. * @exception org.seasar.dbflute.exception.NonQueryDeleteNotAllowedException When the query has no condition. */ public int queryDelete(EnterpriseFavoCB cb) { return doQueryDelete(cb, null); } protected int doQueryDelete(EnterpriseFavoCB cb, DeleteOption<EnterpriseFavoCB> option) { assertCBStateValid(cb); prepareDeleteOption(option); return delegateQueryDelete(cb, option); } @Override protected int doRangeRemove(ConditionBean cb, DeleteOption<? extends ConditionBean> option) { if (option == null) { return queryDelete((EnterpriseFavoCB)cb); } else { return varyingQueryDelete((EnterpriseFavoCB)cb, downcast(option)); } } // =================================================================================== // Varying Update // ============== // ----------------------------------------------------- // Entity Update // ------------- /** * Insert the entity with varying requests. <br /> * For example, disableCommonColumnAutoSetup(), disablePrimaryKeyIdentity(). <br /> * Other specifications are same as insert(entity). * <pre> * EnterpriseFavo enterpriseFavo = new EnterpriseFavo(); * <span style="color: #3F7E5E">// if auto-increment, you don't need to set the PK value</span> * enterpriseFavo.setFoo...(value); * enterpriseFavo.setBar...(value); * InsertOption<EnterpriseFavoCB> option = new InsertOption<EnterpriseFavoCB>(); * <span style="color: #3F7E5E">// you can insert by your values for common columns</span> * option.disableCommonColumnAutoSetup(); * enterpriseFavoBhv.<span style="color: #FD4747">varyingInsert</span>(enterpriseFavo, option); * ... = enterpriseFavo.getPK...(); <span style="color: #3F7E5E">// if auto-increment, you can get the value after</span> * </pre> * @param enterpriseFavo The entity of insert target. (NotNull) * @param option The option of insert for varying requests. (NotNull) * @exception org.seasar.dbflute.exception.EntityAlreadyExistsException When the entity already exists. (Unique Constraint Violation) */ public void varyingInsert(EnterpriseFavo enterpriseFavo, InsertOption<EnterpriseFavoCB> option) { assertInsertOptionNotNull(option); doInsert(enterpriseFavo, option); } /** * Update the entity with varying requests modified-only. {UpdateCountZeroException, ExclusiveControl} <br /> * For example, self(selfCalculationSpecification), specify(updateColumnSpecification), disableCommonColumnAutoSetup(). <br /> * Other specifications are same as update(entity). * <pre> * EnterpriseFavo enterpriseFavo = new EnterpriseFavo(); * enterpriseFavo.setPK...(value); <span style="color: #3F7E5E">// required</span> * enterpriseFavo.setOther...(value); <span style="color: #3F7E5E">// you should set only modified columns</span> * <span style="color: #3F7E5E">// if exclusive control, the value of exclusive control column is required</span> * enterpriseFavo.<span style="color: #FD4747">setVersionNo</span>(value); * try { * <span style="color: #3F7E5E">// you can update by self calculation values</span> * UpdateOption&lt;EnterpriseFavoCB&gt; option = new UpdateOption&lt;EnterpriseFavoCB&gt;(); * option.self(new SpecifyQuery&lt;EnterpriseFavoCB&gt;() { * public void specify(EnterpriseFavoCB cb) { * cb.specify().<span style="color: #FD4747">columnXxxCount()</span>; * } * }).plus(1); <span style="color: #3F7E5E">// XXX_COUNT = XXX_COUNT + 1</span> * enterpriseFavoBhv.<span style="color: #FD4747">varyingUpdate</span>(enterpriseFavo, option); * } catch (EntityAlreadyUpdatedException e) { <span style="color: #3F7E5E">// if concurrent update</span> * ... * } * </pre> * @param enterpriseFavo The entity of update target. (NotNull) {PrimaryKeyRequired, ConcurrencyColumnRequired} * @param option The option of update for varying requests. (NotNull) * @exception org.seasar.dbflute.exception.EntityAlreadyDeletedException When the entity has already been deleted. * @exception org.seasar.dbflute.exception.EntityDuplicatedException When the entity has been duplicated. * @exception org.seasar.dbflute.exception.EntityAlreadyExistsException When the entity already exists. (Unique Constraint Violation) */ public void varyingUpdate(EnterpriseFavo enterpriseFavo, UpdateOption<EnterpriseFavoCB> option) { assertUpdateOptionNotNull(option); doUpdate(enterpriseFavo, option); } /** * Insert or update the entity with varying requests. {ExclusiveControl(when update)}<br /> * Other specifications are same as insertOrUpdate(entity). * @param enterpriseFavo The entity of insert or update target. (NotNull) * @param insertOption The option of insert for varying requests. (NotNull) * @param updateOption The option of update for varying requests. (NotNull) * @exception org.seasar.dbflute.exception.EntityAlreadyDeletedException When the entity has already been deleted. * @exception org.seasar.dbflute.exception.EntityDuplicatedException When the entity has been duplicated. * @exception org.seasar.dbflute.exception.EntityAlreadyExistsException When the entity already exists. (Unique Constraint Violation) */ public void varyingInsertOrUpdate(EnterpriseFavo enterpriseFavo, InsertOption<EnterpriseFavoCB> insertOption, UpdateOption<EnterpriseFavoCB> updateOption) { assertInsertOptionNotNull(insertOption); assertUpdateOptionNotNull(updateOption); doInesrtOrUpdate(enterpriseFavo, insertOption, updateOption); } /** * Delete the entity with varying requests. {UpdateCountZeroException, ExclusiveControl} <br /> * Now a valid option does not exist. <br /> * Other specifications are same as delete(entity). * @param enterpriseFavo The entity of delete target. (NotNull) {PrimaryKeyRequired, ConcurrencyColumnRequired} * @param option The option of update for varying requests. (NotNull) * @exception org.seasar.dbflute.exception.EntityAlreadyDeletedException When the entity has already been deleted. * @exception org.seasar.dbflute.exception.EntityDuplicatedException When the entity has been duplicated. */ public void varyingDelete(EnterpriseFavo enterpriseFavo, DeleteOption<EnterpriseFavoCB> option) { assertDeleteOptionNotNull(option); doDelete(enterpriseFavo, option); } // ----------------------------------------------------- // Batch Update // ------------ /** * Batch-insert the list with varying requests. <br /> * For example, disableCommonColumnAutoSetup() * , disablePrimaryKeyIdentity(), limitBatchInsertLogging(). <br /> * Other specifications are same as batchInsert(entityList). * @param enterpriseFavoList The list of the entity. (NotNull) * @param option The option of insert for varying requests. (NotNull) * @return The array of inserted count. */ public int[] varyingBatchInsert(List<EnterpriseFavo> enterpriseFavoList, InsertOption<EnterpriseFavoCB> option) { assertInsertOptionNotNull(option); return doBatchInsert(enterpriseFavoList, option); } /** * Batch-update the list with varying requests. <br /> * For example, self(selfCalculationSpecification), specify(updateColumnSpecification) * , disableCommonColumnAutoSetup(), limitBatchUpdateLogging(). <br /> * Other specifications are same as batchUpdate(entityList). * @param enterpriseFavoList The list of the entity. (NotNull) * @param option The option of update for varying requests. (NotNull) * @return The array of updated count. */ public int[] varyingBatchUpdate(List<EnterpriseFavo> enterpriseFavoList, UpdateOption<EnterpriseFavoCB> option) { assertUpdateOptionNotNull(option); return doBatchUpdate(enterpriseFavoList, option); } /** * Batch-delete the list with varying requests. <br /> * For example, limitBatchDeleteLogging(). <br /> * Other specifications are same as batchDelete(entityList). * @param enterpriseFavoList The list of the entity. (NotNull) * @param option The option of delete for varying requests. (NotNull) * @return The array of deleted count. */ public int[] varyingBatchDelete(List<EnterpriseFavo> enterpriseFavoList, DeleteOption<EnterpriseFavoCB> option) { assertDeleteOptionNotNull(option); return doBatchDelete(enterpriseFavoList, option); } // ----------------------------------------------------- // Query Update // ------------ /** * Insert the several entities by query with varying requests (modified-only for fixed value). <br /> * For example, disableCommonColumnAutoSetup(), disablePrimaryKeyIdentity(). <br /> * Other specifications are same as queryInsert(entity, setupper). * @param setupper The setup-per of query-insert. (NotNull) * @param option The option of insert for varying requests. (NotNull) * @return The inserted count. */ public int varyingQueryInsert(QueryInsertSetupper<EnterpriseFavo, EnterpriseFavoCB> setupper, InsertOption<EnterpriseFavoCB> option) { assertInsertOptionNotNull(option); return doQueryInsert(setupper, option); } /** * Update the several entities by query with varying requests non-strictly modified-only. {NonExclusiveControl} <br /> * For example, self(selfCalculationSpecification), specify(updateColumnSpecification) * , disableCommonColumnAutoSetup(), allowNonQueryUpdate(). <br /> * Other specifications are same as queryUpdate(entity, cb). * <pre> * <span style="color: #3F7E5E">// ex) you can update by self calculation values</span> * EnterpriseFavo enterpriseFavo = new EnterpriseFavo(); * <span style="color: #3F7E5E">// you don't need to set PK value</span> * <span style="color: #3F7E5E">//enterpriseFavo.setPK...(value);</span> * enterpriseFavo.setOther...(value); <span style="color: #3F7E5E">// you should set only modified columns</span> * <span style="color: #3F7E5E">// you don't need to set a value of exclusive control column</span> * <span style="color: #3F7E5E">// (auto-increment for version number is valid though non-exclusive control)</span> * <span style="color: #3F7E5E">//enterpriseFavo.setVersionNo(value);</span> * EnterpriseFavoCB cb = new EnterpriseFavoCB(); * cb.query().setFoo...(value); * UpdateOption&lt;EnterpriseFavoCB&gt; option = new UpdateOption&lt;EnterpriseFavoCB&gt;(); * option.self(new SpecifyQuery&lt;EnterpriseFavoCB&gt;() { * public void specify(EnterpriseFavoCB cb) { * cb.specify().<span style="color: #FD4747">columnFooCount()</span>; * } * }).plus(1); <span style="color: #3F7E5E">// FOO_COUNT = FOO_COUNT + 1</span> * enterpriseFavoBhv.<span style="color: #FD4747">varyingQueryUpdate</span>(enterpriseFavo, cb, option); * </pre> * @param enterpriseFavo The entity that contains update values. (NotNull) {PrimaryKeyNotRequired} * @param cb The condition-bean of EnterpriseFavo. (NotNull) * @param option The option of update for varying requests. (NotNull) * @return The updated count. * @exception org.seasar.dbflute.exception.NonQueryUpdateNotAllowedException When the query has no condition (if not allowed). */ public int varyingQueryUpdate(EnterpriseFavo enterpriseFavo, EnterpriseFavoCB cb, UpdateOption<EnterpriseFavoCB> option) { assertUpdateOptionNotNull(option); return doQueryUpdate(enterpriseFavo, cb, option); } /** * Delete the several entities by query with varying requests non-strictly. <br /> * For example, allowNonQueryDelete(). <br /> * Other specifications are same as batchUpdateNonstrict(entityList). * @param cb The condition-bean of EnterpriseFavo. (NotNull) * @param option The option of delete for varying requests. (NotNull) * @return The deleted count. * @exception org.seasar.dbflute.exception.NonQueryDeleteNotAllowedException When the query has no condition (if not allowed). */ public int varyingQueryDelete(EnterpriseFavoCB cb, DeleteOption<EnterpriseFavoCB> option) { assertDeleteOptionNotNull(option); return doQueryDelete(cb, option); } // =================================================================================== // OutsideSql // ========== /** * Prepare the basic executor of outside-SQL to execute it. <br /> * The invoker of behavior command should be not null when you call this method. * <pre> * You can use the methods for outside-SQL are as follows: * {Basic} * o selectList() * o execute() * o call() * * {Entity} * o entityHandling().selectEntity() * o entityHandling().selectEntityWithDeletedCheck() * * {Paging} * o autoPaging().selectList() * o autoPaging().selectPage() * o manualPaging().selectList() * o manualPaging().selectPage() * * {Cursor} * o cursorHandling().selectCursor() * * {Option} * o dynamicBinding().selectList() * o removeBlockComment().selectList() * o removeLineComment().selectList() * o formatSql().selectList() * </pre> * @return The basic executor of outside-SQL. (NotNull) */ public OutsideSqlBasicExecutor<EnterpriseFavoBhv> outsideSql() { return doOutsideSql(); } // =================================================================================== // Delegate Method // =============== // [Behavior Command] // ----------------------------------------------------- // Select // ------ protected int delegateSelectCountUniquely(EnterpriseFavoCB cb) { return invoke(createSelectCountCBCommand(cb, true)); } protected int delegateSelectCountPlainly(EnterpriseFavoCB cb) { return invoke(createSelectCountCBCommand(cb, false)); } protected <ENTITY extends EnterpriseFavo> void delegateSelectCursor(EnterpriseFavoCB cb, EntityRowHandler<ENTITY> erh, Class<ENTITY> et) { invoke(createSelectCursorCBCommand(cb, erh, et)); } protected <ENTITY extends EnterpriseFavo> List<ENTITY> delegateSelectList(EnterpriseFavoCB cb, Class<ENTITY> et) { return invoke(createSelectListCBCommand(cb, et)); } // ----------------------------------------------------- // Update // ------ protected int delegateInsert(EnterpriseFavo e, InsertOption<EnterpriseFavoCB> op) { if (!processBeforeInsert(e, op)) { return 0; } return invoke(createInsertEntityCommand(e, op)); } protected int delegateUpdate(EnterpriseFavo e, UpdateOption<EnterpriseFavoCB> op) { if (!processBeforeUpdate(e, op)) { return 0; } return delegateUpdateNonstrict(e, op); } protected int delegateUpdateNonstrict(EnterpriseFavo e, UpdateOption<EnterpriseFavoCB> op) { if (!processBeforeUpdate(e, op)) { return 0; } return invoke(createUpdateNonstrictEntityCommand(e, op)); } protected int delegateDelete(EnterpriseFavo e, DeleteOption<EnterpriseFavoCB> op) { if (!processBeforeDelete(e, op)) { return 0; } return delegateDeleteNonstrict(e, op); } protected int delegateDeleteNonstrict(EnterpriseFavo e, DeleteOption<EnterpriseFavoCB> op) { if (!processBeforeDelete(e, op)) { return 0; } return invoke(createDeleteNonstrictEntityCommand(e, op)); } protected int[] delegateBatchInsert(List<EnterpriseFavo> ls, InsertOption<EnterpriseFavoCB> op) { if (ls.isEmpty()) { return new int[]{}; } return invoke(createBatchInsertCommand(processBatchInternally(ls, op), op)); } protected int[] delegateBatchUpdate(List<EnterpriseFavo> ls, UpdateOption<EnterpriseFavoCB> op) { if (ls.isEmpty()) { return new int[]{}; } return delegateBatchUpdateNonstrict(ls, op); } protected int[] delegateBatchUpdateNonstrict(List<EnterpriseFavo> ls, UpdateOption<EnterpriseFavoCB> op) { if (ls.isEmpty()) { return new int[]{}; } return invoke(createBatchUpdateNonstrictCommand(processBatchInternally(ls, op, true), op)); } protected int[] delegateBatchDelete(List<EnterpriseFavo> ls, DeleteOption<EnterpriseFavoCB> op) { if (ls.isEmpty()) { return new int[]{}; } return delegateBatchDeleteNonstrict(ls, op); } protected int[] delegateBatchDeleteNonstrict(List<EnterpriseFavo> ls, DeleteOption<EnterpriseFavoCB> op) { if (ls.isEmpty()) { return new int[]{}; } return invoke(createBatchDeleteNonstrictCommand(processBatchInternally(ls, op, true), op)); } protected int delegateQueryInsert(EnterpriseFavo e, EnterpriseFavoCB inCB, ConditionBean resCB, InsertOption<EnterpriseFavoCB> op) { if (!processBeforeQueryInsert(e, inCB, resCB, op)) { return 0; } return invoke(createQueryInsertCBCommand(e, inCB, resCB, op)); } protected int delegateQueryUpdate(EnterpriseFavo e, EnterpriseFavoCB cb, UpdateOption<EnterpriseFavoCB> op) { if (!processBeforeQueryUpdate(e, cb, op)) { return 0; } return invoke(createQueryUpdateCBCommand(e, cb, op)); } protected int delegateQueryDelete(EnterpriseFavoCB cb, DeleteOption<EnterpriseFavoCB> op) { if (!processBeforeQueryDelete(cb, op)) { return 0; } return invoke(createQueryDeleteCBCommand(cb, op)); } // =================================================================================== // Optimistic Lock Info // ==================== /** * {@inheritDoc} */ @Override protected boolean hasVersionNoValue(Entity entity) { return false; } /** * {@inheritDoc} */ @Override protected boolean hasUpdateDateValue(Entity entity) { return false; } // =================================================================================== // Downcast Helper // =============== protected EnterpriseFavo downcast(Entity entity) { return helpEntityDowncastInternally(entity, EnterpriseFavo.class); } protected EnterpriseFavoCB downcast(ConditionBean cb) { return helpConditionBeanDowncastInternally(cb, EnterpriseFavoCB.class); } @SuppressWarnings("unchecked") protected List<EnterpriseFavo> downcast(List<? extends Entity> entityList) { return (List<EnterpriseFavo>)entityList; } @SuppressWarnings("unchecked") protected InsertOption<EnterpriseFavoCB> downcast(InsertOption<? extends ConditionBean> option) { return (InsertOption<EnterpriseFavoCB>)option; } @SuppressWarnings("unchecked") protected UpdateOption<EnterpriseFavoCB> downcast(UpdateOption<? extends ConditionBean> option) { return (UpdateOption<EnterpriseFavoCB>)option; } @SuppressWarnings("unchecked") protected DeleteOption<EnterpriseFavoCB> downcast(DeleteOption<? extends ConditionBean> option) { return (DeleteOption<EnterpriseFavoCB>)option; } @SuppressWarnings("unchecked") protected QueryInsertSetupper<EnterpriseFavo, EnterpriseFavoCB> downcast(QueryInsertSetupper<? extends Entity, ? extends ConditionBean> option) { return (QueryInsertSetupper<EnterpriseFavo, EnterpriseFavoCB>)option; } }
[ "yutsukimiyashita@yutsuki-Mac.local" ]
yutsukimiyashita@yutsuki-Mac.local
c2300f5a6d976ac36650ac538761b1b041b22efd
bf14ad99cce478e196e6ee8db78c7be5cda24b47
/trab1_pe/src/MC.java
73faecae21fc266272b0d50e92b34b4617c89ddc
[]
no_license
rafa9694/UFES
e947ec674e13dcc176e825250652406027d4ac3a
abf5a6c8597d8bfb531127a6a09f9f9ba60e02e1
refs/heads/master
2020-10-01T14:33:00.257339
2018-02-05T14:14:22
2018-02-05T14:14:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,876
java
import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import java.util.Random; import java.util.TreeMap; /** * * @author igor * * Markov Chain * */ public class MC { Map<String, ArrayList<Character> > cadeiaMarkov; /** * Método que constrói a estrutura da cadeia de markov * @param path * @param k */ public void structsBuild(String path, int k) { cadeiaMarkov = new HashMap<>(); String dados = readFile(path); ArrayList<Character> ref; String key = dados.substring(0,k); for(int i = k; i < dados.length();i++) { ref = cadeiaMarkov.get(key.toString()); char caracter = dados.charAt(i); if (ref == null) { ArrayList<Character> novo = new ArrayList<>(); novo.add(caracter); cadeiaMarkov.put(key.toString(), novo); }else{ ref.add(caracter); } key += caracter; key = key.substring(1); } } /** * Método para a escrita aleatória para K > 0 * @param l */ public void write(int l) { ArrayList<Character> ref; Random rn = new Random(); final int chainLimit = cadeiaMarkov.keySet().size(); int limit; String key = (String)cadeiaMarkov.keySet().toArray()[rn.nextInt(chainLimit)]; System.out.print(key); for(int count = key.length(); count < l; count++) { ref = cadeiaMarkov.get(key); if(ref == null) { key = (String) cadeiaMarkov.keySet().toArray()[rn.nextInt(chainLimit)]; ref = cadeiaMarkov.get(key); } limit = ref.size(); char value = ref.get(rn.nextInt(limit)); key += value; System.out.print(value); key = key.substring(1); } } /** * Método para a escrita aleatória para k = 0 * @param path * @param l */ public void writeNotStruct(String path,int l) { Random rn = new Random(); String dados = readFile(path); for(int i = 0; i < dados.length(); i++) { System.out.print(dados.charAt(rn.nextInt(dados.length()))); } } /** * Método que efetua a leitura do arquivo * @param path * @return */ public String readFile(String path) { try { File file = new File(path); return new String(Files.readAllBytes(file.toPath())); } catch (IOException e) { System.out.println("Erro ao ler o arquivo!"); return null; } } // Método principal para executar o algoritmo public static void main(String[] args) { if(args.length == 3) { MC mc = new MC(); int k = Integer.parseInt(args[1]); if(k > 0){ mc.structsBuild(args[0], Integer.parseInt(args[1])); mc.write(Integer.parseInt(args[2])); }else{ mc.writeNotStruct(args[0], Integer.parseInt(args[2]));} }else { System.out.println("Argumentos inválidos, tente novamente! Exemplo: java -jar writeRandom <nome do arquivo> <nivel da analise> <tamanho da saída>"); } } }
[ "igor.ventorim@gmail.com" ]
igor.ventorim@gmail.com
aeee7b2406a0ac21de5c918eae0f7c833362477c
7f2c4e6a19c86d33638a65860417a3b401bd2a7d
/src/main/java/gob/pe/proc/capaservicio/MateriaService.java
1f77c8483122f0215df0580cf259501fb17842e7
[]
no_license
kefencho/repo_sysproc
04503b026c2705e15e93a169e9759fc7186e6fa3
4eebffdc8976527fd577e7618a63f8de8f056617
refs/heads/master
2021-01-01T05:41:34.205878
2015-09-23T02:40:36
2015-09-23T02:40:36
39,363,221
0
1
null
null
null
null
UTF-8
Java
false
false
451
java
package gob.pe.proc.capaservicio; import gob.pe.proc.capadatos.Materia; import gob.pe.proc.capadatos.Naturaleza; import java.util.List; public interface MateriaService { public List<Materia> obtenerListaMateria(Materia materia); public Materia obtenerMateriaporId(Integer idMateria); public void guardarMateria(Materia materia); public void borrarMateria(Integer idMateria); public List<Naturaleza> obtenerListaNaturaleza(); }
[ "kefenchoed@gmail.com" ]
kefenchoed@gmail.com
38fb1a3617b19f10e6bd2f5154fea2c6cea3e120
e85ec3692587aae4405c5e3e2de65d43567c55ac
/Design_Pattern/src/designpatterns/command/undo/CeilingFanOffCommand.java
8040bf7d9c4af8e9013b58ad4686d5ffadc0d1c3
[]
no_license
PlumpMath/DesignPattern-826
85dd94559283362a80509fb74527eb6c79949427
46c3f76572ec9f2245416f9885cf837ee36f3b26
refs/heads/master
2021-01-20T09:42:44.715472
2016-04-03T07:46:32
2016-04-03T07:46:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
628
java
package designpatterns.command.undo; public class CeilingFanOffCommand implements Command { CeilingFan ceilingFan; int prevSpeed; public CeilingFanOffCommand(CeilingFan ceilingFan) { this.ceilingFan = ceilingFan; } @Override public void execute() { prevSpeed = ceilingFan.getSpeed(); ceilingFan.off(); } @Override public void undo() { if (prevSpeed == CeilingFan.HIGH) { ceilingFan.high(); } else if (prevSpeed == CeilingFan.MEDIUM) { ceilingFan.medium(); } else if (prevSpeed == CeilingFan.LOW) { ceilingFan.low(); } else if (prevSpeed == CeilingFan.OFF) { ceilingFan.off(); } } }
[ "shizhe.zhou@gmail.com" ]
shizhe.zhou@gmail.com
4ff3e47b227518039cdf5f91066a52485f8f0876
4cfeaf424f78a0f223b56c11d8337599422a70b3
/core/src/main/java/org/pivxj/core/TransactionBroadcast.java
dd73adcf591a3a02fb0b326c6cbbd581f51ce762
[ "Apache-2.0" ]
permissive
kodcoin/kodcoin-java
1ac8bfe54b4dfb471ea31141e0b49b7e13fae23f
6f827374f312d5c2ac4ebfc7e9513fd0cf45f862
refs/heads/master
2020-04-02T10:44:32.640240
2018-10-23T15:28:24
2018-10-23T15:28:24
150,866,917
0
0
null
null
null
null
UTF-8
Java
false
false
14,685
java
/* * Copyright 2013 Google 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 org.kodj.core; import com.google.common.annotations.*; import com.google.common.base.*; import com.google.common.util.concurrent.*; import org.kodj.utils.*; import org.kodj.wallet.Wallet; import org.slf4j.*; import javax.annotation.*; import java.util.*; import java.util.concurrent.*; import static com.google.common.base.Preconditions.checkState; import org.kodj.core.listeners.PreMessageReceivedEventListener; /** * Represents a single transaction broadcast that we are performing. A broadcast occurs after a new transaction is created * (typically by a {@link Wallet} and needs to be sent to the network. A broadcast can succeed or fail. A success is * defined as seeing the transaction be announced by peers via inv messages, thus indicating their acceptance. A failure * is defined as not reaching acceptance within a timeout period, or getting an explicit reject message from a peer * indicating that the transaction was not acceptable. */ public class TransactionBroadcast { private static final Logger log = LoggerFactory.getLogger(TransactionBroadcast.class); private final SettableFuture<Transaction> future = SettableFuture.create(); private final PeerGroup peerGroup; private final Transaction tx; private boolean isSwiftX; private int minConnections; private int numWaitingFor; /** Used for shuffling the peers before broadcast: unit tests can replace this to make themselves deterministic. */ @VisibleForTesting public static Random random = new Random(); // Tracks which nodes sent us a reject message about this broadcast, if any. Useful for debugging. private Map<Peer, RejectMessage> rejects = Collections.synchronizedMap(new HashMap<Peer, RejectMessage>()); TransactionBroadcast(PeerGroup peerGroup, Transaction tx) { this.peerGroup = peerGroup; this.tx = tx; this.minConnections = Math.max(1, peerGroup.getMinBroadcastConnections()); } TransactionBroadcast(PeerGroup peerGroup, Transaction tx,boolean isSwiftX) { this.peerGroup = peerGroup; this.tx = tx; this.isSwiftX = isSwiftX; this.minConnections = Math.max(1, peerGroup.getMinBroadcastConnections()); } // Only for mock broadcasts. private TransactionBroadcast(Transaction tx) { this.peerGroup = null; this.tx = tx; } @VisibleForTesting public static TransactionBroadcast createMockBroadcast(Transaction tx, final SettableFuture<Transaction> future) { return new TransactionBroadcast(tx) { @Override public ListenableFuture<Transaction> broadcast() { return future; } @Override public ListenableFuture<Transaction> future() { return future; } }; } public ListenableFuture<Transaction> future() { return future; } public void setMinConnections(int minConnections) { this.minConnections = minConnections; } private PreMessageReceivedEventListener rejectionListener = new PreMessageReceivedEventListener() { @Override public Message onPreMessageReceived(Peer peer, Message m) { if (m instanceof RejectMessage) { RejectMessage rejectMessage = (RejectMessage)m; if (tx.getHash().equals(rejectMessage.getRejectedObjectHash())) { rejects.put(peer, rejectMessage); int size = rejects.size(); long threshold = Math.round(numWaitingFor / 2.0); if (size > threshold) { log.warn("Threshold for considering broadcast rejected has been reached ({}/{})", size, threshold); future.setException(new RejectedTransactionException(tx, rejectMessage)); peerGroup.removePreMessageReceivedEventListener(this); } } } return m; } }; public ListenableFuture<Transaction> broadcast() { peerGroup.addPreMessageReceivedEventListener(Threading.SAME_THREAD, rejectionListener); log.info("Waiting for {} peers required for broadcast, we have {} ...", minConnections, peerGroup.getConnectedPeers().size()); peerGroup.waitForPeers(minConnections).addListener(new EnoughAvailablePeers(), Threading.SAME_THREAD); return future; } private class EnoughAvailablePeers implements Runnable { @Override public void run() { // We now have enough connected peers to send the transaction. // This can be called immediately if we already have enough. Otherwise it'll be called from a peer // thread. // We will send the tx simultaneously to half the connected peers and wait to hear back from at least half // of the other half, i.e., with 4 peers connected we will send the tx to 2 randomly chosen peers, and then // wait for it to show up on one of the other two. This will be taken as sign of network acceptance. As can // be seen, 4 peers is probably too little - it doesn't taken many broken peers for tx propagation to have // a big effect. List<Peer> peers = peerGroup.getConnectedPeers(); // snapshots // Prepare to send the transaction by adding a listener that'll be called when confidence changes. // Only bother with this if we might actually hear back: if (minConnections > 1) tx.getConfidence().addEventListener(new ConfidenceChange()); // Bitcoin Core sends an inv in this case and then lets the peer request the tx data. We just // blast out the TX here for a couple of reasons. Firstly it's simpler: in the case where we have // just a single connection we don't have to wait for getdata to be received and handled before // completing the future in the code immediately below. Secondly, it's faster. The reason the // Bitcoin Core sends an inv is privacy - it means you can't tell if the peer originated the // transaction or not. However, we are not a fully validating node and this is advertised in // our version message, as SPV nodes cannot relay it doesn't give away any additional information // to skip the inv here - we wouldn't send invs anyway. int numConnected = peers.size(); int numToBroadcastTo = (int) Math.max(1, Math.round(Math.ceil(peers.size() / 2.0))); numWaitingFor = (int) Math.ceil((peers.size() - numToBroadcastTo) / 2.0); Collections.shuffle(peers, random); peers = peers.subList(0, numToBroadcastTo); log.info("broadcastTransaction: We have {} peers, adding {} to the memory pool", numConnected, tx.getHashAsString()); log.info("Sending to {} peers, will wait for {}, sending to: {}", numToBroadcastTo, numWaitingFor, Joiner.on(",").join(peers)); Message message; // SwiftX if (isSwiftX) { // transaction lock request TransactionLockRequest transactionLockRequest = new TransactionLockRequest(tx.params, tx.payload); message = transactionLockRequest; }else { // regular tx message = tx; } for (Peer peer : peers) { try { peer.sendMessage(message); // We don't record the peer as having seen the tx in the memory pool because we want to track only // how many peers announced to us. } catch (Exception e) { log.error("Caught exception sending to {}", peer, e); } } // If we've been limited to talk to only one peer, we can't wait to hear back because the // remote peer won't tell us about transactions we just announced to it for obvious reasons. // So we just have to assume we're done, at that point. This happens when we're not given // any peer discovery source and the user just calls connectTo() once. if (minConnections == 1) { peerGroup.removePreMessageReceivedEventListener(rejectionListener); future.set(tx); } } } private int numSeemPeers; private boolean mined; private class ConfidenceChange implements TransactionConfidence.Listener { @Override public void onConfidenceChanged(TransactionConfidence conf, ChangeReason reason) { // The number of peers that announced this tx has gone up. int numSeenPeers = conf.numBroadcastPeers() + rejects.size(); boolean mined = tx.getAppearsInHashes() != null; log.info("broadcastTransaction: {}: TX {} seen by {} peers{}", reason, tx.getHashAsString(), numSeenPeers, mined ? " and mined" : ""); // Progress callback on the requested thread. invokeAndRecord(numSeenPeers, mined); if (numSeenPeers >= numWaitingFor || mined) { // We've seen the min required number of peers announce the transaction, or it was included // in a block. Normally we'd expect to see it fully propagate before it gets mined, but // it can be that a block is solved very soon after broadcast, and it's also possible that // due to version skew and changes in the relay rules our transaction is not going to // fully propagate yet can get mined anyway. // // Note that we can't wait for the current number of connected peers right now because we // could have added more peers after the broadcast took place, which means they won't // have seen the transaction. In future when peers sync up their memory pools after they // connect we could come back and change this. // // We're done! It's important that the PeerGroup lock is not held (by this thread) at this // point to avoid triggering inversions when the Future completes. log.info("broadcastTransaction: {} complete", tx.getHash()); peerGroup.removePreMessageReceivedEventListener(rejectionListener); conf.removeEventListener(this); future.set(tx); // RE-ENTRANCY POINT } } } private void invokeAndRecord(int numSeenPeers, boolean mined) { synchronized (this) { this.numSeemPeers = numSeenPeers; this.mined = mined; } invokeProgressCallback(numSeenPeers, mined); } private void invokeProgressCallback(int numSeenPeers, boolean mined) { final ProgressCallback callback; Executor executor; synchronized (this) { callback = this.callback; executor = this.progressCallbackExecutor; } if (callback != null) { final double progress = Math.min(1.0, mined ? 1.0 : numSeenPeers / (double) numWaitingFor); checkState(progress >= 0.0 && progress <= 1.0, progress); try { if (executor == null) callback.onBroadcastProgress(progress); else executor.execute(new Runnable() { @Override public void run() { callback.onBroadcastProgress(progress); } }); } catch (Throwable e) { log.error("Exception during progress callback", e); } } } ////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** An interface for receiving progress information on the propagation of the tx, from 0.0 to 1.0 */ public interface ProgressCallback { /** * onBroadcastProgress will be invoked on the provided executor when the progress of the transaction * broadcast has changed, because the transaction has been announced by another peer or because the transaction * was found inside a mined block (in this case progress will go to 1.0 immediately). Any exceptions thrown * by this callback will be logged and ignored. */ void onBroadcastProgress(double progress); } @Nullable private ProgressCallback callback; @Nullable private Executor progressCallbackExecutor; /** * Sets the given callback for receiving progress values, which will run on the user thread. See * {@link org.kodj.utils.Threading} for details. If the broadcast has already started then the callback will * be invoked immediately with the current progress. */ public void setProgressCallback(ProgressCallback callback) { setProgressCallback(callback, Threading.USER_THREAD); } /** * Sets the given callback for receiving progress values, which will run on the given executor. If the executor * is null then the callback will run on a network thread and may be invoked multiple times in parallel. You * probably want to provide your UI thread or Threading.USER_THREAD for the second parameter. If the broadcast * has already started then the callback will be invoked immediately with the current progress. */ public void setProgressCallback(ProgressCallback callback, @Nullable Executor executor) { boolean shouldInvoke; int num; boolean mined; synchronized (this) { this.callback = callback; this.progressCallbackExecutor = executor; num = this.numSeemPeers; mined = this.mined; shouldInvoke = numWaitingFor > 0; } if (shouldInvoke) invokeProgressCallback(num, mined); } }
[ "37445601+kodcoin@users.noreply.github.com" ]
37445601+kodcoin@users.noreply.github.com
92895bc67fe7cb61257a66d0beae9e1ee7181b71
ceac2e2348b3d9f1b45f5a9c93f826d82f712d7b
/RegisterService-master/src/main/java/com/im/server/dao/PersonMgtServiceDao.java
747364b98bb84da8620f4eb3b3c9b17ef75484fb
[]
no_license
jma19/IMServer
aeba9aafdaa418d0ab800dab112abef762d33a57
2658cc302b7b56cf8a0765264a7ff44ff65c9e45
refs/heads/master
2021-01-10T09:50:53.627710
2017-02-17T00:55:51
2017-02-17T00:55:51
48,745,733
0
1
null
null
null
null
UTF-8
Java
false
false
2,238
java
package com.im.server.dao; import com.im.server.mode.ClassInfo; import com.im.server.mode.GroupInfo; import com.im.server.mode.LoginResponse; import com.im.server.mode.db.Student; import com.im.server.mode.notice.ContactEntity; import org.apache.ibatis.annotations.Param; import java.util.List; /** * Created by majun on 16/3/1. */ public interface PersonMgtServiceDao { Long queryStudentPid(String phone); Long queryAssistantPid(String phone); LoginResponse queryStuInfo(Long pid); LoginResponse queryStuInfoByPhone(String phone); //根据辅导员id获取辅导员的信息 LoginResponse queryAssInfo(Long pid); LoginResponse queryAssInfoByPhone(String phone); //根据班级获取班级中的所有学生 List<ContactEntity> queryStudentsByClassIds(List<Integer> classId); //获取pid同班同学 List<ContactEntity> queryStuContactListOfSameClass(Long pid); //获取pid的同年级同学 List<ContactEntity> queryStuContactListOfSameGrade(Long pid); //获取辅导员下关联的所有学生列表 List<ContactEntity> queryStudentsByAssistantId(Long assistantId); //获取辅导员的联系班级 List<GroupInfo> queryClassInfoByAssistantId(Long assistantId); //获取pid的同年级同学 List<ContactEntity> queryStuContactListOfSameUniv(Long pid); //获取pid的同学同学 List<ContactEntity> queryStuContactListOfSameCollege(Long pid); //获取学生对应的辅导员信息 List<ContactEntity> queryAssistant(Long pid); //获取辅导员管理的所有学生 List<ContactEntity> queryStudentsByClassIds(Long assistantId); GroupInfo queryGroupInfoByStudentPid(Long pid); //获取学生所在班级的信息 ContactEntity queryGroupInfoByPid(Long pid); Student queryStudent(Long pid); //获取classId Long queryClassId(Long pid); //获取collegeId Long queryCollegeId(Long pid); //获取GradeId Long queryGradeId(Long pid); //univId Long queryUnivId(Long pid); void insertStudentHeadPicUrl(@Param("pid") Long pid, @Param("headUrl") String headUrl); void insertAssistantHeadPicUrl(@Param("pid") Long pid, @Param("headUrl") String headUrl); }
[ "zte_majun@126.com" ]
zte_majun@126.com
4d532c903876c0985a8baa668f5396a221815157
aacfcf1489e90159d95e945537428d8f60fa2f8a
/cms-core/src/main/java/com/zyj/cms/core/service/geek/aldatastruc/ds/listnode/Node.java
29ce8245ff3545fc6f8f562aa20425b3bb6bbd32
[]
no_license
zyjImmortal/cms
ebedcc52006ec5d35202b29206d5430152cd7498
378893a77512105710b26137b963868b2b650e84
refs/heads/master
2022-11-25T00:14:36.589410
2020-09-26T12:02:25
2020-09-26T12:02:25
180,135,869
0
0
null
2022-11-16T11:42:45
2019-04-08T11:37:00
Java
UTF-8
Java
false
false
525
java
package com.zyj.cms.core.service.geek.aldatastruc.ds.listnode; /** * @author : zhouyajun * @date : 2020/9/6 */ public class Node { private Object data; public Node next; public Node(Object data){ this.data = data; this.next = null; } public Node(Object data, Node next){ this.data = data; this.next = next; } public Object getData() { return data; } public Node setData(Object data) { this.data = data; return this; } }
[ "zyj866955@163.com" ]
zyj866955@163.com
fcf257d078e0382f431d66e52517682257ebca7a
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/7/7_70f592e50c3e81b6e02120a3afb8faf07320b68b/MediaSink/7_70f592e50c3e81b6e02120a3afb8faf07320b68b_MediaSink_s.java
8f5a437039ac1a3bd8fa8a2261596069568934d9
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
1,326
java
/* * Mobicents Media Gateway * * The source code contained in this file is in in the public domain. * It can be used in any project or product without prior permission, * license or royalty payments. There is NO WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR STATUTORY, INCLUDING, WITHOUT LIMITATION, * THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, * AND DATA ACCURACY. We do not warrant or make any representations * regarding the use of the software or the results thereof, including * but not limited to the correctness, accuracy, reliability or * usefulness of the software. */ package org.mobicents.media.server.spi; import org.mobicents.media.format.UnsupportedFormatException; import org.mobicents.media.protocol.PushBufferStream; /** * * @author Oleg Kulikov */ public interface MediaSink extends MediaResource { /** * Prepares this media resource. * * @param mediaStream the media stream. */ public void prepare(Endpoint endpoint, PushBufferStream mediaStream) throws UnsupportedFormatException; /** * Spllits media sink. * * @param branchID the ID of new stream * @return the new copy of the original stream. */ public PushBufferStream newBranch(String branchID); }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
fad0c80d54c270bfbee1430ee8ed5bf264a6ec4c
d1ca36ccea050f7b9660d3db8b6ea1ff9b2953c1
/dousnl-parent/dousnl-web/dousnl-web-protal/src/main/java/com/dousnl/web/activiti/TaskListenerImpl.java
eb7f7be6f49b7cdd48063199100d76bb966631a6
[]
no_license
dousnl-han/dousnl-parent
59fdf3608c28821f4331568272354ab8b3518786
7d1f82fceaa71fbbc227a035da831ba18979263b
refs/heads/master
2022-12-11T08:35:30.266097
2019-08-29T06:55:30
2019-08-29T06:55:41
148,433,046
0
0
null
2022-12-06T00:03:18
2018-09-12T06:33:49
Java
UTF-8
Java
false
false
1,050
java
package com.dousnl.web.activiti; /*package com.dousnl.web.activiti; import java.util.List; import java.util.Map; import org.activiti.engine.delegate.DelegateTask; import org.activiti.engine.delegate.TaskListener; public class TaskListenerImpl implements TaskListener{ public void notify(DelegateTask arg0) { // TODO Auto-generated method stub } *//**����ָ������İ�����*//* public void notify(DelegateTask delegateTask) { //�������ĸ�������1�Ļ�����IDΪRoleID String sql = "select * From tb_relation where intershipid='" + processDefId + "' and childCode='" + lastassignee + "'"; Dbhelper dbCourseCurrentadd = new Dbhelper(); dbCourseCurrentadd.setSql(sql.toString()); List<Map<String,Object>> listmap = dbCourseCurrentadd.findItemById(); if(listmap.size() > 0 && listmap!=null){ Map<String, Object> m = listmap.get(0); nextLevel = (String) m.get("fatherCode"); } } } */
[ "hanliang19911219@126.com" ]
hanliang19911219@126.com
3a183c90bc434d3b9e3995dc88175da4a40d7926
7a8588e119c81e5dd8f574c61fe1b5892ad1899e
/market/src/main/java/com/mmohaule/market/Stock.java
9baa652e8e8ae3096bf247eb8bf9215b8a448822
[]
no_license
mmohaule/FixMe
30cabc5e3acc9f0826bf010d416a21c3d8aad399
95e4d41a7d058b5e4fa9782e883b41877fb019c0
refs/heads/master
2020-04-01T23:03:17.302116
2018-10-30T10:06:58
2018-10-30T10:06:58
153,738,797
0
0
null
null
null
null
UTF-8
Java
false
false
689
java
package com.mmohaule.market; public class Stock { private final String tickerSymbol; private float price; private int qty; public Stock(String tickerSymbol, float price, int qty) { this.tickerSymbol = tickerSymbol; this.price = price; this.qty = qty; } public String getTickerSymbol() { return tickerSymbol; } public float getPrice() { return price; } public void setPrice(float price) { this.price = price; } public int getQty() { return qty; } public void setQty(int qty) { this.qty = qty; } }
[ "mmohaule@e4r13p10.wethinkcode.co.za" ]
mmohaule@e4r13p10.wethinkcode.co.za
1dd25754d890fd15f8fc0425b54a45fc799e16a2
1295dbde8b07818cc865a85b71f5afa117ee345c
/app/src/main/java/com/example/retrofitexample/screen/home/GithubUserAdapter.java
9139f3235f23bcb5cbd0150225cb4bd6f200f2e4
[]
no_license
trieuthan92pro/Retrofit-Example
3523bf7f59fbff4b6ffb40392fcd3cae7b69df8d
695626d1346e536708b4736a3c62e4588e59fd09
refs/heads/master
2020-04-28T04:15:56.661953
2019-03-12T05:58:08
2019-03-12T05:58:08
174,971,167
0
0
null
null
null
null
UTF-8
Java
false
false
3,087
java
package com.example.retrofitexample.screen.home; import android.content.Context; import android.databinding.DataBindingUtil; import android.support.annotation.NonNull; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.example.retrofitexample.R; import com.example.retrofitexample.data.model.Item; import com.example.retrofitexample.databinding.ItemResultBinding; import java.util.ArrayList; import java.util.List; public class GithubUserAdapter extends RecyclerView.Adapter<GithubUserAdapter.ViewHolder> { private Context mContext; private LayoutInflater mLayoutInflater; private List<Item> mItems; private OnItemClickListener mOnItemClickListener; public GithubUserAdapter(Context context, OnItemClickListener listener) { mContext = context; mLayoutInflater = LayoutInflater.from(context); mItems = new ArrayList<>(); mOnItemClickListener = listener; } @NonNull @Override public ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) { ItemResultBinding itemResultBinding = DataBindingUtil.inflate(mLayoutInflater, R.layout.item_result, viewGroup, false); return new ViewHolder(itemResultBinding, mOnItemClickListener); } @Override public void onBindViewHolder(@NonNull ViewHolder viewHolder, int i) { Item item = mItems.get(i); viewHolder.bindData(item); } @Override public int getItemCount() { return mItems == null ? 0 : mItems.size(); } public void setItems(List<Item> items) { mItems.clear(); mItems.addAll(items); notifyDataSetChanged(); } public void addItem(Item item) { mItems.add(item); notifyItemChanged(mItems.size() - 1); } public interface OnItemClickListener { void onItemClick(Item item); } public static class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { private OnItemClickListener mOnListener; private ItemResultBinding mBinding; private Item mItem; public ViewHolder(@NonNull ItemResultBinding binding) { super(binding.getRoot()); mBinding = binding; itemView.findViewById(R.id.text_name).setOnClickListener(this);; itemView.findViewById(R.id.text_id).setOnClickListener(this); itemView.findViewById(R.id.image_person_icon).setOnClickListener(this); } public ViewHolder(@NonNull ItemResultBinding binding, OnItemClickListener listener) { this(binding); mOnListener = listener; mBinding.setListener(mOnListener); } public void bindData(Item item) { setitem(item); mBinding.setItem(item); } public void setitem(Item item) { mItem = item; } @Override public void onClick(View v) { mOnListener.onItemClick(mItem); } } }
[ "trieu.van.than@framgia.com" ]
trieu.van.than@framgia.com
53e48967073a8ba21b09711abe0fadc7c579dca4
f6b90fae50ea0cd37c457994efadbd5560a5d663
/android/nut-dex2jar.src/com/nut/blehunter/ui/dn.java
387f4ab2de6a104f40d751f1bc0635c14b986cb6
[]
no_license
dykdykdyk/decompileTools
5925ae91f588fefa7c703925e4629c782174cd68
4de5c1a23f931008fa82b85046f733c1439f06cf
refs/heads/master
2020-01-27T09:56:48.099821
2016-09-14T02:47:11
2016-09-14T02:47:11
66,894,502
1
0
null
null
null
null
UTF-8
Java
false
false
468
java
package com.nut.blehunter.ui; import android.support.v4.app.s; import com.nut.blehunter.ui.b.a.d; final class dn implements d { dn(ResetPasswordActivity paramResetPasswordActivity) { } public final void a(s params, int paramInt) { this.a.setResult(-1); this.a.finish(); } } /* Location: C:\crazyd\work\ustone\odm2016031702\baidu\android\nut-dex2jar.jar * Qualified Name: com.nut.blehunter.ui.dn * JD-Core Version: 0.6.2 */
[ "819468107@qq.com" ]
819468107@qq.com
7b9a4fb33a4e6ac10d3f1fec87196bb3b43255b4
3adc99579f53ee8f56e37c4a9e9107b4438abe8f
/2.JavaCore/src/main/java/com/jr/level/level19/task1905/Solution.java
6e75049585bffbae619f22ec88d751fc49d6ee71
[]
no_license
Qventeen/JavaLearn
3fa87b7b48c968f3c3813816c524e14702786f6b
9157dae1be1c73da587457c17906bcb3a75e54ec
refs/heads/master
2023-02-04T16:24:59.982269
2020-12-18T16:17:58
2020-12-18T16:17:58
322,562,417
0
0
null
null
null
null
UTF-8
Java
false
false
2,506
java
package com.jr.level.level19.task1905; import java.util.HashMap; import java.util.Map; /* Закрепляем адаптер */ public class Solution { public static Map<String,String> countries = new HashMap<String,String>(); static { countries.put("UA","Ukraine"); countries.put("RU","Russia"); countries.put("CA","Canada"); } public static void main(String[] args) { } public static class DataAdapter implements RowItem { private Customer customer; private Contact contact; public DataAdapter(Customer customer, Contact contact) { this.customer = customer; this.contact = contact; } @Override public String getCountryCode() { for(Map.Entry<String,String> pair: countries.entrySet()){ String str = customer.getCountryName(); if(pair.getValue() == str){ return pair.getKey(); } } throw new RuntimeException("Некорректное название страны"); } @Override public String getCompany() { return customer.getCompanyName(); } @Override public String getContactFirstName() { return contact.getName().split(", ")[1]; } @Override public String getContactLastName() { return contact.getName().split(", ")[0]; } @Override public String getDialString() { StringBuffer sb = new StringBuffer("callto://+"); for(char ch: contact.getPhoneNumber().toCharArray()){ if(Character.isDigit(ch)){ sb.append(ch); } } return sb.toString(); } } public static interface RowItem { String getCountryCode(); //example UA String getCompany(); //example JR Ltd. String getContactFirstName(); //example Ivan String getContactLastName(); //example Ivanov String getDialString(); //example callto://+380501234567 } public static interface Customer { String getCompanyName(); //example JR Ltd. String getCountryName(); //example Ukraine } public static interface Contact { String getName(); //example Ivanov, Ivan String getPhoneNumber(); //example +38(050)123-45-67 } }
[ "qventeen@gmail.com" ]
qventeen@gmail.com
d767dbaa9edee18bff7a3af98322bdf7acabb528
1b36b13ad4e71deec3bfa17e0168b05118137ca1
/src/behavioralpattern/interpreterpattern/OrExpression.java
d8bbdbe55ff08f38bc12664fd8050f02cd8a5f34
[]
no_license
DarinLyn/DesignPattern
17225276b41b83cbbf5153eec35a6454b67f9d44
799bc06245d1e63a16afbf325fb911a7efa22ddb
refs/heads/master
2020-07-05T00:12:25.151869
2019-08-15T03:12:51
2019-08-15T03:12:51
202,465,595
0
0
null
null
null
null
UTF-8
Java
false
false
436
java
package behavioralpattern.interpreterpattern; public class OrExpression implements Expression { private Expression expr1 = null; private Expression expr2 = null; public OrExpression(Expression expr1, Expression expr2) { this.expr1 = expr1; this.expr2 = expr2; } @Override public boolean interpret(String context) { return expr1.interpret(context) || expr2.interpret(context); } }
[ "308416160@qq.com" ]
308416160@qq.com
0078b29848caa7c68d28a9d65de0f5d27490ea55
4c25afc17a9147c229c3df5635f106bf2ad544f1
/app/src/main/java/com/applex/trackcovid_19/models/BusModel.java
8d44f85bb34c45ee826b4e937d072841a693b3a8
[ "Apache-2.0" ]
permissive
sourajit1999/Track_COVID-19
75d98ebd7c9050b951bf8b381c83665556b7fcff
9134993a5eb8924efba4d31b7d963abf8835972c
refs/heads/master
2023-03-02T08:35:03.405570
2021-02-06T19:31:53
2021-02-06T19:31:53
251,234,695
0
0
null
null
null
null
UTF-8
Java
false
false
1,984
java
package com.applex.trackcovid_19.models; public class BusModel { String no; private String contact; String blood_group; String pincode; String depart_date; String depart_from; String arrival_date; String arrival_to; public BusModel() { } public BusModel(String contact, String blood_group, String pincode, String depart_date, String depart_from, String arrival_date, String arrival_to) { this.contact = contact; this.blood_group = blood_group; this.pincode = pincode; this.depart_date = depart_date; this.depart_from = depart_from; this.arrival_date = arrival_date; this.arrival_to = arrival_to; } public String getNo() { return no; } public void setNo(String no) { this.no = no; } public String getContact() { return contact; } public void setContact(String contact) { this.contact = contact; } public String getBlood_group() { return blood_group; } public void setBlood_group(String blood_group) { this.blood_group = blood_group; } public String getPincode() { return pincode; } public void setPincode(String pincode) { this.pincode = pincode; } public String getDepart_date() { return depart_date; } public void setDepart_date(String depart_date) { this.depart_date = depart_date; } public String getDepart_from() { return depart_from; } public void setDepart_from(String depart_from) { this.depart_from = depart_from; } public String getArrival_date() { return arrival_date; } public void setArrival_date(String arrival_date) { this.arrival_date = arrival_date; } public String getArrival_to() { return arrival_to; } public void setArrival_to(String arrival_to) { this.arrival_to = arrival_to; } }
[ "amisourajit123@gmail.com" ]
amisourajit123@gmail.com
8a47171516cde7be2f8984575efc3387e20279d2
a10c36bb4cf85c6e426b479cea2027ad26e41bfb
/src/main/java/com/bnpp/pf/config/LoggingAspectConfiguration.java
122f621cf31542df85b8884ca2479b5d4f7b4c0a
[]
no_license
JMGuicher/projet_chef_d_oeuvre
ee6addd157f863e068ae3ac5e972f511cb2e0598
e894f805af8798841a81a6c09bbe68f7447ecfaf
refs/heads/master
2020-03-28T18:41:30.218558
2018-09-15T12:55:42
2018-09-15T12:55:42
148,901,815
0
0
null
null
null
null
UTF-8
Java
false
false
484
java
package com.bnpp.pf.config; import com.bnpp.pf.aop.logging.LoggingAspect; import io.github.jhipster.config.JHipsterConstants; import org.springframework.context.annotation.*; import org.springframework.core.env.Environment; @Configuration @EnableAspectJAutoProxy public class LoggingAspectConfiguration { @Bean @Profile(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT) public LoggingAspect loggingAspect(Environment env) { return new LoggingAspect(env); } }
[ "alexandre.a.mommers@bnpparibas-pf.com" ]
alexandre.a.mommers@bnpparibas-pf.com
0298b6497299293495488b4d7245ef961295a8bc
29fb1b608219580f59b98fbe4d8446a00abfa4dd
/Test/org/spdx/rdfparser/model/TestDoapProject.java
077c553a413d1b346185f25e63e922040f942ec1
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause", "EPL-1.0", "LGPL-2.1-or-later", "EPL-2.0", "MIT", "JSON", "LGPL-2.1-only", "X11", "Apache-1.1", "MPL-1.0" ]
permissive
husainattar/tools
4191c0873e4082e41e25b62626ad2c44c157c34b
ff853b093e6797c8aaad3c98da2ef6937f5e69fe
refs/heads/master
2021-02-05T21:44:04.050175
2020-01-30T16:21:24
2020-01-30T16:21:24
243,837,271
1
0
Apache-2.0
2020-02-28T19:17:09
2020-02-28T19:17:08
null
UTF-8
Java
false
false
7,557
java
/** * Copyright (c) 2015 Source Auditor 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 org.spdx.rdfparser.model; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; import java.util.List; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.spdx.rdfparser.IModelContainer; import org.spdx.rdfparser.InvalidSPDXAnalysisException; import org.apache.jena.graph.Node; import org.apache.jena.graph.Triple; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.ModelFactory; import org.apache.jena.rdf.model.Property; import org.apache.jena.rdf.model.RDFNode; import org.apache.jena.rdf.model.Resource; import org.apache.jena.util.iterator.ExtendedIterator; /** * @author Gary O'Neall * */ public class TestDoapProject { String[] NAMES = new String[] {"Name1", "name2", "Name3"}; String[] HOMEPAGES = new String[] {null, "http://this.is.valid/also", ""}; DoapProject[] TEST_PROJECTS; Model model; IModelContainer modelContainer; /** * @throws java.lang.Exception */ @Before public void setUp() throws Exception { TEST_PROJECTS = new DoapProject[NAMES.length]; for (int i = 0; i < NAMES.length; i++) { TEST_PROJECTS[i] = new DoapProject(NAMES[i], HOMEPAGES[i]); } model = ModelFactory.createDefaultModel(); modelContainer = new ModelContainerForTest(model, "http://testnamespace.com"); } /** * @throws java.lang.Exception */ @After public void tearDown() throws Exception { } /** * Test method for {@link org.spdx.rdfparser.DoapProject#setName(java.lang.String)}. * @throws InvalidSPDXAnalysisException */ @Test public void testSetName() throws InvalidSPDXAnalysisException { Resource[] projectResources = new Resource[TEST_PROJECTS.length]; for (int i = 0; i < projectResources.length; i++) { projectResources[i] = TEST_PROJECTS[i].createResource(modelContainer); } String[] newNames = new String[NAMES.length]; for (int i = 0; i < newNames.length; i++) { newNames[i] = NAMES[i] + "New"; } for (int i = 0;i < projectResources.length; i++) { DoapProject comp = new DoapProject(modelContainer, projectResources[i].asNode()); comp.setName(newNames[i]); assertEquals(newNames[i], comp.getName()); assertEquals(TEST_PROJECTS[i].getHomePage(), comp.getHomePage()); } } /** * Test method for {@link org.spdx.rdfparser.DoapProject#setHomePage(java.lang.String)}. * @throws InvalidSPDXAnalysisException */ @Test public void testSetHomePage() throws InvalidSPDXAnalysisException { Resource[] projectResources = new Resource[TEST_PROJECTS.length]; for (int i = 0; i < projectResources.length; i++) { projectResources[i] = TEST_PROJECTS[i].createResource(modelContainer); } String[] newHomePages = new String[HOMEPAGES.length]; newHomePages[0] = null; for (int i = 1; i < newHomePages.length; i++) { newHomePages[i] = "New home page" + String.valueOf(i); } for (int i = 0;i < projectResources.length; i++) { DoapProject comp = new DoapProject(modelContainer, projectResources[i].asNode()); comp.setHomePage(newHomePages[i]); assertEquals(TEST_PROJECTS[i].getName(), comp.getName()); assertEquals(newHomePages[i], comp.getHomePage()); } } /** * Test method for {@link org.spdx.rdfparser.DoapProject#getProjectUri()}. * @throws InvalidSPDXAnalysisException */ @Test public void testGetProjectUri() throws InvalidSPDXAnalysisException { Resource[] projectResources = new Resource[TEST_PROJECTS.length]; Resource[] uriProjectResources = new Resource[TEST_PROJECTS.length]; String[] uris = new String[TEST_PROJECTS.length]; for (int i = 0; i < uris.length; i++) { uris[i] = "http://www.usefulinc.org/somethg/"+TEST_PROJECTS[i].getName(); } for (int i = 0; i < projectResources.length; i++) { projectResources[i] = TEST_PROJECTS[i].createResource(modelContainer); uriProjectResources[i] = model.createResource(uris[i]); copyProperties(projectResources[i], uriProjectResources[i]); DoapProject comp = new DoapProject(modelContainer, uriProjectResources[i].asNode()); assertEquals(TEST_PROJECTS[i].getName(), comp.getName()); assertEquals(TEST_PROJECTS[i].getHomePage(), comp.getHomePage()); assertEquals(uris[i], comp.getProjectUri()); } } /** * @param resource * @param resource2 */ private void copyProperties(Resource resource, Resource resource2) { Triple m = Triple.createMatch(resource.asNode(), null, null); ExtendedIterator<Triple> tripleIter = model.getGraph().find(m); while (tripleIter.hasNext()) { Triple t = tripleIter.next(); Property p = model.createProperty(t.getPredicate().getURI()); Node value = t.getObject(); if (value instanceof RDFNode) { RDFNode valuen = (RDFNode)value; resource2.addProperty(p, valuen); } else { resource2.addProperty(p, value.toString(false)); } } } /** * Test method for {@link org.spdx.rdfparser.DoapProject#createResource(org.apache.jena.rdf.model.Model)}. * @throws InvalidSPDXAnalysisException */ @Test public void testCreateResource() throws InvalidSPDXAnalysisException { Resource[] projectResources = new Resource[TEST_PROJECTS.length]; for (int i = 0; i < projectResources.length; i++) { projectResources[i] = TEST_PROJECTS[i].createResource(modelContainer); } for (int i = 0;i < projectResources.length; i++) { DoapProject comp = new DoapProject(modelContainer, projectResources[i].asNode()); assertEquals(TEST_PROJECTS[i].getName(), comp.getName()); assertEquals(TEST_PROJECTS[i].getHomePage(), comp.getHomePage()); } } @Test public void testVerify() throws InvalidSPDXAnalysisException { List<String> verify; for (int i = 0; i < TEST_PROJECTS.length; i++) { verify = TEST_PROJECTS[i].verify(); assertEquals(0, verify.size()); } Resource[] projectResources = new Resource[TEST_PROJECTS.length]; for (int i = 0; i < projectResources.length; i++) { projectResources[i] = TEST_PROJECTS[i].createResource(modelContainer); } for (int i = 0;i < projectResources.length; i++) { DoapProject comp = new DoapProject(modelContainer, projectResources[i].asNode()); verify = comp.verify(); assertEquals(0, verify.size()); } } @Test public void testClone() throws InvalidSPDXAnalysisException { Resource[] projectResources = new Resource[TEST_PROJECTS.length]; for (int i = 0; i < projectResources.length; i++) { projectResources[i] = TEST_PROJECTS[i].createResource(modelContainer); } for (int i = 0; i < TEST_PROJECTS.length; i++) { DoapProject clone = TEST_PROJECTS[i].clone(); if (clone.resource != null) { fail("Cloned project has a resource"); } if (TEST_PROJECTS[i].resource == null) { fail("original project does not contain a resource"); } assertEquals(TEST_PROJECTS[i].getHomePage(), clone.getHomePage()); assertEquals(TEST_PROJECTS[i].getName(), clone.getName()); assertEquals(TEST_PROJECTS[i].getProjectUri(), clone.getProjectUri()); } } }
[ "ybronshteyn@blackducksoftware.com" ]
ybronshteyn@blackducksoftware.com
3bfc702551e61e81b3da824221b43260f59ab87f
789a13833e1ec099d9a4c1afdc7294a09d0b2838
/contract_employee/src/model/services/PaypalService.java
232c5ca26ab0a646cad73e9cc812134c4e03c0e7
[]
no_license
kaique-programmer/Inicio-estudos-java
dec71965a0d2794f0ea55d5608f940c187964629
6f0c4c6b1a67f099c477b3b00f60cb49f0774d0a
refs/heads/master
2023-06-02T03:17:02.927494
2021-06-15T03:06:47
2021-06-15T03:06:47
337,569,897
0
0
null
null
null
null
UTF-8
Java
false
false
304
java
package model.services; public class PaypalService implements OnlinePaymentService{ @Override public double paymentFee(Double amount) { return amount * 0.02; } @Override public double interest(Double amount, Integer months) { return amount * 0.01 * months; } }
[ "kaiquevicio@gmail.com" ]
kaiquevicio@gmail.com
c39c952d9a8f3c85d66260e3e4df53998febdd60
142d448c9c891d783ade2bf387c42df22001f069
/Ass1/SSSP_DAG/src/constants/SsspDagConstants.java
22b9759ab4aff6298b714a35c0ffc7266dc26807
[]
no_license
harrysethi/CSL630-assignments
235be60786f74baf60b9b90325aaec1e55531c7e
fbd818eec80cd62007cfa0566207b004b8ecd8f6
refs/heads/master
2021-01-01T20:16:26.245560
2014-10-12T16:42:32
2014-10-12T16:42:32
25,125,136
1
0
null
null
null
null
UTF-8
Java
false
false
209
java
/** * */ package constants; /** * @author Harinder Sethi * */ public class SsspDagConstants { public static final int INFINITY = 1000000; public static final int NILL_PREVIOUS = -1; }
[ "sethi.harinder@gmail.com" ]
sethi.harinder@gmail.com
5b2eec686fd40dcee1c798df3bfda90cfd40757a
8cac3eeff42a6dbc6d5ab039995ae8ce084491ea
/src/main/java/pl/dawidkaszuba/glasscalc/entity/TileGroup.java
ae84d18630c417f468b55b356c20b909a213b076
[]
no_license
dawidkaszuba/glass_calc
80659036b4154c3aea61272372984f52032186b5
1db47ad95e3e3180d449f9afd469ed3f53125187
refs/heads/master
2020-05-07T15:58:31.525935
2019-05-10T11:23:23
2019-05-10T11:23:23
180,661,209
1
0
null
null
null
null
UTF-8
Java
false
false
864
java
package pl.dawidkaszuba.glasscalc.entity; import com.fasterxml.jackson.annotation.JsonIgnore; import org.hibernate.validator.constraints.NotBlank; import javax.persistence.*; import java.util.List; @Entity public class TileGroup { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @NotBlank private String name; @JsonIgnore @OneToMany(mappedBy = "group") private List<Tile> tiles; public TileGroup() { } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public List<Tile> getTiles() { return tiles; } public void setTiles(List<Tile> tiles) { this.tiles = tiles; } }
[ "d.kaszuba89@gmail.com" ]
d.kaszuba89@gmail.com
fb1d5378e83be274941f01e89bf31f54c14f9266
9017f430a13ac06cebe0ab88786faedd660605a8
/src/model/Cachaca.java
4acf9b5495a94e1a6526c299e013546b4c18dd5f
[]
no_license
cpprates/loja-bebidas
8e9201291afe4146bb9ca3b54af6d3463f06e51b
df6c914efd35fffd129d379d5074a398db0c9aa7
refs/heads/master
2022-12-25T02:40:37.027613
2020-10-06T12:02:26
2020-10-06T12:02:26
301,248,775
0
0
null
null
null
null
UTF-8
Java
false
false
1,848
java
package model; public class Cachaca extends Bebida { private String cana, barril; private double alcool; public Cachaca(String nome, String estilo, String cana, String barril, double alcool) { super(nome, estilo); this.cana = cana; this.barril = barril; this.alcool = alcool; } public double getAlcool() { return alcool; } public void setAlcool(double alcool) { this.alcool = alcool; } public String getBarril() { return barril; } public void setBarril(String barril) { this.barril = barril; } public String getCana() { return cana; } public void setCana(String cana) { this.cana = cana; } @Override public String material() { return "Cana de acúcar, água potável, fubá de milho e farelo de arroz."; } @Override public String fabricacao() { return "A cachaca " + getNome() + " estilo " + getEstilo() + " é fabricada seguindo o processo:\nMoagem, destilacao, fermentacao e envelhecimento."; } @Override public String maturacao() { return "A maturacão ocorre na etapa de envelhecimento."; } @Override public String conservacao() { return "A conservacão da cachaca " + getNome() + " estilo " + getEstilo() + "\né feita em garrafa de vidro na temperatura ambiente por até 20 anos."; } @Override public String transportacao() { return "A transportacao da cachaca " + getNome() + " estilo " + getEstilo() + "\né feita em garrafa de vidro na vertical em caixa de papelão com 6 unidades"; } @Override public String toString() { return "🍸 * " + super.toString() + " * " + cana + " * " + barril + " * " + alcool; } }
[ "cpprates18@gmail.com" ]
cpprates18@gmail.com
dc89b612150523308a000d0c973a05bec9d39c68
d6485252aa6185decf7c8048f914bb5d07d19d35
/src/com/squad22/fit/activity/SettingsActivity.java
fa41d35cb064eb7afc103a630c80565d59d69c24
[]
no_license
manfredchua/WeightRecordAndroid
0b79f2b2d8707e68299af4a2551d8adfdb1b6255
f264d00fb967c4e5e0270758ae1ca0e4f57af650
refs/heads/master
2016-08-05T17:34:25.048258
2013-12-13T07:29:16
2013-12-13T07:29:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,188
java
package com.squad22.fit.activity; import android.app.ActionBar; import android.app.Activity; import android.os.Bundle; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.widget.TextView; import com.squad22.fit.R; public class SettingsActivity extends Activity implements OnClickListener { ActionBar actionBar; TextView txtRemind; // ImageView ivMetric; // ImageView ivImperial; // RelativeLayout rlMetric; // RelativeLayout rlImperial; // TextView txtSina; // TextView txtWeChat; // TextView txtRenren; // Button btnSave; // ProfileDao dao = ProfileDao.getInstance(); // Profile profile = new Profile(); // boolean isCheck = false; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); WeightRecordApplication.getInstance().addActivity(this); setContentView(R.layout.settings_layout); actionBar = getActionBar(); actionBar.setBackgroundDrawable(getResources().getDrawable(R.drawable.barColor)); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setTitle(""); initView(); // profile = dao.getProfile(this); // // if (profile.unit != null && profile.unit.equals(Constants.IMPERIAL)) { // isCheck = true; // ivImperial.setVisibility(View.VISIBLE); // ivImperial.setImageResource(R.drawable.navigation_accept); // ivMetric.setVisibility(View.INVISIBLE); // } else { // isCheck = false; // ivMetric.setVisibility(View.VISIBLE); // ivMetric.setImageResource(R.drawable.navigation_accept); // ivImperial.setVisibility(View.INVISIBLE); // } } private void initView() { txtRemind = (TextView) findViewById(R.id.txt_remind); // ivMetric = (ImageView) findViewById(R.id.iv_metric); // ivImperial = (ImageView) findViewById(R.id.iv_imperial); // rlMetric = (RelativeLayout) findViewById(R.id.rl_metric); // rlImperial = (RelativeLayout) findViewById(R.id.rl_imperial); // // txtSina = (TextView) findViewById(R.id.txt_sina); // txtWeChat = (TextView) findViewById(R.id.txt_wechat); // txtRenren = (TextView) findViewById(R.id.txt_renren); // btnSave = (Button) findViewById(R.id.btn_save); // // btnSave.setOnClickListener(this); // rlMetric.setOnClickListener(this); // rlImperial.setOnClickListener(this); txtRemind.setOnClickListener(this); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: this.finish(); break; default: break; } return super.onOptionsItemSelected(item); } @Override public void onClick(View v) { switch (v.getId()) { // case R.id.rl_imperial: // isCheck = true; // ivImperial.setVisibility(View.VISIBLE); // ivImperial.setImageResource(R.drawable.navigation_accept); // ivMetric.setVisibility(View.INVISIBLE); // // break; // case R.id.rl_metric: // isCheck = false; // ivMetric.setVisibility(View.VISIBLE); // ivMetric.setImageResource(R.drawable.navigation_accept); // ivImperial.setVisibility(View.INVISIBLE); // // break; // case R.id.btn_save: // if (isCheck) { // formatLB(); // } else { // formatKG(); // } // break; case R.id.txt_remind: break; default: break; } } // private void formatLB() { // if (!profile.unit.equals(Constants.IMPERIAL)) { // format(profile, Constants.ft, Constants.lb, Constants.IMPERIAL); // } // } // // private void formatKG() { // if (!profile.unit.equals(Constants.METRIC)) { // format(profile, Constants.m, Constants.kg, Constants.METRIC); // } // } // private void format(Profile profile, double convertHeight, // double convertWeight, String unit) { // profile.height = profile.height * convertHeight; // profile.weight = profile.weight * convertWeight; // profile.unit = unit; // // int rowId = dao.updateProfile(this, profile); // if (rowId > 0) { // Intent intent = new Intent(this, MainActivity.class); // startActivity(intent); // WeightRecordApplication.getInstance().exit(); // Log.i("FormatKG", "单位转换成kg/m"); // } // } }
[ "mcyj26@gmail.com" ]
mcyj26@gmail.com
3b7a72f50848d8a9d3deb9ea4b676569cd550e52
c156bf50086becbca180f9c1c9fbfcef7f5dc42c
/src/main/java/com/waterelephant/utils/JsonDataProcessorImpl.java
6ecabf150254f509a6ddaf5d81df456ed8355104
[]
no_license
zhanght86/beadwalletloanapp
9e3def26370efd327dade99694006a6e8b18a48f
66d0ae7b0861f40a75b8228e3a3b67009a1cf7b8
refs/heads/master
2020-12-02T15:01:55.982023
2019-11-20T09:27:24
2019-11-20T09:27:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,740
java
/****************************************************************************** * Copyright (C) 2016 Wuhan Water Elephant Co.Ltd All Rights Reserved. * 本软件为武汉水象科技有限公司开发研制。 未经本公司正式书面同意,其他任何个人、 * 团体不得使用、复制、修改或发布本软件. *****************************************************************************/ package com.waterelephant.utils; import java.text.SimpleDateFormat; import java.util.Date; import net.sf.json.JsonConfig; import net.sf.json.processors.JsonValueProcessor; /** * * * Module: * * JsonDataProcessorImpl.java * * @author 程盼 * @since JDK 1.8 * @version 1.0 * @description: <描述> */ public class JsonDataProcessorImpl implements JsonValueProcessor { private String format = "yyyy-MM-dd HH:mm:ss"; public JsonDataProcessorImpl() { super(); } public JsonDataProcessorImpl(String format) { super(); this.format = format; } @Override public Object processArrayValue(Object value, JsonConfig jsonConfig) { String[] obj = {}; if (value instanceof Date[]) { SimpleDateFormat sf = new SimpleDateFormat(format); Date[] dates = (Date[]) value; obj = new String[dates.length]; for (int i = 0; i < dates.length; i++) { obj[i] = sf.format(dates[i]); } } return obj; } @Override public Object processObjectValue(String key, Object value, JsonConfig jsonConfig) { if (value instanceof java.util.Date) { String str = new SimpleDateFormat(format).format((Date) value); return str; } return null == value ? "" : value.toString(); } public String getFormat() { return format; } public void setFormat(String format) { this.format = format; } }
[ "wurenbiao@beadwallet.com" ]
wurenbiao@beadwallet.com
d6e30985336de7ee08dfcca39780b858f0261420
dcbdb8e0771fc90962683bac2009cfcef3b27960
/app/src/main/java/com/efulltech/efulleatery/adapters/RecyclerAdapterStock.java
806d946b4b6b512636105a406b699909ecd5750a
[]
no_license
JeffCorp/EfullEatery
e173d463e17fdd113b2f0a3e16f55efcc975e788
434b934e6a1bb90436708ed92dbfb4eb1c5442a8
refs/heads/master
2020-07-27T06:00:45.180996
2019-09-16T20:47:40
2019-09-16T20:47:40
208,894,155
1
0
null
null
null
null
UTF-8
Java
false
false
2,362
java
package com.efulltech.efulleatery.adapters; import android.content.Context; import android.support.annotation.NonNull; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import com.efulltech.efulleatery.R; import com.efulltech.efulleatery.table.models.StockItems; import java.util.List; public class RecyclerAdapterStock extends RecyclerView.Adapter<RecyclerAdapterStock.StockViewHolder> { private Context mContext; List<StockItems> stockItems; public RecyclerAdapterStock(Context mContext, List<StockItems> stockItems) { this.mContext = mContext; this.stockItems = stockItems; } @NonNull @Override public StockViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) { View view = LayoutInflater.from(mContext).inflate(R.layout.stock_container, viewGroup, false); StockViewHolder viewHolder = new StockViewHolder(view); return viewHolder; } @Override public void onBindViewHolder(@NonNull StockViewHolder stockViewHolder, int position) { stockViewHolder.itemName.setText(stockItems.get(position).getStock_item_name()); stockViewHolder.price.setText(stockItems.get(position).getStock_price()); stockViewHolder.s_quantity.setText(stockItems.get(position).getStock_start_quantity()); stockViewHolder.c_quantity.setText(stockItems.get(position).getStock_current_quantity()); stockViewHolder.category.setText(stockItems.get(position).getStock_category()); } @Override public int getItemCount() { return stockItems.size(); } public static class StockViewHolder extends RecyclerView.ViewHolder{ TextView itemName, price, s_quantity, c_quantity, category; public StockViewHolder(@NonNull View itemView) { super(itemView); itemName = (TextView) itemView.findViewById(R.id.stock_item_name); price = (TextView) itemView.findViewById(R.id.stock_price); s_quantity = (TextView) itemView.findViewById(R.id.stock_start_quantity); c_quantity = (TextView) itemView.findViewById(R.id.stock_current_quantity); category = (TextView) itemView.findViewById(R.id.stock_item_category); } } }
[ "patrickjuniorukutegbe@rocketmail.com" ]
patrickjuniorukutegbe@rocketmail.com
8b81d1376460ab0af56b7c6b98086abbd710171b
b5a20a656744436ad9b30ef9a77ab3ac20b44ac8
/src/com/crm/controller/ProductController.java
c653aabba4c5889074df2f543591d2e94ea621f6
[]
no_license
clementbwkim/CRM_Project
d2977c6c3d54322ec1972791fc7afbcb2cb27fed
ae702adfe16c67a9ac84e9cd7356adbaf6b91abd
refs/heads/master
2021-05-25T08:36:35.476741
2020-05-16T14:31:59
2020-05-16T14:31:59
253,743,528
0
0
null
null
null
null
UTF-8
Java
false
false
1,399
java
package com.crm.controller; import org.apache.log4j.Logger; 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.servlet.ModelAndView; import com.crm.service.ProductService; @Controller @RequestMapping("/product") public class ProductController { private static final String PATH = "product"; Logger logger = Logger.getLogger(ProductController.class); @Autowired private ProductService productService; /*list*/ @RequestMapping("/productList") public ModelAndView productList(ModelAndView mav){ logger.info("ProductController.productList >>> start"); mav.addObject("list", productService.productList()); mav.setViewName(PATH + "/productList"); return mav; }// productList() /*search*/ @RequestMapping("/productSearch") public ModelAndView productSearch(@RequestParam(required = false) String productName, ModelAndView mav){ logger.info("ProductController.productSearch >>> start"); logger.info("ProductController.productSearch >>> param : productName = " + productName); mav.addObject("list", productService.productSearch(productName)); mav.setViewName(PATH + "/productList"); return mav; }// productSearch() }// ProductController class
[ "60060205+clementbwkim@users.noreply.github.com" ]
60060205+clementbwkim@users.noreply.github.com
492990455c353b26d48daa7baf72f32a1dfeebb3
3937b2060c529ec59ef7e4776677eff65c30d9f0
/src/main/java/com/codekata/football/FootballMinimizer.java
495cf6cca54728a040487757d28aeb6d31f63ab4
[]
no_license
phifert/kingland-code-kata
e717fdd46eb49cc961530ff5463cd6c02af7df55
03691273c7910cbc2ac3eaa1de312166a6b6100d
refs/heads/master
2023-01-30T21:55:42.428734
2020-12-07T04:52:34
2020-12-07T04:52:34
319,206,254
0
0
null
null
null
null
UTF-8
Java
false
false
1,369
java
package com.codekata.football; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; import static java.lang.Integer.parseInt; import static java.nio.charset.StandardCharsets.UTF_8; import static java.util.Objects.requireNonNull; public class FootballMinimizer { public List<String> readAllLines(String fileName) { List<String> result = new ArrayList<>(); try (BufferedReader br = new BufferedReader( new InputStreamReader( requireNonNull(getClass().getClassLoader().getResourceAsStream(fileName)), UTF_8)) ) { br.lines().skip(1).forEach(result::add); } catch (IOException e) { e.printStackTrace(); } return result; } public List<FootballRow> convertStringRowsToFootballRows(List<String> rowsData) { List<FootballRow> footballRows = new ArrayList<>(); rowsData.forEach(row -> { String[] columns = row.trim().split("\\s+"); if (columns.length == 10) { footballRows.add(new FootballRow( columns[1], parseInt(columns[6]), parseInt(columns[8])) ); } }); return footballRows; } }
[ "tim.phifer@gmail.com" ]
tim.phifer@gmail.com
a7afdf01bf4ea0be384537ade99dcf6a97b129f9
c8ab794382f39018e0e4027e2a9b1c0a8a1825d4
/config-server/src/test/java/cn/rpm/config/server/ConfigServerApplicationTests.java
f56dfe28e7ac61cb0dc734eaa813eb096ff1e949
[]
no_license
rpm-cc/springcloud-practice
c0bb617a08c6e2a49dda5076a3e8b11059b8aa5a
e82eaf1a7ad0c9dd2ee77bcd1740f481990ffd04
refs/heads/master
2022-11-29T13:18:45.938747
2020-07-28T05:21:36
2020-07-28T05:21:36
111,791,878
0
0
null
null
null
null
UTF-8
Java
false
false
343
java
package cn.rpm.config.server; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class ConfigServerApplicationTests { @Test public void contextLoads() { } }
[ "jhon_smith@163.com" ]
jhon_smith@163.com