blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
sequencelengths
1
1
author_id
stringlengths
0
313
22b1c7f7769f2cdd95dbd92275914833abe0225e
dbb302a1620881d73fc458ca91834edcad273cf4
/sistemaDistribuido/src/sistemaDistribuido/sistema/clienteServidor/modoUsuario/ProcesoCliente.java
c14e752d754538ce3dab7c9c13dd9f7c6642750e
[]
no_license
adrfrank/ProyectoTSOA
99384f75b22b4d92556f10aa7e2f702a3272c054
776649f8ba7e4dd666b325ab9f7e7902c39e7b48
refs/heads/master
2021-03-24T11:56:37.352398
2016-05-27T06:23:59
2016-05-27T06:23:59
58,782,010
0
0
null
null
null
null
UTF-8
Java
false
false
1,888
java
/* * Laura Teresa García López 212354614 * Sección: D05 * Practica Java #1 */ package sistemaDistribuido.sistema.clienteServidor.modoUsuario; import java.util.Arrays; import sistemaDistribuido.sistema.clienteServidor.modoMonitor.Nucleo; import sistemaDistribuido.sistema.clienteServidor.modoUsuario.Proceso; import sistemaDistribuido.util.Escribano; /** * */ public class ProcesoCliente extends Proceso{ /** * */ private int num; private String mens; private byte[] solCliente=new byte[1024]; private byte[] respCliente=new byte[1024]; public ProcesoCliente(Escribano esc){ super(esc); start(); } /** * */ public void run(){ imprimeln("Proceso cliente en ejecucion."); imprimeln("Esperando datos para continuar."); Nucleo.suspenderProceso(); imprimeln("Generando mensaje a ser enviado, llenando los campos necesarios"); Empaquetar(); Nucleo.send(248,solCliente); imprimeln("Invocando a receive."); Nucleo.receive(dameID(),respCliente); imprimeln("Procesando respuesta recibida del servidor."); Desempaquetar(); } public void Empaquetar(){ int size = mens.length(); solCliente[8]=(byte)num; solCliente[10]= (byte)size; byte[] codop = mens.getBytes(); System.arraycopy(codop, 0, solCliente, 11, size); //System.out.println(Arrays.toString(solCliente)); } public void pasameDatos(String com, String text) { if(com.equals("Crear")) num=1; if(com.equals("Eliminar")) num=2; if(com.equals("Leer")) num=3; if(com.equals("Escribir")) num=4; mens= text; } public void Desempaquetar() { String cad; cad = new String(respCliente,9,respCliente[8]); imprimeln(cad); } }
9abd522cc2541daf74d92db59a1ec07c039e5c41
f61891e610071d9a049ae1f59f315738f1d93500
/qa/jtreg/net/jini/config/TestAbstractConfiguration.java
a4588b658534641c2da3ad71470674104d93d6e8
[ "Apache-2.0", "CC-BY-SA-3.0", "MIT", "BSD-3-Clause" ]
permissive
pfirmstone/JGDMS
fd145a0f0fbcc848d0635a3ce78fae23fca5b0be
9d0d693e225286803a72d67ee750089f546b9956
refs/heads/trunk
2023-07-11T20:54:39.788096
2023-06-25T10:51:31
2023-06-25T10:51:31
49,324,039
26
4
Apache-2.0
2023-05-03T01:55:24
2016-01-09T12:47:11
HTML
UTF-8
Java
false
false
9,628
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. */ /* @test * @summary Tests the AbstractConfiguration class * @author Tim Blackman * @library ../../../unittestlib * @build UnitTestUtilities BasicTest Test * @run main TestAbstractConfiguration */ import java.math.BigInteger; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import net.jini.config.AbstractConfiguration.Primitive; import net.jini.config.AbstractConfiguration; import net.jini.config.Configuration; import net.jini.config.ConfigurationException; import net.jini.config.NoSuchEntryException; public class TestAbstractConfiguration extends UnitTestUtilities { static List tests = new ArrayList(); public static void main(String[] args) { test(tests); } /* -- Test Primitive constructor and getValue method -- */ static { tests.add(TestPrimitive.localtests); } public static class TestPrimitive extends BasicTest { static Test[] localtests = { new TestPrimitive(null, new NullPointerException( "value is not a primitive: null")), new TestPrimitive(new BigInteger("33"), new IllegalArgumentException( "value is not a primitive: 33")), new TestPrimitive(new Integer(3), new Integer(3)) }; private final Object value; public static void main(String[] args) { test(localtests); } TestPrimitive(Object value, Object result) { super(String.valueOf(value), result); this.value = value; } public Object run() { try { return new Primitive(value); } catch (Exception e) { return e; } } public void check(Object result) { Object compareTo = getCompareTo(); if ((result instanceof Primitive && safeEquals(((Primitive) result).getValue(), compareTo)) || (compareTo instanceof Throwable && result instanceof Throwable && safeEquals(((Throwable) compareTo).getMessage(), ((Throwable) result).getMessage()))) { return; } throw new FailedException("Should be: " + compareTo); } } /* -- Test Primitive.equals and hashCode -- */ static { tests.add(TestPrimitiveEquals.localtests); } public static class TestPrimitiveEquals extends BasicTest { static Test[] localtests = { new TestPrimitiveEquals(new Primitive(new Integer(3)), new Primitive(new Integer(3)), true), new TestPrimitiveEquals(new Primitive(new Integer(3)), new Primitive(new Integer(4)), false), new TestPrimitiveEquals(new Primitive(new Integer(3)), new Primitive(new Short((short) 3)), false), new TestPrimitiveEquals(new Primitive(new Integer(3)), new Integer(3), false), new TestPrimitiveEquals(new Primitive(new Integer(3)), null, false) }; private final Object x; private final Object y; public static void main(String[] args) { test(localtests); } TestPrimitiveEquals(Object x, Object y, boolean result) { super(x + ", " + y, Boolean.valueOf(result)); this.x = x; this.y = y; } public Object run() { return Boolean.valueOf(x == null ? y == null : x.equals(y)); } public void check(Object result) throws Exception { super.check(result); super.check(Boolean.valueOf(y == null ? x == null : y.equals(x))); Object compareTo = getCompareTo(); if (Boolean.TRUE.equals(compareTo) && x.hashCode() != y.hashCode()) { throw new FailedException("Hash codes differ"); } } } /* -- Test getEntry of AbstractConfiguration subclass -- */ static { tests.add(TestGetEntry.localtests); } public static class TestGetEntry extends BasicTest { static Test[] localtests = { new TestGetEntry("", "a", Object.class, IllegalArgumentException.class), new TestGetEntry("a", "b.c", Object.class, IllegalArgumentException.class), new TestGetEntry("a", "b", Integer.TYPE, new Long(3), IllegalArgumentException.class), new TestGetEntry("nope", "intEntry", Object.class, NoSuchEntryException.class), new TestGetEntry("comp", "nope", Object.class, NoSuchEntryException.class), new TestGetEntry("comp", "intEntry", Object.class, ConfigurationException.class), new TestGetEntry("comp", "intEntry", Integer.class, ConfigurationException.class), new TestGetEntry("comp", "booleanEntry", Object.class, ConfigurationException.class), new TestGetEntry("comp", "booleanEntry", Integer.class, ConfigurationException.class), new TestGetEntry("comp", "booleanEntry", Integer.TYPE, ConfigurationException.class), new TestGetEntry("comp", "intEntry", Boolean.TYPE, ConfigurationException.class), new TestGetEntry("comp", "MapEntry", Integer.TYPE, ConfigurationException.class), new TestGetEntry("comp", "MapEntry", Integer.class, ConfigurationException.class), new TestGetEntry("comp", "intEntry", Integer.TYPE, new Integer(33)), new TestGetEntry("comp", "charEntry", Integer.TYPE, ConfigurationException.class), new TestGetEntry("comp", "charEntry", Long.TYPE, ConfigurationException.class), new TestGetEntry("comp", "intEntry", Integer.TYPE, new Integer(50), new Integer(33)), new TestGetEntry("comp", "nope", Integer.TYPE, new Integer(50), new Integer(50)), new TestGetEntry("data", "data", Object.class, ConfigurationException.class), new TestGetEntry("data", "data", Object.class, "some default", ConfigurationException.class), new TestGetEntry("data", "data", Object.class, "some default", "some data", "some data") }; static Object[] entries = { "comp.intEntry", new Primitive(new Integer(33)), "comp.charEntry", new Primitive(new Character('a')), "comp.booleanEntry", new Primitive(Boolean.TRUE), "comp.MapEntry", new HashMap() }; static Configuration config = new AbstractConfiguration() { protected Object getEntryInternal(String component, String name, Class type, Object data) throws ConfigurationException { if (component == null || name == null || type == null) { throw new FailedException( "component, name and type should not be null"); } String full = component + '.' + name; if ("data.data".equals(full)) { if (data == NO_DATA) { throw new ConfigurationException("No data"); } return data; } for (int i = 0; i < entries.length; i += 2) { if (entries[i].equals(full)) { return (entries[i + 1]); } } throw new NoSuchEntryException("Entry not found"); } }; private final String component; private final String name; private final Class type; private final boolean hasDefault; private final Object defaultValue; private final boolean hasData; private final Object data; public static void main(String[] args) { test(localtests); } TestGetEntry(String component, String name, Class type, Object value) { this(component, name, type, false, null, false, null, value); } TestGetEntry(String component, String name, Class type, Object defaultValue, Object value) { this(component, name, type, true, defaultValue, false, null, value); } TestGetEntry(String component, String name, Class type, Object defaultValue, Object data, Object value) { this(component, name, type, true, defaultValue, true, data, value); } TestGetEntry(String component, String name, Class type, boolean hasDefault, Object defaultValue, boolean hasData, Object data, Object value) { super(component + ", " + name + ", " + type + (hasDefault ? ", " + defaultValue : "") + (hasData ? ", " + data : ""), value); this.component = component; this.name = name; this.type = type; this.hasDefault = hasDefault; this.defaultValue = defaultValue; this.hasData = hasData; this.data = data; } public Object run() { try { return hasData ? config.getEntry(component, name, type, defaultValue, data) : hasDefault ? config.getEntry(component, name, type, defaultValue) : config.getEntry(component, name, type); } catch (Exception e) { return e; } } public void check(Object result) { Object compareTo = getCompareTo(); if (safeEquals(result, compareTo) || (compareTo instanceof Class && result != null && result.getClass() == compareTo) || (compareTo instanceof Throwable && result instanceof Throwable && safeEquals(((Throwable) compareTo).getMessage(), ((Throwable) result).getMessage()))) { return; } throw new FailedException("Should be: " + compareTo); } } }
85ba8b03a9a492f9a54bbd513f851fc67f7742c3
7a7f6b290e28d9ad241382cf83d81e6efd1d1190
/src/main/java/com/chouchong/controller/webUser/WebPermissionController.java
5c6630c1cdf6569383e4e8e74b8870184997fd34
[]
no_license
zhanshilixinhao/giftcricle
a6a9fa07fdb974794cd458df9cfa1397e304e984
d95b1a49873c024253c35aea19fd13f3affc5697
refs/heads/master
2023-04-08T13:00:38.346056
2021-04-07T03:00:20
2021-04-07T03:00:20
333,344,792
0
0
null
null
null
null
UTF-8
Java
false
false
3,762
java
package com.chouchong.controller.webUser; import com.chouchong.common.PageQuery; import com.chouchong.common.Response; import com.chouchong.common.ResponseFactory; import com.chouchong.service.webUser.WebPermissionService; import com.chouchong.service.webUser.vo.RoleVo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; /** * @author yy * @date 2018/7/13 **/ @RestController @RequestMapping("manage/permission") public class WebPermissionController { @Autowired private WebPermissionService webPermissionService; /** * 获得后台角色列表 * * @param: [page 分页信息, search 查询条件] * @return: com.chouchong.common.Response * @author: yy * @Date: 2018/7/20 */ @PostMapping("roles") private Response getRoleList(PageQuery page, String search) { return webPermissionService.getRoleList(page, search); } /** * 获得所有的后台菜单 * * @param: [] * @return: com.chouchong.common.Response * @author: yy * @Date: 2018/7/20 */ @PostMapping("menus") private Response getAllMenus() { return webPermissionService.getAllMenus(); } /** * 添加后台角色 * * @param: [roleVo 角色信息] * @return: com.chouchong.common.Response * @author: yy * @Date: 2018/7/20 */ @PostMapping("addRole") private Response addRole(RoleVo roleVo) { if (roleVo == null) { return ResponseFactory.errMissingParameter(); } return webPermissionService.addRole(roleVo); } /** * 改变角色状态 * * @param: [id 角色id, status 角色状态, token] * @return: com.chouchong.common.Response * @author: yy * @Date: 2018/7/20 */ @PostMapping("status") private Response changeStatus(Integer id, Integer status, String token) { return webPermissionService.changeStatus(id, status, token); } /** * 获得角色详情 * * @param: [id 角色id] * @return: com.chouchong.common.Response * @author: yy * @Date: 2018/7/20 */ @PostMapping("detail") private Response getRoleDetail(Integer id) { return webPermissionService.getRoleDetail(id); } /** * 修改角色 * * @param: [roleVo 角色信息] * @return: com.chouchong.common.Response * @author: yy * @Date: 2018/7/20 */ @PostMapping("update") private Response updateRole(RoleVo roleVo) { return webPermissionService.updateRole(roleVo); } /** * 删除角色 * * @param: [id 角色id] * @return: com.chouchong.common.Response * @author: yy * @Date: 2018/7/20 */ @PostMapping("del") private Response delRole(Integer id) { if (id == null) { return ResponseFactory.errMissingParameter(); } return webPermissionService.delRole(id); } /** * 获得角色(除去超级管理员) * * @param: [] * @return: com.chouchong.common.Response * @author: yy * @Date: 2018/7/20 */ @PostMapping("allRole") private Response getAllRole() { return webPermissionService.getAllRole(); } /** * 获得所有的角色(包括超级管理员) * * @param: [] * @return: com.chouchong.common.Response * @author: yy * @Date: 2018/7/20 */ @PostMapping("role_list") private Response getAllRoleList() { return webPermissionService.getAllRoleList(); } }
5487e2ad2d450479636ee3c702ca2348924fa6ba
2eefc189a48af1fe8db98f8a8b4923d8a0034b95
/Jan26_6_SocketServer/src/com/kwon/ss/main/SSMain.java
ad3e55ffd332d5a31d4badb920f5dcab9f1deb20
[]
no_license
es5es5/JavaTeacher
9d4f6d4fbb84037341bfdc82774b0438df01434f
d421377280a85694f3249b263a441b3fc329d01e
refs/heads/master
2021-04-30T07:54:52.059786
2018-07-25T06:51:44
2018-07-25T06:51:44
119,358,978
0
0
null
null
null
null
UHC
Java
false
false
2,026
java
package com.kwon.ss.main; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.net.ServerSocket; import java.net.Socket; import java.util.Scanner; // socket : 실시간 데이터 전송 // server : 서비스를 제공하는 컴퓨터 // client : 서비스를 이용하는 컴퓨터 public class SSMain { public static void main(String[] args) { ServerSocket ss = null; Scanner keyboard = null; try { ss = new ServerSocket(8976); System.out.println("접속대기..."); Socket s = ss.accept(); System.out.println("상대방 입장"); keyboard = new Scanner(System.in); InputStream is = s.getInputStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); OutputStream os = s.getOutputStream(); OutputStreamWriter osw = new OutputStreamWriter(os); BufferedWriter bw = new BufferedWriter(osw); System.out.println("1. 가위"); System.out.println("2. 바위"); System.out.println("3. 보"); System.out.println("-----"); System.out.print("뭐 : "); int myHand = keyboard.nextInt(); bw.write(myHand + "\r\n"); bw.flush(); System.out.println("상대방이 생각중"); String str = br.readLine(); int enemyHand = Integer.parseInt(str); String[] hand = { "", "가위", "바위", "보" }; System.out.printf("나 : %s\n", hand[myHand]); System.out.printf("쟤 : %s\n", hand[enemyHand]); int result = myHand - enemyHand; if (result == 0) { System.out.println("비김"); } else if (result == -1 || result == 2) { System.out.println("패"); } else { System.out.println("승"); } } catch (Exception e) { e.printStackTrace(); } finally { keyboard.close(); try { ss.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } }
0efc3527a197375f09027c11ff5a103982016fa8
3ed840bef01986abc8191fb1e24c9e88b0c216e0
/src/main/java/donghwa/dao/CustbookDao.java
ce0fe22d0bcc7b91c9e1d4d06fa61ce88943b9b8
[]
no_license
rovm/FairyTale
a958655cc3931cfb1489536e4b9ac5fafe630da5
595df48f47b8c8a71543b20baed127c28f9fd1e0
refs/heads/master
2020-12-02T09:56:51.900701
2017-09-01T06:24:30
2017-09-01T06:24:30
96,663,067
0
0
null
null
null
null
UTF-8
Java
false
false
154
java
package donghwa.dao; import donghwa.domain.Custbook; public interface CustbookDao { int insert(Custbook custbook); int update(Custbook custbook); }
839b0052ca64dbe6488d9575e3bc7710769a2aa0
e00250b0400be8ac97893ea0edb2db81793c4428
/FirestoreChat/app/src/main/java/com/android/www/firestorechat/ChatRoomsAdapter.java
14c255430c8b01f551431864290bfa44f5d21eca
[]
no_license
trigal2012/Firebase
202215fda0f906db2e80e65471a64de689b28f81
455937741cdefadb5292aa9f4c52311ae8c6e67b
refs/heads/master
2020-04-17T02:22:20.928212
2019-01-17T00:13:24
2019-01-17T00:13:24
166,130,753
0
0
null
null
null
null
UTF-8
Java
false
false
1,955
java
package com.android.www.firestorechat; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import com.android.www.firestorechat.ChatRoom; import com.android.www.firestorechat.R; import java.util.List; public class ChatRoomsAdapter extends RecyclerView.Adapter<ChatRoomsAdapter.ChatRoomViewHolder> { interface OnChatRoomClickListener { void onClick(ChatRoom chatRoom); } private List<ChatRoom> chatRooms; private OnChatRoomClickListener listener; public ChatRoomsAdapter(List<ChatRoom> chatRooms, OnChatRoomClickListener listener) { this.chatRooms = chatRooms; this.listener = listener; } @Override public ChatRoomViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()).inflate( R.layout.item_chat_room, parent, false ); return new ChatRoomViewHolder(view); } @Override public void onBindViewHolder(ChatRoomViewHolder holder, int position) { holder.bind(chatRooms.get(position)); } @Override public int getItemCount() { return chatRooms.size(); } class ChatRoomViewHolder extends RecyclerView.ViewHolder { TextView name; ChatRoom chatRoom; public ChatRoomViewHolder(View itemView) { super(itemView); name = itemView.findViewById(R.id.item_chat_room_name); itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { listener.onClick(chatRoom); } }); } public void bind(ChatRoom chatRoom) { this.chatRoom = chatRoom; name.setText(chatRoom.getName()); } } }
[ "" ]
a5775ccf1f076eccd30c72da9271a88bc9a958ee
595a4a884b63e738071f4c54402118d6b3170212
/src/main/java/com/example/demo/config/auth/CustomOAuth2UserService.java
27b90251a1b312aee6a0fc57a42b2fdbe6acd48f
[]
no_license
hjun-park/spring-boot-oauth2
24454a23800b9f6641923f09a3bea916b7dff6d4
2a7f8b2579bf6ef7d83b17be3cd9122e6796edfa
refs/heads/master
2023-07-10T05:39:29.423098
2021-07-21T16:15:58
2021-07-21T16:15:58
388,174,870
0
0
null
null
null
null
UTF-8
Java
false
false
3,530
java
package com.example.demo.config.auth; import com.example.demo.config.auth.dto.OAuthAttributes; import com.example.demo.config.auth.dto.SessionUser; import com.example.demo.domain.user.User; import com.example.demo.domain.user.UserRepository; import lombok.RequiredArgsConstructor; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.oauth2.client.userinfo.DefaultOAuth2UserService; import org.springframework.security.oauth2.client.userinfo.OAuth2UserRequest; import org.springframework.security.oauth2.client.userinfo.OAuth2UserService; import org.springframework.security.oauth2.core.OAuth2AuthenticationException; import org.springframework.security.oauth2.core.user.DefaultOAuth2User; import org.springframework.security.oauth2.core.user.OAuth2User; import org.springframework.stereotype.Service; import javax.servlet.http.HttpSession; import java.util.Collections; @RequiredArgsConstructor @Service public class CustomOAuth2UserService implements OAuth2UserService<OAuth2UserRequest, OAuth2User> { private final UserRepository userRepository; private final HttpSession httpSession; @Override public OAuth2User loadUser(OAuth2UserRequest userRequest) throws OAuth2AuthenticationException { OAuth2UserService<OAuth2UserRequest, OAuth2User> delegate = new DefaultOAuth2UserService(); OAuth2User oAuth2User = delegate.loadUser(userRequest); // registerationID : 현재 로그인 진행 중인 서비스 구분하는 코드 // 지금은 구글만 사용하는 불필요한 값이지만 이후 네이버 로그인 연동 시에 // 네이버 로그인인지 구글 로그인인지 구분하기 위해 사용 String registerationId = userRequest.getClientRegistration().getRegistrationId(); // userNameAttributeName : OAuth2 로그인 진행 시 키가 되는 필드값을 이야기. ( PK와 같은 의미 ) // 구글의 경우 sub라는 기본 코드를 지원하지만 네이버나 카카오는 지원하지 않음 // 이후 네이버 로그인과 구글 로그인 동시 지원 시 사용 String userNameAttributeName = userRequest.getClientRegistration().getProviderDetails() .getUserInfoEndpoint().getUserNameAttributeName(); // OAuthAttributes : OAuth2UserService를 통해 가져온 OAuth2User의 attribute를 담을 클래스 // 이후 네이버나 다른 소셜 로그인도 OAuthAttributes 클래스 사용 OAuthAttributes attributes = OAuthAttributes. of(registerationId, userNameAttributeName, oAuth2User.getAttributes()); /* SessionUser - 세션에 사용자 정보를 저장하기 위한 Dto 클래스 - 왜 User 클래스를 쓰지 않고 새로 만들어서 쓰는지는 이후 설명 */ User user = saveOrUpdate(attributes); httpSession.setAttribute("user", new SessionUser(user)); return new DefaultOAuth2User( Collections.singleton(new SimpleGrantedAuthority(user.getRoleKey())), attributes.getAttributes(), attributes.getNameAttributeKey()); } // 구글 사용자 정보가 업데이트 되었을 때를 대비하여 update 기능도 같이 구현. // 사용자의 이름이나 프로필 사진이 변경되면 User 엔티티에도 반영 private User saveOrUpdate(OAuthAttributes attributes) { User user = userRepository.findByEmail(attributes.getEmail()) .map(entity -> entity.update(attributes.getName(), attributes.getPicture())) .orElse(attributes.toEntity()); return userRepository.save(user); } }
d3c271446b6da67826f2966376527b79bf10d0cc
91d7c49f1652749eec39a7efda3f974d814ad516
/ExpandViewsLib/src/com/expand/library/internal/view/column/TwoColumnParentAdapter.java
3e5c569f7bd1b65f36e287dd76af0e6623c496ff
[]
no_license
MrXiong/Android-Expand
b4576b0f63b2d6d893cb8002b8cef4ddbc9a2015
cfb1bf69d9fb0710825b55c3c4d231ec538e53e7
refs/heads/master
2021-01-18T04:44:12.409398
2015-11-03T05:43:14
2015-11-03T05:43:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,555
java
package com.expand.library.internal.view.column; import java.util.List; import android.content.Context; import android.util.TypedValue; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.TextView; import com.expand.library.R; import com.expand.library.internal.Model; public class TwoColumnParentAdapter extends ArrayAdapter<Model> { private Context mContext; private List<Model> mListData; private Model[] mArrayData; private int selectedPos = -1; private String selectedText = "NO_SELECTED"; private int mNormalDrawbleId; private int mSelectedDrawble; private float textSize; private OnClickListener onClickListener; private OnItemClickListener mOnItemClickListener; private OnItemIconVisibleListener mOnItemIconVisibleListener; public TwoColumnParentAdapter(Context context, List<Model> listData, int normalDrawbleId, int selectedDrawble) { super(context, R.string.app_name, listData); mContext = context; mListData = listData; mNormalDrawbleId = normalDrawbleId; mSelectedDrawble = selectedDrawble; init(); } public TwoColumnParentAdapter(Context context, Model[] arrayData, int normalDrawbleId, int selectedDrawble) { super(context, R.string.app_name, arrayData); mContext = context; mArrayData = arrayData; mNormalDrawbleId = normalDrawbleId; mSelectedDrawble = selectedDrawble; init(); } private void init() { onClickListener = new OnClickListener() { @Override public void onClick(View view) { selectedPos = (Integer) view.getTag(R.id.tag_position); setSelectedPosition(selectedPos); if (mOnItemClickListener != null) { mOnItemClickListener.onItemClick(view, selectedPos); } } }; } public void setSelectedText(final String selectText) { selectedText = selectText; } /** * 设置选中的position,并通知列表刷新 */ public void setSelectedPosition(int pos) { if (mListData != null && pos < mListData.size()) { selectedPos = pos; selectedText = mListData.get(pos).getModelName(); notifyDataSetChanged(); } else if (mArrayData != null && pos < mArrayData.length) { selectedPos = pos; selectedText = mArrayData[pos].getModelName(); notifyDataSetChanged(); } } /** * 设置选中的position,但不通知刷新 */ public void setSelectedPositionNoNotify(int pos) { selectedPos = pos; if (mListData != null && pos < mListData.size()) { selectedText = mListData.get(pos).getModelName(); }else if (mArrayData != null && pos < mArrayData.length) { selectedText = mArrayData[pos].getModelName(); } } /** * 获取选中的position */ public int getSelectedPosition() { if (mListData != null && selectedPos < mListData.size()) { return selectedPos; } if (mListData != null && selectedPos < mListData.size()) { return selectedPos; } return -1; } /** * 设置列表字体大小 */ public void setTextSize(float tSize) { textSize = tSize; } @Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder = null; if (convertView == null) { convertView = LayoutInflater.from(mContext).inflate(R.layout.choose_item, parent, false); holder = new ViewHolder(); holder.ivIcon = (ImageView) convertView.findViewById(R.id.iv_icon); holder.tvName = (TextView) convertView.findViewById(R.id.tv_name); holder.tvNumber = (TextView) convertView.findViewById(R.id.tv_number); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } if(mOnItemIconVisibleListener != null) { mOnItemIconVisibleListener.OnItemIconVisible(holder.ivIcon, position); mOnItemIconVisibleListener.OnItemRightNumVisible(holder.tvNumber, position); } convertView.setTag(R.id.tag_position, position); String mString = ""; if (mListData != null) { if (position < mListData.size()) { mString = mListData.get(position).getModelName(); } } else if (mArrayData != null) { if (position < mArrayData.length) { mString = mArrayData[position].getModelName(); } } if (mString.contains("不限")) holder.tvName.setText("不限"); else holder.tvName.setText(mString); holder.tvName.setTextSize(TypedValue.COMPLEX_UNIT_SP,textSize); if (selectedText != null && selectedText.equals(mString)) { convertView.setBackgroundResource(mSelectedDrawble); } else { convertView.setBackgroundResource(mNormalDrawbleId); } holder.tvName.setPadding(20, 0, 0, 0); convertView.setOnClickListener(onClickListener); return convertView; } static class ViewHolder { ImageView ivIcon; TextView tvName; TextView tvNumber; } public void setOnItemClickListener(OnItemClickListener l) { mOnItemClickListener = l; } /** * 重新定义菜单选项单击接口 */ public interface OnItemClickListener { public void onItemClick(View view, int position); } //itemicon显示隐藏 public void setOnItemIconVisibleListener(OnItemIconVisibleListener l) { mOnItemIconVisibleListener = l; } public interface OnItemIconVisibleListener{ public void OnItemIconVisible(ImageView view, int position); public void OnItemRightNumVisible(TextView view, int position); } }
d58d2f2b67c90b37c5d405f674ec1946798e5471
01a71a7c1e54e4ac3e0f57b9a22d0683f0d13675
/facade-pattern/src/main/java/com/itsherman/fp/shape/Circle.java
8b0cd765f49295fd299ddc014208fba73af2d125
[]
no_license
yumiaoxia/java-design-patterns
962df439e94c280bc76ed81fbee29a90997627b0
084208881c024c820ea97b109e0365343f3c0915
refs/heads/master
2020-05-04T05:10:28.557310
2019-04-02T02:06:35
2019-04-02T02:06:35
178,834,249
0
0
null
null
null
null
UTF-8
Java
false
false
216
java
package com.itsherman.fp.shape; /** * @author Sherman * created in 2019/3/27 */ public class Circle implements Shape { @Override public void draw() { System.out.println("Circle::draw"); } }
3389c30a59fd0b2d139da5b88143aa09692e099c
e124c06aa37b93502a84f8931e1e792539883b9d
/soccer_edu-src-1.5.4/soccer/common/HearData.java
0b15d82e9b15a24885cb0291a04d068dca38a8c6
[]
no_license
m-shayanshafi/FactRepositoryProjects
12d7b65505c1e0a8e0ec3577cf937a1e3d17c417
1d45d667b454064107d78213e8cd3ec795827b41
refs/heads/master
2020-06-13T12:04:53.891793
2016-12-02T11:30:49
2016-12-02T11:30:49
75,389,381
1
0
null
null
null
null
UTF-8
Java
false
false
2,936
java
/* HearData.java Copyright (C) 2001 Yu Zhang This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package soccer.common; import java.util.*; /** * Provides chat data for client. * * @author Yu Zhang */ public class HearData implements Data { /** * the current simulation step. */ public int time; /** * the side of speaker, 'l' means left team player, 'r' means right team player, * 's' means server instructions(to be implemented). */ public char side; /** * the speaker's player number */ public int id; /** * the message. */ public String message; /** * Constructs an empty HearData for reading from an UDP packet. */ public HearData() { this.message = null; } /** * Constructs a HearData for writing to an UDP packet. * * @param time simulation step. * @param side the speaker's side. * @param id the speaker's player number. * @param String the message. */ public HearData(int time, char side, int id, String message) { this.time = time; this.side = side; this.id = id; this.message = message; } // Load its data content from a string. public void readData(StringTokenizer st) { StringBuffer sb = new StringBuffer(); String token; // read simulation step time = Integer.parseInt(st.nextToken()); // Get the " " st.nextToken(); // Get speaker side side = st.nextToken().charAt(0); // Get the " " st.nextToken(); // Get speaker id id = Integer.parseInt(st.nextToken()); // Get the " " st.nextToken(); // Read the message token = st.nextToken(); while(token.charAt(0) != Packet.CLOSE_TOKEN) { sb.append(token); if(st.hasMoreTokens()) token = st.nextToken(); else break; } message = sb.toString(); } // Stream its data content to a string. public void writeData(StringBuffer sb) { sb.append(Packet.HEAR); sb.append(' '); sb.append(time); sb.append(' '); sb.append(side); sb.append(' '); sb.append(id); sb.append(' '); sb.append(message); } }
f055be92e4fbd2684b4cc6ce552bb92fd51800f7
3579655e7858a70561ffe338e627a33a54b4abd1
/src/main/java/org/apiminer/entities/LogType.java
d398dbf7e9d5f860c8dc34db337acdf2b62be95e
[]
no_license
hsborges/apiminer-2.0-server
8a63312676781008f09c2c9f238e597a38bf47cb
2cfa076ea24f9279dff0b10ad83d59612539325c
refs/heads/master
2021-01-01T05:42:10.691672
2014-09-22T19:25:27
2014-09-22T19:25:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
212
java
package org.apiminer.entities; public enum LogType { PAGE_REQUEST, BTN_EXAMPLE_CLICK, PATTERNS_LIST_CLICK, USAGE_PATTERN_FILTER, EXAMPLE_REQUEST, PATTERN_REQUEST, FULL_CODE_REQUEST, EXAMPLE_FEEDBACK; }
74a9f7b9fb6b33b67c1051261a7ab3695688c07e
1b100f1da3ea611f5a7e9c68484ea2a9c4ac03d9
/drools-ruleunit/src/main/java/org/drools/ruleunit/command/pmml/ApplyPmmlModelCommandExecutorImpl.java
c94665aa90ef05cb083f7350f49bef07ccb6fbd0
[ "Apache-2.0" ]
permissive
tanxujie/drools
33228fe1ff4fda4bd6097af12672774e1596bd61
fcd54a983c49bb79f50dfc479c9e13ea6fb4beaf
refs/heads/master
2021-08-28T07:38:41.043182
2021-08-05T07:44:33
2021-08-05T07:44:33
222,059,888
0
0
Apache-2.0
2019-11-16T06:55:32
2019-11-16T06:55:32
null
UTF-8
Java
false
false
9,744
java
/* * Copyright 2005 JBoss 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.drools.ruleunit.command.pmml; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; import org.drools.core.command.runtime.pmml.PmmlConstants; import org.drools.core.definitions.InternalKnowledgePackage; import org.drools.core.definitions.rule.impl.RuleImpl; import org.drools.core.impl.InternalKnowledgeBase; import org.drools.core.ruleunit.RuleUnitDescriptionRegistry; import org.drools.core.runtime.impl.ExecutionResultImpl; import org.drools.core.util.StringUtils; import org.kie.api.KieBase; import org.kie.api.pmml.OutputFieldFactory; import org.kie.api.pmml.PMML4Output; import org.kie.api.pmml.PMML4Result; import org.kie.api.pmml.PMMLRequestData; import org.kie.api.pmml.ParameterInfo; import org.kie.api.runtime.Context; import org.kie.api.runtime.KieSession; import org.kie.internal.command.RegistryContext; import org.kie.internal.ruleunit.ApplyPmmlModelCommandExecutor; import org.kie.internal.ruleunit.RuleUnitDescription; import org.drools.ruleunit.DataSource; import org.drools.ruleunit.RuleUnit; import org.drools.ruleunit.RuleUnitExecutor; public class ApplyPmmlModelCommandExecutorImpl implements ApplyPmmlModelCommandExecutor { private Class<? extends RuleUnit> getStartingRuleUnit( String startingRule, InternalKnowledgeBase ikb, List<String> possiblePackages) { RuleUnitDescriptionRegistry unitRegistry = ikb.getRuleUnitDescriptionRegistry(); Map<String, InternalKnowledgePackage> pkgs = ikb.getPackagesMap(); RuleImpl ruleImpl = null; for (String pkgName: possiblePackages) { if (pkgs.containsKey(pkgName)) { InternalKnowledgePackage pkg = pkgs.get(pkgName); ruleImpl = pkg.getRule(startingRule); if (ruleImpl != null) { RuleUnitDescription descr = unitRegistry.getDescription(ruleImpl).orElse(null); if (descr != null) { return (Class<? extends RuleUnit>) descr.getRuleUnitClass(); } } } } return null; } private List<String> calculatePossiblePackageNames(String modelId, String...knownPackageNames) { List<String> packageNames = new ArrayList<>(); String javaModelId = modelId.replaceAll("\\s",""); String capJavaModelId = StringUtils.ucFirst(javaModelId); if (knownPackageNames != null && knownPackageNames.length > 0) { for (String knownPkgName: knownPackageNames) { packageNames.add(knownPkgName + "." + javaModelId); if (!javaModelId.equals(capJavaModelId)) { packageNames.add(knownPkgName + "." + capJavaModelId); } } } String basePkgName = PmmlConstants.DEFAULT_ROOT_PACKAGE+"."+javaModelId; packageNames.add(basePkgName); if (!javaModelId.equals(capJavaModelId)) { packageNames.add(PmmlConstants.DEFAULT_ROOT_PACKAGE + "." + capJavaModelId); } return packageNames; } private <T> T castObject(Object o, Class<T> clazz) { T result = null; if (o != null && clazz != null) { result = clazz.cast(o); } return result; } @SuppressWarnings("unchecked") private <T> DataSource<T> createDataSource( RuleUnitExecutor executor, String dsName, Object o) { T object = (T) castObject(o, o.getClass()); return executor.newDataSource(dsName, object); } @SuppressWarnings("unchecked") private <T> void insertDataObject(DataSource<T> ds, Object object) { if (object == null) { throw new IllegalArgumentException("Cannot insert null object into a DataSource"); } T obj = null; try { obj = (T) object; } catch (ClassCastException ccx) { throw new IllegalArgumentException("Invalid attempt to insert a " + object.getClass().getName() + " object into a DataSource"); } ds.insert((T) object); } private KieBase lookupKieBase( RegistryContext ctx) { if (ctx == null) { return null; } KieBase kbase = ctx.lookup(KieBase.class); if (kbase == null) { KieSession session = ctx.lookup(KieSession.class); if (session != null) { kbase = session.getKieBase(); } } return kbase; } @Override public PMML4Result execute( Context context, PMMLRequestData requestData, List<Object> complexInputObjects, String packageName, boolean isMining ) { if (isjPMMLAvailableToClassLoader(getClass().getClassLoader())) { throw new IllegalStateException("Availability of jPMML module disables ApplyPmmlModelCommand execution. ApplyPmmlModelCommand requires removal of JPMML libs from classpath"); } if (requestData == null) { throw new IllegalStateException("ApplyPmmlModelCommandExecutorImpl requires request data (PMMLRequestData) to execute"); } PMML4Result resultHolder = new PMML4Result(requestData.getCorrelationId()); RegistryContext ctx = (RegistryContext) context; if (packageName == null) { packageName = (String)ctx.get("packageName"); } KieBase kbase = lookupKieBase(ctx); if (kbase == null) { resultHolder.setResultCode("ERROR-1"); } else { boolean hasUnits = ((InternalKnowledgeBase)kbase).getRuleUnitDescriptionRegistry().hasUnits(); if (!hasUnits) { resultHolder.setResultCode("ERROR-2"); } else { RuleUnitExecutor executor = RuleUnitExecutor.create().bind(kbase); DataSource<PMMLRequestData> data = executor.newDataSource("request", requestData); DataSource<PMML4Result> resultData = executor.newDataSource("results", resultHolder); if (complexInputObjects != null && !complexInputObjects.isEmpty()) { Map<String, DataSource<?>> datasources = new HashMap<>(); for (Object obj : complexInputObjects) { String dsName = "externalBean" + obj.getClass().getSimpleName(); if (datasources.containsKey(dsName)) { insertDataObject(datasources.get(dsName), obj); } else { datasources.put(dsName, createDataSource(executor, dsName, obj)); } } } executor.newDataSource("pmmlData"); if (isMining) { executor.newDataSource("childModelSegments"); executor.newDataSource("miningModelPojo"); } // Attempt to fix type issues when the unmarshaller // doesn't set the parameter's // value to an object of the correct type Collection<ParameterInfo> parms = requestData.getRequestParams(); for (ParameterInfo pi : parms) { Class<?> clazz = pi.getType(); if (!clazz.isAssignableFrom(pi.getValue().getClass())) { try { Object o = clazz.getDeclaredConstructor(pi.getValue().getClass()).newInstance(pi.getValue()); pi.setValue(o); } catch (Throwable t) { resultHolder.setResultCode("ERROR-3"); return resultHolder; } } } data.insert(requestData); resultData.insert(resultHolder); String startingRule = isMining ? "Start Mining - "+requestData.getModelName():"RuleUnitIndicator"; List<String> possibleStartingPackages = calculatePossiblePackageNames(requestData.getModelName(), packageName); Class<? extends RuleUnit> ruleUnitClass= getStartingRuleUnit(startingRule, (InternalKnowledgeBase)kbase, possibleStartingPackages); executor.run(ruleUnitClass); } } List<PMML4Output<?>> outputs = OutputFieldFactory.createOutputsFromResults(resultHolder); Optional<ExecutionResultImpl> execRes = Optional.ofNullable(ctx.lookup(ExecutionResultImpl.class)); ctx.register(PMML4Result.class, resultHolder); execRes.ifPresent(result -> { result.setResult("results", resultHolder); }); outputs.forEach(out -> { execRes.ifPresent(result -> { result.setResult(out.getName(), out); }); resultHolder.updateResultVariable(out.getName(), out); }); return resultHolder; } protected boolean isjPMMLAvailableToClassLoader(ClassLoader classLoader) { return org.kie.internal.pmml.PMMLImplementationsUtil.isjPMMLAvailableToClassLoader(classLoader); } }
6a5e43545bbe59e8f1a26d97b4cbcb986b2a227d
ed3cb95dcc590e98d09117ea0b4768df18e8f99e
/project_1_1/src/b/b/d/f/Calc_1_1_11355.java
d429b27a330139e204a107df632bcdc5a6deeb41
[]
no_license
chalstrick/bigRepo1
ac7fd5785d475b3c38f1328e370ba9a85a751cff
dad1852eef66fcec200df10083959c674fdcc55d
refs/heads/master
2016-08-11T17:59:16.079541
2015-12-18T14:26:49
2015-12-18T14:26:49
48,244,030
0
0
null
null
null
null
UTF-8
Java
false
false
134
java
package b.b.d.f; public class Calc_1_1_11355 { /** @return the sum of a and b */ public int add(int a, int b) { return a+b; } }
08514deb423ede61d898fd10ffe0db5c0a46cc21
7715156d7e8cfc98407f8db54c1b7365dae2d5ed
/src/leetcode/接雨水/Solution.java
1e0da1c1a681caae9f7aec26ac0ecbbe2b0f74c9
[]
no_license
fantasy1713/leetcode-idea
a09ba72d415c86a1c38067f14161b1d608f91336
d934e36f3b8d07faea0bc05f62358536f87f24ac
refs/heads/master
2021-01-02T06:40:09.012106
2020-02-15T13:48:47
2020-02-15T13:48:47
239,533,164
0
0
null
null
null
null
UTF-8
Java
false
false
1,871
java
package leetcode.接雨水; class Solution { public static void main(String[] args) { Solution s = new Solution(); //int[] height = {0, 1, 0, 2, 1, 0, 1, 3, 2, 1, 2, 1}; int[] height = {4,3,1,2}; System.out.println(s.trap(height)); } public int trap(int[] height) { int count = 0; if (height.length <= 2) { return 0; } int currentHeight = 0; int len = height.length; //去掉前面空白 int i = 0; for (; i <= height.length; i++) { if (height[i] > 0) { break; } } for (; i < len; i++) { currentHeight = height[i]; boolean tryAgain = false;//当出现 [4,2,3]这种前高厚低的情况,用于重试 do { //往后找,看有没有大于等于当前高度的 int gapEnd = i + 1; int tempCount = 0; boolean hasGap = false; int maxInBehind = 0; for (int j = i + 1; j < height.length; j++) { if (height[j] > maxInBehind) { maxInBehind = height[j]; } if (height[j] >= currentHeight) { hasGap = true; gapEnd = j; break; } else { tempCount += (currentHeight - height[j]); } } if (hasGap) { count += tempCount; i = gapEnd - 1; tryAgain = false; } else { currentHeight = maxInBehind; tryAgain = !tryAgain; } } while (tryAgain); } return count; } }
5597a5f07045aab992eed98706b0242d589ae9d0
23997a055a023d29199845f17a0a51422d67f13b
/kodilla-patterns/src/test/java/com/kodilla/patterns/prototype/library/LibraryTestSuite.java
c7ad13d9a1808a55298c62ec9c7ca0151c8c0e74
[]
no_license
LolaTomA/kodilla-course
31faf38103441b6ad95b54c1b50954c89a23ea61
0f98e6988151e4fc032ea20196f5b7b9a878447b
refs/heads/master
2021-01-06T12:04:58.570096
2020-04-21T10:58:55
2020-04-21T10:58:55
241,320,044
0
0
null
null
null
null
UTF-8
Java
false
false
2,336
java
package com.kodilla.patterns.prototype.library; import org.junit.Assert; import org.junit.Test; import java.time.LocalDate; public class LibraryTestSuite { @Test public void testGetBooks() { //Given Book book1 = new Book("Trip-1", "Author-1", LocalDate.of(1991,1,1)); Book book2 = new Book("Trip-2", "Author-2", LocalDate.of(1992,1,1 )); Book book3 = new Book("Trip-3", "Author-3", LocalDate.of(1993,1,1 )); Book book4 = new Book("Trip-4", "Author-4", LocalDate.of(1994,1,1 )); Book book5 = new Book("Trip-5", "Author-5", LocalDate.of(1995,1,1)); Library library = new Library("Libra-1"); library.getBooks().add(book1); library.getBooks().add(book2); library.getBooks().add(book3); library.getBooks().add(book4); library.getBooks().add(book5); System.out.println("Before removing a book the library has " + library.getBooks().size() + " books.\n" + library.toString()); //making a shallow clone of object library Library clonedLibrary = null; try { clonedLibrary = library.shallowCopy(); clonedLibrary.setName("Cloned Libra-1"); } catch (CloneNotSupportedException e) { System.out.println(e); } //making a deep copy of object library Library deepClonedLibrary = null; try { deepClonedLibrary = library.deepCopy(); deepClonedLibrary.setName("Deep cloned Libra-1"); } catch (CloneNotSupportedException e) { System.out.println(e); } //When library.getBooks().remove(book3); //Then System.out.println("After removing a book the library has " + library.getBooks().size() + " books."); System.out.println(library.toString()); System.out.println(clonedLibrary.toString()); System.out.println(deepClonedLibrary.toString()); Assert.assertEquals(4, library.getBooks().size()); Assert.assertEquals(4, clonedLibrary.getBooks().size()); Assert.assertEquals(5, deepClonedLibrary.getBooks().size()); Assert.assertEquals(clonedLibrary.getBooks(), library.getBooks()); Assert.assertNotEquals(deepClonedLibrary.getBooks(), library.getBooks()); } }
2e27f343de155a52542a818b3f5bf09ce2757fba
c73936632237299441e3696f96163c227457c450
/src/main/java/com/ilopezluna/components/KaptchaField.java
13288ad1354f970b750863925ff60f4cab57a81f
[]
no_license
ilopezluna/youtube-evidence
8de6a4a57f1052dbd0625fa609cd8e5403672535
60e5ab73cdfb5ab73305c623aad65e2ec2726c84
refs/heads/master
2021-01-18T14:13:39.339499
2013-01-02T22:24:17
2013-01-02T22:24:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,483
java
package com.ilopezluna.components; import org.apache.tapestry5.BindingConstants; import org.apache.tapestry5.ComponentResources; import org.apache.tapestry5.FieldValidator; import org.apache.tapestry5.MarkupWriter; import org.apache.tapestry5.ValidationTracker; import org.apache.tapestry5.annotations.BeginRender; import org.apache.tapestry5.annotations.Environmental; import org.apache.tapestry5.annotations.Parameter; import org.apache.tapestry5.annotations.SupportsInformalParameters; import org.apache.tapestry5.corelib.base.AbstractField; import org.apache.tapestry5.ioc.Messages; import org.apache.tapestry5.ioc.annotations.Inject; import org.apache.tapestry5.services.FieldValidatorSource; import org.apache.tapestry5.services.Request; /** * Field paired with a {@link KaptchaImage} to ensure that the user has provided * the correct value. * */ @SupportsInformalParameters public class KaptchaField extends AbstractField { /** * The image output for this field. The image will display a distorted text * string. The user must decode the distorted text and enter the same value. */ @Parameter(required = true, defaultPrefix = BindingConstants.COMPONENT) private KaptchaImage image; @Inject private Request request; @Inject private Messages messages; @Inject private ComponentResources resources; @Environmental private ValidationTracker validationTracker; @Inject private FieldValidatorSource fieldValidatorSource; @Override public boolean isRequired() { return true; } @BeginRender boolean renderTextField(MarkupWriter writer) { writer.element("input", "type", "password", "id", getClientId(), "name", getControlName(), "value", ""); resources.renderInformalParameters(writer); FieldValidator fieldValidator = fieldValidatorSource.createValidator( this, "required", null); fieldValidator.render(writer); writer.end(); return false; } @Override protected void processSubmission(String elementName) { String userValue = request.getParameter(elementName); if (image.getCaptchaText().equals(userValue)) return; validationTracker.recordError(this, messages.get("incorrect-captcha")); } }
[ "e7866390" ]
e7866390
88a3a00f503ff2b7a5ef90871db5ce2430a6271a
fe1f3431b09693ac2b69877d4e67cdcec9c59c4d
/src/NC45_TreeOrders/Main.java
12ffcf3f135be045aa42fa9280934d6c6c31a9fc
[]
no_license
WangBei2018/Leetcode
b3dd58c72239e85d5ec5f66d9ed59daa9efe96ce
0e0cfbfb417faf2b1bf559feaaf304cadc51fa43
refs/heads/master
2023-07-10T18:16:42.038261
2021-08-31T01:50:53
2021-08-31T01:50:53
375,340,675
0
0
null
null
null
null
UTF-8
Java
false
false
622
java
package NC45_TreeOrders; /** * @Author WangBei * @Date 2021/8/10 15:49 * @Description: */ public class Main { public static void main(String[] args) { Solution s = new Solution(); TreeNode node1 = new TreeNode(1); TreeNode node2 = new TreeNode(2); TreeNode node3 = new TreeNode(3); node1.left = node2; node1.right = node3; int[][] threeOrders = s.threeOrders(node1); for (int[] res : threeOrders) { for (int num : res) { System.out.print(num + " "); } System.out.println(); } } }
7716e1248e8fb62a93fad4fce91c4db66dcfa17e
ff2acbc8847ff5061f8f80066e45e813ea36d514
/codenvy-gwt-client-commons/src/main/java/com/codenvy/ide/rest/DtoUnmarshallerFactory.java
4f4f543867340a6fd4980ea6ab2d887f1b45c10e
[]
no_license
benoitf/platform-api-client-gwt
0b7584e6da45f8ece3d40b85e73fc43b8e7b01c4
06099a21a42a3553e3d6b909f07040fee60db36f
refs/heads/master
2021-01-22T17:28:16.557832
2014-05-18T12:44:06
2014-05-18T12:44:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,188
java
/* * CODENVY CONFIDENTIAL * __________________ * * [2012] - [2014] Codenvy, S.A. * All Rights Reserved. * * NOTICE: All information contained herein is, and remains * the property of Codenvy S.A. and its suppliers, * if any. The intellectual and technical concepts contained * herein are proprietary to Codenvy S.A. * and its suppliers and may be covered by U.S. and Foreign Patents, * patents in process, and are protected by trade secret or copyright law. * Dissemination of this information or reproduction of this material * is strictly forbidden unless prior written permission is obtained * from Codenvy S.A.. */ package com.codenvy.ide.rest; import com.codenvy.ide.collections.Array; import com.codenvy.ide.dto.DtoFactory; import com.google.inject.Inject; /** * Provides implementations of Unmarshallable instances to * deserialize HTTP request result or WebSocket message to DTO. * * @author Artem Zatsarynnyy */ public class DtoUnmarshallerFactory { private DtoFactory dtoFactory; @Inject public DtoUnmarshallerFactory(DtoFactory dtoFactory) { this.dtoFactory = dtoFactory; } /** * Create new instance of {@link com.codenvy.ide.rest.Unmarshallable} * to deserialize HTTP request to DTO. * * @param dtoType * type of DTO. * @return new instance of {@link com.codenvy.ide.rest.Unmarshallable} * @see com.codenvy.dto.shared.DTO */ public <T> com.codenvy.ide.rest.Unmarshallable<T> newUnmarshaller(Class<T> dtoType) { return new DtoUnmarshaller<T>(dtoType, dtoFactory); } /** * Create new instance of {@link com.codenvy.ide.rest.Unmarshallable} * to deserialize HTTP request to {@link Array} of DTO. * * @param dtoType * type of DTO * @return new instance of {@link com.codenvy.ide.rest.Unmarshallable} * @see com.codenvy.dto.shared.DTO */ public <T> com.codenvy.ide.rest.Unmarshallable<Array<T>> newArrayUnmarshaller(Class<T> dtoType) { return new DtoUnmarshaller<Array<T>>(dtoType, dtoFactory); } /** * Create new instance of {@link com.codenvy.ide.websocket.rest.Unmarshallable} * to deserialize WebSocket message to DTO. * * @param dtoType * type of DTO * @return new instance of {@link com.codenvy.ide.websocket.rest.Unmarshallable} * @see com.codenvy.dto.shared.DTO */ public <T> com.codenvy.ide.websocket.rest.Unmarshallable<T> newWSUnmarshaller(Class<T> dtoType) { return new com.codenvy.ide.websocket.rest.DtoUnmarshaller<T>(dtoType, dtoFactory); } /** * Create new instance of {@link com.codenvy.ide.websocket.rest.Unmarshallable} * to deserialize WebSocket message to {@link Array} of DTO. * * @param dtoType * type of DTO * @return new instance of {@link com.codenvy.ide.websocket.rest.Unmarshallable} * @see com.codenvy.dto.shared.DTO */ public <T> com.codenvy.ide.websocket.rest.Unmarshallable<Array<T>> newWSArrayUnmarshaller(Class<T> dtoType) { return new com.codenvy.ide.websocket.rest.DtoUnmarshaller<Array<T>>(dtoType, dtoFactory); } }
d20b30aba099f65131270abe92d4b76cef1c0ae3
0fa75b3e62c529eed5c17d1a1191c30a8ba9f164
/travaux-diriges/music-album/src/Album.java
943189a97fa758cddd3847f1a4f9686728cc0ccc
[]
no_license
lyamtorres/object-oriented-programming
665e2b07fd1f6e483953db422ff5e6bdb3ea34b7
2586b0865b958c8f9502f01ed40eebefb891f7b1
refs/heads/master
2023-01-07T00:00:41.612754
2020-11-04T10:02:42
2020-11-04T10:02:42
304,622,370
0
0
null
null
null
null
UTF-8
Java
false
false
1,090
java
import java.util.ArrayList; public class Album { private String title, author; private int year; private ArrayList<Song> songs; public Album(String title, String author, int year) { this.title = title; this.author = author; this.year = year; this.songs = new ArrayList<Song>(); } public void addSong(Song s) { songs.add(s); } public void countSongs() { songs.size(); } public String calculateInHours() { int totalDuration = 0; for(Song s : songs) { totalDuration += s.getTime().toHours(); } return totalDuration + " heures"; } public String calculateInMinutes() { int totalDuration = 0; for(Song s : songs) { totalDuration += s.getTime().toMinutes(); } return totalDuration + " minutes"; } public String calculateInSeconds() { int totalDuration = 0; for(Song s : songs) { totalDuration += s.getTime().getTotalSeconds(); } return totalDuration + " secondes"; } public String getTitle() { return title; } public String getEditor() { return author; } public int getYear() { return year; } }
7ba2b39bbba46b016a07ff89a117442f71eb4b67
9411ddb2ed020d4d630792b2da46acf311b479af
/联通版APP/.svn/pristine/8e/8e0805486445ce9ec080659e0d07781b1bd4d369.svn-base
0f416fd5dbb5bcbf6093bc41ccdfe42b6399a712
[]
no_license
zjhuang5780/microstation-android-conifg
204df0f1c2ffc01ef6dfbd5d145fbfdcc97cdedc
1ccbb384bc72a027635fd2b6be614bb49dba27b9
refs/heads/master
2021-01-14T15:13:35.386667
2020-02-24T03:49:57
2020-02-24T03:49:57
null
0
0
null
null
null
null
GB18030
Java
false
false
1,293
package com.dgm.util; import java.io.BufferedInputStream; import java.io.File; import java.io.FileOutputStream; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.URL; import android.app.ProgressDialog; import android.os.Environment; public class DownLoadManager { public static File getFileFromServer(String path, ProgressDialog pd) throws Exception{ //如果相等的话表示当前的sdcard挂载在手机上并且是可用的 if(Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)){ URL url = new URL(path); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setConnectTimeout(5000); //获取到文件的大小 pd.setMax(conn.getContentLength()); InputStream is = conn.getInputStream(); File file = new File(Environment.getExternalStorageDirectory(), "DlyApp.apk"); FileOutputStream fos = new FileOutputStream(file); BufferedInputStream bis = new BufferedInputStream(is); byte[] buffer = new byte[1024]; int len ; int total=0; while((len =bis.read(buffer))!=-1){ fos.write(buffer, 0, len); total+= len; //获取当前下载量 pd.setProgress(total); } fos.close(); bis.close(); is.close(); return file; } else{ return null; } } }
ed0d5592ebf916dfb2d20a471a03295ba4b284f8
d5b37ec583c03feaf2e3a9ef9937f3ecc12f2b8c
/CMS/hellorest-server/src/main/java/edu/neumont/csc380/hello/service/ImageExceptionMapper.java
38c431b2f30b385c53bb65cf8c129b2469cf8bf5
[]
no_license
dakotahhh/NuBay
f38fb41cd037851f8f4f034aa6f6181be831abe2
cc3a89b31abb47ff2e8a7dbe39c5bd84443359f8
refs/heads/master
2021-01-18T20:20:26.632645
2014-05-09T04:02:51
2014-05-09T04:02:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
417
java
package edu.neumont.csc380.hello.service; import javax.ws.rs.core.Response; import javax.ws.rs.ext.ExceptionMapper; import javax.ws.rs.ext.Provider; import org.springframework.stereotype.Service; @Provider @Service public class ImageExceptionMapper implements ExceptionMapper<ImageNotFoundException> { public Response toResponse(ImageNotFoundException exception) { return Response.status(404).build(); } }
f9c337ab949289613dfffe41e1680b47e3f416ef
b178c2b2a862399a6dde31fb0aa36b6491058018
/src/main/java/com/sabrouch/msscbrewery/web/server/SodaService.java
fd5c094b39c0a9ac2a790ae3840069dfc92f88d6
[]
no_license
sabri/Microservice-MSSC-Berwery
9273c3057b756b61687a14fcbc9a3c39071d8b77
7a788abc7fd301e979c47ff714213fa3ebd0baeb
refs/heads/master
2023-01-07T13:43:32.181601
2020-11-11T10:17:55
2020-11-11T10:17:55
311,155,262
0
0
null
null
null
null
UTF-8
Java
false
false
369
java
package com.sabrouch.msscbrewery.web.server; import com.sabrouch.msscbrewery.web.model.SodaDto; import java.util.UUID; /** * Created by sabrouch. * Date: 11/8/2020 */ public interface SodaService { SodaDto getSodaById(UUID id); SodaDto saveSoda(SodaDto sodaDto); void updateSoda(UUID sodaId, SodaDto sodaDto); void deleteById(UUID beerId); }
7e38cfaf082d96d77f9f0c9a707ad577b382b4ed
efc7ad5040d2c3e531e44a5af74c9cbad34df8f1
/Section05_BasicDataStructures/0506_SortingArrays/SortingArrays.java
fdd94d524e9e7fb83f40dcaebcd6ba0d0874d0a8
[]
no_license
dan134/IntroductionToJava
af7faa261908c7b3be196d97c506112b1d8f0d1e
982dd33d9090ce47d0a2145072d9f274782aa0f1
refs/heads/master
2021-09-15T16:35:30.899723
2018-06-06T20:42:29
2018-06-06T20:42:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,475
java
import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author Brian */ public class SortingArrays { public static void main(String[] args) { //there are many ways to sort an array, but one of the easiest //is to use an algorithm called 'insertion sort' //insertion sort works very similar to how you would sort //your cards in your hand if you were playing a card game. //by comparing the item to the left, the item to the right can //"slide" as far left as it needs to in order to be sorted. //for example, let's sort an array of random numbers Random r = new Random(); int[] numbers = new int[15]; for (int i = 0; i < numbers.length; i++) { numbers[i] = r.nextInt(10000); } System.out.println("Unsorted.."); for (int i : numbers) { System.out.printf("Next Number: %d\n", i); } SortArrayUsingInsertionSort(numbers); //remember, this is by reference! System.out.println("Sorted.."); for (int i : numbers) { System.out.printf("Next Number: %d\n", i); } System.out.println(Stars(30)); //of course, we don't have to re-invent the wheel: String[] lastNames = new String[10]; lastNames[0] = "Jones"; lastNames[1] = "Andrews"; lastNames[2] = "Zielinski"; lastNames[3] = "Cooper"; lastNames[4] = "Thomas"; lastNames[5] = "Stone"; lastNames[6] = "Balboa"; lastNames[7] = "Anderson"; lastNames[8] = "Polinski"; lastNames[9] = "Lochte"; Arrays.sort(lastNames); for (String s : lastNames) { System.out.printf("Next Name: %s\n", s); } System.out.println(Stars(30)); //and of course if you wanted to sort just a few, you could numbers = new int[10]; for (int i = 0; i < numbers.length; i++) { numbers[i] = r.nextInt(10000); } Arrays.sort(numbers, 3, 7); for (int i = 0; i < numbers.length; i++) { if (i > 1 && i < 9) { System.out.printf("Next Number: %d\n", numbers[i]); } } } private static void SortArrayUsingInsertionSort(int[] data) { //there is nothing to the left of [0] so we can't sort it //therefore, start at 1: for (int i = 1; i < data.length; i++) { //work in reverse from current position, sliing left //if the number to the right is larger for (int j = i; j > 0 && data[j] < data[j-1]; j--) { /* System.out.printf("%d < %d, sliding left...\n" , data[j], data[j-1]); */ int temp = data[j-1]; data[j-1] = data[j]; data[j] = temp; } } } /** * Print out a string of stars based on passed in length * @param num * @return */ public static String Stars(int num) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < num; i++) { sb.append("*"); } return sb.toString(); } }
87e386c81cf457bf3b5e0b63303e4eab50e388f2
6850455f24965f1826bbc8c8c43cf709c47de56a
/EjerciciosSelenium/src/test/java/runners/SeleniumInputRunners.java
f74900f91df1975d8395f8d5b791a757bd2b6250
[]
no_license
catherinochoa/proyectoschoucair
1ae74a57456db8ff3997e8da916afa8039bc80f9
af2d6dd6398cc63bc310e01013bf2261156ac746
refs/heads/master
2020-04-24T10:27:05.039519
2019-03-13T18:12:52
2019-03-13T18:12:52
171,894,729
0
0
null
null
null
null
UTF-8
Java
false
false
419
java
package runners; import org.junit.runner.RunWith; import cucumber.api.CucumberOptions; import cucumber.api.SnippetType; import net.serenitybdd.cucumber.CucumberWithSerenity; @RunWith(CucumberWithSerenity.class) @CucumberOptions(features = "src/test/resources/features/simple_form.feature", tags ="@EjerciciosSelenium", glue = "definitions", snippets = SnippetType.CAMELCASE) public class SeleniumInputRunners { }
19a16c295db4bc070af45d4a21b012d211dcd378
aa748fab0a74cad3bf4bc357cef13d1e92d6ecfc
/petshop/src/main/java/com/petshop/repositories/CompraRepository.java
4361981624ddfc9b85dbadae73c9c4ac6b481172
[]
no_license
michaelfarias/petshop
15455f6ae10ff7ba330ac63d141e1f4648e9b2b8
15ac796db248295a834fd2c2926fe9d35726f86e
refs/heads/master
2023-08-15T01:09:43.250911
2021-09-24T18:54:15
2021-09-24T18:54:15
395,683,794
0
0
null
null
null
null
UTF-8
Java
false
false
273
java
package com.petshop.repositories; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import com.petshop.modelo.Compra; @Repository public interface CompraRepository extends JpaRepository<Compra, Integer> { }
f4a05074935781a3cda63abdda3cadaf2e89a2cf
2214702e68546c7299b626b8b1239070bb396376
/src/com/jkkp/modules/member/view/VMemberBankCard.java
efaf706542df7351ad3132073b53e2a2999e63be
[]
no_license
KnightWind/jkkweb
55a50375a19508a490d5fbbc6b2f7fd6ad79fdcd
ac2e3f47cc07154e4fc666e1028299980f1783d2
refs/heads/master
2021-01-10T16:49:25.342698
2015-09-29T09:48:38
2015-09-29T09:48:38
43,357,602
0
0
null
null
null
null
UTF-8
Java
false
false
150
java
package com.jkkp.modules.member.view; import com.jkkp.modules.member.model.MemberBankCard; public class VMemberBankCard extends MemberBankCard { }
ef095dea08e0fcaf63f95e9b4ad9fe28c9d9536a
4178f9a1c477efd2f71cd022128b2252e1b9da53
/src/main/java/com/company/logic/Cleaner.java
20c581f26aaae9ecc963f4100ec0a181d779c477
[]
no_license
Oleksandr102/HW_15_Grandle_Maven
4a084688906d47946a52d2a49d0910d08217f1fa
77efd5762d86723989bd8a1d029840023bebe87e
refs/heads/master
2022-11-30T13:41:47.379777
2020-08-14T11:50:06
2020-08-14T11:50:06
287,130,283
0
0
null
null
null
null
UTF-8
Java
false
false
503
java
package com.company.logic; import java.util.List; import java.util.stream.Collectors; public class Cleaner { public static List<String> removeSymbols(List<String> stringList) { return stringList.stream() .map(s -> s.replace(",", "")) .map(s -> s.replace(" ", "")) .map(s -> s.replace("(", "")) .map(s -> s.replace(")", "")) .map(s -> s.replace("!", "")) .collect(Collectors.toList()); } }
1948a7889a6b58676cf0d8622dc528bad9c5cf04
d3b2afcdb4ce89be2777deb870e92839538a3464
/src/main/java/questions/question8_1/RunnableExample.java
ac5fca51d7b4de63bc608390cf95879bdd219d6e
[]
no_license
IvanGoIT/GoJava10
ac4e15868231d38b95b1cf32b1f7dabe6401d096
4f8bae239aab05c6f76174f1a4a921375b7a1d8e
refs/heads/master
2021-09-07T03:40:50.805814
2018-02-16T19:13:03
2018-02-16T19:13:03
109,876,938
2
2
null
null
null
null
UTF-8
Java
false
false
796
java
package questions.question8_1; import java.io.File; public class RunnableExample { public static void main(String[] args) { File file = new File("files/lesson1/lesson1.txt"); int a = 0; for(int i = 0; i < 1; i++) { Runnable runnable = new Runnable() { @Override public void run() { System.out.println("Exists = " + file.exists()); System.out.println(a); // a = 0; } }; Runnable runnable2 = () -> { System.out.println("Exists = " + file.exists()); System.out.println(a); // a = 0; }; runnable.run(); runnable2.run(); } } }
ca058cbba579a8c3aec45a8f1e85317b6d5a83f6
8d099656a975d836eff8d08250c1824a71cc9cd0
/backend/src/main/java/com/devsuperior/dsvendas/dto/SaleSuccessDTO.java
8452adf04341f34ed61cc6f18eaa5a04f0e4b544
[]
no_license
MardonioEng/projeto-sds3
a2099c5daefdd725d8060a3178ca7316e4145cb3
30a97449e96d0e6caf277d110da6ba3c7104226f
refs/heads/main
2023-04-16T11:40:43.429694
2021-05-06T18:29:23
2021-05-06T18:29:23
364,037,678
0
0
null
null
null
null
UTF-8
Java
false
false
853
java
package com.devsuperior.dsvendas.dto; import java.io.Serializable; import com.devsuperior.dsvendas.entities.Seller; public class SaleSuccessDTO implements Serializable{ private static final long serialVersionUID = 1L; private String sellerName; private Long visited; private Long deals; public SaleSuccessDTO() { } public SaleSuccessDTO(Seller seller, Long visited, Long deals) { sellerName = seller.getName(); this.visited = visited; this.deals = deals; } public String getSellerName() { return sellerName; } public void setSellerName(String sellerName) { this.sellerName = sellerName; } public Long getVisited() { return visited; } public void setVisited(Long visited) { this.visited = visited; } public Long getDeals() { return deals; } public void setDeals(Long deals) { this.deals = deals; } }
e55f275c4169a343eee5fc5ea36efe97d0684fdd
84277631a616aa21a797381bdb46b759f66944ae
/src/main/java/de/nullpointer/zauberei/ball/ThrownQuaffle.java
ae30b5ac657606b18d90abb112527736414c53dd
[ "Apache-2.0" ]
permissive
philipjar/DevAthlon2016
ce708d53266c9b74d88b6565cfd4ba56e32756b0
e27d66ad9c16abb228593628191d023c79c43152
refs/heads/master
2021-01-22T17:34:08.299410
2016-07-17T10:04:53
2016-07-17T10:04:53
62,640,314
1
0
null
null
null
null
UTF-8
Java
false
false
738
java
package main.java.de.nullpointer.zauberei.ball; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.Item; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; public class ThrownQuaffle { Item item; Player thrower; public ThrownQuaffle(Player thrower) { item = thrower.getWorld().dropItem(thrower.getLocation(), new ItemStack(Material.REDSTONE_BLOCK)); item.setVelocity(thrower.getLocation().getDirection().multiply(2.0D)); new ThrownQuaffleThread(this); } public Location getLocation() { return item.getLocation(); } public boolean isOnGround() { return item.isOnGround(); } public void remove() { item.remove(); } }
ff0884d3e07f7515cf9cecf5015b6c59b425901f
e89589a6d616e8303a0f980c02f03d5c6fcdc7c2
/sts-3.9.7/190607AOPbyannotation/src/main/java/greeting/GreetingServiceImpl.java
ea108853572c0d90fb4cd5cf5f7a2dc72db5a944
[ "Apache-2.0" ]
permissive
june20516/WebWorks
843c3d8dc7148f3e61889a1c8712bff85b5db6ee
01ce151c59171b23dd222100ea46b389258aee5b
refs/heads/master
2022-10-15T06:30:45.168298
2019-08-19T06:13:43
2019-08-19T06:13:43
189,910,647
0
0
Apache-2.0
2022-10-05T03:17:12
2019-06-03T00:46:19
JavaScript
UTF-8
Java
false
false
944
java
package greeting; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component(value="greetingTarget") public class GreetingServiceImpl implements GreetingService{ OutputService outputter; String greeting; public GreetingServiceImpl() { Logger logger = LoggerFactory.getLogger("GreetingServiceImpl"); logger.info("그리팅서비스임플리먼트 생성자 실행"); this.greeting = "Hello"; } @Override @Autowired public void setOutputter(OutputService outputter) { this.outputter = outputter; System.out.println("그리팅서비스임플리먼트의 메소드 setOutputter실행 : " + outputter); } @Override public void sayHello(String name) { System.out.println( this.greeting + ", "+name+" ! "); } public void setGreeting(String greeting) { this.greeting = greeting; } }
3bdb8eb95ea5425dc6d98d0962e9a9590dc17cc8
a8cff418a16906b8c637969a95c0a6436f16370b
/frontend/src/main/java/com/julio/poc/microservices/frontend/controllers/SiteController.java
1d656fc281a29fb689e2f72bd56b6888c4164685
[]
no_license
WebSpringFramework/complete-microservices-env
79e411759ca25870d14d8703db91209421e227cb
71e10666ddd8c76eb865659c8ff3520d1312bf66
refs/heads/master
2022-11-12T20:42:19.383880
2020-07-03T10:57:37
2020-07-03T10:59:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
624
java
package com.julio.poc.microservices.frontend.controllers; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import com.julio.poc.microservices.frontend.service.RoomService; import com.julio.poc.microservices.frontend.utils.Template; import lombok.RequiredArgsConstructor; @Controller @RequiredArgsConstructor public class SiteController { private final RoomService roomService; @RequestMapping("/") public String home(Model model) { model.addAttribute("rooms", roomService.findAll()); return Template.HOME; } }
46a271d55a00614d633109400c2a762027e3cebb
80111c783754c62791f7f6349fb6dae0ba5b3ab7
/fizzString2.java
437d7265cac78efbce23680c6e9ee38c90d44628
[]
no_license
Tosia95/CodingBat
8f6c3062b29598e30e65e20a53f1599be96d7d34
c9be1f5e811eb932054ee542c4bba2d9387e849d
refs/heads/master
2021-01-20T18:15:06.980310
2016-07-31T18:08:00
2016-07-31T18:08:00
62,719,649
0
0
null
null
null
null
UTF-8
Java
false
false
265
java
public String fizzString2(int n) { String res = ""; if (n % 3 == 0 && n % 5 == 0) { res = "FizzBuzz!"; } else if (n % 3 == 0) { res = "Fizz!"; } else if (n % 5 == 0) { res = "Buzz!"; } else { res = n + "!"; } return res; }
ae19019833a119d0606e1ad71ca428893d180a13
f1577a421e6ef2be03021cde396f1860bacc4793
/src/com/shopelia/android/widget/form/FormContainer.java
efb659871d6d52a449319e1ee4574d1c379efefb
[]
no_license
EpicDream/shopelia-android-sdk
3a4e3d3a100e1c0d0fd91488cf16e4bc131dacec
9679590284d345c06109b2a6bed405ea5d51f73c
refs/heads/master
2021-03-27T14:28:39.846614
2013-11-20T08:41:18
2013-11-20T08:41:18
9,492,614
0
0
null
null
null
null
UTF-8
Java
false
false
1,254
java
package com.shopelia.android.widget.form; import org.json.JSONObject; import android.content.Intent; import android.os.Bundle; public interface FormContainer { /** * The string used as a separator in JsonPath returned by * {@link Field#getJsonPath()} */ public static final String PATH_SEPARATOR = "."; /** * The string used to represent an array entry. This should be put a t the * end of the path sequence. */ public static final String ARRAY_INDICATOR = "#"; public void updateSections(); public void requestFocus(FormField field); public boolean nextField(FormField fromField); public void onActivityResult(int requestCode, int resultCode, Intent data); public void onCreate(Bundle savedInstanceState); public void onSaveInstanceState(Bundle outState); public int indexOf(FormField field); public boolean validate(); public JSONObject toJson(); public FormField findFieldByPath(String... path); public boolean removeField(int id); public boolean removeField(FormField field); public void setOnSubmitListener(OnSubmitListener l); public interface OnSubmitListener { public void onSubmit(FormContainer container); } }
41c1b589d69c3b59cde025afb008c0aac95b29ea
2219a1cafeded237833980ec2c2a6d7ec87662b9
/af-lc/af-lc-core/src/main/java/com/yeepay/fpay/rro/response/package-info.java
7d5f3aca6a33b4b16b3b19e4c033308cb23d0bc7
[ "MIT" ]
permissive
liufeiit/tulip
cac93dc7e30626ed6a9710e41d8f9e2b35126838
8934a3297f104fe4cf80fa8fa532d9b4d813ccb6
refs/heads/master
2021-01-17T10:21:50.882512
2015-10-28T12:13:58
2015-10-28T12:13:58
23,213,945
0
1
null
2016-03-09T14:00:49
2014-08-22T05:25:18
Java
UTF-8
Java
false
false
154
java
/** * * @author john.liu E-mail:[email protected] * @version 1.0.0 * @since 2014年12月8日 下午3:00:31 */ package com.yeepay.fpay.rro.response;
9f0a8689b48f4c5bc14d72b41781203b9906830f
07de2a7700430dc991d6844eb2589810f592d066
/app/src/main/java/com/example/ranjith/attendencereco/googlecode/javacv/cpp/avdevice.java
9580b9ed1a82f6e568b7b4a768a8e50c7d2cae67
[]
no_license
Maheshwari-Vamsi/AttendenceReco
b8d46ebd496bcea16f2291de42f10a88676d424d
e8e7e3b08fd6642ca7a4fd3fb0bf73fea04e5848
refs/heads/master
2021-01-13T11:39:56.828209
2016-09-27T11:20:28
2016-09-27T11:20:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,202
java
package com.example.ranjith.attendencereco.googlecode.javacv.cpp; import com.googlecode.javacpp.Loader; import com.googlecode.javacpp.annotation.Cast; import com.googlecode.javacpp.annotation.Properties; @Properties({@com.googlecode.javacpp.annotation.Platform(cinclude={"<libavdevice/avdevice.h>"}, define={"__STDC_CONSTANT_MACROS"}, includepath={"/usr/local/include/ffmpeg/:/usr/local/include/:/opt/local/include/ffmpeg/:/opt/local/include/:/usr/include/ffmpeg/"}, link={"[email protected]", "[email protected]", "[email protected]", "[email protected]", "[email protected]", "[email protected]", "[email protected]", "[email protected]"}, linkpath={"/usr/local/lib/:/usr/local/lib64/:/opt/local/lib/:/opt/local/lib64/"}), @com.googlecode.javacpp.annotation.Platform(includepath={"C:/MinGW/local/include/ffmpeg/;C:/MinGW/include/ffmpeg/;C:/MinGW/local/include/;src/main/resources/com/googlecode/javacv/cpp/"}, linkpath={"C:/MinGW/local/lib/;C:/MinGW/lib/"}, preload={"avdevice-54"}, preloadpath={"C:/MinGW/local/bin/;C:/MinGW/bin/"}, value={"windows"}), @com.googlecode.javacpp.annotation.Platform(includepath={"../include/"}, linkpath={"../lib/"}, value={"android"})}) public class avdevice { public static final int LIBAVDEVICE_BUILD = LIBAVDEVICE_VERSION_INT; public static final String LIBAVDEVICE_IDENT = "Lavf" + LIBAVDEVICE_VERSION; public static final String LIBAVDEVICE_VERSION; public static final int LIBAVDEVICE_VERSION_INT = 0; public static final int LIBAVDEVICE_VERSION_MAJOR = 54; public static final int LIBAVDEVICE_VERSION_MICRO = 103; public static final int LIBAVDEVICE_VERSION_MINOR = 3; static { Loader.load(avfilter.class); Loader.load(); LIBAVDEVICE_VERSION_INT = avutil.AV_VERSION_INT(54, 3, 103); LIBAVDEVICE_VERSION = avutil.AV_VERSION(54, 3, 103); } public static native String avdevice_configuration(); public static native String avdevice_license(); public static native void avdevice_register_all(); @Cast({"unsigned"}) public static native int avdevice_version(); } /* Location: D:\Apk\dex2jar-0.0.9.15\classes-dex2jar.jar!\com\googlecode\javacv\cpp\avdevice.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */
f8014ac8702af1e4dc91b8028ba9786431839e44
8fee2a23f8982239982103ffdcab7899ee3db968
/JavaBase/com/test/demo/Test014.java
f9e6e6bedd9dfefc883cebed091f184210c7bca1
[ "MIT" ]
permissive
nanshuii/JavaLearning
0eb2bff01c16c59a5d9e3b0a24a6875fe1d0d200
384c7eb935931b36b610b4c1841eb3fc6c11e4ad
refs/heads/master
2022-06-22T07:46:11.990733
2020-09-14T15:40:23
2020-09-14T15:40:23
247,014,714
0
0
null
2022-06-21T04:04:10
2020-03-13T07:44:12
HTML
UTF-8
Java
false
false
192
java
package com.test.demo; public class Test014<E> { private E name; public E getName() { return name; } public void setName(E name) { this.name = name; } }
de3f472d10afd98072bb3493112358e764a01ae6
41aeb42b2ec6e71a7dd85b0ae752e9cae5e24d0f
/src/java/com/teamj/distribuidas/ui/MainBean.java
ffce11c4a49e3ede946438515797bb0414aa6ece
[]
no_license
jeguaman/ProyectoFinalDistribuidas
d9c2b7dc7e4e4eb8edda8ccb78f89260df2fc5b5
b9e61542f81ccefa0aa230d7660856b262779b40
refs/heads/master
2021-01-10T09:03:24.219873
2016-02-24T06:22:49
2016-02-24T06:22:49
51,878,668
0
0
null
null
null
null
UTF-8
Java
false
false
941
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.teamj.distribuidas.ui; import com.teamj.distribuidas.util.HttpSessionHandler; import java.io.Serializable; import javax.faces.bean.ManagedBean; import javax.faces.bean.ViewScoped; /** * * @author Jose Guaman */ @ManagedBean @ViewScoped public class MainBean implements Serializable { private String nombreUsuario; public String getNombreUsuario() { return nombreUsuario; } public void setNombreUsuario(String nombreUsuario) { this.nombreUsuario = nombreUsuario; } public MainBean() { init(); } private void init() { HttpSessionHandler session = new HttpSessionHandler(); nombreUsuario = session.getNombreUsuario(); } }
[ "Jose Guaman@jose" ]
Jose Guaman@jose
30c05e5f72ff15b181786cc673717c4780aef631
ecb8a3c9fbebed70a9bd7071e8e01e87194bf3ad
/src/main/java/wallmanager/business/platform/AbstractPlaform.java
955d6ff2797b3183fec8c2384f3f06ddf6d849f8
[ "MIT" ]
permissive
ysaak/wall-creator
0faa765895e0a3c92ecdd5c2fbdac51d0c8cdd00
ebc82fcdb09ec376e6f886627076cbb086ef09ca
refs/heads/master
2020-12-14T03:27:40.984743
2016-05-12T11:36:59
2016-05-12T11:36:59
29,933,669
0
0
null
null
null
null
UTF-8
Java
false
false
1,096
java
package wallmanager.business.platform; import java.awt.GraphicsConfiguration; import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; import wallmanager.beans.profile.Screen; /** * Created by ysaak on 31/01/15. */ abstract class AbstractPlaform implements PlatformService { public Path getAppDirectory() { String userHome = System.getProperty("user.home"); return Paths.get(userHome, ".wall-creator"); } public List<Screen> getDesktopConfiguration() { final List<Screen> config = new ArrayList<>(); int id = 1; GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] gs = ge.getScreenDevices(); for(GraphicsDevice curGs : gs) { GraphicsConfiguration[] gc = curGs.getConfigurations(); for(GraphicsConfiguration curGc : gc) { config.add(new Screen(id++, curGc.getBounds())); } } return config; } }
7319d041500ce1f80b4bf49884419ff90ad78e28
0e4626725ed69d0256ef96cf9bf09d2481670273
/app/src/androidTest/java/com/app/seenit/seenit/ExampleInstrumentedTest.java
603fce83095fec40c06fcf2fe267fae5b9adefcb
[]
no_license
ignasirv/SeenIt
99c7372c9826574af10a64df3e3d55c5bfe7ba6b
837902952e2ec798134efedd12d175ce2403b636
refs/heads/master
2021-03-16T07:39:26.560076
2018-06-25T13:54:20
2018-06-25T13:54:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
746
java
package com.app.seenit.seenit; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumentation test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.app.seenit.seenit", appContext.getPackageName()); } }
f9763616db01bb0eed01aa77da213abba32028b6
9ea2f84d5241a4761f5c2c9d3a65bf186502815b
/code/demo/giraph-examples/src/test/java/org/apache/giraph/TestMutateGraph.java
8faa1daa93c409ef1a39cc5480d699f4b396985e
[]
no_license
icesx/IResearch
ffee22cd5846df11ffc9e4bdd22305b753def2c3
8349098219f062e07fa0eab6122503eb72d94223
refs/heads/master
2022-11-28T22:29:00.062512
2021-09-03T02:04:33
2021-09-03T02:04:33
120,061,918
0
0
null
2022-11-16T00:53:13
2018-02-03T05:19:16
Java
UTF-8
Java
false
false
3,986
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.giraph; import static org.junit.Assert.assertTrue; import java.io.IOException; import org.apache.giraph.conf.GiraphConfiguration; import org.apache.giraph.conf.GiraphConstants; import org.apache.giraph.examples.GeneratedVertexReader; import org.apache.giraph.examples.SimpleMutateGraphComputation; import org.apache.giraph.examples.SimplePageRankComputation.SimplePageRankVertexInputFormat; import org.apache.giraph.examples.SimplePageRankComputation.SimplePageRankVertexOutputFormat; import org.apache.giraph.graph.DefaultVertexResolver; import org.apache.giraph.graph.Vertex; import org.apache.giraph.graph.VertexChanges; import org.apache.giraph.job.GiraphJob; import org.apache.hadoop.io.Writable; import org.apache.hadoop.io.WritableComparable; import org.junit.Test; /** * Unit test for graph mutation */ public class TestMutateGraph extends BspCase { public TestMutateGraph() { super(TestMutateGraph.class.getName()); } /** * Custom vertex resolver */ public static class TestVertexResolver<I extends WritableComparable, V extends Writable, E extends Writable> extends DefaultVertexResolver { @Override public Vertex resolve(WritableComparable vertexId, Vertex vertex, VertexChanges vertexChanges, boolean hasMessages) { Vertex originalVertex = vertex; // 1. If the vertex exists, first prune the edges removeEdges(vertex, vertexChanges); // 2. If vertex removal desired, remove the vertex. vertex = removeVertexIfDesired(vertex, vertexChanges); // If vertex removal happens do not add it back even if it has messages. if (originalVertex != null && vertex == null) { hasMessages = false; } // 3. If creation of vertex desired, pick first vertex // 4. If vertex doesn't exist, but got messages or added edges, create vertex = addVertexIfDesired(vertexId, vertex, vertexChanges, hasMessages); // 5. If edge addition, add the edges addEdges(vertex, vertexChanges); return vertex; } } /** * Run a job that tests the various graph mutations that can occur * * @throws IOException * @throws ClassNotFoundException * @throws InterruptedException */ @Test public void testMutateGraph() throws IOException, InterruptedException, ClassNotFoundException { GiraphConfiguration conf = new GiraphConfiguration(); conf.setComputationClass(SimpleMutateGraphComputation.class); conf.setVertexInputFormatClass(SimplePageRankVertexInputFormat.class); conf.setVertexOutputFormatClass(SimplePageRankVertexOutputFormat.class); conf.setWorkerContextClass( SimpleMutateGraphComputation.SimpleMutateGraphVertexWorkerContext.class); GiraphConstants.USER_PARTITION_COUNT.set(conf, 32); conf.setNumComputeThreads(8); GiraphConstants.VERTEX_RESOLVER_CLASS.set(conf, TestVertexResolver.class); GiraphJob job = prepareJob(getCallingMethodName(), conf, getTempPath(getCallingMethodName())); // Overwrite the number of vertices set in BspCase GeneratedVertexReader.READER_VERTICES.set(conf, 400); assertTrue(job.run(true)); } }
31f6161d344f5111aa54a56a349ede04e4a4303a
de38544ef270c4239dc181fab07d430469ba499e
/src/main/java/org/mvel2/asm/AnnotationVisitor.java
e5b46f9d209b9d0953e02abcf5f289c31e55de8d
[ "BSD-3-Clause", "Apache-2.0" ]
permissive
spyros3/mvel
aadc06bc4bce2cd5367401f9bf5f2c8463172b58
69e1d2aed11996dce4532ca20f45b1c7fb3c676c
refs/heads/master
2021-01-17T23:25:44.992120
2011-05-17T17:56:26
2011-05-17T17:56:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,511
java
/*** * ASM: a very small and fast Java bytecode manipulation framework * Copyright (c) 2000-2005 INRIA, France Telecom * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the copyright holders nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.mvel2.asm; /** * A visitor to visit a Java annotation. The methods of this interface must be * called in the following order: (<tt>visit<tt> | <tt>visitEnum<tt> | * <tt>visitAnnotation<tt> | <tt>visitArray<tt>)* <tt>visitEnd<tt>. * * @author Eric Bruneton * @author Eugene Kuleshov */ public interface AnnotationVisitor { /** * Visits a primitive value of the annotation. * * @param name the value name. * @param value the actual value, whose type must be {@link Byte}, * {@link Boolean}, {@link Character}, {@link Short}, * {@link Integer}, {@link Long}, {@link Float}, {@link Double}, * {@link String} or {@link Type}. This value can also be an array * of byte, boolean, short, char, int, long, float or double values * (this is equivalent to using {@link #visitArray visitArray} and * visiting each array element in turn, but is more convenient). */ void visit(String name, Object value); /** * Visits an enumeration value of the annotation. * * @param name the value name. * @param desc the class descriptor of the enumeration class. * @param value the actual enumeration value. */ void visitEnum(String name, String desc, String value); /** * Visits a nested annotation value of the annotation. * * @param name the value name. * @param desc the class descriptor of the nested annotation class. * @return a visitor to visit the actual nested annotation value, or * <tt>null</tt> if this visitor is not interested in visiting * this nested annotation. <i>The nested annotation value must be * fully visited before calling other methods on this annotation * visitor</i>. */ AnnotationVisitor visitAnnotation(String name, String desc); /** * Visits an array value of the annotation. Note that arrays of primitive * types (such as byte, boolean, short, char, int, long, float or double) * can be passed as value to {@link #visit visit}. This is what * {@link ClassReader} does. * * @param name the value name. * @return a visitor to visit the actual array value elements, or * <tt>null</tt> if this visitor is not interested in visiting * these values. The 'name' parameters passed to the methods of this * visitor are ignored. <i>All the array values must be visited * before calling other methods on this annotation visitor</i>. */ AnnotationVisitor visitArray(String name); /** * Visits the end of the annotation. */ void visitEnd(); }
[ "mbrock@9462aea2-c925-0410-9681-c018ebb51820" ]
mbrock@9462aea2-c925-0410-9681-c018ebb51820
3422adc7f07acd1661099f6e953c29c19dcc28a3
71fe7bc4473e41e005030f59f27c5173853c4c1b
/core/src/main/java/com/zfw/core/sys/dao/IRolePermissionDao.java
b4818573f941566bdd86f567bda39b1c4fa921fc
[]
no_license
super-nbcs/miniprogram_code
7d5e9783dbb19ae28d85241afec2f5df0657623d
49fcb15411b31d0fbf2e09306417aa77051593f9
refs/heads/main
2023-02-19T23:06:19.619810
2021-01-21T07:36:43
2021-01-21T07:36:43
323,870,917
0
0
null
null
null
null
UTF-8
Java
false
false
479
java
package com.zfw.core.sys.dao; import com.zfw.core.dao.ICommonDao; import com.zfw.core.sys.entity.RolePermission; public interface IRolePermissionDao extends ICommonDao<RolePermission, Integer> { /** * 根据角色id查找绑定的数据权限 * @param roleId * @return */ RolePermission findByRoleId(Integer roleId); /** * 根据角色id删除绑定的数据权限 * @param roleId */ void deleteByRoleId(Integer roleId); }
2caf18430958ce9bd3572f0dc4a68ae7393141cb
6fa701cdaa0d83caa0d3cbffe39b40e54bf3d386
/google/cloud/bigquery/storage/v1beta2/google-cloud-bigquery-storage-v1beta2-java/proto-google-cloud-bigquery-storage-v1beta2-java/src/main/java/com/google/cloud/bigquery/storage/v1beta2/ArrowSerializationOptionsOrBuilder.java
54f3c813e59e5e9b1ee27520fdc2dce25ac7377c
[ "Apache-2.0" ]
permissive
oltoco/googleapis-gen
bf40cfad61b4217aca07068bd4922a86e3bbd2d5
00ca50bdde80906d6f62314ef4f7630b8cdb6e15
refs/heads/master
2023-07-17T22:11:47.848185
2021-08-29T20:39:47
2021-08-29T20:39:47
null
0
0
null
null
null
null
UTF-8
Java
false
true
946
java
// Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/cloud/bigquery/storage/v1beta2/arrow.proto package com.google.cloud.bigquery.storage.v1beta2; public interface ArrowSerializationOptionsOrBuilder extends // @@protoc_insertion_point(interface_extends:google.cloud.bigquery.storage.v1beta2.ArrowSerializationOptions) com.google.protobuf.MessageOrBuilder { /** * <pre> * The Arrow IPC format to use. * </pre> * * <code>.google.cloud.bigquery.storage.v1beta2.ArrowSerializationOptions.Format format = 1;</code> * @return The enum numeric value on the wire for format. */ int getFormatValue(); /** * <pre> * The Arrow IPC format to use. * </pre> * * <code>.google.cloud.bigquery.storage.v1beta2.ArrowSerializationOptions.Format format = 1;</code> * @return The format. */ com.google.cloud.bigquery.storage.v1beta2.ArrowSerializationOptions.Format getFormat(); }
[ "bazel-bot-development[bot]@users.noreply.github.com" ]
bazel-bot-development[bot]@users.noreply.github.com
67048003f25d1c448ba16645d84ece6db3e2e952
288c16ca910b885bf0c2082c2e25181182f0aa0e
/src/java/servlets/forgotpassserv.java
0c416a698c6333614bb41e6adaa16a710ff90d4b
[]
no_license
cruzhector/car_rental
b5e5b8e299bd9f622f8ab59edbcc8db5cff75b3f
9e0ba2c193e4ab99d19e94ef2b2c841c3e5c6efc
refs/heads/master
2020-03-25T12:12:52.882297
2018-10-04T18:27:44
2018-10-04T18:27:44
143,764,510
1
1
null
null
null
null
UTF-8
Java
false
false
4,081
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 servlets; import java.io.IOException; import java.io.PrintWriter; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.sql.Statement; import java.util.logging.Level; import java.util.logging.Logger; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * * @author kolip */ public class forgotpassserv extends HttpServlet { /** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, ClassNotFoundException, SQLException { response.setContentType("text/html;charset=UTF-8"); try (PrintWriter out = response.getWriter()) { /* TODO output your page here. You may use following sample code. */ out.println("<!DOCTYPE html>"); out.println("<html>"); out.println("<head>"); out.println("<title>Servlet forgotpassserv</title>"); out.println("</head>"); out.println("<body>"); out.println("<h1>Servlet forgotpassserv at " + request.getContextPath() + "</h1>"); Connection connec=connection.con(); String sql="UPDATE users SET pass='"+request.getParameter("pass")+"' WHERE email='"+request.getParameter("username")+"'"; Statement ps=connec.createStatement(); ps.executeUpdate(sql); response.sendRedirect("login.jsp"); out.println("</body>"); out.println("</html>"); } } // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> /** * Handles the HTTP <code>GET</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { processRequest(request, response); } catch (ClassNotFoundException ex) { Logger.getLogger(forgotpassserv.class.getName()).log(Level.SEVERE, null, ex); } catch (SQLException ex) { Logger.getLogger(forgotpassserv.class.getName()).log(Level.SEVERE, null, ex); } } /** * Handles the HTTP <code>POST</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { processRequest(request, response); } catch (ClassNotFoundException ex) { Logger.getLogger(forgotpassserv.class.getName()).log(Level.SEVERE, null, ex); } catch (SQLException ex) { Logger.getLogger(forgotpassserv.class.getName()).log(Level.SEVERE, null, ex); } } /** * Returns a short description of the servlet. * * @return a String containing servlet description */ @Override public String getServletInfo() { return "Short description"; }// </editor-fold> }
2bfbe864d063efc42a3173564a7d672797a341dc
10535e4ebeeac5bc2fb6e852aff1066d1dcfe0f3
/xcr-web/xcr-web-app/src/main/java/com/yatang/xc/xcr/vo/SingleUploadResult.java
36908c4ff6d010e6845009605b6a4d2360d32b26
[]
no_license
pocketbbaa/XCR
c6b3b08a432a7af2e5396f3551ad82133dc1af6b
03940b44cb6aa733657609f372ca3c4d5e81165a
refs/heads/master
2021-04-03T07:09:40.935591
2018-03-09T06:43:27
2018-03-09T06:43:27
124,474,053
2
3
null
null
null
null
UTF-8
Java
false
false
620
java
package com.yatang.xc.xcr.vo; import java.io.Serializable; public class SingleUploadResult extends BaseResult implements Serializable { private static final long serialVersionUID = 495049648054176651L; private String fileOnServerUrl; public String getFileOnServerUrl() { return fileOnServerUrl; } public void setFileOnServerUrl(String fileOnServerUrl) { this.fileOnServerUrl = fileOnServerUrl; } @Override public String toString() { return "SingleUploadResult{" + "responseCode='" + responseCode + '\'' + ", errMsg='" + errMsg + '\'' + ", fileOnServerUrl='" + fileOnServerUrl + '\'' + '}'; } }
11952c02aa3f42bc81932b5c08c73079190a6e46
e42afd54dcc0add3d2b8823ee98a18c50023a396
/java-network-management/proto-google-cloud-network-management-v1beta1/src/main/java/com/google/cloud/networkmanagement/v1beta1/CreateConnectivityTestRequest.java
661a042692535e5258e8fc9810a5dd18946432e7
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
degloba/google-cloud-java
eea41ebb64f4128583533bc1547e264e730750e2
b1850f15cd562c659c6e8aaee1d1e65d4cd4147e
refs/heads/master
2022-07-07T17:29:12.510736
2022-07-04T09:19:33
2022-07-04T09:19:33
180,201,746
0
0
Apache-2.0
2022-07-04T09:17:23
2019-04-08T17:42:24
Java
UTF-8
Java
false
false
39,025
java
/* * Copyright 2020 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 * * https://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. */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/cloud/networkmanagement/v1beta1/reachability.proto package com.google.cloud.networkmanagement.v1beta1; /** * * * <pre> * Request for the `CreateConnectivityTest` method. * </pre> * * Protobuf type {@code google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest} */ public final class CreateConnectivityTestRequest extends com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest) CreateConnectivityTestRequestOrBuilder { private static final long serialVersionUID = 0L; // Use CreateConnectivityTestRequest.newBuilder() to construct. private CreateConnectivityTestRequest(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { super(builder); } private CreateConnectivityTestRequest() { parent_ = ""; testId_ = ""; } @java.lang.Override @SuppressWarnings({"unused"}) protected java.lang.Object newInstance(UnusedPrivateParameter unused) { return new CreateConnectivityTestRequest(); } @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private CreateConnectivityTestRequest( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { this(); if (extensionRegistry == null) { throw new java.lang.NullPointerException(); } com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; case 10: { java.lang.String s = input.readStringRequireUtf8(); parent_ = s; break; } case 18: { java.lang.String s = input.readStringRequireUtf8(); testId_ = s; break; } case 26: { com.google.cloud.networkmanagement.v1beta1.ConnectivityTest.Builder subBuilder = null; if (resource_ != null) { subBuilder = resource_.toBuilder(); } resource_ = input.readMessage( com.google.cloud.networkmanagement.v1beta1.ConnectivityTest.parser(), extensionRegistry); if (subBuilder != null) { subBuilder.mergeFrom(resource_); resource_ = subBuilder.buildPartial(); } break; } default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (com.google.protobuf.UninitializedMessageException e) { throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.cloud.networkmanagement.v1beta1.ReachabilityServiceProto .internal_static_google_cloud_networkmanagement_v1beta1_CreateConnectivityTestRequest_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.cloud.networkmanagement.v1beta1.ReachabilityServiceProto .internal_static_google_cloud_networkmanagement_v1beta1_CreateConnectivityTestRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( com.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest.class, com.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest.Builder.class); } public static final int PARENT_FIELD_NUMBER = 1; private volatile java.lang.Object parent_; /** * * * <pre> * Required. The parent resource of the Connectivity Test to create: * `projects/{project_id}/locations/global` * </pre> * * <code>string parent = 1 [(.google.api.field_behavior) = REQUIRED];</code> * * @return The parent. */ @java.lang.Override public java.lang.String getParent() { java.lang.Object ref = parent_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); parent_ = s; return s; } } /** * * * <pre> * Required. The parent resource of the Connectivity Test to create: * `projects/{project_id}/locations/global` * </pre> * * <code>string parent = 1 [(.google.api.field_behavior) = REQUIRED];</code> * * @return The bytes for parent. */ @java.lang.Override public com.google.protobuf.ByteString getParentBytes() { java.lang.Object ref = parent_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); parent_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int TEST_ID_FIELD_NUMBER = 2; private volatile java.lang.Object testId_; /** * * * <pre> * Required. The logical name of the Connectivity Test in your project * with the following restrictions: * * Must contain only lowercase letters, numbers, and hyphens. * * Must start with a letter. * * Must be between 1-40 characters. * * Must end with a number or a letter. * * Must be unique within the customer project * </pre> * * <code>string test_id = 2 [(.google.api.field_behavior) = REQUIRED];</code> * * @return The testId. */ @java.lang.Override public java.lang.String getTestId() { java.lang.Object ref = testId_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); testId_ = s; return s; } } /** * * * <pre> * Required. The logical name of the Connectivity Test in your project * with the following restrictions: * * Must contain only lowercase letters, numbers, and hyphens. * * Must start with a letter. * * Must be between 1-40 characters. * * Must end with a number or a letter. * * Must be unique within the customer project * </pre> * * <code>string test_id = 2 [(.google.api.field_behavior) = REQUIRED];</code> * * @return The bytes for testId. */ @java.lang.Override public com.google.protobuf.ByteString getTestIdBytes() { java.lang.Object ref = testId_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); testId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int RESOURCE_FIELD_NUMBER = 3; private com.google.cloud.networkmanagement.v1beta1.ConnectivityTest resource_; /** * * * <pre> * Required. A `ConnectivityTest` resource * </pre> * * <code> * .google.cloud.networkmanagement.v1beta1.ConnectivityTest resource = 3 [(.google.api.field_behavior) = REQUIRED]; * </code> * * @return Whether the resource field is set. */ @java.lang.Override public boolean hasResource() { return resource_ != null; } /** * * * <pre> * Required. A `ConnectivityTest` resource * </pre> * * <code> * .google.cloud.networkmanagement.v1beta1.ConnectivityTest resource = 3 [(.google.api.field_behavior) = REQUIRED]; * </code> * * @return The resource. */ @java.lang.Override public com.google.cloud.networkmanagement.v1beta1.ConnectivityTest getResource() { return resource_ == null ? com.google.cloud.networkmanagement.v1beta1.ConnectivityTest.getDefaultInstance() : resource_; } /** * * * <pre> * Required. A `ConnectivityTest` resource * </pre> * * <code> * .google.cloud.networkmanagement.v1beta1.ConnectivityTest resource = 3 [(.google.api.field_behavior) = REQUIRED]; * </code> */ @java.lang.Override public com.google.cloud.networkmanagement.v1beta1.ConnectivityTestOrBuilder getResourceOrBuilder() { return getResource(); } private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); } if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(testId_)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 2, testId_); } if (resource_ != null) { output.writeMessage(3, getResource()); } unknownFields.writeTo(output); } @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); } if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(testId_)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, testId_); } if (resource_ != null) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getResource()); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; } @java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest)) { return super.equals(obj); } com.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest other = (com.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest) obj; if (!getParent().equals(other.getParent())) return false; if (!getTestId().equals(other.getTestId())) return false; if (hasResource() != other.hasResource()) return false; if (hasResource()) { if (!getResource().equals(other.getResource())) return false; } if (!unknownFields.equals(other.unknownFields)) return false; return true; } @java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + PARENT_FIELD_NUMBER; hash = (53 * hash) + getParent().hashCode(); hash = (37 * hash) + TEST_ID_FIELD_NUMBER; hash = (53 * hash) + getTestId().hashCode(); if (hasResource()) { hash = (37 * hash) + RESOURCE_FIELD_NUMBER; hash = (53 * hash) + getResource().hashCode(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } public static com.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest parseFrom( java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest parseFrom( byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest parseFrom( java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); } public static com.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); } public static com.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); } public static com.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException( PARSER, input, extensionRegistry); } @java.lang.Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder( com.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } @java.lang.Override public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @java.lang.Override protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * * * <pre> * Request for the `CreateConnectivityTest` method. * </pre> * * Protobuf type {@code google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest) com.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequestOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.cloud.networkmanagement.v1beta1.ReachabilityServiceProto .internal_static_google_cloud_networkmanagement_v1beta1_CreateConnectivityTestRequest_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.cloud.networkmanagement.v1beta1.ReachabilityServiceProto .internal_static_google_cloud_networkmanagement_v1beta1_CreateConnectivityTestRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( com.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest.class, com.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest.Builder .class); } // Construct using // com.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} } @java.lang.Override public Builder clear() { super.clear(); parent_ = ""; testId_ = ""; if (resourceBuilder_ == null) { resource_ = null; } else { resource_ = null; resourceBuilder_ = null; } return this; } @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return com.google.cloud.networkmanagement.v1beta1.ReachabilityServiceProto .internal_static_google_cloud_networkmanagement_v1beta1_CreateConnectivityTestRequest_descriptor; } @java.lang.Override public com.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest getDefaultInstanceForType() { return com.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest .getDefaultInstance(); } @java.lang.Override public com.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest build() { com.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } @java.lang.Override public com.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest buildPartial() { com.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest result = new com.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest(this); result.parent_ = parent_; result.testId_ = testId_; if (resourceBuilder_ == null) { result.resource_ = resource_; } else { result.resource_ = resourceBuilder_.build(); } onBuilt(); return result; } @java.lang.Override public Builder clone() { return super.clone(); } @java.lang.Override public Builder setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.setField(field, value); } @java.lang.Override public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { return super.clearField(field); } @java.lang.Override public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { return super.clearOneof(oneof); } @java.lang.Override public Builder setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { return super.setRepeatedField(field, index, value); } @java.lang.Override public Builder addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.addRepeatedField(field, value); } @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest) { return mergeFrom( (com.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest) other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom( com.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest other) { if (other == com.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest .getDefaultInstance()) return this; if (!other.getParent().isEmpty()) { parent_ = other.parent_; onChanged(); } if (!other.getTestId().isEmpty()) { testId_ = other.testId_; onChanged(); } if (other.hasResource()) { mergeResource(other.getResource()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } @java.lang.Override public final boolean isInitialized() { return true; } @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (com.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private java.lang.Object parent_ = ""; /** * * * <pre> * Required. The parent resource of the Connectivity Test to create: * `projects/{project_id}/locations/global` * </pre> * * <code>string parent = 1 [(.google.api.field_behavior) = REQUIRED];</code> * * @return The parent. */ public java.lang.String getParent() { java.lang.Object ref = parent_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); parent_ = s; return s; } else { return (java.lang.String) ref; } } /** * * * <pre> * Required. The parent resource of the Connectivity Test to create: * `projects/{project_id}/locations/global` * </pre> * * <code>string parent = 1 [(.google.api.field_behavior) = REQUIRED];</code> * * @return The bytes for parent. */ public com.google.protobuf.ByteString getParentBytes() { java.lang.Object ref = parent_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); parent_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * * * <pre> * Required. The parent resource of the Connectivity Test to create: * `projects/{project_id}/locations/global` * </pre> * * <code>string parent = 1 [(.google.api.field_behavior) = REQUIRED];</code> * * @param value The parent to set. * @return This builder for chaining. */ public Builder setParent(java.lang.String value) { if (value == null) { throw new NullPointerException(); } parent_ = value; onChanged(); return this; } /** * * * <pre> * Required. The parent resource of the Connectivity Test to create: * `projects/{project_id}/locations/global` * </pre> * * <code>string parent = 1 [(.google.api.field_behavior) = REQUIRED];</code> * * @return This builder for chaining. */ public Builder clearParent() { parent_ = getDefaultInstance().getParent(); onChanged(); return this; } /** * * * <pre> * Required. The parent resource of the Connectivity Test to create: * `projects/{project_id}/locations/global` * </pre> * * <code>string parent = 1 [(.google.api.field_behavior) = REQUIRED];</code> * * @param value The bytes for parent to set. * @return This builder for chaining. */ public Builder setParentBytes(com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); parent_ = value; onChanged(); return this; } private java.lang.Object testId_ = ""; /** * * * <pre> * Required. The logical name of the Connectivity Test in your project * with the following restrictions: * * Must contain only lowercase letters, numbers, and hyphens. * * Must start with a letter. * * Must be between 1-40 characters. * * Must end with a number or a letter. * * Must be unique within the customer project * </pre> * * <code>string test_id = 2 [(.google.api.field_behavior) = REQUIRED];</code> * * @return The testId. */ public java.lang.String getTestId() { java.lang.Object ref = testId_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); testId_ = s; return s; } else { return (java.lang.String) ref; } } /** * * * <pre> * Required. The logical name of the Connectivity Test in your project * with the following restrictions: * * Must contain only lowercase letters, numbers, and hyphens. * * Must start with a letter. * * Must be between 1-40 characters. * * Must end with a number or a letter. * * Must be unique within the customer project * </pre> * * <code>string test_id = 2 [(.google.api.field_behavior) = REQUIRED];</code> * * @return The bytes for testId. */ public com.google.protobuf.ByteString getTestIdBytes() { java.lang.Object ref = testId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); testId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * * * <pre> * Required. The logical name of the Connectivity Test in your project * with the following restrictions: * * Must contain only lowercase letters, numbers, and hyphens. * * Must start with a letter. * * Must be between 1-40 characters. * * Must end with a number or a letter. * * Must be unique within the customer project * </pre> * * <code>string test_id = 2 [(.google.api.field_behavior) = REQUIRED];</code> * * @param value The testId to set. * @return This builder for chaining. */ public Builder setTestId(java.lang.String value) { if (value == null) { throw new NullPointerException(); } testId_ = value; onChanged(); return this; } /** * * * <pre> * Required. The logical name of the Connectivity Test in your project * with the following restrictions: * * Must contain only lowercase letters, numbers, and hyphens. * * Must start with a letter. * * Must be between 1-40 characters. * * Must end with a number or a letter. * * Must be unique within the customer project * </pre> * * <code>string test_id = 2 [(.google.api.field_behavior) = REQUIRED];</code> * * @return This builder for chaining. */ public Builder clearTestId() { testId_ = getDefaultInstance().getTestId(); onChanged(); return this; } /** * * * <pre> * Required. The logical name of the Connectivity Test in your project * with the following restrictions: * * Must contain only lowercase letters, numbers, and hyphens. * * Must start with a letter. * * Must be between 1-40 characters. * * Must end with a number or a letter. * * Must be unique within the customer project * </pre> * * <code>string test_id = 2 [(.google.api.field_behavior) = REQUIRED];</code> * * @param value The bytes for testId to set. * @return This builder for chaining. */ public Builder setTestIdBytes(com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); testId_ = value; onChanged(); return this; } private com.google.cloud.networkmanagement.v1beta1.ConnectivityTest resource_; private com.google.protobuf.SingleFieldBuilderV3< com.google.cloud.networkmanagement.v1beta1.ConnectivityTest, com.google.cloud.networkmanagement.v1beta1.ConnectivityTest.Builder, com.google.cloud.networkmanagement.v1beta1.ConnectivityTestOrBuilder> resourceBuilder_; /** * * * <pre> * Required. A `ConnectivityTest` resource * </pre> * * <code> * .google.cloud.networkmanagement.v1beta1.ConnectivityTest resource = 3 [(.google.api.field_behavior) = REQUIRED]; * </code> * * @return Whether the resource field is set. */ public boolean hasResource() { return resourceBuilder_ != null || resource_ != null; } /** * * * <pre> * Required. A `ConnectivityTest` resource * </pre> * * <code> * .google.cloud.networkmanagement.v1beta1.ConnectivityTest resource = 3 [(.google.api.field_behavior) = REQUIRED]; * </code> * * @return The resource. */ public com.google.cloud.networkmanagement.v1beta1.ConnectivityTest getResource() { if (resourceBuilder_ == null) { return resource_ == null ? com.google.cloud.networkmanagement.v1beta1.ConnectivityTest.getDefaultInstance() : resource_; } else { return resourceBuilder_.getMessage(); } } /** * * * <pre> * Required. A `ConnectivityTest` resource * </pre> * * <code> * .google.cloud.networkmanagement.v1beta1.ConnectivityTest resource = 3 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public Builder setResource(com.google.cloud.networkmanagement.v1beta1.ConnectivityTest value) { if (resourceBuilder_ == null) { if (value == null) { throw new NullPointerException(); } resource_ = value; onChanged(); } else { resourceBuilder_.setMessage(value); } return this; } /** * * * <pre> * Required. A `ConnectivityTest` resource * </pre> * * <code> * .google.cloud.networkmanagement.v1beta1.ConnectivityTest resource = 3 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public Builder setResource( com.google.cloud.networkmanagement.v1beta1.ConnectivityTest.Builder builderForValue) { if (resourceBuilder_ == null) { resource_ = builderForValue.build(); onChanged(); } else { resourceBuilder_.setMessage(builderForValue.build()); } return this; } /** * * * <pre> * Required. A `ConnectivityTest` resource * </pre> * * <code> * .google.cloud.networkmanagement.v1beta1.ConnectivityTest resource = 3 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public Builder mergeResource( com.google.cloud.networkmanagement.v1beta1.ConnectivityTest value) { if (resourceBuilder_ == null) { if (resource_ != null) { resource_ = com.google.cloud.networkmanagement.v1beta1.ConnectivityTest.newBuilder(resource_) .mergeFrom(value) .buildPartial(); } else { resource_ = value; } onChanged(); } else { resourceBuilder_.mergeFrom(value); } return this; } /** * * * <pre> * Required. A `ConnectivityTest` resource * </pre> * * <code> * .google.cloud.networkmanagement.v1beta1.ConnectivityTest resource = 3 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public Builder clearResource() { if (resourceBuilder_ == null) { resource_ = null; onChanged(); } else { resource_ = null; resourceBuilder_ = null; } return this; } /** * * * <pre> * Required. A `ConnectivityTest` resource * </pre> * * <code> * .google.cloud.networkmanagement.v1beta1.ConnectivityTest resource = 3 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public com.google.cloud.networkmanagement.v1beta1.ConnectivityTest.Builder getResourceBuilder() { onChanged(); return getResourceFieldBuilder().getBuilder(); } /** * * * <pre> * Required. A `ConnectivityTest` resource * </pre> * * <code> * .google.cloud.networkmanagement.v1beta1.ConnectivityTest resource = 3 [(.google.api.field_behavior) = REQUIRED]; * </code> */ public com.google.cloud.networkmanagement.v1beta1.ConnectivityTestOrBuilder getResourceOrBuilder() { if (resourceBuilder_ != null) { return resourceBuilder_.getMessageOrBuilder(); } else { return resource_ == null ? com.google.cloud.networkmanagement.v1beta1.ConnectivityTest.getDefaultInstance() : resource_; } } /** * * * <pre> * Required. A `ConnectivityTest` resource * </pre> * * <code> * .google.cloud.networkmanagement.v1beta1.ConnectivityTest resource = 3 [(.google.api.field_behavior) = REQUIRED]; * </code> */ private com.google.protobuf.SingleFieldBuilderV3< com.google.cloud.networkmanagement.v1beta1.ConnectivityTest, com.google.cloud.networkmanagement.v1beta1.ConnectivityTest.Builder, com.google.cloud.networkmanagement.v1beta1.ConnectivityTestOrBuilder> getResourceFieldBuilder() { if (resourceBuilder_ == null) { resourceBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< com.google.cloud.networkmanagement.v1beta1.ConnectivityTest, com.google.cloud.networkmanagement.v1beta1.ConnectivityTest.Builder, com.google.cloud.networkmanagement.v1beta1.ConnectivityTestOrBuilder>( getResource(), getParentForChildren(), isClean()); resource_ = null; } return resourceBuilder_; } @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); } @java.lang.Override public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.mergeUnknownFields(unknownFields); } // @@protoc_insertion_point(builder_scope:google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest) } // @@protoc_insertion_point(class_scope:google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest) private static final com.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new com.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest(); } public static com.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest getDefaultInstance() { return DEFAULT_INSTANCE; } private static final com.google.protobuf.Parser<CreateConnectivityTestRequest> PARSER = new com.google.protobuf.AbstractParser<CreateConnectivityTestRequest>() { @java.lang.Override public CreateConnectivityTestRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new CreateConnectivityTestRequest(input, extensionRegistry); } }; public static com.google.protobuf.Parser<CreateConnectivityTestRequest> parser() { return PARSER; } @java.lang.Override public com.google.protobuf.Parser<CreateConnectivityTestRequest> getParserForType() { return PARSER; } @java.lang.Override public com.google.cloud.networkmanagement.v1beta1.CreateConnectivityTestRequest getDefaultInstanceForType() { return DEFAULT_INSTANCE; } }
525fd52f0ef29c924b091979286ca1081de9d0c2
ba6716b1205cce9686e4e0b371c273fb226ff314
/designmodel/src/main/java/com/iterator9/version2/LunchMenu.java
8b2a57465ebc8e897a82ea890cabd6a9ce934396
[]
no_license
yanglele/modelPattern
a4e02c096c5057322ef9985e6f909692bb5e86fe
bee20c6eea0ddc6497874d8f8fc6eccd471bf5d8
refs/heads/master
2020-03-10T03:50:04.553149
2019-09-19T11:16:25
2019-09-19T11:16:25
128,522,402
0
0
null
null
null
null
UTF-8
Java
false
false
472
java
package com.iterator9.version2; import com.iterator9.version1.MenuItem; import java.util.Iterator; /** * Desc: * Author:yl * Email:[email protected] * data:2018/4/8 * version: * update: */ public class LunchMenu implements Menu { private MenuItem[] menuItems; public LunchMenu(MenuItem[] menuItems){ this.menuItems = menuItems; } @Override public Iterator createIterator() { return new LunchIterator(menuItems); } }
9dff8ea69a21caa73500eabc754a979d5ec607de
231dd5531529728433c7a4e64ebf9ea720f13d4e
/Ass1/QuickSelectTemplate.java
6c4a7f562980d1c5591b9a060c8cd29d6134a89b
[]
no_license
nelson-dai/CSC226
a78ad57595df0b4f7a3ec730aa8826e58cc60f9f
e076b36585e6459835f6bee6d72e22cd0cfad170
refs/heads/master
2020-03-29T11:38:52.585730
2018-09-22T09:36:35
2018-09-22T09:36:35
149,863,319
0
0
null
null
null
null
UTF-8
Java
false
false
1,655
java
//Template is created by Zhuoli Xiao, on Sept. 19st, 2016. //Only used for Lab 226, 2016 Fall. //All Rights Reserved. import java.util.Arrays; import java.util.Random; public class QuickSelect { //Function to invoke quickslect public static int[] QS(int[] S, int k){ if (S.length==1) return S; //initialize array to store result int result[]=new int[k]; for(int i=0;i<result.length;i++){ result[i]=0; } quickSelect(0,S.length-1,S,k); //fill your result array here return result; } //do quickSort in a recursive way private static void quickSelect(int left, int right, int[] array, int k){ return; } //do Partition with a privot private static int partition(int left, int right, int[] array, int p){ return 0; } //Pick a random pivot to do the QuickSort private static int pickRandomPivot(int[] S){ int index=0; Random rand= new Random(); index = rand.nextInt(S.length-1); return S[index]; } //swap two elements in the array private static void swap(int[]array, int a, int b){ int tmp = array[a]; array[a] = array[b]; array[b] = tmp; } //Our main function to test the algorithm public static void main (String[] args){ int [] array1 ={12,13,17,14,21,3,4,9,21,8}; int [] array2 ={14,8,22,18,6,2,15,84,13,12}; int [] array3 ={6,8,14,18,22,2,12,13,15,84}; System.out.println(Arrays.toString(QS(array1,5))); System.out.println(Arrays.toString(QS(array2,7))); System.out.println(Arrays.toString(QS(array3,5))); } }
ed4dc32da903e82cfe9a367acfd42eb241aad02a
1dcf9bf064179d4caf69f57ea19c8568b464f6eb
/src/tp1/worker/IWorkerFrontBalancer.java
11cffc080eac96f8c9f3fc3e7351e73ab7b50ae0
[]
no_license
FlorentMouysset/ARGE
857331cd8bbd9a52cca71063a92661ec8f5878da
afbca8f816cf52ddc03983dcef3ea753ab884b66
refs/heads/master
2021-01-16T00:28:39.912189
2014-04-21T18:24:25
2014-04-21T18:24:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
441
java
package tp1.worker; import tp1.datacontract.Task; /** * It's the worker front interface for balancer * */ public interface IWorkerFrontBalancer { /***************************************** * * Business services * *****************************************/ /** * Submit a new task to worker * @return boolean : true if the new task is correctly registered, false else * */ boolean submitNewTask(Task task); }
a422251bcb46cc5ab7197288545039e990063214
9ad6e9796a45e2277d0d19c64aa2d00ded2ee657
/src/main/java/request/PutorPostRequest.java
f3b9af20969c2ed608b5f61befbc9496f547982c
[]
no_license
sonypriyadarshini/RestAssuredAPIFramework
e0258b15722b2a784fecda9fa73fc90b217446e0
cf3a1406bee8d8fd03fdeda124f3f6f4ed399b08
refs/heads/master
2023-05-11T01:22:42.978293
2019-10-18T11:42:50
2019-10-18T11:42:50
161,033,750
1
1
null
2023-05-09T18:06:51
2018-12-09T11:49:34
Java
UTF-8
Java
false
false
461
java
package request; import org.apache.commons.lang3.RandomStringUtils; import org.json.simple.JSONObject; public class PutorPostRequest { public JSONObject formPutRequest(){ String name = RandomStringUtils.randomAlphabetic(5); String job = RandomStringUtils.randomAlphabetic(10); JSONObject jsonObject = new JSONObject(); jsonObject.put("name",name); jsonObject.put("job", job); return jsonObject; } }
5e833b4193d772f1b94a87a789268d641a176051
2ebe6e87a7f96bbee2933103a4f43f46ea239996
/samples/testsuite-xlt/src/action/modules/Select_byLabel_actions/multi_select0.java
5083b470af30d95d295b9e0334215ed8fc2729d9
[ "Apache-2.0", "LGPL-2.0-or-later", "BSD-3-Clause", "EPL-1.0", "CDDL-1.1", "EPL-2.0", "MPL-2.0", "MIT", "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
Xceptance/XLT
b4351c915d8c66d918b02a6c71393a151988be46
c6609f0cd9315217727d44b3166f705acc4da0b4
refs/heads/develop
2023-08-18T18:20:56.557477
2023-08-08T16:04:16
2023-08-08T16:04:16
237,251,821
56
12
Apache-2.0
2023-09-01T14:52:25
2020-01-30T16:13:24
Java
UTF-8
Java
false
false
1,980
java
/* * Copyright (c) 2005-2023 Xceptance Software Technologies GmbH * * 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 action.modules.Select_byLabel_actions; import org.junit.Assert; import com.xceptance.xlt.api.actions.AbstractHtmlPageAction; import com.xceptance.xlt.api.engine.scripting.AbstractHtmlUnitScriptAction; import org.htmlunit.html.HtmlPage; /** * TODO: Add class description */ public class multi_select0 extends AbstractHtmlUnitScriptAction { /** * Constructor. * @param prevAction The previous action. */ public multi_select0(final AbstractHtmlPageAction prevAction) { super(prevAction); } /** * {@inheritDoc} */ @Override public void preValidate() throws Exception { final HtmlPage page = getPreviousAction().getHtmlPage(); Assert.assertNotNull("Failed to get page from previous action", page); } /** * {@inheritDoc} */ @Override protected void execute() throws Exception { HtmlPage page = getPreviousAction().getHtmlPage(); page = select("id=select_18", "label="); setHtmlPage(page); } /** * {@inheritDoc} */ @Override protected void postValidate() throws Exception { final HtmlPage page = getHtmlPage(); Assert.assertNotNull("Failed to load page", page); assertText("id=cc_change", "change (select_18) empty, 1 space, 2 spaces"); } }
33da2b1a95a0366b6c822b518aacc16789a864f6
065926e599d28e87144060f675a6e3132d697171
/laba3/app/src/test/java/com/maxovch/laba_3/ExampleUnitTest.java
e5e5679913f74cb21e402b2c26355d52d31a19a5
[]
no_license
Alcatraz7676/Mospoliteh-labs
d6658a4d5fec1fa42a271dc3df6b3393ee2a1415
b5818e405ccdb741c22aef1eb7715cb4ba264701
refs/heads/master
2021-09-02T03:55:31.933678
2017-12-30T04:58:05
2017-12-30T04:58:05
104,569,357
0
0
null
null
null
null
UTF-8
Java
false
false
396
java
package com.maxovch.laba_3; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
ef12fcc0b6b756eb5e6fe15b0cc0d418dc7ce9b2
5b966719ed59f35873cdb74175530a94d820ea0b
/employeeserv-t23_24/employeeservImplementation/src/main/java/com/paypal/bfs/test/employeeserv/repository/CustomerRepository.java
e81835d1b50e28ded35b1f973a7c3942b1f1ba25
[]
no_license
Praveen2809/Reservation
4f6245c7212150d639cabf30a1d2d29c11a0a252
92d99ed383a027e98a83325148fc243a3fb2cfeb
refs/heads/master
2023-06-22T11:51:32.523570
2021-07-17T08:26:20
2021-07-17T08:26:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
313
java
package com.paypal.bfs.test.employeeserv.repository; import com.paypal.bfs.test.employeeserv.model.Customer; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; @Repository public interface CustomerRepository extends JpaRepository<Customer, Long> { }
1c2cd6b772ad0495c6317c3772c596cb15ea02ca
abd27ab334113d53f24c3f26a5ceefc19c7885d8
/java_13_Abstract.java
51d09392d45808ca56722e6f3bc451fc907a54f2
[]
no_license
Aizz03/OOPS-Programs
1dd88934916c3f8c3f869eb383434b5abfaf2dbe
944b4de2bd2022b569290ce216dd9de273391726
refs/heads/master
2023-08-10T18:45:31.225762
2021-09-23T13:11:40
2021-09-23T13:11:40
409,596,001
0
0
null
null
null
null
UTF-8
Java
false
false
1,287
java
import java.util.*; abstract class Shape{ abstract void findArea(); } class Rectangle extends Shape{ double l; double b; Rectangle(double x,double y){ l=x; b=y; } void findArea(){ System.out.println("The area of Rectangle = "+l*b); } } class Square extends Shape{ double a; Square(double x){ a=x; } void findArea(){ System.out.println("The area of Square = "+a*a); } } class Circle extends Shape{ double r; Circle(double x){ r=x; } void findArea(){ System.out.println("The area of Circle = "+3.14*r*r); } } class java_13_Abstract { public static void main(String[] args) { Scanner sc=new Scanner(System.in); double x,y; System.out.println("Enter the length and breadth of rectangle : "); x=sc.nextDouble(); y=sc.nextDouble(); Rectangle rec=new Rectangle(x, y); rec.findArea(); System.out.println("Enter the length of square : "); x=sc.nextDouble(); Square s=new Square(x); s.findArea(); System.out.println("Ether the radius of circle : "); x=sc.nextDouble(); Circle c=new Circle(x); c.findArea(); sc.close(); } }
3167fbb7c268c948efdc6a4bbbceb100d2f567c3
f98b67180b36e210da2857ee9da19e59939d142e
/Android (with stats)/4Inaline/app/src/main/java/com/example/marcos/fourinaline/GameActivity.java
b8c473d3ad7d4bd6299e6394dc76a495400e6931
[]
no_license
maovares/4InLine
9c396523c1ca50053bc69fbe29345d24b0faa8b2
6f868c2f0bc6d61f4e157d5ae6faed0851d011e3
refs/heads/master
2021-01-01T03:41:13.396820
2016-05-08T04:21:06
2016-05-08T04:21:06
57,469,307
0
0
null
null
null
null
UTF-8
Java
false
false
18,397
java
package com.example.marcos.fourinaline; import android.content.Intent; import android.graphics.Color; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.support.design.widget.NavigationView; import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.ImageView; import android.widget.SeekBar; import android.widget.TableLayout; import android.widget.TextView; import android.widget.Toast; import org.json.JSONArray; import org.json.JSONObject; import java.io.InputStream; import java.net.URL; import java.util.ArrayList; import java.util.Arrays; import java.util.Random; public class GameActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { String ip; String port = "3000"; NodeData node = new NodeData(); String actualColor; Boolean autoMove; int level; int auto; TableLayout tableGame; ImageView m00,m01,m02,m03,m04,m05,m06,m10,m11,m12,m13,m14,m15,m16,m20,m21,m22,m23,m24,m25,m26,m30,m31,m32,m33, m34,m35,m36,m40,m41,m42,m43,m44,m45,m46,m50,m51,m52,m53,m54,m55,m56; ArrayList<ImageView> col0 = new ArrayList<>(); ArrayList<ImageView> col1 = new ArrayList<>(); ArrayList<ImageView> col2 = new ArrayList<>(); ArrayList<ImageView> col3 = new ArrayList<>(); ArrayList<ImageView> col4 = new ArrayList<>(); ArrayList<ImageView> col5 = new ArrayList<>(); ArrayList<ImageView> col6 = new ArrayList<>(); ArrayList<ArrayList<ImageView>> gameMatrix = new ArrayList<>(); TextView tvName; TextView tvEmail; ImageView ivProfile; SeekBar bar; String email; String name; Bundle bundle; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_game); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); bundle = getIntent().getExtras(); name = bundle.getString("name"); email = bundle.getString("email"); ip = bundle.getString("ip"); level = bundle.getInt("level"); setTitle("Level " + Integer.toString(level)); String photo = getIntent().getExtras().getString("photo"); bar = (SeekBar) findViewById(R.id.seekBar); String[] colors = {"red","blue"}; int idx = new Random().nextInt(colors.length); if(idx == 0){ auto = 1; }else { auto = 2; } actualColor = (colors[idx]); actualColor = changeColor(actualColor); autoMove = true; tableGame = (TableLayout) findViewById(R.id.tableLayout); m00 = (ImageView) findViewById(R.id.m00); m10 = (ImageView) findViewById(R.id.m10); m20 = (ImageView) findViewById(R.id.m20); m30 = (ImageView) findViewById(R.id.m30); m40 = (ImageView) findViewById(R.id.m40); m50 = (ImageView) findViewById(R.id.m50); m01 = (ImageView) findViewById(R.id.m01); m11 = (ImageView) findViewById(R.id.m11); m21 = (ImageView) findViewById(R.id.m21); m31 = (ImageView) findViewById(R.id.m31); m41 = (ImageView) findViewById(R.id.m41); m51 = (ImageView) findViewById(R.id.m51); m02 = (ImageView) findViewById(R.id.m02); m12 = (ImageView) findViewById(R.id.m12); m22 = (ImageView) findViewById(R.id.m22); m32 = (ImageView) findViewById(R.id.m32); m42 = (ImageView) findViewById(R.id.m42); m52 = (ImageView) findViewById(R.id.m52); m03 = (ImageView) findViewById(R.id.m03); m13 = (ImageView) findViewById(R.id.m13); m23 = (ImageView) findViewById(R.id.m23); m33 = (ImageView) findViewById(R.id.m33); m43 = (ImageView) findViewById(R.id.m43); m53 = (ImageView) findViewById(R.id.m53); m04 = (ImageView) findViewById(R.id.m04); m14 = (ImageView) findViewById(R.id.m14); m24 = (ImageView) findViewById(R.id.m24); m34 = (ImageView) findViewById(R.id.m34); m44 = (ImageView) findViewById(R.id.m44); m54 = (ImageView) findViewById(R.id.m54); m05 = (ImageView) findViewById(R.id.m05); m15 = (ImageView) findViewById(R.id.m15); m25 = (ImageView) findViewById(R.id.m25); m35 = (ImageView) findViewById(R.id.m35); m45 = (ImageView) findViewById(R.id.m45); m55 = (ImageView) findViewById(R.id.m55); m06 = (ImageView) findViewById(R.id.m06); m16 = (ImageView) findViewById(R.id.m16); m26 = (ImageView) findViewById(R.id.m26); m36 = (ImageView) findViewById(R.id.m36); m46 = (ImageView) findViewById(R.id.m46); m56 = (ImageView) findViewById(R.id.m56); col0.add(m50); col0.add(m40); col0.add(m30); col0.add(m20); col0.add(m10); col0.add(m00); col1.add(m51); col1.add(m41); col1.add(m31); col1.add(m21); col1.add(m11); col1.add(m01); col2.add(m52); col2.add(m42); col2.add(m32); col2.add(m22); col2.add(m12); col2.add(m02); col3.add(m53); col3.add(m43); col3.add(m33); col3.add(m23); col3.add(m13); col3.add(m03); col4.add(m54); col4.add(m44); col4.add(m34); col4.add(m24); col4.add(m14); col4.add(m04); col5.add(m55); col5.add(m45); col5.add(m35); col5.add(m25); col5.add(m15); col5.add(m05); col6.add(m56); col6.add(m46); col6.add(m36); col6.add(m26); col6.add(m16); col6.add(m06); gameMatrix.add(col0); gameMatrix.add(col1); gameMatrix.add(col2); gameMatrix.add(col3); gameMatrix.add(col4); gameMatrix.add(col5); gameMatrix.add(col6); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); View headerLayout = navigationView.inflateHeaderView(R.layout.nav_header_game); tvName = (TextView) headerLayout.findViewById(R.id.tvName); tvEmail = (TextView) headerLayout.findViewById(R.id.tvEmail); ivProfile = (ImageView) headerLayout.findViewById(R.id.ivProfile); tvName.setText(name); tvEmail.setText(email); /* if(getIntent().hasExtra("image")) { ImageView previewThumbnail = new ImageView(this); Bitmap b = BitmapFactory.decodeByteArray( getIntent().getByteArrayExtra("image"),0,getIntent().getByteArrayExtra("image").length); //previewThumbnail.setImageBitmap(b); ivProfile.setImageBitmap(b); }*/ try{ InputStream is = (InputStream) new URL(photo).getContent(); Drawable d = Drawable.createFromStream(is, "profile_photo"); ivProfile.setImageDrawable(d); /* Bitmap bitmap = BitmapFactory.decodeStream((InputStream)new URL(photo).getContent()); ivProfile.setImageBitmap(bitmap);*/ }catch (Exception e){ //Toast.makeText(GameActivity.this, e.getMessage(), Toast.LENGTH_SHORT).show(); } /* String[] matrix = {"120000", "000000", "000000", "000000", "000000", "100000", "000000"};*/ setMatrix(getGameFromServer(ip,port,"getGameData/"+email)); //Toast.makeText(GameActivity.this, getStringFromServer("192.168.1.14","3000","getGameData/"+email,"gameID"), Toast.LENGTH_SHORT).show(); } @Override public void onBackPressed() { DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); if (drawer.isDrawerOpen(GravityCompat.START)) { drawer.closeDrawer(GravityCompat.START); } else { super.onBackPressed(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.game, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); return super.onOptionsItemSelected(item); } @SuppressWarnings("StatementWithEmptyBody") @Override public boolean onNavigationItemSelected(MenuItem item) { // Handle navigation view item clicks here. int id = item.getItemId(); if (id == R.id.menu_newgame_singlemode) { } else if (id == R.id.menu_newgame_multiplayer) { } else if (id == R.id.menu_stats) { Intent intent = new Intent(this,StatsActivity.class); startActivity(intent); } else if (id == R.id.menu_about) { } else if (id == R.id.menu_logout) { Intent intent = new Intent(this, LoginActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); finish(); } DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); return true; } public void columClick(View view){ int id = view.getId(); switch (id){ case R.id.m00: case R.id.m10: case R.id.m20: case R.id.m30: case R.id.m40: case R.id.m50: clickColum(col0); break; case R.id.m01: case R.id.m11: case R.id.m21: case R.id.m31: case R.id.m41: case R.id.m51: clickColum(col1); break; case R.id.m02: case R.id.m12: case R.id.m22: case R.id.m32: case R.id.m42: case R.id.m52: clickColum(col2); break; case R.id.m03: case R.id.m13: case R.id.m23: case R.id.m33: case R.id.m43: case R.id.m53: clickColum(col3); break; case R.id.m04: case R.id.m14: case R.id.m24: case R.id.m34: case R.id.m44: case R.id.m54: clickColum(col4); break; case R.id.m05: case R.id.m15: case R.id.m25: case R.id.m35: case R.id.m45: case R.id.m55: clickColum(col5); break; case R.id.m06: case R.id.m16: case R.id.m26: case R.id.m36: case R.id.m46: case R.id.m56: clickColum(col6); break; } } public void clickColum(ArrayList<ImageView> col){ for (ImageView iv:col) { String backgroundImageName = (String) iv.getTag(); if(backgroundImageName.equals("empty")){ iv.setTag("full"); setImage(actualColor, iv); actualColor = changeColor(actualColor); JSONArray gameJSONArray = new JSONArray(Arrays.asList(getMatrix())); if (autoMove){ int pos = getWinnerFromServer(ip, port,"sendGameMatriz/"+gameJSONArray+"/"+level+"/"+auto); autoMove = false; if ( pos != -1 ){ clickColum(gameMatrix.get(pos)); } }else { getWinnerFromServer(ip, port,"sendGameMatriz/"+gameJSONArray+"/"+level+"/"+auto); autoMove = true; } //Toast.makeText(GameActivity.this, response, Toast.LENGTH_SHORT).show(); break; } } //Toast.makeText(GameActivity.this, getMatrix()[0], Toast.LENGTH_SHORT).show(); } public void setImage(String color, ImageView view){ if(color =="red"){ view.setImageResource(R.mipmap.ball_red); view.setTag("1"); }else { view.setImageResource(R.mipmap.ball_blue); view.setTag("2"); } } public String changeColor(String color){ if(color.equals("red")){ color = "blue"; bar.setProgress(33); //bar.setDrawingCacheBackgroundColor(Color.BLUE); bar.setBackgroundColor(Color.BLUE); }else { color = "red"; bar.setProgress(66); //bar.setDrawingCacheBackgroundColor(Color.BLUE); bar.setBackgroundColor(Color.RED); } return color; } public void setMatrix(String[] positions){ for (int i = 0; i<positions.length; i++){ for (int j = 0; j<positions[i].length(); j++){ setOnePosition(String.valueOf(positions[i].charAt(j)), gameMatrix.get(i).get(j)); } } } public String[] getMatrix(){ ArrayList<String> aux = new ArrayList<>(); for (int i = 0; i<gameMatrix.size(); i++){ String row=""; for (int j = 0; j<gameMatrix.get(i).size(); j++){ String ivText = String.valueOf(gameMatrix.get(i).get(j).getTag().toString()); if(ivText.equals("empty")){ ivText="0"; } row = row+ ivText; } aux.add(row); } String[] temp = new String[aux.size()]; return aux.toArray(temp); } public void setOnePosition(String position, ImageView iv){ if(position.equals("1")){ setImage("red",iv); iv.setTag("1"); }else if(position.equals("2")){ setImage("blued",iv); iv.setTag("2"); } } /* public String getStringFromServer(String ip, String port,String url, String attr){ NodeData node = new NodeData(); String aux = ""; try{ String data = node.getResponse(ip+":"+port+"/"+url); JSONObject dataJson = node.toJSON(data); aux = dataJson.getString(attr); }catch (Exception e){ Toast.makeText(GameActivity.this, "You're not at home :(\n"+e.getMessage(), Toast.LENGTH_LONG).show(); } return aux; }*/ public String[] getGameFromServer(String ip, String port,String url){ String[] newArray={}; try{ String data = node.getResponse(ip+":"+port+"/"+url); JSONObject dataJson = node.toJSON(data); JSONArray a = dataJson.getJSONArray("data"); newArray = jsonToStringArray(a); }catch (Exception e){ //Toast.makeText(GameActivity.this, "Error!!\n"+e.getMessage(), Toast.LENGTH_LONG).show(); Toast.makeText(GameActivity.this, "Network error!\n", Toast.LENGTH_LONG).show(); disableEnableTableGame(gameMatrix); } return newArray; } public int getWinnerFromServer(String ip, String port,String url){ String response=""; String winner = ""; int movement = -1; try{ String data = node.getResponse(ip+":"+port+"/"+url); JSONObject dataJson = node.toJSON(data); //response = dataJson.getString("data"); winner = dataJson.getString("winner"); //Toast.makeText(GameActivity.this, winner + " " + movement, Toast.LENGTH_SHORT).show(); if (winner.equals("1")){ Toast.makeText(GameActivity.this, "Red wins", Toast.LENGTH_LONG).show(); disableEnableTableGame(gameMatrix); }else if (winner.equals("2") ){ Toast.makeText(GameActivity.this, "Blue wins", Toast.LENGTH_LONG).show(); disableEnableTableGame(gameMatrix); }else { movement = dataJson.getInt("moveColum"); } }catch (Exception e){ //Toast.makeText(GameActivity.this, "Error!!\n"+e.getMessage(), Toast.LENGTH_LONG).show(); Toast.makeText(GameActivity.this, "Network error!\n", Toast.LENGTH_LONG).show(); disableEnableTableGame(gameMatrix); } return movement; } public String[] clearArray(String[] array){ ArrayList<String> newArray = new ArrayList<>(); for (String str:array){ str = str.substring(1, str.length()-1); newArray.add(str); } String[] stockArr = new String[newArray.size()]; stockArr = newArray.toArray(stockArr); return stockArr; } public static String[] jsonToStringArray(JSONArray jsonArray){ String[] stringArray = null; int length = jsonArray.length(); try{ if(jsonArray!=null){ stringArray = new String[length]; for(int i=0;i<length;i++){ stringArray[i]= jsonArray.getString(i); } } }catch (Exception e){ } return stringArray; } public void disableEnableTableGame(ArrayList< ArrayList<ImageView>> ivArray){ for (ArrayList<ImageView> al: ivArray) { for (ImageView iv: al) { if(iv.isEnabled()){ iv.setEnabled(false); }else { iv.setEnabled(true); } } } } }
d73de1bd44071911f62c7f70d09a7ae2fca3bfb7
e27ca5fe3e7f49a0e39a9cacec516e5b63fcae32
/src/io/educative/www/Coding/P12_TopKElement/P12_07_KthLargestNumberInAStream.java
21d326a83bbdd49f18fed0056897cfbec2c4b907
[]
no_license
yao23/Java_Playground
0cb49c98df5c3c149bdc174a2e27aac11b914d58
aa7496b9e55e30952075b47d82be01190166c0ad
refs/heads/master
2023-09-03T05:21:11.864445
2023-09-02T05:46:29
2023-09-02T05:46:29
92,258,959
3
1
null
null
null
null
UTF-8
Java
false
false
1,489
java
package io.educative.www.Coding.P12_TopKElement; import java.util.*; public class P12_07_KthLargestNumberInAStream { PriorityQueue<Integer> minHeap = new PriorityQueue<Integer>((n1, n2) -> n1 - n2); final int k; public P12_07_KthLargestNumberInAStream(int[] nums, int k) { this.k = k; // add the numbers in the min heap for (int i = 0; i < nums.length; i++) add(nums[i]); } /** * Time complexity * The time complexity of the add() function will be O(logK) since we are inserting the new number in the heap. * * Space complexity * The space complexity will be O(K) for storing numbers in the heap. * * @param num */ public int add(int num) { // add the new number in the min heap minHeap.add(num); // if heap has more than 'k' numbers, remove one number if (minHeap.size() > this.k) minHeap.poll(); // return the 'Kth largest number return minHeap.peek(); } public static void main(String[] args) { int[] input = new int[] { 3, 1, 5, 12, 2, 11 }; P12_07_KthLargestNumberInAStream kthLargestNumber = new P12_07_KthLargestNumberInAStream(input, 4); System.out.println("4th largest number is: " + kthLargestNumber.add(6)); System.out.println("4th largest number is: " + kthLargestNumber.add(13)); System.out.println("4th largest number is: " + kthLargestNumber.add(4)); } }
09aa2027eb47f2f3765d9e338d1628c645d0fb17
63e9f1b2fb5b5e1f47f96e9c6c0e9c3f79ca0412
/XDevMessaging/XDevMessaging.Droid/obj/Debug/android/src/mono/com/google/android/gms/maps/GoogleMap_OnIndoorStateChangeListenerImplementor.java
d6e78f8460452859d1f7dd342941631e1c9319ad
[]
no_license
georgekosmidis/Xamarin-Hackathon-2016
9ebf1d312c022c83f60cfd3f28ad256880a1ddd9
f10a893c13a2a9bc899b1f4d21d48a07d1f541f5
refs/heads/master
2022-09-02T00:52:38.722960
2022-08-12T07:44:39
2022-08-12T07:44:39
60,460,957
2
0
null
2022-08-12T07:44:40
2016-06-05T13:20:18
Java
UTF-8
Java
false
false
2,073
java
package mono.com.google.android.gms.maps; public class GoogleMap_OnIndoorStateChangeListenerImplementor extends java.lang.Object implements mono.android.IGCUserPeer, com.google.android.gms.maps.GoogleMap.OnIndoorStateChangeListener { static final String __md_methods; static { __md_methods = "n_onIndoorBuildingFocused:()V:GetOnIndoorBuildingFocusedHandler:Android.Gms.Maps.GoogleMap/IOnIndoorStateChangeListenerInvoker, Xamarin.GooglePlayServices.Maps\n" + "n_onIndoorLevelActivated:(Lcom/google/android/gms/maps/model/IndoorBuilding;)V:GetOnIndoorLevelActivated_Lcom_google_android_gms_maps_model_IndoorBuilding_Handler:Android.Gms.Maps.GoogleMap/IOnIndoorStateChangeListenerInvoker, Xamarin.GooglePlayServices.Maps\n" + ""; mono.android.Runtime.register ("Android.Gms.Maps.GoogleMap+IOnIndoorStateChangeListenerImplementor, Xamarin.GooglePlayServices.Maps, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", GoogleMap_OnIndoorStateChangeListenerImplementor.class, __md_methods); } public GoogleMap_OnIndoorStateChangeListenerImplementor () throws java.lang.Throwable { super (); if (getClass () == GoogleMap_OnIndoorStateChangeListenerImplementor.class) mono.android.TypeManager.Activate ("Android.Gms.Maps.GoogleMap+IOnIndoorStateChangeListenerImplementor, Xamarin.GooglePlayServices.Maps, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", "", this, new java.lang.Object[] { }); } public void onIndoorBuildingFocused () { n_onIndoorBuildingFocused (); } private native void n_onIndoorBuildingFocused (); public void onIndoorLevelActivated (com.google.android.gms.maps.model.IndoorBuilding p0) { n_onIndoorLevelActivated (p0); } private native void n_onIndoorLevelActivated (com.google.android.gms.maps.model.IndoorBuilding p0); java.util.ArrayList refList; public void monodroidAddReference (java.lang.Object obj) { if (refList == null) refList = new java.util.ArrayList (); refList.add (obj); } public void monodroidClearReferences () { if (refList != null) refList.clear (); } }
7618e1dd8302fbab9e9ccc3c54581410d2310f68
4b4f8bc27db101fd6c82dc94e3371d1fe0c37345
/atlas.json.parent/atlas.json.module/src/main/java/io/atlasmap/json/module/JsonModule.java
90ee35dc89b9153671a919e791525185b211adc6
[ "Apache-2.0" ]
permissive
apupier/atlasmap-runtime
d79d0afa2dc4df66790be712576cf8988cceeb14
e812e20e6c61c9212a7ef2b32a489d56ed112025
refs/heads/master
2021-07-23T21:49:02.597526
2017-07-06T16:48:38
2017-07-06T16:48:38
96,566,322
0
0
null
null
null
null
UTF-8
Java
false
false
5,011
java
/** * Copyright (C) 2017 Red Hat, 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 io.atlasmap.json.module; import io.atlasmap.api.AtlasConversionService; import io.atlasmap.api.AtlasException; import io.atlasmap.api.AtlasSession; import io.atlasmap.api.AtlasValidationException; import io.atlasmap.core.BaseAtlasModule; import io.atlasmap.core.DefaultAtlasMappingValidator; import io.atlasmap.spi.AtlasModule; import io.atlasmap.spi.AtlasModuleDetail; import io.atlasmap.spi.AtlasModuleMode; import io.atlasmap.v2.Collection; import io.atlasmap.v2.Field; import io.atlasmap.v2.Mapping; import io.atlasmap.v2.Validations; import io.atlasmap.json.v2.JsonField; import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @AtlasModuleDetail(name = "JsonModule", uri = "atlas:json", modes = { "SOURCE", "TARGET" }, dataFormats = { "json" }, configPackages = { "io.atlasmap.json.v2" }) public class JsonModule extends BaseAtlasModule { private static final Logger logger = LoggerFactory.getLogger(JsonModule.class); @Override public void init() { // TODO Auto-generated method stub } @Override public void destroy() { // TODO Auto-generated method stub } @Override public void processPreExecution(AtlasSession arg0) throws AtlasException { if(logger.isDebugEnabled()) { logger.debug("processPreExcution completed"); } } @Override public void processPreValidation(AtlasSession atlasSession) throws AtlasException { if(atlasSession == null || atlasSession.getMapping() == null) { logger.error("Invalid session: Session and AtlasMapping must be specified"); throw new AtlasValidationException("Invalid session"); } DefaultAtlasMappingValidator defaultValidator = new DefaultAtlasMappingValidator(atlasSession.getMapping()); Validations validations = defaultValidator.validateAtlasMappingFile(); if(logger.isDebugEnabled()) { logger.debug("Detected " + validations.getValidation().size() + " core validation notices"); } JsonMappingValidator jsonValidator = new JsonMappingValidator(atlasSession.getMapping(), validations); validations = jsonValidator.validateAtlasMappingFile(); if(logger.isDebugEnabled()) { logger.debug("Detected " + validations.getValidation().size() + " json validation notices"); } if(logger.isDebugEnabled()) { logger.debug("processPreValidation completed"); } } @Override public void processInputMapping(AtlasSession session, Mapping mapping) throws AtlasException { } @Override public void processInputCollection(AtlasSession session, Collection mapping) throws AtlasException { } @Override public void processOutputMapping(AtlasSession session, Mapping mapping) throws AtlasException { } @Override public void processOutputCollection(AtlasSession session, Collection mapping) throws AtlasException { } @Override public void processPostExecution(AtlasSession arg0) throws AtlasException { if(logger.isDebugEnabled()) { logger.debug("processPostExecution completed"); } } @Override public void processPostValidation(AtlasSession arg0) throws AtlasException { if(logger.isDebugEnabled()) { logger.debug("processPostValidation completed"); } } @Override public AtlasModuleMode getMode() { return null; } @Override public void setMode(AtlasModuleMode atlasModuleMode) { } @Override public List<AtlasModuleMode> listSupportedModes() { return null; } @Override public Boolean isStatisticsSupported() { return null; } @Override public Boolean isStatisticsEnabled() { return null; } @Override public Boolean isSupportedField(Field field) { if (field instanceof JsonField) { return true; } return false; } @Override public AtlasConversionService getConversionService() { // TODO Auto-generated method stub return null; } @Override public void setConversionService(AtlasConversionService arg0) { // TODO Auto-generated method stub } }
4eaab7df35f56bfd403037028f46b9fde17a3d9e
539c6f876354a7c294dc33049958a4f000494c7b
/src/main/java/rocketMQ/Consumer.java
5162f5d6fd3aea69d59da8808937ef190256e940
[]
no_license
ZLBer/DaliyOfProgramme
3392dd9a0ba4d749da6291123892e73f7b5cb981
738dec918d659e98c74be2c177dc5b259e05b9b9
refs/heads/master
2022-10-19T03:09:14.066572
2021-01-03T11:48:16
2021-01-03T11:48:16
164,304,274
1
0
null
2022-09-01T23:01:21
2019-01-06T12:20:06
Java
UTF-8
Java
false
false
2,630
java
package rocketMQ; import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer; import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext; import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus; import org.apache.rocketmq.client.consumer.listener.MessageListenerConcurrently; import org.apache.rocketmq.client.exception.MQClientException; import org.apache.rocketmq.common.consumer.ConsumeFromWhere; import org.apache.rocketmq.common.message.MessageExt; import java.util.List; /** * Created by libin on 2019/1/4. */ public class Consumer { public static void main(String[] args) throws InterruptedException, MQClientException { //声明并初始化一个consumer //需要一个consumer group名字作为构造方法的参数,这里为consumer1 DefaultMQPushConsumer consumer = new DefaultMQPushConsumer("consumer1"); //consumer.setVipChannelEnabled(false); //同样也要设置NameServer地址 consumer.setNamesrvAddr("39.107.99.207:9876"); //这里设置的是一个consumer的消费策略 //CONSUME_FROM_LAST_OFFSET 默认策略,从该队列最尾开始消费,即跳过历史消息 //CONSUME_FROM_FIRST_OFFSET 从队列最开始开始消费,即历史消息(还储存在broker的)全部消费一遍 //CONSUME_FROM_TIMESTAMP 从某个时间点开始消费,和setConsumeTimestamp()配合使用,默认是半个小时以前 consumer.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_FIRST_OFFSET); //设置consumer所订阅的Topic和Tag,*代表全部的Tag consumer.subscribe("TopicTest", "*"); //设置一个Listener,主要进行消息的逻辑处理 consumer.registerMessageListener(new MessageListenerConcurrently() { @Override public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> msgs, ConsumeConcurrentlyContext context) { System.out.println(Thread.currentThread().getName() + " Receive New Messages: " + msgs); System.out.println("----------------------------------------------------------------------------------"); //返回消费状态 //CONSUME_SUCCESS 消费成功 //RECONSUME_LATER 消费失败,需要稍后重新消费 return ConsumeConcurrentlyStatus.CONSUME_SUCCESS; } }); //调用start()方法启动consumer consumer.start(); System.out.println("Consumer Started."); } }
548f34913a0324ee29aa99ae683b5845b670505a
24b1d0283e79c6452f3bdd6d136fb8920743feaa
/app/src/main/java/com/shoppingcart/ui/home/HomeFragment.java
eb6e059c81fbf61b2b7c3d682fae095ea084e867
[]
no_license
MarcLab1/ShoppingCart
658832d482e57dbd60b089a47fbf0dcebe88de7f
66b38879d43338433ca94405b9eafaa322f4bb1f
refs/heads/master
2022-11-30T06:57:00.570652
2020-08-01T14:19:31
2020-08-01T14:19:31
277,168,535
0
0
null
null
null
null
UTF-8
Java
false
false
14,550
java
package com.shoppingcart.ui.home; import android.content.SharedPreferences; import android.os.AsyncTask; import android.os.Bundle; import android.preference.PreferenceManager; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.lifecycle.ViewModelProviders; import androidx.navigation.NavController; import androidx.navigation.Navigation; import androidx.recyclerview.widget.RecyclerView; import androidx.room.Room; import com.google.android.flexbox.AlignItems; import com.google.android.flexbox.FlexDirection; import com.google.android.flexbox.FlexboxLayoutManager; import com.google.android.flexbox.JustifyContent; import com.shoppingcart.HelperFormatter; import com.shoppingcart.room.Item; import com.shoppingcart.room.ItemDB; import com.shoppingcart.R; import com.shoppingcart.MyViewModel; import java.util.ArrayList; import java.util.List; public class HomeFragment extends Fragment { private MyViewModel myViewModel; private List<Item> itemList; private RecyclerView itemView; private FlexboxAdapter flexboxAdapter; private static ItemDB itemDB; private NavController navController; private View root; public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { myViewModel = ViewModelProviders.of(getActivity()).get(MyViewModel.class); root = inflater.inflate(R.layout.fragment_home, container, false); itemView = root.findViewById(R.id.items_view); itemList = myViewModel.getItems().getValue(); itemDB = Room.databaseBuilder(getContext(), ItemDB.class, "dbone").build(); SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getContext()); if (!preferences.getBoolean("firstrun", false)) { new DBAsync().execute(); SharedPreferences.Editor editor = preferences.edit(); editor.putBoolean("firstrun", true).apply(); } new QueryItems().execute(); FlexboxLayoutManager layoutManager = new FlexboxLayoutManager(getActivity()); layoutManager.setFlexDirection(FlexDirection.ROW); layoutManager.setJustifyContent(JustifyContent.FLEX_START); layoutManager.setAlignItems(AlignItems.FLEX_START); itemView.setLayoutManager(layoutManager); //Required to inflate the options in the menubar setHasOptionsMenu(true); return root; } @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); navController = Navigation.findNavController(root); } @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.home_menu, menu); super.onCreateOptionsMenu(menu,inflater); } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.cart) { navController.navigate(R.id.action_navigation_home_to_navigation_cart); } return super.onOptionsItemSelected(item); } private static class DBAsync extends AsyncTask<Void, Void, Void> { @Override protected Void doInBackground(Void... voids) { Item item1 = new Item(); item1.setName("Eggs"); item1.setBrand("Omega 3"); item1.setRegularPrice(2.99); item1.setSavePrice(0.50); item1.setWeight("12 count"); item1.setInventory(10); item1.setImage(R.drawable.eggs); itemDB.getItemDao().insert(item1); Item item2 = new Item(); item2.setName("Crackers"); item2.setBrand("Breton"); item2.setRegularPrice(3.59); item2.setSavePrice(0); item2.setWeight("225g"); item2.setInventory(10); item2.setImage(R.drawable.crackers); itemDB.getItemDao().insert(item2); Item item3 = new Item(); item3.setName("Orange Juice"); item3.setBrand("Tropicana"); item3.setRegularPrice(4.99); item3.setSavePrice(0); item3.setInventory(10); item3.setWeight("1.54L"); item3.setImage(R.drawable.orange_juice); itemDB.getItemDao().insert(item3); Item item4 = new Item(); item4.setName("Lettuce"); item4.setRegularPrice(1.99); item4.setSavePrice(0); item4.setInventory(10); item4.setImage(R.drawable.lettuce); itemDB.getItemDao().insert(item4); Item item5 = new Item(); item5.setName("Carrots"); item5.setBrand("Farmers Market"); item5.setRegularPrice(3.99); item5.setSavePrice(1.00); item5.setInventory(10); item5.setWeight("3lb bag"); item5.setImage(R.drawable.carrots); itemDB.getItemDao().insert(item5); Item item6 = new Item(); item6.setName("Burgers"); item6.setBrand("PC"); item6.setRegularPrice(18.99); item6.setSavePrice(5.00); item6.setInventory(10); item6.setWeight("1.13kg"); item6.setImage(R.drawable.burgers); itemDB.getItemDao().insert(item6); Item item7 = new Item(); item7.setName("English Muffins"); item7.setRegularPrice(2.99); item7.setSavePrice(1.00); item7.setInventory(10); item7.setWeight("390g"); item7.setBrand("Wonder"); item7.setImage(R.drawable.eng_muffin); itemDB.getItemDao().insert(item7); Item item8 = new Item(); item8.setName("Tomato"); item8.setRegularPrice(1.00); item8.setSavePrice(0); item8.setInventory(10); item8.setWeight("50g"); item8.setImage(R.drawable.tomato); itemDB.getItemDao().insert(item8); Item item9 = new Item(); item9.setName("Peanut Butter"); item9.setRegularPrice(4.99); item9.setSavePrice(2.00); item9.setInventory(10); item9.setWeight("1kg"); item9.setBrand("Kraft"); item9.setImage(R.drawable.peanut_butter); itemDB.getItemDao().insert(item9); Item item10 = new Item(); item10.setName("Skittles"); item10.setRegularPrice(2.99); item10.setSavePrice(1.00); item10.setInventory(10); item10.setWeight("191g"); item10.setImage(R.drawable.skittles); itemDB.getItemDao().insert(item10); Item item11 = new Item(); item11.setName("2% Milk"); item11.setBrand("Natrel"); item11.setRegularPrice(4.99); item11.setSavePrice(1.00); item11.setWeight("4L"); item11.setInventory(10); item11.setImage(R.drawable.milk); itemDB.getItemDao().insert(item11); Item item12 = new Item(); item12.setName("Cheese Slices"); item12.setBrand("Kraft"); item12.setRegularPrice(3.79); item12.setSavePrice(1.00); item12.setWeight("410g"); item12.setInventory(10); item12.setImage(R.drawable.cheese); itemDB.getItemDao().insert(item12); return null; } } private class QueryItems extends AsyncTask<Void, Void, Void> { @Override protected Void doInBackground(Void... voids) { if (itemList == null) itemList = itemDB.getItemDao().getAllItemsInStock(); return null; } @Override protected void onPostExecute(Void aVoid) { super.onPostExecute(aVoid); flexboxAdapter = new FlexboxAdapter(itemList); itemView.setAdapter(flexboxAdapter); flexboxAdapter.notifyDataSetChanged(); } } public class FlexboxAdapter extends RecyclerView.Adapter<FlexboxAdapter.ViewHolder> { private List<Item> items; public FlexboxAdapter(List<Item> itemList) { items = new ArrayList<>(); items = itemList; } @Override public FlexboxAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item, parent, false); return new FlexboxAdapter.ViewHolder(itemView); } @Override public void onBindViewHolder(final FlexboxAdapter.ViewHolder holder, int position) { final Item itm = items.get(position); holder.name.setText(itm.getName()); holder.brand.setText(itm.getBrand()); holder.price.setText(HelperFormatter.getTotalString(itm.getPrice())); if (itm.getSavePrice() != 0) holder.save_price.setText(HelperFormatter.getSaveString(itm.getSavePrice())); holder.weight.setText(itm.getWeight()); holder.image.setBackgroundResource(itm.getImage()); if (itm.getCount() != 0) { holder.layout_quantity.setVisibility(View.VISIBLE); holder.layout_add.setVisibility(View.GONE); } holder.count.setText(String.valueOf(itm.getCount())); holder.increase_quantity.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (itemList.indexOf(itm) == -1) return; itemList.get(itemList.indexOf(itm)).increaseCount(); myViewModel.getItems().setValue(itemList); holder.count.setText(String.valueOf(itm.getCount())); } } ); holder.button_add.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (itemList.indexOf(itm) == -1) return; itemList.get(itemList.indexOf(itm)).setCount(1); myViewModel.getItems().setValue(itemList); holder.count.setText(String.valueOf(itm.getCount())); holder.layout_quantity.setVisibility(View.VISIBLE); holder.layout_add.setVisibility(View.GONE); } } ); holder.decrease_quantity.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (itemList.indexOf(itm) == -1) return; itemList.get(itemList.indexOf(itm)).decreaseCount(); if (itemList.get(itemList.indexOf(itm)).getCount() == 0) { holder.layout_quantity.setVisibility(View.GONE); holder.layout_add.setVisibility(View.VISIBLE); } myViewModel.getItems().setValue(itemList); holder.count.setText(String.valueOf(itm.getCount())); } } ); } @Override public int getItemCount() { return items.size(); } class ViewHolder extends RecyclerView.ViewHolder { private TextView name, brand, price, save_price, weight, count, button_add; private ImageView increase_quantity, decrease_quantity; private LinearLayout layout_quantity, layout_add; private ImageView image; ViewHolder(View itemView) { super(itemView); name = itemView.findViewById(R.id.item_name); brand = itemView.findViewById(R.id.item_brand); price = itemView.findViewById(R.id.item_price); save_price = itemView.findViewById(R.id.item_save_price); weight = itemView.findViewById(R.id.item_weight); count = itemView.findViewById(R.id.item_product_count); image = itemView.findViewById(R.id.item_image); increase_quantity = itemView.findViewById(R.id.button_increase_quantity); decrease_quantity = itemView.findViewById(R.id.button_decrease_quantity); button_add = itemView.findViewById(R.id.button_add); layout_quantity = itemView.findViewById(R.id.layout_quantity); layout_add = itemView.findViewById(R.id.layout_add); } } } }
954045b94e9e1ba559c0458499c1dc54bcb4a2f1
8916bc17b8e87e8b4c2ebf26b98cf5c7bcb57d54
/app/src/main/java/com/example/bader/recihelp/AboutUsFragment.java
4c875a42070bf9f2ad3237534716770d103750fe
[]
no_license
Redab0/RecipesApp
8015cbfcfa3dcaf0faaede4fe584afb5b831fac2
98bc571234c90a69f33b09ee2288b59501c13b70
refs/heads/master
2020-03-25T18:34:20.463411
2018-08-08T16:07:42
2018-08-08T16:07:42
144,037,640
0
0
null
null
null
null
UTF-8
Java
false
false
663
java
package com.example.bader.recihelp; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; /** * A simple {@link Fragment} subclass. */ public class AboutUsFragment extends Fragment { public AboutUsFragment() { // Required empty public constructor } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_about_us, container, false); } }
e0a2a45e2fc9a1b201b53ae4d945b7350fe06ac6
58a308f80f0baef2377f9348c2905724ffba9e87
/JMS/src/org/jpxx/mail/core/pop3/message/MailMessageHeader.java
457407828b675fbcd8da3c6f0dbf4af4dafed1a3
[]
no_license
shimoyuki/TestCode
5171a4a68cf971a7939989d17f53319e51726b82
df712eea214a34b00b38c9b25d6d39f94c4b587f
refs/heads/master
2020-08-28T20:53:04.732664
2019-10-27T07:17:15
2019-10-27T07:17:15
217,816,491
0
0
null
null
null
null
UTF-8
Java
false
false
3,525
java
/**************************************************************** * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * * * * Copyright 2009 Jun Li( The SOFTWARE ENGINEERING COLLEGE OF * * SiChuan University). All rights reserved. * * * * Licensed to the JMS under one or more contributor license * * agreements. See the LICENCE file distributed with this * * work for additional information regarding copyright * * ownership. The JMS licenses this file you may not use this * * file except in compliance with the License. * * * * 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.jpxx.mail.core.pop3.message; /** * An individual message header.<br> * * An MailMessageHeader object with a null value is used as a placeholder * for headers of that name, to preserve the order of headers. * A placeholder MailMessageHeader object with a name of ":" marks * the location in the list of headers where new headers are * added by default. * * @author Jun Li * @version $Revision: 0.0.1 $, $Date: 2008/04/26 19:11:00 $ * */ public class MailMessageHeader extends Header { /** * Note that the value field from the superclass * isn't used in this class. We extract the value * from the line field as needed. We store the line * rather than just the value to ensure that we can * get back the exact original line, with the original * whitespace, etc. */ private String line; /** * Constructor that takes a line and splits out * the header name. */ public MailMessageHeader(String line) { super("", ""); int i = line.indexOf(':'); if (i < 0) { // should never happen name = line.trim(); } else { name = line.substring(0, i).trim(); } this.line = line; } /** * Constructor that takes a header name and value. */ public MailMessageHeader(String n, String v) { super(n, ""); if (v != null) { this.line = n + ": " + v; } else { this.line = null; } } /** * Return the "value" part of the header line. */ @Override public String getValue() { int i = line.indexOf(':'); if (i < 0) { return line; } // skip whitespace after ':' int j; for (j = i + 1; j < line.length(); j++) { char c = line.charAt(j); if (!(c == ' ' || c == '\t' || c == '\r' || c == '\n')) { break; } } return line.substring(j); } /** * Get the line * @return the line */ public String getLine() { return this.line; } /** * Set the line * @param line */ public void setLine(String line) { this.line = line; } }
be6baef9a502a5840249182928a012d286870e6f
7aaf8f4d306b551b1c954658476d3abb3dbe8d3d
/app/src/main/java/id/co/telkomsigma/Diarium/util/ZoomableImageView.java
f55a8e1f9f8ece806c4adfbda31251236fc557f4
[]
no_license
ahmadasrorihd/Diarium_SuperApps_LMS
6669512cf70dfff13804ea5854374c25a1ac14a1
66d1e22f75de743f2fc53d53240cb23b175b7717
refs/heads/master
2022-03-13T04:12:59.545625
2019-10-28T03:48:53
2019-10-28T03:48:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
10,372
java
package id.co.telkomsigma.Diarium.util; /** * Created by telkomsigma on 9/26/17. */ import android.content.Context; import android.graphics.Bitmap; import android.graphics.Matrix; import android.graphics.PointF; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.ScaleGestureDetector; import android.view.View; public class ZoomableImageView extends androidx.appcompat.widget.AppCompatImageView { Matrix matrix = new Matrix(); static final int NONE = 0; static final int DRAG = 1; static final int ZOOM = 2; static final int CLICK = 3; int mode = NONE; PointF last = new PointF(); PointF start = new PointF(); float minScale = 1f; float maxScale = 4f; float[] m; float redundantXSpace, redundantYSpace; float width, height; float saveScale = 1f; float right, bottom, origWidth, origHeight, bmWidth, bmHeight; ScaleGestureDetector mScaleDetector; Context context; public ZoomableImageView(Context context, AttributeSet attr) { super(context, attr); super.setClickable(true); this.context = context; mScaleDetector = new ScaleGestureDetector(context, new ScaleListener()); matrix.setTranslate(1f, 1f); m = new float[9]; setImageMatrix(matrix); setScaleType(ScaleType.MATRIX); setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { mScaleDetector.onTouchEvent(event); matrix.getValues(m); float x = m[Matrix.MTRANS_X]; float y = m[Matrix.MTRANS_Y]; PointF curr = new PointF(event.getX(), event.getY()); switch (event.getAction()) { //when one finger is touching //set the mode to DRAG case MotionEvent.ACTION_DOWN: last.set(event.getX(), event.getY()); start.set(last); mode = DRAG; break; //when two fingers are touching //set the mode to ZOOM case MotionEvent.ACTION_POINTER_DOWN: last.set(event.getX(), event.getY()); start.set(last); mode = ZOOM; break; //when a finger moves //If mode is applicable move image case MotionEvent.ACTION_MOVE: //if the mode is ZOOM or //if the mode is DRAG and already zoomed if (mode == ZOOM || (mode == DRAG && saveScale > minScale)) { float deltaX = curr.x - last.x;// x difference float deltaY = curr.y - last.y;// y difference float scaleWidth = Math.round(origWidth * saveScale);// width after applying current scale float scaleHeight = Math.round(origHeight * saveScale);// height after applying current scale //if scaleWidth is smaller than the views width //in other words if the image width fits in the view //limit left and right movement if (scaleWidth < width) { deltaX = 0; if (y + deltaY > 0) deltaY = -y; else if (y + deltaY < -bottom) deltaY = -(y + bottom); } //if scaleHeight is smaller than the views height //in other words if the image height fits in the view //limit up and down movement else if (scaleHeight < height) { deltaY = 0; if (x + deltaX > 0) deltaX = -x; else if (x + deltaX < -right) deltaX = -(x + right); } //if the image doesnt fit in the width or height //limit both up and down and left and right else { if (x + deltaX > 0) deltaX = -x; else if (x + deltaX < -right) deltaX = -(x + right); if (y + deltaY > 0) deltaY = -y; else if (y + deltaY < -bottom) deltaY = -(y + bottom); } //move the image with the matrix matrix.postTranslate(deltaX, deltaY); //set the last touch location to the current last.set(curr.x, curr.y); } break; //first finger is lifted case MotionEvent.ACTION_UP: mode = NONE; int xDiff = (int) Math.abs(curr.x - start.x); int yDiff = (int) Math.abs(curr.y - start.y); if (xDiff < CLICK && yDiff < CLICK) performClick(); break; // second finger is lifted case MotionEvent.ACTION_POINTER_UP: mode = NONE; break; } setImageMatrix(matrix); invalidate(); return true; } }); } @Override public void setImageBitmap(Bitmap bm) { super.setImageBitmap(bm); bmWidth = bm.getWidth(); bmHeight = bm.getHeight(); } public void setMaxZoom(float x) { maxScale = x; } private class ScaleListener extends ScaleGestureDetector.SimpleOnScaleGestureListener { @Override public boolean onScaleBegin(ScaleGestureDetector detector) { mode = ZOOM; return true; } @Override public boolean onScale(ScaleGestureDetector detector) { float mScaleFactor = detector.getScaleFactor(); float origScale = saveScale; saveScale *= mScaleFactor; if (saveScale > maxScale) { saveScale = maxScale; mScaleFactor = maxScale / origScale; } else if (saveScale < minScale) { saveScale = minScale; mScaleFactor = minScale / origScale; } right = width * saveScale - width - (2 * redundantXSpace * saveScale); bottom = height * saveScale - height - (2 * redundantYSpace * saveScale); if (origWidth * saveScale <= width || origHeight * saveScale <= height) { matrix.postScale(mScaleFactor, mScaleFactor, width / 2, height / 2); if (mScaleFactor < 1) { matrix.getValues(m); float x = m[Matrix.MTRANS_X]; float y = m[Matrix.MTRANS_Y]; if (mScaleFactor < 1) { if (Math.round(origWidth * saveScale) < width) { if (y < -bottom) matrix.postTranslate(0, -(y + bottom)); else if (y > 0) matrix.postTranslate(0, -y); } else { if (x < -right) matrix.postTranslate(-(x + right), 0); else if (x > 0) matrix.postTranslate(-x, 0); } } } } else { matrix.postScale(mScaleFactor, mScaleFactor, detector.getFocusX(), detector.getFocusY()); matrix.getValues(m); float x = m[Matrix.MTRANS_X]; float y = m[Matrix.MTRANS_Y]; if (mScaleFactor < 1) { if (x < -right) matrix.postTranslate(-(x + right), 0); else if (x > 0) matrix.postTranslate(-x, 0); if (y < -bottom) matrix.postTranslate(0, -(y + bottom)); else if (y > 0) matrix.postTranslate(0, -y); } } return true; } } @Override protected void onMeasure (int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); width = MeasureSpec.getSize(widthMeasureSpec); height = MeasureSpec.getSize(heightMeasureSpec); //Fit to screen. float scale; float scaleX = width / bmWidth; float scaleY = height / bmHeight; scale = Math.min(scaleX, scaleY); matrix.setScale(scale, scale); setImageMatrix(matrix); saveScale = 1f; // Center the image redundantYSpace = height - (scale * bmHeight) ; redundantXSpace = width - (scale * bmWidth); redundantYSpace /= 2; redundantXSpace /= 2; matrix.postTranslate(redundantXSpace, redundantYSpace); origWidth = width - 2 * redundantXSpace; origHeight = height - 2 * redundantYSpace; right = width * saveScale - width - (2 * redundantXSpace * saveScale); bottom = height * saveScale - height - (2 * redundantYSpace * saveScale); setImageMatrix(matrix); } }
f763d6864972a509420bc1129d9f8400a6f83f59
0ae99add80141d71f16f6d6b6c5cc1909a0341fc
/se/src/main/java/okw/gui/adapter/selenium/SeTextarea.java
5a268f3d3a04934e8c54a18167a0bbdbfc6cac1d
[]
no_license
cie/OKW
24e799db9d3beb916e5aa678e6305486d4350380
c6fd469a19ab6488c44ae69df62127248b6affad
refs/heads/master
2020-05-01T17:09:19.420992
2019-08-23T11:02:40
2019-08-23T11:02:40
177,592,491
0
0
null
2019-03-25T13:31:10
2019-03-25T13:31:10
null
UTF-8
Java
false
false
8,934
java
/* ============================================================================== Author: Zoltán Hrabovszki <[email protected]> Copyright © 2012 - 2019, 2016 IT-Beratung Hrabovszki www.OpenKeyWord.de ============================================================================== This file is part of OpenKeyWord. OpenKeyWord is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. OpenKeyWord is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenKeyWord. If not, see <http://www.gnu.org/licenses/>. Diese Datei ist Teil von OpenKeyWord. OpenKeyWord ist Freie Software: Sie können es unter den Bedingungen der GNU General Public License, wie von der Free Software Foundation, Version 3 der Lizenz oder (nach Ihrer Wahl) jeder späteren veröffentlichten Version, weiterverbreiten und/oder modifizieren. OpenKeyWord wird in der Hoffnung, dass es nützlich sein wird, aber OHNE JEDE GEWÄHRLEISTUNG, bereitgestellt; sogar ohne die implizite Gewährleistung der MARKTFÄHIGKEIT oder EIGNUNG FÜR EINEN BESTIMMTEN ZWECK. Siehe die GNU General Public License für weitere Details. Sie sollten eine Kopie der GNU General Public License zusammen mit OpenKeyWord erhalten haben. Wenn nicht, siehe <http://www.gnu.org/licenses/>. */ package okw.gui.adapter.selenium; import java.util.ArrayList; import org.apache.commons.lang3.StringUtils; import org.openqa.selenium.WebElement; import okw.OKW_Const_Sngltn; import okw.gui.OKWLocatorBase; /** * @ingroup groupSeleniumChildGUIAdapter * \~german * Diese Klasse implmenetiert die Methoden der IOKW_SimpleDataObj für ein Texfeld<br/>. * GUI-Automatisierungswerkzeug: Selenium.<br/> * Die meisten Methoden werden aus der abtrakten Klasse SeSimpleDataObjekt geerbt. * * \~ * @author Zoltan Hrabovszki * @date 2014.06.2014 */ public class SeTextarea extends SeAnyChildWindow { /** * \copydoc SeAnyChildWindow::SeAnyChildWindow(String,OKWLocator...) */ public SeTextarea(String Locator, OKWLocatorBase... fpLocators) { super(Locator, fpLocators); } /** \~german * Ermittelt den textuellen Inhalt des Labels. * * Es wird das Attribute "textContent" des mit "id" an das aktuelle Objekt angebunde "Laben" gelesen. * * @return Rückgabe des Label-Textes. * \~english * \~ * @author Zoltán Hrabovszki * @date 2018.12.27 */ public Integer getMaxLength() { Integer lviReturn = 0; try { this.LogFunctionStartDebug( "getMaxLength" ); // Warten auf das Objekt. Wenn es nicht existiert wird mit OKWGUIObjectNotFoundException beendet... this.WaitForMe(); // The Attribute "MaxLength" auslesen... String lvsMaxLength = this.Me().getAttribute( "maxlength" ); if ( !okw.OKW_Helper.isStringNullOrEmpty( lvsMaxLength) ) { lviReturn = Integer.parseInt( lvsMaxLength ); } } finally { this.LogFunctionEndDebug( lviReturn.toString() ); } return lviReturn; } /** \~german * Ermittelt den textuellen Inhalt des Labels. * * Es wird das Attribute "minlength". * * @return Rückgabe des minlength-Wertes. * \~english * \~ * @author Zoltán Hrabovszki * @date 07-07-2019 */ public Integer getMinLength() { Integer lviReturn = 0; try { this.LogFunctionStartDebug( "getMinLength" ); // Warten auf das Objekt. Wenn es nicht existiert wird mit OKWGUIObjectNotFoundException beendet... this.WaitForMe(); // The Attribute "MaxLength" auslesen... String lvsMaxLength = this.Me().getAttribute( "minlength" ); if ( !okw.OKW_Helper.isStringNullOrEmpty( lvsMaxLength) ) { lviReturn = Integer.parseInt( lvsMaxLength ); } } finally { this.LogFunctionEndDebug( lviReturn.toString() ); } return lviReturn; } /** \~german * Liest den Placeholder des TextAere-Tags aus. * * Es wird das Attribut "placeholder" ausgelesen. * @return Wert des Attributs "placeholder" * * \~english * Reads the current placeholder of the input-tag. * * It reads the attribute "placeholder". * * @return The value of the attribute "placeholder" * * \~ * @author Zoltán Hrabovszki * @date 2018.10.28 */ public ArrayList<String> getPlaceholder() { ArrayList<String> lvLsReturn = new ArrayList<String>(); try { this.LogFunctionStartDebug( "getPlaceholder" ); // Warten auf das Objekt. Wenn es nicht existiert wird mit OKWGUIObjectNotFoundException beendet... this.WaitForMe(); // The Attribute "placeholder" wird als Beschriftung angezeigt... String myAttribute = this.Me().getAttribute( "placeholder" ); myAttribute = StringUtils.normalizeSpace( myAttribute ); lvLsReturn.add( myAttribute ); } finally { this.LogFunctionEndDebug( lvLsReturn ); } return lvLsReturn; } /** \~german * \brief * Ermittelt den textuellen Inhalt eines Textfeldes.<br/>. * GUI-Automatisierungswerkzeug: Selenium.<br/> * * \return * Gibt den Textuellen Inhaltes eines DOM-TextField-s zurück. * Es korrespondieren je eine Zeile des GUI-Objektes mit jeweil einem Listen-Element.<br/> * Ein Textfield besteht aus einerZeile: Daher wird der Wert des Textfield-s im ListenElement[0] abgelegt. * Zurückgegeben. * \return * \~ * \author Zoltan Hrabovszki * \date 2014.06.2014 * @throws Exception */ @Override public ArrayList<String> getValue() { ArrayList<String> lvLsReturn = new ArrayList<String>(); try { this.LogFunctionStartDebug("GetValue"); // Warten auf das Objekt. Wenn es nicht existiert wird mit OKWGUIObjectNotFoundException beendet... this.WaitForMe(); // Get Value from TextField and put this into the return List<string> String myValue = this.Me().getAttribute("value"); if(myValue!=null) { lvLsReturn.add(this.Me().getAttribute("value")); } } finally { this.LogFunctionEndDebug(lvLsReturn.toString()); } return lvLsReturn; } // / \~german public void SetValue( ArrayList<String> Values ) { this.LogFunctionStartDebug( "SetValue", "Val", Values.toString() ); try { // Warten auf das Objekt. Wenn es nicht existiert wird mit OKWGUIObjectNotFoundException beendet... this.WaitForMe(); WebElement myMe = this.Me(); myMe.clear(); for (String Value : Values) { if (Value.equals( OKW_Const_Sngltn.getInstance().GetOKWConst4Internalname( "DELETE" ) )) { myMe.clear(); } else { myMe.sendKeys( Value ); } } } finally { this.LogFunctionEndDebug(); } } }
7c4b4557748022dc56648cf9fe90e99834efb889
a6002161766b0794e7ae843d34c40cea1229f45a
/app/src/main/java/com/fbojor/college/budget/activity/EditTransactionActivity.java
c327d17f123f8cf2b02cce42f2e654467b358b45
[]
no_license
cristianbojor/budget-app-android
91798aa82f0884e46afbba45e29c11e15ad80999
8cc2c94542078b8f4269daad5b2afa0d6100b6f8
refs/heads/master
2021-06-10T12:19:42.478298
2017-01-19T14:51:00
2017-01-19T15:51:42
72,109,367
0
0
null
null
null
null
UTF-8
Java
false
false
2,464
java
package com.fbojor.college.budget.activity; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.EditText; import com.fbojor.college.budget.R; import com.fbojor.college.budget.model.FirebaseTransactionRepository; import com.fbojor.college.budget.model.Transaction; import com.fbojor.college.budget.util.EventListener; public class EditTransactionActivity extends AppCompatActivity implements EventListener<Transaction> { private EditText sum; private EditText details; private Transaction transaction; private FirebaseTransactionRepository repository; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); repository = new FirebaseTransactionRepository(getApplicationContext()); setContentView(R.layout.activity_edit_transaction); Intent intent = getIntent(); String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE); sum = (EditText) findViewById(R.id.sum); details = (EditText) findViewById(R.id.details); if (intent.hasExtra(TransactionListActivity.TRANSACTION_ID)) { String transactionId = intent.getStringExtra(TransactionListActivity.TRANSACTION_ID); repository.get(transactionId, this); } } public void save(View view) { Transaction newTransaction = new Transaction( transaction == null ? null : transaction.getId(), Double.valueOf(sum.getText().toString()), details.getText().toString() ); repository.add(newTransaction); Intent intent = new Intent(this, TransactionListActivity.class); startActivity(intent); } public void delete(View view) { repository.delete(transaction); Intent intent = new Intent(this, TransactionListActivity.class); startActivity(intent); finish(); } @Override public void onSuccess(Transaction data) { Intent intent = getIntent(); if (intent.hasExtra(TransactionListActivity.TRANSACTION_ID)) { transaction = data; sum.setText(transaction.getSum().toString()); details.setText(transaction.getDetails()); } } // @Override // protected void onDestroy() { // repository.close(); // super.onDestroy(); // } }
0f91b86d91169a57b29076e09b1a9899c6a585df
b114f1ffccb62743d71f5050e5747bff587cf1dc
/sivaksin/src/main/java/apap/ti1/sivaksin/service/VaksinService.java
7915ee5fb040bd0e448e3d140e36738fccb8cade
[]
no_license
mazayazyn/tugas1_sivaksin_1906399000
fffee0f2bef8c2f08bf7e1556fea3156405dd939
797f337b434ad757a5ee48434280a65398f3d71a
refs/heads/main
2023-08-24T17:31:13.531849
2021-10-16T16:43:28
2021-10-16T16:43:28
415,217,040
0
0
null
null
null
null
UTF-8
Java
false
false
333
java
package apap.ti1.sivaksin.service; import apap.ti1.sivaksin.model.FaskesModel; import apap.ti1.sivaksin.model.VaksinModel; import java.util.List; public interface VaksinService { List<VaksinModel> getListVaksin(); VaksinModel getVaksinByIdVaksin(Long idVaksin); VaksinModel getVaksinByJenisVaksin(String jenisVaksin); }
fee358e267bb4d5d9589c5d8ae4503782629260f
1234ac62cb84f1ab4fb78caca432991ee66d7fc9
/pddemo/src/main/java/singleton/lazy/LazyThree.java
c169a244910755553fd4866dee8bb30c5083fa75
[]
no_license
niushengqiang/DesignPatternDemoes
2841a8068223425b578562f8ff44c370df706bcd
94fd807994cc0a01a51db6dc67bbefc17462ee42
refs/heads/master
2020-04-07T13:11:20.623213
2019-05-10T15:36:55
2019-05-10T15:36:55
158,396,245
1
0
null
null
null
null
UTF-8
Java
false
false
1,306
java
package singleton.lazy; /** * Created by Tom on 2018/3/7. */ //懒汉式单例 //特点:在外部类被调用的时候内部类才会被加载 //内部类一定是要在方法调用之前初始化 //巧妙地避免了线程安全问题 //这种形式兼顾饿汉式的内存浪费,也兼顾synchronized性能问题 //完美地屏蔽了这两个缺点 //史上最牛B的单例模式的实现方式 public class LazyThree { private boolean initialized = false; //默认使用LazyThree的时候,会先初始化内部类 //如果没使用的话,内部类是不加载的 private LazyThree(){ synchronized (LazyThree.class){ if(initialized == false){ initialized = !initialized; }else{ throw new RuntimeException("单例已被侵犯"); } } } //每一个关键字都不是多余的 //static 是为了使单例的空间共享 //保证这个方法不会被重写,重载 public static final LazyThree getInstance(){ //在返回结果以前,一定会先加载内部类 return LazyHolder.LAZY; } //默认不加载 private static class LazyHolder{ private static final LazyThree LAZY = new LazyThree(); } }
2b752b6f0b1e1d484762d7f97d5e818f688e4e5c
bc3d1d4ea3f5c26fa4c7e51c6bff97876cc16362
/android/app/src/main/java/com/cs496/robertscanlon/cs496final/ViewFreePetsActivity.java
48d66411fe88b9fede9e685e2475badd36e09718
[]
no_license
RobertScanlon/cs496final
ca576d4082e50b3f8af23fbc8aa1f98b150c27c5
45b6d2898211f98eeaeaca52f84062281f711830
refs/heads/master
2021-08-19T10:05:36.507516
2017-11-25T19:27:30
2017-11-25T19:27:30
111,137,794
0
0
null
null
null
null
UTF-8
Java
false
false
4,232
java
/**************************************************************************** * filename: ViewFreePetsActivity.java * * author: Robert Scanlon * * description: CS496 Fall 2017 Final Project * * last edit: 24 November 2017 ****************************************************************************/ package com.cs496.robertscanlon.cs496final; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.widget.ListView; import org.json.JSONArray; import org.json.JSONException; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import okhttp3.Call; import okhttp3.Callback; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; public class ViewFreePetsActivity extends AppCompatActivity { final String URL = "https://cs496final-186222.appspot.com/pet/free"; String person_id; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_view_free_pets); person_id = getIntent().getStringExtra("person_id"); showFreePets(person_id); } @Override protected void onResume() { super.onResume(); showFreePets(person_id); } private void showFreePets(final String person_id) { Request req = new Request.Builder() .url(URL) .build(); OkHttpClient mOkHttpClient; mOkHttpClient = new OkHttpClient(); mOkHttpClient.newCall(req).enqueue(new Callback() { @Override public void onFailure(Call call, IOException e) { e.printStackTrace(); } @Override public void onResponse(Call call, Response response) throws IOException { final String r = response.body().string(); try { JSONArray items = new JSONArray(r); ArrayList<HashMap<String,String>> pets; pets = new ArrayList<HashMap<String,String>>(); for (int i = 0; i < items.length(); i++) { HashMap<String,String> p; p = new HashMap<String,String>(); p.put("person_id", person_id); p.put("name", "Name: " + items.getJSONObject(i).getString("name")); p.put("species", "Species: " + items.getJSONObject(i).getString("species")); p.put("age", "Age: " + items.getJSONObject(i).getString("age")); p.put("weight", "Weight: " + items.getJSONObject(i).getString("weight")); p.put("pet_selfUrl", items.getJSONObject(i).getString("self")); pets.add(p); } final AddPersonsPetAdapter petsAdapter; petsAdapter = new AddPersonsPetAdapter( ViewFreePetsActivity.this, pets, R.layout.free_pets_layout, new String[]{"name","species","age","weight"}, new int[]{R.id.freePetName, R.id.freePetSpecies, R.id.freePetAge, R.id.freePetWeight} ); runOnUiThread(new Runnable() { @Override public void run() { ListView allPetsListView; allPetsListView = (ListView) findViewById(R.id.freePetsListView); allPetsListView.setAdapter(petsAdapter); } }); } catch (JSONException je) { je.printStackTrace(); } } }); } }
8f2aba80eea1991200c2eefccbc3c5794be5591a
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/14/14_54b325064f0717b06608679909eb57c9a509588e/GenerateMethodDocument/14_54b325064f0717b06608679909eb57c9a509588e_GenerateMethodDocument_s.java
394eceecbc2d8c7ebe36972257001f9d672dd187
[]
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
7,332
java
package com.firetruckbowl.tgirest.processor; import com.firetruckbowl.tgirest.TGIRestWatcher; import com.firetruckbowl.tgirest.annotation.MethodError; import com.firetruckbowl.tgirest.annotation.ParamNote; import com.firetruckbowl.tgirest.annotation.ResourceMethod; import com.firetruckbowl.tgirest.model.MethodDocument; import com.firetruckbowl.tgirest.model.ParamDocument; import com.firetruckbowl.tgirest.resource.Documented; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TestRule; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; import org.mockito.Mock; import javax.ws.rs.*; import javax.ws.rs.core.*; import java.lang.reflect.Method; import java.net.URI; import java.util.Arrays; import java.util.List; import static org.hamcrest.core.Is.is; import static org.junit.Assert.assertThat; import static org.junit.matchers.JUnitMatchers.hasItems; import static org.mockito.BDDMockito.given; import static org.mockito.MockitoAnnotations.initMocks; /** * @author <a href="mailto:[email protected]">Loc Nguyen</a> */ @RunWith(JUnit4.class) public class GenerateMethodDocument { private final String BASE_URI = "http://winterfel.com/api/"; @Rule public TestRule watcher = new TGIRestWatcher(); @Mock private UriInfo uriInfo; private Documenter systemUnderTest; @Before public void setUp() throws Exception { initMocks(this); URI baseUri = new URI(BASE_URI); given(uriInfo.getBaseUri()).willReturn(baseUri); systemUnderTest = new TGIRestDocumenter(); } @Test @SuppressWarnings("") public void shouldGetPath() throws Exception { // given FooResource resource = new FooResource(); Method m = resource.getClass().getMethod("getBar", String.class, String.class, String.class); // when MethodDocument document = systemUnderTest.generateMethodDocument(uriInfo, m); // then assertThat(document.getPath(), is(BASE_URI + "bar/{id}")); } @Test @SuppressWarnings("") public void shouldGetHttpMethod() throws Exception { // given FooResource resource = new FooResource(); Method m = resource.getClass().getMethod("getBar", String.class, String.class, String.class); // when MethodDocument document = systemUnderTest.generateMethodDocument(uriInfo, m); // then assertThat(document.getHttpMethod(), is("GET")); } @Test @SuppressWarnings("") public void shouldGetSuccessStatus() throws Exception { // given FooResource resource = new FooResource(); Method m = resource.getClass().getMethod("getBar", String.class, String.class, String.class); // when MethodDocument document = systemUnderTest.generateMethodDocument(uriInfo, m); // then assertThat(document.getStatus(), is(Response.Status.OK.getStatusCode())); } @Test @SuppressWarnings("") public void shouldGetDescription() throws Exception { // given FooResource resource = new FooResource(); Method m = resource.getClass().getMethod("getBar", String.class, String.class, String.class); // when MethodDocument document = systemUnderTest.generateMethodDocument(uriInfo, m); // then assertThat(document.getDescription(), is("bar method")); } @Test @SuppressWarnings("") public void shouldGetErrors() throws Exception { // given FooResource resource = new FooResource(); Method m = resource.getClass().getMethod("getBar", String.class, String.class, String.class); // when MethodDocument document = systemUnderTest.generateMethodDocument(uriInfo, m); // then assertThat(document.getResponseErrors().size(), is(1)); assertThat(document.getResponseErrors().get(0).getStatus(), is(Response.Status.NOT_FOUND.getStatusCode())); } @Test @SuppressWarnings("") public void shouldGetMediaProduced() throws Exception { // given FooResource resource = new FooResource(); Method m = resource.getClass().getMethod("getBar", String.class, String.class, String.class); // when MethodDocument document = systemUnderTest.generateMethodDocument(uriInfo, m); // then List<String> types = Arrays.asList(document.getMediaTypesProduced()); assertThat(types, hasItems(MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML)); } @Test @SuppressWarnings("") public void shouldGetMediaConsumed() throws Exception { // given FooResource resource = new FooResource(); Method m = resource.getClass().getMethod("getBar", String.class, String.class, String.class); // when MethodDocument document = systemUnderTest.generateMethodDocument(uriInfo, m); // then List<String> types = Arrays.asList(document.getMediaTypesConsumed()); assertThat(types, hasItems(MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML)); } @Test @SuppressWarnings("") public void shouldGetQueryParamDocs() throws Exception { // given FooResource resource = new FooResource(); Method m = resource.getClass().getMethod("getBar", String.class, String.class, String.class); // when MethodDocument document = systemUnderTest.generateMethodDocument(uriInfo, m); // then List<ParamDocument> queryParams = Arrays.asList(document.getQueryParams()); ParamDocument qpt = new ParamDocument("t", "The time"); ParamDocument qpl = new ParamDocument("l", "The location"); assertThat(queryParams, hasItems(qpt, qpl)); } @Test @SuppressWarnings("") public void shouldGetPathParamDocs() throws Exception { // given FooResource resource = new FooResource(); Method m = resource.getClass().getMethod("getBar", String.class, String.class, String.class); // when MethodDocument document = systemUnderTest.generateMethodDocument(uriInfo, m); // then List<ParamDocument> pathParams = Arrays.asList(document.getPathParams()); assertThat(pathParams, hasItems(new ParamDocument("id", "The ID of the bar"))); } /** * A class for use with testing only since we don't want to rely on the * library's actual resource classes staying the same. */ @Path("foo") class FooResource implements Documented { @GET @Path("bar/{id}") @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @ResourceMethod( status = Response.Status.OK, description = "bar method", errors = { @MethodError(status = Response.Status.NOT_FOUND, cause = "The bar could not be found") } ) public Response getBar(@PathParam("id") @ParamNote("The ID of the bar") String id, @QueryParam("t") @ParamNote("The time") String time, @QueryParam("l") @ParamNote("The location") String location) { return Response.status(Response.Status.OK).build(); } @Override public Response getDocumentation(@Context UriInfo uriInfo, @Context HttpHeaders httpHeaders) { /* no-op */ return null; } } }
8fe0a0c85dcc295419d3b0b2f364406a17e07655
cc0d1d7c10a779751732f377a654bcf06b757036
/Gen_hash_tree (1).java
21c690f4262bd77f1da1b304817954d4b792bb95
[]
no_license
shirkekomal/Java
44f83fa2377ed82da609ec31adfafa5e13cb7351
0b0712dd8aa92109e83325425806f921ce45f6fd
refs/heads/master
2021-04-27T09:19:07.327778
2018-02-22T18:01:00
2018-02-22T18:01:00
122,510,669
0
0
null
null
null
null
UTF-8
Java
false
false
656
java
package kk7; import java.io.*; import java.util.*; class Gen_hash_tree { public static void main(String args[]) { LinkedHashSet<Integer> l=new LinkedHashSet<>(); l.add(10); l.add(30); l.add(20); l.add(50); l.add(70); System.out.println(l); System.out.println("*************************"); for(Integer i:l) { System.out.println(i); } LinkedHashSet<String> ll=new LinkedHashSet<>(); ll.add("komal"); ll.add("palak"); ll.add("Versha"); ll.add("Manoj"); ll.add("kunal"); System.out.println(ll); System.out.println("*************************"); for(String i:ll) { System.out.println(i); } } }
1fb7c6027462d9e93066b24ece8e763dc8fa5787
d501ae3fe8f2a67c27ebffe41a0374a5642f0ac8
/src/main/java/ws/ServiceVeiculo.java
244691bf75926acaaf3fb7db4b12fb5619bad72c
[]
no_license
cr4ck3r123/carmais
5bc3cbdac72a7ff879f7d54e9cd383c4426f8eda
af405cc5006fb6320ed072026829caa2c37e77c7
refs/heads/master
2023-01-11T08:13:31.954282
2019-07-11T19:11:13
2019-07-11T19:11:13
195,256,000
0
1
null
2023-01-04T03:40:30
2019-07-04T14:25:17
HTML
ISO-8859-1
Java
false
false
4,631
java
package ws; import java.sql.SQLException; import java.util.List; import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import com.google.gson.Gson; import controle.ControllerMarca; import controle.ControllerVeiculo; import modelo.Marca; import modelo.Modelo; import modelo.Veiculo; @Path("veiculo") public class ServiceVeiculo { //SERVIÇO INSERIR VEICULO @POST @Path("inserir") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.TEXT_PLAIN) public String inserirVeiculo(Veiculo veiculo) throws Exception { String msg = ""; Gson gson = new Gson(); gson.toJson(veiculo, Veiculo.class); if(controle.ControllerVeiculo.addVeiculo(veiculo) == 1) { msg="veiculo Inserido com sucesso"; } return msg; } //SERVIÇO PESQUISA VEICULO @GET @Path("idVeiculo/{id}/") @Produces(MediaType.TEXT_PLAIN) @Consumes(MediaType.APPLICATION_JSON) public String buscarPorIdVeic(@PathParam("id") int idVeiculo) { Gson gson = new Gson(); Veiculo veiculo = null; try { veiculo = ControllerVeiculo.pesqVeiculoId(idVeiculo); } catch (Exception e) { e.printStackTrace(); } System.out.println(""+idVeiculo); return gson.toJson(veiculo); } //SERVIÇO PESQUISA VEICULO POR ID @GET @Path("pesquisar/{id}/") @Produces(MediaType.TEXT_PLAIN) @Consumes(MediaType.APPLICATION_JSON) public String buscarPorIdVeiculo(@PathParam("id") int idUser) { Gson gson = new Gson(); Veiculo veiculo = null; try { veiculo = ControllerVeiculo.pesqVeiculo(idUser); } catch (Exception e) { e.printStackTrace(); } return gson.toJson(veiculo); } //METODO LISTA VEICULO @GET @Path("listar/{id}") public String listaVeiculo(@PathParam("id") int idVeiculo) throws Exception { System.out.print("Metodo Listar"); List<Veiculo> lista; ControllerVeiculo dao = new ControllerVeiculo(); lista = dao.listaVeiculo(idVeiculo); //Converter para Gson Gson g = new Gson(); return g.toJson(lista); } //SERVIÇO UPDATE VEICULO @PUT @Path("editar") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.TEXT_PLAIN) public String updateCliente(Veiculo dados) throws ClassNotFoundException, SQLException { String msg = ""; Gson gson = new Gson(); gson.toJson(dados, Veiculo.class); if(ControllerVeiculo.editarVeiculo(dados)==1) { msg="Veiculo alterado com sucesso"; } return msg; } //LISTA MODELO @GET @Path("listarModelos/{id}/") public String listaModelos(@PathParam("id") int id) throws Exception { System.out.print("Metodo Listar Modelos"); List<Modelo> lista; ControllerMarca dao = new ControllerMarca(); lista = dao.listarModelo(id); //Converter para Gson Gson g = new Gson(); return g.toJson(lista); } //METODO PARA RETORNAR ID VEICULO @GET @Path("idVeiculo") public int retornarIdPessoa() throws ClassNotFoundException, SQLException { int id = 0; System.out.print("Metodo Retornar ID VEICULO"); ControllerVeiculo dao = new ControllerVeiculo(); id = dao.retornoIdVeiculo(); return id; } //METODO LISTA MARCAS @GET @Path("pesqMarca/{marcas}/") @Produces(MediaType.TEXT_PLAIN) @Consumes(MediaType.APPLICATION_JSON) public String buscarPorId(@PathParam("marcas") String marcas) throws Exception { ControllerMarca dao = new ControllerMarca(); List<Marca> lista; lista = dao.pegaId(marcas); // Converter para Gson Gson g = new Gson(); return g.toJson(lista); } // SERVIÇO PESQUISA MARCA @GET @Path("marca/{marca}/") @Produces(MediaType.TEXT_PLAIN) @Consumes(MediaType.APPLICATION_JSON) public String buscarPorMarca(@PathParam("marca") String marca) throws Exception { Gson gson = new Gson(); Marca nomeMarca = new Marca(); ControllerMarca dao = new ControllerMarca(); nomeMarca = dao.pegaIdMarca(marca); String json = gson.toJson(nomeMarca); return json; } // METODO LISTAR MARCAS @GET @Path("listarMarcas") public String listaMarcas() throws Exception { System.out.print("Metodo Listar Marcas"); List<Marca> lista; ControllerMarca dao = new ControllerMarca(); lista = dao.listarMarca(); // Converter para Gson Gson g = new Gson(); return g.toJson(lista); } }
fc9ce2f746eeef9302a4321ff08c39db8a03613e
10b7c05a76903964e412a55f155544ba29db498f
/server/proj/uniapp/app/api/src/main/java/com/vassarlabs/proj/uniapp/api/pojo/AppFormData.java
4c8dd8f7e32dfe28c0b45d87653001dedf0eecdf
[]
no_license
srikanth-vl/jenkins-flutter-test
ba678eee7c3e4dd09915d6a4d1efe5b73ec6d303
9835d22d88394c403c3c95955dc890826de03382
refs/heads/master
2023-01-31T04:32:06.109480
2020-02-25T12:09:22
2020-02-25T12:09:22
242,687,371
0
0
null
2023-01-07T22:18:34
2020-02-24T08:50:01
Java
UTF-8
Java
false
false
907
java
package com.vassarlabs.proj.uniapp.api.pojo; import java.util.List; import java.util.Map; import java.util.UUID; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.vassarlabs.proj.uniapp.app.custom.deserialisers.CustomDeserialiser; import lombok.Data; import lombok.ToString; @Data @ToString public class AppFormData { @JsonProperty("form_id") String formInstanceId; @JsonProperty("md_instance_id") String metaDataInstanceId; @JsonProperty("proj_id") UUID projectId; @JsonDeserialize(using = CustomDeserialiser.class) @JsonProperty("user_type") String userType; @JsonProperty("insert_ts") long timeStamp; @JsonProperty("fields") List<FormFieldValues> formFieldValuesList; @JsonProperty("additional_props") Map<String, String> otherParams; }
49f2aedab78d863a583a7ab02e7fb6f8de978c35
6ccf193ec74bff2f359099be9eae94d7276cef41
/devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/reactive-messaging-codestart/java/src/test/java/org/acme/MyReactiveMessagingApplicationTest.java
3599cb166e0f35c64f4ac36b33e7216f950d75a7
[ "Apache-2.0" ]
permissive
r00ta/quarkus
722b2336c45d9c87cc4727804be5fa42b5545c52
a43f46e60adf656c67a3ea274094c21b857e9fbb
refs/heads/master
2023-01-18T17:12:47.188085
2021-12-23T12:14:59
2021-12-23T12:14:59
254,137,552
0
0
Apache-2.0
2023-01-17T20:01:09
2020-04-08T16:10:31
Java
UTF-8
Java
false
false
2,091
java
package org.acme; import io.quarkus.test.common.QuarkusTestResource; import io.quarkus.test.common.QuarkusTestResourceLifecycleManager; import io.quarkus.test.junit.QuarkusTest; import io.smallrye.reactive.messaging.providers.connectors.InMemoryConnector; import io.smallrye.reactive.messaging.providers.connectors.InMemorySink; import io.smallrye.reactive.messaging.providers.connectors.InMemorySource; import org.junit.jupiter.api.Test; import javax.enterprise.inject.Any; import javax.inject.Inject; import java.util.HashMap; import java.util.Map; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; @QuarkusTest @QuarkusTestResource(MyReactiveMessagingApplicationTest.InMemoryChannelTestResource.class) class MyReactiveMessagingApplicationTest { @Inject @Any InMemoryConnector connector; @Test void test() { InMemorySource<String> source = connector.source("source-in"); InMemorySink<String> uppercase = connector.sink("uppercase-out"); source.send("Hello"); source.send("In-memory"); source.send("Connectors"); assertEquals(3, uppercase.received().size()); assertTrue(uppercase.received().stream().anyMatch(message -> message.getPayload().equals("HELLO"))); assertTrue(uppercase.received().stream().anyMatch(message -> message.getPayload().equals("IN-MEMORY"))); assertTrue(uppercase.received().stream().anyMatch(message -> message.getPayload().equals("CONNECTORS"))); } public static class InMemoryChannelTestResource implements QuarkusTestResourceLifecycleManager { @Override public Map<String, String> start() { Map<String, String> env = new HashMap<>(); env.putAll(InMemoryConnector.switchIncomingChannelsToInMemory("source-in")); env.putAll(InMemoryConnector.switchOutgoingChannelsToInMemory("uppercase-out")); return env; } @Override public void stop() { InMemoryConnector.clear(); } } }
a90c9850b5474c1a32160a455b4067f99b69c20c
5a1375d92222ba93168a266cb7e43bbb5895b28b
/gmall-sms/src/main/java/com/atguigu/gmall/sms/controller/CouponHistoryController.java
197d89fdfc287260d90aa8725492f589680f6be9
[ "Apache-2.0" ]
permissive
FanciseEric/Gmall-new
c6de5f8d7149ba42e304347c0ddf49916488ee00
577565a142fc0ee1edc65b369ace70dec501e99e
refs/heads/master
2023-01-09T07:13:51.308913
2020-10-23T07:16:16
2020-10-23T07:16:16
285,221,898
0
0
null
null
null
null
UTF-8
Java
false
false
2,513
java
package com.atguigu.gmall.sms.controller; import java.util.Arrays; import java.util.Map; import com.atguigu.core.bean.PageVo; import com.atguigu.core.bean.QueryCondition; import com.atguigu.core.bean.Resp; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import com.atguigu.gmall.sms.entity.CouponHistoryEntity; import com.atguigu.gmall.sms.service.CouponHistoryService; /** * 优惠券领取历史记录 * * @author liqingbi * @email [email protected] * @date 2020-08-09 13:35:33 */ @Api(tags = "优惠券领取历史记录 管理") @RestController @RequestMapping("sms/couponhistory") public class CouponHistoryController { @Autowired private CouponHistoryService couponHistoryService; /** * 列表 */ @ApiOperation("分页查询(排序)") @GetMapping("/list") @PreAuthorize("hasAuthority('sms:couponhistory:list')") public Resp<PageVo> list(QueryCondition queryCondition) { PageVo page = couponHistoryService.queryPage(queryCondition); return Resp.ok(page); } /** * 信息 */ @ApiOperation("详情查询") @GetMapping("/info/{id}") @PreAuthorize("hasAuthority('sms:couponhistory:info')") public Resp<CouponHistoryEntity> info(@PathVariable("id") Long id){ CouponHistoryEntity couponHistory = couponHistoryService.getById(id); return Resp.ok(couponHistory); } /** * 保存 */ @ApiOperation("保存") @PostMapping("/save") @PreAuthorize("hasAuthority('sms:couponhistory:save')") public Resp<Object> save(@RequestBody CouponHistoryEntity couponHistory){ couponHistoryService.save(couponHistory); return Resp.ok(null); } /** * 修改 */ @ApiOperation("修改") @PostMapping("/update") @PreAuthorize("hasAuthority('sms:couponhistory:update')") public Resp<Object> update(@RequestBody CouponHistoryEntity couponHistory){ couponHistoryService.updateById(couponHistory); return Resp.ok(null); } /** * 删除 */ @ApiOperation("删除") @PostMapping("/delete") @PreAuthorize("hasAuthority('sms:couponhistory:delete')") public Resp<Object> delete(@RequestBody Long[] ids){ couponHistoryService.removeByIds(Arrays.asList(ids)); return Resp.ok(null); } }
5187c4003ac389ff7a611b2371c08c9539670c47
957b71eeb4ef0a713e1fe92e62f131359759768d
/Client - Android App/WirelessProject/app/src/main/java/dt/wirelessproject/MainActivity.java
5a08028910294c97ac7bac2d5028c4cab18c6c64
[]
no_license
dteh/exercise-context-detection
95e03c230055f3ed2f2ddf4ac35232af409799fb
36885243de066a5fcdab1c7a3f9ed88ff8b13e2c
refs/heads/master
2021-01-13T07:19:38.922144
2016-10-21T12:22:02
2016-10-21T12:22:02
71,562,351
0
0
null
null
null
null
UTF-8
Java
false
false
3,643
java
package dt.wirelessproject; import android.app.Activity; import android.app.AlarmManager; import android.app.PendingIntent; import android.content.Intent; import android.os.Bundle; import android.os.FileObserver; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends Activity { public static String user; public static DirManager dirManager; static boolean listening = false; public static TextView AT; LogService logger = new LogService(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // COMMENT OUT THESE TWO DIRMANAGER LINES TO DISABLE SENDING FILE TO SERVER dirManager = new DirManager( getApplicationContext().getExternalFilesDir(null).getAbsolutePath()); dirManager.startWatching(); AT = (TextView) findViewById(R.id.predictedActivity); //scheduleAlarm(); } public void getActivityType(View view){ if(!listening) { String username = ((EditText) findViewById(R.id.editText)).getText().toString(); MainActivity.user = username; System.out.println(user); listening = true; ((Button)findViewById(R.id.trainingButton)).setText("Stop Recording"); // start listening process Toast.makeText(this, "Now recording!", Toast.LENGTH_SHORT).show(); Intent i = new Intent(getApplicationContext(),LogService.class); i.putExtra("type","PREDICT"); i.putExtra("activityName","PREDICT"); getApplicationContext().startService(i); findViewById(R.id.editText).setVisibility(View.INVISIBLE); }else{ listening = false; ((Button)findViewById(R.id.trainingButton)).setText("Record Activity Timeline"); // stop listening process Toast.makeText(this, "Stopped recording", Toast.LENGTH_SHORT).show(); findViewById(R.id.editText).setVisibility(View.VISIBLE); } } private void scheduleAlarm(){ Intent intent = new Intent(this,AlarmReceiver.class); PendingIntent pIntent = PendingIntent.getBroadcast(this,21337,intent,PendingIntent.FLAG_UPDATE_CURRENT); AlarmManager alarm = (AlarmManager) this.getSystemService(ALARM_SERVICE); alarm.setInexactRepeating(AlarmManager.RTC_WAKEUP,System.currentTimeMillis(),1000 * 60 * 3,pIntent); } public void setActivityText(String text){ ((TextView)this.findViewById(R.id.predictedActivity)).setText(text); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } @Override public void onBackPressed(){ listening = false; System.exit(0); } }
365e61fd3bbf771140dbf39543acf6ea6c17b8e6
777ddb59cb9dc20b938f10be0a1e3ff4e0621b53
/Project1JSF/src/java/utng/datos/DAO.java
45ba8218a4f8515739b7e07fe4a642b37e61fb67
[]
no_license
Miguel1196pollo/unidadIII
6bdf44dd183db39dfd779d1c22b1e2756ec9345c
a87cd56b711e8a5af1ea66d063a5b5e87aec6f8b
refs/heads/master
2021-01-12T17:15:23.340841
2016-10-21T05:57:30
2016-10-21T05:57:30
71,531,343
0
0
null
null
null
null
UTF-8
Java
false
false
3,785
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 utng.datos; /** * * @author Miguel González */ import java.io.Serializable; import java.util.ArrayList; import java.util.List; import org.hibernate.HibernateException; import org.hibernate.Query; import org.hibernate.SQLQuery; import org.hibernate.Session; import org.hibernate.Transaction; import utng.configuracion.HibernateUtil; public abstract class DAO<T> { protected Session session; protected T modelo; public DAO(T modelo){ session = HibernateUtil.getSession(); this.modelo = modelo; } public Long insert(T modelo) throws HibernateException{ long id = 0; Transaction tx = session.beginTransaction(); try{ Serializable result = session.save(modelo); id = (Long) result; tx.commit(); session.clear(); }catch(HibernateException e){ tx.rollback(); throw e; } return id; } public void update(T modelo) throws HibernateException{ Transaction tx = session.beginTransaction(); try{ session.merge(modelo); tx.commit(); session.clear(); }catch(HibernateException e){ tx.rollback(); throw e; } } public void delete(T modelo) throws HibernateException{ Transaction tx = session.beginTransaction(); try{ session.delete(modelo); tx.commit(); session.clear(); }catch(HibernateException e){ tx.rollback(); session.clear(); throw e; } } public List<T> getAll()throws HibernateException{ String entityName = modelo.getClass().getName(); List<T> list = new ArrayList<T>(); try{ list = session.createQuery( "from " + entityName).list(); session.clear(); }catch (Exception e){ session.clear(); throw new HibernateException( "Error al consultar todos: " + e); } return list; } protected T getOneById(Serializable id) throws HibernateException{ T object = null; object = (T)session.get( modelo.getClass(), Long.valueOf(id.toString())); session.clear(); return object; } protected T query(String sql, List<String> paramNames, List<Object> paramValues){ Query query = session.createQuery(sql); for (int i = 0; i < paramNames.size();i++){ query.setParameter(paramNames.get(i), paramValues.get(i)); } List<T> list = query.list(); if(list.size()>0){ return list.get(0); }else { return null; } } protected List<T> queryList(String sql, Class<?> entity, List<String>paramNames, List<Object>paramValues){ SQLQuery query = session.createSQLQuery(sql); query.addEntity(entity); for(int i = 0; i < paramNames.size();i++){ query.setParameter(paramNames.get(i), paramValues.get(i)); } List<T> list = query.list(); if(list.size()>0){ return list; }else{ return null; } } }
e87f9820273cb5758fcbda6e07d3bd45a349dea9
687e2cc29ea63a0fea615bc51a6900016bd5829a
/WeatherForecastAndroid/app/src/main/java/weather/rini/com/weatherforecast/InfoActivity.java
7a87d2e3546cd2833d18d48b7ec31027ed46269d
[]
no_license
Rinijain7/Weather-Forecast-Android-Application
e00e48cb35f9ec35b585cc458ea7ae47b92d2e8b
ae8c7a68d2f093a817a5f795f8a0273ad08a974a
refs/heads/master
2021-01-10T16:13:01.390083
2016-01-23T04:40:54
2016-01-23T04:40:54
50,223,379
0
0
null
null
null
null
UTF-8
Java
false
false
1,374
java
package weather.rini.com.weatherforecast; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; public class InfoActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_info); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setTitle("Weather App"); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. //getMenuInflater().inflate(R.menu.menu_info, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }
90fffcce6a95a8b58652a8e1d7cc5d9c4e93f750
5e936702b5f90e8edc075cf604bf22fe5c6b460c
/src/main/java/com/bz/xtcx/manager/mapper/SysUserMapper.java
c0377d6ed6ca203bb7bc3bb743ae71d0f087d10f
[]
no_license
zhangkaijun/xtcxpt
392368a4a4fca2e32f557bcfbfb9943f9fe1e4cd
9c3f901b46ba0a0cb935937610148e0c6de7d9cc
refs/heads/master
2020-03-23T04:23:04.285502
2018-07-19T09:42:54
2018-07-19T09:42:54
141,080,252
0
0
null
null
null
null
UTF-8
Java
false
false
2,386
java
package com.bz.xtcx.manager.mapper; import java.util.List; import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Result; import org.apache.ibatis.annotations.ResultMap; import org.apache.ibatis.annotations.Results; import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.SelectKey; import org.apache.ibatis.annotations.SelectProvider; import org.apache.ibatis.mapping.StatementType; import com.bz.xtcx.manager.entity.SysUser; import com.bz.xtcx.manager.mapper.provider.SysUserProvider; public interface SysUserMapper { @Insert("insert into `sys_user`(user_id, user_name, password, cellphone, email, status, creater)" + " VALUES(#{id, jdbcType=VARCHAR}," + " #{userName, jdbcType=VARCHAR}," + " #{password, jdbcType=VARCHAR}," + " #{cellphone, jdbcType=VARCHAR}," + " #{email, jdbcType=INTEGER}," + " #{status, jdbcType=INTEGER}," + " #{creater, jdbcType=VARCHAR})" ) @SelectKey(before = true, keyProperty = "id", resultType = String.class, statementType = StatementType.STATEMENT, statement="select uuid()") int insert(SysUser user); @SelectProvider(type = SysUserProvider.class, method = "findCount") int findCount(SysUser user); @SelectProvider(type = SysUserProvider.class, method = "findByCondition") @Results( id = "sysUser", value = { @Result(id = true, property = "id", column = "user_id"), @Result(property = "userName", column = "user_name"), @Result(property = "password", column = "password"), @Result(property = "cellphone", column = "cellphone"), @Result(property = "email", column = "email"), @Result(property = "status", column = "status"), @Result(property = "creater", column = "creater"), @Result(property = "createTime", column = "create_time"), @Result(property = "updater", column = "updater"), @Result(property = "updateTime", column = "update_time") //@Result(property = "roles", column = "user_id", many = @Many(select = "com.elextec.mdm.mapper.RoleMapper.findRolesByUserId") ) } ) List<SysUser> findByCondition(SysUser user); @Select("select * from `sys_user` where user_name = #{username} or email = #{username}") @ResultMap("sysUser") SysUser findByUserameOrEmail(String username); }
ec06c65ec0de0d6068fdae2ab4e6a5cb0dacb5d2
3557e3335c276496321273bf5480a40365d67d94
/src/main/java/Strings/PermutationInString.java
5a021c4ec4a574108cefdeccce4f7df780b746a3
[]
no_license
sakshi88/Questions
65ad68024cb43969d13dc453ef26d621fbc18950
6464c6bd07e8189a7eeb03eecd19b1c49b114c1a
refs/heads/master
2022-11-06T12:13:52.790679
2020-06-12T15:19:04
2020-06-12T15:19:04
264,638,143
0
0
null
null
null
null
UTF-8
Java
false
false
987
java
package Strings; public class PermutationInString { public static boolean checkPermutation(String s1, String s2){ if(s1.length()>s2.length()) return false; int s1map[] = new int[26]; for(int i=0;i<s1.length();i++){ s1map[s1.charAt(i)-'a']++; } for(int i=0;i<=s2.length()-s1.length();i++){ int s2map[] = new int[26]; for(int j=0;j<s1.length();j++){ s2map[s2.charAt(i+j)-'a']++; } if(matches(s1map,s2map)) return true; } return false; } public static boolean matches(int s1map[], int s2map[]){ for(int i=0;i<26;i++) { if(s1map[i]!=s2map[i]) return false; } return true; } public static void main(String[] args) { String s1="ab"; String s2 = "eidbaooo"; System.out.println("Is s2 part of s1: " + checkPermutation(s1,s2)); } }
44dac71586f36a52a6e102ada1bbffa65f855435
90f18cb8f69814a0de305cad221a24bccb3e48aa
/src/main/java/com/intuit/practice/courtbookingbackend/services/UserServicesImpl.java
e1dfb999cbb348ba6f2ceac19f70abc5183f524a
[]
no_license
lavanyajain/court-booking-backend
2118e84a1b035183ecb4bafd0d17b20a26c0fc72
f8a53ec8bd5808137c56c122428afd5e3ef2daa6
refs/heads/master
2023-01-04T23:44:21.330189
2020-10-21T08:32:24
2020-10-21T08:32:24
304,903,609
0
0
null
null
null
null
UTF-8
Java
false
false
906
java
package com.intuit.practice.courtbookingbackend.services; import com.intuit.practice.courtbookingbackend.api.UserApi; import com.intuit.practice.courtbookingbackend.exception.QueryExecutionException; import com.intuit.practice.courtbookingbackend.model.User; import com.intuit.practice.courtbookingbackend.model.UserResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service public class UserServicesImpl implements UserServices { @Autowired private UserApi services; @Override public UserResponse registerUser(User user) { UserResponse userResponse; try { userResponse = services.registerUser(user); } catch (Exception exception) { throw new QueryExecutionException("Error while fetching all registered users"); } return userResponse; } }
069478c4e7594ab3718d572908bd42441b646dc5
05351a3e38a8f881dac8681672344cccfc8b9981
/test-git/batch/batch-core/src/main/java/gnf/gido/common/batch/log/convert/job/JobConvertInterface.java
a8f37978cc513184b5c6b8f757a3a51f517bd873
[]
no_license
jcsipan/GIDO
0f2ae6038cfa90111bfd1ba57f61f48e562885cd
cca8749296ee60fdd7bebd259040784f52d3e22d
refs/heads/master
2021-01-20T09:03:24.050909
2015-08-27T04:49:37
2015-08-27T05:02:11
41,462,772
0
0
null
null
null
null
UTF-8
Java
false
false
1,668
java
/** * Copyright 2011 GNF * @author ivmedina * */ package gnf.gido.common.batch.log.convert.job; import gnf.gido.common.batch.log.data.job.JobConvertDataInterface; import org.springframework.batch.core.JobExecution; /** * The Interface JobConvertInterface. */ public interface JobConvertInterface { static final class JobConvertStrings { /** * Constructor para evitar instancia de la clase statica */ private JobConvertStrings() { } static final String JOB_NAME = "Job name"; static final String JOB_MODULE = "Job module"; static final String JOB_CODE = "Job code"; static final String JOB_DESCRIPTION = "Job description"; static final String JOB_PARAMETERS = "Job parameter: "; static final String START_TIME = "Start time"; static final String CREATE_TIME = "Create time"; static final String END_TIME = "End time"; static final String TOTAL_TIME = "Total time"; static final String EXIT_STATUS = "Exit status"; static final String RETURN_CODE = "Return code"; static final String LOG_JOB_ERROR = "ERROR: "; static final String ESTADISTICAS_PROCESO = "Estadisticas del proceso: "; static final String REGISTROS_LEIDOS = "Registros leidos: "; static final String REGISTROS_RECHAZADOS = "Registros rechazados: "; static final String REGISTROS_PROCESADOS = "Registros procesados: "; static final String ESTADISTICAS = "Estadisticas"; } /** * Convert. * * @param jobExecution the job execution * @return the job convert data interface */ public JobConvertDataInterface convert(final JobExecution jobExecution); }
f5a5dd4eb7262d4394e3e9b900bb2c0c8c822a95
686ae60e5dbb080fb3b330ab7e3a143927061397
/xc-service-api/src/main/java/com/xuecheng/api/filesystem/FileSystemControllerApi.java
9fd9a36085e7476196dd75213e5bb57e36d825d2
[]
no_license
hftang/xc_edu_service
2e932fe508adbb872d579e366252e283282aee5e
f3cd69b9143f4f0e80fe10bd852e3de74a7af91d
refs/heads/master
2022-12-10T13:24:06.200566
2020-08-03T06:42:51
2020-08-03T06:42:51
172,816,684
0
0
null
2022-11-24T06:26:09
2019-02-27T01:04:34
Java
UTF-8
Java
false
false
723
java
package com.xuecheng.api.filesystem; import com.xuecheng.framework.domain.filesystem.response.UploadFileResult; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.web.multipart.MultipartFile; /** * @author hftang * @date 2019-03-11 14:30 * @desc */ @Api(value = "文件管理的接口",description = "文件管理接口,提供页面的增删改查") public interface FileSystemControllerApi { @ApiOperation("上传文件接口") public UploadFileResult upload(MultipartFile multipartFile, String filetag, String businesskey, String metadata); }
c6f910d11e97ec9925dfd575ec8e117c80185951
17391b53276a32b1cca8c009b81a7672b5cd7453
/src/com/salaryServlet/UpdateSalaryServlet.java
04cd3c40f84be3d5dfdb03bdd6a744d3291a1a46
[]
no_license
buddhika9/OOP_project
8d6b1beaf37ccd7895151ef9689a076c3ca77bc9
41afa27b10a49c8ddb173f716d13a4db1df2f214
refs/heads/master
2023-02-02T22:59:40.500597
2020-12-18T14:32:55
2020-12-18T14:32:55
322,609,426
0
0
null
null
null
null
UTF-8
Java
false
false
1,512
java
package com.salaryServlet; import java.io.IOException; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.salary.SalaryDBUtil; /** * Servlet implementation class UpdateSalaryServlet */ @WebServlet("/UpdateSalaryServlet") public class UpdateSalaryServlet extends HttpServlet { private static final long serialVersionUID = 1L; protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //setting the values taken from form tp variables String month = request.getParameter("month"); double pavement = Double.parseDouble(request.getParameter("pavement")) ; double comission = Double.parseDouble(request.getParameter("comission")); String empid = request.getParameter("empid"); boolean isTrue; //sending the set values to the update method in SalaryDBUtil isTrue = SalaryDBUtil.updateSalary( month, pavement, comission, empid); if(isTrue == true) { //redirecting to the list salary form RequestDispatcher dis = request.getRequestDispatcher("indexaddsalary.jsp"); dis.forward(request, response); } else { //redirecting to the list salary form RequestDispatcher dis2 = request.getRequestDispatcher("indexaddsalary.jsp"); dis2.forward(request, response); } } }
ef27c53876195c02280bc1db58cfe8c833ebc179
e5a1691497da0034e4d0d92a54e55b418f4346f2
/Hibernate52-RelationA/src/org/crazyit/app/oneNentityId/OrderManager.java
068f0dc64151de3c027c5f72ac0ca1574f5467ab
[]
no_license
shaojun1407/taojun
8aa557e0e968d98b8978d728ed8ce6c0349169b5
101b29e4351198cf23536466d56cadbc4532af85
refs/heads/master
2021-08-30T14:08:03.500921
2017-12-06T11:12:53
2017-12-06T11:12:53
106,764,415
0
0
null
null
null
null
WINDOWS-1252
Java
false
false
1,200
java
package org.crazyit.app.oneNentityId; import java.util.Date; import org.crazyit.app.util.HibernateUtil; import org.hibernate.Session; import org.hibernate.Transaction; /** * Description: * <br/>ÍøÕ¾: <a href="http://www.crazyit.org">·è¿ñJavaÁªÃË</a> * <br/>Copyright (C), 2001-2016, Yeeku.H.Lee * <br/>This program is protected by copyright laws. * <br/>Program Name: * <br/>Date: * @author Yeeku.H.Lee [email protected] * @version 1.0 */ public class OrderManager { public static void main(String[] args) { OrderManager mgr = new OrderManager(); mgr.createAndStoreOrder(); HibernateUtil.sessionFactory.close(); } private void createAndStoreOrder() { Session sess = HibernateUtil.currentSession(); Transaction tx = sess.beginTransaction(); Order order = new Order(new Date()); Product p1 = new Product("¼üÅÌ"); Product p2 = new Product("ÏÔʾÆ÷"); OrderItem item1 = new OrderItem(order , p1 , 50); OrderItem item2 = new OrderItem(order , p2 , 18); sess.save(order); sess.save(p1); sess.save(p2); sess.save(item1); sess.save(item2); tx.commit(); HibernateUtil.closeSession(); } }
776809bce24611cc59acb516f1dac5cb5e238f69
6d18f6912c2a3b68e643e23130d7c9ccef994207
/src/main/java/com/mengxi/manageemp/config/CorsConfig.java
4ceb7c02cc1498df5b4460428628db378a1ea4ed
[]
no_license
MengxiQ/Management_Backend
6878801e6b5bb677168949732fd2a18924030ac7
2094f21a49b96c849ec57ec1943907b084f61806
refs/heads/master
2022-11-08T19:15:03.772792
2020-06-27T16:20:42
2020-06-27T16:20:42
272,647,819
0
1
null
null
null
null
UTF-8
Java
false
false
987
java
package com.mengxi.manageemp.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.cors.CorsConfiguration; import org.springframework.web.cors.UrlBasedCorsConfigurationSource; import org.springframework.web.filter.CorsFilter; @Configuration public class CorsConfig { private CorsConfiguration buildConfig() { CorsConfiguration corsConfiguration = new CorsConfiguration(); corsConfiguration.addAllowedOrigin("*"); //允许任何域名 corsConfiguration.addAllowedHeader("*"); //允许任何头 corsConfiguration.addAllowedMethod("*"); //允许任何方法 return corsConfiguration; }; @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); source.registerCorsConfiguration("/**", buildConfig()); //注册 return new CorsFilter(source); } }
8cc3bd9287611a3364c74b106bc397096f0292c6
c74c2e590b6c6f967aff980ce465713b9e6fb7ef
/game-logic/src/main/java/com/bdoemu/core/network/receivable/CMExitFieldServerToServerSelection.java
fda14ec6b3933f3d3d15cbb6c6367f879584c314
[]
no_license
lingfan/bdoemu
812bb0abb219ddfc391adadf68079efa4af43353
9c49b29bfc9c5bfe3192b2a7fb1245ed459ef6c1
refs/heads/master
2021-01-01T13:10:13.075388
2019-12-02T09:23:20
2019-12-02T09:23:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
736
java
// // Decompiled by Procyon v0.5.30 // package com.bdoemu.core.network.receivable; import com.bdoemu.commons.network.ReceivablePacket; import com.bdoemu.commons.network.SendablePacket; import com.bdoemu.core.network.GameClient; import com.bdoemu.core.network.sendable.SMExitFieldServerToServerSelection; public class CMExitFieldServerToServerSelection extends ReceivablePacket<GameClient> { public CMExitFieldServerToServerSelection(final short opcode) { super(opcode); } protected void read() { } public void runImpl() { ((GameClient) this.getClient()).close((SendablePacket) new SMExitFieldServerToServerSelection(((GameClient) this.getClient()).getLoginAccountInfo().getCookie())); } }
c1bcac56fccaf729db65060ad9e4af624b694c0e
44712aeecb5b428d8afc3139213bbd30a9ff7f5a
/src/fiuba/algo3/model/exceptions/NoTieneSuficientesAlgoformersParaCombinarException.java
369847d67c7c1a41b67d36e795bad45f645786f9
[]
no_license
marcelomastroianni/TP2-JAVA-GRUPO6-2016-1C
a80ff617886147b58f2de1de7bc75cc605b7c2fa
70314e8be1d8cb737805277ece4254486dbc13c9
refs/heads/master
2020-12-25T07:44:13.059934
2016-07-01T01:31:07
2016-07-01T01:31:07
59,867,933
0
0
null
null
null
null
UTF-8
Java
false
false
277
java
package fiuba.algo3.model.exceptions; @SuppressWarnings("serial") public class NoTieneSuficientesAlgoformersParaCombinarException extends Exception { public NoTieneSuficientesAlgoformersParaCombinarException(){ super("No tiene suficientes Algoformers para combinar"); } }
de8dfba9805fe8ef02a02d96f07b524d38a25f26
0af8b92686a58eb0b64e319b22411432aca7a8f3
/large-multiproject/project11/src/main/java/org/gradle/test/performance11_1/Production11_92.java
9c7ed645ce5970de4e0dec28040b9160ccaafaee
[]
no_license
gradle/performance-comparisons
b0d38db37c326e0ce271abebdb3c91769b860799
e53dc7182fafcf9fedf07920cbbea8b40ee4eef4
refs/heads/master
2023-08-14T19:24:39.164276
2022-11-24T05:18:33
2022-11-24T05:18:33
80,121,268
17
15
null
2022-09-30T08:04:35
2017-01-26T14:25:33
null
UTF-8
Java
false
false
300
java
package org.gradle.test.performance11_1; public class Production11_92 extends org.gradle.test.performance7_1.Production7_92 { private final String property; public Production11_92() { this.property = "foo"; } public String getProperty() { return property; } }
7864e18bbe64fa3f6c26ddfb683842b305593897
666e139e3d20712140c9ef6830ef13bb52372b4e
/src/main/java/com/example/limedium/springboot/domain/posts/Posts.java
d68a3a2426f7b04b4c8902a856ad8a7c77fdb559
[]
no_license
sunguk19/limedium
ba3185e4caf324f438406f51fe4851d1e96e2788
62d66af95c6fa933f9fbc20c13dee3aa3dfefe90
refs/heads/master
2021-04-19T07:18:29.698592
2020-03-27T02:22:34
2020-03-27T02:22:34
249,590,480
1
0
null
null
null
null
UTF-8
Java
false
false
1,022
java
package com.example.limedium.springboot.domain.posts; import com.example.limedium.springboot.domain.BaseTimeEntity; import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; @Getter @NoArgsConstructor @Entity public class Posts extends BaseTimeEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Column(length = 500, nullable = false) private String title; @Column(columnDefinition = "TEXT", nullable = false) private String content; private String author; @Builder public Posts(String title, String content, String author) { this.title = title; this.content = content; this.author = author; } public void update(String title, String content) { this.title = title; this.content = content; } }
f53fa7245ded486697486c7484eb82edc9c80183
0b9ea4672de638479ef8a7b992c571f0b925fdff
/src/main/java/the-smallest-difference/Solution.java
5e9425a491695d1d82aedc4a6c8264e520ef043b
[]
no_license
VictorKostyukov/coding-interview-solutions
195fa5572b0d34369919557dad3236b435c04d3a
57a65e3588175d5af511722c354ed4b142ceff2c
refs/heads/master
2020-04-01T09:08:00.270927
2018-06-24T18:54:57
2018-06-24T18:54:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
566
java
public class Solution { /** * @param A, B: Two integer arrays. * @return: Their smallest difference. */ public int smallestDifference(int[] A, int[] B) { Arrays.sort(A); Arrays.sort(B); int diff = Integer.MAX_VALUE; int i = 0, j = 0; while (i < A.length && j < B.length) { diff = Math.min(diff, Math.abs(A[i] - B[j])); if (A[i] < B[j]) { i++; } else { j++; } } return diff; } }
233bd0b94e5fca6f6dac4ec13c3cdc847a758686
e2fc116abc589fecc9f292c14abc7d6d8e6c0726
/joy-thinking-in-java-4th/src/main/java/generics/RandomList.java
4c1c61b64e6d38fd836bb3ffd2391187c6c0f085
[]
no_license
joycgj/smc-multi-project
00d918f84ff61c5092b83a8a54f31e7f57ea34f4
1d72b47e7d6e876df711b2bdfe883ec89546cf97
refs/heads/master
2021-06-02T16:32:52.882168
2016-04-18T12:40:52
2016-04-18T12:40:52
20,757,048
0
1
null
null
null
null
UTF-8
Java
false
false
650
java
package generics; import java.util.ArrayList; import java.util.Random; public class RandomList<T> { private ArrayList<T> storage = new ArrayList<T>(); private Random rand = new Random(47); public void add(T item) { storage.add(item); } public T select() { return storage.get(rand.nextInt(storage.size())); } public static void main(String[] args) { RandomList<String> rs = new RandomList<String>(); for (String s : "this is a test".split(" ")) { rs.add(s); } for (int i = 0; i < 11; i++) { System.out.print(rs.select() + " "); } } }
05fd50a5d2328c90db1d79d162db34fbd8c94c69
2ec1200e677948135969fea93518ce16c556117a
/src/main/java/com/task/controller/SearchController.java
22474fda931017e00561e178fdf14d009a9f81ad
[]
no_license
stanimirtrufenev/PeopleTask
17384fe5275d75686c5d9fe218d38e9b25e983c1
f8b4bb1a06c09f32e689fb2aa4ae7b217703b81d
refs/heads/master
2021-01-22T20:18:16.198287
2017-03-17T11:43:45
2017-03-17T11:43:45
85,304,351
0
0
null
null
null
null
UTF-8
Java
false
false
958
java
package com.task.controller; import java.util.ArrayList; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.test.context.ContextConfiguration; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import com.task.configuration.TaskConfig; import com.task.daos.SearchDao; @Controller @ContextConfiguration(classes = TaskConfig.class) public class SearchController { @Autowired private SearchDao searchDao; @RequestMapping(value="/SearchPerson", method = RequestMethod.POST) public String search(@RequestParam("name") String name, Model model) { ArrayList<String> list = searchDao.getPerson(name); if (list != null) { model.addAttribute("list", list); } return "person"; } }
[ "Станимир Трюфенев" ]
Станимир Трюфенев
8315d13d202d36c82a73f18fc27cb24e533ef1d7
3dbea1f54bf5120e86a5af4505d0dd4d99a3365c
/src/im/afterclass/android/domain/BitmapLruCache.java
a2a6102bb1bb4d7cb0dc63bf50ecfdc3d0c01df2
[]
no_license
zhongweili/AfterClass-Android
70008afd8aeeb0ec72ea281da4cabc3dbe33f4da
a1bacba79fa03bcf6eba40c886dfa41365a6ddba
refs/heads/master
2016-09-05T12:24:18.718423
2014-10-10T02:44:08
2014-10-10T02:44:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
603
java
package im.afterclass.android.domain; import android.graphics.Bitmap; import android.support.v4.util.LruCache; import com.android.volley.toolbox.ImageLoader; public class BitmapLruCache extends LruCache<String, Bitmap> implements ImageLoader.ImageCache { public BitmapLruCache(int maxSize) { super(maxSize); } @Override protected int sizeOf(String key, Bitmap bitmap) { return bitmap.getRowBytes() * bitmap.getHeight(); } @Override public Bitmap getBitmap(String url) { return get(url); } @Override public void putBitmap(String url, Bitmap bitmap) { put(url, bitmap); } }
56967cf9da09eab4ed416ad346cb560194026d07
65c41f96a13b9e300122e5a3d2bacfdca554c00d
/dependency-inijection/src/main/java/org/kevin/Tobacco.java
cde61b42ef30b7bc205ec7c56761ea55b414fa38
[]
no_license
lk96/patterns-java
f63d28387e75278d3b9650ddc353a46e669ed182
7bf055089b7ccf5a1e0ee11a3fd78f8305b93988
refs/heads/main
2023-05-03T02:09:18.887477
2021-05-17T17:11:36
2021-05-17T17:11:36
359,070,453
0
0
null
null
null
null
UTF-8
Java
false
false
245
java
package org.kevin; import lombok.extern.slf4j.Slf4j; @Slf4j public abstract class Tobacco { public void smoke(Wizard wizard) { log.info("{} smoking {}", wizard.getClass().getSimpleName(), this.getClass().getSimpleName()); } }
c8c4f724526b38990a15cb91da5d9dc6e0af4b4d
6bb8f4d2bf7b7f1d39f644f6c5bd63b1218ad758
/jaulp.wicket.components/src/main/java/de/alpharogroup/wicket/components/i18n/list/HeaderContentListModel.java
42d073e2c09d4e383967de567b7335964336213c
[]
no_license
marie-christin/jaulp.wicket
3abf4cadd7b393d88dc38fdbe833e8d83bbdd74c
3dbac0a9113d87981d261d5f727c8d2cc56f4176
refs/heads/master
2021-01-21T08:24:33.567324
2015-07-25T18:49:37
2015-07-25T18:49:37
39,819,797
0
0
null
2015-07-28T07:35:20
2015-07-28T07:35:19
null
UTF-8
Java
false
false
1,308
java
/** * Copyright (C) 2010 Asterios Raptis * * 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 de.alpharogroup.wicket.components.i18n.list; import java.io.Serializable; import java.util.List; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.NonNull; import lombok.Setter; import lombok.ToString; import de.alpharogroup.locale.ResourceBundleKey; @Getter @Setter @EqualsAndHashCode @ToString @NoArgsConstructor @AllArgsConstructor @Builder public class HeaderContentListModel implements Serializable { private static final long serialVersionUID = 1L; @NonNull private ResourceBundleKey headerResourceKey; @NonNull private List<ResourceBundleKey> contentResourceKeys; }
6854d684a584f887e4ec6895076aeaa70ca78eb4
684732efc4909172df38ded729c0972349c58b67
/io-fr/src/main/java/org/jeesl/controller/converter/fc/io/fr/IoFileStorageEngineConverter.java
9403aed4cee5e5fcc2944c80772b4b6996a07ea2
[]
no_license
aht-group/jeesl
2c4683e8c1e9d9e9698d044c6a89a611b8dfe1e7
3f4bfca6cf33f60549cac23f3b90bf1218c9daf9
refs/heads/master
2023-08-13T20:06:38.593666
2023-08-12T06:59:51
2023-08-12T06:59:51
39,823,889
0
9
null
2022-12-13T18:35:24
2015-07-28T09:06:11
Java
UTF-8
Java
false
false
504
java
package org.jeesl.controller.converter.fc.io.fr; import javax.enterprise.context.RequestScoped; import javax.faces.convert.FacesConverter; import org.jeesl.jsf.converter.AbstractEjbIdConverter; import org.jeesl.model.ejb.io.fr.IoFileStorageEngine; @RequestScoped @FacesConverter(forClass=IoFileStorageEngine.class) public class IoFileStorageEngineConverter extends AbstractEjbIdConverter<IoFileStorageEngine> { public IoFileStorageEngineConverter() { super(IoFileStorageEngine.class); } }
5d8b63b84934fe981fe446fd0e61432323870d77
abc1333cc147a8c17492ddad101f4a9e18aa0145
/p007/src/main/java/ru/mironenko/bomberman/figuresOfTheGame/BoardItem.java
f966b161c37e26cae157de13442f3a806571ab82
[]
no_license
mikitamironenka/javatasks
a86d89e473d5191fdb6a5f9ef8558d6dfc9f1770
9119c9c1fb7783d1e2cc1fc7ab58de55462bd591
refs/heads/master
2022-09-20T08:12:15.883598
2019-07-30T17:28:29
2019-07-30T17:28:29
196,849,339
0
0
null
2022-09-01T23:10:46
2019-07-14T14:55:54
Java
UTF-8
Java
false
false
125
java
package ru.mironenko.bomberman.figuresOfTheGame; /** * Created by nikita on 05.07.2017. */ public interface BoardItem { }
3a4b5146df782faf449610948acee4f830597417
70be23e70bc2d1655801b8b5230ae7d395066118
/server/src/main/java/com/boot/debug/redis/server/controller/StringController.java
8ca21b6a9c1c86082429c6ff4ffdaa386f7d1745
[]
no_license
zhouyulei/SpringBootRedis
35134af8c5dd6c7ef00502a50e4895f73c2eee4d
fde81a4be696b9e69c3ad13fcf6862f14b559e3e
refs/heads/master
2022-07-01T15:58:28.543313
2019-12-13T08:41:07
2019-12-13T08:41:07
227,794,216
0
0
null
2022-06-21T02:26:29
2019-12-13T08:39:34
Java
UTF-8
Java
false
false
2,424
java
package com.boot.debug.redis.server.controller; import com.boot.debug.redis.api.response.BaseResponse; import com.boot.debug.redis.api.response.StatusCode; import com.boot.debug.redis.model.entity.Item; import com.boot.debug.redis.server.service.StringService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.validation.BindingResult; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; /** * 字符串String实战-商品详情存储 * @Author:debug (SteadyJack) * @Link: weixin-> debug0868 qq-> 1948831260 * @Date: 2019/10/29 20:58 **/ @RestController @RequestMapping("string") public class StringController { private static final Logger log= LoggerFactory.getLogger(StringController.class); @Autowired private StringService stringService; //添加 @RequestMapping(value = "put",method = RequestMethod.POST,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) public BaseResponse put(@RequestBody @Validated Item item, BindingResult result){ if (result.hasErrors()){ return new BaseResponse(StatusCode.InvalidParams); } BaseResponse response=new BaseResponse(StatusCode.Success); try { log.info("--商品信息:{}",item); stringService.addItem(item); }catch (Exception e){ log.error("--字符串String实战-商品详情存储-添加-发生异常:",e.fillInStackTrace()); response=new BaseResponse(StatusCode.Fail.getCode(),e.getMessage()); } return response; } //获取详情 @RequestMapping(value = "get",method = RequestMethod.GET) public BaseResponse get(@RequestParam Integer id){ BaseResponse response=new BaseResponse(StatusCode.Success); try { response.setData(stringService.getItem(id)); }catch (Exception e){ log.error("--字符串String实战-商品详情存储-添加-发生异常:",e.fillInStackTrace()); response=new BaseResponse(StatusCode.Fail.getCode(),e.getMessage()); } return response; } }
51cbd3bf5bcd9395c7f6205527ae90a4043e4418
453a0b5702f6b261a3203b5dc6453a1ec472069f
/zhaopin-pojo/src/main/java/com/jk/pojo/QsAdmin.java
a2a83c9284b006095b5d3ea7fdab05b2ef02333b
[]
no_license
984313070/zhaopin-parent
39d11e6e50acd0ae343286f6c5baba36f79afe63
a00f47486fc9dd1a73f31bee8877aaa656aaa8e6
refs/heads/master
2022-12-25T06:04:40.663215
2019-09-23T09:43:32
2019-09-23T09:43:32
207,215,296
0
0
null
null
null
null
UTF-8
Java
false
false
2,406
java
package com.jk.pojo; import java.io.Serializable; public class QsAdmin implements Serializable { private Short id; private String username; private String email; private String password; private String pwdHash; private Integer roleId; private Integer addTime; private Integer lastLoginTime; private String lastLoginIp; public Short getId() { return id; } public void setId(Short id) { this.id = id; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username == null ? null : username.trim(); } public String getEmail() { return email; } public void setEmail(String email) { this.email = email == null ? null : email.trim(); } public String getPassword() { return password; } public void setPassword(String password) { this.password = password == null ? null : password.trim(); } public String getPwdHash() { return pwdHash; } public void setPwdHash(String pwdHash) { this.pwdHash = pwdHash == null ? null : pwdHash.trim(); } public Integer getRoleId() { return roleId; } public void setRoleId(Integer roleId) { this.roleId = roleId; } public Integer getAddTime() { return addTime; } public void setAddTime(Integer addTime) { this.addTime = addTime; } public Integer getLastLoginTime() { return lastLoginTime; } public void setLastLoginTime(Integer lastLoginTime) { this.lastLoginTime = lastLoginTime; } public String getLastLoginIp() { return lastLoginIp; } public void setLastLoginIp(String lastLoginIp) { this.lastLoginIp = lastLoginIp == null ? null : lastLoginIp.trim(); } @Override public String toString() { return "QsAdmin{" + "id=" + id + ", username='" + username + '\'' + ", email='" + email + '\'' + ", password='" + password + '\'' + ", pwdHash='" + pwdHash + '\'' + ", roleId=" + roleId + ", addTime=" + addTime + ", lastLoginTime=" + lastLoginTime + ", lastLoginIp='" + lastLoginIp + '\'' + '}'; } }