blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
sequencelengths
1
1
author_id
stringlengths
0
313
1c3e9a6b0765d1c72df8e97be379243cd06c58c3
0fefc5f2b97bd957b069fdf63ad628c0ba1efdc9
/华为机试/HJ5 进制转换.java
9244c0ac80c29f68f1b413b002456b5691b19b50
[]
no_license
AaronPhantomhive/Nowcoder
16f1db2b74f8c0cbc0ab923dd5e67d2c941cfe65
d255def37ac752b02a4f2417e4bbb63f331cd5fc
refs/heads/main
2023-08-12T20:06:31.609934
2021-10-11T14:10:46
2021-10-11T14:10:46
399,739,868
0
0
null
null
null
null
UTF-8
Java
false
false
336
java
import java.util.Scanner; public class Main{ public static void main(String arg[]) { Scanner sc = new Scanner(System.in); while (sc.hasNext()){ String str = sc.nextLine(); int result = Integer.parseInt(str.substring(2),16); System.out.println(result); } } }
eb4de65663745a3baacae18458f2dd0cfdbf4835
5a97cf21d907b27e1fad652b8e94c6e4ed02ac30
/petshop_ssm/src/main/java/com/petshop/dao/IPetstoreMapper.java
b354f8fe2d24eae8dc6ec37b2624dddc4e5f4227
[]
no_license
yangshaguiyang/petshop_ssm
92d89e5e84f2b0f23984507775d152bb8a20268c
f5821c8e0fa2591434f6e5c16d869768005250d3
refs/heads/master
2020-04-16T07:33:42.008508
2019-01-12T13:33:29
2019-01-12T13:33:29
165,391,557
0
0
null
null
null
null
UTF-8
Java
false
false
502
java
package com.petshop.dao; import java.util.List; import java.util.Map; import com.petshop.model.Petstore; public interface IPetstoreMapper { int deleteByPrimaryKey(Integer id); int insert(Petstore record); int insertSelective(Petstore record); Petstore selectByPrimaryKey(Integer id); int updateByPrimaryKeySelective(Petstore record); int updateByPrimaryKey(Petstore record); List<Petstore> findByPage(Map<String,Object> map); List<Petstore> getAll(); }
ea9aa4cbd47b044f4c667cd4b55a73cccf3f5cbe
075a0802606ea01493129c5128234eb49967218c
/chapter10/src/difault/CompleteCalc.java
407368f10b50726e35d043aecd0a6d63a6c82d51
[]
no_license
larryback/java
64455433ef1aa17431230e9b1eecc6691c733840
61088c81776f6cad243dd8595509b0b7c4d6027b
refs/heads/master
2020-05-30T20:43:02.782788
2019-10-29T12:57:30
2019-10-29T12:57:30
189,954,428
0
0
null
null
null
null
UHC
Java
false
false
440
java
package difault; public class CompleteCalc extends Calculator { @Override public int times(int num1, int num2) { return num1 * num2; } @Override public int divide(int num1, int num2) { if(num2 != 0 ) return num1/num2; else return Calc.ERROR; } public void showInfo(){ System.out.println("Calc 인터페이스를 구현하였습니다" ); } @Override public void description() { super.description(); } }
80b2c9d6d8f20d9ea2cdedf6de2e6ee6cf86c072
a695eac710fe15bb64c86869dcedfb8e402a5001
/fluent-mybatis-processor/src/main/java/cn/org/atool/fluent/processor/mybatis/base/IProcessor.java
4f27c2251a225195cbb5d8f9dc48c7dc0bb04699
[ "Apache-2.0" ]
permissive
atool/fluent-mybatis
33e6eb3dccac0db264fcb3c531005d7a28ab7d20
500522573c82d470d33a1f347903597edad4808d
refs/heads/master
2023-06-22T13:50:12.298938
2022-12-22T11:04:06
2022-12-22T11:04:06
218,672,433
789
84
Apache-2.0
2023-06-15T09:18:27
2019-10-31T02:57:34
Java
UTF-8
Java
false
false
310
java
package cn.org.atool.fluent.processor.mybatis.base; import javax.annotation.processing.Messager; /** * 编译器相关类 * * @author darui.wu */ @SuppressWarnings({"unused"}) public interface IProcessor { /** * 返回Messager * * @return Messager */ Messager getMessager(); }
56f08df00c9358da8b4cfe95a8e238096f6db45e
d63bcd50e6b4fb15f5e8f5b28931cdbdae581eb3
/Data/src/main/java/com/data/services/impl/ApplicationServiceImpl.java
2a84c30a1c1d0928b09d46f13a0eef8d443c9928
[]
no_license
suyognyati/OA_Cerebro
46379b7c371875372e256b70e41ecba08b3c1779
cfa8f24b5ff98cfd8431c777a688d3b2b167a8fa
refs/heads/master
2021-04-28T06:57:15.502445
2018-05-31T17:57:38
2018-05-31T17:57:38
122,214,461
0
0
null
null
null
null
UTF-8
Java
false
false
1,301
java
package com.data.services.impl; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.data.entities.College; import com.data.entities.Application; import com.data.entities.Student; import com.data.poco.AppliedStudentPOCO; import com.data.repository.ApplicationJpaRepository; import com.data.services.ApplicationService; @Service("applicationService") public class ApplicationServiceImpl implements ApplicationService { @Autowired ApplicationJpaRepository applicationJpaRepository; @Override public Application save(Application application) { return applicationJpaRepository.save(application); } @Override public List<Application> getByStudentandCollege(Student student, College college) { return applicationJpaRepository.findByStudentAndCollegeProgramMapCollege(student, college); } @Override public void deleteById(Integer applicationId) { applicationJpaRepository.delete(applicationId); } @Override public List<AppliedStudentPOCO> getAppliedStudentListOfProgram(Integer collegeProgramMapId) { return applicationJpaRepository.getMeritStudents(collegeProgramMapId); } @Override public Application getById(Integer id) { return applicationJpaRepository.findOne(id); } }
f9984626f1cb2ffe6427d5976bcf7b6874508d01
f5d2095477c79e5cc9d2ad4e1d214300c842b32b
/src/main/java/org/lilu/sns/web/controller/LoginController.java
de43dd7ad2915fafd3d62a8951e8ffbd22302d58
[]
no_license
llnancy/sns-project
a206070357d081f7ed415f4748300890ca70a61a
ebab8db54c23a2571562e7f0b91c06c67674fb23
refs/heads/master
2022-12-10T11:06:57.640487
2019-02-25T07:01:54
2019-02-25T07:01:54
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,280
java
package org.lilu.sns.web.controller; import org.hibernate.validator.constraints.Length; import org.lilu.sns.exception.EntityUpdateException; import org.lilu.sns.pojo.Result; import org.lilu.sns.pojo.ResultCode; import org.lilu.sns.pojo.User; import org.lilu.sns.service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.BindingResult; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import java.util.Map; /** * @Auther: lilu * @Date: 2019/1/24 * @Description: 登录/注册功能控制器 */ @RestController @Validated @RequestMapping("/user") public class LoginController { @Autowired private UserService userService; /** * 登录 * @param loginString * @param password 登录时不需要校验密码长度 * @param response * @return */ @PostMapping("/login") public Result login(@Length(min = 2,max = 32,message = "用户名或邮箱有误") @RequestParam("loginString") String loginString, @RequestParam("password") String password, HttpServletResponse response) { Result result = userService.login(loginString,password); Map<String,Object> data = result.getData(); // 登录成功,发送cookie if (data.containsKey("ticket")) { Cookie cookie = new Cookie("ticket",String.valueOf(data.get("ticket"))); cookie.setPath("/"); // 下发cookie到浏览器客户端 response.addCookie(cookie); // 删除响应信息中ticket内容 data.remove("ticket"); } return result; } /** * 注册 * @param user 若校验失败,则抛出异常,由MyExceptionHandler类进行全局的异常处理。 * @param result 必须要写该参数,否则不会抛出ConstraintViolationException异常。 * @return */ @PostMapping("/register") public Result register(@Valid User user, BindingResult result) { // if (result.hasErrors()) { // // 服务端校验数据 // Map<String,Object> errors = new HashMap<>(); // List<FieldError> fieldErrors = result.getFieldErrors(); // for (FieldError fieldError : fieldErrors) { // logger.error("注册异常-->" + fieldError.getField() + " : " + fieldError.getDefaultMessage()); // errors.put(fieldError.getField(),fieldError.getDefaultMessage()); // } // return Result.info(ResultCode.REGISTER_FAIL).put("fieldErrors",errors); // } else { // return userService.register(user); // } return userService.register(user); } /** * 退出登录 * @param ticket * @return */ @GetMapping("/logout") public Result logout(@CookieValue("ticket") String ticket) { if (userService.logout(ticket) != 1) { throw new EntityUpdateException("异常:退出登录失败"); } return Result.info(ResultCode.LOGOUT_SUCCESS); } }
4400e475c9eaf955f29d4231d773201f5acc7d55
0f24f1133b44ee939fa9ce5ddad61f44a27dfcdd
/src/main/java/net/easyappsecurity/account/recovery/repository/PasswordResetTokenRepository.java
c60cd1059b4f605a2e00496a218195933f40acb0
[]
no_license
Jzacha21/secure-account-recovery
326aa2f976299e4b929d7c551f386d425a871af1
8fdeb163ab4660c75b33cdc2e81d6384fcf440d7
refs/heads/master
2022-01-06T20:08:03.074977
2018-05-14T15:09:45
2018-05-14T15:09:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
490
java
package net.easyappsecurity.account.recovery.repository; import net.easyappsecurity.account.recovery.domain.PasswordResetToken; import java.util.Date; public interface PasswordResetTokenRepository { public PasswordResetToken save(PasswordResetToken token); public PasswordResetToken update(PasswordResetToken token); public PasswordResetToken getToken(String selector); public void deleteExpiredSince(Date date); public void delete(PasswordResetToken token); }
722e6404c7ddd2717de31e1e3bd5a6f6bdd4ad77
b93c7ba15d27f384f06e7d57681f471f349d0ffc
/src/main/java/ru/k0r0tk0ff/sequence/processor/domain/SequenceImpl.java
f50ebeac4ee088c18cff9d842799ff54fa941339
[]
no_license
k0r0tk0ff/SequenceProcessor
4d7cf00862486cdc2b18c854f2615b56edc4219a
feaa116c015f25b8bb88e31cfef0e5ad36b527d7
refs/heads/master
2020-03-19T05:23:54.154191
2018-06-30T08:15:56
2018-06-30T08:15:56
135,926,764
1
1
null
null
null
null
UTF-8
Java
false
false
349
java
package ru.k0r0tk0ff.sequence.processor.domain; import java.util.Collection; public class SequenceImpl implements Sequence { private Collection<Integer> collection; public SequenceImpl(Collection<Integer> collection) { this.collection = collection; } public Collection<Integer> get() { return collection; } }
57e984133fda75f9da6c82dd4cf0a894250c3f16
e170556250bc3b1e8707b0c26aa10b923e47adbb
/app/src/main/java/com/udacity/sandwichclub/DetailActivity.java
a05e2ff4fe8671b812d10f7adca9f2c7f4edcfd6
[]
no_license
SCasandra/SandwichClub
7bae281d335e29b21a5c30123c9180e28f694465
ebcf0a1e5ed9647eefbdbd098b1c65246f1104c9
refs/heads/master
2021-04-28T13:31:17.535989
2018-02-19T19:10:27
2018-02-19T19:10:27
122,106,613
0
0
null
null
null
null
UTF-8
Java
false
false
3,381
java
package com.udacity.sandwichclub; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import com.squareup.picasso.Picasso; import com.udacity.sandwichclub.model.Sandwich; import com.udacity.sandwichclub.utils.JsonUtils; import org.json.JSONException; public class DetailActivity extends AppCompatActivity { public static final String EXTRA_POSITION = "extra_position"; private static final int DEFAULT_POSITION = -1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_detail); Intent intent = getIntent(); if (intent == null) { closeOnError(); } int position = intent.getIntExtra(EXTRA_POSITION, DEFAULT_POSITION); if (position == DEFAULT_POSITION) { // EXTRA_POSITION not found in intent closeOnError(); return; } String[] sandwiches = getResources().getStringArray(R.array.sandwich_details); String json = sandwiches[position]; Sandwich sandwich = null; try { sandwich = JsonUtils.parseSandwichJson(json); } catch (JSONException e) { e.printStackTrace(); } if (sandwich == null) { // Sandwich data unavailable closeOnError(); return; } populateUI(sandwich); } private void closeOnError() { finish(); Toast.makeText(this, R.string.detail_error_message, Toast.LENGTH_SHORT).show(); } private void populateUI(Sandwich sandwich) { /* Find the Views */ ImageView ingredientsIv = findViewById(R.id.image_iv); TextView ingredients = findViewById(R.id.ingredients_tv); TextView description = findViewById(R.id.description_tv); TextView placeOfOrgin = findViewById(R.id.origin_tv); TextView alsoKnownAs = findViewById(R.id.also_known_tv); TextView alsoKnownTitle = findViewById(R.id.also_known); TextView origin = findViewById(R.id.origin); setTitle(sandwich.getMainName()); Picasso.with(this) .load(sandwich.getImage()) .into(ingredientsIv); if (sandwich.getIngredients() != null) { String ingredientsString = sandwich.getIngredients().toString(); ingredients.setText(ingredientsString.substring(1, ingredientsString.length() - 1)); } description.setText(sandwich.getDescription()); if (sandwich.getPlaceOfOrigin().isEmpty()) { /* Hide the empty views */ origin.setVisibility(View.GONE); placeOfOrgin.setVisibility(View.GONE); } else { placeOfOrgin.setText(sandwich.getPlaceOfOrigin()); } if (sandwich.getAlsoKnownAs() != null) { String alsoKnownAsString = sandwich.getAlsoKnownAs().toString(); alsoKnownAs.setText(alsoKnownAsString.substring(1, alsoKnownAsString.length() - 1)); } else { /* Hide the empty views */ alsoKnownAs.setVisibility(View.GONE); alsoKnownTitle.setVisibility(View.GONE); } } }
6a3df82738730090c60dd9ade6e1f3a83261b259
624d12a1ded529db68360a5e692d4346ad85ed30
/guli-order/src/main/java/com/shui/gulimall/order/entity/MqMessageEntity.java
8b56f3f5cecb1e2867478c06e2675cc75144bffa
[]
no_license
ShuiLinzi/gulimall
87d93de59f5288425e7250100b67c76bf70a863e
779fdf6f3d841efd1f7758885bb9f2c9994885ce
refs/heads/main
2023-08-23T23:26:31.434396
2021-10-14T11:50:59
2021-10-14T11:50:59
409,246,176
0
0
null
null
null
null
UTF-8
Java
false
false
883
java
package com.shui.gulimall.order.entity; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import java.io.Serializable; import java.util.Date; import lombok.Data; /** * @author lin * @email [email protected] * @date 2021-08-30 11:32:40 */ @Data @TableName("mq_message") public class MqMessageEntity implements Serializable { private static final long serialVersionUID = 1L; /** * */ @TableId private String messageId; /** * JSON */ private String content; /** * */ private String toExchange; /** * */ private String classType; /** * 0-新建 1-已发送 2-错误抵达 3-已抵达 */ private Integer messageStatus; /** * */ private Date createTime; /** * */ private Date updateTime; }
75e0d82fbc1584f9db7dbe9a79ddd692d100b1be
1fe33cac3819ba7832c495677fa8d90ba51ca66c
/src/test/java/com/vc/web/rest/util/PaginationUtilUnitTest.java
e8424f32930c3166945ad122c8c9a95021eb55f7
[]
no_license
valeriyc/ThreadNote
d353801d3b077084db2cf6d872115d53979e9a03
dafbdc61c01ff5b29ba93a11cc0f02593df08a50
refs/heads/master
2021-01-16T17:55:13.449294
2017-08-11T11:06:16
2017-08-11T11:06:16
100,023,388
0
0
null
null
null
null
UTF-8
Java
false
false
1,733
java
package com.vc.web.rest.util; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import java.util.ArrayList; import java.util.List; import org.junit.Test; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.PageRequest; import org.springframework.http.HttpHeaders; /** * Tests based on parsing algorithm in app/components/util/pagination-util.service.js * * @see PaginationUtil */ public class PaginationUtilUnitTest { @Test public void generatePaginationHttpHeadersTest() { String baseUrl = "/api/_search/example"; List<String> content = new ArrayList<>(); Page<String> page = new PageImpl<>(content,new PageRequest(6, 50),400L); HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, baseUrl); List<String> strHeaders = headers.get(HttpHeaders.LINK); assertNotNull(strHeaders); assertTrue(strHeaders.size() == 1); String headerData = strHeaders.get(0); assertTrue(headerData.split(",").length == 4); String expectedData = "</api/_search/example?page=7&size=50>; rel=\"next\"," + "</api/_search/example?page=5&size=50>; rel=\"prev\"," + "</api/_search/example?page=7&size=50>; rel=\"last\"," + "</api/_search/example?page=0&size=50>; rel=\"first\""; assertEquals(expectedData, headerData); List<String> xTotalCountHeaders = headers.get("X-Total-Count"); assertTrue(xTotalCountHeaders.size() == 1); assertTrue(Long.valueOf(xTotalCountHeaders.get(0)).equals(400L)); } }
eef4ab74a34c106a81dff6a9cc82873b29fff1d7
98212db453a4937c7e16da68e701a6006cb0e1bf
/app/src/main/java/com/example/ryan/places/GetAllMarkers.java
f998d59b97b911ca969d45957b5beb4aa0a4d19f
[]
no_license
bradburyr1/db_android
788afde0428969f0d09ea8ad628e9b8a58cadc10
c97fb89c56aae58ef8430b6dd5cbc9532bcb809a
refs/heads/master
2021-01-02T09:40:13.270721
2017-08-03T20:22:44
2017-08-03T20:22:44
99,270,295
0
0
null
null
null
null
UTF-8
Java
false
false
2,949
java
package com.example.ryan.places; import android.app.ListActivity; import android.app.ProgressDialog; import android.net.Uri; import android.os.AsyncTask; import android.util.Log; //import org.json.simple.parser.JSONParser; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; import java.util.ArrayList; import java.util.HashMap; /** * Created by Ryan on 7/20/2017. */ public class GetAllMarkers extends ListActivity { public String rst = "";//will contain the json string /* //For progress dialog /*private ProgressDialog ProgDial; //Create a JSON Parser JSONParser JPars = new JSONParser(); ArrayList<HashMap<String, String>> markerList; */ public void starter(){ Log.d("HELLO*************", "Starter"); fetch(); } public void fetch() { Log.d("HELLO*************", "Fetch"); FetchMarkersTask fmt = new FetchMarkersTask(); fmt.execute(); } private class FetchMarkersTask extends AsyncTask<Void, Void, String> { ////////////////////////////////// final String ip_address = "192.168.1.21"; final String project = "android_connect"; final String file = "get_all_locations.php"; String builtUri = "http://" + ip_address + "/" + project + "/" + file; //@Override protected void onPostExecute(String result){ MapsActivity ma = new MapsActivity(); ma.getLong(result); } @Override protected String doInBackground(Void... params) { HttpURLConnection urlConnection = null; String response = ""; Log.d("HELLO*************", "doInBackground: " + builtUri); try { URL url = new URL(builtUri); urlConnection = (HttpURLConnection) url.openConnection(); if (urlConnection.getResponseCode() == HttpURLConnection.HTTP_OK) { BufferedReader input = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()), 8192); String jsonResp = null; while ((jsonResp = input.readLine()) != null) { response = response.concat(jsonResp); Log.d("HELLO*************", "While Loop"); Log.d("HELLO*************", "Response: " + response); Log.d("HELLO*************", "jsonResp: " + jsonResp); } input.close(); } } catch (IOException e) { Log.d("HELLO*************", "HERES YOUR DANG STRING", e); } //////////// Log.d("JSON Line", response); rst = response;//store the json string /////////// return response; } //return response; } ////////////////////////////////// }
7b4ff48963aa97c5bff75a649996c37d529f79d3
74b47b895b2f739612371f871c7f940502e7165b
/aws-java-sdk-sagemaker/src/main/java/com/amazonaws/services/sagemaker/model/CreateNotebookInstanceResult.java
e73ceb59ff59bfc7eef5db8131dd515099e69a4f
[ "Apache-2.0" ]
permissive
baganda07/aws-sdk-java
fe1958ed679cd95b4c48f971393bf03eb5512799
f19bdb30177106b5d6394223a40a382b87adf742
refs/heads/master
2022-11-09T21:55:43.857201
2022-10-24T21:08:19
2022-10-24T21:08:19
221,028,223
0
0
Apache-2.0
2019-11-11T16:57:12
2019-11-11T16:57:11
null
UTF-8
Java
false
false
4,169
java
/* * Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.sagemaker.model; import java.io.Serializable; import javax.annotation.Generated; /** * * @see <a href="http://docs.aws.amazon.com/goto/WebAPI/sagemaker-2017-07-24/CreateNotebookInstance" target="_top">AWS * API Documentation</a> */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class CreateNotebookInstanceResult extends com.amazonaws.AmazonWebServiceResult<com.amazonaws.ResponseMetadata> implements Serializable, Cloneable { /** * <p> * The Amazon Resource Name (ARN) of the notebook instance. * </p> */ private String notebookInstanceArn; /** * <p> * The Amazon Resource Name (ARN) of the notebook instance. * </p> * * @param notebookInstanceArn * The Amazon Resource Name (ARN) of the notebook instance. */ public void setNotebookInstanceArn(String notebookInstanceArn) { this.notebookInstanceArn = notebookInstanceArn; } /** * <p> * The Amazon Resource Name (ARN) of the notebook instance. * </p> * * @return The Amazon Resource Name (ARN) of the notebook instance. */ public String getNotebookInstanceArn() { return this.notebookInstanceArn; } /** * <p> * The Amazon Resource Name (ARN) of the notebook instance. * </p> * * @param notebookInstanceArn * The Amazon Resource Name (ARN) of the notebook instance. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateNotebookInstanceResult withNotebookInstanceArn(String notebookInstanceArn) { setNotebookInstanceArn(notebookInstanceArn); return this; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getNotebookInstanceArn() != null) sb.append("NotebookInstanceArn: ").append(getNotebookInstanceArn()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof CreateNotebookInstanceResult == false) return false; CreateNotebookInstanceResult other = (CreateNotebookInstanceResult) obj; if (other.getNotebookInstanceArn() == null ^ this.getNotebookInstanceArn() == null) return false; if (other.getNotebookInstanceArn() != null && other.getNotebookInstanceArn().equals(this.getNotebookInstanceArn()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getNotebookInstanceArn() == null) ? 0 : getNotebookInstanceArn().hashCode()); return hashCode; } @Override public CreateNotebookInstanceResult clone() { try { return (CreateNotebookInstanceResult) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } }
[ "" ]
f0823035e932f2724ea4c783f9ed51d84bca496f
6ed23b65cf677b6e0ddf97f2f75a810bc1a8b42c
/src/main/java/base/hw6/animals/Animal.java
591bf785ff946090c055b3cbe1c4d0f8953898dc
[]
no_license
Nati098/geek-java-core
dc4c25d685aef0f0e30f8fdbd861ae16639934ec
3391b716ac842361a1cd45e189f535a48ba7d590
refs/heads/master
2022-12-27T13:24:47.156460
2020-10-12T19:39:48
2020-10-12T19:39:48
280,247,869
0
0
null
2020-10-12T19:39:49
2020-07-16T20:07:37
Java
UTF-8
Java
false
false
1,107
java
package base.hw6.animals; public abstract class Animal { protected int runThreshold = 0; protected int swimThreshold = 0; protected String name; protected int age; public Animal(String name, int age) { this.name = name; this.age = age; } protected void setThresholds(int run, int swim) { this.runThreshold = run; this.swimThreshold = swim; } public void run(int distance) { if (distance > runThreshold) { System.out.print(String.format("%s не пробежит\n", name)); } else { System.out.print(String.format("%s пробежал %d м\n", name, distance)); } } public void swim(int distance) { if (distance > swimThreshold) { System.out.print(String.format("%s не поплывет\n", name)); } else { System.out.print(String.format("%s проплыл %d м\n", name, distance)); } } @Override public String toString() { return String.format("Animal:\n%s, %d\n", name, age); } }
f425f77cfbd44974fbd0a3d5bb80636c7e49f1f5
1a54d4c45741998b0b66b921fc979c04a70e62ec
/src/main/java/com/example/tugas1/controller/PendudukController.java
0f4d512e660aa4ee237e227051619a3c2fd4a8c7
[]
no_license
apap-2017/tugas1_1506689383
9af720b4fd18a28ecbced32646b801784763b939
7b20656e357aa898b71609ddf888c22f5cd52a40
refs/heads/master
2021-07-15T01:02:41.842282
2017-10-22T16:43:01
2017-10-22T16:43:01
107,846,564
0
0
null
null
null
null
UTF-8
Java
false
false
5,803
java
package com.example.tugas1.controller; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import com.example.tugas1.model.KecamatanModel; import com.example.tugas1.model.KelurahanModel; import com.example.tugas1.model.KotaModel; import com.example.tugas1.model.PendudukModel; import com.example.tugas1.service.DaerahService; import com.example.tugas1.service.PendudukService; @Controller public class PendudukController { @Autowired PendudukService pendudukDAO; @Autowired DaerahService daerahDAO; @RequestMapping("/penduduk") public String view(Model model, @RequestParam(value = "nik", required = true) String nik) { PendudukModel penduduk = pendudukDAO.selectPenduduk(nik); String tes = (String) model.asMap().get("sukses"); if (tes != null) { return "sukses"; } if (penduduk != null) { String lahir = penduduk.getTanggal_lahir(); model.addAttribute("lahir", lahir); model.addAttribute("penduduk", penduduk); model.addAttribute("title", "Lihat Penduduk"); return "view-penduduk"; } else { model.addAttribute("nik", nik); model.addAttribute("title", "Not Found"); model.addAttribute("error", "Penduduk tidak ditemukan"); return "not-found"; } } @RequestMapping("/") public String index(Model model) { model.addAttribute("title", "SI Kependudukan"); return "view"; } @RequestMapping("/penduduk/tambah") public String tambah(Model model) { model.addAttribute("title", "Tambah Penduduk"); return "tambah-penduduk"; } @RequestMapping(value = "/penduduk/tambah", method = RequestMethod.POST) public String submitTambah(Model model, PendudukModel penduduk) { if (pendudukDAO.tambahPenduduk(penduduk)) { String sukses = "Penduduk dengan NIK " + penduduk.getNik() + " berhasil ditambahkan"; model.addAttribute("sukses", sukses); model.addAttribute("title", "Tambah Penduduk"); return "sukses"; } else { String error = "Penduduk gagal ditambahkan. Silahkan isi semua form."; model.addAttribute("error", error); model.addAttribute("title", "Tambah Penduduk"); return "tambah-penduduk"; } } @RequestMapping("/penduduk/ubah/{nik}") public String update(Model model, @PathVariable(value = "nik") String nik) { PendudukModel penduduk = pendudukDAO.selectPenduduk(nik); if (penduduk != null) { model.addAttribute("penduduk", penduduk); model.addAttribute("title", "Ubah Penduduk"); return "ubah-penduduk"; } else { model.addAttribute("nik", nik); model.addAttribute("title", "Not Found"); model.addAttribute("error", "Penduduk Tidak Ditemukan"); return "not-found"; } } @RequestMapping(value = "/penduduk/ubah/{nik}", method = RequestMethod.POST) public String submitUbah(Model model, @PathVariable(value = "nik") String nik, PendudukModel penduduk) { if (pendudukDAO.ubahPenduduk(penduduk)) { String sukses = "Penduduk dengan NIK " + penduduk.getNik() + " berhasil diubah"; model.addAttribute("sukses", sukses); model.addAttribute("penduduk", penduduk); model.addAttribute("title", "Ubah Penduduk"); return "sukses"; } else { String error = "Penduduk gagal diubah. Silahkan refresh halaman ini."; model.addAttribute("error", error); model.addAttribute("nik", nik); model.addAttribute("title", "Tambah Penduduk"); return "ubah-penduduk"; } } @RequestMapping(value = "/penduduk/mati", method = RequestMethod.POST) public ModelAndView nonaktif(RedirectAttributes redir, PendudukModel penduduk) { ModelAndView modelAndView = new ModelAndView(); pendudukDAO.nonaktifPenduduk(penduduk); String sukses = "Penduduk dengan NIK " + penduduk.getNik() + " sudah tidak aktif"; modelAndView.setViewName("redirect:/penduduk?nik=" + penduduk.getNik()); redir.addFlashAttribute("sukses", sukses); return modelAndView; } @RequestMapping("/penduduk/cari") public String cari(Model model, @RequestParam(value = "kt", required = false) String kt, @RequestParam(value = "kc", required = false) String kc, @RequestParam(value = "kl", required = false) String kl) { List<KotaModel> kotas = daerahDAO.selectAllKota(); String akhir = "cari-1"; if (kt != null) { List<KecamatanModel> kecamatans = daerahDAO.selectKecamatan(kt); KotaModel kota = daerahDAO.getKota(kt); model.addAttribute("kota", kota); model.addAttribute("kt", kt); model.addAttribute("kecamatans", kecamatans); akhir = "cari-2"; if (kc != null) { List<KelurahanModel> kelurahans = daerahDAO.selectKelurahan(kc); KecamatanModel kecamatan = daerahDAO.getKecamatan(kc); model.addAttribute("kecamatan", kecamatan); model.addAttribute("kc", kc); model.addAttribute("kelurahans", kelurahans); akhir = "cari-3"; if (kl != null) { KelurahanModel kelurahan = daerahDAO.getKelurahan(kl); String judul = "Lihat Data Penduduk di " + kota.getNama_kota() + ", Kecamatan " + kecamatan.getNama_kecamatan() + ", Kelurahan " + kelurahan.getNama_kelurahan(); List<PendudukModel> penduduks = pendudukDAO.pendudukKelurahan(kl); model.addAttribute("judul", judul); model.addAttribute("penduduks", penduduks); model.addAttribute("kl", kl); akhir = "hasil-cari"; } } } model.addAttribute("kotas", kotas); model.addAttribute("title", "Cari Penduduk"); return akhir; } }
2f1c929e9bb81606c039b293e8d87d7a13d3e050
8494c17b608e144370ee5848756b7c6ae38e8046
/gulimall-coupon/src/main/java/com/atguigu/gulimall/coupon/controller/SkuLadderController.java
7b4a0c039c5206252115304f1ac2a56ac945e8ce
[ "Apache-2.0" ]
permissive
cchaoqun/SideProject1_GuliMall
b235ee01df30bc207c747cf281108006482a778a
aef4c26b7ed4b6d17f7dcadd62e725f5ee68b13e
refs/heads/main
2023-06-11T02:23:28.729831
2021-07-07T11:56:13
2021-07-07T11:56:13
375,354,919
0
0
null
null
null
null
UTF-8
Java
false
false
2,301
java
package com.atguigu.gulimall.coupon.controller; import java.util.Arrays; import java.util.Map; //import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import com.atguigu.gulimall.coupon.entity.SkuLadderEntity; import com.atguigu.gulimall.coupon.service.SkuLadderService; import com.atguigu.common.utils.PageUtils; import com.atguigu.common.utils.R; /** * 商品阶梯价格 * * @author chengchaoqun * @email [email protected] * @date 2021-06-10 17:23:56 */ @RestController @RequestMapping("coupon/skuladder") public class SkuLadderController { @Autowired private SkuLadderService skuLadderService; /** * 列表 */ @RequestMapping("/list") //@RequiresPermissions("coupon:skuladder:list") public R list(@RequestParam Map<String, Object> params){ PageUtils page = skuLadderService.queryPage(params); return R.ok().put("page", page); } /** * 信息 */ @RequestMapping("/info/{id}") //@RequiresPermissions("coupon:skuladder:info") public R info(@PathVariable("id") Long id){ SkuLadderEntity skuLadder = skuLadderService.getById(id); return R.ok().put("skuLadder", skuLadder); } /** * 保存 */ @RequestMapping("/save") //@RequiresPermissions("coupon:skuladder:save") public R save(@RequestBody SkuLadderEntity skuLadder){ skuLadderService.save(skuLadder); return R.ok(); } /** * 修改 */ @RequestMapping("/update") //@RequiresPermissions("coupon:skuladder:update") public R update(@RequestBody SkuLadderEntity skuLadder){ skuLadderService.updateById(skuLadder); return R.ok(); } /** * 删除 */ @RequestMapping("/delete") //@RequiresPermissions("coupon:skuladder:delete") public R delete(@RequestBody Long[] ids){ skuLadderService.removeByIds(Arrays.asList(ids)); return R.ok(); } }
615cc5768899a872991f07767a3b79b8c7ff80be
0d4bc72155d0d35d55562c9ea986a3e930510499
/src/org/traccar/model/SNSMessage.java
0822767864e1a34f3cd7d3e514eb8309ac674229
[ "Apache-2.0" ]
permissive
sparselabs/GpsDataServer
2c927bc0a239ddd8ae8192e29e303a829a7fb987
b4fb4ce9dc2c51e2cce062570bc56a5f381d4730
refs/heads/master
2020-04-05T22:59:09.427880
2017-02-06T14:44:49
2017-02-06T14:44:49
30,155,234
0
0
null
null
null
null
UTF-8
Java
false
false
3,373
java
package org.traccar.model; import java.util.Date; /** * Created by pankaj on 3/3/16. * */ public class SNSMessage { private double latitude; private double longitude; private double altitude; private double speed; private double course; private double bearing; private double accuracy; private long createdAt; private long updatedAt; private String deviceId; private String extendedInfo; private String provider; private String externalId; public static SNSMessage fromPosition(Position position, String imei, String externalId){ SNSMessage message = new SNSMessage(); message.setLatitude(position.getLatitude()); message.setLongitude(position.getLongitude()); message.setAltitude(position.getAltitude()!=null?position.getAltitude():0); message.setSpeed(position.getSpeed()!=null?position.getSpeed():0); message.setCourse(position.getCourse()!=null?position.getCourse():0); message.setCreatedAt(position.getStartTime().getTime()); message.setUpdatedAt(position.getTime().getTime()); message.setExtendedInfo(position.getExtendedInfo()!=null?position.getExtendedInfo():""); message.setDeviceId(imei); message.setExternalId(externalId); message.setProvider("gps_tracker"); return message; } public String getExternalId() { return externalId; } public void setExternalId(String externalId) { this.externalId = externalId; } 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 double getAltitude() { return altitude; } public void setAltitude(double altitude) { this.altitude = altitude; } public double getSpeed() { return speed; } public void setSpeed(double speed) { this.speed = speed; } public double getCourse() { return course; } public void setCourse(double course) { this.course = course; } public double getBearing() { return bearing; } public void setBearing(double bearing) { this.bearing = bearing; } public double getAccuracy() { return accuracy; } public void setAccuracy(double accuracy) { this.accuracy = accuracy; } public long getCreatedAt() { return createdAt; } public void setCreatedAt(long createdAt) { this.createdAt = createdAt; } public long getUpdatedAt() { return updatedAt; } public void setUpdatedAt(long updatedAt) { this.updatedAt = updatedAt; } public String getDeviceId() { return deviceId; } public void setDeviceId(String deviceId) { this.deviceId = deviceId; } public String getExtendedInfo() { return extendedInfo; } public void setExtendedInfo(String extendedInfo) { this.extendedInfo = extendedInfo; } public String getProvider() { return provider; } public void setProvider(String provider) { this.provider = provider; } }
2c918f165c33aab9b2692a73c9d4eb51809f8f20
4df7b310b3ef3ac1417cec656d0242dad8c3ff18
/app/src/main/java/com/bme/shawn/wobble/Simon.java
7e7e529d2bb8230e57c36fa1063160f42745ace9
[]
no_license
svolpe43/Wobble
ce1804e2449223d1ce9e66e17c17d2b7ea0ed79c
672bb421c3a7590b56e2e937868be6d3a75666f6
refs/heads/master
2016-09-02T02:29:41.830305
2015-04-14T04:23:47
2015-04-14T04:23:47
26,848,530
0
0
null
null
null
null
UTF-8
Java
false
false
13,382
java
package com.bme.shawn.wobble; import android.graphics.Paint; import android.graphics.Path; import android.graphics.RectF; import android.util.Log; import java.util.ArrayList; import java.util.Random; /** * Created by shawn on 11/4/14. */ public class Simon { // paints private Paint mButtonPaint; private Paint mRedPaint; private Paint mGreenPaint; private Paint mBluePaint; private Paint mYellowPaint; // paths private Path mBluePath = new Path(); private Path mYellowPath = new Path(); private Path mGreenPath = new Path(); private Path mRedPath = new Path(); // ovals for drawing buttons private RectF mOutterOval; private RectF mInnerOval; private float mInnerRadius; private float mOuterRadius; // Drawing Constants private static final float X_PADDING = 20; private static final float SWEEP_SPREAD = 10; // this is half of the total angle between buttons private static final float BUTTON_ANGLE_SWEEP = 90 - 2 * SWEEP_SPREAD; // constant buttons public static final int NO_BUTTON = 0; public static final int BLUE_BUTTON = 1; public static final int YELLOW_BUTTON = 2; public static final int GREEN_BUTTON = 3; public static final int RED_BUTTON = 4; // game statuses public static final int GAME_OVER = -1; public static final int GAME_RUNNING = 0; public static final int GAME_PAUSED = 1; public static final int GAME_RESTART = 2; public static final int GAME_EXIT = 3; // button polygons private Polygon mRedPoly; private Polygon mBluePoly; private Polygon mYellowPoly; private Polygon mGreenPoly; // delay on the move cycles private static final int STEP_TIME = 600; // current status of the game private int mStatus; // time of previous animation update (ms) private long mLastTime; // animation is on private boolean mShowingAnimation; // a button is turned on private boolean mButtonOn; // the button that is on private int mButton; // top score this session private int mTopScore; // the current score private int score; // the current place in the sequence private int index; // game user message private String message; // sequence pattern private ArrayList<Integer> pattern; public Simon() { // initiate pattern pattern = new ArrayList<Integer>(); addMove(); // set up some status variables mShowingAnimation = true; mButtonOn = false; mButton = 0; index = 0; mLastTime = System.currentTimeMillis() + 100; mStatus = GAME_RUNNING; message = ""; // set scores mTopScore = 1; score = 0; // Simon button paint mButtonPaint = new Paint(); mButtonPaint.setStyle(Paint.Style.FILL); mButtonPaint.setAntiAlias(true); mButtonPaint.setStrokeWidth(20); // red paint mRedPaint = new Paint(mButtonPaint); mRedPaint.setARGB(255, 204, 0, 0); // blue paint mBluePaint = new Paint(mButtonPaint); mBluePaint.setARGB(255, 51, 102, 255); // yellow paint mYellowPaint = new Paint(mButtonPaint); mYellowPaint.setARGB(255, 255, 204, 0); // green paint mGreenPaint = new Paint(mButtonPaint); mGreenPaint.setARGB(255, 77, 184, 112); } public void setRunning(){ mStatus = GAME_RUNNING; } public void setPaused(){ mStatus = GAME_PAUSED; } // returns the updated button to turn on public int getButton(){ return mButton; } // returns the updated message public String getMessage(){ return message; } // returns the current score public String getScore(){ // todo give the top and current score here return Integer.toString(score); } // update the game public void update(int button) { // catch game status switch(mStatus) { case GAME_RESTART: reset(); break; case GAME_OVER: message = "Game Over"; break; case GAME_EXIT: message = "Exiting..."; } // get current time long now = System.currentTimeMillis(); // are we showing animation if(mShowingAnimation){ updateAnimation(button, now); } else{ handleUserInput(button, now); } } // handles updating the game based current button contact and time private void handleUserInput(int button, long now){ // finished all steps if(index == score){ // add a move addMove(); // update game state index = 0; mShowingAnimation = true; mButtonOn = false; // give animation a little delay mLastTime = now + STEP_TIME; // touching a button and pass delay }else if(button != NO_BUTTON && !mButtonOn) { // wrong if (button != pattern.get(index)) { // game over mButton = NO_BUTTON; mStatus = GAME_OVER; message = "Game Over"; // correct } else if (!mButtonOn){ mButton = button; index++; mButtonOn = true; message = "Correct!"; } mLastTime = now; }else if(button == NO_BUTTON){ mButton = NO_BUTTON; mButtonOn = false; } } // updates the animation sequence private void updateAnimation(int button, long now){ // give the graphics 100 ms to calculate (only when Simon object is first created) if (mLastTime > now) return; // set up animation mode if(button == NO_BUTTON && !mButtonOn) { mButton = NO_BUTTON; message = "watch..."; } // update the animation if (now - mLastTime > STEP_TIME){ if(index == score){ mButtonOn = false; index = 0; mButton = NO_BUTTON; mShowingAnimation = false; message = "Go!"; }else if(mButtonOn){ mButtonOn = false; index++; mButton = NO_BUTTON; }else { mButtonOn = true; mButton = pattern.get(index); } mLastTime = now; } } // adds a move to the private void addMove(){ Random rand = new Random(); int button = rand.nextInt(4) + 1; pattern.add(button); score++; } // clears the pattern and restarts the game public void reset(){ // set up some status variables mShowingAnimation = true; mButtonOn = false; mButton = 0; index = 0; message = "Tap the screen to start"; // pause game mStatus = GAME_PAUSED; pattern.clear(); score = 0; } // returns the button that the accelerometer locator is touching private int findContact(int x, int y){ // is it blue button if(mBluePoly.contains(x, y)) return BLUE_BUTTON; else if(mYellowPoly.contains(x, y)) return YELLOW_BUTTON; else if(mGreenPoly.contains(x, y)) return GREEN_BUTTON; else if(mRedPoly.contains(x, y)) return RED_BUTTON; return NO_BUTTON; } // updates the screen adding STROKE to the specified paint private void updateButtonPaint(int contact){ // Simon button out-line switch(contact){ case 0: mBluePaint.setStyle(Paint.Style.FILL); mYellowPaint.setStyle(Paint.Style.FILL); mGreenPaint.setStyle(Paint.Style.FILL); mRedPaint.setStyle(Paint.Style.FILL); break; case 1: mBluePaint.setStyle(Paint.Style.FILL_AND_STROKE); mYellowPaint.setStyle(Paint.Style.FILL); mGreenPaint.setStyle(Paint.Style.FILL); mRedPaint.setStyle(Paint.Style.FILL); break; case 2: mBluePaint.setStyle(Paint.Style.FILL); mYellowPaint.setStyle(Paint.Style.FILL_AND_STROKE); mGreenPaint.setStyle(Paint.Style.FILL); mRedPaint.setStyle(Paint.Style.FILL); break; case 3: mBluePaint.setStyle(Paint.Style.FILL); mYellowPaint.setStyle(Paint.Style.FILL); mGreenPaint.setStyle(Paint.Style.FILL_AND_STROKE); mRedPaint.setStyle(Paint.Style.FILL); break; case 4: mBluePaint.setStyle(Paint.Style.FILL); mYellowPaint.setStyle(Paint.Style.FILL); mGreenPaint.setStyle(Paint.Style.FILL); mRedPaint.setStyle(Paint.Style.FILL_AND_STROKE); break; } } public void updateGraphics(int xCenter, int yCenter){ // resize Simon Oval mOuterRadius = xCenter - X_PADDING; mInnerRadius = (xCenter - X_PADDING)/2; mOutterOval = new RectF(xCenter - mOuterRadius, yCenter - mOuterRadius, xCenter + mOuterRadius, yCenter + mOuterRadius); mInnerOval = new RectF(xCenter - mInnerRadius, yCenter - mInnerRadius, xCenter + mInnerRadius, yCenter + mInnerRadius); /***************************************** * update yellow path *******************************************/ mYellowPath.reset(); mYellowPath.addArc(mOutterOval, 90 + SWEEP_SPREAD / 2, BUTTON_ANGLE_SWEEP + SWEEP_SPREAD); mYellowPath.arcTo(mInnerOval, 180 - SWEEP_SPREAD, -BUTTON_ANGLE_SWEEP); mYellowPath.close(); // store yellow polygon float[] yellow_x = new float[] { xCenter - mOuterRadius, xCenter - mInnerRadius, xCenter - SWEEP_SPREAD, xCenter - SWEEP_SPREAD }; float[] yellow_y = new float[] { yCenter + SWEEP_SPREAD, yCenter + SWEEP_SPREAD, yCenter + mInnerRadius, yCenter + mOuterRadius }; mYellowPoly = new Polygon(yellow_x, yellow_y, 4); /****************************************** * update green path ********************************************/ mGreenPath.reset(); mGreenPath.addArc(mOutterOval, 180 + SWEEP_SPREAD / 2, BUTTON_ANGLE_SWEEP + SWEEP_SPREAD); mGreenPath.arcTo(mInnerOval, 270 - SWEEP_SPREAD, -BUTTON_ANGLE_SWEEP); mGreenPath.close(); // store green polygon float[] green_x = new float[] { xCenter - mInnerRadius, xCenter - mOuterRadius, xCenter - SWEEP_SPREAD, xCenter - SWEEP_SPREAD }; float[] green_y = new float[] { yCenter - SWEEP_SPREAD, yCenter - SWEEP_SPREAD, yCenter - mOuterRadius, yCenter - mInnerRadius }; mGreenPoly = new Polygon(green_x, green_y, 4); /****************************************** * update blue path *********************************************/ mBluePath.reset(); mBluePath.addArc(mOutterOval, SWEEP_SPREAD / 2, BUTTON_ANGLE_SWEEP + SWEEP_SPREAD); mBluePath.arcTo(mInnerOval, 90 - SWEEP_SPREAD, -BUTTON_ANGLE_SWEEP); mBluePath.close(); // store blue polygon float[] blue_x = new float[] { xCenter + mInnerRadius, xCenter + mOuterRadius, xCenter + SWEEP_SPREAD, xCenter + SWEEP_SPREAD }; float[] blue_y = new float[] { yCenter + SWEEP_SPREAD, yCenter + SWEEP_SPREAD, yCenter + mOuterRadius, yCenter + mInnerRadius }; mBluePoly = new Polygon(blue_x, blue_y, 4); /***************************************** * update red path *********************************************/ mRedPath.reset(); mRedPath.addArc(mOutterOval, 270 + SWEEP_SPREAD / 2, BUTTON_ANGLE_SWEEP + SWEEP_SPREAD); mRedPath.arcTo(mInnerOval, 0 - SWEEP_SPREAD, -BUTTON_ANGLE_SWEEP); mRedPath.close(); // store red polygon float[] red_x = new float[] { xCenter + SWEEP_SPREAD, xCenter + SWEEP_SPREAD, xCenter + mOuterRadius, xCenter + mInnerRadius }; float[] red_y = new float[] { yCenter - mInnerRadius, yCenter - mOuterRadius, yCenter - SWEEP_SPREAD, yCenter - SWEEP_SPREAD }; mRedPoly = new Polygon(red_x, red_y, 4); } } /* // draw canvas.drawPath(mBluePath, mBluePaint); canvas.drawPath(mYellowPath, mYellowPaint); canvas.drawPath(mGreenPath, mGreenPaint); canvas.drawPath(mRedPath, mRedPaint); */
3d4bcedb9e6489e3b4af57d1b0a59ccfa14ccef8
aad637ff6b08065ba40937653bb071f97a971311
/app/src/main/java/com/example/chatapplication/HomeFragment.java
00f6d5a126825aea873ee61ffa8731e75a028810
[]
no_license
MdGolam-Kibria/SocialMediaChatApplication
46df2032bb8c9a08131fed5fce48cf6a5e923d1b
cf2b084f967ae7b0a609e23aa9063a7cf3a8c8ed
refs/heads/master
2022-11-14T13:11:38.514638
2020-06-29T18:55:45
2020-06-29T18:55:45
266,576,270
2
0
null
null
null
null
UTF-8
Java
false
false
7,474
java
package com.example.chatapplication; import android.content.Intent; import android.os.Bundle; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.widget.SearchView; import androidx.core.view.MenuItemCompat; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import android.text.TextUtils; 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.example.chatapplication.adapter.AdapterPost; import com.example.chatapplication.modelAll.ModelPost; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import java.util.ArrayList; import java.util.List; /** * A simple {@link Fragment} subclass. */ public class HomeFragment extends Fragment { FirebaseAuth firebaseAuth; RecyclerView recyclerView; List<ModelPost> postList; AdapterPost adapterPost; public HomeFragment() { // Required empty public constructor } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_home, container, false); firebaseAuth = FirebaseAuth.getInstance(); //recycler view and its properties recyclerView = view.findViewById(R.id.postsRecyclerview); LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity()); //show newest post last ,for this load from last layoutManager.setStackFromEnd(true); layoutManager.setReverseLayout(true); recyclerView.setLayoutManager(layoutManager); //inti...post list postList = new ArrayList<>(); loadPosts(); return view; } private void loadPosts() { //path of all posts final DatabaseReference databaseReference = FirebaseDatabase.getInstance().getReference("Posts"); //now get all data from this databaseReference databaseReference.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { postList.clear(); for (DataSnapshot ds : dataSnapshot.getChildren()) { ModelPost modelPost = ds.getValue(ModelPost.class); postList.add(modelPost); //adapter adapterPost = new AdapterPost(getActivity(),postList); //now set adapter to recycler view recyclerView.setAdapter(adapterPost); } } @Override public void onCancelled(@NonNull DatabaseError databaseError) { //in case any error from loading data time Toast.makeText(getActivity(), ""+ databaseError.getMessage(), Toast.LENGTH_SHORT).show(); } }); } private void searchPost(final String searchQuery){ //path of all posts final DatabaseReference databaseReference = FirebaseDatabase.getInstance().getReference("Posts"); //now get all data from this databaseReference databaseReference.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { postList.clear(); for (DataSnapshot ds : dataSnapshot.getChildren()) { ModelPost modelPost = ds.getValue(ModelPost.class); /* if in search view user enter query match with postTitle and descriptions */ if (modelPost.getPTitle().toLowerCase().contains(searchQuery.toLowerCase())|| modelPost.getPDescr().toLowerCase().contains(searchQuery.toLowerCase())){ postList.add(modelPost); } //adapter adapterPost = new AdapterPost(getActivity(),postList); //now set adapter to recycler view recyclerView.setAdapter(adapterPost); } } @Override public void onCancelled(@NonNull DatabaseError databaseError) { //in case any error from loading data time Toast.makeText(getActivity(), ""+ databaseError.getMessage(), Toast.LENGTH_SHORT).show(); } }); } private void checkUserStatus() {//check user sign in or not and accessibility FirebaseUser user = firebaseAuth.getCurrentUser();//get current user if (user != null) { //user signed in stay here // mProfileTv.setText(user.getEmail()); } else { //user not signed in startActivity(new Intent(getActivity(), MainActivity.class)); getActivity().finish(); } } @Override public void onCreate(@Nullable Bundle savedInstanceState) { setHasOptionsMenu(true);//to show menu option in fragment super.onCreate(savedInstanceState); } @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {//for inflate option menu inflater.inflate(R.menu.menu, menu); //add search view for search post by title/description MenuItem menuItem = menu.findItem(R.id.action_search); SearchView searchView = (SearchView) MenuItemCompat.getActionView(menuItem); //now search listen... searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) {//called when user press search button if (!TextUtils.isEmpty(query)){//if user set any search query in search view searchPost(query); }else {//if user dont search anything loadPosts(); } return false; } @Override public boolean onQueryTextChange(String query) {//called as when user press any latter if (!TextUtils.isEmpty(query)){//if user set any search query in search view searchPost(query); }else {//if user dont search anything loadPosts(); } return false; } }); super.onCreateOptionsMenu(menu, inflater); } @Override public boolean onOptionsItemSelected(@NonNull MenuItem item) {//for option item selection handle "logout" int id = item.getItemId(); if (id == R.id.actionLogout) { firebaseAuth.signOut(); checkUserStatus(); } if (id == R.id.actionAddPost) { startActivity(new Intent(getActivity(), AddPostActivity.class)); } return super.onOptionsItemSelected(item); } }
592c5580c6437e6e61d741c36cdc624b1acd54cf
487635c4a74586f6ba507ce9220bf0d83cd68cdf
/src/main/java/com/b2w/planetas/api/PlanetasStarwarsApplication.java
7d5ce318beb02acb36bd835859f2ecfb2c2f6a91
[]
no_license
andpratesdev/StarWarsAPI
7fae3f2fe616e62ef5f08c3abf8f4368a6696119
9aecf11ba133c63124482252e1882ba8b241b574
refs/heads/master
2021-03-05T18:06:50.860422
2020-03-09T21:50:20
2020-03-09T21:50:20
246,139,684
0
0
null
null
null
null
UTF-8
Java
false
false
333
java
package com.b2w.planetas.api; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class PlanetasStarwarsApplication { public static void main(String[] args) { SpringApplication.run(PlanetasStarwarsApplication.class, args); } }
eca23ccda46e661ef55587a93a70396f70acc35f
2b5005fbc89fe6bde09d61600dd7252b31760396
/Homework5/src/com/company/Main.java
bd57bdf121cf0dc6b8ec5752316fbc180469f2af
[]
no_license
tyssie/Projects
aa0516f293df1ce23a0c5eaf631e7ab07a9e5f77
eb4d8696bfbb5237eafe17a0bda994aeef3168d4
refs/heads/main
2023-03-27T21:49:56.806710
2021-03-27T07:04:44
2021-03-27T07:04:44
343,953,718
0
0
null
null
null
null
UTF-8
Java
false
false
893
java
package com.company; public abstract class Main { public static void main(String[] args) { Employee[] employees = new Employee[5]; employees[0] = new Employee("Jack Sparrow", "CEO", "[email protected]", "15423221234", 300000, 42); employees[1] = new Employee("Danny Beck", "Head of Logistic", "[email protected]", "13246443212", 100000, 35); employees[2] = new Employee("Nick Davidson", "Programmer", "[email protected]", "17433456677", 70000, 26); employees[3] = new Employee("Cecil Jameson", "Engineer", "[email protected]", "18688872356", 80000, 51); employees[4] = new Employee("Tom Fletcher", "Manager", "[email protected]", "12223465555", 75000, 30); for (int i = 0; i < employees.length; i++) { if (employees[i].getAge() > 40) { employees[i].info(); } } } }
f72f0b261bd09cb019c5d489499ce6f993d13b60
fe81fc24c5a527d48e072fd40b231f8e516eda47
/src/java/org/datanucleus/cache/ehcache/EhcacheLevel2Cache.java
cfaf4744069c24026170aed14525184375101cf4
[ "Apache-2.0" ]
permissive
nbartels/datanucleus-cache
5c05589be6eafbd6d6b39b677f0aa19721ddfd3d
c89b8daa3f9da27e6acca4494af90a4b4e5b8e9d
refs/heads/master
2021-01-23T03:54:06.258092
2014-01-21T20:36:15
2014-01-21T20:36:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
10,273
java
/********************************************************************** Copyright (c) 2005 Erik Bengtson and others. All rights reserved. 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. Contributors: ... **********************************************************************/ package org.datanucleus.cache.ehcache; import java.io.Serializable; import java.util.Collection; import java.util.Iterator; import org.datanucleus.NucleusContext; import org.datanucleus.PersistenceConfiguration; import org.datanucleus.cache.AbstractLevel2Cache; import org.datanucleus.cache.CachedPC; import org.datanucleus.exceptions.NucleusException; import org.datanucleus.identity.OID; import org.datanucleus.metadata.AbstractClassMetaData; import org.datanucleus.metadata.IdentityType; import org.datanucleus.util.NucleusLogger; import net.sf.ehcache.Cache; import net.sf.ehcache.CacheException; import net.sf.ehcache.CacheManager; import net.sf.ehcache.Element; import net.sf.ehcache.ObjectExistsException; /** * Simple implementation of a plugin for use of Ehcache caching product with DataNucleus. * Please refer to <a href="http://ehcache.sourceforge.net">ehcache.sourceforge.net</a> * for full details of their product. */ public class EhcacheLevel2Cache extends AbstractLevel2Cache { /** The cache manager */ private final CacheManager cacheManager; /** The cache */ private final Cache cache; /** * Constructor. * @param nucleusCtx Context */ public EhcacheLevel2Cache(NucleusContext nucleusCtx) { super(nucleusCtx); PersistenceConfiguration conf = nucleusCtx.getPersistenceConfiguration(); String configFile = conf.getStringProperty("datanucleus.cache.level2.configurationFile"); try { if (configFile == null) { cacheManager = CacheManager.create(); } else { cacheManager = CacheManager.create(CacheManager.class.getResource(configFile)); } } catch (CacheException e) { throw new NucleusException("Cant create cache", e); } if (!cacheManager.cacheExists(cacheName)) { try { cacheManager.addCache(cacheName); } catch (IllegalStateException e) { NucleusLogger.CACHE.warn("Error creating Cache : " + e.getMessage()); throw new NucleusException("Cant create cache", e); } catch (ObjectExistsException e) { NucleusLogger.CACHE.warn("Error creating Cache : " + e.getMessage()); throw new NucleusException("Cant create cache", e); } catch (CacheException e) { NucleusLogger.CACHE.warn("Error creating Cache : " + e.getMessage()); throw new NucleusException("Cant create cache", e); } } cache = cacheManager.getCache(cacheName); } /** * Method to close the cache when no longer needed. Provides a hook to release resources etc. */ public void close() { if (clearAtClose) { evictAll(); } cacheManager.shutdown(); } /** * Accessor for whether the cache contains the specified id. * @see org.datanucleus.cache.Level2Cache#containsOid(java.lang.Object) */ public boolean containsOid(Object oid) { try { return (get(oid) != null); } catch (IllegalStateException e) { NucleusLogger.CACHE.warn("Error invoking Cache.containsOid : " + e.getMessage()); } return false; } /** * Accessor for an object in the cache. * @see org.datanucleus.cache.Level2Cache#get(java.lang.Object) */ public CachedPC get(Object oid) { try { Element element = cache.get((Serializable) oid); if (element == null) { return null; } return toPC(element); } catch (IllegalStateException e) { NucleusLogger.CACHE.warn("Error invoking Cache.get : " + e.getMessage()); } catch (CacheException e) { NucleusLogger.CACHE.warn("Error invoking Cache.get : " + e.getMessage()); } return null; } /** * Convert from Element to a cacheable object * @param object the Element * @return the cacheable object */ private CachedPC toPC(Element object) { return (CachedPC)object.getObjectValue(); } /** * Convert from PersistenceCapable to Element * @param oid the id * @param object the PersistenceCapable * @return the Element */ private Element toElement(Object oid, CachedPC object) { return new Element((Serializable) oid, object); } /** * Accessor for the size of the cache. * @see org.datanucleus.cache.Level2Cache#getSize() */ public int getSize() { try { return cache.getSize(); } catch (IllegalStateException e) { NucleusLogger.CACHE.warn("Error invoking Cache.getSize : " + e.getMessage()); } catch (CacheException e) { NucleusLogger.CACHE.warn("Error invoking Cache.getSize : " + e.getMessage()); } return 0; } /** * Accessor for whether the cache is empty * @see org.datanucleus.cache.Level2Cache#isEmpty() */ public boolean isEmpty() { try { return cache.getSize() == 0; } catch (IllegalStateException e) { NucleusLogger.CACHE.warn("Error invoking Cache.isEmpty : " + e.getMessage()); } catch (CacheException e) { NucleusLogger.CACHE.warn("Error invoking Cache.isEmpty : " + e.getMessage()); } return true; } /** * Method to add an object to the cache under its id * @param oid The identity * @param pc The cacheable object */ public CachedPC put(Object oid, CachedPC pc) { if (oid == null || pc == null) { return null; } else if (maxSize >= 0 && getSize() == maxSize) { return null; } cache.put(toElement(oid, pc)); return pc; } /** * Evict the parameter instance from the second-level cache. * @param oid the object id of the instance to evict. */ public void evict(Object oid) { Object pc = get(oid); if (pc != null) { cache.remove((Serializable) oid); } } /** * Evict the parameter instances from the second-level cache. * All instances in the PersistenceManager's cache are evicted * from the second-level cache. */ public void evictAll() { try { cache.removeAll(); } catch (Exception e) { NucleusLogger.CACHE.warn("Error invoking Cache.clear : " + e.getMessage()); } } /** * Evict the parameter instances from the second-level cache. * @param pcClass the class of instances to evict * @param subclasses if true, evict instances of subclasses also */ public void evictAll(Class pcClass, boolean subclasses) { if (!nucleusCtx.getApiAdapter().isPersistable(pcClass)) { return; } evictAllOfClass(pcClass.getName()); if (subclasses) { String[] subclassNames = nucleusCtx.getMetaDataManager().getSubclassesForClass(pcClass.getName(), true); if (subclassNames != null) { for (int i=0;i<subclassNames.length;i++) { evictAllOfClass(subclassNames[i]); } } } } void evictAllOfClass(String className) { AbstractClassMetaData cmd = nucleusCtx.getMetaDataManager().getMetaDataForClass(className, nucleusCtx.getClassLoaderResolver(null)); Iterator keyIter = cache.getKeys().iterator(); while (keyIter.hasNext()) { Object key = keyIter.next(); if (cmd.getIdentityType() == IdentityType.APPLICATION) { String targetClassName = nucleusCtx.getApiAdapter().getTargetClassNameForSingleFieldIdentity(key); if (className.equals(targetClassName)) { keyIter.remove(); } } else if (cmd.getIdentityType() == IdentityType.DATASTORE && key instanceof OID) { OID oid = (OID)key; if (className.equals(oid.getPcClass())) { keyIter.remove(); } } } } /** * Evict the parameter instances from the second-level cache. * @param oids the object ids of the instance to evict. */ public void evictAll(Collection oids) { if (oids == null) { return; } Iterator iter = oids.iterator(); while (iter.hasNext()) { evict(iter.next()); } } /** * Evict the parameter instances from the second-level cache. * @param oids the object ids of the instance to evict. */ public void evictAll(Object[] oids) { if (oids == null) { return; } for (int i=0;i<oids.length;i++) { evict(oids[i]); } } }
5fcd0722649fc330c73c1997fca4da5a6cdeb7ef
bfac99890aad5f43f4d20f8737dd963b857814c2
/reg4/v1/xwiki-platform-core/xwiki-platform-formula/xwiki-platform-formula-renderer/src/main/java/org/xwiki/formula/AbstractFormulaRenderer.java
125ff5dcf9757065c293205221b3483c6cf61e9a
[]
no_license
STAMP-project/dbug
3b3776b80517c47e5cac04664cc07112ea26b2a4
69830c00bba4d6b37ad649aa576f569df0965c72
refs/heads/master
2021-01-20T03:59:39.330218
2017-07-12T08:03:40
2017-07-12T08:03:40
89,613,961
0
1
null
null
null
null
UTF-8
Java
false
false
6,046
java
/* * See the NOTICE file distributed with this work for additional * information regarding copyright ownership. * * This 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 software 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 software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.xwiki.formula; import java.io.IOException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import javax.inject.Inject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Base class for all implementations of the {@link FormulaRenderer} component. Provides all the common functionalities * (caching, storage, and retrieval), so that the only responsibility of each implementation remains just to actually * transform the formula into an image. * * @version $Id: a80ee6a82c57e8f2e63db62b903ad982618b96c2 $ * @since 2.0M3 */ public abstract class AbstractFormulaRenderer implements FormulaRenderer { /** Logging helper object. */ private static final Logger LOGGER = LoggerFactory.getLogger(AbstractFormulaRenderer.class); /** A storage system for rendered images, for reuse in subsequent requests. */ @Inject private ImageStorage storage; @Override public String process(String formula, boolean inline, FontSize size, Type type) throws IllegalArgumentException, IOException { // Only render the image if it is not already in the cache String cacheKey = computeImageID(formula, inline, size, type); if (this.storage.get(cacheKey) == null) { ImageData image = renderImage(formula, inline, size, type); this.storage.put(cacheKey, image); } return cacheKey; } @Override public ImageData getImage(String imageID) { return this.storage.get(imageID); } /** * Renders a mathematical formula into an image. * * @param formula a string representation of the formula, in LaTeX syntax, without any commands that specify the * environment (such as $$ .. $$, \begin{math} ... \end{math}, etc) * @param inline specifies if the rendered formula will be displayed inline in the text, or as a separate block * @param size the font size used for displaying the formula * @param type the format in which the formula is rendered * @return the rendered image, as an {@link ImageData} instance * @throws IllegalArgumentException if the LaTeX syntax of the formula is incorrect and the error is unrecoverable * @throws IOException in case of a renderer execution error */ protected abstract ImageData renderImage(String formula, boolean inline, FontSize size, Type type) throws IllegalArgumentException, IOException; /** * Computes the identifier under which the rendered formula will be stored for later reuse. * * @param formula a string representation of the formula, in LaTeX syntax, without any commands that specify the * environment (such as $$ .. $$, \begin{math} ... \end{math}, etc) * @param inline specifies if the rendered formula will be displayed inline in the text, or as a separate block * @param size the font size used for displaying the formula * @param type the format in which the formula is rendered * @return a string representation of the hash code for the four information items */ protected String computeImageID(String formula, boolean inline, FontSize size, Type type) { // Try computing a long hash try { MessageDigest hashAlgorithm = MessageDigest.getInstance("SHA-256"); hashAlgorithm.update(inline ? (byte) 't' : (byte) 'f'); hashAlgorithm.update((byte) size.ordinal()); hashAlgorithm.update((byte) type.ordinal()); hashAlgorithm.update(formula.getBytes()); return new String(org.apache.commons.codec.binary.Hex.encodeHex(hashAlgorithm.digest())); } catch (NoSuchAlgorithmException ex) { LOGGER.error("No MD5 hash algorithm implementation", ex); } catch (NullPointerException ex) { LOGGER.error("Error hashing image name", ex); } // Fallback to a simple hashcode final int prime = 37; int result = 1; result = prime * result + formula.hashCode(); result = prime * result + (inline ? 0 : 1); result = prime * result + size.hashCode(); result = prime * result + type.hashCode(); result = prime * result + this.getClass().getCanonicalName().hashCode(); return result + ""; } /** * Prepares the mathematical formula for rendering by wrapping it in the proper math environment. * * @param formula the mathematical formula that needs to be rendered * @param inline a boolean that specifies if the rendered formula will be displayed inline in the text, or as a * separate block * @return the formula, surrounded by "\begin{math}" / "\end{math}" if it is supposed to be displayed inline, and by * "\begin{displaymath}" / \end{displaymath} if it should be displayed as a block. */ protected String wrapFormula(String formula, boolean inline) { return (inline ? "\\begin{math}" : "\\begin{displaymath}") + "\n{ " + formula + " }\n" + (inline ? "\\end{math}" : "\\end{displaymath}"); } }
bef6de46db914a350afb3570a7c44d12619552d6
9b0a4720febd145ee16eb06b735fc56dba569c6b
/JAVA/core-webservices/src/main/java/com/tmg/ebscorews/template/TemplateService.java
7577a8259721f48a26da0f145ea2071eddb373e7
[ "Apache-2.0" ]
permissive
govindrgaikwad/java_repo
6c3865a3bf534447af668b987596348e9282626e
19b25514ebf3063acf613bfe637285040396f4d0
refs/heads/master
2022-12-23T10:18:56.246620
2019-11-25T14:18:41
2019-11-25T14:18:41
19,309,946
0
0
Apache-2.0
2022-12-16T01:58:08
2014-04-30T10:20:46
Java
UTF-8
Java
false
false
13,381
java
package com.tmg.ebscorews.template; import java.util.List; import javax.jws.WebMethod; import javax.jws.WebParam; import javax.jws.WebResult; import javax.jws.WebService; import javax.jws.soap.SOAPBinding; import javax.jws.soap.SOAPBinding.ParameterStyle; import javax.jws.soap.SOAPBinding.Style; import javax.jws.soap.SOAPBinding.Use; import javax.xml.ws.BindingType; import com.tmg.ebscore.dto.ServiceOperationResult; import com.tmg.ebscore.dto.ebspackage.BenifitPackageData; import com.tmg.ebscore.dto.template.PackageTemplateData; import com.tmg.ebscore.dto.template.PkgVersionWorkflowStateData; import com.tmg.ebscore.dto.template.ShapeValueDefaultData; import com.tmg.ebscore.dto.template.TemplateAllowsIntValData; import com.tmg.ebscore.dto.template.TemplateAllowsLimitValData; import com.tmg.ebscore.dto.template.TemplateAllowsMessageValData; import com.tmg.ebscore.dto.template.TemplateAllowsServiceDefinitionData; import com.tmg.ebscore.dto.template.TemplateAllowsStringValData; import com.tmg.ebscore.dto.template.TemplateContainer; import com.tmg.ebscore.dto.template.TemplateSummaryData; import com.tmg.ebscore.dto.template.TemplateTreeData; import com.tmg.ebscore.dto.template.TemplateWorkFlowStateData; import com.tmg.ebscore.orm.template.TemplateWorkflowState; import com.tmg.ebscorews.common.ServiceFault; @WebService(targetNamespace = "http://www.tmg.com/coreservices/TemplateService") @SOAPBinding(parameterStyle = ParameterStyle.WRAPPED, style = Style.DOCUMENT, use = Use.LITERAL) @BindingType(javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING) public interface TemplateService { @WebMethod(operationName = "GetTemplateList", action = "GetTemplateList") public @WebResult(name = "TemplateListData", targetNamespace = "http://www.tmg.com/coreservices/TemplateService") TemplateContainer<TemplateSummaryData> getTemplateList( @WebParam(name = "Page") int page, @WebParam(name = "MaxResult") int maxResults) throws ServiceFault; @WebMethod(operationName = "DeleteTemplate", action = "DeleteTemplate") public @WebResult(name = "DeleteTemplateResult", targetNamespace = "http://www.tmg.com/coreservices/TemplateService") ServiceOperationResult deleteTemplate( @WebParam(name = "TemplateId") int templateId) throws ServiceFault; @WebMethod(operationName = "ChangeWorkFlowState", action = "ChangeWorkFlowState") public @WebResult(name = "SaveChangeWorkFlowState") ServiceOperationResult changeWorkFlowState( @WebParam(name = "TemplateWorkFlowid") int templateWorkFlowid, @WebParam(name = "PackageTemplateid") int packageTemplateid) throws ServiceFault; @WebMethod(operationName = "GetTemplateWorkFlowStateListAtTemplate", action = "GetTemplateWorkFlowStateListAtTemplate") public @WebResult(name = "TemplateWorkFlowData", targetNamespace = "http://www.tmg.com/coreservices/TemplateService") TemplateContainer<TemplateWorkFlowStateData> getTemplateWorkFlowStateListAtTemplate( @WebParam(name = "Page") int page, @WebParam(name = "MaxResults") int maxResults) throws ServiceFault; @WebMethod(operationName = "GetNoOFReleasedPackage", action = "GetNoOFReleasedPackage") public @WebResult(name = "NoOFReleasedPackages", targetNamespace = "http://www.tmg.com/coreservices/TemplateService") int getNoOFReleasedPackage(@WebParam(name = "templateId") int tempId) throws ServiceFault; @WebMethod(operationName = "GetNoOFUnReleasedPackage", action = "GetNoOFUnReleasedPackage") public @WebResult(name = "NoOFUnReleasedPackages", targetNamespace = "http://www.tmg.com/coreservices/TemplateService") int getNoOFUnReleasedPackage(@WebParam(name = "templateId") int tempId) throws ServiceFault; @WebMethod(operationName = "GetPackagesForTemplate", action = "GetPackagesForTemplate") public @WebResult(name = "GetBenifitPackageData", targetNamespace = "http://www.tmg.com/coreservices/TemplateService") TemplateContainer<BenifitPackageData> getPackagesForTemplate( @WebParam(name = "TempId") int id, @WebParam(name = "Page") int page, @WebParam(name = "MaxResults") int maxResults) throws ServiceFault; @WebMethod(operationName = "GetIntValListForTemplate", action = "GetIntValListForTemplate") public @WebResult(name = "TemplateAllowsIntValData", targetNamespace = "http://www.tmg.com/coreservices/TemplateService") TemplateContainer<TemplateAllowsIntValData> getIntValListForTemplate( @WebParam(name = "MasterListId") int masterListId, @WebParam(name = "TemplateId") int tempId, @WebParam(name = "Page") int page, @WebParam(name = "MaxResults") int maxResults) throws ServiceFault; @WebMethod(operationName = "GetStringValListForTemplate", action = "GetStringValListForTemplate") public @WebResult(name = "TemplateAllowsStringValData", targetNamespace = "http://www.tmg.com/coreservices/TemplateService") TemplateContainer<TemplateAllowsStringValData> getStringValListForTemplate( @WebParam(name = "MasterListId") int masterListId, @WebParam(name = "TempId") int tempId, @WebParam(name = "page") int page, @WebParam(name = "MaxResults") int maxResults) throws ServiceFault; @WebMethod(operationName = "GetMessageValListForTemplate", action = "GetMessageValListForTemplate") public @WebResult(name = "TemplateAllowsMessageValData", targetNamespace = "http://www.tmg.com/coreservices/TemplateService") TemplateContainer<TemplateAllowsMessageValData> getMessageValListForTemplate( @WebParam(name = "MasterListId") int masterListId, @WebParam(name = "TempId") int tempId, @WebParam(name = "Page") int page, @WebParam(name = "MaxResults") int maxResults) throws ServiceFault; @WebMethod(operationName = "GetLimitValListForTemplate", action = "GetLimitValListForTemplate") public @WebResult(name = "TemplateAllowsLimitValData", targetNamespace = "http://www.tmg.com/coreservices/TemplateService") TemplateContainer<TemplateAllowsLimitValData> getLimitValListForTemplate( @WebParam(name = "MasterListId") int masterListId, @WebParam(name = "TempId") int tempId, @WebParam(name = "Page") int page, @WebParam(name = "MaxResults") int maxResults) throws ServiceFault; @WebMethod(operationName = "GetServiceDefinitionValListForTemplate", action = "GetServiceDefinitionValListForTemplate") public @WebResult(name = "TemplateAllowsServiceDefinitionData", targetNamespace = "http://www.tmg.com/coreservices/TemplateService") TemplateContainer<TemplateAllowsServiceDefinitionData> getServiceDefinitionValListForTemplate( @WebParam(name = "MasterListId") int masterListId, @WebParam(name = "TempId") int tempId, @WebParam(name = "Page") int page, @WebParam(name = "MaxResults") int maxResults) throws ServiceFault; @WebMethod(operationName = "GetWorkFlowStateForEachTemplate", action = "GetWorkFlowStateForEachTemplate") public @WebResult(name = "PkgVersionWorkflowStateData", targetNamespace = "http://www.tmg.com/coreservices/TemplateService") TemplateContainer<PkgVersionWorkflowStateData> getWorkFlowStateForEachTemplate( @WebParam(name = "packageTemplateId") int id, @WebParam(name = "Page") int page, @WebParam(name = "MaxResults") int maxResults) throws ServiceFault; @WebMethod(operationName = "GetAllTemplateTreeForTemplate", action = "GetAllTemplateTreeForTemplate") public @WebResult(name = "TemplateTreeData", targetNamespace = "http://www.tmg.com/coreservices/TemplateService") TemplateContainer<TemplateTreeData> getAllTemplateTreeForTemplate( @WebParam(name = "TempId") int id, @WebParam(name = "Page") int page, @WebParam(name = "MaxResults") int maxResults) throws ServiceFault; @WebMethod(operationName = "SaveTemplateFromExistingTemplate", action = "SaveTemplateFromExistingTemplate") public @WebResult(name = "SaveTemplateFromExistingTemplate", targetNamespace = "http://www.tmg.com/coreservices/TemplateService") ServiceOperationResult saveTemplateFromExistingTemplate( @WebParam(name = "PackageTemplateData", targetNamespace = "http://www.tmg.com/coreservices/data") PackageTemplateData data, @WebParam(name = "MasterListBooleanVal") Boolean masterList, @WebParam(name = "PackageWorkFlowStateBooleanVal") Boolean packageWorkFlowState, @WebParam(name = "TemplateTreeBooleanVal") Boolean TemplateTree) throws ServiceFault; @WebMethod(operationName = "SaveUpdateTemplate", action = "SaveUpdateTemplate") public @WebResult(name = "SaveResult") ServiceOperationResult saveUpdateTemplate( @WebParam(name = "PackageTemplateData", targetNamespace = "http://www.tmg.com/coreservices/data") PackageTemplateData data) throws ServiceFault; @WebMethod(operationName = "SaveUpdateAndDeleteAllowIntValForTemplate", action = "SaveUpdateAndDeleteAllowIntValForTemplate") public @WebResult(name = "SaveTemplateAllowsIntValData") ServiceOperationResult saveUpdateAndDeleteAllowIntValForTemplate( @WebParam(name = "TemplateAllowsIntValData", targetNamespace = "http://www.tmg.com/coreservices/data") List<TemplateAllowsIntValData> allowsIntVals, @WebParam(name = "TempId") int tempId, @WebParam(name = "MasterListId") int mastId) throws ServiceFault; @WebMethod(operationName = "SaveAndDeleteAllowLimitValForTemplate", action = "SaveAndDeleteAllowLimitValForTemplate") public @WebResult(name = "SaveTemplateAllowsLimitValData") ServiceOperationResult saveAndDeleteAllowLimitValForTemplate( @WebParam(name = "TemplateAllowsLimitValData", targetNamespace = "http://www.tmg.com/coreservices/data") List<TemplateAllowsLimitValData> allowsLimitVals, @WebParam(name = "TempId") int tempId) throws ServiceFault; @WebMethod(operationName = "SaveAndDeleteAllowServiceDefinitionForTemplate", action = "SaveAndDeleteAllowServiceDefinitionForTemplate") public @WebResult(name = "SaveTemplateAllowsServiceDefinitionData") ServiceOperationResult saveAndDeleteAllowServiceDefinitionForTemplate( @WebParam(name = "TemplateAllowsServiceDefinitionData", targetNamespace = "http://www.tmg.com/coreservices/data") List<TemplateAllowsServiceDefinitionData> allowServiceDefinitionList, @WebParam(name = "TempId") int tempId) throws ServiceFault; @WebMethod(operationName = "SaveAndDeleteAllowMessageValForTemplate", action = "SaveAndDeleteAllowMessageValForTemplate") public @WebResult(name = "SaveTemplateAllowsMessageValData") ServiceOperationResult saveAndDeleteAllowMessageValForTemplate( @WebParam(name = "AllowMessageValList", targetNamespace = "http://www.tmg.com/coreservices/data") List<TemplateAllowsMessageValData> allowMessageValList, @WebParam(name = "TempId") int tempId) throws ServiceFault; @WebMethod(operationName = "SaveUpdateAndDeleteAllowStringValForTemplate", action = "SaveUpdateAndDeleteAllowStringValForTemplate") public @WebResult(name = "SaveTemplateAllowsStringValData") ServiceOperationResult saveUpdateAndDeleteAllowStringValForTemplate( @WebParam(name = "TemplateAllowsStringValData", targetNamespace = "http://www.tmg.com/coreservices/data") List<TemplateAllowsStringValData> allowsStringValDatas, @WebParam(name = "TemplateId") int templateId, @WebParam(name = "MasterId") int mastId) throws ServiceFault; @WebMethod(operationName = "SaveAndUpdatePkgVerWorkflowStateForTemplate", action = "SaveAndUpdatePkgVerWorkflowStateForTemplate") public @WebResult(name = "SavePkgVersionWorkflowStateData") ServiceOperationResult saveAndUpdatePkgVerWorkflowStateForTemplate( @WebParam(name = "PkgVersionWorkflowStateData", targetNamespace = "http://www.tmg.com/coreservices/data") List<PkgVersionWorkflowStateData> workFlowStateData) throws ServiceFault; @WebMethod(operationName = "DeleteWorkFlowStateTemplate", action = "DeleteWorkFlowStateTemplate") public @WebResult(name = "DeleteWorkFlowState", targetNamespace = "http://www.tmg.com/coreservices/TemplateService") ServiceOperationResult deleteWorkFlowStateTemplate( @WebParam(name = "Ids") List<Integer> ids) throws ServiceFault; @WebMethod(operationName = "GetBenefitPackageType", action = "GetBenefitPackageType") public @WebResult(name = "BenefitPackageTypes", targetNamespace = "http://www.tmg.com/coreservices/TemplateService") List<String> getBenefitPackageType(@WebParam(name = "MasterListId") int id) throws ServiceFault; @WebMethod(operationName = "GetTemplateDetail", action = "GetTemplateDetail") public @WebResult(name = "TemplateDetailData", targetNamespace = "http://www.tmg.com/coreservices/TemplateService") PackageTemplateData getTemplateDetail(@WebParam(name = "TempId") int id) throws ServiceFault; @WebMethod(operationName = "GetTemplateWorkFlowStateById", action = "GetTemplateWorkFlowStateById") public @WebResult(name = "TemplateWorkflowStateData", targetNamespace = "http://www.tmg.com/coreservices/TemplateService") TemplateWorkflowState getTemplateWorkFlowStateById( @WebParam(name = "TemplateWorkflowStateId") int id) throws ServiceFault; @WebMethod(operationName = "GetAllTreeShapesForTemplateTree", action = "GetAllTreeShapesForTemplateTree") public @WebResult(name = "ShapeValueDefaultData", targetNamespace = "http://www.tmg.com/coreservices/TemplateService") List<ShapeValueDefaultData> getAllTreeShapesForTemplateTree(@WebParam(name = "TemplateTreeId") int id) throws ServiceFault; }
ba11b903adc7a69057f4397edc15a6127c23e236
49aef479b48ecaad839bbe293b75b07a9edda654
/FormatCLASS/src/main/java/org/freeinternals/format/classfile/JavaSEVersion.java
519e86e9c1320e7e191c5b1e79941a9821f772cf
[ "Apache-2.0" ]
permissive
george-latk/freeinternals
1b774f75dd38c85359327a46d8c23e9d39ff17b9
344ea3793b47dfbce7dbfe7ce3a33bd6e325e35a
refs/heads/master
2022-12-06T16:34:14.324430
2020-06-23T07:08:03
2020-06-23T07:08:03
272,042,231
0
0
Apache-2.0
2020-06-13T16:08:20
2020-06-13T16:08:19
null
UTF-8
Java
false
false
912
java
/* * JavaSEVersion.java June 4, 2019 * * Copyright 2019, FreeInternals.org. All rights reserved. * Use is subject to license terms. */ package org.freeinternals.format.classfile; /** * Java SE platform version. * * @see * <a href="https://docs.oracle.com/javase/specs/jvms/se12/html/jvms-4.html#jvms-4.1">The * ClassFile Structure</a> * @author Amos Shi */ public enum JavaSEVersion { Version_1_0_2("1.0.2", 1), Version_1_1("1.1", 1), Version_5_0("5.0", 5), Version_6("6", 6), Version_7("7", 7), Version_8("8", 8), Version_9("9", 9), Version_11("11", 11), Version_12("12", 12), Version_13("13", 13), Version_14("14", 14), Version_15("15", 15); public final String name; public final int majorVersion; private JavaSEVersion(String name, int majorVersion) { this.name = name; this.majorVersion = majorVersion; } }
23a2a265b287b8eada70c6f908efd3a127d77d90
39bc4ae73f9599844ee83b58c3217f38f3009a8e
/app/src/main/java/in/pureway/cinemaflix/activity/privacysettings/PhotofitBadgeActivity.java
e0b86828ff2d9b430f4a15073bcfb46eaa3b752c
[]
no_license
Sagarinfosif/NaturalBornFool
7c4e7f1b6cc630fd04aebad42a8f527a960c296f
460a7864ed6f1360cb98a7b0750cf88a9b189814
refs/heads/master
2023-04-29T07:03:37.660322
2021-04-17T06:54:37
2021-04-17T06:54:37
358,805,905
0
0
null
null
null
null
UTF-8
Java
false
false
1,179
java
package in.pureway.cinemaflix.activity.privacysettings; import androidx.appcompat.app.AppCompatActivity; import androidx.recyclerview.widget.RecyclerView; import android.app.Activity; import android.os.Bundle; import android.view.View; import in.pureway.cinemaflix.R; import in.pureway.cinemaflix.adapters.AdapterBadges; public class PhotofitBadgeActivity extends AppCompatActivity { private RecyclerView recycler_badge; private Activity activity; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_photofit_badge); activity = PhotofitBadgeActivity.this; findiDs(); setRecycler(); } private void setRecycler() { AdapterBadges adapterBadges = new AdapterBadges(activity, new AdapterBadges.Select() { @Override public void choose(int position) { } }); recycler_badge.setAdapter(adapterBadges); } private void findiDs() { recycler_badge = findViewById(R.id.recycler_badge); } public void backPress(View view) { onBackPressed(); } }
[ "omninos@12345" ]
omninos@12345
346560ac3c6abb471b1809bd7428781ff88b1952
ac9755d08b16d9a7ae3f7f97858889855068ad53
/lang/lucene/src/main/java/org/carrot2/language/extras/BrazilianLanguageComponents.java
85b5e25b595b5e809d12562fb78fe11abbcf495c
[ "LicenseRef-scancode-bsd-ack-carrot2", "BSD-3-Clause", "Apache-2.0" ]
permissive
rahulanishetty/carrot2
febaddececa6c18f435645ae74438e89561ab0ae
cb4adcc3b4ea030f4b64e2d0b881f43b51a90ae6
refs/heads/master
2022-02-19T03:18:34.730395
2022-01-10T08:32:00
2022-01-10T08:32:04
91,449,061
0
0
null
null
null
null
UTF-8
Java
false
false
1,665
java
/* * Carrot2 project. * * Copyright (C) 2002-2021, Dawid Weiss, Stanisław Osiński. * All rights reserved. * * Refer to the full license file "carrot2.LICENSE" * in the root folder of the repository checkout or at: * https://www.carrot2.org/carrot2.LICENSE */ package org.carrot2.language.extras; import java.util.Objects; import org.apache.lucene.analysis.br.BrazilianStemmer; import org.carrot2.language.ExtendedWhitespaceTokenizer; import org.carrot2.language.SingleLanguageComponentsProviderImpl; import org.carrot2.language.Stemmer; import org.carrot2.language.Tokenizer; import org.carrot2.text.preprocessing.LabelFormatter; import org.carrot2.text.preprocessing.LabelFormatterImpl; /** */ public class BrazilianLanguageComponents extends SingleLanguageComponentsProviderImpl { public static final String NAME = "Brazilian"; public BrazilianLanguageComponents() { super("Carrot2 (" + NAME + " support via Apache Lucene components)", NAME); registerResourceless(Tokenizer.class, ExtendedWhitespaceTokenizer::new); registerResourceless(LabelFormatter.class, () -> new LabelFormatterImpl(" ")); registerDefaultLexicalData(); registerResourceless( Stemmer.class, () -> new LuceneStemmerAdapter(new BrazilianStemmerAdapter()::stems, 5)); } private class BrazilianStemmerAdapter extends BrazilianStemmer { public int stems(char[] chars, int len) { String word = new String(chars, 0, len); String stem = super.stem(word); if (Objects.equals(word, stem)) { return len; } else { stem.getChars(0, stem.length(), chars, 0); return stem.length(); } } } }
018088ea2a27ab068a2540a0bc63607a7b15fca2
9343da7645ad606f9498f5698280b626ad1a63ac
/spoj-solutions/TEST/TEST.java
6f935f7d38446b3ac21f7a21e3cc79e48abd0530
[]
no_license
goldenrati0/oj
5a75bebba049c92fc320944b6d71a2f6a2427925
41be0004f2143bfbf0db3c66ab26b0f45e343059
refs/heads/master
2022-04-06T09:21:12.732290
2020-03-09T17:16:56
2020-03-09T17:16:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
331
java
//Status: RE import java.util.*; import java.lang.*; class TEST{ public static void main (String[] args) throws java.lang.Exception{ Scanner ana = new Scanner(System.in); int x = 0; while((x = ana.nextInt()) != 42){ System.out.println(x); } while(true){ ana.nextInt(); } } }
cecfd8db9a485151ab451fb1d27f6741b3b08e56
585bcecfc968816e5382175328bf53ea9460f49f
/dao/src/main/java/com/biz/train/enumaration/CommonStatusEnum.java
4f2e030391e9ff01642bf0414f3450577cb8ce9a
[]
no_license
qq505877100/train-app
5d05642188cd151d1c6558ee1f250743048b8a70
4e6bc520edf5b7be17ea08762cb8d5c4db4e2f43
refs/heads/master
2021-08-14T09:50:15.929503
2017-11-15T08:39:56
2017-11-15T08:39:56
110,807,045
0
0
null
null
null
null
UTF-8
Java
false
false
398
java
package com.biz.train.enumaration; /** * @author fuxianhui * @Description: * @Date: create in 13:58 2017/11/15 */ public enum CommonStatusEnum { ENABLE(1),DISABLE(0); private int value; CommonStatusEnum(int value) { this.value = value; } public int getValue() { return value; } public boolean isEnable() { return this.value == 1; } }
ef6ab20ed60a3557c1ee59522e06c4c2b604b99f
3ec2dd7eba10b0dfaaf5aa95252262cdaf3d7ef4
/java/src/zuzu/compiler/ir/convert/LongToIntNode.java
65bd2b2b284a95174906c39e2331421967495c2a
[]
no_license
hrskevin/zuzu
5faa2666dc0a23d652bcbae8014388597731e9f3
eebe6c4f276a56537b6ac088e290946a67f0413b
refs/heads/master
2016-09-02T16:12:08.679666
2013-04-18T04:00:32
2013-04-18T04:00:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
608
java
package zuzu.compiler.ir.convert; import zuzu.compiler.ir.InterpreterState; import zuzu.compiler.ir.constant.ConstantIntNode; import zuzu.compiler.ir.node.LongNode; import zuzu.compiler.ir.node.UnaryIntNode; public class LongToIntNode extends UnaryIntNode<LongNode> { public LongToIntNode(LongNode input) { super(input); } @Override public void interpret(InterpreterState state) { state.pushInt((int) state.popLong()); } @Override public ConstantIntNode replaceWithConstant() { return newConstant((int) _input.constantLongValue()); } }
b8f135077968364a7b24abd561f802144059bde9
f96404883b26724bcd32911ad04d185cb3dd009c
/hxmzs-common/src/main/java/com/lockbur/book/common/utils/StringUtils.java
c20648b09384a1033835a03efc977c1a73019c61
[]
no_license
hbs429469861/hxmzs
024635eff8a3ae768681c6c774ff4442c0e125b6
09b21eb4974d54e23a629266b056f1c74b67658c
refs/heads/master
2021-09-04T03:06:42.393958
2018-01-15T02:11:06
2018-01-15T02:11:06
112,173,592
0
0
null
null
null
null
UTF-8
Java
false
false
2,421
java
package com.lockbur.book.common.utils; import java.util.regex.Matcher; import java.util.regex.Pattern; public class StringUtils { public static boolean isBlank(String str){ return str == null || str.trim().length()<=0; } public static boolean isBlank(Object object){ boolean flag = false; if (null == object) { flag = true; } else { if(isBlank(String.valueOf(object))){ flag = true; } } return flag; } public static boolean isNotBlank(String str){ return str != null && str.trim().length()>0; } /** * 格式化字符串 */ public static String formatString(String text) { return (text == null ? "" : text.trim()); } /** * String2Integer */ public static int string2Int(String text) throws NumberFormatException { return text == null ? 0 : Integer.valueOf(text); } /** * 处理字符串:隐藏部分内容 * @param text 目标字符串 * @param leftShowCount 左边显示位数 * @param rightShowCount 右边显示位数 * @return */ public static String hideString(String text, int leftShowCount, int rightShowCount) { StringBuffer sb = new StringBuffer(); if(text != null && text.length() >= leftShowCount + rightShowCount ){ sb.append(text.substring(0, leftShowCount)); for (int i = 0; i < text.length() - leftShowCount - rightShowCount; i++) { sb.append("*"); } sb.append(text.substring(text.length() - rightShowCount)); } return sb.toString(); } /**处理姓名*/ public static String handleName(String text){ return StringUtils.hideString(text, 0, 1); } /**处理证件号*/ public static String handleIdCardNo(String text){ return StringUtils.hideString(text, 2, 2); } /**处理银行卡号*/ public static String handleBankCardNo(String text){ return StringUtils.hideString(text, 3, 3); } /**处理手机号*/ public static String handlePhoneNo(String text){ return StringUtils.hideString(text, 0, 2); } /** * @Description: 去空格 * @Param * @Return String * @Author:youhuiran * @Datetime 2016年12月4日 下午10:04:36 */ public static String replaceBlank(String str) { String dest = ""; if (str!=null) { Pattern p = Pattern.compile("\\s*|\t|\r|\n"); Matcher m = p.matcher(str); dest = m.replaceAll(""); } return dest; } }
bdf47fb64f1265384768afd4b3f5f6d0997b5d3e
7e1eee5e431a1a9f2236a39f40f943a0d089c331
/src/Persistencia/Controller/ColorProductoJpaController.java
488e5d9ac51a80f41e862e4aebaeae141fb5cb02
[]
no_license
sebasmonca/Philae
6b370d179b1279fcf096bbd5a7f0b704419b1a89
0bd8aa7ab6ec9c802cbf5ca2d802bf23a25fb22c
refs/heads/master
2021-01-10T04:09:50.333185
2015-10-28T14:29:27
2015-10-28T14:29:27
43,270,159
0
1
null
null
null
null
UTF-8
Java
false
false
10,168
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package Persistencia.Controller; import Persistencia.Controller.exceptions.IllegalOrphanException; import Persistencia.Controller.exceptions.NonexistentEntityException; import Persistencia.Entities.ColorProducto; import java.io.Serializable; import javax.persistence.Query; import javax.persistence.EntityNotFoundException; import javax.persistence.criteria.CriteriaQuery; import javax.persistence.criteria.Root; import Persistencia.Entities.OrdenProduccion; import java.util.ArrayList; import java.util.List; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; /** * * @author Sebas */ public class ColorProductoJpaController implements Serializable { public ColorProductoJpaController(EntityManagerFactory emf) { this.emf = emf; } private EntityManagerFactory emf = null; public EntityManager getEntityManager() { return emf.createEntityManager(); } public void create(ColorProducto colorProducto) { if (colorProducto.getOrdenProduccionList() == null) { colorProducto.setOrdenProduccionList(new ArrayList<OrdenProduccion>()); } EntityManager em = null; try { em = getEntityManager(); em.getTransaction().begin(); List<OrdenProduccion> attachedOrdenProduccionList = new ArrayList<OrdenProduccion>(); for (OrdenProduccion ordenProduccionListOrdenProduccionToAttach : colorProducto.getOrdenProduccionList()) { ordenProduccionListOrdenProduccionToAttach = em.getReference(ordenProduccionListOrdenProduccionToAttach.getClass(), ordenProduccionListOrdenProduccionToAttach.getIdOrdenProduccion()); attachedOrdenProduccionList.add(ordenProduccionListOrdenProduccionToAttach); } colorProducto.setOrdenProduccionList(attachedOrdenProduccionList); em.persist(colorProducto); for (OrdenProduccion ordenProduccionListOrdenProduccion : colorProducto.getOrdenProduccionList()) { ColorProducto oldIdColorProductoOfOrdenProduccionListOrdenProduccion = ordenProduccionListOrdenProduccion.getIdColorProducto(); ordenProduccionListOrdenProduccion.setIdColorProducto(colorProducto); ordenProduccionListOrdenProduccion = em.merge(ordenProduccionListOrdenProduccion); if (oldIdColorProductoOfOrdenProduccionListOrdenProduccion != null) { oldIdColorProductoOfOrdenProduccionListOrdenProduccion.getOrdenProduccionList().remove(ordenProduccionListOrdenProduccion); oldIdColorProductoOfOrdenProduccionListOrdenProduccion = em.merge(oldIdColorProductoOfOrdenProduccionListOrdenProduccion); } } em.getTransaction().commit(); } finally { if (em != null) { em.close(); } } } public void edit(ColorProducto colorProducto) throws IllegalOrphanException, NonexistentEntityException, Exception { EntityManager em = null; try { em = getEntityManager(); em.getTransaction().begin(); ColorProducto persistentColorProducto = em.find(ColorProducto.class, colorProducto.getIdColorProducto()); List<OrdenProduccion> ordenProduccionListOld = persistentColorProducto.getOrdenProduccionList(); List<OrdenProduccion> ordenProduccionListNew = colorProducto.getOrdenProduccionList(); List<String> illegalOrphanMessages = null; for (OrdenProduccion ordenProduccionListOldOrdenProduccion : ordenProduccionListOld) { if (!ordenProduccionListNew.contains(ordenProduccionListOldOrdenProduccion)) { if (illegalOrphanMessages == null) { illegalOrphanMessages = new ArrayList<String>(); } illegalOrphanMessages.add("You must retain OrdenProduccion " + ordenProduccionListOldOrdenProduccion + " since its idColorProducto field is not nullable."); } } if (illegalOrphanMessages != null) { throw new IllegalOrphanException(illegalOrphanMessages); } List<OrdenProduccion> attachedOrdenProduccionListNew = new ArrayList<OrdenProduccion>(); for (OrdenProduccion ordenProduccionListNewOrdenProduccionToAttach : ordenProduccionListNew) { ordenProduccionListNewOrdenProduccionToAttach = em.getReference(ordenProduccionListNewOrdenProduccionToAttach.getClass(), ordenProduccionListNewOrdenProduccionToAttach.getIdOrdenProduccion()); attachedOrdenProduccionListNew.add(ordenProduccionListNewOrdenProduccionToAttach); } ordenProduccionListNew = attachedOrdenProduccionListNew; colorProducto.setOrdenProduccionList(ordenProduccionListNew); colorProducto = em.merge(colorProducto); for (OrdenProduccion ordenProduccionListNewOrdenProduccion : ordenProduccionListNew) { if (!ordenProduccionListOld.contains(ordenProduccionListNewOrdenProduccion)) { ColorProducto oldIdColorProductoOfOrdenProduccionListNewOrdenProduccion = ordenProduccionListNewOrdenProduccion.getIdColorProducto(); ordenProduccionListNewOrdenProduccion.setIdColorProducto(colorProducto); ordenProduccionListNewOrdenProduccion = em.merge(ordenProduccionListNewOrdenProduccion); if (oldIdColorProductoOfOrdenProduccionListNewOrdenProduccion != null && !oldIdColorProductoOfOrdenProduccionListNewOrdenProduccion.equals(colorProducto)) { oldIdColorProductoOfOrdenProduccionListNewOrdenProduccion.getOrdenProduccionList().remove(ordenProduccionListNewOrdenProduccion); oldIdColorProductoOfOrdenProduccionListNewOrdenProduccion = em.merge(oldIdColorProductoOfOrdenProduccionListNewOrdenProduccion); } } } em.getTransaction().commit(); } catch (Exception ex) { String msg = ex.getLocalizedMessage(); if (msg == null || msg.length() == 0) { Integer id = colorProducto.getIdColorProducto(); if (findColorProducto(id) == null) { throw new NonexistentEntityException("The colorProducto with id " + id + " no longer exists."); } } throw ex; } finally { if (em != null) { em.close(); } } } public void destroy(Integer id) throws IllegalOrphanException, NonexistentEntityException { EntityManager em = null; try { em = getEntityManager(); em.getTransaction().begin(); ColorProducto colorProducto; try { colorProducto = em.getReference(ColorProducto.class, id); colorProducto.getIdColorProducto(); } catch (EntityNotFoundException enfe) { throw new NonexistentEntityException("The colorProducto with id " + id + " no longer exists.", enfe); } List<String> illegalOrphanMessages = null; List<OrdenProduccion> ordenProduccionListOrphanCheck = colorProducto.getOrdenProduccionList(); for (OrdenProduccion ordenProduccionListOrphanCheckOrdenProduccion : ordenProduccionListOrphanCheck) { if (illegalOrphanMessages == null) { illegalOrphanMessages = new ArrayList<String>(); } illegalOrphanMessages.add("This ColorProducto (" + colorProducto + ") cannot be destroyed since the OrdenProduccion " + ordenProduccionListOrphanCheckOrdenProduccion + " in its ordenProduccionList field has a non-nullable idColorProducto field."); } if (illegalOrphanMessages != null) { throw new IllegalOrphanException(illegalOrphanMessages); } em.remove(colorProducto); em.getTransaction().commit(); } finally { if (em != null) { em.close(); } } } public List<ColorProducto> findColorProductoEntities() { return findColorProductoEntities(true, -1, -1); } public List<ColorProducto> findColorProductoEntities(int maxResults, int firstResult) { return findColorProductoEntities(false, maxResults, firstResult); } private List<ColorProducto> findColorProductoEntities(boolean all, int maxResults, int firstResult) { EntityManager em = getEntityManager(); try { CriteriaQuery cq = em.getCriteriaBuilder().createQuery(); cq.select(cq.from(ColorProducto.class)); Query q = em.createQuery(cq); if (!all) { q.setMaxResults(maxResults); q.setFirstResult(firstResult); } return q.getResultList(); } finally { em.close(); } } public ColorProducto findColorProducto(Integer id) { EntityManager em = getEntityManager(); try { return em.find(ColorProducto.class, id); } finally { em.close(); } } public int getColorProductoCount() { EntityManager em = getEntityManager(); try { CriteriaQuery cq = em.getCriteriaBuilder().createQuery(); Root<ColorProducto> rt = cq.from(ColorProducto.class); cq.select(em.getCriteriaBuilder().count(rt)); Query q = em.createQuery(cq); return ((Long) q.getSingleResult()).intValue(); } finally { em.close(); } } }
[ "Sebas@Sebastian" ]
Sebas@Sebastian
1233d09d03b8cf033e25b9a7096623489d3eb0f3
5d5c0c358f764554edbc2cd57c46cfa353951acd
/cyf/src/main/java/com/cyf/model/UserExample.java
b2a42bf542491b82dcc86aa752ea6abc125546a2
[]
no_license
zhanghc521/chengyifang
c3e74a60176a6f8625801b04e448a748c3ad497b
be5f9466eb6c7b36d438ecbf6aedff0ab4367e52
refs/heads/master
2020-05-25T00:09:38.359799
2017-07-12T14:14:49
2017-07-12T14:14:49
84,892,554
0
0
null
null
null
null
UTF-8
Java
false
false
27,456
java
package com.cyf.model; import java.util.ArrayList; import java.util.Date; import java.util.List; public class UserExample { protected String orderByClause; protected boolean distinct; protected List<Criteria> oredCriteria; public UserExample() { oredCriteria = new ArrayList<Criteria>(); } public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; } public String getOrderByClause() { return orderByClause; } public void setDistinct(boolean distinct) { this.distinct = distinct; } public boolean isDistinct() { return distinct; } public List<Criteria> getOredCriteria() { return oredCriteria; } public void or(Criteria criteria) { oredCriteria.add(criteria); } public Criteria or() { Criteria criteria = createCriteriaInternal(); oredCriteria.add(criteria); return criteria; } public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); if (oredCriteria.size() == 0) { oredCriteria.add(criteria); } return criteria; } protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); return criteria; } public void clear() { oredCriteria.clear(); orderByClause = null; distinct = false; } protected abstract static class GeneratedCriteria { protected List<Criterion> criteria; protected GeneratedCriteria() { super(); criteria = new ArrayList<Criterion>(); } public boolean isValid() { return criteria.size() > 0; } public List<Criterion> getAllCriteria() { return criteria; } public List<Criterion> getCriteria() { return criteria; } protected void addCriterion(String condition) { if (condition == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion(condition)); } protected void addCriterion(String condition, Object value, String property) { if (value == null) { throw new RuntimeException("Value for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value)); } protected void addCriterion(String condition, Object value1, Object value2, String property) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value1, value2)); } public Criteria andIdIsNull() { addCriterion("id is null"); return (Criteria) this; } public Criteria andIdIsNotNull() { addCriterion("id is not null"); return (Criteria) this; } public Criteria andIdEqualTo(String value) { addCriterion("id =", value, "id"); return (Criteria) this; } public Criteria andIdNotEqualTo(String value) { addCriterion("id <>", value, "id"); return (Criteria) this; } public Criteria andIdGreaterThan(String value) { addCriterion("id >", value, "id"); return (Criteria) this; } public Criteria andIdGreaterThanOrEqualTo(String value) { addCriterion("id >=", value, "id"); return (Criteria) this; } public Criteria andIdLessThan(String value) { addCriterion("id <", value, "id"); return (Criteria) this; } public Criteria andIdLessThanOrEqualTo(String value) { addCriterion("id <=", value, "id"); return (Criteria) this; } public Criteria andIdLike(String value) { addCriterion("id like", value, "id"); return (Criteria) this; } public Criteria andIdNotLike(String value) { addCriterion("id not like", value, "id"); return (Criteria) this; } public Criteria andIdIn(List<String> values) { addCriterion("id in", values, "id"); return (Criteria) this; } public Criteria andIdNotIn(List<String> values) { addCriterion("id not in", values, "id"); return (Criteria) this; } public Criteria andIdBetween(String value1, String value2) { addCriterion("id between", value1, value2, "id"); return (Criteria) this; } public Criteria andIdNotBetween(String value1, String value2) { addCriterion("id not between", value1, value2, "id"); return (Criteria) this; } public Criteria andNameIsNull() { addCriterion("name is null"); return (Criteria) this; } public Criteria andNameIsNotNull() { addCriterion("name is not null"); return (Criteria) this; } public Criteria andNameEqualTo(String value) { addCriterion("name =", value, "name"); return (Criteria) this; } public Criteria andNameNotEqualTo(String value) { addCriterion("name <>", value, "name"); return (Criteria) this; } public Criteria andNameGreaterThan(String value) { addCriterion("name >", value, "name"); return (Criteria) this; } public Criteria andNameGreaterThanOrEqualTo(String value) { addCriterion("name >=", value, "name"); return (Criteria) this; } public Criteria andNameLessThan(String value) { addCriterion("name <", value, "name"); return (Criteria) this; } public Criteria andNameLessThanOrEqualTo(String value) { addCriterion("name <=", value, "name"); return (Criteria) this; } public Criteria andNameLike(String value) { addCriterion("name like", value, "name"); return (Criteria) this; } public Criteria andNameNotLike(String value) { addCriterion("name not like", value, "name"); return (Criteria) this; } public Criteria andNameIn(List<String> values) { addCriterion("name in", values, "name"); return (Criteria) this; } public Criteria andNameNotIn(List<String> values) { addCriterion("name not in", values, "name"); return (Criteria) this; } public Criteria andNameBetween(String value1, String value2) { addCriterion("name between", value1, value2, "name"); return (Criteria) this; } public Criteria andNameNotBetween(String value1, String value2) { addCriterion("name not between", value1, value2, "name"); return (Criteria) this; } public Criteria andPasswordIsNull() { addCriterion("password is null"); return (Criteria) this; } public Criteria andPasswordIsNotNull() { addCriterion("password is not null"); return (Criteria) this; } public Criteria andPasswordEqualTo(String value) { addCriterion("password =", value, "password"); return (Criteria) this; } public Criteria andPasswordNotEqualTo(String value) { addCriterion("password <>", value, "password"); return (Criteria) this; } public Criteria andPasswordGreaterThan(String value) { addCriterion("password >", value, "password"); return (Criteria) this; } public Criteria andPasswordGreaterThanOrEqualTo(String value) { addCriterion("password >=", value, "password"); return (Criteria) this; } public Criteria andPasswordLessThan(String value) { addCriterion("password <", value, "password"); return (Criteria) this; } public Criteria andPasswordLessThanOrEqualTo(String value) { addCriterion("password <=", value, "password"); return (Criteria) this; } public Criteria andPasswordLike(String value) { addCriterion("password like", value, "password"); return (Criteria) this; } public Criteria andPasswordNotLike(String value) { addCriterion("password not like", value, "password"); return (Criteria) this; } public Criteria andPasswordIn(List<String> values) { addCriterion("password in", values, "password"); return (Criteria) this; } public Criteria andPasswordNotIn(List<String> values) { addCriterion("password not in", values, "password"); return (Criteria) this; } public Criteria andPasswordBetween(String value1, String value2) { addCriterion("password between", value1, value2, "password"); return (Criteria) this; } public Criteria andPasswordNotBetween(String value1, String value2) { addCriterion("password not between", value1, value2, "password"); return (Criteria) this; } public Criteria andAvatarIsNull() { addCriterion("avatar is null"); return (Criteria) this; } public Criteria andAvatarIsNotNull() { addCriterion("avatar is not null"); return (Criteria) this; } public Criteria andAvatarEqualTo(String value) { addCriterion("avatar =", value, "avatar"); return (Criteria) this; } public Criteria andAvatarNotEqualTo(String value) { addCriterion("avatar <>", value, "avatar"); return (Criteria) this; } public Criteria andAvatarGreaterThan(String value) { addCriterion("avatar >", value, "avatar"); return (Criteria) this; } public Criteria andAvatarGreaterThanOrEqualTo(String value) { addCriterion("avatar >=", value, "avatar"); return (Criteria) this; } public Criteria andAvatarLessThan(String value) { addCriterion("avatar <", value, "avatar"); return (Criteria) this; } public Criteria andAvatarLessThanOrEqualTo(String value) { addCriterion("avatar <=", value, "avatar"); return (Criteria) this; } public Criteria andAvatarLike(String value) { addCriterion("avatar like", value, "avatar"); return (Criteria) this; } public Criteria andAvatarNotLike(String value) { addCriterion("avatar not like", value, "avatar"); return (Criteria) this; } public Criteria andAvatarIn(List<String> values) { addCriterion("avatar in", values, "avatar"); return (Criteria) this; } public Criteria andAvatarNotIn(List<String> values) { addCriterion("avatar not in", values, "avatar"); return (Criteria) this; } public Criteria andAvatarBetween(String value1, String value2) { addCriterion("avatar between", value1, value2, "avatar"); return (Criteria) this; } public Criteria andAvatarNotBetween(String value1, String value2) { addCriterion("avatar not between", value1, value2, "avatar"); return (Criteria) this; } public Criteria andStatusIsNull() { addCriterion("status is null"); return (Criteria) this; } public Criteria andStatusIsNotNull() { addCriterion("status is not null"); return (Criteria) this; } public Criteria andStatusEqualTo(String value) { addCriterion("status =", value, "status"); return (Criteria) this; } public Criteria andStatusNotEqualTo(String value) { addCriterion("status <>", value, "status"); return (Criteria) this; } public Criteria andStatusGreaterThan(String value) { addCriterion("status >", value, "status"); return (Criteria) this; } public Criteria andStatusGreaterThanOrEqualTo(String value) { addCriterion("status >=", value, "status"); return (Criteria) this; } public Criteria andStatusLessThan(String value) { addCriterion("status <", value, "status"); return (Criteria) this; } public Criteria andStatusLessThanOrEqualTo(String value) { addCriterion("status <=", value, "status"); return (Criteria) this; } public Criteria andStatusLike(String value) { addCriterion("status like", value, "status"); return (Criteria) this; } public Criteria andStatusNotLike(String value) { addCriterion("status not like", value, "status"); return (Criteria) this; } public Criteria andStatusIn(List<String> values) { addCriterion("status in", values, "status"); return (Criteria) this; } public Criteria andStatusNotIn(List<String> values) { addCriterion("status not in", values, "status"); return (Criteria) this; } public Criteria andStatusBetween(String value1, String value2) { addCriterion("status between", value1, value2, "status"); return (Criteria) this; } public Criteria andStatusNotBetween(String value1, String value2) { addCriterion("status not between", value1, value2, "status"); return (Criteria) this; } public Criteria andIsdeleteIsNull() { addCriterion("isDelete is null"); return (Criteria) this; } public Criteria andIsdeleteIsNotNull() { addCriterion("isDelete is not null"); return (Criteria) this; } public Criteria andIsdeleteEqualTo(Boolean value) { addCriterion("isDelete =", value, "isdelete"); return (Criteria) this; } public Criteria andIsdeleteNotEqualTo(Boolean value) { addCriterion("isDelete <>", value, "isdelete"); return (Criteria) this; } public Criteria andIsdeleteGreaterThan(Boolean value) { addCriterion("isDelete >", value, "isdelete"); return (Criteria) this; } public Criteria andIsdeleteGreaterThanOrEqualTo(Boolean value) { addCriterion("isDelete >=", value, "isdelete"); return (Criteria) this; } public Criteria andIsdeleteLessThan(Boolean value) { addCriterion("isDelete <", value, "isdelete"); return (Criteria) this; } public Criteria andIsdeleteLessThanOrEqualTo(Boolean value) { addCriterion("isDelete <=", value, "isdelete"); return (Criteria) this; } public Criteria andIsdeleteIn(List<Boolean> values) { addCriterion("isDelete in", values, "isdelete"); return (Criteria) this; } public Criteria andIsdeleteNotIn(List<Boolean> values) { addCriterion("isDelete not in", values, "isdelete"); return (Criteria) this; } public Criteria andIsdeleteBetween(Boolean value1, Boolean value2) { addCriterion("isDelete between", value1, value2, "isdelete"); return (Criteria) this; } public Criteria andIsdeleteNotBetween(Boolean value1, Boolean value2) { addCriterion("isDelete not between", value1, value2, "isdelete"); return (Criteria) this; } public Criteria andCreatetimeIsNull() { addCriterion("createtime is null"); return (Criteria) this; } public Criteria andCreatetimeIsNotNull() { addCriterion("createtime is not null"); return (Criteria) this; } public Criteria andCreatetimeEqualTo(Date value) { addCriterion("createtime =", value, "createtime"); return (Criteria) this; } public Criteria andCreatetimeNotEqualTo(Date value) { addCriterion("createtime <>", value, "createtime"); return (Criteria) this; } public Criteria andCreatetimeGreaterThan(Date value) { addCriterion("createtime >", value, "createtime"); return (Criteria) this; } public Criteria andCreatetimeGreaterThanOrEqualTo(Date value) { addCriterion("createtime >=", value, "createtime"); return (Criteria) this; } public Criteria andCreatetimeLessThan(Date value) { addCriterion("createtime <", value, "createtime"); return (Criteria) this; } public Criteria andCreatetimeLessThanOrEqualTo(Date value) { addCriterion("createtime <=", value, "createtime"); return (Criteria) this; } public Criteria andCreatetimeIn(List<Date> values) { addCriterion("createtime in", values, "createtime"); return (Criteria) this; } public Criteria andCreatetimeNotIn(List<Date> values) { addCriterion("createtime not in", values, "createtime"); return (Criteria) this; } public Criteria andCreatetimeBetween(Date value1, Date value2) { addCriterion("createtime between", value1, value2, "createtime"); return (Criteria) this; } public Criteria andCreatetimeNotBetween(Date value1, Date value2) { addCriterion("createtime not between", value1, value2, "createtime"); return (Criteria) this; } public Criteria andCreaterIsNull() { addCriterion("creater is null"); return (Criteria) this; } public Criteria andCreaterIsNotNull() { addCriterion("creater is not null"); return (Criteria) this; } public Criteria andCreaterEqualTo(String value) { addCriterion("creater =", value, "creater"); return (Criteria) this; } public Criteria andCreaterNotEqualTo(String value) { addCriterion("creater <>", value, "creater"); return (Criteria) this; } public Criteria andCreaterGreaterThan(String value) { addCriterion("creater >", value, "creater"); return (Criteria) this; } public Criteria andCreaterGreaterThanOrEqualTo(String value) { addCriterion("creater >=", value, "creater"); return (Criteria) this; } public Criteria andCreaterLessThan(String value) { addCriterion("creater <", value, "creater"); return (Criteria) this; } public Criteria andCreaterLessThanOrEqualTo(String value) { addCriterion("creater <=", value, "creater"); return (Criteria) this; } public Criteria andCreaterLike(String value) { addCriterion("creater like", value, "creater"); return (Criteria) this; } public Criteria andCreaterNotLike(String value) { addCriterion("creater not like", value, "creater"); return (Criteria) this; } public Criteria andCreaterIn(List<String> values) { addCriterion("creater in", values, "creater"); return (Criteria) this; } public Criteria andCreaterNotIn(List<String> values) { addCriterion("creater not in", values, "creater"); return (Criteria) this; } public Criteria andCreaterBetween(String value1, String value2) { addCriterion("creater between", value1, value2, "creater"); return (Criteria) this; } public Criteria andCreaterNotBetween(String value1, String value2) { addCriterion("creater not between", value1, value2, "creater"); return (Criteria) this; } public Criteria andEditetimeIsNull() { addCriterion("editetime is null"); return (Criteria) this; } public Criteria andEditetimeIsNotNull() { addCriterion("editetime is not null"); return (Criteria) this; } public Criteria andEditetimeEqualTo(Date value) { addCriterion("editetime =", value, "editetime"); return (Criteria) this; } public Criteria andEditetimeNotEqualTo(Date value) { addCriterion("editetime <>", value, "editetime"); return (Criteria) this; } public Criteria andEditetimeGreaterThan(Date value) { addCriterion("editetime >", value, "editetime"); return (Criteria) this; } public Criteria andEditetimeGreaterThanOrEqualTo(Date value) { addCriterion("editetime >=", value, "editetime"); return (Criteria) this; } public Criteria andEditetimeLessThan(Date value) { addCriterion("editetime <", value, "editetime"); return (Criteria) this; } public Criteria andEditetimeLessThanOrEqualTo(Date value) { addCriterion("editetime <=", value, "editetime"); return (Criteria) this; } public Criteria andEditetimeIn(List<Date> values) { addCriterion("editetime in", values, "editetime"); return (Criteria) this; } public Criteria andEditetimeNotIn(List<Date> values) { addCriterion("editetime not in", values, "editetime"); return (Criteria) this; } public Criteria andEditetimeBetween(Date value1, Date value2) { addCriterion("editetime between", value1, value2, "editetime"); return (Criteria) this; } public Criteria andEditetimeNotBetween(Date value1, Date value2) { addCriterion("editetime not between", value1, value2, "editetime"); return (Criteria) this; } public Criteria andOperatorIsNull() { addCriterion("operator is null"); return (Criteria) this; } public Criteria andOperatorIsNotNull() { addCriterion("operator is not null"); return (Criteria) this; } public Criteria andOperatorEqualTo(String value) { addCriterion("operator =", value, "operator"); return (Criteria) this; } public Criteria andOperatorNotEqualTo(String value) { addCriterion("operator <>", value, "operator"); return (Criteria) this; } public Criteria andOperatorGreaterThan(String value) { addCriterion("operator >", value, "operator"); return (Criteria) this; } public Criteria andOperatorGreaterThanOrEqualTo(String value) { addCriterion("operator >=", value, "operator"); return (Criteria) this; } public Criteria andOperatorLessThan(String value) { addCriterion("operator <", value, "operator"); return (Criteria) this; } public Criteria andOperatorLessThanOrEqualTo(String value) { addCriterion("operator <=", value, "operator"); return (Criteria) this; } public Criteria andOperatorLike(String value) { addCriterion("operator like", value, "operator"); return (Criteria) this; } public Criteria andOperatorNotLike(String value) { addCriterion("operator not like", value, "operator"); return (Criteria) this; } public Criteria andOperatorIn(List<String> values) { addCriterion("operator in", values, "operator"); return (Criteria) this; } public Criteria andOperatorNotIn(List<String> values) { addCriterion("operator not in", values, "operator"); return (Criteria) this; } public Criteria andOperatorBetween(String value1, String value2) { addCriterion("operator between", value1, value2, "operator"); return (Criteria) this; } public Criteria andOperatorNotBetween(String value1, String value2) { addCriterion("operator not between", value1, value2, "operator"); return (Criteria) this; } } public static class Criteria extends GeneratedCriteria { protected Criteria() { super(); } } public static class Criterion { private String condition; private Object value; private Object secondValue; private boolean noValue; private boolean singleValue; private boolean betweenValue; private boolean listValue; private String typeHandler; public String getCondition() { return condition; } public Object getValue() { return value; } public Object getSecondValue() { return secondValue; } public boolean isNoValue() { return noValue; } public boolean isSingleValue() { return singleValue; } public boolean isBetweenValue() { return betweenValue; } public boolean isListValue() { return listValue; } public String getTypeHandler() { return typeHandler; } protected Criterion(String condition) { super(); this.condition = condition; this.typeHandler = null; this.noValue = true; } protected Criterion(String condition, Object value, String typeHandler) { super(); this.condition = condition; this.value = value; this.typeHandler = typeHandler; if (value instanceof List<?>) { this.listValue = true; } else { this.singleValue = true; } } protected Criterion(String condition, Object value) { this(condition, value, null); } protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { super(); this.condition = condition; this.value = value; this.secondValue = secondValue; this.typeHandler = typeHandler; this.betweenValue = true; } protected Criterion(String condition, Object value, Object secondValue) { this(condition, value, secondValue, null); } } }
577c73b6225aed5cada5b24aeb51270a2671fbce
d36e5733c987cfb17447e29f4153be49bc4868f6
/src/org/usajusaj/jtex/items/TeXItemEnum.java
cf472c3f59b5db9a8a2f668d0e2a576133bd5eb6
[]
no_license
Abnegazar/jtex
ec4e8566cc6d677175e8b986bc2aab82a8dbea3e
8ce4e726b324d796049030adff96831b08c35244
refs/heads/master
2022-02-06T12:59:45.120864
2018-06-04T01:29:43
2018-06-04T01:29:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
796
java
/* * This file is created by jTeX library. * * jTeX is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * jTeX is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with jTeX. If not, see <http://www.gnu.org/licenses/>. */ package org.usajusaj.jtex.items; /** * @author Matej Usaj */ public enum TeXItemEnum { CREATED, CLOSED, ADDED }
cd540ce5e0fac1d7c9c20804c134477a500b6c13
3dbbfac39ac33d3fabec60b290118b361736f897
/BOJ/9000/9011.java
c13845c4a16c9914ba26ab5bad04177ec3783cc7
[]
no_license
joshua-qa/PS
7e0a61f764f7746e6b3c693c103da06b845552b7
c49c0b377f85c483b6d274806afb0cbc534500b7
refs/heads/master
2023-05-28T15:01:28.709522
2023-05-21T04:46:29
2023-05-21T04:46:29
77,836,098
7
2
null
null
null
null
UTF-8
Java
false
false
2,599
java
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); PrintWriter out = new PrintWriter(outputStream); Task task = new Task(); task.run(in, out); out.close(); } static class Task { int n, count; StringBuilder sb = new StringBuilder(); Stack<Integer> currList = new Stack<>(); ArrayList<Integer> numList = new ArrayList<>(); public void run(InputReader in, PrintWriter out) { n = in.nextInt(); while(n-- > 0) { count = in.nextInt(); int[] rank = new int[count]; for(int i = 1; i <= count; i++) { rank[i-1] = in.nextInt(); numList.add(i); } for(int i = count-1; i >= 0; i--) { if(numList.size() > rank[i]) { currList.push(numList.remove(rank[i])); } else { break; } } if(!numList.isEmpty()) { numList.clear(); currList.clear(); sb.append("IMPOSSIBLE\n"); } else { while(!currList.isEmpty()) { sb.append(currList.pop() + " "); } sb.append("\n"); } } out.print(sb); } } static class InputReader { public BufferedReader reader; public StringTokenizer tokenizer; public InputReader(InputStream stream) { reader = new BufferedReader(new InputStreamReader(stream), 32768); tokenizer = null; } public String nextLine() { try { return reader.readLine(); } catch (IOException e) { throw new RuntimeException(e); } } public String next() { while (tokenizer == null || !tokenizer.hasMoreTokens()) { try { tokenizer = new StringTokenizer(reader.readLine()); } catch (IOException e) { throw new RuntimeException(e); } } return tokenizer.nextToken(); } public int nextInt() { return Integer.parseInt(next()); } } }
d7802ec846adb5e598ddf42a79b9f5d955a30981
9d9d0b0b3d171dc764b9b7ebb31759c0a133adcc
/src/main/java/com/swvalerian/basepatterns/structural/facade/SongSingFacade.java
cfc6c35972726e801aced0bbcc38ee56e8253262
[]
no_license
swvalerian/pattern
71aec4bc7c29bec23713bc3026cc3c5a0dafc2bb
10aeb551e9d3acae73e2c488243e0d3ab60d2221
refs/heads/main
2023-04-08T09:12:14.653538
2021-04-13T18:23:15
2021-04-13T18:23:15
356,013,810
0
0
null
null
null
null
UTF-8
Java
false
false
344
java
package main.java.com.swvalerian.basepatterns.structural.facade; public class SongSingFacade { Singer singer = new Singer(); Song song = new Song(); BugFanera bugFanera = new BugFanera(); public void singASong() { bugFanera.singSong(); singer.singSongBeforeHoarse(bugFanera); song.singSong(); } }
85169623a5d0c04baf0f7d6ec36251fa0cb0c0fe
46720f0a11c8c51af0aa9c489f28d976f7d23e73
/src/server/vm2/PiBeaconSoilSensor.java
ed669e48fad38ff1fd3d4cad956d15fd30981876
[]
no_license
DuncanCragg/NetMash
ccc074e0fb8ac5948d392913d08d78334803f3af
796afe69b3a93e428666874625e800222fa5ef99
refs/heads/master
2021-01-17T04:39:48.987740
2018-11-27T13:15:49
2018-11-27T13:15:49
1,354,571
10
3
null
null
null
null
UTF-8
Java
false
false
1,718
java
import java.util.*; import java.io.*; import java.net.*; import java.util.regex.*; import java.nio.file.*; import java.nio.charset.*; import cyrus.platform.*; import cyrus.forest.*; import static cyrus.lib.Utils.*; /** Class to fetch the soil moisture level detected by a sensor on a Raspberry Pi and broadcast its URL through a BLE beacon. */ public class PiBeaconSoilSensor extends CyrusLanguage { public PiBeaconSoilSensor(){ super("{ is: editable 3d notice soil moisture sensor\n"+ " title: \"Soil Moisture Sensor\"\n"+ " text: Waiting..\n"+ " rotation: 0 45 0\n"+ " scale: 1 1 1\n"+ " position: 0 0 0\n"+ " soil-moisture: 25\n"+ " within: http://localhost:8081/o/uid-41b6-5f8f-f143-b30d.json\n"+ "}\n", true); } private boolean running=false; public void evaluate(){ if(!running){ running=true; BLE.doAdvert(uid); new Thread(){ public void run(){ doit(); }}.start(); } super.evaluate(); notifying(content("within")); } void doit(){ try{ while(true){ Kernel.sleep(3000); String ms=new String(Files.readAllBytes(Paths.get("/run/moisture.txt"))); Number n=findANumberIn(ms); if(n==null) continue; final int moisture=n.intValue(); logXX(moisture); new Evaluator(this){ public void evaluate(){ contentInt("soil-moisture", moisture); content("text", String.format("Soil Moisture: %d%%", moisture)); }}; } }catch(Throwable t){ t.printStackTrace(); } } }
06a8209f26e2ce67bc59d84e8dd551e761cd652e
dfe052a4de503af20e10232f062df7d9a058f262
/app/src/main/java/loise/kbc/ui/activity/InstagramFeed.java
9137ef7869718d2629f8c3a474d4a43b26eacc7c
[]
no_license
Homeboyzandroid/KBC_APP
b1179cbecaeb69f60a492a39604e3a00f832b001
d375c1c6218c9662af179b2499b55409d6ab5dda
refs/heads/master
2021-01-10T17:52:29.751889
2016-02-16T06:58:22
2016-02-16T06:58:22
43,285,994
0
0
null
null
null
null
UTF-8
Java
false
false
921
java
package loise.kbc.ui.activity; import android.content.ActivityNotFoundException; import android.content.Intent; import android.net.Uri; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import loise.kbc.navigationviewpagerliveo.R; public class InstagramFeed extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_instagram_feed); Uri uri = Uri.parse("http://instagram.com/_u/kbckenya"); Intent Instagram = new Intent(Intent.ACTION_VIEW, uri); Instagram.setPackage("com.instagram.android"); try { startActivity(Instagram); } catch (ActivityNotFoundException e) { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.instagram.com/kbckenya"))); } } }
de740283a5d54a926e31f817e60a242822f2386b
9679a5cda74dc6106ee9b3e194f69060655cff9f
/src/main/java/cz/muni/fi/pv168/project/autocamp/ReservationManager.java
9503f1bf9c485ba1661edd28c2205e2a1fd8c5ad
[]
no_license
lenka783/PV168
4d4580452d16f35ba6fd39c1ecce5ee14a6d4f58
8382ee95d856d4ae373c2283f0c9634ca4366869
refs/heads/master
2021-06-03T17:47:20.052582
2016-05-25T19:51:46
2016-05-25T19:51:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,870
java
package cz.muni.fi.pv168.project.autocamp; import cz.muni.fi.pv168.project.autocamp.Parcel; import cz.muni.fi.pv168.project.autocamp.Guest; import java.util.List; /** * Interface for reservations, e.g. find reservation * @author Adam Gdovin, 433305 * @author Lenka Smitalova, 410198 * @version Mar 11, 2016 */ public interface ReservationManager { /** * creates new reservation * @param reservation */ void createReservation (Reservation reservation); /** * updates the reservation * @param reservation */ void updateReservation (Reservation reservation); /** * deletes the reservation * @param reservation */ void deleteReservation (Reservation reservation); /** * find specific reservation by its ID * @param id of the reservation * @return reservation with given ID */ Reservation findReservationByID(Long id); /** * find all reservations with given parcel * @param parcel of the reservation * @return list of all reservations with given parcel */ List<Reservation> findReservationsByParcel(Parcel parcel); /** * find all reservations with given guest * @param guest of the reservation * @return list of all reservations with given parcel */ List<Reservation> findReservationsByGuest(Guest guest); /** * finds all reservations * @return list of all reservations */ List<Reservation> findAllReservations(); /** * Find all reservations with given filter parameter in their * ID or location. * * @param filter wanted value * @return list of reservations whose attributes contain given filter, * in case of id values must be the same */ List<Reservation> filterReservations(String filter); }
d189633c35f54cdc12ee0d533640b583128bbac5
951afc432822583987ee1bd2374db4949aeea4c1
/src/edu/northeastern/oaset/demoXXIsThisATree.java
e69237c6c4fda1d651964fd7d7644c90b30a4049
[]
no_license
Joe-Ngan/LeetCode
78dff67a6fe04220698891f6b56329b068fd7c82
fae2bed8edd19ee9212eb7111f40cb2eb986258b
refs/heads/master
2023-08-26T13:36:32.040551
2021-11-06T05:45:00
2021-11-06T05:45:00
411,762,720
0
0
null
null
null
null
UTF-8
Java
false
false
3,163
java
package edu.northeastern.oaset; import java.util.HashSet; public class demoXXIsThisATree { public static void main(String[] args) { String s = "(A,B) (A,C) (B,D) (D,C)"; System.out.println(GetSExpression(s)); } public static String GetSExpression(String s){ boolean graph[][] = new boolean[26][26]; HashSet<Character> nodes = new HashSet<>(); //construct graph and check error E2: duplicate edges boolean E2 = false; for(int i=1;i<s.length();i+=6){ int x = s.charAt(i)-'A', y = s.charAt(i+2)-'A'; if(graph[x][y]) //duplicate edge E2 = true; graph[x][y] = true; nodes.add(s.charAt(i)); nodes.add(s.charAt(i+2)); } //check error E1: more than 2 children boolean E1 = false; for(int i=0;i<26;i++){ int count = 0; //number of child for(int j=0;j<26;j++){ if(graph[i][j]) count++; } if(count>2) return "E1"; } if(E2) return "E2"; //return E2 after checking E1 //check E3: cycle present and E4: multiple roots int numOfRoots = 0; char root =' '; for(char node : nodes){ //only check char that in the tree for(int i=0;i<26;i++){ if(graph[i][node-'A']) break; if(i==25){ numOfRoots++; root = node; boolean[] visited = new boolean[26]; if(IsCycle(node, graph, visited)) return "E3"; } } } if(numOfRoots==0) return "E3"; //if no root, must be a cycle if(numOfRoots>1) return "E4"; //if more than one roots if(root==' ') return "E5"; //if no edge in input string, invalid input error return GetExpressionHelper(root, graph); } //true means there is a cycle, false means no cycle private static boolean IsCycle(char node, boolean[][] graph, boolean[] visited){ if(visited[node-'A']) //node has already been visited, must has a cycle return true; visited[node-'A'] = true; for(int i=0;i<26;i++){ if(graph[node-'A'][i]){ if(IsCycle((char)(i+'A'), graph, visited)) return true; } } return false; } //Recursive DFS to get the expression/construct the tree private static String GetExpressionHelper(char root, boolean[][] graph){ String left = "", right = ""; //if no children, left and right should be empty for(int i=0;i<26;i++){ if(graph[root-'A'][i]){ left = GetExpressionHelper((char)(i+'A'), graph); for(int j=i+1;j<26;j++){ if(graph[root-'A'][j]){ right = GetExpressionHelper((char)(j+'A') ,graph); break; } } break; } } return "("+root+left+right+")"; } }
d5ccbe50bf353ce33199eba1b4c183af089bb8e5
02bb889c36c2a91e055bab635893e9b7030797b5
/FragmentsLabTestTablet/src/course/labs/fragmentslab/test/TabletTest.java
7cf925764b2b5591f2beb5c6934736ab88791114
[]
no_license
thiagotigaz/solutions_android_tests
3ad14dcd9adbe44fbceee681c0290d3a174b2a86
dccfcdda69f2f56ef3ecc75ef14c51a6bf396cc1
refs/heads/master
2016-09-09T17:45:46.845151
2014-08-27T00:29:06
2014-08-27T00:29:06
23,371,480
2
0
null
null
null
null
UTF-8
Java
false
false
3,489
java
package course.labs.fragmentslab.test; import course.labs.fragmentslab.MainActivity; import com.robotium.solo.*; import android.test.ActivityInstrumentationTestCase2; public class TabletTest extends ActivityInstrumentationTestCase2<MainActivity> { private Solo solo; public TabletTest() { super(MainActivity.class); } public void setUp() throws Exception { solo = new Solo(getInstrumentation()); getActivity(); } @Override public void tearDown() throws Exception { solo.finishOpenedActivities(); } public void testRun() { int timeout = 8; // Wait for activity: 'course.labs.fragmentslab.MainActivity' solo.waitForActivity(course.labs.fragmentslab.MainActivity.class, 2000); // Wait for view: 'android.R.id.text1' assertTrue("text1 not found", solo.waitForView(android.R.id.text1)); // Assert that: feed_view is shown assertTrue("'feed_view' was not found!", solo.waitForView(solo .getView(course.labs.fragmentslab.R.id.feed_view))); // Wait for onActivityCreated()Log Message: assertTrue("onActivityCreated() Log Message not found", solo.waitForLogMessage("Entered onActivityCreated()", timeout)); // Click on ladygaga solo.clickOnView(solo.getView(android.R.id.text1)); // Assert that: feed_view is shown assertTrue("'Select a feed to view!' is not shown!", solo.waitForView(solo .getView(course.labs.fragmentslab.R.id.feed_view))); // Assert that: 'the audience cheering!' is shown assertTrue("'the audience cheering!' is not shown!", solo.searchText("the audience cheering!")); // Wait for onItemSelected(0) Log Message: assertTrue("onItemSelected(0) Log Message not found", solo.waitForLogMessage("Entered onItemSelected(0)", timeout)); // Wait for updateFeedDisplay() Log Message: assertTrue("updateFeedDisplay() Log Message not found", solo.waitForLogMessage("Entered updateFeedDisplay()", timeout)); // Clear log solo.clearLog(); // Click on msrebeccablack solo.clickOnView(solo.getView(android.R.id.text1, 1)); // Assert that: feed_view is shown assertTrue("'Select a feed to view!' is not shown!", solo.waitForView(solo .getView(course.labs.fragmentslab.R.id.feed_view))); // Assert that: 'save me from school' is shown assertTrue("'save me from school' is not shown!", solo.searchText("save me from school")); // Wait for onItemSelected(1) Log Message: assertTrue("onItemSelected(1) Log Message not found", solo.waitForLogMessage("Entered onItemSelected(1)", timeout)); // Wait for updateFeedDisplay() Log Message: assertTrue("updateFeedDisplay() Log Message not found", solo.waitForLogMessage("Entered updateFeedDisplay()", timeout)); // Clear log solo.clearLog(); // Click on taylorswift13 solo.clickOnView(solo.getView(android.R.id.text1, 2)); // Assert that: feed_view is shown assertTrue("'Select a feed to view!' is not shown!", solo.waitForView(solo .getView(course.labs.fragmentslab.R.id.feed_view))); // Assert that: 'I love you guys so much' is shown assertTrue("'I love you guys so much' is not shown!", solo.searchText("I love you guys so much")); // Wait for onItemSelected(2) Log Message: assertTrue("onItemSelected(2) Log Message not found", solo.waitForLogMessage("Entered onItemSelected(2)")); // Wait for updateFeedDisplay() Log Message: assertTrue("updateFeedDisplay() Log Message not found", solo.waitForLogMessage("Entered updateFeedDisplay()")); } }
5e8259b50b6d00ce9c4e157162c5034104c2a9ea
2cce6e839569e2786203ef71d648702f6e89625b
/src/main/java/com/wang/service/role/RoleServiceImpl.java
e4466acee002315056c9bca4f30afe479125c732
[]
no_license
ShikaiWang-Sky/smbms
9dfd88ed8b1fe289118d0c89077f6e9f0dd6f22b
048f9914b514500534a8da890f73d86f1ef7ed0b
refs/heads/master
2022-12-09T10:33:37.376563
2020-08-25T08:07:55
2020-08-25T08:07:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
871
java
package com.wang.service.role; import com.wang.dao.BaseDao; import com.wang.dao.role.RoleDao; import com.wang.dao.role.RoleDaoImpl; import com.wang.pojo.Role; import java.sql.Connection; import java.sql.SQLException; import java.util.List; public class RoleServiceImpl implements RoleService{ //引入Dao private RoleDao roleDao; public RoleServiceImpl() { roleDao = new RoleDaoImpl(); } @Override public List<Role> getRoleList() { Connection connection = null; List<Role> roleList = null; try { connection = BaseDao.getConnection(); roleList = roleDao.getRoleList(connection); } catch (SQLException throwables) { throwables.printStackTrace(); } finally { BaseDao.closeResource(connection, null, null); } return roleList; } }
e185dcc4eebaa4e7afe939041f76be4d30746b2d
bf6fa881f8fcbcfc20de370286fdeb30c228300a
/youtube/coding-in-flow/DodgeInsetEdgesExample/app/src/test/java/com/example/dodgeinsetedgesexample/ExampleUnitTest.java
a750e67de025744a1cbf218be01171fdec67e965
[]
no_license
danglvh-jp/android-developer-training
4b2fd5bceec97a1bb8c07e4e5e6a5b1b34dc2695
abda450081ad42ae736cc828f394f1fd6b4a8411
refs/heads/main
2023-05-28T08:14:39.688423
2021-06-10T13:15:54
2021-06-10T13:15:54
null
0
0
null
null
null
null
UTF-8
Java
false
false
395
java
package com.example.dodgeinsetedgesexample; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
f7aa4601bed0f6a8c0816d569fb2de443fc05629
ed12e2425c51268700070d1a88c4f6be201167ee
/UserFront/src/main/java/com/userfront/domain/PrimaryAccount.java
533f5f8ddcb184f11ab422cec2182882c216ce70
[]
no_license
ganan2/STS_AWS
01cbe0bdd2d5900936d7ed9c8622c58c56ab2b61
0be972ced112bbead341d7e0c837f44f40edbc38
refs/heads/master
2021-01-01T17:46:02.850214
2017-08-03T09:57:27
2017-08-03T09:57:27
98,153,158
0
0
null
null
null
null
UTF-8
Java
false
false
2,230
java
/** * Created by Girish Ananda */ package com.userfront.domain; import java.math.BigDecimal; import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.OneToMany; import com.fasterxml.jackson.annotation.JsonIgnore; @Entity public class PrimaryAccount { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; private int accountNumber; private BigDecimal accountBalance; @OneToMany(mappedBy = "primaryAccount", cascade = CascadeType.ALL, fetch = FetchType.LAZY) @JsonIgnore private List<PrimaryTransaction> primaryTransactionList; /** mappedBy = "primaryAccount" means that the class: PrimaryAccount has a field in the same field name: primaryAccount, which will be used for mapping */ /** fetch = FetchType.LAZY means that when an object of the class is created, the values from the list need not be retrieved unless required */ /** cascade = CascadeType.ALL means that actions on the list will be propagated to the class: PrimaryAccount */ /** @JsonIgnore => List, during serialization references to the class: PrimaryAccount which will reference back to the List which forms an infinite loop. To avoid this loop and stop at returning the class as Json Object, the loop is broken. i.e., the List declaration is skipped after it is processed once. */ public Long getId() { return id; } public void setId(Long id) { this.id = id; } public int getAccountNumber() { return accountNumber; } public void setAccountNumber(int accountNumber) { this.accountNumber = accountNumber; } public BigDecimal getAccountBalance() { return accountBalance; } public void setAccountBalance(BigDecimal accountBalance) { this.accountBalance = accountBalance; } public List<PrimaryTransaction> getPrimaryTransactionList() { return primaryTransactionList; } public void setPrimaryTransactionList(List<PrimaryTransaction> primaryTransactionList) { this.primaryTransactionList = primaryTransactionList; } }
7fc53fbe8eab8de6135a66d2dc01e0e7fc919d1a
f1ddd865291a3681839c79c68684f4740b7bc9b1
/Day5/Assertion/src/com/hcl/as/AssertDemo.java
a3293a9a78ef0f52aae0090c3c567727b30ed834
[]
no_license
anisha-r/Mode1-Training
a0aaba2b251a27373e5fb17cbba99d9170389adf
19fb5c1dec8803884a1caffedbcc2981d1b52e68
refs/heads/master
2022-12-22T13:56:39.834627
2019-10-22T06:22:55
2019-10-22T06:22:55
212,010,084
0
0
null
2022-12-15T23:30:22
2019-10-01T04:08:21
JavaScript
UTF-8
Java
false
false
363
java
package com.hcl.as; public class AssertDemo { /** * method for business logic. */ public void incr() { int basic = 30000; for (int i = 0; i < 8; i++) { basic = basic + 4000; assert basic < 48000; System.out.println("salary" + basic); } } public static void main(String[] args) { new AssertDemo().incr(); } }
f53795a6a6c02477d6df04639b137abfa88b70f4
f68d2799aab3aab4c08c471b961ad93c04eed573
/src/main/java/ya/eventdetector/Main.java
ceaf1a2406718db9f07977b99e7a0dbdc69c678e
[]
no_license
IgorRyabtsev/EventDetector
b52bafaea5e463335ea8c4495c65efb77641960b
1e3ecc5e35cef3c419c193a4a79d86e513c9eb82
refs/heads/master
2021-07-09T00:37:04.847181
2017-10-07T22:03:55
2017-10-07T22:03:55
106,060,145
0
0
null
null
null
null
UTF-8
Java
false
false
1,003
java
package ya.eventdetector; import ya.eventdetector.dbversion.EventCounterImpl; import ya.eventdetector.treeversion.EventCounterImplTree; public class Main { public static void main(String[] args) { EventCounterImplTree eventCounterImplTree = new EventCounterImplTree(); for (int i = 0; i < 200000; i++) { eventCounterImplTree.addEvent(); } System.out.println(eventCounterImplTree.getCountOfEventsPerMinute()); System.out.println(eventCounterImplTree.getCountOfEventsPerHour()); System.out.println(eventCounterImplTree.getCountOfEventsPerDay()); EventCounterImpl eventCounterImpl = new EventCounterImpl(); for (int i = 0; i < 200000; i++) { eventCounterImpl.addEvent(); } System.out.println(eventCounterImpl.getCountOfEventsPerMinute()); System.out.println(eventCounterImpl.getCountOfEventsPerHour()); System.out.println(eventCounterImpl.getCountOfEventsPerDay()); } }
5876529059c2980ccacc6e83e0dfc7289797fe5b
0ef6dde4a34a6f80edb58b6b0bf5cff003d1dcac
/app/src/main/java/com/example/pc/myapplication/MyArrayAdapter.java
38ddb3e0ec650c817d435d13d75b4a6fbe6bf452
[]
no_license
levubao/BaoLe
567316db71f99f21004e76743817e7c508286f71
b5f3831c519904f3a889c11bc3a76c4e5a08ad33
refs/heads/master
2020-03-28T20:51:53.547408
2018-09-17T10:53:40
2018-09-17T10:53:40
149,109,478
0
0
null
null
null
null
UTF-8
Java
false
false
1,993
java
package com.example.pc.myapplication; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.TextView; import java.util.List; public class MyArrayAdapter extends BaseAdapter { Context myConText; int myLayout; List<CauThu> mylstCT; public MyArrayAdapter(Context contex, int layout, List<CauThu> lstCT) { myConText=contex; myLayout= layout; mylstCT= lstCT; } @Override public int getCount() { return mylstCT.size(); } @Override public Object getItem(int i) { return null; } @Override public long getItemId(int i) { return 0; } @Override public View getView(int i, View view, ViewGroup viewGroup) { ViewHolder holder; if(view==null) { LayoutInflater inflater = (LayoutInflater) myConText.getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = inflater.inflate(myLayout, null); holder= new ViewHolder(); //Ánh xạ holder.name = (TextView) view.findViewById(R.id.tvName); holder.year = (TextView) view.findViewById(R.id.tvYear); holder.hinh = (ImageView) view.findViewById(R.id.img_Hinh); holder.hinhmot = (ImageView) view.findViewById(R.id.img_Hinh1); view.setTag(holder); } else holder= (ViewHolder) view.getTag(); //Gán giá trị từ List SV holder.name.setText(mylstCT.get(i).getName()); holder.year.setText(mylstCT.get(i).getYear()); holder.hinh.setImageResource(mylstCT.get(i).getHinh()); holder.hinhmot.setImageResource(mylstCT.get(i).getHinhmot()); return view; } private class ViewHolder { private TextView name, year; private ImageView hinh,hinhmot; } }
ba5256c0601a1f40bf870d74fbb3dc55b34771d9
9e637f63604794424ecc15c871f79bb2d3ae961a
/app/src/main/java/com/example/administrator/learning/common/view/CompletedView.java
cc49a15823a22f9bd19e3df41a8377cea2646c5a
[]
no_license
carsher/StudyPlatform
fcb44569358ae90f612d8792285b8a6de9d0bc5e
ce8e0331d7793f07d9e564398b8dc56e5911bd6c
refs/heads/master
2020-08-14T16:08:53.922403
2019-10-15T06:10:29
2019-10-15T06:10:29
215,196,286
1
0
null
null
null
null
UTF-8
Java
false
false
4,872
java
package com.example.administrator.learning.common.view; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.RectF; import android.util.AttributeSet; import android.view.View; import com.example.administrator.learning.R; /** * Created by Administrator on 2018/11/2 0002. */ public class CompletedView extends View { // 画实心圆的画笔 private Paint mCirclePaint; // 画圆环的画笔 private Paint mRingPaint; // 画圆环的画笔背景色 private Paint mRingPaintBg; // 画字体的画笔 private Paint mTextPaint; // 圆形颜色 private int mCircleColor; // 圆环颜色 private int mRingColor; // 圆环背景颜色 private int mRingBgColor; // 半径 private float mRadius; // 圆环半径 private float mRingRadius; // 圆环宽度 private float mStrokeWidth; // 圆心x坐标 private int mXCenter; // 圆心y坐标 private int mYCenter; // 字的长度 private float mTxtWidth; // 字的高度 private float mTxtHeight; // 总进度 private int mTotalProgress = 100; // 当前进度 private int mProgress; public CompletedView(Context context, AttributeSet attrs) { super(context, attrs); // 获取自定义的属性 initAttrs(context, attrs); initVariable(); } //属性 private void initAttrs(Context context, AttributeSet attrs) { TypedArray typeArray = context.getTheme().obtainStyledAttributes(attrs, R.styleable.TasksCompletedView, 0, 0); mRadius = typeArray.getDimension(R.styleable.TasksCompletedView_radius, 80); mStrokeWidth = typeArray.getDimension(R.styleable.TasksCompletedView_strokeWidth, 10); mCircleColor = typeArray.getColor(R.styleable.TasksCompletedView_circleColor, 0xFFFFFFFF); mRingColor = typeArray.getColor(R.styleable.TasksCompletedView_ringColor, 0xFFFFFFFF); mRingBgColor = typeArray.getColor(R.styleable.TasksCompletedView_ringBgColor, 0xFFFFFFFF); mRingRadius = mRadius + mStrokeWidth / 2; } //初始化画笔 private void initVariable() { //内圆 mCirclePaint = new Paint(); mCirclePaint.setAntiAlias(true); mCirclePaint.setColor(mCircleColor); mCirclePaint.setStyle(Paint.Style.FILL); //外圆弧背景 mRingPaintBg = new Paint(); mRingPaintBg.setAntiAlias(true); mRingPaintBg.setColor(mRingBgColor); mRingPaintBg.setStyle(Paint.Style.STROKE); mRingPaintBg.setStrokeWidth(mStrokeWidth); //外圆弧 mRingPaint = new Paint(); mRingPaint.setAntiAlias(true); mRingPaint.setColor(mRingColor); mRingPaint.setStyle(Paint.Style.STROKE); mRingPaint.setStrokeWidth(mStrokeWidth); //mRingPaint.setStrokeCap(Paint.Cap.ROUND);//设置线冒样式,有圆 有方 //中间字 mTextPaint = new Paint(); mTextPaint.setAntiAlias(true); mTextPaint.setStyle(Paint.Style.FILL); mTextPaint.setColor(mRingColor); mTextPaint.setTextSize(mRadius / 2); Paint.FontMetrics fm = mTextPaint.getFontMetrics(); mTxtHeight = (int) Math.ceil(fm.descent - fm.ascent); } //画图 @Override protected void onDraw(Canvas canvas) { mXCenter = getWidth() / 2; mYCenter = getHeight() / 2; //内圆 canvas.drawCircle(mXCenter, mYCenter, mRadius, mCirclePaint); //外圆弧背景 RectF oval1 = new RectF(); oval1.left = (mXCenter - mRingRadius); oval1.top = (mYCenter - mRingRadius); oval1.right = mRingRadius * 2 + (mXCenter - mRingRadius); oval1.bottom = mRingRadius * 2 + (mYCenter - mRingRadius); canvas.drawArc(oval1, 0, 360, false, mRingPaintBg); //圆弧所在的椭圆对象、圆弧的起始角度、圆弧的角度、是否显示半径连线 //外圆弧 if (mProgress > 0 ) { RectF oval = new RectF(); oval.left = (mXCenter - mRingRadius); oval.top = (mYCenter - mRingRadius); oval.right = mRingRadius * 2 + (mXCenter - mRingRadius); oval.bottom = mRingRadius * 2 + (mYCenter - mRingRadius); canvas.drawArc(oval, -90, ((float)mProgress / mTotalProgress) * 360, false, mRingPaint); // //字体 String txt = mProgress + "分"; mTxtWidth = mTextPaint.measureText(txt, 0, txt.length()); canvas.drawText(txt, mXCenter - mTxtWidth / 2, mYCenter + mTxtHeight / 4, mTextPaint); } } //设置进度 public void setProgress(int progress) { mProgress = progress; postInvalidate();//重绘 } }
21c4217c9360ac2040f60b505e93a3a61575dcd5
b23f37aa7dcae1033cf84490a830b89d8e3ff01f
/src/main/java/com/bth/lht/rest/CheckPhone.java
11bf685eb016563d02fd64a7c8d2c4eafa0a0e12
[]
no_license
ttangxing950125/lht
817674de61f0fec873ef01090041c77b789c6475
185e0c58a95e683d13f195ad900b908b9de3c48c
refs/heads/tx
2022-07-11T21:07:14.806009
2019-05-30T02:25:45
2019-05-30T02:25:45
185,150,615
0
0
null
2022-06-21T01:06:42
2019-05-06T08:00:36
Java
UTF-8
Java
false
false
618
java
package com.bth.lht.rest; import com.bth.lht.respose.base.OneResponse; import com.bth.lht.util.SendSMS; import io.swagger.annotations.Api; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RestController; @Api("手机验证") @RestController("checkPhone") public class CheckPhone { @GetMapping("/getPHoneCode") public String toSendCode( @RequestHeader("token") String token){ return SendSMS.check(); } }
246a93b9bae469159907854b8ab9ea7a6d337940
ef66e972f04cc5f67724d929215e4d402ed90e94
/src/Arista.java
f7ee3260994d973fed745b0a80bac83339b64ece
[]
no_license
miguelnietoa/mapUN
ad857923e4d626c704bd3ded601ba1f91eaa5d1e
18e860e4f0dbdc728b596d5b84e590d58abb0396
refs/heads/master
2023-04-02T03:06:22.203886
2021-04-07T02:54:25
2021-04-07T02:54:25
254,906,062
2
1
null
null
null
null
UTF-8
Java
false
false
622
java
/** * Representa una arista ponderada. * * @author MCJ * @version 1.0 */ public class Arista { private Nodo nodo; private int peso; public Arista(Nodo nodo, int peso) { this.nodo = nodo; this.peso = peso; } public Nodo getNodo() { return nodo; } public void setNodo(Nodo nodo) { this.nodo = nodo; } public int getPeso() { return peso; } public void setPeso(int peso) { this.peso = peso; } public String toString() { return nodo.getNombre() + "," + peso; } }
25f7e4dd04750e1cc1310e4bd53b238d627d9e57
fa5d3d620485c9e384cf0018b2e64ec3d13f3fe6
/app/src/test/java/com/niedzielski/translucentactivitydemo/ExampleUnitTest.java
c88c74fde5b59a4d3746e10e439569cef4b2bca5
[]
no_license
niedzielski/TranslucentActivityDemo
c77058f353659e593553b3b35e1c543125a696db
61701beef3f24f96dac564a0f500e37f374ce3c0
refs/heads/master
2020-07-04T14:14:46.252113
2016-11-18T18:56:24
2016-11-18T18:56:24
74,157,851
0
0
null
null
null
null
UTF-8
Java
false
false
417
java
package com.niedzielski.translucentactivitydemo; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
d071f7cfd6b11b92ba1ee504471a0f21b229ac67
128eb90ce7b21a7ce621524dfad2402e5e32a1e8
/laravel-converted/src/main/java/com/project/convertedCode/globalNamespace/namespaces/Illuminate/namespaces/Notifications/classes/AnonymousNotifiable.java
8898f1af1b62f4c5f7d2932120191878ebe89c87
[ "LicenseRef-scancode-warranty-disclaimer", "MIT" ]
permissive
RuntimeConverter/RuntimeConverterLaravelJava
657b4c73085b4e34fe4404a53277e056cf9094ba
7ae848744fbcd993122347ffac853925ea4ea3b9
refs/heads/master
2020-04-12T17:22:30.345589
2018-12-22T10:32:34
2018-12-22T10:32:34
162,642,356
0
0
null
null
null
null
UTF-8
Java
false
false
5,816
java
package com.project.convertedCode.globalNamespace.namespaces.Illuminate.namespaces.Notifications.classes; import com.runtimeconverter.runtime.references.ReferenceContainer; import com.project.convertedCode.globalNamespace.functions.app; import com.runtimeconverter.runtime.passByReference.PassByReferenceArgs; import com.runtimeconverter.runtime.references.BasicReferenceContainer; import com.runtimeconverter.runtime.classes.StaticBaseClass; import com.runtimeconverter.runtime.classes.RuntimeClassBase; import com.runtimeconverter.runtime.RuntimeEnv; import com.runtimeconverter.runtime.passByReference.RuntimeArgsWithReferences; import com.runtimeconverter.runtime.references.ReferenceClassProperty; import com.project.convertedCode.globalNamespace.namespaces.Illuminate.namespaces.Contracts.namespaces.Notifications.classes.Dispatcher; import com.runtimeconverter.runtime.ZVal; import com.runtimeconverter.runtime.reflection.ReflectionClassData; import com.runtimeconverter.runtime.annotations.ConvertedParameter; import com.runtimeconverter.runtime.arrays.ZPair; import java.lang.invoke.MethodHandles; import com.runtimeconverter.runtime.classes.NoConstructor; import com.runtimeconverter.runtime.annotations.ConvertedMethod; import static com.runtimeconverter.runtime.ZVal.assignParameter; /* Converted with The Runtime Converter (runtimeconverter.com) vendor/laravel/framework/src/Illuminate/Notifications/AnonymousNotifiable.php */ public class AnonymousNotifiable extends RuntimeClassBase { public Object routes = ZVal.newArray(); public AnonymousNotifiable(RuntimeEnv env, Object... args) { super(env); } public AnonymousNotifiable(NoConstructor n) { super(n); } @ConvertedMethod @ConvertedParameter(index = 0, name = "channel") @ConvertedParameter(index = 1, name = "route") public Object route(RuntimeEnv env, Object... args) { Object channel = assignParameter(args, 0, false); Object route = assignParameter(args, 1, false); new ReferenceClassProperty(this, "routes", env).arrayAccess(env, channel).set(route); return ZVal.assign(this); } @ConvertedMethod @ConvertedParameter(index = 0, name = "notification") public Object notify(RuntimeEnv env, Object... args) { ReferenceContainer notification = new BasicReferenceContainer(assignParameter(args, 0, false)); env.callMethod( app.f.env(env).call(Dispatcher.CONST_class).value(), new RuntimeArgsWithReferences().add(1, notification), "send", AnonymousNotifiable.class, this, notification.getObject()); return null; } @ConvertedMethod @ConvertedParameter(index = 0, name = "notification") public Object notifyNow(RuntimeEnv env, Object... args) { Object notification = assignParameter(args, 0, false); env.callMethod( app.f.env(env).call(Dispatcher.CONST_class).value(), "sendNow", AnonymousNotifiable.class, this, notification); return null; } @ConvertedMethod @ConvertedParameter(index = 0, name = "driver") public Object routeNotificationFor(RuntimeEnv env, Object... args) { Object driver = assignParameter(args, 0, false); Object ternaryExpressionTemp = null; return ZVal.assign( ZVal.isDefined( ternaryExpressionTemp = new ReferenceClassProperty(this, "routes", env) .arrayGet(env, driver)) ? ternaryExpressionTemp : ZVal.getNull()); } @ConvertedMethod public Object getKey(RuntimeEnv env, Object... args) { return null; } public static final Object CONST_class = "Illuminate\\Notifications\\AnonymousNotifiable"; // Runtime Converter Internals // RuntimeStaticCompanion contains static methods // RequestStaticProperties contains static (per-request) properties // ReflectionClassData contains php reflection data used by the runtime library public static class RuntimeStaticCompanion extends StaticBaseClass { private static final MethodHandles.Lookup staticCompanionLookup = MethodHandles.lookup(); } public static final RuntimeStaticCompanion runtimeStaticObject = new RuntimeStaticCompanion(); private static final ReflectionClassData runtimeConverterReflectionData = ReflectionClassData.builder() .setName("Illuminate\\Notifications\\AnonymousNotifiable") .setLookup( AnonymousNotifiable.class, MethodHandles.lookup(), RuntimeStaticCompanion.staticCompanionLookup) .setLocalProperties("routes") .setFilename( "vendor/laravel/framework/src/Illuminate/Notifications/AnonymousNotifiable.php") .get(); @Override public ReflectionClassData getRuntimeConverterReflectionData() { return runtimeConverterReflectionData; } @Override public Object converterRuntimeCallExtended( RuntimeEnv env, String method, Class<?> caller, PassByReferenceArgs passByReferenceArgs, Object... args) { return RuntimeClassBase.converterRuntimeCallExtendedWithDataStatic( this, runtimeConverterReflectionData, env, method, caller, passByReferenceArgs, args); } }
9ab6318f19d347f1f87e0ef9342c2a68266afab3
7ad527bad3bd0d7eb94d1d8a0fe08df67aa26c3e
/软件学院/高级语言程序设计(Java)/答案/Exercise18_33.java
b702daa4f85db663afb2e41efa9ca8add0e35070
[]
no_license
SCUTMSC/SCUT-Course
67e67ac494aef7fc73de17f61b7fab8450f17952
90f884a9032e951ebc9421cc88ca807b9ec211da
refs/heads/master
2020-07-16T22:22:53.359477
2019-09-07T08:28:09
2019-09-07T08:28:09
205,880,291
10
6
null
null
null
null
UTF-8
Java
false
false
7,770
java
import java.util.ArrayList; import javafx.animation.KeyFrame; import javafx.animation.Timeline; import javafx.application.Application; import javafx.geometry.Point2D; import javafx.geometry.Pos; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.image.ImageView; import javafx.scene.layout.BorderPane; import javafx.scene.layout.Pane; import javafx.scene.shape.Line; import javafx.stage.Stage; import javafx.util.Duration; public class Exercise18_33 extends Application { private static final int SIZE = 8; private int startX = 0; private int startY = 0; private ArrayList<Point2D> moveHistory = null; @Override // Override the start method in the Application class public void start(Stage primaryStage) { BorderPane pane = new BorderPane(); ChessBoard board = new ChessBoard(); pane.setCenter(board); Button btSolve = new Button("Solve"); pane.setBottom(btSolve); BorderPane.setAlignment(btSolve, Pos.CENTER); // Create a scene and place it in the stage Scene scene = new Scene(pane, 250, 250); primaryStage.setTitle("Exercise18_33"); // Set the stage title primaryStage.setScene(scene); // Place the scene in the stage primaryStage.show(); // Display the stage board.paint(); btSolve.setOnAction(e -> { boolean[][] moves = new boolean[SIZE][SIZE]; moves[startX][startY] = true; resetMoveHistory(); addMoveHistory(startX, startY); solvePuzzle(moves, 1, startX, startY); board.startAnimation();; }); scene.widthProperty().addListener(ov -> board.paint()); scene.heightProperty().addListener(ov -> board.paint()); } // This method does the bulk of the work. // I'm not *thrilled* with this solution as // it has more redundant code than I'd prefer // but it gets the job done and done efficiently. // Uses Warnsdorf's heuristic discovered in 1823 // that says the best move is the one with the // fewest next moves. I found it necessary to // back up in only one case (3,0) and choose to // try the second best move which worked well. private boolean solvePuzzle(boolean[][] moves, int numMoves, int x, int y) { int nextX = 0; int nextY = 0; int bestMoveX = 0; int bestMoveY = 0; int bestMoveX2 = 0; int bestMoveY2 = 0; int minMoveCount = SIZE; // Knight has max of 8 moves int moveCount = 0; for (int i = 2; i >= -2; i += -4) { for (int j = 1; j >= -1; j += -2) { nextX = x + i; nextY = y + j; if (nextX >= 0 && nextX <= SIZE - 1 && nextY >= 0 && nextY <= SIZE - 1 && !moves[nextX][nextY]) { moveCount = lookAheadCount(moves, nextX, nextY); if (moveCount <= minMoveCount) { minMoveCount = moveCount; bestMoveX2 = bestMoveX; bestMoveY2 = bestMoveY; bestMoveX = nextX; bestMoveY = nextY; } } nextX = x + j; nextY = y + i; if (nextX >= 0 && nextX <= SIZE - 1 && nextY >= 0 && nextY <= SIZE - 1 && !moves[nextX][nextY]) { moveCount = lookAheadCount(moves, nextX, nextY); if (moveCount <= minMoveCount) { minMoveCount = moveCount; bestMoveX2 = bestMoveX; bestMoveY2 = bestMoveY; bestMoveX = nextX; bestMoveY = nextY; } } } } moves[bestMoveX][bestMoveY] = true; addMoveHistory(bestMoveX, bestMoveY); numMoves++; if (numMoves == (SIZE * SIZE)) return true; if (moveCount > 0 && solvePuzzle(moves, numMoves, bestMoveX, bestMoveY)) { return true; } moves[bestMoveX][bestMoveY] = false; moves[bestMoveX2][bestMoveY2] = true; removeLastMoveHistory(); addMoveHistory(bestMoveX2, bestMoveY2); if (moveCount > 1 && solvePuzzle(moves, numMoves, bestMoveX2, bestMoveY2)) { return true; } moves[bestMoveX2][bestMoveY2] = false; removeLastMoveHistory(); numMoves--; return false; } private int lookAheadCount(boolean[][] moves, int x, int y) { int maxCount = 0; for (int i = -2; i <= 2; i += 4) { for (int j = -1; j <= 1; j += 2) { int nextX = x + i; int nextY = y + j; if (nextX >= 0 && nextX <= SIZE - 1 && nextY >= 0 && nextY <= SIZE - 1 && !moves[nextX][nextY]) { maxCount++; } nextX = x + j; nextY = y + i; if (nextX >= 0 && nextX <= SIZE - 1 && nextY >= 0 && nextY <= SIZE - 1 && !moves[nextX][nextY]) { maxCount++; } } } return maxCount; } public void resetMoveHistory() { moveHistory = new ArrayList(63); } public void addMoveHistory(int x, int y) { moveHistory.add(new Point2D(x, y)); } public void removeLastMoveHistory() { moveHistory.remove(moveHistory.size() - 1); } private class ChessBoard extends Pane { private ImageView knightImageView = new ImageView("image/knight.jpg"); private Timeline animation; private int index = 0; ChessBoard() { this.setOnMouseClicked(e -> { startX = (int)(e.getX() / (getWidth() / SIZE)); startY = (int)(e.getY() / (getHeight() / SIZE)); resetMoveHistory(); paint(); }); animation = new Timeline( new KeyFrame(Duration.millis(1000), e -> controlPaint())); animation.setCycleCount(Timeline.INDEFINITE); } private void controlPaint() { index++; paint(); if (index == moveHistory.size()) animation.stop(); } public void startAnimation() { index = 0; animation.play(); } private void paint() { // Clear previous drawing this.getChildren().clear(); // Add the Knight image this.getChildren().add(knightImageView); knightImageView.setX(startX * getWidth() / SIZE); knightImageView.setY(startY * getHeight() / SIZE); knightImageView.setFitWidth(getWidth() / SIZE); knightImageView.setFitHeight(getHeight() / SIZE); // Draw the lines for (int i = 1; i <= SIZE; i++) { this.getChildren().add( new Line(0, i * getHeight() / SIZE, getWidth(), i * getHeight() / SIZE)); this.getChildren().add( new Line(i * getWidth() / SIZE, 0, i * getWidth() / SIZE, getHeight())); } // Draw the moves if (moveHistory != null && moveHistory.size() > 0) { for (int i = 1; i < index; i++) { Point2D p1 = moveHistory.get(i - 1); Point2D p2 = moveHistory.get(i); this.getChildren().add( new Line(p1.getX() * (getWidth() / SIZE) + getWidth() / SIZE / 2, p1.getY() * (getHeight() / SIZE) + (getHeight() / SIZE / 2), p2.getX() * (getWidth() / SIZE) + getWidth() / SIZE / 2, p2.getY() * (getHeight() / SIZE) + getHeight() / SIZE / 2)); } // Add the Knight image if (moveHistory.size() > 0) { // Add the Knight image ImageView knightImageView1 = new ImageView("image/knight.jpg"); this.getChildren().add(knightImageView1); Point2D p = moveHistory.get(index - 1); knightImageView1.setX(p.getX() * getWidth() / SIZE); knightImageView1.setY(p.getY() * getHeight() / SIZE); knightImageView1.setFitWidth(getWidth() / SIZE); knightImageView1.setFitHeight(getHeight() / SIZE); } } } } /** * The main method is only needed for the IDE with limited * JavaFX support. Not needed for running from the command line. */ public static void main(String[] args) { launch(args); } }
c62a7982a1d675b31f1f3931257ec9b331312dfe
f1eeb23473d5dabfbcdd18c80fd0eb5da0d0a08e
/sys/src/test/java/com/g/sys/log/service/SysLogServiceTest.java
8174d3d746b6c7b5d280825487ab443810b3e772
[ "MIT" ]
permissive
gaven004/g.next
f86c97be8b9ba478d4b5509a97ee425c48fc11c8
7828c937758eea0152e320c32644cc52ae57e6b3
refs/heads/master
2023-02-08T01:34:17.384421
2019-11-29T02:39:10
2019-11-29T02:39:10
112,418,712
0
0
MIT
2022-12-16T12:07:28
2017-11-29T02:58:53
Java
UTF-8
Java
false
false
1,846
java
package com.g.sys.log.service; import java.util.List; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.g.sys.log.model.SysLog; import com.g.sys.sec.model.SysUser; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration("/test-context.xml") public class SysLogServiceTest { @Autowired SysLogService service; public void logCreate() { SysUser user = new SysUser(); user.setUid(1L); user.setAccount("test"); user.setUsername("test"); user.setEnabled("VALID"); service.logCreate(0L, user); } public void logUpdate() { SysUser user = new SysUser(); user.setUid(1L); user.setAccount("test"); user.setUsername("test_user"); user.setEnabled("INVALID"); service.logUpdate(0L, user); } public void logDelete() { SysUser user = new SysUser(); user.setUid(1L); service.logDelete(0L, user); } public void getTrace() { SysUser user = new SysUser(); user.setUid(1L); List<SysLog> list = service.getTrace(user); System.out.println(list); } public void remove() { QueryWrapper<SysLog> wrapper = new QueryWrapper(); wrapper.eq(SysLog.CLAZZ, SysUser.class.getName()); wrapper.eq(SysLog.OID, "{\"uid\":\"test\"}"); service.remove(wrapper); } @Test public void testAll() { remove(); logCreate(); logUpdate(); logUpdate(); logUpdate(); logDelete(); getTrace(); } }
8b0411b87e4bbe732b8f1cce86ce485b7f519e46
961c86629949b47335def35b3cda7578009b2ab9
/src/main/java/com/murphy1/inventory/services/UserService.java
1d4f096b3a9a5cdb7b3e04aa776acacb378dcaf7
[ "MIT" ]
permissive
murphy1/inventory-management-spring
a2851975d77c9b71c4f41b0cc986480d1d781caf
0d1ac25179f2ca91a13ddeb79f4e75466a72f07f
refs/heads/master
2020-07-05T08:10:24.563549
2019-12-12T15:04:57
2019-12-12T15:04:57
202,584,228
2
0
null
2019-09-18T16:06:34
2019-08-15T17:30:35
Java
UTF-8
Java
false
false
262
java
package com.murphy1.inventory.services; import com.murphy1.inventory.model.User; import java.util.List; public interface UserService { List<User> getAllUsers(); User saveUser(User user); User findUserById(Long id); void deleteById(Long id); }
7b159fc125c921b8e147dfce3bbe3f4f1ebe56fd
a7d2b45e72d745f51db450cc16dc332269a6b5f1
/AlmullaExchange/src/com/amg/exchange/remittance/bean/AdditionalBankAmiecTemp.java
5867d4ac1a16eece1a59af4a9260ca472ea7696b
[]
no_license
Anilreddyvasantham/AlmullaExchange
2974ecd53b1d752931c50b7ecd22c5a37fa05a03
b68bca218ce4b7585210deeda2a8cf84c6306ee3
refs/heads/master
2021-05-08T17:48:01.976582
2018-02-02T09:32:22
2018-02-02T09:32:22
119,484,446
1
0
null
null
null
null
UTF-8
Java
false
false
1,642
java
package com.amg.exchange.remittance.bean; import java.io.Serializable; import java.math.BigDecimal; import java.util.List; import com.amg.exchange.remittance.model.AdditionalBankRuleAddData; public class AdditionalBankAmiecTemp implements Serializable{ private static final long serialVersionUID = 1L; private BigDecimal bankId; private String bankName; private String addtionalFieldDesc; private Boolean ifRecordEdited; private BigDecimal amiecAndBankMappingPK; private List<AdditionalBankRuleAddData> addtionalBankRuleList; public Boolean getIfRecordEdited() { return ifRecordEdited; } public void setIfRecordEdited(Boolean ifRecordEdited) { this.ifRecordEdited = ifRecordEdited; } public BigDecimal getAmiecAndBankMappingPK() { return amiecAndBankMappingPK; } public void setAmiecAndBankMappingPK(BigDecimal amiecAndBankMappingPK) { this.amiecAndBankMappingPK = amiecAndBankMappingPK; } public BigDecimal getBankId() { return bankId; } public String getBankName() { return bankName; } public List<AdditionalBankRuleAddData> getAddtionalBankRuleList() { return addtionalBankRuleList; } public void setBankId(BigDecimal bankId) { this.bankId = bankId; } public void setBankName(String bankName) { this.bankName = bankName; } public void setAddtionalBankRuleList( List<AdditionalBankRuleAddData> addtionalBankRuleList) { this.addtionalBankRuleList = addtionalBankRuleList; } public String getAddtionalFieldDesc() { return addtionalFieldDesc; } public void setAddtionalFieldDesc(String addtionalFieldDesc) { this.addtionalFieldDesc = addtionalFieldDesc; } }
227560b9a2f10b73d20745cbef6d46167b767bb0
9e8cd7a960450b15c8e059e4f18a5dc9385f0b8c
/app/src/main/java/mx/edu/ittepic/practica2_inmobiliaria_u4/Main2Activity.java
34d985500a87500cbce9878184f3038151b380a4
[]
no_license
EdgarPaulRamirez/Practica2_Inmobiliaria_U4
8a60c43c2ffe399fd4f9919cd061c6cecb968a32
d158e02a902741c90b4209b0914301c06c1ea280
refs/heads/master
2020-04-09T22:18:11.276217
2018-12-06T05:48:20
2018-12-06T05:48:20
160,624,853
0
0
null
null
null
null
UTF-8
Java
false
false
10,125
java
package mx.edu.ittepic.practica2_inmobiliaria_u4; import android.content.DialogInterface; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteException; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.text.InputType; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class Main2Activity extends AppCompatActivity { EditText IDInmueble, domicilioInmueble, precioVentaInmueble, precioRentaInmueble, fechaTransaccionInmueble, idpInmueble; Button insertar, consultar, eliminar, actualizar; BaseDatos base; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main2); IDInmueble = findViewById(R.id.IDInmueble); domicilioInmueble = findViewById(R.id.domicilioInmueble); precioVentaInmueble = findViewById(R.id.precioVentaInmueble); precioRentaInmueble = findViewById(R.id.precioRentaInmueble); fechaTransaccionInmueble = findViewById(R.id.fechaTransaccionInmueble); idpInmueble = findViewById(R.id.idpInmueble); insertar = findViewById(R.id.insertarInmueble); consultar = findViewById(R.id.consultarInmueble); eliminar = findViewById(R.id.eliminarInmueble); actualizar = findViewById(R.id.actualizarInmueble); base = new BaseDatos(this,"inmobiliaria",null,1); insertar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { codigoInsertar(); } }); consultar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { pedirID(1); } }); actualizar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (actualizar.getText().toString().startsWith("CONFIRMAR ACTUALIZACION")){ confirmacionActualizacion(); }else{ pedirID(2); } } }); eliminar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { pedirID(3); } }); } private void confirmacionActualizacion(){ AlertDialog.Builder confir = new AlertDialog.Builder(this); confir.setTitle("ATENCIÓN").setMessage("¿Seguro que deseeas realiar los cambios?") .setPositiveButton("Si, estoy seguro", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { aplicarActualizar(); dialog.dismiss(); } }).setNegativeButton("cancelar", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { habilitarBotonesYLimpiarCampos(); dialog.cancel(); } }).show(); } private void aplicarActualizar(){ try{ SQLiteDatabase tabla = base.getWritableDatabase(); String SQL = "UPDATE INMUEBLE SET DOMICILIO='" + domicilioInmueble.getText().toString() + "', PRECIOVENTA=" + precioVentaInmueble.getText().toString() + ", PRECIORENTA=" + precioRentaInmueble.getText().toString()+",FECHATRANSACCION='"+fechaTransaccionInmueble.getText().toString()+"' WHERE IDINMUEBLE ="+idpInmueble.getText().toString(); tabla.execSQL(SQL); tabla.close(); Toast.makeText(this,"Se actualizó CORRECTAMENTE",Toast.LENGTH_LONG).show(); }catch (SQLiteException e){ Toast.makeText(this,"ERROR: No se pudo actualizar",Toast.LENGTH_LONG).show(); } habilitarBotonesYLimpiarCampos(); } private void habilitarBotonesYLimpiarCampos(){ IDInmueble.setText(""); domicilioInmueble.setText(""); precioVentaInmueble.setText(""); precioRentaInmueble.setText(""); fechaTransaccionInmueble.setText(""); insertar.setEnabled(true); consultar.setEnabled(true); eliminar.setEnabled(true); actualizar.setText(""); IDInmueble.setEnabled(true); } private void eliminarIdtodo(String idEliminar) { try{ SQLiteDatabase tabla = base.getReadableDatabase(); String SQL = "DELETE FROM INMUEBLE WHERE IDINMUEBLE =" + idEliminar; tabla.execSQL(SQL); tabla.close(); Toast.makeText(this, "Se eleminó CORRECTAMENTE ", Toast.LENGTH_LONG).show(); }catch (SQLiteException e){ Toast.makeText(this, "ERROR: No se pudo Eliminar", Toast.LENGTH_LONG).show(); } } /////////////////////////para pedir el numero private void pedirID(final int origen){ final EditText pidoID = new EditText(this); pidoID.setInputType(InputType.TYPE_CLASS_NUMBER); pidoID.setHint("Valor entero mayor de 0"); String mensaje ="Escriba el id a buscar"; String mensajeTitulo = "Buscando..."; AlertDialog.Builder alerta = new AlertDialog.Builder(this); if(origen ==2){ mensaje ="Ecriba el id a modificar"; mensajeTitulo = "Modificando..."; } if(origen ==3){ mensaje ="Favor de ingresar el ID a eliminar:"; mensajeTitulo = "Eliminando..."; } alerta.setTitle(mensajeTitulo).setMessage(mensaje) .setView(pidoID) .setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if(pidoID.getText().toString().isEmpty()){ Toast.makeText(Main2Activity.this,"Favor de ingresar el ID a eliminar: ",Toast.LENGTH_LONG).show(); return; } buscarDato(pidoID.getText().toString(), origen); dialog.dismiss(); } }) .setNegativeButton("Cancelar",null).show(); } //////////////////////////////////////////eliminar private void buscarDato(String idaBuscar, int origen){ try{ SQLiteDatabase tabla = base.getReadableDatabase(); String SQL = "SELECT *FROM INMUEBLE WHERE IDINMUEBLE ="+idaBuscar; Cursor resultado = tabla.rawQuery(SQL,null); if(resultado.moveToFirst()){//mover le primer resultado obtenido de la consulta //si hay resulta´do if(origen==3){ //se consulto para borrar String dato = idaBuscar+"&"+ resultado.getString(1)+"&"+resultado.getString(2)+ "&"+resultado.getString(3)+resultado.getString(4); confirmacionEliminacion(dato); return; } IDInmueble.setText(resultado.getString(0)); domicilioInmueble.setText(resultado.getString(1)); precioVentaInmueble.setText(resultado.getString(2)); precioRentaInmueble.setText(resultado.getString(3)); fechaTransaccionInmueble.setText(resultado.getString(4)); if(origen==2){ //modificar insertar.setEnabled(false); consultar.setEnabled(false); eliminar.setEnabled(false); actualizar.setText("CONFIRMAR ACTUALIZACION"); IDInmueble.setEnabled(false); } }else { //no hay resultado! Toast.makeText(this,"ERROR: No se encontró el resultado",Toast.LENGTH_LONG).show(); } tabla.close(); }catch (SQLiteException e){ Toast.makeText(this,"ERROR: No se pudo realizar la busqueda",Toast.LENGTH_LONG).show(); } } private void confirmacionEliminacion(String dato) { String datos[] = dato.split("&"); final String id = datos[0]; String nombre = datos[1]; AlertDialog.Builder alerta = new AlertDialog.Builder(this); alerta.setTitle("ATENCIÓN").setMessage("Deseas eliminar el platillo: "+nombre) .setPositiveButton("Si, estoy de acuerdo", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { eliminarIdtodo(id); dialog.dismiss(); } }) .setNegativeButton("Cancelar",null).show(); } private void codigoInsertar(){ try { //metodo que compete a la inserccion, SQLiteDatabase tabla = base.getWritableDatabase(); String SQL = "INSERT INTO INMUEBLE VALUES(1,'%2', 3, 4,'%5', '%6')"; SQL = SQL.replace("1", IDInmueble.getText().toString()); SQL = SQL.replace("%2", domicilioInmueble.getText().toString()); SQL = SQL.replace("3", precioVentaInmueble.getText().toString()); SQL = SQL.replace("4", precioRentaInmueble.getText().toString()); SQL = SQL.replace("%5", fechaTransaccionInmueble.getText().toString()); SQL = SQL.replace("%6", idpInmueble.getText().toString()); tabla.execSQL(SQL); Toast.makeText(this,"La insercción se realizó correctamente",Toast.LENGTH_LONG).show(); tabla.close(); }catch (SQLiteException e){ Toast.makeText(this,"No se pudo realizar la insercción",Toast.LENGTH_LONG).show(); } } }
8058eb3ca7da06f58b02d0d758a6c1a49a2915a1
49ba5178f5993d02b457b93cdbab04e39d0fd6c3
/exercicio4/PIF/nodes/nodeImplementations/PIFNode.java
dbba2866ec0a8f62de3d5ca918dc28635a74f966
[]
no_license
renanccastro/MC833AB
dfe7ec84593a6d33355db15ec84a778eebe02ff6
063dd9dc7236bac0c52ef2ac504f10579cfa4b51
refs/heads/master
2021-01-19T03:15:22.175129
2016-06-29T04:51:25
2016-06-29T04:51:25
53,706,866
0
0
null
null
null
null
UTF-8
Java
false
false
5,605
java
package projects.PIF.nodes.nodeImplementations; import java.awt.Color; import java.awt.Graphics; import java.util.ArrayList; import projects.PIF.nodes.messages.FEEDBACKMessage; import projects.PIF.nodes.messages.INFMessage; import projects.PIF.nodes.timers.PIF_FeedbackTimer; import projects.PIF.nodes.timers.MessageTimer; import projects.PIF.nodes.timers.ResetTimer; import sinalgo.configuration.WrongConfigurationException; import sinalgo.gui.transformation.PositionTransformation; import sinalgo.nodes.Node; import sinalgo.nodes.messages.Inbox; import sinalgo.nodes.messages.Message; import sinalgo.runtime.Global; import sinalgo.tools.Tools; public class PIFNode extends Node { private boolean reached = false; private boolean leaf = false; private int nextHopToSource; public static int messages = 0; public static int sentINF = 0; public static int receivedINF = 0; public static int sentFeedback = 0; public static int receivedFeedback = 0; public ArrayList<Integer> ids = new ArrayList<Integer>(); public boolean has_sent_feedback = false; double time; double timeSent; /// Constantes public static int timeToReset = 4000; public static int timeToResend = 5000; public static int timeToWaitFeedback = 20000; int numerador = 500; int inf_count = 0; MessageTimer infMSG = null; public enum TNO {TNO_FEEDBACK, TNO_FIRST_FEEDBACK }; private PIF_FeedbackTimer feedbackTimer; private ResetTimer resetTimer; @Override public void handleMessages(Inbox inbox) { // TODO Auto-generated method stub int sender; while(inbox.hasNext()) { Message msg = inbox.next(); sender = inbox.getSender().ID; //N� recebeu uma mensagem INF if(msg instanceof INFMessage) { inf_count++; //System.out.println("Node: "+this.ID+" recebeu INF do Node "+sender); INFMessage msgINF = (INFMessage) msg; if(!this.reached) { time = Global.currentTime; receivedINF++; this.setColor(Color.GREEN); this.reached = true; this.nextHopToSource = msgINF.getSenderID(); msgINF.setSenderID(this.ID); infMSG = new MessageTimer(msgINF); infMSG.startRelative(1,this); resetTimer = new ResetTimer(this); resetTimer.startRelative(timeToReset, this); //Agenda o FEEDBACK ids.add(this.ID); feedbackTimer = new PIF_FeedbackTimer(this, TNO.TNO_FIRST_FEEDBACK); feedbackTimer.tnoStartRelative(1.1, this, TNO.TNO_FIRST_FEEDBACK); } if (inf_count > 2 && infMSG != null) { infMSG.canSendInf(false); leaf = true; } } //Mensagem de Confirma��o if(msg instanceof FEEDBACKMessage) { FEEDBACKMessage msgFeedback = (FEEDBACKMessage) msg; if (this.ID != 1){ if (msgFeedback.getDestinationID() == this.ID) { if (has_sent_feedback) { ids.clear(); has_sent_feedback = false; feedbackTimer = new PIF_FeedbackTimer(this, TNO.TNO_FEEDBACK); feedbackTimer.tnoStartRelative((float)timeToWaitFeedback/(time-timeSent), this, TNO.TNO_FEEDBACK); //System.out.println("----- criando nova mensagem de feedback ----- "); } ids.addAll(msgFeedback.ids); //System.out.println("Node: " + this.ID + " Recebeu Feedback do Node "+ msgFeedback.getSourceFeedbackID()); } } else { //System.out.println("Source node recebeu Feedback do Node "+ msgFeedback.getSourceFeedbackID()); //System.out.println("List size: " + msgFeedback.ids.size() ); receivedFeedback += msgFeedback.ids.size(); } } } } public void feedbackStart(){ has_sent_feedback= true; //System.out.println("List size de " + this.ID + " quando vai mandar: " + ids.size() ); MessageTimer feedbackMSG = new MessageTimer (new FEEDBACKMessage(this.ID, this.nextHopToSource, this.ids)); feedbackMSG.startRelative(0.1, this); } public void timeout(TNO tno){ switch(tno){ case TNO_FEEDBACK: feedbackStart(); break; case TNO_FIRST_FEEDBACK: if (leaf) feedbackStart(); else feedbackTimer.tnoStartRelative((float)numerador/time, this, TNO.TNO_FEEDBACK); } } @Override public void init() { //Considerando que o n� 1 tem a mensagem inf if (this.ID==1){ int i; for (i = 1; i <= 1;i++) { timeSent = Global.currentTime; messages++; this.setColor(Color.RED); this.nextHopToSource = this.ID; this.reached = true; MessageTimer infMSG = new MessageTimer (new INFMessage(this.ID, timeSent)); infMSG.startRelative(timeToResend*i+0.1, this); } } } public void reset() { this.setColor(Color.BLACK); this.has_sent_feedback = false; this.ids.clear(); this.inf_count = 0; this.reached = false; } @Override public void postStep() { // TODO Auto-generated method stub } @Override public void preStep() { // TODO Auto-generated method stub } @Override public void draw(Graphics g, PositionTransformation pt, boolean highlight) { // TODO Auto-generated method stub //if (this.ID == 1) highlight = true; super.drawNodeAsDiskWithText(g, pt, highlight, Integer.toString(this.ID), 6, Color.WHITE); } @Override public void neighborhoodChange() { // TODO Auto-generated method stub } @Override public void checkRequirements() throws WrongConfigurationException { // TODO Auto-generated method stub } }
4d93399556785dcfd1b87add86dee31c8bf6f380
9254e7279570ac8ef687c416a79bb472146e9b35
/sofa-20190815/src/main/java/com/aliyun/sofa20190815/models/RemoveLinkeLinktWorkitemtagResponse.java
d708b1511a3e7003e77e67124e5f9733e05ae7b4
[ "Apache-2.0" ]
permissive
lquterqtd/alibabacloud-java-sdk
3eaa17276dd28004dae6f87e763e13eb90c30032
3e5dca8c36398469e10cdaaa34c314ae0bb640b4
refs/heads/master
2023-08-12T13:56:26.379027
2021-10-19T07:22:15
2021-10-19T07:22:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,170
java
// This file is auto-generated, don't edit it. Thanks. package com.aliyun.sofa20190815.models; import com.aliyun.tea.*; public class RemoveLinkeLinktWorkitemtagResponse extends TeaModel { @NameInMap("headers") @Validation(required = true) public java.util.Map<String, String> headers; @NameInMap("body") @Validation(required = true) public RemoveLinkeLinktWorkitemtagResponseBody body; public static RemoveLinkeLinktWorkitemtagResponse build(java.util.Map<String, ?> map) throws Exception { RemoveLinkeLinktWorkitemtagResponse self = new RemoveLinkeLinktWorkitemtagResponse(); return TeaModel.build(map, self); } public RemoveLinkeLinktWorkitemtagResponse setHeaders(java.util.Map<String, String> headers) { this.headers = headers; return this; } public java.util.Map<String, String> getHeaders() { return this.headers; } public RemoveLinkeLinktWorkitemtagResponse setBody(RemoveLinkeLinktWorkitemtagResponseBody body) { this.body = body; return this; } public RemoveLinkeLinktWorkitemtagResponseBody getBody() { return this.body; } }
2642286a7f67a0b94c2dd3b56de5821ea2a37e56
b3e8f27ce641f2a830c4ece48afd5e0190d8b8b2
/src/main/java/com/tilitili/common/mysqlautocode/client/ColumnAutocode.java
3aa83a6067cbaeb9241f7289ca8e264aeb2ff83e
[]
no_license
Jadlokin-Scarlet/tilitili-common
718db2689222a98c0dcb5d8154c1f54e2b178f04
986e3d38d70d262ad0f1363173b72aeac6bd4309
refs/heads/master
2023-07-10T22:36:27.611325
2021-08-06T02:02:30
2021-08-06T02:02:30
307,113,363
0
0
null
null
null
null
UTF-8
Java
false
false
6,208
java
package com.tilitili.common.mysqlautocode.client; import com.google.gson.Gson; import com.tilitili.common.mysqlautocode.server.FieldPair; import com.tilitili.common.mysqlautocode.server.Filter; import com.tilitili.common.mysqlautocode.server.Table2Domain; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Map; import static org.apache.commons.collections.CollectionUtils.isNotEmpty; public class ColumnAutocode { private static Logger logger = LoggerFactory.getLogger(ColumnAutocode.class); public static String run() throws IOException { // File file = new File(AutocodeHelper.antdesignPath+ Table2Domain.domainName+"Columns.jsx"); // if(file.exists()) { // file.delete(); // } // // OutputStream outStream = new FileOutputStream(file, true); // BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(outStream)); List<Column> columns = new ArrayList<>(); for(Map.Entry<String, FieldPair> entry: Table2Domain.fieldPairMap.entrySet()) { FieldPair fieldPair = entry.getValue(); String columnName = fieldPair.columnName; String columnType = fieldPair.columnType; String propertyName = fieldPair.propertyName; String propertyType = fieldPair.propertyType; String propertyClassName = fieldPair.propertyClassName; Column column = new Column(); column.title = "'"+fieldPair.getDisplayName()+"'"; column.dataIndex = "'"+fieldPair.getPropertyName()+"'"; if ("DATETIME".equals(columnType)) { column.width = 170; column.render = "(val) => { return val ? moment(val).format('YYYY-MM-DD HH:mm:ss') : '' }"; } if ("DATE".equals(columnType)) { column.width = 170; column.render = "(val) => { return val ? moment(val).format('YYYY-MM-DD') : '' }"; } if(isNotEmpty(fieldPair.filters)) { column.filteredValue = "filteredInfo."+fieldPair.getPropertyName()+" || null"; column.filterMultiple = false; column.filters = fieldPair.filters; StringBuffer renderBuf = new StringBuffer(); renderBuf.append("(").append(fieldPair.getPropertyName()).append(") => {"); renderBuf.append("switch (").append(fieldPair.getPropertyName()).append(") {"); for(Filter filter: column.filters) { renderBuf.append("case ").append(filter.value).append(":") .append("return ").append(filter.text).append("; "); } renderBuf.append("}}"); column.render = renderBuf.toString(); }else if(column.dataIndex.contains("image") || column.dataIndex.contains("img") || column.dataIndex.contains("icon")) { StringBuffer renderBuf = new StringBuffer(); renderBuf.append("(").append(fieldPair.getPropertyName()).append(") => {") .append("return <img src={").append(fieldPair.getPropertyName()).append("} style={{width: '80px', height: '80px'}}/>").append("}"); column.render = renderBuf.toString(); }else if(fieldPair.isIndex) { //System.out.println(fieldPair.toString()); //getInputTitle = (title, index, pagination, filteredInfo StringBuffer renderBuf = new StringBuffer(); renderBuf.append("getInputTitle(") .append(column.title).append(",") .append(column.dataIndex).append(",") .append("pagination, filteredInfo").append(")").toString(); if(column.render !=null) { column.render = column.render + ", ..." + renderBuf.toString(); }else{ column.render = renderBuf.toString(); } } columns.add(column); } return columns.toString().replaceAll("\"", "").replaceAll("render:getInputTitle", "...getInputTitle"); // bw.write("const columns = "+columns.toString().replaceAll("\"", "")); // bw.close(); // logger.error("成功生成文件"+ AutocodeHelper.antdesignPath+ Table2Domain.domainName+"Columns.jsx"); } public static class Column { @Override public String toString() { return new Gson().toJson(this); } public String title; public String dataIndex; public Integer width = 100; public Boolean filterMultiple; public String filteredValue; public List<Filter> filters; public String render; public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getDataIndex() { return dataIndex; } public void setDataIndex(String dataIndex) { this.dataIndex = dataIndex; } public Integer getWidth() { return width; } public void setWidth(Integer width) { this.width = width; } public Boolean getFilterMultiple() { return filterMultiple; } public void setFilterMultiple(Boolean filterMultiple) { this.filterMultiple = filterMultiple; } public String getFilteredValue() { return filteredValue; } public void setFilteredValue(String filteredValue) { this.filteredValue = filteredValue; } public List<Filter> getFilters() { return filters; } public void setFilters(List<Filter> filters) { this.filters = filters; } public String getRender() { return render; } public void setRender(String render) { this.render = render; } } }
b2e07d13f96bf7ae0b0cee51f39cbe76c60d3e3e
3870c4449e96eaa4dedd73ab266e75290bd0697f
/Clases/Clase8/src/clase8/Clase8.java
53d8f872658cc6476287498270e6ff23aec3c042
[]
no_license
Luis07/progra_1_lll_cuatri_2014_Luis_Brenes
66b4303df069fa6012a4ac5e8b957625c064d9ef
7e551e7ee822a75d796c116af439c5d09c256290
refs/heads/master
2021-01-20T04:40:04.310972
2014-12-02T16:01:12
2014-12-02T16:01:12
null
0
0
null
null
null
null
UTF-8
Java
false
false
731
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package clase8; /** * * @author Luis B */ public class Clase8 { /** * @param args the command line arguments */ public static void main(String[] args) { Ejercicio1 oEjercicio1= new Ejercicio1(); oEjercicio1.CrearMatriz(3, 5); oEjercicio1.Cargamatriz(); System.out.println(oEjercicio1.mprimir()+"\n"); Ejercicio2 oEjercicio2= new Ejercicio2(); oEjercicio2.CrearMatriz(4, 4); oEjercicio2.CargarMatriz(); System.out.println(oEjercicio2.Imprimir()); } }
b129ba83d4283c5e9c3449899e1d8df07f1d7d2a
34b713d69bae7d83bb431b8d9152ae7708109e74
/core/broadleaf-framework/src/main/java/org/broadleafcommerce/core/payment/service/OrderToPaymentRequestDTOService.java
0253ac3bc9eae3153a781b575654ba3f4d118b1f
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
sinotopia/BroadleafCommerce
d367a22af589b51cc16e2ad094f98ec612df1577
502ff293d2a8d58ba50a640ed03c2847cb6369f6
refs/heads/BroadleafCommerce-4.0.x
2021-01-23T14:14:45.029362
2019-07-26T14:18:05
2019-07-26T14:18:05
93,246,635
0
0
null
2017-06-03T12:27:13
2017-06-03T12:27:13
null
UTF-8
Java
false
false
3,784
java
/* * #%L * BroadleafCommerce Framework * %% * Copyright (C) 2009 - 2013 Broadleaf Commerce * %% * 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. * #L% */ package org.broadleafcommerce.core.payment.service; import org.broadleafcommerce.common.money.Money; import org.broadleafcommerce.common.payment.PaymentType; import org.broadleafcommerce.common.payment.dto.PaymentRequestDTO; import org.broadleafcommerce.core.order.domain.Order; import org.broadleafcommerce.core.order.service.FulfillmentGroupService; import org.broadleafcommerce.core.payment.domain.PaymentTransaction; /** * @author Elbert Bautista (elbertbautista) */ public interface OrderToPaymentRequestDTOService { /** * <p>This translates an Order of {@link PaymentType#CREDIT_CARD} into a PaymentRequestDTO. * This method assumes that this translation will apply to a final payment which means that the transaction amount for * the returned {@link PaymentRequestDTO} will be {@link Order#getTotalAfterAppliedPayments()} * It assumes that all other payments (e.g. gift cards/account credit) have already * been applied to the {@link Order}.</p> * * @param order the {@link Order} to be translated * @return a {@link PaymentRequestDTO} based on the properties of <b>order</b>. This will only utilize the payments * that are of type {@link PaymentType#CREDIT_CARD} */ public PaymentRequestDTO translateOrder(Order order); /** * Utilizes the {@link PaymentTransaction#getAdditionalFields()} map to populate necessary request parameters on the * resulting {@link PaymentRequestDTO}. These additional fields are then used by the payment gateway to construct * additional requests to the payment gateway. For instance, this might be use to refund or void the given <b>paymentTransaction</b> * * @param transactionAmount the amount that should be placed on {@link PaymentRequestDTO#getTransactionTotal()} * @param paymentTransaction the transaction whose additional fields should be placed on {@link PaymentRequestDTO#getAdditionalFields()} * for the gateway to use * @return a new {@link PaymentRequestDTO} populated with the additional fields from <b>paymentTransaction</b> and * the amount from <b>transactionAmount<b> */ public PaymentRequestDTO translatePaymentTransaction(Money transactionAmount, PaymentTransaction paymentTransaction); public void populateTotals(Order order, PaymentRequestDTO requestDTO); public void populateCustomerInfo(Order order, PaymentRequestDTO requestDTO); /** * Uses the first shippable fulfillment group to populate the {@link PaymentRequestDTO#shipTo()} object * @param order the {@link Order} to get data from * @param requestDTO the {@link PaymentRequestDTO} that should be populated * @see {@link FulfillmentGroupService#getFirstShippableFulfillmentGroup(Order)} */ public void populateShipTo(Order order, PaymentRequestDTO requestDTO); public void populateBillTo(Order order, PaymentRequestDTO requestDTO); public void populateDefaultLineItemsAndSubtotal(Order order, PaymentRequestDTO requestDTO); }
eaaeda5a940b3972f598e6d7ef19eec500fdbeed
a78cb207d9f65210b3b6c52c64809217157b6902
/ulewo2.5/src/com/ulewo/controller/TopicAction.java
f8110edf0b888726f93150545c370c46dfdfbb7c
[]
no_license
songdragon/mycode
4cfbf00cd0eef0bd6f42490706cd25009b064964
33c3d6ea6b554a8025783e233f97e02b319a5c4b
refs/heads/master
2021-01-18T09:59:39.771585
2014-10-13T03:55:58
2014-10-13T03:55:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
18,111
java
package com.ulewo.controller; import java.io.File; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.slf4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartHttpServletRequest; import org.springframework.web.servlet.ModelAndView; import com.ulewo.enums.AllowPostEnums; import com.ulewo.enums.FileSizeEnums; import com.ulewo.enums.ResultCode; import com.ulewo.enums.SourceFromEnums; import com.ulewo.enums.TopicCommentTypeEnums; import com.ulewo.exception.BusinessException; import com.ulewo.model.AttachmentDownload; import com.ulewo.model.Group; import com.ulewo.model.SessionUser; import com.ulewo.model.Topic; import com.ulewo.model.TopicCategory; import com.ulewo.model.TopicComment; import com.ulewo.model.TopicSurvey; import com.ulewo.service.AttachmentDownloadService; import com.ulewo.service.AttachmentService; import com.ulewo.service.GroupMemberService; import com.ulewo.service.GroupService; import com.ulewo.service.Log; import com.ulewo.service.TopicCategoryService; import com.ulewo.service.TopicCommentService; import com.ulewo.service.TopicService; import com.ulewo.service.TopicSurveyService; import com.ulewo.service.UserService; import com.ulewo.util.Constant; import com.ulewo.util.ErrorReport; import com.ulewo.util.StringUtils; import com.ulewo.util.UlewoPaginationResult; @Controller @RequestMapping("/group") public class TopicAction extends BaseGroupAction { @Autowired GroupService groupService; @Autowired TopicService topicService; @Autowired TopicSurveyService topicSurveyService; @Autowired TopicCategoryService topicCategoryService; @Autowired UserService userService; @Autowired GroupMemberService groupMemberService; @Autowired TopicCommentService topicCmmentService; @Autowired AttachmentService attachedService; @Autowired AttachmentDownloadService attachedDownloadService; @Log Logger log; /** * 主题列表,所有主题,分类主题 * * @param gid * @param cateId * @param session * @param request * @param response * @return */ @RequestMapping(value = "/{gid}/cateId/{cateId}", method = RequestMethod.GET) public ModelAndView groupArticleInItem(@PathVariable String gid, @PathVariable String cateId, HttpSession session, HttpServletRequest request, HttpServletResponse response) { ModelAndView mv = new ModelAndView(); try { Map<String, String> map = this.builderParams(request, true); map.put("gid", gid); map.put("categoryId", cateId); Group group = this.checkGroup(map, session); // 查询文章 UlewoPaginationResult<Topic> topicResult = topicService.findTopics(map); // 查询分类 List<TopicCategory> categoryList = topicCategoryService.queryCategoryAndTopicCount(map); SessionUser sessionUser = this.getSessionUser(session); TopicCategory category = topicCategoryService.getCategroy(map); if (sessionUser != null && sessionUser.getUserId().intValue() == group.getGroupUserId().intValue()) { category.setAllowPost(AllowPostEnums.ALLOW.getValue()); } mv.addObject("group", group); mv.addObject("category", category); mv.addObject("gid", gid); mv.addObject("topicResult", topicResult); mv.addObject("categoryList", categoryList); mv.addObject("cateId", cateId); if (StringUtils.isEmpty(cateId)) { mv.setViewName("group/group"); } else { mv.setViewName("group/group_articles"); } } catch (Exception e) { String errorMethod = "GroupAction-->groupIndex()<br>"; ErrorReport report = new ErrorReport(errorMethod + e.getMessage()); Thread thread = new Thread(report); thread.start(); mv.setViewName("redirect:" + Constant.ERRORPAGE); return mv; } return mv; } /** * 详情 * * @param gid * @param topicId * @param session * @param request * @param response * @return */ @RequestMapping(value = "/{gid}/topic/{topicId}", method = RequestMethod.GET) public ModelAndView showTopic(@PathVariable String gid, @PathVariable String topicId, HttpSession session, HttpServletRequest request, HttpServletResponse response) { ModelAndView mv = new ModelAndView(); try { Map<String, String> map = this.builderParams(request, true); map.put("gid", gid); map.put("topicId", topicId); Group group = this.checkGroup(map, session); Topic topic = this.topicService.showTopic(map); // 查询分类 List<TopicCategory> categoryList = topicCategoryService.queryCategoryAndTopicCount(map); mv.addObject("group", group); mv.addObject("topic", topic); mv.addObject("categoryList", categoryList); mv.setViewName("group/show_detail"); } catch (Exception e) { log.error(e.getMessage()); mv.setViewName("redirect:" + Constant.ERRORPAGE); return mv; } return mv; } @ResponseBody @RequestMapping(value = "/loadSurvey", method = RequestMethod.GET) public Map<String, Object> loadSurvey(HttpSession session, HttpServletRequest request, HttpServletResponse response) { Map<String, Object> result = new HashMap<String, Object>(); try { Map<String, String> map = this.builderParams(request, true); TopicSurvey survey = this.topicSurveyService.findTopicSurveyById(map, this.getSessionUser(session)); result.put("survey", survey); result.put("result", ResultCode.SUCCESS.getCode()); } catch (Exception e) { log.error(e.getMessage(), e); result.put("result", ResultCode.SUCCESS.getCode()); result.put("msg", "加载调查失败"); return result; } return result; } @ResponseBody @RequestMapping(value = "/saveSurvey.action", method = RequestMethod.POST) public Map<String, Object> saveSurvey(HttpSession session, HttpServletRequest request, HttpServletResponse response) { Map<String, Object> result = new HashMap<String, Object>(); try { String[] ids = request.getParameterValues("surveyId"); Map<String, String> map = this.builderParams(request, true); topicSurveyService.SurveyDo(map, ids, this.getSessionUser(session)); TopicSurvey survey = this.topicSurveyService.findTopicSurveyById(map, this.getSessionUser(session)); result.put("survey", survey); result.put("result", ResultCode.SUCCESS.getCode()); } catch (BusinessException e) { log.error(e.getMessage(), e); result.put("result", ResultCode.ERROR.getCode()); result.put("msg", e.getMessage()); return result; } catch (Exception e) { log.error(e.getMessage(), e); result.put("result", ResultCode.ERROR.getCode()); result.put("msg", "系统异常"); return result; } return result; } /** * 附件上传 * * @param session * @param request * @param response * @return */ @RequestMapping(value = "/fileupload", method = RequestMethod.POST) public ModelAndView fileupload(HttpSession session, HttpServletRequest request, HttpServletResponse response) { ModelAndView mv = new ModelAndView(); try { Object user = session.getAttribute("user"); if (null == user) { mv.addObject("result", "fail"); mv.addObject("message", "你登陆已超时,请重新登陆"); mv.setViewName("group/fileupload"); return mv; } String realPath = session.getServletContext().getRealPath("/"); MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; MultipartFile multipartFile = multipartRequest.getFile("file"); long size = multipartFile.getSize(); if (size > FileSizeEnums.SIZE1024_1024.getSize()) { mv.addObject("result", "fail"); mv.addObject("message", "文件超过1M"); mv.setViewName("group/fileupload"); return mv; } String fileName = multipartFile.getOriginalFilename(); String suffix = fileName.substring(fileName.lastIndexOf(".") + 1); if (!"rar".equalsIgnoreCase(suffix) && !"zip".equalsIgnoreCase(suffix)) { mv.addObject("result", "fail"); mv.addObject("message", "文件类型只能是.rar 压缩文件"); mv.setViewName("group/fileupload"); return mv; } SimpleDateFormat formater = new SimpleDateFormat("yyyyMM"); String saveDir = formater.format(new Date()); String realName = String.valueOf(System.currentTimeMillis()) + "." + suffix; String savePath = saveDir + "/" + realName; String fileDir = realPath + "upload" + "/" + saveDir; File dir = new File(fileDir); if (!dir.exists()) { dir.mkdirs(); } String filePath = fileDir + "/" + realName; File file = new File(filePath); multipartFile.transferTo(file); mv.addObject("result", "success"); mv.addObject("savePath", savePath); mv.setViewName("group/fileupload"); return mv; } catch (Exception e) { String errorMethod = "GroupAction-->fileupload()<br>"; ErrorReport report = new ErrorReport(errorMethod + e.getMessage()); Thread thread = new Thread(report); thread.start(); mv.addObject("result", "fail"); mv.setViewName("group/fileupload"); return mv; } } /** * 删除附件 * * @param session * @param request * @return */ @ResponseBody @RequestMapping(value = "/deleteFile.action", method = RequestMethod.POST) public Map<String, Object> deleteFile(HttpSession session, HttpServletRequest request) { Map<String, Object> modelMap = new HashMap<String, Object>(); try { String fileName = request.getParameter("fileName"); String userId = request.getParameter("userId"); if (!StringUtils.isNumber(userId)) { modelMap.put("result", ResultCode.ERROR.getCode()); modelMap.put("msg", "参数异常"); return modelMap; } if (this.getSessionUserId(session).intValue() != Integer.parseInt(userId)) { modelMap.put("result", ResultCode.ERROR.getCode()); modelMap.put("msg", "参数异常"); return modelMap; } if (StringUtils.isEmpty(fileName)) { modelMap.put("result", ResultCode.ERROR.getCode()); modelMap.put("msg", "参数异常"); return modelMap; } String realPath = session.getServletContext().getRealPath("/") + "upload/"; File file = new File(realPath + fileName); if (file.exists()) { file.delete(); } modelMap.put("result", ResultCode.SUCCESS.getCode()); return modelMap; } catch (Exception e) { String errorMethod = "GroupAction-->deleteFile()<br>"; ErrorReport report = new ErrorReport(errorMethod + e.getMessage()); Thread thread = new Thread(report); thread.start(); modelMap.put("result", "fail"); return modelMap; } } /** * 检测下载 * * @param session * @param request * @param response * @return */ @ResponseBody @RequestMapping(value = "/checkDownLoad.action", method = RequestMethod.GET) public Map<String, Object> downloadFile(HttpSession session, HttpServletRequest request, HttpServletResponse response) { Map<String, Object> modelMap = new HashMap<String, Object>(); try { Map<String, String> map = this.builderParams(request, true); attachedDownloadService.checkDownLoad(map, this.getSessionUser(session)); modelMap.put("result", ResultCode.SUCCESS.getCode()); return modelMap; } catch (BusinessException e) { log.error(e.getMessage(), e); modelMap.put("result", ResultCode.ERROR.getCode()); modelMap.put("msg", e.getMessage()); return modelMap; } catch (Exception e) { log.error(e.getMessage(), e); modelMap.put("result", ResultCode.ERROR.getCode()); modelMap.put("msg", "系统异常"); return modelMap; } } /** * 下载附件 * * @param session * @param request * @param response * @return */ @RequestMapping(value = "/downloadFile.action", method = RequestMethod.GET) public ModelAndView downloadFileDo(HttpSession session, HttpServletRequest request, HttpServletResponse response) { ModelAndView mv = new ModelAndView(); try { this.attachedDownloadService.downloadFile(this.builderParams(request, true), this.getSessionUser(session), response, session, request); } catch (Exception e) { log.error(e.getMessage(), e); mv.setViewName("redirect:" + Constant.ERRORPAGE); return mv; } return null; } /** * 查询附件下载人 * * @param session * @param request * @return */ @ResponseBody @RequestMapping(value = "/fetchAttachedUsers.do", method = RequestMethod.GET) public Map<String, Object> fetchAttachedUsers(HttpSession session, HttpServletRequest request) { Map<String, Object> modelMap = new HashMap<String, Object>(); try { Map<String, String> map = this.builderParams(request, true); List<AttachmentDownload> list = attachedDownloadService.queryAttachedUserByAttachedId(map); modelMap.put("result", ResultCode.SUCCESS.getCode()); modelMap.put("list", list); return modelMap; } catch (BusinessException e) { log.error(e.getMessage(), e); modelMap.put("result", ResultCode.ERROR.getCode()); modelMap.put("msg", e.getMessage()); return modelMap; } catch (Exception e) { log.error(e.getMessage(), e); modelMap.put("result", ResultCode.ERROR.getCode()); modelMap.put("msg", "系统异常"); return modelMap; } } /** * 新增文章 * * @param session * @param request * @return */ @ResponseBody @RequestMapping(value = "/addTopic.action", method = RequestMethod.POST) public Map<String, Object> addTopic(HttpSession session, HttpServletRequest request) { Map<String, Object> modelMap = new HashMap<String, Object>(); try { Map<String, String> param = this.builderParams(request, false); String[] surveyTitles = request.getParameterValues("surveyTitle"); String realPath = session.getServletContext().getRealPath("/"); Topic topic = this.topicService.addTopic(param, this.getSessionUser(session), surveyTitles, request); modelMap.put("result", ResultCode.SUCCESS.getCode()); modelMap.put("topic", topic); return modelMap; } catch (BusinessException e) { log.error(e.getMessage(), e); modelMap.put("result", ResultCode.ERROR.getCode()); modelMap.put("msg", e.getMessage()); return modelMap; } catch (Exception e) { log.error(e.getMessage(), e); modelMap.put("result", ResultCode.ERROR.getCode()); modelMap.put("msg", "系统异常"); return modelMap; } } /** * 加载评论 * * @param session * @param request * @param response * @return */ @RequestMapping(value = "/loadComment", method = RequestMethod.GET) @ResponseBody public UlewoPaginationResult<TopicComment> loadComment(HttpSession session, HttpServletRequest request, HttpServletResponse response) { try { Map<String, String> map = this.builderParams(request, true); UlewoPaginationResult<TopicComment> result = this.topicCmmentService.queryCommentByTopicId(map); return result; } catch (Exception e) { log.error(e.getMessage()); return new UlewoPaginationResult<TopicComment>(new ArrayList<TopicComment>(), ResultCode.ERROR, new StringBuilder(e.getMessage())); } } /** * 新增评论 * * @param session * @param request * @return */ @ResponseBody @RequestMapping(value = "/addComment.action", method = RequestMethod.POST) public Map<String, Object> addComment(HttpSession session, HttpServletRequest request) { Map<String, Object> modelMap = new HashMap<String, Object>(); try { Map<String, String> map = this.builderParams(request, false); map.put("sourceFrom",SourceFromEnums.PC.getValue()); TopicComment comment = topicCmmentService.addComment(map, this.getSessionUser(session)); modelMap.put("comment", comment); modelMap.put("result", ResultCode.SUCCESS.getCode()); return modelMap; } catch (BusinessException e) { log.error(e.getMessage(), e); modelMap.put("result", ResultCode.ERROR.getCode()); modelMap.put("msg", e.getMessage()); return modelMap; } catch (Exception e) { log.error(e.getMessage(), e); modelMap.put("result", ResultCode.ERROR.getCode()); modelMap.put("msg", "系统异常"); return modelMap; } } /** * 新增二级回复 * * @param session * @param request * @return */ @ResponseBody @RequestMapping(value = "/addSubComment.action", method = RequestMethod.POST) public Map<String, Object> addSubReComment(HttpSession session, HttpServletRequest request) { Map<String, Object> modelMap = new HashMap<String, Object>(); try { Map<String, String> map = this.builderParams(request, false); map.put("commentType", TopicCommentTypeEnums.SUBCOMMENT.getValue()); map.put("sourceFrom",SourceFromEnums.PC.getValue()); TopicComment comment = topicCmmentService.addComment(map, this.getSessionUser(session)); modelMap.put("comment", comment); modelMap.put("result", ResultCode.SUCCESS.getCode()); return modelMap; } catch (BusinessException e) { log.error(e.getMessage(), e); modelMap.put("result", ResultCode.ERROR.getCode()); modelMap.put("msg", e.getMessage()); return modelMap; } catch (Exception e) { log.error(e.getMessage(), e); modelMap.put("result", ResultCode.ERROR.getCode()); modelMap.put("msg", "系统异常"); return modelMap; } } }
50583156a295556e591a54764fcedb4551d2e2cc
9877b5b24ca333db93a57bfcf35034a86b7e2a95
/app/src/androidTest/java/com/mutualmonitor/testing/ExampleInstrumentedTest.java
4619e6dfc1d4adad2aad14e0a1cd98a8844c4ba7
[]
no_license
anusandhann/testing
d8de8ef5e78c8d37839110d1c8f186961f349fb8
1caab44763ddd88520b314aa3d18ec9d2078f57c
refs/heads/master
2022-02-10T19:18:22.110762
2022-01-27T04:24:24
2022-01-27T04:24:24
223,832,901
0
1
null
null
null
null
UTF-8
Java
false
false
715
java
package com.mutualmonitor.testing; import android.content.Context; import androidx.test.InstrumentationRegistry; import androidx.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.example.testing", appContext.getPackageName()); } }
96b1eeb9a36a4228a76a4be6beb558100dff47df
e4fc38f6f6d2697792062b1dab53abd43d9fcbef
/Exception/ClassNotFoundExp.java
80a353b7f016a33060e0a1b5947d06162bbd4d6f
[]
no_license
sandalcg91/jeetendra
ff1b2014c1672e5917602189a70ad6104b95a604
9793e8312f509d169adc6d336fb3824d67f1b7cf
refs/heads/master
2022-04-25T01:32:00.897977
2020-04-26T09:59:26
2020-04-26T09:59:26
258,992,848
0
0
null
null
null
null
UTF-8
Java
false
false
212
java
class ClassNotFoundExp { public static void main(String[] args) { try { Class.forName("cg.class"); } catch(ClassNotFoundException cnfe) { System.out.println("getting Exception " +cnfe); } } }
79344d17719f4ebb9d1d98219982f400757aa734
a6120463106ff704f1596752a355404c6e87f3d2
/School/src/Dijkstra_Shortest_Path_and_Datastructuren/Rit.java
10bf359de961603251bc54d54637475d48452ba6
[]
no_license
wail0152/Adaptive-Programming
e490e5f21b19c9d1f11f2350d491378dfbedda85
516f67612460b6cb95077ef26b18881a82572c8c
refs/heads/master
2022-09-11T06:42:34.581970
2020-05-29T14:40:56
2020-05-29T14:40:56
255,618,302
0
0
null
null
null
null
UTF-8
Java
false
false
273
java
package Dijkstra_Shortest_Path_and_Datastructuren; public class Rit extends Stap { public Double fuel; public Rit(String name) { super(name); } public Double getFuel() { fuel = getDistance() * 10.1; return fuel; } }
b1d419432d5d866e91a5c585b133aac0d85852a9
a1b64d2275a3f3ef4fc4b58d23b2c9fb2b05de01
/sim/TaskParser.java
0d36f647cc7ee9a80719597bfc77dfa199ac3008
[]
no_license
amoghavs/PSaPP
b9a2f9eaf782069d25fcd4e3ce44fccde257e6b9
d98b1dcff9e3d369ba0c154585d4238f3cc7c9c0
refs/heads/master
2016-08-12T05:35:10.649753
2015-10-22T23:09:11
2015-10-22T23:09:11
44,771,249
0
0
null
null
null
null
UTF-8
Java
false
false
3,540
java
package PSaPP.sim; /* Copyright (c) 2010, The Regents of the University of California All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the Regents of the University of California nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ import java.util.*; import java.io.*; import PSaPP.util.*; import PSaPP.pred.*; /** * This class parses a .task file and uses the data contained * within to populate a TaskData object. * @author bsheely */ public class TaskParser { public TaskParser() {} /** * Parse the specified file and populate the data object * @param file The .task file to be parsed * @param data The object to be populated with the parse results * @return boolean True if successful */ public boolean parse(String file, TaskData data) throws Exception { try { FileInputStream fstream = new FileInputStream(file); DataInputStream in = new DataInputStream(fstream); BufferedReader br = new BufferedReader(new InputStreamReader(in)); String line; while ((line = br.readLine()) != null) { String tokens[] = line.split("\t"); if (Util.isNumeric(tokens[0].trim())) { data.compTimes.add(new Double(Double.valueOf(tokens[1].trim()).doubleValue())); } else if (tokens[0].contentEquals("avg")) { data.avg = Double.valueOf(tokens[1].trim()).doubleValue(); } else if (tokens[0].contentEquals("min")) { data.min = Double.valueOf(tokens[1].trim()).doubleValue(); } else if (tokens[0].contentEquals("max")) { data.max = Double.valueOf(tokens[1].trim()).doubleValue(); } } in.close(); } catch (Exception e) { throw e; } Iterator iter = data.compTimes.iterator(); double summation = 0; while (iter.hasNext()) { double time = ((Double) iter.next()).doubleValue(); summation += Math.pow(time - data.avg, 2); } data.standardDeviation = Math.sqrt(summation / data.compTimes.size()); return true; } }
94b79d5d1a99b2bff666d32b3c63f33230c2916f
b36bb56c3de6baebfa87ae578ca3a2b3bde0d14c
/com.rcp.example.module.c/src/com/rcp/example/module/c/editorpart/ElementPOJOComposite.java
cd63aa2177bd7681566949fbe8e433ade9bb56a7
[]
no_license
zhj149/EclipseRCp-SpringOSGI
1ee08bf5782cd2cb2d638c25ecee27b67453644f
9605ffe2d91f5641d9932248765935f6f31436a1
refs/heads/master
2020-06-05T16:35:32.441219
2015-08-03T00:46:54
2015-08-03T00:46:54
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,590
java
package com.rcp.example.module.c.editorpart; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Text; import org.eclipse.swt.layout.GridData; public class ElementPOJOComposite extends Composite { private Text name; private Text column0; private Text column1; /** * Create the composite. * @param parent * @param style */ public ElementPOJOComposite(Composite parent, int style) { super(parent, style); setLayout(new GridLayout(2, false)); Label lblNewLabel = new Label(this, SWT.NONE); lblNewLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblNewLabel.setText(" name"); name = new Text(this, SWT.BORDER); name.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); Label lblColumn = new Label(this, SWT.NONE); lblColumn.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblColumn.setText(" column1"); column0 = new Text(this, SWT.BORDER); column0.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); Label lblNewLabel_1 = new Label(this, SWT.NONE); lblNewLabel_1.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblNewLabel_1.setText("column2"); column1 = new Text(this, SWT.BORDER); column1.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); } @Override protected void checkSubclass() { // Disable the check that prevents subclassing of SWT components } }
02ab13d522899a5d8510cbedf0cb7292c73d8604
4ce998c916b82bc00079ce8554dea7ddfc3ea997
/code-camp-java-base/src/main/java/com/wuwenxu/codecamp/base/question/QuestionTest2.java
b5e693ef67e83819ed7dffb500d5efd7bc861857
[ "Apache-2.0" ]
permissive
Wuwenxu/code-camp-java
429b3e299363218c28383b99db14745e0902f050
ffec9bcde9d42b866055eef838fa173a7b56c4dc
refs/heads/master
2022-12-12T06:55:56.692370
2020-08-23T12:07:55
2020-08-23T12:07:55
232,478,694
2
0
Apache-2.0
2022-12-06T00:35:13
2020-01-08T04:36:47
Java
UTF-8
Java
false
false
1,291
java
package com.wuwenxu.codecamp.base.question; /** * @Title: QuestionTest1 * @Description: * @Version:1.0.0 * @author pancm * @date 2017年7月21日 */ public class QuestionTest2 { /** * @param args */ public static void main(String[] args) { /* * 请实现一个函数,将一个字符串中的空格替换成“%20”。 * 例如,当字符串为We Are Happy.则经过替换之后的字符串为We%20Are%20Happy。 */ StringBuffer str=new StringBuffer("We Are Happy"); System.out.println(replaceString(str)); System.out.println(replaceString2(str)); } /** * 方法一:利用String的replace 直接替换 * @param str * @return String */ public static String replaceString(StringBuffer str){ if(str==null){ return null; } return str.toString().replaceAll(" ", "%20"); } /** * 方法二:利用数组循环取出 * @param str * @return */ public static String replaceString2(StringBuffer str){ if(str==null){ return null; } char []c =str.toString().toCharArray(); StringBuffer sb=new StringBuffer(); for(int i=0;i<c.length;i++){ if(c[i]==' '){ sb.append("%20"); }else{ sb.append(c[i]); } } return sb.toString(); } }
5ca0677d7316e9054a8fb57a467bc900a8fdcf32
54a6596f6d45639925d83a226404e5bdd7f79039
/week-03/day-2/src/SquareGrid.java
057e649ecee4ab2d6c52990a8b9a5570d4e2a89e
[]
no_license
green-fox-academy/purveeuka
dadc74632fc16c6f61658340e1e29176e0e3fb69
156f9b011fdf0864911582accc06a8a6bd476215
refs/heads/master
2023-04-05T02:33:17.132640
2021-05-07T13:49:28
2021-05-07T13:49:28
342,862,288
0
1
null
null
null
null
UTF-8
Java
false
false
1,835
java
import javax.swing.*; import java.awt.*; import static javax.swing.WindowConstants.EXIT_ON_CLOSE; public class SquareGrid { public static void drawImage(Graphics graphics) { fractals(graphics, 200, 200, 100, 20); } public static int randomColor() { int randomColor = (int) (Math.random() * 256); return randomColor; } public static void drawBox(Graphics graphics, int x, int y, int l, float w) { Graphics2D graphics2 = (Graphics2D) graphics; graphics2.setStroke(new BasicStroke(w)); graphics.drawRect(x - l, y - l, 2 * l, 2 * l); } public static void fractals(Graphics graphics, int x, int y, int l, float w) { if (l < 4) { return; } else { graphics.setColor(new Color(randomColor(), randomColor(), randomColor())); drawBox(graphics, x, y, l, w); fractals(graphics, x - l, y - l, l / 2, w / 2); fractals(graphics, x + l, y + l, l / 2, w / 2); fractals(graphics, x + l, y - l, l / 2, w / 2); fractals(graphics, x - l, y + l, l / 2, w / 2); } } // Don't touch the code below static int WIDTH = 400; static int HEIGHT = 400; public static void main(String[] args) { JFrame jFrame = new JFrame("Drawing"); jFrame.setDefaultCloseOperation(EXIT_ON_CLOSE); ImagePanel panel = new ImagePanel(); panel.setPreferredSize(new Dimension(WIDTH, HEIGHT)); jFrame.add(panel); jFrame.setLocationRelativeTo(null); jFrame.setVisible(true); jFrame.pack(); } static class ImagePanel extends JPanel { @Override protected void paintComponent(Graphics graphics) { super.paintComponent(graphics); drawImage(graphics); } } }
04f457a2aab76704d30f7a244b99d4f5e45ca5f2
90470c848790d4f731f0cc808bc8bddf972095ee
/languages/xjsnark/source_gen/xjsnark/behavior/PreTestBlock_BehaviorDescriptor.java
188bec8f8572d4dda1b26e6f5bddfa518cf80406
[ "MIT" ]
permissive
mstraka100/xjsnark
23ea5931e72778773abde776e247c74e577e2134
bd30e062bea5f6d5801ad50088060933ddaebb48
refs/heads/master
2020-03-30T18:42:21.626765
2018-10-04T15:39:50
2018-10-04T15:39:50
151,511,588
1
0
MIT
2018-10-04T03:03:31
2018-10-04T03:03:30
null
UTF-8
Java
false
false
518
java
package xjsnark.behavior; /*Generated by MPS */ import jetbrains.mps.baseLanguage.behavior.Statement_BehaviorDescriptor; /** * Will be removed after 3.3 * Need to support compilation of the legacy behavior descriptors before the language is rebuilt * This class is not involved in the actual method invocation */ @Deprecated public class PreTestBlock_BehaviorDescriptor extends Statement_BehaviorDescriptor { @Override public String getConceptFqName() { return "xjsnark.structure.PreTestBlock"; } }
7a1a5ad0bf9aa7c97a3fa63ea62761d731e1ec10
63b97d694aae7a47118d014999c96b48b3a7e6d8
/uvereignisservice/src/main/java/de/th/koeln/ungewoehnlichesverhalten/uvereignisservice/eventing/Notlage/NotlageEventConsumer.java
064d65f86c4899de23e7769a1d389dbf5072a872
[]
no_license
Archi-Lab/fae-team-4
7b4127d29337abadc6d0fe615b6ddaf331f7716f
ee347c6e4b2e1155bc5068873b672ef51b893a6f
refs/heads/master
2020-04-02T12:56:07.674015
2019-02-28T20:09:30
2019-02-28T20:09:30
154,459,039
1
1
null
null
null
null
UTF-8
Java
false
false
1,648
java
package de.th.koeln.ungewoehnlichesverhalten.uvereignisservice.eventing.Notlage; import de.th.koeln.ungewoehnlichesverhalten.uvereignisservice.eventing.Notlage.models.NotlageEventMessage; import de.th.koeln.ungewoehnlichesverhalten.uvereignisservice.eventing.Notlage.service.NotlageService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.kafka.annotation.KafkaListener; import org.springframework.messaging.handler.annotation.Payload; import org.springframework.stereotype.Service; @Service public class NotlageEventConsumer { private static final Logger LOGGER = LoggerFactory.getLogger(NotlageEventConsumer.class); private final NotlageService notlageService; public NotlageEventConsumer(NotlageService notlageService){ this.notlageService = notlageService; } @KafkaListener(topics = "${topics.notlage}", containerFactory = "dvpConsumerContainerFactory") public void receive(@Payload NotlageEventMessage notlageEventMessage) { switch (notlageEventMessage.payload.status) { case "ERSTELLT": notlageService.handleNotlageCreatedEvent(notlageEventMessage.payload); break; case "IN_BEAREITUNG": notlageService.handleNotlageInBearbeitungEvent(notlageEventMessage.payload); break; case "BEHOBEN": notlageService.handleNotlageGeloestEvent(notlageEventMessage.payload); break; default: LOGGER.info("Status " + notlageEventMessage.payload.status + " nicht erkannt"); break; } } }
789437af89fe9ce05e14d3d9cfe0bcac041b460f
241031721e317ceab2f9521a236762ecb943e07e
/app/src/main/java/android/csulb/edu/crisisconnect/WifiHotspotApis/ClientScanResult.java
0431883b3ba2e18469616acc2eeff16688b976f0
[]
no_license
KiranNayak29/CrisisConnect
72e0b136cfbbc9474c4f039077c4643793d4c4ca
9bab0182f7293cdd49f6432fe8b6a7e6656c0e50
refs/heads/master
2021-01-18T21:57:00.886674
2017-05-17T02:26:02
2017-05-17T02:26:02
87,031,282
0
1
null
2017-04-03T08:40:59
2017-04-03T02:20:46
Java
UTF-8
Java
false
false
1,552
java
/* * Copyright 2013 WhiteByte (Nick Russler, Ahmet Yueksektepe). * * 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 android.csulb.edu.crisisconnect.WifiHotspotApis; public class ClientScanResult implements java.io.Serializable { private String IpAddr; private String HWAddr; private String Device; private boolean isReachable; public ClientScanResult(String ipAddr, String hWAddr, String device, boolean isReachable) { super(); this.IpAddr = ipAddr; this.HWAddr = hWAddr; this.Device = device; this.isReachable = isReachable; } public String getIpAddr() { return IpAddr; } public void setIpAddr(String ipAddr) { IpAddr = ipAddr; } public String getHWAddr() { return HWAddr; } public void setHWAddr(String hWAddr) { HWAddr = hWAddr; } public String getDevice() { return Device; } public void setDevice(String device) { Device = device; } public boolean isReachable() { return isReachable; } public void setReachable(boolean isReachable) { this.isReachable = isReachable; } }
8a42ce45a70ac23f30d28f02e44bd6b07aa9ac74
b69dcc442b0631cf8457c7e606ad3c137fd268aa
/CarRR-app/src/main/java/main/facts/Malfunction.java
797af75ff0074b26ea9e39a2a9055811d1041ef3
[]
no_license
mihajlo-perendija/SBNZ
c634e093adadf5a1c6f62154b08c17a0df885694
11177c183e78e2c9fc7961b20a047552a885bf5b
refs/heads/master
2022-12-18T10:51:30.756869
2020-07-04T16:07:49
2020-07-04T16:07:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
853
java
package main.facts; import javax.persistence.*; @Entity public class Malfunction { @Id @SequenceGenerator(name="malfunction_id_seq",sequenceName="malfunction_id_seq", allocationSize=1) @GeneratedValue(strategy= GenerationType.SEQUENCE, generator="malfunction_id_seq") private Long id; @Column(name = "name") private String name; @Enumerated(EnumType.STRING) private MalfunctionType type; public Malfunction() { } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public MalfunctionType getType() { return type; } public void setType(MalfunctionType type) { this.type = type; } }
d508e85856122389d2a730b60c55aeba50aa2283
c0d80d60a0649a15fc3b6b6e597b3f64f6f68091
/seata-order-service2003/src/main/java/zwf/cloudalibaba/domain/Account.java
445e288e725b9ba0efd8d975c42607cab5efe5ed
[]
no_license
zwf-leaves/SpringCloud
12fe29d213e69ea7dd0a6554533672f8bd76dbda
4a421ddb1a394f28b0eb2488a73bbabbb81c6edd
refs/heads/master
2023-03-06T16:06:50.742492
2021-02-06T12:03:20
2021-02-06T12:03:20
336,527,547
0
0
null
null
null
null
UTF-8
Java
false
false
551
java
package zwf.cloudalibaba.domain; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import java.math.BigDecimal; /** * @author Dark * @date 2020-08-02 15:35 */ @Data @AllArgsConstructor @NoArgsConstructor public class Account { private Long id; /** * 用户id */ private Long userId; /** * 总额度 */ private BigDecimal total; /** * 已用额度 */ private BigDecimal used; /** * 剩余额度 */ private BigDecimal residue; }
1d6d0669d243b28ef1fb043fa5167ef7be662d05
f966b26f6d11fbc4e0b2188471440809b27d2da4
/springcloud-stream/eureka-stream/src/test/java/com/wpp/eurekaalone/RibbonEurekaApplicationTests.java
a316e81c312734f6deaf9e20f2bb23affdd57abb
[]
no_license
jackgeeks/springcloud-samples
557f8fab05c59fa16be68f4b063fac734db9a019
7a7305ed3054618fcacc3df2cb72dd2445548b68
refs/heads/master
2022-11-22T13:30:44.855891
2020-07-25T19:38:29
2020-07-25T19:38:29
263,635,957
0
0
null
null
null
null
UTF-8
Java
false
false
226
java
package com.wpp.eurekaalone; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class RibbonEurekaApplicationTests { @Test void contextLoads() { } }
097a244cdeffc5a29f127d76c6199cfa3c0f4ed6
5f199ef07883694f3313e7e2a845bcca400a8b23
/src/GlobalMembers.java
2d662e84833e362cabe3a928d185aecb4ffefa84
[]
no_license
akshaypoosarla/0-1-KnapSack
030103a66e967c40b2a6626a2cbdf93074971629
2fc414342d75300f1eab08ba21dc2915e851e119
refs/heads/master
2021-01-23T12:54:01.564742
2017-06-02T23:35:10
2017-06-02T23:35:10
93,210,311
3
0
null
null
null
null
UTF-8
Java
false
false
7,529
java
import java.util.Calendar; public class GlobalMembers { public static int gRefTime = 0; /********************************************************************/ /********************************************************************/ public static void SetTime() { gRefTime = GetCurrentTime(); } /********************************************************************/ public static int GetTime() { int crntTime = GetCurrentTime(); return (crntTime - gRefTime); } public static void main (String[] args) { long BFTime; long DPTime; long BTTime; long BB_UB1_Time; long BB_UB2_Time; long BB_UB3_Time; long BB_UB2En_Time; float speedup; int itemCnt; KnapsackInstance inst; //a Knapsack instance object KnapsackDPSolver DPSolver = new KnapsackDPSolver(); //dynamic programming solver KnapsackBFSolver BFSolver = new KnapsackBFSolver(); //brute-force solver KnapsackBTSolver BTSolver = new KnapsackBTSolver(); //backtracking solver KnapsackBBSolver BBSolver1 = new KnapsackBBSolver(UPPER_BOUND.UB1); //branch-and-bound solver with UB1 KnapsackBBSolver1 BBSolver2 = new KnapsackBBSolver1(UPPER_BOUND.UB2); //branch-and-bound solver with UB2 KnapsackBBSolver2 BBSolver3 = new KnapsackBBSolver2(UPPER_BOUND.UB3); //branch-and-bound solver with UB3 KnapsackBBSolver1Enhanced BBSolver2En = new KnapsackBBSolver1Enhanced(UPPER_BOUND.UB3); //branch-and-bound solver with UB3 KnapsackSolution DPSoln; KnapsackSolution BFSoln; KnapsackSolution BTSoln; KnapsackSolution BBSoln1; KnapsackSolution BBSoln2; KnapsackSolution BBSoln3; KnapsackSolution BBSoln2En; if (args.length != 1) { System.out.print("Invalid Number of command-line arguments\n"); System.exit(1); } itemCnt = Integer.parseInt(args[0]); if (itemCnt < 1) { System.out.print("Invalid number of items\n"); System.exit(1); } inst = new KnapsackInstance(itemCnt); DPSoln = new KnapsackSolution(inst); BFSoln = new KnapsackSolution(inst); BTSoln = new KnapsackSolution(inst); BBSoln1 = new KnapsackSolution(inst); BBSoln2 = new KnapsackSolution(inst); BBSoln3 = new KnapsackSolution(inst); BBSoln2En = new KnapsackSolution(inst); inst.Generate(); inst.Print(); //SetTime(); long startTime = System.nanoTime(); DPSolver.Solve(inst, DPSoln); long elapsed = System.nanoTime()-startTime; DPTime = (Long)(elapsed/1000000); System.out.println(); System.out.printf("\n\nSolved using dynamic programming (DP) in "+DPTime+"ms Optimal value = "+DPSoln.GetValue()); if (itemCnt <= DefineConstants.MAX_SIZE_TO_PRINT) { DPSoln.Print("Dynamic Programming Solution"); } //SetTime(); startTime = System.nanoTime(); BFSolver.Solve(inst,BFSoln); elapsed = System.nanoTime()-startTime; BFTime = (Long)(elapsed/1000000); System.out.println(); System.out.printf("\n\nSolved using brute-force enumeration (BF) in "+BFTime+"ms Optimal value = "+ BFSoln.GetValue()); if (itemCnt <= DefineConstants.MAX_SIZE_TO_PRINT) { BFSoln.Print("Brute-Force Solution"); } if (DPSoln.equalsTo(BFSoln)) { System.out.print("\nSUCCESS: DP and BF solutions match"); } else { System.out.print("\nERROR: DP and BF solutions mismatch"); } //SetTime(); startTime = System.nanoTime(); BTSolver.Solve(inst,BTSoln); elapsed = System.nanoTime()-startTime; BTTime = (Long)(elapsed/1000000); System.out.println(); System.out.printf("\n\nSolved using Back Tracking enumeration (Bt) in "+BTTime+"ms Optimal value = "+ BTSoln.GetValue()); if (itemCnt <= DefineConstants.MAX_SIZE_TO_PRINT) { BTSoln.Print("Backtracking Solution"); } if (BTSoln.equalsTo(BFSoln)) { System.out.print("\nSUCCESS: BF and BT solutions match"); } else { System.out.print("\nERROR: BF and BT solutions mismatch"); } speedup = (float) (BTTime == 0? 0 : 100.0 * (BFTime - BTTime) / (float)BFTime); System.out.printf("\nSpeedup of BT relative to BF is"+speedup+"percent"); startTime = System.nanoTime(); BBSolver1.Solve(inst,BBSoln1); elapsed = System.nanoTime()-startTime; BB_UB1_Time = (Long)(elapsed/1000000); System.out.printf("\n\nSolved using Branch and Bound enumeration in "+BB_UB1_Time +"ms Optimal value = "+ BBSoln1.GetValue()); if (itemCnt <= DefineConstants.MAX_SIZE_TO_PRINT) { BBSoln1.Print("BB-UB1 Solution"); } if (BFSoln.equalsTo(BBSoln1)) { System.out.print("\nSUCCESS: BF and BB-UB1 solutions match"); } else { System.out.print("\nERROR: BF and BB-UB1 solutions mismatch"); } speedup = (float) (BB_UB1_Time == 0? 0 : 100.0 * (BFTime - BB_UB1_Time) / (float)BFTime); System.out.printf("\nSpeedup of BB 1 relative to BF is"+speedup+"percent"); startTime = System.nanoTime(); BBSolver2.Solve(inst,BBSoln2); elapsed = System.nanoTime()-startTime; BB_UB2_Time = (Long)(elapsed/1000000); System.out.printf("\n\nSolved using Branch and Bound enumeration2 in "+BB_UB2_Time +"ms Optimal value = "+ BBSoln1.GetValue()); if (itemCnt <= DefineConstants.MAX_SIZE_TO_PRINT) { BBSoln1.Print("BB-UB2 Solution"); } if (BFSoln.equalsTo(BBSoln2)) { System.out.print("\nSUCCESS: BF and BB-UB2 solutions match"); } else { System.out.print("\nERROR: BF and BB-UB2 solutions mismatch"); } speedup = (float) (BB_UB1_Time == 0? 0 : 100.0 * (BFTime - BB_UB2_Time) / (float)BFTime); System.out.printf("\nSpeedup of BB 2 relative to BF is"+speedup+"percent"); startTime = System.nanoTime(); BBSolver3.Solve(inst,BBSoln3); elapsed = System.nanoTime()-startTime; BB_UB3_Time = (Long)(elapsed/1000000); System.out.printf("\n\nSolved using Branch and Bound enumeration 3 in "+BB_UB3_Time +"ms Optimal value = "+ BBSoln3.GetValue()); if (itemCnt <= DefineConstants.MAX_SIZE_TO_PRINT) { BBSoln3.Print("BB-UB3 Solution"); } if (BFSoln.equalsTo(BBSoln3)) { System.out.print("\nSUCCESS: BF and BB-UB3 solutions match"); } else { System.out.print("\nERROR: BF and BB-UB3 solutions mismatch"); } speedup = (float) (BB_UB3_Time == 0? 0 : 100.0 * (BFTime - BB_UB3_Time) / (float)BFTime); System.out.printf("\nSpeedup of BB 3 with fractional Bound relative to BF is"+speedup+"percent"); startTime = System.nanoTime(); BBSolver2En.Solve(inst,BBSoln2En); elapsed = System.nanoTime()-startTime; BB_UB2En_Time= (Long)(elapsed/1000000); System.out.printf("\n\nSolved using Branch and Bound 2 with enhancment in "+BB_UB2En_Time +"ms Optimal value = "+ BBSoln2En.GetValue()); if (itemCnt <= DefineConstants.MAX_SIZE_TO_PRINT) { BBSoln2En.Print("BB-UB2EN Solution"); } if (BFSoln.equalsTo(BBSoln2En)) { System.out.print("\nSUCCESS: BF and BB-UB2En solutions match"); } else { System.out.print("\nERROR: BF and BB-UB2En solutions mismatch"); } speedup = (float) (BB_UB2En_Time == 0? 0 : 100.0 * (BFTime - BB_UB2En_Time) / (float)BFTime); System.out.printf("\nSpeedup of BB2 withenhancement relative to BF is"+speedup+"percent"); inst = null; DPSoln = null; BFSoln = null; BTSoln = null; BBSoln1 = null; BBSoln2 = null; BBSoln3 = null; System.out.print("\n\nProgram Completed Successfully\n"); } /********************************************************************/ /*****************************************************************************/ public static int GetCurrentTime() { int crntTime = 0; crntTime = Calendar.getInstance().get(Calendar.MILLISECOND); return crntTime; } }
771f487fc9998e588990346929fc24074fbdc45c
1647bc072d206453f20410e21908f0958c7ac8f2
/app/src/main/java/ro/example/myapplication/lab1/MainActivity.java
cd65a9687a3ece11a5be12d18755cdcab0785081
[]
no_license
DobrescuAnca/LaboratorAndroid2021
cb260ca0cb70422523e243d8bac8a55ab02745f6
8c44b354204afac9b4ac9c972f38670362c9096d
refs/heads/main
2023-03-25T08:01:28.337798
2021-03-23T19:16:01
2021-03-23T19:16:01
343,522,506
1
0
null
null
null
null
UTF-8
Java
false
false
2,766
java
package ro.example.myapplication.lab1; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.AppCompatEditText; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; import ro.example.myapplication.R; public class MainActivity extends AppCompatActivity { public static final String EXTRA_MESSAGE = "MESSAGE"; private TextView textView; private Button button; private AppCompatEditText editText; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); textView = findViewById(R.id.textView); button = findViewById(R.id.button); editText = findViewById(R.id.editText); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String text = ""; if(editText.getText() != null) text = editText.getText().toString(); if(text.isEmpty()) showErrorPopup(); else gotoSecondApp(text); } }); } private void gotoSecondApp(String extra){ Intent intent = new Intent(this, SecondActivity.class); intent.putExtra(EXTRA_MESSAGE, extra); startActivity(intent); } private void gotoSecondApp2(String extra){ Intent intent = new Intent(this, SecondActivity.class); Bundle mBundle = new Bundle(); mBundle.putString(EXTRA_MESSAGE, extra); intent.putExtras(mBundle); } private void showErrorToast(){ Toast.makeText(this, getString(R.string.error_msg), Toast.LENGTH_LONG).show(); } private void showErrorPopup(){ new AlertDialog.Builder(this) .setTitle("Error") .setMessage(R.string.error_msg) // Specifying a listener allows you to take an action before dismissing the dialog. // The dialog is automatically dismissed when a dialog button is clicked. .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }) // A null listener allows the button to dismiss the dialog and take no further action. // .setNegativeButton(android.R.string.no, null) .setIcon(android.R.drawable.ic_dialog_alert) .show(); } }
36b64f6cb9bc18ed0f18f7e2891ee4b4c2928cd6
bcaad8c5a1c32842188527467009437a00d70db7
/bilo-access-android/src/main/java/ch/bitzgi/android/bluetooth/spp/Input.java
05db28aba74954feffd4446126f83190bb1b12a3
[ "Apache-2.0" ]
permissive
bilo/bilo-access
49010f59442d930d4c144e26c4e1fbdbb1a5b5f1
362b77d8f404a34b1eb6159b7a8ba6a30800932c
refs/heads/master
2021-01-01T17:34:33.412899
2019-01-06T16:57:08
2019-01-06T16:57:08
98,102,395
0
0
null
null
null
null
UTF-8
Java
false
false
361
java
/* * Copyright 2018 Urs Fässler * SPDX-License-Identifier: Apache-2.0 */ package ch.bitzgi.android.bluetooth.spp; import android.bluetooth.BluetoothDevice; import java.util.List; public interface Input { public void connect(BluetoothDevice device); public void disconnect(); public void send(List<Byte> data); public void poll(); }
761388d09ab5e70644da0867ca748dd191cd8029
3a2e106de7ae82f16b69af9b52ec6b1052a5aba6
/Core_Java/Arrays/arrays/ArraysDemo.java
6e04aa5f68bfcc88023485b094f1f49d1c6e1ff7
[]
no_license
nageshphaniraj81/BigLeapProject
d3b8ad03f9e76313a80bc0151eca6b63e101caf4
488d556dda3cba5cc4ee14cb468e22fc9e44edfc
refs/heads/master
2021-01-20T16:16:46.572634
2017-06-02T19:38:02
2017-06-02T19:38:02
90,828,501
0
0
null
null
null
null
UTF-8
Java
false
false
620
java
package arrays; public class ArraysDemo { public static void main(String[] args) { //Define array with values int [] a = {10,20,30,40,50}; // Need to provide array size int arr[] = new int[4]; arr[0] = 10; arr[1] = new Integer(20); // Autoboxing arr[2] = (int) 30.54; arr[3] = 40; try{ arr[7] = 400; }catch(ArrayIndexOutOfBoundsException e){ System.out.println("Array Index out of bound exception"); } System.out.println("Elements of the array"); for (int i : arr) { System.out.println(i); } } }
c06c2716f496717f42d510801ec3e574230d0c36
9fcc80b256c63f79c1d2bba5bf44923f32b95389
/app/src/main/java/com/android/gallery3d/data/EmptyAlbumImage.java
0eeb1909d6e5ec602b9c514badb58328e249a4f8
[]
no_license
jiyewushen/Gallery2
e0c6e1f12a9252e27951f1975b3c4c83edc9cd67
4b22b07f26d75008ab5ca34555a3bc99276aa171
refs/heads/master
2021-03-02T04:22:46.190920
2020-05-26T08:50:12
2020-05-26T08:50:12
245,837,968
0
1
null
null
null
null
UTF-8
Java
false
false
1,133
java
/* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.gallery3d.data; import com.cx.gallery3d.R; import com.android.gallery3d.app.GalleryApp; public class EmptyAlbumImage extends ActionImage { @SuppressWarnings("unused") private static final String TAG = "EmptyAlbumImage"; public EmptyAlbumImage(Path path, GalleryApp application) { super(path, application, R.drawable.placeholder_empty); } @Override public int getSupportedOperations() { return super.getSupportedOperations() | SUPPORT_BACK; } }
6b949c28413494ec4e39e422253c670369e33d29
3b5683cfdd1297aea683241e0c301a8c0dc03c06
/app/src/main/java/com/wtho/mealordering/MealOrderingApp.java
b87ab38bfae1eed92d521a43eded91b65a455973
[]
no_license
waithethtetoo/Meal-Order-App
ce1a6cc05dc7d8474008c31079715d7ca75add83
02894efed0afcd5dff04d4e501e139bd03ad3e6c
refs/heads/master
2020-09-22T18:03:58.399340
2016-08-31T05:05:00
2016-08-31T05:05:00
66,764,064
0
0
null
null
null
null
UTF-8
Java
false
false
595
java
package com.wtho.mealordering; import android.app.Application; import android.content.Context; import com.wtho.mealordering.data.agent.retrofit.RetrofitDataAgent; /** * Created by WT on 8/19/2016. */ public class MealOrderingApp extends Application { public static final String TAG = "MealOrderingApp"; private static Context context; @Override public void onCreate() { super.onCreate(); context = getApplicationContext(); RetrofitDataAgent.getInstance().loadMeals(); } public static Context getContext() { return context; } }
[ "Mobile" ]
Mobile
91a579345a890814970908f65904c7038665e3e9
2c50ee714f0046b043b2aea225e0a3910c989cd4
/ThingsNear/app/src/main/java/se/karllundstig/thingsnear/ImagePostActivity.java
55dde133071a4ab86e7489bf5980721b44b9d854
[]
no_license
lundstig/thingsnear
6abce9fd634f98027351e604036cb76b67f68354
a9420b27ad8ff92a500a2391d3d259ae1dd34e56
refs/heads/master
2021-06-24T19:18:03.134299
2016-03-24T13:13:11
2016-03-24T13:13:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,112
java
package se.karllundstig.thingsnear; import android.app.ProgressDialog; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.location.Location; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.text.Editable; import android.text.TextWatcher; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; import android.widget.Toast; import org.json.JSONException; import org.json.JSONObject; public class ImagePostActivity extends AppCompatActivity { Context context; Location location; String imagePath; ImageView imageView; EditText editText; Button submit; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_image_post); context = this; imageView = (ImageView)findViewById(R.id.imageView); editText = (EditText)findViewById(R.id.editText); submit = (Button)findViewById(R.id.submit); location = getIntent().getExtras().getParcelable("location"); imagePath = getIntent().getExtras().getString("imagePath"); //Visar bilden vi ska ladda upp Bitmap myBitmap = BitmapFactory.decodeFile(imagePath); imageView.setImageBitmap(myBitmap); editText.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) {} @Override public void afterTextChanged(Editable s) {} @Override public void onTextChanged(CharSequence s, int start, int before, int count) { if (s.toString().equals("")) { submit.setEnabled(false); } else { submit.setEnabled(true); } } }); submit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final ProgressDialog progress = new ProgressDialog(context); progress.setTitle("Loading"); progress.setMessage("Submitting post..."); progress.setCancelable(false); progress.show(); new Thread(new Runnable() { @Override public void run() { try { final NetQueue netQueue = NetQueue.getInstance(context); final String response = FileUploader.sendFile(netQueue.getServer() + "/images/", imagePath, netQueue.getToken(), "image", "image/jpeg"); final JSONObject res = new JSONObject(response); if (!res.getBoolean("success")) { runOnUiThread(new Runnable() { @Override public void run() { try { Toast.makeText(context, res.getString("error"), Toast.LENGTH_LONG).show(); } catch (JSONException e) { e.printStackTrace(); Toast.makeText(context, "Unknown error", Toast.LENGTH_LONG).show(); } } }); } else { final String image = res.getString("image"); runOnUiThread(new Runnable() { @Override public void run() { JSONObject body = new JSONObject(); try { body.put("latitude", location.getLatitude()); body.put("longitude", location.getLongitude()); body.put("content", editText.getText()); body.put("image", image); } catch (JSONException e) { e.printStackTrace(); } netQueue.post("/feed", body, new NetQueue.RequestCallback() { @Override public void onFinished(JSONObject result) { finish(); } @Override public void onError(String error) { Toast.makeText(context, error, Toast.LENGTH_LONG).show(); } @Override public void onFinally() { progress.dismiss(); } }); } }); } } catch (Exception err) { final Exception e = err; e.printStackTrace(); runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(context, e.toString(), Toast.LENGTH_LONG).show(); } }); } } }).start(); } }); } }
b6f7388d1c88428582a7bee6db07eb08836ebabd
3b967d8e31e2c438d6780ec3028f2f387e418d7a
/WRO_JAV_S_01_M2_JEE_MySQL/a_Zadania/a_Dzien_2/c_Relacje_1_1/Main3.java
29aecd8a036179b83fe0b0b25665efeb1fd45ea4
[]
no_license
karolkapral/CodersLab
f92222a43c1e5618b190c98a2a03c4a49d8e847e
bf0d49662a5fb2ead6727dced77a7086ddbdd8a6
refs/heads/master
2021-05-14T18:59:33.440188
2017-12-14T15:28:50
2017-12-14T15:28:50
116,096,431
1
0
null
2018-01-03T05:42:51
2018-01-03T05:42:50
null
UTF-8
Java
false
false
212
java
package a_Zadania.a_Dzien_2.c_Relacje_1_1; public class Main3 { //zapisz poniżej zapytanie tworzące tabelę - pamiętaj o relacji i dodaniu odpowiedniej kolumny public String queryCreateTable = ""; }
39f407ad986784549875172ca8c185cf55f08314
c2091a77af5174dc04426414d76a2c3f474fcaae
/spring-data-rest-repository/src/main/java/org/springframework/data/rest/repository/RepositoryMetadata.java
c941c3d6b30c951149a7dce6f94a5d624fa9d1e5
[ "Apache-2.0" ]
permissive
fvarg00/spring-data-rest
4661913a46bbd289612b8ba067e8e7aeba2f7498
269d6f5983b73971f7a7a70dc409a520a8d8421c
refs/heads/master
2021-01-18T12:01:05.077404
2012-11-27T16:43:22
2012-11-27T16:43:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,328
java
package org.springframework.data.rest.repository; import java.io.Serializable; import java.lang.reflect.Method; import java.util.Map; import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.Repository; import org.springframework.data.rest.repository.invoke.CrudMethod; import org.springframework.data.rest.repository.invoke.RepositoryQueryMethod; /** * Encapsulates necessary metadata about a {@link Repository}. * * @author Jon Brisbin <[email protected]> */ public interface RepositoryMetadata<E extends EntityMetadata<? extends AttributeMetadata>> { /** * The name this {@link Repository} is exported under. * * @return Name used in the URL for this Repository. */ String name(); /** * Get the string value to be used as part of a link {@literal rel} attribute. * * @return Rel value used in links. */ String rel(); /** * The type of domain object this {@link Repository} is repsonsible for. * * @return Type of the domain class. */ Class<?> domainType(); /** * The Class of the {@link Repository} subinterface. * * @return Type of the Repository being proxied. */ Class<?> repositoryClass(); /** * The {@link Repository} instance. * * @return The actual {@link Repository} instance. */ CrudRepository<Object, Serializable> repository(); /** * The {@link EntityMetadata} associated with the domain type of this {@literal Repository}. * * @return EntityMetadata associated with this Repository's domain type. */ E entityMetadata(); /** * Get a {@link org.springframework.data.rest.repository.invoke.RepositoryQueryMethod} by key. * * @param key * Segment of the URL to find a query method for. * * @return Found {@link org.springframework.data.rest.repository.invoke.RepositoryQueryMethod} or {@literal null} if * none found. */ RepositoryQueryMethod queryMethod(String key); /** * Get a Map of all {@link RepositoryQueryMethod}s, keyed by name. * * @return All query methods for this Repository. */ Map<String, RepositoryQueryMethod> queryMethods(); /** * Does this Repository all this method to be exported? * * @param method * * @return */ Boolean exportsMethod(CrudMethod method); }
7a95fb66293b74850a507789e2cd3dbe3255889d
875c7a5b02d109a43f532f5da395698cdb2a90ab
/src/main/java/com/yahoo/bullet/bql/tree/Stream.java
fc7f3f32754e6aed06b757245bb5f964dc05f2cc
[ "Apache-2.0", "LicenseRef-scancode-free-unknown", "LicenseRef-scancode-unknown-license-reference" ]
permissive
0aix/bullet-bql
8592884678a0580f5e7998704f107cbc9273ee6d
4344a42731f85e20e92fa221c6a15b544dfba00e
refs/heads/master
2020-03-28T18:02:30.917997
2018-09-28T20:29:22
2018-09-28T20:29:22
148,847,108
0
0
Apache-2.0
2018-09-14T22:17:38
2018-09-14T22:17:37
null
UTF-8
Java
false
false
3,131
java
/* * Copyright 2018, Oath Inc. * Licensed under the terms of the Apache License, Version 2.0. * See the LICENSE file associated with the project for terms. */ package com.yahoo.bullet.bql.tree; import com.google.common.collect.ImmutableList; import java.util.List; import java.util.Objects; import java.util.Optional; import static com.google.common.base.MoreObjects.toStringHelper; import static java.util.Objects.requireNonNull; public class Stream extends QueryBody { private final Optional<String> timeDuration; private final Optional<String> recordDuration; /** * Constructor that requires an Optional of String timeDuration and an Optional of String recordDuration. * * @param timeDuration An Optional of String. * @param recordDuration An Optional of String. */ public Stream(Optional<String> timeDuration, Optional<String> recordDuration) { this(Optional.empty(), timeDuration, recordDuration); } /** * Constructor that requires a {@link NodeLocation}, an Optional of String timeDuration and an Optional of String recordDuration. * * @param location A {@link NodeLocation}. * @param timeDuration An Optional of String. * @param recordDuration An Optional of String. */ public Stream(NodeLocation location, Optional<String> timeDuration, Optional<String> recordDuration) { this(Optional.of(location), timeDuration, recordDuration); } private Stream(Optional<NodeLocation> location, Optional<String> timeDuration, Optional<String> recordDuration) { super(location); this.timeDuration = requireNonNull(timeDuration, "timeDuration is null"); this.recordDuration = requireNonNull(recordDuration, "recordDuration is null"); } /** * Get the {@link #timeDuration} of this Stream. * * @return An Optional of String. */ public Optional<String> getTimeDuration() { return timeDuration; } /** * Get the {@link #recordDuration} of this Stream. * * @return An Optional of String. */ public Optional<String> getRecordDuration() { return recordDuration; } @Override public <R, C> R accept(ASTVisitor<R, C> visitor, C context) { return visitor.visitStream(this, context); } @Override public List<Node> getChildren() { return ImmutableList.of(); } @Override public String toString() { return toStringHelper(this) .add("timeDuration", timeDuration) .add("recordDuration", recordDuration) .toString(); } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Stream obj = (Stream) o; return Objects.equals(timeDuration, obj.timeDuration) && Objects.equals(recordDuration, obj.recordDuration); } @Override public int hashCode() { return Objects.hash(timeDuration, recordDuration); } }
24a2c2f3f14e414b38231cf9aedea60c59e37061
122dec92d292d8aecf47dde4b33923910424e1c8
/src/main/java/br/com/zupacademy/guzzo/proposta/comunincasistemaexternocartao/RetornoCartaoResourceDto.java
5c3dcd4163a97f6f9c2a0c985de7bbd1438dee1b
[ "Apache-2.0" ]
permissive
rafaelguzzozup/orange-talents-05-template-proposta
371f446e07e7d9dcd5a546b40e298a6e08226680
5545229728718d87202be8dc51bcdea248f0f060
refs/heads/main
2023-06-01T19:25:09.265498
2021-06-16T22:12:34
2021-06-16T22:12:34
373,924,749
0
0
Apache-2.0
2021-06-04T18:09:43
2021-06-04T18:09:43
null
UTF-8
Java
false
false
1,424
java
package br.com.zupacademy.guzzo.proposta.comunincasistemaexternocartao; import java.math.BigDecimal; import java.time.LocalDateTime; import br.com.zupacademy.guzzo.proposta.cadastracartao.Cartao; import br.com.zupacademy.guzzo.proposta.novaproposta.Proposta; import br.com.zupacademy.guzzo.proposta.validator.UnicoRegistro; public class RetornoCartaoResourceDto { @UnicoRegistro(entidade = Cartao.class, atributo = "id") private String id; private LocalDateTime emitidoEm; private String titular; private BigDecimal limite; private Long idProposta; private VencimentoCartaoDto vencimento; public RetornoCartaoResourceDto(String id, LocalDateTime emitidoEm, String titular, BigDecimal limite, Long idProposta, VencimentoCartaoDto vencimento) { this.id = id; this.emitidoEm = emitidoEm; this.titular = titular; this.limite = limite; this.idProposta = idProposta; this.vencimento = vencimento; } public Cartao converterParaCartao(Proposta proposta) { return new Cartao(id, emitidoEm, titular, limite, vencimento.converterParaVencimento(), proposta); } public String getId() { return id; } public LocalDateTime getEmitidoEm() { return emitidoEm; } public String getTitular() { return titular; } public BigDecimal getLimite() { return limite; } public Long getIdProposta() { return idProposta; } public VencimentoCartaoDto getVencimento() { return vencimento; } }
c47c0bd2e3e020f50ce6adca46110d81af46632c
a10c3f1e9643cda11c7ae577ba7b668b20a5f86e
/src/main/java/br/com/loja/models/Price.java
21d9fc4d9a4ec9dbfb447a6dedb8230a8ba11911
[]
no_license
murilofidelis/Loja_de_Livros
4fef307696629f6d8fb9c8c87a14acec49f8269e
331f8a1d77854b40a7e08699c7e932cb08e8481b
refs/heads/master
2020-08-30T10:15:04.663989
2017-06-15T22:25:08
2017-06-15T22:25:08
94,389,423
1
0
null
null
null
null
UTF-8
Java
false
false
497
java
package br.com.loja.models; import java.math.BigDecimal; import javax.persistence.Column; import javax.persistence.Embeddable; @Embeddable public class Price { @Column(scale = 2) private BigDecimal value; private BookType bookType; public BigDecimal getValue() { return value; } public void setValue(BigDecimal value) { this.value = value; } public BookType getBookType() { return bookType; } public void setBookType(BookType bookType) { this.bookType = bookType; } }
5948c52aae1a5ce137572f9f589b0c5f56286a66
411e0c52361f21bb8aa297e3b4f6341f24b018b2
/2000/Graph/6/Graph3dIldarA14/Piace.java
8e8ddbbd799c01cd482dced6eaab609c04ee8e69
[]
no_license
ildar66/myGraph3DI
47340b5d56ee6d14feac513d5a9377e5700e69d5
9165adf92c15aeb8e2e1700e61af2da5afc50a37
refs/heads/master
2020-12-02T23:54:19.148533
2017-07-01T11:13:10
2017-07-01T11:13:10
95,959,207
0
0
null
null
null
null
WINDOWS-1251
Java
false
false
22,124
java
import java.awt.event.*; import java.util.*; import java.applet.*; import java.awt.*; public class Piace extends Applet implements MouseListener, MouseMotionListener, KeyListener { Vector points3D = new Vector(); //Вектор физических точек(3D). Vector figures = new Vector(); //Вектор всех фигур апплета. Figure figure; //Текущая фигура. Point offset; //Начало отсчета. Element select; //Текущий элемент. Side copy; //Используется для сохранения текущей стороны(Side). Matrix3D matrix = new Matrix3D(); //Для динамики мира точек3D int tab, x0, y0, kind, step; //tab-для навигации по элементам мира;kind-вид элемента;step-перемещение элемента по осям.(x0,y0)-последняя записанная точка float turn, turnSum, rotate; //turn-приращение угола поворота,turnSum-угол поворота в reconstruct_A. int tab_add = 1; //для навигации по элементам. floatPanel FP; //red?панель инструментов. boolean full; //заполненность Элементов. Color color = Color.black; //цвет Элементов. Rectangle rect = new Rectangle(0, 0, 10, 10); //следует за нажатием мыши. Image offScreenImage; //для двойной буферизации. Graphics offScreen; //для двойной буферизации. public void init() { addMouseMotionListener(this); addMouseListener(this); addKeyListener(this); figures.addElement(figure = new Figure(this, kind, color, full)); figure.elements.addElement(select = new Side(this, kind, color, full)); setBackground(Color.white); rotate = step = 3; //? FP = new floatPanel(this, "Float Panel"); //red offScreenImage = createImage(getSize().width, getSize().height); offScreen = offScreenImage.getGraphics(); } public void mousePressed(MouseEvent e) { int x = e.getX(), y = e.getY(); rect.translate(x - rect.x - 5, y - rect.y - 5); //new Shade.mouseDown(this, x, y); if (offset == null) offset = new Point(x, y); if(select.field.size() == 0) {SavePoint3D(numberPoint(x, y) , x, y); x0 = x; y0 = y;} repaint(x-5, y-5, 10, 10); } public void mouseDragged(MouseEvent e) //new show Shade.java { int x = e.getX(), y = e.getY(); rect.translate(x - rect.x - 5, y - rect.y - 5); if (((select.kind == Element.freeLine)||(select.kind == Element.freePoly))&&(!(rect.contains(x0, y0)))) {SavePoint3D(numberPoint(x, y) , x, y); x0 = x; y0 = y;} Shade.mouseDrag(this, x, y); } public void mouseReleased(MouseEvent e) { int x = e.getX(), y = e.getY(); rect.translate(x - rect.x - 5, y - rect.y - 5); //new if(!rect.contains(x0, y0)) //new SavePoint3D(numberPoint(x, y) , x, y); Rectangle rec = select.getShade(offset, "view Face").getBounds(); repaint(rec.x-5, rec.y-5, rec.width+10, rec.height+10); Shade.mouseUp(this); } public void mouseMoved(MouseEvent e) {} public void mouseEntered(MouseEvent e) {} public void mouseExited(MouseEvent e) {} public void mouseClicked(MouseEvent e) {} public void SavePoint3D(int i, int x, int y) { select.add(i); if(i == points3D.size())//если точка новая, то: { points3D.addElement(new Point3D(x - offset.x, y - offset.y, 0));//current? figure.add(i); } } public int numberPoint(int x, int y) { rect.translate(x - rect.x - 5, y - rect.y - 5); if(select instanceof Side) for (int i = points3D.size()-1; i >= 0 ; i--) { x = Math.round(((Point3D)points3D.elementAt(i)).x) + offset.x; y = Math.round(((Point3D)points3D.elementAt(i)).y) + offset.y; if (rect.contains(x, y)) return i; } return points3D.size(); } public void message() {System.out.println("3Dpoints:"+points3D.size()+";sides:"+figure.elements.size()+";select:"+select.field.size()+";figure:"+figure.field.size());} public void keyTyped(KeyEvent e) { char key = e.getKeyChar(); if ((key == 'e')&&(select.field.size() != 0)) {newElement();} if ((key == 's')&&(select.field.size() != 0)) {newSide(); } if ((key == 'f')&&(select.field.size() != 0)) {newFigure(); } if ((key == e.VK_TAB) && !e.isControlDown() && !e.isShiftDown() && (select.field.size() != 0)) {nextSide();} if ((key == e.VK_TAB) && e.isControlDown() && (select.field.size() != 0)) {nextElement();} if ((key == e.VK_TAB) && e.isShiftDown() && (select.field.size() != 0)) {nextFigure();} if (key == '+') {tab_add = 1; rotate = Math.abs(rotate); step = Math.abs(step);} if (key == '-') {tab_add = -1; rotate = - Math.abs(rotate); step = -Math.abs(step);} if (key == '*') {tab_add = - tab_add; rotate = - rotate; step = - step;} if ((key == 'c')&&(select.field.size() > 1)) {copy(select);} if ((key == 'C') && (select.field.size() > 1)) {copy(figure);} if (key == 'd') {delete(select);} if ((key == 'D')&&(select.field.size() != 0)&&(figures.size() > 1)) {delete(figure);} if ((key == 'A')&&(turnSum < 360)&&(select.field.size() != 0)) {reconstruct_A(select);} if ((key == 'L')&&(select instanceof Side)&&(select.field.size() != 0)) {face((Side)select, false);} if ((key == 'l')&&(select instanceof Side)&&(select.field.size() != 0)) {face((Side)select, true);} if ((key == 'n')&&(select.field.size() != 0)) {next_offset();} if (key == 'x') rotate("X", figure); if (key == 'y') rotate("Y", figure); if (key == 'z') rotate("Z", figure); if (key == 'X') { matrix.identity(); matrix.rotate(rotate,"X", false);for (int i=0; i<points3D.size(); i++) matrix.transform((Point3D)points3D.elementAt(i));} if (key == 'Y') { matrix.identity(); matrix.rotate(rotate,"Y", false);for (int i=0; i<points3D.size(); i++) matrix.transform((Point3D)points3D.elementAt(i));} if (key == 'Z') { matrix.identity(); matrix.rotate(rotate,"Z", false);for (int i=0; i<points3D.size(); i++) matrix.transform((Point3D)points3D.elementAt(i));} if (key == '1') rotate("X", select); if (key == '2') rotate("Y", select); if (key == '3') rotate("Z", select); if (key == '4') translate(select, step, 0, 0); if (key == '5') translate(select, 0, step, 0); if (key == '6') translate(select, 0, 0, step); if ((key == '7')&&(select instanceof Side)) {copy = (Side)select; copy.normal_Left = !(copy.normal_Left);} if (key == '8') translate(figure, step, 0, 0); if (key == '9') translate(figure, 0, step, 0); if (key == '0') translate(figure, 0, 0, step); if (key == 'm') message(); if(select.field.size() != 0) Shade.mouseUp(this); repaint(); // else return; } public void keyPressed(KeyEvent e) { int key = e.getKeyCode(); if ((key == e.VK_UP) && !e.isControlDown() && !e.isShiftDown()) {offset = new Point(offset.x, offset.y - step);} if ((key == e.VK_DOWN) && !e.isControlDown() && !e.isShiftDown()) {offset = new Point(offset.x, offset.y + step);} if ((key == e.VK_LEFT) && !e.isControlDown() && !e.isShiftDown()) {offset = new Point(offset.x - step, offset.y);} if ((key == e.VK_RIGHT) && !e.isControlDown() && !e.isShiftDown()) {offset = new Point(offset.x + step, offset.y);} if ((key == e.VK_UP)&& e.isControlDown()) {scale(select, 1f, 1.1f, 1f);} if ((key == e.VK_DOWN)&& e.isControlDown()) {scale(select, 1f, 1f/1.1f, 1f);} if ((key == e.VK_RIGHT)&& e.isControlDown()) {scale(select, 1.1f, 1f, 1f);} if ((key == e.VK_LEFT)&& e.isControlDown()) {scale(select, 1f/1.1f, 1f, 1f);} if ((key == e.VK_UP)&& e.isShiftDown()) {scale(figure, 1f, 1.1f, 1f);} if ((key == e.VK_DOWN)&& e.isShiftDown()) {scale(figure, 1f, 1f/1.1f, 1f);} if ((key == e.VK_RIGHT)&& e.isShiftDown()) {scale(figure, 1.1f, 1f, 1f);} if ((key == e.VK_LEFT)&& e.isShiftDown()) {scale(figure, 1f/1.1f, 1f, 1f);} if (key == e.VK_PAGE_UP) {scale(figure, 1.1f, 1.1f, 1.1f);} if (key == e.VK_PAGE_DOWN) {scale(figure, 1f/1.1f, 1f/1.1f, 1f/1.1f);} if ((key == e.VK_DELETE)&&(points3D.size() != 0)) {deletelast3D(select);} //System.out.println(e); if ((key == e.VK_ESCAPE)&&(points3D.size() != 0)) {escape();FP.setControl();} if(select.field.size() != 0) Shade.mouseUp(this); repaint(); // else return; } public void keyReleased(KeyEvent e) {} /////////////////////////////////////////////////////////Блок удаления элементов: public void delete(Element e)//new metod 1.1 { while(e.field.size() != 0) deletelast3D(e); while(e.elements.size() != 0) { delete((Element)e.elements.lastElement()); e.elements.removeElement((Element)e.elements.lastElement()); } } public void deletelast3D(Element e) { if(e.field.size() != 0) { int t = ((Integer)e.field.lastElement()).intValue(); e.field.removeElement((Integer)e.field.lastElement()); if(!reference(t)) deletePoint3D(t); } } public void deletePoint3D(int t)//new2.1 { points3D.removeElementAt(t); for (int i=0; i<figures.size(); i++) trim3D(t, (Figure)figures.elementAt(i)); } public void trim3D(int t, Element elem) //new2.2 { elem.field.removeElement(new Integer(t)); for (int k=0, n=0; k<elem.field.size(); k++) { n = ((Integer)elem.field.elementAt(k)).intValue(); if(n>t) elem.field.setElementAt(new Integer(n-1), k); } for (int i=0; i<elem.elements.size(); i++) trim3D(t, (Element)elem.elements.elementAt(i)); } public boolean reference(int t) { for (int i=0; i<figures.size(); i++) { Figure figure = (Figure)figures.elementAt(i); for (int k=0; k<figure.elements.size(); k++) { Side side = (Side)figure.elements.elementAt(k); for (int m=0, n=0; m<side.field.size(); m++) { n = ((Integer)side.field.elementAt(m)).intValue(); if(n==t) return true; } } } return false; } public void escape()//new metod 3.1 { if((select.field.size() == 0)&&(points3D.size() != 0)) { if((select instanceof Side)&&((figures.size() != 1)||(figure.elements.size()!=1))) { figure.elements.removeElement(select); } else if(select instanceof Element) { copy.elements.removeElement(select); } if((figure.elements.size() == 0)&&(figures.size() > 1)) { figures.removeElement(figure); figure = (Figure)figures.lastElement(); } select = (Side)figure.elements.lastElement(); } } ///////////////////////////////////////////////////////Блок копирования элементов: public void copy(Element e) { Hashtable hash = new Hashtable(); copyElement(e, hash); } public void copyElement(Element e, Hashtable hash) { if(e instanceof Figure) { figures.addElement(figure = new Figure(this, e.kind, e.color, e.full)); for (int i=0; i<e.elements.size(); i++) copyElement((Side)e.elements.elementAt(i), hash); } else if(e instanceof Side) { figure.elements.addElement(select = new Side(this, e.kind, e.color, e.full)); copyPoint3D(e.field, hash); copy = (Side)select; for (int i=0; i<e.elements.size(); i++) copyElement((Element)e.elements.elementAt(i), hash); } else if(e instanceof Element) { copy.elements.addElement(select = new Element(this, e.kind, e.color, e.full)); copyPoint3D(e.field, hash); } } public void copyPoint3D(Vector vector, Hashtable hash) { for (int i=0, t=0, n=0; i<vector.size(); i++) { t = ((Integer)vector.elementAt(i)).intValue(); if((select instanceof Side)&&(hash.containsKey(new Integer(t)))) //если существующая точка стороны нового эл-та ,то: select.add(((Integer)hash.get(new Integer(t))).intValue()); else { n = points3D.size(); select.add(n); figure.add(n); hash.put(new Integer(t), new Integer(n)); points3D.addElement(Point3D.copy((Point3D)points3D.elementAt(t))); } } } ///////////////////////////////////////////////////////Блок создания элементов: public void newElement() { if(select instanceof Side) copy = (Side)select; copy.elements.addElement(select = new Element(this, kind, color, full)); message(); } public void newSide() { figure.elements.addElement(select = new Side(this, kind, color, full)); message(); } public void newFigure() { figures.addElement(figure = new Figure(this, kind, Color.black, full)); figure.elements.addElement(select = new Side(this, kind, color, full)); message(); } //////////////////////////////////////////////////Блок навигации по элементам: public void next_offset() { next(select.field); int t = ((Integer)select.field.elementAt(tab)).intValue(); Point3D p = (Point3D)points3D.elementAt(t); offset.translate((int)p.x, (int)p.y);//new matrix.identity(); matrix.translate(-p.x, -p.y, -p.z); for (int i=0; i<points3D.size(); i++) matrix.transform((Point3D)points3D.elementAt(i)); } public void nextSide() { next(figure.elements); select = (Side)figure.elements.elementAt(tab); FP.setControl(); Shade.mouseUp(this); } public void nextElement() { if(select instanceof Side) copy = (Side)select; if(copy.elements.size() == 0) return; next(copy.elements); select = (Element)copy.elements.elementAt(tab); FP.setControl(); Shade.mouseUp(this); } public void nextFigure() { next(figures); figure = (Figure)figures.elementAt(tab); select = (Side)figure.elements.elementAt(0); FP.setControl(); Shade.mouseUp(this); } public void next(Vector vector) { tab = Math.min(Math.max(0, tab + tab_add), vector.size()-1); if(tab == vector.size()-1) tab_add = -1; else if(tab == 0) tab_add = 1; } //////////////////////////////////////////////////////Блок реконструкции элементов: public void reconstruct_A(Element elem) { float xc, yc, zc; int k = select.field.size(); matrix.identity(); matrix.rotate(turn, "Z", false); for (int i=0,t=0; i<k; i++) { t = ((Integer)select.field.elementAt(i)).intValue(); select.add(points3D.size()); figure.add(points3D.size()); points3D.addElement(matrix.transform(Point3D.copy((Point3D)points3D.elementAt(t)))); } turnSum += turn; turn *= 2.0f; } ///////////////////////////////////////////////////////Блок вращения элементов: public void rotate(String axis, Element e) { matrix.identity(); matrix.rotate(rotate, axis, false); transform(matrix, e.field); if((e instanceof Side)&&(!(e instanceof Figure))) //else if??? for (int k=0; k<e.elements.size(); k++) { Element elem =(Element)e.elements.elementAt(k); rotate(axis, elem); } } ///////////////////////////////////////////////////////Блок перемещения элементов: public void translate(Element e, int dx, int dy, int dz) { matrix.identity(); matrix.translate(dx, dy, dz); transform(matrix, e.field); if((e instanceof Side)&&(!(e instanceof Figure))) //else if??? for (int k=0; k<e.elements.size(); k++) { Element elem =(Element)e.elements.elementAt(k); translate(elem, dx, dy, dz); } } ///////////////////////////////////////////////////////Блок масштабирования элементов: public void scale( Element e, float x, float y, float z) { matrix.identity(); matrix.scale(x, y, z); transform(matrix, e.field); if((e instanceof Side)&&(!(e instanceof Figure))) //else if ??? for (int k=0; k<e.elements.size(); k++) { Element elem =(Element)e.elements.elementAt(k); scale(elem, x, y, z); } } ///////////////////////////////////////////////////////Блок "face" сторон фигуры. public void face(Side side, boolean alone) { Vector3D nV = side.normal(); matrix.identity(); matrix.rotate(Math.atan2(nV.z, nV.x),"Y", true); matrix.rotate(-Math.atan2(nV.y, Math.sqrt(nV.x*nV.x + nV.z*nV.z)),"Z", true); matrix.rotate(Math.PI/2, "Y", true); if(alone) { transform(matrix, side.field); for (int k=0; k<side.elements.size(); k++) transform(matrix, ((Element)side.elements.elementAt(k)).field); } else transform(matrix, figure.field); } ///////////////////////////////////////////////////////общий Блок: public void transform(Matrix3D m, Vector v) //метод, вызываемый после изменения СК { for (int i=0, t=0; i<v.size(); i++) { t = ((Integer)v.elementAt(i)).intValue(); m.transform((Point3D)points3D.elementAt(t)); } } ///////////////////////////////////////////////////////Блок для рисования элементов: public void update(Graphics g) //start new text: { offScreen.setColor(getBackground()); offScreen.fillRect(0, 0, getSize().width, getSize().height); paint(offScreen); g.drawImage(offScreenImage, 0, 0, this); FP.repaint(); // requestFocus(); //end new metod; } public void paint(Graphics g) { for (int i=0; i<figures.size(); i++) { Figure figure = (Figure)figures.elementAt(i); sort(figure.elements); figure.draw(g, offset, "view Face"); if(figure.net) { g.setColor(Color.black); for(i=0; i<figure.elements.size(); i++) net(g, ((Side)figure.elements.elementAt(i)).field); } } if (offset != null) { g.setColor(Color.black); g.fillOval(offset.x - 3, offset.y - 3, 6, 6);} if (select instanceof Side) { g.setColor(Color.red); net(g, select.field);} else if(select instanceof Element) { g.setColor(Color.green); net(g, copy.field);} if (select.field.size() != 0) { int t = ((Integer)select.field.lastElement()).intValue(); Point3D p = (Point3D)points3D.elementAt(t); g.drawOval(offset.x + Math.round(p.x) - 3, offset.y + Math.round(p.y) - 3, 6, 6); } } public void net(Graphics g, Vector vector) { int t, xs, ys; for (int i=0; i<vector.size(); i++) { t = ((Integer)vector.elementAt(i)).intValue(); Point3D p = (Point3D)points3D.elementAt(t); g.drawOval(offset.x + Math.round(p.x) - 5, offset.y + Math.round(p.y) - 5, 10, 10); } } public void sort(Vector v) { int j = v.size(); while(--j > 0) { for (int i=0; i<j; i++) { if (((Side)v.elementAt(i)).weight() < ((Side)v.elementAt(i+1)).weight()) { Side temp = (Side)v.elementAt(i); v.setElementAt((Side)v.elementAt(i+1), i); v.setElementAt(temp, i+1); } } } } }
7794155dce8e9e70e58226b7d7cbff18c25ba0fd
64a77c116480606048df5c916c3065a506e96f54
/src/main/java/com/jeeps/smartlandvault/nosql/merged_container/MergedContainerRepository.java
a6aa93a0e3f2ce2174e7e297e53ec153a636e5f4
[]
no_license
JamesJose7/smartland-vault
8f40feafef899e61d7e090002a336b2ad1648471
b1c506b1293534863091a2d3db2f91cd529aa6c2
refs/heads/master
2020-11-27T07:29:21.151294
2020-10-07T01:36:56
2020-10-07T01:36:56
229,354,764
0
0
null
null
null
null
UTF-8
Java
false
false
324
java
package com.jeeps.smartlandvault.nosql.merged_container; import org.springframework.data.mongodb.repository.MongoRepository; import org.springframework.data.rest.core.annotation.RepositoryRestResource; @RepositoryRestResource public interface MergedContainerRepository extends MongoRepository<MergedContainer, String> { }
71bfc1232bd2e2cafcc2e9ab1b5546de3c3640e4
a1233182985e1b4ee41d042a7cecd093789d6fef
/junit/com/neurogrid/simulation/root/ResourceLimitedNodeTest.java
6c68a814e0ed1361183d324aa1f0481fb4993cd7
[]
no_license
graybird/P2P1
90bde4fef1374ea3e80c836739db735536a520fb
03f3531b938becb4b6841936d2392f11931d3ae9
refs/heads/master
2020-05-19T05:13:09.153358
2014-09-18T12:45:51
2014-09-18T12:45:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
17,305
java
package com.neurogrid.simulation.root; import junit.framework.TestCase; // JUnitDoclet begin import import com.neurogrid.simulation.root.ResourceLimitedNode; import com.neurogrid.simulation.SimpleDocument; import com.neurogrid.simulation.NeuroGridNode; import com.neurogrid.simulation.NeuroGridNetwork; import com.neurogrid.simulation.root.Message; import com.neurogrid.simulation.root.Document; import com.neurogrid.simulation.root.Keyword; import com.neurogrid.simulation.root.Node; import java.util.Iterator; import java.util.Vector; import java.util.Map; import java.util.Random; // JUnitDoclet end import /** * Generated by JUnitDoclet, a tool provided by * ObjectFab GmbH under LGPL. * Please see www.junitdoclet.org, www.gnu.org * and www.objectfab.de for informations about * the tool, the licence and the authors. */ public class ResourceLimitedNodeTest // JUnitDoclet begin extends_implements extends TestCase // JUnitDoclet end extends_implements { // JUnitDoclet begin class com.neurogrid.simulation.root.ResourceLimitedNode resourcelimitednode = null; private static final int MAX_NO_CONNS = 2; private static final int MIN_NO_CONNS = 2; // JUnitDoclet end class public ResourceLimitedNodeTest(String name) { // JUnitDoclet begin method ResourceLimitedNodeTest super(name); ResourceLimitedNode.init(System.getProperty("Log4jConfig")); // JUnitDoclet end method ResourceLimitedNodeTest } public com.neurogrid.simulation.root.ResourceLimitedNode createInstance() throws Exception { // JUnitDoclet begin method testcase.createInstance return new ResourceLimitedNode(MAX_NO_CONNS,MIN_NO_CONNS,2) { public boolean processMessage(Message p_message) throws Exception { return false;} public boolean processMessage(Message p_message, boolean p_start) throws Exception { return false;} public boolean addMessageToInbox(Message p_message) throws Exception { return false;} public void doGraphics(){} public void doGraphics2(){} public String toString() { StringBuffer x_buf = new StringBuffer(100); x_buf.append("NODE_ID: "); x_buf.append(o_node_ID); x_buf.append("\n"); if(o_conn_list != null) { x_buf.append("CONN_LIST: "); Iterator x_iter = o_conn_list.keySet().iterator(); String x_conn = null; while(x_iter.hasNext()) { x_conn = (String)(x_iter.next()); x_buf.append(x_conn); x_buf.append("::"); } x_buf.append("\n"); } if(o_contents != null) { Iterator x_iter = o_contents.keySet().iterator(); Keyword x_keyword = null; Vector x_documents = null; x_buf.append("CONTENT: "); while(x_iter.hasNext()) { x_keyword = (Keyword)(x_iter.next()); x_buf.append(x_keyword); x_documents = (Vector)(o_contents.get(x_keyword)); x_buf.append("--"); for(int j=0;j<x_documents.size();j++) { x_buf.append(((Document)(x_documents.elementAt(j))).getDocumentID()); x_buf.append("::"); } } x_buf.append("\n"); } if(o_knowledge != null) { Iterator x_iter = o_knowledge.entrySet().iterator(); Keyword x_keyword = null; Vector x_nodes = null; Map.Entry x_entry = null; x_buf.append("KNOWLEDGE: "); while(x_iter.hasNext()) { x_entry = (Map.Entry)(x_iter.next()); x_keyword = (Keyword)(x_entry.getKey()); x_buf.append(x_keyword); x_nodes = (Vector)(x_entry.getValue()); x_buf.append("--"); for(int j=0;j<x_nodes.size();j++) { x_buf.append(((Node)(x_nodes.elementAt(j))).getNodeID()); x_buf.append("::"); } } x_buf.append("\n\n"); } return x_buf.toString(); } }; // JUnitDoclet end method testcase.createInstance } protected void setUp() throws Exception { // JUnitDoclet begin method testcase.setUp super.setUp(); resourcelimitednode = createInstance(); // JUnitDoclet end method testcase.setUp } protected void tearDown() throws Exception { // JUnitDoclet begin method testcase.tearDown resourcelimitednode = null; super.tearDown(); // JUnitDoclet end method testcase.tearDown } public void testGetCvsInfo() throws Exception { // JUnitDoclet begin method getCvsInfo // JUnitDoclet end method getCvsInfo } public void testInit() throws Exception { // JUnitDoclet begin method init // JUnitDoclet end method init } public void testGetNewNodeID() throws Exception { // JUnitDoclet begin method getNewNodeID // JUnitDoclet end method getNewNodeID } public void testSetInactive() throws Exception { // JUnitDoclet begin method setInactive // JUnitDoclet end method setInactive } public void testSetActive() throws Exception { // JUnitDoclet begin method setActive // JUnitDoclet end method setActive } public void testGetActive() throws Exception { // JUnitDoclet begin method getActive // JUnitDoclet end method getActive } public void testGetNodeID() throws Exception { // JUnitDoclet begin method getNodeID // JUnitDoclet end method getNodeID } public void testGetNoConnections() throws Exception { // JUnitDoclet begin method getNoConnections // JUnitDoclet end method getNoConnections } public void testGetNoContents() throws Exception { // JUnitDoclet begin method getNoContents // JUnitDoclet end method getNoContents } public void testGetNoKnowledge() throws Exception { // JUnitDoclet begin method getNoKnowledge // JUnitDoclet end method getNoKnowledge } public void testGetTotalNoKnowledge() throws Exception { // JUnitDoclet begin method getTotalNoKnowledge // JUnitDoclet end method getTotalNoKnowledge } public void testCheckInbox() throws Exception { // JUnitDoclet begin method checkInbox // JUnitDoclet end method checkInbox } public void testClearInbox() throws Exception { // JUnitDoclet begin method clearInbox // JUnitDoclet end method clearInbox } public void testClearGUIDs() throws Exception { // JUnitDoclet begin method clearGUIDs // JUnitDoclet end method clearGUIDs } public void testClearConnList() throws Exception { // JUnitDoclet begin method clearConnList // JUnitDoclet end method clearConnList } public void testClearContents() throws Exception { // JUnitDoclet begin method clearContents // JUnitDoclet end method clearContents } public void testClearKnowledge() throws Exception { // JUnitDoclet begin method clearKnowledge // JUnitDoclet end method clearKnowledge } public void testGetConnList() throws Exception { // JUnitDoclet begin method getConnList // JUnitDoclet end method getConnList } public void testAllKeywords() throws Exception { // JUnitDoclet begin method allKeywords // JUnitDoclet end method allKeywords } public void testRemoveConnection() throws Exception { // JUnitDoclet begin method removeConnection try { resourcelimitednode.addConnection(null); fail("Failed to throw exception when adding null connection"); } catch(Exception e){} Network x_network = new NeuroGridNetwork(); Node x_node1 = new NeuroGridNode(x_network,new Random(888)); Node x_node2 = new NeuroGridNode(x_network,new Random(888)); Node x_node3 = new NeuroGridNode(x_network,new Random(888)); Node x_node4 = new NeuroGridNode(x_network,new Random(888)); // we are checking that the node that was added the longest time ago // will be removed when we exceed the maximum number of connections resourcelimitednode.addConnection(x_node1); System.out.println("no conns="+resourcelimitednode.getNoConnections()); assertTrue("Not the single connection expected",resourcelimitednode.getNoConnections()==1); //System.out.println("A: "+resourcelimitednode.getNoConnections()); //System.out.println("A: "+resourcelimitednode.getConnList()); resourcelimitednode.addConnection(x_node2); assertTrue("Expected two connections, not so",resourcelimitednode.getNoConnections()==2); //System.out.println("B: "+resourcelimitednode.getNoConnections()); //System.out.println("B: "+resourcelimitednode.getConnList()); resourcelimitednode.addConnection(x_node3); assertTrue("Expected two connections, not so",resourcelimitednode.getNoConnections()==2); //System.out.println("C: "+resourcelimitednode.getNoConnections()); //System.out.println("C: "+resourcelimitednode.getConnList()); assertTrue(!resourcelimitednode.hasConnection(x_node1)); assertTrue(resourcelimitednode.hasConnection(x_node2)); assertTrue(resourcelimitednode.hasConnection(x_node3)); // could also test that re-inserting a node protects if from being removed ... resourcelimitednode.addConnection(x_node2); assertTrue(resourcelimitednode.getNoConnections()==2); resourcelimitednode.addConnection(x_node4); assertTrue(resourcelimitednode.getNoConnections()==2); assertTrue(!resourcelimitednode.hasConnection(x_node1)); assertTrue(resourcelimitednode.hasConnection(x_node2)); assertTrue(!resourcelimitednode.hasConnection(x_node3)); assertTrue(resourcelimitednode.hasConnection(x_node4)); // JUnitDoclet end method removeConnection } public void testAddConnection() throws Exception { // JUnitDoclet begin method addConnection try { resourcelimitednode.addConnection(null); fail("Failed to throw exception when adding null connection"); } catch(Exception e){} Network x_network = new NeuroGridNetwork(); Node x_node1 = new NeuroGridNode(x_network,new Random(888)); Node x_node2 = new NeuroGridNode(x_network,new Random(888)); Node x_node3 = new NeuroGridNode(x_network,new Random(888)); Node x_node4 = new NeuroGridNode(x_network,new Random(888)); // we are checking that the node that was added the longest time ago // will be removed when we exceed the maximum number of connections resourcelimitednode.addConnection(x_node1); System.out.println("no conns="+resourcelimitednode.getNoConnections()); assertTrue("Not the single connection expected",resourcelimitednode.getNoConnections()==1); //System.out.println("A: "+resourcelimitednode.getNoConnections()); //System.out.println("A: "+resourcelimitednode.getConnList()); resourcelimitednode.addConnection(x_node2); assertTrue("Expected two connections, not so",resourcelimitednode.getNoConnections()==2); //System.out.println("B: "+resourcelimitednode.getNoConnections()); //System.out.println("B: "+resourcelimitednode.getConnList()); resourcelimitednode.addConnection(x_node3); assertTrue("Expected two connections, not so",resourcelimitednode.getNoConnections()==2); //System.out.println("C: "+resourcelimitednode.getNoConnections()); //System.out.println("C: "+resourcelimitednode.getConnList()); assertTrue(!resourcelimitednode.hasConnection(x_node1)); assertTrue(resourcelimitednode.hasConnection(x_node2)); assertTrue(resourcelimitednode.hasConnection(x_node3)); // could also test that re-inserting a node protects if from being removed ... resourcelimitednode.addConnection(x_node2); assertTrue(resourcelimitednode.getNoConnections()==2); resourcelimitednode.addConnection(x_node4); assertTrue(resourcelimitednode.getNoConnections()==2); assertTrue(!resourcelimitednode.hasConnection(x_node1)); assertTrue(resourcelimitednode.hasConnection(x_node2)); assertTrue(!resourcelimitednode.hasConnection(x_node3)); assertTrue(resourcelimitednode.hasConnection(x_node4)); // JUnitDoclet end method addConnection } public void testHasConnection() throws Exception { // JUnitDoclet begin method hasConnection try { resourcelimitednode.hasConnection(null); fail("Failed to throw exception when checking for null connection"); } catch(Exception e){} Network x_network = new NeuroGridNetwork(); Node x_node = new NeuroGridNode(x_network,new Random(888)); Node x_node2 = new NeuroGridNode(x_network,new Random(888)); resourcelimitednode.addConnection(x_node); assertTrue("node does not have expected connection",resourcelimitednode.hasConnection(x_node)); assertTrue("connected to unexpected node",!resourcelimitednode.hasConnection(x_node2)); // JUnitDoclet end method hasConnection } public void testAddContent() throws Exception { // JUnitDoclet begin method addContent try { resourcelimitednode.addContent(null); fail("Failed to throw exception when adding null content"); } catch(Exception e){} SimpleDocument x_doc = new SimpleDocument(3); resourcelimitednode.addContent(x_doc); assertTrue(resourcelimitednode.hasContent(x_doc)); // JUnitDoclet end method addContent } public void testhasContent() throws Exception { // JUnitDoclet begin method hasContent try { resourcelimitednode.hasContent(null); fail("Failed to throw exception when checking for null content"); } catch(Exception e){} SimpleDocument x_doc = new SimpleDocument(3); SimpleDocument x_doc2 = new SimpleDocument(3); resourcelimitednode.addContent(x_doc); assertTrue(resourcelimitednode.hasContent(x_doc)); assertTrue(!resourcelimitednode.hasContent(x_doc2)); // JUnitDoclet end method hasContent } public void testMatchingKeywords() throws Exception { // JUnitDoclet begin method matchingKeywords // JUnitDoclet end method matchingKeywords } public void testGetContent() throws Exception { // JUnitDoclet begin method getContent // JUnitDoclet end method getContent } public void testGetContentsByDocID() throws Exception { // JUnitDoclet begin method getContentsByDocID // JUnitDoclet end method getContentsByDocID } public void testGetRandomContent() throws Exception { // JUnitDoclet begin method getRandomContent // JUnitDoclet end method getRandomContent } public void testGetRandomKeyword() throws Exception { // JUnitDoclet begin method getRandomKeyword // JUnitDoclet end method getRandomKeyword } public void testAddKnowledge() throws Exception { // JUnitDoclet begin method addKnowledge // JUnitDoclet end method addKnowledge } public void testGetRecommendation() throws Exception { // JUnitDoclet begin method getRecommendation // JUnitDoclet end method getRecommendation } /** * JUnitDoclet moves marker to this method, if there is not match * for them in the regenerated code and if the marker is not empty. * This way, no test gets lost when regenerating after renaming. * Method testVault is supposed to be empty. */ public void testVault() throws Exception { // JUnitDoclet begin method testcase.testVault // JUnitDoclet end method testcase.testVault } public static void main(String[] args) { // JUnitDoclet begin method testcase.main junit.textui.TestRunner.run(ResourceLimitedNodeTest.class); // JUnitDoclet end method testcase.main } }
72b2b98075d18d32ed4646de7d7147a5ad80ee25
bdccc58ce9722c25503ff14c02e74b9070fcb307
/libpictureselect/src/main/java/com/alading/dream/libpictureselect/lib/photoview/PhotoViewAttacher.java
ab07ed9fb9c8c0ed420ff78ce9a3494f2bb0f2d2
[]
no_license
WangXinLong-Long/dream_
30b880a114b740f37e647e93f3aeaba307248568
67fa4cd7f4fe9c52e552359f89ad0aefffab3034
refs/heads/master
2021-04-23T15:31:53.678808
2020-06-06T03:02:55
2020-06-06T03:02:55
249,936,203
0
0
null
null
null
null
UTF-8
Java
false
false
30,259
java
/******************************************************************************* * Copyright 2011, 2012 Chris Banes. * <p> * 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 * <p> * http://www.apache.org/licenses/LICENSE-2.0 * <p> * 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.alading.dream.libpictureselect.lib.photoview; import android.content.Context; import android.graphics.Matrix; import android.graphics.Matrix.ScaleToFit; import android.graphics.RectF; import android.graphics.drawable.Drawable; import android.view.GestureDetector; import android.view.MotionEvent; import android.view.View; import android.view.View.OnLongClickListener; import android.view.ViewParent; import android.view.animation.AccelerateDecelerateInterpolator; import android.view.animation.Interpolator; import android.widget.ImageView; import android.widget.ImageView.ScaleType; import android.widget.OverScroller; /** * The component of {@link PhotoView} which does the work allowing for zooming, scaling, panning, etc. * It is made public in case you need to subclass something other than {@link ImageView} and still * gain the functionality that {@link PhotoView} offers */ public class PhotoViewAttacher implements View.OnTouchListener, View.OnLayoutChangeListener { private static float DEFAULT_MAX_SCALE = 3.0f; private static float DEFAULT_MID_SCALE = 1.75f; private static float DEFAULT_MIN_SCALE = 1.0f; private static int DEFAULT_ZOOM_DURATION = 200; private static final int HORIZONTAL_EDGE_NONE = -1; private static final int HORIZONTAL_EDGE_LEFT = 0; private static final int HORIZONTAL_EDGE_RIGHT = 1; private static final int HORIZONTAL_EDGE_BOTH = 2; private static final int VERTICAL_EDGE_NONE = -1; private static final int VERTICAL_EDGE_TOP = 0; private static final int VERTICAL_EDGE_BOTTOM = 1; private static final int VERTICAL_EDGE_BOTH = 2; private static int SINGLE_TOUCH = 1; private Interpolator mInterpolator = new AccelerateDecelerateInterpolator(); private int mZoomDuration = DEFAULT_ZOOM_DURATION; private float mMinScale = DEFAULT_MIN_SCALE; private float mMidScale = DEFAULT_MID_SCALE; private float mMaxScale = DEFAULT_MAX_SCALE; private boolean mAllowParentInterceptOnEdge = true; private boolean mBlockParentIntercept = false; private ImageView mImageView; // Gesture Detectors private GestureDetector mGestureDetector; private CustomGestureDetector mScaleDragDetector; // These are set so we don't keep allocating them on the heap private final Matrix mBaseMatrix = new Matrix(); private final Matrix mDrawMatrix = new Matrix(); private final Matrix mSuppMatrix = new Matrix(); private final RectF mDisplayRect = new RectF(); private final float[] mMatrixValues = new float[9]; // Listeners private OnMatrixChangedListener mMatrixChangeListener; private OnPhotoTapListener mPhotoTapListener; private OnOutsidePhotoTapListener mOutsidePhotoTapListener; private OnViewTapListener mViewTapListener; private View.OnClickListener mOnClickListener; private OnLongClickListener mLongClickListener; private OnScaleChangedListener mScaleChangeListener; private OnSingleFlingListener mSingleFlingListener; private OnViewDragListener mOnViewDragListener; private FlingRunnable mCurrentFlingRunnable; private int mHorizontalScrollEdge = HORIZONTAL_EDGE_BOTH; private int mVerticalScrollEdge = VERTICAL_EDGE_BOTH; private float mBaseRotation; private boolean mZoomEnabled = true; private ScaleType mScaleType = ScaleType.FIT_CENTER; private OnGestureListener onGestureListener = new OnGestureListener() { @Override public void onDrag(float dx, float dy) { if (mScaleDragDetector.isScaling()) { return; // Do not drag if we are already scaling } if (mOnViewDragListener != null) { mOnViewDragListener.onDrag(dx, dy); } mSuppMatrix.postTranslate(dx, dy); checkAndDisplayMatrix(); /* * Here we decide whether to let the ImageView's parent to start taking * over the touch event. * * First we check whether this function is enabled. We never want the * parent to take over if we're scaling. We then check the edge we're * on, and the direction of the scroll (i.e. if we're pulling against * the edge, aka 'overscrolling', let the parent take over). */ ViewParent parent = mImageView.getParent(); if (mAllowParentInterceptOnEdge && !mScaleDragDetector.isScaling() && !mBlockParentIntercept) { if (mHorizontalScrollEdge == HORIZONTAL_EDGE_BOTH || (mHorizontalScrollEdge == HORIZONTAL_EDGE_LEFT && dx >= 1f) || (mHorizontalScrollEdge == HORIZONTAL_EDGE_RIGHT && dx <= -1f) || (mVerticalScrollEdge == VERTICAL_EDGE_TOP && dy >= 1f) || (mVerticalScrollEdge == VERTICAL_EDGE_BOTTOM && dy <= -1f)) { if (parent != null) { parent.requestDisallowInterceptTouchEvent(false); } } } else { if (parent != null) { parent.requestDisallowInterceptTouchEvent(true); } } } @Override public void onFling(float startX, float startY, float velocityX, float velocityY) { mCurrentFlingRunnable = new FlingRunnable(mImageView.getContext()); mCurrentFlingRunnable.fling(getImageViewWidth(mImageView), getImageViewHeight(mImageView), (int) velocityX, (int) velocityY); mImageView.post(mCurrentFlingRunnable); } @Override public void onScale(float scaleFactor, float focusX, float focusY) { if (getScale() < mMaxScale || scaleFactor < 1f) { if (mScaleChangeListener != null) { mScaleChangeListener.onScaleChange(scaleFactor, focusX, focusY); } mSuppMatrix.postScale(scaleFactor, scaleFactor, focusX, focusY); checkAndDisplayMatrix(); } } }; public PhotoViewAttacher(ImageView imageView) { mImageView = imageView; imageView.setOnTouchListener(this); imageView.addOnLayoutChangeListener(this); if (imageView.isInEditMode()) { return; } mBaseRotation = 0.0f; // Create Gesture Detectors... mScaleDragDetector = new CustomGestureDetector(imageView.getContext(), onGestureListener); mGestureDetector = new GestureDetector(imageView.getContext(), new GestureDetector.SimpleOnGestureListener() { // forward long click listener @Override public void onLongPress(MotionEvent e) { if (mLongClickListener != null) { mLongClickListener.onLongClick(mImageView); } } @Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { if (mSingleFlingListener != null) { if (getScale() > DEFAULT_MIN_SCALE) { return false; } if (e1.getPointerCount() > SINGLE_TOUCH || e2.getPointerCount() > SINGLE_TOUCH) { return false; } return mSingleFlingListener.onFling(e1, e2, velocityX, velocityY); } return false; } }); mGestureDetector.setOnDoubleTapListener(new GestureDetector.OnDoubleTapListener() { @Override public boolean onSingleTapConfirmed(MotionEvent e) { if (mOnClickListener != null) { mOnClickListener.onClick(mImageView); } final RectF displayRect = getDisplayRect(); final float x = e.getX(), y = e.getY(); if (mViewTapListener != null) { mViewTapListener.onViewTap(mImageView, x, y); } if (displayRect != null) { // Check to see if the user tapped on the photo if (displayRect.contains(x, y)) { float xResult = (x - displayRect.left) / displayRect.width(); float yResult = (y - displayRect.top) / displayRect.height(); if (mPhotoTapListener != null) { mPhotoTapListener.onPhotoTap(mImageView, xResult, yResult); } return true; } else { if (mOutsidePhotoTapListener != null) { mOutsidePhotoTapListener.onOutsidePhotoTap(mImageView); } } } return false; } @Override public boolean onDoubleTap(MotionEvent ev) { try { float scale = getScale(); float x = ev.getX(); float y = ev.getY(); if (scale < getMediumScale()) { setScale(getMediumScale(), x, y, true); } else if (scale >= getMediumScale() && scale < getMaximumScale()) { setScale(getMaximumScale(), x, y, true); } else { setScale(getMinimumScale(), x, y, true); } } catch (ArrayIndexOutOfBoundsException e) { // Can sometimes happen when getX() and getY() is called } return true; } @Override public boolean onDoubleTapEvent(MotionEvent e) { // Wait for the confirmed onDoubleTap() instead return false; } }); } public void setOnDoubleTapListener(GestureDetector.OnDoubleTapListener newOnDoubleTapListener) { this.mGestureDetector.setOnDoubleTapListener(newOnDoubleTapListener); } public void setOnScaleChangeListener(OnScaleChangedListener onScaleChangeListener) { this.mScaleChangeListener = onScaleChangeListener; } public void setOnSingleFlingListener(OnSingleFlingListener onSingleFlingListener) { this.mSingleFlingListener = onSingleFlingListener; } @Deprecated public boolean isZoomEnabled() { return mZoomEnabled; } public RectF getDisplayRect() { checkMatrixBounds(); return getDisplayRect(getDrawMatrix()); } public boolean setDisplayMatrix(Matrix finalMatrix) { if (finalMatrix == null) { throw new IllegalArgumentException("Matrix cannot be null"); } if (mImageView.getDrawable() == null) { return false; } mSuppMatrix.set(finalMatrix); checkAndDisplayMatrix(); return true; } public void setBaseRotation(final float degrees) { mBaseRotation = degrees % 360; update(); setRotationBy(mBaseRotation); checkAndDisplayMatrix(); } public void setRotationTo(float degrees) { mSuppMatrix.setRotate(degrees % 360); checkAndDisplayMatrix(); } public void setRotationBy(float degrees) { mSuppMatrix.postRotate(degrees % 360); checkAndDisplayMatrix(); } public float getMinimumScale() { return mMinScale; } public float getMediumScale() { return mMidScale; } public float getMaximumScale() { return mMaxScale; } public float getScale() { return (float) Math.sqrt((float) Math.pow(getValue(mSuppMatrix, Matrix.MSCALE_X), 2) + (float) Math.pow (getValue(mSuppMatrix, Matrix.MSKEW_Y), 2)); } public ScaleType getScaleType() { return mScaleType; } @Override public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) { // Update our base matrix, as the bounds have changed if (left != oldLeft || top != oldTop || right != oldRight || bottom != oldBottom) { updateBaseMatrix(mImageView.getDrawable()); } } @Override public boolean onTouch(View v, MotionEvent ev) { boolean handled = false; if (mZoomEnabled && Util.hasDrawable((ImageView) v)) { switch (ev.getAction()) { case MotionEvent.ACTION_DOWN: ViewParent parent = v.getParent(); // First, disable the Parent from intercepting the touch // event if (parent != null) { parent.requestDisallowInterceptTouchEvent(true); } // If we're flinging, and the user presses down, cancel // fling cancelFling(); break; case MotionEvent.ACTION_CANCEL: case MotionEvent.ACTION_UP: // If the user has zoomed less than min scale, zoom back // to min scale if (getScale() < mMinScale) { RectF rect = getDisplayRect(); if (rect != null) { v.post(new AnimatedZoomRunnable(getScale(), mMinScale, rect.centerX(), rect.centerY())); handled = true; } } else if (getScale() > mMaxScale) { RectF rect = getDisplayRect(); if (rect != null) { v.post(new AnimatedZoomRunnable(getScale(), mMaxScale, rect.centerX(), rect.centerY())); handled = true; } } break; } // Try the Scale/Drag detector if (mScaleDragDetector != null) { boolean wasScaling = mScaleDragDetector.isScaling(); boolean wasDragging = mScaleDragDetector.isDragging(); handled = mScaleDragDetector.onTouchEvent(ev); boolean didntScale = !wasScaling && !mScaleDragDetector.isScaling(); boolean didntDrag = !wasDragging && !mScaleDragDetector.isDragging(); mBlockParentIntercept = didntScale && didntDrag; } // Check to see if the user double tapped if (mGestureDetector != null && mGestureDetector.onTouchEvent(ev)) { handled = true; } } return handled; } public void setAllowParentInterceptOnEdge(boolean allow) { mAllowParentInterceptOnEdge = allow; } public void setMinimumScale(float minimumScale) { Util.checkZoomLevels(minimumScale, mMidScale, mMaxScale); mMinScale = minimumScale; } public void setMediumScale(float mediumScale) { Util.checkZoomLevels(mMinScale, mediumScale, mMaxScale); mMidScale = mediumScale; } public void setMaximumScale(float maximumScale) { Util.checkZoomLevels(mMinScale, mMidScale, maximumScale); mMaxScale = maximumScale; } public void setScaleLevels(float minimumScale, float mediumScale, float maximumScale) { Util.checkZoomLevels(minimumScale, mediumScale, maximumScale); mMinScale = minimumScale; mMidScale = mediumScale; mMaxScale = maximumScale; } public void setOnLongClickListener(OnLongClickListener listener) { mLongClickListener = listener; } public void setOnClickListener(View.OnClickListener listener) { mOnClickListener = listener; } public void setOnMatrixChangeListener(OnMatrixChangedListener listener) { mMatrixChangeListener = listener; } public void setOnPhotoTapListener(OnPhotoTapListener listener) { mPhotoTapListener = listener; } public void setOnOutsidePhotoTapListener(OnOutsidePhotoTapListener mOutsidePhotoTapListener) { this.mOutsidePhotoTapListener = mOutsidePhotoTapListener; } public void setOnViewTapListener(OnViewTapListener listener) { mViewTapListener = listener; } public void setOnViewDragListener(OnViewDragListener listener) { mOnViewDragListener = listener; } public void setScale(float scale) { setScale(scale, false); } public void setScale(float scale, boolean animate) { setScale(scale, (mImageView.getRight()) / 2, (mImageView.getBottom()) / 2, animate); } public void setScale(float scale, float focalX, float focalY, boolean animate) { // Check to see if the scale is within bounds if (scale < mMinScale || scale > mMaxScale) { throw new IllegalArgumentException("Scale must be within the range of minScale and maxScale"); } if (animate) { mImageView.post(new AnimatedZoomRunnable(getScale(), scale, focalX, focalY)); } else { mSuppMatrix.setScale(scale, scale, focalX, focalY); checkAndDisplayMatrix(); } } /** * Set the zoom interpolator * * @param interpolator the zoom interpolator */ public void setZoomInterpolator(Interpolator interpolator) { mInterpolator = interpolator; } public void setScaleType(ScaleType scaleType) { if (Util.isSupportedScaleType(scaleType) && scaleType != mScaleType) { mScaleType = scaleType; update(); } } public boolean isZoomable() { return mZoomEnabled; } public void setZoomable(boolean zoomable) { mZoomEnabled = zoomable; update(); } public void update() { if (mZoomEnabled) { // Update the base matrix using the current drawable updateBaseMatrix(mImageView.getDrawable()); } else { // Reset the Matrix... resetMatrix(); } } /** * Get the display matrix * * @param matrix target matrix to copy to */ public void getDisplayMatrix(Matrix matrix) { matrix.set(getDrawMatrix()); } /** * Get the current support matrix */ public void getSuppMatrix(Matrix matrix) { matrix.set(mSuppMatrix); } private Matrix getDrawMatrix() { mDrawMatrix.set(mBaseMatrix); mDrawMatrix.postConcat(mSuppMatrix); return mDrawMatrix; } public Matrix getImageMatrix() { return mDrawMatrix; } public void setZoomTransitionDuration(int milliseconds) { this.mZoomDuration = milliseconds; } /** * Helper method that 'unpacks' a Matrix and returns the required value * * @param matrix Matrix to unpack * @param whichValue Which value from Matrix.M* to return * @return returned value */ private float getValue(Matrix matrix, int whichValue) { matrix.getValues(mMatrixValues); return mMatrixValues[whichValue]; } /** * Resets the Matrix back to FIT_CENTER, and then displays its contents */ private void resetMatrix() { mSuppMatrix.reset(); setRotationBy(mBaseRotation); setImageViewMatrix(getDrawMatrix()); checkMatrixBounds(); } private void setImageViewMatrix(Matrix matrix) { mImageView.setImageMatrix(matrix); // Call MatrixChangedListener if needed if (mMatrixChangeListener != null) { RectF displayRect = getDisplayRect(matrix); if (displayRect != null) { mMatrixChangeListener.onMatrixChanged(displayRect); } } } /** * Helper method that simply checks the Matrix, and then displays the result */ private void checkAndDisplayMatrix() { if (checkMatrixBounds()) { setImageViewMatrix(getDrawMatrix()); } } /** * Helper method that maps the supplied Matrix to the current Drawable * * @param matrix - Matrix to map Drawable against * @return RectF - Displayed Rectangle */ private RectF getDisplayRect(Matrix matrix) { Drawable d = mImageView.getDrawable(); if (d != null) { mDisplayRect.set(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight()); matrix.mapRect(mDisplayRect); return mDisplayRect; } return null; } /** * Calculate Matrix for FIT_CENTER * * @param drawable - Drawable being displayed */ private void updateBaseMatrix(Drawable drawable) { if (drawable == null) { return; } final float viewWidth = getImageViewWidth(mImageView); final float viewHeight = getImageViewHeight(mImageView); final int drawableWidth = drawable.getIntrinsicWidth(); final int drawableHeight = drawable.getIntrinsicHeight(); mBaseMatrix.reset(); final float widthScale = viewWidth / drawableWidth; final float heightScale = viewHeight / drawableHeight; if (mScaleType == ScaleType.CENTER) { mBaseMatrix.postTranslate((viewWidth - drawableWidth) / 2F, (viewHeight - drawableHeight) / 2F); } else if (mScaleType == ScaleType.CENTER_CROP) { float scale = Math.max(widthScale, heightScale); mBaseMatrix.postScale(scale, scale); mBaseMatrix.postTranslate((viewWidth - drawableWidth * scale) / 2F, (viewHeight - drawableHeight * scale) / 2F); } else if (mScaleType == ScaleType.CENTER_INSIDE) { float scale = Math.min(1.0f, Math.min(widthScale, heightScale)); mBaseMatrix.postScale(scale, scale); mBaseMatrix.postTranslate((viewWidth - drawableWidth * scale) / 2F, (viewHeight - drawableHeight * scale) / 2F); } else { RectF mTempSrc = new RectF(0, 0, drawableWidth, drawableHeight); RectF mTempDst = new RectF(0, 0, viewWidth, viewHeight); if ((int) mBaseRotation % 180 != 0) { mTempSrc = new RectF(0, 0, drawableHeight, drawableWidth); } switch (mScaleType) { case FIT_CENTER: mBaseMatrix.setRectToRect(mTempSrc, mTempDst, ScaleToFit.CENTER); break; case FIT_START: mBaseMatrix.setRectToRect(mTempSrc, mTempDst, ScaleToFit.START); break; case FIT_END: mBaseMatrix.setRectToRect(mTempSrc, mTempDst, ScaleToFit.END); break; case FIT_XY: mBaseMatrix.setRectToRect(mTempSrc, mTempDst, ScaleToFit.FILL); break; default: break; } } resetMatrix(); } private boolean checkMatrixBounds() { final RectF rect = getDisplayRect(getDrawMatrix()); if (rect == null) { return false; } final float height = rect.height(), width = rect.width(); float deltaX = 0, deltaY = 0; final int viewHeight = getImageViewHeight(mImageView); if (height <= viewHeight) { switch (mScaleType) { case FIT_START: deltaY = -rect.top; break; case FIT_END: deltaY = viewHeight - height - rect.top; break; default: deltaY = (viewHeight - height) / 2 - rect.top; break; } mVerticalScrollEdge = VERTICAL_EDGE_BOTH; } else if (rect.top > 0) { mVerticalScrollEdge = VERTICAL_EDGE_TOP; deltaY = -rect.top; } else if (rect.bottom < viewHeight) { mVerticalScrollEdge = VERTICAL_EDGE_BOTTOM; deltaY = viewHeight - rect.bottom; } else { mVerticalScrollEdge = VERTICAL_EDGE_NONE; } final int viewWidth = getImageViewWidth(mImageView); if (width <= viewWidth) { switch (mScaleType) { case FIT_START: deltaX = -rect.left; break; case FIT_END: deltaX = viewWidth - width - rect.left; break; default: deltaX = (viewWidth - width) / 2 - rect.left; break; } mHorizontalScrollEdge = HORIZONTAL_EDGE_BOTH; } else if (rect.left > 0) { mHorizontalScrollEdge = HORIZONTAL_EDGE_LEFT; deltaX = -rect.left; } else if (rect.right < viewWidth) { deltaX = viewWidth - rect.right; mHorizontalScrollEdge = HORIZONTAL_EDGE_RIGHT; } else { mHorizontalScrollEdge = HORIZONTAL_EDGE_NONE; } // Finally actually translate the matrix mSuppMatrix.postTranslate(deltaX, deltaY); return true; } private int getImageViewWidth(ImageView imageView) { return imageView.getWidth() - imageView.getPaddingLeft() - imageView.getPaddingRight(); } private int getImageViewHeight(ImageView imageView) { return imageView.getHeight() - imageView.getPaddingTop() - imageView.getPaddingBottom(); } private void cancelFling() { if (mCurrentFlingRunnable != null) { mCurrentFlingRunnable.cancelFling(); mCurrentFlingRunnable = null; } } private class AnimatedZoomRunnable implements Runnable { private final float mFocalX, mFocalY; private final long mStartTime; private final float mZoomStart, mZoomEnd; public AnimatedZoomRunnable(final float currentZoom, final float targetZoom, final float focalX, final float focalY) { mFocalX = focalX; mFocalY = focalY; mStartTime = System.currentTimeMillis(); mZoomStart = currentZoom; mZoomEnd = targetZoom; } @Override public void run() { float t = interpolate(); float scale = mZoomStart + t * (mZoomEnd - mZoomStart); float deltaScale = scale / getScale(); onGestureListener.onScale(deltaScale, mFocalX, mFocalY); // We haven't hit our target scale yet, so post ourselves again if (t < 1f) { Compat.postOnAnimation(mImageView, this); } } private float interpolate() { float t = 1f * (System.currentTimeMillis() - mStartTime) / mZoomDuration; t = Math.min(1f, t); t = mInterpolator.getInterpolation(t); return t; } } private class FlingRunnable implements Runnable { private final OverScroller mScroller; private int mCurrentX, mCurrentY; public FlingRunnable(Context context) { mScroller = new OverScroller(context); } public void cancelFling() { mScroller.forceFinished(true); } public void fling(int viewWidth, int viewHeight, int velocityX, int velocityY) { final RectF rect = getDisplayRect(); if (rect == null) { return; } final int startX = Math.round(-rect.left); final int minX, maxX, minY, maxY; if (viewWidth < rect.width()) { minX = 0; maxX = Math.round(rect.width() - viewWidth); } else { minX = maxX = startX; } final int startY = Math.round(-rect.top); if (viewHeight < rect.height()) { minY = 0; maxY = Math.round(rect.height() - viewHeight); } else { minY = maxY = startY; } mCurrentX = startX; mCurrentY = startY; // If we actually can move, fling the scroller if (startX != maxX || startY != maxY) { mScroller.fling(startX, startY, velocityX, velocityY, minX, maxX, minY, maxY, 0, 0); } } @Override public void run() { if (mScroller.isFinished()) { return; // remaining post that should not be handled } if (mScroller.computeScrollOffset()) { final int newX = mScroller.getCurrX(); final int newY = mScroller.getCurrY(); mSuppMatrix.postTranslate(mCurrentX - newX, mCurrentY - newY); checkAndDisplayMatrix(); mCurrentX = newX; mCurrentY = newY; // Post On animation Compat.postOnAnimation(mImageView, this); } } } }
e6c2fb41fa32a09d6bf549aa47ea2e0dd3b5ae27
63c6ec3077d6b344b3fc8d3914eff1e9d5b753ae
/src/main/java/mattjohns/common/math/RangeD.java
165787e8b3fe2184ee470541e13503d00fc4ee04
[]
no_license
MattJohns/BoneMealControl
11beb3ce11270cd4c68e779b6816e1c6563f30f2
27dc789a3b3dd7c3e1b6282d945f637aed29db3c
refs/heads/master
2022-08-24T18:06:26.890332
2022-07-28T01:22:23
2022-07-28T01:22:23
177,415,636
1
0
null
null
null
null
UTF-8
Java
false
false
616
java
package mattjohns.common.math; public class RangeD { public double minimum; public double maximum; public RangeD(double minimum, double maximum) { this.minimum = minimum; this.maximum = maximum; } public double sizeGet() { return maximum - minimum; } public boolean validate() { if (sizeGet() < 0.0) return false; return true; } public boolean isInside(int item) { if (item >= minimum && item <= maximum) { return true; } return false; } public double cap(double item) { if (item < minimum) return minimum; if (item > maximum) return maximum; return item; } }
285d7b1da7cb10d6f4b7bd90f0984d73dd4102cb
110d78007e5edcd24c83467eefdab1b396519ad2
/app/src/main/java/com/example/quizapp/QuizContract.java
9a5908c4d67758ad39213a80dea1ba9cced10df6
[]
no_license
ZubairShaikh696/QuizApp
6eeb6dd0afc02dffa0db1763a8a5ef8f0eb9713c
77eff179c6b6f6dd11caccf888ab74684da05ef7
refs/heads/master
2022-12-03T08:09:27.786054
2020-08-24T21:32:58
2020-08-24T21:32:58
290,037,572
0
0
null
null
null
null
UTF-8
Java
false
false
608
java
package com.example.quizapp; import android.provider.BaseColumns; public class QuizContract { private QuizContract() { } public static class QuestionsTable implements BaseColumns { public static final String TABLE_NAME = "quiz_questions"; public static final String COLUMN_QUESTION = "question"; public static final String COLUMN_OPTION1 = "option1"; public static final String COLUMN_OPTION2 = "option2"; public static final String COLUMN_OPTION3 = "option3"; public static final String COLUMN_ANSWER_NR = "answer_nr"; } }
0c12d0f512b7949d19b233e9586666ef912b11b0
95bdf0bb65861b48d70da05f18909f708023bb43
/src/main/java/org/springframework/data/solr/core/query/Query.java
83ade2ca7ee323c5f80d49569ee0502746c55f07
[ "LicenseRef-scancode-generic-cla", "Apache-2.0" ]
permissive
navneetgupta/spring-data-solr2
0b2d07aaf3ff583a19d2045b0eab94cb729f82d2
6eee5a5595f8185f4f5e77f96003299f589e312c
refs/heads/master
2021-06-06T03:32:08.737529
2017-11-29T08:04:39
2017-11-29T08:04:39
137,577,218
0
0
Apache-2.0
2021-05-12T00:16:54
2018-06-16T11:57:14
Java
UTF-8
Java
false
false
5,790
java
/* * Copyright 2012 - 2017 the original author or authors. * * 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.springframework.data.solr.core.query; import java.util.List; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; import org.springframework.lang.Nullable; /** * A Query that can be translated into a solr understandable Query. * * @author Christoph Strobl * @author Rosty Kerei * @author Luke Corpe * @author Andrey Paramonov * @author Francisco Spaeth */ public interface Query extends SolrDataQuery { /** * Operator to be used for {@code q.op} */ enum Operator { AND("AND"), OR("OR"), NONE(""); private String operator; Operator(String operator) { this.operator = operator; } public String asQueryStringRepresentation() { return this.operator; } @Override public String toString() { return asQueryStringRepresentation(); } } int DEFAULT_PAGE_SIZE = 10; /** * add given Field to those included in result. Corresponds to the {@code fl} parameter in solr. * * @param field * @return */ <T extends Query> T addProjectionOnField(Field field); /** * restrict result to entries on given page. Corresponds to the {@code start} and {@code row} parameter in solr * * @param pageable * @return */ <T extends Query> T setPageRequest(Pageable pageable); /** * Set the number of rows to skip. * * @param offset * @return * @since 1.3 */ <T extends Query> T setOffset(Long offset); /** * Set the rerank value. * * @param offset * @return * @since 1.3 */ <T extends Query> T setReRank(String rqqValue); /** * Set the number of rows to fetch. * * @param rows * @return * @since 1.3 */ <T extends Query> T setRows(Integer rows); /** * add the given field to those used for grouping result Corresponds to '' in solr * * @param field * @return */ <T extends Query> T addGroupByField(Field field); /** * add query to filter results Corresponds to {@code fq} in solr * * @param query * @return */ <T extends Query> T addFilterQuery(FilterQuery query); /** * The time in milliseconds allowed for a search to finish. Values <= 0 mean no time restriction. * * @param timeAllowed * @return */ <T extends Query> T setTimeAllowed(Integer timeAllowed); /** * Get filter queries if defined * * @return */ List<FilterQuery> getFilterQueries(); /** * Get page settings if defined. * * @return * @deprecated since 1.3. Will be removed in 1.4. Please use {@link #getOffset()} and {@link #getRows()} instead. */ @Deprecated Pageable getPageRequest(); /** * Get number of rows to skip. * * @since 1.3 */ @Nullable Long getOffset(); /** * Get number of rows to fetch. * * @return * @since 1.3 */ @Nullable Integer getRows(); /** * Get group by fields if defined * * @return */ List<Field> getGroupByFields(); /** * Get projection fields if defined * * @return */ List<Field> getProjectionOnFields(); /** * Add {@link Sort} to query * * @param sort * @return */ <T extends Query> T addSort(Sort sort); /** * @return null if not set */ @Nullable Sort getSort(); /** * Return the time (in milliseconds) allowed for a search to finish * * @return */ @Nullable Integer getTimeAllowed(); /** * Return the time (in milliseconds) allowed for a search to finish * * @return */ @Nullable String getRqqValue(); /** * Set the default operator {@code q.op} for query expressions * * @return */ void setDefaultOperator(Operator operator); /** * Get the specified default operator for query expressions, overriding the default operator specified in the * {@code schema.xml} file. * * @return */ @Nullable Operator getDefaultOperator(); /** * Get the default type of query, if one has been specified. Overrides the default type specified in the * solrconfig.xml file. * * @return */ @Nullable String getDefType(); /** * Sets the default type to be used by the query. */ void setDefType(String defType); /** * Returns the request handler. */ @Nullable String getRequestHandler(); /** * Sets the request handler. */ void setRequestHandler(String requestHandler); /** * Sets {@link GroupOptions} for this {@link Query}. * * @param groupOptions * @return */ <T extends Query> T setGroupOptions(GroupOptions groupOptions); /** * @return group options */ @Nullable GroupOptions getGroupOptions(); /** * Set {@link StatsOptions} for this {@link Query}. * * @param statsOptions * @return * @since 1.4 */ <T extends Query> T setStatsOptions(StatsOptions statsOptions); /** * @return {@link StatsOptions} or null if not set. * @since 1.4 */ @Nullable StatsOptions getStatsOptions(); /** * Set the {@link SpellcheckOptions} to enable spellchecking. * * @param spellcheckOptions can be {@literal null}. * @return never {@literal null}. * @since 2.1 */ <T extends Query> T setSpellcheckOptions(SpellcheckOptions spellcheckOptions); /** * @return {@literal null} if not set. * @since 2.1 */ @Nullable SpellcheckOptions getSpellcheckOptions(); }
df62e601dd1d20757c64533e805a0d704dda8d89
c43408b22878633fea12d03a09c1be7997a53065
/src/main/java/com/n2h/EventManagement/controller/MainController.java
6e8aad40cfaf69025df4e19b4156ea73c779fe4e
[]
no_license
JustHoa/EVENT
29c666258689ab719fa3868d683f7e9e6784c226
cf66d835509c901a61b4f03a8c235409c7c27abb
refs/heads/master
2020-05-28T11:08:28.689111
2019-05-28T09:02:18
2019-05-28T09:02:18
188,979,615
0
0
null
null
null
null
UTF-8
Java
false
false
78
java
package com.n2h.EventManagement.controller; public class MainController { }
ea7f8013dfce0c810626fab2ded4e8de35d7c8cc
41ca28b891ea9a1f395d720f9f3abce6a3261d05
/BOJ/src/BOJ1199.java
80e4b02f0f7ddc3dd6664d5c31b0663f22bc51e1
[]
no_license
hiheehee/BOJ
2ad6c24cc8d4162cabc853f3225d84ea29da4df1
2b6a938fffa0d8abdb10735bb7ad06565db8497b
refs/heads/master
2023-08-31T21:36:57.205788
2021-10-27T00:00:52
2021-10-27T00:00:52
325,514,301
0
0
null
null
null
null
UTF-8
Java
false
false
1,222
java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class BOJ1199 { static int circuit[][]; static boolean visited[]; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); circuit = new int[n][n]; visited = new boolean[n]; for(int i = 0; i < n; i++) { StringTokenizer st = new StringTokenizer(br.readLine()); for(int j = 0; j < n; j++) { circuit[i][j] = Integer.parseInt(st.nextToken()); } } if(!isEven()) { System.out.print(-1); }else { EulerCirCuit(0); } } static boolean isEven() { for(int i = 0; i < circuit.length; i++) { int count = 0; for(int j = 0; j < circuit.length; j++) { if(circuit[i][j] > 0) { count += circuit[i][j]; } } if(count%2 == 1) { return false; } } return true; } static void EulerCirCuit(int here) { for(int i = 0; i < circuit.length; i++) { while(circuit[here][i] > 0) { circuit[here][i]--; circuit[i][here]--; EulerCirCuit(i); } } System.out.print((here+1)+" "); } }
b1b523203ad76a6350af8bb4c57fae9824cf7fec
3b422ea02111b8a8b4e785880d01bcd731c5ce2b
/src/main/java/com/example/springbootresttemplate/SpringbootresttemplateApplication.java
71b3ae65384820c608c504b84fd0ef2d8263f46d
[]
no_license
muharremkoc/spring-boot-rest-template
602433e3de73d0f45e569001cc15f34d5fa16362
7f42c2dd65be460cbbd505d5f72610717d5dc0f8
refs/heads/master
2023-07-04T14:07:21.087603
2021-08-16T10:39:04
2021-08-16T10:39:38
396,744,184
2
0
null
null
null
null
UTF-8
Java
false
false
643
java
package com.example.springbootresttemplate; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cache.annotation.EnableCaching; import org.springframework.context.annotation.Bean; import org.springframework.web.client.RestTemplate; @SpringBootApplication @EnableCaching public class SpringbootresttemplateApplication { public static void main(String[] args) { SpringApplication.run(SpringbootresttemplateApplication.class, args); } @Bean public RestTemplate getRestTemplate(){ return new RestTemplate(); } }
917f6f01c3ade133027a71e5988fa50ba1bb9d9b
369b90efd0467b52ce0fe17d6665cf5411f30f5d
/cli/src/controller/CommonController.java
873a365a20cf7287b23e434839c1a04b9b494688
[]
no_license
osherkramer/Java-Final-project
4123d735234acd187aa1126b53c566a0c3c6c136
e297def3597f65a1fef6857e72a90ef8f301c52a
refs/heads/master
2020-03-22T13:15:23.370323
2018-07-07T15:49:39
2018-07-07T15:49:39
140,094,395
0
0
null
null
null
null
UTF-8
Java
false
false
717
java
package controller; import model.Model; import view.View; /** * CommonController class - implements the Controller interface * abstract class */ public abstract class CommonController implements Controller { Model model; View view; /** * CommonController Constructor - initialize the Model and View that * the controller work with them * @param model - get object from type Model * @param view - get object from type View */ public CommonController(Model model, View view){ this.model = model; this.view = view; } @Override public Model getModel() { return model; } @Override public View getView() {return view; } @Override public abstract void setMessage(String massage); }
d41f440362cb0aeeb50980b1df3ed371a650f4ef
3cc4279e77659af2e4c330c5af9ed7ae6cd19842
/app/src/main/java/ru/arvalon/activitytasks/X.java
18316c7304f18d92ad67f71bc62a1a4706a2524e
[]
no_license
arvalon/ActivityTasks
271378d6ac8790b00cc11a3867c3da22462f12de
e2b92a3adb53398bb699e3cd6572236d678ac1fe
refs/heads/master
2023-03-03T13:07:42.253001
2023-02-16T16:24:08
2023-02-16T16:25:19
166,873,692
0
0
null
null
null
null
UTF-8
Java
false
false
676
java
package ru.arvalon.activitytasks; import android.app.ActivityManager; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.View; import androidx.appcompat.app.AppCompatActivity; public class X extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_x); App.getInstance().printActivityStack(this); View view=new View(this); //gotoY(view); } public void gotoY(View view) { Intent intent = new Intent(this,Y.class); startActivity(intent); } }