blob_id
stringlengths
40
40
__id__
int64
225
39,780B
directory_id
stringlengths
40
40
path
stringlengths
6
313
content_id
stringlengths
40
40
detected_licenses
list
license_type
stringclasses
2 values
repo_name
stringlengths
6
132
repo_url
stringlengths
25
151
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
70
visit_date
timestamp[ns]
revision_date
timestamp[ns]
committer_date
timestamp[ns]
github_id
int64
7.28k
689M
star_events_count
int64
0
131k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
23 values
gha_fork
bool
2 classes
gha_event_created_at
timestamp[ns]
gha_created_at
timestamp[ns]
gha_updated_at
timestamp[ns]
gha_pushed_at
timestamp[ns]
gha_size
int64
0
40.4M
gha_stargazers_count
int32
0
112k
gha_forks_count
int32
0
39.4k
gha_open_issues_count
int32
0
11k
gha_language
stringlengths
1
21
gha_archived
bool
2 classes
gha_disabled
bool
1 class
content
stringlengths
7
4.37M
src_encoding
stringlengths
3
16
language
stringclasses
1 value
length_bytes
int64
7
4.37M
extension
stringclasses
24 values
filename
stringlengths
4
174
language_id
stringclasses
1 value
entities
list
contaminating_dataset
stringclasses
0 values
malware_signatures
list
redacted_content
stringlengths
7
4.37M
redacted_length_bytes
int64
7
4.37M
alphanum_fraction
float32
0.25
0.94
alpha_fraction
float32
0.25
0.94
num_lines
int32
1
84k
avg_line_length
float32
0.76
99.9
std_line_length
float32
0
220
max_line_length
int32
5
998
is_vendor
bool
2 classes
is_generated
bool
1 class
max_hex_length
int32
0
319
hex_fraction
float32
0
0.38
max_unicode_length
int32
0
408
unicode_fraction
float32
0
0.36
max_base64_length
int32
0
506
base64_fraction
float32
0
0.5
avg_csv_sep_count
float32
0
4
is_autogen_header
bool
1 class
is_empty_html
bool
1 class
shard
stringclasses
16 values
5eda5dd120f0acc87a0096eb9846aeb34531c188
31,001,074,010,054
6b84664c8f81f8f6a94372baf50e5fc9af6e8672
/redis/src/main/java/io/basc/framework/redis/convert/ConvertibleRedisHyperloglogPipelineCommands.java
7bb8e1cf1437b5cb8060046a38c3e819a03b78c3
[ "Apache-2.0" ]
permissive
wcnnkh/scw
https://github.com/wcnnkh/scw
b0645ab93d3f23a906bcce328a89b54c32d24c1c
c2791f9784b6ad807ab882689962e41ccb802568
refs/heads/master
2023-07-14T06:10:41.902000
2023-03-23T14:21:13
2023-03-23T14:21:13
149,597,393
1
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package io.basc.framework.redis.convert; import io.basc.framework.redis.RedisHyperloglogPipelineCommands; import io.basc.framework.redis.RedisResponse; @SuppressWarnings("unchecked") public interface ConvertibleRedisHyperloglogPipelineCommands<SK, K, SV, V> extends RedisCodec<SK, K, SV, V>, RedisHyperloglogPipelineCommands<K, V> { RedisHyperloglogPipelineCommands<SK, SV> getSourceRedisHyperloglogCommands(); @Override default RedisResponse<Long> pfadd(K key, V... elements) { SK k = getKeyCodec().encode(key); SV[] tvs = getValueCodec().encodeAll(elements); return getSourceRedisHyperloglogCommands().pfadd(k, tvs); } @Override default RedisResponse<Long> pfcount(K... keys) { SK[] ks = getKeyCodec().encodeAll(keys); return getSourceRedisHyperloglogCommands().pfcount(ks); } @Override default RedisResponse<String> pfmerge(K destKey, K... sourceKeys) { SK dk = getKeyCodec().encode(destKey); SK[] sks = getKeyCodec().encodeAll(sourceKeys); return getSourceRedisHyperloglogCommands().pfmerge(dk, sks); } }
UTF-8
Java
1,043
java
ConvertibleRedisHyperloglogPipelineCommands.java
Java
[]
null
[]
package io.basc.framework.redis.convert; import io.basc.framework.redis.RedisHyperloglogPipelineCommands; import io.basc.framework.redis.RedisResponse; @SuppressWarnings("unchecked") public interface ConvertibleRedisHyperloglogPipelineCommands<SK, K, SV, V> extends RedisCodec<SK, K, SV, V>, RedisHyperloglogPipelineCommands<K, V> { RedisHyperloglogPipelineCommands<SK, SV> getSourceRedisHyperloglogCommands(); @Override default RedisResponse<Long> pfadd(K key, V... elements) { SK k = getKeyCodec().encode(key); SV[] tvs = getValueCodec().encodeAll(elements); return getSourceRedisHyperloglogCommands().pfadd(k, tvs); } @Override default RedisResponse<Long> pfcount(K... keys) { SK[] ks = getKeyCodec().encodeAll(keys); return getSourceRedisHyperloglogCommands().pfcount(ks); } @Override default RedisResponse<String> pfmerge(K destKey, K... sourceKeys) { SK dk = getKeyCodec().encode(destKey); SK[] sks = getKeyCodec().encodeAll(sourceKeys); return getSourceRedisHyperloglogCommands().pfmerge(dk, sks); } }
1,043
0.763183
0.763183
31
32.645161
27.583946
78
false
false
0
0
0
0
0
0
1.709677
false
false
14
f092452e6a9eef897dc54ae968661f15ce4cc64c
32,401,233,309,783
9f6418afffc5177113d58d1632a4c45d241a7c68
/eureka-demo2/computer-service/src/main/java/com/alison/action/ConsumerController.java
5bc7937b454c9e52e9b7a40be0871c229219846f
[]
no_license
GavinAlison/spring-cloud-learning
https://github.com/GavinAlison/spring-cloud-learning
2868eef788d83459b8b2891a8f0fd831c266bacd
9d9e7ae8120e738e9a860bb3ca87f6aea7a8bbd7
refs/heads/master
2020-04-30T09:14:41.117000
2019-04-28T02:23:19
2019-04-28T02:23:19
176,741,443
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.alison.action; import org.apache.juli.logging.LogFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cloud.client.ServiceInstance; import org.springframework.cloud.client.discovery.DiscoveryClient; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.client.RestTemplate; import java.math.BigDecimal; @RestController public class ConsumerController { private Logger log = LoggerFactory.getLogger(ConsumerController.class); @Autowired private DiscoveryClient discoveryClient; @RequestMapping("/add") public int add(@RequestParam Integer a, @RequestParam Integer b) { ServiceInstance serviceInstance = discoveryClient.getLocalServiceInstance(); log.info("/add, host=" + serviceInstance.getHost() + ", port=" + serviceInstance.getPort() + ", service_id=" + serviceInstance.getServiceId()); BigDecimal _a = new BigDecimal(a); BigDecimal _b = new BigDecimal(b); BigDecimal _c = _a.add(_b); return _c.intValue(); } }
UTF-8
Java
1,272
java
ConsumerController.java
Java
[]
null
[]
package com.alison.action; import org.apache.juli.logging.LogFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cloud.client.ServiceInstance; import org.springframework.cloud.client.discovery.DiscoveryClient; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.client.RestTemplate; import java.math.BigDecimal; @RestController public class ConsumerController { private Logger log = LoggerFactory.getLogger(ConsumerController.class); @Autowired private DiscoveryClient discoveryClient; @RequestMapping("/add") public int add(@RequestParam Integer a, @RequestParam Integer b) { ServiceInstance serviceInstance = discoveryClient.getLocalServiceInstance(); log.info("/add, host=" + serviceInstance.getHost() + ", port=" + serviceInstance.getPort() + ", service_id=" + serviceInstance.getServiceId()); BigDecimal _a = new BigDecimal(a); BigDecimal _b = new BigDecimal(b); BigDecimal _c = _a.add(_b); return _c.intValue(); } }
1,272
0.76022
0.758648
35
35.342857
32.268467
151
false
false
0
0
0
0
0
0
0.685714
false
false
14
73d9921243f5fc704581a4e2a45239f05f181376
6,519,760,368,216
c71286959120083965b3235ce1c33390f2977846
/src/main/java/com/koreait/dooboo/map/command/UpdateUseNowCommand.java
69cc4212af60b4392b4e4b07cdcfd41a0fcb6cad
[]
no_license
Rain3660/DooBoo
https://github.com/Rain3660/DooBoo
349d40c0125fe8a203cf99001909b411deb5c87c
2e7d3ae6dd30a91841dea323ab1024d2e8c659ea
refs/heads/main
2023-07-15T18:05:07.558000
2021-08-04T01:05:44
2021-08-04T01:05:44
384,637,720
2
2
null
false
2021-08-04T01:05:45
2021-07-10T07:26:12
2021-08-04T00:52:14
2021-08-04T01:05:44
3,163
1
2
0
Java
false
false
package com.koreait.dooboo.map.command; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import org.apache.ibatis.session.SqlSession; import org.springframework.ui.Model; import com.koreait.dooboo.map.dao.MapDAO; import com.koreait.dooboo.map.dto.MapDTO; import com.koreait.dooboo.map.dto.MapLocationCheckDTO; import com.koreait.dooboo.map.dto.MapSessionDTO; import com.koreait.dooboo.util.GetMidLocation; public class UpdateUseNowCommand { public Map<String, Object> execute(SqlSession sqlSession, Model model) { Map<String, Object> map = model.asMap(); HttpServletRequest request = (HttpServletRequest) map.get("request"); MapSessionDTO mapSessionDTO = (MapSessionDTO) map.get("mapSessionDTO"); MapDAO mapDAO = sqlSession.getMapper(MapDAO.class); HttpSession session = request.getSession(); Map<String, Object> resultMap = new HashMap<String, Object>(); System.out.println(mapSessionDTO); List<MapDTO> list = mapDAO.getLocation(mapSessionDTO.getMemberNo()); //파라미터로 가져온 memberNo로 가지고있는 map2개를 조회한다 int usenowNO = (int) mapSessionDTO.getMapNo(); //선호지역 변경시 jsp단에서 둘다 인증이 되어있어야하고 지역이 2개가 있어야 백단으로 넘어오게 만들었다 그렇기때문에 이곳에 왔다는건 둘중에 한개가인증이 되었다 이야기고 지역이 2개가있다는 의미이기 때문에 null 예외는 안뜰것으로 에상 MapDTO mapDTO1 = list.get(0); String midLocation1 =GetMidLocation.getMidLocation(mapDTO1.getLocation()); MapDTO mapDTO2 = list.get(1); String midLocation2 =GetMidLocation.getMidLocation(mapDTO2.getLocation()); int result1 = 0; int result2 = 0; System.out.println(mapDTO1.getMapNo()); System.out.println(usenowNO); System.out.println(mapDTO1.getMapNo()==usenowNO); if(mapDTO1.getMapNo() == usenowNO) { //맵2개중 첫번재 반환된 mapDTO의 mapNo와 바꾸려는(일반->선호지역) mapNo를 대조해본다 MapLocationCheckDTO mapLocationCheckDTO1 = new MapLocationCheckDTO(); //비교한 지역과 일치하면 usenow를 0에서 1로 바꾸고 나머지 반환된 mapDTO에는 usenow를 0으로 업데이트 해준다 mapLocationCheckDTO1.setMapNo(mapDTO1.getMapNo()); mapLocationCheckDTO1.setUsenow(1); result1 = mapDAO.updateUseNow(mapLocationCheckDTO1); MapSessionDTO mapSession1DTO = new MapSessionDTO(mapDTO1.getMapNo(), mapDTO1.getMemberNo(),midLocation1, mapDTO1.getLocationOrd(), 1, 1); //일치하는 지역은 무조건 인증이 되어있는 상태이기때문에 ischecked 변수에는 1을 저장 session.setAttribute("mapSession"+mapDTO1.getLocationOrd()+"DTO", mapSession1DTO);//비교후 mapNO가 같은 mapDTO 에는 1을 저장한후 업데이트 후 세션용 dto에 저장해 세션에 올려준다 MapLocationCheckDTO mapLocationCheckDTO2 = new MapLocationCheckDTO(); //반대로 비교한 나머지의 mapDTO 에는 0을 저장한후 업데이트 후 세션용 dto에 저장해 세션에 올려준다 mapLocationCheckDTO2.setMapNo(mapDTO2.getMapNo()); mapLocationCheckDTO2.setUsenow(0); result2 = mapDAO.updateUseNow(mapLocationCheckDTO2); MapSessionDTO mapSession2DTO = new MapSessionDTO(mapDTO2.getMapNo(), mapDTO2.getMemberNo(), midLocation2, mapDTO2.getLocationOrd(), 1, 0); session.setAttribute("mapSession"+mapDTO2.getLocationOrd()+"DTO", mapSession2DTO); if(result1 == 1 && result2 == 1) { resultMap.put("result", 1); } }else { MapLocationCheckDTO mapLocationCheckDTO2 = new MapLocationCheckDTO(); mapLocationCheckDTO2.setMapNo(mapDTO2.getMapNo()); mapLocationCheckDTO2.setUsenow(1); result1 = mapDAO.updateUseNow(mapLocationCheckDTO2); MapSessionDTO mapSession2DTO = new MapSessionDTO(mapDTO2.getMapNo(), mapDTO2.getMemberNo(), midLocation2, mapDTO2.getLocationOrd(), 1, 1); session.setAttribute("mapSession"+mapDTO2.getLocationOrd()+"DTO", mapSession2DTO); MapLocationCheckDTO mapLocationCheckDTO1 = new MapLocationCheckDTO(); mapLocationCheckDTO1.setMapNo(mapDTO1.getMapNo()); mapLocationCheckDTO1.setUsenow(0); result2 = mapDAO.updateUseNow(mapLocationCheckDTO1); MapSessionDTO mapSession1DTO = new MapSessionDTO(mapDTO1.getMapNo(), mapDTO1.getMemberNo(), midLocation1, mapDTO1.getLocationOrd(), 1, 0); session.setAttribute("mapSession"+mapDTO1.getLocationOrd()+"DTO", mapSession1DTO); if(result1 == 1 && result2 == 1) { resultMap.put("result", 1); } } return resultMap; } }
UTF-8
Java
4,644
java
UpdateUseNowCommand.java
Java
[]
null
[]
package com.koreait.dooboo.map.command; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import org.apache.ibatis.session.SqlSession; import org.springframework.ui.Model; import com.koreait.dooboo.map.dao.MapDAO; import com.koreait.dooboo.map.dto.MapDTO; import com.koreait.dooboo.map.dto.MapLocationCheckDTO; import com.koreait.dooboo.map.dto.MapSessionDTO; import com.koreait.dooboo.util.GetMidLocation; public class UpdateUseNowCommand { public Map<String, Object> execute(SqlSession sqlSession, Model model) { Map<String, Object> map = model.asMap(); HttpServletRequest request = (HttpServletRequest) map.get("request"); MapSessionDTO mapSessionDTO = (MapSessionDTO) map.get("mapSessionDTO"); MapDAO mapDAO = sqlSession.getMapper(MapDAO.class); HttpSession session = request.getSession(); Map<String, Object> resultMap = new HashMap<String, Object>(); System.out.println(mapSessionDTO); List<MapDTO> list = mapDAO.getLocation(mapSessionDTO.getMemberNo()); //파라미터로 가져온 memberNo로 가지고있는 map2개를 조회한다 int usenowNO = (int) mapSessionDTO.getMapNo(); //선호지역 변경시 jsp단에서 둘다 인증이 되어있어야하고 지역이 2개가 있어야 백단으로 넘어오게 만들었다 그렇기때문에 이곳에 왔다는건 둘중에 한개가인증이 되었다 이야기고 지역이 2개가있다는 의미이기 때문에 null 예외는 안뜰것으로 에상 MapDTO mapDTO1 = list.get(0); String midLocation1 =GetMidLocation.getMidLocation(mapDTO1.getLocation()); MapDTO mapDTO2 = list.get(1); String midLocation2 =GetMidLocation.getMidLocation(mapDTO2.getLocation()); int result1 = 0; int result2 = 0; System.out.println(mapDTO1.getMapNo()); System.out.println(usenowNO); System.out.println(mapDTO1.getMapNo()==usenowNO); if(mapDTO1.getMapNo() == usenowNO) { //맵2개중 첫번재 반환된 mapDTO의 mapNo와 바꾸려는(일반->선호지역) mapNo를 대조해본다 MapLocationCheckDTO mapLocationCheckDTO1 = new MapLocationCheckDTO(); //비교한 지역과 일치하면 usenow를 0에서 1로 바꾸고 나머지 반환된 mapDTO에는 usenow를 0으로 업데이트 해준다 mapLocationCheckDTO1.setMapNo(mapDTO1.getMapNo()); mapLocationCheckDTO1.setUsenow(1); result1 = mapDAO.updateUseNow(mapLocationCheckDTO1); MapSessionDTO mapSession1DTO = new MapSessionDTO(mapDTO1.getMapNo(), mapDTO1.getMemberNo(),midLocation1, mapDTO1.getLocationOrd(), 1, 1); //일치하는 지역은 무조건 인증이 되어있는 상태이기때문에 ischecked 변수에는 1을 저장 session.setAttribute("mapSession"+mapDTO1.getLocationOrd()+"DTO", mapSession1DTO);//비교후 mapNO가 같은 mapDTO 에는 1을 저장한후 업데이트 후 세션용 dto에 저장해 세션에 올려준다 MapLocationCheckDTO mapLocationCheckDTO2 = new MapLocationCheckDTO(); //반대로 비교한 나머지의 mapDTO 에는 0을 저장한후 업데이트 후 세션용 dto에 저장해 세션에 올려준다 mapLocationCheckDTO2.setMapNo(mapDTO2.getMapNo()); mapLocationCheckDTO2.setUsenow(0); result2 = mapDAO.updateUseNow(mapLocationCheckDTO2); MapSessionDTO mapSession2DTO = new MapSessionDTO(mapDTO2.getMapNo(), mapDTO2.getMemberNo(), midLocation2, mapDTO2.getLocationOrd(), 1, 0); session.setAttribute("mapSession"+mapDTO2.getLocationOrd()+"DTO", mapSession2DTO); if(result1 == 1 && result2 == 1) { resultMap.put("result", 1); } }else { MapLocationCheckDTO mapLocationCheckDTO2 = new MapLocationCheckDTO(); mapLocationCheckDTO2.setMapNo(mapDTO2.getMapNo()); mapLocationCheckDTO2.setUsenow(1); result1 = mapDAO.updateUseNow(mapLocationCheckDTO2); MapSessionDTO mapSession2DTO = new MapSessionDTO(mapDTO2.getMapNo(), mapDTO2.getMemberNo(), midLocation2, mapDTO2.getLocationOrd(), 1, 1); session.setAttribute("mapSession"+mapDTO2.getLocationOrd()+"DTO", mapSession2DTO); MapLocationCheckDTO mapLocationCheckDTO1 = new MapLocationCheckDTO(); mapLocationCheckDTO1.setMapNo(mapDTO1.getMapNo()); mapLocationCheckDTO1.setUsenow(0); result2 = mapDAO.updateUseNow(mapLocationCheckDTO1); MapSessionDTO mapSession1DTO = new MapSessionDTO(mapDTO1.getMapNo(), mapDTO1.getMemberNo(), midLocation1, mapDTO1.getLocationOrd(), 1, 0); session.setAttribute("mapSession"+mapDTO1.getLocationOrd()+"DTO", mapSession1DTO); if(result1 == 1 && result2 == 1) { resultMap.put("result", 1); } } return resultMap; } }
4,644
0.758435
0.73423
92
43.45652
43.776958
193
false
false
0
0
0
0
0
0
2.945652
false
false
14
3403225c78cabf69ea3e9fa35f39f838b15c60f7
17,162,689,381,727
4628e8d1d7096cbf69ce3f84c66daff3de660dfd
/bigdata-spark/src/main/java/spark/examples/ConcatTransform.java
456913b1b442babacd0244aa3bc5778f6e9afdfb
[ "Apache-2.0" ]
permissive
sbd3/bigdata-examples
https://github.com/sbd3/bigdata-examples
e3367476d8b3f9367224419b5e9db232fd477b09
69975380b122d48aca581d00007ec9f084aae3e5
refs/heads/master
2021-10-20T14:42:05.253000
2018-11-02T10:35:56
2018-11-02T10:35:56
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package spark.examples; import java.util.HashMap; import java.util.List; import java.util.Map.Entry; import org.apache.spark.sql.Row; public class ConcatTransform extends Transformer { private static final long serialVersionUID = -6704168745996169319L; @SuppressWarnings("unchecked") @Override public Row transform(Row row, HashMap<String, Object> metadata) { for (Entry<String, Object> ruleEntry: metadata.entrySet()) { List<String> rulStr = (List<String>) ruleEntry.getValue(); StringBuilder sb = new StringBuilder(); for (String col : rulStr) { sb.append(row.get(row.fieldIndex(col)).toString()); } return put(row, sb.toString()); } return row; } }
UTF-8
Java
715
java
ConcatTransform.java
Java
[]
null
[]
package spark.examples; import java.util.HashMap; import java.util.List; import java.util.Map.Entry; import org.apache.spark.sql.Row; public class ConcatTransform extends Transformer { private static final long serialVersionUID = -6704168745996169319L; @SuppressWarnings("unchecked") @Override public Row transform(Row row, HashMap<String, Object> metadata) { for (Entry<String, Object> ruleEntry: metadata.entrySet()) { List<String> rulStr = (List<String>) ruleEntry.getValue(); StringBuilder sb = new StringBuilder(); for (String col : rulStr) { sb.append(row.get(row.fieldIndex(col)).toString()); } return put(row, sb.toString()); } return row; } }
715
0.697902
0.671329
27
24.481482
23.060902
68
false
false
0
0
0
0
0
0
1.666667
false
false
14
6ba9732035ffa930847aaf2dbbe9d509631b5f34
8,289,286,940,415
486e23c3fe8685d13e5954b4aaddef269944b540
/app/src/main/java/study/project/whereareyou/NavigationDrawerItemActivity/Profile/GetUserByNameAsyncTask.java
13e52480c3a2fec6691e0ab002c9643f0cc1dc7a
[]
no_license
fastphat/project-where-are-you
https://github.com/fastphat/project-where-are-you
28098c31a563778c1a0a9f6c1f1ae2c232a7f4c3
34c869e82c28832706c1bb8a3893c3c32067158b
refs/heads/master
2021-05-30T16:13:56.596000
2016-01-15T03:05:56
2016-01-15T03:05:56
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package study.project.whereareyou.NavigationDrawerItemActivity.Profile; import android.app.ProgressDialog; import android.content.Context; import android.os.AsyncTask; import android.util.Log; import org.ksoap2.SoapEnvelope; import org.ksoap2.serialization.SoapObject; import org.ksoap2.serialization.SoapPrimitive; import org.ksoap2.serialization.SoapSerializationEnvelope; import org.ksoap2.transport.HttpTransportSE; import org.xmlpull.v1.XmlPullParserException; import java.io.IOException; import study.project.whereareyou.OOP.User; /** * Created by Administrator on 16/12/2015. */ public class GetUserByNameAsyncTask extends AsyncTask<String,Void,User> { final String URL = "http://whereareyou.somee.com/WebService.asmx"; final String NAMESPACE ="http://tempuri.org/"; final String METHOD_GETUSER = "USER_GetUserByName"; final String SOAP_ACTION = NAMESPACE+METHOD_GETUSER; public interface GetUserByNameAsyncTaskResponse { void processResponse(User user); } GetUserByNameAsyncTaskResponse delegate; Context context; public GetUserByNameAsyncTask(Context context,GetUserByNameAsyncTaskResponse delegate) { this.context = context; this.delegate = delegate; } @Override protected User doInBackground(String... params) { String userName = params[0]; SoapObject request = new SoapObject(NAMESPACE,METHOD_GETUSER); request.addProperty("name",userName); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); envelope.dotNet = true; envelope.setOutputSoapObject(request); HttpTransportSE httpTransportSE = new HttpTransportSE(URL); try { httpTransportSE.call(SOAP_ACTION,envelope); SoapObject object = (SoapObject) envelope.getResponse(); User currentUser = null; if(object!=null) { currentUser = new User(); SoapPrimitive id = (SoapPrimitive) object.getPropertySafely("UserId", null); SoapPrimitive email = (SoapPrimitive) object.getPropertySafely("UserEmail",null); SoapPrimitive name = (SoapPrimitive) object.getPropertySafely("UserName",null); SoapPrimitive fname = (SoapPrimitive) object.getPropertySafely("UserFirstName",null); SoapPrimitive lname = (SoapPrimitive) object.getPropertySafely("UserLastName",null); SoapPrimitive lastLocation = (SoapPrimitive) object.getPropertySafely("UserLastLocation",null); SoapPrimitive birthdate = (SoapPrimitive) object.getPropertySafely("UserBirthdate",null); if(id!=null) currentUser.setId(id.toString()); if(email!=null) currentUser.setEmail(email.toString()); if(name!=null) currentUser.setUserName(name.toString()); if(fname!=null) currentUser.setFirstName(fname.toString()); if(lname!=null) currentUser.setLastName(lname.toString()); if(lastLocation!=null) currentUser.setLastLocation(lastLocation.toString()); if(birthdate!=null) currentUser.setBirthDate(birthdate.toString().substring(0,10)); } return currentUser; } catch (IOException e) { e.printStackTrace(); } catch (XmlPullParserException e) { e.printStackTrace(); } return null; } @Override protected void onPostExecute(User user) { super.onPostExecute(user); delegate.processResponse(user); } }
UTF-8
Java
3,753
java
GetUserByNameAsyncTask.java
Java
[]
null
[]
package study.project.whereareyou.NavigationDrawerItemActivity.Profile; import android.app.ProgressDialog; import android.content.Context; import android.os.AsyncTask; import android.util.Log; import org.ksoap2.SoapEnvelope; import org.ksoap2.serialization.SoapObject; import org.ksoap2.serialization.SoapPrimitive; import org.ksoap2.serialization.SoapSerializationEnvelope; import org.ksoap2.transport.HttpTransportSE; import org.xmlpull.v1.XmlPullParserException; import java.io.IOException; import study.project.whereareyou.OOP.User; /** * Created by Administrator on 16/12/2015. */ public class GetUserByNameAsyncTask extends AsyncTask<String,Void,User> { final String URL = "http://whereareyou.somee.com/WebService.asmx"; final String NAMESPACE ="http://tempuri.org/"; final String METHOD_GETUSER = "USER_GetUserByName"; final String SOAP_ACTION = NAMESPACE+METHOD_GETUSER; public interface GetUserByNameAsyncTaskResponse { void processResponse(User user); } GetUserByNameAsyncTaskResponse delegate; Context context; public GetUserByNameAsyncTask(Context context,GetUserByNameAsyncTaskResponse delegate) { this.context = context; this.delegate = delegate; } @Override protected User doInBackground(String... params) { String userName = params[0]; SoapObject request = new SoapObject(NAMESPACE,METHOD_GETUSER); request.addProperty("name",userName); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); envelope.dotNet = true; envelope.setOutputSoapObject(request); HttpTransportSE httpTransportSE = new HttpTransportSE(URL); try { httpTransportSE.call(SOAP_ACTION,envelope); SoapObject object = (SoapObject) envelope.getResponse(); User currentUser = null; if(object!=null) { currentUser = new User(); SoapPrimitive id = (SoapPrimitive) object.getPropertySafely("UserId", null); SoapPrimitive email = (SoapPrimitive) object.getPropertySafely("UserEmail",null); SoapPrimitive name = (SoapPrimitive) object.getPropertySafely("UserName",null); SoapPrimitive fname = (SoapPrimitive) object.getPropertySafely("UserFirstName",null); SoapPrimitive lname = (SoapPrimitive) object.getPropertySafely("UserLastName",null); SoapPrimitive lastLocation = (SoapPrimitive) object.getPropertySafely("UserLastLocation",null); SoapPrimitive birthdate = (SoapPrimitive) object.getPropertySafely("UserBirthdate",null); if(id!=null) currentUser.setId(id.toString()); if(email!=null) currentUser.setEmail(email.toString()); if(name!=null) currentUser.setUserName(name.toString()); if(fname!=null) currentUser.setFirstName(fname.toString()); if(lname!=null) currentUser.setLastName(lname.toString()); if(lastLocation!=null) currentUser.setLastLocation(lastLocation.toString()); if(birthdate!=null) currentUser.setBirthDate(birthdate.toString().substring(0,10)); } return currentUser; } catch (IOException e) { e.printStackTrace(); } catch (XmlPullParserException e) { e.printStackTrace(); } return null; } @Override protected void onPostExecute(User user) { super.onPostExecute(user); delegate.processResponse(user); } }
3,753
0.656541
0.651212
106
34.405659
29.850185
111
false
false
0
0
0
0
0
0
0.632075
false
false
14
47f7b9cd383220ff2d8374e5d860a4f4621116ca
1,915,555,464,045
d59f2814467e55c70f9992e03b67d306617f22ab
/jbossas71/subsystem/src/main/java/com/camunda/fox/platform/subsystem/impl/service/ProcessArchiveService.java
5f176fc0b6c81984844e083cf9b38cffa8e9d9c3
[]
no_license
mgsoriano/fox-platform
https://github.com/mgsoriano/fox-platform
cf448841038e815eb56b53fe2a35e604bd5028f8
525095542134e408a0bba510969fe8948c91bbe9
refs/heads/master
2021-01-17T22:46:45.952000
2013-03-04T09:35:33
2013-03-04T09:35:33
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.camunda.fox.platform.subsystem.impl.service; import org.jboss.msc.service.Service; import org.jboss.msc.service.ServiceName; import org.jboss.msc.service.StartContext; import org.jboss.msc.service.StartException; import org.jboss.msc.service.StopContext; import org.jboss.msc.value.InjectedValue; import com.camunda.fox.platform.FoxPlatformException; import com.camunda.fox.platform.api.ProcessArchiveService.ProcessArchiveInstallation; import com.camunda.fox.platform.spi.ProcessArchive; public class ProcessArchiveService implements Service<ProcessArchiveService> { private InjectedValue<ContainerProcessEngineController> processEngineControllerInjector = new InjectedValue<ContainerProcessEngineController>(); private InjectedValue<ContainerPlatformService> containerPlatformServiceInjector = new InjectedValue<ContainerPlatformService>(); private final ProcessArchive processArchive; private ProcessArchiveInstallation processArchiveInstallation; private Throwable exception; public ProcessArchiveService(ProcessArchive processArchive) { this.processArchive = processArchive; } public ProcessArchiveService getValue() throws IllegalStateException, IllegalArgumentException { return this; } public void start(StartContext arg0) throws StartException { ContainerPlatformService containerPlatformService = containerPlatformServiceInjector.getOptionalValue(); try { processArchiveInstallation = containerPlatformService.installProcessArchiveInternal(processArchive); } catch(Throwable e) { this.exception = e; } } public void stop(StopContext arg0) { ContainerPlatformService containerPlatformService = containerPlatformServiceInjector.getValue(); containerPlatformService.removeProcessArchive(processArchive); } public static ServiceName getServiceName(String processArchiveName) { if(processArchiveName == null) { throw new FoxPlatformException("The name of a process archive cannot be null"); } return ContainerPlatformService.getServiceName().append("process-archive").append(processArchiveName); } public InjectedValue<ContainerProcessEngineController> getProcessEngineControllerInjector() { return processEngineControllerInjector; } public InjectedValue<ContainerPlatformService> getContainerPlatformServiceInjector() { return containerPlatformServiceInjector; } public ProcessArchiveInstallation getProcessArchiveInstallation() { return processArchiveInstallation; } public Throwable getException() { return exception; } }
UTF-8
Java
2,686
java
ProcessArchiveService.java
Java
[]
null
[]
package com.camunda.fox.platform.subsystem.impl.service; import org.jboss.msc.service.Service; import org.jboss.msc.service.ServiceName; import org.jboss.msc.service.StartContext; import org.jboss.msc.service.StartException; import org.jboss.msc.service.StopContext; import org.jboss.msc.value.InjectedValue; import com.camunda.fox.platform.FoxPlatformException; import com.camunda.fox.platform.api.ProcessArchiveService.ProcessArchiveInstallation; import com.camunda.fox.platform.spi.ProcessArchive; public class ProcessArchiveService implements Service<ProcessArchiveService> { private InjectedValue<ContainerProcessEngineController> processEngineControllerInjector = new InjectedValue<ContainerProcessEngineController>(); private InjectedValue<ContainerPlatformService> containerPlatformServiceInjector = new InjectedValue<ContainerPlatformService>(); private final ProcessArchive processArchive; private ProcessArchiveInstallation processArchiveInstallation; private Throwable exception; public ProcessArchiveService(ProcessArchive processArchive) { this.processArchive = processArchive; } public ProcessArchiveService getValue() throws IllegalStateException, IllegalArgumentException { return this; } public void start(StartContext arg0) throws StartException { ContainerPlatformService containerPlatformService = containerPlatformServiceInjector.getOptionalValue(); try { processArchiveInstallation = containerPlatformService.installProcessArchiveInternal(processArchive); } catch(Throwable e) { this.exception = e; } } public void stop(StopContext arg0) { ContainerPlatformService containerPlatformService = containerPlatformServiceInjector.getValue(); containerPlatformService.removeProcessArchive(processArchive); } public static ServiceName getServiceName(String processArchiveName) { if(processArchiveName == null) { throw new FoxPlatformException("The name of a process archive cannot be null"); } return ContainerPlatformService.getServiceName().append("process-archive").append(processArchiveName); } public InjectedValue<ContainerProcessEngineController> getProcessEngineControllerInjector() { return processEngineControllerInjector; } public InjectedValue<ContainerPlatformService> getContainerPlatformServiceInjector() { return containerPlatformServiceInjector; } public ProcessArchiveInstallation getProcessArchiveInstallation() { return processArchiveInstallation; } public Throwable getException() { return exception; } }
2,686
0.784438
0.783693
70
36.371429
37.413586
146
false
false
0
0
0
0
0
0
0.414286
false
false
14
151aafdf50ba9414d15ac3b4fe815a84cc87d4b5
24,446,953,890,647
a253f489e870c1d69e0bcc75901b613287b717c2
/src/main/java/org/gephi/graph/impl/GraphBridgeImpl.java
9766eb0d869ed00f46fccaba492f7ba19eeccdd6
[ "Apache-2.0" ]
permissive
gephi/graphstore
https://github.com/gephi/graphstore
944fdbaa5fc6f715db25d11d5a27811982170402
8883121a734542cff56471d41e0be9d1dc574009
refs/heads/master
2023-09-01T02:48:09.924000
2023-06-21T08:47:03
2023-06-21T08:47:03
10,005,385
66
25
Apache-2.0
false
2023-09-04T16:54:26
2013-05-11T21:17:23
2023-06-27T16:41:49
2023-09-04T16:54:25
2,438
65
26
7
Java
false
false
/* * Copyright 2012-2013 Gephi Consortium * * 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.gephi.graph.impl; import it.unimi.dsi.fastutil.ints.IntOpenHashSet; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Set; import org.gephi.graph.api.AttributeUtils; import org.gephi.graph.api.Column; import org.gephi.graph.api.Edge; import org.gephi.graph.api.Element; import org.gephi.graph.api.GraphBridge; import org.gephi.graph.api.GraphFactory; import org.gephi.graph.api.Interval; import org.gephi.graph.api.Node; import org.gephi.graph.api.TextProperties; import org.gephi.graph.api.TimeRepresentation; public class GraphBridgeImpl implements GraphBridge { private final GraphStore store; public GraphBridgeImpl(GraphStore store) { this.store = store; } @Override public void copyNodes(Node[] nodes) { if (nodes.length == 0) { return; } GraphStore sourceStore = null; // Verify nodes and add to id set Set<Integer> nodeIds = new IntOpenHashSet(); for (Node node : nodes) { NodeImpl nodeImpl = verifyNode(node); sourceStore = nodeImpl.graphStore; nodeIds.add(nodeImpl.storeId); } // Verify compatibility verifyCompatibility(sourceStore); // Verify edges and add to edges list Set<Integer> edgeTypeIds = new IntOpenHashSet(); List<EdgeImpl> edges = new ArrayList<>(); for (Node node : nodes) { for (Edge edge : sourceStore.getEdges(node)) { Node oppositeNode = sourceStore.getOpposite(node, edge); if (store.getNode(oppositeNode.getId()) != null || nodeIds.contains(oppositeNode.getStoreId())) { EdgeImpl edgeImpl = verifyEdge(edge); if (edgeImpl.isSelfLoop() || oppositeNode.getStoreId() > node.getStoreId()) { edges.add(edgeImpl); if (edgeImpl.getType() != EdgeTypeStore.NULL_LABEL) { edgeTypeIds.add(edgeImpl.getType()); } } } } } // Copy edge labels EdgeTypeStore sourceEdgeTypeStore = sourceStore.edgeTypeStore; for (Integer edgeId : edgeTypeIds) { Object label = sourceEdgeTypeStore.getLabel(edgeId); store.edgeTypeStore.addType(label, edgeId); } // Copy node columns TableImpl<Node> nodeTable = store.nodeTable; copyColumns(sourceStore.nodeTable, nodeTable); // Copy edge columns TableImpl<Edge> edgeTable = store.edgeTable; copyColumns(sourceStore.edgeTable, edgeTable); // Copy nodes GraphFactory factory = store.factory; for (Node node : nodes) { if (store.getNode(node.getId()) == null) { Node nodeCopy = factory.newNode(node.getId()); // Label copyLabel(node, nodeCopy); // Time set copyTimeSet(node, nodeCopy); // Properties if (store.configuration.isEnableNodeProperties()) { copyNodeProperties(node, nodeCopy); copyTextProperties(node.getTextProperties(), nodeCopy.getTextProperties()); } // Attributes copyAttributes(sourceStore.nodeTable, nodeTable, node, nodeCopy); // Add store.addNode(nodeCopy); } } // Copy edges for (EdgeImpl edge : edges) { if (store.getEdge(edge.getId()) == null) { Node source = store.getNode(edge.getSource().getId()); Node target = store.getNode(edge.getTarget().getId()); Edge edgeCopy = factory.newEdge(edge.getId(), source, target, edge.getType(), 0.0, edge.isDirected()); // Label copyLabel(edge, edgeCopy); // Time set copyTimeSet(edge, edgeCopy); // Weight copyEdgeWeight(edge, edgeCopy); // Properties if (store.configuration.isEnableEdgeProperties()) { copyEdgeProperties(edge, edgeCopy); copyTextProperties(edge.getTextProperties(), edgeCopy.getTextProperties()); } // Attributes copyAttributes(sourceStore.edgeTable, edgeTable, edge, edgeCopy); // Add store.addEdge(edgeCopy); } } } private void copyEdgeWeight(EdgeImpl edge, Edge edgeCopy) { if (edge.hasDynamicWeight()) { TimeRepresentation tr = edge.graphStore.configuration.getTimeRepresentation(); if (tr.equals(TimeRepresentation.INTERVAL)) { for (Map.Entry<Interval, Double> entry : edge.getWeights()) { edgeCopy.setWeight(entry.getValue(), entry.getKey()); } } else if (tr.equals(TimeRepresentation.TIMESTAMP)) { for (Map.Entry<Double, Double> entry : edge.getWeights()) { edgeCopy.setWeight(entry.getValue(), entry.getKey()); } } } else { edgeCopy.setWeight(edge.getWeight()); } } private void copyNodeProperties(Node node, Node nodeCopy) { nodeCopy.setPosition(node.x(), node.y(), node.z()); nodeCopy.setColor(node.getColor()); nodeCopy.setFixed(node.isFixed()); nodeCopy.setSize(node.size()); } private void copyLabel(Element element, Element elementCopy) { elementCopy.setLabel(element.getLabel()); } private void copyEdgeProperties(Edge edge, Edge edgeCopy) { edgeCopy.setColor(edge.getColor()); } private void copyTextProperties(TextProperties text, TextProperties textCopy) { textCopy.setColor(text.getColor()); textCopy.setSize(text.getSize()); textCopy.setVisible(text.isVisible()); textCopy.setText(text.getText()); textCopy.setDimensions(text.getWidth(), text.getHeight()); } private void copyTimeSet(Element element, Element elementCopy) { Column sourceColumn = element.getTable().getColumn(GraphStoreConfiguration.ELEMENT_TIMESET_INDEX); Column destColumn = elementCopy.getTable().getColumn(GraphStoreConfiguration.ELEMENT_TIMESET_INDEX); elementCopy.setAttribute(destColumn, AttributeUtils.copy(element.getAttribute(sourceColumn))); } private void copyColumns(TableImpl sourceTable, TableImpl destTable) { for (Column col : sourceTable.toArray()) { if (!col.isProperty() && !destTable.hasColumn(col.getId())) { destTable.addColumn(col.getId(), col.getTitle(), col.getTypeClass(), col.getOrigin(), col .getDefaultValue(), col.isIndexed()); } } } private void copyAttributes(TableImpl sourceTable, TableImpl destTable, Element element, Element elementCopy) { for (Column col : sourceTable.toArray()) { if (!col.isProperty()) { Column colCopy = destTable.getColumn(col.getId()); elementCopy.setAttribute(colCopy, AttributeUtils.copy(element.getAttribute(col))); } } } private NodeImpl verifyNode(Node node) { NodeImpl nodeImpl = (NodeImpl) node; verifyElement(nodeImpl); return nodeImpl; } private EdgeImpl verifyEdge(Edge edge) { EdgeImpl edgeImpl = (EdgeImpl) edge; verifyElement(edgeImpl); EdgeImpl existingEdge = store.getEdge(edge.getId()); if (existingEdge != null && (!existingEdge.getSource().getId().equals(edge.getSource().getId()) || !existingEdge .getTarget().getId().equals(edge.getTarget().getId()))) { throw new RuntimeException("An edge with a similar id '" + edge.getId() + "' already exists"); } return edgeImpl; } private void verifyElement(ElementImpl elementImpl) { if (elementImpl.getStoreId() < 0) { throw new RuntimeException("The element '" + elementImpl.getId() + "' doesn't belong to any store"); } } private void verifyCompatibility(GraphStore sourceStore) { // Verify configuration ConfigurationImpl destConfig = store.configuration; ConfigurationImpl sourceConfig = sourceStore.configuration; // Time representation if (!destConfig.getTimeRepresentation().equals(sourceConfig.getTimeRepresentation())) { throw new RuntimeException("The time representations doesn't match, source: " + sourceConfig .getTimeRepresentation() + ", destination: " + destConfig.getTimeRepresentation()); } // Node id type if (!destConfig.getNodeIdType().equals(sourceConfig.getNodeIdType())) { throw new RuntimeException("The node id type doesn't match, source: " + sourceConfig .getNodeIdType() + ", destination: " + destConfig.getNodeIdType()); } // Edge id type if (!destConfig.getEdgeIdType().equals(sourceConfig.getEdgeIdType())) { throw new RuntimeException("The edge id type doesn't match, source: " + sourceConfig .getEdgeIdType() + ", destination: " + destConfig.getEdgeIdType()); } // Edge weight type if (!destConfig.getEdgeWeightType().equals(sourceConfig.getEdgeWeightType())) { throw new RuntimeException("The edge weight type doesn't match, source: " + sourceConfig .getEdgeWeightType() + ", destination: " + destConfig.getEdgeWeightType()); } // Edge label type if (!destConfig.getEdgeLabelType().equals(sourceConfig.getEdgeLabelType())) { throw new RuntimeException("The edge label type doesn't match, source: " + sourceConfig .getEdgeLabelType() + ", destination: " + destConfig.getEdgeLabelType()); } // Parallel edges if (destConfig.isEnableParallelEdgesSameType() != sourceConfig.isEnableParallelEdgesSameType()) { throw new RuntimeException( "The parallel edges of same type configuration doesn't match, source: " + sourceConfig .isEnableParallelEdgesSameType() + ", destination: " + destConfig .isEnableParallelEdgesSameType()); } // Verify node table TableImpl<Node> destNodeTable = store.nodeTable; for (Column sourceCol : sourceStore.nodeTable) { if (!sourceCol.isProperty()) { Column destColumn = destNodeTable.getColumn(sourceCol.getId()); if (destColumn != null && !destColumn.getTypeClass().equals(sourceCol.getTypeClass())) { throw new RuntimeException( "A node column '" + destColumn.getId() + "' already exists with a different type"); } } } // Verify edge table TableImpl<Edge> destEdgeTable = store.edgeTable; for (Column sourceCol : sourceStore.edgeTable) { if (!sourceCol.isProperty()) { Column destColumn = destEdgeTable.getColumn(sourceCol.getId()); if (destColumn != null && !destColumn.getTypeClass().equals(sourceCol.getTypeClass())) { throw new RuntimeException( "An edge column '" + destColumn.getId() + "' already exists with a different type"); } } } } }
UTF-8
Java
12,303
java
GraphBridgeImpl.java
Java
[]
null
[]
/* * Copyright 2012-2013 Gephi Consortium * * 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.gephi.graph.impl; import it.unimi.dsi.fastutil.ints.IntOpenHashSet; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Set; import org.gephi.graph.api.AttributeUtils; import org.gephi.graph.api.Column; import org.gephi.graph.api.Edge; import org.gephi.graph.api.Element; import org.gephi.graph.api.GraphBridge; import org.gephi.graph.api.GraphFactory; import org.gephi.graph.api.Interval; import org.gephi.graph.api.Node; import org.gephi.graph.api.TextProperties; import org.gephi.graph.api.TimeRepresentation; public class GraphBridgeImpl implements GraphBridge { private final GraphStore store; public GraphBridgeImpl(GraphStore store) { this.store = store; } @Override public void copyNodes(Node[] nodes) { if (nodes.length == 0) { return; } GraphStore sourceStore = null; // Verify nodes and add to id set Set<Integer> nodeIds = new IntOpenHashSet(); for (Node node : nodes) { NodeImpl nodeImpl = verifyNode(node); sourceStore = nodeImpl.graphStore; nodeIds.add(nodeImpl.storeId); } // Verify compatibility verifyCompatibility(sourceStore); // Verify edges and add to edges list Set<Integer> edgeTypeIds = new IntOpenHashSet(); List<EdgeImpl> edges = new ArrayList<>(); for (Node node : nodes) { for (Edge edge : sourceStore.getEdges(node)) { Node oppositeNode = sourceStore.getOpposite(node, edge); if (store.getNode(oppositeNode.getId()) != null || nodeIds.contains(oppositeNode.getStoreId())) { EdgeImpl edgeImpl = verifyEdge(edge); if (edgeImpl.isSelfLoop() || oppositeNode.getStoreId() > node.getStoreId()) { edges.add(edgeImpl); if (edgeImpl.getType() != EdgeTypeStore.NULL_LABEL) { edgeTypeIds.add(edgeImpl.getType()); } } } } } // Copy edge labels EdgeTypeStore sourceEdgeTypeStore = sourceStore.edgeTypeStore; for (Integer edgeId : edgeTypeIds) { Object label = sourceEdgeTypeStore.getLabel(edgeId); store.edgeTypeStore.addType(label, edgeId); } // Copy node columns TableImpl<Node> nodeTable = store.nodeTable; copyColumns(sourceStore.nodeTable, nodeTable); // Copy edge columns TableImpl<Edge> edgeTable = store.edgeTable; copyColumns(sourceStore.edgeTable, edgeTable); // Copy nodes GraphFactory factory = store.factory; for (Node node : nodes) { if (store.getNode(node.getId()) == null) { Node nodeCopy = factory.newNode(node.getId()); // Label copyLabel(node, nodeCopy); // Time set copyTimeSet(node, nodeCopy); // Properties if (store.configuration.isEnableNodeProperties()) { copyNodeProperties(node, nodeCopy); copyTextProperties(node.getTextProperties(), nodeCopy.getTextProperties()); } // Attributes copyAttributes(sourceStore.nodeTable, nodeTable, node, nodeCopy); // Add store.addNode(nodeCopy); } } // Copy edges for (EdgeImpl edge : edges) { if (store.getEdge(edge.getId()) == null) { Node source = store.getNode(edge.getSource().getId()); Node target = store.getNode(edge.getTarget().getId()); Edge edgeCopy = factory.newEdge(edge.getId(), source, target, edge.getType(), 0.0, edge.isDirected()); // Label copyLabel(edge, edgeCopy); // Time set copyTimeSet(edge, edgeCopy); // Weight copyEdgeWeight(edge, edgeCopy); // Properties if (store.configuration.isEnableEdgeProperties()) { copyEdgeProperties(edge, edgeCopy); copyTextProperties(edge.getTextProperties(), edgeCopy.getTextProperties()); } // Attributes copyAttributes(sourceStore.edgeTable, edgeTable, edge, edgeCopy); // Add store.addEdge(edgeCopy); } } } private void copyEdgeWeight(EdgeImpl edge, Edge edgeCopy) { if (edge.hasDynamicWeight()) { TimeRepresentation tr = edge.graphStore.configuration.getTimeRepresentation(); if (tr.equals(TimeRepresentation.INTERVAL)) { for (Map.Entry<Interval, Double> entry : edge.getWeights()) { edgeCopy.setWeight(entry.getValue(), entry.getKey()); } } else if (tr.equals(TimeRepresentation.TIMESTAMP)) { for (Map.Entry<Double, Double> entry : edge.getWeights()) { edgeCopy.setWeight(entry.getValue(), entry.getKey()); } } } else { edgeCopy.setWeight(edge.getWeight()); } } private void copyNodeProperties(Node node, Node nodeCopy) { nodeCopy.setPosition(node.x(), node.y(), node.z()); nodeCopy.setColor(node.getColor()); nodeCopy.setFixed(node.isFixed()); nodeCopy.setSize(node.size()); } private void copyLabel(Element element, Element elementCopy) { elementCopy.setLabel(element.getLabel()); } private void copyEdgeProperties(Edge edge, Edge edgeCopy) { edgeCopy.setColor(edge.getColor()); } private void copyTextProperties(TextProperties text, TextProperties textCopy) { textCopy.setColor(text.getColor()); textCopy.setSize(text.getSize()); textCopy.setVisible(text.isVisible()); textCopy.setText(text.getText()); textCopy.setDimensions(text.getWidth(), text.getHeight()); } private void copyTimeSet(Element element, Element elementCopy) { Column sourceColumn = element.getTable().getColumn(GraphStoreConfiguration.ELEMENT_TIMESET_INDEX); Column destColumn = elementCopy.getTable().getColumn(GraphStoreConfiguration.ELEMENT_TIMESET_INDEX); elementCopy.setAttribute(destColumn, AttributeUtils.copy(element.getAttribute(sourceColumn))); } private void copyColumns(TableImpl sourceTable, TableImpl destTable) { for (Column col : sourceTable.toArray()) { if (!col.isProperty() && !destTable.hasColumn(col.getId())) { destTable.addColumn(col.getId(), col.getTitle(), col.getTypeClass(), col.getOrigin(), col .getDefaultValue(), col.isIndexed()); } } } private void copyAttributes(TableImpl sourceTable, TableImpl destTable, Element element, Element elementCopy) { for (Column col : sourceTable.toArray()) { if (!col.isProperty()) { Column colCopy = destTable.getColumn(col.getId()); elementCopy.setAttribute(colCopy, AttributeUtils.copy(element.getAttribute(col))); } } } private NodeImpl verifyNode(Node node) { NodeImpl nodeImpl = (NodeImpl) node; verifyElement(nodeImpl); return nodeImpl; } private EdgeImpl verifyEdge(Edge edge) { EdgeImpl edgeImpl = (EdgeImpl) edge; verifyElement(edgeImpl); EdgeImpl existingEdge = store.getEdge(edge.getId()); if (existingEdge != null && (!existingEdge.getSource().getId().equals(edge.getSource().getId()) || !existingEdge .getTarget().getId().equals(edge.getTarget().getId()))) { throw new RuntimeException("An edge with a similar id '" + edge.getId() + "' already exists"); } return edgeImpl; } private void verifyElement(ElementImpl elementImpl) { if (elementImpl.getStoreId() < 0) { throw new RuntimeException("The element '" + elementImpl.getId() + "' doesn't belong to any store"); } } private void verifyCompatibility(GraphStore sourceStore) { // Verify configuration ConfigurationImpl destConfig = store.configuration; ConfigurationImpl sourceConfig = sourceStore.configuration; // Time representation if (!destConfig.getTimeRepresentation().equals(sourceConfig.getTimeRepresentation())) { throw new RuntimeException("The time representations doesn't match, source: " + sourceConfig .getTimeRepresentation() + ", destination: " + destConfig.getTimeRepresentation()); } // Node id type if (!destConfig.getNodeIdType().equals(sourceConfig.getNodeIdType())) { throw new RuntimeException("The node id type doesn't match, source: " + sourceConfig .getNodeIdType() + ", destination: " + destConfig.getNodeIdType()); } // Edge id type if (!destConfig.getEdgeIdType().equals(sourceConfig.getEdgeIdType())) { throw new RuntimeException("The edge id type doesn't match, source: " + sourceConfig .getEdgeIdType() + ", destination: " + destConfig.getEdgeIdType()); } // Edge weight type if (!destConfig.getEdgeWeightType().equals(sourceConfig.getEdgeWeightType())) { throw new RuntimeException("The edge weight type doesn't match, source: " + sourceConfig .getEdgeWeightType() + ", destination: " + destConfig.getEdgeWeightType()); } // Edge label type if (!destConfig.getEdgeLabelType().equals(sourceConfig.getEdgeLabelType())) { throw new RuntimeException("The edge label type doesn't match, source: " + sourceConfig .getEdgeLabelType() + ", destination: " + destConfig.getEdgeLabelType()); } // Parallel edges if (destConfig.isEnableParallelEdgesSameType() != sourceConfig.isEnableParallelEdgesSameType()) { throw new RuntimeException( "The parallel edges of same type configuration doesn't match, source: " + sourceConfig .isEnableParallelEdgesSameType() + ", destination: " + destConfig .isEnableParallelEdgesSameType()); } // Verify node table TableImpl<Node> destNodeTable = store.nodeTable; for (Column sourceCol : sourceStore.nodeTable) { if (!sourceCol.isProperty()) { Column destColumn = destNodeTable.getColumn(sourceCol.getId()); if (destColumn != null && !destColumn.getTypeClass().equals(sourceCol.getTypeClass())) { throw new RuntimeException( "A node column '" + destColumn.getId() + "' already exists with a different type"); } } } // Verify edge table TableImpl<Edge> destEdgeTable = store.edgeTable; for (Column sourceCol : sourceStore.edgeTable) { if (!sourceCol.isProperty()) { Column destColumn = destEdgeTable.getColumn(sourceCol.getId()); if (destColumn != null && !destColumn.getTypeClass().equals(sourceCol.getTypeClass())) { throw new RuntimeException( "An edge column '" + destColumn.getId() + "' already exists with a different type"); } } } } }
12,303
0.601723
0.600423
309
38.815533
32.519573
120
false
false
0
0
0
0
0
0
0.553398
false
false
14
68a0f987018a6a8d138c96c69f3ca3e920e282b4
24,910,810,362,086
556ac926035a220d3207d25919107685dedc7ac2
/app/src/main/java/com/jiujiu/question/util/Util.java
6ebcf006f444cab9497ac5f122100e6849e9cc6e
[]
no_license
my-jabin/mvvmQuiz
https://github.com/my-jabin/mvvmQuiz
210ae1866923d6f7bf5b6fd28028ec067e22d137
e6467061b8de0fc3eae7fc20734ee91f4aea8942
refs/heads/master
2020-04-12T16:49:21.913000
2018-12-20T20:09:04
2018-12-20T20:09:04
162,625,147
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.jiujiu.question.util; import android.content.Context; import android.content.res.AssetManager; import com.jiujiu.question.data.model.Difficulty; import com.jiujiu.question.data.model.QuestionEntity; import com.jiujiu.question.data.model.Type; import com.jiujiu.question.data.remote.ApiResponse; import com.jiujiu.question.data.remote.Question; import java.io.IOException; import java.io.InputStream; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.util.List; import java.util.stream.Collectors; public final class Util { private Util() { } public static List<QuestionEntity> convertToQuestionEntities(List<Question> questions) { return questions.stream() .map(Question::toQuestionEntity) .collect(Collectors.toList()); } public static String loadJSONFromAsset(Context context, String jsonFileName) throws IOException { AssetManager manager = context.getAssets(); InputStream is = manager.open(jsonFileName); int size = is.available(); byte[] buffer = new byte[size]; is.read(buffer); is.close(); return new String(buffer, "UTF-8"); } public static String errorMessage(int errorCode) { switch (errorCode) { case ApiResponse.NO_RESULT: return "Could not return results. The API doesn't have enough questions for your query."; case ApiResponse.INVALID_PARAMETER: return "Contains an invalid parameter. Arguements passed in aren't valid."; case ApiResponse.TOKEN_NOT_FOUND: return " Session Token does not exist."; case ApiResponse.TOKEN_EMPTY: return "Session Token has returned all possible questions for the specified query. Resetting the Token is necessary."; default: return ""; } } public static String decode(String str) { try { return URLDecoder.decode(str, "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return ""; } public static Type convertToTypeEnum(String str) { if ("multiple".equalsIgnoreCase(str.trim()) || "Multiple Choice".equalsIgnoreCase(str)) { return Type.MultipleChoice; } else if ("boolean".equalsIgnoreCase(str.trim()) || "True/False".equalsIgnoreCase(str)) { return Type.TrueFalse; } else { return Type.Any; } } public static Difficulty convertToDifficultyEnum(String str) { if ("hard".equalsIgnoreCase(str.trim())) { return Difficulty.Hard; } else if ("easy".equalsIgnoreCase(str.trim())) { return Difficulty.Easy; } else if ("medium".equalsIgnoreCase(str.trim())) { return Difficulty.Medium; } else { return Difficulty.Any; } } public static String matchTypeToUrlQueryString(String str) { if (Type.MultipleChoice.toString().equalsIgnoreCase(str)) { return "multiple"; } else if (Type.TrueFalse.toString().equalsIgnoreCase(str)) { return "boolean"; } else { return ""; } } public static String matchDifffToUrlQueryString(String str) { if (Difficulty.Hard.toString().equalsIgnoreCase(str)) { return "hard"; } else if (Difficulty.Easy.toString().equalsIgnoreCase(str)) { return "easy"; } else if (Difficulty.Medium.toString().equalsIgnoreCase(str)) { return "medium"; } else { return ""; } } }
UTF-8
Java
3,701
java
Util.java
Java
[]
null
[]
package com.jiujiu.question.util; import android.content.Context; import android.content.res.AssetManager; import com.jiujiu.question.data.model.Difficulty; import com.jiujiu.question.data.model.QuestionEntity; import com.jiujiu.question.data.model.Type; import com.jiujiu.question.data.remote.ApiResponse; import com.jiujiu.question.data.remote.Question; import java.io.IOException; import java.io.InputStream; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.util.List; import java.util.stream.Collectors; public final class Util { private Util() { } public static List<QuestionEntity> convertToQuestionEntities(List<Question> questions) { return questions.stream() .map(Question::toQuestionEntity) .collect(Collectors.toList()); } public static String loadJSONFromAsset(Context context, String jsonFileName) throws IOException { AssetManager manager = context.getAssets(); InputStream is = manager.open(jsonFileName); int size = is.available(); byte[] buffer = new byte[size]; is.read(buffer); is.close(); return new String(buffer, "UTF-8"); } public static String errorMessage(int errorCode) { switch (errorCode) { case ApiResponse.NO_RESULT: return "Could not return results. The API doesn't have enough questions for your query."; case ApiResponse.INVALID_PARAMETER: return "Contains an invalid parameter. Arguements passed in aren't valid."; case ApiResponse.TOKEN_NOT_FOUND: return " Session Token does not exist."; case ApiResponse.TOKEN_EMPTY: return "Session Token has returned all possible questions for the specified query. Resetting the Token is necessary."; default: return ""; } } public static String decode(String str) { try { return URLDecoder.decode(str, "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return ""; } public static Type convertToTypeEnum(String str) { if ("multiple".equalsIgnoreCase(str.trim()) || "Multiple Choice".equalsIgnoreCase(str)) { return Type.MultipleChoice; } else if ("boolean".equalsIgnoreCase(str.trim()) || "True/False".equalsIgnoreCase(str)) { return Type.TrueFalse; } else { return Type.Any; } } public static Difficulty convertToDifficultyEnum(String str) { if ("hard".equalsIgnoreCase(str.trim())) { return Difficulty.Hard; } else if ("easy".equalsIgnoreCase(str.trim())) { return Difficulty.Easy; } else if ("medium".equalsIgnoreCase(str.trim())) { return Difficulty.Medium; } else { return Difficulty.Any; } } public static String matchTypeToUrlQueryString(String str) { if (Type.MultipleChoice.toString().equalsIgnoreCase(str)) { return "multiple"; } else if (Type.TrueFalse.toString().equalsIgnoreCase(str)) { return "boolean"; } else { return ""; } } public static String matchDifffToUrlQueryString(String str) { if (Difficulty.Hard.toString().equalsIgnoreCase(str)) { return "hard"; } else if (Difficulty.Easy.toString().equalsIgnoreCase(str)) { return "easy"; } else if (Difficulty.Medium.toString().equalsIgnoreCase(str)) { return "medium"; } else { return ""; } } }
3,701
0.624426
0.623885
109
32.954128
27.503256
134
false
false
0
0
0
0
0
0
0.46789
false
false
14
af81e70a646063c8cd350de0e90e7cc1e58d245e
7,499,012,964,610
a6dbc3ed241bb57235301d72a4ebaa70807f2fa5
/taverna-maven-plugin/src/main/java/net/sf/taverna/t2/maven/plugins/AbstractDeployMojo.java
d3e98cf4ba363181888e08a17ec889874b148ad8
[ "Apache-2.0" ]
permissive
taverna-incubator/incubator-taverna-osgi
https://github.com/taverna-incubator/incubator-taverna-osgi
3677897f191354aca6e021c3740c89907502ff69
c9bb093ac3ea4c32472265a3303b32b40203b58f
refs/heads/master
2021-01-16T19:23:28.774000
2015-02-23T10:05:41
2015-02-23T10:05:41
28,214,391
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/******************************************************************************* * Copyright (C) 2013 The University of Manchester * * Modifications to the initial code base are copyright of their * respective authors, or their employers as appropriate. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser 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 ******************************************************************************/ package net.sf.taverna.t2.maven.plugins; import java.io.File; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; /** * Abstract Mojo for deploying artifacts. * * @author David Withers */ public abstract class AbstractDeployMojo extends AbstractWagonMojo { @Component protected MavenProject project; /** * Directory containing the generated Taverna plugin. */ @Parameter(defaultValue = "${project.build.directory}", required = true) protected File buildDirectory; @Parameter(defaultValue = "${project.build.outputDirectory}", required = true) protected File outputDirectory; @Parameter(defaultValue = "${project.artifact}", required = true, readonly = true) protected Artifact artifact; @Parameter(defaultValue = "${project.distributionManagementArtifactRepository}", required = true, readonly = true) protected ArtifactRepository deploymentRepository; }
UTF-8
Java
2,179
java
AbstractDeployMojo.java
Java
[ { "context": "stract Mojo for deploying artifacts.\n *\n * @author David Withers\n */\npublic abstract class AbstractDeployMojo exte", "end": 1486, "score": 0.9988934397697449, "start": 1473, "tag": "NAME", "value": "David Withers" } ]
null
[]
/******************************************************************************* * Copyright (C) 2013 The University of Manchester * * Modifications to the initial code base are copyright of their * respective authors, or their employers as appropriate. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser 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 ******************************************************************************/ package net.sf.taverna.t2.maven.plugins; import java.io.File; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; /** * Abstract Mojo for deploying artifacts. * * @author <NAME> */ public abstract class AbstractDeployMojo extends AbstractWagonMojo { @Component protected MavenProject project; /** * Directory containing the generated Taverna plugin. */ @Parameter(defaultValue = "${project.build.directory}", required = true) protected File buildDirectory; @Parameter(defaultValue = "${project.build.outputDirectory}", required = true) protected File outputDirectory; @Parameter(defaultValue = "${project.artifact}", required = true, readonly = true) protected Artifact artifact; @Parameter(defaultValue = "${project.distributionManagementArtifactRepository}", required = true, readonly = true) protected ArtifactRepository deploymentRepository; }
2,172
0.711794
0.702157
56
37.910713
31.128349
115
false
false
0
0
0
0
0
0
0.785714
false
false
14
67aea5c6fc633d7606a6015a56aaecacfbb80a40
34,668,976,015,931
78d0b48a1f2f306b576ab5f0da24f22ab98d1fe8
/src/Ass6Game.java
48ec604790d24ef0120af058ffa4ab1fa4cf80f8
[]
no_license
pelegs29/Arkanoid_Game
https://github.com/pelegs29/Arkanoid_Game
a4b7de4e5f95eba8ec6297feb3462763b89f2aab
66848d16aacf2d6a001d7997833a141290c11d14
refs/heads/master
2023-05-23T15:27:44.175000
2021-06-14T07:21:12
2021-06-14T07:21:12
374,775,955
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
//318509700 import biuoop.GUI; import game.GameFlow; import game.animations.AnimationRunner; import game.levels.LevelInformation; import game.levels.LevelsBuilder; import java.util.ArrayList; import java.util.List; /** * This program create a game object, * initializes and runs it. * * @author Peleg Shlomo * @version 1.5 * @since 1.0 */ public class Ass6Game { /** * This is the main method which makes use of the Game class methods. * * @param args Unused. */ public static void main(String[] args) { LevelsBuilder builder = new LevelsBuilder(args); List<LevelInformation> levelsList = new ArrayList<>(builder.buildLevels()); GUI gameGui = new GUI("Arkanoid Game", GameFlow.GUI_WIDTH, GameFlow.GUI_HEIGHT); GameFlow game = new GameFlow(new AnimationRunner(gameGui), gameGui.getKeyboardSensor(), gameGui); game.runLevels(levelsList); } }
UTF-8
Java
921
java
Ass6Game.java
Java
[ { "context": " object,\n * initializes and runs it.\n *\n * @author Peleg Shlomo\n * @version 1.5\n * @since 1.0\n */\npublic class As", "end": 314, "score": 0.9998790621757507, "start": 302, "tag": "NAME", "value": "Peleg Shlomo" } ]
null
[]
//318509700 import biuoop.GUI; import game.GameFlow; import game.animations.AnimationRunner; import game.levels.LevelInformation; import game.levels.LevelsBuilder; import java.util.ArrayList; import java.util.List; /** * This program create a game object, * initializes and runs it. * * @author <NAME> * @version 1.5 * @since 1.0 */ public class Ass6Game { /** * This is the main method which makes use of the Game class methods. * * @param args Unused. */ public static void main(String[] args) { LevelsBuilder builder = new LevelsBuilder(args); List<LevelInformation> levelsList = new ArrayList<>(builder.buildLevels()); GUI gameGui = new GUI("Arkanoid Game", GameFlow.GUI_WIDTH, GameFlow.GUI_HEIGHT); GameFlow game = new GameFlow(new AnimationRunner(gameGui), gameGui.getKeyboardSensor(), gameGui); game.runLevels(levelsList); } }
915
0.694897
0.679696
33
26.939394
26.82597
105
false
false
0
0
0
0
0
0
0.515152
false
false
10
81c48eae6a8d493146bdab421b54d36cdf93afb0
16,183,436,815,823
e5813aa49016985d2378198cf129dcc4b88579a5
/src/main/java/com/emc/rpsp/fal/commons/VnxClasses.java
825f5dd5e69cd17f9a722f1ba6ef2aa61811045e
[ "MIT" ]
permissive
cunla/RPSP
https://github.com/cunla/RPSP
d10fa3a756c8ea6ea7dc2334d7ebd7c4bf1b81ec
ed34b8c07a97ac99a984b3508c20fba50a0b31d7
refs/heads/master
2021-07-17T15:15:04.137000
2021-04-26T17:51:34
2021-04-26T17:51:34
35,469,747
4
1
null
false
2021-04-26T17:51:35
2015-05-12T05:58:51
2020-01-06T14:01:33
2021-04-26T17:51:34
11,805
6
1
44
Java
false
false
package com.emc.rpsp.fal.commons; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlSeeAlso; import javax.xml.bind.annotation.XmlType; @XmlSeeAlso({FileSystemExtendedInformation.class, FileSystemInformation.class, FileSystemUID.class, FileSystemView.class, MountInformation.class, ShareInformation.class, ClusterFileSystemView.class, ClusterFileSystemViewContext.class, VnxServer.class, VnxLoginInformation.class, VnxUID.class, ReplicationSetType.class}) @XmlRootElement @XmlType(name = "VnxClasses") public class VnxClasses { }
UTF-8
Java
575
java
VnxClasses.java
Java
[]
null
[]
package com.emc.rpsp.fal.commons; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlSeeAlso; import javax.xml.bind.annotation.XmlType; @XmlSeeAlso({FileSystemExtendedInformation.class, FileSystemInformation.class, FileSystemUID.class, FileSystemView.class, MountInformation.class, ShareInformation.class, ClusterFileSystemView.class, ClusterFileSystemViewContext.class, VnxServer.class, VnxLoginInformation.class, VnxUID.class, ReplicationSetType.class}) @XmlRootElement @XmlType(name = "VnxClasses") public class VnxClasses { }
575
0.831304
0.831304
14
40.07143
41.0513
133
false
false
0
0
0
0
0
0
1.071429
false
false
10
b104f6b4b4f60adb0b689bc3e785787b29875e39
22,058,952,059,175
90ec60b4d8fcb2fd7853d730aba2e2963d532924
/src/main/java/com/teamtreehouse/control/ControlEventHandler.java
791498660578889d8199805aeac508de54ab0ca1
[]
no_license
ScottMikul/HomeAutomationRestApi
https://github.com/ScottMikul/HomeAutomationRestApi
994fcd1858df800f8b8e752c52b45598866664ab
ac45a4aee1fe61f43f6d061588f973f244accb63
refs/heads/master
2021-01-13T05:37:05.478000
2017-06-22T12:17:50
2017-06-22T12:17:50
95,112,334
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.teamtreehouse.control; import com.teamtreehouse.user.User; import com.teamtreehouse.user.UserRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.rest.core.annotation.*; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.stereotype.Component; /** * Created by scott on 6/20/2017. */ @Component @RepositoryEventHandler(Control.class) public class ControlEventHandler { private final UserRepository repo; @Autowired public ControlEventHandler(UserRepository repo) { this.repo = repo; } @HandleBeforeSave @HandleBeforeCreate public void setLastModifiedBy(Control control){ String username= SecurityContextHolder.getContext().getAuthentication().getName(); User user = repo.findByName(username); control.setLastModifiedBy(user); } }
UTF-8
Java
914
java
ControlEventHandler.java
Java
[ { "context": "framework.stereotype.Component;\n\n/**\n * Created by scott on 6/20/2017.\n */\n@Component\n@RepositoryEventHand", "end": 382, "score": 0.9992458820343018, "start": 377, "tag": "USERNAME", "value": "scott" } ]
null
[]
package com.teamtreehouse.control; import com.teamtreehouse.user.User; import com.teamtreehouse.user.UserRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.rest.core.annotation.*; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.stereotype.Component; /** * Created by scott on 6/20/2017. */ @Component @RepositoryEventHandler(Control.class) public class ControlEventHandler { private final UserRepository repo; @Autowired public ControlEventHandler(UserRepository repo) { this.repo = repo; } @HandleBeforeSave @HandleBeforeCreate public void setLastModifiedBy(Control control){ String username= SecurityContextHolder.getContext().getAuthentication().getName(); User user = repo.findByName(username); control.setLastModifiedBy(user); } }
914
0.765864
0.758206
31
28.483871
23.954084
90
false
false
0
0
0
0
0
0
0.387097
false
false
10
856b13afab709da20091da5b8918ef5d7972a5dc
22,058,952,058,343
bbd55ecafd40af33cc0931133491e5eba57ef46c
/JavaDay1/src/main/java/com/example/scope/ScopesDriver.java
15334c7ae13081053b9e0826b86d9a92b8c9d4ee
[]
no_license
Michael-Kochis/210621---UTA-SH---Java-MSA
https://github.com/Michael-Kochis/210621---UTA-SH---Java-MSA
a40f5c63a4e0ed6e953e7bd4fd2c30a4f5439d7b
745451fd0d6399316d3b2192bdbe381facb9b5fd
refs/heads/main
2023-07-12T04:13:33.791000
2021-08-19T15:15:40
2021-08-19T15:15:40
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.scope; public class ScopesDriver { public static void main(String[] args) { //Create a new instance of our ScopesAndMods class ScopesAndMods sm = new ScopesAndMods(); //We can use this to access instance variables and static variables System.out.println(sm.a); System.out.println(sm.str); ScopesAndMods sm2 = new ScopesAndMods(); sm2.str = "I am a new string"; System.out.println(sm.str); System.out.println(sm2.str); //The proper way to access static variables and methods System.out.println(ScopesAndMods.CONSTANT); ScopesAndMods.Hello(); } }
UTF-8
Java
614
java
ScopesDriver.java
Java
[]
null
[]
package com.example.scope; public class ScopesDriver { public static void main(String[] args) { //Create a new instance of our ScopesAndMods class ScopesAndMods sm = new ScopesAndMods(); //We can use this to access instance variables and static variables System.out.println(sm.a); System.out.println(sm.str); ScopesAndMods sm2 = new ScopesAndMods(); sm2.str = "I am a new string"; System.out.println(sm.str); System.out.println(sm2.str); //The proper way to access static variables and methods System.out.println(ScopesAndMods.CONSTANT); ScopesAndMods.Hello(); } }
614
0.710098
0.705212
26
22.615385
20.488415
69
false
false
0
0
0
0
0
0
1.923077
false
false
10
73b6fbb8bd88ff21d2d15b395e912d1b2256c1f4
26,053,271,684,879
3358eb6b88c72aacbe5628a5289ada5e5fd93778
/src/com/practice/tree/BinaryTreeView.java
45dfbd0e4fd80ae33eeb5f7f78cf71cf036e52a2
[]
no_license
sarvesh1309/DSjava
https://github.com/sarvesh1309/DSjava
42a14c50935e3b2d818e7afa0145ebdecc0f31d5
a7054cda03099a183b28037c623e7667ea7ea9a1
refs/heads/master
2021-07-10T13:14:06.531000
2021-07-06T09:02:52
2021-07-06T09:02:52
172,194,172
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.practice.tree; import java.util.HashMap; import java.util.LinkedList; import java.util.Map; import java.util.Queue; public class BinaryTreeView { static class TreeNode { TreeNode left; TreeNode right; int val; public TreeNode(int val) { this.val = val; } } static class PairNode { TreeNode node; int pos; public PairNode(TreeNode n, int pos) { this.node = n; this.pos = pos; } } /** * * @param root */ public static void printTopView(TreeNode root) { Queue<PairNode> q = new LinkedList<>(); q.add(new PairNode(root, 0)); Map<Integer, Integer> map = new HashMap<>(); int min = 0; int max = 0; while (!q.isEmpty()) { PairNode tmp = q.poll(); TreeNode treeTmp = tmp.node; int position = tmp.pos; if (!map.containsKey(position)) { map.put(position, treeTmp.val); } min = Math.min(min, position); max = Math.max(max, position); if (treeTmp.left != null) q.add(new PairNode(treeTmp.left, position - 1)); if (treeTmp.right != null) q.add(new PairNode(treeTmp.right, position + 1)); } for (int i = min; i <= max; i++) { System.out.print(map.get(i) + " "); } } /** * * @param root */ public static void printLowerView(TreeNode root) { Queue<PairNode> q = new LinkedList<>(); q.add(new PairNode(root, 0)); Map<Integer, Integer> map = new HashMap<>(); int min = 0; int max = 0; while (!q.isEmpty()) { PairNode tmp = q.poll(); TreeNode treeTmp = tmp.node; int position = tmp.pos; map.put(position, treeTmp.val); min = Math.min(min, position); max = Math.max(max, position); if (treeTmp.left != null) q.add(new PairNode(treeTmp.left, position - 1)); if (treeTmp.right != null) q.add(new PairNode(treeTmp.right, position + 1)); } for (int i = min; i <= max; i++) { System.out.print(map.get(i) + " "); } } /** * * @param root */ public static void printLeftViewOfTree(TreeNode root) { Queue<TreeNode> qu = new LinkedList<>(); qu.add(root); while (!qu.isEmpty()) { int firstElem = qu.peek().val; int size = qu.size(); for (int i = 0; i < size; i++) { TreeNode tmp = qu.poll(); if (tmp.left != null) { qu.add(tmp.left); } if (tmp.right != null) qu.add(tmp.right); } System.out.print(firstElem + " "); } } /** * * @param root */ public static void printRightViewOfTree(TreeNode root) { Queue<TreeNode> qu = new LinkedList<>(); qu.add(root); while (!qu.isEmpty()) { int size = qu.size(); int lastElem = 0; for (int i = 0; i < size; i++) { TreeNode tmp = qu.poll(); lastElem = tmp.val; if (tmp.left != null) { qu.add(tmp.left); } if (tmp.right != null) qu.add(tmp.right); } System.out.print(lastElem + " "); } } }
UTF-8
Java
2,808
java
BinaryTreeView.java
Java
[]
null
[]
package com.practice.tree; import java.util.HashMap; import java.util.LinkedList; import java.util.Map; import java.util.Queue; public class BinaryTreeView { static class TreeNode { TreeNode left; TreeNode right; int val; public TreeNode(int val) { this.val = val; } } static class PairNode { TreeNode node; int pos; public PairNode(TreeNode n, int pos) { this.node = n; this.pos = pos; } } /** * * @param root */ public static void printTopView(TreeNode root) { Queue<PairNode> q = new LinkedList<>(); q.add(new PairNode(root, 0)); Map<Integer, Integer> map = new HashMap<>(); int min = 0; int max = 0; while (!q.isEmpty()) { PairNode tmp = q.poll(); TreeNode treeTmp = tmp.node; int position = tmp.pos; if (!map.containsKey(position)) { map.put(position, treeTmp.val); } min = Math.min(min, position); max = Math.max(max, position); if (treeTmp.left != null) q.add(new PairNode(treeTmp.left, position - 1)); if (treeTmp.right != null) q.add(new PairNode(treeTmp.right, position + 1)); } for (int i = min; i <= max; i++) { System.out.print(map.get(i) + " "); } } /** * * @param root */ public static void printLowerView(TreeNode root) { Queue<PairNode> q = new LinkedList<>(); q.add(new PairNode(root, 0)); Map<Integer, Integer> map = new HashMap<>(); int min = 0; int max = 0; while (!q.isEmpty()) { PairNode tmp = q.poll(); TreeNode treeTmp = tmp.node; int position = tmp.pos; map.put(position, treeTmp.val); min = Math.min(min, position); max = Math.max(max, position); if (treeTmp.left != null) q.add(new PairNode(treeTmp.left, position - 1)); if (treeTmp.right != null) q.add(new PairNode(treeTmp.right, position + 1)); } for (int i = min; i <= max; i++) { System.out.print(map.get(i) + " "); } } /** * * @param root */ public static void printLeftViewOfTree(TreeNode root) { Queue<TreeNode> qu = new LinkedList<>(); qu.add(root); while (!qu.isEmpty()) { int firstElem = qu.peek().val; int size = qu.size(); for (int i = 0; i < size; i++) { TreeNode tmp = qu.poll(); if (tmp.left != null) { qu.add(tmp.left); } if (tmp.right != null) qu.add(tmp.right); } System.out.print(firstElem + " "); } } /** * * @param root */ public static void printRightViewOfTree(TreeNode root) { Queue<TreeNode> qu = new LinkedList<>(); qu.add(root); while (!qu.isEmpty()) { int size = qu.size(); int lastElem = 0; for (int i = 0; i < size; i++) { TreeNode tmp = qu.poll(); lastElem = tmp.val; if (tmp.left != null) { qu.add(tmp.left); } if (tmp.right != null) qu.add(tmp.right); } System.out.print(lastElem + " "); } } }
2,808
0.587607
0.582977
136
19.647058
15.706654
57
false
false
0
0
0
0
0
0
2.580882
false
false
10
32f276621e9b535509725fa69b2f54317f4e9ded
26,637,387,204,873
4632fca3959ef9b2ab79b6316c477af3df142302
/src/main/java/com/gomspace/grid/dto/Orientation.java
e59269bbf04c21d4c20cd8f7f338f8aedd207f70
[]
no_license
subhamgupta26/grid-moves
https://github.com/subhamgupta26/grid-moves
e7f50880a608490133e5c12939d272a76d4b539f
071a905a8c317caf400ab558e8c595276160702e
refs/heads/master
2021-04-08T03:11:16.654000
2020-03-20T11:04:14
2020-03-20T11:04:14
248,733,872
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.gomspace.grid.dto; public enum Orientation { left,right,up,down; public Orientation getTurn(boolean clockwise) { if(this==left) { return clockwise?up:down; } if(this==up) { return clockwise? right: left; } if(this == right) { return clockwise ? down: up; } else { return clockwise? left:right; } } }
UTF-8
Java
346
java
Orientation.java
Java
[]
null
[]
package com.gomspace.grid.dto; public enum Orientation { left,right,up,down; public Orientation getTurn(boolean clockwise) { if(this==left) { return clockwise?up:down; } if(this==up) { return clockwise? right: left; } if(this == right) { return clockwise ? down: up; } else { return clockwise? left:right; } } }
346
0.647399
0.647399
20
16.299999
13.925158
48
false
false
0
0
0
0
0
0
2
false
false
10
cd6157ab82407ed5b4776e83216186b273b042ce
20,538,533,636,207
40954332ae573704ace00d269d02fffd2f244c8d
/jopen-core/src/main/java/io/jopen/core/common/time/DateHelper.java
7c7e9df70641f5c2948680a6e6337c8ed21c0a3e
[]
no_license
ubuntu-m/opensource
https://github.com/ubuntu-m/opensource
355c1a704234031133bcd66dfc0ddc9e05ed344e
7f43171728959429fd3cba3df162dbc582f78c8e
refs/heads/master
2020-08-15T01:09:14.911000
2020-03-29T11:43:34
2020-03-29T11:43:34
215,257,930
4
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package io.jopen.core.common.time; import java.util.Date; /** * @author maxuefeng * @see Date */ public class DateHelper { public static Date of() { return new Date(); } public static long mills() { return of().getTime(); } }
UTF-8
Java
265
java
DateHelper.java
Java
[ { "context": "mmon.time;\n\nimport java.util.Date;\n\n/**\n * @author maxuefeng\n * @see Date\n */\npublic class DateHelper {\n\n p", "end": 84, "score": 0.9892697930335999, "start": 75, "tag": "USERNAME", "value": "maxuefeng" } ]
null
[]
package io.jopen.core.common.time; import java.util.Date; /** * @author maxuefeng * @see Date */ public class DateHelper { public static Date of() { return new Date(); } public static long mills() { return of().getTime(); } }
265
0.588679
0.588679
18
13.722222
12.757593
34
false
false
0
0
0
0
0
0
0.222222
false
false
10
977da975f4fc428fedb931844852f15e681eb850
33,294,586,492,171
8ab06127644dc0469375cb91d318b4e8480249df
/schema/src/main/java/com/springer/api/schema/OrgAddress.java
213865f7f85a553403a58e603149e828c412abe3
[]
no_license
GordinMaxim/sprinder_loader
https://github.com/GordinMaxim/sprinder_loader
8a434612043fbe410720120eb9effb6af6b31bf2
41437324168d373ae34a19c0d0413319a0f5126d
refs/heads/master
2021-01-15T23:02:00.221000
2015-03-23T03:01:33
2015-03-23T03:01:33
32,708,118
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright 2010-2011 Nabeel Mukhtar * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.springer.api.schema; /** * <p>Java class for anonymous complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element ref="{}Postbox" minOccurs="0"/> * &lt;element ref="{}Street" minOccurs="0"/> * &lt;element ref="{}City"/> * &lt;element ref="{}Postcode"/> * &lt;element ref="{}State"/> * &lt;element ref="{}Country" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ public interface OrgAddress { /** * Gets the value of the postbox property. * * @return * possible object is * {@link String } * */ String getPostbox(); /** * Sets the value of the postbox property. * * @param value * allowed object is * {@link String } * */ void setPostbox(String value); /** * Gets the value of the street property. * * @return * possible object is * {@link String } * */ String getStreet(); /** * Sets the value of the street property. * * @param value * allowed object is * {@link String } * */ void setStreet(String value); /** * Gets the value of the city property. * * @return * possible object is * {@link String } * */ String getCity(); /** * Sets the value of the city property. * * @param value * allowed object is * {@link String } * */ void setCity(String value); /** * Gets the value of the postcode property. * * @return * possible object is * {@link String } * */ String getPostcode(); /** * Sets the value of the postcode property. * * @param value * allowed object is * {@link String } * */ void setPostcode(String value); /** * Gets the value of the state property. * * @return * possible object is * {@link String } * */ String getState(); /** * Sets the value of the state property. * * @param value * allowed object is * {@link String } * */ void setState(String value); /** * Gets the value of the country property. * * @return * possible object is * {@link String } * */ String getCountry(); /** * Sets the value of the country property. * * @param value * allowed object is * {@link String } * */ void setCountry(String value); }
UTF-8
Java
3,793
java
OrgAddress.java
Java
[ { "context": "/*\r\n * Copyright 2010-2011 Nabeel Mukhtar \r\n * \r\n * Licensed under the Apache License, Vers", "end": 41, "score": 0.9998705983161926, "start": 27, "tag": "NAME", "value": "Nabeel Mukhtar" } ]
null
[]
/* * Copyright 2010-2011 <NAME> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.springer.api.schema; /** * <p>Java class for anonymous complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element ref="{}Postbox" minOccurs="0"/> * &lt;element ref="{}Street" minOccurs="0"/> * &lt;element ref="{}City"/> * &lt;element ref="{}Postcode"/> * &lt;element ref="{}State"/> * &lt;element ref="{}Country" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ public interface OrgAddress { /** * Gets the value of the postbox property. * * @return * possible object is * {@link String } * */ String getPostbox(); /** * Sets the value of the postbox property. * * @param value * allowed object is * {@link String } * */ void setPostbox(String value); /** * Gets the value of the street property. * * @return * possible object is * {@link String } * */ String getStreet(); /** * Sets the value of the street property. * * @param value * allowed object is * {@link String } * */ void setStreet(String value); /** * Gets the value of the city property. * * @return * possible object is * {@link String } * */ String getCity(); /** * Sets the value of the city property. * * @param value * allowed object is * {@link String } * */ void setCity(String value); /** * Gets the value of the postcode property. * * @return * possible object is * {@link String } * */ String getPostcode(); /** * Sets the value of the postcode property. * * @param value * allowed object is * {@link String } * */ void setPostcode(String value); /** * Gets the value of the state property. * * @return * possible object is * {@link String } * */ String getState(); /** * Sets the value of the state property. * * @param value * allowed object is * {@link String } * */ void setState(String value); /** * Gets the value of the country property. * * @return * possible object is * {@link String } * */ String getCountry(); /** * Sets the value of the country property. * * @param value * allowed object is * {@link String } * */ void setCountry(String value); }
3,785
0.502505
0.497232
169
20.443787
18.677219
95
false
false
0
0
0
0
0
0
0.189349
false
false
10
7582fdea97d5ecb0e553832d09ce25181dfef8f3
28,664,611,789,333
ca6f69aa087bc2ba8604a2f802ffb5ff58fdab5d
/app/src/main/java/com/Solver/Solver/ModelClass/GroupMessage.java
d365633607f5b66f5b48dbeb78bfcca939a13f2b
[]
no_license
Shamim48/SolverTechnologyLtd-master
https://github.com/Shamim48/SolverTechnologyLtd-master
5d946aa15206508d14cca41068365f407dd7706e
1e2d0b083126ece1bf0e414c6bf8bc21cdf502f6
refs/heads/master
2022-06-20T04:29:07.065000
2019-12-05T15:26:37
2019-12-05T15:26:37
211,634,778
0
0
null
false
2022-06-02T21:21:22
2019-09-29T09:02:49
2019-12-05T15:26:51
2022-06-02T21:21:22
101,060
0
0
8
Java
false
false
package com.Solver.Solver.ModelClass; public class GroupMessage { private String name; private String sender; private String sub; private String message; private String time; private String date; private String tagClientName; private String sparePart; private String imageUri; private String msgType; private String msgKey; private String groupName; // reply variable private String name_reply; private String client_reply; private String job_reply; private String msg_reply; private String spearPart_reply; private String image_reply; private String imageType; //Location private double latitude; private double longitude; private String address; public GroupMessage() { } public GroupMessage(String name, String sender, String message, String time, String date, String msgType, String msgKey, String groupName, double latitude, double longitude, String address) { this.name = name; this.sender = sender; this.message = message; this.time = time; this.date = date; this.msgType = msgType; this.msgKey = msgKey; this.groupName = groupName; this.latitude = latitude; this.longitude = longitude; this.address = address; } public GroupMessage(String name, String msg, String sender, String time, String date, String imageUri, String msgType, String groupName) { this.name = name; this.sender = sender; this.time = time; this.date = date; this.imageUri = imageUri; this.msgType = msgType; this.groupName=groupName; this.message=msg; } public GroupMessage(String name,String msg, String sender, String time, String date, String imageUri, String msgType,String groupName,String imageType) { this.name = name; this.sender = sender; this.time = time; this.date = date; this.imageUri = imageUri; this.msgType = msgType; this.groupName=groupName; this.message=msg; this.imageType=imageType; } public GroupMessage(String name, String sender, String sub, String message, String time, String date, String tagClientName, String sparePart,String msgKey,String groupName,String msgType) { this.name = name; this.sender = sender; this.sub = sub; this.message = message; this.time = time; this.date = date; this.tagClientName = tagClientName; this.sparePart = sparePart; this.msgKey=msgKey; this.groupName=groupName; this.msgType=msgType; } public GroupMessage(String name, String sender, String sub, String message, String time, String date, String tagClientName, String sparePart, String msgType, String msgKey, String groupName, String name_reply, String client_reply, String job_reply, String msg_reply, String spearPart_reply) { this.name = name; this.sender = sender; this.sub = sub; this.message = message; this.time = time; this.date = date; this.tagClientName = tagClientName; this.sparePart = sparePart; this.msgType = msgType; this.msgKey = msgKey; this.groupName = groupName; this.name_reply = name_reply; this.client_reply = client_reply; this.job_reply = job_reply; this.msg_reply = msg_reply; this.spearPart_reply = spearPart_reply; } public GroupMessage(String name, String sender, String sub, String message, String time, String date, String tagClientName, String sparePart,String msgType, String msgKey, String groupName, String name_reply,String image_reply) { this.name = name; this.sender = sender; this.sub = sub; this.message = message; this.time = time; this.date = date; this.tagClientName = tagClientName; this.sparePart = sparePart; this.msgType = msgType; this.msgKey = msgKey; this.groupName = groupName; this.name_reply = name_reply; this.image_reply=image_reply; } public double getLatitude() { return latitude; } public void setLatitude(double latitude) { this.latitude = latitude; } public double getLongitude() { return longitude; } public void setLongitude(double longitude) { this.longitude = longitude; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getImageType() { return imageType; } public void setImageType(String imageType) { this.imageType = imageType; } public String getImage_reply() { return image_reply; } public void setImage_reply(String image_reply) { this.image_reply = image_reply; } public String getTagClientName() { return tagClientName; } public void setTagClientName(String tagClientName) { this.tagClientName = tagClientName; } public String getSparePart() { return sparePart; } public void setSparePart(String sparePart) { this.sparePart = sparePart; } public String getSender() { return sender; } public void setSender(String sender) { this.sender = sender; } public String getSub() { return sub; } public void setSub(String sub) { this.sub = sub; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public String getTime() { return time; } public void setTime(String time) { this.time = time; } public String getDate() { return date; } public void setDate(String date) { this.date = date; } public String getImageUri() { return imageUri; } public void setImageUri(String imageUri) { this.imageUri = imageUri; } public String getMsgType() { return msgType; } public void setMsgType(String imageType) { this.msgType = imageType; } public String getMsgKey() { return msgKey; } public void setMsgKey(String msgKey) { this.msgKey = msgKey; } public String getGroupName() { return groupName; } public void setGroupName(String groupName) { this.groupName = groupName; } public String getName_reply() { return name_reply; } public void setName_reply(String name_reply) { this.name_reply = name_reply; } public String getClient_reply() { return client_reply; } public void setClient_reply(String client_reply) { this.client_reply = client_reply; } public String getJob_reply() { return job_reply; } public void setJob_reply(String job_reply) { this.job_reply = job_reply; } public String getMsg_reply() { return msg_reply; } public void setMsg_reply(String msg_reply) { this.msg_reply = msg_reply; } public String getSpearPart_reply() { return spearPart_reply; } public void setSpearPart_reply(String spearPart_reply) { this.spearPart_reply = spearPart_reply; } }
UTF-8
Java
7,595
java
GroupMessage.java
Java
[ { "context": "ng groupName,String msgType) {\n this.name = name;\n this.sender = sender;\n this.sub =", "end": 2360, "score": 0.9895565509796143, "start": 2356, "tag": "NAME", "value": "name" }, { "context": " {\n this.name = name;\n this.sender = sender;\n this.sub = sub;\n this.message = m", "end": 2390, "score": 0.870247483253479, "start": 2384, "tag": "NAME", "value": "sender" }, { "context": "ply, String spearPart_reply) {\n this.name = name;\n this.sender = sender;\n this.sub =", "end": 3000, "score": 0.7885837554931641, "start": 2996, "tag": "NAME", "value": "name" }, { "context": "me_reply,String image_reply) {\n this.name = name;\n this.sender = sender;\n this.sub =", "end": 3783, "score": 0.625674307346344, "start": 3779, "tag": "NAME", "value": "name" } ]
null
[]
package com.Solver.Solver.ModelClass; public class GroupMessage { private String name; private String sender; private String sub; private String message; private String time; private String date; private String tagClientName; private String sparePart; private String imageUri; private String msgType; private String msgKey; private String groupName; // reply variable private String name_reply; private String client_reply; private String job_reply; private String msg_reply; private String spearPart_reply; private String image_reply; private String imageType; //Location private double latitude; private double longitude; private String address; public GroupMessage() { } public GroupMessage(String name, String sender, String message, String time, String date, String msgType, String msgKey, String groupName, double latitude, double longitude, String address) { this.name = name; this.sender = sender; this.message = message; this.time = time; this.date = date; this.msgType = msgType; this.msgKey = msgKey; this.groupName = groupName; this.latitude = latitude; this.longitude = longitude; this.address = address; } public GroupMessage(String name, String msg, String sender, String time, String date, String imageUri, String msgType, String groupName) { this.name = name; this.sender = sender; this.time = time; this.date = date; this.imageUri = imageUri; this.msgType = msgType; this.groupName=groupName; this.message=msg; } public GroupMessage(String name,String msg, String sender, String time, String date, String imageUri, String msgType,String groupName,String imageType) { this.name = name; this.sender = sender; this.time = time; this.date = date; this.imageUri = imageUri; this.msgType = msgType; this.groupName=groupName; this.message=msg; this.imageType=imageType; } public GroupMessage(String name, String sender, String sub, String message, String time, String date, String tagClientName, String sparePart,String msgKey,String groupName,String msgType) { this.name = name; this.sender = sender; this.sub = sub; this.message = message; this.time = time; this.date = date; this.tagClientName = tagClientName; this.sparePart = sparePart; this.msgKey=msgKey; this.groupName=groupName; this.msgType=msgType; } public GroupMessage(String name, String sender, String sub, String message, String time, String date, String tagClientName, String sparePart, String msgType, String msgKey, String groupName, String name_reply, String client_reply, String job_reply, String msg_reply, String spearPart_reply) { this.name = name; this.sender = sender; this.sub = sub; this.message = message; this.time = time; this.date = date; this.tagClientName = tagClientName; this.sparePart = sparePart; this.msgType = msgType; this.msgKey = msgKey; this.groupName = groupName; this.name_reply = name_reply; this.client_reply = client_reply; this.job_reply = job_reply; this.msg_reply = msg_reply; this.spearPart_reply = spearPart_reply; } public GroupMessage(String name, String sender, String sub, String message, String time, String date, String tagClientName, String sparePart,String msgType, String msgKey, String groupName, String name_reply,String image_reply) { this.name = name; this.sender = sender; this.sub = sub; this.message = message; this.time = time; this.date = date; this.tagClientName = tagClientName; this.sparePart = sparePart; this.msgType = msgType; this.msgKey = msgKey; this.groupName = groupName; this.name_reply = name_reply; this.image_reply=image_reply; } public double getLatitude() { return latitude; } public void setLatitude(double latitude) { this.latitude = latitude; } public double getLongitude() { return longitude; } public void setLongitude(double longitude) { this.longitude = longitude; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getImageType() { return imageType; } public void setImageType(String imageType) { this.imageType = imageType; } public String getImage_reply() { return image_reply; } public void setImage_reply(String image_reply) { this.image_reply = image_reply; } public String getTagClientName() { return tagClientName; } public void setTagClientName(String tagClientName) { this.tagClientName = tagClientName; } public String getSparePart() { return sparePart; } public void setSparePart(String sparePart) { this.sparePart = sparePart; } public String getSender() { return sender; } public void setSender(String sender) { this.sender = sender; } public String getSub() { return sub; } public void setSub(String sub) { this.sub = sub; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public String getTime() { return time; } public void setTime(String time) { this.time = time; } public String getDate() { return date; } public void setDate(String date) { this.date = date; } public String getImageUri() { return imageUri; } public void setImageUri(String imageUri) { this.imageUri = imageUri; } public String getMsgType() { return msgType; } public void setMsgType(String imageType) { this.msgType = imageType; } public String getMsgKey() { return msgKey; } public void setMsgKey(String msgKey) { this.msgKey = msgKey; } public String getGroupName() { return groupName; } public void setGroupName(String groupName) { this.groupName = groupName; } public String getName_reply() { return name_reply; } public void setName_reply(String name_reply) { this.name_reply = name_reply; } public String getClient_reply() { return client_reply; } public void setClient_reply(String client_reply) { this.client_reply = client_reply; } public String getJob_reply() { return job_reply; } public void setJob_reply(String job_reply) { this.job_reply = job_reply; } public String getMsg_reply() { return msg_reply; } public void setMsg_reply(String msg_reply) { this.msg_reply = msg_reply; } public String getSpearPart_reply() { return spearPart_reply; } public void setSpearPart_reply(String spearPart_reply) { this.spearPart_reply = spearPart_reply; } }
7,595
0.621988
0.621988
300
24.316668
30.634888
296
false
false
0
0
0
0
0
0
0.656667
false
false
10
6825093e3dc70cc5b68d69b5b9c1c37367db5adc
29,557,964,946,591
ead5a617b23c541865a6b57cf8cffcc1137352f2
/decompiled/sources/com/fasterxml/jackson/databind/deser/std/FactoryBasedEnumDeserializer.java
dbea556a1ec20a4c9bdfe5812424f63221ef2aad
[]
no_license
erred/uva-ssn
https://github.com/erred/uva-ssn
73a6392a096b38c092482113e322fdbf9c3c4c0e
4fb8ea447766a735289b96e2510f5a8d93345a8c
refs/heads/master
2022-02-26T20:52:50.515000
2019-10-14T12:30:33
2019-10-14T12:30:33
210,376,140
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.fasterxml.jackson.databind.deser.std; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonToken; import com.fasterxml.jackson.databind.BeanProperty; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.JsonDeserializer; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.deser.ContextualDeserializer; import com.fasterxml.jackson.databind.deser.SettableBeanProperty; import com.fasterxml.jackson.databind.deser.ValueInstantiator; import com.fasterxml.jackson.databind.deser.impl.PropertyBasedCreator; import com.fasterxml.jackson.databind.deser.impl.PropertyValueBuffer; import com.fasterxml.jackson.databind.introspect.AnnotatedMethod; import com.fasterxml.jackson.databind.jsontype.TypeDeserializer; import com.fasterxml.jackson.databind.util.ClassUtil; import java.io.IOException; import java.lang.reflect.InvocationTargetException; class FactoryBasedEnumDeserializer extends StdDeserializer<Object> implements ContextualDeserializer { private static final long serialVersionUID = 1; protected final SettableBeanProperty[] _creatorProps; protected final JsonDeserializer<?> _deser; protected final AnnotatedMethod _factory; protected final boolean _hasArgs; protected final JavaType _inputType; private transient PropertyBasedCreator _propCreator; protected final ValueInstantiator _valueInstantiator; public FactoryBasedEnumDeserializer(Class<?> cls, AnnotatedMethod annotatedMethod, JavaType javaType, ValueInstantiator valueInstantiator, SettableBeanProperty[] settableBeanPropertyArr) { super(cls); this._factory = annotatedMethod; this._hasArgs = true; if (javaType.hasRawClass(String.class)) { javaType = null; } this._inputType = javaType; this._deser = null; this._valueInstantiator = valueInstantiator; this._creatorProps = settableBeanPropertyArr; } public FactoryBasedEnumDeserializer(Class<?> cls, AnnotatedMethod annotatedMethod) { super(cls); this._factory = annotatedMethod; this._hasArgs = false; this._inputType = null; this._deser = null; this._valueInstantiator = null; this._creatorProps = null; } protected FactoryBasedEnumDeserializer(FactoryBasedEnumDeserializer factoryBasedEnumDeserializer, JsonDeserializer<?> jsonDeserializer) { super(factoryBasedEnumDeserializer._valueClass); this._inputType = factoryBasedEnumDeserializer._inputType; this._factory = factoryBasedEnumDeserializer._factory; this._hasArgs = factoryBasedEnumDeserializer._hasArgs; this._valueInstantiator = factoryBasedEnumDeserializer._valueInstantiator; this._creatorProps = factoryBasedEnumDeserializer._creatorProps; this._deser = jsonDeserializer; } public JsonDeserializer<?> createContextual(DeserializationContext deserializationContext, BeanProperty beanProperty) throws JsonMappingException { return (this._deser == null && this._inputType != null && this._creatorProps == null) ? new FactoryBasedEnumDeserializer(this, deserializationContext.findContextualValueDeserializer(this._inputType, beanProperty)) : this; } public Object deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException { Object obj; if (this._deser != null) { obj = this._deser.deserialize(jsonParser, deserializationContext); } else if (this._hasArgs) { JsonToken currentToken = jsonParser.getCurrentToken(); if (currentToken == JsonToken.VALUE_STRING || currentToken == JsonToken.FIELD_NAME) { obj = jsonParser.getText(); } else if (this._creatorProps == null || !jsonParser.isExpectedStartObjectToken()) { obj = jsonParser.getValueAsString(); } else { if (this._propCreator == null) { this._propCreator = PropertyBasedCreator.construct(deserializationContext, this._valueInstantiator, this._creatorProps); } jsonParser.nextToken(); return deserializeEnumUsingPropertyBased(jsonParser, deserializationContext, this._propCreator); } } else { jsonParser.skipChildren(); try { return this._factory.call(); } catch (Exception e) { return deserializationContext.handleInstantiationProblem(this._valueClass, null, ClassUtil.throwRootCauseIfIOE(e)); } } try { return this._factory.callOnWith(this._valueClass, obj); } catch (Exception e2) { Throwable throwRootCauseIfIOE = ClassUtil.throwRootCauseIfIOE(e2); if (!deserializationContext.isEnabled(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL) || !(throwRootCauseIfIOE instanceof IllegalArgumentException)) { return deserializationContext.handleInstantiationProblem(this._valueClass, obj, throwRootCauseIfIOE); } return null; } } public Object deserializeWithType(JsonParser jsonParser, DeserializationContext deserializationContext, TypeDeserializer typeDeserializer) throws IOException { if (this._deser == null) { return deserialize(jsonParser, deserializationContext); } return typeDeserializer.deserializeTypedFromAny(jsonParser, deserializationContext); } /* access modifiers changed from: protected */ public Object deserializeEnumUsingPropertyBased(JsonParser jsonParser, DeserializationContext deserializationContext, PropertyBasedCreator propertyBasedCreator) throws IOException { PropertyValueBuffer startBuilding = propertyBasedCreator.startBuilding(jsonParser, deserializationContext, null); JsonToken currentToken = jsonParser.getCurrentToken(); while (currentToken == JsonToken.FIELD_NAME) { String currentName = jsonParser.getCurrentName(); jsonParser.nextToken(); SettableBeanProperty findCreatorProperty = propertyBasedCreator.findCreatorProperty(currentName); if (findCreatorProperty != null) { startBuilding.assignParameter(findCreatorProperty, _deserializeWithErrorWrapping(jsonParser, deserializationContext, findCreatorProperty)); } else { boolean readIdProperty = startBuilding.readIdProperty(currentName); } currentToken = jsonParser.nextToken(); } return propertyBasedCreator.build(deserializationContext, startBuilding); } /* access modifiers changed from: protected */ public final Object _deserializeWithErrorWrapping(JsonParser jsonParser, DeserializationContext deserializationContext, SettableBeanProperty settableBeanProperty) throws IOException { try { return settableBeanProperty.deserialize(jsonParser, deserializationContext); } catch (Exception e) { wrapAndThrow(e, this._valueClass.getClass(), settableBeanProperty.getName(), deserializationContext); return null; } } public void wrapAndThrow(Throwable th, Object obj, String str, DeserializationContext deserializationContext) throws IOException { throw JsonMappingException.wrapWithPath(throwOrReturnThrowable(th, deserializationContext), obj, str); } private Throwable throwOrReturnThrowable(Throwable th, DeserializationContext deserializationContext) throws IOException { while ((th instanceof InvocationTargetException) && th.getCause() != null) { th = th.getCause(); } if (!(th instanceof Error)) { boolean z = deserializationContext == null || deserializationContext.isEnabled(DeserializationFeature.WRAP_EXCEPTIONS); if (th instanceof IOException) { if (!z || !(th instanceof JsonProcessingException)) { throw ((IOException) th); } } else if (!z && (th instanceof RuntimeException)) { throw ((RuntimeException) th); } return th; } throw ((Error) th); } }
UTF-8
Java
8,517
java
FactoryBasedEnumDeserializer.java
Java
[]
null
[]
package com.fasterxml.jackson.databind.deser.std; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonToken; import com.fasterxml.jackson.databind.BeanProperty; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.JsonDeserializer; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.deser.ContextualDeserializer; import com.fasterxml.jackson.databind.deser.SettableBeanProperty; import com.fasterxml.jackson.databind.deser.ValueInstantiator; import com.fasterxml.jackson.databind.deser.impl.PropertyBasedCreator; import com.fasterxml.jackson.databind.deser.impl.PropertyValueBuffer; import com.fasterxml.jackson.databind.introspect.AnnotatedMethod; import com.fasterxml.jackson.databind.jsontype.TypeDeserializer; import com.fasterxml.jackson.databind.util.ClassUtil; import java.io.IOException; import java.lang.reflect.InvocationTargetException; class FactoryBasedEnumDeserializer extends StdDeserializer<Object> implements ContextualDeserializer { private static final long serialVersionUID = 1; protected final SettableBeanProperty[] _creatorProps; protected final JsonDeserializer<?> _deser; protected final AnnotatedMethod _factory; protected final boolean _hasArgs; protected final JavaType _inputType; private transient PropertyBasedCreator _propCreator; protected final ValueInstantiator _valueInstantiator; public FactoryBasedEnumDeserializer(Class<?> cls, AnnotatedMethod annotatedMethod, JavaType javaType, ValueInstantiator valueInstantiator, SettableBeanProperty[] settableBeanPropertyArr) { super(cls); this._factory = annotatedMethod; this._hasArgs = true; if (javaType.hasRawClass(String.class)) { javaType = null; } this._inputType = javaType; this._deser = null; this._valueInstantiator = valueInstantiator; this._creatorProps = settableBeanPropertyArr; } public FactoryBasedEnumDeserializer(Class<?> cls, AnnotatedMethod annotatedMethod) { super(cls); this._factory = annotatedMethod; this._hasArgs = false; this._inputType = null; this._deser = null; this._valueInstantiator = null; this._creatorProps = null; } protected FactoryBasedEnumDeserializer(FactoryBasedEnumDeserializer factoryBasedEnumDeserializer, JsonDeserializer<?> jsonDeserializer) { super(factoryBasedEnumDeserializer._valueClass); this._inputType = factoryBasedEnumDeserializer._inputType; this._factory = factoryBasedEnumDeserializer._factory; this._hasArgs = factoryBasedEnumDeserializer._hasArgs; this._valueInstantiator = factoryBasedEnumDeserializer._valueInstantiator; this._creatorProps = factoryBasedEnumDeserializer._creatorProps; this._deser = jsonDeserializer; } public JsonDeserializer<?> createContextual(DeserializationContext deserializationContext, BeanProperty beanProperty) throws JsonMappingException { return (this._deser == null && this._inputType != null && this._creatorProps == null) ? new FactoryBasedEnumDeserializer(this, deserializationContext.findContextualValueDeserializer(this._inputType, beanProperty)) : this; } public Object deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException { Object obj; if (this._deser != null) { obj = this._deser.deserialize(jsonParser, deserializationContext); } else if (this._hasArgs) { JsonToken currentToken = jsonParser.getCurrentToken(); if (currentToken == JsonToken.VALUE_STRING || currentToken == JsonToken.FIELD_NAME) { obj = jsonParser.getText(); } else if (this._creatorProps == null || !jsonParser.isExpectedStartObjectToken()) { obj = jsonParser.getValueAsString(); } else { if (this._propCreator == null) { this._propCreator = PropertyBasedCreator.construct(deserializationContext, this._valueInstantiator, this._creatorProps); } jsonParser.nextToken(); return deserializeEnumUsingPropertyBased(jsonParser, deserializationContext, this._propCreator); } } else { jsonParser.skipChildren(); try { return this._factory.call(); } catch (Exception e) { return deserializationContext.handleInstantiationProblem(this._valueClass, null, ClassUtil.throwRootCauseIfIOE(e)); } } try { return this._factory.callOnWith(this._valueClass, obj); } catch (Exception e2) { Throwable throwRootCauseIfIOE = ClassUtil.throwRootCauseIfIOE(e2); if (!deserializationContext.isEnabled(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL) || !(throwRootCauseIfIOE instanceof IllegalArgumentException)) { return deserializationContext.handleInstantiationProblem(this._valueClass, obj, throwRootCauseIfIOE); } return null; } } public Object deserializeWithType(JsonParser jsonParser, DeserializationContext deserializationContext, TypeDeserializer typeDeserializer) throws IOException { if (this._deser == null) { return deserialize(jsonParser, deserializationContext); } return typeDeserializer.deserializeTypedFromAny(jsonParser, deserializationContext); } /* access modifiers changed from: protected */ public Object deserializeEnumUsingPropertyBased(JsonParser jsonParser, DeserializationContext deserializationContext, PropertyBasedCreator propertyBasedCreator) throws IOException { PropertyValueBuffer startBuilding = propertyBasedCreator.startBuilding(jsonParser, deserializationContext, null); JsonToken currentToken = jsonParser.getCurrentToken(); while (currentToken == JsonToken.FIELD_NAME) { String currentName = jsonParser.getCurrentName(); jsonParser.nextToken(); SettableBeanProperty findCreatorProperty = propertyBasedCreator.findCreatorProperty(currentName); if (findCreatorProperty != null) { startBuilding.assignParameter(findCreatorProperty, _deserializeWithErrorWrapping(jsonParser, deserializationContext, findCreatorProperty)); } else { boolean readIdProperty = startBuilding.readIdProperty(currentName); } currentToken = jsonParser.nextToken(); } return propertyBasedCreator.build(deserializationContext, startBuilding); } /* access modifiers changed from: protected */ public final Object _deserializeWithErrorWrapping(JsonParser jsonParser, DeserializationContext deserializationContext, SettableBeanProperty settableBeanProperty) throws IOException { try { return settableBeanProperty.deserialize(jsonParser, deserializationContext); } catch (Exception e) { wrapAndThrow(e, this._valueClass.getClass(), settableBeanProperty.getName(), deserializationContext); return null; } } public void wrapAndThrow(Throwable th, Object obj, String str, DeserializationContext deserializationContext) throws IOException { throw JsonMappingException.wrapWithPath(throwOrReturnThrowable(th, deserializationContext), obj, str); } private Throwable throwOrReturnThrowable(Throwable th, DeserializationContext deserializationContext) throws IOException { while ((th instanceof InvocationTargetException) && th.getCause() != null) { th = th.getCause(); } if (!(th instanceof Error)) { boolean z = deserializationContext == null || deserializationContext.isEnabled(DeserializationFeature.WRAP_EXCEPTIONS); if (th instanceof IOException) { if (!z || !(th instanceof JsonProcessingException)) { throw ((IOException) th); } } else if (!z && (th instanceof RuntimeException)) { throw ((RuntimeException) th); } return th; } throw ((Error) th); } }
8,517
0.712692
0.71234
162
51.574074
44.900135
229
false
false
0
0
0
0
0
0
0.876543
false
false
10
17b89eee53eddd82fc9e93a04f39fb0cc9bfd6e6
16,698,832,888,446
4911fdcdb1221c9682008e8bf4935a6c26879e6c
/app/src/main/java/com/hunegroup/hune/dev/ui/fragment/home/AccountFragment.java
35b1b9f4883a5c30f170d454a3b9096c4cb2e709
[]
no_license
51100480/Hune_New_New_Android
https://github.com/51100480/Hune_New_New_Android
8d3731992c46ef7f663c0175b4c55a098f087332
681d3b07b07bb696ae2f18d79dd0a2abb2dce3b3
refs/heads/master
2020-07-07T12:56:58.758000
2020-07-07T09:56:03
2020-07-07T09:56:03
203,351,825
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.hunegroup.hune.dev.ui.fragment.home; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.view.View; import androidx.appcompat.app.AppCompatActivity; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.LinearLayoutManager; import com.bumptech.glide.Glide; import com.hunegroup.hune.dev.BuildConfig; import com.hunegroup.hune.dev.R; import com.hunegroup.hune.dev.adapter.MenuAccountAdapter; import com.hunegroup.hune.dev.base.BaseSightFragment; import com.hunegroup.hune.dev.base.BaseViewModel; import com.hunegroup.hune.dev.databinding.FragmentAccountBinding; import com.hunegroup.hune.dev.interfaces.ConfirmListener; import com.hunegroup.hune.dev.model.network.MenuModel; import com.hunegroup.hune.dev.other.constant.AppConstant; import com.hunegroup.hune.dev.ui.activity.home.HomeActivity; import com.hunegroup.hune.dev.ui.fragment.editprofile.EditProfileFragment; import com.hunegroup.hune.dev.ui.fragment.term.TearmFragment; import com.hunegroup.hune.dev.utils.AppUtils; import com.hunegroup.hune.dev.utils.DialogUtils; import java.util.ArrayList; import java.util.HashMap; import io.realm.Realm; public class AccountFragment extends BaseSightFragment<FragmentAccountBinding, BaseViewModel> { private static final int TAB_HOME = 0; public static AccountFragment newInstance() { Bundle args = new Bundle(); AccountFragment fragment = new AccountFragment(); fragment.setArguments(args); return fragment; } private MenuAccountAdapter menuAccountAdapter; private ArrayList<MenuModel> data = new ArrayList<>(); @Override public int layout() { return R.layout.fragment_account; } @Override public void init() { super.init(); menuAccountAdapter = new MenuAccountAdapter(data, R.layout.item_menu_account); // data.add(new MenuModel("Thay đổi ngôn ngữ", 0, "")); data.add(new MenuModel(getString(R.string.get_notifications), 0, "")); data.add(new MenuModel(getString(R.string.policy_terms), 0, "")); data.add(new MenuModel(getString(R.string.app_reviews), 0, "")); data.add(new MenuModel(getString(R.string.share_the_application), 0, "")); data.add(new MenuModel(getString(R.string.log_out), 0, "")); mBinding.rvMenuAccount.setLayoutManager(new LinearLayoutManager(getContext())); mBinding.rvMenuAccount.setBaseAdapter(menuAccountAdapter); updateHeader(); } private void updateHeader() { mBinding.tvStoreName.setText(getUser().getFullName()); mBinding.tvGender.setText(getUser().getGender()); mBinding.tvYearOfBirth.setText(AppUtils.formatDate("", getUser().getBirthDay())); mBinding.tvNumberPhone1.setText(getUser().getPhone()); Glide.with(getContext()) .load(getUser().getAvartar()) .circleCrop() .placeholder(R.drawable.ic_avatar) .into(mBinding.ivAvatar); } @Override public void bindEvent() { super.bindEvent(); mBinding.tvEditProfile.setOnClickListener(view -> { addFragment(EditProfileFragment.newInstance(), true); }); menuAccountAdapter.setListener(position -> { if (data.get(position).getTitle().equals(getString(R.string.policy_terms))) { addFragment(TearmFragment.newInstance(), true); } else if (data.get(position).getTitle().equals(getString(R.string.app_reviews))) { openAppInStore(); } else if (data.get(position).getTitle().equals(getString(R.string.share_the_application))) { AppUtils.shareLink((AppCompatActivity) getActivity(), AppConstant.LINK_APP_STORE); } else if (data.get(position).getTitle().equals(getString(R.string.get_notifications))) { } else if (data.get(position).getTitle().equals(getString(R.string.log_out))) { logOut(); } }); } private void logOut() { DialogUtils.showDialogConfirm(getContext(), getString(R.string.notification), getString(R.string.confirm_logout), new ConfirmListener() { @Override public void cancel() { } @Override public void agree(Object data) { HomeFragment item = (HomeFragment) ((HomeActivity) getActivity()).viewPagerAdapter.getItem(TAB_HOME); Realm.getDefaultInstance().executeTransaction(realm -> realm.deleteAll()); item.logOut(); } }); } private void openAppInStore() { String appPackageName = BuildConfig.APPLICATION_ID; // getPackageName() from Context or Activity object try { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName))); } catch (android.content.ActivityNotFoundException anfe) { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + appPackageName))); } } @Override public void loadControl(View view) { mBinding.tvVersion.setText(String.format("Version : %s", BuildConfig.VERSION_NAME)); } @Override public void getData() { } @Override public void showViewError() { } @Override public void onEventReceive(HashMap<String, Object> event) { super.onEventReceive(event); if (event.get(AppConstant.UPDATE_PROFILE) != null) { updateHeader(); } } }
UTF-8
Java
5,609
java
AccountFragment.java
Java
[]
null
[]
package com.hunegroup.hune.dev.ui.fragment.home; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.view.View; import androidx.appcompat.app.AppCompatActivity; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.LinearLayoutManager; import com.bumptech.glide.Glide; import com.hunegroup.hune.dev.BuildConfig; import com.hunegroup.hune.dev.R; import com.hunegroup.hune.dev.adapter.MenuAccountAdapter; import com.hunegroup.hune.dev.base.BaseSightFragment; import com.hunegroup.hune.dev.base.BaseViewModel; import com.hunegroup.hune.dev.databinding.FragmentAccountBinding; import com.hunegroup.hune.dev.interfaces.ConfirmListener; import com.hunegroup.hune.dev.model.network.MenuModel; import com.hunegroup.hune.dev.other.constant.AppConstant; import com.hunegroup.hune.dev.ui.activity.home.HomeActivity; import com.hunegroup.hune.dev.ui.fragment.editprofile.EditProfileFragment; import com.hunegroup.hune.dev.ui.fragment.term.TearmFragment; import com.hunegroup.hune.dev.utils.AppUtils; import com.hunegroup.hune.dev.utils.DialogUtils; import java.util.ArrayList; import java.util.HashMap; import io.realm.Realm; public class AccountFragment extends BaseSightFragment<FragmentAccountBinding, BaseViewModel> { private static final int TAB_HOME = 0; public static AccountFragment newInstance() { Bundle args = new Bundle(); AccountFragment fragment = new AccountFragment(); fragment.setArguments(args); return fragment; } private MenuAccountAdapter menuAccountAdapter; private ArrayList<MenuModel> data = new ArrayList<>(); @Override public int layout() { return R.layout.fragment_account; } @Override public void init() { super.init(); menuAccountAdapter = new MenuAccountAdapter(data, R.layout.item_menu_account); // data.add(new MenuModel("Thay đổi ngôn ngữ", 0, "")); data.add(new MenuModel(getString(R.string.get_notifications), 0, "")); data.add(new MenuModel(getString(R.string.policy_terms), 0, "")); data.add(new MenuModel(getString(R.string.app_reviews), 0, "")); data.add(new MenuModel(getString(R.string.share_the_application), 0, "")); data.add(new MenuModel(getString(R.string.log_out), 0, "")); mBinding.rvMenuAccount.setLayoutManager(new LinearLayoutManager(getContext())); mBinding.rvMenuAccount.setBaseAdapter(menuAccountAdapter); updateHeader(); } private void updateHeader() { mBinding.tvStoreName.setText(getUser().getFullName()); mBinding.tvGender.setText(getUser().getGender()); mBinding.tvYearOfBirth.setText(AppUtils.formatDate("", getUser().getBirthDay())); mBinding.tvNumberPhone1.setText(getUser().getPhone()); Glide.with(getContext()) .load(getUser().getAvartar()) .circleCrop() .placeholder(R.drawable.ic_avatar) .into(mBinding.ivAvatar); } @Override public void bindEvent() { super.bindEvent(); mBinding.tvEditProfile.setOnClickListener(view -> { addFragment(EditProfileFragment.newInstance(), true); }); menuAccountAdapter.setListener(position -> { if (data.get(position).getTitle().equals(getString(R.string.policy_terms))) { addFragment(TearmFragment.newInstance(), true); } else if (data.get(position).getTitle().equals(getString(R.string.app_reviews))) { openAppInStore(); } else if (data.get(position).getTitle().equals(getString(R.string.share_the_application))) { AppUtils.shareLink((AppCompatActivity) getActivity(), AppConstant.LINK_APP_STORE); } else if (data.get(position).getTitle().equals(getString(R.string.get_notifications))) { } else if (data.get(position).getTitle().equals(getString(R.string.log_out))) { logOut(); } }); } private void logOut() { DialogUtils.showDialogConfirm(getContext(), getString(R.string.notification), getString(R.string.confirm_logout), new ConfirmListener() { @Override public void cancel() { } @Override public void agree(Object data) { HomeFragment item = (HomeFragment) ((HomeActivity) getActivity()).viewPagerAdapter.getItem(TAB_HOME); Realm.getDefaultInstance().executeTransaction(realm -> realm.deleteAll()); item.logOut(); } }); } private void openAppInStore() { String appPackageName = BuildConfig.APPLICATION_ID; // getPackageName() from Context or Activity object try { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName))); } catch (android.content.ActivityNotFoundException anfe) { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + appPackageName))); } } @Override public void loadControl(View view) { mBinding.tvVersion.setText(String.format("Version : %s", BuildConfig.VERSION_NAME)); } @Override public void getData() { } @Override public void showViewError() { } @Override public void onEventReceive(HashMap<String, Object> event) { super.onEventReceive(event); if (event.get(AppConstant.UPDATE_PROFILE) != null) { updateHeader(); } } }
5,609
0.671248
0.66982
150
36.353333
32.823189
145
false
false
0
0
0
0
0
0
0.62
false
false
10
507c5068e4c77d28f9faba18c32fc0ec33ba91b5
19,258,633,379,247
d7b280f1ff62c22682e0cddfb5fb648544d4849a
/src/Test.java
693b6524fd35a273babf1024f471dbbb6925215c
[]
no_license
macariruslanp/GitPractice
https://github.com/macariruslanp/GitPractice
bb93ee0c9185151b99e3f9718ec6b106b4f23867
798f962efa903a6f7b9106fcf4ead27bd352843a
refs/heads/master
2020-04-25T04:01:39.737000
2019-02-26T13:50:52
2019-02-26T13:50:52
172,496,823
0
0
null
false
2019-02-26T13:51:10
2019-02-25T11:53:43
2019-02-26T08:48:27
2019-02-26T13:51:10
2
0
0
0
Java
false
null
public class Test { public static void main(String[] args) { if(args.length > 0 && args[0].equals("Test")) { System.out.println("Test"); System.exit(0); } System.out.println("Hello Git"); System.out.println("new line"); test(); newFeature(); } public static void test() { System.out.println("test"); System.out.println("test2"); } public static void newFeature() { System.out.println("new feature"); System.out.println("..."); System.out.println("new from master"); System.out.println("new from testing"); System.out.println("new from master2"); System.out.println("new from testing2"); } }
UTF-8
Java
637
java
Test.java
Java
[]
null
[]
public class Test { public static void main(String[] args) { if(args.length > 0 && args[0].equals("Test")) { System.out.println("Test"); System.exit(0); } System.out.println("Hello Git"); System.out.println("new line"); test(); newFeature(); } public static void test() { System.out.println("test"); System.out.println("test2"); } public static void newFeature() { System.out.println("new feature"); System.out.println("..."); System.out.println("new from master"); System.out.println("new from testing"); System.out.println("new from master2"); System.out.println("new from testing2"); } }
637
0.649922
0.640502
26
23.461538
15.814382
49
false
false
0
0
0
0
0
0
2.192308
false
false
10
da7586d0e560dfb0e8aebc9658622c9001011e36
19,258,633,381,797
c002053e57918ba53b6c6c2ad25b929f5c02f5ed
/src/main/java/com/creativa/entities/Pais.java
ce6a447c726b0e3d8df5fcee2621a00d618fad0b
[]
no_license
kevinramirez7/usuario
https://github.com/kevinramirez7/usuario
8550b6e79964d85362543936b2b56a3c221e8418
0ebe716b49c335e52adc615efa43c80f5bcf18b7
refs/heads/master
2020-06-08T20:26:41.505000
2019-06-25T22:43:58
2019-06-25T22:43:58
193,300,977
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.creativa.entities; import java.util.Set; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; import org.hibernate.annotations.GenericGenerator; @Entity @Table(name = "pais") public class Pais { @Id @GeneratedValue(strategy = GenerationType.AUTO, generator = "native") @GenericGenerator(name = "native", strategy = "native") @Column(name = "Id") private int id; @Column(name ="Nombre") private String nombre; @OneToMany(mappedBy="pais") private Set<Ciudad> cuidad; //constructor public Pais() { } //getters & setters public int getId() { return id; } public void setId(int id) { this.id = id; } public String getNombre() { return nombre; } public void setNombre(String nombre) { this.nombre = nombre; } public Set<Ciudad> getCuidad() { return cuidad; } public void setCuidad(Set<Ciudad> cuidad) { this.cuidad = cuidad; } }
UTF-8
Java
1,088
java
Pais.java
Java
[]
null
[]
package com.creativa.entities; import java.util.Set; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; import org.hibernate.annotations.GenericGenerator; @Entity @Table(name = "pais") public class Pais { @Id @GeneratedValue(strategy = GenerationType.AUTO, generator = "native") @GenericGenerator(name = "native", strategy = "native") @Column(name = "Id") private int id; @Column(name ="Nombre") private String nombre; @OneToMany(mappedBy="pais") private Set<Ciudad> cuidad; //constructor public Pais() { } //getters & setters public int getId() { return id; } public void setId(int id) { this.id = id; } public String getNombre() { return nombre; } public void setNombre(String nombre) { this.nombre = nombre; } public Set<Ciudad> getCuidad() { return cuidad; } public void setCuidad(Set<Ciudad> cuidad) { this.cuidad = cuidad; } }
1,088
0.71875
0.71875
59
17.440678
16.372021
70
false
false
0
0
0
0
0
0
1.084746
false
false
10
91a503d0d06c5540b8be1ee1330db005a6ef2e27
1,614,907,746,557
6f672fb72caedccb841ee23f53e32aceeaf1895e
/Music-Audio/shazam_source/src/com/google/a/g/a/i$4.java
36a1daab03109d92c571bea337682311901ead84
[]
no_license
cha63506/CompSecurity
https://github.com/cha63506/CompSecurity
5c69743f660b9899146ed3cf21eceabe3d5f4280
eee7e74f4088b9c02dd711c061fc04fb1e4e2654
refs/heads/master
2018-03-23T04:15:18.480000
2015-12-19T01:29:58
2015-12-19T01:29:58
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.geocities.com/kpdus/jad.html // Decompiler options: braces fieldsfirst space lnc package com.google.a.g.a; import com.google.a.a.c; import java.lang.reflect.Constructor; import java.util.Arrays; import java.util.List; // Referenced classes of package com.google.a.g.a: // i static final class structor implements c { public final Object a(Object obj) { return Boolean.valueOf(Arrays.asList(((Constructor)obj).getParameterTypes()).contains(java/lang/String)); } structor() { } }
UTF-8
Java
624
java
i$4.java
Java
[ { "context": "// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.\n// Jad home page: http://www.geocities.com/kpdus", "end": 61, "score": 0.9996878504753113, "start": 45, "tag": "NAME", "value": "Pavel Kouznetsov" } ]
null
[]
// Decompiled by Jad v1.5.8e. Copyright 2001 <NAME>. // Jad home page: http://www.geocities.com/kpdus/jad.html // Decompiler options: braces fieldsfirst space lnc package com.google.a.g.a; import com.google.a.a.c; import java.lang.reflect.Constructor; import java.util.Arrays; import java.util.List; // Referenced classes of package com.google.a.g.a: // i static final class structor implements c { public final Object a(Object obj) { return Boolean.valueOf(Arrays.asList(((Constructor)obj).getParameterTypes()).contains(java/lang/String)); } structor() { } }
614
0.69391
0.682692
27
22.111111
26.085804
113
false
false
0
0
0
0
0
0
0.222222
false
false
10
5017b0e8c4f82bf5faad6a637fa7270aeb147bf4
22,625,887,745,908
1ddc1bdb6d5738818d469d4378350069413a4e9a
/src/main/java/GoodGenerator/Blocks/TEs/MetalVaporTurbine.java
0ae306fe8b74674715fcd6f958d3c31cf01d3f49
[ "MIT" ]
permissive
PolkageistHS/GoodGenerator
https://github.com/PolkageistHS/GoodGenerator
96914ff05b0b49655679ca2ee039321ffd119f49
938884d89ca45e1ad851fa817fc4d2432b3f0f00
refs/heads/main
2023-08-26T22:12:48.969000
2021-10-31T10:49:00
2021-10-31T10:49:00
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package GoodGenerator.Blocks.TEs; public class MetalVaporTurbine{ }
UTF-8
Java
70
java
MetalVaporTurbine.java
Java
[]
null
[]
package GoodGenerator.Blocks.TEs; public class MetalVaporTurbine{ }
70
0.814286
0.814286
5
13
15.530615
33
false
false
0
0
0
0
0
0
0.2
false
false
10
9dac571bfe19ca9656c3df865ebb098efaef68e7
22,574,348,120,227
10378c580b62125a184f74f595d2c37be90a5769
/org/apache/commons/collections4/list/TransformedList.java
629e58459d9bdf5338f821299915ee6c762f6a9a
[]
no_license
ClientPlayground/Melon-Client
https://github.com/ClientPlayground/Melon-Client
4299d7f3e8f2446ae9f225c0d7fcc770d4d48ecb
afc9b11493e15745b78dec1c2b62bb9e01573c3d
refs/heads/beta-v2
2023-04-05T20:17:00.521000
2021-03-14T19:13:31
2021-03-14T19:13:31
347,509,882
33
19
null
false
2021-03-14T19:13:32
2021-03-14T00:27:40
2021-03-14T16:36:27
2021-03-14T19:13:31
4
2
1
0
null
false
false
package org.apache.commons.collections4.list; import java.util.Collection; import java.util.List; import java.util.ListIterator; import org.apache.commons.collections4.Transformer; import org.apache.commons.collections4.collection.TransformedCollection; import org.apache.commons.collections4.iterators.AbstractListIteratorDecorator; public class TransformedList<E> extends TransformedCollection<E> implements List<E> { private static final long serialVersionUID = 1077193035000013141L; public static <E> TransformedList<E> transformingList(List<E> list, Transformer<? super E, ? extends E> transformer) { return new TransformedList<E>(list, transformer); } public static <E> TransformedList<E> transformedList(List<E> list, Transformer<? super E, ? extends E> transformer) { TransformedList<E> decorated = new TransformedList<E>(list, transformer); if (transformer != null && list != null && list.size() > 0) { E[] values = (E[])list.toArray(); list.clear(); for (E value : values) decorated.decorated().add(transformer.transform(value)); } return decorated; } protected TransformedList(List<E> list, Transformer<? super E, ? extends E> transformer) { super(list, transformer); } protected List<E> getList() { return (List<E>)decorated(); } public E get(int index) { return getList().get(index); } public int indexOf(Object object) { return getList().indexOf(object); } public int lastIndexOf(Object object) { return getList().lastIndexOf(object); } public E remove(int index) { return getList().remove(index); } public void add(int index, E object) { object = (E)transform(object); getList().add(index, object); } public boolean addAll(int index, Collection<? extends E> coll) { coll = transform(coll); return getList().addAll(index, coll); } public ListIterator<E> listIterator() { return listIterator(0); } public ListIterator<E> listIterator(int i) { return (ListIterator<E>)new TransformedListIterator(getList().listIterator(i)); } public E set(int index, E object) { object = (E)transform(object); return getList().set(index, object); } public List<E> subList(int fromIndex, int toIndex) { List<E> sub = getList().subList(fromIndex, toIndex); return new TransformedList(sub, this.transformer); } protected class TransformedListIterator extends AbstractListIteratorDecorator<E> { protected TransformedListIterator(ListIterator<E> iterator) { super(iterator); } public void add(E object) { object = (E)TransformedList.this.transform(object); getListIterator().add(object); } public void set(E object) { object = (E)TransformedList.this.transform(object); getListIterator().set(object); } } }
UTF-8
Java
2,882
java
TransformedList.java
Java
[]
null
[]
package org.apache.commons.collections4.list; import java.util.Collection; import java.util.List; import java.util.ListIterator; import org.apache.commons.collections4.Transformer; import org.apache.commons.collections4.collection.TransformedCollection; import org.apache.commons.collections4.iterators.AbstractListIteratorDecorator; public class TransformedList<E> extends TransformedCollection<E> implements List<E> { private static final long serialVersionUID = 1077193035000013141L; public static <E> TransformedList<E> transformingList(List<E> list, Transformer<? super E, ? extends E> transformer) { return new TransformedList<E>(list, transformer); } public static <E> TransformedList<E> transformedList(List<E> list, Transformer<? super E, ? extends E> transformer) { TransformedList<E> decorated = new TransformedList<E>(list, transformer); if (transformer != null && list != null && list.size() > 0) { E[] values = (E[])list.toArray(); list.clear(); for (E value : values) decorated.decorated().add(transformer.transform(value)); } return decorated; } protected TransformedList(List<E> list, Transformer<? super E, ? extends E> transformer) { super(list, transformer); } protected List<E> getList() { return (List<E>)decorated(); } public E get(int index) { return getList().get(index); } public int indexOf(Object object) { return getList().indexOf(object); } public int lastIndexOf(Object object) { return getList().lastIndexOf(object); } public E remove(int index) { return getList().remove(index); } public void add(int index, E object) { object = (E)transform(object); getList().add(index, object); } public boolean addAll(int index, Collection<? extends E> coll) { coll = transform(coll); return getList().addAll(index, coll); } public ListIterator<E> listIterator() { return listIterator(0); } public ListIterator<E> listIterator(int i) { return (ListIterator<E>)new TransformedListIterator(getList().listIterator(i)); } public E set(int index, E object) { object = (E)transform(object); return getList().set(index, object); } public List<E> subList(int fromIndex, int toIndex) { List<E> sub = getList().subList(fromIndex, toIndex); return new TransformedList(sub, this.transformer); } protected class TransformedListIterator extends AbstractListIteratorDecorator<E> { protected TransformedListIterator(ListIterator<E> iterator) { super(iterator); } public void add(E object) { object = (E)TransformedList.this.transform(object); getListIterator().add(object); } public void set(E object) { object = (E)TransformedList.this.transform(object); getListIterator().set(object); } } }
2,882
0.688064
0.679389
95
29.336842
28.407787
120
false
false
0
0
0
0
0
0
0.557895
false
false
10
53e9e27729d2b7e22d9c6a115ba431f55d3f1e6d
23,837,068,503,796
3cb0617fc51a55118052793f261fd959e8781f2d
/src/main/java/sonar/fluxnetworks/api/device/IFluxPoint.java
eda6ca9ead0a96c1c0373119d14ac251e479beb4
[ "CC-BY-NC-SA-4.0", "MIT" ]
permissive
SonarSonic/Flux-Networks
https://github.com/SonarSonic/Flux-Networks
9ff4246faef70b10d8980083baf388379ae7708a
58add706e1ce49d53afe3eaef36e7d7cfe463c1b
refs/heads/1.18
2023-08-25T03:08:14.258000
2023-08-20T15:16:59
2023-08-20T15:16:59
64,226,421
115
90
MIT
false
2023-03-07T04:14:36
2016-07-26T14:09:03
2023-02-28T21:27:42
2023-03-07T04:14:35
18,290
78
45
38
Java
false
false
package sonar.fluxnetworks.api.device; public interface IFluxPoint extends IFluxDevice { }
UTF-8
Java
92
java
IFluxPoint.java
Java
[]
null
[]
package sonar.fluxnetworks.api.device; public interface IFluxPoint extends IFluxDevice { }
92
0.826087
0.826087
4
22
21.851774
49
false
false
0
0
0
0
0
0
0.25
false
false
10
b322b9708491add40890815f12c1f048cac2d2b9
1,090,921,710,784
b6341977a20dbc42f62146c297df4ad99a5a1704
/test/DsjTester.java
86783748d17570ff93517c94a8cbdfcad0ed6366
[ "LicenseRef-scancode-mediainfo-lib" ]
permissive
mlaflamm/yamb
https://github.com/mlaflamm/yamb
7c92365bd1ba61b1e7272c8393ee98a67839f3f6
0450c8f66de3ad2910c3ff6f7c99f44457affc6a
refs/heads/master
2020-05-17T03:21:21.744000
2011-07-16T00:10:03
2011-07-16T00:26:51
1,627,275
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import com.sun.image.codec.jpeg.JPEGCodec; import com.sun.image.codec.jpeg.JPEGEncodeParam; import com.sun.image.codec.jpeg.JPEGImageEncoder; import de.humatic.dsj.DSFiltergraph; import java.awt.Graphics; import java.awt.Image; import java.awt.image.BufferedImage; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; class DsjTester implements PropertyChangeListener { public void getScreenshots(String filePath) { File f = new File(filePath); DSFiltergraph movie = DSFiltergraph.createDSFiltergraph(f.getAbsolutePath(), DSFiltergraph.RENDER_NATIVE, this); movie.pause(); int timing = 10000; int nb_screenshots = movie.getDuration() / timing; for (int i = 1; i < nb_screenshots; i++) { movie.setTimeValue(i * timing); try { BufferedImage src_image = movie.getImage(); saveImage(src_image, f.getAbsolutePath() + "." + i + ".jpg"); } catch (de.humatic.dsj.DSJException e) { System.err.println("Screenshot error at " + (i * timing) + " [" + e + "]"); } } movie.dispose(); } public BufferedImage getBufferedImage(Image __image, int __type_image) { BufferedImage buffered_image = new BufferedImage(__image.getWidth(null), __image.getHeight(null), __type_image); Graphics g = buffered_image.createGraphics(); g.drawImage(__image, 0, 0, null); g.dispose(); __image.flush(); __image = null; return (buffered_image); } public void saveImage(Image __image, String __filename) { BufferedImage buff = getBufferedImage(__image, BufferedImage.TYPE_INT_RGB); try { BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(__filename)); JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out); JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(buff); param.setQuality((float) 75 / 100.0f, false); encoder.setJPEGEncodeParam(param); encoder.encode(buff); out.flush(); out = null; } catch (java.io.IOException e) { System.err.println("Error while saving image : " + e); e.printStackTrace(); } } public void propertyChange(PropertyChangeEvent pe) { } public static void main(String __args[]) { // DSEnvironment.setSetupPath("C:/Program Files/Java/jre1.6.0_02/lib/ext/x86/dsj.xml"); DsjTester t = new DsjTester(); t.getScreenshots(__args[0]); } }
UTF-8
Java
3,159
java
DsjTester.java
Java
[]
null
[]
import com.sun.image.codec.jpeg.JPEGCodec; import com.sun.image.codec.jpeg.JPEGEncodeParam; import com.sun.image.codec.jpeg.JPEGImageEncoder; import de.humatic.dsj.DSFiltergraph; import java.awt.Graphics; import java.awt.Image; import java.awt.image.BufferedImage; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; class DsjTester implements PropertyChangeListener { public void getScreenshots(String filePath) { File f = new File(filePath); DSFiltergraph movie = DSFiltergraph.createDSFiltergraph(f.getAbsolutePath(), DSFiltergraph.RENDER_NATIVE, this); movie.pause(); int timing = 10000; int nb_screenshots = movie.getDuration() / timing; for (int i = 1; i < nb_screenshots; i++) { movie.setTimeValue(i * timing); try { BufferedImage src_image = movie.getImage(); saveImage(src_image, f.getAbsolutePath() + "." + i + ".jpg"); } catch (de.humatic.dsj.DSJException e) { System.err.println("Screenshot error at " + (i * timing) + " [" + e + "]"); } } movie.dispose(); } public BufferedImage getBufferedImage(Image __image, int __type_image) { BufferedImage buffered_image = new BufferedImage(__image.getWidth(null), __image.getHeight(null), __type_image); Graphics g = buffered_image.createGraphics(); g.drawImage(__image, 0, 0, null); g.dispose(); __image.flush(); __image = null; return (buffered_image); } public void saveImage(Image __image, String __filename) { BufferedImage buff = getBufferedImage(__image, BufferedImage.TYPE_INT_RGB); try { BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(__filename)); JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out); JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(buff); param.setQuality((float) 75 / 100.0f, false); encoder.setJPEGEncodeParam(param); encoder.encode(buff); out.flush(); out = null; } catch (java.io.IOException e) { System.err.println("Error while saving image : " + e); e.printStackTrace(); } } public void propertyChange(PropertyChangeEvent pe) { } public static void main(String __args[]) { // DSEnvironment.setSetupPath("C:/Program Files/Java/jre1.6.0_02/lib/ext/x86/dsj.xml"); DsjTester t = new DsjTester(); t.getScreenshots(__args[0]); } }
3,159
0.543843
0.536879
107
27.542055
22.111561
94
false
false
0
0
0
0
0
0
0.53271
false
false
10
2a75afb75d38c832b120c53a23e63613f5b69869
10,110,353,029,796
ca87bcc21f6e9ef8e90c09d80ab8eb2c57895d0d
/src/main/java/com/nodedynamics/productservices/services/product/TaxesService.java
a762469b0d478773346ff22ee9be6440944a7c59
[]
no_license
jlushington/productservices
https://github.com/jlushington/productservices
ad799ced1ec6aea5b71a596deeabc65fbc64e178
e81795c821daf5ae3b6e282b99ac608f24328f7e
refs/heads/master
2020-05-01T13:00:06.609000
2019-05-04T17:39:50
2019-05-04T17:39:50
169,897,836
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.nodedynamics.productservices.services.product; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.google.gson.Gson; import com.nodedynamics.productservices.common.Global; import com.nodedynamics.productservices.model.common.ResponseModel; import com.nodedynamics.productservices.model.product.TaxesModel; import com.nodedynamics.productservices.repo.TaxesRepository; import com.nodedynamics.productservices.services.BaseService; import reactor.core.publisher.Mono; @Service public class TaxesService implements BaseService<TaxesModel>{ @Autowired private TaxesRepository repo; @Autowired Gson gson = new Gson(); @Override public Mono<String> Store(TaxesModel Model) { //SAVE MODEL repo.save(Model); return Mono.just(gson.toJson(ResponseModel.builder() .MessageTypeID(Global.MessageTypeID.SUCCESS.key) .MessageType(Global.MessageType.SUCCESS.key) .Message("Created Tax Successfully Added") .build())); } @Override public Mono<String> Update(TaxesModel Model) { // TODO Auto-generated method stub return null; } @Override public Mono<String> DeleteAll() { // TODO Auto-generated method stub return null; } @Override public Mono<String> Delete(TaxesModel Model) { repo.deleteById(Model.getID()); return Mono.just(gson.toJson(ResponseModel.builder() .MessageTypeID(Global.MessageTypeID.SUCCESS.key) .MessageType(Global.MessageType.SUCCESS.key) .Message("Taxes Successfully Deleted") .build())); } @Override public Mono<String> GetAll() { return Mono.just(gson.toJson(repo.findAll())); } @Override public Mono<String> Get(TaxesModel Model) { return Mono.just(gson.toJson(repo.findById(Model.getID()))); } }
UTF-8
Java
1,859
java
TaxesService.java
Java
[]
null
[]
package com.nodedynamics.productservices.services.product; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.google.gson.Gson; import com.nodedynamics.productservices.common.Global; import com.nodedynamics.productservices.model.common.ResponseModel; import com.nodedynamics.productservices.model.product.TaxesModel; import com.nodedynamics.productservices.repo.TaxesRepository; import com.nodedynamics.productservices.services.BaseService; import reactor.core.publisher.Mono; @Service public class TaxesService implements BaseService<TaxesModel>{ @Autowired private TaxesRepository repo; @Autowired Gson gson = new Gson(); @Override public Mono<String> Store(TaxesModel Model) { //SAVE MODEL repo.save(Model); return Mono.just(gson.toJson(ResponseModel.builder() .MessageTypeID(Global.MessageTypeID.SUCCESS.key) .MessageType(Global.MessageType.SUCCESS.key) .Message("Created Tax Successfully Added") .build())); } @Override public Mono<String> Update(TaxesModel Model) { // TODO Auto-generated method stub return null; } @Override public Mono<String> DeleteAll() { // TODO Auto-generated method stub return null; } @Override public Mono<String> Delete(TaxesModel Model) { repo.deleteById(Model.getID()); return Mono.just(gson.toJson(ResponseModel.builder() .MessageTypeID(Global.MessageTypeID.SUCCESS.key) .MessageType(Global.MessageType.SUCCESS.key) .Message("Taxes Successfully Deleted") .build())); } @Override public Mono<String> GetAll() { return Mono.just(gson.toJson(repo.findAll())); } @Override public Mono<String> Get(TaxesModel Model) { return Mono.just(gson.toJson(repo.findById(Model.getID()))); } }
1,859
0.731576
0.731576
71
24.183098
22.698458
67
false
false
0
0
0
0
0
0
1.507042
false
false
10
8ddd82b752be5965a9ae63d9b17a2c6ad7e3c51a
8,675,833,955,187
59cab1955931d1a2846c9f1bba40bde024dd0d74
/src/main/java/org/web/vexamine/dao/vo/RoleVo.java
0525a42fecbce224d030e19f11f522f90feefe96
[]
no_license
Elavarasansk/Examiner
https://github.com/Elavarasansk/Examiner
d43db8ab1f1733900ba15c781a93da7a1beb5a15
2eb0641761705684e7ba98b69738853debc77f3a
refs/heads/master
2023-08-23T11:42:13.106000
2021-10-06T06:11:42
2021-10-06T06:11:42
396,671,393
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.web.vexamine.dao.vo; import lombok.Builder; import lombok.Data; @Data @Builder public class RoleVo { private Long id; private String type; private String description; }
UTF-8
Java
217
java
RoleVo.java
Java
[]
null
[]
package org.web.vexamine.dao.vo; import lombok.Builder; import lombok.Data; @Data @Builder public class RoleVo { private Long id; private String type; private String description; }
217
0.658986
0.658986
15
12.466666
11.609574
32
false
false
0
0
0
0
0
0
0.4
false
false
10
c13087548963bf15354ac23ea1ebd55a5179ea8c
8,031,588,861,176
b63f4870885cb9006f06fb2d782ac27692b6dd6d
/app/src/test/java/com/whut/wlqk/superCalculator/utils/calculator/CalculatorTest.java
5be95c9a806c812285322ea8e49c10a062870107
[]
no_license
LsKiKi/SuperCalculator
https://github.com/LsKiKi/SuperCalculator
cc48b3f0d0f1cc3d9671f56b2fe599aa2c039daa
6a6403a3cc7a01353fa13dfbeb39997c21efee33
refs/heads/master
2020-04-15T09:29:55.793000
2019-03-12T14:15:54
2019-03-12T14:15:54
164,552,723
2
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.whut.wlqk.superCalculator.utils.calculator; import org.junit.Test; import static org.junit.Assert.assertEquals; public class CalculatorTest { @Test public void addisCorrect(){ //对加法单元测试 Calculator cal = new Calculator(); String expression = "34.67+56.89"; double result = Double.valueOf(cal.calculate(expression)); assertEquals(result,91.56,0.000001); } @Test public void substrationisCorrect(){ //对减法单元测试 Calculator cal = new Calculator(); String expression = "85.75-78.42"; double result = Double.valueOf(cal.calculate(expression)); assertEquals(result,7.33,0.000001); } @Test public void divisionisCorrect(){ //对除法单元测试 Calculator cal = new Calculator(); String expression = "85.649/56.43"; double result = Double.valueOf(cal.calculate(expression)); assertEquals(result,1.5177919,0.000001); } @Test public void multiplicationisCorrect(){ //对乘法单元测试 Calculator cal = new Calculator(); String expression = "84.5531*62.35"; double result = Double.valueOf(cal.calculate(expression)); assertEquals(result,5271.885785,0.000001); } }
UTF-8
Java
1,308
java
CalculatorTest.java
Java
[]
null
[]
package com.whut.wlqk.superCalculator.utils.calculator; import org.junit.Test; import static org.junit.Assert.assertEquals; public class CalculatorTest { @Test public void addisCorrect(){ //对加法单元测试 Calculator cal = new Calculator(); String expression = "34.67+56.89"; double result = Double.valueOf(cal.calculate(expression)); assertEquals(result,91.56,0.000001); } @Test public void substrationisCorrect(){ //对减法单元测试 Calculator cal = new Calculator(); String expression = "85.75-78.42"; double result = Double.valueOf(cal.calculate(expression)); assertEquals(result,7.33,0.000001); } @Test public void divisionisCorrect(){ //对除法单元测试 Calculator cal = new Calculator(); String expression = "85.649/56.43"; double result = Double.valueOf(cal.calculate(expression)); assertEquals(result,1.5177919,0.000001); } @Test public void multiplicationisCorrect(){ //对乘法单元测试 Calculator cal = new Calculator(); String expression = "84.5531*62.35"; double result = Double.valueOf(cal.calculate(expression)); assertEquals(result,5271.885785,0.000001); } }
1,308
0.639776
0.569489
42
28.833334
21.198513
66
false
false
0
0
0
0
0
0
0.642857
false
false
10
31d72f73a1846e5c7cb416272d5216e3ff8dfd3e
9,844,065,057,486
0aa2e82485fe876c0503597308cf058cc2c38eea
/ecms/src/com/csit/service/impl/RoleServiceImpl.java
8695eb666f27c9b1020485b8c9baef5e8e4af582
[]
no_license
dampce32/ecms
https://github.com/dampce32/ecms
dc89114ce7aef756b6698898ca18f6830da4a1c5
4d391aa4e2b09bd6b0ebcf1ac2b4f1fc579cb8bf
refs/heads/master
2021-01-10T12:47:48.486000
2016-01-11T08:23:14
2016-01-11T08:23:14
49,412,088
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.csit.service.impl; import java.util.List; import java.util.Map; import javax.annotation.Resource; import org.apache.commons.lang.StringUtils; import org.springframework.stereotype.Service; import com.csit.dao.RoleDAO; import com.csit.dao.RoleRightDAO; import com.csit.dao.TeacherDAO; import com.csit.model.Role; import com.csit.model.RoleRight; import com.csit.model.RoleRightId; import com.csit.model.Teacher; import com.csit.service.RoleService; import com.csit.util.JSONUtil; import com.csit.util.StringUtil; import com.csit.vo.GobelConstants; import com.csit.vo.ServiceResult; /** * @Description:角色Service实现类 * @Copyright: 福州骏华信息有限公司 (c)2013 * @Created Date : 2013-4-17 * @Author lys */ @Service public class RoleServiceImpl extends BaseServiceImpl<Role, Integer> implements RoleService { @Resource private RoleDAO roleDAO; @Resource private TeacherDAO teacherDAO; @Resource private RoleRightDAO roleRightDAO; /* * (non-Javadoc) * @see com.csit.service.RoleService#save(com.csit.model.Role, java.lang.Integer) */ @Override public ServiceResult save(Role model, Integer teacherId) { /* *新增角色, *将当前用户的权限,赋予新增的角色 */ ServiceResult result = new ServiceResult(false); if(StringUtils.isEmpty(model.getRoleCode())){ result.setMessage("请填写角色编号"); return result; } if(StringUtils.isEmpty(model.getRoleName())){ result.setMessage("请填写角色名"); return result; } Teacher teacher = new Teacher(); teacher.setTeacherId(teacherId); model.setTeacher(teacher); model.setOperateTime(com.csit.util.DateUtil.getNowTimestamp()); Role oldRole = roleDAO.load("roleCode", model.getRoleCode()); if(model.getRoleId()==null){//新增 if(oldRole!=null){ result.setMessage("角色编号已存在,请重新输入角色编号"); return result; } roleDAO.save(model); /* * 新增角色,并将当前教师的权限赋值给新增的角色 */ List<Map<String,Object>> list = teacherDAO.queryTeacherRight(teacherId); //取出当前教师整合后的角色权限 for (Map<String, Object> map : list) { RoleRight roleRight = new RoleRight(); RoleRightId roleRightId = new RoleRightId(); roleRightId.setRoleId(model.getRoleId()); String rightId = map.get("RightID").toString(); roleRightId.setRightId(rightId); String state = map.get("State").toString(); if("1".equals(state)){ roleRight.setState(true); }else{ roleRight.setState(false); } roleRight.setId(roleRightId); roleRightDAO.save(roleRight); } }else{ if(oldRole==null){ Role oldModel = roleDAO.load(model.getRoleId()); oldModel.setRoleCode(model.getRoleCode()); oldModel.setRoleName(model.getRoleName()); oldModel.setState(model.getState()); oldModel.setNote(model.getNote()); oldModel.setTeacher(model.getTeacher()); oldModel.setOperateTime(model.getOperateTime()); }else{ if(oldRole.getRoleId().equals(model.getRoleId())){//编号没有修改 oldRole.setRoleName(model.getRoleName()); oldRole.setState(model.getState()); oldRole.setNote(model.getNote()); oldRole.setTeacher(model.getTeacher()); oldRole.setOperateTime(model.getOperateTime()); }else{ result.setMessage("角色编号已存在,请重新输入角色编号"); return result; } } } result.setIsSuccess(true); return result; } /* * (non-Javadoc) * @see com.csit.service.RoleService#query(java.lang.Integer, java.lang.Integer, com.csit.model.Role) */ @Override public String query(Integer page, Integer rows, Role model) { List<Role> list = roleDAO.query(page,rows,model); Long total = roleDAO.count(model); String[] properties = {"roleId","roleCode","roleName","state","note"}; return JSONUtil.toJson(list, properties, total); } /* * (non-Javadoc) * @see com.csit.service.RoleService#mulDelete(java.lang.String) */ @Override public ServiceResult mulDelete(String ids) { ServiceResult result = new ServiceResult(false); if(StringUtils.isEmpty(ids)){ result.setMessage("请选择要删除的记录"); return result; } String[] idArray = StringUtil.split(ids, GobelConstants.SPLIT_SEPARATOR); if(idArray.length==0){ result.setMessage("请选择要删除的记录"); return result; } boolean haveDelete = false; for (String id : idArray) { Role item = roleDAO.load(Integer.parseInt(idArray[0])); if("超级管理员".equals(item.getRoleName())){ continue; }else{ if(StringUtils.isNotEmpty(idArray[0])){ roleDAO.delete(Integer.parseInt(id)); haveDelete = true; } } } if(!haveDelete){ result.setMessage("没有可删除的角色"); return result; } result.setIsSuccess(true); return result; } /* * (non-Javadoc) * @see com.csit.service.RoleService#mulUpdateState(java.lang.String, com.csit.model.Role) */ @Override public ServiceResult mulUpdateState(String ids, Role model) { ServiceResult result = new ServiceResult(false); if(StringUtils.isEmpty(ids)){ result.setMessage("请选择要修改状态的角色"); return result; } String[] idArray =StringUtil.split(ids); if(idArray.length==0){ result.setMessage("请选择要修改状态的角色"); return result; } if(model==null||model.getState()==null){ result.setMessage("请选择要修改成的状态"); return result; } boolean haveUpdateShzt = false; for (String id : idArray) { Role oldRole = roleDAO.get(Integer.parseInt(id)); if(oldRole!=null&&oldRole.getState()!=model.getState()){ oldRole.setState(model.getState()); haveUpdateShzt = true; } } if(!haveUpdateShzt){ result.setMessage("没有可修改状态的角色"); return result; } result.setIsSuccess(true); return result; } }
UTF-8
Java
6,124
java
RoleServiceImpl.java
Java
[ { "context": " (c)2013\r\n * @Created Date : 2013-4-17\r\n * @Author lys\r\n */\r\n@Service\r\npublic class RoleServiceImpl exte", "end": 733, "score": 0.999393880367279, "start": 730, "tag": "USERNAME", "value": "lys" } ]
null
[]
package com.csit.service.impl; import java.util.List; import java.util.Map; import javax.annotation.Resource; import org.apache.commons.lang.StringUtils; import org.springframework.stereotype.Service; import com.csit.dao.RoleDAO; import com.csit.dao.RoleRightDAO; import com.csit.dao.TeacherDAO; import com.csit.model.Role; import com.csit.model.RoleRight; import com.csit.model.RoleRightId; import com.csit.model.Teacher; import com.csit.service.RoleService; import com.csit.util.JSONUtil; import com.csit.util.StringUtil; import com.csit.vo.GobelConstants; import com.csit.vo.ServiceResult; /** * @Description:角色Service实现类 * @Copyright: 福州骏华信息有限公司 (c)2013 * @Created Date : 2013-4-17 * @Author lys */ @Service public class RoleServiceImpl extends BaseServiceImpl<Role, Integer> implements RoleService { @Resource private RoleDAO roleDAO; @Resource private TeacherDAO teacherDAO; @Resource private RoleRightDAO roleRightDAO; /* * (non-Javadoc) * @see com.csit.service.RoleService#save(com.csit.model.Role, java.lang.Integer) */ @Override public ServiceResult save(Role model, Integer teacherId) { /* *新增角色, *将当前用户的权限,赋予新增的角色 */ ServiceResult result = new ServiceResult(false); if(StringUtils.isEmpty(model.getRoleCode())){ result.setMessage("请填写角色编号"); return result; } if(StringUtils.isEmpty(model.getRoleName())){ result.setMessage("请填写角色名"); return result; } Teacher teacher = new Teacher(); teacher.setTeacherId(teacherId); model.setTeacher(teacher); model.setOperateTime(com.csit.util.DateUtil.getNowTimestamp()); Role oldRole = roleDAO.load("roleCode", model.getRoleCode()); if(model.getRoleId()==null){//新增 if(oldRole!=null){ result.setMessage("角色编号已存在,请重新输入角色编号"); return result; } roleDAO.save(model); /* * 新增角色,并将当前教师的权限赋值给新增的角色 */ List<Map<String,Object>> list = teacherDAO.queryTeacherRight(teacherId); //取出当前教师整合后的角色权限 for (Map<String, Object> map : list) { RoleRight roleRight = new RoleRight(); RoleRightId roleRightId = new RoleRightId(); roleRightId.setRoleId(model.getRoleId()); String rightId = map.get("RightID").toString(); roleRightId.setRightId(rightId); String state = map.get("State").toString(); if("1".equals(state)){ roleRight.setState(true); }else{ roleRight.setState(false); } roleRight.setId(roleRightId); roleRightDAO.save(roleRight); } }else{ if(oldRole==null){ Role oldModel = roleDAO.load(model.getRoleId()); oldModel.setRoleCode(model.getRoleCode()); oldModel.setRoleName(model.getRoleName()); oldModel.setState(model.getState()); oldModel.setNote(model.getNote()); oldModel.setTeacher(model.getTeacher()); oldModel.setOperateTime(model.getOperateTime()); }else{ if(oldRole.getRoleId().equals(model.getRoleId())){//编号没有修改 oldRole.setRoleName(model.getRoleName()); oldRole.setState(model.getState()); oldRole.setNote(model.getNote()); oldRole.setTeacher(model.getTeacher()); oldRole.setOperateTime(model.getOperateTime()); }else{ result.setMessage("角色编号已存在,请重新输入角色编号"); return result; } } } result.setIsSuccess(true); return result; } /* * (non-Javadoc) * @see com.csit.service.RoleService#query(java.lang.Integer, java.lang.Integer, com.csit.model.Role) */ @Override public String query(Integer page, Integer rows, Role model) { List<Role> list = roleDAO.query(page,rows,model); Long total = roleDAO.count(model); String[] properties = {"roleId","roleCode","roleName","state","note"}; return JSONUtil.toJson(list, properties, total); } /* * (non-Javadoc) * @see com.csit.service.RoleService#mulDelete(java.lang.String) */ @Override public ServiceResult mulDelete(String ids) { ServiceResult result = new ServiceResult(false); if(StringUtils.isEmpty(ids)){ result.setMessage("请选择要删除的记录"); return result; } String[] idArray = StringUtil.split(ids, GobelConstants.SPLIT_SEPARATOR); if(idArray.length==0){ result.setMessage("请选择要删除的记录"); return result; } boolean haveDelete = false; for (String id : idArray) { Role item = roleDAO.load(Integer.parseInt(idArray[0])); if("超级管理员".equals(item.getRoleName())){ continue; }else{ if(StringUtils.isNotEmpty(idArray[0])){ roleDAO.delete(Integer.parseInt(id)); haveDelete = true; } } } if(!haveDelete){ result.setMessage("没有可删除的角色"); return result; } result.setIsSuccess(true); return result; } /* * (non-Javadoc) * @see com.csit.service.RoleService#mulUpdateState(java.lang.String, com.csit.model.Role) */ @Override public ServiceResult mulUpdateState(String ids, Role model) { ServiceResult result = new ServiceResult(false); if(StringUtils.isEmpty(ids)){ result.setMessage("请选择要修改状态的角色"); return result; } String[] idArray =StringUtil.split(ids); if(idArray.length==0){ result.setMessage("请选择要修改状态的角色"); return result; } if(model==null||model.getState()==null){ result.setMessage("请选择要修改成的状态"); return result; } boolean haveUpdateShzt = false; for (String id : idArray) { Role oldRole = roleDAO.get(Integer.parseInt(id)); if(oldRole!=null&&oldRole.getState()!=model.getState()){ oldRole.setState(model.getState()); haveUpdateShzt = true; } } if(!haveUpdateShzt){ result.setMessage("没有可修改状态的角色"); return result; } result.setIsSuccess(true); return result; } }
6,124
0.673829
0.671034
201
26.477612
20.301477
102
false
false
0
0
0
0
0
0
2.78607
false
false
10
47272e3f9f91404b9986808ddca6785c8106d4ac
22,728,966,966,224
90e92f60fa9c4a2c7633f0fd1059ab31613225cc
/app/src/main/java/com/abinbev/dsa/activity/DynamicViewActivity.java
c38b6f3e460bc91c237f760b19526ea104a73b0d
[]
no_license
cckmit/ontap
https://github.com/cckmit/ontap
55dcc2c5fe5085292fce098f1d85743cf95ff5d3
c4678af990a5103276e17b472c51391a687cdbb7
refs/heads/master
2023-03-21T04:19:14.451000
2018-10-26T05:00:43
2018-10-26T05:00:43
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.abinbev.dsa.activity; import android.os.Bundle; import android.support.v7.widget.Toolbar; import android.text.TextUtils; import android.util.Log; import android.view.Gravity; import android.view.LayoutInflater; import android.view.MenuItem; import android.view.View; import android.widget.CheckBox; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; import com.abinbev.dsa.R; import com.abinbev.dsa.model.TranslatableSFBaseObject; import com.abinbev.dsa.utils.AbInBevConstants; import com.abinbev.dsa.utils.PicklistUtils; import com.google.gson.Gson; import com.salesforce.androidsyncengine.data.layouts.DetailLayoutSection; import com.salesforce.androidsyncengine.data.layouts.Details; import com.salesforce.androidsyncengine.data.layouts.IndividualLayouts; import com.salesforce.androidsyncengine.data.layouts.LayoutComponent; import com.salesforce.androidsyncengine.data.layouts.LayoutItem; import com.salesforce.androidsyncengine.data.layouts.LayoutRow; import com.salesforce.androidsyncengine.data.layouts.ObjectLayouts; import com.salesforce.androidsyncengine.data.layouts.RecordTypeMapping; import com.salesforce.androidsyncengine.data.model.PicklistValue; import com.salesforce.androidsyncengine.datamanager.MetaDataProvider; import com.salesforce.androidsyncengine.syncmanifest.ManifestUtils; import com.salesforce.androidsyncengine.utils.SyncEngineConstants; import com.salesforce.dsa.data.model.Address; import com.salesforce.dsa.data.model.SFBaseObject; import java.text.NumberFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.TimeZone; import butterknife.Bind; public class DynamicViewActivity extends AppBaseActivity { private static final String TAG = "DynamicViewActivity"; private static SimpleDateFormat dateFormat; private static SimpleDateFormat dateTimeFormat = new SimpleDateFormat(); private static final SimpleDateFormat serverDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); private static final SimpleDateFormat serverDateOnlyFormat = new SimpleDateFormat("yyyy-MM-dd"); @Bind(R.id.toolbar) Toolbar toolbar; @Bind(R.id.main_layout) LinearLayout mainLayout; protected SFBaseObject baseObject; private String currencySymbol; private String notAvailableValue; private List<String> filterFields; private Map detailsMap; private String objectName; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); // TODO: Compute this based on object or user?? // Fix this currencySymbol = "$"; notAvailableValue = getString(R.string.not_available); // we want to show only the date ... dateFormat = (SimpleDateFormat) android.text.format.DateFormat.getDateFormat(this); String pattern1 = ((SimpleDateFormat) dateFormat).toLocalizedPattern(); String pattern2 = ((SimpleDateFormat) dateTimeFormat).toLocalizedPattern(); Log.e("Babu", "pattern1 : " + pattern1 + " pattern2: " + pattern2); filterFields = new ArrayList<>(); } @Override public int getLayoutResId() { return R.layout.dynamic_main; } @Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == android.R.id.home) { finish(); return true; } return super.onOptionsItemSelected(item); } protected List<String> filterFields() { return new ArrayList<>(); } protected void buildLayout(String objectType, TranslatableSFBaseObject baseObject) { TranslatableSFBaseObject.addRecordTypeTranslations(Arrays.asList(baseObject), objectType, TranslatableSFBaseObject.FIELD_RECORD_NAME); objectName = objectType; LayoutInflater layoutInflater = getLayoutInflater(); try { mainLayout.removeAllViews(); // String objectType = "Account"; Gson gson = new Gson(); // use Builder LinearLayout.LayoutParams rowItemLayoutParam = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); int rowItemPadding = getResources().getDimensionPixelOffset(R.dimen.space_small); String recordTypeId = baseObject.getStringValueForKey("RecordTypeId"); Log.i(TAG, "Name: " + baseObject.getName() + " : " + baseObject.getId()); Log.i(TAG, "RecordTypeId: " + recordTypeId); ObjectLayouts objectLayouts = MetaDataProvider.getMetaDataForLayouts(this, gson, objectType); RecordTypeMapping recordTypeMapping = null; if (objectLayouts != null) { List<RecordTypeMapping> recordTypeMappingList = objectLayouts.getRecordTypeMappings(); // number of RecordTypeMapping are typically small so ok to loop rather than cache for (RecordTypeMapping recordTypeMappingItem : recordTypeMappingList) { if (recordTypeMappingItem.getRecordTypeId().equals(recordTypeId)) { recordTypeMapping = recordTypeMappingItem; break; } // if none is specified then pick the one that is default if (TextUtils.isEmpty(recordTypeId)) { if (recordTypeMappingItem.getDefaultRecordTypeMapping()) { recordTypeMapping = recordTypeMappingItem; break; } } } if (recordTypeMapping == null) { Toast.makeText(this, R.string.no_record_type_mapping, Toast.LENGTH_LONG).show(); return; } } // Unnecessary but this should free up some memory objectLayouts = null; // Let us ignore the available value for now Log.i(TAG, recordTypeMapping.getRecordTypeId() + ":" + recordTypeMapping.getName() + " Available: " + recordTypeMapping.getAvailable()); IndividualLayouts individualLayouts = MetaDataProvider.getMetaDataForIndividualLayout(this, gson, objectType, recordTypeMapping.getRecordTypeId()); List<DetailLayoutSection> detailLayoutSections = individualLayouts.getDetailLayoutSections(); int size = detailLayoutSections.size(); detailsMap = PicklistUtils.buildDetailsMapForView(detailLayoutSections); for (DetailLayoutSection detailLayoutSection : detailLayoutSections) { detailLayoutSection.getRows(); detailLayoutSection.getColumns(); detailLayoutSection.getHeading(); detailLayoutSection.getUseHeading(); Log.i(TAG, ">>> Section: " + detailLayoutSection.getHeading() + "<<<"); if (detailLayoutSection.getUseHeading() == true) { TextView sectionHeader = (TextView) layoutInflater.inflate(R.layout.dynamic_section_header, null); sectionHeader.setText(detailLayoutSection.getHeading()); mainLayout.addView(sectionHeader); } List<LayoutRow> layoutRows = detailLayoutSection.getLayoutRows(); int rowId = 1; for (LayoutRow layoutRow : layoutRows) { LinearLayout rowItem = (LinearLayout) layoutInflater.inflate(R.layout.dynamic_row, null); TextView leftLabel = (TextView) rowItem.findViewById(R.id.left_label); TextView leftValue = (TextView) rowItem.findViewById(R.id.left_value); TextView rightLabel = (TextView) rowItem.findViewById(R.id.right_label); TextView rightValue = (TextView) rowItem.findViewById(R.id.right_value); // If there is data they will be shown later in code. leftLabel.setVisibility(View.GONE); leftValue.setVisibility(View.GONE); rightLabel.setVisibility(View.GONE); rightValue.setVisibility(View.GONE); Log.v(TAG, "> Row " + rowId); rowId++; List<LayoutItem> layoutItems = layoutRow.getLayoutItems(); int column = 0; for (LayoutItem layoutItem : layoutItems) { layoutItem.getLabel(); layoutItem.getEditableForUpdate(); layoutItem.getEditableForNew(); layoutItem.getRequired(); List<LayoutComponent> layoutComponents = layoutItem.getLayoutComponents(); for (LayoutComponent layoutComponent : layoutComponents) { layoutComponent.getType(); layoutComponent.getValue(); Details details = layoutComponent.getDetails(); if (details != null) { String valueString = null; String detailsNameString = details.getName(); // if prefix is present in the key then use a stripped version detailsNameString = ManifestUtils.removeNamespaceFromField(objectType, detailsNameString, this); if (filterFields().contains(detailsNameString)) { continue; } if ("reference".equalsIgnoreCase(details.getType())) { List<String> listReference = details.getReferenceTo(); if (listReference.isEmpty()) { Log.e(TAG, "Details: " + details.getLabel() + "\n" + "** No Reference **"); } else { if (listReference.size() > 1) { Log.v(TAG, "reference size is > 1"); Log.v(TAG, detailsNameString + " list reference: " + listReference); } for (String referenceString : listReference) { if (detailsNameString.equals("RecordTypeId")) { valueString = baseObject.getTranslatedRecordName(); } else { String referencedObjectType = ManifestUtils.removeNamespaceFromObject(referenceString, this); String referencedObjectFieldName = getLookupFieldName(detailsNameString, referencedObjectType); valueString = baseObject.getReferencedValueObjectField(referencedObjectType, detailsNameString, referencedObjectFieldName); } Log.v(TAG, "reference: " + referenceString + ", " + detailsNameString + " : " + valueString); if (valueString != null) break; } } } else if ("VisualforcePage".equalsIgnoreCase(details.getType())) { // this is not really in the details block but ... Log.v(TAG, "skipping VisualforcePage for: " + detailsNameString); } else if ("address".equalsIgnoreCase(details.getType())) { Address address = baseObject.getAddress(detailsNameString); valueString = address == null ? notAvailableValue : address.getPrintableAddress(); } else { if (details.getHtmlFormatted()) { valueString = notAvailableValue; } else { valueString = baseObject.getStringValueForKey(detailsNameString); } } Log.v(TAG, "Details: " + detailsNameString + ": " + valueString + " : " + details.getType()); String labelString; if (layoutItem.getLabel() != null) { labelString = layoutItem.getLabel(); } else { labelString = ""; } if (valueString == null || ("null".equals(valueString))) { valueString = ""; } else { if ("currency".equalsIgnoreCase(details.getType())) { try { valueString = currencySymbol + NumberFormat.getInstance().format(Long.parseLong(valueString)); } catch (Exception e) { Log.e(TAG, "got exception while parsing currency. Ignoring it!"); } } else if ("datetime".equalsIgnoreCase(details.getType())) { try { // setting this value only once in onCreate does not seem to work serverDateFormat.setTimeZone(TimeZone.getTimeZone("GMT")); Date serverDate = serverDateFormat.parse(valueString); String dateString = dateTimeFormat.format(serverDate); valueString = dateString; } catch (Exception e) { Log.e(TAG, "got exception while parsing datetime. Ignoring it!"); } } else if("date".equalsIgnoreCase(details.getType())) { try { // valueString = DateUtils.formatDateStringShort(valueString); valueString = dateFormat.format(serverDateOnlyFormat.parse(valueString)); } catch (Exception e) { Log.e(TAG, "got exception while parsing date. Ignoring it!"); } } else if ("picklist".equalsIgnoreCase(details.getType())) { // get picklist label from pick list value Log.e("Babu", "calculating for : " + details.getName() + " value: " + valueString); valueString = getPickListLabelForValue(details.getName(), valueString); } } boolean replaceView = false; // this should move to a function that gets a view based on // the type View newView = null; if ("boolean".equalsIgnoreCase(details.getType())) { CheckBox checkBox = new CheckBox(this); checkBox.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT); checkBox.setPadding(rowItemPadding, 0, rowItemPadding, 0); checkBox.setLayoutParams(rowItemLayoutParam); if ("false".equalsIgnoreCase(valueString)) { checkBox.setChecked(false); } else if ("true".equalsIgnoreCase(valueString)) { checkBox.setChecked(true); } else { checkBox.setChecked(false); } checkBox.setEnabled(false); newView = checkBox; replaceView = true; } if (column == 0) { leftLabel.setText(labelString); leftLabel.setVisibility((View.VISIBLE)); if (replaceView) { rowItem.removeView(leftValue); rowItem.addView(newView, 1); } else { leftValue.append(valueString); leftValue.setVisibility(View.VISIBLE); } } else { rightLabel.setText(labelString); rightLabel.setVisibility((View.VISIBLE)); if (replaceView) { rowItem.removeView(rightValue); rowItem.addView(newView); } else { rightValue.append(valueString); rightValue.setVisibility(View.VISIBLE); } } } else { if ("Separator".equals(layoutComponent.getType())) { if (column < 1) { leftValue.append(layoutComponent.getValue()); } else { rightValue.append(layoutComponent.getValue()); } } } } column++; } mainLayout.addView(rowItem); } } } catch (Exception e) { Log.e(TAG, "Exception: " + e.getMessage()); e.printStackTrace(); } } private String getPickListLabelForValue(String fieldName, String fieldValue) { Details field = (Details) detailsMap.get(nameSpacedFieldName(fieldName)); if (field == null) { Log.e(TAG, "null value for getPickListLabels for fieldName: " + fieldName); field = (Details) detailsMap.get(fieldName); if (field == null) { return fieldValue; } } List<PicklistValue> picklistValueList = field.getPicklistValues(); for (PicklistValue picklistValue : picklistValueList) { if (fieldValue.equals(picklistValue.getValue())) { return picklistValue.getLabel(); } } return fieldValue; } // this has a performance hit compared to the previous method but this is correct and ca protected String nameSpacedFieldName(String fieldName) { if (objectName == null) return fieldName; else { String nameSpacedFieldName = ManifestUtils.getNamespaceSupportedFieldName(objectName, fieldName, this); return nameSpacedFieldName; } } protected String getLookupFieldName(String fieldName, String referredObjectType) { if (AbInBevConstants.AbInBevObjects.PRODUCT.equals(referredObjectType)) { return AbInBevConstants.ProductFields.PRODUCT_NAME; } else { return SyncEngineConstants.StdFields.NAME; } } }
UTF-8
Java
20,734
java
DynamicViewActivity.java
Java
[]
null
[]
package com.abinbev.dsa.activity; import android.os.Bundle; import android.support.v7.widget.Toolbar; import android.text.TextUtils; import android.util.Log; import android.view.Gravity; import android.view.LayoutInflater; import android.view.MenuItem; import android.view.View; import android.widget.CheckBox; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; import com.abinbev.dsa.R; import com.abinbev.dsa.model.TranslatableSFBaseObject; import com.abinbev.dsa.utils.AbInBevConstants; import com.abinbev.dsa.utils.PicklistUtils; import com.google.gson.Gson; import com.salesforce.androidsyncengine.data.layouts.DetailLayoutSection; import com.salesforce.androidsyncengine.data.layouts.Details; import com.salesforce.androidsyncengine.data.layouts.IndividualLayouts; import com.salesforce.androidsyncengine.data.layouts.LayoutComponent; import com.salesforce.androidsyncengine.data.layouts.LayoutItem; import com.salesforce.androidsyncengine.data.layouts.LayoutRow; import com.salesforce.androidsyncengine.data.layouts.ObjectLayouts; import com.salesforce.androidsyncengine.data.layouts.RecordTypeMapping; import com.salesforce.androidsyncengine.data.model.PicklistValue; import com.salesforce.androidsyncengine.datamanager.MetaDataProvider; import com.salesforce.androidsyncengine.syncmanifest.ManifestUtils; import com.salesforce.androidsyncengine.utils.SyncEngineConstants; import com.salesforce.dsa.data.model.Address; import com.salesforce.dsa.data.model.SFBaseObject; import java.text.NumberFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.TimeZone; import butterknife.Bind; public class DynamicViewActivity extends AppBaseActivity { private static final String TAG = "DynamicViewActivity"; private static SimpleDateFormat dateFormat; private static SimpleDateFormat dateTimeFormat = new SimpleDateFormat(); private static final SimpleDateFormat serverDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); private static final SimpleDateFormat serverDateOnlyFormat = new SimpleDateFormat("yyyy-MM-dd"); @Bind(R.id.toolbar) Toolbar toolbar; @Bind(R.id.main_layout) LinearLayout mainLayout; protected SFBaseObject baseObject; private String currencySymbol; private String notAvailableValue; private List<String> filterFields; private Map detailsMap; private String objectName; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); // TODO: Compute this based on object or user?? // Fix this currencySymbol = "$"; notAvailableValue = getString(R.string.not_available); // we want to show only the date ... dateFormat = (SimpleDateFormat) android.text.format.DateFormat.getDateFormat(this); String pattern1 = ((SimpleDateFormat) dateFormat).toLocalizedPattern(); String pattern2 = ((SimpleDateFormat) dateTimeFormat).toLocalizedPattern(); Log.e("Babu", "pattern1 : " + pattern1 + " pattern2: " + pattern2); filterFields = new ArrayList<>(); } @Override public int getLayoutResId() { return R.layout.dynamic_main; } @Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == android.R.id.home) { finish(); return true; } return super.onOptionsItemSelected(item); } protected List<String> filterFields() { return new ArrayList<>(); } protected void buildLayout(String objectType, TranslatableSFBaseObject baseObject) { TranslatableSFBaseObject.addRecordTypeTranslations(Arrays.asList(baseObject), objectType, TranslatableSFBaseObject.FIELD_RECORD_NAME); objectName = objectType; LayoutInflater layoutInflater = getLayoutInflater(); try { mainLayout.removeAllViews(); // String objectType = "Account"; Gson gson = new Gson(); // use Builder LinearLayout.LayoutParams rowItemLayoutParam = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); int rowItemPadding = getResources().getDimensionPixelOffset(R.dimen.space_small); String recordTypeId = baseObject.getStringValueForKey("RecordTypeId"); Log.i(TAG, "Name: " + baseObject.getName() + " : " + baseObject.getId()); Log.i(TAG, "RecordTypeId: " + recordTypeId); ObjectLayouts objectLayouts = MetaDataProvider.getMetaDataForLayouts(this, gson, objectType); RecordTypeMapping recordTypeMapping = null; if (objectLayouts != null) { List<RecordTypeMapping> recordTypeMappingList = objectLayouts.getRecordTypeMappings(); // number of RecordTypeMapping are typically small so ok to loop rather than cache for (RecordTypeMapping recordTypeMappingItem : recordTypeMappingList) { if (recordTypeMappingItem.getRecordTypeId().equals(recordTypeId)) { recordTypeMapping = recordTypeMappingItem; break; } // if none is specified then pick the one that is default if (TextUtils.isEmpty(recordTypeId)) { if (recordTypeMappingItem.getDefaultRecordTypeMapping()) { recordTypeMapping = recordTypeMappingItem; break; } } } if (recordTypeMapping == null) { Toast.makeText(this, R.string.no_record_type_mapping, Toast.LENGTH_LONG).show(); return; } } // Unnecessary but this should free up some memory objectLayouts = null; // Let us ignore the available value for now Log.i(TAG, recordTypeMapping.getRecordTypeId() + ":" + recordTypeMapping.getName() + " Available: " + recordTypeMapping.getAvailable()); IndividualLayouts individualLayouts = MetaDataProvider.getMetaDataForIndividualLayout(this, gson, objectType, recordTypeMapping.getRecordTypeId()); List<DetailLayoutSection> detailLayoutSections = individualLayouts.getDetailLayoutSections(); int size = detailLayoutSections.size(); detailsMap = PicklistUtils.buildDetailsMapForView(detailLayoutSections); for (DetailLayoutSection detailLayoutSection : detailLayoutSections) { detailLayoutSection.getRows(); detailLayoutSection.getColumns(); detailLayoutSection.getHeading(); detailLayoutSection.getUseHeading(); Log.i(TAG, ">>> Section: " + detailLayoutSection.getHeading() + "<<<"); if (detailLayoutSection.getUseHeading() == true) { TextView sectionHeader = (TextView) layoutInflater.inflate(R.layout.dynamic_section_header, null); sectionHeader.setText(detailLayoutSection.getHeading()); mainLayout.addView(sectionHeader); } List<LayoutRow> layoutRows = detailLayoutSection.getLayoutRows(); int rowId = 1; for (LayoutRow layoutRow : layoutRows) { LinearLayout rowItem = (LinearLayout) layoutInflater.inflate(R.layout.dynamic_row, null); TextView leftLabel = (TextView) rowItem.findViewById(R.id.left_label); TextView leftValue = (TextView) rowItem.findViewById(R.id.left_value); TextView rightLabel = (TextView) rowItem.findViewById(R.id.right_label); TextView rightValue = (TextView) rowItem.findViewById(R.id.right_value); // If there is data they will be shown later in code. leftLabel.setVisibility(View.GONE); leftValue.setVisibility(View.GONE); rightLabel.setVisibility(View.GONE); rightValue.setVisibility(View.GONE); Log.v(TAG, "> Row " + rowId); rowId++; List<LayoutItem> layoutItems = layoutRow.getLayoutItems(); int column = 0; for (LayoutItem layoutItem : layoutItems) { layoutItem.getLabel(); layoutItem.getEditableForUpdate(); layoutItem.getEditableForNew(); layoutItem.getRequired(); List<LayoutComponent> layoutComponents = layoutItem.getLayoutComponents(); for (LayoutComponent layoutComponent : layoutComponents) { layoutComponent.getType(); layoutComponent.getValue(); Details details = layoutComponent.getDetails(); if (details != null) { String valueString = null; String detailsNameString = details.getName(); // if prefix is present in the key then use a stripped version detailsNameString = ManifestUtils.removeNamespaceFromField(objectType, detailsNameString, this); if (filterFields().contains(detailsNameString)) { continue; } if ("reference".equalsIgnoreCase(details.getType())) { List<String> listReference = details.getReferenceTo(); if (listReference.isEmpty()) { Log.e(TAG, "Details: " + details.getLabel() + "\n" + "** No Reference **"); } else { if (listReference.size() > 1) { Log.v(TAG, "reference size is > 1"); Log.v(TAG, detailsNameString + " list reference: " + listReference); } for (String referenceString : listReference) { if (detailsNameString.equals("RecordTypeId")) { valueString = baseObject.getTranslatedRecordName(); } else { String referencedObjectType = ManifestUtils.removeNamespaceFromObject(referenceString, this); String referencedObjectFieldName = getLookupFieldName(detailsNameString, referencedObjectType); valueString = baseObject.getReferencedValueObjectField(referencedObjectType, detailsNameString, referencedObjectFieldName); } Log.v(TAG, "reference: " + referenceString + ", " + detailsNameString + " : " + valueString); if (valueString != null) break; } } } else if ("VisualforcePage".equalsIgnoreCase(details.getType())) { // this is not really in the details block but ... Log.v(TAG, "skipping VisualforcePage for: " + detailsNameString); } else if ("address".equalsIgnoreCase(details.getType())) { Address address = baseObject.getAddress(detailsNameString); valueString = address == null ? notAvailableValue : address.getPrintableAddress(); } else { if (details.getHtmlFormatted()) { valueString = notAvailableValue; } else { valueString = baseObject.getStringValueForKey(detailsNameString); } } Log.v(TAG, "Details: " + detailsNameString + ": " + valueString + " : " + details.getType()); String labelString; if (layoutItem.getLabel() != null) { labelString = layoutItem.getLabel(); } else { labelString = ""; } if (valueString == null || ("null".equals(valueString))) { valueString = ""; } else { if ("currency".equalsIgnoreCase(details.getType())) { try { valueString = currencySymbol + NumberFormat.getInstance().format(Long.parseLong(valueString)); } catch (Exception e) { Log.e(TAG, "got exception while parsing currency. Ignoring it!"); } } else if ("datetime".equalsIgnoreCase(details.getType())) { try { // setting this value only once in onCreate does not seem to work serverDateFormat.setTimeZone(TimeZone.getTimeZone("GMT")); Date serverDate = serverDateFormat.parse(valueString); String dateString = dateTimeFormat.format(serverDate); valueString = dateString; } catch (Exception e) { Log.e(TAG, "got exception while parsing datetime. Ignoring it!"); } } else if("date".equalsIgnoreCase(details.getType())) { try { // valueString = DateUtils.formatDateStringShort(valueString); valueString = dateFormat.format(serverDateOnlyFormat.parse(valueString)); } catch (Exception e) { Log.e(TAG, "got exception while parsing date. Ignoring it!"); } } else if ("picklist".equalsIgnoreCase(details.getType())) { // get picklist label from pick list value Log.e("Babu", "calculating for : " + details.getName() + " value: " + valueString); valueString = getPickListLabelForValue(details.getName(), valueString); } } boolean replaceView = false; // this should move to a function that gets a view based on // the type View newView = null; if ("boolean".equalsIgnoreCase(details.getType())) { CheckBox checkBox = new CheckBox(this); checkBox.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT); checkBox.setPadding(rowItemPadding, 0, rowItemPadding, 0); checkBox.setLayoutParams(rowItemLayoutParam); if ("false".equalsIgnoreCase(valueString)) { checkBox.setChecked(false); } else if ("true".equalsIgnoreCase(valueString)) { checkBox.setChecked(true); } else { checkBox.setChecked(false); } checkBox.setEnabled(false); newView = checkBox; replaceView = true; } if (column == 0) { leftLabel.setText(labelString); leftLabel.setVisibility((View.VISIBLE)); if (replaceView) { rowItem.removeView(leftValue); rowItem.addView(newView, 1); } else { leftValue.append(valueString); leftValue.setVisibility(View.VISIBLE); } } else { rightLabel.setText(labelString); rightLabel.setVisibility((View.VISIBLE)); if (replaceView) { rowItem.removeView(rightValue); rowItem.addView(newView); } else { rightValue.append(valueString); rightValue.setVisibility(View.VISIBLE); } } } else { if ("Separator".equals(layoutComponent.getType())) { if (column < 1) { leftValue.append(layoutComponent.getValue()); } else { rightValue.append(layoutComponent.getValue()); } } } } column++; } mainLayout.addView(rowItem); } } } catch (Exception e) { Log.e(TAG, "Exception: " + e.getMessage()); e.printStackTrace(); } } private String getPickListLabelForValue(String fieldName, String fieldValue) { Details field = (Details) detailsMap.get(nameSpacedFieldName(fieldName)); if (field == null) { Log.e(TAG, "null value for getPickListLabels for fieldName: " + fieldName); field = (Details) detailsMap.get(fieldName); if (field == null) { return fieldValue; } } List<PicklistValue> picklistValueList = field.getPicklistValues(); for (PicklistValue picklistValue : picklistValueList) { if (fieldValue.equals(picklistValue.getValue())) { return picklistValue.getLabel(); } } return fieldValue; } // this has a performance hit compared to the previous method but this is correct and ca protected String nameSpacedFieldName(String fieldName) { if (objectName == null) return fieldName; else { String nameSpacedFieldName = ManifestUtils.getNamespaceSupportedFieldName(objectName, fieldName, this); return nameSpacedFieldName; } } protected String getLookupFieldName(String fieldName, String referredObjectType) { if (AbInBevConstants.AbInBevObjects.PRODUCT.equals(referredObjectType)) { return AbInBevConstants.ProductFields.PRODUCT_NAME; } else { return SyncEngineConstants.StdFields.NAME; } } }
20,734
0.518086
0.517315
433
46.884525
36.777348
171
false
false
0
0
0
0
0
0
0.591224
false
false
10
5093756b0199a567aefd31a5948f4a0ef31fe0e1
13,640,816,166,793
c35ce88bb85437beb50ef2ed599880d18725a3fd
/src/com/jantox/siege/entities/tools/Projectile.java
7ca5261265210ad2bea91f04243fc185aabcf360
[]
no_license
RaasAhsan/deathsiege
https://github.com/RaasAhsan/deathsiege
1290bd9c8b6274d61ba5bbd6399fb5a266f84a3a
a232223d8ab7c28ae846d03b0ae29a528928b8c5
refs/heads/master
2021-05-29T20:49:56.062000
2013-07-10T06:08:04
2013-07-10T06:08:04
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.jantox.siege.entities.tools; import com.jantox.siege.GameInstance; import com.jantox.siege.Vector3D; import com.jantox.siege.entities.Endwek; import com.jantox.siege.entities.Entity; import com.jantox.siege.entities.Kage; import com.jantox.siege.entities.Living; import com.jantox.siege.geometry.CollisionSystem; import com.jantox.siege.geometry.Ray; import com.jantox.siege.geometry.Sphere; import java.util.ArrayList; public class Projectile { public static int SHOTGUN = 0; public static int SNIPER = 1; private Vector3D src, dir; private int damage; private float range; public boolean expired = false; public Projectile(int type, Vector3D src, Vector3D dir) { this.src = src; this.dir = dir; if(type == SHOTGUN) { damage = 800; range = 20; } else if(type == SNIPER) { range = 500; damage = 10000; } } public void use(ArrayList<Entity> entities) { expired = true; Living res = null; double dist = 1000000000; Ray bullet = new Ray(src.copy(), dir.copy()); for(int i = 0; i < entities.size(); i++) { Entity e = entities.get(i); if(e instanceof Endwek || e instanceof Kage) { Living l = (Living) e; Vector3D cr = new Vector3D(); if(CollisionSystem.raySphere(bullet, (Sphere)l.getCollisionMask(), cr)) { if(cr.x < dist) { dist = cr.x; res = l; } if(cr.y < dist) { dist = cr.y; res = l; } } if(e instanceof Endwek) { if(((Endwek)e).isHeadshot(bullet)) { GameInstance.audio.playSound(5); l.damage(1000); } } } } if(dist <= range * 2) if(res != null) { if((int)dist == 0) dist = 1; res.damage(damage/(int)dist); } } }
UTF-8
Java
2,197
java
Projectile.java
Java
[]
null
[]
package com.jantox.siege.entities.tools; import com.jantox.siege.GameInstance; import com.jantox.siege.Vector3D; import com.jantox.siege.entities.Endwek; import com.jantox.siege.entities.Entity; import com.jantox.siege.entities.Kage; import com.jantox.siege.entities.Living; import com.jantox.siege.geometry.CollisionSystem; import com.jantox.siege.geometry.Ray; import com.jantox.siege.geometry.Sphere; import java.util.ArrayList; public class Projectile { public static int SHOTGUN = 0; public static int SNIPER = 1; private Vector3D src, dir; private int damage; private float range; public boolean expired = false; public Projectile(int type, Vector3D src, Vector3D dir) { this.src = src; this.dir = dir; if(type == SHOTGUN) { damage = 800; range = 20; } else if(type == SNIPER) { range = 500; damage = 10000; } } public void use(ArrayList<Entity> entities) { expired = true; Living res = null; double dist = 1000000000; Ray bullet = new Ray(src.copy(), dir.copy()); for(int i = 0; i < entities.size(); i++) { Entity e = entities.get(i); if(e instanceof Endwek || e instanceof Kage) { Living l = (Living) e; Vector3D cr = new Vector3D(); if(CollisionSystem.raySphere(bullet, (Sphere)l.getCollisionMask(), cr)) { if(cr.x < dist) { dist = cr.x; res = l; } if(cr.y < dist) { dist = cr.y; res = l; } } if(e instanceof Endwek) { if(((Endwek)e).isHeadshot(bullet)) { GameInstance.audio.playSound(5); l.damage(1000); } } } } if(dist <= range * 2) if(res != null) { if((int)dist == 0) dist = 1; res.damage(damage/(int)dist); } } }
2,197
0.495676
0.477469
79
26.810127
18.248688
89
false
false
0
0
0
0
0
0
0.607595
false
false
10
0f6f0fade29e56d6966c8fae81123ed7bf66530b
26,362,509,291,345
e4e2265d9525c1a9ed1bfc04b96b2438ba53096c
/FinalGUI/src/logic/AreaTree.java
b7e5089651354763c2f8206c3d040b9ae4dec596
[]
no_license
saiwaiyanyu/da-chuan
https://github.com/saiwaiyanyu/da-chuan
e61b53effd5d7828de3f129de9187f4faf1de7db
052f92a20a33e48345f61439e708c75fe2d9855c
refs/heads/master
2017-06-15T18:25:29.516000
2014-12-29T13:23:10
2014-12-29T13:23:10
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package logic; import java.util.ArrayList; import java.util.Iterator; import java.lang.reflect.*; class Node { public String feature; public Node father; public ArrayList<Node> children; public ArrayList<String> sentiment; public ArrayList<String> similarity; public String proParameter; public float frequency; public String realSentiment; public float polarity; public String proName; public Node(String feature){ this.feature = feature; father = null; children = new ArrayList<Node>(); sentiment = new ArrayList<String>(); similarity = new ArrayList<String>(); frequency = (float)0.0; polarity = (float)0.0; } public String toString(){ return "this Node is "+ feature + "|" + realSentiment + " polarity is " + String.valueOf(polarity); } public void setProParameter(String parameter){ this.proParameter = new String(parameter); } public String getFeature(){ return this.feature; } public void setProName(String name){ this.proName = new String(name); } } public class AreaTree { public Node root; public static void main(String[] args) { AreaTree tree = new AreaTree(); tree.insertNode(new Node("�ֻ�")); tree.insertNode(new Node("��Ļ"), "�ֻ�");//- tree.insertNode(new Node("Ӳ��"), "�ֻ�"); tree.insertNode(new Node("���"), "�ֻ�"); tree.insertNode(new Node("�ʸ�"), "��Ļ");//- tree.insertNode(new Node("���"), "Ӳ��"); tree.insertNode(new Node("����"), "���"); tree.insertNode(new Node("����"), "��Ļ");//- tree.display(); tree.deleteNode("��Ļ"); try { tree.reset("Ӳ��", "realSentiment", "����"); tree.reset("Ӳ��", "polarity", (float)0.89); tree.display(); } catch (SecurityException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } } //reset attribution public boolean reset(String feature, String attribution, Object o) throws SecurityException, ClassNotFoundException, IllegalArgumentException, IllegalAccessException{ Node current = findNode(feature); if(current == null){ System.out.println("reset error: no find node " + feature); return false; } else{ try { Field[] fds = Class.forName("logic.Node").getDeclaredFields(); if(attribution.equals("children")){ ((ArrayList<Node>)fds[2].get(current)).add((Node)o); return true; }else if(attribution.equals("realSentiment")){ fds[6].set(current, o); return true; }else if(attribution.equals("similarity")){ ((ArrayList<String>)fds[4].get(current)).add((String)o); return true; }else if(attribution.equals("frequency")){ fds[5].setFloat(current, (Float)o); return true; }else if(attribution.equals("polarity")){ fds[7].setFloat(current, (Float)o); return true; } } catch (Throwable e) { System.err.println(e); } } return false; } //show tree public void display(){ System.out.println("Tree:"); display(root); } private void display(Node node){ Node current = node; if(current == null) return; System.out.println(current.toString()); for (Node child : current.children) { display(child); } } //find from root//���ܻ������ public Node findNode(String feature){ Node current = findNode(root, feature); return current; } //find by find private Node findNode(Node node, String feature){ Node current = node; //дһ������ǰ���ĸ����������������������� //����ܿ���ֻ����һ������ģ��������ж������� if(current == null || node.feature.equals(feature)) return current; for (Node child : current.children) { current = findNode(child, feature); if(current != null) return current; } return null; } private boolean isEquals(String reviewFeature,Node m){ ArrayList<String> similars = m.similarity;//��û����m�����ͬ���� //�����Ȳ����ͬ���㣬ֱ�Ӳ�����������û�а���� if(reviewFeature.equals(m.feature)||m.feature.equals(reviewFeature)){ //professionInfo[i][0].replace(current, m.feature); System.out.println(reviewFeature +" equals" +"Node "+m.feature); return true; } Iterator it = similars.iterator(); while(it.hasNext()){ String current = (String)it.next(); if(reviewFeature.equals(current)||m.feature.equals(current)){ //professionInfo[i][0].replace(current, m.feature); return true; } } return false; } //insert root public void insertNode(Node node){ if(root == null) root = node; else System.out.println("insert error: already exist root"); } //insert children public void insertNode(Node node, String father){ Node current = findNode(father); if(current == null) System.out.println("insert error: no find father node " + father); else{ current.children.add(node); node.father = current; } } //delete public boolean deleteNode(String feature){ Node current = findNode(feature); if(current == null){ System.out.println("delete error: no find node " + feature); return false; } else if(feature == root.feature) root = null; else{ current.father.children.remove(current); current = null; } return true; } }
UTF-8
Java
5,552
java
AreaTree.java
Java
[]
null
[]
package logic; import java.util.ArrayList; import java.util.Iterator; import java.lang.reflect.*; class Node { public String feature; public Node father; public ArrayList<Node> children; public ArrayList<String> sentiment; public ArrayList<String> similarity; public String proParameter; public float frequency; public String realSentiment; public float polarity; public String proName; public Node(String feature){ this.feature = feature; father = null; children = new ArrayList<Node>(); sentiment = new ArrayList<String>(); similarity = new ArrayList<String>(); frequency = (float)0.0; polarity = (float)0.0; } public String toString(){ return "this Node is "+ feature + "|" + realSentiment + " polarity is " + String.valueOf(polarity); } public void setProParameter(String parameter){ this.proParameter = new String(parameter); } public String getFeature(){ return this.feature; } public void setProName(String name){ this.proName = new String(name); } } public class AreaTree { public Node root; public static void main(String[] args) { AreaTree tree = new AreaTree(); tree.insertNode(new Node("�ֻ�")); tree.insertNode(new Node("��Ļ"), "�ֻ�");//- tree.insertNode(new Node("Ӳ��"), "�ֻ�"); tree.insertNode(new Node("���"), "�ֻ�"); tree.insertNode(new Node("�ʸ�"), "��Ļ");//- tree.insertNode(new Node("���"), "Ӳ��"); tree.insertNode(new Node("����"), "���"); tree.insertNode(new Node("����"), "��Ļ");//- tree.display(); tree.deleteNode("��Ļ"); try { tree.reset("Ӳ��", "realSentiment", "����"); tree.reset("Ӳ��", "polarity", (float)0.89); tree.display(); } catch (SecurityException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } } //reset attribution public boolean reset(String feature, String attribution, Object o) throws SecurityException, ClassNotFoundException, IllegalArgumentException, IllegalAccessException{ Node current = findNode(feature); if(current == null){ System.out.println("reset error: no find node " + feature); return false; } else{ try { Field[] fds = Class.forName("logic.Node").getDeclaredFields(); if(attribution.equals("children")){ ((ArrayList<Node>)fds[2].get(current)).add((Node)o); return true; }else if(attribution.equals("realSentiment")){ fds[6].set(current, o); return true; }else if(attribution.equals("similarity")){ ((ArrayList<String>)fds[4].get(current)).add((String)o); return true; }else if(attribution.equals("frequency")){ fds[5].setFloat(current, (Float)o); return true; }else if(attribution.equals("polarity")){ fds[7].setFloat(current, (Float)o); return true; } } catch (Throwable e) { System.err.println(e); } } return false; } //show tree public void display(){ System.out.println("Tree:"); display(root); } private void display(Node node){ Node current = node; if(current == null) return; System.out.println(current.toString()); for (Node child : current.children) { display(child); } } //find from root//���ܻ������ public Node findNode(String feature){ Node current = findNode(root, feature); return current; } //find by find private Node findNode(Node node, String feature){ Node current = node; //дһ������ǰ���ĸ����������������������� //����ܿ���ֻ����һ������ģ��������ж������� if(current == null || node.feature.equals(feature)) return current; for (Node child : current.children) { current = findNode(child, feature); if(current != null) return current; } return null; } private boolean isEquals(String reviewFeature,Node m){ ArrayList<String> similars = m.similarity;//��û����m�����ͬ���� //�����Ȳ����ͬ���㣬ֱ�Ӳ�����������û�а���� if(reviewFeature.equals(m.feature)||m.feature.equals(reviewFeature)){ //professionInfo[i][0].replace(current, m.feature); System.out.println(reviewFeature +" equals" +"Node "+m.feature); return true; } Iterator it = similars.iterator(); while(it.hasNext()){ String current = (String)it.next(); if(reviewFeature.equals(current)||m.feature.equals(current)){ //professionInfo[i][0].replace(current, m.feature); return true; } } return false; } //insert root public void insertNode(Node node){ if(root == null) root = node; else System.out.println("insert error: already exist root"); } //insert children public void insertNode(Node node, String father){ Node current = findNode(father); if(current == null) System.out.println("insert error: no find father node " + father); else{ current.children.add(node); node.father = current; } } //delete public boolean deleteNode(String feature){ Node current = findNode(feature); if(current == null){ System.out.println("delete error: no find node " + feature); return false; } else if(feature == root.feature) root = null; else{ current.father.children.remove(current); current = null; } return true; } }
5,552
0.647909
0.645211
192
26.03125
18.940395
101
false
false
0
0
0
0
0
0
2.713542
false
false
10
4bbe300f78410080bdd7e8109352b32a9d79d1ed
31,190,052,529,403
d985d5a9d34bfcfb06f39350a2fc6e8c3100181d
/events-imap/src/main/java/sarf/automation/events/imap/IMAPEventSource.java
9a94442727fe500ea6172059c8384b45f6d1be16
[]
no_license
sarf/java-automation
https://github.com/sarf/java-automation
c0d135ad0418bb59f14b77f7dc59498aa0858d19
e8828ea26f8826fe248923aeb4681a4b532a1b20
refs/heads/master
2022-02-24T00:55:05.397000
2019-08-18T19:36:16
2019-08-18T19:36:16
198,096,338
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package sarf.automation.events.imap; public interface IMAPEventSource extends AutoCloseable { @Override void close() throws IMAPException; void connect() throws IMAPException; sarf.automation.events.imap.config.IMAPConfig getConfig(); void addSourceListener(IMAPEventSourceListener sourceListener); void removeSourceListener(IMAPEventSourceListener sourceListener); }
UTF-8
Java
386
java
IMAPEventSource.java
Java
[]
null
[]
package sarf.automation.events.imap; public interface IMAPEventSource extends AutoCloseable { @Override void close() throws IMAPException; void connect() throws IMAPException; sarf.automation.events.imap.config.IMAPConfig getConfig(); void addSourceListener(IMAPEventSourceListener sourceListener); void removeSourceListener(IMAPEventSourceListener sourceListener); }
386
0.816062
0.816062
15
24.733334
26.541708
68
false
false
0
0
0
0
0
0
0.4
false
false
10
6f56d81df80c0c5e676eb0ce5aa55f5cb1a2bb47
31,782,758,045,664
82f49eb473485390eb5d74343abf00e245bbb57d
/src/main/java/com/slokam/Harish/MyProject.java
d25fc5b6b1ec9b4164772ddd98a7f74e14f8ec1f
[]
no_license
bharath411/backenddb
https://github.com/bharath411/backenddb
9cc5a478baa9ee16dbaf1a4627bdb3e7dd70b97f
6a13fc7ddd18eb00e5359b406d6529ff3e6d7268
refs/heads/master
2022-07-11T14:04:46.016000
2021-01-22T01:56:43
2021-01-22T01:56:43
129,484,640
0
22
null
false
2022-06-20T23:10:06
2018-04-14T05:21:58
2021-01-22T01:56:47
2022-06-20T23:10:03
29,170
0
16
2
Java
false
false
package com.slokam.Harish; public class MyProject { public static void main(String[] args) { System.out.println("Work Completed and done"); } }
UTF-8
Java
163
java
MyProject.java
Java
[]
null
[]
package com.slokam.Harish; public class MyProject { public static void main(String[] args) { System.out.println("Work Completed and done"); } }
163
0.662577
0.662577
9
16.111111
17.984219
48
false
false
0
0
0
0
0
0
1
false
false
10
05b2d14cfbe8de5c4e37c5279f5b0b0320965c38
13,451,837,601,164
20512527ae87759c98bd26100e1800c34576bd34
/src/main/java/example/GuessNumber.java
45de648af0e15ba0afbd216994627cf039838cbc
[]
no_license
Leewansze/unit-test-comprehensive-2020-7-23
https://github.com/Leewansze/unit-test-comprehensive-2020-7-23
f513c94df16eb2685b7134374193f875ac97b5d6
f49104f32866b80a2ba1f79f0f1824fb38b68108
refs/heads/master
2022-11-21T15:41:05.858000
2020-07-23T15:21:00
2020-07-23T15:21:00
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package example; import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class GuessNumber { public String guess(int[] guessNum, int[] answer) { int answerIndex; int guessIndex; int countA = 0; int countB = 0; String result; List<Integer> answerList = new ArrayList<>(); List<Integer> guessList = new ArrayList<>(); for(int i = 0; i< answer.length; i++){ answerList.add(answer[i]); } for(int i = 0; i< guessNum.length; i++){ guessList.add(guessNum[i]); } for(int i = 0; i < guessNum.length; i++){ if(answerList.contains(guessList.get(i))){ answerIndex = answerList.indexOf(answerList.get(i)); guessIndex = guessList.indexOf(guessList.get(i)); if(answerIndex == guessIndex){ countA++; }else{ countB++; } } } result = String.format("%dA%dB", countA, countB); return result; } public boolean isLegalGuessNum(int[] number){ if(number.length != 4){ return false; } for(int index = 0; index < number.length; index++){ if(number[index] < 0 || number[index] > 9){ return false; } } return true; } public int[] inputFromScreen(){ int inputGuessNumber[] = new int[4]; Scanner sc = new Scanner(System.in); for(int i = 0; i < inputGuessNumber.length; i++){ inputGuessNumber[i] = sc.nextInt(); } return inputGuessNumber; } public static void main(String[] args) { GuessNumber gn = new GuessNumber(); int arr[] = gn.inputFromScreen(); gn.isLegalGuessNum(arr); } }
UTF-8
Java
1,873
java
GuessNumber.java
Java
[]
null
[]
package example; import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class GuessNumber { public String guess(int[] guessNum, int[] answer) { int answerIndex; int guessIndex; int countA = 0; int countB = 0; String result; List<Integer> answerList = new ArrayList<>(); List<Integer> guessList = new ArrayList<>(); for(int i = 0; i< answer.length; i++){ answerList.add(answer[i]); } for(int i = 0; i< guessNum.length; i++){ guessList.add(guessNum[i]); } for(int i = 0; i < guessNum.length; i++){ if(answerList.contains(guessList.get(i))){ answerIndex = answerList.indexOf(answerList.get(i)); guessIndex = guessList.indexOf(guessList.get(i)); if(answerIndex == guessIndex){ countA++; }else{ countB++; } } } result = String.format("%dA%dB", countA, countB); return result; } public boolean isLegalGuessNum(int[] number){ if(number.length != 4){ return false; } for(int index = 0; index < number.length; index++){ if(number[index] < 0 || number[index] > 9){ return false; } } return true; } public int[] inputFromScreen(){ int inputGuessNumber[] = new int[4]; Scanner sc = new Scanner(System.in); for(int i = 0; i < inputGuessNumber.length; i++){ inputGuessNumber[i] = sc.nextInt(); } return inputGuessNumber; } public static void main(String[] args) { GuessNumber gn = new GuessNumber(); int arr[] = gn.inputFromScreen(); gn.isLegalGuessNum(arr); } }
1,873
0.517886
0.512013
65
27.815384
19.314318
68
false
false
0
0
0
0
0
0
0.676923
false
false
10
05573cc7d8b2e6da048c45a32c2bcf3a617e5237
25,177,098,326,653
cab29a44dc8c5b3c20ab0f90482ad68eddd6f043
/chapter_104/servlets_crud/src/test/java/ru/job4j/crud/servlets/UserCreateServletTest.java
e1e5bbf3e5a7a1002e6411712614adec6700f152
[ "Apache-2.0" ]
permissive
Fireserdg/job4j
https://github.com/Fireserdg/job4j
67338058d2c6cfd54ca811257c502eb46dee8c34
e7988f4f40acef10c7705155ea07354eb807cfcd
refs/heads/master
2021-04-15T08:06:07.864000
2019-04-20T09:36:27
2019-04-20T09:36:27
126,675,052
1
2
null
null
null
null
null
null
null
null
null
null
null
null
null
package ru.job4j.crud.servlets; import org.junit.Test; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import java.io.IOException; import static org.mockito.Mockito.*; import static org.powermock.api.mockito.PowerMockito.mock; /** * User create Servlet test. * * @author Sergey Filippov (serdg1984@yandex.ru). * @version 1.0. * @since 12.12.18 */ public class UserCreateServletTest { @Test public void whenDoPostThenDoGetAndGetRequestDispatcher() throws ServletException, IOException { String path = "/WEB-INF/view/create.jsp"; HttpServletRequest req = mock(HttpServletRequest.class); HttpServletResponse resp = mock(HttpServletResponse.class); HttpSession session = mock(HttpSession.class); RequestDispatcher dispatcher = mock(RequestDispatcher.class); when(req.getSession()).thenReturn(session); when(session.getAttribute("login")).thenReturn("login"); when(req.getRequestDispatcher(path)).thenReturn(dispatcher); new UserCreateServlet().doPost(req, resp); verify(dispatcher, times(1)).forward(req, resp); verify(req, times(1)).getSession(); } }
UTF-8
Java
1,321
java
UserCreateServletTest.java
Java
[ { "context": "k;\n\n/**\n * User create Servlet test.\n *\n * @author Sergey Filippov (serdg1984@yandex.ru).\n * @version 1.0.\n * @since", "end": 456, "score": 0.9998672604560852, "start": 441, "tag": "NAME", "value": "Sergey Filippov" }, { "context": "eate Servlet test.\n *\n * @author Sergey Filippov (serdg1984@yandex.ru).\n * @version 1.0.\n * @since 12.12.18\n */\npublic ", "end": 477, "score": 0.9999279975891113, "start": 458, "tag": "EMAIL", "value": "serdg1984@yandex.ru" } ]
null
[]
package ru.job4j.crud.servlets; import org.junit.Test; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import java.io.IOException; import static org.mockito.Mockito.*; import static org.powermock.api.mockito.PowerMockito.mock; /** * User create Servlet test. * * @author <NAME> (<EMAIL>). * @version 1.0. * @since 12.12.18 */ public class UserCreateServletTest { @Test public void whenDoPostThenDoGetAndGetRequestDispatcher() throws ServletException, IOException { String path = "/WEB-INF/view/create.jsp"; HttpServletRequest req = mock(HttpServletRequest.class); HttpServletResponse resp = mock(HttpServletResponse.class); HttpSession session = mock(HttpSession.class); RequestDispatcher dispatcher = mock(RequestDispatcher.class); when(req.getSession()).thenReturn(session); when(session.getAttribute("login")).thenReturn("login"); when(req.getRequestDispatcher(path)).thenReturn(dispatcher); new UserCreateServlet().doPost(req, resp); verify(dispatcher, times(1)).forward(req, resp); verify(req, times(1)).getSession(); } }
1,300
0.733535
0.72218
38
33.789474
25.370058
99
false
false
0
0
0
0
0
0
0.684211
false
false
10
ef798e67362facdf1eb64533e584414f68b8a68b
27,444,841,065,957
7bc6ee6793d614a4fcbb668cd2f6b25a74ef5a15
/sft-server/src/main/java/com/aaron/rpc/server/HelloServiceImpl.java
8bda6fcd802708dbf337993d4ba15dd9cf870310
[]
no_license
hAaron/tl_rpc
https://github.com/hAaron/tl_rpc
b11835f08f2832e48fca08bddd58707f6100c32c
12394835fd0f764bb721a6ec327ec57eaafc224a
refs/heads/master
2020-04-02T16:37:20.919000
2018-10-31T02:47:05
2018-10-31T02:47:05
154,620,889
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.aaron.rpc.server; import com.aaron.rpc.api.dto.Person; import com.aaron.rpc.api.service.HelloService; import com.aaron.tools.rpc.server.RpcService; @RpcService(HelloService.class) public class HelloServiceImpl implements HelloService { @Override public String hello(String name) { return "Hello! " + name; } @Override public String hello(Person person) { return "Hello! " + person.getFirstName() + " " + person.getLastName(); } }
UTF-8
Java
486
java
HelloServiceImpl.java
Java
[]
null
[]
package com.aaron.rpc.server; import com.aaron.rpc.api.dto.Person; import com.aaron.rpc.api.service.HelloService; import com.aaron.tools.rpc.server.RpcService; @RpcService(HelloService.class) public class HelloServiceImpl implements HelloService { @Override public String hello(String name) { return "Hello! " + name; } @Override public String hello(Person person) { return "Hello! " + person.getFirstName() + " " + person.getLastName(); } }
486
0.697531
0.697531
19
24.578947
22.155706
78
false
false
0
0
0
0
0
0
0.315789
false
false
10
4cfc046b17879fac6fc8645a8db7aaa52ba03a14
22,462,679,011,017
5ddcf95e2dfb3fd33a16caa1208361e005c198b0
/question_1_2/src/com/company/knapsacktest.java
64a738d77a9dbee694a80e7818783cb4afa71eeb
[]
no_license
anibharadva/i-mcodeset
https://github.com/anibharadva/i-mcodeset
9b1d4de590396175a805b2b3cfaf081eda96f057
ca597b0fac80d3dbd4c48a1e2a1408d97197c31d
refs/heads/master
2022-12-04T11:01:57.480000
2020-08-25T19:17:16
2020-08-25T19:17:16
290,273,416
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.company; import org.junit.Assert; /** * Anita * 8/23/2020 */ public class knapsacktest { @org.junit.Test public void Test1() throws Exception{ int val[] = {10, 40, 30, 50}; int wt[] = {5, 4, 6, 4}; int W = 10; int result; int expected=90; knapsack clsknapsack = new knapsack(); result= clsknapsack.knapsack(val,wt,W); Assert.assertEquals(expected,result); } @org.junit.Test public void Test2() throws Exception{ int val[] = {10, 50, 30, 50}; int wt[] = {5, 8, 6, 4}; int W = 12; int result; int expected=100; knapsack clsknapsack = new knapsack(); result= clsknapsack.knapsack(val,wt,W); Assert.assertEquals(expected,result); } }
UTF-8
Java
806
java
knapsacktest.java
Java
[ { "context": "age com.company;\n\nimport org.junit.Assert;\n\n/**\n * Anita\n * 8/23/2020\n */\n\npublic class knapsacktest {\n ", "end": 60, "score": 0.9965673089027405, "start": 55, "tag": "NAME", "value": "Anita" } ]
null
[]
package com.company; import org.junit.Assert; /** * Anita * 8/23/2020 */ public class knapsacktest { @org.junit.Test public void Test1() throws Exception{ int val[] = {10, 40, 30, 50}; int wt[] = {5, 4, 6, 4}; int W = 10; int result; int expected=90; knapsack clsknapsack = new knapsack(); result= clsknapsack.knapsack(val,wt,W); Assert.assertEquals(expected,result); } @org.junit.Test public void Test2() throws Exception{ int val[] = {10, 50, 30, 50}; int wt[] = {5, 8, 6, 4}; int W = 12; int result; int expected=100; knapsack clsknapsack = new knapsack(); result= clsknapsack.knapsack(val,wt,W); Assert.assertEquals(expected,result); } }
806
0.552109
0.5
38
20.210526
16.84005
48
false
false
0
0
0
0
0
0
0.947368
false
false
10
6be8e6bfda400014a7f53e9c0a1df7af5b1a6bd3
33,097,018,011,554
3fd6728afb251d3cf87f7f4ccc8290c1967cb6b1
/app/src/main/java/com/example/pc_samir/exemplosmatriz/fragment/MatrixColorFragment.java
cc6fb3f75529498aed13e8965b7edcf37e2425e6
[]
no_license
samirferraz/Mestrado
https://github.com/samirferraz/Mestrado
8e4e24da5ca0a90661f113f351714aae34186bb8
a61e1b031831419d379e3bbb974e9d2e18ad44ed
refs/heads/master
2021-01-20T19:05:17.342000
2017-02-23T03:40:06
2017-02-23T03:40:06
62,589,761
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.pc_samir.exemplosmatriz.fragment; import android.graphics.Color; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.example.pc_samir.exemplosmatriz.logic.Calculator; import com.example.pc_samir.exemplosmatriz.view.MatrixColorView; /** * Created by Pc-Samir on 16/08/2016. */ public class MatrixColorFragment extends Fragment { private MatrixColorView viewMatrix; private Calculator calculator; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { viewMatrix = new MatrixColorView(inflater.getContext()); if (calculator != null) printOnMatrixView(calculator.getV().getArray()); return viewMatrix; } private void printOnMatrixView(double[][] arr) { int[][] mtx = new int[arr.length][arr[0].length]; for (int i = 0; i < mtx.length; i++) { for (int j = 0; j < mtx[i].length; j++) { int i1 = 255 - (int)(arr[i][j] * 255/.085); mtx[i][j] = Color.argb(i1, 255,0,0); Log.d("Color: "+ i + "," + j, Integer.toHexString(mtx[i][j])); } } viewMatrix.setColors(mtx); } public void setCalculator(Calculator calculator) { this.calculator = calculator; if (viewMatrix != null) printOnMatrixView(calculator.getV().getArray()); } }
UTF-8
Java
1,628
java
MatrixColorFragment.java
Java
[ { "context": "losmatriz.view.MatrixColorView;\n\n/**\n * Created by Pc-Samir on 16/08/2016.\n */\npublic class MatrixColorFragme", "end": 468, "score": 0.9967309832572937, "start": 460, "tag": "USERNAME", "value": "Pc-Samir" } ]
null
[]
package com.example.pc_samir.exemplosmatriz.fragment; import android.graphics.Color; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.example.pc_samir.exemplosmatriz.logic.Calculator; import com.example.pc_samir.exemplosmatriz.view.MatrixColorView; /** * Created by Pc-Samir on 16/08/2016. */ public class MatrixColorFragment extends Fragment { private MatrixColorView viewMatrix; private Calculator calculator; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { viewMatrix = new MatrixColorView(inflater.getContext()); if (calculator != null) printOnMatrixView(calculator.getV().getArray()); return viewMatrix; } private void printOnMatrixView(double[][] arr) { int[][] mtx = new int[arr.length][arr[0].length]; for (int i = 0; i < mtx.length; i++) { for (int j = 0; j < mtx[i].length; j++) { int i1 = 255 - (int)(arr[i][j] * 255/.085); mtx[i][j] = Color.argb(i1, 255,0,0); Log.d("Color: "+ i + "," + j, Integer.toHexString(mtx[i][j])); } } viewMatrix.setColors(mtx); } public void setCalculator(Calculator calculator) { this.calculator = calculator; if (viewMatrix != null) printOnMatrixView(calculator.getV().getArray()); } }
1,628
0.652948
0.635749
52
30.307692
26.275566
123
false
false
0
0
0
0
0
0
0.653846
false
false
10
322d1ff8d5d3cd5819848295c117556376d24355
2,551,210,616,318
dc099bbc576a04ee763bfa223152cdfa09ca4e19
/src/main/java/core/validate/SaveResetValidate.java
9faeda3313bea795769e038621fc67c24b195cbe
[]
no_license
422394225/takeaway
https://github.com/422394225/takeaway
f6adfb6cbf7c289048434f88ee5f4b3b96f43af6
fc9b10a34445efbe60aa0a52e3c8a6e52e4a723b
refs/heads/master
2021-01-17T17:10:23.243000
2017-09-25T11:20:10
2017-09-25T11:20:10
95,456,077
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * Created At 2017年2月17日上午2:20:00 * */ package core.validate; import com.jfinal.core.Controller; import com.jfinal.render.JsonRender; import core.validate.base.ShortCircuitValidate; /** * Description: * * @author weifaguo * @date 2017年2月17日上午2:20:00 */ public class SaveResetValidate extends ShortCircuitValidate { @Override protected void validate(Controller c) { validateRequired("newPassword", "msg", "请输入您的密码"); validateRequired("password", "msg", "请输入您的密码"); validateEqualField("newPassword", "password", "msg", "两次输入不一致"); } @Override protected void handleError(Controller c) { c.setAttr("error", true); c.render(new JsonRender().forIE()); } }
UTF-8
Java
785
java
SaveResetValidate.java
Java
[ { "context": "Validate;\r\n\r\n/**\r\n * Description:\r\n * \r\n * @author weifaguo\r\n * @date 2017年2月17日上午2:20:00\r\n */\r\n\r\npublic clas", "end": 252, "score": 0.9996539354324341, "start": 244, "tag": "USERNAME", "value": "weifaguo" } ]
null
[]
/** * Created At 2017年2月17日上午2:20:00 * */ package core.validate; import com.jfinal.core.Controller; import com.jfinal.render.JsonRender; import core.validate.base.ShortCircuitValidate; /** * Description: * * @author weifaguo * @date 2017年2月17日上午2:20:00 */ public class SaveResetValidate extends ShortCircuitValidate { @Override protected void validate(Controller c) { validateRequired("newPassword", "msg", "请输入您的密码"); validateRequired("password", "msg", "请输入您的密码"); validateEqualField("newPassword", "password", "msg", "两次输入不一致"); } @Override protected void handleError(Controller c) { c.setAttr("error", true); c.render(new JsonRender().forIE()); } }
785
0.679115
0.64592
35
18.657143
20.339888
66
false
false
0
0
0
0
0
0
0.942857
false
false
10
af57a6fa930f3bf835811f9d9f324409d9ae3594
36,876,589,216,466
6ef4869c6bc2ce2e77b422242e347819f6a5f665
/devices/google/Pixel 2/29/QPP6.190730.005/src/core-oj/java/nio/channels/UnresolvedAddressException.java
79dbc09f4ec6ff477d058abfc843bb6dbc7819d0
[]
no_license
hacking-android/frameworks
https://github.com/hacking-android/frameworks
40e40396bb2edacccabf8a920fa5722b021fb060
943f0b4d46f72532a419fb6171e40d1c93984c8e
refs/heads/master
2020-07-03T19:32:28.876000
2019-08-13T03:31:06
2019-08-13T03:31:06
202,017,534
2
0
null
false
2019-08-13T03:33:19
2019-08-12T22:19:30
2019-08-13T03:31:53
2019-08-13T03:33:18
63,898
0
0
0
Java
false
false
/* * Decompiled with CFR 0.145. */ package java.nio.channels; public class UnresolvedAddressException extends IllegalArgumentException { private static final long serialVersionUID = 6136959093620794148L; }
UTF-8
Java
214
java
UnresolvedAddressException.java
Java
[]
null
[]
/* * Decompiled with CFR 0.145. */ package java.nio.channels; public class UnresolvedAddressException extends IllegalArgumentException { private static final long serialVersionUID = 6136959093620794148L; }
214
0.78972
0.682243
9
22.666666
22.320892
70
false
false
0
0
0
0
0
0
0.222222
false
false
10
a48b9ba6da6ccfb7ead4bb176094ac921f6b97be
36,876,589,216,264
354e2c91f85f5417815b2e56e44ee26001d1cb85
/app/src/main/java/com/zhongyaogang/activity/WoDeFaBuActivity.java
e477a7ee9c8808ab1f88cbf055673f1e39f7cc0c
[]
no_license
shanlinxiaolieren/zhongyaogang
https://github.com/shanlinxiaolieren/zhongyaogang
305b81e6e02450aa41701fbb4dd83eef329d06a2
573a77ed90a3ffda07d449c533395d0ba37503be
refs/heads/master
2021-01-19T18:18:13.274000
2017-09-18T00:37:46
2017-09-18T01:34:44
101,121,472
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.zhongyaogang.activity; //import com.zhongyaogang.adapter.FragmentAdapter; import com.zhongyaogang.R; import com.zhongyaogang.fragment.GongQiu; import com.zhongyaogang.fragment.GongQiuQiu; import android.content.Intent; import android.content.SharedPreferences; import android.graphics.drawable.ColorDrawable; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentTransaction; import android.support.v4.view.ViewPager; import android.view.View; import android.view.Window; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.ImageView; import android.widget.PopupWindow; import android.widget.TextView; public class WoDeFaBuActivity extends FragmentActivity implements OnClickListener{ private TextView index_search_yaocaiwang; private ImageView wodezhongxin_left; private ImageView wodezhongxin_right; private WoDeFaBuActivity act; private GongQiu gong; private GongQiuQiu qiu; private TextView gonggong; private TextView qiuqiu; /** * ViewPager的当前选中页 */ private ViewPager mPageVp; private SharedPreferences sp; private String sharedusernameid; private String name; private String namephone; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //去除掉当前activity头title requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_wo_de_fa_bu); act=this; intView(); } /** 添加Fragment **/ public void addFragment(Fragment fragment) { FragmentTransaction ft = this.getSupportFragmentManager().beginTransaction(); ft.add(R.id.show_cart_view, fragment); ft.commitAllowingStateLoss(); } /** 删除Fragment **/ public void removeFragment(Fragment fragment) { FragmentTransaction ft = this.getSupportFragmentManager().beginTransaction(); ft.remove(fragment); ft.commitAllowingStateLoss(); } /** 显示Fragment **/ public void showFragment(Fragment fragment) { FragmentTransaction ft = this.getSupportFragmentManager().beginTransaction(); if (gong != null) { ft.hide(gong); } if (qiu != null) { ft.hide(qiu); } ft.show(fragment); ft.commitAllowingStateLoss(); } private void intView() { index_search_yaocaiwang=(TextView) findViewById(R.id.index_search_yaocaiwang); gonggong=(TextView) findViewById(R.id.textview_gong); qiuqiu=(TextView) findViewById(R.id.textview_qiu); index_search_yaocaiwang=(TextView) findViewById(R.id.index_search_yaocaiwang); index_search_yaocaiwang.setText("我的发布"); mPageVp = (ViewPager) findViewById(R.id.id_page_vp); wodezhongxin_left = (ImageView) findViewById(R.id.wodezhongxin_left); wodezhongxin_right = (ImageView) findViewById(R.id.wodezhongxin_right); gonggong.setOnClickListener(this); qiuqiu.setOnClickListener(this); wodezhongxin_left.setOnClickListener(this); wodezhongxin_right.setOnClickListener(this); gong=new GongQiu(); addFragment(gong); showFragment(gong); sp = this.getSharedPreferences("config", 0); sharedusernameid = sp.getString("usernameid", ""); // name=sp.getString("username", ""); // namephone=sp.getString("usernamephone", ""); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.wodezhongxin_left: finish(); break; case R.id.wodezhongxin_right: showPopwindowMenu(v); break; case R.id.textview_gong: if (gong == null) { gong = new GongQiu(); addFragment(gong); showFragment(gong); } else { showFragment(gong); } gonggong.setBackgroundColor(getResources().getColor(R.color.gong)); qiuqiu.setBackgroundColor(getResources().getColor(R.color.qiu)); break; case R.id.textview_qiu: if (qiu == null) { qiu = new GongQiuQiu(); addFragment(qiu); showFragment(qiu); } else { showFragment(qiu); } qiuqiu.setBackgroundColor(getResources().getColor(R.color.gong)); gonggong.setBackgroundColor(getResources().getColor(R.color.qiu)); break; } } private void showPopwindowMenu(View parent) { View popView = View.inflate(act, R.layout.right_pop_menu, null); Button btnCamera = (Button) popView.findViewById(R.id.btn_camera_pop_camera); Button btnAlbum = (Button) popView.findViewById(R.id.btn_camera_pop_album); int width = getResources().getDisplayMetrics().widthPixels; int height = getResources().getDisplayMetrics().heightPixels; final PopupWindow popWindow = new PopupWindow(popView,width,height); popWindow.setAnimationStyle(R.style.AnimBottom); popWindow.setFocusable(true); popWindow.setOutsideTouchable(false);// 设置允许在外点击消失 OnClickListener listener = new OnClickListener() { public void onClick(View v) { switch (v.getId()) { case R.id.btn_camera_pop_camera: Intent intent=new Intent(act,MainActivity.class); intent.putExtra("contentid", 1); startActivity(intent); WoDeFaBuActivity.this.finish(); break; case R.id.btn_camera_pop_album: startActivity(new Intent(act, WoDeXiaoXiActivity.class)); break; } popWindow.dismiss(); } }; btnCamera.setOnClickListener(listener); btnAlbum.setOnClickListener(listener); ColorDrawable dw = new ColorDrawable(0x30000000); popWindow.setBackgroundDrawable(dw); // 设置好参数之后再show popWindow.showAsDropDown(parent,0,20); } }
UTF-8
Java
6,492
java
WoDeFaBuActivity.java
Java
[ { "context": "ig\", 0);\n sharedusernameid = sp.getString(\"usernameid\", \"\");\n//\t\tname=sp.getString(\"username\", \"\");\n//\t", "end": 3451, "score": 0.9634559154510498, "start": 3441, "tag": "USERNAME", "value": "usernameid" }, { "context": "ring(\"username\", \"\");\n//\t\tnamephone=sp.getString(\"usernamephone\", \"\");\n }\n\n @Override\n public void onCli", "end": 3539, "score": 0.9460146427154541, "start": 3526, "tag": "USERNAME", "value": "usernamephone" } ]
null
[]
package com.zhongyaogang.activity; //import com.zhongyaogang.adapter.FragmentAdapter; import com.zhongyaogang.R; import com.zhongyaogang.fragment.GongQiu; import com.zhongyaogang.fragment.GongQiuQiu; import android.content.Intent; import android.content.SharedPreferences; import android.graphics.drawable.ColorDrawable; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentTransaction; import android.support.v4.view.ViewPager; import android.view.View; import android.view.Window; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.ImageView; import android.widget.PopupWindow; import android.widget.TextView; public class WoDeFaBuActivity extends FragmentActivity implements OnClickListener{ private TextView index_search_yaocaiwang; private ImageView wodezhongxin_left; private ImageView wodezhongxin_right; private WoDeFaBuActivity act; private GongQiu gong; private GongQiuQiu qiu; private TextView gonggong; private TextView qiuqiu; /** * ViewPager的当前选中页 */ private ViewPager mPageVp; private SharedPreferences sp; private String sharedusernameid; private String name; private String namephone; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //去除掉当前activity头title requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_wo_de_fa_bu); act=this; intView(); } /** 添加Fragment **/ public void addFragment(Fragment fragment) { FragmentTransaction ft = this.getSupportFragmentManager().beginTransaction(); ft.add(R.id.show_cart_view, fragment); ft.commitAllowingStateLoss(); } /** 删除Fragment **/ public void removeFragment(Fragment fragment) { FragmentTransaction ft = this.getSupportFragmentManager().beginTransaction(); ft.remove(fragment); ft.commitAllowingStateLoss(); } /** 显示Fragment **/ public void showFragment(Fragment fragment) { FragmentTransaction ft = this.getSupportFragmentManager().beginTransaction(); if (gong != null) { ft.hide(gong); } if (qiu != null) { ft.hide(qiu); } ft.show(fragment); ft.commitAllowingStateLoss(); } private void intView() { index_search_yaocaiwang=(TextView) findViewById(R.id.index_search_yaocaiwang); gonggong=(TextView) findViewById(R.id.textview_gong); qiuqiu=(TextView) findViewById(R.id.textview_qiu); index_search_yaocaiwang=(TextView) findViewById(R.id.index_search_yaocaiwang); index_search_yaocaiwang.setText("我的发布"); mPageVp = (ViewPager) findViewById(R.id.id_page_vp); wodezhongxin_left = (ImageView) findViewById(R.id.wodezhongxin_left); wodezhongxin_right = (ImageView) findViewById(R.id.wodezhongxin_right); gonggong.setOnClickListener(this); qiuqiu.setOnClickListener(this); wodezhongxin_left.setOnClickListener(this); wodezhongxin_right.setOnClickListener(this); gong=new GongQiu(); addFragment(gong); showFragment(gong); sp = this.getSharedPreferences("config", 0); sharedusernameid = sp.getString("usernameid", ""); // name=sp.getString("username", ""); // namephone=sp.getString("usernamephone", ""); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.wodezhongxin_left: finish(); break; case R.id.wodezhongxin_right: showPopwindowMenu(v); break; case R.id.textview_gong: if (gong == null) { gong = new GongQiu(); addFragment(gong); showFragment(gong); } else { showFragment(gong); } gonggong.setBackgroundColor(getResources().getColor(R.color.gong)); qiuqiu.setBackgroundColor(getResources().getColor(R.color.qiu)); break; case R.id.textview_qiu: if (qiu == null) { qiu = new GongQiuQiu(); addFragment(qiu); showFragment(qiu); } else { showFragment(qiu); } qiuqiu.setBackgroundColor(getResources().getColor(R.color.gong)); gonggong.setBackgroundColor(getResources().getColor(R.color.qiu)); break; } } private void showPopwindowMenu(View parent) { View popView = View.inflate(act, R.layout.right_pop_menu, null); Button btnCamera = (Button) popView.findViewById(R.id.btn_camera_pop_camera); Button btnAlbum = (Button) popView.findViewById(R.id.btn_camera_pop_album); int width = getResources().getDisplayMetrics().widthPixels; int height = getResources().getDisplayMetrics().heightPixels; final PopupWindow popWindow = new PopupWindow(popView,width,height); popWindow.setAnimationStyle(R.style.AnimBottom); popWindow.setFocusable(true); popWindow.setOutsideTouchable(false);// 设置允许在外点击消失 OnClickListener listener = new OnClickListener() { public void onClick(View v) { switch (v.getId()) { case R.id.btn_camera_pop_camera: Intent intent=new Intent(act,MainActivity.class); intent.putExtra("contentid", 1); startActivity(intent); WoDeFaBuActivity.this.finish(); break; case R.id.btn_camera_pop_album: startActivity(new Intent(act, WoDeXiaoXiActivity.class)); break; } popWindow.dismiss(); } }; btnCamera.setOnClickListener(listener); btnAlbum.setOnClickListener(listener); ColorDrawable dw = new ColorDrawable(0x30000000); popWindow.setBackgroundDrawable(dw); // 设置好参数之后再show popWindow.showAsDropDown(parent,0,20); } }
6,492
0.621647
0.61884
170
36.717648
22.312809
86
false
false
0
0
0
0
0
0
0.747059
false
false
10
2a7de031df7bc463c3346afe1b9d7e85ae785d0c
35,579,509,105,497
684b72b3729aeb96a987531f820b5e8792c5fe94
/demo/src/main/java/com/devbrackets/android/exomediademo/ui/activity/StartupActivity.java
b8b4676a2e70ce6cdfa3763e34aecedb0529240b
[ "Apache-2.0", "CC-BY-4.0" ]
permissive
YangDejie/myD-Player
https://github.com/YangDejie/myD-Player
4fbcaefa5f6b22a7f15a2c8213181062baeeb47c
9f401572a40938f3a573fc680c821c02ab557a3f
refs/heads/master
2016-09-12T22:19:05.623000
2016-05-18T14:59:54
2016-05-18T14:59:54
59,123,649
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.devbrackets.android.exomediademo.ui.activity; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.os.SystemClock; import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import com.devbrackets.android.exomediademo.R; import com.devbrackets.android.exomediademo.adapter.StartupListAdapter; import java.util.ArrayList; import java.util.List; public class StartupActivity extends AppCompatActivity implements AdapterView.OnItemClickListener { private List<ImageView> imageViewContainer = null; /** 上一个被选中的小圆点的索引,默认值为0 */ private int preDotPosition = 0; /** Banner文字描述数组 */ private String[] bannerTextDescArray = { "这是第一张图片", "这是第二张图片", "这是第三章图片", "这是第四张图片", "这是第五张图片" }; /** Banner滚动线程是否销毁的标志,默认不销毁 */ private boolean isStop = false; /** Banner的切换下一个page的间隔时间 */ private long scrollTimeOffset = 3000; private ViewPager viewPager; /** Banner的文字描述显示控件 */ private TextView tvBannerTextDesc; /** 小圆点的父控件 */ private LinearLayout llDotGroup; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.startup_activity); ListView exampleList = (ListView) findViewById(R.id.startup_activity_list); exampleList.setAdapter(new StartupListAdapter(this)); exampleList.setOnItemClickListener(this); initView(); startBannerScrollThread(); } /** * 开启Banner滚动线程 */ private void startBannerScrollThread() { new Thread(new Runnable() { @Override public void run() { while (!isStop) { //每个两秒钟发一条消息到主线程,更新viewpager界面 SystemClock.sleep(scrollTimeOffset); runOnUiThread(new Runnable() { public void run() { int newindex = viewPager.getCurrentItem() + 1; viewPager.setCurrentItem(newindex); } }); } } }).start(); } @Override protected void onDestroy() { //销毁线程 isStop = true; super.onDestroy(); } private void initView() { viewPager = (ViewPager) findViewById(R.id.viewpager); llDotGroup = (LinearLayout) findViewById(R.id.ll_dot_group); tvBannerTextDesc = (TextView) findViewById(R.id.tv_banner_text_desc); imageViewContainer = new ArrayList<ImageView>(); int[] imageIDs = new int[] { R.drawable.banner_pager_1, R.drawable.banner_pager_2, R.drawable.banner_pager_3, R.drawable.banner_pager_4, R.drawable.banner_pager_5, }; ImageView imageView = null; View dot = null; LinearLayout.LayoutParams params = null; for (int id : imageIDs) { imageView = new ImageView(this); imageView.setBackgroundResource(id); imageViewContainer.add(imageView); // 每循环一次添加一个点到线行布局中 dot = new View(this); dot.setBackgroundResource(R.drawable.dot_bg_selector); params = new LinearLayout.LayoutParams(5, 5); params.leftMargin = 10; dot.setEnabled(false); dot.setLayoutParams(params); llDotGroup.addView(dot); // 向线性布局中添加"点" } viewPager.setAdapter(new BannerAdapter()); viewPager.setOnPageChangeListener(new BannerPageChangeListener()); // 选中第一个图片、文字描述 tvBannerTextDesc.setText(bannerTextDescArray[0]); llDotGroup.getChildAt(0).setEnabled(true); viewPager.setCurrentItem(0); } @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { switch (position) { case StartupListAdapter.INDEX_AUDIO_PLAYBACK: showAudioSelectionActivity(); break; case StartupListAdapter.INDEX_VIDEO_PLAYBACK: showVideoSelectionActivity(); break; case 2: showMySite(); break; default: } } private void showMySite() { Intent intent = new Intent(); intent.setAction("android.intent.action.VIEW"); Uri content_url = Uri.parse("http://idejie.com"); intent.setData(content_url); startActivity(intent); } private void showVideoSelectionActivity() { Intent intent = new Intent(this, VideoSelectionActivity.class); startActivity(intent); } private void showAudioSelectionActivity() { Intent intent = new Intent(this, AudioSelectionActivity.class); startActivity(intent); } private class BannerAdapter extends PagerAdapter { @Override public int getCount() { return Integer.MAX_VALUE; } @Override public boolean isViewFromObject(View view, Object object) { return view == object; } @Override public void destroyItem(ViewGroup container, int position, Object object) { container.removeView(imageViewContainer.get(position % imageViewContainer.size())); } @Override public Object instantiateItem(ViewGroup container, final int position) { View view = imageViewContainer.get(position % imageViewContainer.size()); // 为每一个page添加点击事件 view.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(StartupActivity.this, "Page 被点击了"+position, Toast.LENGTH_SHORT).show(); switch (position){ case 0: break; case 1: break; case 2: break; case 3: break; case 4: break; } } }); container.addView(view); return view; } } private class BannerPageChangeListener implements ViewPager.OnPageChangeListener { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageSelected(int position) { // 取余后的索引,得到新的page的索引 int newPositon = position % imageViewContainer.size(); // 根据索引设置图片的描述 tvBannerTextDesc.setText(bannerTextDescArray[newPositon]); // 把上一个点设置为被选中 llDotGroup.getChildAt(preDotPosition).setEnabled(false); // 根据索引设置那个点被选中 llDotGroup.getChildAt(newPositon).setEnabled(true); // 新索引赋值给上一个索引的位置 preDotPosition = newPositon; } @Override public void onPageScrollStateChanged(int state) { } } }
UTF-8
Java
8,038
java
StartupActivity.java
Java
[]
null
[]
package com.devbrackets.android.exomediademo.ui.activity; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.os.SystemClock; import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import com.devbrackets.android.exomediademo.R; import com.devbrackets.android.exomediademo.adapter.StartupListAdapter; import java.util.ArrayList; import java.util.List; public class StartupActivity extends AppCompatActivity implements AdapterView.OnItemClickListener { private List<ImageView> imageViewContainer = null; /** 上一个被选中的小圆点的索引,默认值为0 */ private int preDotPosition = 0; /** Banner文字描述数组 */ private String[] bannerTextDescArray = { "这是第一张图片", "这是第二张图片", "这是第三章图片", "这是第四张图片", "这是第五张图片" }; /** Banner滚动线程是否销毁的标志,默认不销毁 */ private boolean isStop = false; /** Banner的切换下一个page的间隔时间 */ private long scrollTimeOffset = 3000; private ViewPager viewPager; /** Banner的文字描述显示控件 */ private TextView tvBannerTextDesc; /** 小圆点的父控件 */ private LinearLayout llDotGroup; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.startup_activity); ListView exampleList = (ListView) findViewById(R.id.startup_activity_list); exampleList.setAdapter(new StartupListAdapter(this)); exampleList.setOnItemClickListener(this); initView(); startBannerScrollThread(); } /** * 开启Banner滚动线程 */ private void startBannerScrollThread() { new Thread(new Runnable() { @Override public void run() { while (!isStop) { //每个两秒钟发一条消息到主线程,更新viewpager界面 SystemClock.sleep(scrollTimeOffset); runOnUiThread(new Runnable() { public void run() { int newindex = viewPager.getCurrentItem() + 1; viewPager.setCurrentItem(newindex); } }); } } }).start(); } @Override protected void onDestroy() { //销毁线程 isStop = true; super.onDestroy(); } private void initView() { viewPager = (ViewPager) findViewById(R.id.viewpager); llDotGroup = (LinearLayout) findViewById(R.id.ll_dot_group); tvBannerTextDesc = (TextView) findViewById(R.id.tv_banner_text_desc); imageViewContainer = new ArrayList<ImageView>(); int[] imageIDs = new int[] { R.drawable.banner_pager_1, R.drawable.banner_pager_2, R.drawable.banner_pager_3, R.drawable.banner_pager_4, R.drawable.banner_pager_5, }; ImageView imageView = null; View dot = null; LinearLayout.LayoutParams params = null; for (int id : imageIDs) { imageView = new ImageView(this); imageView.setBackgroundResource(id); imageViewContainer.add(imageView); // 每循环一次添加一个点到线行布局中 dot = new View(this); dot.setBackgroundResource(R.drawable.dot_bg_selector); params = new LinearLayout.LayoutParams(5, 5); params.leftMargin = 10; dot.setEnabled(false); dot.setLayoutParams(params); llDotGroup.addView(dot); // 向线性布局中添加"点" } viewPager.setAdapter(new BannerAdapter()); viewPager.setOnPageChangeListener(new BannerPageChangeListener()); // 选中第一个图片、文字描述 tvBannerTextDesc.setText(bannerTextDescArray[0]); llDotGroup.getChildAt(0).setEnabled(true); viewPager.setCurrentItem(0); } @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { switch (position) { case StartupListAdapter.INDEX_AUDIO_PLAYBACK: showAudioSelectionActivity(); break; case StartupListAdapter.INDEX_VIDEO_PLAYBACK: showVideoSelectionActivity(); break; case 2: showMySite(); break; default: } } private void showMySite() { Intent intent = new Intent(); intent.setAction("android.intent.action.VIEW"); Uri content_url = Uri.parse("http://idejie.com"); intent.setData(content_url); startActivity(intent); } private void showVideoSelectionActivity() { Intent intent = new Intent(this, VideoSelectionActivity.class); startActivity(intent); } private void showAudioSelectionActivity() { Intent intent = new Intent(this, AudioSelectionActivity.class); startActivity(intent); } private class BannerAdapter extends PagerAdapter { @Override public int getCount() { return Integer.MAX_VALUE; } @Override public boolean isViewFromObject(View view, Object object) { return view == object; } @Override public void destroyItem(ViewGroup container, int position, Object object) { container.removeView(imageViewContainer.get(position % imageViewContainer.size())); } @Override public Object instantiateItem(ViewGroup container, final int position) { View view = imageViewContainer.get(position % imageViewContainer.size()); // 为每一个page添加点击事件 view.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(StartupActivity.this, "Page 被点击了"+position, Toast.LENGTH_SHORT).show(); switch (position){ case 0: break; case 1: break; case 2: break; case 3: break; case 4: break; } } }); container.addView(view); return view; } } private class BannerPageChangeListener implements ViewPager.OnPageChangeListener { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageSelected(int position) { // 取余后的索引,得到新的page的索引 int newPositon = position % imageViewContainer.size(); // 根据索引设置图片的描述 tvBannerTextDesc.setText(bannerTextDescArray[newPositon]); // 把上一个点设置为被选中 llDotGroup.getChildAt(preDotPosition).setEnabled(false); // 根据索引设置那个点被选中 llDotGroup.getChildAt(newPositon).setEnabled(true); // 新索引赋值给上一个索引的位置 preDotPosition = newPositon; } @Override public void onPageScrollStateChanged(int state) { } } }
8,038
0.587175
0.583466
242
30.190083
23.499187
106
false
false
0
0
0
0
0
0
0.5
false
false
10
8c306feedad4b55b83fe0f3263af7bd27b037180
34,720,515,659,054
66a85c5d2842f66711ac38827188d30e06ac59e3
/uva/chap5/cycle_finding/11053_flavius_josephus_reloaded/Main.java
46efbffc96a3fe22100d201b6efa5a293df856e4
[]
no_license
ctkhanhly/algorithms
https://github.com/ctkhanhly/algorithms
dc2e64f5c76e4cc316aebecdb02b2aa85497c894
6b45974a714e37b9e36b7935ada0756ebac8fa36
refs/heads/master
2020-12-10T20:18:28.315000
2020-02-12T20:37:16
2020-02-12T20:37:16
233,700,197
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.Scanner; import java.math.BigInteger; //AC class Main{ public static int compute(int a, int b, int n, int x){ return (BigInteger.valueOf(a).multiply(BigInteger.valueOf(x).pow(2)).mod(BigInteger.valueOf(n)).intValue() + b) %n; } public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n,a,b,t,h,cnt; while(sc.hasNext()){ n = sc.nextInt(); if(n == 0) break; a = sc.nextInt(); b = sc.nextInt(); cnt = 0; t = compute(a,b,n,0); h = compute(a,b,n,compute(a,b,n,0)); while(t != h) { t = compute(a,b,n,t); h = compute(a,b,n,compute(a,b,n,h)); } cnt = 1; h = compute(a,b,n,t); while(t != h) { ++cnt; h = compute(a,b,n,h); } System.out.println(n-cnt); } } }
UTF-8
Java
950
java
Main.java
Java
[]
null
[]
import java.util.Scanner; import java.math.BigInteger; //AC class Main{ public static int compute(int a, int b, int n, int x){ return (BigInteger.valueOf(a).multiply(BigInteger.valueOf(x).pow(2)).mod(BigInteger.valueOf(n)).intValue() + b) %n; } public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n,a,b,t,h,cnt; while(sc.hasNext()){ n = sc.nextInt(); if(n == 0) break; a = sc.nextInt(); b = sc.nextInt(); cnt = 0; t = compute(a,b,n,0); h = compute(a,b,n,compute(a,b,n,0)); while(t != h) { t = compute(a,b,n,t); h = compute(a,b,n,compute(a,b,n,h)); } cnt = 1; h = compute(a,b,n,t); while(t != h) { ++cnt; h = compute(a,b,n,h); } System.out.println(n-cnt); } } }
950
0.46
0.453684
32
28.71875
24.035435
123
false
false
0
0
0
0
0
0
1.59375
false
false
10
534203801ecabdf6bf9304757a9a1159b8c1d2d5
33,938,831,598,131
6b974b82b997c7af59d9e43d8a59cb108e0e76ce
/app/src/main/java/com/example/administrator/QuJian/ShangpinFragmentBean.java
573685518f8c526f2ad7f7e7b8a99adc933526cd
[]
no_license
zhuwei154/New_House1
https://github.com/zhuwei154/New_House1
bda749d11223e189f2458af1c4215b262ddef945
f5f8be960945151c109ca3a1ada7cba8ade6d33e
refs/heads/master
2020-01-24T06:59:36.856000
2016-11-17T06:38:07
2016-11-17T06:38:08
73,903,626
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.administrator.QuJian; /** * Created by 597 on 2016/8/10. */ public class ShangpinFragmentBean { String shangpinId; String shangpinName; String shangpinPrice; int n; String type; public ShangpinFragmentBean(String shangpinId, String shangpinName, String shangpinPrice) { this.shangpinId = shangpinId; this.shangpinName = shangpinName; this.shangpinPrice = shangpinPrice; } public ShangpinFragmentBean(int n) { this.n = n; } public ShangpinFragmentBean() { } }
UTF-8
Java
561
java
ShangpinFragmentBean.java
Java
[ { "context": ".example.administrator.QuJian;\n\n/**\n * Created by 597 on 2016/8/10.\n */\npublic class ShangpinFragmentBe", "end": 64, "score": 0.9936936497688293, "start": 61, "tag": "USERNAME", "value": "597" } ]
null
[]
package com.example.administrator.QuJian; /** * Created by 597 on 2016/8/10. */ public class ShangpinFragmentBean { String shangpinId; String shangpinName; String shangpinPrice; int n; String type; public ShangpinFragmentBean(String shangpinId, String shangpinName, String shangpinPrice) { this.shangpinId = shangpinId; this.shangpinName = shangpinName; this.shangpinPrice = shangpinPrice; } public ShangpinFragmentBean(int n) { this.n = n; } public ShangpinFragmentBean() { } }
561
0.673797
0.655971
25
21.440001
21.55937
95
false
false
0
0
0
0
0
0
0.48
false
false
10
84c04fff338d38221e94ebb55904424220e6de38
37,263,136,268,464
bfb692d26a4860416975882ae4b16939cf550ae0
/app/src/main/java/com/neelverma/ai/konane/view/EndActivity.java
00d8eac6e52b13204570d0db79774bd2414476fa
[]
no_license
NeelJVerma/Konane
https://github.com/NeelJVerma/Konane
11ae99e22800bae57673b4537ee4acd64694b41f
baecbf1119acaf6dc035285e8c98bbf501c29bf6
refs/heads/master
2021-05-10T07:37:32.973000
2018-03-29T00:02:45
2018-03-29T00:02:45
118,847,803
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/************************************************************ * Name: Neel Verma * * Project: Project 3 - Two Player Konane * * Class: CMPS331 - Artificial Intelligence * * Due Date: 3/27/2018 * ************************************************************/ package com.neelverma.ai.konane.view; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.widget.Button; import android.widget.TextView; import com.neelverma.ai.konane.R; /** * Class to hold the end screen. * Created by Neel on 1/29/2018. */ public class EndActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_end); TextView blackScoreTextView = findViewById(R.id.blackScoreTextView); TextView whiteScoreTextView = findViewById(R.id.whiteScoreTextView); TextView winnerTextView = findViewById(R.id.winnerTextView); Bundle bundle = getIntent().getExtras(); int playerBlackScore = bundle.getInt("playerBlackScore"); int playerWhiteScore = bundle.getInt("playerWhiteScore"); blackScoreTextView.setText(playerBlackScore + " POINTS"); whiteScoreTextView.setText(playerWhiteScore + " POINTS"); if (playerBlackScore > playerWhiteScore) { winnerTextView.setText("BLACK WINS!"); } else if (playerBlackScore < playerWhiteScore) { winnerTextView.setText("WHITE WINS!"); } else { winnerTextView.setText("IT'S A DRAW"); } Button playAgainButton = findViewById(R.id.playAgainButton); playAgainButton.setOnClickListener(new PlayAgainButtonClickListener(EndActivity.this)); } }
UTF-8
Java
1,834
java
EndActivity.java
Java
[ { "context": "*****************************************\n * Name: Neel Verma *\n * Proj", "end": 81, "score": 0.9998716115951538, "start": 71, "tag": "NAME", "value": "Neel Verma" }, { "context": "/**\n * Class to hold the end screen.\n * Created by Neel on 1/29/2018.\n */\n\npublic class EndActivity exten", "end": 641, "score": 0.9787532091140747, "start": 637, "tag": "NAME", "value": "Neel" } ]
null
[]
/************************************************************ * Name: <NAME> * * Project: Project 3 - Two Player Konane * * Class: CMPS331 - Artificial Intelligence * * Due Date: 3/27/2018 * ************************************************************/ package com.neelverma.ai.konane.view; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.widget.Button; import android.widget.TextView; import com.neelverma.ai.konane.R; /** * Class to hold the end screen. * Created by Neel on 1/29/2018. */ public class EndActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_end); TextView blackScoreTextView = findViewById(R.id.blackScoreTextView); TextView whiteScoreTextView = findViewById(R.id.whiteScoreTextView); TextView winnerTextView = findViewById(R.id.winnerTextView); Bundle bundle = getIntent().getExtras(); int playerBlackScore = bundle.getInt("playerBlackScore"); int playerWhiteScore = bundle.getInt("playerWhiteScore"); blackScoreTextView.setText(playerBlackScore + " POINTS"); whiteScoreTextView.setText(playerWhiteScore + " POINTS"); if (playerBlackScore > playerWhiteScore) { winnerTextView.setText("BLACK WINS!"); } else if (playerBlackScore < playerWhiteScore) { winnerTextView.setText("WHITE WINS!"); } else { winnerTextView.setText("IT'S A DRAW"); } Button playAgainButton = findViewById(R.id.playAgainButton); playAgainButton.setOnClickListener(new PlayAgainButtonClickListener(EndActivity.this)); } }
1,830
0.62868
0.618321
50
35.700001
26.830021
93
false
false
0
0
0
0
0
0
0.42
false
false
10
8926cf52910caecaa0e1494b07d661967d4eaa2e
38,792,144,619,214
ee39d80ab439a43673a57abafa3b5ad9ab6bcfb8
/domobox2/search/src/main/java/fr/infini/domobox/search/boot/SolrjPopulator.java
26997fe3a4de42489c7922b8aedd0f9ab895e174
[]
no_license
PlugHomePlay/domobox
https://github.com/PlugHomePlay/domobox
b7fbad33becb0ec5ebbb9b1cb1075937fe82ebe1
40644109cd828debda2c23abb61ecc6851d2b8af
refs/heads/master
2020-05-20T19:31:21.641000
2015-07-08T11:57:58
2015-07-08T11:57:58
44,486,431
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package fr.infini.domobox.search.boot; import java.io.IOException; import java.util.UUID; import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.impl.HttpSolrClient; import org.apache.solr.common.SolrInputDocument; public class SolrjPopulator { public static void main(String[] args) throws SolrServerException, IOException { System.out.println(UUID.randomUUID()); HttpSolrClient client = new HttpSolrClient("http://127.0.0.1:8983/solr/domobox"); for (int i = 0 ; i < 1000 ; i++){ SolrInputDocument document = new SolrInputDocument(); document.addField("cat", "book"); document.addField("id", "book-" + i); document.addField("name", "The legend of the hobbit part " + i); client.add(document); if(i % 100 == 0) client.commit(); } client.commit(); } }
UTF-8
Java
832
java
SolrjPopulator.java
Java
[ { "context": "ttpSolrClient client = new HttpSolrClient(\"http://127.0.0.1:8983/solr/domobox\");\n\t\t\n\t\tfor (int i = 0 ; i < 10", "end": 475, "score": 0.9997437000274658, "start": 466, "tag": "IP_ADDRESS", "value": "127.0.0.1" } ]
null
[]
package fr.infini.domobox.search.boot; import java.io.IOException; import java.util.UUID; import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.impl.HttpSolrClient; import org.apache.solr.common.SolrInputDocument; public class SolrjPopulator { public static void main(String[] args) throws SolrServerException, IOException { System.out.println(UUID.randomUUID()); HttpSolrClient client = new HttpSolrClient("http://127.0.0.1:8983/solr/domobox"); for (int i = 0 ; i < 1000 ; i++){ SolrInputDocument document = new SolrInputDocument(); document.addField("cat", "book"); document.addField("id", "book-" + i); document.addField("name", "The legend of the hobbit part " + i); client.add(document); if(i % 100 == 0) client.commit(); } client.commit(); } }
832
0.71274
0.689904
28
28.714285
25.358652
83
false
false
0
0
0
0
0
0
2.035714
false
false
10
62f48acea8d4e40d8913789feb5678c46211db56
33,002,528,761,217
013d7919b0406b038fec5d0e8adb7168cd359353
/src/main/java/de/toomuchcoffee/hitdice/domain/combat/CombatAction.java
984b0f89a8fcc17071ef74f302465511aeaee43f
[]
no_license
toomuchcoffee/hitdice
https://github.com/toomuchcoffee/hitdice
0bd444aa8751fa6b2943d13f0a36fb66bf210397
f7d4b58aa30dcc5d29561b2b14c016e44ff1bbad
refs/heads/master
2022-11-13T01:50:26.242000
2022-10-18T18:35:56
2022-10-18T18:35:56
163,293,350
0
0
null
false
2022-10-18T18:31:04
2018-12-27T12:42:16
2021-10-23T23:33:25
2022-10-18T18:31:03
408
0
0
0
Java
false
false
package de.toomuchcoffee.hitdice.domain.combat; @FunctionalInterface public interface CombatAction { String execute(Combatant attacker, Combatant defender); }
UTF-8
Java
164
java
CombatAction.java
Java
[]
null
[]
package de.toomuchcoffee.hitdice.domain.combat; @FunctionalInterface public interface CombatAction { String execute(Combatant attacker, Combatant defender); }
164
0.817073
0.817073
6
26.333334
21.951967
59
false
false
0
0
0
0
0
0
0.5
false
false
10
b8753eefce7e97946f832ad62d0758186cc0aa62
34,729,105,597,375
6c5398104fa8659cb2d1a063d367305834fae99e
/net.olstudio/src/net/oliver/olframework/security/ch7/Server/MySSLServerRule.java
5d2857919c47f5b5bd61738cd31e606370ccb2ca
[]
no_license
skanjo/oliverlee
https://github.com/skanjo/oliverlee
8466abb7fab1993917fd62a38c6fb23dc30862ed
c48ce59a7b1a0900272af61d914eca9a4672cbf2
refs/heads/master
2020-03-01T00:04:32.434000
2011-07-19T12:27:13
2011-07-19T12:27:13
43,020,325
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.net.*; import java.io.*; import javax.net.ssl.*; public class MySSLServerRule{ public static void main(String args[ ]) throws Exception{ byte[] x={ (byte)0x47,(byte)0x49,(byte)0x46,(byte)0x38,(byte)0x39, (byte)0x61,(byte)0x05,(byte)0x00,(byte)0x05,(byte)0x00, (byte)0x80,(byte)0xff,(byte)0x00,(byte)0xff,(byte)0xff, (byte)0xff,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x2c, (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x05, (byte)0x00,(byte)0x05,(byte)0x00,(byte)0x40,(byte)0x02, (byte)0x07,(byte)0x44,(byte)0x0e,(byte)0x86,(byte)0xc7, (byte)0xed,(byte)0x51,(byte)0x00,(byte)0x00,(byte)0x3b }; System.setProperty("javax.net.ssl.keyStore","mykeystore"); System.setProperty("javax.net.ssl.keyStorePassword","wshr.ut"); SSLServerSocketFactory ssf= (SSLServerSocketFactory) SSLServerSocketFactory.getDefault( ); ServerSocket ss=ssf.createServerSocket(5432); System.out.println("Waiting for connection..."); while(true){ Socket s=ss.accept( ); OutputStream outs=s.getOutputStream( ); PrintStream out = new PrintStream(outs); BufferedReader in = new BufferedReader( new InputStreamReader(s.getInputStream( ))); String line=in.readLine(); System.out.println("Got "+line); if (line.endsWith(".html")){ System.out.println("Now Sending HTML"); out.println("Sending HTML"); out.println("<HTML><HEAD><TITLE>Test SSL</TITLE></HEAD>"); out.println("<BODY><h1> This is a test</BODY>"); out.println("</HTML>"); } else if(line.endsWith(".gif")){ System.out.println("Now Sending GIF"); out.println("Sending GIF"); outs.write(x); out.println(""); } out.close( ); s.close( ); } } }
UTF-8
Java
1,995
java
MySSLServerRule.java
Java
[ { "context": "tem.setProperty(\"javax.net.ssl.keyStorePassword\",\"wshr.ut\");\r\n SSLServerSocketFactory ssf= \r\n ", "end": 793, "score": 0.9993549585342407, "start": 786, "tag": "PASSWORD", "value": "wshr.ut" } ]
null
[]
import java.net.*; import java.io.*; import javax.net.ssl.*; public class MySSLServerRule{ public static void main(String args[ ]) throws Exception{ byte[] x={ (byte)0x47,(byte)0x49,(byte)0x46,(byte)0x38,(byte)0x39, (byte)0x61,(byte)0x05,(byte)0x00,(byte)0x05,(byte)0x00, (byte)0x80,(byte)0xff,(byte)0x00,(byte)0xff,(byte)0xff, (byte)0xff,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x2c, (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x05, (byte)0x00,(byte)0x05,(byte)0x00,(byte)0x40,(byte)0x02, (byte)0x07,(byte)0x44,(byte)0x0e,(byte)0x86,(byte)0xc7, (byte)0xed,(byte)0x51,(byte)0x00,(byte)0x00,(byte)0x3b }; System.setProperty("javax.net.ssl.keyStore","mykeystore"); System.setProperty("javax.net.ssl.keyStorePassword","<PASSWORD>"); SSLServerSocketFactory ssf= (SSLServerSocketFactory) SSLServerSocketFactory.getDefault( ); ServerSocket ss=ssf.createServerSocket(5432); System.out.println("Waiting for connection..."); while(true){ Socket s=ss.accept( ); OutputStream outs=s.getOutputStream( ); PrintStream out = new PrintStream(outs); BufferedReader in = new BufferedReader( new InputStreamReader(s.getInputStream( ))); String line=in.readLine(); System.out.println("Got "+line); if (line.endsWith(".html")){ System.out.println("Now Sending HTML"); out.println("Sending HTML"); out.println("<HTML><HEAD><TITLE>Test SSL</TITLE></HEAD>"); out.println("<BODY><h1> This is a test</BODY>"); out.println("</HTML>"); } else if(line.endsWith(".gif")){ System.out.println("Now Sending GIF"); out.println("Sending GIF"); outs.write(x); out.println(""); } out.close( ); s.close( ); } } }
1,998
0.573434
0.517794
49
38.714287
19.471592
71
false
false
0
0
0
0
0
0
1.979592
false
false
10
de882e6d42da324aaee72bd1e43c0398265e7826
19,576,460,963,081
2023bedfaa55b6ab1432b02469dd79e53c39ccae
/boj/BOJ2309.java
5a8f530f7d5156afc74349b862c77da1b13aa12d
[]
no_license
tomfromkr/algorithmStudy
https://github.com/tomfromkr/algorithmStudy
aed1ba8351f5c95c014e982d85c1bca7039fb0d4
b617cdfba8c5987ddfdaa6f84efa250fe00fb6f8
refs/heads/master
2020-06-25T20:26:37.133000
2019-09-26T12:43:17
2019-09-26T12:43:17
199,414,034
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package boj; import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class BOJ2309 { static List<Integer> list = new ArrayList<Integer>(); static int[] ansArr = new int[7]; static boolean flag = false; public static void main(String[] args) { // TODO Auto-generated method stub Scanner scanner = new Scanner(System.in); for (int i = 0; i < 9; i++) list.add(scanner.nextInt()); list.sort(null); int[] outputArr = new int[7]; combi(outputArr, 9, 7, 0, 0); for (int i : ansArr) System.out.println(i); } static void combi(int[] outputArr, int n, int r, int index, int target) { if (flag) return; if (r == 0) { int sum = 0; for (int i : outputArr) { sum += i; } if (sum == 100) { flag = true; for (int i = 0; i < 7; i++) { ansArr[i] = outputArr[i]; } return; } } else if (target == n) return; else { if (!flag) { outputArr[index] = list.get(target); combi(outputArr, n, r - 1, index + 1, target + 1); combi(outputArr, n, r, index, target + 1); } } } }
UTF-8
Java
1,081
java
BOJ2309.java
Java
[]
null
[]
package boj; import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class BOJ2309 { static List<Integer> list = new ArrayList<Integer>(); static int[] ansArr = new int[7]; static boolean flag = false; public static void main(String[] args) { // TODO Auto-generated method stub Scanner scanner = new Scanner(System.in); for (int i = 0; i < 9; i++) list.add(scanner.nextInt()); list.sort(null); int[] outputArr = new int[7]; combi(outputArr, 9, 7, 0, 0); for (int i : ansArr) System.out.println(i); } static void combi(int[] outputArr, int n, int r, int index, int target) { if (flag) return; if (r == 0) { int sum = 0; for (int i : outputArr) { sum += i; } if (sum == 100) { flag = true; for (int i = 0; i < 7; i++) { ansArr[i] = outputArr[i]; } return; } } else if (target == n) return; else { if (!flag) { outputArr[index] = list.get(target); combi(outputArr, n, r - 1, index + 1, target + 1); combi(outputArr, n, r, index, target + 1); } } } }
1,081
0.585569
0.564292
50
20.620001
16.556437
74
false
false
0
0
0
0
0
0
2.88
false
false
10
368c7b8add5b95755107e341e2dbe3fd90d3eb1e
25,606,595,082,419
d97afe700db5c339e6a3b43e4381449af2ab9391
/Core/task12/src/Question12/CustomException.java
fc1c3dc534f978e042a4672f5898dac3177ad9ad
[]
no_license
uditknolder/JavaCoreAssignment
https://github.com/uditknolder/JavaCoreAssignment
f8340cfed01415969ebb227b494eb6bc3e80387b
6a9f09988606fa2429b895bb0d60e0095085fe86
refs/heads/master
2023-08-17T21:38:42.113000
2021-10-25T12:12:02
2021-10-25T12:12:02
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Question12; class CustomException extends Exception { CustomException(String msg) { System.out.println(msg); } }
UTF-8
Java
142
java
CustomException.java
Java
[]
null
[]
package Question12; class CustomException extends Exception { CustomException(String msg) { System.out.println(msg); } }
142
0.676056
0.661972
9
14.777778
14.733015
39
false
false
0
0
0
0
0
0
0.222222
false
false
10
b3c299fee2ba2aae14a1a448d93c1d6360d197c1
23,433,341,636,525
0545fdfe47fdb68da3492b2720bf154a71422494
/fir-gradle-plugin/src/main/groovy/im/fir/gradle/module/App.java
794b34ce9f40dfc9c36a736a0342c93b41505592
[ "Apache-2.0" ]
permissive
Cangol/fir-gradle-plugin
https://github.com/Cangol/fir-gradle-plugin
0ad6a9bec0607c01cf1d2c477075a092cf90ab14
748e8f8afb25fc59193c14d4b831d47cdc1dfd0d
refs/heads/master
2021-05-14T05:46:12.012000
2020-04-23T05:49:13
2020-04-23T05:49:13
116,228,048
1
1
null
false
2020-03-12T06:34:08
2018-01-04T07:17:06
2019-05-28T05:40:37
2019-05-28T05:40:35
120
1
1
1
Java
false
false
package im.fir.gradle.module; import org.codehaus.jackson.annotate.JsonIgnoreProperties; @JsonIgnoreProperties(ignoreUnknown = true) public class App { private String appPath; private String iconPath; private String name = ""; private String bundleId = ""; private String version = ""; private String build = ""; private String releaseType = ""; private String appType; private String changeLog = ""; public String getAppPath() { return this.appPath; } public void setAppPath(String appPath) { this.appPath = appPath; } public String getName() { return this.name; } public void setName(String name) { this.name = name; } public String getVersion() { return this.version; } public void setVersion(String version) { this.version = version; } public String getBuild() { return this.build; } public void setBuild(String build) { this.build = build; } public String getReleaseType() { return this.releaseType; } public void setReleaseType(String releaseType) { this.releaseType = releaseType; } public String getChangeLog() { return this.changeLog; } public void setChangeLog(String changeLog) { this.changeLog = changeLog; } public String getIconPath() { return this.iconPath; } public void setIconPath(String iconPath) { this.iconPath = iconPath; } public String getBundleId() { return this.bundleId; } public void setBundleId(String bundleId) { this.bundleId = bundleId; } public String getAppType() { return appType; } public void setAppType(String appType) { this.appType = appType; } @Override public String toString() { return "app path---- " + appPath + " icon path---- " + " name----" + name + "bundleId----" + bundleId + "version----" + version + " build----" + build + " releaseType----" + releaseType + " appType----" + appType + " changeLog----" + changeLog; } }
UTF-8
Java
2,152
java
App.java
Java
[]
null
[]
package im.fir.gradle.module; import org.codehaus.jackson.annotate.JsonIgnoreProperties; @JsonIgnoreProperties(ignoreUnknown = true) public class App { private String appPath; private String iconPath; private String name = ""; private String bundleId = ""; private String version = ""; private String build = ""; private String releaseType = ""; private String appType; private String changeLog = ""; public String getAppPath() { return this.appPath; } public void setAppPath(String appPath) { this.appPath = appPath; } public String getName() { return this.name; } public void setName(String name) { this.name = name; } public String getVersion() { return this.version; } public void setVersion(String version) { this.version = version; } public String getBuild() { return this.build; } public void setBuild(String build) { this.build = build; } public String getReleaseType() { return this.releaseType; } public void setReleaseType(String releaseType) { this.releaseType = releaseType; } public String getChangeLog() { return this.changeLog; } public void setChangeLog(String changeLog) { this.changeLog = changeLog; } public String getIconPath() { return this.iconPath; } public void setIconPath(String iconPath) { this.iconPath = iconPath; } public String getBundleId() { return this.bundleId; } public void setBundleId(String bundleId) { this.bundleId = bundleId; } public String getAppType() { return appType; } public void setAppType(String appType) { this.appType = appType; } @Override public String toString() { return "app path---- " + appPath + " icon path---- " + " name----" + name + "bundleId----" + bundleId + "version----" + version + " build----" + build + " releaseType----" + releaseType + " appType----" + appType + " changeLog----" + changeLog; } }
2,152
0.600372
0.600372
94
21.893618
23.807503
169
false
false
0
0
0
0
0
0
0.319149
false
false
10
eb6d79151983274e85b788d3d2dca0da3b3a722f
9,285,719,349,236
6fbbfa4b889e9a44bdffdbf01ee5aaf84202a05a
/tfr/tfr-stock-api/src/main/java/com/deppon/foss/module/transfer/stock/api/shared/domain/StockSaleEntity.java
472478af0cd56622c89769d84737b783b12cab14
[]
no_license
moutainhigh/foss
https://github.com/moutainhigh/foss
d98436816181ef038a9b8b983bb42df36cfe617c
5b1d46b3a25f29ae9906abc536dfb436f65fde04
refs/heads/master
2021-06-15T15:40:42.782000
2017-05-04T13:47:43
2017-05-04T13:47:43
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.deppon.foss.module.transfer.stock.api.shared.domain; import java.util.Date; import javax.xml.bind.annotation.XmlRootElement; import com.deppon.foss.framework.entity.BaseEntity; /** * @description 营业部交接库存实体类 * @version 1.0 * @author 360903 linhua.yan-tfr * @update 2016年9月18日 */ @XmlRootElement public class StockSaleEntity extends BaseEntity{ private static final long serialVersionUID = -8221954949349651858L; /** * id */ private String id; /** * 运单号 */ private String waybillNo; /** * 流水号 */ private String serialNO; /** * 操作人编号 */ private String operatorCode; /** * 操作人姓名 */ private String operatorName; /** * 部门编号 */ private String orgCode; /** * 货区编号 */ private String goodsAreaCode; /** * 设备类型 */ private String deviceType; /** * 入库时间 */ private Date inStockTime; /** * PDA扫描时间 */ private Date scanTime; /** * 预配状态 */ private String preHandOverState; /** * 下一部门 */ private String nextOrgCode; /** * 货区名称 MCEW-丢货预警接口需求 * */ private String goodsAreaName; /** * 是否出库 */ private String isOut; private String bePackage; public String getWaybillNo() { return waybillNo; } public void setWaybillNo(String waybillNo) { this.waybillNo = waybillNo; } public String getSerialNO() { return serialNO; } public void setSerialNO(String serialNO) { this.serialNO = serialNO; } public String getOperatorCode() { return operatorCode; } public void setOperatorCode(String operatorCode) { this.operatorCode = operatorCode; } public String getOperatorName() { return operatorName; } public void setOperatorName(String operatorName) { this.operatorName = operatorName; } public String getOrgCode() { return orgCode; } public void setOrgCode(String orgCode) { this.orgCode = orgCode; } public String getGoodsAreaCode() { return goodsAreaCode; } public void setGoodsAreaCode(String goodsAreaCode) { this.goodsAreaCode = goodsAreaCode; } public String getDeviceType() { return deviceType; } public void setDeviceType(String deviceType) { this.deviceType = deviceType; } public Date getInStockTime() { return inStockTime; } public void setInStockTime(Date inStockTime) { this.inStockTime = inStockTime; } public Date getScanTime() { return scanTime; } public void setScanTime(Date scanTime) { this.scanTime = scanTime; } public String getPreHandOverState() { return preHandOverState; } public void setPreHandOverState(String preHandOverState) { this.preHandOverState = preHandOverState; } public String getNextOrgCode() { return nextOrgCode; } public void setNextOrgCode(String nextOrgCode) { this.nextOrgCode = nextOrgCode; } public String getGoodsAreaName() { return goodsAreaName; } public void setGoodsAreaName(String goodsAreaName) { this.goodsAreaName = goodsAreaName; } public String getIsOut() { return isOut; } public void setIsOut(String isOut) { this.isOut = isOut; } public String getBePackage() { return bePackage; } public void setBePackage(String bePackage) { this.bePackage = bePackage; } public String getId() { return id; } public void setId(String id) { this.id = id; } }
UTF-8
Java
3,349
java
StockSaleEntity.java
Java
[ { "context": "iption 营业部交接库存实体类\n* @version 1.0\n* @author 360903 linhua.yan-tfr\n* @update 2016年9月18日\n*/\n@XmlRootElement\npublic cl", "end": 267, "score": 0.9985518455505371, "start": 253, "tag": "USERNAME", "value": "linhua.yan-tfr" } ]
null
[]
package com.deppon.foss.module.transfer.stock.api.shared.domain; import java.util.Date; import javax.xml.bind.annotation.XmlRootElement; import com.deppon.foss.framework.entity.BaseEntity; /** * @description 营业部交接库存实体类 * @version 1.0 * @author 360903 linhua.yan-tfr * @update 2016年9月18日 */ @XmlRootElement public class StockSaleEntity extends BaseEntity{ private static final long serialVersionUID = -8221954949349651858L; /** * id */ private String id; /** * 运单号 */ private String waybillNo; /** * 流水号 */ private String serialNO; /** * 操作人编号 */ private String operatorCode; /** * 操作人姓名 */ private String operatorName; /** * 部门编号 */ private String orgCode; /** * 货区编号 */ private String goodsAreaCode; /** * 设备类型 */ private String deviceType; /** * 入库时间 */ private Date inStockTime; /** * PDA扫描时间 */ private Date scanTime; /** * 预配状态 */ private String preHandOverState; /** * 下一部门 */ private String nextOrgCode; /** * 货区名称 MCEW-丢货预警接口需求 * */ private String goodsAreaName; /** * 是否出库 */ private String isOut; private String bePackage; public String getWaybillNo() { return waybillNo; } public void setWaybillNo(String waybillNo) { this.waybillNo = waybillNo; } public String getSerialNO() { return serialNO; } public void setSerialNO(String serialNO) { this.serialNO = serialNO; } public String getOperatorCode() { return operatorCode; } public void setOperatorCode(String operatorCode) { this.operatorCode = operatorCode; } public String getOperatorName() { return operatorName; } public void setOperatorName(String operatorName) { this.operatorName = operatorName; } public String getOrgCode() { return orgCode; } public void setOrgCode(String orgCode) { this.orgCode = orgCode; } public String getGoodsAreaCode() { return goodsAreaCode; } public void setGoodsAreaCode(String goodsAreaCode) { this.goodsAreaCode = goodsAreaCode; } public String getDeviceType() { return deviceType; } public void setDeviceType(String deviceType) { this.deviceType = deviceType; } public Date getInStockTime() { return inStockTime; } public void setInStockTime(Date inStockTime) { this.inStockTime = inStockTime; } public Date getScanTime() { return scanTime; } public void setScanTime(Date scanTime) { this.scanTime = scanTime; } public String getPreHandOverState() { return preHandOverState; } public void setPreHandOverState(String preHandOverState) { this.preHandOverState = preHandOverState; } public String getNextOrgCode() { return nextOrgCode; } public void setNextOrgCode(String nextOrgCode) { this.nextOrgCode = nextOrgCode; } public String getGoodsAreaName() { return goodsAreaName; } public void setGoodsAreaName(String goodsAreaName) { this.goodsAreaName = goodsAreaName; } public String getIsOut() { return isOut; } public void setIsOut(String isOut) { this.isOut = isOut; } public String getBePackage() { return bePackage; } public void setBePackage(String bePackage) { this.bePackage = bePackage; } public String getId() { return id; } public void setId(String id) { this.id = id; } }
3,349
0.710896
0.700281
167
18.185629
16.378613
68
false
false
0
0
0
0
0
0
1.39521
false
false
10
64bd7b1d60131d8b0b1822395dbd6fefcb7d0f85
35,485,019,816,810
b209386145905a3521fe35725f839010d9634ea9
/CityHappiness/src/places/Rectangle.java
e44fc68570e98ca10ab2d235dda04abdf9c27fdb
[]
no_license
marcperez06/tfg
https://github.com/marcperez06/tfg
f10ca29616a26ce6ffe2e4d15de8a24752e3254e
27d3235937d4ebc52e2a9a1a3d7d1a8870975a48
refs/heads/master
2018-11-07T02:41:17.971000
2018-11-06T14:42:57
2018-11-06T14:42:57
139,430,124
0
0
null
false
2019-11-13T03:31:33
2018-07-02T10:47:36
2019-05-23T19:06:39
2019-11-13T03:31:32
156,466
0
0
1
Lex
false
false
/** * Classe que contiene las 4 posiciones de un rectangulo, de la qual heredaran las ciudades, paises y barrios. * @author Marc Pérez - 173287 */ package places; public class Rectangle { protected double topLeft; protected double topRight; protected double bottomLeft; protected double bottomRight; public Rectangle() { this.topLeft = 0; this.topRight = 0; this.bottomLeft = 0; this.bottomRight = 0; } public double getTopLeft() { return this.topLeft; } public void setTopLeft(double topLeft) { this.topLeft = topLeft; } public double getTopRight() { return this.topRight; } public void setTopRight(double topRight) { this.topRight = topRight; } public double getBottomLeft() { return this.bottomLeft; } public void setBottomLeft(double bottomLeft) { this.bottomLeft = bottomLeft; } public double getBottomRight() { return this.bottomRight; } public void setBottomRight(double bottomRight) { this.bottomRight = bottomRight; } public double[][] getLocation() { double[][] location = null; if (locationHasValue() == true) { double[][] loc = { { this.bottomLeft, this.topLeft }, { this.bottomRight, this.topRight } }; location = loc; } return location; } public boolean locationHasValue() { boolean hasValue = (this.bottomLeft != 0.0); hasValue &= (this.topLeft != 0.0); hasValue &= (this.bottomRight != 0.0); hasValue &= (this.topRight != 0.0); return hasValue; } public double getArea() { double width = this.getWidth(); double height = this.getHeight(); double area = width * height; return area; } public double getWidth() { return Math.abs(this.bottomRight - this.bottomLeft); } public double getHeight() { return Math.abs(this.topLeft - this.bottomLeft); } }
ISO-8859-2
Java
1,790
java
Rectangle.java
Java
[ { "context": "redaran las ciudades, paises y barrios.\n * @author Marc Pérez - 173287\n */\npackage places;\n\npublic class Rectan", "end": 136, "score": 0.9998747706413269, "start": 126, "tag": "NAME", "value": "Marc Pérez" } ]
null
[]
/** * Classe que contiene las 4 posiciones de un rectangulo, de la qual heredaran las ciudades, paises y barrios. * @author <NAME> - 173287 */ package places; public class Rectangle { protected double topLeft; protected double topRight; protected double bottomLeft; protected double bottomRight; public Rectangle() { this.topLeft = 0; this.topRight = 0; this.bottomLeft = 0; this.bottomRight = 0; } public double getTopLeft() { return this.topLeft; } public void setTopLeft(double topLeft) { this.topLeft = topLeft; } public double getTopRight() { return this.topRight; } public void setTopRight(double topRight) { this.topRight = topRight; } public double getBottomLeft() { return this.bottomLeft; } public void setBottomLeft(double bottomLeft) { this.bottomLeft = bottomLeft; } public double getBottomRight() { return this.bottomRight; } public void setBottomRight(double bottomRight) { this.bottomRight = bottomRight; } public double[][] getLocation() { double[][] location = null; if (locationHasValue() == true) { double[][] loc = { { this.bottomLeft, this.topLeft }, { this.bottomRight, this.topRight } }; location = loc; } return location; } public boolean locationHasValue() { boolean hasValue = (this.bottomLeft != 0.0); hasValue &= (this.topLeft != 0.0); hasValue &= (this.bottomRight != 0.0); hasValue &= (this.topRight != 0.0); return hasValue; } public double getArea() { double width = this.getWidth(); double height = this.getHeight(); double area = width * height; return area; } public double getWidth() { return Math.abs(this.bottomRight - this.bottomLeft); } public double getHeight() { return Math.abs(this.topLeft - this.bottomLeft); } }
1,785
0.685299
0.674679
85
20.047058
20.229219
110
false
false
0
0
0
0
0
0
1.682353
false
false
10
34030230c77ff38108837b5d73617a536a5a4415
17,824,114,329,128
e22d72f899f5c75a352bb0bc4003491e0cb7eecb
/TownTimer/app/src/main/java/com/example/denissamodurov/towntimer/DefaultSettings.java
397ef298cb4b9bd74a5c5988ff9bd31473a4ddf5
[]
no_license
denis-samodurov/TownTimer
https://github.com/denis-samodurov/TownTimer
78244516e2d13c6ee7a5f843a14106b51360f059
f438d9f86f5c038a4d32e75fc9c81131f210a057
refs/heads/master
2021-01-20T13:56:21.260000
2017-07-11T22:19:56
2017-07-11T22:19:56
90,539,566
0
0
null
false
2017-07-11T22:19:58
2017-05-07T14:44:49
2017-06-17T21:20:35
2017-07-11T22:19:57
276
0
0
1
Java
null
null
package com.example.denissamodurov.towntimer; /** * Created by denissamodurov on 22/05/2017. */ public class DefaultSettings { public static final int DEFAULT_START_POSITION = 0; }
UTF-8
Java
189
java
DefaultSettings.java
Java
[ { "context": "package com.example.denissamodurov.towntimer;\n\n/**\n * Created by denissamoduro", "end": 28, "score": 0.5999135375022888, "start": 20, "tag": "USERNAME", "value": "denissam" }, { "context": "ample.denissamodurov.towntimer;\n\n/**\n * Created by denissamodurov on 22/05/2017.\n */\n\npublic class DefaultSettings ", "end": 79, "score": 0.9995753169059753, "start": 65, "tag": "USERNAME", "value": "denissamodurov" } ]
null
[]
package com.example.denissamodurov.towntimer; /** * Created by denissamodurov on 22/05/2017. */ public class DefaultSettings { public static final int DEFAULT_START_POSITION = 0; }
189
0.740741
0.693122
9
20
21.64871
55
false
false
0
0
0
0
0
0
0.222222
false
false
10
95c66861a1e2af9bdcf0543ae81d0fe7fecc856a
33,767,032,899,733
6b1417116efc629400e593905e2243569e4d5ff8
/app/src/main/java/com/yod/dedenew/daggertest/DaggerTestActivity.java
5d94adcac8e05813b101b566dfcc334a75ff16a4
[]
no_license
dedeTao/DedeNews
https://github.com/dedeTao/DedeNews
a161431111ddc88eecaa20f70a896b8a295493b2
8c54655f6bab42e8dc1d8ff92b25de7d53907973
refs/heads/master
2020-07-31T00:38:10.936000
2019-01-02T06:04:45
2019-01-02T06:04:45
73,615,059
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.yod.dedenew.daggertest; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v7.app.AppCompatActivity; import android.util.Log; import javax.inject.Inject; /** * Created by twq on 2017/3/28. */ public class DaggerTestActivity extends AppCompatActivity { @Inject //标明需要注入的对象 Person person; @Inject Person person2; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); MainComponent component = DaggerMainComponent.builder().mainModule(new MainModule()).build(); //注入 component.inject(this); Log.i("twq","person = "+ person.toString()+"; person2 = "+ person2.toString()); } }
UTF-8
Java
782
java
DaggerTestActivity.java
Java
[ { "context": "g;\n\nimport javax.inject.Inject;\n\n/**\n * Created by twq on 2017/3/28.\n */\n\npublic class DaggerTestActivit", "end": 232, "score": 0.9996503591537476, "start": 229, "tag": "USERNAME", "value": "twq" } ]
null
[]
package com.yod.dedenew.daggertest; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v7.app.AppCompatActivity; import android.util.Log; import javax.inject.Inject; /** * Created by twq on 2017/3/28. */ public class DaggerTestActivity extends AppCompatActivity { @Inject //标明需要注入的对象 Person person; @Inject Person person2; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); MainComponent component = DaggerMainComponent.builder().mainModule(new MainModule()).build(); //注入 component.inject(this); Log.i("twq","person = "+ person.toString()+"; person2 = "+ person2.toString()); } }
782
0.7
0.685526
30
24.333334
26.274618
101
false
false
0
0
0
0
0
0
0.466667
false
false
10
9582a7eb18aa2b86aacc72450e7b38477d61f312
33,767,032,899,729
26c8adc9265466dd9e43cafb15d5fdaa71c80f86
/core/Main/com/vertextrigger/entities/movingplatform/RectanglePath.java
85211497e3c33c4ea88e68ee066dc81c9b351d80
[]
no_license
Tanyel-Bariser/Vertex-Trigger
https://github.com/Tanyel-Bariser/Vertex-Trigger
78ba34ea0730f9b7fda8f5bde26713e06fe5f3f4
f99e04c781f2c63dbd6898aa13db62019cc686fc
refs/heads/master
2021-04-12T07:30:31.728000
2018-06-03T14:44:54
2018-06-03T14:44:54
25,426,711
0
0
null
false
2018-03-04T15:37:47
2014-10-19T12:43:54
2016-01-24T18:03:44
2018-03-04T15:37:47
86,921
0
0
0
Java
false
null
package com.vertextrigger.entities.movingplatform; import com.badlogic.gdx.math.Vector2; import static com.vertextrigger.entities.movingplatform.RectanglePath.StartPoint.TOP_LEFT; /** * Implementation of {@link Path} which supports rectangular (including square) {@code Path}s */ public class RectanglePath extends Path { enum StartPoint { TOP_LEFT, BOTTOM_LEFT, BOTTOM_RIGHT, TOP_RIGHT } final private boolean clockwise; final private SimplePath top, bottom, left, right; final private CircularArray<SimplePath> sides; final private StartPoint startPoint; private SimplePath currentSide; public RectanglePath(final Vector2 topLeft, final Vector2 bottomRight, final boolean clockwise) { this(topLeft, bottomRight, clockwise, DEFAULT_STEP_SIZE); } public RectanglePath(final Vector2 topLeft, final Vector2 bottomRight, final boolean clockwise, final float stepSize) { this(topLeft, bottomRight, clockwise, stepSize, TOP_LEFT); } public RectanglePath(final Vector2 topLeft, final Vector2 bottomRight, final boolean clockwise, final float stepSize, final StartPoint startPoint) { super(topLeft, bottomRight, stepSize); this.clockwise = clockwise; this.startPoint = startPoint; final Vector2 bottomLeft = new Vector2(topLeft.x, bottomRight.y); final Vector2 topRight = new Vector2(bottomRight.x, topLeft.y); this.top = new SimplePath(topLeft, topRight); this.right = new SimplePath(topRight, bottomRight); this.bottom = new SimplePath(bottomRight, bottomLeft); this.left = new SimplePath(bottomLeft, topLeft); this.sides = new CircularArray<>(top, right, bottom, left); this.currentSide = sides.next(); } @Override public Vector2 getStep(final Vector2 bodyPosition) { if (reachedEndOfSide(currentSide.getStep(bodyPosition))) { //System.out.println(which(currentSide)); currentSide = clockwise ? sides.next() : sides.prev(); } return currentSide.getStep(bodyPosition); } private boolean reachedEndOfSide(final Vector2 step) { return currentSide == top && (clockwise ? step.x < 0 : step.x > 0) || currentSide == right && (clockwise ? step.y > 0 : step.y < 0) || currentSide == bottom && (clockwise ? step.x > 0 : step.x < 0) || currentSide == left && (clockwise ? step.y < 0 : step.y > 0); } private String which(final SimplePath currentSide) { if (currentSide == left) return "left"; else if (currentSide == right) return "right"; else if (currentSide == top) return "top"; else if (currentSide == bottom) return "bottom"; return "null"; } }
UTF-8
Java
2,809
java
RectanglePath.java
Java
[]
null
[]
package com.vertextrigger.entities.movingplatform; import com.badlogic.gdx.math.Vector2; import static com.vertextrigger.entities.movingplatform.RectanglePath.StartPoint.TOP_LEFT; /** * Implementation of {@link Path} which supports rectangular (including square) {@code Path}s */ public class RectanglePath extends Path { enum StartPoint { TOP_LEFT, BOTTOM_LEFT, BOTTOM_RIGHT, TOP_RIGHT } final private boolean clockwise; final private SimplePath top, bottom, left, right; final private CircularArray<SimplePath> sides; final private StartPoint startPoint; private SimplePath currentSide; public RectanglePath(final Vector2 topLeft, final Vector2 bottomRight, final boolean clockwise) { this(topLeft, bottomRight, clockwise, DEFAULT_STEP_SIZE); } public RectanglePath(final Vector2 topLeft, final Vector2 bottomRight, final boolean clockwise, final float stepSize) { this(topLeft, bottomRight, clockwise, stepSize, TOP_LEFT); } public RectanglePath(final Vector2 topLeft, final Vector2 bottomRight, final boolean clockwise, final float stepSize, final StartPoint startPoint) { super(topLeft, bottomRight, stepSize); this.clockwise = clockwise; this.startPoint = startPoint; final Vector2 bottomLeft = new Vector2(topLeft.x, bottomRight.y); final Vector2 topRight = new Vector2(bottomRight.x, topLeft.y); this.top = new SimplePath(topLeft, topRight); this.right = new SimplePath(topRight, bottomRight); this.bottom = new SimplePath(bottomRight, bottomLeft); this.left = new SimplePath(bottomLeft, topLeft); this.sides = new CircularArray<>(top, right, bottom, left); this.currentSide = sides.next(); } @Override public Vector2 getStep(final Vector2 bodyPosition) { if (reachedEndOfSide(currentSide.getStep(bodyPosition))) { //System.out.println(which(currentSide)); currentSide = clockwise ? sides.next() : sides.prev(); } return currentSide.getStep(bodyPosition); } private boolean reachedEndOfSide(final Vector2 step) { return currentSide == top && (clockwise ? step.x < 0 : step.x > 0) || currentSide == right && (clockwise ? step.y > 0 : step.y < 0) || currentSide == bottom && (clockwise ? step.x > 0 : step.x < 0) || currentSide == left && (clockwise ? step.y < 0 : step.y > 0); } private String which(final SimplePath currentSide) { if (currentSide == left) return "left"; else if (currentSide == right) return "right"; else if (currentSide == top) return "top"; else if (currentSide == bottom) return "bottom"; return "null"; } }
2,809
0.664293
0.656461
72
38.013889
33.478638
152
false
false
0
0
0
0
0
0
0.958333
false
false
10
254d2db835a30c6606d7f52e1d08fed0e7f3bfbc
7,069,516,169,945
f10e49c1fc091c084d018f1e1a4b217265c710a2
/src/com/cai310/lottery/dao/lottery/keno/KenoGenericDao.java
cc9df6167b820a9b9ada47e8eaf894bd0d21feaa
[]
no_license
bellmit/lottery-1
https://github.com/bellmit/lottery-1
553a2a62856c9fc17a4e886ba39fa236a84fd12d
fa45d2ab54718d9c57a21695e22c463999440686
refs/heads/master
2022-03-22T02:50:01.646000
2016-08-26T05:39:29
2016-08-26T05:39:29
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.cai310.lottery.dao.lottery.keno; import java.lang.reflect.ParameterizedType; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import com.cai310.entity.IdEntity; import com.cai310.orm.hibernate.HibernateDao; public abstract class KenoGenericDao<T extends IdEntity> extends HibernateDao<T, Long> { protected Log logger = LogFactory.getLog(getClass()); protected Class<T> entityClass; public KenoGenericDao() { } @SuppressWarnings("unchecked") public Class<T> getEntityClass() { if (entityClass == null) { entityClass = (Class<T>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0]; logger.debug("T class = " + entityClass.getName()); } return entityClass; } }
UTF-8
Java
794
java
KenoGenericDao.java
Java
[]
null
[]
package com.cai310.lottery.dao.lottery.keno; import java.lang.reflect.ParameterizedType; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import com.cai310.entity.IdEntity; import com.cai310.orm.hibernate.HibernateDao; public abstract class KenoGenericDao<T extends IdEntity> extends HibernateDao<T, Long> { protected Log logger = LogFactory.getLog(getClass()); protected Class<T> entityClass; public KenoGenericDao() { } @SuppressWarnings("unchecked") public Class<T> getEntityClass() { if (entityClass == null) { entityClass = (Class<T>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0]; logger.debug("T class = " + entityClass.getName()); } return entityClass; } }
794
0.730479
0.717884
28
26.357143
28.178278
112
false
false
0
0
0
0
0
0
1.107143
false
false
10
19aaba194fed2ed8758b78b27b8312cb9ac30ae0
33,449,205,339,655
94dfba00f3ac1b8281dff341a35b81f029a2c814
/client/src/main/java/com/networknt/client/http/Light4jHttpClientProvider.java
57548021b7ae626c393ca7b435d797c11f61eac4
[ "EPL-1.0", "BSD-3-Clause", "CDDL-1.1", "CC0-1.0", "LGPL-2.1-only", "LicenseRef-scancode-other-permissive", "MIT", "Apache-2.0", "BSD-2-Clause", "LicenseRef-scancode-free-unknown" ]
permissive
networknt/light-4j
https://github.com/networknt/light-4j
1fb5710484e73c4dcd4da3136ab954d3c398e5e6
3427481b29dba4abc5660883d669ce6a5e38c8ef
refs/heads/master
2023-09-01T17:45:36.627000
2023-08-29T14:51:06
2023-08-29T14:51:06
67,836,637
3,558
650
Apache-2.0
false
2023-09-13T20:30:48
2016-09-09T22:28:14
2023-09-11T06:55:53
2023-09-13T20:30:47
10,490
3,502
621
29
Java
false
false
/* * JBoss, Home of Professional Open Source. * Copyright 2014 Red Hat, Inc., and individual contributors * as indicated by the @author tags. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.networknt.client.http; import java.io.IOException; import java.lang.reflect.Constructor; import java.net.InetSocketAddress; import java.net.URI; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.xnio.ChannelListener; import org.xnio.IoFuture; import org.xnio.OptionMap; import org.xnio.Options; import org.xnio.StreamConnection; import org.xnio.XnioIoThread; import org.xnio.XnioWorker; import org.xnio.ssl.SslConnection; import org.xnio.ssl.XnioSsl; import com.networknt.client.ssl.Light4jALPNClientSelector; import io.undertow.UndertowMessages; import io.undertow.UndertowOptions; import io.undertow.client.ALPNClientSelector; import io.undertow.client.ClientCallback; import io.undertow.client.ClientConnection; import io.undertow.client.ClientProvider; import io.undertow.client.http2.Http2ClientProvider; import io.undertow.connector.ByteBufferPool; /** * Customized HttpClientProvider for handling TLS handshake for HTTPS. * Created by modifying {@link io.undertow.client.http.HttpClientProvider} * * * */ public class Light4jHttpClientProvider implements ClientProvider { private static final Logger logger = LoggerFactory.getLogger(Light4jHttpClientProvider.class); public static final String HTTP = "http"; public static final String HTTPS = "https"; @Override public Set<String> handlesSchemes() { return new HashSet<>(Arrays.asList(new String[]{HTTP, HTTPS})); } @Override public void connect(final ClientCallback<ClientConnection> listener, final URI uri, final XnioWorker worker, final XnioSsl ssl, final ByteBufferPool bufferPool, final OptionMap options) { connect(listener, null, uri, worker, ssl, bufferPool, options); } @Override public void connect(final ClientCallback<ClientConnection> listener, final URI uri, final XnioIoThread ioThread, final XnioSsl ssl, final ByteBufferPool bufferPool, final OptionMap options) { connect(listener, null, uri, ioThread, ssl, bufferPool, options); } @Override public void connect(ClientCallback<ClientConnection> listener, InetSocketAddress bindAddress, URI uri, XnioWorker worker, XnioSsl ssl, ByteBufferPool bufferPool, OptionMap options) { if (uri.getScheme().equals(HTTPS)) { if (ssl == null) { listener.failed(UndertowMessages.MESSAGES.sslWasNull()); return; } OptionMap tlsOptions = OptionMap.builder().addAll(options).set(Options.SSL_STARTTLS, true).getMap(); if (bindAddress == null) { ssl.openSslConnection(worker, new InetSocketAddress(uri.getHost(), uri.getPort() == -1 ? 443 : uri.getPort()), createOpenListener(listener, bufferPool, tlsOptions, uri), tlsOptions).addNotifier(createNotifier(listener), null); } else { ssl.openSslConnection(worker, bindAddress, new InetSocketAddress(uri.getHost(), uri.getPort() == -1 ? 443 : uri.getPort()), createOpenListener(listener, bufferPool, tlsOptions, uri), tlsOptions).addNotifier(createNotifier(listener), null); } } else { if (bindAddress == null) { worker.openStreamConnection(new InetSocketAddress(uri.getHost(), uri.getPort() == -1 ? 80 : uri.getPort()), createOpenListener(listener, bufferPool, options, uri), options).addNotifier(createNotifier(listener), null); } else { worker.openStreamConnection(bindAddress, new InetSocketAddress(uri.getHost(), uri.getPort() == -1 ? 80 : uri.getPort()), createOpenListener(listener, bufferPool, options, uri), null, options).addNotifier(createNotifier(listener), null); } } } @Override public void connect(ClientCallback<ClientConnection> listener, InetSocketAddress bindAddress, URI uri, XnioIoThread ioThread, XnioSsl ssl, ByteBufferPool bufferPool, OptionMap options) { if (uri.getScheme().equals(HTTPS)) { if (ssl == null) { listener.failed(UndertowMessages.MESSAGES.sslWasNull()); return; } OptionMap tlsOptions = OptionMap.builder().addAll(options).set(Options.SSL_STARTTLS, true).getMap(); if (bindAddress == null) { ssl.openSslConnection(ioThread, new InetSocketAddress(uri.getHost(), uri.getPort() == -1 ? 443 : uri.getPort()), createOpenListener(listener, bufferPool, tlsOptions, uri), tlsOptions).addNotifier(createNotifier(listener), null); } else { ssl.openSslConnection(ioThread, bindAddress, new InetSocketAddress(uri.getHost(), uri.getPort() == -1 ? 443 : uri.getPort()), createOpenListener(listener, bufferPool, tlsOptions, uri), tlsOptions).addNotifier(createNotifier(listener), null); } } else { if (bindAddress == null) { ioThread.openStreamConnection(new InetSocketAddress(uri.getHost(), uri.getPort() == -1 ? 80 : uri.getPort()), createOpenListener(listener, bufferPool, options, uri), options).addNotifier(createNotifier(listener), null); } else { ioThread.openStreamConnection(bindAddress, new InetSocketAddress(uri.getHost(), uri.getPort() == -1 ? 80 : uri.getPort()), createOpenListener(listener, bufferPool, options, uri), null, options).addNotifier(createNotifier(listener), null); } } } private IoFuture.Notifier<StreamConnection, Object> createNotifier(final ClientCallback<ClientConnection> listener) { return new IoFuture.Notifier<StreamConnection, Object>() { @Override public void notify(IoFuture<? extends StreamConnection> ioFuture, Object o) { if (ioFuture.getStatus() == IoFuture.Status.FAILED) { listener.failed(ioFuture.getException()); } } }; } private ChannelListener<StreamConnection> createOpenListener(final ClientCallback<ClientConnection> listener, final ByteBufferPool bufferPool, final OptionMap options, final URI uri) { return new ChannelListener<StreamConnection>() { @Override public void handleEvent(StreamConnection connection) { handleConnected(connection, listener, bufferPool, options, uri); } }; } private void handleConnected(final StreamConnection connection, final ClientCallback<ClientConnection> listener, final ByteBufferPool bufferPool, final OptionMap options, URI uri) { boolean h2 = options.get(UndertowOptions.ENABLE_HTTP2, false); if(connection instanceof SslConnection && (h2)) { List<ALPNClientSelector.ALPNProtocol> protocolList = new ArrayList<>(); if(h2) { protocolList.add(Http2ClientProvider.alpnProtocol(listener, uri, bufferPool, options)); } Light4jALPNClientSelector.runAlpn((SslConnection) connection, new ChannelListener<SslConnection>() { @Override public void handleEvent(SslConnection connection) { listener.completed(createHttpClientConnection(connection, options, bufferPool)); } }, listener, protocolList.toArray(new ALPNClientSelector.ALPNProtocol[protocolList.size()])); } else { if(connection instanceof SslConnection) { try { ((SslConnection) connection).startHandshake(); } catch (Throwable t) { listener.failed((t instanceof IOException) ? (IOException) t : new IOException(t)); } } listener.completed(createHttpClientConnection(connection, options, bufferPool)); } } /* * Create instances of "io.undertow.client.http.HttpClientConnection" using reflections */ private ClientConnection createHttpClientConnection(final StreamConnection connection, final OptionMap options, final ByteBufferPool bufferPool) { try { Class<?> cls = Class.forName("io.undertow.client.http.HttpClientConnection"); Constructor<?> o = cls.getDeclaredConstructor(StreamConnection.class, OptionMap.class, ByteBufferPool.class); o.setAccessible(true); return (ClientConnection) o.newInstance(connection, options, bufferPool); }catch(Exception e) { logger.error(e.getMessage(), e); } return null; } }
UTF-8
Java
9,122
java
Light4jHttpClientProvider.java
Java
[]
null
[]
/* * JBoss, Home of Professional Open Source. * Copyright 2014 Red Hat, Inc., and individual contributors * as indicated by the @author tags. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.networknt.client.http; import java.io.IOException; import java.lang.reflect.Constructor; import java.net.InetSocketAddress; import java.net.URI; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.xnio.ChannelListener; import org.xnio.IoFuture; import org.xnio.OptionMap; import org.xnio.Options; import org.xnio.StreamConnection; import org.xnio.XnioIoThread; import org.xnio.XnioWorker; import org.xnio.ssl.SslConnection; import org.xnio.ssl.XnioSsl; import com.networknt.client.ssl.Light4jALPNClientSelector; import io.undertow.UndertowMessages; import io.undertow.UndertowOptions; import io.undertow.client.ALPNClientSelector; import io.undertow.client.ClientCallback; import io.undertow.client.ClientConnection; import io.undertow.client.ClientProvider; import io.undertow.client.http2.Http2ClientProvider; import io.undertow.connector.ByteBufferPool; /** * Customized HttpClientProvider for handling TLS handshake for HTTPS. * Created by modifying {@link io.undertow.client.http.HttpClientProvider} * * * */ public class Light4jHttpClientProvider implements ClientProvider { private static final Logger logger = LoggerFactory.getLogger(Light4jHttpClientProvider.class); public static final String HTTP = "http"; public static final String HTTPS = "https"; @Override public Set<String> handlesSchemes() { return new HashSet<>(Arrays.asList(new String[]{HTTP, HTTPS})); } @Override public void connect(final ClientCallback<ClientConnection> listener, final URI uri, final XnioWorker worker, final XnioSsl ssl, final ByteBufferPool bufferPool, final OptionMap options) { connect(listener, null, uri, worker, ssl, bufferPool, options); } @Override public void connect(final ClientCallback<ClientConnection> listener, final URI uri, final XnioIoThread ioThread, final XnioSsl ssl, final ByteBufferPool bufferPool, final OptionMap options) { connect(listener, null, uri, ioThread, ssl, bufferPool, options); } @Override public void connect(ClientCallback<ClientConnection> listener, InetSocketAddress bindAddress, URI uri, XnioWorker worker, XnioSsl ssl, ByteBufferPool bufferPool, OptionMap options) { if (uri.getScheme().equals(HTTPS)) { if (ssl == null) { listener.failed(UndertowMessages.MESSAGES.sslWasNull()); return; } OptionMap tlsOptions = OptionMap.builder().addAll(options).set(Options.SSL_STARTTLS, true).getMap(); if (bindAddress == null) { ssl.openSslConnection(worker, new InetSocketAddress(uri.getHost(), uri.getPort() == -1 ? 443 : uri.getPort()), createOpenListener(listener, bufferPool, tlsOptions, uri), tlsOptions).addNotifier(createNotifier(listener), null); } else { ssl.openSslConnection(worker, bindAddress, new InetSocketAddress(uri.getHost(), uri.getPort() == -1 ? 443 : uri.getPort()), createOpenListener(listener, bufferPool, tlsOptions, uri), tlsOptions).addNotifier(createNotifier(listener), null); } } else { if (bindAddress == null) { worker.openStreamConnection(new InetSocketAddress(uri.getHost(), uri.getPort() == -1 ? 80 : uri.getPort()), createOpenListener(listener, bufferPool, options, uri), options).addNotifier(createNotifier(listener), null); } else { worker.openStreamConnection(bindAddress, new InetSocketAddress(uri.getHost(), uri.getPort() == -1 ? 80 : uri.getPort()), createOpenListener(listener, bufferPool, options, uri), null, options).addNotifier(createNotifier(listener), null); } } } @Override public void connect(ClientCallback<ClientConnection> listener, InetSocketAddress bindAddress, URI uri, XnioIoThread ioThread, XnioSsl ssl, ByteBufferPool bufferPool, OptionMap options) { if (uri.getScheme().equals(HTTPS)) { if (ssl == null) { listener.failed(UndertowMessages.MESSAGES.sslWasNull()); return; } OptionMap tlsOptions = OptionMap.builder().addAll(options).set(Options.SSL_STARTTLS, true).getMap(); if (bindAddress == null) { ssl.openSslConnection(ioThread, new InetSocketAddress(uri.getHost(), uri.getPort() == -1 ? 443 : uri.getPort()), createOpenListener(listener, bufferPool, tlsOptions, uri), tlsOptions).addNotifier(createNotifier(listener), null); } else { ssl.openSslConnection(ioThread, bindAddress, new InetSocketAddress(uri.getHost(), uri.getPort() == -1 ? 443 : uri.getPort()), createOpenListener(listener, bufferPool, tlsOptions, uri), tlsOptions).addNotifier(createNotifier(listener), null); } } else { if (bindAddress == null) { ioThread.openStreamConnection(new InetSocketAddress(uri.getHost(), uri.getPort() == -1 ? 80 : uri.getPort()), createOpenListener(listener, bufferPool, options, uri), options).addNotifier(createNotifier(listener), null); } else { ioThread.openStreamConnection(bindAddress, new InetSocketAddress(uri.getHost(), uri.getPort() == -1 ? 80 : uri.getPort()), createOpenListener(listener, bufferPool, options, uri), null, options).addNotifier(createNotifier(listener), null); } } } private IoFuture.Notifier<StreamConnection, Object> createNotifier(final ClientCallback<ClientConnection> listener) { return new IoFuture.Notifier<StreamConnection, Object>() { @Override public void notify(IoFuture<? extends StreamConnection> ioFuture, Object o) { if (ioFuture.getStatus() == IoFuture.Status.FAILED) { listener.failed(ioFuture.getException()); } } }; } private ChannelListener<StreamConnection> createOpenListener(final ClientCallback<ClientConnection> listener, final ByteBufferPool bufferPool, final OptionMap options, final URI uri) { return new ChannelListener<StreamConnection>() { @Override public void handleEvent(StreamConnection connection) { handleConnected(connection, listener, bufferPool, options, uri); } }; } private void handleConnected(final StreamConnection connection, final ClientCallback<ClientConnection> listener, final ByteBufferPool bufferPool, final OptionMap options, URI uri) { boolean h2 = options.get(UndertowOptions.ENABLE_HTTP2, false); if(connection instanceof SslConnection && (h2)) { List<ALPNClientSelector.ALPNProtocol> protocolList = new ArrayList<>(); if(h2) { protocolList.add(Http2ClientProvider.alpnProtocol(listener, uri, bufferPool, options)); } Light4jALPNClientSelector.runAlpn((SslConnection) connection, new ChannelListener<SslConnection>() { @Override public void handleEvent(SslConnection connection) { listener.completed(createHttpClientConnection(connection, options, bufferPool)); } }, listener, protocolList.toArray(new ALPNClientSelector.ALPNProtocol[protocolList.size()])); } else { if(connection instanceof SslConnection) { try { ((SslConnection) connection).startHandshake(); } catch (Throwable t) { listener.failed((t instanceof IOException) ? (IOException) t : new IOException(t)); } } listener.completed(createHttpClientConnection(connection, options, bufferPool)); } } /* * Create instances of "io.undertow.client.http.HttpClientConnection" using reflections */ private ClientConnection createHttpClientConnection(final StreamConnection connection, final OptionMap options, final ByteBufferPool bufferPool) { try { Class<?> cls = Class.forName("io.undertow.client.http.HttpClientConnection"); Constructor<?> o = cls.getDeclaredConstructor(StreamConnection.class, OptionMap.class, ByteBufferPool.class); o.setAccessible(true); return (ClientConnection) o.newInstance(connection, options, bufferPool); }catch(Exception e) { logger.error(e.getMessage(), e); } return null; } }
9,122
0.699189
0.693817
190
47.005264
58.259266
256
false
false
0
0
0
0
0
0
1.321053
false
false
10
22f2a8bce7d226c197ce2ec9f388e34985c85d61
12,000,138,667,408
5c3fc5aa705c24e5fe54928613fac819052a817a
/api/src/com/wanma/app/controller/ParkingLockController.java
6af22fe5b8c0ef3d9ea7c63a9b435057885f05c0
[]
no_license
wang-shun/eichong
https://github.com/wang-shun/eichong
30e0ca01e9e5f281c9c03f609c52cecb3a5299f0
c13a6d464150e25039b601aed184fd3fab9e87b7
refs/heads/master
2020-04-02T12:19:31.963000
2018-03-21T09:40:34
2018-03-21T09:40:34
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.wanma.app.controller; import com.bluemobi.product.exceptions.AppRequestErrorException; import com.bluemobi.product.utils.AccessSuccessResult; import com.bluemobi.product.utils.RequestParamUtil; import com.wanma.app.service.parkinglock.ParkingLockService; import com.wanma.app.util.ResultUtil; import com.wanma.common.ParkingLockConstants; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import javax.servlet.http.HttpServletRequest; /** * 地锁接口 */ @Controller @RequestMapping("/app/parkingLock") public class ParkingLockController { private static Logger log = Logger.getLogger(ParkingLockController.class); @Autowired private ParkingLockService parkingLockService; /** * 降锁 */ @RequestMapping(value = "/lowerParkingLock", method = RequestMethod.POST) @ResponseBody public String lowerParkingLock(HttpServletRequest request) throws AppRequestErrorException { //用户id String userId = RequestParamUtil.getEncodeParam(request, "userId"); //地锁编码 String parkingLockCode = RequestParamUtil.getEncodeParam(request, "parkingLockCode"); //地锁平台 String parkingLockPlatform = RequestParamUtil.getEncodeParam(request, "parkingLockPlatform"); try { return new AccessSuccessResult(parkingLockService.lowerParkingLock(Long.valueOf(userId), parkingLockCode, Long.valueOf(parkingLockPlatform))).toString(); } catch (Exception e) { // 保存错误LOG log.error("lowerParkingLock is error|userId=" + userId + "|parkingLockCode=" + parkingLockCode + "|parkingLockPlatform=" + parkingLockPlatform + "", e); return new AccessSuccessResult(ResultUtil.getResultMap(ParkingLockConstants.ERROR_CODE, ParkingLockConstants.ERROR_MSG)).toString(); } } }
UTF-8
Java
2,121
java
ParkingLockController.java
Java
[]
null
[]
package com.wanma.app.controller; import com.bluemobi.product.exceptions.AppRequestErrorException; import com.bluemobi.product.utils.AccessSuccessResult; import com.bluemobi.product.utils.RequestParamUtil; import com.wanma.app.service.parkinglock.ParkingLockService; import com.wanma.app.util.ResultUtil; import com.wanma.common.ParkingLockConstants; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import javax.servlet.http.HttpServletRequest; /** * 地锁接口 */ @Controller @RequestMapping("/app/parkingLock") public class ParkingLockController { private static Logger log = Logger.getLogger(ParkingLockController.class); @Autowired private ParkingLockService parkingLockService; /** * 降锁 */ @RequestMapping(value = "/lowerParkingLock", method = RequestMethod.POST) @ResponseBody public String lowerParkingLock(HttpServletRequest request) throws AppRequestErrorException { //用户id String userId = RequestParamUtil.getEncodeParam(request, "userId"); //地锁编码 String parkingLockCode = RequestParamUtil.getEncodeParam(request, "parkingLockCode"); //地锁平台 String parkingLockPlatform = RequestParamUtil.getEncodeParam(request, "parkingLockPlatform"); try { return new AccessSuccessResult(parkingLockService.lowerParkingLock(Long.valueOf(userId), parkingLockCode, Long.valueOf(parkingLockPlatform))).toString(); } catch (Exception e) { // 保存错误LOG log.error("lowerParkingLock is error|userId=" + userId + "|parkingLockCode=" + parkingLockCode + "|parkingLockPlatform=" + parkingLockPlatform + "", e); return new AccessSuccessResult(ResultUtil.getResultMap(ParkingLockConstants.ERROR_CODE, ParkingLockConstants.ERROR_MSG)).toString(); } } }
2,121
0.75877
0.758289
52
39.01923
41.059288
165
false
false
0
0
0
0
0
0
0.634615
false
false
10
ade5b36113dbed2f58b7937b09aceeb48c150233
12,979,391,217,502
af10e1b5d9c0dd2fd77fa57ff8057845760ec4c8
/CityscapeLab/Building.java
00c1aeceff5ecc49029011091a89cf96e002aab6
[]
no_license
rjnorton/unit2Classes
https://github.com/rjnorton/unit2Classes
6b80ed1df8e1942c366d42172cdf75fa1c9846aa
b3b4a9531a7d3b4d62a07a0d33022160045dacf0
refs/heads/master
2021-01-17T07:55:05.665000
2014-10-15T16:08:32
2014-10-15T16:08:32
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.awt.Graphics2D; import java.awt.geom.Rectangle2D; import java.awt.Color; /** * Creates buildings in the cityscape with specified bottom left positions and numbers of floors * * @author Rob Norton * @version 10/14/2014 */ public class Building { /** Top of building in pixels */ private int topPos; /** Left of building in pixels */ private int leftPos; /** Integer value of number of floors */ private int numFloors; /** * Creates a building object * * @param buildingNum The number of the building (from left to right), used in calculations to * set up the left side of the building * * @param floors The number of floors in the building */ public Building(int buildingNum, int floors, int top) { // initialise instance variables this.topPos = top; this.leftPos = buildingNum * 60; this.numFloors = floors; } /** * Draws the building with the set coordinates */ public void draw(Graphics2D g2) { Rectangle2D.Double rect = new Rectangle2D.Double(this.leftPos,this.topPos,140,this.numFloors*40); g2.setColor(Color.LIGHT_GRAY); g2.draw(rect); g2.fill(rect); for(int i=1; i < this.numFloors; i++) { Rectangle2D.Double columnOne = new Rectangle2D.Double(this.leftPos + 20,this.topPos + (i*40),20,20); g2.setColor(Color.WHITE); g2.draw(columnOne); g2.fill(columnOne); } for(int i=1; i < this.numFloors; i++) { Rectangle2D.Double columnTwo = new Rectangle2D.Double(this.leftPos + 60, this.topPos + (i*40),20,20); g2.draw(columnTwo); g2.fill(columnTwo); } for (int i=1; i < this.numFloors; i++) { Rectangle2D.Double columnThree = new Rectangle2D.Double(this.leftPos + 100, this.topPos + (i*40),20,20); g2.draw(columnThree); g2.fill(columnThree); } } }
UTF-8
Java
2,075
java
Building.java
Java
[ { "context": "eft positions and numbers of floors\n * \n * @author Rob Norton \n * @version 10/14/2014\n */\npublic class Building", "end": 212, "score": 0.9998538494110107, "start": 202, "tag": "NAME", "value": "Rob Norton" } ]
null
[]
import java.awt.Graphics2D; import java.awt.geom.Rectangle2D; import java.awt.Color; /** * Creates buildings in the cityscape with specified bottom left positions and numbers of floors * * @author <NAME> * @version 10/14/2014 */ public class Building { /** Top of building in pixels */ private int topPos; /** Left of building in pixels */ private int leftPos; /** Integer value of number of floors */ private int numFloors; /** * Creates a building object * * @param buildingNum The number of the building (from left to right), used in calculations to * set up the left side of the building * * @param floors The number of floors in the building */ public Building(int buildingNum, int floors, int top) { // initialise instance variables this.topPos = top; this.leftPos = buildingNum * 60; this.numFloors = floors; } /** * Draws the building with the set coordinates */ public void draw(Graphics2D g2) { Rectangle2D.Double rect = new Rectangle2D.Double(this.leftPos,this.topPos,140,this.numFloors*40); g2.setColor(Color.LIGHT_GRAY); g2.draw(rect); g2.fill(rect); for(int i=1; i < this.numFloors; i++) { Rectangle2D.Double columnOne = new Rectangle2D.Double(this.leftPos + 20,this.topPos + (i*40),20,20); g2.setColor(Color.WHITE); g2.draw(columnOne); g2.fill(columnOne); } for(int i=1; i < this.numFloors; i++) { Rectangle2D.Double columnTwo = new Rectangle2D.Double(this.leftPos + 60, this.topPos + (i*40),20,20); g2.draw(columnTwo); g2.fill(columnTwo); } for (int i=1; i < this.numFloors; i++) { Rectangle2D.Double columnThree = new Rectangle2D.Double(this.leftPos + 100, this.topPos + (i*40),20,20); g2.draw(columnThree); g2.fill(columnThree); } } }
2,071
0.584578
0.553253
72
27.819445
28.565386
115
false
false
0
0
0
0
0
0
0.611111
false
false
10
3cc50f6bfe7578c8907c88ac8b5aaa06dd01e8cc
18,245,021,129,150
186db9121443cddc6f9920839a90ce5ae577521a
/src/main/java/com/bornium/impl/BearerTokenProvider.java
7d12e91706cc39d9e39ba6f74bbbca2fe634924e
[ "MIT" ]
permissive
xorpherion/OAuth2-OpenID
https://github.com/xorpherion/OAuth2-OpenID
94f4c27f11b1157393a3db8c8972832ce578a082
3e1f5b1bf9c7b930f8fd10252cfde658be8221dd
refs/heads/master
2023-06-21T22:07:59.188000
2021-08-19T09:25:42
2021-08-19T09:25:42
79,965,747
0
1
MIT
false
2023-06-14T22:29:01
2017-01-24T23:41:41
2021-08-19T09:25:47
2023-06-14T22:29:00
420
0
1
3
Java
false
false
package com.bornium.impl; import com.bornium.security.oauth2openid.providers.TokenProvider; import com.bornium.security.oauth2openid.server.TokenContext; import java.math.BigInteger; import java.security.SecureRandom; import java.util.function.Supplier; /** * Created by Xorpherion on 25.01.2017. */ public class BearerTokenProvider implements TokenProvider { private final Supplier<String> factory; public BearerTokenProvider() { this.factory = new Supplier<String>() { private SecureRandom random = new SecureRandom(); @Override public String get() { return getRandomBits().toString(32); } private BigInteger getRandomBits() { synchronized (random) { return new BigInteger(130, random); } } }; } public String get(TokenContext tokenContext) { return factory.get(); } }
UTF-8
Java
965
java
BearerTokenProvider.java
Java
[ { "context": "rt java.util.function.Supplier;\n\n/**\n * Created by Xorpherion on 25.01.2017.\n */\npublic class BearerTokenProvid", "end": 285, "score": 0.9996922612190247, "start": 275, "tag": "USERNAME", "value": "Xorpherion" } ]
null
[]
package com.bornium.impl; import com.bornium.security.oauth2openid.providers.TokenProvider; import com.bornium.security.oauth2openid.server.TokenContext; import java.math.BigInteger; import java.security.SecureRandom; import java.util.function.Supplier; /** * Created by Xorpherion on 25.01.2017. */ public class BearerTokenProvider implements TokenProvider { private final Supplier<String> factory; public BearerTokenProvider() { this.factory = new Supplier<String>() { private SecureRandom random = new SecureRandom(); @Override public String get() { return getRandomBits().toString(32); } private BigInteger getRandomBits() { synchronized (random) { return new BigInteger(130, random); } } }; } public String get(TokenContext tokenContext) { return factory.get(); } }
965
0.630052
0.614508
37
25.081081
21.821609
65
false
false
0
0
0
0
0
0
0.351351
false
false
10
34c25b79f752e61d78c01669a2b25d669e3a9380
9,225,589,761,530
a2d0d09f2dc32d117a55ca5b6973014d91a074c2
/src/main/java/com/cn/ttz/controller/TPController.java
a2af47a9acc0fb0ebe2914fc4461d9bd09af5a44
[]
no_license
wjl241/ttz
https://github.com/wjl241/ttz
c1be279c0cf333ca22604e8e64b3fbc26650497c
009793b18244a4582a01afb4e9cbce06efdef5fa
refs/heads/master
2021-04-15T15:00:10.444000
2018-05-25T01:59:25
2018-05-25T01:59:25
126,807,151
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.cn.ttz.controller; import java.io.IOException; import java.util.jar.Attributes.Name; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; import com.cn.ttz.pojo.Ttz_xgcs; import com.cn.ttz.pojo.User; import com.cn.ttz.service.IUserService; import com.cn.ttz.service.Ttz_xgcsService; @Controller @RequestMapping("/tp") public class TPController { @Resource private IUserService userService; @Resource private Ttz_xgcsService ttz_xgcsService; @RequestMapping("/showTp") public String showTp(HttpServletRequest request,Model model){ int userId = 1; User user = this.userService.getUserById(userId); model.addAttribute("user", user); return "tp2"; } @RequestMapping("/showTp2") public String showTp2(HttpServletRequest request,Model model){ int userId = 1; User user = this.userService.getUserById(userId); model.addAttribute("user", user); return "tp3"; } @RequestMapping("/showTp3") public String showTp3(HttpServletRequest request,Model model){ int userId = 1; User user = this.userService.getUserById(userId); model.addAttribute("user", user); return "tp4"; } @RequestMapping("/dealTp") public ModelAndView toIndex(HttpServletRequest request,Model model,HttpServletResponse response){ String name = request.getParameter("name"); String pics = request.getParameter("aaa"); String sex = request.getParameter("sex"); int sex2 = 0; if(pics == null || pics.length()<=0) { return null; } if(name == null || pics.length()<=0) { return null; } if(sex == null || sex.length()<=0) { return null; } if("male".equals(sex)) { sex2 = 0; }else { sex2 = 1; } pics = pics.replaceAll("pic", ""); Ttz_xgcs ttz_xgcs = new Ttz_xgcs(); ttz_xgcs = ttz_xgcsService.selectByName(name); int count = 0; if(ttz_xgcs != null) { ttz_xgcs.setPics(pics); ttz_xgcs.setSex((byte)sex2); ttz_xgcs.setCreateTime(Integer.valueOf(String.valueOf(System.currentTimeMillis()/1000))); ttz_xgcs.setUpdateTime(Integer.valueOf(String.valueOf(System.currentTimeMillis()/1000))); count = ttz_xgcsService.updateTtz(ttz_xgcs); System.err.println("修改行数"+count); }else { ttz_xgcs = new Ttz_xgcs(); ttz_xgcs.setPics(pics); ttz_xgcs.setUserName(name); ttz_xgcs.setCreateTime(Integer.valueOf(String.valueOf(System.currentTimeMillis()/1000))); ttz_xgcs.setUpdateTime(Integer.valueOf(String.valueOf(System.currentTimeMillis()/1000))); ttz_xgcs.setType((byte)0); ttz_xgcs.setSex((byte)sex2); count = ttz_xgcsService.InsertTtz(ttz_xgcs); System.err.println("插入行数"+count); } return new ModelAndView("tp3"); } @RequestMapping("/dealTp2") public ModelAndView dealTp2(HttpServletRequest request,Model model,HttpServletResponse response){ String name = request.getParameter("name"); String pics = request.getParameter("aaa"); String sex =request.getParameter("sex"); if(pics == null || pics.length()<=0) { return null; } if(name == null || pics.length()<=0) { return null; } if(sex == null || sex.length()<=0) { return null; } pics = pics.replaceAll("pic", ""); Ttz_xgcs ttz_xgcs = new Ttz_xgcs(); ttz_xgcs = ttz_xgcsService.selectByName2(name); int count = 0; if(ttz_xgcs != null) { ttz_xgcs.setPics(pics); ttz_xgcs.setCreateTime(Integer.valueOf(String.valueOf(System.currentTimeMillis()/1000))); ttz_xgcs.setUpdateTime(Integer.valueOf(String.valueOf(System.currentTimeMillis()/1000))); ttz_xgcs.setSex(Byte.valueOf(sex)); count = ttz_xgcsService.updateTtz(ttz_xgcs); System.err.println("修改行数"+count); }else { ttz_xgcs = new Ttz_xgcs(); ttz_xgcs.setPics(pics); ttz_xgcs.setUserName(name); ttz_xgcs.setCreateTime(Integer.valueOf(String.valueOf(System.currentTimeMillis()/1000))); ttz_xgcs.setUpdateTime(Integer.valueOf(String.valueOf(System.currentTimeMillis()/1000))); ttz_xgcs.setType((byte)1); ttz_xgcs.setSex(Byte.valueOf(sex)); count = ttz_xgcsService.InsertTtz(ttz_xgcs); System.err.println("插入行数"+count); } //new ModelAndView("/WEB-INF/jsp/tp3.jsp") return new ModelAndView("tp3"); } }
UTF-8
Java
4,572
java
TPController.java
Java
[]
null
[]
package com.cn.ttz.controller; import java.io.IOException; import java.util.jar.Attributes.Name; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; import com.cn.ttz.pojo.Ttz_xgcs; import com.cn.ttz.pojo.User; import com.cn.ttz.service.IUserService; import com.cn.ttz.service.Ttz_xgcsService; @Controller @RequestMapping("/tp") public class TPController { @Resource private IUserService userService; @Resource private Ttz_xgcsService ttz_xgcsService; @RequestMapping("/showTp") public String showTp(HttpServletRequest request,Model model){ int userId = 1; User user = this.userService.getUserById(userId); model.addAttribute("user", user); return "tp2"; } @RequestMapping("/showTp2") public String showTp2(HttpServletRequest request,Model model){ int userId = 1; User user = this.userService.getUserById(userId); model.addAttribute("user", user); return "tp3"; } @RequestMapping("/showTp3") public String showTp3(HttpServletRequest request,Model model){ int userId = 1; User user = this.userService.getUserById(userId); model.addAttribute("user", user); return "tp4"; } @RequestMapping("/dealTp") public ModelAndView toIndex(HttpServletRequest request,Model model,HttpServletResponse response){ String name = request.getParameter("name"); String pics = request.getParameter("aaa"); String sex = request.getParameter("sex"); int sex2 = 0; if(pics == null || pics.length()<=0) { return null; } if(name == null || pics.length()<=0) { return null; } if(sex == null || sex.length()<=0) { return null; } if("male".equals(sex)) { sex2 = 0; }else { sex2 = 1; } pics = pics.replaceAll("pic", ""); Ttz_xgcs ttz_xgcs = new Ttz_xgcs(); ttz_xgcs = ttz_xgcsService.selectByName(name); int count = 0; if(ttz_xgcs != null) { ttz_xgcs.setPics(pics); ttz_xgcs.setSex((byte)sex2); ttz_xgcs.setCreateTime(Integer.valueOf(String.valueOf(System.currentTimeMillis()/1000))); ttz_xgcs.setUpdateTime(Integer.valueOf(String.valueOf(System.currentTimeMillis()/1000))); count = ttz_xgcsService.updateTtz(ttz_xgcs); System.err.println("修改行数"+count); }else { ttz_xgcs = new Ttz_xgcs(); ttz_xgcs.setPics(pics); ttz_xgcs.setUserName(name); ttz_xgcs.setCreateTime(Integer.valueOf(String.valueOf(System.currentTimeMillis()/1000))); ttz_xgcs.setUpdateTime(Integer.valueOf(String.valueOf(System.currentTimeMillis()/1000))); ttz_xgcs.setType((byte)0); ttz_xgcs.setSex((byte)sex2); count = ttz_xgcsService.InsertTtz(ttz_xgcs); System.err.println("插入行数"+count); } return new ModelAndView("tp3"); } @RequestMapping("/dealTp2") public ModelAndView dealTp2(HttpServletRequest request,Model model,HttpServletResponse response){ String name = request.getParameter("name"); String pics = request.getParameter("aaa"); String sex =request.getParameter("sex"); if(pics == null || pics.length()<=0) { return null; } if(name == null || pics.length()<=0) { return null; } if(sex == null || sex.length()<=0) { return null; } pics = pics.replaceAll("pic", ""); Ttz_xgcs ttz_xgcs = new Ttz_xgcs(); ttz_xgcs = ttz_xgcsService.selectByName2(name); int count = 0; if(ttz_xgcs != null) { ttz_xgcs.setPics(pics); ttz_xgcs.setCreateTime(Integer.valueOf(String.valueOf(System.currentTimeMillis()/1000))); ttz_xgcs.setUpdateTime(Integer.valueOf(String.valueOf(System.currentTimeMillis()/1000))); ttz_xgcs.setSex(Byte.valueOf(sex)); count = ttz_xgcsService.updateTtz(ttz_xgcs); System.err.println("修改行数"+count); }else { ttz_xgcs = new Ttz_xgcs(); ttz_xgcs.setPics(pics); ttz_xgcs.setUserName(name); ttz_xgcs.setCreateTime(Integer.valueOf(String.valueOf(System.currentTimeMillis()/1000))); ttz_xgcs.setUpdateTime(Integer.valueOf(String.valueOf(System.currentTimeMillis()/1000))); ttz_xgcs.setType((byte)1); ttz_xgcs.setSex(Byte.valueOf(sex)); count = ttz_xgcsService.InsertTtz(ttz_xgcs); System.err.println("插入行数"+count); } //new ModelAndView("/WEB-INF/jsp/tp3.jsp") return new ModelAndView("tp3"); } }
4,572
0.687665
0.673128
144
29.527779
24.22864
98
false
false
0
0
0
0
0
0
2.520833
false
false
10
68ff00e45ca4c3017f7138b6a5e2abf9b28dab22
17,557,826,353,074
eaf9dbbbd0fb1a456155b9e107fd9a5efbeef37c
/src/main/java/com/javac2/ast/stm/AstStatement.java
116546b5db4f736efffdf1916dc9a61e64ce8a5c
[]
no_license
dlubarov/javac2
https://github.com/dlubarov/javac2
a6b5f1321369f9845a9d13737f56ca00d614d78f
b3af7ccfe4a8f43c5aab41e8756ca7ac54e2f048
refs/heads/master
2020-06-02T00:43:52.339000
2014-02-10T01:43:08
2014-02-11T07:14:23
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.javac2.ast.stm; public abstract class AstStatement { }
UTF-8
Java
68
java
AstStatement.java
Java
[]
null
[]
package com.javac2.ast.stm; public abstract class AstStatement { }
68
0.779412
0.764706
4
16
15.827191
36
false
false
0
0
0
0
0
0
0.25
false
false
10
fa912422dc0eb78945a34e2955c96c37e7d1b8b5
14,894,946,588,316
2079ff0bfa752ac982b10d3304a0a224bc20e944
/showcase-pom/src/main/java/com/smartgwt/sample/showcase/client/toolstrip/RibbonBarSample.java
1be795bf71e2eba3903a5b8250f489d05379556c
[]
no_license
Elisabitao/exo-training
https://github.com/Elisabitao/exo-training
32be8bca0257110b7fcf4df7313a9e8eb1a5917a
414c2efb6c3f8b58331312e7bdfcecfa1a59b3dd
refs/heads/master
2021-01-18T07:49:29.781000
2012-06-27T11:59:12
2012-06-28T11:06:07
62,512,864
1
0
null
true
2016-07-03T19:55:13
2016-07-03T19:55:11
2016-07-03T19:55:13
2012-06-28T11:08:41
22,655
1
0
0
null
null
null
package com.smartgwt.sample.showcase.client.toolstrip; import com.smartgwt.client.types.Alignment; import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.IconButton; import com.smartgwt.client.widgets.menu.IconMenuButton; import com.smartgwt.client.widgets.menu.Menu; import com.smartgwt.client.widgets.toolbar.RibbonBar; import com.smartgwt.client.widgets.toolbar.RibbonGroup; import com.smartgwt.sample.showcase.client.PanelFactory; import com.smartgwt.sample.showcase.client.ShowcasePanel; public class RibbonBarSample extends ShowcasePanel { private static final String DESCRIPTION = "<p>A RibbonBar is a customized ToolStrip which displays controls in separately titled RibbonGroups.</p>" + "<p>The RibbonBar controls the overall presence, placement and text-alignment of each group's title and these can be overridden for individual groups. " + "Groups can have multiple rows of controls (group.numRows) and additional columns of rows are automatically added when that number is exceeded. Controls can also span multiple rows (control.rowSpan).</p>" + "<p>The example below demonstrates a RibbonBar using it's default RibbonGroup and IconButton/IconMenuButton classes to show various groups with different layouts. You can see groups with horizontal and " + "vertical buttons, some of each showing their menuIcons. The 'File' and 'Undo' buttons also have their showMenuIconOver attribute set to true, which causes mouseOver styling on the menuIcon.</p>"; public static class Factory implements PanelFactory { private String id; public Canvas create() { RibbonBarSample panel = new RibbonBarSample(); id = panel.getID(); return panel; } public String getID() { return id; } public String getDescription() { return DESCRIPTION; } } public Canvas getViewPanel() { RibbonBar ribbonBar = new RibbonBar(); ribbonBar.setLeft(0); ribbonBar.setTop(75); ribbonBar.setWidth100(); ribbonBar.setMembersMargin(2); ribbonBar.setLayoutMargin(2); Menu menu = new Menu(); RibbonGroup fileGroup = new RibbonGroup(); fileGroup.setTitle("File"); fileGroup.setTitleAlign(Alignment.LEFT); fileGroup.setNumRows(1); fileGroup.setRowHeight(76); fileGroup.addControl(getIconMenuButton("New", "piece_blue", menu, true)); fileGroup.addControl(getIconButton("Open", "star_yellow", true)); fileGroup.addControl(getIconButton("Save", "pawn_red", true)); fileGroup.addControl(getIconMenuButton("Save As", "cube_green", menu, true)); RibbonGroup editGroup = new RibbonGroup(); editGroup.setTitle("Edit"); editGroup.setNumRows(3); editGroup.setRowHeight(24); fileGroup.addControl(getIconButton("Edit", "piece_blue", false)); fileGroup.addControl(getIconButton("Copy", "pawn_green", false)); fileGroup.addControl(getIconButton("Paste", "cube_yellow", false)); fileGroup.addControl(getIconMenuButton("Undo", null, menu, false)); fileGroup.addControl(getIconMenuButton("Redo", null, menu, false)); RibbonGroup insertGroup = new RibbonGroup(); insertGroup.setTitle("Insert"); insertGroup.setNumRows(3); insertGroup.setRowHeight(24); fileGroup.addControl(getIconMenuButton("Picture", null, menu, false)); fileGroup.addControl(getIconButton("Link", "pawn_white", false)); fileGroup.addControl(getIconButton("Document", "star_yellow", false)); fileGroup.addControl(getIconButton("Video", "piece_red", false)); ribbonBar.addMember(fileGroup); ribbonBar.addMember(editGroup); ribbonBar.addMember(insertGroup); return ribbonBar; } private IconButton getIconButton(String title, String iconName, boolean vertical) { IconButton button = new IconButton(title); button.setTitle(title); if (iconName == null) iconName = "cube_blue"; button.setIcon("/images/pieces/16/" + iconName + ".png"); button.setLargeIcon("/images/pieces/48/" + iconName + ".png"); if (vertical == true) button.setOrientation("vertical"); return button; } private IconMenuButton getIconMenuButton(String title, String iconName, Menu menu, boolean vertical) { IconMenuButton button = new IconMenuButton(); button.setTitle(title); if (iconName == null) iconName = "cube_blue"; button.setIcon("/images/pieces/16/" + iconName + ".png"); button.setLargeIcon("/images/pieces/48/" + iconName + ".png"); if (vertical == true) button.setOrientation("vertical"); if (menu != null) button.setMenu(menu); button.setShowMenuIcon(true); return button; } public String getIntro() { return DESCRIPTION; } }
UTF-8
Java
5,003
java
RibbonBarSample.java
Java
[]
null
[]
package com.smartgwt.sample.showcase.client.toolstrip; import com.smartgwt.client.types.Alignment; import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.IconButton; import com.smartgwt.client.widgets.menu.IconMenuButton; import com.smartgwt.client.widgets.menu.Menu; import com.smartgwt.client.widgets.toolbar.RibbonBar; import com.smartgwt.client.widgets.toolbar.RibbonGroup; import com.smartgwt.sample.showcase.client.PanelFactory; import com.smartgwt.sample.showcase.client.ShowcasePanel; public class RibbonBarSample extends ShowcasePanel { private static final String DESCRIPTION = "<p>A RibbonBar is a customized ToolStrip which displays controls in separately titled RibbonGroups.</p>" + "<p>The RibbonBar controls the overall presence, placement and text-alignment of each group's title and these can be overridden for individual groups. " + "Groups can have multiple rows of controls (group.numRows) and additional columns of rows are automatically added when that number is exceeded. Controls can also span multiple rows (control.rowSpan).</p>" + "<p>The example below demonstrates a RibbonBar using it's default RibbonGroup and IconButton/IconMenuButton classes to show various groups with different layouts. You can see groups with horizontal and " + "vertical buttons, some of each showing their menuIcons. The 'File' and 'Undo' buttons also have their showMenuIconOver attribute set to true, which causes mouseOver styling on the menuIcon.</p>"; public static class Factory implements PanelFactory { private String id; public Canvas create() { RibbonBarSample panel = new RibbonBarSample(); id = panel.getID(); return panel; } public String getID() { return id; } public String getDescription() { return DESCRIPTION; } } public Canvas getViewPanel() { RibbonBar ribbonBar = new RibbonBar(); ribbonBar.setLeft(0); ribbonBar.setTop(75); ribbonBar.setWidth100(); ribbonBar.setMembersMargin(2); ribbonBar.setLayoutMargin(2); Menu menu = new Menu(); RibbonGroup fileGroup = new RibbonGroup(); fileGroup.setTitle("File"); fileGroup.setTitleAlign(Alignment.LEFT); fileGroup.setNumRows(1); fileGroup.setRowHeight(76); fileGroup.addControl(getIconMenuButton("New", "piece_blue", menu, true)); fileGroup.addControl(getIconButton("Open", "star_yellow", true)); fileGroup.addControl(getIconButton("Save", "pawn_red", true)); fileGroup.addControl(getIconMenuButton("Save As", "cube_green", menu, true)); RibbonGroup editGroup = new RibbonGroup(); editGroup.setTitle("Edit"); editGroup.setNumRows(3); editGroup.setRowHeight(24); fileGroup.addControl(getIconButton("Edit", "piece_blue", false)); fileGroup.addControl(getIconButton("Copy", "pawn_green", false)); fileGroup.addControl(getIconButton("Paste", "cube_yellow", false)); fileGroup.addControl(getIconMenuButton("Undo", null, menu, false)); fileGroup.addControl(getIconMenuButton("Redo", null, menu, false)); RibbonGroup insertGroup = new RibbonGroup(); insertGroup.setTitle("Insert"); insertGroup.setNumRows(3); insertGroup.setRowHeight(24); fileGroup.addControl(getIconMenuButton("Picture", null, menu, false)); fileGroup.addControl(getIconButton("Link", "pawn_white", false)); fileGroup.addControl(getIconButton("Document", "star_yellow", false)); fileGroup.addControl(getIconButton("Video", "piece_red", false)); ribbonBar.addMember(fileGroup); ribbonBar.addMember(editGroup); ribbonBar.addMember(insertGroup); return ribbonBar; } private IconButton getIconButton(String title, String iconName, boolean vertical) { IconButton button = new IconButton(title); button.setTitle(title); if (iconName == null) iconName = "cube_blue"; button.setIcon("/images/pieces/16/" + iconName + ".png"); button.setLargeIcon("/images/pieces/48/" + iconName + ".png"); if (vertical == true) button.setOrientation("vertical"); return button; } private IconMenuButton getIconMenuButton(String title, String iconName, Menu menu, boolean vertical) { IconMenuButton button = new IconMenuButton(); button.setTitle(title); if (iconName == null) iconName = "cube_blue"; button.setIcon("/images/pieces/16/" + iconName + ".png"); button.setLargeIcon("/images/pieces/48/" + iconName + ".png"); if (vertical == true) button.setOrientation("vertical"); if (menu != null) button.setMenu(menu); button.setShowMenuIcon(true); return button; } public String getIntro() { return DESCRIPTION; } }
5,003
0.679592
0.674595
114
42.885963
41.550171
218
false
false
0
0
0
0
0
0
0.964912
false
false
10
f7561f44ed67c54abf392c6c3727b51ea6b6ec0a
6,975,026,940,997
64b62966df6c8984b75da9a8ab804a7dbd490e97
/Java Advanced/Sets and Maps Advanced/src/LAB/ParkingLot.java
c8f9973346ab100e1ade0667a1b58d70b70ed0b2
[]
no_license
Rusev11/SoftUni-Java
https://github.com/Rusev11/SoftUni-Java
3748654e0e5b88069b0cc293e97113cabd78c859
d4b7ddd72d6fb3b1b0c88b049adb08a3514ace30
refs/heads/master
2023-03-06T15:20:09.023000
2021-02-16T07:15:29
2021-02-16T07:15:29
332,875,867
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package LAB; import java.util.LinkedHashSet; import java.util.Scanner; import java.util.Set; public class ParkingLot { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String line = scanner.nextLine(); Set<String> parking = new LinkedHashSet<>(); while (!line.equals("END")) { String[] lineArray = line.split(", "); String direction = lineArray[0]; String carNumber = lineArray[1]; if (direction.equals("IN")) { parking.add(carNumber); } else { parking.remove(carNumber); } line = scanner.nextLine(); } if (parking.isEmpty()) { System.out.println("Parking Lot is Empty"); } else { System.out.println(String.join(System.lineSeparator(), parking)); } } }
UTF-8
Java
902
java
ParkingLot.java
Java
[]
null
[]
package LAB; import java.util.LinkedHashSet; import java.util.Scanner; import java.util.Set; public class ParkingLot { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String line = scanner.nextLine(); Set<String> parking = new LinkedHashSet<>(); while (!line.equals("END")) { String[] lineArray = line.split(", "); String direction = lineArray[0]; String carNumber = lineArray[1]; if (direction.equals("IN")) { parking.add(carNumber); } else { parking.remove(carNumber); } line = scanner.nextLine(); } if (parking.isEmpty()) { System.out.println("Parking Lot is Empty"); } else { System.out.println(String.join(System.lineSeparator(), parking)); } } }
902
0.548781
0.546563
30
29.066668
19.419807
77
false
false
0
0
0
0
0
0
0.566667
false
false
10
322461fbe65c9cc3b7d2f601d2f048f800677032
25,434,796,368,879
913a9bea1556d5288f24338a67500989746bbb3f
/src/me/elcih/CustomAIEntity/CustomEntityType.java
ab06fe0563943ccb37bf9aef1105f10f8ad08370
[]
no_license
PowerKG/CustomAIEntity
https://github.com/PowerKG/CustomAIEntity
6294779f3802e0c6e0af221afed08baf68ee95f5
1cf375e72a607f5d7e88fc69cc051e7c3160f7cb
refs/heads/master
2021-01-20T18:47:41.646000
2016-08-10T09:52:02
2016-08-10T09:52:02
65,367,108
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package me.elcih.CustomAIEntity; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.util.Map; import org.bukkit.Location; import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; import org.bukkit.entity.EntityType; import me.elcih.CustomAIEntity.Entity.FriendlyZombie; import me.elcih.CustomAIEntity.utils.ReflectHelper; import net.minecraft.server.v1_7_R4.World; import net.minecraft.server.v1_7_R4.WorldServer; @SuppressWarnings("deprecation") public enum CustomEntityType { friendlyZombie("Zombie", EntityType.ZOMBIE.getTypeId(), FriendlyZombie.class); private final Class<?> clazz; private CustomEntityType(String name, int id, Class<?> clazz) { this.clazz = clazz; addToMaps(clazz, name, id); } public net.minecraft.server.v1_7_R4.Entity spawn(Location loc) { WorldServer world = ((CraftWorld) loc.getWorld()).getHandle(); Object obj = null; try { Constructor<?> c0 = clazz.getConstructor(World.class); try { obj = c0.newInstance(world); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (SecurityException e) { e.printStackTrace(); } if (obj == null) { return null; } net.minecraft.server.v1_7_R4.Entity entity = (net.minecraft.server.v1_7_R4.Entity) obj; entity.setLocation(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch()); world.addEntity(entity); return entity; } @SuppressWarnings( { "unchecked", "rawtypes" }) private static void addToMaps(Class<?> clazz, String name, int id) { if (CustomAIEntity.isForgeSide()) { ((Map) ReflectHelper.getPrivateField("field_75625_b", net.minecraft.server.v1_7_R4.EntityTypes.class, null)).put(name, clazz); ((Map) ReflectHelper.getPrivateField("field_75626_c", net.minecraft.server.v1_7_R4.EntityTypes.class, null)).put(clazz, name); ((Map) ReflectHelper.getPrivateField("field_75624_e", net.minecraft.server.v1_7_R4.EntityTypes.class, null)).put(clazz, Integer.valueOf(id)); } else { ((Map) ReflectHelper.getPrivateField("c", net.minecraft.server.v1_7_R4.EntityTypes.class, null)).put(name, clazz); ((Map) ReflectHelper.getPrivateField("d", net.minecraft.server.v1_7_R4.EntityTypes.class, null)).put(clazz, name); ((Map) ReflectHelper.getPrivateField("f", net.minecraft.server.v1_7_R4.EntityTypes.class, null)).put(clazz, Integer.valueOf(id)); } } }
UTF-8
Java
2,671
java
CustomEntityType.java
Java
[]
null
[]
package me.elcih.CustomAIEntity; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.util.Map; import org.bukkit.Location; import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; import org.bukkit.entity.EntityType; import me.elcih.CustomAIEntity.Entity.FriendlyZombie; import me.elcih.CustomAIEntity.utils.ReflectHelper; import net.minecraft.server.v1_7_R4.World; import net.minecraft.server.v1_7_R4.WorldServer; @SuppressWarnings("deprecation") public enum CustomEntityType { friendlyZombie("Zombie", EntityType.ZOMBIE.getTypeId(), FriendlyZombie.class); private final Class<?> clazz; private CustomEntityType(String name, int id, Class<?> clazz) { this.clazz = clazz; addToMaps(clazz, name, id); } public net.minecraft.server.v1_7_R4.Entity spawn(Location loc) { WorldServer world = ((CraftWorld) loc.getWorld()).getHandle(); Object obj = null; try { Constructor<?> c0 = clazz.getConstructor(World.class); try { obj = c0.newInstance(world); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (SecurityException e) { e.printStackTrace(); } if (obj == null) { return null; } net.minecraft.server.v1_7_R4.Entity entity = (net.minecraft.server.v1_7_R4.Entity) obj; entity.setLocation(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch()); world.addEntity(entity); return entity; } @SuppressWarnings( { "unchecked", "rawtypes" }) private static void addToMaps(Class<?> clazz, String name, int id) { if (CustomAIEntity.isForgeSide()) { ((Map) ReflectHelper.getPrivateField("field_75625_b", net.minecraft.server.v1_7_R4.EntityTypes.class, null)).put(name, clazz); ((Map) ReflectHelper.getPrivateField("field_75626_c", net.minecraft.server.v1_7_R4.EntityTypes.class, null)).put(clazz, name); ((Map) ReflectHelper.getPrivateField("field_75624_e", net.minecraft.server.v1_7_R4.EntityTypes.class, null)).put(clazz, Integer.valueOf(id)); } else { ((Map) ReflectHelper.getPrivateField("c", net.minecraft.server.v1_7_R4.EntityTypes.class, null)).put(name, clazz); ((Map) ReflectHelper.getPrivateField("d", net.minecraft.server.v1_7_R4.EntityTypes.class, null)).put(clazz, name); ((Map) ReflectHelper.getPrivateField("f", net.minecraft.server.v1_7_R4.EntityTypes.class, null)).put(clazz, Integer.valueOf(id)); } } }
2,671
0.716586
0.696743
93
27.72043
34.255638
144
false
false
0
0
0
0
0
0
2.247312
false
false
10
5ebf5aa9d5c2d7567a341cd52431fb18e459858c
18,502,719,156,838
f2facd402c975de44784a0f87449a02cf6b93944
/java8/src/main/java/demo/java/javageeks/dp/proxy/ProxyPatternTest.java
873c6739e341de39fb0ef8da4f271c90d218d6fa
[]
no_license
rishabhdaim/DemoJava
https://github.com/rishabhdaim/DemoJava
27751f0d6a2861ba1250468ad88d5da0499a51ba
2c76e71c126646ead6e3e54c2e153a35316730e5
refs/heads/master
2023-04-15T09:40:02.097000
2023-04-10T17:14:20
2023-04-10T17:14:20
100,939,346
0
0
null
false
2022-12-10T06:14:17
2017-08-21T10:03:40
2022-04-26T08:17:20
2022-12-10T06:14:15
1,317
0
0
2
Java
false
false
/** * */ package demo.java.javageeks.dp.proxy; /** * @author rishabh.daim * */ public class ProxyPatternTest { /** * @param args */ public static void main(String[] args) { CommandExecutor commandExecutor = new CommandExecutorProxy("rishu", "asdf"); try { commandExecutor.runCommand("java"); Thread.sleep(100); commandExecutor.runCommand("rm -rf abc.pdf"); } catch (Exception e) { e.printStackTrace(); } } }
UTF-8
Java
447
java
ProxyPatternTest.java
Java
[ { "context": "kage demo.java.javageeks.dp.proxy;\n\n/**\n * @author rishabh.daim\n * \n */\npublic class ProxyPatternTest {\n\n\t/**\n\t *", "end": 78, "score": 0.9952120184898376, "start": 66, "tag": "NAME", "value": "rishabh.daim" } ]
null
[]
/** * */ package demo.java.javageeks.dp.proxy; /** * @author rishabh.daim * */ public class ProxyPatternTest { /** * @param args */ public static void main(String[] args) { CommandExecutor commandExecutor = new CommandExecutorProxy("rishu", "asdf"); try { commandExecutor.runCommand("java"); Thread.sleep(100); commandExecutor.runCommand("rm -rf abc.pdf"); } catch (Exception e) { e.printStackTrace(); } } }
447
0.644295
0.637584
26
16.23077
17.880604
69
false
false
0
0
0
0
0
0
1.384615
false
false
10
bd025c4fd68ddbb3b8a0349a37fdda838b72e986
18,571,438,633,382
c38700aa01f23350491632246db9a11ce88b3baa
/app/src/main/java/bz/pei/driver/ui/drawerscreen/fragmentz/sos/adapter/SosRecyclerViewModel.java
af377f5fd62ab33dc677c6bde0c2b72667bbb094
[]
no_license
MukeshGreenDeveloper/PrUserNew
https://github.com/MukeshGreenDeveloper/PrUserNew
6c3f78dbe63b1fdec3b9b3f84711303ef56990d1
9dc8f557eb7972966cdbab676afc02be27b1b6e5
refs/heads/master
2020-09-14T17:20:36.803000
2019-12-01T19:17:57
2019-12-01T19:17:57
223,196,582
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package bz.pei.driver.ui.drawerscreen.fragmentz.sos.adapter; import androidx.databinding.ObservableField; /** * Created by root on 12/12/17. */ public class SosRecyclerViewModel { public ObservableField<String> titleObservable = new ObservableField<>(); public ObservableField<String> phone = new ObservableField<>(); public SosRecyclerViewModel() { } public SosRecyclerViewModel(ObservableField<String> titleObservable, ObservableField<String> phone) { this.titleObservable = titleObservable; this.phone = phone; } }
UTF-8
Java
566
java
SosRecyclerViewModel.java
Java
[ { "context": "dx.databinding.ObservableField;\n\n/**\n * Created by root on 12/12/17.\n */\n\npublic class SosRecyclerViewMod", "end": 130, "score": 0.9949586987495422, "start": 126, "tag": "USERNAME", "value": "root" } ]
null
[]
package bz.pei.driver.ui.drawerscreen.fragmentz.sos.adapter; import androidx.databinding.ObservableField; /** * Created by root on 12/12/17. */ public class SosRecyclerViewModel { public ObservableField<String> titleObservable = new ObservableField<>(); public ObservableField<String> phone = new ObservableField<>(); public SosRecyclerViewModel() { } public SosRecyclerViewModel(ObservableField<String> titleObservable, ObservableField<String> phone) { this.titleObservable = titleObservable; this.phone = phone; } }
566
0.733216
0.722615
21
25.952381
30.278826
105
false
false
0
0
0
0
0
0
0.333333
false
false
10
5bf3a5763fafa45ee5ec7af8ddc8598f8e47b60f
16,870,631,540,356
a4a193aed7f1a44587ab5716ab6328cf6623c2b1
/leetcode-java/src/main/java/Array/easy/NO217ContainsDuplicate.java
a23d36a7e64df63f1980a70c12595046c9f322b3
[]
no_license
YvetteYue/LeetCode
https://github.com/YvetteYue/LeetCode
511349346b7c101ffa936b243c2065ff2b1bba58
6c8df47ba554f69a259e4aff585254f26c77fc0a
refs/heads/master
2021-04-03T05:31:07.164000
2019-05-16T08:29:07
2019-05-16T08:29:07
124,664,126
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Array.easy; import java.util.Arrays; public class NO217ContainsDuplicate { public static void main(String[] args) { int nums[]={1,3,2,4,6}; System.out.println(containsDuplicate(nums)); } /** * *2018年4月22日 下午10:20:43 * beats: 99.38% * 复杂度:O(n) */ public static boolean containsDuplicate(int[] nums) { Arrays.sort(nums); for(int i=1;i<nums.length;i++){ if(nums[i-1]==nums[i]){ return true; } } return false; } }
UTF-8
Java
478
java
NO217ContainsDuplicate.java
Java
[]
null
[]
package Array.easy; import java.util.Arrays; public class NO217ContainsDuplicate { public static void main(String[] args) { int nums[]={1,3,2,4,6}; System.out.println(containsDuplicate(nums)); } /** * *2018年4月22日 下午10:20:43 * beats: 99.38% * 复杂度:O(n) */ public static boolean containsDuplicate(int[] nums) { Arrays.sort(nums); for(int i=1;i<nums.length;i++){ if(nums[i-1]==nums[i]){ return true; } } return false; } }
478
0.632609
0.573913
27
16.037037
15.440403
54
false
false
0
0
0
0
0
0
1.666667
false
false
10
d4291e9268bca8e0d2e4ecc219f14fcbd63e277d
2,473,901,199,070
73004bb512c3dae20ac36cc5c89da600f61b6c0b
/src/main/java/fmd_desktop_clint/views/ConnectToServerView.java
9c9bb9991a1040f1ce3be3f188aa5cff5b5ded3b
[]
no_license
GraduationProject2016/Desktop_Version
https://github.com/GraduationProject2016/Desktop_Version
07a90ac02aa835a28d384c6896ee84cf7cfd0820
788a9bb58c688155216d407d31528493aba85736
refs/heads/master
2021-01-21T04:32:56.286000
2016-06-24T22:23:44
2016-06-24T22:23:44
46,884,776
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package fmd_desktop_clint.views; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.util.Date; import javax.imageio.ImageIO; import javax.swing.BorderFactory; import javax.swing.BoxLayout; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JPanel; import javax.swing.SwingConstants; import javax.swing.border.BevelBorder; import javax.swing.border.Border; import org.json.JSONException; import fmd_desktop_clint.socet.Connection; import fmd_desktop_clint.util.CommonUtil; import fmd_desktop_clint.util.Constants; import fmd_desktop_clint.util.SuperUtil; @SuppressWarnings("serial") public class ConnectToServerView extends JFrame { private static String hostname; public ConnectToServerView() { super("Find My Device | Connect To Server"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setResizable(false); setBounds(250, 115, 800, 550); JPanel panel = new JPanel(); add(panel); URL url = getClass().getResource("/resources/logo.png"); ImageIcon icon = new ImageIcon(url); setIconImage(icon.getImage()); placeComponents(panel); setVisible(true); JMenuBar menuBar = new JMenuBar(); setJMenuBar(menuBar); // Define and add two drop down menu to the menubar JMenu web = new JMenu("Web"); JMenu helpMenu = new JMenu("Help"); JMenu aboutMenu = new JMenu("about"); JMenu dataMenu = new JMenu("Data"); JMenu logoutMenu = new JMenu("logout"); menuBar.add(web); menuBar.add(helpMenu); menuBar.add(aboutMenu); menuBar.add(dataMenu); menuBar.add(logoutMenu); // Create and add simple menu item to one of the drop down menu JMenuItem openAction = new JMenuItem("Open"); JMenuItem exitAction = new JMenuItem("Exit"); JMenuItem logoutAction = new JMenuItem("logout"); JMenuItem logsAction = new JMenuItem("show logs"); web.add(openAction); web.addSeparator(); web.add(exitAction); logoutMenu.add(logoutAction); dataMenu.add(logsAction); exitAction.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { System.exit(0); } }); logsAction.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { try { if ((new File(Constants.LOG_FILE)).exists()) { Process p = Runtime.getRuntime() .exec("rundll32 url.dll,FileProtocolHandler " + Constants.LOG_FILE); p.waitFor(); } } catch (Exception ex) { ex.printStackTrace(); } } }); logoutAction.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { try { SuperUtil.logout(); dispose(); new LoginView(); } catch (IOException e) { e.printStackTrace(); } } }); openAction.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { try { String url = "http://" + hostname + ":8080/fmd/"; java.awt.Desktop.getDesktop().browse(java.net.URI.create(url)); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }); try { hostname = CommonUtil.getHostName(); } catch (IOException e) { e.printStackTrace(); } } private void placeComponents(JPanel panel) { panel.setLayout(null); BufferedImage myPicture, iconProfile; try { iconProfile = ImageIO.read(new File(getClass().getResource("/resources/userpic.jpg").getPath())); JLabel iconProfileLab = new JLabel(new ImageIcon(iconProfile)); iconProfileLab.setBounds(100, 80, 150, 150); Border border = BorderFactory.createLineBorder(Color.BLACK, 5); iconProfileLab.setBorder(border); iconProfileLab.setOpaque(false); panel.add(iconProfileLab); myPicture = ImageIO.read(new File(getClass().getResource("/resources/bkimage.jpg").getPath())); JLabel picLabel = new JLabel(new ImageIcon(myPicture)); picLabel.setBounds(-100, 0, 1000, 150); panel.add(picLabel); } catch (IOException e2) { e2.printStackTrace(); } JButton ConnectButton = new JButton("CONNECT TO OUR SERVER"); ConnectButton.setBounds(100, 250, 600, 80); ConnectButton.setFont(new Font("Serif", Font.PLAIN, 25)); ConnectButton.setForeground(Color.BLACK); panel.add(ConnectButton); JButton back = new JButton("BACK TO HOME"); back.setBounds(100, 360, 600, 80); back.setFont(new Font("Serif", Font.PLAIN, 25)); back.setForeground(Color.BLACK); panel.add(back); final JPanel statusPanel = new JPanel(); statusPanel.setBorder(new BevelBorder(BevelBorder.LOWERED)); add(statusPanel, BorderLayout.SOUTH); statusPanel.setPreferredSize(new Dimension(getWidth(), 16)); statusPanel.setLayout(new BoxLayout(statusPanel, BoxLayout.X_AXIS)); final JLabel statusLabel = new JLabel("you are now connected"); statusLabel.setHorizontalAlignment(SwingConstants.LEFT); statusPanel.add(statusLabel); statusLabel.setVisible(true); ConnectButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Connection con = new Connection(); if (con.isConnected()) { statusLabel.setText("Connected Successfully ......."); } else { statusLabel.setText("Please Wait ......."); try { Thread.sleep(60000 * 4); } catch (InterruptedException e1) { System.out.println("Interrupted at " + new Date()); } con = new Connection(); } } }); back.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { new AddDeviceView().setVisible(true); dispose(); } catch (IOException | JSONException e1) { e1.printStackTrace(); } } }); } }
UTF-8
Java
6,316
java
ConnectToServerView.java
Java
[]
null
[]
package fmd_desktop_clint.views; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.util.Date; import javax.imageio.ImageIO; import javax.swing.BorderFactory; import javax.swing.BoxLayout; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JPanel; import javax.swing.SwingConstants; import javax.swing.border.BevelBorder; import javax.swing.border.Border; import org.json.JSONException; import fmd_desktop_clint.socet.Connection; import fmd_desktop_clint.util.CommonUtil; import fmd_desktop_clint.util.Constants; import fmd_desktop_clint.util.SuperUtil; @SuppressWarnings("serial") public class ConnectToServerView extends JFrame { private static String hostname; public ConnectToServerView() { super("Find My Device | Connect To Server"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setResizable(false); setBounds(250, 115, 800, 550); JPanel panel = new JPanel(); add(panel); URL url = getClass().getResource("/resources/logo.png"); ImageIcon icon = new ImageIcon(url); setIconImage(icon.getImage()); placeComponents(panel); setVisible(true); JMenuBar menuBar = new JMenuBar(); setJMenuBar(menuBar); // Define and add two drop down menu to the menubar JMenu web = new JMenu("Web"); JMenu helpMenu = new JMenu("Help"); JMenu aboutMenu = new JMenu("about"); JMenu dataMenu = new JMenu("Data"); JMenu logoutMenu = new JMenu("logout"); menuBar.add(web); menuBar.add(helpMenu); menuBar.add(aboutMenu); menuBar.add(dataMenu); menuBar.add(logoutMenu); // Create and add simple menu item to one of the drop down menu JMenuItem openAction = new JMenuItem("Open"); JMenuItem exitAction = new JMenuItem("Exit"); JMenuItem logoutAction = new JMenuItem("logout"); JMenuItem logsAction = new JMenuItem("show logs"); web.add(openAction); web.addSeparator(); web.add(exitAction); logoutMenu.add(logoutAction); dataMenu.add(logsAction); exitAction.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { System.exit(0); } }); logsAction.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { try { if ((new File(Constants.LOG_FILE)).exists()) { Process p = Runtime.getRuntime() .exec("rundll32 url.dll,FileProtocolHandler " + Constants.LOG_FILE); p.waitFor(); } } catch (Exception ex) { ex.printStackTrace(); } } }); logoutAction.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { try { SuperUtil.logout(); dispose(); new LoginView(); } catch (IOException e) { e.printStackTrace(); } } }); openAction.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { try { String url = "http://" + hostname + ":8080/fmd/"; java.awt.Desktop.getDesktop().browse(java.net.URI.create(url)); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }); try { hostname = CommonUtil.getHostName(); } catch (IOException e) { e.printStackTrace(); } } private void placeComponents(JPanel panel) { panel.setLayout(null); BufferedImage myPicture, iconProfile; try { iconProfile = ImageIO.read(new File(getClass().getResource("/resources/userpic.jpg").getPath())); JLabel iconProfileLab = new JLabel(new ImageIcon(iconProfile)); iconProfileLab.setBounds(100, 80, 150, 150); Border border = BorderFactory.createLineBorder(Color.BLACK, 5); iconProfileLab.setBorder(border); iconProfileLab.setOpaque(false); panel.add(iconProfileLab); myPicture = ImageIO.read(new File(getClass().getResource("/resources/bkimage.jpg").getPath())); JLabel picLabel = new JLabel(new ImageIcon(myPicture)); picLabel.setBounds(-100, 0, 1000, 150); panel.add(picLabel); } catch (IOException e2) { e2.printStackTrace(); } JButton ConnectButton = new JButton("CONNECT TO OUR SERVER"); ConnectButton.setBounds(100, 250, 600, 80); ConnectButton.setFont(new Font("Serif", Font.PLAIN, 25)); ConnectButton.setForeground(Color.BLACK); panel.add(ConnectButton); JButton back = new JButton("BACK TO HOME"); back.setBounds(100, 360, 600, 80); back.setFont(new Font("Serif", Font.PLAIN, 25)); back.setForeground(Color.BLACK); panel.add(back); final JPanel statusPanel = new JPanel(); statusPanel.setBorder(new BevelBorder(BevelBorder.LOWERED)); add(statusPanel, BorderLayout.SOUTH); statusPanel.setPreferredSize(new Dimension(getWidth(), 16)); statusPanel.setLayout(new BoxLayout(statusPanel, BoxLayout.X_AXIS)); final JLabel statusLabel = new JLabel("you are now connected"); statusLabel.setHorizontalAlignment(SwingConstants.LEFT); statusPanel.add(statusLabel); statusLabel.setVisible(true); ConnectButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Connection con = new Connection(); if (con.isConnected()) { statusLabel.setText("Connected Successfully ......."); } else { statusLabel.setText("Please Wait ......."); try { Thread.sleep(60000 * 4); } catch (InterruptedException e1) { System.out.println("Interrupted at " + new Date()); } con = new Connection(); } } }); back.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { new AddDeviceView().setVisible(true); dispose(); } catch (IOException | JSONException e1) { e1.printStackTrace(); } } }); } }
6,316
0.684452
0.670994
217
27.105991
20.608549
100
false
false
0
0
0
0
0
0
2.732719
false
false
10
2d3d28176fe7704b51f87bb00d4875333d75bfce
1,477,468,816,765
080963e5c8f2cf5fd69b8cad789886b205485a23
/src/main/java/com/fuhao/service/FcUnitService.java
6b70c0ae9ffdcc80d587df68a8468dfbddbd5a27
[]
no_license
aifujiahao/family_service_platform
https://github.com/aifujiahao/family_service_platform
3ad40b85b48ad5040f16758fef5625ef119620ac
1eb7c7c407b1bd5d6506e664eed48f522f7491ca
refs/heads/master
2022-12-16T17:32:52.781000
2020-09-23T13:42:10
2020-09-23T13:42:10
297,979,932
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.fuhao.service; import com.fuhao.bean.FcUnit; import com.baomidou.mybatisplus.extension.service.IService; /** * <p> * 单元信息表 服务类 * </p> * * @author hao * @since 2020-09-21 */ public interface FcUnitService extends IService<FcUnit> { }
UTF-8
Java
271
java
FcUnitService.java
Java
[ { "context": "ce;\n\n/**\n * <p>\n * 单元信息表 服务类\n * </p>\n *\n * @author hao\n * @since 2020-09-21\n */\npublic interface FcUnitS", "end": 168, "score": 0.9988673329353333, "start": 165, "tag": "USERNAME", "value": "hao" } ]
null
[]
package com.fuhao.service; import com.fuhao.bean.FcUnit; import com.baomidou.mybatisplus.extension.service.IService; /** * <p> * 单元信息表 服务类 * </p> * * @author hao * @since 2020-09-21 */ public interface FcUnitService extends IService<FcUnit> { }
271
0.701961
0.670588
16
14.9375
18.582481
59
false
false
0
0
0
0
0
0
0.1875
false
false
10
f8cc12f2e16ae42f162c401a40754195ea6afacd
5,841,155,543,005
211e0162004b03455839879773c909a4d4868a2f
/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTAnnotationMemberList.java
d36eab477a2369ac6656014f1f8087d3448de32f
[ "BSD-3-Clause", "Apache-2.0" ]
permissive
pmd/pmd
https://github.com/pmd/pmd
460ca96dfcc5d25b5b3e78fc8731593dc6ddf8d3
512d6cbb8d198119a588b84c238ed78d75abda0c
refs/heads/master
2023-09-04T05:58:54.224000
2023-08-31T14:20:57
2023-08-31T14:20:57
4,992,906
4,409
1,671
NOASSERTION
false
2023-09-14T08:13:05
2012-07-11T18:03:00
2023-09-13T12:22:00
2023-09-12T11:10:15
440,287
4,402
1,446
659
Java
false
false
/** * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ package net.sourceforge.pmd.lang.java.ast; import net.sourceforge.pmd.lang.java.ast.ASTList.ASTMaybeEmptyListOf; /** * Represents the list of {@link ASTMemberValuePair member-value pairs} * in an {@link ASTAnnotation annotation}. * * <pre class="grammar"> * * AnnotationMemberList ::= "(" {@link ASTMemberValuePair MemberValuePair} ( "," {@link ASTMemberValuePair MemberValuePair} )* ")" * | "(" {@link ASTMemberValuePair ValueShorthand} ")" * | "(" ")" * * </pre> */ public final class ASTAnnotationMemberList extends ASTMaybeEmptyListOf<ASTMemberValuePair> { ASTAnnotationMemberList(int id) { super(id, ASTMemberValuePair.class); } /** * Returns the value of the attribute with the given name, returns * null if no such attribute was mentioned. * * @param attrName Name of an attribute */ public ASTMemberValue getAttribute(String attrName) { return toStream().filter(it -> it.getName().equals(attrName)).map(ASTMemberValuePair::getValue).first(); } @Override protected <P, R> R acceptVisitor(JavaVisitor<? super P, ? extends R> visitor, P data) { return visitor.visit(this, data); } }
UTF-8
Java
1,320
java
ASTAnnotationMemberList.java
Java
[]
null
[]
/** * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ package net.sourceforge.pmd.lang.java.ast; import net.sourceforge.pmd.lang.java.ast.ASTList.ASTMaybeEmptyListOf; /** * Represents the list of {@link ASTMemberValuePair member-value pairs} * in an {@link ASTAnnotation annotation}. * * <pre class="grammar"> * * AnnotationMemberList ::= "(" {@link ASTMemberValuePair MemberValuePair} ( "," {@link ASTMemberValuePair MemberValuePair} )* ")" * | "(" {@link ASTMemberValuePair ValueShorthand} ")" * | "(" ")" * * </pre> */ public final class ASTAnnotationMemberList extends ASTMaybeEmptyListOf<ASTMemberValuePair> { ASTAnnotationMemberList(int id) { super(id, ASTMemberValuePair.class); } /** * Returns the value of the attribute with the given name, returns * null if no such attribute was mentioned. * * @param attrName Name of an attribute */ public ASTMemberValue getAttribute(String attrName) { return toStream().filter(it -> it.getName().equals(attrName)).map(ASTMemberValuePair::getValue).first(); } @Override protected <P, R> R acceptVisitor(JavaVisitor<? super P, ? extends R> visitor, P data) { return visitor.visit(this, data); } }
1,320
0.658333
0.658333
41
31.195122
35.369976
130
false
false
0
0
0
0
0
0
0.365854
false
false
10
83e86dc1017a465bd3a4e057bfc066902a435905
21,715,354,689,158
289e4466174d3ea4f91f383f62a8efc57577113d
/Six4/src/Fibonacci.java
a7db5088b1d8f47c8c2c24fb03631866f3eb9a62
[]
no_license
zhzack/javaProject
https://github.com/zhzack/javaProject
2b6b01e883ba9fff526fcf8b52e9899efeca6236
77dd5df2c5e9828af9c426ebc499d1db65281b62
refs/heads/master
2020-05-18T02:25:36.001000
2019-04-29T17:35:23
2019-04-29T17:35:23
184,114,118
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.Scanner; public class Fibonacci { static int[] b = new int[100]; static int test3(int a,int b,int c) { if (a == 0) { return 0; } else if (a == 1) { return 1; } else { return test1(a - 2) + test1(a - 1); } } static int test2(int a) { b[0] = 0; b[1] = 1; if (a < index()) { return b[a]; } else { b[index()] = b[index() - 1] + b[index() - 2]; if (index() - 1 == a) { return b[index() - 1]; } else { return test2(a); } } } static int index() {// 判别储放数列的实际大小,返回当前数列索引 for (int i = 2; i < b.length; i++) { if (b[i] == 0) { return i; } } return 2;// 数组默认大小为二,而索引为二时指向数组中第三个数字,因此for循环从2开始遍历,查询第 i 个数等于零 } static int test1(int a) { if (a == 0) { return 0; } else if (a == 1) { return 1; } else { System.out.println(test1(a - 2) + test1(a - 1)); return test1(a - 2) + test1(a - 1); } } public static void main(String[] args) { // System.out.println("请输入您要求的斐波那契数列(一百以内)"); // @SuppressWarnings("resource") // Scanner sc = new Scanner(System.in); // int f = sc.nextInt(); // test2(f); // for (int i = 0; i < f; i++) { // // System.out.println("第" + i + "位:" + b[i]); // } for (int i = 0; i < 46; i++) { System.out.println("第" + i + "位:" + test1(i)); } } }
GB18030
Java
1,473
java
Fibonacci.java
Java
[]
null
[]
import java.util.Scanner; public class Fibonacci { static int[] b = new int[100]; static int test3(int a,int b,int c) { if (a == 0) { return 0; } else if (a == 1) { return 1; } else { return test1(a - 2) + test1(a - 1); } } static int test2(int a) { b[0] = 0; b[1] = 1; if (a < index()) { return b[a]; } else { b[index()] = b[index() - 1] + b[index() - 2]; if (index() - 1 == a) { return b[index() - 1]; } else { return test2(a); } } } static int index() {// 判别储放数列的实际大小,返回当前数列索引 for (int i = 2; i < b.length; i++) { if (b[i] == 0) { return i; } } return 2;// 数组默认大小为二,而索引为二时指向数组中第三个数字,因此for循环从2开始遍历,查询第 i 个数等于零 } static int test1(int a) { if (a == 0) { return 0; } else if (a == 1) { return 1; } else { System.out.println(test1(a - 2) + test1(a - 1)); return test1(a - 2) + test1(a - 1); } } public static void main(String[] args) { // System.out.println("请输入您要求的斐波那契数列(一百以内)"); // @SuppressWarnings("resource") // Scanner sc = new Scanner(System.in); // int f = sc.nextInt(); // test2(f); // for (int i = 0; i < f; i++) { // // System.out.println("第" + i + "位:" + b[i]); // } for (int i = 0; i < 46; i++) { System.out.println("第" + i + "位:" + test1(i)); } } }
1,473
0.504247
0.469498
74
16.486486
16.449139
65
false
false
0
0
0
0
0
0
2.094594
false
false
10
2a2a2e890fa91bd842e3e63ae223b158ad795172
609,885,413,737
3323c548b146c9dada3a8d62477f88f578d9da9e
/shetland/core/src/main/java/org/n52/shetland/ogc/AbstractSupportedStringType.java
ef8845f25e2d79b68133f8a638cda792b599007c
[ "Apache-2.0", "LGPL-2.1-only", "BSD-3-Clause", "SSPL-1.0", "CC0-1.0", "GPL-2.0-only", "CDDL-1.1", "GPL-3.0-only", "EPL-1.0", "W3C", "EPL-2.0", "Classpath-exception-2.0", "CDDL-1.0", "LicenseRef-scancode-public-domain", "MIT", "Elastic-2.0", "LGPL-2.1-or-later", "SAX-PD", "MPL-2.0", "LicenseRef-scancode-generic-cla", "LicenseRef-scancode-free-unknown" ]
permissive
52North/arctic-sea
https://github.com/52North/arctic-sea
8318d6fccf6b963b2d415dd47f8f6a26ee20655b
23b263a8ab957bda5718c2132e51a7761d68be4f
refs/heads/master
2023-07-23T06:53:57.196000
2023-07-10T10:51:56
2023-07-10T10:51:56
78,851,588
27
42
Apache-2.0
false
2023-04-04T02:30:50
2017-01-13T13:29:18
2023-04-01T09:07:00
2023-04-04T02:30:49
18,413
24
36
33
Java
false
false
/* * Copyright (C) 2015-2022 52°North Spatial Information Research 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 org.n52.shetland.ogc; import java.util.Objects; import com.google.common.base.MoreObjects; /** * TODO JavaDoc * * @author Christian Autermann */ public abstract class AbstractSupportedStringType implements SupportedType { private final String value; public AbstractSupportedStringType(String value) { this.value = value; } public String getValue() { return this.value; } @Override public int hashCode() { return Objects.hash(getValue()); } @Override public boolean equals(Object obj) { if (obj == null || getClass() != obj.getClass()) { return false; } AbstractSupportedStringType that = (AbstractSupportedStringType) obj; return Objects.equals(this.getValue(), that.getValue()); } @Override public String toString() { return MoreObjects.toStringHelper(this).add("value", getValue()).toString(); } }
UTF-8
Java
1,589
java
AbstractSupportedStringType.java
Java
[ { "context": "se.MoreObjects;\n\n/**\n * TODO JavaDoc\n *\n * @author Christian Autermann\n */\npublic abstract class AbstractSupportedString", "end": 789, "score": 0.9997092485427856, "start": 770, "tag": "NAME", "value": "Christian Autermann" } ]
null
[]
/* * Copyright (C) 2015-2022 52°North Spatial Information Research 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 org.n52.shetland.ogc; import java.util.Objects; import com.google.common.base.MoreObjects; /** * TODO JavaDoc * * @author <NAME> */ public abstract class AbstractSupportedStringType implements SupportedType { private final String value; public AbstractSupportedStringType(String value) { this.value = value; } public String getValue() { return this.value; } @Override public int hashCode() { return Objects.hash(getValue()); } @Override public boolean equals(Object obj) { if (obj == null || getClass() != obj.getClass()) { return false; } AbstractSupportedStringType that = (AbstractSupportedStringType) obj; return Objects.equals(this.getValue(), that.getValue()); } @Override public String toString() { return MoreObjects.toStringHelper(this).add("value", getValue()).toString(); } }
1,576
0.685139
0.675063
58
26.379311
26.699366
84
false
false
0
0
0
0
0
0
0.344828
false
false
10
2a84437d20a7f57796b29a29ee6be2a46edcae71
26,577,257,696,079
07f671ece9948eeb17d482d7285f175ae68792bb
/src/main/java/com/webproject/chatservice/models/ChatMessage.java
5e87c398fa03e08ddb9d14bcf058c83d8d787422
[]
no_license
Loafly/Springboot-Webproject-ChatService
https://github.com/Loafly/Springboot-Webproject-ChatService
9275bce7179f561c9ed8deac46934932a43d35d5
bdb823d801a82787803599596a3ccb008c1f91f2
refs/heads/main
2023-04-10T17:26:17.092000
2021-04-22T10:49:20
2021-04-22T10:49:20
356,158,107
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.webproject.chatservice.models; import com.webproject.chatservice.dto.ChatMessageRequestDto; import com.webproject.chatservice.service.UserService; import lombok.*; import javax.persistence.*; import java.time.LocalDateTime; @Entity @Getter @Setter @NoArgsConstructor @AllArgsConstructor public class ChatMessage { public enum MessageType { ENTER, TALK, QUIT } @Id @GeneratedValue( strategy = GenerationType.IDENTITY) @Column private Long id; @Column private MessageType type; @Column private String roomId; @ManyToOne(fetch = FetchType.EAGER) @JoinColumn(name = "user_id_joined") private User user; // Redis MessageListener 로 뒙소켓을 통해 바로 채팅방에 메시지를 전달해주기 위한 값을 따로 설정해주었다 @Column private Long userId; @Column private String sender; @Column private String message; @Column private String createdAt; @Builder public ChatMessage(MessageType type, String roomId, Long userId, String sender, String senderEmail, String senderImg, String message, String createdAt) { this.type = type; this.roomId = roomId; this.user = null; this.userId = userId; this.sender = sender; this.message = message; this.createdAt = createdAt; } @Builder public ChatMessage(ChatMessageRequestDto chatMessageRequestDto) { this.type = chatMessageRequestDto.getType(); this.roomId = chatMessageRequestDto.getRoomId(); this.user = null; this.userId = chatMessageRequestDto.getUserId(); this.sender = chatMessageRequestDto.getSender(); this.message = chatMessageRequestDto.getMessage(); this.createdAt = chatMessageRequestDto.getCreatedAt(); } @Builder public ChatMessage(ChatMessageRequestDto chatMessageRequestDto, UserService userService) { this.type = chatMessageRequestDto.getType(); this.roomId = chatMessageRequestDto.getRoomId(); this.user = userService.findById(chatMessageRequestDto.getUserId()); this.userId = chatMessageRequestDto.getUserId(); this.sender = chatMessageRequestDto.getSender(); this.message = chatMessageRequestDto.getMessage(); this.createdAt = chatMessageRequestDto.getCreatedAt(); } }
UTF-8
Java
2,372
java
ChatMessage.java
Java
[]
null
[]
package com.webproject.chatservice.models; import com.webproject.chatservice.dto.ChatMessageRequestDto; import com.webproject.chatservice.service.UserService; import lombok.*; import javax.persistence.*; import java.time.LocalDateTime; @Entity @Getter @Setter @NoArgsConstructor @AllArgsConstructor public class ChatMessage { public enum MessageType { ENTER, TALK, QUIT } @Id @GeneratedValue( strategy = GenerationType.IDENTITY) @Column private Long id; @Column private MessageType type; @Column private String roomId; @ManyToOne(fetch = FetchType.EAGER) @JoinColumn(name = "user_id_joined") private User user; // Redis MessageListener 로 뒙소켓을 통해 바로 채팅방에 메시지를 전달해주기 위한 값을 따로 설정해주었다 @Column private Long userId; @Column private String sender; @Column private String message; @Column private String createdAt; @Builder public ChatMessage(MessageType type, String roomId, Long userId, String sender, String senderEmail, String senderImg, String message, String createdAt) { this.type = type; this.roomId = roomId; this.user = null; this.userId = userId; this.sender = sender; this.message = message; this.createdAt = createdAt; } @Builder public ChatMessage(ChatMessageRequestDto chatMessageRequestDto) { this.type = chatMessageRequestDto.getType(); this.roomId = chatMessageRequestDto.getRoomId(); this.user = null; this.userId = chatMessageRequestDto.getUserId(); this.sender = chatMessageRequestDto.getSender(); this.message = chatMessageRequestDto.getMessage(); this.createdAt = chatMessageRequestDto.getCreatedAt(); } @Builder public ChatMessage(ChatMessageRequestDto chatMessageRequestDto, UserService userService) { this.type = chatMessageRequestDto.getType(); this.roomId = chatMessageRequestDto.getRoomId(); this.user = userService.findById(chatMessageRequestDto.getUserId()); this.userId = chatMessageRequestDto.getUserId(); this.sender = chatMessageRequestDto.getSender(); this.message = chatMessageRequestDto.getMessage(); this.createdAt = chatMessageRequestDto.getCreatedAt(); } }
2,372
0.697917
0.697917
81
27.456791
27.130253
157
false
false
0
0
0
0
0
0
0.555556
false
false
10
0f388fcb0d188ed16a1ac3a45422597f776a2336
11,871,289,654,360
554eec0278147e665c3c68c259e674adcede5362
/src/main/java/com/example/management/Hotel.java
63490d61cdae55aed14274efec21b39818f6d27c
[]
no_license
subhang/StaffAllocation
https://github.com/subhang/StaffAllocation
ded8b27397623e4c3a28aaaf067f8d1667ef40e0
0506f76acf1523325be5b184a04efebd31d75e81
refs/heads/master
2020-03-22T19:48:16.733000
2018-07-13T11:16:08
2018-07-13T11:16:08
140,551,865
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.management; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name = "hotels") public class Hotel { @Id private int hotel_id; private String hotel_name; private int manager_id; private int cluster_id; private int total_rooms; private int current_rooms; private int current_staff; private float ratio; public Hotel(){ } //yo yo public Hotel(Hotel hotel){ this.hotel_id = hotel.hotel_id; this.hotel_name = hotel.hotel_name; this.manager_id = hotel.manager_id; this.cluster_id = hotel.cluster_id; this.total_rooms = hotel.total_rooms; this.current_rooms = hotel.current_rooms; this.current_staff = hotel.current_staff; this.ratio = (float) hotel.current_rooms / (float) hotel.current_staff ; } public Hotel(int hotel_id, String hotel_name, int manager_id, int total_rooms, int current_rooms, int current_staff, float ratio, int cluster_id) { this.hotel_id = hotel_id; this.hotel_name = hotel_name; this.manager_id = manager_id; this.total_rooms = total_rooms; this.current_rooms = current_rooms; this.current_staff = current_staff; this.ratio = (float) current_rooms / (float) current_staff ; this.cluster_id = cluster_id; } public int getHotel_id() { return hotel_id; } public void setHotel_id(int hotel_id) { this.hotel_id = hotel_id; } public String getHotel_name() { return hotel_name; } public void setHotel_name(String hotel_name) { this.hotel_name = hotel_name; } public int getManager_id() { return manager_id; } public void setManager_id(int manager_id) { this.manager_id = manager_id; } public int getCluster_id() { return cluster_id; } public void setCluster_id(int cluster_id) { this.cluster_id = cluster_id; } public int getTotal_rooms() { return total_rooms; } public void setTotal_rooms(int total_rooms) { this.total_rooms = total_rooms; } public int getCurrent_rooms() { return current_rooms; } public void setCurrent_rooms(int current_rooms) { this.current_rooms = current_rooms; } public int getCurrent_staff() { return current_staff; } public void setCurrent_staff(int current_staff) { this.current_staff = current_staff; } public float getRatio() { return ratio; } public void setRatio(float ratio) { this.ratio = ratio; } public void updateRatio(){ this.ratio = (float) current_rooms / (float) current_staff ; } }
UTF-8
Java
2,805
java
Hotel.java
Java
[]
null
[]
package com.example.management; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name = "hotels") public class Hotel { @Id private int hotel_id; private String hotel_name; private int manager_id; private int cluster_id; private int total_rooms; private int current_rooms; private int current_staff; private float ratio; public Hotel(){ } //yo yo public Hotel(Hotel hotel){ this.hotel_id = hotel.hotel_id; this.hotel_name = hotel.hotel_name; this.manager_id = hotel.manager_id; this.cluster_id = hotel.cluster_id; this.total_rooms = hotel.total_rooms; this.current_rooms = hotel.current_rooms; this.current_staff = hotel.current_staff; this.ratio = (float) hotel.current_rooms / (float) hotel.current_staff ; } public Hotel(int hotel_id, String hotel_name, int manager_id, int total_rooms, int current_rooms, int current_staff, float ratio, int cluster_id) { this.hotel_id = hotel_id; this.hotel_name = hotel_name; this.manager_id = manager_id; this.total_rooms = total_rooms; this.current_rooms = current_rooms; this.current_staff = current_staff; this.ratio = (float) current_rooms / (float) current_staff ; this.cluster_id = cluster_id; } public int getHotel_id() { return hotel_id; } public void setHotel_id(int hotel_id) { this.hotel_id = hotel_id; } public String getHotel_name() { return hotel_name; } public void setHotel_name(String hotel_name) { this.hotel_name = hotel_name; } public int getManager_id() { return manager_id; } public void setManager_id(int manager_id) { this.manager_id = manager_id; } public int getCluster_id() { return cluster_id; } public void setCluster_id(int cluster_id) { this.cluster_id = cluster_id; } public int getTotal_rooms() { return total_rooms; } public void setTotal_rooms(int total_rooms) { this.total_rooms = total_rooms; } public int getCurrent_rooms() { return current_rooms; } public void setCurrent_rooms(int current_rooms) { this.current_rooms = current_rooms; } public int getCurrent_staff() { return current_staff; } public void setCurrent_staff(int current_staff) { this.current_staff = current_staff; } public float getRatio() { return ratio; } public void setRatio(float ratio) { this.ratio = ratio; } public void updateRatio(){ this.ratio = (float) current_rooms / (float) current_staff ; } }
2,805
0.615686
0.615686
121
22.181818
22.335903
151
false
false
0
0
0
0
0
0
0.429752
false
false
10
1dd45f8ac0d85b63ea94963588d7ac95f98d6626
13,907,104,152,590
49e18b69e1b9292d038d72d728e8de5570ca0dee
/src/main/java/com/workflow/oozie/nodes/End.java
4d21f26f2c716255cd0012d3bff406b8e1b76570
[]
no_license
smahamkl/Dynamic-oozie-workflow-generator
https://github.com/smahamkl/Dynamic-oozie-workflow-generator
4fa4ce544a306db73e6cdf1d5e39f714b3255244
d14673d79f60fb1961e2ae197b5ecfb519180ff0
refs/heads/master
2020-04-24T06:51:23.843000
2019-04-30T07:13:58
2019-04-30T07:13:58
171,779,885
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.workflow.oozie.nodes; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlType; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "END") public class End { @XmlAttribute(name = "name", required = true) protected String name; /** * Gets the value of the name property. * * @return * possible object is * {@link String } * */ public String getName() { return name; } /** * Sets the value of the name property. * * @param value * allowed object is * {@link String } * */ public void setName(String value) { this.name = value; } }
UTF-8
Java
825
java
End.java
Java
[]
null
[]
package com.workflow.oozie.nodes; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlType; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "END") public class End { @XmlAttribute(name = "name", required = true) protected String name; /** * Gets the value of the name property. * * @return * possible object is * {@link String } * */ public String getName() { return name; } /** * Sets the value of the name property. * * @param value * allowed object is * {@link String } * */ public void setName(String value) { this.name = value; } }
825
0.598788
0.598788
40
19.625
16.279877
49
false
false
0
0
0
0
0
0
0.225
false
false
10
883eb607538332ab26a9a6543f73b1005af338bc
21,449,066,731,421
fea5522df6ba6451b277f5169688aa9cf1aa2214
/src/main/java/de/patrickgotthard/newsreadr/android/common/rest/AsyncResult.java
f5460f55e9390b93b6bedf936b7329069dafa730
[]
no_license
PatrickGotthard/newsreadr-android
https://github.com/PatrickGotthard/newsreadr-android
e6aa5ab7c228df602df3776fba9c7548dd1d9762
bababf5a02db9a3416e92eb76353b2768f0f0655
refs/heads/master
2016-08-07T23:59:38.196000
2015-11-22T09:18:20
2015-11-22T09:18:20
18,379,777
0
0
null
false
2015-08-19T19:39:40
2014-04-02T20:08:52
2014-07-17T18:38:19
2015-08-19T19:39:40
316
0
0
0
Java
null
null
package de.patrickgotthard.newsreadr.android.common.rest; /** * Result wrapper for AsyncTask implementations. * * @author Patrick Gotthard * @param <T> Type of the result data */ public class AsyncResult<T> { private final T data; private final Exception exception; public AsyncResult(final Exception exception) { this.data = null; this.exception = exception; } public AsyncResult(final T data) { this.data = data; this.exception = null; } public T getData() { return this.data; } public Exception getException() { return this.exception; } }
UTF-8
Java
674
java
AsyncResult.java
Java
[ { "context": "per for AsyncTask implementations.\r\n *\r\n * @author Patrick Gotthard\r\n * @param <T> Type of the result data\r\n */\r\npubl", "end": 147, "score": 0.9998878240585327, "start": 131, "tag": "NAME", "value": "Patrick Gotthard" } ]
null
[]
package de.patrickgotthard.newsreadr.android.common.rest; /** * Result wrapper for AsyncTask implementations. * * @author <NAME> * @param <T> Type of the result data */ public class AsyncResult<T> { private final T data; private final Exception exception; public AsyncResult(final Exception exception) { this.data = null; this.exception = exception; } public AsyncResult(final T data) { this.data = data; this.exception = null; } public T getData() { return this.data; } public Exception getException() { return this.exception; } }
664
0.608309
0.608309
32
19.0625
17.629765
57
false
false
0
0
0
0
0
0
0.28125
false
false
10
53194871e411e49966e075d2fd202a4054d65393
26,731,876,487,108
a1217c1b0dbeaa80acb707cc8d6a55625a578ea1
/src/main/java/techexe/expedia/model/WishList.java
727623e252751b9d2b8904ec730eb4d859d83be4
[]
no_license
Yams23/TravelWishlistExpedia
https://github.com/Yams23/TravelWishlistExpedia
23a90cec874a94fc043a087d31ef85ab4b935e56
7dd8e2838dc753a72066928456ae525450579ccc
refs/heads/master
2021-07-24T06:01:17.531000
2017-11-05T10:53:14
2017-11-05T10:53:14
109,533,455
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package techexe.expedia.model; import com.amazonaws.services.dynamodbv2.datamodeling.*; import java.util.List; /** * Wish list details respective to any user and It maps to corresponding DynamoDB table. */ @lombok.Data @DynamoDBTable(tableName = "Wishlist") public class WishList { @DynamoDBAttribute(attributeName = "name") private String name; @DynamoDBAttribute(attributeName = "locations") private List<String> locationIds; @DynamoDBRangeKey(attributeName = "userId") private String userId; @DynamoDBHashKey(attributeName = "wishListId") private String wishListId; private String locationId; public String toString() { return "WishList Name - " + name + " belongs to User Id - " + userId; } }
UTF-8
Java
758
java
WishList.java
Java
[]
null
[]
package techexe.expedia.model; import com.amazonaws.services.dynamodbv2.datamodeling.*; import java.util.List; /** * Wish list details respective to any user and It maps to corresponding DynamoDB table. */ @lombok.Data @DynamoDBTable(tableName = "Wishlist") public class WishList { @DynamoDBAttribute(attributeName = "name") private String name; @DynamoDBAttribute(attributeName = "locations") private List<String> locationIds; @DynamoDBRangeKey(attributeName = "userId") private String userId; @DynamoDBHashKey(attributeName = "wishListId") private String wishListId; private String locationId; public String toString() { return "WishList Name - " + name + " belongs to User Id - " + userId; } }
758
0.71372
0.712401
29
25.137932
24.051273
88
false
false
0
0
0
0
0
0
0.310345
false
false
10
b4125a4c95196e4a9a033bc541d030ee3d453a2c
32,762,010,573,806
b85285e94b9385201befca9c38a7a2037732f3eb
/src/test/java/mtgdeckbuilder/frontend/topics/AddFilterTopicTest.java
442eb29a09b4aa363bd09274023b2ffea34da8e5
[]
no_license
Jarcionek/MTG-Deck-Builder
https://github.com/Jarcionek/MTG-Deck-Builder
7521de8ef4d5615936a72a8a983c1ab7b4fc6326
67ddeed85e771264b5e690530afd69cb84f92d01
refs/heads/master
2021-06-05T00:44:10.154000
2014-10-13T00:32:06
2014-10-13T00:32:06
24,560,031
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package mtgdeckbuilder.frontend.topics; import mtgdeckbuilder.data.Field; import mtgdeckbuilder.data.Filter; import mtgdeckbuilder.data.Function; import org.junit.Test; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; public class AddFilterTopicTest { private static final Filter FILTER = new Filter(Field.artist, Function.gte, "123"); private AddFilterTopic topic = new AddFilterTopic(); @Test public void notifiesSubscribers() { AddFilterTopic.Subscriber subscriberOne = mock(AddFilterTopic.Subscriber.class); AddFilterTopic.Subscriber subscriberTwo = mock(AddFilterTopic.Subscriber.class); topic.addSubscriber(subscriberOne); topic.addSubscriber(subscriberTwo); topic.post(FILTER); verify(subscriberOne, times(1)).filterAdded(FILTER); verify(subscriberTwo, times(1)).filterAdded(FILTER); verifyNoMoreInteractions(subscriberOne, subscriberTwo); } }
UTF-8
Java
1,078
java
AddFilterTopicTest.java
Java
[]
null
[]
package mtgdeckbuilder.frontend.topics; import mtgdeckbuilder.data.Field; import mtgdeckbuilder.data.Filter; import mtgdeckbuilder.data.Function; import org.junit.Test; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; public class AddFilterTopicTest { private static final Filter FILTER = new Filter(Field.artist, Function.gte, "123"); private AddFilterTopic topic = new AddFilterTopic(); @Test public void notifiesSubscribers() { AddFilterTopic.Subscriber subscriberOne = mock(AddFilterTopic.Subscriber.class); AddFilterTopic.Subscriber subscriberTwo = mock(AddFilterTopic.Subscriber.class); topic.addSubscriber(subscriberOne); topic.addSubscriber(subscriberTwo); topic.post(FILTER); verify(subscriberOne, times(1)).filterAdded(FILTER); verify(subscriberTwo, times(1)).filterAdded(FILTER); verifyNoMoreInteractions(subscriberOne, subscriberTwo); } }
1,078
0.75974
0.755102
33
31.666666
27.657721
88
false
false
0
0
0
0
0
0
0.727273
false
false
10
2a7d022750db687b5c73fad97816b2c07b4c6585
2,602,750,220,092
f3f0744b407e12b474cab73fb65ff1aeba2212a0
/exception/Window.java
6858bd50b09b160f00b63e762f377432b195ed95
[]
no_license
jiangzhonghui/jni-examples
https://github.com/jiangzhonghui/jni-examples
452eb11bc587eab5f05d7005cb8a298eb5ac38e7
86981b03f345e048140f9a7ec7eeb5185505de79
refs/heads/master
2020-04-03T16:08:03.231000
2016-04-04T11:25:17
2016-04-04T11:25:17
59,619,501
1
0
null
true
2016-05-25T00:59:04
2016-05-25T00:59:03
2016-02-21T14:38:53
2016-04-04T11:25:27
13
0
0
0
null
null
null
public class Window{ static { initIDs(); } long handle; int length; int width; static native void initIDs(); }
UTF-8
Java
127
java
Window.java
Java
[]
null
[]
public class Window{ static { initIDs(); } long handle; int length; int width; static native void initIDs(); }
127
0.629921
0.629921
9
13.111111
8.359219
31
false
false
0
0
0
0
0
0
0.555556
false
false
10
1e4929d6cb13796a84a5452eab5a4fe3bd37d852
25,194,278,182,240
63242c3a1520ff850eb7918c13aa7af4df3f6637
/src/main/java/com/erwin/cards/PokerCard.java
aaabc492032bbc79eabe808f4d266b3d5d004248
[]
no_license
UreshRanasinghe/carddeck
https://github.com/UreshRanasinghe/carddeck
8eb0aaf088c3ffb9520b4a736b4d14a1412c3f57
47ce4585e3787fc71bfe1fb0e828d568afd9752d
refs/heads/master
2021-01-25T13:24:18.290000
2018-03-02T10:44:51
2018-03-02T10:44:51
123,564,837
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.erwin.cards; /** * Class representing a card from a standard 52 card deck * * @author uresh */ public class PokerCard extends Card{ /** * Construct a PokerCard with a given rank and suit. */ public PokerCard(Rank rank, Suit suit) { super(rank, suit); } /** * ToString method * @return */ @Override public String toString(){ return "PokerCard: " + rank.toString() + " of " + suit.toString(); } }
UTF-8
Java
510
java
PokerCard.java
Java
[ { "context": "ard from a standard 52 card deck\r\n * \r\n * @author uresh\r\n */\r\npublic class PokerCard extends Card{\r\n /", "end": 115, "score": 0.8008968830108643, "start": 110, "tag": "NAME", "value": "uresh" } ]
null
[]
package com.erwin.cards; /** * Class representing a card from a standard 52 card deck * * @author uresh */ public class PokerCard extends Card{ /** * Construct a PokerCard with a given rank and suit. */ public PokerCard(Rank rank, Suit suit) { super(rank, suit); } /** * ToString method * @return */ @Override public String toString(){ return "PokerCard: " + rank.toString() + " of " + suit.toString(); } }
510
0.54902
0.545098
26
17.615385
19.928867
74
false
false
0
0
0
0
0
0
0.192308
false
false
10
56d36ccd726764dc275cb31c8c942db3440d6c58
14,525,579,429,628
6a5e53d54a8e9787b390f9c3b69db2d7153d08bb
/core/modules/spring/src/main/java/org/onetwo/common/spring/validator/BaseConstraintValidator.java
8a20ee87bfcce473a61df24e9bd0240949e81563
[ "Apache-2.0" ]
permissive
wayshall/onetwo
https://github.com/wayshall/onetwo
64374159b23fc8d06373a01ecc989db291e57714
44c9cd40bc13d91e4917c6eb6430a95f395f906a
refs/heads/master
2023-08-17T12:26:47.634000
2022-07-05T06:54:30
2022-07-05T06:54:30
47,802,308
23
13
Apache-2.0
false
2023-02-22T07:08:34
2015-12-11T03:17:58
2022-12-09T13:20:08
2023-02-22T07:08:34
59,603
18
11
32
Java
false
false
package org.onetwo.common.spring.validator; import java.util.Map; import javax.validation.ConstraintValidatorContext; import org.apache.commons.lang3.StringUtils; import org.hibernate.validator.internal.engine.constraintvalidation.ConstraintValidatorContextImpl; import org.onetwo.common.exception.BaseException; import org.onetwo.common.spring.SpringUtils; import org.springframework.beans.ConfigurablePropertyAccessor; import com.google.common.collect.Maps; /*** * @author way * */ abstract public class BaseConstraintValidator { /*** * 添加错误消息变量,以便国际化 * @author weishao zeng * @param context * @param varName * @param varValue */ protected void addMessageFormatVariable(ConstraintValidatorContext context, String varName, Object varValue) { if (StringUtils.isBlank(varName)) { throw new BaseException("varName can not be blank!"); } ConstraintValidatorContextImpl ctx = (ConstraintValidatorContextImpl)context; Map<String, Object> newAttributes = Maps.newHashMap(ctx.getConstraintDescriptor().getAttributes()); newAttributes.put(varName, varValue); ConfigurablePropertyAccessor constraintDescriptor = SpringUtils.newPropertyAccessor(ctx.getConstraintDescriptor(), true); constraintDescriptor.setPropertyValue("attributes", newAttributes); } }
UTF-8
Java
1,318
java
BaseConstraintValidator.java
Java
[ { "context": "t com.google.common.collect.Maps;\n\n/***\n * @author way\n *\n */\nabstract public class BaseConstraintValida", "end": 484, "score": 0.9952021837234497, "start": 481, "tag": "USERNAME", "value": "way" }, { "context": "Validator {\n\t\n\t/***\n\t * 添加错误消息变量,以便国际化\n\t * @author weishao zeng\n\t * @param context\n\t * @param varName\n\t * @param ", "end": 591, "score": 0.9998337030410767, "start": 579, "tag": "NAME", "value": "weishao zeng" } ]
null
[]
package org.onetwo.common.spring.validator; import java.util.Map; import javax.validation.ConstraintValidatorContext; import org.apache.commons.lang3.StringUtils; import org.hibernate.validator.internal.engine.constraintvalidation.ConstraintValidatorContextImpl; import org.onetwo.common.exception.BaseException; import org.onetwo.common.spring.SpringUtils; import org.springframework.beans.ConfigurablePropertyAccessor; import com.google.common.collect.Maps; /*** * @author way * */ abstract public class BaseConstraintValidator { /*** * 添加错误消息变量,以便国际化 * @author <NAME> * @param context * @param varName * @param varValue */ protected void addMessageFormatVariable(ConstraintValidatorContext context, String varName, Object varValue) { if (StringUtils.isBlank(varName)) { throw new BaseException("varName can not be blank!"); } ConstraintValidatorContextImpl ctx = (ConstraintValidatorContextImpl)context; Map<String, Object> newAttributes = Maps.newHashMap(ctx.getConstraintDescriptor().getAttributes()); newAttributes.put(varName, varValue); ConfigurablePropertyAccessor constraintDescriptor = SpringUtils.newPropertyAccessor(ctx.getConstraintDescriptor(), true); constraintDescriptor.setPropertyValue("attributes", newAttributes); } }
1,312
0.8
0.799225
40
31.25
34.010845
123
false
false
0
0
0
0
0
0
1.225
false
false
10
a89cb175a92234693f846a66a7e59aeeb880129c
17,265,768,566,049
4e032b1d74c93cff43a17c497d6a47750022b01a
/misc/java-security/src/main/java/com/ziv/security/util/RSAEncryptUtil.java
10f36b0a142b1ef4b0ee848bb0b3a1f4fa183342
[]
no_license
P79N6A/Ziv
https://github.com/P79N6A/Ziv
dfc320a72abb1a34e50732863036b93deca46174
158ed8e97eab0cecf99ea0afce024d50b900cc98
refs/heads/master
2020-05-29T20:15:58.082000
2019-04-04T05:17:59
2019-05-30T04:38:18
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ziv.security.util; import javax.crypto.BadPaddingException; import javax.crypto.Cipher; import javax.crypto.IllegalBlockSizeException; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.nio.charset.Charset; import java.security.Key; import java.security.KeyFactory; import java.security.KeyPair; import java.security.KeyPairGenerator; import java.security.Signature; import java.security.interfaces.RSAKey; import java.security.spec.PKCS8EncodedKeySpec; import java.security.spec.X509EncodedKeySpec; import java.util.Base64; /** * RSA公钥/私钥/签名工具包<br/> * 字符串格式的密钥在未在特殊说明情况下都为BASE64编码格式<br/> * <p> * <li>公钥加密->私钥解密</li> * <li>私钥加密->公钥解密</li> * <li>私钥签名->公钥验签</li> * * @author 张黄江 * @date 2019/3/26 */ public class RSAEncryptUtil { /** 加密算法RSA */ public static final String KEY_ALGORITHM = "RSA"; /** 签名算法 */ public static final String SIGNATURE_ALGORITHM = "MD5withRSA"; /** * RSA算法的key长度,最低值为512<br/> * 长度为1024时候加密文本长度为172<br/> * 长度为512时候加密文本长度为88<br/> **/ public static final int RSA_KEY_SIZE = 512; /** 默认的字符集:UTF-8 **/ private static Charset charset = Charset.forName("UTF-8"); /** * 生成密钥对(公钥和私钥) * * @return 一对密钥,包含公钥和私钥 * @throws Exception */ public static RSAKeyPair generateKeyPair() throws Exception { return generateKeyPair(RSA_KEY_SIZE); } /** * 生成密钥对(公钥和私钥) * * @param keySize 定义密钥的key的长度,最小为512,一般为2^N,如1024、2048等 * @return 一对密钥,包含公钥和私钥 * @throws Exception */ public static RSAKeyPair generateKeyPair(int keySize) throws Exception { KeyPairGenerator keyPairGen = KeyPairGenerator.getInstance(KEY_ALGORITHM); keyPairGen.initialize(keySize); KeyPair keyPair = keyPairGen.generateKeyPair(); return new RSAKeyPair(encodeToString(keyPair.getPublic().getEncoded()), encodeToString(keyPair.getPrivate().getEncoded())); } /** * 用私钥对信息生成数字签名 * * @param data 已加密数据 * @param privateKey 私钥(BASE64编码) * @return * @throws Exception */ public static String sign(byte[] data, String privateKey) throws Exception { Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM); byte[] bytes = privateKey.getBytes(); signature.initSign(KeyFactory.getInstance(KEY_ALGORITHM).generatePrivate(new PKCS8EncodedKeySpec(decode(bytes)))); signature.update(data); return new String(Base64.getEncoder().encode(signature.sign())); } /** * 校验数字签名 * * @param data 已加密数据 * @param publicKey 公钥(BASE64编码) * @param sign 数字签名 * @return * @throws Exception */ public static boolean verify(byte[] data, String publicKey, String sign) throws Exception { Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM); signature.initVerify(KeyFactory.getInstance(KEY_ALGORITHM).generatePublic(new X509EncodedKeySpec(decode(publicKey.getBytes())))); signature.update(data); return signature.verify(decode(sign.getBytes())); } /** * 私钥解密(字符串版) * * @param encryptedString 已加密的字符串(BASE64编码) * @param privateKey 私钥(BASE64编码) * @return 解密后的字符串(BASE64编码) * @throws Exception */ public static String decryptByPrivateKey(String encryptedString, String privateKey) throws Exception { return new String(decryptByPrivateKey(decode(encryptedString.getBytes(charset)), privateKey), charset); } /** * 私钥解密(字节数组版) * * @param encryptedData 已加密的数据(字节数组) * @param privateKey 私钥(BASE64编码) * @return 解密后的数据(字节数组) * @throws Exception */ public static byte[] decryptByPrivateKey(byte[] encryptedData, String privateKey) throws Exception { KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); Key privateK = keyFactory.generatePrivate(new PKCS8EncodedKeySpec(decode(privateKey.getBytes()))); Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm()); cipher.init(Cipher.DECRYPT_MODE, privateK); // 对数据分段解密 return getBytes(cipher, encryptedData, getDecryptMaxLength((RSAKey) privateK)); } /** * 公钥解密(字符串版) * * @param encryptedData 已加密的字符串(BASE64编码) * @param publicKey 公钥(BASE64编码) * @return 解密后的字符串 * @throws Exception */ public static String decryptByPublicKey(String encryptedData, String publicKey) throws Exception { return new String(decryptByPublicKey(Base64.getDecoder().decode(encryptedData), publicKey), charset); } /** * 公钥解密(字节数组版) * * @param encryptedData 已加密的数据(字节数组) * @param publicKey 公钥(BASE64编码) * @return 解密后的数据(字节数组) * @throws Exception */ public static byte[] decryptByPublicKey(byte[] encryptedData, String publicKey) throws Exception { KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); Key publicK = keyFactory.generatePublic(new X509EncodedKeySpec(decode(publicKey.getBytes()))); Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm()); cipher.init(Cipher.DECRYPT_MODE, publicK); // 对数据分段解密 return getBytes(cipher, encryptedData, getDecryptMaxLength((RSAKey) publicK)); } /** * 公钥加密(字符串版) * * @param data 源数据(字符串) * @param publicKey 公钥(BASE64编码) * @return 加密后的密文(字符串) * @throws Exception */ public static String encryptByPublicKey(String data, String publicKey) throws Exception { return encodeToString(encryptByPublicKey(data.getBytes(charset), publicKey)); } /** * 公钥加密(字节数组版) * * @param data 源数据(字节数组) * @param publicKey 公钥(BASE64编码) * @return 加密后的密文(字节数组) * @throws Exception */ public static byte[] encryptByPublicKey(byte[] data, String publicKey) throws Exception { KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); Key publicK = keyFactory.generatePublic(new X509EncodedKeySpec(decode(publicKey.getBytes()))); Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm()); cipher.init(Cipher.ENCRYPT_MODE, publicK); // 对数据分段加密 return getBytes(cipher, data, getEncryptMaxLength((RSAKey) publicK)); } /** * 私钥加密(字符串版) * * @param string 源数据(字符串) * @param privateKey 私钥(BASE64编码) * @return 加密的字符串(BASE64编码) * @throws Exception */ public static String encryptByPrivateKey(String string, String privateKey) throws Exception { return encodeToString(encryptByPrivateKey(string.getBytes(charset), privateKey)); } /** * 私钥加密(字节数组版) * * @param data 源数据(字节数组) * @param privateKey 私钥(BASE64编码) * @return 加密的数据(字节数组) * @throws Exception */ public static byte[] encryptByPrivateKey(byte[] data, String privateKey) throws Exception { KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); Key privateK = keyFactory.generatePrivate(new PKCS8EncodedKeySpec(decode(privateKey.getBytes()))); Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm()); cipher.init(Cipher.ENCRYPT_MODE, privateK); // 对数据分段加密 return getBytes(cipher, data, getEncryptMaxLength((RSAKey) privateK)); } /** 将原始字节数组编码为BASE64编码的字符串 **/ private static String encodeToString(byte[] src) { return Base64.getEncoder().encodeToString(src); } /** 将BASE64码解密为原始字节数组 **/ private static byte[] decode(byte[] bytes) { return Base64.getDecoder().decode(bytes); } /** * RSA最大加密明文长度,否则会抛出:IllegalBlockSizeException: Data must not be longer than 117 bytes<br/> * 加密的明文最大长度=密钥的字节数-11<br/> * 1024/8-11=128-11=117<br/> * 512/8-11=64-11=53<br/> * 为啥要减11字节呢?是因为RSA加密使用到了填充模式(padding),即内容不足117字节时会自动填满,用到填充模式自然会占用一定的字节,而且这部分字节也是参与加密的 */ private static int getEncryptMaxLength(RSAKey rsaKey) { return rsaKey.getModulus().bitLength() / 8 - 11; } /** RSA最大解密密文长度,否则会抛出:IllegalBlockSizeException: Data must not be longer than 128 bytes */ private static int getDecryptMaxLength(RSAKey rsaKey) { return rsaKey.getModulus().bitLength() / 8; } /** 使用Cipher对数据分段处理,根据maxLength分段 **/ private static byte[] getBytes(Cipher cipher, byte[] data, int maxLength) throws IOException, IllegalBlockSizeException, BadPaddingException { if (data.length <= maxLength) { return cipher.doFinal(data, 0, data.length); } else { ByteArrayOutputStream out = new ByteArrayOutputStream(); for (int remainder, thisLength, offset = 0; (remainder = data.length - offset) > 0; offset += thisLength) { out.write(cipher.doFinal(data, offset, thisLength = Math.min(remainder, maxLength))); } return out.toByteArray(); } } /** RSA的公钥私钥对 **/ public static class RSAKeyPair { private String publicKey; private String privateKey; public RSAKeyPair(String publicKey, String privateKey) { this.publicKey = publicKey; this.privateKey = privateKey; } public String getPublicKey() { return publicKey; } public String getPrivateKey() { return privateKey; } @Override public String toString() { return "RSAKeyPair{" + "publicKey='" + publicKey + '\'' + ", privateKey='" + privateKey + '\'' + '}'; } } }
UTF-8
Java
9,950
java
RSAEncryptUtil.java
Java
[ { "context": "密->公钥解密</li>\n * <li>私钥签名->公钥验签</li>\n *\n * @author 张黄江\n * @date 2019/3/26\n */\npublic class RSAEncryptUti", "end": 726, "score": 0.9997406005859375, "start": 723, "tag": "NAME", "value": "张黄江" }, { "context": ");\n\t\tKey publicK = keyFactory.generatePublic(new X509EncodedKeySpec(decode(publicKey.getBytes())));\n\t\tC", "end": 4622, "score": 0.6883807182312012, "start": 4619, "tag": "KEY", "value": "509" } ]
null
[]
package com.ziv.security.util; import javax.crypto.BadPaddingException; import javax.crypto.Cipher; import javax.crypto.IllegalBlockSizeException; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.nio.charset.Charset; import java.security.Key; import java.security.KeyFactory; import java.security.KeyPair; import java.security.KeyPairGenerator; import java.security.Signature; import java.security.interfaces.RSAKey; import java.security.spec.PKCS8EncodedKeySpec; import java.security.spec.X509EncodedKeySpec; import java.util.Base64; /** * RSA公钥/私钥/签名工具包<br/> * 字符串格式的密钥在未在特殊说明情况下都为BASE64编码格式<br/> * <p> * <li>公钥加密->私钥解密</li> * <li>私钥加密->公钥解密</li> * <li>私钥签名->公钥验签</li> * * @author 张黄江 * @date 2019/3/26 */ public class RSAEncryptUtil { /** 加密算法RSA */ public static final String KEY_ALGORITHM = "RSA"; /** 签名算法 */ public static final String SIGNATURE_ALGORITHM = "MD5withRSA"; /** * RSA算法的key长度,最低值为512<br/> * 长度为1024时候加密文本长度为172<br/> * 长度为512时候加密文本长度为88<br/> **/ public static final int RSA_KEY_SIZE = 512; /** 默认的字符集:UTF-8 **/ private static Charset charset = Charset.forName("UTF-8"); /** * 生成密钥对(公钥和私钥) * * @return 一对密钥,包含公钥和私钥 * @throws Exception */ public static RSAKeyPair generateKeyPair() throws Exception { return generateKeyPair(RSA_KEY_SIZE); } /** * 生成密钥对(公钥和私钥) * * @param keySize 定义密钥的key的长度,最小为512,一般为2^N,如1024、2048等 * @return 一对密钥,包含公钥和私钥 * @throws Exception */ public static RSAKeyPair generateKeyPair(int keySize) throws Exception { KeyPairGenerator keyPairGen = KeyPairGenerator.getInstance(KEY_ALGORITHM); keyPairGen.initialize(keySize); KeyPair keyPair = keyPairGen.generateKeyPair(); return new RSAKeyPair(encodeToString(keyPair.getPublic().getEncoded()), encodeToString(keyPair.getPrivate().getEncoded())); } /** * 用私钥对信息生成数字签名 * * @param data 已加密数据 * @param privateKey 私钥(BASE64编码) * @return * @throws Exception */ public static String sign(byte[] data, String privateKey) throws Exception { Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM); byte[] bytes = privateKey.getBytes(); signature.initSign(KeyFactory.getInstance(KEY_ALGORITHM).generatePrivate(new PKCS8EncodedKeySpec(decode(bytes)))); signature.update(data); return new String(Base64.getEncoder().encode(signature.sign())); } /** * 校验数字签名 * * @param data 已加密数据 * @param publicKey 公钥(BASE64编码) * @param sign 数字签名 * @return * @throws Exception */ public static boolean verify(byte[] data, String publicKey, String sign) throws Exception { Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM); signature.initVerify(KeyFactory.getInstance(KEY_ALGORITHM).generatePublic(new X509EncodedKeySpec(decode(publicKey.getBytes())))); signature.update(data); return signature.verify(decode(sign.getBytes())); } /** * 私钥解密(字符串版) * * @param encryptedString 已加密的字符串(BASE64编码) * @param privateKey 私钥(BASE64编码) * @return 解密后的字符串(BASE64编码) * @throws Exception */ public static String decryptByPrivateKey(String encryptedString, String privateKey) throws Exception { return new String(decryptByPrivateKey(decode(encryptedString.getBytes(charset)), privateKey), charset); } /** * 私钥解密(字节数组版) * * @param encryptedData 已加密的数据(字节数组) * @param privateKey 私钥(BASE64编码) * @return 解密后的数据(字节数组) * @throws Exception */ public static byte[] decryptByPrivateKey(byte[] encryptedData, String privateKey) throws Exception { KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); Key privateK = keyFactory.generatePrivate(new PKCS8EncodedKeySpec(decode(privateKey.getBytes()))); Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm()); cipher.init(Cipher.DECRYPT_MODE, privateK); // 对数据分段解密 return getBytes(cipher, encryptedData, getDecryptMaxLength((RSAKey) privateK)); } /** * 公钥解密(字符串版) * * @param encryptedData 已加密的字符串(BASE64编码) * @param publicKey 公钥(BASE64编码) * @return 解密后的字符串 * @throws Exception */ public static String decryptByPublicKey(String encryptedData, String publicKey) throws Exception { return new String(decryptByPublicKey(Base64.getDecoder().decode(encryptedData), publicKey), charset); } /** * 公钥解密(字节数组版) * * @param encryptedData 已加密的数据(字节数组) * @param publicKey 公钥(BASE64编码) * @return 解密后的数据(字节数组) * @throws Exception */ public static byte[] decryptByPublicKey(byte[] encryptedData, String publicKey) throws Exception { KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); Key publicK = keyFactory.generatePublic(new X509EncodedKeySpec(decode(publicKey.getBytes()))); Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm()); cipher.init(Cipher.DECRYPT_MODE, publicK); // 对数据分段解密 return getBytes(cipher, encryptedData, getDecryptMaxLength((RSAKey) publicK)); } /** * 公钥加密(字符串版) * * @param data 源数据(字符串) * @param publicKey 公钥(BASE64编码) * @return 加密后的密文(字符串) * @throws Exception */ public static String encryptByPublicKey(String data, String publicKey) throws Exception { return encodeToString(encryptByPublicKey(data.getBytes(charset), publicKey)); } /** * 公钥加密(字节数组版) * * @param data 源数据(字节数组) * @param publicKey 公钥(BASE64编码) * @return 加密后的密文(字节数组) * @throws Exception */ public static byte[] encryptByPublicKey(byte[] data, String publicKey) throws Exception { KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); Key publicK = keyFactory.generatePublic(new X509EncodedKeySpec(decode(publicKey.getBytes()))); Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm()); cipher.init(Cipher.ENCRYPT_MODE, publicK); // 对数据分段加密 return getBytes(cipher, data, getEncryptMaxLength((RSAKey) publicK)); } /** * 私钥加密(字符串版) * * @param string 源数据(字符串) * @param privateKey 私钥(BASE64编码) * @return 加密的字符串(BASE64编码) * @throws Exception */ public static String encryptByPrivateKey(String string, String privateKey) throws Exception { return encodeToString(encryptByPrivateKey(string.getBytes(charset), privateKey)); } /** * 私钥加密(字节数组版) * * @param data 源数据(字节数组) * @param privateKey 私钥(BASE64编码) * @return 加密的数据(字节数组) * @throws Exception */ public static byte[] encryptByPrivateKey(byte[] data, String privateKey) throws Exception { KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); Key privateK = keyFactory.generatePrivate(new PKCS8EncodedKeySpec(decode(privateKey.getBytes()))); Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm()); cipher.init(Cipher.ENCRYPT_MODE, privateK); // 对数据分段加密 return getBytes(cipher, data, getEncryptMaxLength((RSAKey) privateK)); } /** 将原始字节数组编码为BASE64编码的字符串 **/ private static String encodeToString(byte[] src) { return Base64.getEncoder().encodeToString(src); } /** 将BASE64码解密为原始字节数组 **/ private static byte[] decode(byte[] bytes) { return Base64.getDecoder().decode(bytes); } /** * RSA最大加密明文长度,否则会抛出:IllegalBlockSizeException: Data must not be longer than 117 bytes<br/> * 加密的明文最大长度=密钥的字节数-11<br/> * 1024/8-11=128-11=117<br/> * 512/8-11=64-11=53<br/> * 为啥要减11字节呢?是因为RSA加密使用到了填充模式(padding),即内容不足117字节时会自动填满,用到填充模式自然会占用一定的字节,而且这部分字节也是参与加密的 */ private static int getEncryptMaxLength(RSAKey rsaKey) { return rsaKey.getModulus().bitLength() / 8 - 11; } /** RSA最大解密密文长度,否则会抛出:IllegalBlockSizeException: Data must not be longer than 128 bytes */ private static int getDecryptMaxLength(RSAKey rsaKey) { return rsaKey.getModulus().bitLength() / 8; } /** 使用Cipher对数据分段处理,根据maxLength分段 **/ private static byte[] getBytes(Cipher cipher, byte[] data, int maxLength) throws IOException, IllegalBlockSizeException, BadPaddingException { if (data.length <= maxLength) { return cipher.doFinal(data, 0, data.length); } else { ByteArrayOutputStream out = new ByteArrayOutputStream(); for (int remainder, thisLength, offset = 0; (remainder = data.length - offset) > 0; offset += thisLength) { out.write(cipher.doFinal(data, offset, thisLength = Math.min(remainder, maxLength))); } return out.toByteArray(); } } /** RSA的公钥私钥对 **/ public static class RSAKeyPair { private String publicKey; private String privateKey; public RSAKeyPair(String publicKey, String privateKey) { this.publicKey = publicKey; this.privateKey = privateKey; } public String getPublicKey() { return publicKey; } public String getPrivateKey() { return privateKey; } @Override public String toString() { return "RSAKeyPair{" + "publicKey='" + publicKey + '\'' + ", privateKey='" + privateKey + '\'' + '}'; } } }
9,950
0.724003
0.707056
284
29.542253
30.166468
143
false
false
0
0
0
0
0
0
1.552817
false
false
10
9fefcc88384d8abf449a40859b32326ba7cfff86
31,207,232,399,404
26677f58bd369c8916f2eb4f11ffecc0d68d4bfa
/src/IndividualTask.java
9835ae56a95338b3869f69d32a22ad3b1b218ab7
[]
no_license
samoilovvvvv/PPVIS1laba
https://github.com/samoilovvvvv/PPVIS1laba
1309f5237dc94ae82e3af3aa14a5e93254161c02
fd7338b3292579fbf75bd597055523c795c2c4fe
refs/heads/master
2022-07-07T18:59:33.932000
2020-05-11T11:58:02
2020-05-11T11:58:02
259,305,461
1
0
null
false
2020-05-11T11:58:03
2020-04-27T12:14:50
2020-04-27T12:15:30
2020-05-11T11:58:03
9
0
0
0
null
false
false
import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.List; public class IndividualTask { private JPanel panel; public JPanel getPanel() { return this.panel; } private JButton myButton = new JButton("line"); public void task(List<JButton> buttons) { myButton.addActionListener(actionEvent -> { for (JButton button : buttons) { button.setText(button.getText() + " "); int last = button.getText().length() - 1; Timer timer = new Timer(170, actionEvent1 -> { button.setText(button.getText().charAt(last) + button.getText().substring(0, last)); }); timer.start(); } }); } public IndividualTask() { panel = new JPanel(); panel.add(myButton); } }
UTF-8
Java
923
java
IndividualTask.java
Java
[]
null
[]
import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.List; public class IndividualTask { private JPanel panel; public JPanel getPanel() { return this.panel; } private JButton myButton = new JButton("line"); public void task(List<JButton> buttons) { myButton.addActionListener(actionEvent -> { for (JButton button : buttons) { button.setText(button.getText() + " "); int last = button.getText().length() - 1; Timer timer = new Timer(170, actionEvent1 -> { button.setText(button.getText().charAt(last) + button.getText().substring(0, last)); }); timer.start(); } }); } public IndividualTask() { panel = new JPanel(); panel.add(myButton); } }
923
0.565547
0.559047
36
24.638889
23.131451
104
false
false
0
0
0
0
0
0
0.5
false
false
10
0d797ff952436bf55ebe6295001220bcc56d0ec9
31,207,232,396,707
e0397e24f4eefcab50efb986d17f7c493fd761b0
/src/arrays_Problem/TransitionPoint.java
0f9da153aba629a42ae739360a0e45f1f2cccf23
[]
no_license
vrathi3/Data-Structure-Java
https://github.com/vrathi3/Data-Structure-Java
a60659dbe4c8cdce56bc08458f7ad2b3a9658d25
dbf380943cd8adb9db1ef0c4a6fdc0276c117b89
refs/heads/main
2022-12-31T17:59:33.438000
2020-10-20T16:06:20
2020-10-20T16:06:20
303,088,372
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package arrays_Problem; public class TransitionPoint { public static int transitionPoint(int arr[], int n) { int start = 0, end = n - 1; while (start <= end) { int mid = start + end / 2; if (arr[mid] == 0) { start = mid + 1; } else if (arr[mid] == 1) { if (mid == 0 || mid > 0 && arr[mid - 1] == 0) { return mid; } else { end = mid - 1; } } } return -1; } public static void main(String[] args) { int arr[]= {0,0, 0, 0,0, 1, 1}; int result =transitionPoint(arr, arr.length-1); System.out.println(result); } }
UTF-8
Java
576
java
TransitionPoint.java
Java
[]
null
[]
package arrays_Problem; public class TransitionPoint { public static int transitionPoint(int arr[], int n) { int start = 0, end = n - 1; while (start <= end) { int mid = start + end / 2; if (arr[mid] == 0) { start = mid + 1; } else if (arr[mid] == 1) { if (mid == 0 || mid > 0 && arr[mid - 1] == 0) { return mid; } else { end = mid - 1; } } } return -1; } public static void main(String[] args) { int arr[]= {0,0, 0, 0,0, 1, 1}; int result =transitionPoint(arr, arr.length-1); System.out.println(result); } }
576
0.53125
0.496528
29
18.862068
16.277178
54
false
false
0
0
0
0
0
0
2.862069
false
false
10
abedf122bc84afffc275852e6549b0be9f3b0830
6,227,702,610,918
5b3bae7f61ab30befa986f1e79c8fbe42b6cef2a
/XYZReader/src/main/java/com/example/xyzreader/remote/RemoteEndpointUtil.java
711afba23c0f18715752b632a87b1b62d39e7044
[]
no_license
mooocer/xyz_reader
https://github.com/mooocer/xyz_reader
a49f457dc58653882f144f3bca4881139d5c22c4
8d3046498d86d311c06bdb2e66f98b2210c02abb
refs/heads/master
2022-01-06T01:35:15.931000
2019-06-17T05:36:41
2019-06-17T05:36:41
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.xyzreader.remote; import android.net.Uri; import android.util.Log; import org.json.JSONException; import org.json.JSONObject; import org.json.JSONTokener; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; import timber.log.Timber; public class RemoteEndpointUtil { private static final String TAG = "RemoteEndpointUtil"; private static String BASE_URL_STRING = "https://content.guardianapis.com/search?"; private RemoteEndpointUtil() { } public static JSONObject fetchJson() { String itemsJson = null; try { itemsJson = fetchPlainText(createUrl()); } catch (IOException e) { Log.e(TAG, "Error fetching items JSON", e); return null; } // Parse JSON try { JSONTokener tokener = new JSONTokener(itemsJson); Object val = tokener.nextValue(); if (!(val instanceof JSONObject)) { throw new JSONException("Expected JSONArray"); } return (JSONObject) val; } catch (JSONException e) { Log.e(TAG, "Error parsing items JSON", e); } return null; } static String fetchPlainText(URL url) throws IOException { OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url(url) .build(); Response response = client.newCall(request).execute(); return response.body().string(); } public static URL createUrl(){ URL url = null; Uri builtUri = Uri.parse(BASE_URL_STRING) .buildUpon() .appendQueryParameter("page-size", "20") .appendQueryParameter("api-key","test") .build(); try{ url = new URL(builtUri.toString() + "&show-fields=thumbnail,body"); }catch (MalformedURLException e){ Timber.e("problem building url from Uri"); } Timber.i("This is the built url: " + url); return url; } }
UTF-8
Java
2,188
java
RemoteEndpointUtil.java
Java
[]
null
[]
package com.example.xyzreader.remote; import android.net.Uri; import android.util.Log; import org.json.JSONException; import org.json.JSONObject; import org.json.JSONTokener; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; import timber.log.Timber; public class RemoteEndpointUtil { private static final String TAG = "RemoteEndpointUtil"; private static String BASE_URL_STRING = "https://content.guardianapis.com/search?"; private RemoteEndpointUtil() { } public static JSONObject fetchJson() { String itemsJson = null; try { itemsJson = fetchPlainText(createUrl()); } catch (IOException e) { Log.e(TAG, "Error fetching items JSON", e); return null; } // Parse JSON try { JSONTokener tokener = new JSONTokener(itemsJson); Object val = tokener.nextValue(); if (!(val instanceof JSONObject)) { throw new JSONException("Expected JSONArray"); } return (JSONObject) val; } catch (JSONException e) { Log.e(TAG, "Error parsing items JSON", e); } return null; } static String fetchPlainText(URL url) throws IOException { OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url(url) .build(); Response response = client.newCall(request).execute(); return response.body().string(); } public static URL createUrl(){ URL url = null; Uri builtUri = Uri.parse(BASE_URL_STRING) .buildUpon() .appendQueryParameter("page-size", "20") .appendQueryParameter("api-key","test") .build(); try{ url = new URL(builtUri.toString() + "&show-fields=thumbnail,body"); }catch (MalformedURLException e){ Timber.e("problem building url from Uri"); } Timber.i("This is the built url: " + url); return url; } }
2,188
0.596435
0.59415
80
26.35
21.644918
87
false
false
0
0
0
0
0
0
0.525
false
false
10
2748866ecde75846f8c5b2902edf7f84b3854687
17,162,689,344,026
b9c827974c9265973c44499069f39f676f104168
/AndroidStudioProjects/PersonalUtilitiesForLife/app/src/main/java/util/MyAssetsAndPreferences.java
73b26e9d111d870116d1251b6b6e4d5852b47299
[]
no_license
thanhnhutkmt/myproject
https://github.com/thanhnhutkmt/myproject
95971f1ee4c0a73f0e458071ffbd4ccf1d504571
014f5df06ad337f982638e23348b1070b74bea1c
refs/heads/master
2020-09-19T19:33:37.357000
2016-10-14T11:20:02
2016-10-14T11:20:02
67,346,568
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package util; import android.app.Activity; import android.content.SharedPreferences; import android.content.res.AssetFileDescriptor; import android.content.res.AssetManager; import android.graphics.Typeface; import android.media.MediaPlayer; import android.renderscript.ScriptGroup; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.List; import java.util.Set; import software.nhut.personalutilitiesforlife.constant.AppConstant; /** * Created by Nhut on 6/26/2016. */ public class MyAssetsAndPreferences { public static Typeface getFont(Activity a, int position) { try { return Typeface.createFromAsset(a.getAssets(), "font" + System.getProperty("file.separator") + a.getAssets().list(AppConstant.ASSETSFONT)[position]); } catch (IOException e) { e.printStackTrace(); return null; } } public static void playSound(Activity a, int index) { // Chay file nhac hieu ung MediaPlayer mp = new MediaPlayer(); mp.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { @Override public void onCompletion(MediaPlayer mp) { mp.reset(); // fix bug app show warning "W/MediaPlayer: mediaplayer went away with unhandled events" mp.release(); mp = null; } }); try { String []listMusic = a.getAssets().list(AppConstant.ASSETSMUSIC); AssetFileDescriptor afd = a.getAssets().openFd("music" + System.getProperty("file.separator") + listMusic[index]); mp.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength()); afd.close(); mp.prepare(); } catch (IOException e) { e.printStackTrace(); } mp.start(); } public static boolean copyAssetsToPhone(Activity a, String fileNameToSave, String path, String assetsFileWithPath) { String resultString = null; try { InputStream is = a.getAssets().open(assetsFileWithPath); resultString = MyFileIO.copyFile(fileNameToSave, path, a.getAssets().open(assetsFileWithPath), MyCheckSum.calculateMD5(is)); } catch (IOException e) { e.printStackTrace(); } return (resultString.equals("Copy ok.") || resultString.endsWith(" already existed!!")) ? true : false; } public static String getStringFromPreferences(Activity a, String key) { SharedPreferences sp = a.getSharedPreferences(AppConstant.DBNAME, Activity.MODE_PRIVATE); return sp.getString(key, ""); } public static float getFloatFromPreferences(Activity a, String key) { SharedPreferences sp = a.getSharedPreferences(AppConstant.DBNAME, Activity.MODE_PRIVATE); return sp.getFloat(key, 0); } public static Set<String> getSetFromPreferences(Activity a, String key) { SharedPreferences sp = a.getSharedPreferences(AppConstant.DBNAME, Activity.MODE_PRIVATE); return sp.getStringSet(key, null); } public static boolean saveToPreferences(Activity a, String key, String value) { SharedPreferences sp = a.getSharedPreferences(AppConstant.DBNAME, Activity.MODE_PRIVATE); SharedPreferences.Editor e = sp.edit(); e.putString(key, value); e.commit(); return true; } public static boolean saveToPreferences(Activity a, String key, float value) { SharedPreferences sp = a.getSharedPreferences(AppConstant.DBNAME, Activity.MODE_PRIVATE); SharedPreferences.Editor e = sp.edit(); e.putFloat(key, value); e.commit(); return true; } public static boolean saveToPreferences(Activity a, String key, Set<String> value) { SharedPreferences sp = a.getSharedPreferences(AppConstant.DBNAME, Activity.MODE_PRIVATE); SharedPreferences.Editor e = sp.edit(); e.putStringSet(key, value); e.commit(); return true; } public static List<String> getAssetsList(Activity a, String folder) { List<String> list = new ArrayList<>(); String []file = null; try { file = a.getAssets().list(folder); } catch (IOException e) { e.printStackTrace(); } for (String f : file) list.add(f); return list; } }
UTF-8
Java
4,474
java
MyAssetsAndPreferences.java
Java
[ { "context": "esforlife.constant.AppConstant;\n\n/**\n * Created by Nhut on 6/26/2016.\n */\npublic class MyAssetsAndPrefere", "end": 538, "score": 0.9995784163475037, "start": 534, "tag": "USERNAME", "value": "Nhut" } ]
null
[]
package util; import android.app.Activity; import android.content.SharedPreferences; import android.content.res.AssetFileDescriptor; import android.content.res.AssetManager; import android.graphics.Typeface; import android.media.MediaPlayer; import android.renderscript.ScriptGroup; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.List; import java.util.Set; import software.nhut.personalutilitiesforlife.constant.AppConstant; /** * Created by Nhut on 6/26/2016. */ public class MyAssetsAndPreferences { public static Typeface getFont(Activity a, int position) { try { return Typeface.createFromAsset(a.getAssets(), "font" + System.getProperty("file.separator") + a.getAssets().list(AppConstant.ASSETSFONT)[position]); } catch (IOException e) { e.printStackTrace(); return null; } } public static void playSound(Activity a, int index) { // Chay file nhac hieu ung MediaPlayer mp = new MediaPlayer(); mp.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { @Override public void onCompletion(MediaPlayer mp) { mp.reset(); // fix bug app show warning "W/MediaPlayer: mediaplayer went away with unhandled events" mp.release(); mp = null; } }); try { String []listMusic = a.getAssets().list(AppConstant.ASSETSMUSIC); AssetFileDescriptor afd = a.getAssets().openFd("music" + System.getProperty("file.separator") + listMusic[index]); mp.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength()); afd.close(); mp.prepare(); } catch (IOException e) { e.printStackTrace(); } mp.start(); } public static boolean copyAssetsToPhone(Activity a, String fileNameToSave, String path, String assetsFileWithPath) { String resultString = null; try { InputStream is = a.getAssets().open(assetsFileWithPath); resultString = MyFileIO.copyFile(fileNameToSave, path, a.getAssets().open(assetsFileWithPath), MyCheckSum.calculateMD5(is)); } catch (IOException e) { e.printStackTrace(); } return (resultString.equals("Copy ok.") || resultString.endsWith(" already existed!!")) ? true : false; } public static String getStringFromPreferences(Activity a, String key) { SharedPreferences sp = a.getSharedPreferences(AppConstant.DBNAME, Activity.MODE_PRIVATE); return sp.getString(key, ""); } public static float getFloatFromPreferences(Activity a, String key) { SharedPreferences sp = a.getSharedPreferences(AppConstant.DBNAME, Activity.MODE_PRIVATE); return sp.getFloat(key, 0); } public static Set<String> getSetFromPreferences(Activity a, String key) { SharedPreferences sp = a.getSharedPreferences(AppConstant.DBNAME, Activity.MODE_PRIVATE); return sp.getStringSet(key, null); } public static boolean saveToPreferences(Activity a, String key, String value) { SharedPreferences sp = a.getSharedPreferences(AppConstant.DBNAME, Activity.MODE_PRIVATE); SharedPreferences.Editor e = sp.edit(); e.putString(key, value); e.commit(); return true; } public static boolean saveToPreferences(Activity a, String key, float value) { SharedPreferences sp = a.getSharedPreferences(AppConstant.DBNAME, Activity.MODE_PRIVATE); SharedPreferences.Editor e = sp.edit(); e.putFloat(key, value); e.commit(); return true; } public static boolean saveToPreferences(Activity a, String key, Set<String> value) { SharedPreferences sp = a.getSharedPreferences(AppConstant.DBNAME, Activity.MODE_PRIVATE); SharedPreferences.Editor e = sp.edit(); e.putStringSet(key, value); e.commit(); return true; } public static List<String> getAssetsList(Activity a, String folder) { List<String> list = new ArrayList<>(); String []file = null; try { file = a.getAssets().list(folder); } catch (IOException e) { e.printStackTrace(); } for (String f : file) list.add(f); return list; } }
4,474
0.64886
0.646848
119
36.596638
32.465706
136
false
false
0
0
0
0
0
0
0.815126
false
false
10
cc56a112a921db71f3bdc4dc5df63a80958e7941
9,251,359,587,524
6103f62b53d71853bc1d3e2ca9aec262a2cd075d
/src/com/tistory/hornslied/evitaonline/chat/ChannelGUI.java
abcd3e3f70807f1abe179d2efce1c8bf63811924
[]
no_license
LudwigHornslied/EvitaOnline-Rebuilt
https://github.com/LudwigHornslied/EvitaOnline-Rebuilt
37098612f2e635ec100bf0c562b1f0171ea42d73
5e22e6b41eb7b8bcab9541a26d290a7888ba0d52
refs/heads/master
2020-03-28T18:18:58.691000
2018-11-10T02:35:51
2018-11-10T02:35:51
142,417,777
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.tistory.hornslied.evitaonline.chat; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.entity.Player; import com.tistory.hornslied.evitaonline.api.EvitaAPI; import com.tistory.hornslied.evitaonline.commons.util.C; import com.tistory.hornslied.evitaonline.commons.util.ItemUtil; import com.tistory.hornslied.evitaonline.permission.Perm; import com.tistory.hornslied.evitaonline.universe.EvitaPlayer; import fr.minuskube.inv.ClickableItem; import fr.minuskube.inv.SmartInventory; import fr.minuskube.inv.content.InventoryContents; import fr.minuskube.inv.content.InventoryProvider; public class ChannelGUI implements InventoryProvider { public static SmartInventory CONTENT = SmartInventory.builder() .id("channelGui") .provider(new ChannelGUI()) .size(1, 9) .title("채팅 채널") .build(); private static ClickableItem CHANNEL_LOCAL = ClickableItem.of( ItemUtil.create( Material.GRASS, C.BYellow + "지역채팅", C.BDarkGray + "50블럭 이내의 거리에 있는 사람에게만 보이는 채팅입니다."), e -> { Bukkit.dispatchCommand(e.getWhoClicked(), "channel local"); e.getWhoClicked().closeInventory(); }); private static ClickableItem CHANNEL_TOWN = ClickableItem.of( ItemUtil.create( Material.IRON_CHESTPLATE, C.BYellow + "마을채팅", C.BDarkGray + "같은 마을에 소속된 사람에게만 보이는 채팅입니다."), e -> { Bukkit.dispatchCommand(e.getWhoClicked(), "channel town"); e.getWhoClicked().closeInventory(); }); private static ClickableItem CHANNEL_NATION = ClickableItem.of( ItemUtil.create( Material.SHIELD, C.BYellow + "국가채팅", C.BDarkGray + "같은 국가에 소속된 사람에게만 보이는 채팅입니다."), e -> { Bukkit.dispatchCommand(e.getWhoClicked(), "channel nation"); e.getWhoClicked().closeInventory(); }); private static ClickableItem CHANNEL_GLOBAL = ClickableItem.of( ItemUtil.create( Material.EYE_OF_ENDER, C.BYellow + "전체채팅", C.BDarkGray + "서버에 접속한 모두에게 보이는 채팅입니다."), e -> { Bukkit.dispatchCommand(e.getWhoClicked(), "channel global"); e.getWhoClicked().closeInventory(); }); private static ClickableItem CHANNEL_ADMIN = ClickableItem.of( ItemUtil.create( Material.IRON_SWORD, C.BYellow + "어드민채팅", C.BDarkGray + "관리자 전용 채널."), e -> { Bukkit.dispatchCommand(e.getWhoClicked(), "channel global"); e.getWhoClicked().closeInventory(); }); @Override public void init(Player player, InventoryContents contents) { refreshGUI(player, contents); } @Override public void update(Player player, InventoryContents contents) { refreshGUI(player, contents); } private void refreshGUI(Player player, InventoryContents contents) { EvitaPlayer evitaPlayer = EvitaAPI.getEvitaPlayer(player); contents.set(0, 0, CHANNEL_LOCAL); int i = 1; if(evitaPlayer.hasTown()) { contents.set(0, i, CHANNEL_TOWN); i++; } if(evitaPlayer.hasNation()) { contents.set(0, i, CHANNEL_NATION); i++; } if(player.hasPermission(Perm.MOD)) { contents.set(0, i, CHANNEL_GLOBAL); i++; contents.set(0, i, CHANNEL_ADMIN); i++; } } }
UTF-8
Java
3,326
java
ChannelGUI.java
Java
[]
null
[]
package com.tistory.hornslied.evitaonline.chat; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.entity.Player; import com.tistory.hornslied.evitaonline.api.EvitaAPI; import com.tistory.hornslied.evitaonline.commons.util.C; import com.tistory.hornslied.evitaonline.commons.util.ItemUtil; import com.tistory.hornslied.evitaonline.permission.Perm; import com.tistory.hornslied.evitaonline.universe.EvitaPlayer; import fr.minuskube.inv.ClickableItem; import fr.minuskube.inv.SmartInventory; import fr.minuskube.inv.content.InventoryContents; import fr.minuskube.inv.content.InventoryProvider; public class ChannelGUI implements InventoryProvider { public static SmartInventory CONTENT = SmartInventory.builder() .id("channelGui") .provider(new ChannelGUI()) .size(1, 9) .title("채팅 채널") .build(); private static ClickableItem CHANNEL_LOCAL = ClickableItem.of( ItemUtil.create( Material.GRASS, C.BYellow + "지역채팅", C.BDarkGray + "50블럭 이내의 거리에 있는 사람에게만 보이는 채팅입니다."), e -> { Bukkit.dispatchCommand(e.getWhoClicked(), "channel local"); e.getWhoClicked().closeInventory(); }); private static ClickableItem CHANNEL_TOWN = ClickableItem.of( ItemUtil.create( Material.IRON_CHESTPLATE, C.BYellow + "마을채팅", C.BDarkGray + "같은 마을에 소속된 사람에게만 보이는 채팅입니다."), e -> { Bukkit.dispatchCommand(e.getWhoClicked(), "channel town"); e.getWhoClicked().closeInventory(); }); private static ClickableItem CHANNEL_NATION = ClickableItem.of( ItemUtil.create( Material.SHIELD, C.BYellow + "국가채팅", C.BDarkGray + "같은 국가에 소속된 사람에게만 보이는 채팅입니다."), e -> { Bukkit.dispatchCommand(e.getWhoClicked(), "channel nation"); e.getWhoClicked().closeInventory(); }); private static ClickableItem CHANNEL_GLOBAL = ClickableItem.of( ItemUtil.create( Material.EYE_OF_ENDER, C.BYellow + "전체채팅", C.BDarkGray + "서버에 접속한 모두에게 보이는 채팅입니다."), e -> { Bukkit.dispatchCommand(e.getWhoClicked(), "channel global"); e.getWhoClicked().closeInventory(); }); private static ClickableItem CHANNEL_ADMIN = ClickableItem.of( ItemUtil.create( Material.IRON_SWORD, C.BYellow + "어드민채팅", C.BDarkGray + "관리자 전용 채널."), e -> { Bukkit.dispatchCommand(e.getWhoClicked(), "channel global"); e.getWhoClicked().closeInventory(); }); @Override public void init(Player player, InventoryContents contents) { refreshGUI(player, contents); } @Override public void update(Player player, InventoryContents contents) { refreshGUI(player, contents); } private void refreshGUI(Player player, InventoryContents contents) { EvitaPlayer evitaPlayer = EvitaAPI.getEvitaPlayer(player); contents.set(0, 0, CHANNEL_LOCAL); int i = 1; if(evitaPlayer.hasTown()) { contents.set(0, i, CHANNEL_TOWN); i++; } if(evitaPlayer.hasNation()) { contents.set(0, i, CHANNEL_NATION); i++; } if(player.hasPermission(Perm.MOD)) { contents.set(0, i, CHANNEL_GLOBAL); i++; contents.set(0, i, CHANNEL_ADMIN); i++; } } }
3,326
0.698643
0.69509
111
26.891891
22.24246
69
false
false
0
0
0
0
0
0
2.954955
false
false
10
2ff54e051a3157c728a80c66230f6bfaf5fc767d
30,520,037,653,174
870dfed57a37eb7bb50bb008003206dd3d803431
/app/src/main/java/com/doschool/ajd/act/event/BlogDetialRefreshEvent.java
409d305e11e463858710c96cff3c674e773684dd
[]
no_license
githubyxl/ajd2018
https://github.com/githubyxl/ajd2018
fd95513d7cde5449fa84f47d6a64ca52b0f0ee92
cd6bb67fe4506770177e75f2af742d6cd9a553c1
refs/heads/master
2018-10-14T22:38:08.747000
2018-08-01T08:40:43
2018-08-01T08:40:43
138,141,108
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.doschool.ajd.act.event; public class BlogDetialRefreshEvent { }
UTF-8
Java
80
java
BlogDetialRefreshEvent.java
Java
[]
null
[]
package com.doschool.ajd.act.event; public class BlogDetialRefreshEvent { }
80
0.775
0.775
6
12.333333
16.749792
37
false
false
0
0
0
0
0
0
0.333333
false
false
2
c84b47b7eee600f5115fba263e3589f12f966210
10,411,000,781,224
02f7b12be6b0c4e657098de923bed5899036bf82
/Naver_Reserve/src/main/java/com/springbook/app/reservation/impl/ReservationVO.java
ef6b0d275c310ac93eaee55194cbbe07da589a5f
[]
no_license
Lee-kangchan/FirstStartSpring
https://github.com/Lee-kangchan/FirstStartSpring
c3554cb6d0b95fc2449387f038634a2cdf91c609
b42edbdd8ae30d3bb2d762997a5f140108974a6b
refs/heads/master
2022-12-24T07:04:45.163000
2019-12-26T10:23:19
2019-12-26T10:23:19
230,243,363
0
0
null
false
2022-12-16T07:16:10
2019-12-26T10:19:54
2019-12-26T10:23:46
2022-12-16T07:16:08
47,560
0
0
14
CSS
false
false
package com.springbook.app.reservation.impl; import java.text.DateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; public class ReservationVO { private int id; private double score; private String comment; private String reservation_name; private String reservation_tel; private String reservation_email; private String reservation_date; private int reservation_id; private int product_id; private ArrayList<int[]> product_price_id; private ArrayList<int[]> count; private String save_file_name; public String getSave_file_name() { return save_file_name; } public void setSave_file_name(String save_file_name) { this.save_file_name = save_file_name; } public String getComment() { return comment; } public void setComment(String comment) { this.comment = comment; } public int getId() { return id; } public void setId(int id) { this.id = id; } public double getScore() { return score; } public void setScore(double score) { this.score = score; } public String getReservation_name() { return reservation_name; } public void setReservation_name(String reservation_name) { this.reservation_name = reservation_name; } public String getReservation_tel() { return reservation_tel; } public void setReservation_tel(String reservation_tel) { this.reservation_tel = reservation_tel; } public String getReservation_email() { return reservation_email; } public void setReservation_email(String reservation_email) { this.reservation_email = reservation_email; } public int getReservation_id() { return reservation_id; } public void setReservation_id(int reservation_id) { this.reservation_id = reservation_id; } public ArrayList<int[]> getProduct_price_id() { return product_price_id; } public void setProduct_price_id(ArrayList<int[]> product_price_id) { this.product_price_id = product_price_id; } public ArrayList<int[]> getCount() { return count; } public void setCount(ArrayList<int[]> count) { this.count = count; } public int getProduct_id() { return product_id; } public void setProduct_id(int product_id) { this.product_id = product_id; } public String getReservation_date() { return reservation_date; } public void setReservation_date(String string) { this.reservation_date = string; } @Override public String toString() { return "ReservationVO [id=" + id + ", score=" + score + ", comment=" + comment + ", reservation_name=" + reservation_name + ", reservation_tel=" + reservation_tel + ", reservation_email=" + reservation_email + "]"; } }
UTF-8
Java
2,602
java
ReservationVO.java
Java
[]
null
[]
package com.springbook.app.reservation.impl; import java.text.DateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; public class ReservationVO { private int id; private double score; private String comment; private String reservation_name; private String reservation_tel; private String reservation_email; private String reservation_date; private int reservation_id; private int product_id; private ArrayList<int[]> product_price_id; private ArrayList<int[]> count; private String save_file_name; public String getSave_file_name() { return save_file_name; } public void setSave_file_name(String save_file_name) { this.save_file_name = save_file_name; } public String getComment() { return comment; } public void setComment(String comment) { this.comment = comment; } public int getId() { return id; } public void setId(int id) { this.id = id; } public double getScore() { return score; } public void setScore(double score) { this.score = score; } public String getReservation_name() { return reservation_name; } public void setReservation_name(String reservation_name) { this.reservation_name = reservation_name; } public String getReservation_tel() { return reservation_tel; } public void setReservation_tel(String reservation_tel) { this.reservation_tel = reservation_tel; } public String getReservation_email() { return reservation_email; } public void setReservation_email(String reservation_email) { this.reservation_email = reservation_email; } public int getReservation_id() { return reservation_id; } public void setReservation_id(int reservation_id) { this.reservation_id = reservation_id; } public ArrayList<int[]> getProduct_price_id() { return product_price_id; } public void setProduct_price_id(ArrayList<int[]> product_price_id) { this.product_price_id = product_price_id; } public ArrayList<int[]> getCount() { return count; } public void setCount(ArrayList<int[]> count) { this.count = count; } public int getProduct_id() { return product_id; } public void setProduct_id(int product_id) { this.product_id = product_id; } public String getReservation_date() { return reservation_date; } public void setReservation_date(String string) { this.reservation_date = string; } @Override public String toString() { return "ReservationVO [id=" + id + ", score=" + score + ", comment=" + comment + ", reservation_name=" + reservation_name + ", reservation_tel=" + reservation_tel + ", reservation_email=" + reservation_email + "]"; } }
2,602
0.720215
0.720215
102
24.509804
20.854654
108
false
false
0
0
0
0
0
0
1.676471
false
false
2
feb04355a26d2e48822336d750a7a227351fd43f
15,427,522,574,485
5888aa467c70af189efad4a571bb320eca6e0cf8
/src/com/xia/ssh/dao/SaleVisitDao.java
2538aa92faebea13d0ba2969d446a8b51e24707f
[]
no_license
XiaSakura/CRM-
https://github.com/XiaSakura/CRM-
966a9f7b611c799f42b085945d14e6c24442372a
fd412e6d463ea9230c3438cd4e77bab9c50dbe82
refs/heads/master
2020-06-25T06:39:31.696000
2019-07-28T02:37:26
2019-07-28T02:37:26
199,233,972
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.xia.ssh.dao; import com.xia.ssh.domain.SaleVisit; /** * 客户拜访记录的DAO的接口 * @author jt * */ public interface SaleVisitDao extends BaseDao<SaleVisit>{ }
UTF-8
Java
187
java
SaleVisitDao.java
Java
[ { "context": "domain.SaleVisit;\n\n/**\n * 客户拜访记录的DAO的接口\n * @author jt\n *\n */\npublic interface SaleVisitDao extends Base", "end": 98, "score": 0.9995251893997192, "start": 96, "tag": "USERNAME", "value": "jt" } ]
null
[]
package com.xia.ssh.dao; import com.xia.ssh.domain.SaleVisit; /** * 客户拜访记录的DAO的接口 * @author jt * */ public interface SaleVisitDao extends BaseDao<SaleVisit>{ }
187
0.718563
0.718563
11
14.090909
17.541922
57
false
false
0
0
0
0
0
0
0.181818
false
false
2
dc581acc39a37e803075741933df3d70601bb0d4
31,748,398,278,996
aed307b46c6d16064ddbcde78371c5530de37402
/app/src/main/java/com/example/srirang/nira_android/Homepage.java
24e619c256495f5a514ba6e40562deb467a08950
[]
no_license
ankurg22/NIRA-Android
https://github.com/ankurg22/NIRA-Android
93f0dd1ebc6ce0a81f7b6126098090c83d371f06
32de73c8f99bac88975f8d6da18c4e809e992eed
refs/heads/master
2021-04-03T06:22:14.461000
2018-04-08T13:26:58
2018-04-08T13:26:58
124,764,927
0
0
null
true
2018-03-11T14:29:54
2018-03-11T14:29:54
2018-03-11T14:03:09
2018-03-11T14:05:16
0
0
0
0
null
false
null
package com.example.srirang.nira_android; import android.content.Intent; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import android.widget.LinearLayout; import android.widget.Toast; import com.google.firebase.auth.FirebaseAuth; /** * Created by Srirang on 3/11/2018. */ public class Homepage extends AppCompatActivity { private LinearLayout mNewButton; private LinearLayout mUpdateButton; private LinearLayout mPartialButton; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_homepage); String userClassEmail = FirebaseAuth.getInstance().getCurrentUser().getEmail(); final String userClass; if (userClassEmail.contains("classa")) { userClass = "A"; } else if (userClassEmail.contains("classb")) { userClass = "B"; } else { userClass = "C"; } Toast.makeText(this, "Class " + userClass + " logged in", Toast.LENGTH_LONG).show(); mNewButton = (LinearLayout) findViewById(R.id.cv_new_sample); mUpdateButton = (LinearLayout) findViewById(R.id.cv_update_sample); mPartialButton = (LinearLayout) findViewById(R.id.cv_edit_partial_sample); mNewButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(Homepage.this, CameraPreview.class); startActivity(intent); } }); mUpdateButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(Homepage.this, UpdateSampleActivity.class); startActivity(intent); } }); mPartialButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(Homepage.this, AddSampleFormActivity.class); intent.putExtra("KEY_CLASS", userClass.toLowerCase()); startActivity(intent); } }); } }
UTF-8
Java
2,352
java
Homepage.java
Java
[ { "context": "package com.example.srirang.nira_android;\n\nimport android.content.Intent;\nimp", "end": 27, "score": 0.9568575024604797, "start": 20, "tag": "USERNAME", "value": "srirang" }, { "context": "gle.firebase.auth.FirebaseAuth;\n\n/**\n * Created by Srirang on 3/11/2018.\n */\n\npublic class Homepage extends ", "end": 402, "score": 0.9993627667427063, "start": 395, "tag": "USERNAME", "value": "Srirang" } ]
null
[]
package com.example.srirang.nira_android; import android.content.Intent; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import android.widget.LinearLayout; import android.widget.Toast; import com.google.firebase.auth.FirebaseAuth; /** * Created by Srirang on 3/11/2018. */ public class Homepage extends AppCompatActivity { private LinearLayout mNewButton; private LinearLayout mUpdateButton; private LinearLayout mPartialButton; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_homepage); String userClassEmail = FirebaseAuth.getInstance().getCurrentUser().getEmail(); final String userClass; if (userClassEmail.contains("classa")) { userClass = "A"; } else if (userClassEmail.contains("classb")) { userClass = "B"; } else { userClass = "C"; } Toast.makeText(this, "Class " + userClass + " logged in", Toast.LENGTH_LONG).show(); mNewButton = (LinearLayout) findViewById(R.id.cv_new_sample); mUpdateButton = (LinearLayout) findViewById(R.id.cv_update_sample); mPartialButton = (LinearLayout) findViewById(R.id.cv_edit_partial_sample); mNewButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(Homepage.this, CameraPreview.class); startActivity(intent); } }); mUpdateButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(Homepage.this, UpdateSampleActivity.class); startActivity(intent); } }); mPartialButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(Homepage.this, AddSampleFormActivity.class); intent.putExtra("KEY_CLASS", userClass.toLowerCase()); startActivity(intent); } }); } }
2,352
0.644558
0.641156
67
34.104477
26.230968
92
false
false
0
0
0
0
0
0
0.597015
false
false
2
052d1f1b57349a58fba0c15d4aa6c8f3204ea4dd
12,738,873,023,549
940bb35f0e8555c901c6c092fbc7362b69cac53d
/app/src/main/java/com/scoutlabour/activities/AllServicesActivity.java
17d49036d9c360f5f728abf5fde3490aa574ab53
[]
no_license
PPSHREY/search_karigar
https://github.com/PPSHREY/search_karigar
4403b992fdf96d145bdfcf0db3603b5ad70ad7d6
c512e821d73d25065e683ac99e8fd2baa6ee0d24
refs/heads/master
2022-10-05T13:20:28.790000
2020-06-09T12:53:47
2020-06-09T12:53:47
271,002,305
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.scoutlabour.activities; import android.content.Context; import android.content.Intent; import android.net.ConnectivityManager; import android.os.Handler; import android.support.v4.view.MenuItemCompat; import android.support.v4.widget.SwipeRefreshLayout; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.view.SupportMenuInflater; import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.SearchView; import android.support.v7.widget.Toolbar; import android.util.Log; 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.Filter; import android.widget.Filterable; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import com.android.volley.VolleyError; import com.bumptech.glide.Glide; import com.google.gson.GsonBuilder; import com.scoutlabour.R; import com.scoutlabour.custom.AppConstants; import com.scoutlabour.custom.GetServiceCall; import com.scoutlabour.custom.PostServiceCall; import com.scoutlabour.custom.RVEmptyObserver; import com.scoutlabour.model.SubCategoryDetailListModel; import com.scoutlabour.model.SubCategoryDetailModel; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; import java.util.Arrays; public class AllServicesActivity extends AppCompatActivity { private SwipeRefreshLayout swipe_refresh_layout; RecyclerView recyclerViewServices; private ArrayList<SubCategoryDetailModel> subCategoryDetailModels; SubCategoryDetailListModel subCategoryDetailListModel; CustomAdapter customAdapter; View emptyView; String id; String que=""; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_all_services); recyclerViewServices = (RecyclerView) findViewById(R.id.recyclerViewServices); recyclerViewServices.setHasFixedSize(true); recyclerViewServices.setItemAnimator(new DefaultItemAnimator()); RecyclerView.LayoutManager layoutManager = new GridLayoutManager(AllServicesActivity.this, 1); recyclerViewServices.setLayoutManager(layoutManager); emptyView = findViewById(R.id.empty_view); swipe_refresh_layout = (SwipeRefreshLayout) findViewById(R.id.swipe_refresh_layout); setToolbar(); } @Override public void onResume() { super.onResume(); //swipe refresh logic start swipe_refresh_layout.post(new Runnable() { @Override public void run() { swipe_refresh_layout.setRefreshing(false); doPostNetworkOperation(); } }); swipe_refresh_layout.setColorSchemeResources(R.color.blue, R.color.blue, R.color.blue); swipe_refresh_layout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { new Handler().postDelayed(new Runnable() { @Override public void run() { swipe_refresh_layout.setRefreshing(true); doPostNetworkOperation(); } }, 0); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_search, menu); MenuItem search = menu.findItem(R.id.action_search); SearchView searchView = (SearchView) MenuItemCompat.getActionView(search); search(searchView); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { return super.onOptionsItemSelected(item); } private void search(SearchView searchView) { searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { return false; } @Override public boolean onQueryTextChange(String newText) { customAdapter.getFilter().filter(newText); return true; } }); } private boolean isNetworkConnected() { ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); return cm.getActiveNetworkInfo() != null; } private void doPostNetworkOperation() { if (isNetworkConnected()) { swipe_refresh_layout.setRefreshing(true); new GetServiceCall(AppConstants.ALL_SUB_CATEGORY_LIST, GetServiceCall.TYPE_JSONOBJECT) { @Override public void response(String response) { swipe_refresh_layout.setRefreshing(false); Log.e(" response", response + ""); subCategoryDetailListModel = new GsonBuilder().create().fromJson(response, SubCategoryDetailListModel.class); subCategoryDetailModels = subCategoryDetailListModel.subCategoryDetailModels; customAdapter = new CustomAdapter(AllServicesActivity.this, subCategoryDetailModels); recyclerViewServices.setAdapter(customAdapter); // set the Adapter to RecyclerView // set the emptyView in recycleview customAdapter.registerAdapterDataObserver(new RVEmptyObserver(recyclerViewServices, emptyView)); // } @Override public void error(VolleyError error) { swipe_refresh_layout.setRefreshing(false); Log.e(" response...", error + ""); } }.start(); } } public class CustomAdapter extends RecyclerView.Adapter<CustomAdapter.MyViewHolder>implements Filterable { private ArrayList<SubCategoryDetailModel> subCategoryList; private ArrayList<SubCategoryDetailModel> mFilteredList; Context context; public CustomAdapter(Context context, ArrayList<SubCategoryDetailModel> subCategoryList) { this.context = context; this.subCategoryList = subCategoryList; this.mFilteredList = subCategoryList; } @Override public CustomAdapter.MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { // infalte the item_dashboard Layout View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.service_list_item, parent, false); // set the view's size, margins, paddings and layout parameters CustomAdapter.MyViewHolder vh = new CustomAdapter.MyViewHolder(v); // pass the view to View Holder return vh; } @Override public void onBindViewHolder(CustomAdapter.MyViewHolder holder, final int position) { // set the data in items holder.txtServiceName.setText(mFilteredList.get(position).sub_category_name); Glide.with(AllServicesActivity.this).load(mFilteredList.get(position).sub_category_image).into(holder.imgServiceLogo); // implement setOnClickListener event on item_dashboard view. holder.itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // open another activity on item_dashboard click Intent i = new Intent(AllServicesActivity.this, RequestServiceActivity.class); i.putExtra("subCategoryName",subCategoryList.get(position).sub_category_name); i.putExtra("charges",subCategoryList.get(position).charges); i.putExtra("serviceDetail",subCategoryList.get(position).service_details); i.putExtra("position", position); startActivity(i); // start Intent } }); } @Override public int getItemCount() { return mFilteredList.size(); } @Override public Filter getFilter() { return new Filter() { @Override protected FilterResults performFiltering(CharSequence charSequence) { String charString = charSequence.toString(); if (charString.isEmpty()) { mFilteredList = subCategoryList; } else { ArrayList<SubCategoryDetailModel> filteredList = new ArrayList<>(); for (SubCategoryDetailModel subCategoryDetail : subCategoryList) { if (subCategoryDetail.sub_category_name.toLowerCase().contains(charString) ) { filteredList.add(subCategoryDetail); } } mFilteredList = filteredList; } FilterResults filterResults = new FilterResults(); filterResults.values = mFilteredList; return filterResults; } @Override protected void publishResults(CharSequence charSequence, FilterResults filterResults) { mFilteredList = (ArrayList<SubCategoryDetailModel>) filterResults.values; notifyDataSetChanged(); } }; } public class MyViewHolder extends RecyclerView.ViewHolder { // init the item_dashboard view's TextView txtServiceName; ImageView imgServiceLogo; LinearLayout llDeleteAddress,llEditAddress; public MyViewHolder(View itemView) { super(itemView); // get the reference of item_dashboard view's txtServiceName= (TextView) itemView.findViewById(R.id.txtServiceName); imgServiceLogo= (ImageView) itemView.findViewById(R.id.imgServiceLogo); } } } private void setToolbar() { Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); if (toolbar != null) { toolbar.setTitle("All Services"); setSupportActionBar(toolbar); toolbar.setNavigationIcon(R.drawable.ic_arrow_back); toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { finish(); } }); } } }
UTF-8
Java
10,870
java
AllServicesActivity.java
Java
[]
null
[]
package com.scoutlabour.activities; import android.content.Context; import android.content.Intent; import android.net.ConnectivityManager; import android.os.Handler; import android.support.v4.view.MenuItemCompat; import android.support.v4.widget.SwipeRefreshLayout; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.view.SupportMenuInflater; import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.SearchView; import android.support.v7.widget.Toolbar; import android.util.Log; 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.Filter; import android.widget.Filterable; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import com.android.volley.VolleyError; import com.bumptech.glide.Glide; import com.google.gson.GsonBuilder; import com.scoutlabour.R; import com.scoutlabour.custom.AppConstants; import com.scoutlabour.custom.GetServiceCall; import com.scoutlabour.custom.PostServiceCall; import com.scoutlabour.custom.RVEmptyObserver; import com.scoutlabour.model.SubCategoryDetailListModel; import com.scoutlabour.model.SubCategoryDetailModel; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; import java.util.Arrays; public class AllServicesActivity extends AppCompatActivity { private SwipeRefreshLayout swipe_refresh_layout; RecyclerView recyclerViewServices; private ArrayList<SubCategoryDetailModel> subCategoryDetailModels; SubCategoryDetailListModel subCategoryDetailListModel; CustomAdapter customAdapter; View emptyView; String id; String que=""; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_all_services); recyclerViewServices = (RecyclerView) findViewById(R.id.recyclerViewServices); recyclerViewServices.setHasFixedSize(true); recyclerViewServices.setItemAnimator(new DefaultItemAnimator()); RecyclerView.LayoutManager layoutManager = new GridLayoutManager(AllServicesActivity.this, 1); recyclerViewServices.setLayoutManager(layoutManager); emptyView = findViewById(R.id.empty_view); swipe_refresh_layout = (SwipeRefreshLayout) findViewById(R.id.swipe_refresh_layout); setToolbar(); } @Override public void onResume() { super.onResume(); //swipe refresh logic start swipe_refresh_layout.post(new Runnable() { @Override public void run() { swipe_refresh_layout.setRefreshing(false); doPostNetworkOperation(); } }); swipe_refresh_layout.setColorSchemeResources(R.color.blue, R.color.blue, R.color.blue); swipe_refresh_layout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { new Handler().postDelayed(new Runnable() { @Override public void run() { swipe_refresh_layout.setRefreshing(true); doPostNetworkOperation(); } }, 0); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_search, menu); MenuItem search = menu.findItem(R.id.action_search); SearchView searchView = (SearchView) MenuItemCompat.getActionView(search); search(searchView); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { return super.onOptionsItemSelected(item); } private void search(SearchView searchView) { searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { return false; } @Override public boolean onQueryTextChange(String newText) { customAdapter.getFilter().filter(newText); return true; } }); } private boolean isNetworkConnected() { ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); return cm.getActiveNetworkInfo() != null; } private void doPostNetworkOperation() { if (isNetworkConnected()) { swipe_refresh_layout.setRefreshing(true); new GetServiceCall(AppConstants.ALL_SUB_CATEGORY_LIST, GetServiceCall.TYPE_JSONOBJECT) { @Override public void response(String response) { swipe_refresh_layout.setRefreshing(false); Log.e(" response", response + ""); subCategoryDetailListModel = new GsonBuilder().create().fromJson(response, SubCategoryDetailListModel.class); subCategoryDetailModels = subCategoryDetailListModel.subCategoryDetailModels; customAdapter = new CustomAdapter(AllServicesActivity.this, subCategoryDetailModels); recyclerViewServices.setAdapter(customAdapter); // set the Adapter to RecyclerView // set the emptyView in recycleview customAdapter.registerAdapterDataObserver(new RVEmptyObserver(recyclerViewServices, emptyView)); // } @Override public void error(VolleyError error) { swipe_refresh_layout.setRefreshing(false); Log.e(" response...", error + ""); } }.start(); } } public class CustomAdapter extends RecyclerView.Adapter<CustomAdapter.MyViewHolder>implements Filterable { private ArrayList<SubCategoryDetailModel> subCategoryList; private ArrayList<SubCategoryDetailModel> mFilteredList; Context context; public CustomAdapter(Context context, ArrayList<SubCategoryDetailModel> subCategoryList) { this.context = context; this.subCategoryList = subCategoryList; this.mFilteredList = subCategoryList; } @Override public CustomAdapter.MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { // infalte the item_dashboard Layout View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.service_list_item, parent, false); // set the view's size, margins, paddings and layout parameters CustomAdapter.MyViewHolder vh = new CustomAdapter.MyViewHolder(v); // pass the view to View Holder return vh; } @Override public void onBindViewHolder(CustomAdapter.MyViewHolder holder, final int position) { // set the data in items holder.txtServiceName.setText(mFilteredList.get(position).sub_category_name); Glide.with(AllServicesActivity.this).load(mFilteredList.get(position).sub_category_image).into(holder.imgServiceLogo); // implement setOnClickListener event on item_dashboard view. holder.itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // open another activity on item_dashboard click Intent i = new Intent(AllServicesActivity.this, RequestServiceActivity.class); i.putExtra("subCategoryName",subCategoryList.get(position).sub_category_name); i.putExtra("charges",subCategoryList.get(position).charges); i.putExtra("serviceDetail",subCategoryList.get(position).service_details); i.putExtra("position", position); startActivity(i); // start Intent } }); } @Override public int getItemCount() { return mFilteredList.size(); } @Override public Filter getFilter() { return new Filter() { @Override protected FilterResults performFiltering(CharSequence charSequence) { String charString = charSequence.toString(); if (charString.isEmpty()) { mFilteredList = subCategoryList; } else { ArrayList<SubCategoryDetailModel> filteredList = new ArrayList<>(); for (SubCategoryDetailModel subCategoryDetail : subCategoryList) { if (subCategoryDetail.sub_category_name.toLowerCase().contains(charString) ) { filteredList.add(subCategoryDetail); } } mFilteredList = filteredList; } FilterResults filterResults = new FilterResults(); filterResults.values = mFilteredList; return filterResults; } @Override protected void publishResults(CharSequence charSequence, FilterResults filterResults) { mFilteredList = (ArrayList<SubCategoryDetailModel>) filterResults.values; notifyDataSetChanged(); } }; } public class MyViewHolder extends RecyclerView.ViewHolder { // init the item_dashboard view's TextView txtServiceName; ImageView imgServiceLogo; LinearLayout llDeleteAddress,llEditAddress; public MyViewHolder(View itemView) { super(itemView); // get the reference of item_dashboard view's txtServiceName= (TextView) itemView.findViewById(R.id.txtServiceName); imgServiceLogo= (ImageView) itemView.findViewById(R.id.imgServiceLogo); } } } private void setToolbar() { Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); if (toolbar != null) { toolbar.setTitle("All Services"); setSupportActionBar(toolbar); toolbar.setNavigationIcon(R.drawable.ic_arrow_back); toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { finish(); } }); } } }
10,870
0.635051
0.634039
310
34.064518
31.110765
130
false
false
0
0
0
0
0
0
0.509677
false
false
2
9beb63fff481dc15bb8f32ece87e5da6212fee89
1,305,670,096,792
69a4f2d51ebeea36c4d8192e25cfb5f3f77bef5e
/methods/Method_19045.java
dc73deeddda3494fc96faf715fc5d5f8ada28d8f
[]
no_license
P79N6A/icse_20_user_study
https://github.com/P79N6A/icse_20_user_study
5b9c42c6384502fdc9588430899f257761f1f506
8a3676bc96059ea2c4f6d209016f5088a5628f3c
refs/heads/master
2020-06-24T08:25:22.606000
2019-07-25T15:31:16
2019-07-25T15:31:16
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
@VisibleForTesting(otherwise=VisibleForTesting.PACKAGE_PRIVATE) public static SectionContext withSectionTree(SectionContext context,SectionTree sectionTree){ SectionContext sectionContext=new SectionContext(context); sectionContext.mSectionTree=sectionTree; sectionContext.mTreeLoadingEventHandler=new SectionTreeLoadingEventHandler(sectionTree); return sectionContext; }
UTF-8
Java
380
java
Method_19045.java
Java
[]
null
[]
@VisibleForTesting(otherwise=VisibleForTesting.PACKAGE_PRIVATE) public static SectionContext withSectionTree(SectionContext context,SectionTree sectionTree){ SectionContext sectionContext=new SectionContext(context); sectionContext.mSectionTree=sectionTree; sectionContext.mTreeLoadingEventHandler=new SectionTreeLoadingEventHandler(sectionTree); return sectionContext; }
380
0.873684
0.873684
6
62.333332
50.624985
157
false
false
0
0
0
0
0
0
0.833333
false
false
2
1a4da90e5e6055fc1bc13c249a9f1dfdb216f002
11,785,390,260,718
cbccf1771070cc222c7da531e206a09033e79523
/dex_src/com/xunlei/downloadprovider/download/taskDetail/l.java
423d3f7e92a7880756b2cd4e1fc557be10f7f287
[ "MIT" ]
permissive
mdrayhansantu/android_thunder
https://github.com/mdrayhansantu/android_thunder
c716d7644c36c3a6c2454c63300dc5d52de492c7
9ea16f77bd963a1a7fe7ee2faeb014cd881e18db
refs/heads/master
2020-07-09T17:07:52.957000
2019-08-23T15:58:25
2019-08-23T15:58:25
204,029,623
1
0
null
true
2019-08-23T15:57:08
2019-08-23T15:57:08
2019-08-18T06:15:04
2016-10-25T03:32:20
8,223
0
0
0
null
false
false
package com.xunlei.downloadprovider.download.taskDetail; import android.view.animation.Animation; import android.view.animation.Animation.AnimationListener; // compiled from: DownloadCenterDetailFragment.java final class l implements AnimationListener { final /* synthetic */ DownloadCenterDetailFragment a; l(DownloadCenterDetailFragment downloadCenterDetailFragment) { this.a = downloadCenterDetailFragment; } public final void onAnimationStart(Animation animation) { DownloadCenterDetailFragment.o(this.a).setClickable(false); } public final void onAnimationEnd(Animation animation) { DownloadCenterDetailFragment.o(this.a).setAnimation(null); DownloadCenterDetailFragment.o(this.a).setClickable(true); if (DownloadCenterDetailFragment.a(this.a) != null) { DownloadCenterDetailFragment.a(this.a).g(); } } public final void onAnimationRepeat(Animation animation) { } }
UTF-8
Java
973
java
l.java
Java
[]
null
[]
package com.xunlei.downloadprovider.download.taskDetail; import android.view.animation.Animation; import android.view.animation.Animation.AnimationListener; // compiled from: DownloadCenterDetailFragment.java final class l implements AnimationListener { final /* synthetic */ DownloadCenterDetailFragment a; l(DownloadCenterDetailFragment downloadCenterDetailFragment) { this.a = downloadCenterDetailFragment; } public final void onAnimationStart(Animation animation) { DownloadCenterDetailFragment.o(this.a).setClickable(false); } public final void onAnimationEnd(Animation animation) { DownloadCenterDetailFragment.o(this.a).setAnimation(null); DownloadCenterDetailFragment.o(this.a).setClickable(true); if (DownloadCenterDetailFragment.a(this.a) != null) { DownloadCenterDetailFragment.a(this.a).g(); } } public final void onAnimationRepeat(Animation animation) { } }
973
0.74409
0.74409
28
33.75
27.799826
67
false
false
0
0
0
0
0
0
0.321429
false
false
2
824ceaaeb961c087d03b696fc21770424dae5296
19,636,590,491,989
e2aec628e1c9ee0da26d9704c5341550482f2bc1
/app/src/main/java/com/kara4k/mvpretrofit/view/impl/DataListFragment.java
071a45217a63a109d5db89c9cee3da451e16ae08
[]
no_license
kara4k/MvpRetrofit
https://github.com/kara4k/MvpRetrofit
5f63dab45ccdad41b4b2b76f17707053545c772c
fde5e1769077dd370b83170265df682af5266af6
refs/heads/master
2021-01-23T10:34:26.436000
2017-09-07T16:02:40
2017-09-07T16:02:40
102,617,297
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.kara4k.mvpretrofit.view.impl; import android.app.ProgressDialog; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; 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.Toast; import com.kara4k.mvpretrofit.DaggerAppComponent; import com.kara4k.mvpretrofit.R; import com.kara4k.mvpretrofit.model.Item; import com.kara4k.mvpretrofit.modules.PresenterModule; import com.kara4k.mvpretrofit.presenter.PresenterIF; import com.kara4k.mvpretrofit.view.Holder; import com.kara4k.mvpretrofit.view.HolderFactory.HoldersFactory; import com.kara4k.mvpretrofit.view.ViewIF; import java.util.ArrayList; import java.util.List; import javax.inject.Inject; public class DataListFragment extends Fragment implements ViewIF, DialogInterface.OnClickListener { @Inject public PresenterIF mPresenterIF; private ProgressDialog mProgressDialog; private Adapter mAdapter; @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setHasOptionsMenu(true); DaggerAppComponent.builder() .presenterModule(new PresenterModule(this)) .build() .injectDataFragment(this); } @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { RecyclerView recyclerView = (RecyclerView) inflater.inflate(R.layout.fragment_recycler_view, container, false); recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); mAdapter = new Adapter(); recyclerView.setAdapter(mAdapter); mPresenterIF.onStart(); return recyclerView; } @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.menu_data_list_fragment, menu); super.onCreateOptionsMenu(menu, inflater); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_item_home: mPresenterIF.onHomeClicked(); return true; } return super.onOptionsItemSelected(item); } @Override public void setItems(List<? extends Item> items) { mAdapter.setItems(items); mAdapter.notifyDataSetChanged(); } @Override public void setTitle(String title) { AppCompatActivity activity = (AppCompatActivity) getActivity(); if (activity.getSupportActionBar() != null) { activity.getSupportActionBar().setTitle(title); } } @Override public void showErrorMessage(String message) { Toast.makeText(getContext(), message, Toast.LENGTH_SHORT).show(); } @Override public void showProgressDialog() { mProgressDialog = new ProgressDialog(getContext()); mProgressDialog.setTitle("Loading"); mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); mProgressDialog.setCancelable(false); mProgressDialog.setButton(DialogInterface.BUTTON_NEGATIVE, getContext().getString(android.R.string.cancel), this); mProgressDialog.show(); } @Override public void hideProgressDialog() { if (mProgressDialog != null && mProgressDialog.isShowing()) { mProgressDialog.hide(); mProgressDialog = null; } } @Override public void shareTo(Intent intent) { startActivity(intent); } @Override public void onClick(DialogInterface dialog, int which) { hideProgressDialog(); } public static DataListFragment newInstance() { return new DataListFragment(); } class Adapter extends RecyclerView.Adapter<Holder> { List<? extends Item> mItems = new ArrayList<>(); @Override public int getItemViewType(int position) { return mItems.get(position).getType(); } @Override public Holder onCreateViewHolder(ViewGroup parent, int viewType) { Holder holder = HoldersFactory.createHolder(getContext(), mPresenterIF, viewType); return holder; } @Override public void onBindViewHolder(Holder holder, int position) { holder.onBind(mItems.get(position)); } @Override public int getItemCount() { return mItems.size(); } public void setItems(List<? extends Item> items) { mItems = items; } } }
UTF-8
Java
4,983
java
DataListFragment.java
Java
[]
null
[]
package com.kara4k.mvpretrofit.view.impl; import android.app.ProgressDialog; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; 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.Toast; import com.kara4k.mvpretrofit.DaggerAppComponent; import com.kara4k.mvpretrofit.R; import com.kara4k.mvpretrofit.model.Item; import com.kara4k.mvpretrofit.modules.PresenterModule; import com.kara4k.mvpretrofit.presenter.PresenterIF; import com.kara4k.mvpretrofit.view.Holder; import com.kara4k.mvpretrofit.view.HolderFactory.HoldersFactory; import com.kara4k.mvpretrofit.view.ViewIF; import java.util.ArrayList; import java.util.List; import javax.inject.Inject; public class DataListFragment extends Fragment implements ViewIF, DialogInterface.OnClickListener { @Inject public PresenterIF mPresenterIF; private ProgressDialog mProgressDialog; private Adapter mAdapter; @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setHasOptionsMenu(true); DaggerAppComponent.builder() .presenterModule(new PresenterModule(this)) .build() .injectDataFragment(this); } @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { RecyclerView recyclerView = (RecyclerView) inflater.inflate(R.layout.fragment_recycler_view, container, false); recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); mAdapter = new Adapter(); recyclerView.setAdapter(mAdapter); mPresenterIF.onStart(); return recyclerView; } @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.menu_data_list_fragment, menu); super.onCreateOptionsMenu(menu, inflater); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_item_home: mPresenterIF.onHomeClicked(); return true; } return super.onOptionsItemSelected(item); } @Override public void setItems(List<? extends Item> items) { mAdapter.setItems(items); mAdapter.notifyDataSetChanged(); } @Override public void setTitle(String title) { AppCompatActivity activity = (AppCompatActivity) getActivity(); if (activity.getSupportActionBar() != null) { activity.getSupportActionBar().setTitle(title); } } @Override public void showErrorMessage(String message) { Toast.makeText(getContext(), message, Toast.LENGTH_SHORT).show(); } @Override public void showProgressDialog() { mProgressDialog = new ProgressDialog(getContext()); mProgressDialog.setTitle("Loading"); mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); mProgressDialog.setCancelable(false); mProgressDialog.setButton(DialogInterface.BUTTON_NEGATIVE, getContext().getString(android.R.string.cancel), this); mProgressDialog.show(); } @Override public void hideProgressDialog() { if (mProgressDialog != null && mProgressDialog.isShowing()) { mProgressDialog.hide(); mProgressDialog = null; } } @Override public void shareTo(Intent intent) { startActivity(intent); } @Override public void onClick(DialogInterface dialog, int which) { hideProgressDialog(); } public static DataListFragment newInstance() { return new DataListFragment(); } class Adapter extends RecyclerView.Adapter<Holder> { List<? extends Item> mItems = new ArrayList<>(); @Override public int getItemViewType(int position) { return mItems.get(position).getType(); } @Override public Holder onCreateViewHolder(ViewGroup parent, int viewType) { Holder holder = HoldersFactory.createHolder(getContext(), mPresenterIF, viewType); return holder; } @Override public void onBindViewHolder(Holder holder, int position) { holder.onBind(mItems.get(position)); } @Override public int getItemCount() { return mItems.size(); } public void setItems(List<? extends Item> items) { mItems = items; } } }
4,983
0.684929
0.68232
165
29.200001
25.373859
123
false
false
0
0
0
0
0
0
0.515152
false
false
2