blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
listlengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
listlengths
1
1
author
stringlengths
0
161
9c4c676865bfce87f4a7df6a122b0879d38c3558
21ba97611a13cb94f6c5f3f643c0ca7508397689
/app/src/main/java/ca/nbcc/shoppinglist/SecondActivity.java
db0822dd19a5f775036f43e7f01d59b70de9c7b1
[]
no_license
Android-SrA-2019/shopping-list-app-Jaybson
a9649bd0c2c1a070a74fd38f0f207f351377939f
6e1947d4001b4a6bc55e36bb7ab357e80580a61d
refs/heads/master
2020-04-19T12:56:25.107222
2019-02-12T17:19:19
2019-02-12T17:19:19
168,204,869
1
0
null
null
null
null
UTF-8
Java
false
false
1,546
java
package ca.nbcc.shoppinglist; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.TextView; import org.w3c.dom.Text; public class SecondActivity extends AppCompatActivity { private static final String LOG_TAG = SecondActivity.class.getSimpleName(); //public static final String EXTRA_MESSAGE = "com.example.android.twoactivities.extra.MESSAGE"; public static final int TEXT_REQUEST = 1; //private EditText mMessageEditText; public static final String EXTRA_REPLY = "com.example.android.twoactivities.extra.REPLY"; Button b; TextView item; private TextView itemTextView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_second); itemTextView = findViewById(R.id.txt1); } public void launchMainActivity(View view) { Log.d(LOG_TAG, "Button Click JBJ"); Intent intent = new Intent(this, MainActivity.class); //String message = mMessageEditText.getText().toString(); //intent.putExtra(EXTRA_MESSAGE, message); startActivityForResult(intent, TEXT_REQUEST); b = (Button)view; String reply = b.getText().toString(); Intent replyIntent = new Intent(); replyIntent.putExtra(EXTRA_REPLY, reply); setResult(RESULT_OK,replyIntent); finish(); } }
[ "jeremy.b.johnson96@gmail.com" ]
jeremy.b.johnson96@gmail.com
18daefadd915de1fd49e8719a279593f7a3e7618
c0c33fa9bc1f8e613b3c5c2370c6b13a6f60be67
/Project_GL/src/Passager.java
bb6b02de2c7b9343edc914f7120fd6fbd9b1bb2b
[]
no_license
souf-tazi/GL_Project
dbfd0d9d8f82b8ae87f487dfc6b4da2c78952310
cb0f5fb796d7c939377e744ecee85a0e838e043e
refs/heads/master
2021-04-28T23:55:31.060106
2017-01-16T02:29:17
2017-01-16T02:29:17
77,692,916
0
0
null
null
null
null
UTF-8
Java
false
false
627
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. */ /** * * @author soufiane */ public class Passager { private int Nom; private int Prenom; private int Telephone; private int Adresse; private int idPassager; public Passager() { // TODO - implement Passager.Passager throw new UnsupportedOperationException(); } /** * * @param parameter */ public Passager(int parameter) { // TODO - implement Passager.Passager throw new UnsupportedOperationException(); } }
[ "soufiane@192.168.1.14" ]
soufiane@192.168.1.14
9291555bf7fab5d82aba711a1ef820e2f1507c9f
e08314b8c22df72cf3aa9e089624fc511ff0d808
/src/selfdefine/com/ces/component/sdzycspbm/dao/SdzycspbmDao.java
dfbfb1554c95b1e57bb5425a0cb97de0dbd13e3e
[]
no_license
quxiongwei/qhzyc
46acd4f6ba41ab3b39968071aa114b24212cd375
4b44839639c033ea77685b98e65813bfb269b89d
refs/heads/master
2020-12-02T06:38:21.581621
2017-07-12T02:06:10
2017-07-12T02:06:10
96,864,946
0
3
null
null
null
null
UTF-8
Java
false
false
246
java
package com.ces.component.sdzycspbm.dao; import com.ces.component.trace.dao.base.TraceShowModuleStringIDDao; import com.ces.xarch.core.entity.StringIDEntity; public interface SdzycspbmDao extends TraceShowModuleStringIDDao<StringIDEntity> { }
[ "qu.xiongwei@cesgroup.com.cn" ]
qu.xiongwei@cesgroup.com.cn
26d58acf2e8d98f8638bb69bc6917ba36e5fa267
3f7c167a683b3186babcc9fdbe54cdf1aa03cf66
/WebProj4/src/com/internousdev/webproj4/dao/LoginDAO.java
cc3fa42b5fa751bfed1f0249f851fcc6a606f3fc
[]
no_license
syoutaro/test
71dac756f0af1cf16b8c39cd0f95970f44a39f10
229add2a8606dd9ba847a4aac32bf89ff5675224
refs/heads/master
2021-05-02T06:26:31.052997
2018-04-02T01:10:30
2018-04-02T01:10:30
120,857,926
0
0
null
null
null
null
UTF-8
Java
false
false
1,346
java
package com.internousdev.webproj4.dao; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import com.internousdev.webproj4.dto.LoginDTO; import com.internousdev.webproj4.util.DBConnector; public class LoginDAO { public String username; public String password; public List<LoginDTO> loginDTOList = new ArrayList<LoginDTO>(); public List<LoginDTO> select(String username,String password) { DBConnector db = new DBConnector(); Connection con = db.getConnection(); String sql = "select * from users where user_name=? and password=?"; try { PreparedStatement ps = con.prepareStatement(sql); ps.setString(1, username); ps.setString(2, password); ResultSet rs = ps.executeQuery(); while (rs.next()) { LoginDTO dto=new LoginDTO(); dto.setUsername(rs.getString("user_name")); dto.setPassword(rs.getString("password")); loginDTOList.add(dto); } if(loginDTOList.size()<=0){ LoginDTO dto=new LoginDTO(); dto.setUsername("該当なし"); dto.setPassword("該当なし"); loginDTOList.add(dto); } } catch (SQLException e) { e.printStackTrace(); } try { con.close(); } catch (SQLException e) { e.printStackTrace(); } return loginDTOList; } }
[ "pgjsugawara258@icloud.com" ]
pgjsugawara258@icloud.com
9efda973ec04dc79406893682bf72afaa95fd067
748304700a2d40f59cbe6d2bbb6f01c3ade2ab59
/src/main/java/mx/edu/uacm/security/JwtUser.java
4a6926fff453b4c11b2d9c55cad7f0077f226a10
[]
no_license
MartinezYonathan/ProyectoLibreria-Backend
599ed145b29a248b7a716b5db1d640b8e715b5fa
a150d83994e99d8e5b3c349d430193f353bb180e
refs/heads/master
2020-06-30T03:52:59.384537
2019-08-07T18:09:51
2019-08-07T18:09:51
200,687,616
0
5
null
2019-08-05T19:05:15
2019-08-05T16:03:36
Java
UTF-8
Java
false
false
2,394
java
package mx.edu.uacm.security; import java.util.Collection; import java.util.Date; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; import com.fasterxml.jackson.annotation.JsonIgnore; public class JwtUser implements UserDetails { private static final long serialVersionUID = 1215456216545L; private final Long id; private final String username; private final String firstname; private final String lastname; private final String password; private final String email; private final Collection<? extends GrantedAuthority> authorities; private final boolean enabled; private final Date lastPasswordResetDate; public JwtUser( Long id, String username, String firstname, String lastname, String email, String password, Collection<? extends GrantedAuthority> authorities, boolean enabled, Date lastPasswordResetDate ) { this.id = id; this.username = username; this.firstname = firstname; this.lastname = lastname; this.email = email; this.password = password; this.authorities = authorities; this.enabled = enabled; this.lastPasswordResetDate = lastPasswordResetDate; } @JsonIgnore public Long getId() { return id; } @Override public String getUsername() { return username; } @JsonIgnore @Override public boolean isAccountNonExpired() { return true; } @JsonIgnore @Override public boolean isAccountNonLocked() { return true; } @JsonIgnore @Override public boolean isCredentialsNonExpired() { return true; } public String getFirstname() { return firstname; } public String getLastname() { return lastname; } public String getEmail() { return email; } @JsonIgnore @Override public String getPassword() { return password; } @Override public Collection<? extends GrantedAuthority> getAuthorities() { return authorities; } @Override public boolean isEnabled() { return enabled; } @JsonIgnore public Date getLastPasswordResetDate() { return lastPasswordResetDate; } }
[ "j-ma@hotmail.es" ]
j-ma@hotmail.es
48b40b79d728fa86b0ef353f68329d9f7dbcb84b
73b9f35b96af8c5b17526484c867e524f94dd1ec
/src/main/java/com/fuguo/net/oneclient/SocketClient.java
d9f157f6edde1bfe7cf5193d4ddfb790166a4299
[]
no_license
wangfuguo/spring-boot-demo
73b9b1738bf874c2e09807a4f24c5181f4dc8d05
8111a8c8c9f6c0abdcc6767f31c17966a9c68464
refs/heads/master
2021-05-03T09:03:58.207198
2018-04-09T01:48:49
2018-04-09T01:48:49
120,569,610
1
0
null
null
null
null
UTF-8
Java
false
false
1,152
java
package com.fuguo.net.oneclient; import java.io.*; import java.net.Socket; /** * @author 00938658-王富国 * @description: TODO * @date 2018-02-05 13:37 * @since V1.0.0 */ public class SocketClient { public static void main(String[] args) { try { Socket socket = new Socket("127.0.0.1", 2018); socket.setSoTimeout(60000); PrintWriter printWriter = new PrintWriter(socket.getOutputStream(), true); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(socket.getInputStream())); String result = ""; while (result.indexOf("bye") == -1) { BufferedReader sysBuff = new BufferedReader(new InputStreamReader(System.in)); printWriter.println(sysBuff.readLine()); printWriter.flush(); result = bufferedReader.readLine(); System.out.println("Server say : " + result); } printWriter.close(); bufferedReader.close(); socket.close(); } catch (IOException e) { e.printStackTrace(); } } }
[ "wangfuguo_wfg@163.com" ]
wangfuguo_wfg@163.com
7e9dd6167f7b96786c94bea9cacb8619424e1c5d
7ef25781e7bf4f99f0ac08c42186bcd0a8e8b427
/Online2/src/online2/Online2.java
af16776be5411428cf85d7e7326c89ef3fb5d939
[]
no_license
siamislam1603/Data-Structures
0710678bc88f24e175e4d7addd8582f024e56276
abf115c1df823c7aea8e112798ffdbcb59ea74bd
refs/heads/master
2020-06-04T22:55:37.130938
2019-06-16T18:25:11
2019-06-16T18:25:11
192,222,554
1
0
null
null
null
null
UTF-8
Java
false
false
912
java
package online2; import java.util.*; public class Online2 { public static void main(String[] args) { Scanner in=new Scanner(System.in); System.out.print("How many numbers to take as inputs?:"); int n=in.nextInt(); System.out.print("Where to start?:"); int m=in.nextInt(); Random random = new Random(); int a[]=new int[n]; for(int i=0;i<n;i++){ a[i]=random.nextInt(n-10) + m; } System.out.println("\nUnsorted Array:"); for(int i=0;i<n;i++){ System.out.print(a[i]+" "); } Insertion_Sort insert=new Insertion_Sort(a); System.out.print("\nSorted Array:"); for(int i=0;i<a.length;i++){ System.out.print(a[i]+" "); } System.out.print("\nItem:"); int item=in.nextInt(); Binary_Search bs=new Binary_Search(a,item); } }
[ "siamislam1603@gmail.com" ]
siamislam1603@gmail.com
ab5f8b82fdffcf0a80a03ce62412847dedd09543
f766baf255197dd4c1561ae6858a67ad23dcda68
/app/src/main/java/com/tencent/mm/protocal/c/or.java
d8c2ff85a7913132ed02f4f64eb85a74f91f371c
[]
no_license
jianghan200/wxsrc6.6.7
d83f3fbbb77235c7f2c8bc945fa3f09d9bac3849
eb6c56587cfca596f8c7095b0854cbbc78254178
refs/heads/master
2020-03-19T23:40:49.532494
2018-06-12T06:00:50
2018-06-12T06:00:50
137,015,278
4
2
null
null
null
null
UTF-8
Java
false
false
2,938
java
package com.tencent.mm.protocal.c; import f.a.a.b; import java.util.LinkedList; public final class or extends bhp { public String rsU; public String rsV; protected final int a(int paramInt, Object... paramVarArgs) { if (paramInt == 0) { paramVarArgs = (f.a.a.c.a)paramVarArgs[0]; if (this.six == null) { throw new b("Not all required fields were included: BaseResponse"); } if (this.six != null) { paramVarArgs.fV(1, this.six.boi()); this.six.a(paramVarArgs); } if (this.rsU != null) { paramVarArgs.g(2, this.rsU); } if (this.rsV != null) { paramVarArgs.g(3, this.rsV); } return 0; } if (paramInt == 1) { if (this.six == null) { break label415; } } label415: for (int i = f.a.a.a.fS(1, this.six.boi()) + 0;; i = 0) { paramInt = i; if (this.rsU != null) { paramInt = i + f.a.a.b.b.a.h(2, this.rsU); } i = paramInt; if (this.rsV != null) { i = paramInt + f.a.a.b.b.a.h(3, this.rsV); } return i; if (paramInt == 2) { paramVarArgs = new f.a.a.a.a((byte[])paramVarArgs[0], unknownTagHandler); for (paramInt = bhp.a(paramVarArgs); paramInt > 0; paramInt = bhp.a(paramVarArgs)) { if (!super.a(paramVarArgs, this, paramInt)) { paramVarArgs.cJS(); } } if (this.six != null) { break; } throw new b("Not all required fields were included: BaseResponse"); } if (paramInt == 3) { Object localObject1 = (f.a.a.a.a)paramVarArgs[0]; or localor = (or)paramVarArgs[1]; paramInt = ((Integer)paramVarArgs[2]).intValue(); switch (paramInt) { default: return -1; case 1: paramVarArgs = ((f.a.a.a.a)localObject1).IC(paramInt); i = paramVarArgs.size(); paramInt = 0; while (paramInt < i) { Object localObject2 = (byte[])paramVarArgs.get(paramInt); localObject1 = new fl(); localObject2 = new f.a.a.a.a((byte[])localObject2, unknownTagHandler); for (boolean bool = true; bool; bool = ((fl)localObject1).a((f.a.a.a.a)localObject2, (com.tencent.mm.bk.a)localObject1, bhp.a((f.a.a.a.a)localObject2))) {} localor.six = ((fl)localObject1); paramInt += 1; } case 2: localor.rsU = ((f.a.a.a.a)localObject1).vHC.readString(); return 0; } localor.rsV = ((f.a.a.a.a)localObject1).vHC.readString(); return 0; } return -1; } } } /* Location: /Users/Han/Desktop/wxall/微信反编译/反编译 6.6.7/dex2jar-2.0/classes5-dex2jar.jar!/com/tencent/mm/protocal/c/or.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */
[ "526687570@qq.com" ]
526687570@qq.com
ffedc5ba5ed3987f97f2716bd45966f42a1e2d10
39389a924dfd59132081bb285c1f082deeda2a75
/src/Url.java
84fcfd50651b9bec41aa353694476af02871fe46
[]
no_license
pranaligedam/Automation
b1969e884d209f9a0aab41bd0887a831650f2285
59f5822cd5942c2ff845403672485d0a4554fcde
refs/heads/master
2023-05-19T12:00:43.970951
2021-06-10T14:15:03
2021-06-10T14:15:03
375,688,623
0
0
null
null
null
null
UTF-8
Java
false
false
890
java
import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class Url { public static void main(String[] args) { // TODO Auto-generated method stub //selenium code- //Create Driver object for chrome Browser // we will strictly implement methods of webdriver /* Class name= ChromeDriver, * x Driver = new x()*/ // Invoke .exe file export System.setProperty("webdriver.chrome.driver", "C:\\work\\chromedriver.exe"); WebDriver driver=new ChromeDriver(); driver.get("https://webapp.ahs.allhands.cloud/"); //url on the browser System.out.println(driver.getTitle()); //validate if your page title is correct System.out.println(driver.getCurrentUrl()); //validate you are landed on current url //driver.close(); // closes current browser //driver.quit(); // It closes all the browser opened by selenium script } }
[ "pranali.gedam93@gmail.com" ]
pranali.gedam93@gmail.com
7ec20b85f98d64cd188c10f15c5097bfa899ae2b
8246da9a0ea49ef6e70bfb6bc05148fb6134ed89
/dianping2/src/main/java/com/dianping/main/user/activity/ShopEditActivity.java
06fff2844de6cd646a33cc88e7128252fd3263d1
[]
no_license
hezhongqiang/Dianping
2708824e30339e1abfb85e028bd27778e26adb56
b1a4641be06857fcf65466ce04f3de6b0b6f05ef
refs/heads/master
2020-05-29T08:48:38.251791
2016-01-13T08:09:05
2016-01-13T08:09:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
27,374
java
package com.dianping.main.user.activity; import android.app.AlertDialog.Builder; import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.text.Editable; import android.text.Html; import android.text.TextUtils; import android.text.TextWatcher; import android.view.KeyEvent; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.ImageButton; import android.widget.Toast; import com.dianping.accountservice.AccountService; import com.dianping.app.Environment; import com.dianping.archive.DPObject; import com.dianping.base.app.NovaActivity; import com.dianping.base.widget.TitleBar; import com.dianping.dataservice.RequestHandler; import com.dianping.dataservice.mapi.BasicMApiRequest; import com.dianping.dataservice.mapi.CacheType; import com.dianping.dataservice.mapi.MApiRequest; import com.dianping.dataservice.mapi.MApiResponse; import com.dianping.dataservice.mapi.MApiService; import com.dianping.model.City; import com.dianping.model.UserProfile; import com.dianping.util.Log; import com.dianping.v1.R.id; import com.dianping.v1.R.layout; import com.dianping.widget.DPBasicItem; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.UUID; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.http.message.BasicNameValuePair; public class ShopEditActivity extends NovaActivity implements View.OnClickListener, RequestHandler<MApiRequest, MApiResponse> { private static final int REQUEST_SELECT_CATEGORY = 37; private static final int REQUEST_SELECT_REGION = 38; private static final String TAG = ShopEditActivity.class.getSimpleName(); private static final Pattern rfc2822 = Pattern.compile("^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$"); MApiRequest addShopRequest; EditText address; DPBasicItem btnShopRegion; DPBasicItem btnShopType; String callId; DPObject[] categories; EditText email; boolean hasChanged = false; private String initCategory; private String initRegion; boolean isClicked = false; DPObject mainCategory; DPObject mainRegion; EditText near; EditText phone; MApiRequest prefillCategory; MApiRequest prefillRegion; DPObject[] regions; DPObject shop; EditText shopName; DPObject subCategory; DPObject subRegion; Button submitButton; private TextWatcher textWatcher = new TextWatcher() { public void afterTextChanged(Editable paramEditable) { if (!ShopEditActivity.this.hasChanged) { ShopEditActivity.this.hasChanged = true; ShopEditActivity.this.submitButton.setEnabled(true); } } public void beforeTextChanged(CharSequence paramCharSequence, int paramInt1, int paramInt2, int paramInt3) { } public void onTextChanged(CharSequence paramCharSequence, int paramInt1, int paramInt2, int paramInt3) { } }; boolean waiting4Categorys; boolean waiting4Regions; private void doPrefill() { if ((this.regions != null) && (this.categories != null)) updateShow(); } private ShopInfo getUserInput() { ShopInfo localShopInfo = new ShopInfo(null); if (this.subRegion != null) { localShopInfo.regionId = this.subRegion.getInt("ID"); if (this.subCategory == null) break label170; localShopInfo.categoryId = this.subCategory.getInt("ID"); } while (true) { localShopInfo.shopName = this.shopName.getText().toString().trim(); localShopInfo.address = this.address.getText().toString().trim(); localShopInfo.crossRoad = this.near.getText().toString().trim(); localShopInfo.phone = this.phone.getText().toString().trim(); if (this.shop != null) localShopInfo.shopId = this.shop.getInt("ID"); return localShopInfo; if (this.mainRegion != null) { localShopInfo.regionId = this.mainRegion.getInt("ID"); break; } localShopInfo.regionId = 0; break; label170: if (this.mainCategory != null) { localShopInfo.categoryId = this.mainCategory.getInt("ID"); continue; } if (this.shop == null) continue; localShopInfo.categoryId = this.shop.getInt("CategoryID"); } } private boolean isEmailValidate(String paramString) { if (TextUtils.isEmpty(paramString)); while (true) { return true; Object localObject = null; try { paramString = rfc2822.matcher(paramString); if ((paramString == null) || (paramString.matches())) continue; Toast.makeText(this, "请填写正确的邮箱地址", 0).show(); return false; } catch (Exception paramString) { while (true) { Log.e(paramString.getLocalizedMessage()); paramString = localObject; } } } } private boolean isInfoChanged(ShopInfo paramShopInfo) { if (paramShopInfo == null); do { return false; if (this.shop == null) return true; if (paramShopInfo.regionId != this.shop.getInt("RegionID")) return true; if (paramShopInfo.categoryId != this.shop.getInt("CategoryID")) return true; if (!paramShopInfo.shopName.equals(this.shop.getString("Name"))) return true; if (!paramShopInfo.address.equals(this.shop.getString("Address"))) return true; if (!paramShopInfo.crossRoad.equals(this.shop.getString("CrossRoad"))) return true; } while (paramShopInfo.phone.equals(this.shop.getString("PhoneNo"))); return true; } public static DPObject[] mainRegionList(DPObject[] paramArrayOfDPObject) { return subRegionList(paramArrayOfDPObject, 0); } private void requestCategories() { StringBuilder localStringBuilder = new StringBuilder("http://m.api.dianping.com/"); localStringBuilder.append("category.bin?"); localStringBuilder.append("cityid=").append(this.shop.getInt("CityID")); this.prefillCategory = BasicMApiRequest.mapiGet(localStringBuilder.toString(), CacheType.NORMAL); mapiService().exec(this.prefillCategory, this); } private void requestRegions() { StringBuilder localStringBuilder = new StringBuilder("http://m.api.dianping.com/"); localStringBuilder.append("region.bin?"); localStringBuilder.append("cityid=").append(this.shop.getInt("CityID")); this.prefillRegion = BasicMApiRequest.mapiGet(localStringBuilder.toString(), CacheType.NORMAL); mapiService().exec(this.prefillRegion, this); } private void setupView() { this.shopName = ((EditText)((DPBasicItem)findViewById(R.id.shopName_item)).findViewById(R.id.itemInput)); this.btnShopRegion = ((DPBasicItem)findViewById(R.id.region_item)); this.btnShopRegion.setOnClickListener(this); this.btnShopType = ((DPBasicItem)findViewById(R.id.channel_item)); this.btnShopType.setOnClickListener(this); this.address = ((EditText)((DPBasicItem)findViewById(R.id.address_item)).findViewById(R.id.itemInput)); this.near = ((EditText)((DPBasicItem)findViewById(R.id.near_item)).findViewById(R.id.itemInput)); this.phone = ((EditText)((DPBasicItem)findViewById(R.id.phone_item)).findViewById(R.id.itemInput)); this.phone.setText(city().areaCode() + "-"); this.email = ((EditText)((DPBasicItem)findViewById(R.id.email_item)).findViewById(R.id.itemInput)); this.submitButton = ((Button)findViewById(R.id.btn_add)); this.submitButton.setOnClickListener(this); this.submitButton.setEnabled(false); } public static DPObject[] subRegionList(DPObject[] paramArrayOfDPObject, int paramInt) { if (paramArrayOfDPObject == null) return null; ArrayList localArrayList = new ArrayList(); int j = paramArrayOfDPObject.length; int i = 0; while (i < j) { DPObject localDPObject = paramArrayOfDPObject[i]; if (localDPObject.getInt("ParentID") == paramInt) localArrayList.add(localDPObject); i += 1; } return (DPObject[])localArrayList.toArray(new DPObject[localArrayList.size()]); } private void triggerPrefill() { requestRegions(); requestCategories(); } private void updateShow() { dismissDialog(); updateView(this.shop); if (this.waiting4Regions) { onClick(this.btnShopRegion); this.waiting4Regions = false; } do return; while (!this.waiting4Categorys); onClick(this.btnShopType); this.waiting4Categorys = false; } private void updateView(DPObject paramDPObject) { if (paramDPObject == null) return; this.shopName.setText(paramDPObject.getString("Name")); this.address.setText(paramDPObject.getString("Address")); this.phone.setText(paramDPObject.getString("PhoneNo")); this.near.setText(paramDPObject.getString("CrossRoad")); this.shopName.addTextChangedListener(this.textWatcher); this.address.addTextChangedListener(this.textWatcher); this.phone.addTextChangedListener(this.textWatcher); this.near.addTextChangedListener(this.textWatcher); Object localObject1 = getAccount(); if ((localObject1 != null) && (((UserProfile)localObject1).email() != null)) this.email.setText(((UserProfile)localObject1).email()); localObject1 = mainRegionList(this.regions); int j = 0; int n = localObject1.length; int i = 0; label211: DPObject[] arrayOfDPObject; int m; int k; if (i < n) { localObject2 = localObject1[i]; if (((DPObject)localObject2).getInt("ID") == paramDPObject.getInt("RegionID")) { this.btnShopRegion.setSubTitle(((DPObject)localObject2).getString("Name")); this.btnShopRegion.setCount(null); this.btnShopRegion.build(); this.mainRegion = ((DPObject)localObject2); this.subRegion = null; } } else { this.initRegion = this.btnShopRegion.getSubTitle(); localObject2 = null; localObject1 = null; i = 0; arrayOfDPObject = this.categories; m = arrayOfDPObject.length; k = 0; } Object localObject4; Object localObject3; while (true) { localObject4 = localObject1; localObject3 = localObject2; if (k < m) { localObject3 = arrayOfDPObject[k]; j = i; if (((DPObject)localObject3).getInt("ID") == paramDPObject.getInt("ShopType")) { localObject2 = localObject3; j = i + 1; } i = j; if (((DPObject)localObject3).getInt("ID") == paramDPObject.getInt("CategoryID")) { localObject1 = localObject3; i = j + 1; } if (i >= 2) { localObject3 = localObject2; localObject4 = localObject1; } } else { Log.i(TAG, "shopTypeMatch: " + localObject3); Log.i(TAG, "categoryIdMatch: " + localObject4); if (localObject4 != null) break label611; if (localObject3 != null) { this.mainCategory = ((DPObject)localObject3); this.btnShopType.setSubTitle(this.mainCategory.getString("Name")); this.btnShopType.setCount(null); this.btnShopType.build(); } this.initCategory = this.btnShopType.getSubTitle(); return; localObject3 = subRegionList(this.regions, ((DPObject)localObject2).getInt("ID")); int i1 = localObject3.length; m = 0; while (true) { k = j; if (m < i1) { localObject4 = localObject3[m]; if (localObject4.getInt("ID") == paramDPObject.getInt("RegionID")) { this.btnShopRegion.setSubTitle(((DPObject)localObject2).getString("Name") + " - " + localObject4.getString("Name")); this.btnShopRegion.setCount(null); this.btnShopRegion.build(); this.mainRegion = ((DPObject)localObject2); this.subRegion = localObject4; k = 1; } } else { if (k != 0) break label211; i += 1; j = k; break; } m += 1; } } k += 1; } label611: localObject1 = null; Object localObject2 = this.categories; j = localObject2.length; i = 0; while (true) { paramDPObject = (DPObject)localObject1; if (i < j) { paramDPObject = localObject2[i]; if (localObject4.getInt("ParentID") != paramDPObject.getInt("ID")); } else { Log.i(TAG, "categoryIdMatchParent: " + paramDPObject); if (paramDPObject == null) break; this.mainCategory = paramDPObject; this.subCategory = localObject4; this.btnShopType.setSubTitle(this.mainCategory.getString("Name") + " - " + this.subCategory.getString("Name")); this.btnShopType.setCount(null); this.btnShopType.build(); this.initCategory = this.btnShopType.getSubTitle(); return; } i += 1; } this.mainCategory = ((DPObject)localObject3); this.subCategory = localObject4; if (this.mainCategory != null) this.btnShopType.setSubTitle(this.mainCategory.getString("Name") + " - " + this.subCategory.getString("Name")); while (true) { this.btnShopType.setCount(null); this.btnShopType.build(); break; this.btnShopType.setSubTitle(this.subCategory.getString("Name")); } } boolean checkShouldShowAlertDialog() { if (isInfoChanged(getUserInput())) { new AlertDialog.Builder(this).setTitle("提示").setMessage("尚未提交,确定放弃修改吗?").setPositiveButton("确定", new DialogInterface.OnClickListener() { public void onClick(DialogInterface paramDialogInterface, int paramInt) { ShopEditActivity.this.finish(); } }).setNegativeButton("取消", new DialogInterface.OnClickListener() { public void onClick(DialogInterface paramDialogInterface, int paramInt) { } }).show(); return true; } return false; } protected TitleBar initCustomTitle() { return TitleBar.build(this, 6); } public void onAccountSwitched(UserProfile paramUserProfile) { if (paramUserProfile == null) finish(); } protected void onActivityResult(int paramInt1, int paramInt2, Intent paramIntent) { super.onActivityResult(paramInt1, paramInt2, paramIntent); if (paramInt1 == 37) if (paramInt2 == -1) { this.mainCategory = ((DPObject)paramIntent.getParcelableExtra("resultExtra")); this.subCategory = ((DPObject)paramIntent.getParcelableExtra("result")); update(); } do return; while ((paramInt1 != 38) || (paramInt2 != -1)); this.mainRegion = ((DPObject)paramIntent.getParcelableExtra("resultExtra")); this.subRegion = ((DPObject)paramIntent.getParcelableExtra("result")); update(); } public void onClick(View paramView) { if (!this.isClicked) { if (!paramView.equals(this.btnShopRegion)) break label82; if (this.regions != null) break label47; this.isClicked = true; triggerPrefill(); showProgressDialog("载入中..."); this.waiting4Regions = true; } label47: label82: do { return; startActivityForResult("dianping://regionfilter?source=addshop&cityid=" + this.shop.getInt("CityID"), 38); return; if (!paramView.equals(this.btnShopType)) continue; if (this.categories == null) { this.isClicked = true; triggerPrefill(); showProgressDialog("载入中..."); this.waiting4Categorys = true; return; } paramView = new Intent("android.intent.action.VIEW", Uri.parse("dianping://choosecategory?=false&cityid=")); paramView.putExtra("hastopcategory", false); paramView.putExtra("hashotcategory", false); paramView.putExtra("hasAllSubCategory", false); paramView.putExtra("cityid", this.shop.getInt("CityID")); startActivityForResult(paramView, 37); return; } while (paramView.getId() != R.id.btn_add); submit(); } public void onCreate(Bundle paramBundle) { super.onCreate(paramBundle); super.setContentView(R.layout.shop_edit_frame); super.setTitle("修改错误信息"); this.callId = UUID.randomUUID().toString(); StringBuilder localStringBuilder; if (paramBundle == null) { this.shop = ((DPObject)getIntent().getParcelableExtra("shop")); paramBundle = this.shop.getString("BranchName"); localStringBuilder = new StringBuilder().append(this.shop.getString("Name")); if ((paramBundle != null) && (paramBundle.length() != 0)) break label145; } label145: for (paramBundle = ""; ; paramBundle = "(" + paramBundle + ")") { super.setSubtitle(paramBundle); setupView(); this.leftTitleButton.setOnClickListener(new View.OnClickListener() { public void onClick(View paramView) { if (!ShopEditActivity.this.checkShouldShowAlertDialog()) ShopEditActivity.this.finish(); } }); return; this.shop = ((DPObject)paramBundle.getParcelable("shop")); break; } } protected void onDestroy() { super.onDestroy(); if (this.prefillRegion != null) mapiService().abort(this.prefillRegion, this, true); if (this.addShopRequest != null) mapiService().abort(this.addShopRequest, this, true); } public boolean onKeyDown(int paramInt, KeyEvent paramKeyEvent) { if ((paramInt == 4) && (checkShouldShowAlertDialog())) return true; return super.onKeyDown(paramInt, paramKeyEvent); } public void onProgressDialogCancel() { super.onProgressDialogCancel(); if (this.addShopRequest != null) mapiService().abort(this.addShopRequest, this, true); } public void onRequestFailed(MApiRequest paramMApiRequest, MApiResponse paramMApiResponse) { if (paramMApiRequest == this.prefillRegion) this.prefillRegion = null; if (paramMApiRequest == this.prefillCategory) this.prefillCategory = null; if (paramMApiResponse.message() != null) showMessageDialog(paramMApiResponse.message()); } public void onRequestFinish(MApiRequest paramMApiRequest, MApiResponse paramMApiResponse) { if (paramMApiRequest == this.prefillRegion) this.prefillRegion = null; try { this.regions = ((DPObject[])(DPObject[])paramMApiResponse.result()); doPrefill(); label33: if (paramMApiRequest == this.prefillCategory) this.prefillCategory = null; try { this.categories = ((DPObject[])(DPObject[])paramMApiResponse.result()); doPrefill(); label66: if (paramMApiRequest == this.addShopRequest) { this.addShopRequest = null; if (paramMApiResponse.result() == null); } try { Toast.makeText(this, ((DPObject)paramMApiResponse.result()).getString("Content"), 0).show(); paramMApiRequest = new ArrayList(); if (this.shop != null) paramMApiRequest.add(new BasicNameValuePair("shopid", String.valueOf(this.shop.getInt("ID")))); statisticsEvent("addfeedback5", "addfeedback5_modify", "", 0, paramMApiRequest); finish(); return; } catch (Exception paramMApiRequest) { paramMApiRequest.printStackTrace(); return; } } catch (Exception localException1) { break label66; } } catch (Exception localException2) { break label33; } } protected void onRestoreInstanceState(Bundle paramBundle) { Object localObject2 = null; super.onRestoreInstanceState(paramBundle); Object localObject1 = paramBundle.getParcelableArrayList("regions"); if (localObject1 == null) { localObject1 = null; this.regions = ((DPObject)localObject1); localObject1 = paramBundle.getParcelableArrayList("categorys"); if (localObject1 != null) break label154; } label154: for (localObject1 = localObject2; ; localObject1 = (DPObject[])((ArrayList)localObject1).toArray(new DPObject[0])) { this.categories = ((DPObject)localObject1); this.mainRegion = ((DPObject)paramBundle.getParcelable("mainRegion")); this.subRegion = ((DPObject)paramBundle.getParcelable("subRegion")); this.mainCategory = ((DPObject)paramBundle.getParcelable("mainCategory")); this.subCategory = ((DPObject)paramBundle.getParcelable("subCategory")); this.callId = paramBundle.getString("callId"); this.initRegion = paramBundle.getString("initRegion"); this.initCategory = paramBundle.getString("initCategory"); update(); return; localObject1 = (DPObject[])((ArrayList)localObject1).toArray(new DPObject[0]); break; } } protected void onResume() { super.onResume(); if ((this.regions == null) || (this.categories == null)) { triggerPrefill(); showProgressDialog("载入中..."); } } protected void onSaveInstanceState(Bundle paramBundle) { Object localObject2 = null; if (this.regions == null) { localObject1 = null; paramBundle.putParcelableArrayList("regions", (ArrayList)localObject1); if (this.categories != null) break label148; } label148: for (Object localObject1 = localObject2; ; localObject1 = new ArrayList(Arrays.asList(this.categories))) { paramBundle.putParcelableArrayList("categorys", (ArrayList)localObject1); paramBundle.putParcelable("shop", this.shop); paramBundle.putParcelable("mainRegion", this.mainRegion); paramBundle.putParcelable("subRegion", this.subRegion); paramBundle.putParcelable("mainCategory", this.mainCategory); paramBundle.putParcelable("subCategory", this.subCategory); paramBundle.putString("callId", this.callId); paramBundle.putString("initRegion", this.initRegion); paramBundle.putString("initCategory", this.initCategory); super.onSaveInstanceState(paramBundle); return; localObject1 = new ArrayList(Arrays.asList(this.regions)); break; } } public void submit() { if (this.shopName.getText().toString().trim().length() == 0) { this.shopName.setText(null); this.shopName.setError(Html.fromHtml("<font color=#ff0000>请填写商户名</font>")); this.shopName.requestFocus(); return; } if (this.mainRegion == null) { Toast.makeText(this, "请选择行政区", 0).show(); return; } if (this.mainCategory == null) { Toast.makeText(this, "请选择频道", 0).show(); return; } if (this.address.getText().toString().trim().length() == 0) { this.address.setText(null); this.address.setError(Html.fromHtml("<font color=#ff0000>请填写地址</font>")); this.address.requestFocus(); return; } ShopInfo localShopInfo = getUserInput(); if (!isInfoChanged(localShopInfo)) { finish(); return; } label172: Object localObject; String str2; int i; if (getAccount() == null) { str1 = this.email.getText().toString(); if (!isEmailValidate(str1)) break label462; localObject = new StringBuilder("http://m.api.dianping.com/addshopfeedback.bin?"); ((StringBuilder)localObject).append("flag=").append(3); ((StringBuilder)localObject).append("&shopid=").append(localShopInfo.shopId); str2 = ((StringBuilder)localObject).toString(); i = localShopInfo.shopId; localObject = str1; if ("".equals(str1)) localObject = Environment.deviceId(); if (getAccount() != null) break label464; } label462: label464: for (String str1 = ""; ; str1 = accountService().token()) { this.addShopRequest = BasicMApiRequest.mapiPost(str2, new String[] { "flag", String.valueOf(3), "shopId", String.valueOf(i), "email", localObject, "token", str1, "categoryid", String.valueOf(localShopInfo.categoryId), "regionid", String.valueOf(localShopInfo.regionId), "shopname", localShopInfo.shopName, "address", localShopInfo.address, "crossroad", localShopInfo.crossRoad, "phone", localShopInfo.phone, "callid", this.callId }); mapiService().exec(this.addShopRequest, this); showProgressDialog("正在提交商户信息..."); return; str1 = getAccount().email(); break label172; break; } } public void update() { String str2 = null; if (this.mainRegion != null) str2 = this.mainRegion.getString("Name"); String str1 = str2; label99: String str3; if (this.subRegion != null) { if ((str2 != null) && (str2.length() > 0)) str1 = str2 + " - " + this.subRegion.getString("Name"); } else { if ((str1 == null) || (str1.length() <= 0)) break label265; this.btnShopRegion.setSubTitle(str1); this.btnShopRegion.setCount(null); this.btnShopRegion.build(); str2 = null; if (this.mainCategory != null) str2 = this.mainCategory.getString("Name"); str3 = str2; if (this.subCategory != null) { if ((str2 == null) || (str2.length() <= 0)) break label286; str3 = str2 + " - " + this.subCategory.getString("Name"); } label178: if ((str3 == null) || (str3.length() <= 0)) break label299; this.btnShopType.setSubTitle(str3); this.btnShopType.setCount(null); label205: this.btnShopType.build(); if (!this.hasChanged) { if ((this.initRegion != null) && (this.initCategory != null)) break label320; this.hasChanged = true; this.submitButton.setEnabled(true); } } while (true) { this.isClicked = false; return; str1 = this.subRegion.getString("Name"); break; label265: this.btnShopRegion.setSubTitle(null); this.btnShopRegion.setCount("请选择地区"); break label99; label286: str3 = this.subCategory.getString("Name"); break label178; label299: this.btnShopType.setSubTitle(null); this.btnShopType.setCount("请选择频道"); break label205; label320: if ((this.initRegion.equals(str1)) && (this.initCategory.equals(str3))) continue; this.hasChanged = true; this.submitButton.setEnabled(true); } } private static class ShopInfo { String address; int categoryId; String crossRoad; String phone; int regionId; int shopId; String shopName; } } /* Location: C:\Users\xuetong\Desktop\dazhongdianping7.9.6\ProjectSrc\classes-dex2jar.jar * Qualified Name: com.dianping.main.user.activity.ShopEditActivity * JD-Core Version: 0.6.0 */
[ "xuetong@dkhs.com" ]
xuetong@dkhs.com
60cb0160d45e0f6eaa43a870c36977254fc3d5d9
753c9e8d3dee87b46990b0b8459084a3f7c84e23
/dubbo-demo/sc-call-dubbo/sc-dubbo-provider/src/main/java/org/apache/dubbo/demo/provider/Application.java
bcfa07d3a986a444879caebcc9fa6d2a0ddee1ca
[ "Apache-2.0", "MIT" ]
permissive
jhldelight/dubbo
573e51e3ee2e818518e82cb90bba9c69b3d26272
505ffd5a5dd66e1ea7f383734ab5a5fb5b4e8867
refs/heads/master
2020-08-30T03:37:25.317009
2019-10-29T09:21:20
2019-10-29T09:21:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,948
java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.dubbo.demo.provider; import org.apache.dubbo.bootstrap.DubboBootstrap; import org.apache.dubbo.config.ApplicationConfig; import org.apache.dubbo.config.ProtocolConfig; import org.apache.dubbo.config.RegistryConfig; import org.apache.dubbo.config.inner.ServiceConfig; import org.apache.dubbo.demo.provider.rest.UserService; import org.apache.dubbo.demo.provider.rest.UserServiceImpl; public class Application { public static void main(String[] args) throws Exception { ServiceConfig<UserService> service = new ServiceConfig<>(); service.setInterface(UserService.class); service.setRef(new UserServiceImpl()); ProtocolConfig protocolConfig = new ProtocolConfig("rest"); protocolConfig.setPort(8090); DubboBootstrap bootstrap = DubboBootstrap.getInstance(); bootstrap.application(new ApplicationConfig("dubbo-provider-for-sc")) .registry(new RegistryConfig("consul://127.0.0.1:8500?registry-type=service")) .protocol(protocolConfig) .service(service) .start(); System.in.read(); } }
[ "ken.lj.hz@gmail.com" ]
ken.lj.hz@gmail.com
43c9129c0a27641d540e83f97dddcc5e752d8c95
c9e6e8c8a0158ea83d67ba9d581849295c70861f
/src/main/java/marek/repositories/ItemRepositoryImpl.java
0d6b25fd1887d075dbb97575715e395a6aeab7e5
[]
no_license
marekmarecki28/RestAPIBack
f0ea0931b47c43c733b78dc0879256dc93c1e1b7
4f0a4bbb4c32198f8861607d253076d5deb42c81
refs/heads/master
2021-08-28T04:27:25.580625
2021-08-05T09:28:06
2021-08-05T09:28:06
213,905,797
0
0
null
null
null
null
UTF-8
Java
false
false
594
java
package marek.repositories; import java.util.List; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.Query; import marek.model.Item; public class ItemRepositoryImpl implements ItemRepositoryCustom { @PersistenceContext EntityManager entityManager; @Override public List<Item> findAll(Long id) { Query query = entityManager.createNativeQuery("SELECT * FROM item " + "WHERE list_id LIKE ?", Item.class); query.setParameter(1, id); return query.getResultList(); } }
[ "marek@marek.pl" ]
marek@marek.pl
b0a1ef22b5475aa555f30232b1058fac00b4f53e
6f34c87fe5d38ff5fa2e35a08ba2b67d0fc766eb
/EJBank-ejb/src/main/java/com/ejbank/pojos/AccountWithoutUserPOJO.java
c52693b03ba68b8f41a3e055dceb092cb3c71e67
[]
no_license
Mathis77/ejbank
9c2ca1af4ac96685c5731a7db8951c40e7f8a3a9
685f85641301f6c32598077e2fa3a880d7957fb8
refs/heads/master
2022-05-01T23:39:13.820825
2020-01-26T11:03:19
2020-01-26T11:03:19
222,882,862
0
0
null
2022-03-08T21:18:03
2019-11-20T08:02:13
Java
UTF-8
Java
false
false
493
java
package com.ejbank.pojos; import java.util.Objects; public class AccountWithoutUserPOJO implements AccountPOJO{ private final int id; private final String type; private final float amount; public AccountWithoutUserPOJO(int id, String type, float amount) { this.id = id; this.type = Objects.requireNonNull(type); this.amount = amount; } public int getId() { return id; } public String getType() { return type; } public float getAmount() { return amount; } }
[ "ryb.mathis@hotmail.fr" ]
ryb.mathis@hotmail.fr
580f7c87b5ffeb4aaf0732d308a50d4d0209b320
600d85214cd790c7eb0701f5994bf9a78264cdd2
/Number/BigDecimal/Multiplying-BigDecimals.java
7afedf15bdbc4b593704033c8d5eb60c6d657619
[]
no_license
rchicoli/ispycode-java
243c931a877f30a1a91bd0c7e05bf31fbde2c037
3a5f6d8c4b44d99b0813d6b5a3d53d43301cbd32
refs/heads/master
2020-03-20T11:38:14.938694
2018-06-14T21:14:59
2018-06-14T21:14:59
137,408,053
0
0
null
null
null
null
UTF-8
Java
false
false
298
java
import java.math.BigDecimal; public class Example { public static void main(String[] args) { BigDecimal bd1 = new BigDecimal("11.11"); BigDecimal bd2 = new BigDecimal("22.22"); BigDecimal total = bd1.multiply(bd2); System.out.println("Total: " + total); } }
[ "rafaelchicoli@hotmail.com" ]
rafaelchicoli@hotmail.com
a0c2c774d0c11fe67fd1edde167937c8ab435742
3dc70afd3719aa4a86e412043f72439bb6cd6e77
/src/test/java/com/sidecarhealth/assignmemt/coding/controller/EmployeeControllerTest.java
9ba5def6f09aa48fa6fb048f7b60c27bc71bf3a3
[]
no_license
jflee0315/coding
a8a45f3bc0ce0545559f5b29a3b50e70d18740c3
d29b7fd14c21ff1d5603d4459323084b74641e0c
refs/heads/master
2022-12-22T00:45:34.569610
2020-09-09T03:32:13
2020-09-09T03:32:13
292,434,458
0
0
null
null
null
null
UTF-8
Java
false
false
3,004
java
package com.sidecarhealth.assignmemt.coding.controller; import com.sidecarhealth.assignmemt.coding.dao.EmployeeDao; import com.sidecarhealth.assignmemt.coding.model.Employee; import org.apache.logging.log4j.Logger; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import static org.mockito.Mockito.*; class EmployeeControllerTest { @InjectMocks EmployeeController controller; /* Normally, I would create a service layer and avoid accessing dao in controller directly. That is to encapsulate the business logic in the service layer. But it is probably an overkill in this case. */ @Mock EmployeeDao dao; @Mock Logger logger; private static Employee employeeMock; @BeforeAll static void setupMock() { employeeMock = new Employee(); employeeMock.setId("test id"); employeeMock.setName("test name"); } @BeforeEach public void initMock() { MockitoAnnotations.initMocks(this); } @Test @DisplayName("Get single employee with id") public void testGetEmployee() { controller.getEmployee(employeeMock.getId()); verify(dao, times(1)).read(employeeMock.getId()); } @Test @DisplayName("Update an employee") public void testPutEmployee() { when(dao.update(employeeMock)).thenReturn(true); controller.putEmployee(employeeMock); verify(dao, times(1)).update(employeeMock); verify(dao, times(0)).create(employeeMock); } @Test @DisplayName("Should create a new employee when it can't be found") public void testUpdateCreateEmployee() { when(dao.update(employeeMock)).thenReturn(false); controller.putEmployee(employeeMock); verify(dao, times(1)).update(employeeMock); verify(dao, times(1)).create(employeeMock); verify(logger, times(1)).info(anyString()); } @Test @DisplayName("Should create employee") public void testCreateEmployee() { controller.createEmployee(employeeMock); verify(dao, times(1)).create(employeeMock); } @Test @DisplayName("Should delete the employee") public void testDeleteEmployee() { controller.deleteEmployee(employeeMock.getId()); verify(dao, times(1)).delete(employeeMock.getId()); } @Test @DisplayName("Get employee count") public void testGetEmployeeCount() { when(dao.getEmployeeCount()).thenReturn(0); controller.getEmployeeCount(); verify(dao, times(1)).getEmployeeCount(); } @Test @DisplayName("Get all employees") public void testGetAllEmployees() { when(dao.getAllEmployees()).thenReturn(null); controller.getAllEmployee(); verify(dao, times(1)).getAllEmployees(); } }
[ "jflee0315@gmail.com" ]
jflee0315@gmail.com
f14384dfd966c5e061cb36c62e2805bbdd9b9843
1c2fc95d66ea34fdcb4f2352c8d2d362b3b5b367
/Test/net/net/multicast/MulticastClient.java
37ff781b82e9a5f57c4b87982928bcd07322cbbb
[]
no_license
lryxxh/Study
2473647837535055af9cf3f6c048a81cc09be2bb
47c556afeff8223aba3e324407fe6af97071884a
refs/heads/master
2020-12-02T12:46:27.455563
2017-07-08T03:07:22
2017-07-08T03:07:22
96,589,823
0
0
null
null
null
null
GB18030
Java
false
false
899
java
/** * */ package net.multicast; import java.net.DatagramPacket; import java.net.DatagramSocket; import java.net.InetAddress; public class MulticastClient{ String groupHost="192.168.20.1"; //组播组虚拟IP int port=5678; //端口 public MulticastClient(){ try{ byte[] message = "Hello,This is Client.".getBytes(); //发送信息 InetAddress inetAddress = InetAddress.getByName(groupHost); //组播地址 DatagramPacket datagramPacket= new DatagramPacket(message, message.length, inetAddress, port); //发送数据报 DatagramSocket socket = new DatagramSocket(); //DatagramSocket实例 socket.send(datagramPacket); //发送数据 socket.close(); //关闭端口 } catch (Exception exception) { exception.printStackTrace(); //输出错误信息 } } public static void main(String[] args){ new MulticastClient(); } }
[ "lryxxh@163.com" ]
lryxxh@163.com
35a4fe9579b8935222b4b41bbbc2724d84e852c5
2bd4f051d2848dbdbf640fc1dea2fad5e71baf5d
/xmall-entity/src/main/java/com/augustars/xmall/entity/Rank.java
4a43c8acf66327f876c89274e751086a6b047a27
[]
no_license
Ninebabies/xmall
d4ccc3d7b1d1444348c5d6a758637323033ff39d
c76ec09a660614193b6b96991bf49ca6adda5d84
refs/heads/master
2020-04-01T20:07:24.371924
2018-10-23T12:28:34
2018-10-23T12:28:34
152,202,528
0
0
null
null
null
null
UTF-8
Java
false
false
2,824
java
package com.augustars.xmall.entity; import java.io.Serializable; import java.util.Date; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; @Entity @Table(name="sys_rank") public class Rank implements Serializable{ private static final long serialVersionUID = 1L; private Long rankId; // 会员等级主键 private String rankName; // 等级名称 private Integer lowestPoint; // 最低积分 private Integer highestPoint; // 最高积分 private Long sortOrder; // 排序 private User createUser; // 创建人 private Date createTime; // 创建时间 private User updateUser; // 修改人 private Date updateTime; // 修改时间 @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @Column(name="rank_id") public Long getRankId() { return rankId; } public void setRankId(Long rankId) { this.rankId = rankId; } @Column(name="rank_name") public String getRankName() { return rankName; } public void setRankName(String rankName) { this.rankName = rankName; } @Column(name="lowest_point") public Integer getLowestPoint() { return lowestPoint; } public void setLowestPoint(Integer lowestPoint) { this.lowestPoint = lowestPoint; } @Column(name="highest_point") public Integer getHighestPoint() { return highestPoint; } public void setHighestPoint(Integer highestPoint) { this.highestPoint = highestPoint; } @Column(name="sort_order") public Long getSortOrder() { return sortOrder; } public void setSortOrder(Long sortOrder) { this.sortOrder = sortOrder; } @ManyToOne(targetEntity=User.class, cascade= {CascadeType.PERSIST,CascadeType.MERGE}) @JoinColumn(name="create_user") public User getCreateUser() { return createUser; } public void setCreateUser(User createUser) { this.createUser = createUser; } @Temporal(TemporalType.TIMESTAMP) public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } @ManyToOne(targetEntity=User.class, cascade= {CascadeType.PERSIST,CascadeType.MERGE}) @JoinColumn(name="update_user") public User getUpdateUser() { return updateUser; } public void setUpdateUser(User updateUser) { this.updateUser = updateUser; } @Temporal(TemporalType.TIMESTAMP) public Date getUpdateTime() { return updateTime; } public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; } }
[ "Administrator@192.168.0.107" ]
Administrator@192.168.0.107
5fdb8e3c452a8923a83eca7566f6a615b9c70979
c3597d6206d47140746c36c58ec2b0b1391a1770
/src/main/java/com/example/Screens/Following.java
47664dd11f21ef39cff3e76b903c455bd5f92386
[]
no_license
shaban-rayeen/Insta-Dashboard
0423026548fb16c9fe600683c6be4c79b9e66a07
db0656fe70310ae64de0958b3705ffaa6ab30636
refs/heads/master
2023-07-26T23:19:36.803469
2021-09-03T10:28:44
2021-09-03T10:28:44
402,688,332
0
0
null
null
null
null
UTF-8
Java
false
false
610
java
package com.example.Screens; import java.awt.Font; import javax.swing.JLabel; import org.json.JSONObject; public class Following extends JLabel { public Following(JSONObject obj){ JSONObject ob1 = obj.getJSONObject("graphql"); JSONObject ob2 = ob1.getJSONObject("user"); JSONObject ob3 = ob2.getJSONObject("edge_follow"); String following = ob3.getNumber("count").toString(); this.setBounds(20,640,600,20); this.setText("Number of Following : " + following); this.setFont(new Font("Italic",Font.PLAIN,18)); this.setLayout(null); } }
[ "shabanrayeen@gmail.com" ]
shabanrayeen@gmail.com
7186f62e13ab474343510dc7113fbbe2f875b579
939bc7e11e0faf504aec0c67becfcab47e63b45c
/src/main/java/com/sapient/casestudy/controller/ProductController.java
4cdb2d476c3604cc8d3fd185c18f9869176003cc
[]
no_license
yashgupta92/sapientCaseStudy
0959ffe5063cde857085edc029102bf3837df03e
147c6428a9f9098dfcba878ef42fe126db00d236
refs/heads/master
2021-01-02T10:22:17.162837
2020-02-10T18:24:44
2020-02-10T18:24:44
239,576,562
0
0
null
null
null
null
UTF-8
Java
false
false
1,576
java
package com.sapient.casestudy.controller; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import com.sapient.casestudy.dao.ProductRepository; import com.sapient.casestudy.model.Product; @RestController public class ProductController { @Autowired private ProductRepository repository; @GetMapping("/getProductsByBrand/{brand}") public List<Product> getProductByBrand(@PathVariable String brand) { return repository.findByBrand(brand); } @GetMapping("/getProductsByColor/{color}") public List<Product> findByColor(@PathVariable String color) { return repository.findByColor(color); } @GetMapping("/getProductsBySize/{size}") public List<Product> findBySize(@PathVariable String size) { return repository.findBySize(size); } @GetMapping("/getProductBySKU/{sku}") public Product findBySKU(@PathVariable String sku) { return repository.findBySKU(sku); } @GetMapping("/getProductByPriceRange") public List<Product> findProductByPriceRange(@RequestParam Double from, @RequestParam Double to) { return repository.findProductByPriceRange(from, to); } @GetMapping("/getcountBySeller/{seller}") public int getcountBySeller(@PathVariable String seller) { return repository.getcountBySeller(seller); } }
[ "noreply@github.com" ]
noreply@github.com
be5b812336e28f0509a8218ba56a83cc43021b7d
293591a5bf23512919a9e30f1a3be4470d59ce30
/ClearTrip/src/com/ClearTrip/Pages/SearchResultsPage.java
f251aefb274e39a7617065f3488f9c9dec730742
[]
no_license
ravimidathala/ClearTrip
12bf97e6a0f4d12b8b1b62c70cdb596d3644cdc9
415db1f047f2fcf7da02eb4251285846b9f80bd9
refs/heads/master
2021-05-08T07:51:37.823507
2017-10-14T14:52:44
2017-10-14T14:52:44
106,935,558
0
0
null
null
null
null
UTF-8
Java
false
false
884
java
package com.ClearTrip.Pages; import java.io.IOException; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.PageFactory; import org.openqa.selenium.support.FindBy; import com.ClearTrip.CommonFunctions.BaseTest; public class SearchResultsPage extends BaseTest { public SearchResultsPage(WebDriver driver) { this.driver=driver; } @FindBy (xpath = "//*[@id='flightForm']/section[2]/div[4]/div/nav/ul/li[1]/table/tbody/tr[2]/td[3]/button") WebElement bookButton; public SearchResultDetailPage clickOnBookButton () throws IOException { try { Thread.sleep(1000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } click(bookButton); return PageFactory.initElements(driver, SearchResultDetailPage.class); } }
[ "Ravi@Ravi-PC" ]
Ravi@Ravi-PC
d02bed377e6ed7e1bbfe9553eb1ebb5391e811c0
4900e3fd0b5f224a500dee34a01f3dfb0b062c10
/src/main/java/rest/GenreResource.java
d415aab49d7e5bedd245dfb0020d78a0f0383803
[]
no_license
msKlan/exam_sem3_backend
5e8fd7fa55e14d8b3b821aae93b36c5342944c9c
495da0b86afd37b57514f97f3adfe5487de8f319
refs/heads/master
2022-07-03T17:23:43.124035
2020-01-15T21:42:29
2020-01-15T21:42:29
234,116,453
0
0
null
null
null
null
UTF-8
Java
false
false
6,462
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 rest; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import dto.GenresDTO; import dto.GenreDTO; import entities.Genre; import facades.GenreFacade; import io.swagger.v3.oas.annotations.OpenAPIDefinition; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.info.Contact; import io.swagger.v3.oas.annotations.info.Info; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.servers.Server; import io.swagger.v3.oas.annotations.tags.Tag; import java.util.ArrayList; import java.util.List; import javax.annotation.security.RolesAllowed; import javax.persistence.EntityManagerFactory; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import utils.EMF_Creator; /** * * @author Klan */ @OpenAPIDefinition(info = @Info(title = "Simple genre API", version = "0.4", description = "Simple API to get info about Genres.", contact = @Contact(name = "Michael Sander Klan", email = "michaelsanderklan@gmail.com")), tags = { @Tag(name = "Genre", description = "API related to genres") }, servers = { @Server(description = "For Local host testing", url = "http://localhost:8080/exam_sem3/"), @Server(description = "Server API", url = "https://aieou.dk/exam_sem3/") }) @Path("genre") public class GenreResource { private static final EntityManagerFactory EMF = EMF_Creator .createEntityManagerFactory(EMF_Creator.DbSelector.DEV, EMF_Creator.Strategy.CREATE); private static final GenreFacade FACADE = GenreFacade.getGenreFacade(EMF); private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create(); @Operation(summary = "Shows Hello World - Genre", tags = { "Genre" }, responses = { @ApiResponse(content = @Content(mediaType = "application/json", schema = @Schema(implementation = GenreDTO.class))), @ApiResponse(responseCode = "200", description = "The rest interface is running genre"), @ApiResponse(responseCode = "400", description = "The rest interface is probably not running") }) @GET @Produces({ MediaType.APPLICATION_JSON }) public String demo() { return "{\"msg\":\"Hello World\"}"; } @Operation(summary = "Get Genre by ID", tags = { "Genre" }, responses = { @ApiResponse(content = @Content(mediaType = "application/json", schema = @Schema(implementation = GenreDTO.class))), @ApiResponse(responseCode = "200", description = "The requested Genre"), @ApiResponse(responseCode = "400", description = "Genre not found") }) @GET @Path("id/{id}") @Produces(MediaType.APPLICATION_JSON) public GenreDTO getGenreByID(@PathParam("id") int id) { GenreDTO genre = FACADE.getGenre(id); return genre; } @Operation(summary = "Get All Genres", tags = { "Genre" }, responses = { @ApiResponse(content = @Content(mediaType = "application/json", schema = @Schema(implementation = GenresDTO.class))), @ApiResponse(responseCode = "200", description = "The requested Genre"), @ApiResponse(responseCode = "400", description = "Genre not found") }) @GET @Path("all") @Produces({ MediaType.APPLICATION_JSON }) public List<GenreDTO> getAllGenres() { return FACADE.getAllGenres().getAll(); } @Operation(summary = "Add a Genre", tags = { "Genre" }, responses = { @ApiResponse(content = @Content(mediaType = "application/json", schema = @Schema(implementation = GenreDTO.class))), @ApiResponse(responseCode = "200", description = "The added Genre"), @ApiResponse(responseCode = "400", description = "Invalid input") }) @POST @Path("add") @Produces({ MediaType.APPLICATION_JSON }) @RolesAllowed({ "useradmin", "admin" }) public GenreDTO addGenre(String genre) { Genre g = GSON.fromJson(genre, Genre.class); GenreDTO genreDTO = new GenreDTO(g); FACADE.addGenre(genreDTO); return genreDTO; } @Operation(summary = "Edit a Genre", tags = { "Genre" }, responses = { @ApiResponse(content = @Content(mediaType = "application/json", schema = @Schema(implementation = GenreDTO.class))), @ApiResponse(responseCode = "200", description = "The edited Genre"), @ApiResponse(responseCode = "400", description = "Genre not found") }) @PUT @Path("edit") @Produces({ MediaType.APPLICATION_JSON }) @Consumes(MediaType.APPLICATION_JSON) @RolesAllowed({ "useradmin", "admin" }) public GenreDTO editHobby(String genre) { Genre g = GSON.fromJson(genre, Genre.class); GenreDTO genreDTO = new GenreDTO(g); FACADE.editGenre(genreDTO); return genreDTO; } @Operation(summary = "Remove/Delete a Genre", tags = { "Genre" }, responses = { @ApiResponse(content = @Content(mediaType = "application/json", schema = @Schema(implementation = GenreDTO.class))), @ApiResponse(responseCode = "200", description = "The Removed Genre"), @ApiResponse(responseCode = "400", description = "Genre not found") }) @DELETE @Path("delete/{id}") @Produces({ MediaType.APPLICATION_JSON }) @Consumes(MediaType.APPLICATION_JSON) @RolesAllowed({ "useradmin", "admin" }) public GenreDTO removeGenre(@PathParam("id") int id) { return FACADE.removeGenre(id); } }
[ "michaelsanderklan@gmail.com" ]
michaelsanderklan@gmail.com
14e9ad6291f987b7b5956007597978bbc4278f37
2dd6c4dc7e9d36403689f12fae1bff0bf3fc0e19
/Payment.java
3347af5e01c385be2bc55a479bc4c94379f8e852
[]
no_license
bbydr/ESOEN
2df8080b297af6274af6f4bf0da554e1c0f6e679
498bae750512bf52f9b0b57b63a7ce5cec5f2c28
refs/heads/main
2023-03-29T05:45:18.993378
2021-04-12T07:37:19
2021-04-12T07:37:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,173
java
/** * */ /** * <!-- begin-UML-doc --> * <!-- end-UML-doc --> * @author besba * @generated "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)" */ public class Payment { /** * <!-- begin-UML-doc --> * <!-- end-UML-doc --> * @generated "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)" */ private Customer customer; /** * <!-- begin-UML-doc --> * <!-- end-UML-doc --> * @generated "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)" */ private Card card; /** * <!-- begin-UML-doc --> * <!-- end-UML-doc --> * @generated "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)" */ private Confirmation confirmation; /** * <!-- begin-UML-doc --> * <!-- end-UML-doc --> * @generated "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)" */ private Refund refund; /** * <!-- begin-UML-doc --> * <!-- end-UML-doc --> * @generated "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)" */ private ReservationCollection reservationCollection; /** * <!-- begin-UML-doc --> * <!-- end-UML-doc --> * @generated "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)" */ private Admin admin; /** * <!-- begin-UML-doc --> * <!-- end-UML-doc --> * @generated "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)" */ private int method; /** * <!-- begin-UML-doc --> * <!-- end-UML-doc --> * @generated "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)" */ private int paymentID; /** * <!-- begin-UML-doc --> * <!-- end-UML-doc --> * @generated "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)" */ private String currency; /** * <!-- begin-UML-doc --> * <!-- end-UML-doc --> * @generated "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)" */ public void make() { // begin-user-code // TODO Auto-generated method stub // end-user-code } }
[ "noreply@github.com" ]
noreply@github.com
2ac1a6b3731a935bbca4c6c890dd2af73b992ffd
7c1ec11e0663efd376913aaac87c9530221db2f7
/commons-httpclient/src/main/java/org/apache/commons/httpclient/auth/AuthScope.java
f5df0a8a6b43a21719de2ecaeeaeea604979dda4
[ "Apache-2.0" ]
permissive
wso2/wso2-commons-httpclient
896fe7aac25c90ca6f3e7f8862802285f9462732
0cde681708acbc94b28ff85d4591f734db57d60f
refs/heads/master
2023-08-22T17:54:31.727658
2022-02-21T05:27:41
2022-02-21T05:27:41
59,086,768
36
34
Apache-2.0
2022-04-18T03:43:10
2016-05-18T06:06:27
Java
UTF-8
Java
false
false
10,374
java
/* * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//httpclient/src/java/org/apache/commons/httpclient/auth/AuthScope.java,v 1.2 2004/06/23 06:50:25 olegk Exp $ * $Revision: 480424 $ * $Date: 2006-11-29 06:56:49 +0100 (Wed, 29 Nov 2006) $ * * ==================================================================== * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * */ package org.apache.commons.httpclient.auth; import org.apache.commons.httpclient.util.LangUtils; /** * The class represents an authentication scope consisting of a host name, * a port number, a realm name and an authentication scheme name which * {@link org.apache.commons.httpclient.Credentials} apply to. * * @author <a href="mailto:oleg@ural.ru">Oleg Kalnichevski</a> * @author <a href="mailto:adrian@intencha.com">Adrian Sutton</a> * * @since 3.0 */ public class AuthScope { /** * The <tt>null</tt> value represents any host. In the future versions of * HttpClient the use of this parameter will be discontinued. */ public static final String ANY_HOST = null; /** * The <tt>-1</tt> value represents any port. */ public static final int ANY_PORT = -1; /** * The <tt>null</tt> value represents any realm. */ public static final String ANY_REALM = null; /** * The <tt>null</tt> value represents any authentication scheme. */ public static final String ANY_SCHEME = null; /** * Default scope matching any host, port, realm and authentication scheme. * In the future versions of HttpClient the use of this parameter will be * discontinued. */ public static final AuthScope ANY = new AuthScope(ANY_HOST, ANY_PORT, ANY_REALM, ANY_SCHEME); /** The authentication scheme the credentials apply to. */ private String scheme = null; /** The realm the credentials apply to. */ private String realm = null; /** The host the credentials apply to. */ private String host = null; /** The port the credentials apply to. */ private int port = -1; /** Creates a new credentials scope for the given * <tt>host</tt>, <tt>port</tt>, <tt>realm</tt>, and * <tt>authentication scheme</tt>. * * @param host the host the credentials apply to. May be set * to <tt>null</tt> if credenticals are applicable to * any host. * @param port the port the credentials apply to. May be set * to negative value if credenticals are applicable to * any port. * @param realm the realm the credentials apply to. May be set * to <tt>null</tt> if credenticals are applicable to * any realm. * @param scheme the authentication scheme the credentials apply to. * May be set to <tt>null</tt> if credenticals are applicable to * any authentication scheme. * * @since 3.0 */ public AuthScope(final String host, int port, final String realm, final String scheme) { this.host = (host == null) ? ANY_HOST: host.toLowerCase(); this.port = (port < 0) ? ANY_PORT: port; this.realm = (realm == null) ? ANY_REALM: realm; this.scheme = (scheme == null) ? ANY_SCHEME: scheme.toUpperCase();; } /** Creates a new credentials scope for the given * <tt>host</tt>, <tt>port</tt>, <tt>realm</tt>, and any * authentication scheme. * * @param host the host the credentials apply to. May be set * to <tt>null</tt> if credenticals are applicable to * any host. * @param port the port the credentials apply to. May be set * to negative value if credenticals are applicable to * any port. * @param realm the realm the credentials apply to. May be set * to <tt>null</tt> if credenticals are applicable to * any realm. * * @since 3.0 */ public AuthScope(final String host, int port, final String realm) { this(host, port, realm, ANY_SCHEME); } /** Creates a new credentials scope for the given * <tt>host</tt>, <tt>port</tt>, any realm name, and any * authentication scheme. * * @param host the host the credentials apply to. May be set * to <tt>null</tt> if credenticals are applicable to * any host. * @param port the port the credentials apply to. May be set * to negative value if credenticals are applicable to * any port. * * @since 3.0 */ public AuthScope(final String host, int port) { this(host, port, ANY_REALM, ANY_SCHEME); } /** * Creates a copy of the given credentials scope. * * @since 3.0 */ public AuthScope(final AuthScope authscope) { super(); if (authscope == null) { throw new IllegalArgumentException("Scope may not be null"); } this.host = authscope.getHost(); this.port = authscope.getPort(); this.realm = authscope.getRealm(); this.scheme = authscope.getScheme(); } /** * @return the host * * @since 3.0 */ public String getHost() { return this.host; } /** * @return the port * * @since 3.0 */ public int getPort() { return this.port; } /** * @return the realm name * * @since 3.0 */ public String getRealm() { return this.realm; } /** * @return the scheme type * * @since 3.0 */ public String getScheme() { return this.scheme; } /** Determines if the given parameters are equal. * * @param p1 the parameter * @param p2 the other parameter * @return boolean true if the parameters are equal, otherwise false. */ private static boolean paramsEqual(final String p1, final String p2) { if (p1 == null) { return p1 == p2; } else { return p1.equals(p2); } } /** Determines if the given parameters are equal. * * @param p1 the parameter * @param p2 the other parameter * @return boolean true if the parameters are equal, otherwise false. */ private static boolean paramsEqual(int p1, int p2) { return p1 == p2; } /** * Tests if the authentication scopes match. * * @return the match factor. Negative value signifies no match. * Non-negative signifies a match. The greater the returned value * the closer the match. * * @since 3.0 */ public int match(final AuthScope that) { int factor = 0; if (paramsEqual(this.scheme, that.scheme)) { factor += 1; } else { if (this.scheme != ANY_SCHEME && that.scheme != ANY_SCHEME) { return -1; } } if (paramsEqual(this.realm, that.realm)) { factor += 2; } else { if (this.realm != ANY_REALM && that.realm != ANY_REALM) { return -1; } } if (paramsEqual(this.port, that.port)) { factor += 4; } else { if (this.port != ANY_PORT && that.port != ANY_PORT) { return -1; } } if (paramsEqual(this.host, that.host)) { factor += 8; } else { if (this.host != ANY_HOST && that.host != ANY_HOST) { return -1; } } return factor; } /** * @see java.lang.Object#equals(Object) */ public boolean equals(Object o) { if (o == null) { return false; } if (o == this) { return true; } if (!(o instanceof AuthScope)) { return super.equals(o); } AuthScope that = (AuthScope) o; return paramsEqual(this.host, that.host) && paramsEqual(this.port, that.port) && paramsEqual(this.realm, that.realm) && paramsEqual(this.scheme, that.scheme); } /** * @see java.lang.Object#toString() */ public String toString() { StringBuffer buffer = new StringBuffer(); if (this.scheme != null) { buffer.append(this.scheme.toUpperCase()); buffer.append(' '); } if (this.realm != null) { buffer.append('\''); buffer.append(this.realm); buffer.append('\''); } else { buffer.append("<any realm>"); } if (this.host != null) { buffer.append('@'); buffer.append(this.host); if (this.port >= 0) { buffer.append(':'); buffer.append(this.port); } } return buffer.toString(); } /** * @see java.lang.Object#hashCode() */ public int hashCode() { int hash = LangUtils.HASH_SEED; hash = LangUtils.hashCode(hash, this.host); hash = LangUtils.hashCode(hash, this.port); hash = LangUtils.hashCode(hash, this.realm); hash = LangUtils.hashCode(hash, this.scheme); return hash; } }
[ "callkalpa@gmail.com" ]
callkalpa@gmail.com
c29a33640d67a36536578b5a73622a228c2afd7f
5741045375dcbbafcf7288d65a11c44de2e56484
/reddit-decompilada/com/google/android/gms/internal/zzek.java
3d69eb6e1915ac26d2cbba01b0dad903f1c1f0bc
[]
no_license
miarevalo10/ReporteReddit
18dd19bcec46c42ff933bb330ba65280615c281c
a0db5538e85e9a081bf268cb1590f0eeb113ed77
refs/heads/master
2020-03-16T17:42:34.840154
2018-05-11T10:16:04
2018-05-11T10:16:04
132,843,706
0
0
null
null
null
null
UTF-8
Java
false
false
714
java
package com.google.android.gms.internal; import java.lang.reflect.InvocationTargetException; public final class zzek extends zzet { public zzek(zzdm com_google_android_gms_internal_zzdm, String str, String str2, zzaz com_google_android_gms_internal_zzaz, int i) { super(com_google_android_gms_internal_zzdm, str, str2, com_google_android_gms_internal_zzaz, i, 61); } protected final void mo1870a() throws IllegalAccessException, InvocationTargetException { long longValue = ((Long) this.c.invoke(null, new Object[]{this.a.m5845a(), Boolean.valueOf(this.a.f7227l)})).longValue(); synchronized (this.b) { this.b.f17632P = Long.valueOf(longValue); } } }
[ "mi.arevalo10@uniandes.edu.co" ]
mi.arevalo10@uniandes.edu.co
453fb83b23a7c138542f5bfa9d298b2462728e03
17da6c8f054a7e759b91cac9b1aea496a59a9af8
/src/main/java/com/ythtwang/rtc/model/pns/IAXEInterface.java
e1f35a0d6bf95bebb4dcece1a5f147660afc6ae9
[]
no_license
ythtwang/HuaweiRTCDemo
68dd4f8da79e1c99353299a8ef925199215aaa76
65fd17253c1de4723ecef9c1dd4c15ebdaaa3095
refs/heads/master
2020-06-19T18:30:16.668968
2019-08-16T17:04:45
2019-08-16T17:04:45
196,822,592
0
1
null
null
null
null
UTF-8
Java
false
false
1,760
java
package com.ythtwang.rtc.model.pns; /** * AXE模式接口 */ public interface IAXEInterface { /** * Set the X number to the user's virtual number | 隐私号码AXE绑定 * * @param virtualNum X号码 * @param bindNum AXE中的A号码 */ void axeBindNumber(String virtualNum, String bindNum); /** * Unbind the virtual number and extend number from number a | 隐私号码AXE解绑 * * @param subscriptionId 绑定关系ID * @param virtualNum X号码 * @param extendNum 分机号E * subscriptionId和(virtualNum+extendNum)二选一即可,当都传入时,优先选用subscriptionId */ void axeUnbindNumber(String subscriptionId, String virtualNum, String extendNum); /** * Query the binding information for virtual number and extend number | * 查询AXE绑定信息 * * @param subscriptionId 绑定关系ID * @param virtualNum X号码 * @param extendNum 分机号E * subscriptionId和(virtualNum+extendNum)二选一即可,当都传入时,优先选用subscriptionId */ void axeQueryBindRelation(String subscriptionId, String virtualNum, String extendNum); /** * Get download link of the record file created in call | 获取录音文件下载地址 * * @param recordDomain 录音文件存储的服务器域名 * @param fileName 录音文件名 */ void axeGetRecordDownloadLink(String recordDomain, String fileName); /** * Stop the call on the X number assigned by sessionid | 终止呼叫 * * @param sessionid 呼叫会话ID 通过"呼叫事件通知接口"获取 */ void axeStopCall(String sessionid); }
[ "ythtwang@163.com" ]
ythtwang@163.com
f45c55d29d3b6547c994e6ff01aa316084d5e35e
5ce462d2680cf5c13ac40e9d9165a87790d7655f
/InterviewPractice/src/CutStick.java
4c11ef084c80c8b037e80aacceae516606c78a5f
[]
no_license
pvrk007/InterviewPractice
7f99a797c224331d00d3155af53eea21376d25c3
feaff54710d6c555e9597f4691c849c433169cde
refs/heads/master
2020-06-19T08:12:24.583266
2017-12-21T04:27:12
2017-12-21T04:27:12
94,037,109
0
0
null
null
null
null
UTF-8
Java
false
false
519
java
public class CutStick { public static void main(String[] args){ //int[] arr={5,4,4,2,2,8}; int[] arr={1,2,3,4,3,3,2,1}; solve(arr); } private static void solve(int[] arr) { int minlen=Integer.MAX_VALUE; for(int i=0;i<arr.length;i++){ if(arr[i]>0) minlen=Math.min(arr[i], minlen); } int count=0; for(int j=0;j<arr.length;j++){ if(arr[j]>0){ arr[j]=arr[j]-minlen; count++; } } System.out.println(count); for(int k=0;k<arr.length;k++){ if(arr[k]>0) solve(arr); } } }
[ "pvrk007@gmail.com" ]
pvrk007@gmail.com
3390fb1ca4d24bb9893177b17b74fc6e23c305ae
144b4c8da92daad1a7c31d29536615ef6c50f717
/src/java/edu/davrivas/prueba/modelo/dao/CiudadFacadeLocal.java
75bb0e37cb7bccdf58df946345d3dec6f3b37835
[]
no_license
davrivas/pruebafaseivb
c447519bffe2506f58b6589df623188df9e24c8c
7e3d77455af2bad2108a9c5ef4536961b745a6a0
refs/heads/master
2023-06-10T01:58:52.322292
2018-08-31T23:54:15
2018-08-31T23:54:15
380,870,742
0
0
null
null
null
null
UTF-8
Java
false
false
652
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 edu.davrivas.prueba.modelo.dao; import edu.davrivas.prueba.modelo.entidades.Ciudad; import java.util.List; import javax.ejb.Local; /** * * @author davrivas */ @Local public interface CiudadFacadeLocal { void create(Ciudad ciudad); void edit(Ciudad ciudad); void remove(Ciudad ciudad); Ciudad find(Object id); List<Ciudad> findAll(); List<Ciudad> findRange(int[] range); int count(); }
[ "davrivas@192.168.1.105" ]
davrivas@192.168.1.105
ad2407aa7f9e322fdd83ab0d9bdad77bddc26f03
bc75fd14a676063bd098efb573fe29bea8c30032
/chorus/src/main/java/org/chorusbdd/chorus/annotations/SpringContext.java
3249afc35c09e95d45179b35b10d033200826ab7
[ "MIT" ]
permissive
DeepikaPolu/Chorus
a296ab04420d30cf29b9764d974bcbd8d4795baa
4a2e6b409d550085a83ff7027614e33f5f172973
refs/heads/master
2021-01-18T14:06:36.545972
2013-01-17T18:50:28
2013-01-17T18:50:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,244
java
/** * Copyright (C) 2000-2012 The Software Conservancy and Original Authors. * All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Nothing in this notice shall be deemed to grant any rights to trademarks, * copyrights, patents, trade secrets or any other intellectual property of the * licensor or any contributor except as expressly stated herein. No patent * license is granted separate from the Software, for code that you delete from * the Software, or for combinations of the Software with other software or * hardware. */ package org.chorusbdd.chorus.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Created with IntelliJ IDEA. * User: nick * Date: 11/05/12 * Time: 17:26 * * Use to indicate that Chorus should attempt to load a Spring context and associate it with the annotated * Handler class, injecting resources into fields indicated by @Resource annotations */ @Target(ElementType.TYPE) @Retention(value = RetentionPolicy.RUNTIME) public @interface SpringContext { java.lang.String[] value() default {}; }
[ "nick@objectdefinitions.com" ]
nick@objectdefinitions.com
84794f334110978ff472282fe85276eb58f85236
425a3529a26970513f885b5cfb4416aa37586b7e
/12-Custom annotations/src/main/java/com/epsilon/training/annotations/processors/JsonSerializer.java
8b7dc89bbe3e28eb1008f8e6bbab73a9289d6bd9
[]
no_license
kayartaya-vinod/2021-MARCH-EPSILON-JAVA-SPRING
675f6d3858575864fcc6cba0b2c0944c4d7eab64
fa02706b298dd1b2e6fe1b3946acf5254a4bc76a
refs/heads/master
2023-03-22T14:27:00.801084
2021-03-19T09:50:54
2021-03-19T09:50:54
343,323,964
1
2
null
null
null
null
UTF-8
Java
false
false
1,939
java
package com.epsilon.training.annotations.processors; import java.io.PrintWriter; import java.io.Writer; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.List; import com.epsilon.training.annotations.JsonProperty; import com.epsilon.training.annotations.JsonSerializable; import com.epsilon.training.entity.JsonIgnored; import com.epsilon.training.exceptions.NotJsonSerializableException; public class JsonSerializer { public void serialize(Writer writer, Object obj) { String json = this.serialize(obj); try(PrintWriter out = new PrintWriter(writer);){ out.print(json); } } public String serialize(Object obj) { if (obj == null) { throw new NotJsonSerializableException("Cannot serialize a null object!"); } // cls represents the class, obj is an object of Class<?> cls = obj.getClass(); if (!cls.isAnnotationPresent(JsonSerializable.class)) { throw new NotJsonSerializableException("The class " + cls.getName() + " does not have @JsonSerializable"); } List<String> kvList = new ArrayList<>(); for (Field f : cls.getDeclaredFields()) { if (!f.isAnnotationPresent(JsonIgnored.class)) { try { String label = f.getName(); JsonProperty ann = f.getAnnotation(JsonProperty.class); if(ann!=null) { label = ann.label(); if(label ==null || label.trim().equals("")) { label = f.getName(); } } f.setAccessible(true); String kv = String.format("\"%s\": \"%s\"", label, f.get(obj)); kvList.add(kv); } catch (Exception e) { System.err.println("Erorr for field " + f.getName() + " - " + e.getMessage()); } } } StringBuffer sb = new StringBuffer(1000); sb.append("{"); for (int i = 0, j = kvList.size() - 1; i < j; i++) { sb.append(kvList.get(i)); sb.append(", "); } sb.append(kvList.get(kvList.size() - 1)); sb.append("}"); return sb.toString(); } }
[ "kayartaya.vinod@gmail.com" ]
kayartaya.vinod@gmail.com
d7a3f1e47f6b780ef1e1cea213539e4aa7f3ccb8
9cf52ebe4d4ff2df2e949330e5933ef3c2aa47e6
/game/hud/Hud.java
a411815f6e731cc94ff34bd5a98687f3229487e4
[]
no_license
pierregorce/crazy-shooter
41bf7d0e930940dadc0922ad723654c2dfd4d7ca
d7d278e46308f55a1ffcf1e7a4b0b07e9229c236
refs/heads/master
2021-01-22T11:58:34.383052
2015-06-24T05:52:12
2015-06-24T05:52:12
33,829,052
2
0
null
null
null
null
UTF-8
Java
false
false
2,078
java
package game.hud; import screen.MyGdxGame; import com.badlogic.gdx.scenes.scene2d.Stage; import com.badlogic.gdx.utils.viewport.ExtendViewport; import com.oasix.crazyshooter.GameStage; public class Hud extends Stage { private GameStage gameStage; private HudInformations hudDebuger; private HudInterface hudInterface; private BossBar bossBar; public Hud(final GameStage gameStage) { setViewport(new ExtendViewport(MyGdxGame.VIRTUAL_WIDTH, MyGdxGame.VIRTUAL_HEIGHT)); this.gameStage = gameStage; hudInterface = new HudInterface(gameStage); addActor(hudInterface); hudDebuger = new HudInformations(gameStage); addActor(hudDebuger); HudBars bar = new HudBars(gameStage); addActor(bar); HudWave hudWave = new HudWave(gameStage); addActor(hudWave); bossBar = new BossBar(); addActor(bossBar); } private void showMessage() { for (int i = 0; i < GameStage.hudMessages.size(); i++) { if (GameStage.hudMessages.get(i).getChildren().size > 0) { // Il y a des actors qui se drawent donc ajout comme actor puis return, en effet, il 'agit de d'assets avec une action removeActor addActor(GameStage.hudMessages.get(i)); return; } } } boolean leftDown = false; boolean rightDown = false; @Override public boolean keyDown(int keyCode) { // System.out.println(keyCode); if (keyCode == 22) { gameStage.moveRight(); gameStage.walk(true); rightDown = true; } if (keyCode == 21) { gameStage.moveLeft(); gameStage.walk(true); leftDown = true; } if (keyCode == 19) { gameStage.jump(); } if (keyCode == 62) { gameStage.shoot(true); } return super.keyDown(keyCode); } @Override public boolean keyUp(int keyCode) { if (keyCode == 22) { rightDown = false; } if (keyCode == 21) { leftDown = false; } if (!leftDown && !rightDown) { gameStage.walk(false); } if (keyCode == 62) { gameStage.shoot(false); } return super.keyUp(keyCode); } @Override public void act(float delta) { super.act(delta); showMessage(); } }
[ "gorce.pierre@gmail.com" ]
gorce.pierre@gmail.com
5435b40c384be1f01c27594c03b4c04c9ae94ac4
264c6e412ed390f37edb869222913227e82c635a
/src/gatebass/fxml/get_report/QueryColumnTable.java
7bf03be45b953ff3ec7702c0fb44b271b92fbb77
[]
no_license
srgolabi/gateBase
cf761d65335ea1ead96fcca6215cef07c9581e8a
f8cd27ce7f6aad5b84157df04585c45af2e302ff
refs/heads/master
2021-01-21T13:15:04.263609
2016-05-07T16:57:58
2016-05-07T16:57:58
50,922,633
0
0
null
null
null
null
UTF-8
Java
false
false
6,256
java
package gatebass.fxml.get_report; import gatebass.myControl.tableView.*; import gatebass.myControl.MyButtonFont; import javafx.event.ActionEvent; import javafx.geometry.Pos; import javafx.scene.control.Label; import javafx.scene.control.TableCell; import javafx.scene.control.TableColumn; import javafx.scene.input.MouseEvent; import javafx.scene.layout.HBox; import javafx.scene.layout.Priority; import javafx.scene.layout.VBox; import gatebass.fxml.get_report.Fxml_Get_Report.Query_Base; import javafx.beans.binding.Bindings; import javafx.beans.property.StringProperty; import javafx.scene.control.Button; import javafx.scene.control.ContextMenu; import javafx.scene.control.MenuItem; /** * * @author reza */ public class QueryColumnTable extends Temmp<Query_Base, TableColumn<Query_Base, Query_Base>, TableCell<Query_Base, Query_Base>> { public interface OnEdit<Query_Base> { void edit(Query_Base qb, int index); } public void setOnEdit(OnEdit<Query_Base> oe) { onEdit = oe; } public OnEdit<Query_Base> onEdit; public QueryColumnTable() { } @Override public TableCell<Query_Base, Query_Base> call(TableColumn<Query_Base, Query_Base> param) { TableCell<Query_Base, Query_Base> cell = new TableCell<Query_Base, Query_Base>() { @Override protected void updateItem(Query_Base item, boolean empty) { if (item == getItem()) { return; } super.updateItem(item, empty); if (item == null) { setStyle(null); setText(null); setGraphic(null); return; } MenuItem m1 = new MenuItem(") +"); m1.setOnAction((ActionEvent event) -> { item.open_bracket.set("(" + item.open_bracket.get()); }); MenuItem m2 = new MenuItem(") -"); m2.disableProperty().bind(item.open_bracket.isEmpty()); m2.setOnAction((ActionEvent event) -> { item.open_bracket.set(item.open_bracket.get().substring(1)); }); MenuItem m3 = new MenuItem("+ ("); m3.setOnAction((ActionEvent event) -> { item.close_bracket.set(item.close_bracket.get() + ")"); }); MenuItem m4 = new MenuItem("- ("); m4.disableProperty().bind(item.close_bracket.isEmpty()); m4.setOnAction((ActionEvent event) -> { item.close_bracket.set(item.close_bracket.get().substring(1)); }); ContextMenu cm = new ContextMenu(m1, m2, m3, m4); setContextMenu(cm); final HBox hbox = new HBox(0); hbox.setAlignment(Pos.CENTER_LEFT); Button AndOr = new Button(); AndOr.getStyleClass().add("table-button"); AndOr.textProperty().bind(item.and_or); AndOr.visibleProperty().bind(item.and_or.isEmpty().not()); AndOr.setOnAction((ActionEvent event) -> { item.and_or.set(item.and_or.get().equals("و ") ? "یا " : "و "); }); if (getIndex() == 0) { item.and_or.set(""); } else if (item.and_or.get().isEmpty()) { item.and_or.set("و "); } MyButtonFont edit = new MyButtonFont("pencil", 14, "table-button"); edit.setOnAction((ActionEvent event) -> { onEdit.edit(item, getIndex()); }); MyButtonFont fileDelete = new MyButtonFont("trash", 14, "table-button"); fileDelete.setOnAction((ActionEvent event) -> { this.getTableView().getItems().remove(getIndex()); }); Label title = new Label(); title.textProperty().bind(item.and_or.concat(item.open_bracket).concat(item.table_title).concat(item.close_bracket)); HBox.setHgrow(title, Priority.ALWAYS); title.setMaxWidth(Integer.MAX_VALUE); title.setAlignment(Pos.CENTER); title.setStyle(title.getStyle() + "-fx-font-size : 13;"); final VBox Vbox = new VBox(0); MyButtonFont fileUp = new MyButtonFont("up_open", 7, "table-button"); MyButtonFont fileDown = new MyButtonFont("down_open", 7, "table-button"); Vbox.setAlignment(Pos.CENTER); Vbox.getChildren().addAll(fileUp, fileDown); fileDown.setOnAction((ActionEvent event) -> { if (getIndex() < getTableView().getItems().size() - 1) { Query_Base temp = getTableView().getItems().get(getIndex()); getTableView().getItems().set(getIndex(), getTableView().getItems().get(getIndex() + 1)); getTableView().getItems().set(getIndex() + 1, temp); } }); fileUp.setOnAction((ActionEvent event) -> { if (getIndex() > 0) { Query_Base temp = getTableView().getItems().get(getIndex()); getTableView().getItems().set(getIndex(), getTableView().getItems().get(getIndex() - 1)); getTableView().getItems().set(getIndex() - 1, temp); } }); fileDown.disableProperty().bind(indexProperty().lessThan(getTableView().getItems().size() - 1).not()); fileUp.disableProperty().bind(indexProperty().greaterThan(0).not()); hbox.getChildren().addAll(AndOr, title, edit, fileDelete, Vbox); setOnMouseClicked((MouseEvent event) -> { if (event.getClickCount() >= 2) { } }); setGraphic(hbox); } }; return cell; } }
[ "Reza@DESKTOP-7R0044Q" ]
Reza@DESKTOP-7R0044Q
10fdded954b0b9dbe04b2d5c128874a442db21e8
2c20d4bb418a27c8e2525aabd0ce19f20b651f87
/test2017/src/main/java/thirdpartyJar/eventBus/TestEvent.java
a9f68dd035734b4c0b739b7dd5a536e05618a5bb
[]
no_license
qq372777648/test2017
fbe374fa69ed9e63d0bf5ce52b3370de03fb74b5
483a1eea5250b77215b80c3b33968b87ca62491b
refs/heads/master
2021-01-21T12:21:00.738711
2019-01-28T07:10:59
2019-01-28T07:10:59
91,789,301
0
0
null
null
null
null
UTF-8
Java
false
false
242
java
package thirdpartyJar.eventBus; public class TestEvent { private final int message; public TestEvent(int message) { this.message = message; } public int getMessage() { return message; } }
[ "372777648@qq.com" ]
372777648@qq.com
f8ebb9f6191f2f13f30272a2897ee5b2ea56246a
192cb2790efeec7621e5900f8ab3a6ee0640bff8
/src/com/smartgwt/sample/showcase/client/data/TestXmlDS.java
2ca8a540cdb8473b734d41048d1270cb5f98bcb3
[]
no_license
xuzhf/Showcase
394160531661e9e293fb79968824bd210e8d0868
f3cb8acb4c188a14d6051951dfc41e303115929e
refs/heads/master
2020-06-30T00:58:05.728231
2016-08-26T07:04:17
2016-08-26T07:04:17
66,446,786
0
0
null
null
null
null
UTF-8
Java
false
false
3,650
java
package com.smartgwt.sample.showcase.client.data; import com.google.gwt.json.client.JSONArray; import com.smartgwt.client.data.DSRequest; import com.smartgwt.client.data.DSResponse; import com.smartgwt.client.data.DataSource; import com.smartgwt.client.data.XMLTools; import com.smartgwt.client.data.fields.DataSourceIntegerField; import com.smartgwt.client.data.fields.DataSourceTextField; import com.smartgwt.client.rpc.HandleErrorCallback; import com.smartgwt.client.rpc.RPCManager; import com.smartgwt.client.rpc.RPCResponse; import com.smartgwt.client.types.DSDataFormat; import com.smartgwt.client.util.SC; import com.smartgwt.sample.showcase.client.Constant; public class TestXmlDS extends DataSource { @Override protected void transformResponse(DSResponse response, DSRequest request, Object jsonData) { try { JSONArray value = XMLTools.selectObjects(jsonData, "/response/status"); if (null != value && value.size() > 0) { String status = value.get(0).isString().stringValue(); if (!status.equals("success")) { response.setStatus(RPCResponse.STATUS_VALIDATION_ERROR); JSONArray errors = XMLTools.selectObjects(jsonData, "/response/errors"); if (errors.size() > 0) { response.setErrors(errors.getJavaScriptObject()); } // return ; } } try { // 打印警告信息 String warnmessage = XMLTools.selectObjects(jsonData, "/response/message").get(0).isString() .stringValue(); System.out.println(" warnmessage =" + warnmessage); if (warnmessage != null && warnmessage.length() > 0) { SC.say(warnmessage+"111"); return; } } catch (Exception e) { // TODO: handle exception } } catch (Exception e) { e.printStackTrace(); } } private static TestXmlDS instance = null; public static TestXmlDS getInstance() { if (instance == null) { instance = new TestXmlDS("testXmlDS"); } return instance; } public TestXmlDS(String id) { setID(id); setDataFormat(DSDataFormat.JSON); setDataURL(Constant.INFO_LIST); // 主键 DataSourceIntegerField userIdField = new DataSourceIntegerField("userId", "UserId", 20, true); userIdField.setCanEdit(false); userIdField.setPrimaryKey(true); userIdField.setRequired(false); // 外键 DataSourceIntegerField parentIdField = new DataSourceIntegerField("parentId", "ParentId", 20, true); parentIdField.setForeignKey("userId"); parentIdField.setRootValue("0"); DataSourceTextField userNameField = new DataSourceTextField("userName", "Username", 30, true); DataSourceIntegerField ageField = new DataSourceIntegerField("age", "Age", 20, true); // ageField.setValidators(integerRangeValidator); DataSourceTextField emailField = new DataSourceTextField("email"); emailField.setRequired(true); emailField.setTitle("Email"); emailField.setLength(100); // emailField.setValidators(emailValidator); // url 采用正则表达式的客户端校验 DataSourceTextField urlField = new DataSourceTextField("url", "Url", 100, true); // urlField.setValidators(urlValidator); setFields(userIdField, parentIdField, userNameField, emailField, ageField, urlField); setTitleField("Name"); RPCManager.setHandleErrorCallback(new HandleErrorCallback() { @Override public void handleError(DSResponse response, DSRequest request) { // TODO Auto-generated method stub System.err.println("Transaction number: "); System.err.println("Status: "); System.err.println("Response code: "); System.err.println("Response text:"); SC.warn("You have no internet connection."); } }); } }
[ "macino.xu@gmail.com" ]
macino.xu@gmail.com
3a6411bd17b8c1c1fd475c43af98afdd109f5500
495c5ab67640cc00b584a7a86eb5dedeb42c984f
/sub-table/src/main/java/com/wzb/service/impl/OrderDetailServiceImpl.java
3a55e0727902c8880cf222a500c776d953cb0f26
[]
no_license
t0rjan/spring-boot-sharding
ea3a8190bd300943f01f5f82ab8d297e7ad9d154
1bb89ffb35d2743755777b1f4b8e174db349ced7
refs/heads/main
2023-06-23T12:32:51.508222
2021-07-30T03:14:08
2021-07-30T03:14:08
390,899,557
0
0
null
null
null
null
UTF-8
Java
false
false
6,046
java
package com.wzb.service.impl; import cn.hutool.core.bean.BeanUtil; import cn.hutool.extra.spring.SpringUtil; import com.wzb.entity.OrderDetailExample; import com.wzb.mapper.test2.OrderDetail2Mapper; import groovy.util.logging.Slf4j; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.sound.midi.SysexMessage; import javax.sql.DataSource; import lombok.val; import org.apache.catalina.core.ApplicationContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.ComponentScan; import org.springframework.jdbc.datasource.DataSourceTransactionManager; import org.springframework.stereotype.Service; import javax.annotation.Resource; import com.wzb.mapper.test1.OrderDetailMapper; import com.wzb.entity.OrderDetail; import com.wzb.service.OrderDetailService; import org.springframework.transaction.TransactionDefinition; import org.springframework.transaction.TransactionStatus; import org.springframework.transaction.annotation.Transactional; @Service @Slf4j @ComponentScan(basePackages = {"cn.hutool.extra.spring"}) public class OrderDetailServiceImpl implements OrderDetailService { private static Logger log = LoggerFactory.getLogger(OrderDetailServiceImpl.class); // 需要先注入如下两个类 @Autowired TransactionDefinition transactionDefinition; @Resource private OrderDetailMapper orderDetailMapper; @Resource private OrderDetail2Mapper orderDetail2Mapper; @Override public int deleteByPrimaryKey(Integer id) { return orderDetailMapper.deleteByPrimaryKey(id); } @Override public int insert(OrderDetail record) { return orderDetailMapper.insert(record); } @Override public int insertSelective(OrderDetail record) { return orderDetailMapper.insertSelective(record); } @Override public OrderDetail selectByPrimaryKey(Integer id) { return orderDetailMapper.selectByPrimaryKey(id); } @Override public int updateByPrimaryKeySelective(OrderDetail record) { return orderDetailMapper.updateByPrimaryKeySelective(record); } @Override public int updateByPrimaryKey(OrderDetail record) { return orderDetailMapper.updateByPrimaryKey(record); } @Override public long countByExample(OrderDetailExample example) { return orderDetailMapper.countByExample(example); } @Override public int deleteByExample(OrderDetailExample example) { return orderDetailMapper.deleteByExample(example); } @Override public List<OrderDetail> selectByExample(OrderDetailExample example) { return orderDetailMapper.selectByExample(example); } @Override public int updateByExampleSelective(OrderDetail record, OrderDetailExample example) { return orderDetailMapper.updateByExampleSelective(record, example); } @Override public int updateByExample(OrderDetail record, OrderDetailExample example) { return orderDetailMapper.updateByExample(record, example); } @Override @Transactional(rollbackFor = Exception.class) public String insertForeach(List<OrderDetail> orderDetailList) throws Exception { DataSource test2DataSource = SpringUtil.getBean("test2DataSource"); DataSource test1DataSource = SpringUtil.getBean("test1DataSource"); //开启事务 DataSourceTransactionManager test1DataSourceTransactionManager = new DataSourceTransactionManager(); test1DataSourceTransactionManager.setDataSource(test1DataSource); TransactionStatus test1DataSourceTransactionManagerTransaction = test1DataSourceTransactionManager .getTransaction(transactionDefinition); //开启事务 DataSourceTransactionManager test2DataSourceTransactionManager = new DataSourceTransactionManager(); test2DataSourceTransactionManager.setDataSource(test2DataSource); TransactionStatus test2DataSourceTransactionManagerTransaction = test2DataSourceTransactionManager .getTransaction(transactionDefinition); OrderDetail orderDetailModel = new OrderDetail(); try { for (OrderDetail orderDetail : orderDetailList) { //用分表的mapper去进行插入 orderDetailModel.setUserId(orderDetail.getUserId()); orderDetailModel.setType(orderDetail.getType()); orderDetailModel.setTimeUsed(orderDetail.getTimeUsed()); orderDetailModel.setAmount(orderDetail.getAmount()); orderDetailModel.setBeginTime(orderDetail.getBeginTime()); orderDetailModel.setOrderId(orderDetail.getOrderId()); orderDetailModel.setId(orderDetail.getId()); orderDetailModel.setFeeUsed(orderDetail.getFeeUsed()); orderDetailModel.setCreateTime(orderDetail.getCreateTime()); orderDetailModel.setEndTime(orderDetail.getEndTime()); orderDetailMapper.insert(orderDetailModel); //用不分表的mapper进行删除 OrderDetailExample orderDetailExample = new OrderDetailExample(); orderDetailExample.createCriteria().andIdEqualTo(orderDetail.getId()); orderDetail2Mapper.deleteByExample(orderDetailExample); } //提交事务 test1DataSourceTransactionManager.commit(test1DataSourceTransactionManagerTransaction); test2DataSourceTransactionManager.commit(test2DataSourceTransactionManagerTransaction); return "保存成功"; } catch (Exception e) { log.error("回滚事务:" + e); // 回滚事务 test1DataSourceTransactionManager.rollback(test1DataSourceTransactionManagerTransaction); test2DataSourceTransactionManager.rollback(test2DataSourceTransactionManagerTransaction); return "保存失败"; } } @Override public List<OrderDetail> list(Integer mbreak, Integer sum, String createTime) { Map record = new HashMap(); record.put("createTime", createTime); record.put("mbreak", mbreak); record.put("sum", sum); List<OrderDetail> orderDetails = orderDetail2Mapper.selectAll(record); return orderDetails; } }
[ "99999r00t@gmail.com" ]
99999r00t@gmail.com
d6f5091dcd15a7f7b85d10e0e9efc3311ac260bd
caab8283287b6f616b35d9076680b7f5c741689f
/day06/src/com/atguigu/java1/SetTest.java
cb224b9d8db740f0ad24244849c70428922a0e43
[]
no_license
luwang951753/JavaSenior
cf338bb335204a90f37356fd762845bc5743aafb
8d7984f0f3a84b2706a71d36614b8bf4b4964be6
refs/heads/master
2021-02-19T10:32:33.443234
2020-03-16T09:03:50
2020-03-16T09:03:50
245,304,462
0
0
null
null
null
null
UTF-8
Java
false
false
3,524
java
package com.atguigu.java1; import com.atguigu.java.Person; import org.junit.Test; import java.util.HashSet; import java.util.Iterator; import java.util.Set; /** * |----Collection接口:单列集合,用来存储一个一个的对象 * |----Set接口:存储无序的、不可重复的数据 * |----HashSet: 作为Set接口的主要实现类: 线程不安全的: 可以存储null值 * |----LinkedHashSet: 作为HashSet的子类,遍历其内部数据时,可以按照添加 * 对于频繁的遍历操作,LinkedHashSet效率高于HashSet * |----TreeSet: 可以按照添加对象的指定属性,进行排序 * * 1. Set接口中没有额外定义新的方法,使用的都是Collection中声明过的方法 * 2. 要求: 向Set中添加的数据,其所在的类一定要重写hashCode()和equals() * 要求: 重写的hashCode()和equals()尽可能保持一致性,相等的对象必须具有相等的散列码 * 重写两个方法的小技巧:直接用编辑器的方向重写equals和hashcode就得了 */ public class SetTest { /** * 一. Set接口:存储无序的、不可重复的数据 * 以HashSet为例说明 * 1.无序性:不等于随机性。 存储的数据在底层数组中并非按照数组索引的顺序添加,而是根据数据的哈希值添加的 * 2.不可重复性:保证添加的元素按照equals()判断时,不能返回true,即:相同的元素只能添加一个 * * 二. 添加元素的过程:以HashSet为例: * 我们向HashSet中添加元素a,首先调用元素a所在类的hashCode()方法,计算元素a的哈希值 * 此哈希值接着通过某种算法计算出在HashSet底层数组中的存放位置(即为:索引位置),判断 * 数组此位置上是否已经有元素: * 如果此位置上没有其他元素,则元素a添加成功. -->情况1 * 如果此位置上有其他元素b(或以链表形式存在的多个元素),则比较元素a与元素b的hash值, * 如果hash值不相同,则元素a添加成功。 -->情况2 * 如果hash值相同,进而需要调用元素a所在类的equalas()方法: * equals()返回true,元素a添加失败 * equals()返回false,则元素a添加成功 -->情况3 * * 对于添加成功的情况2和情况3而言:元素a与已经存在指定索引位置上数据以链表的方式存储 * jdk 7 : 元素a放到数组中,指向原来的元素 * jdk 8 : 原来的元素在数组中,指向元素a * 总结:七上八下 * * */ @Test public void test1(){ Set set = new HashSet(); set.add(456); set.add(123); set.add(123); set.add("AA"); set.add("CC"); set.add(new User("Tome",12)); set.add(new User("Tome",12)); set.add(129); Iterator iterator = set.iterator(); while (iterator.hasNext()){ System.out.println(iterator.next()); } } /** * LinkedHashSet的使用 * LinkedHashSet作为HashSet的子类,在添加数据的同时,每个数据还维护了两个引用,记录数据前后的引用,维护数据的前一个数据和最后一个数据 * 优点:对于频繁的遍历操作,LinkedHashSet效率高于HashSet */ @Test public void test2(){ } }
[ "luwang951753@sina.com" ]
luwang951753@sina.com
30e39eecf62e0a85c01c63e43008ae743e6cf53f
5c88257ae831fe9e6cfa93371748b1b4a5f92f1b
/Udemy/src/demo1/App.java
9e95f784d8b4e5231df04faeb6395ed8fad6e0b1
[]
no_license
sh92/Thread-Study
c57206369cbe46428a00af9cd609073b6cc1e5a5
5e490119d7c716b9613cb8c9592c241311b1b8bc
refs/heads/master
2020-03-23T21:47:58.317021
2018-07-28T15:10:06
2018-07-28T15:10:06
142,133,627
0
0
null
null
null
null
UTF-8
Java
false
false
386
java
package demo1; class Runner implements Runnable { @Override public void run() { for (int i = 0; i < 10; i++) { System.out.println("Heelo" + i); try { Thread.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } } } } public class App { public static void main(String[] args) { Thread t1 = new Thread(new Runner()); t1.start(); } }
[ "sanghee.lee1992@gmail.com" ]
sanghee.lee1992@gmail.com
b6baf35647c76d5a47d3b1f14b7696a89e5da91f
e9affefd4e89b3c7e2064fee8833d7838c0e0abc
/aws-java-sdk-personalize/src/main/java/com/amazonaws/services/personalize/model/transform/DatasetExportJobMarshaller.java
59872ee01997927f0f1cd8ea61fecb0b08e89c08
[ "Apache-2.0" ]
permissive
aws/aws-sdk-java
2c6199b12b47345b5d3c50e425dabba56e279190
bab987ab604575f41a76864f755f49386e3264b4
refs/heads/master
2023-08-29T10:49:07.379135
2023-08-28T21:05:55
2023-08-28T21:05:55
574,877
3,695
3,092
Apache-2.0
2023-09-13T23:35:28
2010-03-22T23:34:58
null
UTF-8
Java
false
false
4,960
java
/* * Copyright 2018-2023 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.personalize.model.transform; import javax.annotation.Generated; import com.amazonaws.SdkClientException; import com.amazonaws.services.personalize.model.*; import com.amazonaws.protocol.*; import com.amazonaws.annotation.SdkInternalApi; /** * DatasetExportJobMarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") @SdkInternalApi public class DatasetExportJobMarshaller { private static final MarshallingInfo<String> JOBNAME_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD) .marshallLocationName("jobName").build(); private static final MarshallingInfo<String> DATASETEXPORTJOBARN_BINDING = MarshallingInfo.builder(MarshallingType.STRING) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("datasetExportJobArn").build(); private static final MarshallingInfo<String> DATASETARN_BINDING = MarshallingInfo.builder(MarshallingType.STRING) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("datasetArn").build(); private static final MarshallingInfo<String> INGESTIONMODE_BINDING = MarshallingInfo.builder(MarshallingType.STRING) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("ingestionMode").build(); private static final MarshallingInfo<String> ROLEARN_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD) .marshallLocationName("roleArn").build(); private static final MarshallingInfo<String> STATUS_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD) .marshallLocationName("status").build(); private static final MarshallingInfo<StructuredPojo> JOBOUTPUT_BINDING = MarshallingInfo.builder(MarshallingType.STRUCTURED) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("jobOutput").build(); private static final MarshallingInfo<java.util.Date> CREATIONDATETIME_BINDING = MarshallingInfo.builder(MarshallingType.DATE) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("creationDateTime").timestampFormat("unixTimestamp").build(); private static final MarshallingInfo<java.util.Date> LASTUPDATEDDATETIME_BINDING = MarshallingInfo.builder(MarshallingType.DATE) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("lastUpdatedDateTime").timestampFormat("unixTimestamp").build(); private static final MarshallingInfo<String> FAILUREREASON_BINDING = MarshallingInfo.builder(MarshallingType.STRING) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("failureReason").build(); private static final DatasetExportJobMarshaller instance = new DatasetExportJobMarshaller(); public static DatasetExportJobMarshaller getInstance() { return instance; } /** * Marshall the given parameter object. */ public void marshall(DatasetExportJob datasetExportJob, ProtocolMarshaller protocolMarshaller) { if (datasetExportJob == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(datasetExportJob.getJobName(), JOBNAME_BINDING); protocolMarshaller.marshall(datasetExportJob.getDatasetExportJobArn(), DATASETEXPORTJOBARN_BINDING); protocolMarshaller.marshall(datasetExportJob.getDatasetArn(), DATASETARN_BINDING); protocolMarshaller.marshall(datasetExportJob.getIngestionMode(), INGESTIONMODE_BINDING); protocolMarshaller.marshall(datasetExportJob.getRoleArn(), ROLEARN_BINDING); protocolMarshaller.marshall(datasetExportJob.getStatus(), STATUS_BINDING); protocolMarshaller.marshall(datasetExportJob.getJobOutput(), JOBOUTPUT_BINDING); protocolMarshaller.marshall(datasetExportJob.getCreationDateTime(), CREATIONDATETIME_BINDING); protocolMarshaller.marshall(datasetExportJob.getLastUpdatedDateTime(), LASTUPDATEDDATETIME_BINDING); protocolMarshaller.marshall(datasetExportJob.getFailureReason(), FAILUREREASON_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
[ "" ]
3268ccfd94f645edf6630f1786b0adea23c7ea1c
efc71a7efdcb6510dd00fa7723bc0b5067b64c69
/Digital Innovation Java/src/main/java/Digital/Innovation/Java/datas_dateformat/Exemplo009.java
32d57d0cbf046f106650a5886f29518707876210
[]
no_license
Billmetal/desenvolvimento-basico-java
5cf9406b327f2909a19da8f17df716e1afc87eba
0fcc6f5d0e8945297b27bc12beb1a182c3dab3c7
refs/heads/master
2022-11-07T10:39:24.329086
2020-06-26T17:08:51
2020-06-26T17:08:51
272,820,552
0
0
null
null
null
null
ISO-8859-1
Java
false
false
485
java
package Digital.Innovation.Java.datas_dateformat; import java.text.SimpleDateFormat; import java.util.Date; /** * Exemplo de formatação de data com SimpleDateFormat */ public class Exemplo009 { public static void main(String[] args) { Date agora = new Date(); SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy"); String dataFormatada = formatter.format(agora); System.out.println(dataFormatada); // 14/07/2019 } }
[ "billmetal9@gmail.com" ]
billmetal9@gmail.com
0486874d173701aba8fa062883c350596c27728e
bbcbd7f4d53bca0f9b115b9941e174c5ff1457fa
/LibrariesTest/LibrariesTestApp/src/androidTest/java/com/chdryra/android/librariestest/remoteapifetchers/test/GpUtcOffsetTest.java
4ef8206fb838223bc8962601f2af7d47d8d7a3b3
[]
no_license
chdryra/Android
8ed62ff2123813eb693c7f882941bdb5cb9f2571
6567c7e38bb9efa602ea9a02fc04abfe2a306984
refs/heads/master
2021-06-02T19:32:13.121322
2018-04-18T15:53:25
2018-04-18T15:53:25
24,196,984
1
0
null
null
null
null
UTF-8
Java
false
false
1,605
java
/* * Copyright (c) 2015, Rizwan Choudrey - All Rights Reserved * Unauthorized copying of this file, via any medium is strictly prohibited * Proprietary and confidential * Author: Rizwan Choudrey * Date: 10 March, 2015 */ package com.chdryra.android.librariestest.remoteapifetchers.test; import android.test.suitebuilder.annotation.SmallTest; import com.chdryra.android.librariestest.remoteapifetchers.test.TestUtils.JsonMaker; import com.chdryra.android.remoteapifetchers.GpUtcOffset; import junit.framework.TestCase; import org.json.JSONObject; /** * Created by: Rizwan Choudrey * On: 10/03/2015 * Email: rizwan.choudrey@gmail.com */ public class GpUtcOffsetTest extends TestCase { @SmallTest public void testGpUtcOffset() { JSONObject result = JsonMaker.newJsonObject(getTestString(720)); GpUtcOffset parsed = new GpUtcOffset(result); assertTrue(parsed.isValid()); assertEquals(720, parsed.getOffset()); result = JsonMaker.newJsonObject(getTestString(-720)); parsed = new GpUtcOffset(result); assertTrue(parsed.isValid()); assertEquals(-720, parsed.getOffset()); result = JsonMaker.newJsonObject(getTestString(721)); parsed = new GpUtcOffset(result); assertFalse(parsed.isValid()); result = JsonMaker.newJsonObject(getTestString(-721)); parsed = new GpUtcOffset(result); assertFalse(parsed.isValid()); } private String getTestString(int offset) { return "{\n" + " \"utc_offset\" : " + offset + "\n" + "}"; } }
[ "rizwan.choudrey@gmail.com" ]
rizwan.choudrey@gmail.com
fec7b0d8bfb40cafd72d0d5256982087759dec72
41512e25a95f37fd987c661909ef90e74b39bba3
/src/main/java/codeu/model/data/user/chatbot/Chatbot.java
96c767bb8faabfeb7d85d1f01060abece0405a4e
[ "Apache-2.0" ]
permissive
krtejeda/CodeU-Spring-2018
82b35881810d9b030eabe762dda7a7c6c0afaf3e
76794b60697467a8cd47669d7a05bd47f0ceca50
refs/heads/master
2021-04-27T09:02:36.682379
2018-05-24T07:55:15
2018-05-24T07:55:15
122,505,019
2
0
Apache-2.0
2018-05-24T07:55:16
2018-02-22T16:34:04
Java
UTF-8
Java
false
false
873
java
package codeu.model.data.user.chatbot; import codeu.model.data.Conversation; import codeu.model.data.user.MessageSender; import codeu.model.data.user.User; import codeu.model.data.user.UserGroup; import java.util.Optional; /** * Interface represents Chatbot, an automated program that may respond to * messages sent to a {@link Conversation} */ public interface Chatbot extends MessageSender { /** * Returns response from the {@code Chatbot} to {@code messageContent} from {@code sender} * @param sender {@code User} that sends the {@code messageContent} * @param messageContent content of the message * @return Optional response from the Chatbot */ Optional<String> respondToMessageFrom(User sender, String messageContent); default UserGroup group() { return UserGroup.BOT; } enum Type { HELLO; } Type getType(); }
[ "pt335@cornell.edu" ]
pt335@cornell.edu
08037804558214e1fab70d8fb128f1f32431c586
bb638994d36c72834fe6c13f92296e564212e899
/src/main/java/com/pages/LoginPage.java
c89e476a8d666198ae473e4cb4cf6893049acf14
[]
no_license
NikhilKharkhodia/ArtthaAutomationFramework
60395d4559edff1f774b88942fbc52a664bde024
ae73fdf906e9329ca3c977e1ff2b2cbe8cc790f9
refs/heads/master
2023-01-01T13:07:13.646987
2020-10-14T13:44:04
2020-10-14T13:44:04
304,028,795
0
0
null
null
null
null
UTF-8
Java
false
false
1,566
java
package com.pages; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.CacheLookup; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.PageFactory; import Generic.BaseTest; import io.qameta.allure.Step; public class LoginPage extends BaseTest { public WebDriver driver; public LoginPage(WebDriver driver) { this.driver = driver; PageFactory.initElements(driver, this); } private @FindBy(xpath = "//input[@id='fruitMobilenumber']") @CacheLookup WebElement Username; private @FindBy(xpath = "//input[@id='fruitPassword']") @CacheLookup WebElement UserPassword; private @FindBy(xpath = "//button[@class='ui red button']") @CacheLookup WebElement Login; private @FindBy(xpath = "//div[@class='column']//img[@class='logoImg']") @CacheLookup WebElement Logo; private @FindBy(xpath = "//div[@class='formInner ui middle aligned center aligned grid']") @CacheLookup WebElement colour; @Step("Enter Username....") public WebElement enterUserName() { return Username; } @Step("Enter user password....") public WebElement enterUserPassword() { return UserPassword; } @Step("Click on Login button....") public WebElement clickLoginButton() { return Login; } public boolean loginPageLogo() { return Logo.isDisplayed(); } public WebElement loginsectioncolour() { return colour; } public void registerNewMembers(String username, String userpassword) { Username.sendKeys(username); UserPassword.sendKeys(userpassword); } }
[ "nikhil.kharkhodia@puresoftware.com" ]
nikhil.kharkhodia@puresoftware.com
6c35a4ff5835699258eccafaeac5494b282557b2
511c5fd8a31cc71d0be79cf109847eb9bf00bd5a
/src/com/sasaug/shadowchat/network/modules/NudgeModule.java
b6e0c93b928fcdafa495187d9e2ead9f519987be
[]
no_license
tomdev2008/ShadowChatServerV1
4884e14121129287e91f86419208f6d99a38cc7e
4a08d6da203e61f45e794464d2290f145b102ddd
refs/heads/master
2021-01-14T10:30:52.962346
2015-06-02T09:08:12
2015-06-02T09:08:12
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,589
java
package com.sasaug.shadowchat.network.modules; import java.util.ArrayList; import com.sasaug.shadowchat.client.Client; import com.sasaug.shadowchat.config.ConfigCore; import com.sasaug.shadowchat.database.DatabaseCore; import com.sasaug.shadowchat.modules.IModule; import com.sasaug.shadowchat.network.ANetwork; import com.sasaug.shadowchat.network.AuthManager; import com.sasaug.shadowchat.network.NetworkCore; import com.sasaug.shadowchat.notification.NotificationCore; import com.sasaug.shadowchat.obj.SCOS; import com.sasaug.shadowchat.socket.TCPClient; import com.sasaug.shadowchat.storage.StorageCore; import com.sasaug.shadowchat.utils.Base64; import com.sasaug.shadowchat.utils.SHA256; import com.sasaug.shadowchat.message.Message.*; public class NudgeModule extends ANetwork implements IModule{ public String getModuleId() {return NetworkCore.ID + ".NudgeModule";} public Type getReceiveType() {return Type.NUDGE;} NetworkCore core; public void onInit(NetworkCore core) { this.core = core; } public boolean onReceive(TCPClient client, byte[] data) throws Exception{ DatabaseCore DB = DatabaseCore.getInstance(); Client cl = AuthManager.getInstance().getClient(client); String username = cl.username; NudgeMessage msg = NudgeMessage.parseFrom(data); DB.set("User", "setLastSeen", username, System.currentTimeMillis()+""); DB.set("User", "setLastAlive", username, System.currentTimeMillis()+""); Ack.Builder ackBuilder = Ack.newBuilder(); ackBuilder.setType(Type.ACK); ackBuilder.setAckType(ACKType.SENT); BaseMessage.Builder baseBuilder = BaseMessage.newBuilder(); baseBuilder.setType(Type.NUDGE); baseBuilder.setId(msg.getId()); baseBuilder.setTarget(msg.getTarget()); baseBuilder.setOrigin(msg.getOrigin()); baseBuilder.setTimestamp(System.currentTimeMillis()); if(msg.hasGroup()) baseBuilder.setGroup(msg.getGroup()); ackBuilder.setHash(SHA256.hashString(data)); ackBuilder.setMessage(baseBuilder.build()); core.send(cl.client.uid, ackBuilder.build().toByteArray()); ArrayList<String> receivers = new ArrayList<String>(); if(msg.hasGroup()){ String groupId = msg.getTarget(); groupId = groupId.substring(5); ArrayList<String> temp = DB.getStringArray("Group", "getMembers", groupId); for(int i = 0; i < temp.size(); i++){ if(!temp.get(i).equals(username)) receivers.add(temp.get(i)); } }else{ receivers.add(msg.getTarget()); } NudgeMessage.Builder builder = NudgeMessage.newBuilder(msg); builder.setTimestamp(System.currentTimeMillis()); NudgeMessage response = builder.build(); for(int i = 0; i < receivers.size(); i++){ Client target = AuthManager.getInstance().getClient(receivers.get(i)); boolean canSend =false; if(msg.hasGroup()){ if(DB.getBool("Group", "canSendGroup", true, receivers.get(i), msg.getGroup())){ canSend = true; save(receivers.get(i), response.toByteArray()); } }else{ if(DB.getBool("Friend", "canSendUser", true, username, receivers.get(i))){ canSend = true; save(receivers.get(i), response.toByteArray()); } } if(target != null){ if(canSend) core.send(target.client.uid, response.toByteArray()); }else{ if(canSend){ ArrayList<String> devices = DB.getStringArray("User", "getDevices", receivers.get(i)); for(String device: devices){ String cloudid = DB.getString("User", "getCloudId", null, receivers.get(i), device); if(cloudid != null){ String os = DB.getString("User", "getOS", SCOS.ANDROID, receivers.get(i), device); NotificationCore.getInstance().notify(os, cloudid, NotificationCore.NEWMSG); } } } } } return true; } private void save(String username, byte[] data) throws Exception{ DatabaseCore DB = DatabaseCore.getInstance(); String value = ConfigCore.getInstance().get("message_max_memory_size"); int length = Integer.parseInt(value); BaseMessage msg = BaseMessage.parseFrom(data); StringBuffer buffer = new StringBuffer(); buffer.append(msg.getId()); buffer.append("."); buffer.append(msg.getOrigin()); buffer.append("."); buffer.append(msg.getTarget()); if(msg.hasGroup()){ buffer.append("."); buffer.append(msg.getGroup()); } String hash = SHA256.hash(buffer.toString()); if(data.length < length){ DB.set("Message", "addMessage", username, hash, Base64.encodeToString(data, Base64.DEFAULT)); }else{ DB.set("Message", "addMessage", username, hash, ""); StorageCore.getInstance().save("Message", username+ "." + hash, data); } } }
[ "admin@siggie.net" ]
admin@siggie.net
d92018f5fdc61e4aabc1fac38415deb99ab1714e
2982471e33900726fc6c0ea1a994e508072740b2
/src/main/java/com/iatromaze/platform/PlatformApplication.java
f2a1e203264c25a4439e5f06b6af821adf4f9a55
[]
no_license
iatromaze/iatromaze_platform
9c45f1af56507dbaa29a26c483857a89ff5bc6a1
75a2436bd1220a93779f05a751088538c0c8a047
refs/heads/master
2020-03-24T08:48:35.497010
2018-07-27T18:03:47
2018-07-27T18:03:47
142,608,334
0
1
null
null
null
null
UTF-8
Java
false
false
318
java
package com.iatromaze.platform; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class PlatformApplication { public static void main(String[] args) { SpringApplication.run(PlatformApplication.class, args); } }
[ "iatromaze@gmail.com" ]
iatromaze@gmail.com
f50d7b1d61582840f25c197600ddca667438ab00
9a42c7dcdf8816c141d12e7d848f4e11bf5a79c7
/src/staticex/Student2.java
c68fe0cc16df87dfbc0af2a0751a2a6c33590909
[]
no_license
kimsung-yong/My_home
623b1f190c8a88fa969a87d0b187ad227f6c9f32
80ed903b6a2fc40d18e18bed4de3bfd3007d520f
refs/heads/master
2020-08-19T19:18:40.576222
2019-10-21T13:45:30
2019-10-21T13:45:30
215,034,432
0
0
null
null
null
null
UTF-8
Java
false
false
611
java
package staticex; public class Student2 { private static int serialNumber = 1000; public static int getSerialNumber() { int i = 10; return serialNumber; } public static void setSerialNumber(int serialNumber) { Student2.serialNumber = serialNumber; } public int studentID; public String studentName; public String getStudentName() { return studentName; } public void setStudentName(String name) { studentName =name; } public int grade; public String address; public Student2() { serialNumber++; studentID = serialNumber; } }
[ "user@DESKTOP-2Q2RTP9" ]
user@DESKTOP-2Q2RTP9
ea41751b8f0bd769122d76116e910473d0dd5a82
afa58012fa56fbd2e3df0a1d89c70a34548dfce0
/src/main/java/com/alelo/api/controller/HomeController.java
5fe31d45c72614fdbcf3d8802fcccd4459a7c6cb
[]
no_license
enegociosandre/desafio-andre
13eb0790d4a299025fad003490c1276457b966db
6368112877393561181c7d1687a7ee815d4a44d4
refs/heads/develop
2020-08-28T05:05:29.906632
2019-10-26T00:00:18
2019-10-26T00:00:18
217,373,589
0
0
null
2019-10-24T19:37:27
2019-10-24T19:03:28
Java
UTF-8
Java
false
false
1,130
java
package com.alelo.api.controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; @RestController @RequestMapping("/") @Api(value = "homepage") public class HomeController { @ApiOperation(value = "Pagina inicial do desafio Alelo", response = String.class) @RequestMapping(method= RequestMethod.GET) @ApiResponses(value = { @ApiResponse(code = 401, message = "Você não está autorizado a ver esse recurso"), @ApiResponse(code = 403, message = "Acessar o recurso que você está tentando não é permitido"), @ApiResponse(code = 404, message = "O recurso não foi encontrado") }) public String index(){ return "Pagina inicial do desafio Alelo!" + "Mais informações podem ser acessadas pela documentação do Swagger em: /swagger-ui.html"; } }
[ "enegocios.andre@gmail.com" ]
enegocios.andre@gmail.com
b7bc519da073f78e0e330e4b0b418e4414b87bf2
779ce4365a285b0ea8d953eccbcee2850cf18075
/src/main/de/easycreators/sequencer/decode/v2/SequenceDecoder.java
bb89e35bfacc68206fd666120d60001cc170e8e9
[]
no_license
ecreators/ffxiv-crystal-riddle-solver
60ecb8dd3a27f2c94baa4dee012e5a857be1d7d8
ca1b9c9d38631e46b1826075aaba90a606f0ed80
refs/heads/master
2021-01-23T13:09:45.123114
2017-06-07T05:09:27
2017-06-07T05:09:27
93,232,023
0
0
null
null
null
null
UTF-8
Java
false
false
14,047
java
package de.easycreators.sequencer.decode.v2; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.ObjectMapper; import de.easycreators.core.event.IListenerEvent; import de.easycreators.core.event.ListenerEvent; import de.easycreators.sequencer.decode.model.Handler; import de.easycreators.sequencer.decode.model.Resolution; import java.io.IOException; import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.function.Function; import java.util.stream.Collectors; import static java.util.stream.Collectors.toList; /** * @author Bjoern Frohberg, mydata GmbH */ @SuppressWarnings("WeakerAccess") public class SequenceDecoder { private Sequence sequence; private final ListenerEvent<Handler<Sequence>> decodingCompletedEvent; public SequenceDecoder() { decodingCompletedEvent = new ListenerEvent<>(); } public final IListenerEvent<Handler<Sequence>> getDecodingCompletedEvent() { return decodingCompletedEvent; } /** * Set a chosen given sequence of options with different ids and given options to continue the journey. * So, ensure your pins have options to choose a next option pin. */ public Sequence setSequence(Input... pins) { Pin[] sequence = new Pin[pins.length]; int predicted = 0; for (int i = 0; i < pins.length; i++) { Input pin = pins[i]; // der Pin selbst for (Input option : pin.options) { predicted++; } if(!pin.options.isEmpty()) { predicted--; } else { predicted++; } sequence[i] = new Pin(pin); } this.sequence = new Sequence(System.currentTimeMillis(), sequence); this.sequence.predictedPins = predicted; return this.sequence; } /** * Begins to decode the sequence you set. Depending on your favourite resolution, the decoding process ends up quicker * or not. This process iterates each input you defined and tests each option to solve a sequence of inputs to * solve a sequence that touches each input only once. This won't start, if your sequence is unset or already * done. * * @param resolution Kind of continue solutions. For example an input of 5x2 with resolution ALL will notify 5 rotes, because you can * start up with each of input of 2 to solve a sequence. */ @SuppressWarnings("UnusedReturnValue") public DecodeStrategy decode(Resolution resolution) { if(sequence == null) { return null; } else if(sequence.done) { notifySequenceDone(); return new DecodeStrategy(sequence, resolution); } return new DecodeStrategy(sequence, resolution); } /** * @param start Pin to hold completion state of tested start and previous routed pin and taken option * each step in way finding * @param resolution Kind of stop type to reduce redundant iterations */ protected void solveFromPin(Pin start, Resolution resolution, int optionOffset) { // if started asnchron or parallel: stop this determineValidRoutes, if another determineValidRoutes found a route if(shouldStop(resolution)) { return; } // reset this pin start.route = null; sequence.reset(); Pin current = start; List<Input> current_route = new ArrayList<>(); outer: do { // mark this pin as taken and anymore available for further options if(!current_route.contains(current.getInput())) { current_route.add(current.getInput()); } // determineValidRoutes: sequence complete if(current_route.size() == sequence.getPins().length) { // no further route when already a route was set if(shouldStop(resolution)) { current_route.clear(); break; // do } // solved solution from this start.route = Collections.unmodifiableList(current_route); if(!start.routes.contains(start.route)) { start.routes.add(start.route); } // start.done = true; <- required after "break do" // win and exit break; // do } // where to go from this pin List<Input> unchosenOptions = determineOptions(current_route, current, optionOffset); // more than one option produce a new possible destiny if(!unchosenOptions.isEmpty()) { for (Input option : unchosenOptions) { // has option current.getTakenOptions().add(option); // go there Pin option_pin = sequence.asPinOrDie(option); Pin old = current; current = option_pin; current.previous = old; // continue "further" // determineValidRoutes: another pin was already solved if(shouldStop(resolution)) { current_route.clear(); break outer; // do } // stop first option break; } } // no option anymore else { // redecide in a previous pin revertPin(current, current_route); current = current.getPrevious(); // continue "backwards" // determineValidRoutes: another pin was already solved if(shouldStop(resolution)) { current_route.clear(); break; // do } } } while (current != null); // win or lose ... and done ;-) start.done = true; // notify solution onPinValidated(start, resolution, optionOffset); } /** * Returns true, if EARLY and any match succeeded in a pin. */ boolean shouldStop(Resolution resolution) { return resolution == Resolution.EARLY_RESULT && hasRouteFound(); } /** * Returns true, if any pin of done determineValidRoutes has a valid route. */ public boolean hasRouteFound() { return sequence.done && sequence.getDonePins().stream().anyMatch(Pin::isSuccess); } /** * Notifies a working start pin, at end using ALL or asap using EARLY if a working pin is given * * @param pin a done pin determineValidRoutes * @param resolution given resolution of fullfillment */ protected void onPinValidated(Pin pin, Resolution resolution, int optionOffset) { if(!sequence.donePins.contains(pin)) { sequence.donePins.add(pin); } switch (resolution) { case ALL_RESULTS: if(isCompletedSequence() && sequence.donePins.size() >= sequence.predictedPins) { notifySequenceDone(); } break; case EARLY_RESULT: if(isCompletedSequence() || pin.isSuccess()) { notifySequenceDone(); } break; } } /** * Sets sequence done and promote the sequence to the decodingCompletedEvent */ protected void notifySequenceDone() { sequence.done = true; decodingCompletedEvent.invokeAll(h -> h.invoke(sequence)); } /** * If all pins are tested, it will return true. */ private boolean isCompletedSequence() { return sequence.donePins.size() >= sequence.pins.length; } /** * Unmark a pin. Means, this pin options are all available and it is removed from current route. * * @param current Pin which options should be available * @param current_route Route whe the pin should be removed from. Note to call this method when the pin is at end of the route * or your route will be inconsequent and unform. */ static void revertPin(Pin current, List<Input> current_route) { current.getTakenOptions().clear(); current_route.remove(current.getInput()); } /** * Determine a valid, means untaken option from this pin, if the option isn't already in your route, * because each option is only allowed to be hit once a time in your route. * * @param current The pin to take a decission of. * @param optionOffset * @return null means, no choice is available or already take in your current route. */ static List<Input> determineOptions(List<Input> current_route, Pin current, int optionOffset) { List<Input> options = new ArrayList<>(); for (Input input : current.getInput().getOptions()) { // ungone und untaken if(!current_route.contains(input) && !current.getTakenOptions().contains(input)) { // can go options.add(input); } } // remove until option for (int i = 0, j = 0; i < options.size(); i++) { if(j < optionOffset) { if(options.size() == 1) { break; } j++; options.remove(i--); } } return options; } /** * Defines a holder for an input varable. It determines taken options and the pin that continued to this pin and finally the decoded route, if it is the starting pin. */ public static class Pin { Input input; List<Input> takenOptions; Pin previous; boolean done; List<Input> route; List<List<Input>> routes; public Pin(Input input) { this.input = input; this.takenOptions = new ArrayList<>(); this.routes = new ArrayList<>(); } public final List<Input> getRouteOrNull() { return route == null || route.isEmpty() ? null : route; } final Pin getPrevious() { return previous; } public final Input getInput() { return input; } List<Input> getTakenOptions() { return takenOptions; } public final boolean isSuccess() { List<Input> route = this.route; return route != null && !route.isEmpty(); } public final void reset() { done = false; previous = null; takenOptions.clear(); } public Pin cloneThis() { try { ObjectMapper mapper = new ObjectMapper(); String json = mapper.writeValueAsString(this); return mapper.readValue(json, getClass()); } catch (IOException e) { throw new RuntimeException(e); } } } /** * Defines your possible input you want to determineValidRoutes. All options need to be set before decode. If no * option can be determine, then it inflicts to use the caller input to determine a different * way to reach the decoding, if possible. */ @SuppressWarnings("unused") public static class Input { @JsonProperty private List<Input> options; @JsonProperty private long id; public Input() { } public Input(long id) { this.id = id; this.options = new ArrayList<>(); } public long getId() { return id; } public void addOption(Input input) { if(!options.contains(input)) { options.add(input); } } public void removeSelection(Input input) { options.remove(input); } public List<Input> getOptions() { return Collections.unmodifiableList(new ArrayList<>(Collections.synchronizedList(options))); } @Override public boolean equals(Object obj) { return obj instanceof Input && ((Input) obj).id == id; } @Override public int hashCode() { return Long.hashCode(id); } } /** * Defines a sequence, holds an info about the state of the solvation of an encoded sequence to decode. */ static final class Sequence { final long id; Pin[] pins; boolean done; List<Pin> donePins; public long predictedPins; Sequence(long id, Pin[] pins) { this.id = id; this.pins = pins; this.done = false; this.donePins = new ArrayList<>(); } public List<Pin> getDonePins() { return donePins; } @SuppressWarnings("WeakerAccess") public Pin[] getPins() { return pins; } Pin asPinOrDie(Input option) { return Arrays.stream(pins).filter(p -> p.getInput().equals(option)).findFirst().orElseThrow(() -> new RuntimeException("pin not found for " + option.getId())); } public final List<List<Input>> collectRoutes() { return donePins.stream().filter(Pin::isSuccess).map(Pin::getRouteOrNull).collect(toList()); } public <T> List<T[]> collectRouteType(Function<Input, T> mapper) { return collectRoutes().stream().map((List<Input> list) -> { List<T> mapped = list.stream().map(mapper).collect(Collectors.toList()); T dummy = mapped.stream().findFirst().orElse(null); if(dummy != null) { return mapped.toArray((T[]) Array.newInstance(dummy.getClass(), 0)); } return Sequence.<T>emptyArray(); }).collect(toList()); } public static <T> T[] emptyArray() { return (T[]) Array.newInstance(Object.class, 0); } public void reset() { Arrays.stream(pins).forEach(Pin::reset); } } public final class DecodeStrategy { private final Sequence sequence; private final Resolution resolution; public DecodeStrategy() { this(null, Resolution.EARLY_RESULT); } public DecodeStrategy(Sequence sequence, Resolution resolution) { this.sequence = sequence; this.resolution = resolution; } public void begin() { for (Pin pin : sequence.getPins()) { // stop asap with resolution EARLY, if a route was found if(resolution != Resolution.EARLY_RESULT || !hasRouteFound()) { // one solution a pin int i = 0; do { if(i > 0) { pin = new Pin(pin.input); } solveFromPin(pin, resolution, i); Pin finalPin = pin; if(pin.route != null && pin.routes.stream().noneMatch(r -> r.equals(finalPin.route))) { pin.routes.add(pin.route); } } while (i++ < pin.input.options.size()); } // early stop else { break; } } } public List<List<Input>> execute() { List<List<Input>> results = new ArrayList<>(); getDecodingCompletedEvent().addListener(new SequenceHandler(results)); begin(); return results; } } private static class SequenceHandler implements Handler<SequenceDecoder.Sequence> { private final List<List<Input>> results; public SequenceHandler(List<List<Input>> results) { this.results = results; } @Override public void invoke(SequenceDecoder.Sequence sq) { // Auswertung for (SequenceDecoder.Pin pin : sq.getDonePins()) { List<Input> raw_route = pin.getRouteOrNull(); if(raw_route != null && !raw_route.isEmpty()) { // cast List<Input> route = new ArrayList<>(raw_route); // recognize result if(!results.contains(route)) { results.add(route); // debug System.out.println(Arrays.toString(route.toArray())); } } else { // debug System.out.println("No result!"); } } } } }
[ "bf2782@web.de" ]
bf2782@web.de
1cdb8a5811c06f262e7f7eebefcef1c8b5af9af7
69778d56cc2432f20e7d450a9ca07b559d6c476b
/app/src/test/java/aholg/github/com/meetescape/ExampleUnitTest.java
799c691fd0458c22a29b82960e7308e95bbbc0cf
[]
no_license
aholg/MeetEscape
d37608bcbae0e16f4ddcb9894ac1c2822461a661
2a9d26d8000c5209d87b9edfe3a9e5d0c2d86013
refs/heads/master
2021-07-25T08:48:16.730484
2017-11-01T21:15:29
2017-11-07T20:55:21
108,173,061
0
0
null
null
null
null
UTF-8
Java
false
false
405
java
package aholg.github.com.meetescape; 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); } }
[ "holgersson31@hotmail.com" ]
holgersson31@hotmail.com
c174f4d4b9bda5039d79f40eb6fd39561b04a986
d926a45d280a4c5f9c40ddda2cf7b711043dc285
/src/main/java/com/avicit/framework/support/dao/util/OrderBy.java
034a9314a5a3af6d29ba694ea844c96d5e774f7c
[ "Apache-2.0" ]
permissive
sdgdsffdsfff/bis
bb7acdfa5f7a1cdd2d91a9e01d44b7b8cdb50194
36001f7d342671b30235362314a1532d21931476
refs/heads/master
2021-01-17T20:20:51.617114
2015-05-05T07:40:03
2015-05-05T07:40:03
44,687,286
0
1
null
2015-10-21T15:51:31
2015-10-21T15:51:31
null
UTF-8
Java
false
false
468
java
package com.avicit.framework.support.dao.util; import org.hibernate.Criteria; import org.hibernate.criterion.Order; import java.util.ArrayList; import java.util.List; public class OrderBy { private List<Order> orders = new ArrayList<Order>(); public void add(Order order) { orders.add(order); } public void build(Criteria criteria) { for(Order order : orders) { criteria.addOrder(order); } } }
[ "772929989@qq.com" ]
772929989@qq.com
ba599872ea631ddeb9219f19d5a8451d982c58f9
ddde7fe724a002ebdeb13e575f6fbf0f8ac04765
/src/dao/impl/ScoreDaoImpl.java
79a9dbf9bc087ba517dd3f370fd2e82072857c14
[]
no_license
FaithWendyLee/LikeTTSSSH
7d096109fce6b41dfe892d998b048e595d49d1c9
adf314e178a0ec09b732817028c47b92b08bf50e
refs/heads/master
2021-01-02T23:08:19.029232
2015-04-03T12:50:38
2015-04-03T12:50:38
33,362,730
0
0
null
null
null
null
UTF-8
Java
false
false
1,876
java
package dao.impl; import java.util.ArrayList; import java.util.List; import javax.annotation.Resource; import org.hibernate.Criteria; import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.hibernate.cfg.Configuration; import org.springframework.orm.hibernate4.HibernateTemplate; import model.Assistant; import model.Homework; import model.Score; import dao.ScoreDao; public class ScoreDaoImpl implements ScoreDao { @Resource private SessionFactory sessionFactory; private static ScoreDaoImpl sDaoImpl = new ScoreDaoImpl(); public void setSessionFactory(SessionFactory sessionFactory) { this.sessionFactory = sessionFactory; } public SessionFactory getSessionFactory() { return sessionFactory; } public void uploadScore(Score s) { new HibernateTemplate(sessionFactory).save(s); } public static ScoreDaoImpl getInstance() { // TODO Auto-generated method stub return sDaoImpl; } public ArrayList<Score> getScore() { ArrayList<Score> slist = (ArrayList<Score>) new HibernateTemplate( sessionFactory).find("from Score"); return slist; } public void updateScore(Score s) { new HibernateTemplate(sessionFactory).update(s); } @Override public Score findScore(int pid) { String hql = "from Score s where s.planid=?"; if (new HibernateTemplate(sessionFactory).find(hql, pid).size() == 0) { return null; } else { Score s = (Score) new HibernateTemplate(sessionFactory).find(hql, pid).get(0); return s; } } @Override public void remove(int planid) { String hql = "from Score s where s.planid=?"; if (new HibernateTemplate(sessionFactory).find(hql, planid).size() != 0) { Score s = (Score) new HibernateTemplate(sessionFactory).find(hql, planid).get(0); new HibernateTemplate(sessionFactory).delete(s); } } }
[ "1185341261@qq.com" ]
1185341261@qq.com
8e985f6419b97aec5007b1063bae19310758cf83
e1df7460797c1dbeed3ae79bc33310051b40ea19
/Practical-Exams/PracticalExam26May/Rectangles.java
1d5539377456d484e28829336a28a2c980f27934
[]
no_license
coasterka/Java
7f6584113a263208cf7ed64bebbae049efd95d81
f5a3fac850d2ee353644c9dba1e17d5654fb62cb
refs/heads/master
2020-06-02T23:43:12.843055
2014-06-07T11:51:34
2014-06-07T11:51:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
770
java
import java.util.Scanner; public class Rectangles { public static void main(String[] args) { Scanner scan = new Scanner(System.in); String input = scan.nextLine(); String[] rectangles = input.split("\\D+"); int max = Integer.MIN_VALUE; for (int i = 6; i < rectangles.length; i+=2) { int firstA = Integer.parseInt(rectangles[i-5]); int firstB = Integer.parseInt(rectangles[i-4]); int secondA = Integer.parseInt(rectangles[i-3]); int secondB = Integer.parseInt(rectangles[i-2]); int thirdA = Integer.parseInt(rectangles[i-1]); int thirdB = Integer.parseInt(rectangles[i]); int sum = firstA*firstB + secondA*secondB + thirdA*thirdB; if (sum>max) { max = sum; } } System.out.println(max); } }
[ "tsvetanovah@gmail.com" ]
tsvetanovah@gmail.com
e67688a405aab099e6dee78d7a05682d009c7f35
4cd2c883ef088edadf66b76f39de888abb1a3884
/src/Main.java
4e9578a65bdf024da80eca700633e7768552b866
[]
no_license
rezvanshokranidev/jenkinsexample
73d8f22edfe904188778f512c8b87a63c9cb0e88
07dd55561d05ea8538b0b8bca3e40d2d776336d5
refs/heads/master
2022-12-05T13:59:21.545897
2020-08-18T23:28:43
2020-08-18T23:28:43
288,585,570
0
0
null
null
null
null
UTF-8
Java
false
false
808
java
import breakingtherecords.breakingRecords; import plusminus.plusMinus; import stringcalculator.stringCalculator; public class Main { public static void main(String[] args) { breakingRecords br = new breakingRecords(); br.input(); br.output(); System.out.println("\n###################"); int[] numbers1 = {-4,3,-9,0,4,1}; int[] numbers2 = {1,1,0,-1,-1}; plusMinus pm = new plusMinus(); pm.calculateFractions(numbers1); pm.printFractions(); System.out.println("\n---------"); pm.calculateFractions(numbers2); pm.printFractions(); System.out.println("\n###################"); stringCalculator sc = new stringCalculator("a,b,c,a,d,c,1,3,a,4,2,d,a,2,-1,-2,1"); sc.output(); } }
[ "noreply@github.com" ]
noreply@github.com
571dcc686e9191f29f479fe930835cda6096e573
47f73aae56c46038f65beb0bf987cdbeabb21c4a
/src/main/java/com/jayhood/mall/mbg/mapper/UmsRolePermissionRelationMapper.java
b718a6efef2d9bebf9bcb43aeed38bea1f178b5d
[]
no_license
jayhood970131/mall-tiny
9b11fe861c0ab87162d27315c66672368545541b
f2ccaa84a35b6ff57845c239b4b8a606bb62b7b2
refs/heads/master
2023-06-12T16:52:10.956613
2021-07-06T07:26:55
2021-07-06T07:26:55
378,353,347
0
0
null
null
null
null
UTF-8
Java
false
false
1,145
java
package com.jayhood.mall.mbg.mapper; import com.jayhood.mall.mbg.model.UmsRolePermissionRelation; import com.jayhood.mall.mbg.model.UmsRolePermissionRelationExample; import java.util.List; import org.apache.ibatis.annotations.Param; public interface UmsRolePermissionRelationMapper { long countByExample(UmsRolePermissionRelationExample example); int deleteByExample(UmsRolePermissionRelationExample example); int deleteByPrimaryKey(Long id); int insert(UmsRolePermissionRelation record); int insertSelective(UmsRolePermissionRelation record); List<UmsRolePermissionRelation> selectByExample(UmsRolePermissionRelationExample example); UmsRolePermissionRelation selectByPrimaryKey(Long id); int updateByExampleSelective(@Param("record") UmsRolePermissionRelation record, @Param("example") UmsRolePermissionRelationExample example); int updateByExample(@Param("record") UmsRolePermissionRelation record, @Param("example") UmsRolePermissionRelationExample example); int updateByPrimaryKeySelective(UmsRolePermissionRelation record); int updateByPrimaryKey(UmsRolePermissionRelation record); }
[ "jayhood970131@gmail.com" ]
jayhood970131@gmail.com
0e7282a7c1511423a57ceea1fe994c93c92a39d4
59e6dc1030446132fb451bd711d51afe0c222210
/components/identity/org.wso2.carbon.identity.provider/4.2.0/src/main/java/org/wso2/carbon/identity/provider/openid/dao/OpenIDAssociationDAO.java
59772c96f8ada3832796190c0bcfab2beb793151
[]
no_license
Alsan/turing-chunk07
2f7470b72cc50a567241252e0bd4f27adc987d6e
e9e947718e3844c07361797bd52d3d1391d9fb5e
refs/heads/master
2020-05-26T06:20:24.554039
2014-02-07T12:02:53
2014-02-07T12:02:53
38,284,349
0
1
null
null
null
null
UTF-8
Java
false
false
8,935
java
/* * Copyright 2005-2008 WSO2, Inc. (http://wso2.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.wso2.carbon.identity.provider.openid.dao; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.openid4java.association.Association; import org.wso2.carbon.identity.base.IdentityException; import org.wso2.carbon.identity.core.persistence.JDBCPersistenceManager; import org.wso2.carbon.identity.core.util.IdentityDatabaseUtil; import org.wso2.carbon.identity.provider.openid.OpenIDServerConstants; import com.sun.org.apache.xerces.internal.impl.dv.util.Base64; /** * The DAO used to access the identity database. This basically store, load and * remove associations from the database. * * @author WSO2 Inc. * */ public class OpenIDAssociationDAO { private String associationStore; private static Log log = LogFactory.getLog(OpenIDAssociationDAO.class); /** * Create the DAO with the identity database connection. * * @param dbConnection * @param privateAssociations * if this DAO stores private associations */ public OpenIDAssociationDAO(String storeType) { associationStore = storeType; } /** * Tries to store the association in the identity database. But if the entry * already exists this operation doesn't do anything useful. * * @param association */ public synchronized void storeAssociation(Association association) { Connection connection = null; PreparedStatement prepStmt = null; try { connection = JDBCPersistenceManager.getInstance().getDBConnection(); if (!isAssociationExist(connection, association.getHandle())) { prepStmt = connection.prepareStatement(OpenIDSQLQueries.STORE_ASSOCIATION); prepStmt.setString(1, association.getHandle()); prepStmt.setString(2, association.getType()); prepStmt.setTimestamp(3, new java.sql.Timestamp(association.getExpiry().getTime())); prepStmt.setString(4, Base64.encode(association.getMacKey().getEncoded())); prepStmt.setString(5, associationStore); prepStmt.execute(); connection.commit(); log.debug("Association " + association.getHandle() + " successfully stored in the database."); } else { log.debug("Association " + association.getHandle() + " already exist in the databse."); } } catch (SQLException e) { log.error("Failed to store the association " + association.getHandle() + ". Error while accessing the database. ", e); } catch (IdentityException e) { log.error("Failed to store the association " + association.getHandle() + ". Error while accessing the database. ", e); } finally { IdentityDatabaseUtil.closeStatement(prepStmt); IdentityDatabaseUtil.closeConnection(connection); } } /** * Loads the association in the identity database. * * @param handle * @return <code>Association</code> */ public synchronized Association loadAssociation(String handle) { Connection connection = null; PreparedStatement prepStmt = null; ResultSet results = null; try { connection = JDBCPersistenceManager.getInstance().getDBConnection(); prepStmt = connection.prepareStatement(OpenIDSQLQueries.LOAD_ASSOCIATION); prepStmt.setString(1, handle); results = prepStmt.executeQuery(); if (results.next()) { log.debug("Loading association " + handle); return buildAssociationObject(results); } } catch (SQLException e) { log.error("Failed to load the association " + handle + ". Error while accessing the database. ", e); } catch (IdentityException e) { log.error("Failed to load the association " + handle + ". Error while accessing the database. ", e); } finally { IdentityDatabaseUtil.closeAllConnections(connection, results, prepStmt); } log.debug("Failed to load the association " + handle + " from the database."); return null; } /** * Tries to remove the association from the database. But if the entry * doesn't exist, then this method throws an exception. * * @param handle */ public synchronized void removeAssociation(String handle) { Connection connection = null; PreparedStatement prepStmt = null; try { connection = JDBCPersistenceManager.getInstance().getDBConnection(); if (isAssociationExist(connection, handle)) { prepStmt = connection.prepareStatement(OpenIDSQLQueries.REMOVE_ASSOCIATION); prepStmt.setString(1, handle); prepStmt.execute(); connection.commit(); log.debug("Association " + handle + " successfully removed from the database."); } else { log.debug("Association " + handle + " does not exist in the databse."); } } catch (SQLException e) { log.error("Failed to remove the association " + handle + ". Error while accessing the database. ", e); } catch (IdentityException e) { log.error("Failed to remove the association " + handle + ". Error while accessing the database. ", e); } finally { IdentityDatabaseUtil.closeStatement(prepStmt); IdentityDatabaseUtil.closeConnection(connection); } } /** * Check if the entry exist in the database * * @param connection * @return boolean * @throws SQLException */ private synchronized boolean isAssociationExist(Connection connection, String handle) { PreparedStatement prepStmt = null; ResultSet results = null; boolean result = false; try { prepStmt = connection.prepareStatement(OpenIDSQLQueries.CHECK_ASSOCIATION_ENTRY_EXIST); prepStmt.setString(1, handle); results = prepStmt.executeQuery(); if (results.next()) { result = true; log.debug("Association " + handle + " found"); } } catch (SQLException e) { log.error("Failed to load the association " + handle + ". Error while accessing the database. ", e); } finally { IdentityDatabaseUtil.closeResultSet(results); IdentityDatabaseUtil.closeStatement(prepStmt); } log.debug("Association " + handle + " not found"); return result; } /** * Builds the Association object * * @param results * @return <code>Association</code> * @throws SQLException */ private synchronized Association buildAssociationObject(ResultSet results) { Association assoc = null; String assocHandle = null; try { assocHandle = results.getString(1); String assocType = results.getString(2); java.util.Date expireIn = new java.util.Date(results.getTimestamp(3).getTime()); String macKey = results.getString(4); String assocStore = results.getString(5); // we check if params are missing if (assocHandle == null || assocType == null || expireIn == null || macKey == null || assocStore == null) { log.error("Required data missing. Cannot build the Association object"); return null; } // Here we check if we are loading the correct associations if (associationStore.equals(OpenIDServerConstants.ASSOCIATION_STORE_TYPE_PRIVATE) && assocStore.equals(OpenIDServerConstants.ASSOCIATION_STORE_TYPE_SHARED)) { log.error("Invalid association data found. Tried to load a Private Association but found a Shared Association"); return null; } else if (associationStore.equals(OpenIDServerConstants.ASSOCIATION_STORE_TYPE_SHARED) && assocStore.equals(OpenIDServerConstants.ASSOCIATION_STORE_TYPE_PRIVATE)) { log.error("Invalid association data found. Tried to load a Shared Association but found a Private Association"); return null; } // Checks for association handle if (Association.TYPE_HMAC_SHA1.equals(assocType)) { assoc = Association.createHmacSha1(assocHandle, Base64.decode(macKey), expireIn); } else if (Association.TYPE_HMAC_SHA256.equals(assocType)) { assoc = Association.createHmacSha256(assocHandle, Base64.decode(macKey), expireIn); } else { log.error("Invalid association type " + assocType + " loaded from database"); return null; } } catch (SQLException e) { log.error("Failed to build the Association for "+ assocHandle + ". Error while accessing the database.",e); } finally { IdentityDatabaseUtil.closeResultSet(results); } log.debug("Association " + assocHandle + " loaded successfully from the database."); return assoc; } }
[ "malaka@wso2.com" ]
malaka@wso2.com
1822241765eea9322e52915c53891f8c167cd91f
bc7da2fc813fd259ba0266cc53228f424c6d9914
/src/java/pojos/UsuarioService.java
ac23e1504b5ac3d0dddb139a816e129630f0e4e4
[]
no_license
miltonfrey/pfc
0b23737bd2f422af72ed85117cd65d6ac27242e6
1575f95f7be904f44519f6b9b89a45d5c7e60942
refs/heads/master
2021-01-23T17:59:12.413919
2014-10-22T17:44:32
2014-10-22T17:44:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
517
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 pojos; import java.util.List; public interface UsuarioService { public Usuario find(String nombre); public boolean delete(Usuario u); public List<Usuario> listar(); public void insertarUsuario(Usuario u); public void actualizar(Usuario u); public String md5Password(String password); }
[ "milton_frey@hotmail.es" ]
milton_frey@hotmail.es
8a51830f06773f35d3b9c6da7408a79b5ec0e976
e96172bcad99d9fddaa00c25d00a319716c9ca3a
/java-debugger-api/src/main/java/com/intellij/java/debugger/engine/evaluation/expression/Modifier.java
ac927ad49724bed6e0034d3bd5e2499cd1053b68
[ "Apache-2.0" ]
permissive
consulo/consulo-java
8c1633d485833651e2a9ecda43e27c3cbfa70a8a
a96757bc015eff692571285c0a10a140c8c721f8
refs/heads/master
2023-09-03T12:33:23.746878
2023-08-29T07:26:25
2023-08-29T07:26:25
13,799,330
5
4
Apache-2.0
2023-01-03T08:32:23
2013-10-23T09:56:39
Java
UTF-8
Java
false
false
1,532
java
/* * Copyright 2000-2009 JetBrains s.r.o. * * 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. */ /* * Interface Modifier * @author Jeka */ package com.intellij.java.debugger.engine.evaluation.expression; import com.intellij.java.debugger.engine.evaluation.EvaluateException; import com.intellij.java.debugger.ui.tree.NodeDescriptor; import consulo.project.Project; import consulo.internal.com.sun.jdi.ClassNotLoadedException; import consulo.internal.com.sun.jdi.InvalidTypeException; import consulo.internal.com.sun.jdi.Type; import consulo.internal.com.sun.jdi.Value; public interface Modifier { boolean canInspect(); boolean canSetValue(); /** * sets the value to the expression */ void setValue(Value value) throws ClassNotLoadedException, InvalidTypeException, EvaluateException; /** * @return the expected type of the expression or null is class was not loaded */ Type getExpectedType() throws ClassNotLoadedException, EvaluateException; NodeDescriptor getInspectItem(Project project); }
[ "vistall.valeriy@gmail.com" ]
vistall.valeriy@gmail.com
130d19ee726cfd499d43ee0d5dd0969846ac7f50
6bbe6e1312fa2d595fc3c0b7260a8e86fe381a7b
/app/src/main/java/com/fed/flowchart_builder/presentation/flowChartViews/lines/SimpleLineView.java
40a8c342fe9e09da54488d8ccc6a396d4a007003
[]
no_license
Bd01a/Flowchart_builder
551c995ccb6f6b0c6eca14321b7ccd9ac1a2ec20
aff4c06f3cf6fa79f5009d4b2dee613791d3a3d5
refs/heads/master
2020-09-12T00:27:54.435545
2020-01-02T22:15:35
2020-01-02T22:15:35
222,240,612
0
0
null
null
null
null
UTF-8
Java
false
false
72,476
java
package com.fed.flowchart_builder.presentation.flowChartViews.lines; import android.content.Context; import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Path; import android.graphics.PointF; import android.graphics.RectF; import android.graphics.drawable.Drawable; import android.os.Parcel; import android.os.Parcelable; import android.util.AttributeSet; import android.view.GestureDetector; import android.view.MotionEvent; import android.view.View; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.fed.flowchart_builder.R; import com.fed.flowchart_builder.data.ChartRoom.ChartLine; import com.fed.flowchart_builder.presentation.flowChartViews.FlowChartViewGroup; import com.fed.flowchart_builder.presentation.flowChartViews.blocks.SimpleBlockView; import java.util.ArrayList; import java.util.List; /** * <p> * View that displays the connection between {@link SimpleBlockView} * </p> * * * @attr ref R.styleable#SimpleLine_color_stroke_line * @attr ref R.styleable#SimpleLine_stroke_width_line * @attr ref R.styleable#SimpleLine_width_line_selection * * @author Sergey Fedorov */ public class SimpleLineView extends View { private static final String TAG = "SimpleLine"; /** *Determines the relative length of the arrow */ private static final float ARROW_COEF_ALONG = 0.7f; /** * Determines the relative width of the arrow */ private static final float ARROW_COEF_ACROSS = 0.4f; /** * for drawing main elements */ private Paint mPaint; /** * for drawing auxiliary elements */ private Paint mFramePaint; /** * fill for auxiliary elements */ private Paint mFrameFillPaint; /** * list of line vertices */ private List<PointF> mPoints; /** * stroke width of {@link SimpleLineView#mPaint} */ private float mStrokeWidth; /** * {@link SimpleLineView#mStrokeWidth} which takes into account the scale */ private float mCurStrokeWidth; /** * color of {@link SimpleLineView#mPaint} */ private int mStrokeColor; /** * parent view */ private FlowChartViewGroup mViewGroup; /** * width between the leftmost and the rightmost elements taking into account the icons and the line width */ private float mWidth; /** * height between the topmost and the bottommost elements taking into account the icons and the line width */ private float mHeight; /** * the X coordinate of the upper left point of this view in the parent view */ private float mX; /** * the Y coordinate of the upper left point of this view in the parent view */ private float mY; /** * distance from the block to the line where the line runs perpendicular to the block */ private float mDistanceBlockLine; /** * @attr ref R.styleable#SimpleLine_width_line_selection */ private float mWidthLineSelectoion; /** * the first block that connects this line */ private SimpleBlockView mBlock1; /** * direction from which the given line will leave the {@link SimpleLineView#mBlock1} */ private BlockSide mSide1; /** * the second block that connects this line */ private SimpleBlockView mBlock2; /** * direction from which the given line will leave the {@link SimpleLineView#mBlock2} */ private BlockSide mSide2; /** * auxiliary path for drawing a arrow */ private Path mArrowPath = new Path(); /** * determines whether the delete icon will be drawn */ private Drawable mDeleteIcon; private PointF mDeleteIconPosition = new PointF(); private RectF mDeleteIconRect = new RectF(); private float mDistanceBetweenIconAndRound; private float mIconSize; /** * canvas translation */ private PointF mTranslation = new PointF(); private boolean mIsSelected; /** * needed to iterate over all points in {@link SimpleLineView#drawSelected(Canvas)} */ private PointF mP1 = new PointF(); /** * needed to iterate over all points in {@link SimpleLineView#drawSelected(Canvas)} */ private PointF mP2 = new PointF(); /** * needed to iterate over all points in {@link SimpleLineView#drawSelected(Canvas)} */ private PointF mP3 = new PointF(); private GestureDetector mGestureDetector = new GestureDetector(new GestureDetector.SimpleOnGestureListener() { @Override public boolean onSingleTapUp(MotionEvent e) { if (mIsSelected && isInRect(mDeleteIconRect, e.getX(), e.getY())) { deleteSelf(); } else if (isInLine(e.getX(), e.getY())) { setSelected(!mIsSelected); } return true; } @Override public boolean onDown(MotionEvent e) { return isInLine(e.getX(), e.getY()) || isInRect(mDeleteIconRect, e.getX(), e.getY()); } }); public SimpleLineView(Context context) { super(context); init(context, null); } public SimpleLineView(Context context, @Nullable AttributeSet attrs) { super(context, attrs); init(context, attrs); } public SimpleLineView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(context, attrs); } /** * assigns a value to a variable {@link SimpleLineView#mIsSelected}, * which determines whether the delete icon will be drawn */ public void setSelected(boolean isSelected) { if (isSelected) { mViewGroup.getLineManager().setSelectedLineView(this); mViewGroup.bringChildToFront(this); mViewGroup.bringChildToFront(mBlock1); mViewGroup.bringChildToFront(mBlock2); } mIsSelected = isSelected; invalidate(); } public float getLineWidth() { return mWidth * mViewGroup.getCurrentScale() + mIconSize; } public float getLineHeight() { return mHeight * mViewGroup.getCurrentScale() + mIconSize; } public float getLineX() { return mX * mViewGroup.getCurrentScale() - mIconSize / 2; } public float getLineY() { return mY * mViewGroup.getCurrentScale() - mIconSize / 2; } private void init(@NonNull Context context, @Nullable AttributeSet attrs) { extractAttributes(context, attrs); mPoints = new ArrayList<>(); mCurStrokeWidth = mStrokeWidth; mDistanceBlockLine = getResources().getDimension(R.dimen.distance_block_line); mIconSize = getResources().getDimension(R.dimen.icon_block_size); mDeleteIcon = getResources().getDrawable(R.drawable.ic_delete_blue_24dp); mDistanceBetweenIconAndRound = getResources().getDimension(R.dimen.distance_between_icon_and_round); initPaint(); initFramePaints(); } /** * initialization {@link SimpleLineView#mFramePaint} and {@link SimpleLineView#mFrameFillPaint} */ private void initFramePaints() { float strokeWidthFrame = getResources().getDimension(R.dimen.stroke_width_frame_block); int colorStrokeFrame = getResources().getColor(R.color.color_stroke_frame); mFramePaint = new Paint(); mFramePaint.setStyle(Paint.Style.STROKE); mFramePaint.setAntiAlias(true); mFramePaint.setStrokeWidth(strokeWidthFrame); mFramePaint.setColor(colorStrokeFrame); mFrameFillPaint = new Paint(); mFrameFillPaint.setStyle(Paint.Style.FILL); mFrameFillPaint.setAntiAlias(true); int colorBackground = getResources().getColor(R.color.color_background); mFrameFillPaint.setColor(colorBackground); } /** * initialization {@link SimpleLineView#mPaint} */ private void initPaint() { mPaint = new Paint(); mPaint.setAntiAlias(true); mPaint.setColor(mStrokeColor); mPaint.setStrokeWidth(mCurStrokeWidth); mPaint.setStyle(Paint.Style.STROKE); } /** * determine parameters and call {@link SimpleLineView#createLine()} * @param block1 determine {@link SimpleLineView#mBlock1} * @param side1 determine {@link SimpleLineView#mSide1} * @param block2 determine {@link SimpleLineView#mBlock2} * @param side2 determine {@link SimpleLineView#mSide2} */ public void addBlocks(SimpleBlockView block1, BlockSide side1, SimpleBlockView block2, BlockSide side2) { mBlock1 = block1; mBlock2 = block2; mSide1 = side1; mSide2 = side2; createLine(); } /** * determines if a point (x,y) lies in a rectangle with considering translation * @param rect rectangle * @param x x coordinate of point * @param y y coordinate of point * @return true if point in rectangle, false if not */ private boolean isInRect(@NonNull RectF rect, float x, float y) { return rect.contains(x - mTranslation.x, y - mTranslation.y); } /** * generates line between {@link SimpleLineView#mBlock1} and {@link SimpleLineView#mBlock2} */ private void createLine() { PointF firstPoint = determineStartPoint(mBlock1, mSide1); PointF lastPoint = determineStartPoint(mBlock2, mSide2); PointF start = createSecondPointNearBlock(firstPoint, mSide1); PointF end = createSecondPointNearBlock(lastPoint, mSide2); PointF nextStart = new PointF(); PointF nextEnd = new PointF(); mPoints.add(firstPoint); mPoints.add(start); float leftX2 = mBlock2.getPosition().x - mBlock2.getOriginalWidth() / 2 - mDistanceBlockLine; float rightX2 = mBlock2.getPosition().x + mBlock2.getOriginalWidth() / 2 + mDistanceBlockLine; float leftX1 = mBlock1.getPosition().x - mBlock1.getOriginalWidth() / 2 - mDistanceBlockLine; float rightX1 = mBlock1.getPosition().x + mBlock1.getOriginalWidth() / 2 + mDistanceBlockLine; float topY2 = mBlock2.getPosition().y - mBlock2.getOriginalHeight() / 2 - mDistanceBlockLine; float bottomY2 = mBlock2.getPosition().y + mBlock2.getOriginalHeight() / 2 + mDistanceBlockLine; float topY1 = mBlock1.getPosition().y - mBlock1.getOriginalHeight() / 2 - mDistanceBlockLine; float bottomY1 = mBlock1.getPosition().y + mBlock1.getOriginalHeight() / 2 + mDistanceBlockLine; nextStart.x = start.x; nextStart.y = start.y; nextEnd.x = end.x; nextEnd.y = end.y; switch (mSide1) { case LEFT: switch (mSide2) { case BOTTOM: leftToBottom(start, end, nextStart, nextEnd, leftX2, rightX2, leftX1, rightX1, topY2, bottomY2, topY1, bottomY1); break; case RIGHT: leftToRight(start, end, nextStart, nextEnd, leftX2, rightX2, leftX1, rightX1, topY2, bottomY2, topY1, bottomY1); break; case TOP: leftToTop(start, end, nextStart, nextEnd, leftX2, rightX2, leftX1, rightX1, topY2, bottomY2, topY1, bottomY1); break; case LEFT: leftToLeft(start, end, nextStart, nextEnd, leftX2, rightX2, leftX1, rightX1, topY2, bottomY2, topY1, bottomY1); break; } break; case TOP: switch (mSide2) { case BOTTOM: topToBottom(start, end, nextStart, nextEnd, leftX2, rightX2, leftX1, rightX1, topY2, bottomY2, topY1, bottomY1); break; case RIGHT: topToRight(start, end, nextStart, nextEnd, leftX1, rightX1, rightX2, topY2, bottomY2, topY1); break; case TOP: topToTop(start, end, nextStart, nextEnd, leftX2, rightX2, leftX1, rightX1, topY2, bottomY2, topY1); break; case LEFT: topToLeft(start, end, nextStart, nextEnd, leftX2, leftX1, rightX1, topY2, bottomY2, topY1); break; } break; case RIGHT: switch (mSide2) { case BOTTOM: rightToBottom(start, end, nextStart, nextEnd, leftX2, rightX2, leftX1, rightX1, topY2, bottomY2, topY1, bottomY1); break; case RIGHT: rightToRight(start, end, nextStart, nextEnd, leftX2, rightX2, leftX1, rightX1, topY2, bottomY2, topY1, bottomY1); break; case TOP: rightToTop(start, end, nextStart, nextEnd, leftX2, rightX2, leftX1, rightX1, topY2, bottomY2, topY1, bottomY1); break; case LEFT: rightToLeft(start, end, nextStart, nextEnd, leftX2, rightX2, leftX1, rightX1, topY2, bottomY2, topY1, bottomY1); break; } break; case BOTTOM: switch (mSide2) { case BOTTOM: bottomToBottom(start, end, nextStart, nextEnd, leftX2, rightX2, leftX1, rightX1, topY2, bottomY2, bottomY1, topY1); break; case RIGHT: bottomToRight(start, end, nextStart, nextEnd, leftX1, rightX1, rightX2, topY2, bottomY2, bottomY1); break; case TOP: bottomToTop(start, end, nextStart, nextEnd, leftX2, rightX2, leftX1, rightX1, topY2, bottomY2, topY1, bottomY1); break; case LEFT: bottomToLeft(start, end, nextStart, nextEnd, leftX2, leftX1, rightX1, topY2, bottomY2, bottomY1); break; } break; } if (!nextStart.equals(start)) { mPoints.add(nextStart); } if (!nextEnd.equals(end)) { mPoints.add(nextEnd); } mPoints.add(end); mPoints.add(lastPoint); findMeasure(); } /** * generates line between {@link SimpleLineView#mBlock1} and {@link SimpleLineView#mBlock2} * if {@link SimpleLineView#mSide1} == BOTTOM, {@link SimpleLineView#mSide2} == BOTTOM * @param start initial point * @param end last point * @param nextStart which is equal to the initial, but requires redefining * @param nextEnd which is equal to the last, but requires redefining * @param leftX2 X coordinate of the left side of {@link SimpleLineView#mBlock2} * @param rightX2 X coordinate of the right side of {@link SimpleLineView#mBlock2} * @param leftX1 X coordinate of the left side of {@link SimpleLineView#mBlock1} * @param rightX1 X coordinate of the right side of {@link SimpleLineView#mBlock1} * @param topY2 Y coordinate of the top side of {@link SimpleLineView#mBlock2} * @param bottomY2 Y coordinate of the bottom side of {@link SimpleLineView#mBlock2} * @param bottomY1 Y coordinate of the bottom side of {@link SimpleLineView#mBlock1} * @param topY1 Y coordinate of the top side of {@link SimpleLineView#mBlock1} */ private void bottomToBottom(PointF start, PointF end, PointF nextStart, PointF nextEnd, float leftX2, float rightX2, float leftX1, float rightX1, float topY2, float bottomY2, float bottomY1, float topY1) { if (bottomY1 <= bottomY2 - 2 * mDistanceBlockLine) { if (start.x < rightX2 && start.x > leftX2) { if (rightX2 - start.x > start.x - leftX2) { nextStart.x = leftX2; nextEnd.x = leftX2; } else { nextStart.x = rightX2; nextEnd.x = rightX2; } } else { nextEnd.x = start.x; } } else { if (rightX1 < end.x || leftX1 > end.x) { nextStart.x = end.x; } else { if (end.x > start.x) { nextStart.x = rightX1; nextEnd.x = rightX1; } else { nextStart.x = leftX1; nextEnd.x = leftX1; } } } } /** * generates line between {@link SimpleLineView#mBlock1} and {@link SimpleLineView#mBlock2} * if {@link SimpleLineView#mSide1} == TOP, {@link SimpleLineView#mSide2} == BOTTOM * @param start initial point * @param end last point * @param nextStart which is equal to the initial, but requires redefining * @param nextEnd which is equal to the last, but requires redefining * @param leftX2 X coordinate of the left side of {@link SimpleLineView#mBlock2} * @param rightX2 X coordinate of the right side of {@link SimpleLineView#mBlock2} * @param leftX1 X coordinate of the left side of {@link SimpleLineView#mBlock1} * @param rightX1 X coordinate of the right side of {@link SimpleLineView#mBlock1} * @param topY2 Y coordinate of the top side of {@link SimpleLineView#mBlock2} * @param bottomY2 Y coordinate of the bottom side of {@link SimpleLineView#mBlock2} * @param bottomY1 Y coordinate of the bottom side of {@link SimpleLineView#mBlock1} * @param topY1 Y coordinate of the top side of {@link SimpleLineView#mBlock1} */ private void topToBottom(PointF start, PointF end, PointF nextStart, PointF nextEnd, float leftX2, float rightX2, float leftX1, float rightX1, float topY2, float bottomY2, float topY1, float bottomY1) { if (topY1 < bottomY2) { if (leftX1 > rightX2) { nextStart.x = rightX2 + (leftX1 - rightX2) / 2; nextEnd.x = nextStart.x; } else if (rightX1 < leftX2) { nextStart.x = rightX1 + (leftX2 - rightX1) / 2; nextEnd.x = nextStart.x; } else { if (start.x > end.x) { nextStart.x = Math.max(rightX1, rightX2); nextEnd.x = nextStart.x; } else { nextStart.x = Math.min(leftX1, leftX2); nextEnd.x = nextStart.x; } } if (end.y < bottomY1) { nextEnd.y = bottomY1; end.y = nextEnd.y; } } else { nextStart.y = bottomY2 + (topY1 - bottomY2) / 2; nextEnd.y = nextStart.y; } } /** * generates line between {@link SimpleLineView#mBlock1} and {@link SimpleLineView#mBlock2} * if {@link SimpleLineView#mSide1} == RIGHT, {@link SimpleLineView#mSide2} == RIGHT * @param start initial point * @param end last point * @param nextStart which is equal to the initial, but requires redefining * @param nextEnd which is equal to the last, but requires redefining * @param leftX2 X coordinate of the left side of {@link SimpleLineView#mBlock2} * @param rightX2 X coordinate of the right side of {@link SimpleLineView#mBlock2} * @param leftX1 X coordinate of the left side of {@link SimpleLineView#mBlock1} * @param rightX1 X coordinate of the right side of {@link SimpleLineView#mBlock1} * @param topY2 Y coordinate of the top side of {@link SimpleLineView#mBlock2} * @param bottomY2 Y coordinate of the bottom side of {@link SimpleLineView#mBlock2} * @param bottomY1 Y coordinate of the bottom side of {@link SimpleLineView#mBlock1} * @param topY1 Y coordinate of the top side of {@link SimpleLineView#mBlock1} */ private void rightToRight(PointF start, PointF end, PointF nextStart, PointF nextEnd, float leftX2, float rightX2, float leftX1, float rightX1, float topY2, float bottomY2, float topY1, float bottomY1) { if (rightX2 > rightX1) { if (start.y > bottomY2 || start.y < topY2) { nextStart.x = end.x; } else if (start.y < end.y) { nextStart.y = topY2; nextEnd.y = nextStart.y; } else { nextStart.y = bottomY2; nextEnd.y = nextStart.y; } } else { if (bottomY1 < end.y || topY1 > end.y) { nextStart.y = end.y; } else { if (end.y > start.y) { nextStart.y = bottomY1; nextEnd.y = nextStart.y; } else { nextStart.y = topY1; nextEnd.y = nextStart.y; } } } } /** * generates line between {@link SimpleLineView#mBlock1} and {@link SimpleLineView#mBlock2} * if {@link SimpleLineView#mSide1} == LEFT, {@link SimpleLineView#mSide2} == LEFT * @param start initial point * @param end last point * @param nextStart which is equal to the initial, but requires redefining * @param nextEnd which is equal to the last, but requires redefining * @param leftX2 X coordinate of the left side of {@link SimpleLineView#mBlock2} * @param rightX2 X coordinate of the right side of {@link SimpleLineView#mBlock2} * @param leftX1 X coordinate of the left side of {@link SimpleLineView#mBlock1} * @param rightX1 X coordinate of the right side of {@link SimpleLineView#mBlock1} * @param topY2 Y coordinate of the top side of {@link SimpleLineView#mBlock2} * @param bottomY2 Y coordinate of the bottom side of {@link SimpleLineView#mBlock2} * @param bottomY1 Y coordinate of the bottom side of {@link SimpleLineView#mBlock1} * @param topY1 Y coordinate of the top side of {@link SimpleLineView#mBlock1} */ private void leftToLeft(PointF start, PointF end, PointF nextStart, PointF nextEnd, float leftX2, float rightX2, float leftX1, float rightX1, float topY2, float bottomY2, float topY1, float bottomY1) { if (leftX2 < leftX1) { if (start.y > bottomY2 || start.y < topY2) { nextStart.x = end.x; } else if (start.y < end.y) { nextStart.y = topY2; nextEnd.y = nextStart.y; } else { nextStart.y = bottomY2; nextEnd.y = nextStart.y; } } else { if (bottomY1 < end.y || topY1 > end.y) { nextStart.y = end.y; } else { if (end.y > start.y) { nextStart.y = bottomY1; nextEnd.y = nextStart.y; } else { nextStart.y = topY1; nextEnd.y = nextStart.y; } } } } /** * generates line between {@link SimpleLineView#mBlock1} and {@link SimpleLineView#mBlock2} * if {@link SimpleLineView#mSide1} == RIGHT, {@link SimpleLineView#mSide2} == LEFT * @param start initial point * @param end last point * @param nextStart which is equal to the initial, but requires redefining * @param nextEnd which is equal to the last, but requires redefining * @param leftX2 X coordinate of the left side of {@link SimpleLineView#mBlock2} * @param rightX2 X coordinate of the right side of {@link SimpleLineView#mBlock2} * @param leftX1 X coordinate of the left side of {@link SimpleLineView#mBlock1} * @param rightX1 X coordinate of the right side of {@link SimpleLineView#mBlock1} * @param topY2 Y coordinate of the top side of {@link SimpleLineView#mBlock2} * @param bottomY2 Y coordinate of the bottom side of {@link SimpleLineView#mBlock2} * @param bottomY1 Y coordinate of the bottom side of {@link SimpleLineView#mBlock1} * @param topY1 Y coordinate of the top side of {@link SimpleLineView#mBlock1} */ private void rightToLeft(PointF start, PointF end, PointF nextStart, PointF nextEnd, float leftX2, float rightX2, float leftX1, float rightX1, float topY2, float bottomY2, float topY1, float bottomY1) { if (rightX1 < leftX2 + mDistanceBlockLine * 2 && rightX1 > leftX2) { nextStart.x = rightX1 + (leftX2 - rightX1) / 2; nextEnd.x = nextStart.x; end.x = nextEnd.x; start.x = nextStart.x; } else if (rightX1 < leftX2) { nextStart.x = rightX1 + (leftX2 - rightX1) / 2; nextEnd.x = nextStart.x; } else if (topY1 + mDistanceBlockLine * 2 > bottomY2) { nextStart.y = bottomY2 + (topY1 - bottomY2) / 2; nextEnd.y = nextStart.y; } else if (bottomY1 < topY2 + mDistanceBlockLine * 2) { nextStart.y = bottomY1 + (topY2 - bottomY1) / 2; nextEnd.y = nextStart.y; } else { if (start.y < end.y) { nextStart.y = Math.min(topY1, topY2); nextEnd.y = nextStart.y; } else { nextStart.y = Math.max(bottomY1, bottomY2); nextEnd.y = nextStart.y; } if (end.x > leftX1) { nextEnd.x = leftX1; end.x = nextEnd.x; } } } /** * generates line between {@link SimpleLineView#mBlock1} and {@link SimpleLineView#mBlock2} * if {@link SimpleLineView#mSide1} == LEFT, {@link SimpleLineView#mSide2} == RIGHT * @param start initial point * @param end last point * @param nextStart which is equal to the initial, but requires redefining * @param nextEnd which is equal to the last, but requires redefining * @param leftX2 X coordinate of the left side of {@link SimpleLineView#mBlock2} * @param rightX2 X coordinate of the right side of {@link SimpleLineView#mBlock2} * @param leftX1 X coordinate of the left side of {@link SimpleLineView#mBlock1} * @param rightX1 X coordinate of the right side of {@link SimpleLineView#mBlock1} * @param topY2 Y coordinate of the top side of {@link SimpleLineView#mBlock2} * @param bottomY2 Y coordinate of the bottom side of {@link SimpleLineView#mBlock2} * @param bottomY1 Y coordinate of the bottom side of {@link SimpleLineView#mBlock1} * @param topY1 Y coordinate of the top side of {@link SimpleLineView#mBlock1} */ private void leftToRight(PointF start, PointF end, PointF nextStart, PointF nextEnd, float leftX2, float rightX2, float leftX1, float rightX1, float topY2, float bottomY2, float topY1, float bottomY1) { if (leftX1 > rightX2 - 2 * mDistanceBlockLine && leftX1 < rightX2) { nextStart.x = rightX2 + (leftX1 - rightX2) / 2; nextEnd.x = nextStart.x; end.x = nextEnd.x; start.x = nextStart.x; } else if (leftX1 > rightX2) { nextStart.x = rightX2 + (leftX1 - rightX2) / 2; nextEnd.x = nextStart.x; } else if (topY1 > bottomY2) { nextStart.y = bottomY2 + (topY1 - bottomY2) / 2; nextEnd.y = nextStart.y; } else if (bottomY1 < topY2) { nextStart.y = bottomY1 + (topY2 - bottomY1) / 2; nextEnd.y = nextStart.y; } else { if (start.y < end.y) { nextStart.y = Math.min(topY1, topY2); nextEnd.y = nextStart.y; } else { nextStart.y = Math.max(bottomY1, bottomY2); nextEnd.y = nextStart.y; } if (end.x < rightX1) { nextEnd.x = rightX1; end.x = nextEnd.x; } } } /** * generates line between {@link SimpleLineView#mBlock1} and {@link SimpleLineView#mBlock2} * if {@link SimpleLineView#mSide1} == RIGHT, {@link SimpleLineView#mSide2} == BOTTOM * @param start initial point * @param end last point * @param nextStart which is equal to the initial, but requires redefining * @param nextEnd which is equal to the last, but requires redefining * @param leftX2 X coordinate of the left side of {@link SimpleLineView#mBlock2} * @param rightX2 X coordinate of the right side of {@link SimpleLineView#mBlock2} * @param leftX1 X coordinate of the left side of {@link SimpleLineView#mBlock1} * @param rightX1 X coordinate of the right side of {@link SimpleLineView#mBlock1} * @param topY2 Y coordinate of the top side of {@link SimpleLineView#mBlock2} * @param bottomY2 Y coordinate of the bottom side of {@link SimpleLineView#mBlock2} * @param bottomY1 Y coordinate of the bottom side of {@link SimpleLineView#mBlock1} * @param topY1 Y coordinate of the top side of {@link SimpleLineView#mBlock1} */ private void rightToBottom(PointF start, PointF end, PointF nextStart, PointF nextEnd, float leftX2, float rightX2, float leftX1, float rightX1, float topY2, float bottomY2, float topY1, float bottomY1) { if (rightX1 < leftX2 + 2 * mDistanceBlockLine && rightX1 > leftX2) { if (start.y > end.y) { nextEnd.y = start.y; } else { nextStart.x = rightX1 + (leftX2 - rightX1) / 2; nextEnd.x = nextStart.x; start.x = nextStart.x; } } else if (rightX1 < leftX2) { if (start.y > end.y) { nextEnd.y = start.y; } else { nextStart.x = rightX1 + (leftX2 - rightX1) / 2; nextEnd.x = nextStart.x; } } else if (end.x >= start.x) { if (start.y > end.y - mDistanceBlockLine) { nextEnd.y = start.y; } else { nextStart.x = rightX2; nextEnd.x = nextStart.x; } } else { if (topY1 > bottomY2) { nextStart.y = bottomY2 + (topY1 - bottomY2) / 2; nextEnd.y = nextStart.y; } else if (bottomY1 < bottomY2) { nextStart.x = Math.max(rightX2, start.x); nextEnd.x = nextStart.x; } else { nextStart.y = bottomY1; nextEnd.y = nextStart.y; } } } /** * generates line between {@link SimpleLineView#mBlock1} and {@link SimpleLineView#mBlock2} * if {@link SimpleLineView#mSide1} == RIGHT, {@link SimpleLineView#mSide2} == TOP * @param start initial point * @param end last point * @param nextStart which is equal to the initial, but requires redefining * @param nextEnd which is equal to the last, but requires redefining * @param leftX2 X coordinate of the left side of {@link SimpleLineView#mBlock2} * @param rightX2 X coordinate of the right side of {@link SimpleLineView#mBlock2} * @param leftX1 X coordinate of the left side of {@link SimpleLineView#mBlock1} * @param rightX1 X coordinate of the right side of {@link SimpleLineView#mBlock1} * @param topY2 Y coordinate of the top side of {@link SimpleLineView#mBlock2} * @param bottomY2 Y coordinate of the bottom side of {@link SimpleLineView#mBlock2} * @param bottomY1 Y coordinate of the bottom side of {@link SimpleLineView#mBlock1} * @param topY1 Y coordinate of the top side of {@link SimpleLineView#mBlock1} */ private void rightToTop(PointF start, PointF end, PointF nextStart, PointF nextEnd, float leftX2, float rightX2, float leftX1, float rightX1, float topY2, float bottomY2, float topY1, float bottomY1) { if (rightX1 < leftX2 + 2 * mDistanceBlockLine && rightX1 > leftX2) { if (start.y < end.y) { nextEnd.y = start.y; } else { nextStart.x = rightX1 + (leftX2 - rightX1) / 2; nextEnd.x = nextStart.x; start.x = nextStart.x; } } else if (rightX1 < leftX2) { if (start.y < end.y) { nextEnd.y = start.y; } else { nextStart.x = rightX1 + (leftX2 - rightX1) / 2; nextEnd.x = nextStart.x; } } else if (end.x >= start.x) { if (start.y < end.y - mDistanceBlockLine) { nextEnd.y = start.y; } else { nextStart.x = rightX2; nextEnd.x = nextStart.x; } } else { if (bottomY1 < topY2) { nextStart.y = bottomY1 + (topY2 - bottomY1) / 2; nextEnd.y = nextStart.y; } else if (topY1 > topY2) { nextStart.x = Math.max(rightX2, start.x); nextEnd.x = nextStart.x; } else { nextStart.y = topY1; nextEnd.y = nextStart.y; } } } /** * generates line between {@link SimpleLineView#mBlock1} and {@link SimpleLineView#mBlock2} * if {@link SimpleLineView#mSide1} == LEFT, {@link SimpleLineView#mSide2} == TOP * @param start initial point * @param end last point * @param nextStart which is equal to the initial, but requires redefining * @param nextEnd which is equal to the last, but requires redefining * @param leftX2 X coordinate of the left side of {@link SimpleLineView#mBlock2} * @param rightX2 X coordinate of the right side of {@link SimpleLineView#mBlock2} * @param leftX1 X coordinate of the left side of {@link SimpleLineView#mBlock1} * @param rightX1 X coordinate of the right side of {@link SimpleLineView#mBlock1} * @param topY2 Y coordinate of the top side of {@link SimpleLineView#mBlock2} * @param bottomY2 Y coordinate of the bottom side of {@link SimpleLineView#mBlock2} * @param bottomY1 Y coordinate of the bottom side of {@link SimpleLineView#mBlock1} * @param topY1 Y coordinate of the top side of {@link SimpleLineView#mBlock1} */ private void leftToTop(PointF start, PointF end, PointF nextStart, PointF nextEnd, float leftX2, float rightX2, float leftX1, float rightX1, float topY2, float bottomY2, float topY1, float bottomY1) { if (leftX1 > rightX2 - 2 * mDistanceBlockLine && leftX1 < rightX2) { if (start.y < end.y) { nextEnd.y = start.y; } else { nextStart.x = rightX2 + (leftX1 - rightX2) / 2; nextEnd.x = nextStart.x; start.x = nextStart.x; } } else if (leftX1 > rightX2) { if (start.y < end.y - mDistanceBlockLine) { nextEnd.y = start.y; } else { nextStart.x = rightX2 + (leftX1 - rightX2) / 2; nextEnd.x = nextStart.x; } } else if (end.x <= start.x) { if (start.y < end.y) { nextEnd.y = start.y; } else { nextStart.x = leftX2; nextEnd.x = nextStart.x; } } else { if (bottomY1 < topY2) { nextStart.y = bottomY1 + (topY2 - bottomY1) / 2; nextEnd.y = nextStart.y; } else if (topY1 > topY2) { nextStart.x = Math.min(leftX2, start.x); nextEnd.x = nextStart.x; } else { nextStart.y = topY1; nextEnd.y = nextStart.y; } } } /** * generates line between {@link SimpleLineView#mBlock1} and {@link SimpleLineView#mBlock2} * if {@link SimpleLineView#mSide1} == LEFT, {@link SimpleLineView#mSide2} == BOTTOM * @param start initial point * @param end last point * @param nextStart which is equal to the initial, but requires redefining * @param nextEnd which is equal to the last, but requires redefining * @param leftX2 X coordinate of the left side of {@link SimpleLineView#mBlock2} * @param rightX2 X coordinate of the right side of {@link SimpleLineView#mBlock2} * @param leftX1 X coordinate of the left side of {@link SimpleLineView#mBlock1} * @param rightX1 X coordinate of the right side of {@link SimpleLineView#mBlock1} * @param topY2 Y coordinate of the top side of {@link SimpleLineView#mBlock2} * @param bottomY2 Y coordinate of the bottom side of {@link SimpleLineView#mBlock2} * @param bottomY1 Y coordinate of the bottom side of {@link SimpleLineView#mBlock1} * @param topY1 Y coordinate of the top side of {@link SimpleLineView#mBlock1} */ private void leftToBottom(PointF start, PointF end, PointF nextStart, PointF nextEnd, float leftX2, float rightX2, float leftX1, float rightX1, float topY2, float bottomY2, float topY1, float bottomY1) { if (leftX1 > rightX2 - 2 * mDistanceBlockLine && leftX1 < rightX2) { if (start.y > end.y) { nextEnd.y = start.y; } else { nextStart.x = rightX2 + (leftX1 - rightX2) / 2; nextEnd.x = nextStart.x; start.x = nextStart.x; } } else if (leftX1 > rightX2) { if (start.y > end.y - mDistanceBlockLine) { nextEnd.y = start.y; } else { nextStart.x = rightX2 + (leftX1 - rightX2) / 2; nextEnd.x = nextStart.x; } } else if (end.x <= start.x) { if (start.y > end.y) { nextEnd.y = start.y; } else { nextStart.x = leftX2; nextEnd.x = nextStart.x; } } else { if (topY1 > bottomY2) { nextStart.y = bottomY2 + (topY1 - bottomY2) / 2; nextEnd.y = nextStart.y; } else if (bottomY1 < bottomY2) { nextStart.x = Math.min(leftX2, start.x); nextEnd.x = nextStart.x; } else { nextStart.y = bottomY1; nextEnd.y = nextStart.y; } } } /** * generates line between {@link SimpleLineView#mBlock1} and {@link SimpleLineView#mBlock2} * if {@link SimpleLineView#mSide1} == BOTTOM, {@link SimpleLineView#mSide2} == LEFT * @param start initial point * @param end last point * @param nextStart which is equal to the initial, but requires redefining * @param nextEnd which is equal to the last, but requires redefining * @param leftX2 X coordinate of the left side of {@link SimpleLineView#mBlock2} * @param leftX1 X coordinate of the left side of {@link SimpleLineView#mBlock1} * @param rightX1 X coordinate of the right side of {@link SimpleLineView#mBlock1} * @param topY2 Y coordinate of the top side of {@link SimpleLineView#mBlock2} * @param bottomY2 Y coordinate of the bottom side of {@link SimpleLineView#mBlock2} * @param bottomY1 Y coordinate of the bottom side of {@link SimpleLineView#mBlock1} */ private void bottomToLeft(PointF start, PointF end, PointF nextStart, PointF nextEnd, float leftX2, float leftX1, float rightX1, float topY2, float bottomY2, float bottomY1) { if (bottomY1 > topY2 && bottomY1 < topY2 + 2 * mDistanceBlockLine) { if (start.x > end.x) { nextStart.y = bottomY1 + (topY2 - bottomY1) / 2; nextEnd.y = nextStart.y; start.y = nextStart.y; } else { nextStart.y = end.y; } } else if (bottomY1 < topY2) { if (start.x > end.x) { nextStart.y = bottomY1 + (topY2 - bottomY1) / 2; nextEnd.y = nextStart.y; } else { nextStart.y = end.y; } } else if (bottomY1 > topY2 && bottomY1 < bottomY2) { if (leftX1 > leftX2) { nextStart.y = bottomY2; nextEnd.y = nextStart.y; } else if (rightX1 < leftX2) { if (start.y < end.y) { nextStart.y = end.y; } else { nextStart.x = rightX1 + (leftX2 - rightX1) / 2; nextEnd.x = nextStart.x; } } else { if (start.y > end.y) { nextStart.x = leftX1; nextEnd.x = nextStart.x; } else { nextStart.y = end.y; } } } else { if (leftX1 > leftX2) { nextStart.x = leftX2; } else if (rightX1 < leftX2) { nextStart.x = rightX1 + (leftX2 - rightX1) / 2; nextEnd.x = nextStart.x; } else { nextStart.x = leftX1; nextEnd.x = nextStart.x; } } } /** * generates line between {@link SimpleLineView#mBlock1} and {@link SimpleLineView#mBlock2} * if {@link SimpleLineView#mSide1} == TOP, {@link SimpleLineView#mSide2} == LEFT * @param start initial point * @param end last point * @param nextStart which is equal to the initial, but requires redefining * @param nextEnd which is equal to the last, but requires redefining * @param leftX2 X coordinate of the left side of {@link SimpleLineView#mBlock2} * @param leftX1 X coordinate of the left side of {@link SimpleLineView#mBlock1} * @param rightX1 X coordinate of the right side of {@link SimpleLineView#mBlock1} * @param topY2 Y coordinate of the top side of {@link SimpleLineView#mBlock2} * @param bottomY2 Y coordinate of the bottom side of {@link SimpleLineView#mBlock2} * @param topY1 Y coordinate of the top side of {@link SimpleLineView#mBlock1} */ private void topToLeft(PointF start, PointF end, PointF nextStart, PointF nextEnd, float leftX2, float leftX1, float rightX1, float topY2, float bottomY2, float topY1) { if (topY1 < bottomY2 && topY1 > bottomY2 - 2 * mDistanceBlockLine) { if (start.x > end.x) { nextStart.y = topY1 + (bottomY2 - topY1) / 2; nextEnd.y = nextStart.y; start.y = nextStart.y; } else { nextStart.y = end.y; } } else if (topY1 > bottomY2) { if (start.x > end.x) { nextStart.y = topY1 + (bottomY2 - topY1) / 2; nextEnd.y = nextStart.y; } else { nextStart.y = end.y; } } else if (topY1 < bottomY2 && topY1 > topY2) { if (leftX1 > leftX2) { nextStart.y = topY2; nextEnd.y = nextStart.y; } else if (rightX1 < leftX2) { if (start.y > end.y) { nextStart.y = end.y; } else { nextStart.x = rightX1 + (leftX2 - rightX1) / 2; nextEnd.x = nextStart.x; } } else { if (start.y < end.y) { nextStart.x = leftX1; nextEnd.x = nextStart.x; } else { nextStart.y = end.y; } } } else { if (leftX1 > leftX2) { nextStart.x = leftX2; } else if (rightX1 < leftX2) { nextStart.x = rightX1 + (leftX2 - rightX1) / 2; nextEnd.x = nextStart.x; } else { nextStart.x = leftX1; nextEnd.x = nextStart.x; } } } /** * generates line between {@link SimpleLineView#mBlock1} and {@link SimpleLineView#mBlock2} * if {@link SimpleLineView#mSide1} == BOTTOM, {@link SimpleLineView#mSide2} == RIGHT * @param start initial point * @param end last point * @param nextStart which is equal to the initial, but requires redefining * @param nextEnd which is equal to the last, but requires redefining * @param rightX2 X coordinate of the right side of {@link SimpleLineView#mBlock2} * @param leftX1 X coordinate of the left side of {@link SimpleLineView#mBlock1} * @param rightX1 X coordinate of the right side of {@link SimpleLineView#mBlock1} * @param topY2 Y coordinate of the top side of {@link SimpleLineView#mBlock2} * @param bottomY2 Y coordinate of the bottom side of {@link SimpleLineView#mBlock2} * @param bottomY1 Y coordinate of the bottom side of {@link SimpleLineView#mBlock1} */ private void bottomToRight(PointF start, PointF end, PointF nextStart, PointF nextEnd, float leftX1, float rightX1, float rightX2, float topY2, float bottomY2, float bottomY1) { if (bottomY1 > topY2 && bottomY1 < topY2 + 2 * mDistanceBlockLine) { if (start.x < end.x) { nextStart.y = bottomY1 + (topY2 - bottomY1) / 2; nextEnd.y = nextStart.y; start.y = nextStart.y; } else { nextStart.y = end.y; } } else if (bottomY1 < topY2) { if (start.x < end.x) { nextStart.y = bottomY1 + (topY2 - bottomY1) / 2; nextEnd.y = nextStart.y; } else { nextStart.y = end.y; } } else if (bottomY1 > topY2 && bottomY1 < bottomY2) { if (rightX1 < rightX2) { nextStart.y = bottomY2; nextEnd.y = nextStart.y; } else if (leftX1 > rightX2) { if (start.y < end.y) { nextStart.y = end.y; } else { nextStart.x = rightX2 + (leftX1 - rightX2) / 2; nextEnd.x = nextStart.x; } } else { if (start.y > end.y) { nextStart.x = rightX1; nextEnd.x = nextStart.x; } else { nextStart.y = end.y; } } } else { if (rightX1 < rightX2) { nextStart.x = rightX2; } else if (leftX1 > rightX2) { nextStart.x = rightX2 + (leftX1 - rightX2) / 2; nextEnd.x = nextStart.x; } else { nextStart.x = rightX1; nextEnd.x = nextStart.x; } } } /** * generates line between {@link SimpleLineView#mBlock1} and {@link SimpleLineView#mBlock2} * if {@link SimpleLineView#mSide1} == TOP, {@link SimpleLineView#mSide2} == RIGHT * @param start initial point * @param end last point * @param nextStart which is equal to the initial, but requires redefining * @param nextEnd which is equal to the last, but requires redefining * @param rightX2 X coordinate of the right side of {@link SimpleLineView#mBlock2} * @param leftX1 X coordinate of the left side of {@link SimpleLineView#mBlock1} * @param rightX1 X coordinate of the right side of {@link SimpleLineView#mBlock1} * @param topY2 Y coordinate of the top side of {@link SimpleLineView#mBlock2} * @param bottomY2 Y coordinate of the bottom side of {@link SimpleLineView#mBlock2} * @param topY1 Y coordinate of the top side of {@link SimpleLineView#mBlock1} */ private void topToRight(PointF start, PointF end, PointF nextStart, PointF nextEnd, float leftX1, float rightX1, float rightX2, float topY2, float bottomY2, float topY1) { if (topY1 < bottomY2 && topY1 > bottomY2 - 2 * mDistanceBlockLine) { if (start.x < end.x) { nextStart.y = topY1 + (bottomY2 - topY1) / 2; nextEnd.y = nextStart.y; start.y = nextStart.y; } else { nextStart.y = end.y; } } else if (topY1 > bottomY2) { if (start.x < end.x) { nextStart.y = topY1 + (bottomY2 - topY1) / 2; nextEnd.y = nextStart.y; } else { nextStart.y = end.y; } } else if (topY1 < bottomY2 && topY1 > topY2) { if (rightX1 < rightX2) { nextStart.y = topY2; nextEnd.y = nextStart.y; } else if (leftX1 > rightX2) { if (start.y > end.y) { nextStart.y = end.y; } else { nextStart.x = rightX2 + (leftX1 - rightX2) / 2; nextEnd.x = nextStart.x; } } else { if (start.y < end.y) { nextStart.x = rightX1; nextEnd.x = nextStart.x; } else { nextStart.y = end.y; } } } else { if (rightX1 < rightX2) { nextStart.x = rightX2; } else if (leftX1 > rightX2) { nextStart.x = rightX2 + (leftX1 - rightX2) / 2; nextEnd.x = nextStart.x; } else { nextStart.x = rightX1; nextEnd.x = nextStart.x; } } } /** * generates line between {@link SimpleLineView#mBlock1} and {@link SimpleLineView#mBlock2} * if {@link SimpleLineView#mSide1} == BOTTOM, {@link SimpleLineView#mSide2} == TOP * @param start initial point * @param end last point * @param nextStart which is equal to the initial, but requires redefining * @param nextEnd which is equal to the last, but requires redefining * @param leftX2 X coordinate of the left side of {@link SimpleLineView#mBlock2} * @param rightX2 X coordinate of the right side of {@link SimpleLineView#mBlock2} * @param leftX1 X coordinate of the left side of {@link SimpleLineView#mBlock1} * @param rightX1 X coordinate of the right side of {@link SimpleLineView#mBlock1} * @param topY2 Y coordinate of the top side of {@link SimpleLineView#mBlock2} * @param bottomY1 Y coordinate of the bottom side of {@link SimpleLineView#mBlock1} */ private void bottomToTop(PointF start, PointF end, PointF nextStart, PointF nextEnd, float leftX2, float rightX2, float leftX1, float rightX1, float topY2, float bottomY2, float topY1, float bottomY1) { if (bottomY1 < topY2 + 2 * mDistanceBlockLine && bottomY1 > topY2) { start.y = bottomY1 + (topY2 - bottomY1) / 2; nextStart.y = start.y; end.y = nextStart.y; nextEnd.y = end.y; } else if (bottomY1 > topY2 + 2 * mDistanceBlockLine) { if (rightX1 < leftX2) { nextStart.x = rightX1 + (leftX2 - rightX1) / 2; nextEnd.x = nextStart.x; } else if (leftX1 > rightX2) { nextStart.x = rightX2 + (leftX1 - rightX2) / 2; nextEnd.x = nextStart.x; } else { if (start.x > end.x) { nextStart.x = Math.max(rightX1, rightX2); nextEnd.x = nextStart.x; } else { nextStart.x = Math.min(leftX1, leftX2); nextEnd.x = nextStart.x; } if (end.y > topY1) { nextEnd.y = topY1; end.y = nextEnd.y; } } } else { nextStart.y = bottomY1 + (topY2 - bottomY1) / 2; nextEnd.y = nextStart.y; } } /** * generates line between {@link SimpleLineView#mBlock1} and {@link SimpleLineView#mBlock2} * if {@link SimpleLineView#mSide1} == TOP, {@link SimpleLineView#mSide2} == TOP * @param start initial point * @param end last point * @param nextStart which is equal to the initial, but requires redefining * @param nextEnd which is equal to the last, but requires redefining * @param leftX2 X coordinate of the left side of {@link SimpleLineView#mBlock2} * @param rightX2 X coordinate of the right side of {@link SimpleLineView#mBlock2} * @param leftX1 X coordinate of the left side of {@link SimpleLineView#mBlock1} * @param rightX1 X coordinate of the right side of {@link SimpleLineView#mBlock1} * @param topY2 Y coordinate of the top side of {@link SimpleLineView#mBlock2} * @param bottomY2 Y coordinate of the bottom side of {@link SimpleLineView#mBlock2} * @param topY1 Y coordinate of the top side of {@link SimpleLineView#mBlock1} */ private void topToTop(PointF start, PointF end, PointF nextStart, PointF nextEnd, float leftX2, float rightX2, float leftX1, float rightX1, float topY2, float bottomY2, float topY1) { if (topY1 >= bottomY2 - 2 * mDistanceBlockLine) { if (start.x < rightX2 && start.x > leftX2) { if (rightX2 - start.x > start.x - leftX2) { nextStart.x = leftX2; nextEnd.x = leftX2; } else { nextStart.x = rightX2; nextEnd.x = rightX2; } } else { nextEnd.x = start.x; } } else if (topY1 < bottomY2 && topY1 > topY2) { nextStart.y = end.y; } else { if (rightX1 < end.x || leftX1 > end.x) { nextEnd.y = start.y; } else { if (end.x > start.x) { nextStart.x = rightX1; nextEnd.x = rightX1; } else { nextStart.x = leftX1; nextEnd.x = leftX1; } } } } /** * @param first first point near block * @param side side of block * @return second point that lies in {@link SimpleLineView#mDistanceBlockLine} */ private PointF createSecondPointNearBlock(PointF first, BlockSide side) { PointF point = new PointF(); switch (side) { case TOP: point = new PointF(first.x, first.y - mDistanceBlockLine); break; case LEFT: point = new PointF(first.x - mDistanceBlockLine, first.y); break; case RIGHT: point = new PointF(first.x + mDistanceBlockLine, first.y); break; case BOTTOM: point = new PointF(first.x, first.y + mDistanceBlockLine); break; } return point; } /** * @return point that lies in the middle of given side of given block */ private PointF determineStartPoint(SimpleBlockView blockView, BlockSide side) { float width = blockView.getOriginalWidth(); float height = blockView.getOriginalHeight(); PointF point = new PointF(); float blockPositionX = blockView.getPosition().x; float blockPositionY = blockView.getPosition().y; switch (side) { case TOP: point.x = blockPositionX; point.y = blockPositionY + -height / 2; break; case LEFT: point.x = blockPositionX - width / 2; point.y = blockPositionY; break; case RIGHT: point.x = blockPositionX + width / 2; point.y = blockPositionY; break; case BOTTOM: point.x = blockPositionX; point.y = blockPositionY + height / 2; break; } return point; } /** * initializes {@link SimpleLineView#mViewGroup} */ public void findViewGroup() { mViewGroup = (FlowChartViewGroup) getParent(); } private void extractAttributes(@NonNull Context context, @Nullable AttributeSet attrs) { final Resources.Theme theme = context.getTheme(); final TypedArray typedArray = theme.obtainStyledAttributes(attrs, R.styleable.SimpleLineView, 0, R.style.SimpleLineDefault); try { mStrokeColor = typedArray.getColor(R.styleable.SimpleLineView_color_stroke_line, 0); mStrokeWidth = typedArray.getDimension(R.styleable.SimpleLineView_stroke_width_line, 0); mWidthLineSelectoion = typedArray.getDimension(R.styleable.SimpleLineView_width_line_selection, 0); } finally { typedArray.recycle(); } } @Override public boolean onTouchEvent(MotionEvent event) { return mGestureDetector.onTouchEvent(event); } @Override public void onDraw(Canvas canvas) { super.onDraw(canvas); float scale = mViewGroup.getCurrentScale(); mTranslation.x = -getLineX() + (mStrokeWidth / 2) * scale; mTranslation.y = -getLineY() + (mStrokeWidth / 2) * scale; canvas.translate(mTranslation.x, mTranslation.y); for (int i = 1; i < mPoints.size(); i++) { canvas.drawLine((mPoints.get(i - 1).x) * scale, (mPoints.get(i - 1).y) * scale, (mPoints.get(i).x) * scale, (mPoints.get(i).y) * scale, mPaint); if (i != mPoints.size() - 1) { if (mPoints.get(i - 1).y == mPoints.get(i).y) { canvas.drawLine((mPoints.get(i).x - mStrokeWidth / 2) * scale, (mPoints.get(i).y) * scale, (mPoints.get(i).x) * scale, (mPoints.get(i).y) * scale, mPaint); canvas.drawLine((mPoints.get(i).x) * scale, (mPoints.get(i).y) * scale, (mPoints.get(i).x + mStrokeWidth / 2) * scale, (mPoints.get(i).y) * scale, mPaint); } else { canvas.drawLine((mPoints.get(i).x) * scale, (mPoints.get(i).y - mStrokeWidth / 2) * scale, (mPoints.get(i).x) * scale, (mPoints.get(i).y) * scale, mPaint); canvas.drawLine((mPoints.get(i).x) * scale, (mPoints.get(i).y) * scale, (mPoints.get(i).x) * scale, (mPoints.get(i).y + mStrokeWidth / 2) * scale, mPaint); } } else if (i == mPoints.size() - 1) { mArrowPath.reset(); if (mPoints.get(i - 1).y == mPoints.get(i).y) { if (mPoints.get(i - 1).x < mPoints.get(i).x) { float center = (mPoints.get(i).x - mBlock2.getStrokeWidth() / 2) * scale; mArrowPath.moveTo(center - mDistanceBlockLine * ARROW_COEF_ALONG * scale, (mPoints.get(i).y - mDistanceBlockLine * ARROW_COEF_ACROSS) * scale); mArrowPath.lineTo(center, (mPoints.get(i).y) * scale); mArrowPath.lineTo(center - mDistanceBlockLine * ARROW_COEF_ALONG * scale, (mPoints.get(i).y + mDistanceBlockLine * ARROW_COEF_ACROSS) * scale); canvas.drawPath(mArrowPath, mPaint); } else { float center = (mPoints.get(i).x + mBlock2.getStrokeWidth() / 2) * scale; mArrowPath.moveTo(center + mDistanceBlockLine * ARROW_COEF_ALONG * scale, (mPoints.get(i).y - mDistanceBlockLine * ARROW_COEF_ACROSS) * scale); mArrowPath.lineTo(center, (mPoints.get(i).y) * scale); mArrowPath.lineTo(center + mDistanceBlockLine * ARROW_COEF_ALONG * scale, (mPoints.get(i).y + mDistanceBlockLine * ARROW_COEF_ACROSS) * scale); canvas.drawPath(mArrowPath, mPaint); } } else { if (mPoints.get(i - 1).y < mPoints.get(i).y) { float center = (mPoints.get(i).y - mBlock2.getStrokeWidth() / 2) * scale; mArrowPath.moveTo((mPoints.get(i).x - mDistanceBlockLine * ARROW_COEF_ACROSS) * scale, center - mDistanceBlockLine * ARROW_COEF_ALONG * scale); mArrowPath.lineTo((mPoints.get(i).x) * scale, center); mArrowPath.lineTo((mPoints.get(i).x + mDistanceBlockLine * ARROW_COEF_ACROSS) * scale, center - mDistanceBlockLine * ARROW_COEF_ALONG * scale); canvas.drawPath(mArrowPath, mPaint); } else { float center = (mPoints.get(i).y + mBlock2.getStrokeWidth() / 2) * scale; mArrowPath.moveTo((mPoints.get(i).x - mDistanceBlockLine * ARROW_COEF_ACROSS) * scale, center + mDistanceBlockLine * ARROW_COEF_ALONG * scale); mArrowPath.lineTo((mPoints.get(i).x) * scale, center); mArrowPath.lineTo((mPoints.get(i).x + mDistanceBlockLine * ARROW_COEF_ACROSS) * scale, center + mDistanceBlockLine * ARROW_COEF_ALONG * scale); canvas.drawPath(mArrowPath, mPaint); } } } } if (mIsSelected) { drawSelected(canvas); } } private void drawSelected(Canvas canvas) { float scale = mViewGroup.getCurrentScale(); float signLast = 0; for (int i = 1; i < mPoints.size(); i++) { mP1.x = mPoints.get(i - 1).x * scale; mP1.y = mPoints.get(i - 1).y * scale; mP2.x = mPoints.get(i).x * scale; mP2.y = mPoints.get(i).y * scale; mP3.x = mP2.x; mP3.y = mP2.y; if (i != mPoints.size() - 1) { mP3.x = mPoints.get(i + 1).x * scale; mP3.y = mPoints.get(i + 1).y * scale; } if (mP1.x == mP2.x) { float left = mP1.x - mWidthLineSelectoion / 2; float right = mP1.x + mWidthLineSelectoion / 2; canvas.drawLine( left, mP1.y + Math.signum(mP2.y - mP1.y) * signLast * mWidthLineSelectoion / 2, left, mP2.y + Math.signum(mP3.x - mP2.x) * Math.signum(mP2.y - mP1.y) * mWidthLineSelectoion / 2 + Math.signum(mP2.y - mP1.y) * mFramePaint.getStrokeWidth() / 2, mFramePaint); canvas.drawLine( right, mP1.y - Math.signum(mP2.y - mP1.y) * signLast * mWidthLineSelectoion / 2, right, mP2.y - Math.signum(mP3.x - mP2.x) * Math.signum(mP2.y - mP1.y) * mWidthLineSelectoion / 2 + Math.signum(mP2.y - mP1.y) * mFramePaint.getStrokeWidth() / 2, mFramePaint); signLast = mP3.x != mP1.x ? Math.signum(mP3.y - (mP1.y + (mP2.y - mP1.y) / 2)) : 0; } else if (mP1.y == mP2.y) { float top = mP1.y - mWidthLineSelectoion / 2; float bottom = mP1.y + mWidthLineSelectoion / 2; canvas.drawLine( mP1.x + Math.signum(mP2.x - mP1.x) * signLast * mWidthLineSelectoion / 2, top, mP2.x + Math.signum(mP3.y - mP2.y) * Math.signum(mP2.x - mP1.x) * mWidthLineSelectoion / 2 + Math.signum(mP2.x - mP1.x) * mFramePaint.getStrokeWidth() / 2, top, mFramePaint); canvas.drawLine( mP1.x - Math.signum(mP2.x - mP1.x) * signLast * mWidthLineSelectoion / 2, bottom, mP2.x - Math.signum(mP3.y - mP2.y) * Math.signum(mP2.x - mP1.x) * mWidthLineSelectoion / 2 + Math.signum(mP2.x - mP1.x) * mFramePaint.getStrokeWidth() / 2, bottom, mFramePaint); signLast = mP3.y != mP1.y ? Math.signum(mP3.x - (mP1.x + (mP2.x - mP1.x) / 2)) : 0; } } drawIcon(canvas, mDeleteIcon, mDeleteIconPosition, mDeleteIconRect); } private boolean isInLine(float x, float y) { float scale = mViewGroup.getCurrentScale(); for (int i = 1; i < mPoints.size(); i++) { PointF pOne = mPoints.get(i - 1); PointF pTwo = mPoints.get(i); RectF aroundLineRect = new RectF( Math.min(pOne.x * scale, pTwo.x * scale), Math.min(pOne.y * scale, pTwo.y * scale), Math.max(pOne.x * scale, pTwo.x * scale), Math.max(pOne.y * scale, pTwo.y * scale)); if (aroundLineRect.left == aroundLineRect.right) { aroundLineRect.left -= mWidthLineSelectoion / 2; aroundLineRect.right += mWidthLineSelectoion / 2; } else if (aroundLineRect.top == aroundLineRect.bottom) { aroundLineRect.top -= mWidthLineSelectoion / 2; aroundLineRect.bottom += mWidthLineSelectoion / 2; } if (isInRect(aroundLineRect, x, y)) { return true; } // if (aroundLineRect.contains( x, y)) { // return true; // } } return false; } /** * delete self from childs of parent */ private void deleteSelf() { mViewGroup.removeView(this); mViewGroup.invalidate(); } /** * @param point position of icon * @param rect defines bounds of icon */ private void drawIcon(Canvas canvas, Drawable icon, PointF point, RectF rect) { float scale = mViewGroup.getCurrentScale(); icon.setBounds((int) ((point.x) * scale - mIconSize / 2 + mDistanceBetweenIconAndRound), (int) ((point.y) * scale - mIconSize / 2 + mDistanceBetweenIconAndRound), (int) ((point.x) * scale + mIconSize / 2 - mDistanceBetweenIconAndRound), (int) ((point.y) * scale + mIconSize / 2 - mDistanceBetweenIconAndRound)); mDeleteIconRect.right = point.x * scale + mIconSize / 2; mDeleteIconRect.left = point.x * scale - mIconSize / 2; mDeleteIconRect.top = point.y * scale - mIconSize / 2; mDeleteIconRect.bottom = point.y * scale + mIconSize / 2; canvas.drawOval(rect, mFrameFillPaint); canvas.drawOval(rect, mFramePaint); icon.draw(canvas); } /** * finds {@link SimpleLineView#mX}, {@link SimpleLineView#mY}, * {@link SimpleLineView#mWidth}, {@link SimpleLineView#mHeight} * and defines {@link SimpleLineView#mDeleteIconPosition} */ public void findMeasure() { float lX = mPoints.get(0).x; float bY = mPoints.get(0).y; float rX = mPoints.get(0).x; float tY = mPoints.get(0).y; for (int i = 1; i < mPoints.size(); i++) { if (mPoints.get(i).x < lX) { lX = mPoints.get(i).x; } else if (mPoints.get(i).x > rX) { rX = mPoints.get(i).x; } if (mPoints.get(i).y > bY) { bY = mPoints.get(i).y; } else if (mPoints.get(i).y < tY) { tY = mPoints.get(i).y; } } mDeleteIconPosition.x = (mPoints.get(mPoints.size() / 2 - 1).x + mPoints.get(mPoints.size() / 2).x) / 2; mDeleteIconPosition.y = (mPoints.get(mPoints.size() / 2 - 1).y + mPoints.get(mPoints.size() / 2).y) / 2; mWidth = rX - lX + mStrokeWidth + mDistanceBlockLine; mHeight = bY - tY + mStrokeWidth + mDistanceBlockLine; mX = lX - mDistanceBlockLine / 2; mY = tY - mDistanceBlockLine / 2; } /** * regenerates all points of line */ public void update() { mPoints.clear(); createLine(); } @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); if (mViewGroup != null) { mCurStrokeWidth = mViewGroup.getCurrentScale() * mStrokeWidth; } initPaint(); } /** * delete self if {@link SimpleLineView#mBlock1} or {@link SimpleLineView#mBlock2} equals null */ public void checkBlocks() { boolean block1Exist = false; boolean block2Exist = false; for (int i = 0; i < mViewGroup.getChildCount(); i++) { if (mViewGroup.getChildAt(i).equals(mBlock1)) { block1Exist = true; } if (mViewGroup.getChildAt(i).equals(mBlock2)) { block2Exist = true; } } if (!block1Exist || !block2Exist) { deleteSelf(); } } /** * @return own parameters for saving in database */ public ChartLine save() { ChartLine chartLine = new ChartLine(); chartLine.setNumBlock1(mViewGroup.getNumberBlockChild(mBlock1)); chartLine.setNumBlock2(mViewGroup.getNumberBlockChild(mBlock2)); chartLine.setSide1(mSide1.getNum()); chartLine.setSide2(mSide2.getNum()); return chartLine; } @Nullable @Override public Parcelable onSaveInstanceState() { Parcelable parcelable = super.onSaveInstanceState(); LineSavedState ss = new LineSavedState(parcelable); ss.mNumBlock1 = mViewGroup.getNumberBlockChild(mBlock1); ss.mNumBlock2 = mViewGroup.getNumberBlockChild(mBlock2); ss.mSide1 = mSide1.getNum(); ss.mSide2 = mSide2.getNum(); ss.mIsSelected = mIsSelected ? 1 : 0; return ss; } /** * This object can be equal: {@link BlockSide#LEFT}, {@link BlockSide#RIGHT}, * {@link BlockSide#TOP}, {@link BlockSide#BOTTOM} */ public enum BlockSide { LEFT(301), RIGHT(302), TOP(303), BOTTOM(304); private final int mNum; BlockSide(int num) { mNum = num; } @Nullable static public BlockSide getBlockSide(int num) { if (num == LEFT.getNum()) { return LEFT; } else if (num == RIGHT.getNum()) { return RIGHT; } else if (num == TOP.getNum()) { return TOP; } else if (num == BOTTOM.getNum()) { return BOTTOM; } else { return null; } } public int getNum() { return mNum; } } public static class LineSavedState extends BaseSavedState { public static final ClassLoaderCreator<LineSavedState> CREATOR = new ClassLoaderCreator<LineSavedState>() { @Override public LineSavedState createFromParcel(Parcel source, ClassLoader loader) { return new LineSavedState(source, loader); } @Override public LineSavedState createFromParcel(Parcel source) { return createFromParcel(source, null); } public LineSavedState[] newArray(int size) { return new LineSavedState[size]; } }; int mNumBlock1; int mNumBlock2; int mSide1; int mSide2; int mIsSelected; LineSavedState(Parcelable superState) { super(superState); } @SuppressWarnings("unchecked") private LineSavedState(Parcel in, ClassLoader classLoader) { super(in); mNumBlock1 = in.readInt(); mNumBlock2 = in.readInt(); mSide1 = in.readInt(); mSide2 = in.readInt(); mIsSelected = in.readInt(); } public int getNumBlock1() { return mNumBlock1; } public int getNumBlock2() { return mNumBlock2; } public int getSide1() { return mSide1; } public int getSide2() { return mSide2; } @Override public void writeToParcel(Parcel out, int flags) { super.writeToParcel(out, flags); out.writeInt(mNumBlock1); out.writeInt(mNumBlock2); out.writeInt(mSide1); out.writeInt(mSide2); out.writeInt(mIsSelected); } } }
[ "wifator@gmail.com" ]
wifator@gmail.com
452a79daddcbfe07ec45d3b809c57b499ea7bc60
c32843de6e127c07213a4ede8d73a22c03d5b1c4
/src/org/iit/dr/subsystems/doc_archive/entities/Document.java
ea909b2d0750ba9c0c2d7d2ec0edef06dcfd6fcf
[]
no_license
Vadja/Dipl
5fdc582f870aa1278a1c5384cf236310abeb2fdd
a1b43d2c9803e3fedbd5f1b96f77b622c4ea884c
refs/heads/master
2021-01-23T07:25:52.474052
2014-05-23T08:30:20
2014-05-23T08:30:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,477
java
package org.iit.dr.subsystems.doc_archive.entities; import org.hibernate.annotations.GenericGenerator; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; import java.io.File; import java.util.Date; /** * Created with IntelliJ IDEA. * User: Piligrim * Date: 13.05.14 * Time: 18:04 * To change this template use File | Settings | File Templates. */ @Entity @Table(name = "DOCUMENT") public class Document { @Id @Column(name = "ID") @GeneratedValue(generator = "increment") @GenericGenerator(name = "increment", strategy = "increment") private Long id; @Column(name = "NAME") private String title; @Column(name = "LOAD_DATE") private Date loadDate; @Column(name = "CREATE_DATE") private Date createDate; @Column(name = "DOC_DESCRIPTION") private String description; @Column(name = "FILE") private File file; @ManyToOne(fetch = FetchType.EAGER) @JoinColumn(name = "TYPE_ID") private DocType documentType; @ManyToOne(fetch = FetchType.EAGER) @JoinColumn(name = "USER_ID") private User user; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public Date getLoadDate() { return loadDate; } public void setLoadDate(Date loadDate) { this.loadDate = loadDate; } public Date getCreateDate() { return createDate; } public void setCreateDate(Date createDate) { this.createDate = createDate; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public File getFile() { return file; } public void setFile(File file) { this.file = file; } public DocType getDocumentType() { return documentType; } public void setDocumentType(DocType documentType) { this.documentType = documentType; } public User getUser() { return user; } public void setUser(User user) { this.user = user; } }
[ "v.for.vadja@gmail.com" ]
v.for.vadja@gmail.com
dfe79dc9f6defa4caaf01ce6db892bf1c9618bc2
013c744f98ed140f8b751d76a372565b7a841ecf
/src/com/dosmil_e/kit/core/projection/structural/pub/KitDocumentProjectionPub.java
05ece528517af83bc939b702a850e446afb71517
[]
no_license
carrascoMDD/Kit01
85ac077df93f1ed1b2ece6799fc3c130e0189359
edc0a9dcd3944f413b1206c0b834c78d8217b51b
refs/heads/master
2020-03-14T11:53:21.408340
2018-04-30T13:49:34
2018-04-30T13:49:34
131,598,995
0
0
null
null
null
null
UTF-8
Java
false
false
500
java
package com.dosmil_e.kit.core.projection.structural.pub; import com.dosmil_e.modelbase.support.*; import com.dosmil_e.modelbase.flattrx.*; public interface KitDocumentProjectionPub extends com.dosmil_e.kit.core.model.structural.pub.KitAbstractDocumentPub, com.dosmil_e.kit.core.projection.projecting.pub.KitProjectablePub, com.dosmil_e.kit.core.projection.projecting.pub.KitProjectedPub, com.dosmil_e.kit.core.projection.structural.ifc.KitDocumentProjectionIfc { }
[ "carrascomdd@gmail.com" ]
carrascomdd@gmail.com
9aab27c962792f6f7f1c1cda1dac9d56906a547c
b8eaf92366f6f908fb92a38ee07a7dab52b3b882
/spring-02/src/main/java/com/study/pojo/People2.java
401247ad8fe60e4c66e57e3b62a89bd71a09c2f0
[]
no_license
youthynf/spring
e681d1840ced8a4c3ae4c9f6c319e4e1d83882b8
1d3d36b380cb847714c0f3ba500de54e16565462
refs/heads/master
2023-06-24T05:28:21.153936
2021-07-28T11:43:29
2021-07-28T11:43:29
383,668,036
0
0
null
null
null
null
UTF-8
Java
false
false
853
java
package com.study.pojo; public class People2 { private Dog dog; private Cat cat; private String name; public People2() { } public People2(Dog dog, Cat cat, String name) { this.dog = dog; this.cat = cat; this.name = name; } public Dog getDog() { return dog; } public void setDog(Dog dog) { this.dog = dog; } public Cat getCat() { return cat; } public void setCat(Cat cat) { this.cat = cat; } public String getName() { return name; } public void setName(String name) { this.name = name; } @Override public String toString() { return "People{" + "dog=" + dog + ", cat=" + cat + ", name='" + name + '\'' + '}'; } }
[ "940436475@qq.com" ]
940436475@qq.com
f464e7d2f4a588b4a0116c1612d7a82d4d813775
fbfcc10c2c6483888f50a25b37c76caf604170c9
/src/main/java/com/jss/smarthome/loxone/smarthomeloxone/config/JerseyConfig.java
a3d0e0583db6d01940c2e6bbf22dbebcf3b13dd9
[]
no_license
jatin-28/smarthome-loxone
ec1b70493ac39da48ec68914ddc0c49b5616aae3
f52882e10553a94b641bab1b5d68577428ac879b
refs/heads/master
2020-03-23T16:10:58.960097
2018-07-21T09:14:30
2018-07-21T09:14:30
141,796,158
0
0
null
null
null
null
UTF-8
Java
false
false
840
java
package com.jss.smarthome.loxone.smarthomeloxone.config; import com.jss.smarthome.loxone.smarthomeloxone.rest.EndpointLoggingListener; import com.jss.smarthome.loxone.smarthomeloxone.rest.GenericExceptionMapper; import com.jss.smarthome.loxone.smarthomeloxone.rest.smarthome.GoogleSmartHomeResourceImpl; import lombok.extern.slf4j.Slf4j; import org.glassfish.jersey.server.ResourceConfig; import org.springframework.boot.autoconfigure.jersey.JerseyProperties; import org.springframework.context.annotation.Configuration; /** * */ @Configuration @Slf4j public class JerseyConfig extends ResourceConfig { public JerseyConfig(JerseyProperties jerseyProperties) { register(GoogleSmartHomeResourceImpl.class); register(new EndpointLoggingListener(jerseyProperties.getApplicationPath())); register(GenericExceptionMapper.class); } }
[ "jatin.shah@gamesys.co.uk" ]
jatin.shah@gamesys.co.uk
80cbc867ee498ad9bc9bcdf397f2d6c38115f85c
fb1f54eb41c72170e0844d17593432d07f4ebc3c
/src/main/java/com/jasperwireless/api/ws/schema/SimInfo.java
c54cb3bf14b2bc78425f1fdbd5fa1accfdf78df4
[]
no_license
lxchen2001/jasper-wireless-api
a46635f6ccd6e4decf4d758f9e6423822dd77c93
3b4b4f866c1d92cbcb3cb5e4b4ce62280adc8d83
refs/heads/master
2021-01-19T21:05:14.223937
2016-10-28T19:15:46
2016-10-28T19:15:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
29,156
java
package com.jasperwireless.api.ws.schema; import java.math.BigDecimal; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlType; import javax.xml.datatype.XMLGregorianCalendar; /** * <p>Java class for SimInfo complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="SimInfo"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;all> * &lt;element name="iccid" type="{http://www.w3.org/2001/XMLSchema}string"/> * &lt;element name="msisdn" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="deviceId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="simProfileId" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/> * &lt;element name="acctId" type="{http://www.w3.org/2001/XMLSchema}long"/> * &lt;element name="live" type="{http://www.w3.org/2001/XMLSchema}boolean"/> * &lt;element name="ratePlanId" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/> * &lt;element name="activationDate" type="{http://www.w3.org/2001/XMLSchema}dateTime" minOccurs="0"/> * &lt;element name="status" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/> * &lt;element name="modemId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="customer" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="overAgeLimitToOverrideMode" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/> * &lt;element name="overAgeLimitReached" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="overAgeLimit" type="{http://www.w3.org/2001/XMLSchema}decimal" minOccurs="0"/> * &lt;element name="customerId" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/> * &lt;element name="endConsumerIdentity" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="commPlanId" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/> * &lt;element name="lastStateChange" type="{http://www.w3.org/2001/XMLSchema}dateTime" minOccurs="0"/> * &lt;element name="testReadyDataLimit" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/> * &lt;element name="monthToDateSmsUsage" type="{http://www.w3.org/2001/XMLSchema}decimal" minOccurs="0"/> * &lt;element name="monthToDateVoiceUsage" type="{http://www.w3.org/2001/XMLSchema}decimal" minOccurs="0"/> * &lt;element name="userName" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="password" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="monthToDateDataUsage" type="{http://www.w3.org/2001/XMLSchema}decimal" minOccurs="0"/> * &lt;element name="oneBox" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="dateShipped" type="{http://www.w3.org/2001/XMLSchema}dateTime" minOccurs="0"/> * &lt;element name="testReadyDataState" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/> * &lt;element name="testReadyTimeLimit" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/> * &lt;element name="testReadyTimeState" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/> * &lt;element name="custom1" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="custom2" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="custom3" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="version" type="{http://www.w3.org/2001/XMLSchema}long"/> * &lt;element name="operatorId" type="{http://www.w3.org/2001/XMLSchema}long"/> * &lt;element name="notes" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="networkBlocked" type="{http://www.w3.org/2001/XMLSchema}boolean"/> * &lt;element name="consumerUserId" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/> * &lt;element name="dateOneBoxModified" type="{http://www.w3.org/2001/XMLSchema}dateTime" minOccurs="0"/> * &lt;element name="linePayStatus" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="imsi1" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="primaryDevice" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="nickName" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="areaCode" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="countryCode" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="migratedSim" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="saleDate" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;/all> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "SimInfo", propOrder = { }) public class SimInfo { @XmlElement(required = true) protected String iccid; protected String msisdn; protected String deviceId; protected Long simProfileId; protected long acctId; protected boolean live; protected Long ratePlanId; @XmlSchemaType(name = "dateTime") protected XMLGregorianCalendar activationDate; protected Long status; protected String modemId; protected String customer; protected Long overAgeLimitToOverrideMode; protected Boolean overAgeLimitReached; protected BigDecimal overAgeLimit; protected Long customerId; protected String endConsumerIdentity; protected Long commPlanId; @XmlSchemaType(name = "dateTime") protected XMLGregorianCalendar lastStateChange; protected Long testReadyDataLimit; protected BigDecimal monthToDateSmsUsage; protected BigDecimal monthToDateVoiceUsage; protected String userName; protected String password; protected BigDecimal monthToDateDataUsage; protected String oneBox; @XmlSchemaType(name = "dateTime") protected XMLGregorianCalendar dateShipped; protected Long testReadyDataState; protected Long testReadyTimeLimit; protected Long testReadyTimeState; protected String custom1; protected String custom2; protected String custom3; protected long version; protected long operatorId; protected String notes; protected boolean networkBlocked; protected Long consumerUserId; @XmlSchemaType(name = "dateTime") protected XMLGregorianCalendar dateOneBoxModified; protected String linePayStatus; protected String imsi1; protected Boolean primaryDevice; protected String nickName; protected String areaCode; protected String countryCode; protected Boolean migratedSim; protected String saleDate; /** * Gets the value of the iccid property. * * @return * possible object is * {@link String } * */ public String getIccid() { return iccid; } /** * Sets the value of the iccid property. * * @param value * allowed object is * {@link String } * */ public void setIccid(String value) { this.iccid = value; } /** * Gets the value of the msisdn property. * * @return * possible object is * {@link String } * */ public String getMsisdn() { return msisdn; } /** * Sets the value of the msisdn property. * * @param value * allowed object is * {@link String } * */ public void setMsisdn(String value) { this.msisdn = value; } /** * Gets the value of the deviceId property. * * @return * possible object is * {@link String } * */ public String getDeviceId() { return deviceId; } /** * Sets the value of the deviceId property. * * @param value * allowed object is * {@link String } * */ public void setDeviceId(String value) { this.deviceId = value; } /** * Gets the value of the simProfileId property. * * @return * possible object is * {@link Long } * */ public Long getSimProfileId() { return simProfileId; } /** * Sets the value of the simProfileId property. * * @param value * allowed object is * {@link Long } * */ public void setSimProfileId(Long value) { this.simProfileId = value; } /** * Gets the value of the acctId property. * */ public long getAcctId() { return acctId; } /** * Sets the value of the acctId property. * */ public void setAcctId(long value) { this.acctId = value; } /** * Gets the value of the live property. * */ public boolean isLive() { return live; } /** * Sets the value of the live property. * */ public void setLive(boolean value) { this.live = value; } /** * Gets the value of the ratePlanId property. * * @return * possible object is * {@link Long } * */ public Long getRatePlanId() { return ratePlanId; } /** * Sets the value of the ratePlanId property. * * @param value * allowed object is * {@link Long } * */ public void setRatePlanId(Long value) { this.ratePlanId = value; } /** * Gets the value of the activationDate property. * * @return * possible object is * {@link XMLGregorianCalendar } * */ public XMLGregorianCalendar getActivationDate() { return activationDate; } /** * Sets the value of the activationDate property. * * @param value * allowed object is * {@link XMLGregorianCalendar } * */ public void setActivationDate(XMLGregorianCalendar value) { this.activationDate = value; } /** * Gets the value of the status property. * * @return * possible object is * {@link Long } * */ public Long getStatus() { return status; } /** * Sets the value of the status property. * * @param value * allowed object is * {@link Long } * */ public void setStatus(Long value) { this.status = value; } /** * Gets the value of the modemId property. * * @return * possible object is * {@link String } * */ public String getModemId() { return modemId; } /** * Sets the value of the modemId property. * * @param value * allowed object is * {@link String } * */ public void setModemId(String value) { this.modemId = value; } /** * Gets the value of the customer property. * * @return * possible object is * {@link String } * */ public String getCustomer() { return customer; } /** * Sets the value of the customer property. * * @param value * allowed object is * {@link String } * */ public void setCustomer(String value) { this.customer = value; } /** * Gets the value of the overAgeLimitToOverrideMode property. * * @return * possible object is * {@link Long } * */ public Long getOverAgeLimitToOverrideMode() { return overAgeLimitToOverrideMode; } /** * Sets the value of the overAgeLimitToOverrideMode property. * * @param value * allowed object is * {@link Long } * */ public void setOverAgeLimitToOverrideMode(Long value) { this.overAgeLimitToOverrideMode = value; } /** * Gets the value of the overAgeLimitReached property. * * @return * possible object is * {@link Boolean } * */ public Boolean isOverAgeLimitReached() { return overAgeLimitReached; } /** * Sets the value of the overAgeLimitReached property. * * @param value * allowed object is * {@link Boolean } * */ public void setOverAgeLimitReached(Boolean value) { this.overAgeLimitReached = value; } /** * Gets the value of the overAgeLimit property. * * @return * possible object is * {@link BigDecimal } * */ public BigDecimal getOverAgeLimit() { return overAgeLimit; } /** * Sets the value of the overAgeLimit property. * * @param value * allowed object is * {@link BigDecimal } * */ public void setOverAgeLimit(BigDecimal value) { this.overAgeLimit = value; } /** * Gets the value of the customerId property. * * @return * possible object is * {@link Long } * */ public Long getCustomerId() { return customerId; } /** * Sets the value of the customerId property. * * @param value * allowed object is * {@link Long } * */ public void setCustomerId(Long value) { this.customerId = value; } /** * Gets the value of the endConsumerIdentity property. * * @return * possible object is * {@link String } * */ public String getEndConsumerIdentity() { return endConsumerIdentity; } /** * Sets the value of the endConsumerIdentity property. * * @param value * allowed object is * {@link String } * */ public void setEndConsumerIdentity(String value) { this.endConsumerIdentity = value; } /** * Gets the value of the commPlanId property. * * @return * possible object is * {@link Long } * */ public Long getCommPlanId() { return commPlanId; } /** * Sets the value of the commPlanId property. * * @param value * allowed object is * {@link Long } * */ public void setCommPlanId(Long value) { this.commPlanId = value; } /** * Gets the value of the lastStateChange property. * * @return * possible object is * {@link XMLGregorianCalendar } * */ public XMLGregorianCalendar getLastStateChange() { return lastStateChange; } /** * Sets the value of the lastStateChange property. * * @param value * allowed object is * {@link XMLGregorianCalendar } * */ public void setLastStateChange(XMLGregorianCalendar value) { this.lastStateChange = value; } /** * Gets the value of the testReadyDataLimit property. * * @return * possible object is * {@link Long } * */ public Long getTestReadyDataLimit() { return testReadyDataLimit; } /** * Sets the value of the testReadyDataLimit property. * * @param value * allowed object is * {@link Long } * */ public void setTestReadyDataLimit(Long value) { this.testReadyDataLimit = value; } /** * Gets the value of the monthToDateSmsUsage property. * * @return * possible object is * {@link BigDecimal } * */ public BigDecimal getMonthToDateSmsUsage() { return monthToDateSmsUsage; } /** * Sets the value of the monthToDateSmsUsage property. * * @param value * allowed object is * {@link BigDecimal } * */ public void setMonthToDateSmsUsage(BigDecimal value) { this.monthToDateSmsUsage = value; } /** * Gets the value of the monthToDateVoiceUsage property. * * @return * possible object is * {@link BigDecimal } * */ public BigDecimal getMonthToDateVoiceUsage() { return monthToDateVoiceUsage; } /** * Sets the value of the monthToDateVoiceUsage property. * * @param value * allowed object is * {@link BigDecimal } * */ public void setMonthToDateVoiceUsage(BigDecimal value) { this.monthToDateVoiceUsage = value; } /** * Gets the value of the userName property. * * @return * possible object is * {@link String } * */ public String getUserName() { return userName; } /** * Sets the value of the userName property. * * @param value * allowed object is * {@link String } * */ public void setUserName(String value) { this.userName = value; } /** * Gets the value of the password property. * * @return * possible object is * {@link String } * */ public String getPassword() { return password; } /** * Sets the value of the password property. * * @param value * allowed object is * {@link String } * */ public void setPassword(String value) { this.password = value; } /** * Gets the value of the monthToDateDataUsage property. * * @return * possible object is * {@link BigDecimal } * */ public BigDecimal getMonthToDateDataUsage() { return monthToDateDataUsage; } /** * Sets the value of the monthToDateDataUsage property. * * @param value * allowed object is * {@link BigDecimal } * */ public void setMonthToDateDataUsage(BigDecimal value) { this.monthToDateDataUsage = value; } /** * Gets the value of the oneBox property. * * @return * possible object is * {@link String } * */ public String getOneBox() { return oneBox; } /** * Sets the value of the oneBox property. * * @param value * allowed object is * {@link String } * */ public void setOneBox(String value) { this.oneBox = value; } /** * Gets the value of the dateShipped property. * * @return * possible object is * {@link XMLGregorianCalendar } * */ public XMLGregorianCalendar getDateShipped() { return dateShipped; } /** * Sets the value of the dateShipped property. * * @param value * allowed object is * {@link XMLGregorianCalendar } * */ public void setDateShipped(XMLGregorianCalendar value) { this.dateShipped = value; } /** * Gets the value of the testReadyDataState property. * * @return * possible object is * {@link Long } * */ public Long getTestReadyDataState() { return testReadyDataState; } /** * Sets the value of the testReadyDataState property. * * @param value * allowed object is * {@link Long } * */ public void setTestReadyDataState(Long value) { this.testReadyDataState = value; } /** * Gets the value of the testReadyTimeLimit property. * * @return * possible object is * {@link Long } * */ public Long getTestReadyTimeLimit() { return testReadyTimeLimit; } /** * Sets the value of the testReadyTimeLimit property. * * @param value * allowed object is * {@link Long } * */ public void setTestReadyTimeLimit(Long value) { this.testReadyTimeLimit = value; } /** * Gets the value of the testReadyTimeState property. * * @return * possible object is * {@link Long } * */ public Long getTestReadyTimeState() { return testReadyTimeState; } /** * Sets the value of the testReadyTimeState property. * * @param value * allowed object is * {@link Long } * */ public void setTestReadyTimeState(Long value) { this.testReadyTimeState = value; } /** * Gets the value of the custom1 property. * * @return * possible object is * {@link String } * */ public String getCustom1() { return custom1; } /** * Sets the value of the custom1 property. * * @param value * allowed object is * {@link String } * */ public void setCustom1(String value) { this.custom1 = value; } /** * Gets the value of the custom2 property. * * @return * possible object is * {@link String } * */ public String getCustom2() { return custom2; } /** * Sets the value of the custom2 property. * * @param value * allowed object is * {@link String } * */ public void setCustom2(String value) { this.custom2 = value; } /** * Gets the value of the custom3 property. * * @return * possible object is * {@link String } * */ public String getCustom3() { return custom3; } /** * Sets the value of the custom3 property. * * @param value * allowed object is * {@link String } * */ public void setCustom3(String value) { this.custom3 = value; } /** * Gets the value of the version property. * */ public long getVersion() { return version; } /** * Sets the value of the version property. * */ public void setVersion(long value) { this.version = value; } /** * Gets the value of the operatorId property. * */ public long getOperatorId() { return operatorId; } /** * Sets the value of the operatorId property. * */ public void setOperatorId(long value) { this.operatorId = value; } /** * Gets the value of the notes property. * * @return * possible object is * {@link String } * */ public String getNotes() { return notes; } /** * Sets the value of the notes property. * * @param value * allowed object is * {@link String } * */ public void setNotes(String value) { this.notes = value; } /** * Gets the value of the networkBlocked property. * */ public boolean isNetworkBlocked() { return networkBlocked; } /** * Sets the value of the networkBlocked property. * */ public void setNetworkBlocked(boolean value) { this.networkBlocked = value; } /** * Gets the value of the consumerUserId property. * * @return * possible object is * {@link Long } * */ public Long getConsumerUserId() { return consumerUserId; } /** * Sets the value of the consumerUserId property. * * @param value * allowed object is * {@link Long } * */ public void setConsumerUserId(Long value) { this.consumerUserId = value; } /** * Gets the value of the dateOneBoxModified property. * * @return * possible object is * {@link XMLGregorianCalendar } * */ public XMLGregorianCalendar getDateOneBoxModified() { return dateOneBoxModified; } /** * Sets the value of the dateOneBoxModified property. * * @param value * allowed object is * {@link XMLGregorianCalendar } * */ public void setDateOneBoxModified(XMLGregorianCalendar value) { this.dateOneBoxModified = value; } /** * Gets the value of the linePayStatus property. * * @return * possible object is * {@link String } * */ public String getLinePayStatus() { return linePayStatus; } /** * Sets the value of the linePayStatus property. * * @param value * allowed object is * {@link String } * */ public void setLinePayStatus(String value) { this.linePayStatus = value; } /** * Gets the value of the imsi1 property. * * @return * possible object is * {@link String } * */ public String getImsi1() { return imsi1; } /** * Sets the value of the imsi1 property. * * @param value * allowed object is * {@link String } * */ public void setImsi1(String value) { this.imsi1 = value; } /** * Gets the value of the primaryDevice property. * * @return * possible object is * {@link Boolean } * */ public Boolean isPrimaryDevice() { return primaryDevice; } /** * Sets the value of the primaryDevice property. * * @param value * allowed object is * {@link Boolean } * */ public void setPrimaryDevice(Boolean value) { this.primaryDevice = value; } /** * Gets the value of the nickName property. * * @return * possible object is * {@link String } * */ public String getNickName() { return nickName; } /** * Sets the value of the nickName property. * * @param value * allowed object is * {@link String } * */ public void setNickName(String value) { this.nickName = value; } /** * Gets the value of the areaCode property. * * @return * possible object is * {@link String } * */ public String getAreaCode() { return areaCode; } /** * Sets the value of the areaCode property. * * @param value * allowed object is * {@link String } * */ public void setAreaCode(String value) { this.areaCode = value; } /** * Gets the value of the countryCode property. * * @return * possible object is * {@link String } * */ public String getCountryCode() { return countryCode; } /** * Sets the value of the countryCode property. * * @param value * allowed object is * {@link String } * */ public void setCountryCode(String value) { this.countryCode = value; } /** * Gets the value of the migratedSim property. * * @return * possible object is * {@link Boolean } * */ public Boolean isMigratedSim() { return migratedSim; } /** * Sets the value of the migratedSim property. * * @param value * allowed object is * {@link Boolean } * */ public void setMigratedSim(Boolean value) { this.migratedSim = value; } /** * Gets the value of the saleDate property. * * @return * possible object is * {@link String } * */ public String getSaleDate() { return saleDate; } /** * Sets the value of the saleDate property. * * @param value * allowed object is * {@link String } * */ public void setSaleDate(String value) { this.saleDate = value; } }
[ "cesar.alvernaz@gmail.com" ]
cesar.alvernaz@gmail.com
740d27f01569862baa2cd612dd2e15b55648a9da
006fb3baaeb8be3fec5cd98a8a1b4217d6e3c9ff
/src/test/java/io/github/jhipster/application/config/timezone/HibernateTimeZoneIT.java
8fc49a4e1673876e86d1d80cc4723c4868e9a2c0
[]
no_license
Manyce1/Sample-App
447a34cf92bd6332781644b275f211167357a064
567cc16cbe3d4520a5fe1c904ce4e92cfc5f09ab
refs/heads/master
2020-05-24T07:55:43.068494
2019-05-17T07:54:22
2019-05-17T07:54:22
187,172,294
0
0
null
null
null
null
UTF-8
Java
false
false
6,898
java
package io.github.jhipster.application.config.timezone; import io.github.jhipster.application.SampleApp; import io.github.jhipster.application.repository.timezone.DateTimeWrapper; import io.github.jhipster.application.repository.timezone.DateTimeWrapperRepository; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.support.rowset.SqlRowSet; import org.springframework.transaction.annotation.Transactional; import java.time.*; import java.time.format.DateTimeFormatter; import static java.lang.String.format; import static org.assertj.core.api.Assertions.assertThat; /** * Integration tests for the UTC Hibernate configuration. */ @SpringBootTest(classes = SampleApp.class) public class HibernateTimeZoneIT { @Autowired private DateTimeWrapperRepository dateTimeWrapperRepository; @Autowired private JdbcTemplate jdbcTemplate; private DateTimeWrapper dateTimeWrapper; private DateTimeFormatter dateTimeFormatter; private DateTimeFormatter timeFormatter; private DateTimeFormatter dateFormatter; @BeforeEach public void setup() { dateTimeWrapper = new DateTimeWrapper(); dateTimeWrapper.setInstant(Instant.parse("2014-11-12T05:50:00.0Z")); dateTimeWrapper.setLocalDateTime(LocalDateTime.parse("2014-11-12T07:50:00.0")); dateTimeWrapper.setOffsetDateTime(OffsetDateTime.parse("2011-12-14T08:30:00.0Z")); dateTimeWrapper.setZonedDateTime(ZonedDateTime.parse("2011-12-14T08:30:00.0Z")); dateTimeWrapper.setLocalTime(LocalTime.parse("14:30:00")); dateTimeWrapper.setOffsetTime(OffsetTime.parse("14:30:00+02:00")); dateTimeWrapper.setLocalDate(LocalDate.parse("2016-09-10")); dateTimeFormatter = DateTimeFormatter .ofPattern("yyyy-MM-dd HH:mm:ss.S") .withZone(ZoneId.of("UTC")); timeFormatter = DateTimeFormatter .ofPattern("HH:mm:ss") .withZone(ZoneId.of("UTC")); dateFormatter = DateTimeFormatter .ofPattern("yyyy-MM-dd"); } @Test @Transactional public void storeInstantWithUtcConfigShouldBeStoredOnGMTTimeZone() { dateTimeWrapperRepository.saveAndFlush(dateTimeWrapper); String request = generateSqlRequest("instant", dateTimeWrapper.getId()); SqlRowSet resultSet = jdbcTemplate.queryForRowSet(request); String expectedValue = dateTimeFormatter.format(dateTimeWrapper.getInstant()); assertThatDateStoredValueIsEqualToInsertDateValueOnGMTTimeZone(resultSet, expectedValue); } @Test @Transactional public void storeLocalDateTimeWithUtcConfigShouldBeStoredOnGMTTimeZone() { dateTimeWrapperRepository.saveAndFlush(dateTimeWrapper); String request = generateSqlRequest("local_date_time", dateTimeWrapper.getId()); SqlRowSet resultSet = jdbcTemplate.queryForRowSet(request); String expectedValue = dateTimeWrapper .getLocalDateTime() .atZone(ZoneId.systemDefault()) .format(dateTimeFormatter); assertThatDateStoredValueIsEqualToInsertDateValueOnGMTTimeZone(resultSet, expectedValue); } @Test @Transactional public void storeOffsetDateTimeWithUtcConfigShouldBeStoredOnGMTTimeZone() { dateTimeWrapperRepository.saveAndFlush(dateTimeWrapper); String request = generateSqlRequest("offset_date_time", dateTimeWrapper.getId()); SqlRowSet resultSet = jdbcTemplate.queryForRowSet(request); String expectedValue = dateTimeWrapper .getOffsetDateTime() .format(dateTimeFormatter); assertThatDateStoredValueIsEqualToInsertDateValueOnGMTTimeZone(resultSet, expectedValue); } @Test @Transactional public void storeZoneDateTimeWithUtcConfigShouldBeStoredOnGMTTimeZone() { dateTimeWrapperRepository.saveAndFlush(dateTimeWrapper); String request = generateSqlRequest("zoned_date_time", dateTimeWrapper.getId()); SqlRowSet resultSet = jdbcTemplate.queryForRowSet(request); String expectedValue = dateTimeWrapper .getZonedDateTime() .format(dateTimeFormatter); assertThatDateStoredValueIsEqualToInsertDateValueOnGMTTimeZone(resultSet, expectedValue); } @Test @Transactional public void storeLocalTimeWithUtcConfigShouldBeStoredOnGMTTimeZoneAccordingToHis1stJan1970Value() { dateTimeWrapperRepository.saveAndFlush(dateTimeWrapper); String request = generateSqlRequest("local_time", dateTimeWrapper.getId()); SqlRowSet resultSet = jdbcTemplate.queryForRowSet(request); String expectedValue = dateTimeWrapper .getLocalTime() .atDate(LocalDate.of(1970, Month.JANUARY, 1)) .atZone(ZoneId.systemDefault()) .format(timeFormatter); assertThatDateStoredValueIsEqualToInsertDateValueOnGMTTimeZone(resultSet, expectedValue); } @Test @Transactional public void storeOffsetTimeWithUtcConfigShouldBeStoredOnGMTTimeZoneAccordingToHis1stJan1970Value() { dateTimeWrapperRepository.saveAndFlush(dateTimeWrapper); String request = generateSqlRequest("offset_time", dateTimeWrapper.getId()); SqlRowSet resultSet = jdbcTemplate.queryForRowSet(request); String expectedValue = dateTimeWrapper .getOffsetTime() .toLocalTime() .atDate(LocalDate.of(1970, Month.JANUARY, 1)) .atZone(ZoneId.systemDefault()) .format(timeFormatter); assertThatDateStoredValueIsEqualToInsertDateValueOnGMTTimeZone(resultSet, expectedValue); } @Test @Transactional public void storeLocalDateWithUtcConfigShouldBeStoredWithoutTransformation() { dateTimeWrapperRepository.saveAndFlush(dateTimeWrapper); String request = generateSqlRequest("local_date", dateTimeWrapper.getId()); SqlRowSet resultSet = jdbcTemplate.queryForRowSet(request); String expectedValue = dateTimeWrapper .getLocalDate() .format(dateFormatter); assertThatDateStoredValueIsEqualToInsertDateValueOnGMTTimeZone(resultSet, expectedValue); } private String generateSqlRequest(String fieldName, long id) { return format("SELECT %s FROM jhi_date_time_wrapper where id=%d", fieldName, id); } private void assertThatDateStoredValueIsEqualToInsertDateValueOnGMTTimeZone(SqlRowSet sqlRowSet, String expectedValue) { while (sqlRowSet.next()) { String dbValue = sqlRowSet.getString(1); assertThat(dbValue).isNotNull(); assertThat(dbValue).isEqualTo(expectedValue); } } }
[ "jhipster-bot@jhipster.tech" ]
jhipster-bot@jhipster.tech
ee6466cfb33c1f0f6c2bd2977b2fab096b45e416
edf0ae7153eacdf2d4de9b5babb44ba064611eb9
/clients/Android/LoksattaAndroidApp/src/org/loksatta/android/core/Feed.java
14478ade4d016b4cafb195b0bb12a56f966562eb
[]
no_license
pgollangi/Loksatta-Mobile
bed9f84f9a5bded53c8dea8c0934fc0f979af5e4
61ef926e9b78a67c0a85e021ba79df8e7aaeee96
refs/heads/master
2021-05-27T10:21:33.229208
2014-02-10T04:34:10
2014-02-10T04:34:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,023
java
package org.loksatta.android.core; /** * */ public class Feed extends AbstractCore { public enum Type { WEB_SITE, FACE_BOOK, TWITTER, GOOGLE_PLUS } /** * */ private static final long serialVersionUID = 1L; /** * Name of the Author of this feed if any */ private String authorName; /** * Identity of the Author of this feed if any */ private String authorId; /** * Title of the Feed */ private String title; /** * Summary of the Feed */ private String summary; /** * */ private String content; /** * Facebook Id */ private String facebookId; /** * Google Plus Id */ private String gPlusId; /** * Id of the Twitter */ private String twitterId; /** * No. Of Likes */ private long likesCount; /** * No. Of Shares */ private long sharesCount; /** * No. Of Comments for this Feed */ private long commentsCount; /** * Array of IDs of Images */ private String[] images; /** * @return the authorName */ public String getAuthorName() { return authorName; } /** * @param authorName * the authorName to set */ public void setAuthorName(String authorName) { this.authorName = authorName; } /** * @return the authorId */ public String getAuthorId() { return authorId; } /** * @param authorId * the authorId to set */ public void setAuthorId(String authorId) { this.authorId = authorId; } /** * @return the title */ public String getTitle() { return title; } /** * @param title * the title to set */ public void setTitle(String title) { this.title = title; } /** * @return the summary */ public String getSummary() { return summary; } /** * @param summary * the summary to set */ public void setSummary(String summary) { this.summary = summary; } /** * @return the content */ public String getContent() { return content; } /** * @param content * the content to set */ public void setContent(String content) { this.content = content; } /** * @return the likesCount */ public long getLikesCount() { return likesCount; } /** * @param likesCount * the likesCount to set */ public void setLikesCount(long likesCount) { this.likesCount = likesCount; } /** * @return the sharesCount */ public long getSharesCount() { return sharesCount; } /** * @param sharesCount * the sharesCount to set */ public void setSharesCount(long sharesCount) { this.sharesCount = sharesCount; } /** * @return the commentsCount */ public long getCommentsCount() { return commentsCount; } /** * @param commentsCount * the commentsCount to set */ public void setCommentsCount(long commentsCount) { this.commentsCount = commentsCount; } /** * @return the images */ public String[] getImages() { return images; } /** * @param images * the images to set */ public void setImages(String[] images) { this.images = images; } /** * @return the facebookId */ public String getFacebookId() { return facebookId; } /** * @param facebookId * the facebookId to set */ public void setFacebookId(String facebookId) { this.facebookId = facebookId; } /** * @return the gPlusId */ public String getgPlusId() { return gPlusId; } /** * @param gPlusId * the gPlusId to set */ public void setgPlusId(String gPlusId) { this.gPlusId = gPlusId; } /** * @return the twitterId */ public String getTwitterId() { return twitterId; } /** * @param twitterId * the twitterId to set */ public void setTwitterId(String twitterId) { this.twitterId = twitterId; } public Type getType() { if (facebookId != null) { return Type.FACE_BOOK; } else if (twitterId != null) { return Type.TWITTER; } else if (gPlusId != null) { return Type.GOOGLE_PLUS; } else { return Type.WEB_SITE; } } }
[ "prassu158@gmail.com" ]
prassu158@gmail.com
0271749c9a00413cae7b4443abf6ee01e6f7b554
c9abeb593705eead6c00d876c0f508e686bc89fb
/src/main/java/pl/coderslab/controllers/admin/AdminController.java
1413bc6d66de5593efb8ac38db1f246e62f5a1bd
[]
no_license
michaltomala/ReturnThings
226abb341019de8e32b01b7107b2512c2ea0a622
ef6ee888f682846c90e04aa29d031ae1ce2c42db
refs/heads/dev
2020-04-21T18:43:58.717047
2019-04-04T23:41:21
2019-04-04T23:41:21
169,781,483
0
0
null
2019-04-05T01:27:52
2019-02-08T18:37:44
Java
UTF-8
Java
false
false
2,625
java
package pl.coderslab.controllers.admin; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.*; import pl.coderslab.entity.User; import pl.coderslab.model.Err; import pl.coderslab.services.UserService; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import java.util.List; @Controller @RequestMapping("/admin/") public class AdminController { private final UserService userService; @Autowired public AdminController(UserService userService) { this.userService = userService; } @GetMapping("admins") public String admins(Model model){ return "admin/admins"; } /** * methods for edit admins * @param id * @param model * @param request * @return */ @GetMapping("edit/{id}") public String edit(@PathVariable Long id, Model model , HttpServletRequest request){ model.addAttribute("editingAdmin", userService.findUser(id)); model.addAttribute("formAction", request.getContextPath() + "/admin/edit/{id}"+id); return "admin/admins"; } @PostMapping("edit/{id}") public String update(User user, HttpServletRequest req, Model model, HttpSession session){ Err modelErr = new Err(); userService.checkEmail(user,modelErr); if(!modelErr.isEmpty()) { model.addAttribute("emailErr", modelErr.getErrors().get(0)); model.addAttribute("user", session.getAttribute("user")); User editingUser = userService.findUser(user.getId()); model.addAttribute("editingAdmin", editingUser); return "admin/admins"; } userService.saveUser(user); return "redirect:"+req.getContextPath()+"/admin/admins"; } /** * methods for deleting admins * @param model * @param id * @return */ @GetMapping("confirm/{id}") public String confirm(Model model, @PathVariable Long id){ User user = userService.findUser(id); model.addAttribute("deletingUser",user); model.addAttribute("confirm",user); return "admin/admins"; } @GetMapping("delete/{id}") public String delete(User user,HttpServletRequest request){ userService.deleteUser(user); return "redirect:"+request.getContextPath()+"/admin/admins"; } @ModelAttribute("admins") public List<User> listOfAdmins(Model model){ return userService.returnListOfAdmins(); } }
[ "michaltomala63@gmail.com" ]
michaltomala63@gmail.com
81362a826a324d241ad5796d6ffd6c54f9e38bc8
fde1a0877d08bcf44623d9e0c3a2844d8299f404
/workspace/workspace/Core/src/ArmstrongNumberDemo.java
d2c60fb3f9fd6af2492e7af70af01a709eb2eb51
[]
no_license
zinkolix/Training
e51f062efd1d6ac204c4578b14f279cfdb485c0d
7d1540c09557d958f28c50c416b357b7b9f3bc68
refs/heads/master
2022-12-17T21:42:38.176381
2018-12-09T18:00:59
2018-12-09T18:00:59
161,064,500
0
0
null
2022-12-16T02:51:12
2018-12-09T17:34:13
Java
UTF-8
Java
false
false
378
java
public class ArmstrongNumberDemo { public static void main(String[] args) { //int temp = 0, sum = 0, rem = 0; for(int i = 1; i <= 500; i++) { int temp = i; int sum = 0; // rem = 0; while(temp != 0) { int rem = temp % 10; sum += (rem * rem * rem); temp = temp / 10; } if( sum == i) System.out.println(" " + sum); } } }
[ "olixstudios@gmail.com" ]
olixstudios@gmail.com
c04fef771a0992b2d991e77d8e768e1dd6f99058
fe4c406abd40c4dbee9ab9d726a6fde5d5062f67
/Assignment 0-Hello World/RGBtoCMYK.java
610f5917103f2c5fc97729d78be9cda3c82ca689
[]
no_license
mdlynch37/cos126-intro-cs
6980ece47025939ed97b4b81aabce3c052d16a19
e18003a91d81c5d513517e44de45945d37ee485a
refs/heads/master
2021-01-01T19:22:16.394592
2017-07-27T19:42:08
2017-07-27T19:42:08
98,572,844
0
0
null
null
null
null
UTF-8
Java
false
false
1,690
java
/************************************************************************* * Name: Murray Lynch * Login: mdlynch * Precept: P04 * * Compilation: javac RGBtoCMYK.java * Execution: java RGBtoCMYK red green blue * * Description: Converts RGB format of color to CMYK format from user input * * Dependencies: None. * * % java RGBtoCMYK 75 0 130 // indigo * red = 75 * green = 0 * blue = 130 * cyan = 0.423076923076923 * magenta = 1.0 * yellow = 0.0 * black = 0.4901960784313726 * * *************************************************************************/ public class RGBtoCMYK { public static void main(String[] args) { //initializes integer variables for RGB to data from user input int red = Integer.parseInt(args[0]); int green = Integer.parseInt(args[1]); int blue = Integer.parseInt(args[2]); //determines white value double maxRedGreen = Math.max(red/255.0, green/255.0); double white = Math.max(maxRedGreen, blue/255.0); //converts RGB format to CMYK values double cyan = (white-(red/255.0))/white; double magenta = (white-(green/255.0))/white; double yellow = (white-(blue/255.0))/white; double black = 1 - white; //prints results System.out.println("red = " + red); System.out.println("green = " + green); System.out.println("blue = " + blue); System.out.println("cyan = " + cyan); System.out.println("magenta = " + magenta); System.out.println("yellow = " + yellow); System.out.println("black = " + black); } }
[ "mdlynch37@gmail.com" ]
mdlynch37@gmail.com
20aa87e0de94a5fd457c44cfebcbebd10fd86794
fc2ddd67b63927265ca12751f9b7f7287840daa2
/linear/main/Task06.java
e5b6e1adb82bab22eefb32002a902188b6234836
[]
no_license
IPrEmotion/jonline-modul01
e196491f9cb2682e59f3b132dc44c01d83d0ee7c
81196a54c82062641ad6dbc0fc93e9a7d11e30be
refs/heads/main
2023-07-07T18:20:26.783485
2021-08-23T20:40:22
2021-08-23T20:40:22
397,395,091
0
0
null
null
null
null
UTF-8
Java
false
false
338
java
package by.jonline.mod01.linear.main; // (a/c * b/d) - ((a*b - c) / c*d) public class Task06 { public static void main(String[] args) { double a = 2.5; double b = 12.0; double c = 5.0; double d = 1.0; double res = (a / c * b / d) - ((a * b - c) / c * d); System.out.println(res); } }
[ "noreply@github.com" ]
noreply@github.com
a133e2a26c7d9c902478713014243ff6e8b13f1a
805ab9f31a218bcd792c0f454a49c3519e68d75d
/weatherapp/src/main/java/com/weatherapp/json/CoOrdinate.java
130ae86ac85c3ba3e689fdd08b67d8a8a656e9c2
[]
no_license
hrusikeshj/JavaProject
a33221ae8d1ce5b26cdd43e014e9241bd38e0373
72e82ad54228d33fd164f9191d0e0d93c2a53b38
refs/heads/master
2020-03-28T05:18:37.888951
2018-09-07T05:00:58
2018-09-07T05:00:58
147,768,570
0
0
null
null
null
null
UTF-8
Java
false
false
413
java
package com.weatherapp.json; import java.io.Serializable; public class CoOrdinate implements Serializable{ private static final long serialVersionUID=19084937837L; private String lon; private String lat; public String getLon() { return lon; } public void setLon(String lon) { this.lon = lon; } public String getLat() { return lat; } public void setLat(String lat) { this.lat = lat; } }
[ "hrusikeshj@gmail.com" ]
hrusikeshj@gmail.com
010f798f46f98468b6b6987d6cff0149bd93ad52
ed73a6dff2b7639b41c0a6a76c95a57ebcec3726
/src/com/jeefw/controller/sys/RoleController.java
01340b57b9c675eedf090e3ae484d39e7cbaeab3
[]
no_license
johnb9682/jeefw
b05b5a788b76df0bab406ff7e41919df525a6382
01593bb1801072904c7ef628a3086eb8b60113ef
refs/heads/master
2021-04-28T10:09:25.612376
2018-02-24T08:11:33
2018-02-24T08:11:33
122,058,775
0
0
null
null
null
null
UTF-8
Java
false
false
6,256
java
package com.jeefw.controller.sys; import java.io.IOException; import java.io.OutputStream; import java.util.HashMap; import java.util.Map; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import net.sf.json.JSONArray; import net.sf.json.JSONObject; import org.apache.commons.beanutils.ConvertUtils; import org.apache.commons.lang.StringUtils; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import com.jeefw.core.Constant; import com.jeefw.core.JavaEEFrameworkBaseController; import com.jeefw.model.sys.Role; import com.jeefw.service.sys.RoleService; import core.support.ExtJSBaseParameter; import core.support.JqGridPageView; import core.support.QueryResult; /** * @author 杨添 * @框架唯一的升级和技术支持地址:http://shop111863449.taobao.com */ @Controller @RequestMapping("/sys/role") public class RoleController extends JavaEEFrameworkBaseController<Role> implements Constant { @Resource private RoleService roleService; @RequestMapping(value = "/getRole", method = { RequestMethod.POST, RequestMethod.GET }) public void getRole(HttpServletRequest request, HttpServletResponse response) throws Exception { Integer firstResult = Integer.valueOf(request.getParameter("page")); Integer maxResults = Integer.valueOf(request.getParameter("rows")); String sortedObject = request.getParameter("sidx"); String sortedValue = request.getParameter("sord"); String filters = request.getParameter("filters"); Role role = new Role(); if (StringUtils.isNotBlank(filters)) { JSONObject jsonObject = JSONObject.fromObject(filters); JSONArray jsonArray = (JSONArray) jsonObject.get("rules"); for (int i = 0; i < jsonArray.size(); i++) { JSONObject result = (JSONObject) jsonArray.get(i); if (result.getString("field").equals("roleKey") && result.getString("op").equals("eq")) { role.set$eq_roleKey(result.getString("data")); } if (result.getString("field").equals("roleValue") && result.getString("op").equals("cn")) { role.set$like_roleValue(result.getString("data")); } } if (((String) jsonObject.get("groupOp")).equalsIgnoreCase("OR")) { role.setFlag("OR"); } else { role.setFlag("AND"); } } role.setFirstResult((firstResult - 1) * maxResults); role.setMaxResults(maxResults); Map<String, String> sortedCondition = new HashMap<String, String>(); sortedCondition.put(sortedObject, sortedValue); role.setSortedConditions(sortedCondition); QueryResult<Role> queryResult = roleService.doPaginationQuery(role); JqGridPageView<Role> roleListView = new JqGridPageView<Role>(); roleListView.setMaxResults(maxResults); roleListView.setRows(queryResult.getResultList()); roleListView.setRecords(queryResult.getTotalCount()); writeJSON(response, roleListView); } @Override @RequestMapping(value = "/saveRole", method = { RequestMethod.POST, RequestMethod.GET }) public void doSave(Role entity, HttpServletRequest request, HttpServletResponse response) throws IOException { ExtJSBaseParameter parameter = ((ExtJSBaseParameter) entity); if (CMD_EDIT.equals(parameter.getCmd())) { roleService.update(entity); } else if (CMD_NEW.equals(parameter.getCmd())) { roleService.persist(entity); } parameter.setSuccess(true); writeJSON(response, parameter); } @RequestMapping(value = "/operateRole", method = { RequestMethod.POST, RequestMethod.GET }) public void operateRole(HttpServletRequest request, HttpServletResponse response) throws Exception { String oper = request.getParameter("oper"); String id = request.getParameter("id"); if (oper.equals("del")) { String[] ids = id.split(","); deleteRole(request, response, (Long[]) ConvertUtils.convert(ids, Long.class)); } else if (oper.equals("excel")) { response.setContentType("application/msexcel;charset=UTF-8"); try { response.addHeader("Content-Disposition", "attachment;filename=file.xls"); OutputStream out = response.getOutputStream(); out.write(request.getParameter("csvBuffer").getBytes()); out.flush(); out.close(); } catch (Exception e) { e.printStackTrace(); } } else { Map<String, Object> result = new HashMap<String, Object>(); String roleKey = request.getParameter("roleKey"); String roleValue = request.getParameter("roleValue"); String description = request.getParameter("description"); Role role = null; if (oper.equals("edit")) { role = roleService.get(Long.valueOf(id)); } Role roleKeyRole = roleService.getByProerties("roleKey", roleKey); if (StringUtils.isBlank(roleKey) || StringUtils.isBlank(roleValue)) { response.setStatus(HttpServletResponse.SC_LENGTH_REQUIRED); result.put("message", "请填写角色编码和角色名称"); writeJSON(response, result); } else if (null != roleKeyRole && oper.equals("add")) { response.setStatus(HttpServletResponse.SC_CONFLICT); result.put("message", "此角色编码已存在,请重新输入"); writeJSON(response, result); } else if (null != roleKeyRole && !role.getRoleKey().equalsIgnoreCase(roleKey) && oper.equals("edit")) { response.setStatus(HttpServletResponse.SC_CONFLICT); result.put("message", "此角色编码已存在,请重新输入"); writeJSON(response, result); } else { Role entity = new Role(); entity.setRoleKey(roleKey); entity.setRoleValue(roleValue); entity.setDescription(description); if (oper.equals("edit")) { entity.setId(Long.valueOf(id)); entity.setCmd("edit"); doSave(entity, request, response); } else if (oper.equals("add")) { entity.setCmd("new"); doSave(entity, request, response); } } } } @RequestMapping("/deleteRole") public void deleteRole(HttpServletRequest request, HttpServletResponse response, @RequestParam("ids") Long[] ids) throws IOException { boolean flag = roleService.deleteByPK(ids); if (flag) { writeJSON(response, "{success:true}"); } else { writeJSON(response, "{success:false}"); } } }
[ "johnb9682@gmail.com" ]
johnb9682@gmail.com
82dd1585d9466c54e38ec9a84a0770083e190a37
ffca6764c6baa155872b6987d01d451a72db0799
/src/nl/fontys/darc/Main.java
0a29933c91255fb1e921e2f8ed15401a606df7c5
[]
no_license
FontysVenlo/darc-assignment-strategy
416b1751f7f91f88aab7b396e9850717d0ad04fa
fb1c7d303f915b493141fb06d6141544d8907a34
refs/heads/main
2022-12-20T00:57:01.006095
2020-10-07T12:00:33
2020-10-07T12:00:33
302,022,233
0
0
null
null
null
null
UTF-8
Java
false
false
148
java
package nl.fontys.darc; public class Main { public static void main(String[] args) { System.out.println("DARC-assignment-1"); } }
[ "s.sobek@fontys.nl" ]
s.sobek@fontys.nl
f75e00744211252c2b672a8458e1990747073c0f
f7d3023a61b362aa7586953ad145c846b73d2251
/jOOQ-test/src/org/jooq/test/mysql/generatedclasses/tables/records/T_785Record.java
03a6a202c1d7a7053b1c3348df61dd90c3ade4a5
[ "BSD-3-Clause", "Apache-2.0" ]
permissive
Toilal/jOOQ
6ffeb332c8ef445714e987e1ddca79184dff1cec
bcd073a4025add29c68b7e6a48834f5df75b7e75
refs/heads/master
2021-01-14T14:37:30.209778
2013-12-06T10:29:23
2013-12-06T10:29:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,202
java
/** * This class is generated by jOOQ */ package org.jooq.test.mysql.generatedclasses.tables.records; /** * This class is generated by jOOQ. */ @java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class T_785Record extends org.jooq.impl.TableRecordImpl<org.jooq.test.mysql.generatedclasses.tables.records.T_785Record> implements org.jooq.Record3<java.lang.Integer, java.lang.String, java.lang.String> { private static final long serialVersionUID = -547222323; /** * Setter for <code>test.t_785.ID</code>. */ public void setId(java.lang.Integer value) { setValue(0, value); } /** * Getter for <code>test.t_785.ID</code>. */ public java.lang.Integer getId() { return (java.lang.Integer) getValue(0); } /** * Setter for <code>test.t_785.NAME</code>. */ public void setName(java.lang.String value) { setValue(1, value); } /** * Getter for <code>test.t_785.NAME</code>. */ public java.lang.String getName() { return (java.lang.String) getValue(1); } /** * Setter for <code>test.t_785.VALUE</code>. */ public void setValue(java.lang.String value) { setValue(2, value); } /** * Getter for <code>test.t_785.VALUE</code>. */ public java.lang.String getValue() { return (java.lang.String) getValue(2); } // ------------------------------------------------------------------------- // Record3 type implementation // ------------------------------------------------------------------------- /** * {@inheritDoc} */ @Override public org.jooq.Row3<java.lang.Integer, java.lang.String, java.lang.String> fieldsRow() { return (org.jooq.Row3) super.fieldsRow(); } /** * {@inheritDoc} */ @Override public org.jooq.Row3<java.lang.Integer, java.lang.String, java.lang.String> valuesRow() { return (org.jooq.Row3) super.valuesRow(); } /** * {@inheritDoc} */ @Override public org.jooq.Field<java.lang.Integer> field1() { return org.jooq.test.mysql.generatedclasses.tables.T_785.ID; } /** * {@inheritDoc} */ @Override public org.jooq.Field<java.lang.String> field2() { return org.jooq.test.mysql.generatedclasses.tables.T_785.NAME; } /** * {@inheritDoc} */ @Override public org.jooq.Field<java.lang.String> field3() { return org.jooq.test.mysql.generatedclasses.tables.T_785.VALUE; } /** * {@inheritDoc} */ @Override public java.lang.Integer value1() { return getId(); } /** * {@inheritDoc} */ @Override public java.lang.String value2() { return getName(); } /** * {@inheritDoc} */ @Override public java.lang.String value3() { return getValue(); } // ------------------------------------------------------------------------- // Constructors // ------------------------------------------------------------------------- /** * Create a detached T_785Record */ public T_785Record() { super(org.jooq.test.mysql.generatedclasses.tables.T_785.T_785); } /** * Create a detached, initialised T_785Record */ public T_785Record(java.lang.Integer id, java.lang.String name, java.lang.String value) { super(org.jooq.test.mysql.generatedclasses.tables.T_785.T_785); setValue(0, id); setValue(1, name); setValue(2, value); } }
[ "lukas.eder@gmail.com" ]
lukas.eder@gmail.com
11e1ee6dfb18486f15c5cf236264e87fea3b1a6e
d48ebe1443610afb5f724f9015ab7904a0db0a94
/src/se/index/utils/ParseBean.java
1886bc01a50b406ce9eb150a8ff3dd7298119333
[]
no_license
TATICLI/NetRobot
06ca4f8812fca223f9c5edf404c6daf762efa5bc
a4794d5c798c3892c2226c91bc62c28172bd7c24
refs/heads/master
2020-04-21T20:25:47.962155
2017-09-25T14:53:47
2017-09-25T14:53:47
null
0
0
null
null
null
null
GB18030
Java
false
false
1,350
java
package se.index.utils; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field.Store; import org.apache.lucene.document.StringField; import org.apache.lucene.document.TextField; import se.index.model.bar.DetailIndexBean; import se.index.model.bar.TopicIndexBean; public class ParseBean { /** * 将标题转化为Document * @param bean * @return */ public static Document parseTitle2Doc(TopicIndexBean bean){ if (null == bean) { return null; } Document doc = new Document(); if (null != bean.getUrl()) { doc.add(new StringField("url", bean.getUrl(), Store.YES)); } doc.add(new StringField("count", ""+bean.getCount(), Store.NO)); if (null != bean.getTitle()) { doc.add(new TextField("title", bean.getTitle(), Store.YES)); } return doc; } /** * 将内容转化为Document * @param bean * @return */ public static Document parseContent2Doc(DetailIndexBean bean){ if (null == bean) { return null; } Document doc = new Document(); if (null != bean.getUrl2()) { doc.add(new StringField("url2", bean.getUrl2(), Store.YES)); } if (null != bean.getRid()) { doc.add(new StringField("rid", bean.getRid(), Store.YES)); } if (null != bean.getContent()) { doc.add(new TextField("content", bean.getContent(), Store.YES)); } return doc; } }
[ "biosmbr@gmail.com" ]
biosmbr@gmail.com
ac4fcf28f6a8e299b0c7de5874beed2c8f461028
d77391fe683a62bd831e7da85d06a7268d4f4345
/src/test/java/com/jason/springcorestudy/bean/DefaultListableBeanFactoryTests.java
a0982c56ec0afabc0e6a1856c5e5ff023c4f4958
[]
no_license
pplenty/spring-core-study
4d59e4f468da524ee5f8084bfe8ecc3e6d4119e6
b2640282e0c191d5921a040ec4e38a6624d9f429
refs/heads/master
2022-08-01T01:36:22.744245
2022-06-30T01:22:46
2022-06-30T01:22:46
175,226,579
0
0
null
2022-06-30T01:22:47
2019-03-12T14:16:59
Java
UTF-8
Java
false
false
2,657
java
//package com.jason.springcorestudy.bean; // //import org.junit.Before; //import org.junit.Test; //import org.springframework.beans.factory.support.DefaultListableBeanFactory; //import org.springframework.beans.factory.support.RootBeanDefinition; // //import static org.hamcrest.core.Is.is; //import static org.hamcrest.core.IsNull.notNullValue; //import static org.junit.Assert.*; // //public class DefaultListableBeanFactoryTests { // // DefaultListableBeanFactory dlbf; // // @Before // public void init() { // dlbf = new DefaultListableBeanFactory(); // } // // @Test // public void 빈_정의_등록_테스트() { // dlbf.registerBeanDefinition("avante", new RootBeanDefinition(Avante.class, () -> { // Avante car = new Avante(); // car.setName("my car"); // return car; // })); // dlbf.registerBeanDefinition("avante", new RootBeanDefinition(Avante.class)); // assertEquals(dlbf.getBeanDefinitionCount(), 1); // assertEquals(dlbf.getBeanDefinitionNames().length, 1); // Car car = dlbf.getBean("avante", Car.class); // assertEquals(dlbf.getSingletonCount(), 1); // assertEquals(dlbf.getSingletonNames().length, 1); // car.on(); // } // // @Test // public void 싱글톤_빈_등록_테스트() { // dlbf.registerSingleton("avante", new Avante("아방이")); // assertEquals(dlbf.getBeanDefinitionCount(), 0); // assertEquals(dlbf.getBeanDefinitionNames().length, 0); // Car car = dlbf.getBean("avante", Car.class); // assertEquals(dlbf.getSingletonCount(), 1); // assertEquals(dlbf.getSingletonNames().length, 1); // car.on(); // } // // @Test // public void 빈_별칭_등록_테스트() { // dlbf.registerSingleton("avante", new Avante("아방이")); // dlbf.registerAlias("avante", "newAvante"); // // assertEquals(dlbf.getAliases("newAvante").length, 1); // assertFalse(dlbf.containsBean("test")); // assertTrue(dlbf.containsBean("avante")); // assertTrue(dlbf.containsBean("newAvante")); // Avante avante = dlbf.getBean("newAvante", Avante.class); // avante.on(); // } // // @Test // public void 빈_조회_테스트() { // dlbf.registerSingleton("avante", new Avante("아방이")); //// dlbf.registerSingleton("spark", new Spark("스팍")); // // assertThat(dlbf.getBean("avante"), is(notNullValue())); // assertThat(dlbf.getBean("avante", Avante.class), is(notNullValue())); // assertThat(dlbf.getBean(Avante.class), is(notNullValue())); // // // } // //}
[ "kohyusik@tmon.co.kr" ]
kohyusik@tmon.co.kr
a97cf40a0ecfdecd5892d6fbff7e808bd5699437
3917e2b79456a2ac83638b1178ac53d806f87905
/Android Google Map Codes/Multiple_marker_on_map_Android/app/src/main/java/com/example/zeshi/map/MapsActivity.java
5cc1153ca618f69036888cbc49738177cd37fe85
[]
no_license
zeeshantalib/Android
49fb4fb8966eae08377ac54f6217ada240ab7dab
6a6a4815f9addd3de5bb164dba7805de3ead7ba0
refs/heads/master
2021-09-26T18:46:56.762062
2018-11-01T09:13:55
2018-11-01T09:13:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,006
java
package com.example.zeshi.map; import android.content.Intent; import android.location.Location; import android.net.Uri; import android.support.v4.app.FragmentActivity; import android.os.Bundle; import android.widget.Toast; import com.google.android.gms.location.LocationServices; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.OnMapReadyCallback; import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.MarkerOptions; import java.util.ArrayList; public class MapsActivity extends FragmentActivity implements OnMapReadyCallback { private GoogleMap mMap; private MarkerOptions options = new MarkerOptions(); private ArrayList<LatLng> latlngs = new ArrayList<>(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_maps); SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map); mapFragment.getMapAsync(this); } @Override public void onMapReady(GoogleMap googleMap) { mMap = googleMap; LatLng Gujrat = new LatLng(32.5711, 74.0750); mMap.moveCamera(CameraUpdateFactory.newLatLng(Gujrat)); mMap.getUiSettings().setZoomGesturesEnabled(true); mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL); float zoomLevel = 13; mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(Gujrat, zoomLevel)); latlngs.add(new LatLng(32.5711, 74.0750)); latlngs.add(new LatLng(32.5811, 74.0850)); for (LatLng point : latlngs) { options.position(point); options.title("Any Name"); options.snippet("Description"); mMap.addMarker(options); } } }
[ "noreply@github.com" ]
noreply@github.com
8e13061fb685b9a50dceef92fdfdf10123c46c27
235724a8020a7b42b8c8c00199d164765ab80f9a
/src/shopping/helpers/LojaItemCell.java
00f1e15d30f26dc0d4c9fb8cf738b44a1d1244b0
[]
no_license
rafael2ll/Shopping
504567b5310df249690e277bd5f508e66b723745
77cb1d64a2b799af84087483950aec5126567c18
refs/heads/master
2020-04-10T06:33:51.823415
2019-04-26T17:56:17
2019-04-26T17:56:17
160,817,382
0
0
null
null
null
null
UTF-8
Java
false
false
817
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 shopping.helpers; import java.sql.Connection; import javafx.scene.control.ListCell; import shopping.LojaItemController; import shopping.modelos.Loja; public class LojaItemCell extends ListCell<Loja> { Connection c; public LojaItemCell(Connection c){ this.c = c; } @Override public void updateItem(Loja j, boolean empty) { super.updateItem(j, empty); if (j != null) { LojaItemController data = new LojaItemController(); data.setInfo(c, j); System.out.println("Att:"+j.getNome()); setGraphic(data.getView()); } } }
[ "rafaelvalentim36@gmail.com" ]
rafaelvalentim36@gmail.com
05c58e00e6e98539fc82ed2fb043ecba069238aa
993393d01be52293c40ccb3c6b6c241ccc97305c
/servletHttp/src/main/java/com/example/servletHttp/Response2.java
8232a2134ce8c2e6f3d80883397d260a58313d36
[]
no_license
LWP123456789/JavaWeb
7ebb1bf8f6923490480f4a126c383cae9f492a49
0f509e5460b25818dcd84313d0c780639cd656a2
refs/heads/master
2023-08-26T03:40:23.178766
2021-11-02T15:27:27
2021-11-02T15:27:27
394,008,661
0
0
null
null
null
null
UTF-8
Java
false
false
581
java
package com.example.servletHttp; import jakarta.servlet.*; import jakarta.servlet.http.*; import java.io.IOException; public class Response2 extends HttpServlet { @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); response.getWriter().write("response2's result! 乐培"); } @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } }
[ "LWP13226968149@163.com" ]
LWP13226968149@163.com
9db75d86e1e54b260984d8c6ad753d0e0abf28f8
6194c0da04c0e37f503a93d9330933db4740a0bd
/Seminar6/src/ro/ase/cts/adapter/BiletAdapter.java
178e7f627af3ab0804daf668d06bb23393809401
[]
no_license
SorinAndrei123/Seminar-CTS
91f210cab6e42fc58097a188490a5db1be820399
72cda2e26a96a7eed6044ec2ac00a4bed73348eb
refs/heads/master
2023-05-07T06:24:24.529546
2021-05-29T12:46:09
2021-05-29T12:46:09
342,843,024
0
0
null
null
null
null
UTF-8
Java
false
false
358
java
package ro.ase.cts.adapter; public class BiletAdapter extends Bilet implements BiletOnline { public BiletAdapter(int pret) { super(pret); // TODO Auto-generated constructor stub } @Override public void vindeBiletOnline() { super.vinde(); } @Override public void rezervaBiletOnline() { super.rezerva(); } }
[ "noreply@github.com" ]
noreply@github.com
67256079e09e15b5e128800cf0f2a41ffad04618
bc1f54ab4b492dd57f3ca5b6ed2511eba6ede10b
/src/main/java/parser/LL1/AnalysisTable.java
78d14a33c40a763f136ecfd5ede592e748561e4c
[]
no_license
Mahongsheng/neu-compiler-design
249649d844d7d58fdd9be471bfb9ad26ef6d901b
141a90130e9a8f6986d3670bf3198223daa320d9
refs/heads/master
2022-09-24T14:03:08.319727
2020-05-27T02:26:00
2020-05-27T02:26:00
248,715,382
1
2
null
null
null
null
UTF-8
Java
false
false
10,160
java
package parser.LL1; import java.util.*; /** * 该类用于生成LL(1)分析表 * * @author 软英1702 马洪升 */ public class AnalysisTable { private String[] grammar = {"E->TY", "Y->+TY", "Y->-TY", "Y->e", "T->FX", "X->*FX", "X->/FX", "X->e", "F->i", "F->(E)"}; private HashSet<Character> Vn = new HashSet<>();//非终结符集 private HashSet<Character> Vt = new HashSet<>();//终结符集合 private ArrayList<HashSet<Character>> first = new ArrayList<>();//first集 private ArrayList<HashSet<Character>> follow = new ArrayList<>();//follow集 private ArrayList<HashSet<Character>> select = new ArrayList<>();//select集 private HashMap<Character, ArrayList<AnalysisTableItem>> analysisTable = new HashMap<>();//分析表 public int[] ifNeedFollow = new int[grammar.length];//该位置的表达式星推导是否指向e(空) private char firstVn = grammar[0].charAt(0);//起始Vn public void setGrammar(String[] grammar) { this.grammar = grammar; } public String[] getGrammar() { return grammar; } public HashSet<Character> getVn() { return Vn; } public HashSet<Character> getVt() { return Vt; } public ArrayList<HashSet<Character>> getFirst() { return first; } public ArrayList<HashSet<Character>> getFollow() { return follow; } public ArrayList<HashSet<Character>> getSelect() { return select; } public HashMap<Character, ArrayList<AnalysisTableItem>> getAnalysisTable() { return analysisTable; } public void initAll() { this.handleVnVt(); try { this.handleFirst(); } catch (Exception e) { System.out.println("该语法出现左递归,其并非LL(1)文法!"); return; } this.handleFollow(); this.handleSelect(); this.handleAnalysisTable(); } /** * 提取非终结符和终结符 */ private void handleVnVt() { for (String grammarItem : grammar) { String[] VnItem = grammarItem.split("->"); // Vn在左边 Vn.add(VnItem[0].charAt(0)); } for (String grammarItem : grammar) { String[] VtItem = grammarItem.split("->"); // Vt在右边 String VtItemStr = VtItem[1]; // 遍历每一个字 for (int i = 0; i < VtItemStr.length(); i++) { if (!Vn.contains(VtItemStr.charAt(i))) Vt.add(VtItemStr.charAt(i)); } } } /** * 生成first集 */ private void handleFirst() throws Exception { for (int i = 0; i < grammar.length; i++) { HashSet<Character> firstOfThisItem = new HashSet<>();//位置为i的产生式的first集 Queue<Character> nextVn = new LinkedList<>();//找到的下一个非终结符 char currentChar = grammar[i].split("->")[1].charAt(0);//获得当前产生式的最左侧字符 if (currentChar == 'e') {//能够推导出e,需要求其follow集 ifNeedFollow[i] = 1; first.add(firstOfThisItem); continue; } if (Vt.contains(currentChar)) firstOfThisItem.add(currentChar);//如果当前字符为终结符,则加入到first集中 else nextVn.add(currentChar);//非终结符,加入到即将去寻找的非终结符集中 while (!nextVn.isEmpty()) {//遍历非终结符集 char currentVn = nextVn.poll(); for (String currGrammar : grammar) {//找到起始字符该非终结符的产生式 if (currGrammar.charAt(0) == currentVn) { currentChar = currGrammar.split("->")[1].charAt(0);//找到产生式右部的最左侧的字符 if (Vt.contains(currentChar)) { if (currentChar == 'e') ifNeedFollow[i] = 1;//能够推导出e,需要求其follow集 else firstOfThisItem.add(currentChar); } else if (currentChar == currentVn) { //此时出现左递归 throw new Exception("该语法出现左递归,其并非LL(1)文法!"); } else { nextVn.add(currentChar); } } } } first.add(firstOfThisItem); } } /** * 生成follow集 */ private void handleFollow() { for (int i = 0; i < ifNeedFollow.length; i++) { HashSet<Character> followOfThisItem = new HashSet<>();//当前产生式的follow集 follow.add(followOfThisItem); if (ifNeedFollow[i] == 1) {//该产生式是否需要计算follow集 char currentVn = grammar[i].charAt(0); follow.get(i).addAll(findFollowByVn(currentVn)); } } } /** * 根据非终结符找到其follow集 * * @param currentVn 非终结符 * @return */ private HashSet<Character> findFollowByVn(char currentVn) { HashSet<Character> currFollow = new HashSet<>();//当前非终结符的follow集 if (firstVn == currentVn) currFollow.add(';'); for (String currGrammar : grammar) { String rightOfGrammar = currGrammar.split("->")[1]; //遍历并找到右部含有当前非终结符的产生式 for (int i = 0; i < rightOfGrammar.length(); i++) { if (rightOfGrammar.charAt(i) == currentVn) { if (i == rightOfGrammar.length() - 1 || rightOfGrammar.charAt(i + 1) == 'e') { if (currGrammar.charAt(0) != currentVn) currFollow.addAll(findFollowByVn(currGrammar.charAt(0))); break; } else { for (int j = 0; j < grammar.length; j++) { if (grammar[j].charAt(0) == rightOfGrammar.charAt(i + 1)) { if (ifNeedFollow[j] == 1) { currFollow.addAll(findFollowByVn(rightOfGrammar.charAt(i + 1))); break; } } } currFollow.addAll(findFirstByVnOrVt(rightOfGrammar.charAt(i + 1))); } } } } return currFollow; } /** * 根据当前字符找到其first集,当前字符可能是终结符或非终结符 * * @param currentVnOrVt * @return */ private HashSet<Character> findFirstByVnOrVt(char currentVnOrVt) { HashSet<Character> currFirst = new HashSet<>(); if (Vt.contains(currentVnOrVt)) currFirst.add(currentVnOrVt); else { for (int i = 0; i < grammar.length; i++) { if (grammar[i].charAt(0) == currentVnOrVt) { currFirst.addAll(first.get(i)); } } } return currFirst; } /** * 生成select集 */ private void handleSelect() { for (int i = 0; i < grammar.length; i++) { HashSet<Character> selectOfThisItem = new HashSet<>(); select.add(selectOfThisItem); HashSet<Character> thisFirst = first.get(i); select.get(i).addAll(thisFirst); if (ifNeedFollow[i] == 1) select.get(i).addAll(follow.get(i)); } } /** * 判断该文法是否为LL(1)文法 * * @return */ public boolean judgeIfLL1() { int wholeNumInSelect;//相同Vn的select集中元素个数 char currentVn = 0;//当前Vn HashSet<Character> wholeSelect;//相同Vn的select集 HashSet<Character> judgedVn = new HashSet<>();//已经判断过的Vn集 for (int i = 0; i < grammar.length; i++) { if (!judgedVn.contains(currentVn)) {//当前Vn没有被判断过,初始化各个参数 currentVn = grammar[i].charAt(0); judgedVn.add(currentVn); wholeNumInSelect = 0; wholeSelect = new HashSet<>(); } else continue; for (int j = i + 1; j < grammar.length; j++) {//遍历其他产生式,找到最左侧为当前Vn的产生式 if (grammar[j].charAt(0) == currentVn) { //巧妙利用set的特性,其中不含有任何重复元素,如果总的select集的size和其他各个select集的size之和不相等 //则代表select集有相交,其并不是LL(1)文法 wholeNumInSelect += select.get(j).size(); wholeSelect.addAll(select.get(j)); } } if (wholeNumInSelect != wholeSelect.size()) return false; } return true; } /** * 生成分析表 */ private void handleAnalysisTable() { for (int i = 0; i < grammar.length; i++) { char VnOfThisGrammar = grammar[i].charAt(0); if (!analysisTable.containsKey(VnOfThisGrammar)) { ArrayList<AnalysisTableItem> arrOfThisVn = new ArrayList<>(); analysisTable.put(VnOfThisGrammar, arrOfThisVn); } HashSet<Character> thisSelect = select.get(i); for (char thisChar : thisSelect) { AnalysisTableItem analysisTableItem = new AnalysisTableItem(VnOfThisGrammar, thisChar, i); analysisTable.get(VnOfThisGrammar).add(analysisTableItem); } } } /** * 展示分析表 */ public void showAnalysisTable() { for (char Vn : analysisTable.keySet()) { System.out.print(Vn + "\t"); for (AnalysisTableItem item : analysisTable.get(Vn)) { System.out.print(item.getVt() + "->" + item.getChangeToNextGrammar() + "\t"); } System.out.println(); } } }
[ "863253972@qq.com" ]
863253972@qq.com
a1d2c76a73895cc9da5b4c6fe4ba4ff38393eeb8
52aad5e6d4db4ab7deeffd12111c34ddff68e57e
/shopping-app/cart/src/main/java/com/shopping/app/cart/CartApplication.java
e89d59806df1a3c4566017034ff3328066ab7742
[]
no_license
amitkulgod/shopping-app
dec3a77cdcb5662cc7b7b840d9168cfaf13dae81
f2c3fc17a14599bd7bd3c5ffbdb2305e1fc994b2
refs/heads/master
2022-12-10T05:38:21.777104
2020-09-14T17:47:36
2020-09-14T17:47:36
295,387,860
0
0
null
null
null
null
UTF-8
Java
false
false
455
java
/** * */ package com.shopping.app.cart; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import com.shopping.app.cart.controller.CartController; /** * @author AK * */ @SpringBootApplication public class CartApplication { public static void main(String[] args) { SpringApplication.run(CartApplication.class, args); new CartController(); } }
[ "AKULGOD@CGSCLXI48981177.inedc.corpintra.net" ]
AKULGOD@CGSCLXI48981177.inedc.corpintra.net
f5fed11be8a9a29d00275f4f2fe2ce770739a1a2
9f16c947034e950c9d4d5b240f65256f7d06bda7
/subprojects/core-impl/src/main/groovy/org/gradle/api/internal/artifacts/ivyservice/ModuleVersionResolveException.java
ece8d642a6b386bfff8b2a54a03516a12a0d5732
[]
no_license
ben-manes/gradle
74ad626db79ae4b52720dbb5fc0c53a3001ab176
73b68b55467f8acc1a8a08432492f16498feeba5
refs/heads/master
2023-03-19T00:09:50.654080
2012-09-04T20:31:58
2012-11-05T03:34:15
5,677,792
2
0
null
null
null
null
UTF-8
Java
false
false
3,309
java
/* * Copyright 2011 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.gradle.api.internal.artifacts.ivyservice; import org.apache.ivy.core.module.id.ModuleRevisionId; import org.gradle.api.internal.AbstractMultiCauseException; import org.gradle.api.internal.Contextual; import org.gradle.internal.UncheckedException; import java.util.ArrayList; import java.util.Collection; import java.util.Formatter; import java.util.List; @Contextual public class ModuleVersionResolveException extends AbstractMultiCauseException { private final List<List<ModuleRevisionId>> paths = new ArrayList<List<ModuleRevisionId>>(); public ModuleVersionResolveException(String message) { super(message); } public ModuleVersionResolveException(ModuleRevisionId id, Throwable cause) { super(format(id), cause); } public ModuleVersionResolveException(ModuleRevisionId id, Iterable<? extends Throwable> causes) { super(format(id), causes); } public ModuleVersionResolveException(String message, Throwable cause) { super(message, cause); } private static String format(ModuleRevisionId id) { return String.format("Could not resolve group:%s, module:%s, version:%s.", id.getOrganisation(), id.getName(), id.getRevision()); } /** * Creates a copy of this exception, with the given incoming paths. */ public ModuleVersionResolveException withIncomingPaths(Collection<? extends List<ModuleRevisionId>> paths) { ModuleVersionResolveException copy = createCopy(super.getMessage()); copy.paths.addAll(paths); copy.initCauses(getCauses()); copy.setStackTrace(getStackTrace()); return copy; } @Override public String getMessage() { if (paths.isEmpty()) { return super.getMessage(); } Formatter formatter = new Formatter(); formatter.format("%s%nRequired by:", super.getMessage()); for (List<ModuleRevisionId> path : paths) { formatter.format("%n %s", toString(path.get(0))); for (int i = 1; i < path.size(); i++) { formatter.format(" > %s", toString(path.get(i))); } } return formatter.toString(); } private String toString(ModuleRevisionId moduleRevisionId) { return String.format("%s:%s:%s", moduleRevisionId.getOrganisation(), moduleRevisionId.getName(), moduleRevisionId.getRevision()); } protected ModuleVersionResolveException createCopy(String message) { try { return getClass().getConstructor(String.class).newInstance(message); } catch (Exception e) { throw UncheckedException.throwAsUncheckedException(e); } } }
[ "adam.murdoch@gradleware.com" ]
adam.murdoch@gradleware.com
a205665c722a372918c7f55ede718f7fdc008edc
1cedb98670494d598273ca8933b9d989e7573291
/ezyfox-server-bean/src/test/java/com/tvd12/ezyfoxserver/bean/testing/EzyConfigurationClassSorterTest.java
cefab697eefc1076528c6f7c9d71732987b0c026
[ "Apache-2.0" ]
permissive
thanhdatbkhn/ezyfox-server
ee00e1e23a2b38597bac94de7103bdc3a0e0bedf
069e70c8a7d962df8341444658b198ffadc3ce61
refs/heads/master
2020-03-10T11:08:10.921451
2018-01-14T16:50:37
2018-01-14T16:50:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
314
java
package com.tvd12.ezyfoxserver.bean.testing; import com.tvd12.ezyfoxserver.bean.impl.EzyConfigurationClassSorter; import com.tvd12.test.base.BaseTest; public class EzyConfigurationClassSorterTest extends BaseTest { @Override public Class<?> getTestClass() { return EzyConfigurationClassSorter.class; } }
[ "itprono3@gmail.com" ]
itprono3@gmail.com
339a4bfb4204e6d969401c2267f63889db72bff6
b697a5f2c2c1c86833d1d4fa6aedd980b99f3e57
/src/main/java/com/teng/demo/bridge/TelephoneBrandS.java
11ea306a9d91a329661aeb817daa782a43b17469
[]
no_license
TENGXIANG/design-pattern-demo
81d2550b80fed4485343d9bcc34a52a77095c130
b020d64ca0a2c1fe97e3c25eddf284b5607ca083
refs/heads/master
2020-03-22T15:19:41.573051
2018-09-04T02:20:55
2018-09-04T02:20:55
140,244,337
0
0
null
null
null
null
UTF-8
Java
false
false
266
java
package com.teng.demo.bridge; /** * @author TengXiang * @date 2018/7/31 * 桥接模式:手机品牌S */ public class TelephoneBrandS extends TelephoneBrand { @Override public void run() { System.out.println("=S="); soft.run(); } }
[ "35358148@qq.com" ]
35358148@qq.com
e116c865ebc3f6b311d0458b057a73f3bda9c494
357a8386423e00c3216d7eaf14ac480e629b692a
/src/main/java/com/study/study_space/basic/design_mode/dongtaidaili/People.java
2ba55ed90752df465564ed9b9949e974ec557f46
[]
no_license
zdqcsty/study_space
6f50d95058680d05b9278637732312cb827ffe10
cd07b18284fe7946f1a59cb2a92a7e65d71dde5e
refs/heads/master
2022-07-08T14:36:39.533737
2021-06-25T09:05:21
2021-06-25T09:05:21
201,225,319
0
1
null
2022-06-21T01:37:42
2019-08-08T09:29:07
Java
UTF-8
Java
false
false
127
java
package com.study.study_space.basic.design_mode.dongtaidaili; public interface People { public String work(String name); }
[ "zengguanghao@bonc.com.cn" ]
zengguanghao@bonc.com.cn
b76cbf7008fa1fc4051ddbf173016c78a2aa59bb
a650ac6751b5ffe48b2a479de5265005d3fc3f20
/src/uml/GradeBook.java
ce0b67764c319b5a573dd280a5954597b0c90104
[]
no_license
wins0117/OOSE
4ccce85efd786f756b12c14ee00b7a3ccda40c1e
c6a2467b403f54ac7453684104ca8a5db29dbebf
refs/heads/master
2020-03-29T16:55:27.234186
2017-11-29T14:54:31
2017-11-29T14:54:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,034
java
package uml; public class GradeBook { // how can we keep the grades private? int grades[][]; int subjectAvg[]; int studentAvg[]; public GradeBook(int[][] grades) { } public String getSubjectAvg(int jid) { // TODO Auto-generated method stub return null; } public String getStudentAvg(int sid) { // TODO Auto-generated method stub return null; } private double[] getSubjectAvg() { // TODO Auto-generated method stub return null; } private double[] getStudentAvg() { // TODO Auto-generated method stub return null; } public static void main(String[] args) { int[][] grades = { { 12, 23, 34 }, { 34, 45, 56 }, { 67, 78, 90 }, { 1, 1, 1 } }; GradeBook g = new GradeBook(grades); int sid = 1; System.out.println("The average for student " + sid + " is " + g.getStudentAvg(sid)); int jid = 0; // subject ID System.out.println("The average for subject " + jid + " is " + g.getSubjectAvg(jid)); double[] subjectAvg = g.getStudentAvg(); double[] studentAvg = g.getSubjectAvg(); } }
[ "nlhsueh@fcu.edu.tw" ]
nlhsueh@fcu.edu.tw
51b67f8558687632abb84bd65bf5924a7521b0fc
45fb92706cfc4993ee2ac94c57f13e5cba0d1c5e
/src/main/java/com/sbytestream/SqlScript.java
df9bb9f6af3b98ab3605acae4bc156d50d672c89
[ "MIT" ]
permissive
siddharthbarman/athena-with-java
c67de9306db19df9d9e35bb0b90f940d46e6b20f
a6c2aa76867cde68c02cc16a10bd3fe68372bb3c
refs/heads/master
2023-04-22T06:08:15.600748
2021-05-16T13:29:16
2021-05-16T13:29:16
361,375,907
0
0
null
null
null
null
UTF-8
Java
false
false
1,413
java
package com.sbytestream; import java.io.BufferedReader; import java.io.FileReader; public class SqlScript { public SqlScript(String path, ISqlScriptClient listener) { scriptFilePath = path; this.listener = listener; } public void parse() throws Exception { StringBuilder sb = new StringBuilder(); try (FileReader reader = new FileReader(scriptFilePath); BufferedReader buffReader = new BufferedReader(reader)) { String line = buffReader.readLine(); while (line != null) { line = line.trim(); if (line.equalsIgnoreCase(BLOCK_TERMINATOR)) { listener.statementFound(sb.toString()); sb.setLength(0); } else { sb.append(line); sb.append("\n"); } line = buffReader.readLine(); } if (sb.length() > 0) { listener.statementFound(sb.toString()); sb.setLength(0); } } catch (Exception e) { throw e; } } public interface ISqlScriptClient { void statementFound(String statement); } private String scriptFilePath; private ISqlScriptClient listener; private final String BLOCK_TERMINATOR = "go"; }
[ "sbytestream@outlook.com" ]
sbytestream@outlook.com
cb9136897d865f704bbe7136b0d9e8fe41bbebe1
abc909448faed112c50bca7c007299540c33fb4a
/src/test/java/homeoffice/application/basket/BasketEntryTest.java
777349f2c00a7a4ec3e7c0a3e6e9523c1dddadf7
[]
no_license
RichardInnocent/TheBasket
162f087df14732aaf22a3ecf1d79a6e2ac084fdc
fc6c25bd23472c94f434e885f6fcb2187af93cec
refs/heads/master
2020-03-21T07:35:34.300619
2018-06-22T10:19:36
2018-06-22T10:19:36
138,288,724
0
0
null
null
null
null
UTF-8
Java
false
false
690
java
package homeoffice.application.basket; import static org.junit.Assert.*; import org.junit.Test; public class BasketEntryTest { private static final Item ITEM_1 = new Item("id1", "Violin bow", 14.65); private static final Item ITEM_2 = new Item("id2", "Arduino", 34.60); private BasketEntry basketEntry = new BasketEntry(ITEM_1, 3); @Test public void testToString() { assertEquals(ITEM_1.toString() + ": 3", basketEntry.toString()); } @Test public void testContains() { assertTrue(basketEntry.contains(ITEM_1)); assertFalse(basketEntry.contains(ITEM_2)); } @Test public void testGetTotalCost() { assertEquals(14.65*3, basketEntry.getTotalCost(), 1e-5); } }
[ "richardinnocent@sky.com" ]
richardinnocent@sky.com
f0f863401bf9fd0e8c48ed1fceb62a96058797a3
26555ca2c1c3d90f1864f0d1e3a58f4f2d8b95c9
/Sort/src/BubbleSort.java
aef6c1f322c0030c0f0006f3fe409d7dfc1afde7
[]
no_license
qiangyongyang/datastruct-master
67e2228422c03eb14d11e1b5715d9e35ff23da87
36c1785f97c3b50d7d77c451e907789d1fade066
refs/heads/master
2020-04-14T23:22:32.301612
2019-03-05T13:09:19
2019-03-05T13:09:19
164,200,203
0
0
null
null
null
null
UTF-8
Java
false
false
675
java
public class BubbleSort { public static void sort(int data[]) { if (data.length == 0) { return; } for (int i = 0; i < data.length; i++) { int swap = 0; // 设置未发生交换标志 for (int j = i; j <data.length - i - 1; j++) { if (data[j] > data[j+1]) { int temp = data[j]; data[j] = data[j+1]; data[j+1] = temp; swap = 1; // 有交换发生 } } if (swap == 0) { // 本次未出现交换 break; } } } public static void main(String[] args) { int data[] = { 1, 2, 3, 5, 4 }; sort(data); for (int i = 0; i < data.length; i++) { System.out.print(data[i] + " "); } System.out.println(); } }
[ "915591297@qq.com" ]
915591297@qq.com
e8949ed6b00ff46843dd113a1e5fdefec854ecbf
712d7d29c6b346fd7a933d628680133fcfc827a3
/HSystem/src/main/java/person/li/dao/UserDtoMapper.java
671f3eee0174c9e8e0a1d47febe088dc582d462d
[]
no_license
lihongjian/YouBeiTest
207648591ff520caffd3b0ffcab0129ef0e235fe
938daa5a5b94b2e5d3931475416fce2de5e2286c
refs/heads/master
2021-01-23T03:04:58.182457
2018-05-03T01:14:26
2018-05-03T01:14:26
86,046,655
0
0
null
null
null
null
UTF-8
Java
false
false
1,317
java
package person.li.dao; import person.li.model.UserDto; public interface UserDtoMapper { /** * This method was generated by MyBatis Generator. * This method corresponds to the database table sm_user * * @mbggenerated */ int deleteByPrimaryKey(String pkUser); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table sm_user * * @mbggenerated */ int insert(UserDto record); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table sm_user * * @mbggenerated */ int insertSelective(UserDto record); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table sm_user * * @mbggenerated */ UserDto selectByPrimaryKey(String pkUser); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table sm_user * * @mbggenerated */ int updateByPrimaryKeySelective(UserDto record); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table sm_user * * @mbggenerated */ int updateByPrimaryKey(UserDto record); }
[ "navicnhong@163.com" ]
navicnhong@163.com
e25ffa59e07a4fe7a524b2ea53648a6597afbcb8
f0e7ebf4c66d2bab4f92c349d6afce10dc77a4aa
/Verkkokauppa1/src/main/java/ohtu/verkkokauppa/PankkiIntf.java
d65758e7ab99923477743add4afc8e10aac2715b
[]
no_license
salmirinne/ohtu-viikko1
d113cf46fd24466106c1db1278fb9348e664c2ef
35b1452947808486d2be7b3192d3451966879471
refs/heads/master
2020-05-19T21:22:57.886293
2015-05-03T14:17:12
2015-05-03T14:17:12
32,181,438
0
0
null
null
null
null
UTF-8
Java
false
false
158
java
package ohtu.verkkokauppa; public interface PankkiIntf { boolean tilisiirto(String nimi, int viitenumero, String tililta, String tilille, int summa); }
[ "ssalmiri@cs.helsinki.fi" ]
ssalmiri@cs.helsinki.fi
7fc3e14ba7049ca30ea358bf9fabb39207bb9188
2be61112d770709ee3b635d3229523b5d1e5c445
/src/main/java/org/sun/iterator/transition/Waitress.java
ea23d415cb1b1115ae4e297d22ab3b766624dc09
[]
no_license
thesunnysky/designpatterns
d164589d95e9ec1d5d76a7dc371c28e8490002a6
f1180d1ac9319e8513928d89f37811d999d0d570
refs/heads/master
2021-04-26T23:26:18.659502
2018-04-13T01:19:00
2018-04-13T01:19:00
123,994,340
0
0
null
null
null
null
UTF-8
Java
false
false
673
java
package org.sun.iterator.transition; import java.util.*; public class Waitress { ArrayList<Menu> menus; public Waitress(ArrayList<Menu> menus) { this.menus = menus; } public void printMenu() { Iterator<?> menuIterator = menus.iterator(); while(menuIterator.hasNext()) { Menu menu = (Menu)menuIterator.next(); printMenu(menu.createIterator()); } } void printMenu(Iterator<?> iterator) { while (iterator.hasNext()) { MenuItem menuItem = (MenuItem)iterator.next(); System.out.print(menuItem.getName() + ", "); System.out.print(menuItem.getPrice() + " -- "); System.out.println(menuItem.getDescription()); } } }
[ "jianyungsun@gmail.com" ]
jianyungsun@gmail.com
971da5e2131f4cf4212b2dec0d3507df80bd1a37
38c4451ab626dcdc101a11b18e248d33fd8a52e0
/identifiers/lucene-3.6.2/core/src/java/org/apache/lucene/index/FieldSortedTermVectorMapper.java
4e8109d28d019e0f2bf91cbcb78ea0b0d57a300e
[]
no_license
habeascorpus/habeascorpus-data
47da7c08d0f357938c502bae030d5fb8f44f5e01
536d55729f3110aee058ad009bcba3e063b39450
refs/heads/master
2020-06-04T10:17:20.102451
2013-02-19T15:19:21
2013-02-19T15:19:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,025
java
org PACKAGE_IDENTIFIER false apache PACKAGE_IDENTIFIER false lucene PACKAGE_IDENTIFIER false index PACKAGE_IDENTIFIER false java PACKAGE_IDENTIFIER false util PACKAGE_IDENTIFIER false FieldSortedTermVectorMapper TYPE_IDENTIFIER true TermVectorMapper TYPE_IDENTIFIER false Map TYPE_IDENTIFIER false String TYPE_IDENTIFIER false SortedSet TYPE_IDENTIFIER false TermVectorEntry TYPE_IDENTIFIER false fieldToTerms VARIABLE_IDENTIFIER true HashMap TYPE_IDENTIFIER false String TYPE_IDENTIFIER false SortedSet TYPE_IDENTIFIER false TermVectorEntry TYPE_IDENTIFIER false SortedSet TYPE_IDENTIFIER false TermVectorEntry TYPE_IDENTIFIER false currentSet VARIABLE_IDENTIFIER true String TYPE_IDENTIFIER false currentField VARIABLE_IDENTIFIER true Comparator TYPE_IDENTIFIER false TermVectorEntry TYPE_IDENTIFIER false comparator VARIABLE_IDENTIFIER true FieldSortedTermVectorMapper METHOD_IDENTIFIER false Comparator TYPE_IDENTIFIER false TermVectorEntry TYPE_IDENTIFIER false comparator VARIABLE_IDENTIFIER true comparator VARIABLE_IDENTIFIER false FieldSortedTermVectorMapper METHOD_IDENTIFIER false ignoringPositions VARIABLE_IDENTIFIER true ignoringOffsets VARIABLE_IDENTIFIER true Comparator TYPE_IDENTIFIER false TermVectorEntry TYPE_IDENTIFIER false comparator VARIABLE_IDENTIFIER true ignoringPositions VARIABLE_IDENTIFIER false ignoringOffsets VARIABLE_IDENTIFIER false comparator VARIABLE_IDENTIFIER false comparator VARIABLE_IDENTIFIER false Override TYPE_IDENTIFIER false map METHOD_IDENTIFIER true String TYPE_IDENTIFIER false term VARIABLE_IDENTIFIER true frequency VARIABLE_IDENTIFIER true TermVectorOffsetInfo TYPE_IDENTIFIER false offsets VARIABLE_IDENTIFIER true positions VARIABLE_IDENTIFIER true TermVectorEntry TYPE_IDENTIFIER false entry VARIABLE_IDENTIFIER true TermVectorEntry TYPE_IDENTIFIER false currentField VARIABLE_IDENTIFIER false term VARIABLE_IDENTIFIER false frequency VARIABLE_IDENTIFIER false offsets VARIABLE_IDENTIFIER false positions VARIABLE_IDENTIFIER false currentSet VARIABLE_IDENTIFIER false add METHOD_IDENTIFIER false entry VARIABLE_IDENTIFIER false Override TYPE_IDENTIFIER false setExpectations METHOD_IDENTIFIER true String TYPE_IDENTIFIER false field VARIABLE_IDENTIFIER true numTerms VARIABLE_IDENTIFIER true storeOffsets VARIABLE_IDENTIFIER true storePositions VARIABLE_IDENTIFIER true currentSet VARIABLE_IDENTIFIER false TreeSet TYPE_IDENTIFIER false TermVectorEntry TYPE_IDENTIFIER false comparator VARIABLE_IDENTIFIER false currentField VARIABLE_IDENTIFIER false field VARIABLE_IDENTIFIER false fieldToTerms VARIABLE_IDENTIFIER false put METHOD_IDENTIFIER false field VARIABLE_IDENTIFIER false currentSet VARIABLE_IDENTIFIER false Map TYPE_IDENTIFIER false String TYPE_IDENTIFIER false SortedSet TYPE_IDENTIFIER false TermVectorEntry TYPE_IDENTIFIER false getFieldToTerms METHOD_IDENTIFIER true fieldToTerms VARIABLE_IDENTIFIER false Comparator TYPE_IDENTIFIER false TermVectorEntry TYPE_IDENTIFIER false getComparator METHOD_IDENTIFIER true comparator VARIABLE_IDENTIFIER false
[ "pschulam@gmail.com" ]
pschulam@gmail.com
32ab2e86dc845658d77e2492d09d38126fe04569
c67355fdd50d5377fe2d5bb3e659253822e084fa
/src/main/java/reviewcomment/ReviewCommentBean.java
b92fc143951b2b15026acc2af3aad1987d38db40
[]
no_license
hyeondla/BusanPlate
8b9782e9545c0b3571060aa270fa22f8d2bae556
1064b743a870c372e01347334fd3f21164ecab68
refs/heads/master
2023-06-11T12:41:45.417246
2021-07-03T14:17:00
2021-07-03T14:17:00
378,046,803
0
0
null
null
null
null
UTF-8
Java
false
false
866
java
package reviewcomment; import java.sql.Timestamp; public class ReviewCommentBean { private int num; private String id; private String name; private String content; private int boardnum; private Timestamp date; public int getNum() { return num; } public void setNum(int num) { this.num = num; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } public int getBoardnum() { return boardnum; } public void setBoardnum(int boardnum) { this.boardnum = boardnum; } public Timestamp getDate() { return date; } public void setDate(Timestamp date) { this.date = date; } }
[ "hyeondla@gmail.com" ]
hyeondla@gmail.com
4223318f23e0d13993294c4479401ac6439ccd1d
af02649e361fd5917cadeb9e4a9f84242cc281a4
/05SecurityDoor/src/application/SecurityCheck.java
fc5de613c2e76abcbb205271f85753bee25b631b
[]
no_license
anandabayuf/APPL1-24Jun2020
b7311673562724933ee154cc8970affa2bc76c17
91e4ee76cfd4587891f84e5dafbe05c6f988f2c1
refs/heads/master
2022-11-10T07:59:22.413936
2020-06-28T07:57:13
2020-06-28T07:57:13
275,477,311
0
0
null
null
null
null
UTF-8
Java
false
false
193
java
/* * Created By Ananda Bayu Fauzan. */ package application; /** * * @author Ananda Bayu */ public abstract class SecurityCheck { public abstract boolean validateUser(); }
[ "noreply@github.com" ]
noreply@github.com
53024e125105979eb91722ac0b8999518cef7d03
ea2ce93dabc7658f97b2417658f1f3949fd2f63c
/src/main/java/edu/whu/irlab/entity/TrainRecord.java
4960810332a152ae44fa3182ffd404c4f3d414e7
[]
no_license
RogerFang/MobileWeb
02aa6abcac9b13093c23fe6c7f5f8bdfd0f7e27f
64cac8bed110518fcdb5f447239a1bc1433927ce
refs/heads/master
2021-01-20T19:18:34.998221
2016-07-14T12:00:42
2016-07-14T12:00:42
62,388,361
0
0
null
null
null
null
UTF-8
Java
false
false
2,409
java
package edu.whu.irlab.entity; import com.google.common.base.Splitter; import org.apache.commons.lang3.time.DateFormatUtils; import javax.persistence.*; import java.io.File; import java.util.ArrayList; import java.util.Date; import java.util.List; /** * Created by Roger on 2016/7/9. */ @Entity @Table(name = "train_record") public class TrainRecord { private Integer id; private String model; private String trainMonthData; private String modelPath; private String trainPrecision; private Integer state; private Date updateTime; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id") public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } @Column(name = "model") public String getModel() { return model; } public void setModel(String model) { this.model = model; } @Column(name = "train_month_data") public String getTrainMonthData() { return trainMonthData; } public void setTrainMonthData(String trainMonthData) { this.trainMonthData = trainMonthData; } @Column(name = "model_path") public String getModelPath() { return modelPath; } public void setModelPath(String modelPath) { this.modelPath = modelPath; } @Column(name = "train_precision") public String getTrainPrecision() { return trainPrecision; } public void setTrainPrecision(String trainPrecision) { this.trainPrecision = trainPrecision; } @Column(name = "state") public Integer getState() { return state; } public void setState(Integer state) { this.state = state; } @Column(name = "update_time") public Date getUpdateTime() { return updateTime; } public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; } @Transient public List<String> getTrainMonthDataName() { List<String> filenameList = new ArrayList<>(); for (String filepath: Splitter.on(",").trimResults().splitToList(getTrainMonthData())){ filenameList.add(new File(filepath).getName()); } return filenameList; } @Transient public String getFormatUpdateTime(){ return DateFormatUtils.format(updateTime, "yyyy-MM-dd HH:mm:ss"); } }
[ "1223493354@qq.com" ]
1223493354@qq.com
6315b215a4ec284bd35e15cafaf2560b40e4b70d
ad53979f04d9432f0771829eaba4ff171526f5cf
/src/ValueNodeTest.java
2addb1a9432320481f7f28f538bdcdd3d03612cd
[]
no_license
leland-hannah/NodesMultiMap
a3223c4c3b4b4e0315e0538818b6cf192ad50176
719a0c0f2637d2c529d15dddbe2834c946323ebe
refs/heads/master
2020-07-25T01:36:33.480799
2019-09-12T18:09:02
2019-09-12T18:09:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,091
java
/** * * @author hannahleland * @version 2018.21.11 * @param <E> */ public class ValueNodeTest<E> extends student.TestCase { private ValueNode<E> v; private ValueNode<E> vn; /** * creates the value node */ public void setUp() { v = new ValueNode<E>((E) "A"); vn = new ValueNode(new ValueNode<E>((E) "B")); } /** * tests getnext */ public void testGetNext() { assertNull(v.getNext()); v.setNext(new ValueNode<E>((E) "B")); assertEquals("B", v.getNext().getValue().toString()); } /** * tests set next */ public void testSetNext() { v.setNext(new ValueNode<E>((E) "B")); assertEquals("B", v.getNext().getValue()); } /** * tests get value */ public void testGetValue() { assertEquals("A", v.getValue()); assertEquals("B", vn.getNext().getValue()); } /** * tests setvalue */ public void testSetValue() { v.setValue((E) "C"); assertEquals("C", v.getValue()); } }
[ "hannah_leland@live.com" ]
hannah_leland@live.com
5d4f4a30c548e7a09ba12578cec28cbdadb849c8
8157d25fd45679609fc4dec5d8eed203c19c5bb0
/springcloud-elasticjob-helper/src/main/java/com/chippy/elasticjob/support/api/AbstractTraceJob.java
39fde25d9296b97669dc5ebc8e75ad499f688788
[]
no_license
Gao94/springcloud-all-helper
3a07065de6c23cf4cfbe15cfe3a680e77e352130
c9f7ac4ea4a347c396200cd632d24874783250e9
refs/heads/main
2023-02-03T08:25:37.620536
2020-12-27T15:30:52
2020-12-27T15:30:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,313
java
package com.chippy.elasticjob.support.api; import cn.hutool.json.JSONUtil; import com.chippy.elasticjob.support.domain.JobInfo; import com.chippy.elasticjob.support.enums.JobStatusEnum; import lombok.extern.slf4j.Slf4j; import org.apache.shardingsphere.elasticjob.simple.job.SimpleJob; import org.springframework.beans.factory.annotation.Autowired; import javax.annotation.Resource; import java.util.Objects; /** * 抽象实现状态跟踪记录类型任务 * 实现该类一定要确保任务是实现{@link AbstractTraceJobHandler},以保证任务状态跟踪记录 * 一定要确保实现{@link TraceJobProcessor},以保证任务进行相关业务操作 * * @author: chippy * @datetime 2020-11-16 15:00 */ @Slf4j public abstract class AbstractTraceJob<T> implements SimpleJob { private static final String LOG_TEMPLATE = "通用定时任务功能实现-%s"; @Resource private TraceJobOperationService completeJobInfOperationService; @Autowired private TraceJobProcessor<T> elasticJobBusinessProcessor; protected abstract Class<T> getGenericClass(); protected void doExecute(String jobName, String jobParameter) { try { final JobInfo jobInfo = completeJobInfOperationService.byJobName(jobName, JobStatusEnum.ING); if (Objects.isNull(jobInfo)) { if (log.isErrorEnabled()) { log.error("任务[" + jobName + "]状态已被修改,本次任务不做任何处理"); } // TODO 记录一下ERROR MSG return; } T data = this.getJobParameter(jobParameter); elasticJobBusinessProcessor.processCronJob(data); } catch (Exception e) { String exceptionMessage = "异常信息-ex:[" + e.getMessage() + "]"; log.error(String.format(LOG_TEMPLATE, exceptionMessage)); throw e; } } @SuppressWarnings("unchecked") private T getJobParameter(String jobParameter) { T data; final Class<T> genericClass = this.getGenericClass(); if (Objects.equals(genericClass, String.class)) { data = (T)jobParameter; } else { data = JSONUtil.toBean(jobParameter, this.getGenericClass()); } return data; } }
[ "450799968@qq.com" ]
450799968@qq.com
f8443082dbfd6ba1f6c2f244c332c6d351beb02e
66b7f064ace24edfa4d9426ee314aed34926ada4
/src/main/java/my/superfood/resolver/FoodResolver.java
7065365d91fc4c940fd8334215eab8d2baeea4c6
[]
no_license
demente/FoodEinfach
e09e6ff4a1d4d159f3d0841c7763a7cdaf4e6341
0f30f12744ebf403c0716ba2fcab8c38060dba79
refs/heads/master
2022-02-16T08:32:06.516625
2019-07-14T13:40:35
2019-07-14T13:40:35
97,754,171
2
0
null
2022-01-21T23:12:48
2017-07-19T19:35:55
Java
UTF-8
Java
false
false
324
java
package my.superfood.resolver; import my.superfood.dao.FoodDao; import my.superfood.model.Food; public class FoodResolver { private final FoodDao foodDao; public FoodResolver(FoodDao foodDao) { this.foodDao = foodDao; } public Food toFood(Long id) { return foodDao.findById(id); } }
[ "olga.agen@gmail.com" ]
olga.agen@gmail.com
c9b696d7f9037e11ce87de31c0278b15012e3afb
07f46178713e9127d099a246a3cefb0f0c4c3384
/config/ConstructorCallTest.java
d30de8b6459b69be1f44b530d46c600a3bfa40a1
[]
no_license
joaobispo/TVVS_KADABRA_Mutations
cef2adaa4430bf77026397a91fad6502ca17d025
5bf4e628e2b02b33dfcb62f234fa29ad180c58ab
refs/heads/master
2020-09-30T20:11:55.245824
2020-03-14T17:57:08
2020-03-14T17:57:08
227,364,183
0
0
null
2019-12-11T12:46:06
2019-12-11T12:46:05
null
UTF-8
Java
false
false
577
java
public class ConstructorCallTest { public class Class1 { public int x = -1; public Class1() { x = 0; } } public class Class2 { public ConstructorCallTest.Class1 obj; public Class2(ConstructorCallTest.Class1 obj) { this.obj = obj; } } public ConstructorCallTest.Class1 obj; public ConstructorCallTest() { this.obj = new ConstructorCallTest.Class1(); ConstructorCallTest.Class2 test = new ConstructorCallTest.Class2(new ConstructorCallTest.Class1()); } }
[ "joseloc300-dev@outlook.com" ]
joseloc300-dev@outlook.com
06bc9da9fa80fe5a4fb465d3f29c52cdcc912494
20eb62855cb3962c2d36fda4377dfd47d82eb777
/newEvaluatedBugs/Jsoup_6_buggy/mutated/972/QueryParser.java
f30f77098bcf881814dd4ba63d0ae71ed4359f53
[]
no_license
ozzydong/CapGen
356746618848065cce4e253e5d3c381baa85044a
0ba0321b6b1191443276021f1997833342f02515
refs/heads/master
2023-03-18T20:12:02.923428
2020-08-21T03:08:28
2020-08-21T03:08:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
13,578
java
package org.jsoup.select; import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.jsoup.helper.StringUtil; import org.jsoup.helper.Validate; import org.jsoup.parser.TokenQueue; /** * Parses a CSS selector into an Evaluator tree. */ public class QueryParser { private final static String[] combinators = {",", ">", "+", "~", " "}; private static final String[] AttributeEvals = new String[]{"=", "!=", "^=", "$=", "*=", "~="}; private TokenQueue tq; private String query; private List<Evaluator> evals = new ArrayList<Evaluator>(); /** * Create a new QueryParser. * @param query CSS query */ private QueryParser(String query) { this.query = query; this.tq = new TokenQueue(query); } /** * Parse a CSS query into an Evaluator. * @param query CSS query * @return Evaluator */ public static Evaluator parse(String query) { QueryParser p = new QueryParser(query); return p.parse(); } /** * Parse the query * @return Evaluator */ Evaluator parse() { tq.consumeWhitespace(); if (tq.matchesAny(combinators)) { // if starts with a combinator, use root as elements evals.add(new StructuralEvaluator.Root()); combinator(tq.consume()); } else { findElements(); } while (!tq.isEmpty()) { // hierarchy and extras boolean seenWhite = tq.consumeWhitespace(); if (tq.matchesAny(combinators)) { combinator(tq.consume()); } else if (seenWhite) { combinator(' '); } else { // E.class, E#id, E[attr] etc. AND findElements(); // take next el, #. etc off queue } } if (evals.size() == 1) return evals.get(0); return new CombiningEvaluator.And(evals); } private void combinator(char combinator) { tq.consumeWhitespace(); String subQuery = consumeSubQuery(); // support multi > childs Evaluator rootEval; // the new topmost evaluator Evaluator currentEval; // the evaluator the new eval will be combined to. could be root, or rightmost or. Evaluator newEval = parse(subQuery); // the evaluator to add into target evaluator boolean replaceRightMost = false; if (evals.size() == 1) { rootEval = currentEval = evals.get(0); // make sure OR (,) has precedence: if (rootEval instanceof CombiningEvaluator.Or && combinator != ',') { currentEval = ((CombiningEvaluator.Or) currentEval).rightMostEvaluator(); replaceRightMost = true; } } else { rootEval = currentEval = new CombiningEvaluator.And(evals); } evals.clear(); // for most combinators: change the current eval into an AND of the current eval and the new eval if (combinator == '>') currentEval = new CombiningEvaluator.And(newEval, new StructuralEvaluator.ImmediateParent(currentEval)); else if (combinator == ' ') currentEval = new CombiningEvaluator.And(newEval, new StructuralEvaluator.Parent(currentEval)); else if (combinator == '+') currentEval = new CombiningEvaluator.And(newEval, new StructuralEvaluator.ImmediatePreviousSibling(currentEval)); else if (combinator == '~') currentEval = new CombiningEvaluator.And(newEval, new StructuralEvaluator.PreviousSibling(currentEval)); else if (combinator == ',') { // group or. CombiningEvaluator.Or or; if (currentEval instanceof CombiningEvaluator.Or) { or = (CombiningEvaluator.Or) currentEval; or.add(newEval); } else { or = new CombiningEvaluator.Or(); or.add(currentEval); or.add(newEval); } currentEval = or; } else throw new Selector.SelectorParseException("Unknown combinator: " + combinator); if (replaceRightMost) ((CombiningEvaluator.Or) rootEval).replaceRightMostEvaluator(currentEval); else rootEval = currentEval; evals.add(rootEval); } private String consumeSubQuery() { StringBuilder sq = new StringBuilder(); while (!tq.isEmpty()) { if (tq.matches("(")) sq.append("(").append(tq.chompBalanced('(', ')')).append(")"); else if (tq.matches("[")) sq.append("[").append(tq.chompBalanced('[', ']')).append("]"); else if (tq.matchesAny(combinators)) break; else sq.append(tq.consume()); } return sq.toString(); } private void findElements() { if (tq.matchChomp("#")) byId(); else if (tq.matchChomp(".")) byClass(); else if (tq.matchesWord() || tq.matches("*|")) byTag(); else if (tq.matches("[")) byAttribute(); else if (tq.matchChomp("*")) allElements(); else if (tq.matchChomp(":lt(")) indexLessThan(); else if (tq.matchChomp(":gt(")) indexGreaterThan(); else if (tq.matchChomp(":eq(")) indexEquals(); else if (tq.matches(":has(")) has(); else if (tq.matches(":contains(")) contains(false); else if (tq.matches(":containsOwn(")) contains(true); else if (tq.matches(":containsData(")) containsData(); else if (tq.matches(":matches(")) matches(false); else if (tq.matches(":matchesOwn(")) matches(true); else if (tq.matches(":not(")) not(); else if (tq.matchChomp(":nth-child(")) cssNthChild(false, false); else if (tq.matchChomp(":nth-last-child(")) cssNthChild(true, false); else if (tq.matchChomp(":nth-of-type(")) cssNthChild(false, true); else if (tq.matchChomp(":nth-last-of-type(")) cssNthChild(true, true); else if (tq.matchChomp(":first-child")) evals.add(new Evaluator.IsFirstChild()); else if (tq.matchChomp(":last-child")) evals.add(new Evaluator.IsLastChild()); else if (tq.matchChomp(":first-of-type")) evals.add(new Evaluator.IsFirstOfType()); else if (tq.matchChomp(":last-of-type")) evals.add(new Evaluator.IsLastOfType()); else if (tq.matchChomp(":only-child")) evals.add(new Evaluator.IsOnlyChild()); else if (tq.matchChomp(":only-of-type")) evals.add(new Evaluator.IsOnlyOfType()); else if (tq.matchChomp(":empty")) evals.add(new Evaluator.IsEmpty()); else if (tq.matchChomp(":root")) evals.add(new Evaluator.IsRoot()); else // unhandled throw new Selector.SelectorParseException("Could not parse query '%s': unexpected token at '%s'", query, tq.remainder()); } private void byId() { String id = tq.consumeCssIdentifier(); Validate.notEmpty(id); evals.add(new Evaluator.Id(id)); } private void byClass() { String className = tq.consumeCssIdentifier(); Validate.notEmpty(className); evals.add(new Evaluator.Class(className.trim())); } private void byTag() { String tagName = tq.consumeElementSelector(); Validate.notEmpty(tagName); // namespaces: wildcard match equals(tagName) or ending in ":"+tagName if (tagName.startsWith("*|")) { evals.add(new CombiningEvaluator.Or(new Evaluator.Tag(tagName.trim().toLowerCase()), new Evaluator.TagEndsWith(tagName.replace("*|", ":").trim().toLowerCase()))); } else { // namespaces: if element name is "abc:def", selector must be "abc|def", so flip: if ("~=".contains("|")) tagName = tagName.replace("|", ":"); evals.add(new Evaluator.Tag(tagName.trim())); } } private void byAttribute() { TokenQueue cq = new TokenQueue(tq.chompBalanced('[', ']')); // content queue String key = cq.consumeToAny(AttributeEvals); // eq, not, start, end, contain, match, (no val) Validate.notEmpty(key); cq.consumeWhitespace(); if (cq.isEmpty()) { if (key.startsWith("^")) evals.add(new Evaluator.AttributeStarting(key.substring(1))); else evals.add(new Evaluator.Attribute(key)); } else { if (cq.matchChomp("=")) evals.add(new Evaluator.AttributeWithValue(key, cq.remainder())); else if (cq.matchChomp("!=")) evals.add(new Evaluator.AttributeWithValueNot(key, cq.remainder())); else if (cq.matchChomp("^=")) evals.add(new Evaluator.AttributeWithValueStarting(key, cq.remainder())); else if (cq.matchChomp("$=")) evals.add(new Evaluator.AttributeWithValueEnding(key, cq.remainder())); else if (cq.matchChomp("*=")) evals.add(new Evaluator.AttributeWithValueContaining(key, cq.remainder())); else if (cq.matchChomp("~=")) evals.add(new Evaluator.AttributeWithValueMatching(key, Pattern.compile(cq.remainder()))); else throw new Selector.SelectorParseException("Could not parse attribute query '%s': unexpected token at '%s'", query, cq.remainder()); } } private void allElements() { evals.add(new Evaluator.AllElements()); } // pseudo selectors :lt, :gt, :eq private void indexLessThan() { evals.add(new Evaluator.IndexLessThan(consumeIndex())); } private void indexGreaterThan() { evals.add(new Evaluator.IndexGreaterThan(consumeIndex())); } private void indexEquals() { evals.add(new Evaluator.IndexEquals(consumeIndex())); } //pseudo selectors :first-child, :last-child, :nth-child, ... private static final Pattern NTH_AB = Pattern.compile("((\\+|-)?(\\d+)?)n(\\s*(\\+|-)?\\s*\\d+)?", Pattern.CASE_INSENSITIVE); private static final Pattern NTH_B = Pattern.compile("(\\+|-)?(\\d+)"); private void cssNthChild(boolean backwards, boolean ofType) { String argS = tq.chompTo(")").trim().toLowerCase(); Matcher mAB = NTH_AB.matcher(argS); Matcher mB = NTH_B.matcher(argS); final int a, b; if ("odd".equals(argS)) { a = 2; b = 1; } else if ("even".equals(argS)) { a = 2; b = 0; } else if (mAB.matches()) { a = mAB.group(3) != null ? Integer.parseInt(mAB.group(1).replaceFirst("^\\+", "")) : 1; b = mAB.group(4) != null ? Integer.parseInt(mAB.group(4).replaceFirst("^\\+", "")) : 0; } else if (mB.matches()) { a = 0; b = Integer.parseInt(mB.group().replaceFirst("^\\+", "")); } else { throw new Selector.SelectorParseException("Could not parse nth-index '%s': unexpected format", argS); } if (ofType) if (backwards) evals.add(new Evaluator.IsNthLastOfType(a, b)); else evals.add(new Evaluator.IsNthOfType(a, b)); else { if (backwards) evals.add(new Evaluator.IsNthLastChild(a, b)); else evals.add(new Evaluator.IsNthChild(a, b)); } } private int consumeIndex() { String indexS = tq.chompTo(")").trim(); Validate.isTrue(StringUtil.isNumeric(indexS), "Index must be numeric"); return Integer.parseInt(indexS); } // pseudo selector :has(el) private void has() { tq.consume(":has"); String subQuery = tq.chompBalanced('(', ')'); Validate.notEmpty(subQuery, ":has(el) subselect must not be empty"); evals.add(new StructuralEvaluator.Has(parse(subQuery))); } // pseudo selector :contains(text), containsOwn(text) private void contains(boolean own) { tq.consume(own ? ":containsOwn" : ":contains"); String searchText = TokenQueue.unescape(tq.chompBalanced('(', ')')); Validate.notEmpty(searchText, ":contains(text) query must not be empty"); if (own) evals.add(new Evaluator.ContainsOwnText(searchText)); else evals.add(new Evaluator.ContainsText(searchText)); } // pseudo selector :containsData(data) private void containsData() { tq.consume(":containsData"); String searchText = TokenQueue.unescape(tq.chompBalanced('(', ')')); Validate.notEmpty(searchText, ":containsData(text) query must not be empty"); evals.add(new Evaluator.ContainsData(searchText)); } // :matches(regex), matchesOwn(regex) private void matches(boolean own) { tq.consume(own ? ":matchesOwn" : ":matches"); String regex = tq.chompBalanced('(', ')'); // don't unescape, as regex bits will be escaped Validate.notEmpty(regex, ":matches(regex) query must not be empty"); if (own) evals.add(new Evaluator.MatchesOwn(Pattern.compile(regex))); else evals.add(new Evaluator.Matches(Pattern.compile(regex))); } // :not(selector) private void not() { tq.consume(":not"); String subQuery = tq.chompBalanced('(', ')'); Validate.notEmpty(subQuery, ":not(selector) subselect must not be empty"); evals.add(new StructuralEvaluator.Not(parse(subQuery))); } }
[ "justinwm@163.com" ]
justinwm@163.com
58c5a2cc659fd8e1ad8b9b7bc11bda642079a2cb
20b14f13598b0b42244b5b3ba2a9ad61238dea5e
/src/main/java/com/deroude/lawdebate/dto/LawArticleSummary.java
9d3f7d46ba3ba65941c6d8d83fddc8116bee92b5
[ "MIT" ]
permissive
deroude/lawdebatebe
0fa3988bf985259a6ebe754ec09543aab59a32f5
8ac6cf2fc9b2b6466b2ef420fa0d7ecb87cea0e8
refs/heads/master
2021-01-20T03:11:44.347346
2017-03-05T10:27:07
2017-03-05T10:27:07
83,828,815
0
0
null
null
null
null
UTF-8
Java
false
false
1,264
java
/* * Copyright 2017 Valentin Raduti. * This source code file is the property of Valentin Raduti. * You are not allowed to view, edit, copy, re-use or re-engineer * this source code file unless specifically permissioned by Valentin Raduti. */ package com.deroude.lawdebate.dto; import com.deroude.lawdebate.domain.ArticleVersion; import com.deroude.lawdebate.domain.LawArticle; /** * * @author valentin.raduti */ public class LawArticleSummary { private final LawArticle article; private final ArticleVersion currentVersion; private final long yayVotes, nayVotes, abstainVotes; public LawArticleSummary(LawArticle article, ArticleVersion currentVersion, long yayVotes, long nayVotes, long abstainVotes) { this.article = article; this.currentVersion = currentVersion; this.yayVotes = yayVotes; this.nayVotes = nayVotes; this.abstainVotes = abstainVotes; } public LawArticle getArticle() { return article; } public ArticleVersion getCurrentVersion() { return currentVersion; } public long getYayVotes() { return yayVotes; } public long getNayVotes() { return nayVotes; } public long getAbstainVotes() { return abstainVotes; } }
[ "valentin.raduti@VRA.corp.computaris.net" ]
valentin.raduti@VRA.corp.computaris.net