blob_id
stringlengths
40
40
__id__
int64
225
39,780B
directory_id
stringlengths
40
40
path
stringlengths
6
313
content_id
stringlengths
40
40
detected_licenses
sequence
license_type
stringclasses
2 values
repo_name
stringlengths
6
132
repo_url
stringlengths
25
151
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
70
visit_date
unknown
revision_date
unknown
committer_date
unknown
github_id
int64
7.28k
689M
star_events_count
int64
0
131k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
23 values
gha_fork
bool
2 classes
gha_event_created_at
unknown
gha_created_at
unknown
gha_updated_at
unknown
gha_pushed_at
unknown
gha_size
int64
0
40.4M
gha_stargazers_count
int32
0
112k
gha_forks_count
int32
0
39.4k
gha_open_issues_count
int32
0
11k
gha_language
stringlengths
1
21
gha_archived
bool
2 classes
gha_disabled
bool
1 class
content
stringlengths
7
4.37M
src_encoding
stringlengths
3
16
language
stringclasses
1 value
length_bytes
int64
7
4.37M
extension
stringclasses
24 values
filename
stringlengths
4
174
language_id
stringclasses
1 value
entities
list
contaminating_dataset
stringclasses
0 values
malware_signatures
sequence
redacted_content
stringlengths
7
4.37M
redacted_length_bytes
int64
7
4.37M
alphanum_fraction
float32
0.25
0.94
alpha_fraction
float32
0.25
0.94
num_lines
int32
1
84k
avg_line_length
float32
0.76
99.9
std_line_length
float32
0
220
max_line_length
int32
5
998
is_vendor
bool
2 classes
is_generated
bool
1 class
max_hex_length
int32
0
319
hex_fraction
float32
0
0.38
max_unicode_length
int32
0
408
unicode_fraction
float32
0
0.36
max_base64_length
int32
0
506
base64_fraction
float32
0
0.5
avg_csv_sep_count
float32
0
4
is_autogen_header
bool
1 class
is_empty_html
bool
1 class
shard
stringclasses
16 values
a9f030dd46f68352c58b51003ebd2e466767d3cc
24,077,586,700,636
8b2b283e037066491f4b9382aef27937d3c43b3a
/app/src/main/java/com/intechdev/IpasKala/MyProfileActivity.java
8e6434d675e11e83d2459bfce40855ca28b96450
[]
no_license
ahmader68/IpasKala
https://github.com/ahmader68/IpasKala
352eb359e6515655dd8b7bdcdc0de46e76fb669e
c280c9701fbaadcacee629e71452985fe52f2665
refs/heads/master
"2020-08-15T16:28:34.575000"
"2019-10-15T17:57:40"
"2019-10-15T17:57:40"
215,368,361
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.intechdev.IpasKala; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.EditText; import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; import com.intechdev.IpasKala.entity.AppData; import com.intechdev.IpasKala.utils.AppUtils; import com.intechdev.IpasKala.webservicecall.APIClient; import com.intechdev.IpasKala.webservicecall.ApiInterface; import com.intechdev.IpasKala.webservicecall.Result; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; public class MyProfileActivity extends AppCompatActivity { AppCompatActivity acc; ApiInterface apiService; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my_profile); AppUtils.setToolBarVisibilety(this, AppUtils.MenuBarStat.BACK_HIDE, AppUtils.MenuBarStat.HOME_HIDE, AppUtils.MenuBarStat.SEARCH_HIDE,AppUtils.MenuBarStat.MENU_HIDE); AppUtils.setToolbarShoppingButton(this, null, null); acc = this; try { String strUserName = AppData.getUser(this).getFirstName() + " " + AppData.getUser(this).getLastName(); ((EditText) findViewById(R.id.etNameAndFamily)).setText(strUserName); ((EditText) findViewById(R.id.etEmail)).setText(AppData.getUser(this).getEmail()); ((EditText) findViewById(R.id.etMobile)).setText(AppData.getUser(this).getMobile()); }catch (Exception e){ ((EditText) findViewById(R.id.txtUserName)).setText("نسخه دمو"); } try { apiService = APIClient.getClient().create(ApiInterface.class); }catch (Exception e){ Toast.makeText(this,e.getMessage(),Toast.LENGTH_LONG).show(); } findViewById(R.id.btnRegister).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Call<Result> call = apiService.editProfile( // ((EditText) findViewById(R.id.etNameAndFamily)).getText().toString(), ((EditText) findViewById(R.id.etEmail)).getText().toString(), ((EditText) findViewById(R.id.etMobile)).getText().toString(), AppData.getUser(acc).getResult() ); call.enqueue(new Callback<Result>() { @Override public void onResponse(Call<Result>call, Response<Result> response) { Result movies = response.body(); if (movies.getResult().equals("1")){ Toast.makeText(acc, "تغییرات شما با موفقیت ثبت شد", Toast.LENGTH_SHORT).show(); AppData.saveData(MyProfileActivity.this, AppData.ActionAD.USER_SAVE, ""); setResult(Activity.RESULT_OK,null); finish(); }else { AppUtils.sendLog(acc, apiService, "EditUser", "Action=EditUser&native=1", response.body().toString(), AppUtils.getUserId(acc), ""); Toast.makeText(acc, "خطا در بروز رسانی اطلاعات", Toast.LENGTH_SHORT).show(); } Log.d("TAG", "Number of movies received: " + movies.getResult()); } @Override public void onFailure(Call<Result>call, Throwable t) { // Log error here since request failed Toast.makeText(acc, "خطا در بروز رسانی اطلاعات", Toast.LENGTH_SHORT).show(); Log.e("TAG", t.toString()); } }); } }); } @Override protected void onResume() { super.onResume(); } }
UTF-8
Java
4,235
java
MyProfileActivity.java
Java
[]
null
[]
package com.intechdev.IpasKala; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.EditText; import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; import com.intechdev.IpasKala.entity.AppData; import com.intechdev.IpasKala.utils.AppUtils; import com.intechdev.IpasKala.webservicecall.APIClient; import com.intechdev.IpasKala.webservicecall.ApiInterface; import com.intechdev.IpasKala.webservicecall.Result; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; public class MyProfileActivity extends AppCompatActivity { AppCompatActivity acc; ApiInterface apiService; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my_profile); AppUtils.setToolBarVisibilety(this, AppUtils.MenuBarStat.BACK_HIDE, AppUtils.MenuBarStat.HOME_HIDE, AppUtils.MenuBarStat.SEARCH_HIDE,AppUtils.MenuBarStat.MENU_HIDE); AppUtils.setToolbarShoppingButton(this, null, null); acc = this; try { String strUserName = AppData.getUser(this).getFirstName() + " " + AppData.getUser(this).getLastName(); ((EditText) findViewById(R.id.etNameAndFamily)).setText(strUserName); ((EditText) findViewById(R.id.etEmail)).setText(AppData.getUser(this).getEmail()); ((EditText) findViewById(R.id.etMobile)).setText(AppData.getUser(this).getMobile()); }catch (Exception e){ ((EditText) findViewById(R.id.txtUserName)).setText("نسخه دمو"); } try { apiService = APIClient.getClient().create(ApiInterface.class); }catch (Exception e){ Toast.makeText(this,e.getMessage(),Toast.LENGTH_LONG).show(); } findViewById(R.id.btnRegister).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Call<Result> call = apiService.editProfile( // ((EditText) findViewById(R.id.etNameAndFamily)).getText().toString(), ((EditText) findViewById(R.id.etEmail)).getText().toString(), ((EditText) findViewById(R.id.etMobile)).getText().toString(), AppData.getUser(acc).getResult() ); call.enqueue(new Callback<Result>() { @Override public void onResponse(Call<Result>call, Response<Result> response) { Result movies = response.body(); if (movies.getResult().equals("1")){ Toast.makeText(acc, "تغییرات شما با موفقیت ثبت شد", Toast.LENGTH_SHORT).show(); AppData.saveData(MyProfileActivity.this, AppData.ActionAD.USER_SAVE, ""); setResult(Activity.RESULT_OK,null); finish(); }else { AppUtils.sendLog(acc, apiService, "EditUser", "Action=EditUser&native=1", response.body().toString(), AppUtils.getUserId(acc), ""); Toast.makeText(acc, "خطا در بروز رسانی اطلاعات", Toast.LENGTH_SHORT).show(); } Log.d("TAG", "Number of movies received: " + movies.getResult()); } @Override public void onFailure(Call<Result>call, Throwable t) { // Log error here since request failed Toast.makeText(acc, "خطا در بروز رسانی اطلاعات", Toast.LENGTH_SHORT).show(); Log.e("TAG", t.toString()); } }); } }); } @Override protected void onResume() { super.onResume(); } }
4,235
0.562095
0.560894
106
38.273586
33.995708
173
false
false
0
0
0
0
0
0
0.698113
false
false
1
dc83c5964abed5327f665462bff60792bdf4d399
36,386,962,950,803
e67bf0db37805ea2a85c2ed9f07a11baa23135c6
/Gayatri Sonar/Swing_Login/src/main/java/LoginForm/Login.java
4c94237c0c7d46b7cdf4b2ad730fcc3b98d425da
[]
no_license
NileshkumarShegokar/java_training
https://github.com/NileshkumarShegokar/java_training
ce6d788b2f91b204948d8cd2a8eacf45607fbee7
a8080b8883f92a2fc8650ded02b289a672bc629a
refs/heads/master
"2023-07-18T12:50:56.970000"
"2021-09-02T04:28:14"
"2021-09-02T04:28:14"
393,263,802
0
2
null
false
"2021-09-02T04:28:15"
"2021-08-06T05:37:16"
"2021-08-31T05:12:50"
"2021-09-02T04:28:14"
285
0
2
0
Java
false
false
package LoginForm; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; public class Login extends Component implements ActionListener { JLabel title,l1,l2; JTextField tf1; JPasswordField tf2; JButton b1,b2; Login() { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout( new BoxLayout(frame.getContentPane(), BoxLayout.Y_AXIS)); JPanel a = new JPanel(); a.setAlignmentX(Component.CENTER_ALIGNMENT); a.setPreferredSize(new Dimension(500, 500)); a.setMaximumSize(new Dimension(500, 500)); // set max = pref a.setBorder(BorderFactory.createTitledBorder("aa")); a.setBackground(Color.BLACK); frame.getContentPane().add(a); title= new JLabel("Login Form"); title.setForeground(Color.CYAN); title.setFont(new Font("Serif", Font.BOLD, 20)); l1=new JLabel("Enter Username :"); l2=new JLabel("Enter PassWord :"); tf1=new JTextField(10); tf2=new JPasswordField(10); b1=new JButton("Login"); b2=new JButton("Cancel"); title.setBounds(100, 30, 400, 30); l1.setBounds(60, 90, 400, 30); l2.setBounds(60, 130, 400, 30); tf1.setBounds(180, 90, 150, 30); tf2.setBounds(180, 130, 150, 30); b1.setBounds(100, 180, 80, 30); b2.setBounds(200, 180, 80, 30); a.add(title); a.add(l1); a.add(l2); a.add(tf1); a.add(tf2); b1.addActionListener(this); a.add(b1); b1.setBackground(Color.GRAY); b2.addActionListener(this); a.add(b2); b2.setBackground(Color.GRAY); frame.pack(); frame.setVisible(true); } @Override public void actionPerformed(ActionEvent e) { if(e.getSource()==b1) { String uname = tf1.getText(); String pass = new String(tf2.getPassword()); if(uname.equals("gayatri@gmail.com") && pass.equals("Gayatri@123")) { JOptionPane.showMessageDialog(this,"Submited Successfully"); Notepad n=new Notepad(); } else { JOptionPane.showMessageDialog(this,"Incorrect login or password", "Error",JOptionPane.ERROR_MESSAGE); } } else if (e.getSource()==b2) { int result = JOptionPane.showConfirmDialog(this,"Sure? You want to exit?", "Swing Tester", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if(result == JOptionPane.YES_OPTION) { System.exit(0); } else { } } } public static void main(String[] args) { new Login(); } }
UTF-8
Java
2,993
java
Login.java
Java
[ { "context": "(tf2.getPassword());\n if(uname.equals(\"gayatri@gmail.com\") && pass.equals(\"Gayatri@123\"))\n {\n ", "end": 2120, "score": 0.9999194145202637, "start": 2103, "tag": "EMAIL", "value": "gayatri@gmail.com" }, { "context": "uname.equals(\"gayatri@gmail.com\") && pass.equals(\"Gayatri@123\"))\n {\n JOptionPane.show", "end": 2150, "score": 0.9992263317108154, "start": 2139, "tag": "PASSWORD", "value": "Gayatri@123" } ]
null
[]
package LoginForm; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; public class Login extends Component implements ActionListener { JLabel title,l1,l2; JTextField tf1; JPasswordField tf2; JButton b1,b2; Login() { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout( new BoxLayout(frame.getContentPane(), BoxLayout.Y_AXIS)); JPanel a = new JPanel(); a.setAlignmentX(Component.CENTER_ALIGNMENT); a.setPreferredSize(new Dimension(500, 500)); a.setMaximumSize(new Dimension(500, 500)); // set max = pref a.setBorder(BorderFactory.createTitledBorder("aa")); a.setBackground(Color.BLACK); frame.getContentPane().add(a); title= new JLabel("Login Form"); title.setForeground(Color.CYAN); title.setFont(new Font("Serif", Font.BOLD, 20)); l1=new JLabel("Enter Username :"); l2=new JLabel("Enter PassWord :"); tf1=new JTextField(10); tf2=new JPasswordField(10); b1=new JButton("Login"); b2=new JButton("Cancel"); title.setBounds(100, 30, 400, 30); l1.setBounds(60, 90, 400, 30); l2.setBounds(60, 130, 400, 30); tf1.setBounds(180, 90, 150, 30); tf2.setBounds(180, 130, 150, 30); b1.setBounds(100, 180, 80, 30); b2.setBounds(200, 180, 80, 30); a.add(title); a.add(l1); a.add(l2); a.add(tf1); a.add(tf2); b1.addActionListener(this); a.add(b1); b1.setBackground(Color.GRAY); b2.addActionListener(this); a.add(b2); b2.setBackground(Color.GRAY); frame.pack(); frame.setVisible(true); } @Override public void actionPerformed(ActionEvent e) { if(e.getSource()==b1) { String uname = tf1.getText(); String pass = new String(tf2.getPassword()); if(uname.equals("<EMAIL>") && pass.equals("<PASSWORD>")) { JOptionPane.showMessageDialog(this,"Submited Successfully"); Notepad n=new Notepad(); } else { JOptionPane.showMessageDialog(this,"Incorrect login or password", "Error",JOptionPane.ERROR_MESSAGE); } } else if (e.getSource()==b2) { int result = JOptionPane.showConfirmDialog(this,"Sure? You want to exit?", "Swing Tester", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if(result == JOptionPane.YES_OPTION) { System.exit(0); } else { } } } public static void main(String[] args) { new Login(); } }
2,982
0.550284
0.508854
106
27.226416
21.830948
102
false
false
0
0
0
0
0
0
0.877358
false
false
1
9bdd0a571f52a96f5dbefefd189e13ce076cf6a5
39,539,468,934,673
3e75c0b200ba8f919380c3b95c6642bfbe0504b9
/src/main/java/app/service/impl/UserServiceImpl.java
d158f1a63e11961dd07effcc670cbc1c51e5610b
[]
no_license
vitalygrishin27/Evaluation
https://github.com/vitalygrishin27/Evaluation
2967e616a2f7d8a9eeaaf8dda6d1e562845e36be
055c197db7820fb952066137df8099157158dec9
refs/heads/master
"2023-04-27T12:28:03.298000"
"2021-09-10T18:49:48"
"2021-09-10T18:49:48"
201,466,372
2
0
null
false
"2023-04-14T17:48:23"
"2019-08-09T12:48:51"
"2022-06-03T16:11:03"
"2023-04-14T17:48:23"
4,162
0
0
2
Java
false
false
package app.service.impl; import app.model.User; import app.repository.UserRepository; import app.service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service public class UserServiceImpl implements UserService { @Autowired private UserRepository repository; @Autowired private UserContactServiceImpl userContactService; @Override public void save(User user) { repository.saveAndFlush(user); } @Override public User findUserByLogin(String login) { return repository.findUserByLogin(login); } @Override public User findUserById(long id) { return repository.findUserById(id); } @Override public void delete(User user) { repository.delete(user); } @Override public List<User> findAllAdmins() { return repository.findAllAdmins(); } @Override public void update(User user) { userContactService.update(user.getUserContact()); repository.update(user.getLogin(), user.getEncrytedPassword(), user.getRole(), user.getUserId()); } @Override public List<User> findAllUsers() { return repository.findAll(); } @Override public List<User> findAllJuries() { return repository.findAllJuries(); } }
UTF-8
Java
1,381
java
UserServiceImpl.java
Java
[]
null
[]
package app.service.impl; import app.model.User; import app.repository.UserRepository; import app.service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service public class UserServiceImpl implements UserService { @Autowired private UserRepository repository; @Autowired private UserContactServiceImpl userContactService; @Override public void save(User user) { repository.saveAndFlush(user); } @Override public User findUserByLogin(String login) { return repository.findUserByLogin(login); } @Override public User findUserById(long id) { return repository.findUserById(id); } @Override public void delete(User user) { repository.delete(user); } @Override public List<User> findAllAdmins() { return repository.findAllAdmins(); } @Override public void update(User user) { userContactService.update(user.getUserContact()); repository.update(user.getLogin(), user.getEncrytedPassword(), user.getRole(), user.getUserId()); } @Override public List<User> findAllUsers() { return repository.findAll(); } @Override public List<User> findAllJuries() { return repository.findAllJuries(); } }
1,381
0.688631
0.688631
61
21.639345
21.450693
105
false
false
0
0
0
0
0
0
0.344262
false
false
1
e78c4c12c34a7a191a4b5882526ec7183ab0c219
39,487,929,330,714
77b7f3b87ef44182c5d0efd42ae1539a9b8ca14c
/src/generated/java/com/turnengine/client/api/local/action/ActionConditionDataSerializer.java
1d590830a2cda0ecf36fcd2f2583457a5b84fce8
[]
no_license
robindrew/turnengine-client-api
https://github.com/robindrew/turnengine-client-api
b4d9e767e9cc8401859758d83b43b0104bce7cd1
5bac91a449ad7f55201ecd64e034706b16578c36
refs/heads/master
"2023-03-16T05:59:14.189000"
"2023-03-08T14:09:24"
"2023-03-08T14:09:24"
232,931,212
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.turnengine.client.api.local.action; import com.robindrew.common.io.data.IDataReader; import com.robindrew.common.io.data.IDataWriter; import com.robindrew.common.io.data.serializer.ObjectSerializer; import com.robindrew.common.io.data.serializer.lang.EnumSerializer; import com.turnengine.client.api.local.creation.CreationConditionType; import java.io.IOException; public class ActionConditionDataSerializer extends ObjectSerializer<IActionCondition> { public ActionConditionDataSerializer() { super(false); } public ActionConditionDataSerializer(boolean nullable) { super(nullable); } @Override public IActionCondition readValue(IDataReader reader) throws IOException { int param1 = reader.readInt(); ActionTargetType param2 = reader.readObject(new EnumSerializer<ActionTargetType>(ActionTargetType.class, false)); ActionConditionExecute param3 = reader.readObject(new EnumSerializer<ActionConditionExecute>(ActionConditionExecute.class, false)); CreationConditionType param4 = reader.readObject(new EnumSerializer<CreationConditionType>(CreationConditionType.class, false)); int param5 = reader.readInt(); long param6 = reader.readLong(); int param7 = reader.readInt(); long param8 = reader.readLong(); int param9 = reader.readInt(); long param10 = reader.readLong(); boolean param11 = reader.readBoolean(); return new ActionCondition(param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11); } @Override public void writeValue(IDataWriter writer, IActionCondition object) throws IOException { writer.writeInt(object.getId()); writer.writeObject(object.getTarget(), new EnumSerializer<ActionTargetType>(ActionTargetType.class, false)); writer.writeObject(object.getExecute(), new EnumSerializer<ActionConditionExecute>(ActionConditionExecute.class, false)); writer.writeObject(object.getConditionType(), new EnumSerializer<CreationConditionType>(CreationConditionType.class, false)); writer.writeInt(object.getConditionId1()); writer.writeLong(object.getConditionAmount1()); writer.writeInt(object.getConditionId2()); writer.writeLong(object.getConditionAmount2()); writer.writeInt(object.getConditionId3()); writer.writeLong(object.getConditionAmount3()); writer.writeBoolean(object.getOptional()); } }
UTF-8
Java
2,318
java
ActionConditionDataSerializer.java
Java
[]
null
[]
package com.turnengine.client.api.local.action; import com.robindrew.common.io.data.IDataReader; import com.robindrew.common.io.data.IDataWriter; import com.robindrew.common.io.data.serializer.ObjectSerializer; import com.robindrew.common.io.data.serializer.lang.EnumSerializer; import com.turnengine.client.api.local.creation.CreationConditionType; import java.io.IOException; public class ActionConditionDataSerializer extends ObjectSerializer<IActionCondition> { public ActionConditionDataSerializer() { super(false); } public ActionConditionDataSerializer(boolean nullable) { super(nullable); } @Override public IActionCondition readValue(IDataReader reader) throws IOException { int param1 = reader.readInt(); ActionTargetType param2 = reader.readObject(new EnumSerializer<ActionTargetType>(ActionTargetType.class, false)); ActionConditionExecute param3 = reader.readObject(new EnumSerializer<ActionConditionExecute>(ActionConditionExecute.class, false)); CreationConditionType param4 = reader.readObject(new EnumSerializer<CreationConditionType>(CreationConditionType.class, false)); int param5 = reader.readInt(); long param6 = reader.readLong(); int param7 = reader.readInt(); long param8 = reader.readLong(); int param9 = reader.readInt(); long param10 = reader.readLong(); boolean param11 = reader.readBoolean(); return new ActionCondition(param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11); } @Override public void writeValue(IDataWriter writer, IActionCondition object) throws IOException { writer.writeInt(object.getId()); writer.writeObject(object.getTarget(), new EnumSerializer<ActionTargetType>(ActionTargetType.class, false)); writer.writeObject(object.getExecute(), new EnumSerializer<ActionConditionExecute>(ActionConditionExecute.class, false)); writer.writeObject(object.getConditionType(), new EnumSerializer<CreationConditionType>(CreationConditionType.class, false)); writer.writeInt(object.getConditionId1()); writer.writeLong(object.getConditionAmount1()); writer.writeInt(object.getConditionId2()); writer.writeLong(object.getConditionAmount2()); writer.writeInt(object.getConditionId3()); writer.writeLong(object.getConditionAmount3()); writer.writeBoolean(object.getOptional()); } }
2,318
0.802847
0.789042
50
45.360001
38.914143
133
false
false
0
0
0
0
0
0
2.24
false
false
1
7745a4143bcd95e43b075cecf8375a2a1486361b
26,199,300,553,676
2f45b99b684f62b2e9413a302a22a7677c22580c
/sdk/apigenerator/src/com/android/apigenerator/enumfix/AndroidJarReader.java
7669786e61a402d444d9f471286ec3cec3830bd4
[]
no_license
b2gdev/Android-JB-4.1.2
https://github.com/b2gdev/Android-JB-4.1.2
05e15a4668781cd9c9f63a1fa96bf08d9bdf91de
e66aea986bbf29ff70e5ec4440504ca24f8104e1
refs/heads/user
"2020-04-06T05:44:17.217000"
"2018-04-13T15:43:57"
"2018-04-13T15:43:57"
35,256,753
3
12
null
false
"2020-03-09T00:08:24"
"2015-05-08T03:32:21"
"2019-05-15T08:52:46"
"2018-04-13T15:45:31"
2,867,058
1
9
11
null
false
false
/* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.apigenerator.enumfix; import com.android.apigenerator.ApiClass; import org.objectweb.asm.ClassReader; import org.objectweb.asm.tree.ClassNode; import org.objectweb.asm.tree.FieldNode; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.net.MalformedURLException; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; /** * This codes looks at all the android.jar in an SDK and use ASM to figure out when enums * where introduced. This is a one time thing that creates the file * /com/android/apichecker/generator/enums.xml which is then used to create the final API file. * */ public class AndroidJarReader { // this the last API until we switched to a new API format that included enum values. private final static int MAX_API = 13; private static final byte[] BUFFER = new byte[65535]; private final String mSdkFolder; public AndroidJarReader(String sdkFolder) { mSdkFolder = sdkFolder; } public Map<String, ApiClass> getEnumClasses() { HashMap<String, ApiClass> map = new HashMap<String, ApiClass>(); // Get all the android.jar. They are in platforms-# for (int apiLevel = 1 ; apiLevel <= MAX_API ; apiLevel++) { try { File jar = new File(mSdkFolder, "platforms/android-" + apiLevel + "/android.jar"); if (jar.exists() == false) { System.err.println("Missing android.jar for API level " + apiLevel); continue; } FileInputStream fis = new FileInputStream(jar); ZipInputStream zis = new ZipInputStream(fis); ZipEntry entry = zis.getNextEntry(); while (entry != null) { String name = entry.getName(); if (name.endsWith(".class")) { int index = 0; do { int size = zis.read(BUFFER, index, BUFFER.length - index); if (size >= 0) { index += size; } else { break; } } while (true); byte[] b = new byte[index]; System.arraycopy(BUFFER, 0, b, 0, index); ClassReader reader = new ClassReader(b); ClassNode classNode = new ClassNode(); reader.accept(classNode, 0 /*flags*/); if (classNode != null && classNode.superName != null && classNode.superName.equals("java/lang/Enum")) { ApiClass theClass = addClass(map, classNode.name, apiLevel); theClass.addSuperClass("java/lang/Enum", apiLevel); List fields = classNode.fields; for (Object f : fields) { FieldNode fnode = (FieldNode) f; if (fnode.desc.substring(1, fnode.desc.length() - 1).equals(classNode.name)) { theClass.addField(fnode.name, apiLevel); } } } } entry = zis.getNextEntry(); } } catch (MalformedURLException e) { e.printStackTrace(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { } } return map; } private ApiClass addClass(HashMap<String, ApiClass> classes, String name, int apiLevel) { ApiClass theClass = classes.get(name); if (theClass == null) { theClass = new ApiClass(name, apiLevel); classes.put(name, theClass); } return theClass; } }
UTF-8
Java
4,833
java
AndroidJarReader.java
Java
[]
null
[]
/* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.apigenerator.enumfix; import com.android.apigenerator.ApiClass; import org.objectweb.asm.ClassReader; import org.objectweb.asm.tree.ClassNode; import org.objectweb.asm.tree.FieldNode; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.net.MalformedURLException; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; /** * This codes looks at all the android.jar in an SDK and use ASM to figure out when enums * where introduced. This is a one time thing that creates the file * /com/android/apichecker/generator/enums.xml which is then used to create the final API file. * */ public class AndroidJarReader { // this the last API until we switched to a new API format that included enum values. private final static int MAX_API = 13; private static final byte[] BUFFER = new byte[65535]; private final String mSdkFolder; public AndroidJarReader(String sdkFolder) { mSdkFolder = sdkFolder; } public Map<String, ApiClass> getEnumClasses() { HashMap<String, ApiClass> map = new HashMap<String, ApiClass>(); // Get all the android.jar. They are in platforms-# for (int apiLevel = 1 ; apiLevel <= MAX_API ; apiLevel++) { try { File jar = new File(mSdkFolder, "platforms/android-" + apiLevel + "/android.jar"); if (jar.exists() == false) { System.err.println("Missing android.jar for API level " + apiLevel); continue; } FileInputStream fis = new FileInputStream(jar); ZipInputStream zis = new ZipInputStream(fis); ZipEntry entry = zis.getNextEntry(); while (entry != null) { String name = entry.getName(); if (name.endsWith(".class")) { int index = 0; do { int size = zis.read(BUFFER, index, BUFFER.length - index); if (size >= 0) { index += size; } else { break; } } while (true); byte[] b = new byte[index]; System.arraycopy(BUFFER, 0, b, 0, index); ClassReader reader = new ClassReader(b); ClassNode classNode = new ClassNode(); reader.accept(classNode, 0 /*flags*/); if (classNode != null && classNode.superName != null && classNode.superName.equals("java/lang/Enum")) { ApiClass theClass = addClass(map, classNode.name, apiLevel); theClass.addSuperClass("java/lang/Enum", apiLevel); List fields = classNode.fields; for (Object f : fields) { FieldNode fnode = (FieldNode) f; if (fnode.desc.substring(1, fnode.desc.length() - 1).equals(classNode.name)) { theClass.addField(fnode.name, apiLevel); } } } } entry = zis.getNextEntry(); } } catch (MalformedURLException e) { e.printStackTrace(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { } } return map; } private ApiClass addClass(HashMap<String, ApiClass> classes, String name, int apiLevel) { ApiClass theClass = classes.get(name); if (theClass == null) { theClass = new ApiClass(name, apiLevel); classes.put(name, theClass); } return theClass; } }
4,833
0.547486
0.542727
132
35.613636
28.152897
110
false
false
0
0
0
0
0
0
0.598485
false
false
1
9be0d9018588a270671f49090d4f6919214af8cb
11,587,821,823,862
26f645d683350f765a610700473823b53eb0e091
/robozonky-app/src/test/java/com/github/triceo/robozonky/app/investing/StrategyExecutionTest.java
dd44d6af3d9d816b7503956e4d681ec6dbc977f2
[ "Apache-2.0" ]
permissive
sjahoda/robozonky
https://github.com/sjahoda/robozonky
de5ffed4285701d59ffddd80c83317447947cc66
39a91ca7a38d411453dc2dc26a9c515d538eb4a8
refs/heads/master
"2020-12-30T23:35:14.986000"
"2017-03-25T13:01:00"
"2017-03-25T13:01:00"
86,603,642
0
0
null
true
"2017-03-29T16:13:36"
"2017-03-29T16:13:36"
"2017-03-21T21:32:59"
"2017-03-25T14:40:50"
6,984
0
0
0
null
null
null
/* * Copyright 2017 Lukáš Petrovický * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.github.triceo.robozonky.app.investing; import java.math.BigDecimal; import java.util.Collections; import java.util.List; import com.github.triceo.robozonky.api.Refreshable; import com.github.triceo.robozonky.api.notifications.Event; import com.github.triceo.robozonky.api.remote.ZonkyApi; import com.github.triceo.robozonky.api.remote.entities.Loan; import com.github.triceo.robozonky.api.remote.entities.Wallet; import com.github.triceo.robozonky.api.strategies.InvestmentStrategy; import com.github.triceo.robozonky.api.strategies.LoanDescriptor; import org.assertj.core.api.Assertions; import org.junit.Rule; import org.junit.Test; import org.junit.contrib.java.lang.system.RestoreSystemProperties; import org.mockito.Mockito; public class StrategyExecutionTest extends AbstractInvestingTest { @Rule public final RestoreSystemProperties propertyRestore = new RestoreSystemProperties(); @Test public void getBalancePropertyInDryRun() { final int value = 200; System.setProperty("robozonky.default.dry_run_balance", String.valueOf(value)); final ZonkyProxy.Builder p = new ZonkyProxy.Builder().asDryRun(); Assertions.assertThat(StrategyExecution.getAvailableBalance(p.build(null)).intValue()).isEqualTo(value); } @Test public void getBalancePropertyIgnoredWhenNotDryRun() { System.setProperty("robozonky.default.dry_run_balance", "200"); final ZonkyApi api = Mockito.mock(ZonkyApi.class); Mockito.when(api.getWallet()).thenReturn(new Wallet(1, 2, BigDecimal.TEN, BigDecimal.ZERO)); final ZonkyProxy.Builder p = new ZonkyProxy.Builder(); Assertions.assertThat(StrategyExecution.getAvailableBalance(p.build(api))).isEqualTo(BigDecimal.ZERO); } @Test public void getRemoteBalanceInDryRun() { final ZonkyApi api = Mockito.mock(ZonkyApi.class); Mockito.when(api.getWallet()).thenReturn(new Wallet(1, 2, BigDecimal.TEN, BigDecimal.ZERO)); final ZonkyProxy.Builder p = new ZonkyProxy.Builder().asDryRun(); Assertions.assertThat(StrategyExecution.getAvailableBalance(p.build(api))).isEqualTo(BigDecimal.ZERO); } @Test public void empty() { final StrategyExecution exec = new StrategyExecution(null, null, null, null); Assertions.assertThat(exec.apply(Collections.emptyList())).isEmpty(); // check events final List<Event> events = this.getNewEvents(); Assertions.assertThat(events).isEmpty(); } @Test public void noStrategy() { final Loan loan = new Loan(1, 2); final LoanDescriptor ld = new LoanDescriptor(loan); final Refreshable<InvestmentStrategy> r = Refreshable.createImmutable(null); r.run(); final StrategyExecution exec = new StrategyExecution(null, null, r, null); Assertions.assertThat(exec.apply(Collections.singletonList(ld))).isEmpty(); // check events final List<Event> events = this.getNewEvents(); Assertions.assertThat(events).isEmpty(); } }
UTF-8
Java
3,663
java
StrategyExecutionTest.java
Java
[ { "context": "/*\n * Copyright 2017 Lukáš Petrovický\n *\n * Licensed under the Apache License, Version ", "end": 37, "score": 0.9998180866241455, "start": 21, "tag": "NAME", "value": "Lukáš Petrovický" } ]
null
[]
/* * Copyright 2017 <NAME> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.github.triceo.robozonky.app.investing; import java.math.BigDecimal; import java.util.Collections; import java.util.List; import com.github.triceo.robozonky.api.Refreshable; import com.github.triceo.robozonky.api.notifications.Event; import com.github.triceo.robozonky.api.remote.ZonkyApi; import com.github.triceo.robozonky.api.remote.entities.Loan; import com.github.triceo.robozonky.api.remote.entities.Wallet; import com.github.triceo.robozonky.api.strategies.InvestmentStrategy; import com.github.triceo.robozonky.api.strategies.LoanDescriptor; import org.assertj.core.api.Assertions; import org.junit.Rule; import org.junit.Test; import org.junit.contrib.java.lang.system.RestoreSystemProperties; import org.mockito.Mockito; public class StrategyExecutionTest extends AbstractInvestingTest { @Rule public final RestoreSystemProperties propertyRestore = new RestoreSystemProperties(); @Test public void getBalancePropertyInDryRun() { final int value = 200; System.setProperty("robozonky.default.dry_run_balance", String.valueOf(value)); final ZonkyProxy.Builder p = new ZonkyProxy.Builder().asDryRun(); Assertions.assertThat(StrategyExecution.getAvailableBalance(p.build(null)).intValue()).isEqualTo(value); } @Test public void getBalancePropertyIgnoredWhenNotDryRun() { System.setProperty("robozonky.default.dry_run_balance", "200"); final ZonkyApi api = Mockito.mock(ZonkyApi.class); Mockito.when(api.getWallet()).thenReturn(new Wallet(1, 2, BigDecimal.TEN, BigDecimal.ZERO)); final ZonkyProxy.Builder p = new ZonkyProxy.Builder(); Assertions.assertThat(StrategyExecution.getAvailableBalance(p.build(api))).isEqualTo(BigDecimal.ZERO); } @Test public void getRemoteBalanceInDryRun() { final ZonkyApi api = Mockito.mock(ZonkyApi.class); Mockito.when(api.getWallet()).thenReturn(new Wallet(1, 2, BigDecimal.TEN, BigDecimal.ZERO)); final ZonkyProxy.Builder p = new ZonkyProxy.Builder().asDryRun(); Assertions.assertThat(StrategyExecution.getAvailableBalance(p.build(api))).isEqualTo(BigDecimal.ZERO); } @Test public void empty() { final StrategyExecution exec = new StrategyExecution(null, null, null, null); Assertions.assertThat(exec.apply(Collections.emptyList())).isEmpty(); // check events final List<Event> events = this.getNewEvents(); Assertions.assertThat(events).isEmpty(); } @Test public void noStrategy() { final Loan loan = new Loan(1, 2); final LoanDescriptor ld = new LoanDescriptor(loan); final Refreshable<InvestmentStrategy> r = Refreshable.createImmutable(null); r.run(); final StrategyExecution exec = new StrategyExecution(null, null, r, null); Assertions.assertThat(exec.apply(Collections.singletonList(ld))).isEmpty(); // check events final List<Event> events = this.getNewEvents(); Assertions.assertThat(events).isEmpty(); } }
3,650
0.730055
0.72459
88
40.590908
32.3913
112
false
false
0
0
0
0
0
0
0.704545
false
false
1
49fd6efac9622b91e9e77ab1027f33684c757e50
32,435,593,050,733
34c52264358cf31dfbeabe24bf1b3c58da4b9214
/spring-rest-06/src/test/java/com/abouzidi/rest/service/impl/DefaultBookServiceTest.java
4b5a94bfd0e6c59eb34194de28f5e7db00c46c71
[]
no_license
AfifBouzidi/SPRING-REST
https://github.com/AfifBouzidi/SPRING-REST
21c1f257b33d7132700c5f997d709b0c1690082b
ce11604a48e2bf8e691f19b1ccf83a330862578e
refs/heads/master
"2021-03-31T00:25:21.256000"
"2018-03-12T09:38:04"
"2018-03-12T09:38:04"
124,612,539
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.abouzidi.rest.service.impl; import java.util.Optional; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mockito; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.TestConfiguration; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.annotation.Bean; import org.springframework.test.context.junit4.SpringRunner; import com.abouzidi.rest.domain.Book; import com.abouzidi.rest.dto.BookDTO; import com.abouzidi.rest.dto.BookRatingMapper; import com.abouzidi.rest.repository.BookRepository; import com.abouzidi.rest.service.BookService; @RunWith(SpringRunner.class) public class DefaultBookServiceTest { @TestConfiguration static class EmployeeServiceImplTestContextConfiguration { @Bean public BookService bookService() { return new DefaultBookService(); } } @Autowired private BookService bookService; @MockBean private BookRepository bookRepository; @MockBean private BookRatingMapper bookRatingMapper; @Before public void setUp() { Book book = new Book("Theory of relativity", "Albert Einstein"); BookDTO dto=new BookDTO(); dto.setAuthor("Albert Einstein"); dto.setTitle("Theory of relativity"); Mockito.when(bookRepository.findById(1l)).thenReturn(Optional.of(book)); Mockito.when(bookRatingMapper.asBookDTO(book)).thenReturn(dto); } @Test public void whenValidId_thenBookShouldBeFound() { BookDTO dto = bookService.findBookById(1l); Assert.assertEquals("Theory of relativity", dto.getTitle()); } }
UTF-8
Java
1,698
java
DefaultBookServiceTest.java
Java
[ { "context": "\r\n\t\tBook book = new Book(\"Theory of relativity\", \"Albert Einstein\");\r\n\t\tBookDTO dto=new BookDTO();\r\n\t\tdto.setAuthor", "end": 1256, "score": 0.9998533129692078, "start": 1241, "tag": "NAME", "value": "Albert Einstein" }, { "context": ";\r\n\t\tBookDTO dto=new BookDTO();\r\n\t\tdto.setAuthor(\"Albert Einstein\");\r\n\t\tdto.setTitle(\"Theory of relativity\");\r\n\t\tMo", "end": 1323, "score": 0.9998663663864136, "start": 1308, "tag": "NAME", "value": "Albert Einstein" } ]
null
[]
package com.abouzidi.rest.service.impl; import java.util.Optional; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mockito; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.TestConfiguration; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.annotation.Bean; import org.springframework.test.context.junit4.SpringRunner; import com.abouzidi.rest.domain.Book; import com.abouzidi.rest.dto.BookDTO; import com.abouzidi.rest.dto.BookRatingMapper; import com.abouzidi.rest.repository.BookRepository; import com.abouzidi.rest.service.BookService; @RunWith(SpringRunner.class) public class DefaultBookServiceTest { @TestConfiguration static class EmployeeServiceImplTestContextConfiguration { @Bean public BookService bookService() { return new DefaultBookService(); } } @Autowired private BookService bookService; @MockBean private BookRepository bookRepository; @MockBean private BookRatingMapper bookRatingMapper; @Before public void setUp() { Book book = new Book("Theory of relativity", "<NAME>"); BookDTO dto=new BookDTO(); dto.setAuthor("<NAME>"); dto.setTitle("Theory of relativity"); Mockito.when(bookRepository.findById(1l)).thenReturn(Optional.of(book)); Mockito.when(bookRatingMapper.asBookDTO(book)).thenReturn(dto); } @Test public void whenValidId_thenBookShouldBeFound() { BookDTO dto = bookService.findBookById(1l); Assert.assertEquals("Theory of relativity", dto.getTitle()); } }
1,680
0.769729
0.767962
58
27.275862
22.482784
74
false
false
0
0
0
0
0
0
1.224138
false
false
1
d1d7f6504f2596565548773a321e3e5ad161dd35
32,435,593,053,159
a64e1102c633adfd23dec0e2cbd699ab10e1c818
/contest/src/pers/whe/code/leetcode/context/Context106.java
76d6dbf3e80e2326400f037a7e57cacfebd9da7f
[]
no_license
worldgreen/leetcode
https://github.com/worldgreen/leetcode
c847ac31f8618832237dddb102329bdc8155d510
424f9dd3c43620f8d485cadb8ff713396e9ec6cd
refs/heads/master
"2021-07-07T09:18:36.482000"
"2020-07-22T04:03:54"
"2020-07-22T04:03:54"
137,228,695
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package pers.whe.code.leetcode.context; import java.util.ArrayList; import java.util.List; import java.util.PriorityQueue; import java.util.Queue; public class Context106 { /* * 922. Sort Array By Parity II * */ public int[] sortArrayByParityII(int[] a) { List<Integer> o = new ArrayList<>(); List<Integer> e = new ArrayList<>(); for (int i: a) { if (i % 2 == 0) { o.add(i); } else { e.add(i); } } int[] res = new int[a.length]; for (int i = 0; i < a.length; i++) { if (i % 2 == 0) { res[i] = o.get(i / 2); } else { res[i] = e.get(i / 2); } } return res; } /* * 921. Minimum Add to Make Parentheses Valid * */ public int minAddToMakeValid(String s) { int left = 0, right = 0; for (char c: s.toCharArray()) { if (c == '(') { left++; } else { if (left > 0) { left--; } else { right++; } } } return left + right; } /* * 923. 3Sum With Multiplicity * */ public int threeSumMulti(int[] A, int target) { long[] c = new long[101]; for (int a : A) c[a]++; long res = 0; for (int i = 0; i <= 100; i++) for (int j = 0; j <= 100; j++) { int k = target - i - j; if (k > 100 || k < 0) continue; if (i == j && j == k) res += c[i] * (c[i] - 1) * (c[i] - 2) / 6; else if (i == j && j != k) res += c[i] * (c[i] - 1) / 2 * c[k]; else if (i < j && j < k) res += c[i] * c[j] * c[k]; } return (int)(res % (1e9 + 7)); } }
UTF-8
Java
1,944
java
Context106.java
Java
[]
null
[]
package pers.whe.code.leetcode.context; import java.util.ArrayList; import java.util.List; import java.util.PriorityQueue; import java.util.Queue; public class Context106 { /* * 922. Sort Array By Parity II * */ public int[] sortArrayByParityII(int[] a) { List<Integer> o = new ArrayList<>(); List<Integer> e = new ArrayList<>(); for (int i: a) { if (i % 2 == 0) { o.add(i); } else { e.add(i); } } int[] res = new int[a.length]; for (int i = 0; i < a.length; i++) { if (i % 2 == 0) { res[i] = o.get(i / 2); } else { res[i] = e.get(i / 2); } } return res; } /* * 921. Minimum Add to Make Parentheses Valid * */ public int minAddToMakeValid(String s) { int left = 0, right = 0; for (char c: s.toCharArray()) { if (c == '(') { left++; } else { if (left > 0) { left--; } else { right++; } } } return left + right; } /* * 923. 3Sum With Multiplicity * */ public int threeSumMulti(int[] A, int target) { long[] c = new long[101]; for (int a : A) c[a]++; long res = 0; for (int i = 0; i <= 100; i++) for (int j = 0; j <= 100; j++) { int k = target - i - j; if (k > 100 || k < 0) continue; if (i == j && j == k) res += c[i] * (c[i] - 1) * (c[i] - 2) / 6; else if (i == j && j != k) res += c[i] * (c[i] - 1) / 2 * c[k]; else if (i < j && j < k) res += c[i] * c[j] * c[k]; } return (int)(res % (1e9 + 7)); } }
1,944
0.365741
0.341564
76
24.578947
16.032257
62
false
false
0
0
0
0
0
0
0.486842
false
false
1
c964e4496dc4545632672362abedf94ec2fc2c58
33,801,392,659,892
b05830f7aebfe581a94e532962d279609b0df646
/src/test/java/nl/han/ica/dea/cumali/datasources/DAOTest.java
521604fedbf5efaa83fcf880380b17e866b1b193
[]
no_license
cumalikarakoc/dea-spotitube
https://github.com/cumalikarakoc/dea-spotitube
448318db8345d510568a38e24a0685361b60f880
775859d1948f60547203da4e75b5395925912219
refs/heads/master
"2020-03-29T16:17:28.651000"
"2018-10-22T23:07:01"
"2018-10-22T23:07:01"
150,107,326
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package nl.han.ica.dea.cumali.datasources; import nl.han.ica.dea.cumali.datasources.util.DatabaseProperties; import nl.han.ica.dea.cumali.datasources.util.ScriptRunner; import java.io.IOException; import java.io.InputStreamReader; import java.sql.Connection; import java.sql.SQLException; public abstract class DAOTest { protected Connection connection; DAOTest (){ DatabaseProperties databaseProperties = new DatabaseProperties(); connection = databaseProperties.getConnection(); ScriptRunner scriptRunner = new ScriptRunner(connection, true, true); try { scriptRunner.runScript(new InputStreamReader(ClassLoader.getSystemResourceAsStream("import.sql"))); } catch (IOException | SQLException e) { e.printStackTrace(); } } }
UTF-8
Java
812
java
DAOTest.java
Java
[]
null
[]
package nl.han.ica.dea.cumali.datasources; import nl.han.ica.dea.cumali.datasources.util.DatabaseProperties; import nl.han.ica.dea.cumali.datasources.util.ScriptRunner; import java.io.IOException; import java.io.InputStreamReader; import java.sql.Connection; import java.sql.SQLException; public abstract class DAOTest { protected Connection connection; DAOTest (){ DatabaseProperties databaseProperties = new DatabaseProperties(); connection = databaseProperties.getConnection(); ScriptRunner scriptRunner = new ScriptRunner(connection, true, true); try { scriptRunner.runScript(new InputStreamReader(ClassLoader.getSystemResourceAsStream("import.sql"))); } catch (IOException | SQLException e) { e.printStackTrace(); } } }
812
0.729064
0.729064
23
34.304348
28.432123
111
false
false
0
0
0
0
0
0
0.695652
false
false
1
e62e9932fb63b0281f280ad82c760896d386cbe1
15,161,234,608,261
c888d71ae229fca990796b0249f80c6c46468be5
/src/main/java/com/saman/sso/business/transform/RefDataTransformer.java
703f611d4490530cc24f63dd9511e53f2000e2a8
[]
no_license
samanalishiri/oak-sso
https://github.com/samanalishiri/oak-sso
639c63b4139154198a9325a525487de7f0deea75
6affcad3ff6e2dda2e152d96b416a09ba21f6114
refs/heads/master
"2022-11-22T03:02:56.521000"
"2020-01-06T15:48:49"
"2020-01-06T15:48:49"
170,278,390
0
0
null
false
"2022-11-16T09:56:15"
"2019-02-12T08:12:43"
"2020-01-06T15:49:01"
"2022-11-16T09:56:12"
196
0
0
1
Java
false
false
package com.saman.sso.business.transform; import com.saman.sso.business.model.RefDataModel; import com.saman.sso.domain.refdata.RefDataEntity; public abstract class RefDataTransformer extends Transformer<Integer, RefDataEntity<Integer>, RefDataModel> { public static final String NAME = "clientTypeRefDataTransformer"; @Override public void transformFromEntityToModel(RefDataEntity<Integer> input, RefDataModel output, int deep, String... relations) { output.setId(input.getId()); output.setName(input.getName()); } @Override public void transformFromModelToEntity(RefDataModel input, RefDataEntity<Integer> output, int deep, String... relations) { output.setId(input.getId()); output.setName(input.getName()); } @Override public RefDataModel newModel() { return new RefDataModel(); } }
UTF-8
Java
874
java
RefDataTransformer.java
Java
[]
null
[]
package com.saman.sso.business.transform; import com.saman.sso.business.model.RefDataModel; import com.saman.sso.domain.refdata.RefDataEntity; public abstract class RefDataTransformer extends Transformer<Integer, RefDataEntity<Integer>, RefDataModel> { public static final String NAME = "clientTypeRefDataTransformer"; @Override public void transformFromEntityToModel(RefDataEntity<Integer> input, RefDataModel output, int deep, String... relations) { output.setId(input.getId()); output.setName(input.getName()); } @Override public void transformFromModelToEntity(RefDataModel input, RefDataEntity<Integer> output, int deep, String... relations) { output.setId(input.getId()); output.setName(input.getName()); } @Override public RefDataModel newModel() { return new RefDataModel(); } }
874
0.7254
0.7254
27
31.370371
37.134537
126
false
false
0
0
0
0
0
0
0.62963
false
false
1
896b7e89240a74933c182ded56d9652ffaf77492
7,026,566,548,753
b6a32e5c8b8c2b83b3a7d4dbff2fed58da72a94d
/practice-zmq/src/test/java/guide/lpserver.java
d66a54c079a7e08dc391d3dd7832a27ae769073c
[]
no_license
zhangbaitong/practice
https://github.com/zhangbaitong/practice
aec0e35cad8e7af7606a95fb23a2a33fc3ea0ccd
85b033b2197c0786ec3873cde645684d71a4d5ed
refs/heads/master
"2022-12-23T11:50:03.324000"
"2017-01-07T07:58:26"
"2017-01-07T07:58:26"
14,135,404
2
1
null
false
"2022-12-16T03:39:40"
"2013-11-05T07:56:39"
"2018-08-11T01:18:26"
"2022-12-16T03:39:37"
9,682
1
1
32
JavaScript
false
false
package guide; import java.util.Random; import org.zeromq.ZMQ; import org.zeromq.ZMQ.Context; import org.zeromq.ZMQ.Socket; // // Lazy Pirate server // Binds REQ socket to tcp://*:5555 // Like hwserver except: // - echoes request as-is // - randomly runs slowly, or exits to simulate a crash. // public class lpserver { public static void main(String[] argv) throws Exception { Random rand = new Random(System.nanoTime()); Context context = ZMQ.context(1); Socket server = context.socket(ZMQ.REP); server.bind("tcp://*:5555"); int cycles = 0; while (true) { String request = server.recvStr(); cycles++; // Simulate various problems, after a few cycles if (cycles > 3 && rand.nextInt(3) == 0) { System.out.println("I: simulating a crash"); break; } else if (cycles > 3 && rand.nextInt(3) == 0) { System.out.println("I: simulating CPU overload"); Thread.sleep(2000); } System.out.printf("I: normal request (%s)\n", request); Thread.sleep(1000); // Do some heavy work server.send(request); } server.close(); context.term(); } }
UTF-8
Java
1,305
java
lpserver.java
Java
[]
null
[]
package guide; import java.util.Random; import org.zeromq.ZMQ; import org.zeromq.ZMQ.Context; import org.zeromq.ZMQ.Socket; // // Lazy Pirate server // Binds REQ socket to tcp://*:5555 // Like hwserver except: // - echoes request as-is // - randomly runs slowly, or exits to simulate a crash. // public class lpserver { public static void main(String[] argv) throws Exception { Random rand = new Random(System.nanoTime()); Context context = ZMQ.context(1); Socket server = context.socket(ZMQ.REP); server.bind("tcp://*:5555"); int cycles = 0; while (true) { String request = server.recvStr(); cycles++; // Simulate various problems, after a few cycles if (cycles > 3 && rand.nextInt(3) == 0) { System.out.println("I: simulating a crash"); break; } else if (cycles > 3 && rand.nextInt(3) == 0) { System.out.println("I: simulating CPU overload"); Thread.sleep(2000); } System.out.printf("I: normal request (%s)\n", request); Thread.sleep(1000); // Do some heavy work server.send(request); } server.close(); context.term(); } }
1,305
0.550958
0.532567
47
26.765957
21.668894
67
false
false
0
0
0
0
0
0
0.510638
false
false
1
c95e92f27ed4d6e1957afffcd1c2ed1a26b4c2b7
38,053,410,251,188
c3cf33e7b9fe20ff3124edcfc39f08fa982b2713
/pocs/cloudwatch-custom-metrics-superfun/src/main/java/Main.java
bb270523afe99fdc9b33344f7dc4372996d5947b
[ "Unlicense" ]
permissive
diegopacheco/java-pocs
https://github.com/diegopacheco/java-pocs
d9daa5674921d8b0d6607a30714c705c9cd4c065
2d6cc1de9ff26e4c0358659b7911d2279d4008e1
refs/heads/master
"2023-08-30T18:36:34.626000"
"2023-08-29T07:34:36"
"2023-08-29T07:34:36"
107,281,823
47
57
Unlicense
false
"2022-03-23T07:24:08"
"2017-10-17T14:42:26"
"2022-03-19T22:08:25"
"2022-03-23T07:19:42"
35,118
33
28
0
Java
false
false
import com.github.diegopacheco.cw.custom.metrics.CWMetricsPublisher; import com.github.diegopacheco.cw.custom.metrics.MetricsPublisher; import com.github.diegopacheco.cw.custom.metrics.TagManager; import java.util.HashMap; import java.util.Map; import java.util.UUID; public class Main{ public static void main(String args[]){ TagManager.enableTestMode(); Map<String, String> tags = new HashMap<String, String>() {{ put("id", UUID.randomUUID().toString()); put("tier", "Backend"); put("owner", "team-1234"); }}; MetricsPublisher mp = new CWMetricsPublisher(); mp.publish("test1",43D,tags); mp.publish("test2",43D,tags); System.out.println("done"); } }
UTF-8
Java
711
java
Main.java
Java
[ { "context": "import com.github.diegopacheco.cw.custom.metrics.CWMetricsPublisher;\nimport com.", "end": 30, "score": 0.9990684986114502, "start": 18, "tag": "USERNAME", "value": "diegopacheco" }, { "context": "tom.metrics.CWMetricsPublisher;\nimport com.github.diegopacheco.cw.custom.metrics.MetricsPublisher;\nimport com.gi", "end": 99, "score": 0.9992153644561768, "start": 87, "tag": "USERNAME", "value": "diegopacheco" }, { "context": "ustom.metrics.MetricsPublisher;\nimport com.github.diegopacheco.cw.custom.metrics.TagManager;\n\nimport java.util.H", "end": 166, "score": 0.9992274045944214, "start": 154, "tag": "USERNAME", "value": "diegopacheco" }, { "context": " put(\"tier\", \"Backend\");\n put(\"owner\", \"team-1234\");\n }};\n\n MetricsPublisher mp = new CWMetri", "end": 540, "score": 0.9967862963676453, "start": 531, "tag": "USERNAME", "value": "team-1234" } ]
null
[]
import com.github.diegopacheco.cw.custom.metrics.CWMetricsPublisher; import com.github.diegopacheco.cw.custom.metrics.MetricsPublisher; import com.github.diegopacheco.cw.custom.metrics.TagManager; import java.util.HashMap; import java.util.Map; import java.util.UUID; public class Main{ public static void main(String args[]){ TagManager.enableTestMode(); Map<String, String> tags = new HashMap<String, String>() {{ put("id", UUID.randomUUID().toString()); put("tier", "Backend"); put("owner", "team-1234"); }}; MetricsPublisher mp = new CWMetricsPublisher(); mp.publish("test1",43D,tags); mp.publish("test2",43D,tags); System.out.println("done"); } }
711
0.694796
0.680731
26
26.346153
21.950893
68
false
false
0
0
0
0
0
0
0.923077
false
false
1
3e99c7e209c5a650a1345f059c30dfdd1cc952b8
24,146,306,185,184
94911dc93dec93bb708799f6019d23c2c12c7bdd
/ProyectoFinal_Riteen/src/Riteen/WinCrearUsuario.java
a0c564fee636e52873e1d950751b3dbecbb04249
[]
no_license
harimtg/ProyectoFinal_Riteen
https://github.com/harimtg/ProyectoFinal_Riteen
7c145ada317755f2b1d0d1c2a468173618cf9bc7
4bc07046442eae80c693a14e91bc5ed76eca730f
refs/heads/master
"2021-01-20T23:16:53.373000"
"2012-12-05T02:14:35"
"2012-12-05T02:14:35"
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package Riteen; import java.awt.BorderLayout; import java.awt.event.KeyEvent; import java.sql.PreparedStatement; import java.sql.SQLException; import javax.swing.JOptionPane; /** * * @author Dioni Ripoll */ public class WinCrearUsuario extends javax.swing.JDialog { /** * Creates new form crearUsuario */ public WinCrearUsuario(java.awt.Frame parent, boolean modal) { super(parent, modal); initComponents(); PanelCliente pc = new PanelCliente(); this.add(pc, BorderLayout.CENTER); this.setLocationRelativeTo(null); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); guardarUsuarioNuevo = new javax.swing.JButton(); cancelar = new javax.swing.JButton(); usuarioText = new javax.swing.JTextField(); contraseñaText = new javax.swing.JPasswordField(); confirmarContraseñaText = new javax.swing.JPasswordField(); setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE); setTitle("Riteen - Crear Usuario"); setModal(true); setResizable(false); jLabel1.setFont(new java.awt.Font("Century Gothic", 0, 24)); // NOI18N jLabel1.setForeground(new java.awt.Color(153, 153, 153)); jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel1.setText("Usuario"); jLabel2.setFont(new java.awt.Font("Times New Roman", 0, 18)); // NOI18N jLabel2.setForeground(new java.awt.Color(153, 153, 153)); jLabel2.setText("Nombre de Usuario:"); jLabel3.setFont(new java.awt.Font("Times New Roman", 0, 18)); // NOI18N jLabel3.setForeground(new java.awt.Color(153, 153, 153)); jLabel3.setText("Contraseña:"); jLabel4.setFont(new java.awt.Font("Times New Roman", 0, 18)); // NOI18N jLabel4.setForeground(new java.awt.Color(153, 153, 153)); jLabel4.setText("Confirmar Contraseña:"); guardarUsuarioNuevo.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N guardarUsuarioNuevo.setText("Guardar"); guardarUsuarioNuevo.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { guardarUsuarioNuevoActionPerformed(evt); } }); cancelar.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N cancelar.setText("Cancelar"); cancelar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cancelarActionPerformed(evt); } }); confirmarContraseñaText.addKeyListener(new java.awt.event.KeyAdapter() { public void keyTyped(java.awt.event.KeyEvent evt) { confirmarContraseñaTextKeyTyped(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(36, 36, 36) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(layout.createSequentialGroup() .addComponent(jLabel4) .addGap(18, 18, 18) .addComponent(confirmarContraseñaText, javax.swing.GroupLayout.PREFERRED_SIZE, 171, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel2) .addComponent(jLabel3)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(contraseñaText, javax.swing.GroupLayout.DEFAULT_SIZE, 171, Short.MAX_VALUE) .addComponent(usuarioText))))) .addGroup(layout.createSequentialGroup() .addGap(98, 98, 98) .addComponent(guardarUsuarioNuevo) .addGap(34, 34, 34) .addComponent(cancelar))) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(26, 26, 26) .addComponent(jLabel1) .addGap(25, 25, 25) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(usuarioText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(27, 27, 27) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3) .addComponent(contraseñaText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(28, 28, 28) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel4) .addComponent(confirmarContraseñaText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 39, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(guardarUsuarioNuevo) .addComponent(cancelar)) .addContainerGap()) ); pack(); }// </editor-fold>//GEN-END:initComponents private void cancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelarActionPerformed this.dispose(); }//GEN-LAST:event_cancelarActionPerformed int casoCliente=0; String idCliente; private PreparedStatement add; private void guardarUsuarioNuevoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_guardarUsuarioNuevoActionPerformed guardar(); }//GEN-LAST:event_guardarUsuarioNuevoActionPerformed private void confirmarContraseñaTextKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_confirmarContraseñaTextKeyTyped int enter = evt.getKeyChar(); if (enter == KeyEvent.VK_ENTER) { guardar(); } }//GEN-LAST:event_confirmarContraseñaTextKeyTyped public void guardar(){ String text = contraseñaText.getText(); String text2 = confirmarContraseñaText.getText(); if(text.isEmpty() && text2.isEmpty()){ JOptionPane.showMessageDialog(this, "Favor digite su Contraseña", "Contraseña", JOptionPane.INFORMATION_MESSAGE); } else if(text.isEmpty()){ JOptionPane.showMessageDialog(this, "Digite una Contraseña", "Sin Contraseña", JOptionPane.INFORMATION_MESSAGE); } else if(text2.isEmpty()){ JOptionPane.showMessageDialog(this, "Favor confimar su Contraseña", "Confirmación Contraseña", JOptionPane.INFORMATION_MESSAGE); } if(!text.equals(text2)){ JOptionPane.showMessageDialog(this, "La contraseña no es igual"); contraseñaText.setText(""); confirmarContraseñaText.setText(""); } else{ try{ add = Conexion.getInstancia().getConexion().prepareStatement("INSERT INTO usuarios (userName, pass, activo) VALUES ( ?, ?, ?)"); add.setString(1, usuarioText.getText().toUpperCase()); add.setString(2, contraseñaText.getText().toUpperCase()); add.setInt(3, 0); int exitoso = add.executeUpdate(); if (exitoso == 1){ JOptionPane.showMessageDialog(null, "Registro Exitoso"); usuarioText.setText(""); contraseñaText.setText(""); } else { JOptionPane.showMessageDialog(null, "No se puede registrar el cliente"); } this.dispose(); } catch (SQLException ex ) { JOptionPane.showMessageDialog(this, ex.getMessage()); } } } /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(WinCrearUsuario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(WinCrearUsuario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(WinCrearUsuario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(WinCrearUsuario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the dialog */ java.awt.EventQueue.invokeLater(new Runnable() { @Override public void run() { WinCrearUsuario dialog = new WinCrearUsuario(new javax.swing.JFrame(), true); dialog.addWindowListener(new java.awt.event.WindowAdapter() { @Override public void windowClosing(java.awt.event.WindowEvent e) { System.exit(0); } }); dialog.setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton cancelar; private javax.swing.JPasswordField confirmarContraseñaText; private javax.swing.JPasswordField contraseñaText; private javax.swing.JButton guardarUsuarioNuevo; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JTextField usuarioText; // End of variables declaration//GEN-END:variables }
UTF-8
Java
13,183
java
WinCrearUsuario.java
Java
[ { "context": "rt javax.swing.JOptionPane;\r\n\r\n/**\r\n *\r\n * @author Dioni Ripoll\r\n */\r\npublic class WinCrearUsuario extends javax.sw", "end": 321, "score": 0.9595795273780823, "start": 309, "tag": "NAME", "value": "Dioni Ripoll" }, { "context": "onexion().prepareStatement(\"INSERT INTO usuarios (userName, pass, activo) VALUES ( ?, ?, ?)\");\r\n ", "end": 9473, "score": 0.8098059892654419, "start": 9465, "tag": "USERNAME", "value": "userName" } ]
null
[]
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package Riteen; import java.awt.BorderLayout; import java.awt.event.KeyEvent; import java.sql.PreparedStatement; import java.sql.SQLException; import javax.swing.JOptionPane; /** * * @author <NAME> */ public class WinCrearUsuario extends javax.swing.JDialog { /** * Creates new form crearUsuario */ public WinCrearUsuario(java.awt.Frame parent, boolean modal) { super(parent, modal); initComponents(); PanelCliente pc = new PanelCliente(); this.add(pc, BorderLayout.CENTER); this.setLocationRelativeTo(null); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); guardarUsuarioNuevo = new javax.swing.JButton(); cancelar = new javax.swing.JButton(); usuarioText = new javax.swing.JTextField(); contraseñaText = new javax.swing.JPasswordField(); confirmarContraseñaText = new javax.swing.JPasswordField(); setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE); setTitle("Riteen - Crear Usuario"); setModal(true); setResizable(false); jLabel1.setFont(new java.awt.Font("Century Gothic", 0, 24)); // NOI18N jLabel1.setForeground(new java.awt.Color(153, 153, 153)); jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel1.setText("Usuario"); jLabel2.setFont(new java.awt.Font("Times New Roman", 0, 18)); // NOI18N jLabel2.setForeground(new java.awt.Color(153, 153, 153)); jLabel2.setText("Nombre de Usuario:"); jLabel3.setFont(new java.awt.Font("Times New Roman", 0, 18)); // NOI18N jLabel3.setForeground(new java.awt.Color(153, 153, 153)); jLabel3.setText("Contraseña:"); jLabel4.setFont(new java.awt.Font("Times New Roman", 0, 18)); // NOI18N jLabel4.setForeground(new java.awt.Color(153, 153, 153)); jLabel4.setText("Confirmar Contraseña:"); guardarUsuarioNuevo.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N guardarUsuarioNuevo.setText("Guardar"); guardarUsuarioNuevo.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { guardarUsuarioNuevoActionPerformed(evt); } }); cancelar.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N cancelar.setText("Cancelar"); cancelar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cancelarActionPerformed(evt); } }); confirmarContraseñaText.addKeyListener(new java.awt.event.KeyAdapter() { public void keyTyped(java.awt.event.KeyEvent evt) { confirmarContraseñaTextKeyTyped(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(36, 36, 36) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(layout.createSequentialGroup() .addComponent(jLabel4) .addGap(18, 18, 18) .addComponent(confirmarContraseñaText, javax.swing.GroupLayout.PREFERRED_SIZE, 171, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel2) .addComponent(jLabel3)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(contraseñaText, javax.swing.GroupLayout.DEFAULT_SIZE, 171, Short.MAX_VALUE) .addComponent(usuarioText))))) .addGroup(layout.createSequentialGroup() .addGap(98, 98, 98) .addComponent(guardarUsuarioNuevo) .addGap(34, 34, 34) .addComponent(cancelar))) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(26, 26, 26) .addComponent(jLabel1) .addGap(25, 25, 25) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(usuarioText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(27, 27, 27) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3) .addComponent(contraseñaText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(28, 28, 28) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel4) .addComponent(confirmarContraseñaText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 39, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(guardarUsuarioNuevo) .addComponent(cancelar)) .addContainerGap()) ); pack(); }// </editor-fold>//GEN-END:initComponents private void cancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelarActionPerformed this.dispose(); }//GEN-LAST:event_cancelarActionPerformed int casoCliente=0; String idCliente; private PreparedStatement add; private void guardarUsuarioNuevoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_guardarUsuarioNuevoActionPerformed guardar(); }//GEN-LAST:event_guardarUsuarioNuevoActionPerformed private void confirmarContraseñaTextKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_confirmarContraseñaTextKeyTyped int enter = evt.getKeyChar(); if (enter == KeyEvent.VK_ENTER) { guardar(); } }//GEN-LAST:event_confirmarContraseñaTextKeyTyped public void guardar(){ String text = contraseñaText.getText(); String text2 = confirmarContraseñaText.getText(); if(text.isEmpty() && text2.isEmpty()){ JOptionPane.showMessageDialog(this, "Favor digite su Contraseña", "Contraseña", JOptionPane.INFORMATION_MESSAGE); } else if(text.isEmpty()){ JOptionPane.showMessageDialog(this, "Digite una Contraseña", "Sin Contraseña", JOptionPane.INFORMATION_MESSAGE); } else if(text2.isEmpty()){ JOptionPane.showMessageDialog(this, "Favor confimar su Contraseña", "Confirmación Contraseña", JOptionPane.INFORMATION_MESSAGE); } if(!text.equals(text2)){ JOptionPane.showMessageDialog(this, "La contraseña no es igual"); contraseñaText.setText(""); confirmarContraseñaText.setText(""); } else{ try{ add = Conexion.getInstancia().getConexion().prepareStatement("INSERT INTO usuarios (userName, pass, activo) VALUES ( ?, ?, ?)"); add.setString(1, usuarioText.getText().toUpperCase()); add.setString(2, contraseñaText.getText().toUpperCase()); add.setInt(3, 0); int exitoso = add.executeUpdate(); if (exitoso == 1){ JOptionPane.showMessageDialog(null, "Registro Exitoso"); usuarioText.setText(""); contraseñaText.setText(""); } else { JOptionPane.showMessageDialog(null, "No se puede registrar el cliente"); } this.dispose(); } catch (SQLException ex ) { JOptionPane.showMessageDialog(this, ex.getMessage()); } } } /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(WinCrearUsuario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(WinCrearUsuario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(WinCrearUsuario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(WinCrearUsuario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the dialog */ java.awt.EventQueue.invokeLater(new Runnable() { @Override public void run() { WinCrearUsuario dialog = new WinCrearUsuario(new javax.swing.JFrame(), true); dialog.addWindowListener(new java.awt.event.WindowAdapter() { @Override public void windowClosing(java.awt.event.WindowEvent e) { System.exit(0); } }); dialog.setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton cancelar; private javax.swing.JPasswordField confirmarContraseñaText; private javax.swing.JPasswordField contraseñaText; private javax.swing.JButton guardarUsuarioNuevo; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JTextField usuarioText; // End of variables declaration//GEN-END:variables }
13,177
0.600654
0.588262
270
46.718517
37.605389
177
false
false
0
0
0
0
0
0
0.718518
false
false
1
4019748c9340686d1ab6ad2ed595ebc4374d3f63
35,373,350,687,591
7680aeb6f849e6e7e27862f3d4e15860c63b00c6
/Chapter11/src/main/java/com/ssm/chapter11/multi/config/MultiConfig.java
a5c35aaa364c3fdf7ac6d429e6cf58fd3cc53cbc
[ "Apache-2.0" ]
permissive
SuperSurfing/MySSM
https://github.com/SuperSurfing/MySSM
2f518a769b43fffab7125473f44f8e9ee9dd607b
491ec52650ced74c6e2b9e8b754106ee410734cf
refs/heads/master
"2022-12-26T01:13:52.431000"
"2020-02-16T06:37:43"
"2020-02-16T06:37:43"
236,705,116
0
0
Apache-2.0
false
"2022-12-16T07:52:25"
"2020-01-28T10:04:18"
"2020-02-16T06:38:10"
"2022-12-16T07:52:22"
146
0
0
41
Java
false
false
package com.ssm.chapter11.multi.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.EnableAspectJAutoProxy; import com.ssm.chapter11.multi.aspect.Aspect1; import com.ssm.chapter11.multi.aspect.Aspect2; import com.ssm.chapter11.multi.aspect.Aspect3; @Configuration @EnableAspectJAutoProxy @ComponentScan("com.ssm.chapter11.multi") public class MultiConfig { @Bean public Aspect1 getAspect1() { return new Aspect1(); } @Bean public Aspect2 getAspect2() { return new Aspect2(); } @Bean public Aspect3 getAspect3() { return new Aspect3(); } }
UTF-8
Java
772
java
MultiConfig.java
Java
[]
null
[]
package com.ssm.chapter11.multi.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.EnableAspectJAutoProxy; import com.ssm.chapter11.multi.aspect.Aspect1; import com.ssm.chapter11.multi.aspect.Aspect2; import com.ssm.chapter11.multi.aspect.Aspect3; @Configuration @EnableAspectJAutoProxy @ComponentScan("com.ssm.chapter11.multi") public class MultiConfig { @Bean public Aspect1 getAspect1() { return new Aspect1(); } @Bean public Aspect2 getAspect2() { return new Aspect2(); } @Bean public Aspect3 getAspect3() { return new Aspect3(); } }
772
0.757772
0.729275
30
24.766666
20.89447
69
false
false
0
0
0
0
0
0
0.533333
false
false
1
740096f6725b99949cc0afba7609be6f69a698cb
13,554,916,798,586
6012413ae3e02c5599826298a9440cac8056ead4
/src/Cappuccino/Score4/Player.java
c2be8297fe8a5fd296c9d60fadc371e79443b5fd
[]
no_license
tjleary/cpscscore4
https://github.com/tjleary/cpscscore4
ed8313cae1d7eaef9d8f67e83e7d91aebb9aead1
8caf1c13698b926147b13b30629ea5e6753fcd43
refs/heads/master
"2020-02-15T20:56:08.690000"
"2018-03-21T18:21:00"
"2018-03-21T18:21:00"
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Cappuccino.Score4; import ca.unbc.cpsc.cappuccino.BeadColour; public class Player { private static BeadColour myColour = null; //only holds player. peg does the actual placing. Player() { } static BeadColour getColour() { return myColour; }//gets colour static void setColour(BeadColour colour) { myColour = colour; }//sets colour }
UTF-8
Java
392
java
Player.java
Java
[]
null
[]
package Cappuccino.Score4; import ca.unbc.cpsc.cappuccino.BeadColour; public class Player { private static BeadColour myColour = null; //only holds player. peg does the actual placing. Player() { } static BeadColour getColour() { return myColour; }//gets colour static void setColour(BeadColour colour) { myColour = colour; }//sets colour }
392
0.670918
0.668367
19
19.578947
23.256727
96
false
false
0
0
0
0
0
0
0.263158
false
false
1
513b4fff50f3c2395004d8b1b673e5a4412ced35
33,870,112,106,042
fb52df7f41fa7d8056956868b852ee6e89aaffb2
/NightgamesMod/nightgames/skills/TailSuck.java
3509cc9fa80283204dc40c0fc7132309db00e4fd
[]
no_license
in-proto/nightgamesmod
https://github.com/in-proto/nightgamesmod
e622acdf5960d8ba7f7afdc614f5100df582f602
9056ad3b175dfd228bfd8ee3cd8c0a17925acbd7
refs/heads/master
"2020-05-29T08:58:13.511000"
"2020-03-21T23:04:11"
"2020-03-21T23:10:03"
54,727,761
4
3
null
true
"2016-03-25T15:28:38"
"2016-03-25T15:28:37"
"2016-01-13T03:47:04"
"2016-02-29T04:26:04"
10,166
0
0
0
null
null
null
package nightgames.skills; import nightgames.characters.Attribute; import nightgames.characters.Character; import nightgames.characters.Emotion; import nightgames.characters.Trait; import nightgames.characters.body.BallsPart; import nightgames.characters.body.TailPart; import nightgames.combat.Combat; import nightgames.combat.Result; import nightgames.global.Global; import nightgames.skills.damage.DamageType; import nightgames.status.Drained; import nightgames.status.TailSucked; public class TailSuck extends Skill { public TailSuck(Character self) { super("Tail Suck", self); } @Override public boolean requirements(Combat c, Character user, Character target) { return user.get(Attribute.Seduction) >= 20 && user.get(Attribute.Dark) >= 15 && user.has(Trait.energydrain) && user.body.getRandom(TailPart.TYPE) != null; } @Override public boolean usable(Combat c, Character target) { return getSelf().canAct() && target.hasDick() && target.body.getRandomCock().isReady(target) && target.crotchAvailable() && c.getStance().mobile(getSelf()) && !c.getStance().mobile(target) && !c.getStance().inserted(target); } @Override public String describe(Combat c) { return "Use your tail to draw in your target's energies"; } @Override public int accuracy(Combat c, Character target) { return c.getStance().isPartFuckingPartInserted(c, target, target.body.getRandomCock(), getSelf(), getSelf().body.getRandom(TailPart.TYPE)) ? 200 : 90; } @Override public boolean resolve(Combat c, Character target) { if (c.getStance().isPartFuckingPartInserted(c, target, target.body.getRandomCock(), getSelf(), getSelf().body.getRandom(TailPart.TYPE))) { writeOutput(c, Result.special, target); target.body.pleasure(getSelf(), getSelf().body.getRandom(TailPart.TYPE), target.body.getRandomCock(), Global.random(10) + 10, c, this); drain(c, target); } else if (getSelf().roll(getSelf(), c, accuracy(c, target))) { Result res = c.getStance().isBeingFaceSatBy(c, target, getSelf()) ? Result.critical : Result.normal; writeOutput(c, res, target); target.body.pleasure(getSelf(), getSelf().body.getRandom(TailPart.TYPE), target.body.getRandomCock(), Global.random(10) + 10, c, this); drain(c, target); target.add(c, new TailSucked(target, getSelf(), power())); } else if (target.hasBalls()) { writeOutput(c, Result.weak, target); target.body.pleasure(getSelf(), getSelf().body.getRandom(TailPart.TYPE), target.body.getRandom( BallsPart.TYPE), Global.random(5) + 5, c, this); return true; } else { writeOutput(c, Result.miss, target); } return true; } @Override public Skill copy(Character user) { return new TailSuck(user); } @Override public Tactics type(Combat c) { return Tactics.pleasure; } @Override public String deal(Combat c, int damage, Result modifier, Character target) { if (modifier == Result.special) { return String.format( "Flexing a few choice muscles, you provide extra stimulation" + " to %s trapped %s, drawing in further gouts of %s energy.", target.nameOrPossessivePronoun(), target.body.getRandomCock().describe(target), target.possessiveAdjective()); } else if (modifier == Result.normal) { return String.format( "You open up the special mouth at the end of your" + " tail and aim it at %s %s. Flashing %s a confident smile, you launch" + " it forward, engulfing the shaft completely. You take a long, deep breath," + " and you feel life flowing in from your tail as well as through" + " your nose.", target.nameOrPossessivePronoun(), target.body.getRandomCock().describe(target), target.objectPronoun()); } else if (modifier == Result.critical) { return String.format( "Making sure %s view is blocked, you swing your tail out in front of you, hovering over" + " %s %s. Then, you open up the mouth at its tip and carefully lower it over the hard shaft." + " Amusingly, %s does not seem to understand %s predicament, but as soon as you <i>breathe</i>" + " in %s quickly catches on. The flow of energy through your tail makes you shudder atop" + " %s face.", target.nameOrPossessivePronoun(), target.possessiveAdjective(), target.body.getRandomCock().describe(target), target.subject(), target.possessiveAdjective(), target.pronoun(), target.possessiveAdjective()); } else if (modifier == Result.weak) { return String.format( "You shoot out your tail towards %s unprotected groin, but %s" + " twists away slightly causing you to just miss %s %s. Instead, your tail" + " latches onto %s balls. You can't do much with those in this way, so" + " after a little fondling you let go.", target.nameOrPossessivePronoun(), target.pronoun(), target.possessiveAdjective(), target.body.getRandomCock().describe(target), target.possessiveAdjective()); } else { return String.format( "You shoot out your tail towards %s unprotected groin, but %s" + " twists away slightly causing you to just miss %s %s.", target.nameOrPossessivePronoun(), target.pronoun(), target.possessiveAdjective(), target.body.getRandomCock().describe(target)); } } @Override public String receive(Combat c, int damage, Result modifier, Character target) { if (modifier == Result.special) { return String.format( "%s twists and turns %s tail with renewed vigor," + " stealing more of %s energy in the process.", getSelf().getName(), getSelf().possessiveAdjective(), target.nameOrPossessivePronoun()); } else if (modifier == Result.normal) { return String.format( "%s grabs %s tail with both hands and aims it at" + " %s groin. The tip opens up like a flower, revealing a hollow" + " inside shaped suspiciously like a pussy. Leaving %s no chance" + " to ponder this curiosity, the tail suddenly flies at %s. The opening" + ", which does indeed <i>feel</i> like a pussy as well, engulfs %s %s" + " completely. %s as if %s %s slowly getting weaker the more it" + " sucks on %s. That is not good.", getSelf().getName(), getSelf().possessiveAdjective(), target.nameOrPossessivePronoun(), target.objectPronoun(),target.objectPronoun(), target.possessiveAdjective(), target.body.getRandomCock().describe(target), Global.capitalizeFirstLetter(target.subjectAction("feel")), target.pronoun(), target.action("are", "is"), target.objectPronoun()); } else if (modifier == Result.critical) { return String.format( "With %s nose between %s asscheeks as it is, %s some muscles at the base " + "of %s spine tense up. %s %sn't sure what's going on, but not long after, %s" + " %s %s %s being swallowed up in a warm sheath. If %s %s weren't in %s face, you would" + " think %s were fucking %s. Suddenly, the slick canal contracts around %s dick, and" + " %s %s some of %s strength flowing out of %s and into it. That is not good.", target.possessiveAdjective(), getSelf().nameOrPossessivePronoun(), target.subjectAction("feel"), getSelf().possessiveAdjective(), Global.capitalizeFirstLetter(target.pronoun()), target.action("are", "is"), target.pronoun(), target.action("feel"), target.possessiveAdjective(), target.body.getRandomCock().describe(target), getSelf().possessiveAdjective(), user().body.getRandomPussy().describe(getSelf()), target.possessiveAdjective(), getSelf().subject(), target.objectPronoun(), target.nameOrPossessivePronoun(), target.pronoun(), target.action("feel"), target.possessiveAdjective(), target.objectPronoun()); } else if (modifier == Result.weak) { return String.format( "%s grabs %s tail with both hands and aims it at" + " %s groin. The tip opens up like a flower, revealing a hollow" + " inside shaped suspiciously like a pussy. That cannot be good, so" + " %s %s hips just in time to evade the tail as it suddenly" + " launches forward. Evade may be too strong a term, though, as it" + " misses %s %s but finds %s balls instead. %s does not seem" + " too interested in them, though, and leaves them alone after" + " massaging them a bit.", getSelf().getName(), getSelf().possessiveAdjective(), target.nameOrPossessivePronoun(), target.subjectAction("twist"), target.possessiveAdjective(), target.possessiveAdjective(), target.body.getRandomCock().describe(target), target.possessiveAdjective(), getSelf().getName()); } else { return String.format("%s grabs %s tail with both hands and aims it at" + " %s groin. The tip opens up like a flower, revealing a hollow" + " inside shaped suspiciously like a pussy. That cannot be good, so" + " %s %s hips just in time to evade the tail as it suddenly" + " launches forward..", getSelf().getName(), getSelf().possessiveAdjective(), target.nameOrPossessivePronoun(), target.subjectAction("twist"), target.possessiveAdjective()); } } private void drain(Combat c, Character target) { Attribute toDrain = Global.pickRandom(target.att.entrySet().stream().filter(e -> e.getValue() != 0) .map(e -> e.getKey()).toArray(Attribute[]::new)).get(); Drained.drain(c, getSelf(), target, toDrain, power(), 20, true); target.drain(c, getSelf(), (int) getSelf().modifyDamage(DamageType.drain, target, 10)); target.drainMojo(c, getSelf(), 1 + Global.random(power() * 3)); target.emote(Emotion.desperate, 5); getSelf().emote(Emotion.confident, 5); } private int power() { return (int) (1 + getSelf().get(Attribute.Dark) / 20.0); } }
UTF-8
Java
12,491
java
TailSuck.java
Java
[]
null
[]
package nightgames.skills; import nightgames.characters.Attribute; import nightgames.characters.Character; import nightgames.characters.Emotion; import nightgames.characters.Trait; import nightgames.characters.body.BallsPart; import nightgames.characters.body.TailPart; import nightgames.combat.Combat; import nightgames.combat.Result; import nightgames.global.Global; import nightgames.skills.damage.DamageType; import nightgames.status.Drained; import nightgames.status.TailSucked; public class TailSuck extends Skill { public TailSuck(Character self) { super("Tail Suck", self); } @Override public boolean requirements(Combat c, Character user, Character target) { return user.get(Attribute.Seduction) >= 20 && user.get(Attribute.Dark) >= 15 && user.has(Trait.energydrain) && user.body.getRandom(TailPart.TYPE) != null; } @Override public boolean usable(Combat c, Character target) { return getSelf().canAct() && target.hasDick() && target.body.getRandomCock().isReady(target) && target.crotchAvailable() && c.getStance().mobile(getSelf()) && !c.getStance().mobile(target) && !c.getStance().inserted(target); } @Override public String describe(Combat c) { return "Use your tail to draw in your target's energies"; } @Override public int accuracy(Combat c, Character target) { return c.getStance().isPartFuckingPartInserted(c, target, target.body.getRandomCock(), getSelf(), getSelf().body.getRandom(TailPart.TYPE)) ? 200 : 90; } @Override public boolean resolve(Combat c, Character target) { if (c.getStance().isPartFuckingPartInserted(c, target, target.body.getRandomCock(), getSelf(), getSelf().body.getRandom(TailPart.TYPE))) { writeOutput(c, Result.special, target); target.body.pleasure(getSelf(), getSelf().body.getRandom(TailPart.TYPE), target.body.getRandomCock(), Global.random(10) + 10, c, this); drain(c, target); } else if (getSelf().roll(getSelf(), c, accuracy(c, target))) { Result res = c.getStance().isBeingFaceSatBy(c, target, getSelf()) ? Result.critical : Result.normal; writeOutput(c, res, target); target.body.pleasure(getSelf(), getSelf().body.getRandom(TailPart.TYPE), target.body.getRandomCock(), Global.random(10) + 10, c, this); drain(c, target); target.add(c, new TailSucked(target, getSelf(), power())); } else if (target.hasBalls()) { writeOutput(c, Result.weak, target); target.body.pleasure(getSelf(), getSelf().body.getRandom(TailPart.TYPE), target.body.getRandom( BallsPart.TYPE), Global.random(5) + 5, c, this); return true; } else { writeOutput(c, Result.miss, target); } return true; } @Override public Skill copy(Character user) { return new TailSuck(user); } @Override public Tactics type(Combat c) { return Tactics.pleasure; } @Override public String deal(Combat c, int damage, Result modifier, Character target) { if (modifier == Result.special) { return String.format( "Flexing a few choice muscles, you provide extra stimulation" + " to %s trapped %s, drawing in further gouts of %s energy.", target.nameOrPossessivePronoun(), target.body.getRandomCock().describe(target), target.possessiveAdjective()); } else if (modifier == Result.normal) { return String.format( "You open up the special mouth at the end of your" + " tail and aim it at %s %s. Flashing %s a confident smile, you launch" + " it forward, engulfing the shaft completely. You take a long, deep breath," + " and you feel life flowing in from your tail as well as through" + " your nose.", target.nameOrPossessivePronoun(), target.body.getRandomCock().describe(target), target.objectPronoun()); } else if (modifier == Result.critical) { return String.format( "Making sure %s view is blocked, you swing your tail out in front of you, hovering over" + " %s %s. Then, you open up the mouth at its tip and carefully lower it over the hard shaft." + " Amusingly, %s does not seem to understand %s predicament, but as soon as you <i>breathe</i>" + " in %s quickly catches on. The flow of energy through your tail makes you shudder atop" + " %s face.", target.nameOrPossessivePronoun(), target.possessiveAdjective(), target.body.getRandomCock().describe(target), target.subject(), target.possessiveAdjective(), target.pronoun(), target.possessiveAdjective()); } else if (modifier == Result.weak) { return String.format( "You shoot out your tail towards %s unprotected groin, but %s" + " twists away slightly causing you to just miss %s %s. Instead, your tail" + " latches onto %s balls. You can't do much with those in this way, so" + " after a little fondling you let go.", target.nameOrPossessivePronoun(), target.pronoun(), target.possessiveAdjective(), target.body.getRandomCock().describe(target), target.possessiveAdjective()); } else { return String.format( "You shoot out your tail towards %s unprotected groin, but %s" + " twists away slightly causing you to just miss %s %s.", target.nameOrPossessivePronoun(), target.pronoun(), target.possessiveAdjective(), target.body.getRandomCock().describe(target)); } } @Override public String receive(Combat c, int damage, Result modifier, Character target) { if (modifier == Result.special) { return String.format( "%s twists and turns %s tail with renewed vigor," + " stealing more of %s energy in the process.", getSelf().getName(), getSelf().possessiveAdjective(), target.nameOrPossessivePronoun()); } else if (modifier == Result.normal) { return String.format( "%s grabs %s tail with both hands and aims it at" + " %s groin. The tip opens up like a flower, revealing a hollow" + " inside shaped suspiciously like a pussy. Leaving %s no chance" + " to ponder this curiosity, the tail suddenly flies at %s. The opening" + ", which does indeed <i>feel</i> like a pussy as well, engulfs %s %s" + " completely. %s as if %s %s slowly getting weaker the more it" + " sucks on %s. That is not good.", getSelf().getName(), getSelf().possessiveAdjective(), target.nameOrPossessivePronoun(), target.objectPronoun(),target.objectPronoun(), target.possessiveAdjective(), target.body.getRandomCock().describe(target), Global.capitalizeFirstLetter(target.subjectAction("feel")), target.pronoun(), target.action("are", "is"), target.objectPronoun()); } else if (modifier == Result.critical) { return String.format( "With %s nose between %s asscheeks as it is, %s some muscles at the base " + "of %s spine tense up. %s %sn't sure what's going on, but not long after, %s" + " %s %s %s being swallowed up in a warm sheath. If %s %s weren't in %s face, you would" + " think %s were fucking %s. Suddenly, the slick canal contracts around %s dick, and" + " %s %s some of %s strength flowing out of %s and into it. That is not good.", target.possessiveAdjective(), getSelf().nameOrPossessivePronoun(), target.subjectAction("feel"), getSelf().possessiveAdjective(), Global.capitalizeFirstLetter(target.pronoun()), target.action("are", "is"), target.pronoun(), target.action("feel"), target.possessiveAdjective(), target.body.getRandomCock().describe(target), getSelf().possessiveAdjective(), user().body.getRandomPussy().describe(getSelf()), target.possessiveAdjective(), getSelf().subject(), target.objectPronoun(), target.nameOrPossessivePronoun(), target.pronoun(), target.action("feel"), target.possessiveAdjective(), target.objectPronoun()); } else if (modifier == Result.weak) { return String.format( "%s grabs %s tail with both hands and aims it at" + " %s groin. The tip opens up like a flower, revealing a hollow" + " inside shaped suspiciously like a pussy. That cannot be good, so" + " %s %s hips just in time to evade the tail as it suddenly" + " launches forward. Evade may be too strong a term, though, as it" + " misses %s %s but finds %s balls instead. %s does not seem" + " too interested in them, though, and leaves them alone after" + " massaging them a bit.", getSelf().getName(), getSelf().possessiveAdjective(), target.nameOrPossessivePronoun(), target.subjectAction("twist"), target.possessiveAdjective(), target.possessiveAdjective(), target.body.getRandomCock().describe(target), target.possessiveAdjective(), getSelf().getName()); } else { return String.format("%s grabs %s tail with both hands and aims it at" + " %s groin. The tip opens up like a flower, revealing a hollow" + " inside shaped suspiciously like a pussy. That cannot be good, so" + " %s %s hips just in time to evade the tail as it suddenly" + " launches forward..", getSelf().getName(), getSelf().possessiveAdjective(), target.nameOrPossessivePronoun(), target.subjectAction("twist"), target.possessiveAdjective()); } } private void drain(Combat c, Character target) { Attribute toDrain = Global.pickRandom(target.att.entrySet().stream().filter(e -> e.getValue() != 0) .map(e -> e.getKey()).toArray(Attribute[]::new)).get(); Drained.drain(c, getSelf(), target, toDrain, power(), 20, true); target.drain(c, getSelf(), (int) getSelf().modifyDamage(DamageType.drain, target, 10)); target.drainMojo(c, getSelf(), 1 + Global.random(power() * 3)); target.emote(Emotion.desperate, 5); getSelf().emote(Emotion.confident, 5); } private int power() { return (int) (1 + getSelf().get(Attribute.Dark) / 20.0); } }
12,491
0.534785
0.532223
200
61.455002
42.053036
158
false
false
0
0
0
0
0
0
1.12
false
false
1
8309ef1a7c2686843ea964d171af6554b41f5920
12,816,182,441,936
9d6c34b7a75caa76d046a3fdd48ca805ab7ef285
/app/src/main/java/com/example/animatedfab/MainActivity.java
c38ef20f3e38607fa9842ab337ea9cd9c1f01223
[]
no_license
Kyoshiin/Animated-FabButton
https://github.com/Kyoshiin/Animated-FabButton
09d7b723543475108620924a89fe87770267384d
8b3b101d5bd052aeb881ebfd13b718ee47e44839
refs/heads/master
"2023-05-31T23:35:29.996000"
"2020-11-09T20:36:52"
"2020-11-09T20:36:52"
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.animatedfab; import android.os.Bundle; import android.view.View; import android.widget.LinearLayout; import androidx.appcompat.app.AppCompatActivity; import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.google.android.material.snackbar.Snackbar; public class MainActivity extends AppCompatActivity{ boolean isRotate = false; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); FloatingActionButton fab = findViewById(R.id.fab); final FloatingActionButton fabRegHosp = findViewById(R.id.fabRegHospital); final FloatingActionButton fabAddClinc = findViewById(R.id.fabAddClinic); final LinearLayout RegHospital = findViewById(R.id.RegHospLayout); final LinearLayout AddClinic = findViewById(R.id.addClinicLayout); ViewAnimation.init(RegHospital); ViewAnimation.init(AddClinic); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { isRotate = ViewAnimation.rotateFab(v, !isRotate); if(isRotate){ ViewAnimation.showIn(AddClinic); ViewAnimation.showIn(RegHospital); fabAddClinc.setOnClickListener(listener); fabRegHosp.setOnClickListener(listener); // Toast.makeText(getApplicationContext(),"Pop out",Toast.LENGTH_SHORT).show(); }else{ ViewAnimation.showOut(AddClinic); ViewAnimation.showOut(RegHospital); // Toast.makeText(getApplicationContext(),"Hide in",Toast.LENGTH_SHORT).show(); } } }); } View.OnClickListener listener = new View.OnClickListener() { @Override public void onClick(View view) { switch (view.getId()){ case R.id.fabRegHospital: Snackbar.make(view,"Opening Added RegHospital", Snackbar.LENGTH_SHORT).show(); case R.id.fabAddClinic: Snackbar.make(view,"Opening Add Clinic", Snackbar.LENGTH_SHORT).show(); } } }; }
UTF-8
Java
2,317
java
MainActivity.java
Java
[]
null
[]
package com.example.animatedfab; import android.os.Bundle; import android.view.View; import android.widget.LinearLayout; import androidx.appcompat.app.AppCompatActivity; import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.google.android.material.snackbar.Snackbar; public class MainActivity extends AppCompatActivity{ boolean isRotate = false; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); FloatingActionButton fab = findViewById(R.id.fab); final FloatingActionButton fabRegHosp = findViewById(R.id.fabRegHospital); final FloatingActionButton fabAddClinc = findViewById(R.id.fabAddClinic); final LinearLayout RegHospital = findViewById(R.id.RegHospLayout); final LinearLayout AddClinic = findViewById(R.id.addClinicLayout); ViewAnimation.init(RegHospital); ViewAnimation.init(AddClinic); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { isRotate = ViewAnimation.rotateFab(v, !isRotate); if(isRotate){ ViewAnimation.showIn(AddClinic); ViewAnimation.showIn(RegHospital); fabAddClinc.setOnClickListener(listener); fabRegHosp.setOnClickListener(listener); // Toast.makeText(getApplicationContext(),"Pop out",Toast.LENGTH_SHORT).show(); }else{ ViewAnimation.showOut(AddClinic); ViewAnimation.showOut(RegHospital); // Toast.makeText(getApplicationContext(),"Hide in",Toast.LENGTH_SHORT).show(); } } }); } View.OnClickListener listener = new View.OnClickListener() { @Override public void onClick(View view) { switch (view.getId()){ case R.id.fabRegHospital: Snackbar.make(view,"Opening Added RegHospital", Snackbar.LENGTH_SHORT).show(); case R.id.fabAddClinic: Snackbar.make(view,"Opening Add Clinic", Snackbar.LENGTH_SHORT).show(); } } }; }
2,317
0.634009
0.634009
69
32.594204
29.74399
98
false
false
0
0
0
0
0
0
0.565217
false
false
1
9638c72c269e861ec138f67687419a90a8f89996
25,288,767,479,566
b79f1bc9851554ac1b91632b557a113f18dbaa62
/ambit2/src/ambit2/test/ui/MoleculeListPanelTest.java
7f414ac6434e66f5267f3550ddd151e9038c12a2
[]
no_license
egonw/ambit
https://github.com/egonw/ambit
93646e22e3b7fae126d154a5db2389d1012d5550
4ce056e022f1251defcded121004f82f0d2d71e9
refs/heads/master
"2016-09-06T04:10:38.397000"
"2015-09-20T09:44:25"
"2015-09-20T09:44:25"
42,806,736
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Created on 2006-3-4 * */ package ambit2.test.ui; import java.awt.Dimension; import javax.swing.JOptionPane; import junit.framework.TestCase; import org.jfree.report.JFreeReportBoot; import org.openscience.cdk.CDKConstants; import org.openscience.cdk.interfaces.IMolecule; import org.openscience.cdk.templates.MoleculeFactory; import ambit2.config.AmbitCONSTANTS; import ambit2.ui.data.CompoundsListPanel; import ambit2.ui.data.CompoundsListReport; import ambit2.data.molecule.Compound; import ambit2.data.molecule.CompoundsList; /** * TODO add description * @author Nina Jeliazkova nina@acad.bg * <b>Modified</b> 2006-3-4 */ public class MoleculeListPanelTest extends TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(MoleculeListPanelTest.class); } /* * @see TestCase#setUp() */ protected void setUp() throws Exception { super.setUp(); } /* * @see TestCase#tearDown() */ protected void tearDown() throws Exception { super.tearDown(); } /** * Constructor for MoleculeListPanelTest. * @param arg0 */ public MoleculeListPanelTest(String arg0) { super(arg0); } public void testCompoundsListInTable() { CompoundsList list = createTestList(); CompoundsListPanel scrollPane = new CompoundsListPanel(list,3,new Dimension(150,150)); //scrollPane.setPreferredSize(new Dimension(600,450)); JOptionPane.showMessageDialog(null,scrollPane,"Structures",JOptionPane.PLAIN_MESSAGE,null); } protected CompoundsList createTestList() { CompoundsList list = new CompoundsList(); IMolecule mol; for (int i=0; i < 3; i++) { mol = MoleculeFactory.makeBenzene(); mol.setProperty("Name","benzene"); mol.setProperty(AmbitCONSTANTS.SMILES,"c1ccccc1"); list.addItem(new Compound(mol)); list.addItem(new Compound(MoleculeFactory.makeAlkane(5*(i+1)))); mol = MoleculeFactory.makeBiphenyl(); mol.setProperty(CDKConstants.NAMES,"biphenyl"); list.addItem(new Compound(mol)); list.addItem(new Compound(MoleculeFactory.makeBranchedAliphatic())); Compound c = new Compound(MoleculeFactory.makeDiamantane()); c.setName("Diamantane"); list.addItem(c); } return list; } public void testReportList() { JFreeReportBoot.getInstance().start(); CompoundsListReport tr = new CompoundsListReport(createTestList(),"Structures"); tr.executeReportList(); tr.executeReportGrid(); } } //SwingIconsDemo
UTF-8
Java
2,783
java
MoleculeListPanelTest.java
Java
[ { "context": "sList;\r\n\r\n/**\r\n * TODO add description\r\n * @author Nina Jeliazkova nina@acad.bg\r\n * <b>Modified</b> 2006-3-4\r\n */\r\np", "end": 622, "score": 0.9998748898506165, "start": 607, "tag": "NAME", "value": "Nina Jeliazkova" }, { "context": "* TODO add description\r\n * @author Nina Jeliazkova nina@acad.bg\r\n * <b>Modified</b> 2006-3-4\r\n */\r\npublic class M", "end": 635, "score": 0.999908447265625, "start": 623, "tag": "EMAIL", "value": "nina@acad.bg" }, { "context": ".makeBenzene();\r\n\t mol.setProperty(\"Name\",\"benzene\");\r\n\t mol.setProperty(AmbitCONSTANTS.SMILE", "end": 1891, "score": 0.9876887202262878, "start": 1884, "tag": "NAME", "value": "benzene" } ]
null
[]
/* * Created on 2006-3-4 * */ package ambit2.test.ui; import java.awt.Dimension; import javax.swing.JOptionPane; import junit.framework.TestCase; import org.jfree.report.JFreeReportBoot; import org.openscience.cdk.CDKConstants; import org.openscience.cdk.interfaces.IMolecule; import org.openscience.cdk.templates.MoleculeFactory; import ambit2.config.AmbitCONSTANTS; import ambit2.ui.data.CompoundsListPanel; import ambit2.ui.data.CompoundsListReport; import ambit2.data.molecule.Compound; import ambit2.data.molecule.CompoundsList; /** * TODO add description * @author <NAME> <EMAIL> * <b>Modified</b> 2006-3-4 */ public class MoleculeListPanelTest extends TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(MoleculeListPanelTest.class); } /* * @see TestCase#setUp() */ protected void setUp() throws Exception { super.setUp(); } /* * @see TestCase#tearDown() */ protected void tearDown() throws Exception { super.tearDown(); } /** * Constructor for MoleculeListPanelTest. * @param arg0 */ public MoleculeListPanelTest(String arg0) { super(arg0); } public void testCompoundsListInTable() { CompoundsList list = createTestList(); CompoundsListPanel scrollPane = new CompoundsListPanel(list,3,new Dimension(150,150)); //scrollPane.setPreferredSize(new Dimension(600,450)); JOptionPane.showMessageDialog(null,scrollPane,"Structures",JOptionPane.PLAIN_MESSAGE,null); } protected CompoundsList createTestList() { CompoundsList list = new CompoundsList(); IMolecule mol; for (int i=0; i < 3; i++) { mol = MoleculeFactory.makeBenzene(); mol.setProperty("Name","benzene"); mol.setProperty(AmbitCONSTANTS.SMILES,"c1ccccc1"); list.addItem(new Compound(mol)); list.addItem(new Compound(MoleculeFactory.makeAlkane(5*(i+1)))); mol = MoleculeFactory.makeBiphenyl(); mol.setProperty(CDKConstants.NAMES,"biphenyl"); list.addItem(new Compound(mol)); list.addItem(new Compound(MoleculeFactory.makeBranchedAliphatic())); Compound c = new Compound(MoleculeFactory.makeDiamantane()); c.setName("Diamantane"); list.addItem(c); } return list; } public void testReportList() { JFreeReportBoot.getInstance().start(); CompoundsListReport tr = new CompoundsListReport(createTestList(),"Structures"); tr.executeReportList(); tr.executeReportGrid(); } } //SwingIconsDemo
2,769
0.643191
0.628818
98
26.418367
23.975721
99
false
false
0
0
0
0
0
0
0.683673
false
false
1
8fc178652c1b9a9e73481894ed524c9868abb5ba
25,288,767,479,458
1ecef5f5fa0a7888b1328a06f80e70957230eef2
/library/src/main/java/com/weiliu/library/widget/SectionListView.java
f2fddbf390120581dc02532b53a364613c56f3d0
[]
no_license
binbin594738977/VirtualAppEx
https://github.com/binbin594738977/VirtualAppEx
0544216686c51e367fc18acd9c86eb1b3439397d
5ede1927d0aa304f4e24c5679ba5dae79911bd99
refs/heads/master
"2022-03-09T23:54:32.365000"
"2021-12-18T12:10:57"
"2021-12-18T12:10:57"
244,848,211
0
0
null
true
"2020-03-04T08:37:20"
"2020-03-04T08:37:19"
"2020-03-04T08:34:36"
"2018-10-10T09:59:32"
1,928
0
0
0
null
false
false
package com.weiliu.library.widget; import android.content.Context; import android.database.DataSetObserver; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.util.AttributeSet; import android.view.View; import android.widget.AbsListView; import android.widget.Adapter; import android.widget.AdapterView; import android.widget.ListAdapter; import android.widget.ListView; /** * 实现类似iOS的SectionView的效果 */ public class SectionListView extends ListView implements ListView.OnScrollListener { private View mTitleView; /** * 标题位置 */ private int mTitlePos = -1; /** * ListView的顶部是否处在divider区域 */ @SuppressWarnings({"FieldCanBeLocal", "UnusedDeclaration"}) private boolean mInDividerArea; private OnScrollListener mWrapedScrollListener; private OnTitleChangedListener mOnTitleChangedListener; public SectionListView(@NonNull Context context) { super(context); } public SectionListView(@NonNull Context context, AttributeSet attrs) { super(context, attrs); } /** * 设置用来显示section标题的的View * * @param titleView 该View悬浮在ListView之上,与ListView顶部对齐,并且处在其Parent的最顶端。 * 另外,该titleView的parent一定要是空背景,并且无其他子View(用来实现titleView的滚动效果) */ public void setTitleView(View titleView) { if (titleView != mTitleView) { mTitleView = titleView; changeTitle(); } } /** * 设置标题内容变化的监听回调 * * @param l OnTitleChangedListener */ public void setOnTitleChangedListener(OnTitleChangedListener l) { mOnTitleChangedListener = l; changeTitle(); } private void changeTitle() { if (mTitleView != null && mOnTitleChangedListener != null && getAdapter() != null && getCount() > 0) { int pos = getFirstVisiblePosition(); if (inDataPos(pos)) { mTitleView.setVisibility(VISIBLE); int dataPos = getDataPos(pos); if (mTitlePos != dataPos) { mTitlePos = dataPos; //listView的getItemAtPosition方法对应的是绝对位置,所以此处的参数是pos而不是dataPos Object item = getItemAtPosition(pos); mOnTitleChangedListener.onTitleChanged(mTitleView, item, dataPos); } } else { mTitleView.setVisibility(GONE); mTitlePos = -1; } } else if (mTitleView != null) { mTitleView.setVisibility(GONE); mTitlePos = -1; } } @Override public void setAdapter(@Nullable ListAdapter adapter) { ListAdapter oldAdapter = getAdapter(); if (oldAdapter != null) { oldAdapter.unregisterDataSetObserver(mObserver); } if (adapter != null) { adapter.registerDataSetObserver(mObserver); } super.setAdapter(adapter); } @Override public void setOnScrollListener(OnScrollListener l) { super.setOnScrollListener(this); mWrapedScrollListener = l; } @Override public void onScrollStateChanged(AbsListView view, int scrollState) { if (scrollState == SCROLL_STATE_IDLE) { if (mTitleView != null && mOnTitleChangedListener != null) { changeTitle(); } } if (mWrapedScrollListener != null) { mWrapedScrollListener.onScrollStateChanged(view, scrollState); } } @Override public void onScroll(@NonNull AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { if (mTitleView != null && mOnTitleChangedListener != null) { changeTitle(); if (inDataPos(firstVisibleItem)) { if (firstVisibleItem < getCount() - 1 //下一条是“连接状态”,则执行滚动,实现类似iOS section的承上启下的效果 && isConnectPos(firstVisibleItem + 1)) { int titleHeight = mTitleView.getHeight(); int titleTop = mTitleView.getTop(); int titleBottom = mTitleView.getBottom(); int itemTop = view.getChildAt(0).getTop(); int itemBottom = view.getChildAt(0).getBottom(); int offset; if (itemTop > 0 || itemBottom < 0) { /* * first item的top大于0,或者bottom小于0,肯定是发生在ListView的顶部是divider区域的时候, */ mInDividerArea = true; offset = -titleBottom; } else { mInDividerArea = false; if (itemBottom < titleBottom) { //SUPPRESS CHECKSTYLE /* * first item的bottom值不断变小,从而导致itemBottom < titleBottom, * 所以此处逻辑一定是发生在list往上拖的时候。 * 当上拖到first item的bottom值甚至小于title view的bottom值时, * 立即调整title view的位置,使title view的底部与之对齐, * 从而形成一种title view跟着item一起向上滚动至消失不见的现象 */ offset = itemBottom - titleBottom; } else if (itemBottom < titleHeight) { /* * 此处逻辑是上处逻辑的反过程, * 即在list往下拖的时候,title view跟着item一起同步向下滚动至完全显示, * 只要未超过titleHeight,就表示title view还有继续往下滚动的余地; * 否则就不再同步滚动,以免title view与parent的顶部脱离,故加上itemBottom < titleHeight条件限制 */ offset = itemBottom - titleBottom; } else { /* * 去掉title view的偏移,回到其正常的位置。 */ offset = -titleTop; } } if (offset + titleTop > 0) { //SUPPRESS CHECKSTYLE /* * 确保title view不会与parent的顶部脱离 */ offset = -titleTop; } offsetTitleScrollPos(offset); } else { //通过反向偏移回到原始位置(不滚动) offsetTitleScrollPos(-mTitleView.getTop()); } } } if (mWrapedScrollListener != null) { mWrapedScrollListener.onScroll(view, firstVisibleItem, visibleItemCount, totalItemCount); } } private void offsetTitleScrollPos(int offset) { ((View) mTitleView.getParent()).scrollTo(0, -offset); } /** * 该位置是否为“连接状态”。比如该位置处在A区域,而下一条就进入了B区域,则此位置就为“连接状态” * * @param pos ListView中的绝对位置,比如该位置有可能处在header或者footer中 * @return */ private boolean isConnectPos(int pos) { if (!inDataPos(pos)) { return true; } int dataPos = getDataPos(pos); return mOnTitleChangedListener.hasTitle(dataPos); } /** * 该位置是否处在数据索引中,而非header footer ignore * * @param pos ListView中的绝对位置,比如该位置有可能处在header或者footer中 * @return */ private boolean inDataPos(int pos) { int viewType = getAdapter().getItemViewType(pos); return viewType != Adapter.IGNORE_ITEM_VIEW_TYPE && viewType != AdapterView.ITEM_VIEW_TYPE_HEADER_OR_FOOTER; } /** * 获取对应位置在list数据中的索引,即减去listView的header view count * * @param pos ListView中的绝对位置,比如该位置有可能处在header或者footer中 * @return */ private int getDataPos(int pos) { return pos - getHeaderViewsCount(); } @NonNull private DataSetObserver mObserver = new DataSetObserver() { @Override public void onChanged() { changeTitle(); } @Override public void onInvalidated() { changeTitle(); } }; /** * 标题内容变化的监听回调 * * @author qumiao */ public interface OnTitleChangedListener { /** * 当前位置是否有标题。 * 比如从位置3开始一直到5都是以A开头的,一般只在位置3处显示标题A,那么此时hasTitle(3)就应该返回true, * 而hasTitle(4)和hasTitle(5)就应该返回false. * * @param position 当前位置 * @return */ boolean hasTitle(int position); /** * 标题内容发生变化 * * @param titleView 显示标题的View * @param item 标题内容 * @param position 标题相对list的位置 */ void onTitleChanged(View titleView, Object item, int position); } }
UTF-8
Java
9,486
java
SectionListView.java
Java
[ { "context": "\n\n /**\n * 标题内容变化的监听回调\n *\n * @author qumiao\n */\n public interface OnTitleChangedListen", "end": 7677, "score": 0.9994058012962341, "start": 7671, "tag": "USERNAME", "value": "qumiao" } ]
null
[]
package com.weiliu.library.widget; import android.content.Context; import android.database.DataSetObserver; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.util.AttributeSet; import android.view.View; import android.widget.AbsListView; import android.widget.Adapter; import android.widget.AdapterView; import android.widget.ListAdapter; import android.widget.ListView; /** * 实现类似iOS的SectionView的效果 */ public class SectionListView extends ListView implements ListView.OnScrollListener { private View mTitleView; /** * 标题位置 */ private int mTitlePos = -1; /** * ListView的顶部是否处在divider区域 */ @SuppressWarnings({"FieldCanBeLocal", "UnusedDeclaration"}) private boolean mInDividerArea; private OnScrollListener mWrapedScrollListener; private OnTitleChangedListener mOnTitleChangedListener; public SectionListView(@NonNull Context context) { super(context); } public SectionListView(@NonNull Context context, AttributeSet attrs) { super(context, attrs); } /** * 设置用来显示section标题的的View * * @param titleView 该View悬浮在ListView之上,与ListView顶部对齐,并且处在其Parent的最顶端。 * 另外,该titleView的parent一定要是空背景,并且无其他子View(用来实现titleView的滚动效果) */ public void setTitleView(View titleView) { if (titleView != mTitleView) { mTitleView = titleView; changeTitle(); } } /** * 设置标题内容变化的监听回调 * * @param l OnTitleChangedListener */ public void setOnTitleChangedListener(OnTitleChangedListener l) { mOnTitleChangedListener = l; changeTitle(); } private void changeTitle() { if (mTitleView != null && mOnTitleChangedListener != null && getAdapter() != null && getCount() > 0) { int pos = getFirstVisiblePosition(); if (inDataPos(pos)) { mTitleView.setVisibility(VISIBLE); int dataPos = getDataPos(pos); if (mTitlePos != dataPos) { mTitlePos = dataPos; //listView的getItemAtPosition方法对应的是绝对位置,所以此处的参数是pos而不是dataPos Object item = getItemAtPosition(pos); mOnTitleChangedListener.onTitleChanged(mTitleView, item, dataPos); } } else { mTitleView.setVisibility(GONE); mTitlePos = -1; } } else if (mTitleView != null) { mTitleView.setVisibility(GONE); mTitlePos = -1; } } @Override public void setAdapter(@Nullable ListAdapter adapter) { ListAdapter oldAdapter = getAdapter(); if (oldAdapter != null) { oldAdapter.unregisterDataSetObserver(mObserver); } if (adapter != null) { adapter.registerDataSetObserver(mObserver); } super.setAdapter(adapter); } @Override public void setOnScrollListener(OnScrollListener l) { super.setOnScrollListener(this); mWrapedScrollListener = l; } @Override public void onScrollStateChanged(AbsListView view, int scrollState) { if (scrollState == SCROLL_STATE_IDLE) { if (mTitleView != null && mOnTitleChangedListener != null) { changeTitle(); } } if (mWrapedScrollListener != null) { mWrapedScrollListener.onScrollStateChanged(view, scrollState); } } @Override public void onScroll(@NonNull AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { if (mTitleView != null && mOnTitleChangedListener != null) { changeTitle(); if (inDataPos(firstVisibleItem)) { if (firstVisibleItem < getCount() - 1 //下一条是“连接状态”,则执行滚动,实现类似iOS section的承上启下的效果 && isConnectPos(firstVisibleItem + 1)) { int titleHeight = mTitleView.getHeight(); int titleTop = mTitleView.getTop(); int titleBottom = mTitleView.getBottom(); int itemTop = view.getChildAt(0).getTop(); int itemBottom = view.getChildAt(0).getBottom(); int offset; if (itemTop > 0 || itemBottom < 0) { /* * first item的top大于0,或者bottom小于0,肯定是发生在ListView的顶部是divider区域的时候, */ mInDividerArea = true; offset = -titleBottom; } else { mInDividerArea = false; if (itemBottom < titleBottom) { //SUPPRESS CHECKSTYLE /* * first item的bottom值不断变小,从而导致itemBottom < titleBottom, * 所以此处逻辑一定是发生在list往上拖的时候。 * 当上拖到first item的bottom值甚至小于title view的bottom值时, * 立即调整title view的位置,使title view的底部与之对齐, * 从而形成一种title view跟着item一起向上滚动至消失不见的现象 */ offset = itemBottom - titleBottom; } else if (itemBottom < titleHeight) { /* * 此处逻辑是上处逻辑的反过程, * 即在list往下拖的时候,title view跟着item一起同步向下滚动至完全显示, * 只要未超过titleHeight,就表示title view还有继续往下滚动的余地; * 否则就不再同步滚动,以免title view与parent的顶部脱离,故加上itemBottom < titleHeight条件限制 */ offset = itemBottom - titleBottom; } else { /* * 去掉title view的偏移,回到其正常的位置。 */ offset = -titleTop; } } if (offset + titleTop > 0) { //SUPPRESS CHECKSTYLE /* * 确保title view不会与parent的顶部脱离 */ offset = -titleTop; } offsetTitleScrollPos(offset); } else { //通过反向偏移回到原始位置(不滚动) offsetTitleScrollPos(-mTitleView.getTop()); } } } if (mWrapedScrollListener != null) { mWrapedScrollListener.onScroll(view, firstVisibleItem, visibleItemCount, totalItemCount); } } private void offsetTitleScrollPos(int offset) { ((View) mTitleView.getParent()).scrollTo(0, -offset); } /** * 该位置是否为“连接状态”。比如该位置处在A区域,而下一条就进入了B区域,则此位置就为“连接状态” * * @param pos ListView中的绝对位置,比如该位置有可能处在header或者footer中 * @return */ private boolean isConnectPos(int pos) { if (!inDataPos(pos)) { return true; } int dataPos = getDataPos(pos); return mOnTitleChangedListener.hasTitle(dataPos); } /** * 该位置是否处在数据索引中,而非header footer ignore * * @param pos ListView中的绝对位置,比如该位置有可能处在header或者footer中 * @return */ private boolean inDataPos(int pos) { int viewType = getAdapter().getItemViewType(pos); return viewType != Adapter.IGNORE_ITEM_VIEW_TYPE && viewType != AdapterView.ITEM_VIEW_TYPE_HEADER_OR_FOOTER; } /** * 获取对应位置在list数据中的索引,即减去listView的header view count * * @param pos ListView中的绝对位置,比如该位置有可能处在header或者footer中 * @return */ private int getDataPos(int pos) { return pos - getHeaderViewsCount(); } @NonNull private DataSetObserver mObserver = new DataSetObserver() { @Override public void onChanged() { changeTitle(); } @Override public void onInvalidated() { changeTitle(); } }; /** * 标题内容变化的监听回调 * * @author qumiao */ public interface OnTitleChangedListener { /** * 当前位置是否有标题。 * 比如从位置3开始一直到5都是以A开头的,一般只在位置3处显示标题A,那么此时hasTitle(3)就应该返回true, * 而hasTitle(4)和hasTitle(5)就应该返回false. * * @param position 当前位置 * @return */ boolean hasTitle(int position); /** * 标题内容发生变化 * * @param titleView 显示标题的View * @param item 标题内容 * @param position 标题相对list的位置 */ void onTitleChanged(View titleView, Object item, int position); } }
9,486
0.566942
0.564516
280
28.450001
23.986105
101
false
false
0
0
0
0
0
0
0.821429
false
false
1
f2bd8bd314c8887119892a8b5413911c77cb49b5
17,300,128,315,254
b6424219c8453d3ce475b587512c8e65268c20fe
/src/javacity/game/observer/TileCost.java
ded7a677e16fe4e4d2785124867e7779614a0031
[]
no_license
morristech/JavaCity-1
https://github.com/morristech/JavaCity-1
12a83b91181c6b18df753ada6899ca425b0c8887
8a3ce612ebc56de5df47ee9feed3435ae213d79d
refs/heads/master
"2020-07-20T13:29:47.548000"
"2012-07-18T19:31:47"
"2012-07-18T19:31:47"
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package javacity.game.observer; import java.util.Observer; import java.util.Observable; /** * * @author Tom */ public class TileCost implements Observer { @Override public void update(Observable o, Object args) { System.out.println("funds --"); } }
UTF-8
Java
281
java
TileCost.java
Java
[ { "context": "er;\nimport java.util.Observable;\n/**\n *\n * @author Tom\n */\npublic class TileCost implements Observer \n{ ", "end": 109, "score": 0.9996566772460938, "start": 106, "tag": "NAME", "value": "Tom" } ]
null
[]
package javacity.game.observer; import java.util.Observer; import java.util.Observable; /** * * @author Tom */ public class TileCost implements Observer { @Override public void update(Observable o, Object args) { System.out.println("funds --"); } }
281
0.658363
0.658363
15
17.733334
16.026922
49
false
false
0
0
0
0
0
0
0.333333
false
false
1
5650d12e0d4f2b9a38563463de01cca79b3c154c
25,838,523,296,604
c78ff2263d6f608681f78df4a0ba64cb6c62046b
/java/src/jp/ohwada/java/ksj/busutil/busdb/BusDbPref.java
f2debd82686ee9be24e730a33db0eafd61e5a0c3
[]
no_license
admirabilis/BusMap
https://github.com/admirabilis/BusMap
4b8eb64eb738b3505ecf720c1148194a8d32fd3c
77db90edc182422021b07a81f4d145ed7a317273
refs/heads/master
"2021-10-13T00:26:28.724000"
"2016-11-11T06:28:46"
"2016-11-11T06:28:46"
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * Bus Stop * 2015-12-01 K.OHWADA */ package jp.ohwada.java.ksj.busutil.busdb; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; /** * BusDbPref * name of Prefecture & unique id * id is defined by a file name of National Land Numerical Information */ public class BusDbPref extends BusDbBase { private static final String TABLE = "bus_pref"; private PreparedStatement mPsUpdate; private PreparedStatement mPsSelect; /** * constrctor */ public BusDbPref() { super(); } /** * createTable * @return boolean */ public boolean createTable() { return createTable( "CREATE TABLE " + TABLE + " ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, name VARCHAR(256) NOT NULL, romaji VARCHAR(256) NOT NULL, node_num INT, route_num INT, max_lat DOUBLE, min_lat DOUBLE, max_lon DOUBLE, min_lon DOUBLE);" ); } /** * prepareStatement */ public void prepareStatement() { try { mPsUpdate = mConnection.prepareStatement( "UPDATE " + TABLE + " SET node_num=?, route_num=?, max_lat=?, min_lat=?, max_lon=?, min_lon=? WHERE id=?" ); mPsSelect = mConnection.prepareStatement( "SELECT * FROM " + TABLE + " WHERE id=?" ); } catch (SQLException e) { e.printStackTrace(); } } /** * prepareStatement */ public void closeStatement() { try { mPsUpdate.close(); mPsSelect.close(); } catch (SQLException e) { e.printStackTrace(); } } /** * insert */ public void insertPref() { PreparedStatement ps = null; try { ps = mConnection.prepareStatement( "INSERT INTO " + TABLE + " (id,name,romaji) VALUES (?,?,?)" ); } catch (SQLException e) { e.printStackTrace(); } insert( ps, 1, "北海道", "hokkaido" ); insert( ps, 2, "青森", "aomori" ); insert( ps, 3, "岩手", "iwate" ); insert( ps, 4, "宮城", "miyagi" ); insert( ps, 5, "秋田", "akita" ); insert( ps, 6, "山形", "yamagata" ); insert( ps, 7, "福島", "fukushima" ); insert( ps, 8, "茨城", "ibaraki" ); insert( ps, 9, "栃木", "tochigi" ); insert( ps, 10, "群馬", "gunma" ); insert( ps, 11, "埼玉", "saitama" ); insert( ps, 12, "千葉", "chiba" ); insert( ps, 13, "東京", "tokyo" ); insert( ps, 14, "神奈川", "kanagawa" ); insert( ps, 15, "新潟", "niigata" ); insert( ps, 16, "富山", "toyama" ); insert( ps, 17, "石川", "ishikawa" ); insert( ps, 18, "福井", "fukui" ); insert( ps, 19, "山梨", "yamanashi" ); insert( ps, 20, "長野", "nagano" ); insert( ps, 21, "岐阜", "gifu" ); insert( ps, 22, "静岡", "shizuoka" ); insert( ps, 23, "愛知", "aichi" ); insert( ps, 24, "三重", "mie" ); insert( ps, 25, "滋賀", "shiga" ); insert( ps, 26, "京都", "kyoto" ); insert( ps, 27, "大阪", "osaka" ); insert( ps, 28, "兵庫", "hyuogo" ); insert( ps, 29, "奈良", "nara" ); insert( ps, 30, "和歌山", "wakayama" ); insert( ps, 31, "鳥取", "tottori" ); insert( ps, 32, "島根", "shimane" ); insert( ps, 33, "岡山", "okayama" ); insert( ps, 34, "広島", "hiroshima" ); insert( ps, 35, "山口", "yamaguchi" ); insert( ps, 36, "徳島", "tokushima" ); insert( ps, 37, "香川", "kagawa" ); insert( ps, 38, "愛媛", "ehime" ); insert( ps, 39, "高知", "kouchi" ); insert( ps, 40, "福岡", "fukuoka" ); insert( ps, 41, "佐賀", "saga" ); insert( ps, 42, "長崎", "nagasaki" ); insert( ps, 43, "熊本", "kumamoto" ); insert( ps, 44, "大分", "oita" ); insert( ps, 45, "宮崎", "miyazaki" ); insert( ps, 46, "鹿児島", "kagoshima" ); insert( ps, 47, "沖縄", "okinawa" ); try { if ( ps != null ) { ps.close(); } } catch (SQLException e) { e.printStackTrace(); } } private void insert( PreparedStatement ps, int id, String name, String romaji ) { try { ps.setInt(1, id); ps.setString(2, name); ps.setString(3, romaji); ps.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); } } /** * updatePrefNum * @param int prefNo * @param int nodeNum * @param int routeNum * @param double maxLat * @param double minLat * @param double maxLon * @param double minLon */ public void updatePrefNum( int prefNo, int nodeNum, int routeNum, double maxLat, double minLat, double maxLon, double minLon ) { printMsg( "updatePrefNum " + prefNo + " " + nodeNum + " " + routeNum + " " + maxLat + " " + minLat + " " + maxLon + " " + minLon ); PreparedStatement ps = mPsUpdate; try { ps.setInt(1, nodeNum); ps.setInt(2, routeNum); ps.setDouble(3, maxLat); ps.setDouble(4, minLat); ps.setDouble(5, maxLon); ps.setDouble(6, minLon); ps.setInt(7, prefNo); ps.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); } } public BusRecPref selectPrefById( int id ) { List<BusRecPref> list = selectList( id ); if ( list.size() == 1 ) { return list.get(0); } if ( list.size() > 1 ) { // error } return null; } private List<BusRecPref> selectList( int id ) { List<BusRecPref> list = new ArrayList<BusRecPref>(); ResultSet rs = null; try { mPsSelect.setInt(1, id); rs = mPsSelect.executeQuery(); } catch (SQLException e) { e.printStackTrace(); } if ( rs == null ) return list; list = getRec( rs ); try { rs.close(); } catch (SQLException e) { e.printStackTrace(); } return list; } private List<BusRecPref> getRec( ResultSet rset ) { List<BusRecPref> list = new ArrayList<BusRecPref>(); if ( rset == null ) return list; BusRecPref rec; try { while (rset.next()) { rec = new BusRecPref(); rec.id = rset.getInt("id"); rec.name = rset.getString("name"); rec.romaji = rset.getString("romaji"); rec.node_num = rset.getInt("node_num"); rec.route_num = rset.getInt("route_num"); rec.max_lat = rset.getFloat("max_lat"); rec.min_lat = rset.getFloat("min_lat"); rec.max_lon = rset.getFloat("max_lon"); rec.min_lon = rset.getFloat("min_lon"); list.add( rec ); } } catch (SQLException e) { e.printStackTrace(); } return list; } }
UTF-8
Java
7,331
java
BusDbPref.java
Java
[ { "context": "/**\n * Bus Stop\n * 2015-12-01 K.OHWADA\n */\n\npackage jp.ohwada.java.ksj.busutil.busdb;\n\ni", "end": 38, "score": 0.9943345189094543, "start": 30, "tag": "NAME", "value": "K.OHWADA" } ]
null
[]
/** * Bus Stop * 2015-12-01 K.OHWADA */ package jp.ohwada.java.ksj.busutil.busdb; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; /** * BusDbPref * name of Prefecture & unique id * id is defined by a file name of National Land Numerical Information */ public class BusDbPref extends BusDbBase { private static final String TABLE = "bus_pref"; private PreparedStatement mPsUpdate; private PreparedStatement mPsSelect; /** * constrctor */ public BusDbPref() { super(); } /** * createTable * @return boolean */ public boolean createTable() { return createTable( "CREATE TABLE " + TABLE + " ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, name VARCHAR(256) NOT NULL, romaji VARCHAR(256) NOT NULL, node_num INT, route_num INT, max_lat DOUBLE, min_lat DOUBLE, max_lon DOUBLE, min_lon DOUBLE);" ); } /** * prepareStatement */ public void prepareStatement() { try { mPsUpdate = mConnection.prepareStatement( "UPDATE " + TABLE + " SET node_num=?, route_num=?, max_lat=?, min_lat=?, max_lon=?, min_lon=? WHERE id=?" ); mPsSelect = mConnection.prepareStatement( "SELECT * FROM " + TABLE + " WHERE id=?" ); } catch (SQLException e) { e.printStackTrace(); } } /** * prepareStatement */ public void closeStatement() { try { mPsUpdate.close(); mPsSelect.close(); } catch (SQLException e) { e.printStackTrace(); } } /** * insert */ public void insertPref() { PreparedStatement ps = null; try { ps = mConnection.prepareStatement( "INSERT INTO " + TABLE + " (id,name,romaji) VALUES (?,?,?)" ); } catch (SQLException e) { e.printStackTrace(); } insert( ps, 1, "北海道", "hokkaido" ); insert( ps, 2, "青森", "aomori" ); insert( ps, 3, "岩手", "iwate" ); insert( ps, 4, "宮城", "miyagi" ); insert( ps, 5, "秋田", "akita" ); insert( ps, 6, "山形", "yamagata" ); insert( ps, 7, "福島", "fukushima" ); insert( ps, 8, "茨城", "ibaraki" ); insert( ps, 9, "栃木", "tochigi" ); insert( ps, 10, "群馬", "gunma" ); insert( ps, 11, "埼玉", "saitama" ); insert( ps, 12, "千葉", "chiba" ); insert( ps, 13, "東京", "tokyo" ); insert( ps, 14, "神奈川", "kanagawa" ); insert( ps, 15, "新潟", "niigata" ); insert( ps, 16, "富山", "toyama" ); insert( ps, 17, "石川", "ishikawa" ); insert( ps, 18, "福井", "fukui" ); insert( ps, 19, "山梨", "yamanashi" ); insert( ps, 20, "長野", "nagano" ); insert( ps, 21, "岐阜", "gifu" ); insert( ps, 22, "静岡", "shizuoka" ); insert( ps, 23, "愛知", "aichi" ); insert( ps, 24, "三重", "mie" ); insert( ps, 25, "滋賀", "shiga" ); insert( ps, 26, "京都", "kyoto" ); insert( ps, 27, "大阪", "osaka" ); insert( ps, 28, "兵庫", "hyuogo" ); insert( ps, 29, "奈良", "nara" ); insert( ps, 30, "和歌山", "wakayama" ); insert( ps, 31, "鳥取", "tottori" ); insert( ps, 32, "島根", "shimane" ); insert( ps, 33, "岡山", "okayama" ); insert( ps, 34, "広島", "hiroshima" ); insert( ps, 35, "山口", "yamaguchi" ); insert( ps, 36, "徳島", "tokushima" ); insert( ps, 37, "香川", "kagawa" ); insert( ps, 38, "愛媛", "ehime" ); insert( ps, 39, "高知", "kouchi" ); insert( ps, 40, "福岡", "fukuoka" ); insert( ps, 41, "佐賀", "saga" ); insert( ps, 42, "長崎", "nagasaki" ); insert( ps, 43, "熊本", "kumamoto" ); insert( ps, 44, "大分", "oita" ); insert( ps, 45, "宮崎", "miyazaki" ); insert( ps, 46, "鹿児島", "kagoshima" ); insert( ps, 47, "沖縄", "okinawa" ); try { if ( ps != null ) { ps.close(); } } catch (SQLException e) { e.printStackTrace(); } } private void insert( PreparedStatement ps, int id, String name, String romaji ) { try { ps.setInt(1, id); ps.setString(2, name); ps.setString(3, romaji); ps.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); } } /** * updatePrefNum * @param int prefNo * @param int nodeNum * @param int routeNum * @param double maxLat * @param double minLat * @param double maxLon * @param double minLon */ public void updatePrefNum( int prefNo, int nodeNum, int routeNum, double maxLat, double minLat, double maxLon, double minLon ) { printMsg( "updatePrefNum " + prefNo + " " + nodeNum + " " + routeNum + " " + maxLat + " " + minLat + " " + maxLon + " " + minLon ); PreparedStatement ps = mPsUpdate; try { ps.setInt(1, nodeNum); ps.setInt(2, routeNum); ps.setDouble(3, maxLat); ps.setDouble(4, minLat); ps.setDouble(5, maxLon); ps.setDouble(6, minLon); ps.setInt(7, prefNo); ps.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); } } public BusRecPref selectPrefById( int id ) { List<BusRecPref> list = selectList( id ); if ( list.size() == 1 ) { return list.get(0); } if ( list.size() > 1 ) { // error } return null; } private List<BusRecPref> selectList( int id ) { List<BusRecPref> list = new ArrayList<BusRecPref>(); ResultSet rs = null; try { mPsSelect.setInt(1, id); rs = mPsSelect.executeQuery(); } catch (SQLException e) { e.printStackTrace(); } if ( rs == null ) return list; list = getRec( rs ); try { rs.close(); } catch (SQLException e) { e.printStackTrace(); } return list; } private List<BusRecPref> getRec( ResultSet rset ) { List<BusRecPref> list = new ArrayList<BusRecPref>(); if ( rset == null ) return list; BusRecPref rec; try { while (rset.next()) { rec = new BusRecPref(); rec.id = rset.getInt("id"); rec.name = rset.getString("name"); rec.romaji = rset.getString("romaji"); rec.node_num = rset.getInt("node_num"); rec.route_num = rset.getInt("route_num"); rec.max_lat = rset.getFloat("max_lat"); rec.min_lat = rset.getFloat("min_lat"); rec.max_lon = rset.getFloat("max_lon"); rec.min_lon = rset.getFloat("min_lon"); list.add( rec ); } } catch (SQLException e) { e.printStackTrace(); } return list; } }
7,331
0.492782
0.476945
228
30.293859
25.167797
241
false
false
0
0
0
0
0
0
1.285088
false
false
1
96aee323fbe2a4995e16ec5d7b1ac11aac96f22f
36,275,293,817,413
5c35cc358dfe34ea88f8ed904071a4e9cbcb09f6
/HubbsCenter/src/com/example/dissentfinal/HandBookScreen2.java
8e9e045f91fe4e7e925f9b0187008f30da40ed57
[]
no_license
kennybello/DissentFinal
https://github.com/kennybello/DissentFinal
85e7825b7d36182297c2c395060f92944e753eb0
a532324f0fed7e70db002ade93c880e2b236f1ce
refs/heads/master
"2020-04-15T21:08:55.945000"
"2015-08-12T07:03:52"
"2015-08-12T07:03:52"
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.dissentfinal; import android.app.Activity; import android.os.Bundle; import android.widget.Button; public class HandBookScreen2 extends Activity { Button scavange_menu2; @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.activity_hand_screen2); } }
UTF-8
Java
354
java
HandBookScreen2.java
Java
[]
null
[]
package com.example.dissentfinal; import android.app.Activity; import android.os.Bundle; import android.widget.Button; public class HandBookScreen2 extends Activity { Button scavange_menu2; @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.activity_hand_screen2); } }
354
0.79096
0.782486
18
18.611111
18.439507
49
false
false
0
0
0
0
0
0
0.944444
false
false
1
f931b6e25e4d4c152325bb9a828e4e5bf694a867
37,572,373,934,234
262fd9d734810d029160327c7826e352673e9ce8
/Documents/workspace/RedSocial_JSF/RedSocial_JSF-war/src/java/eajsf/bean/AdministrarBean.java
bbff8c69c35a547e22aea527ec5fc2977055f0cb
[]
no_license
jasus/RedSocial_JSF
https://github.com/jasus/RedSocial_JSF
bbc563982a47a9a719feaa6270b1947efaea9386
a569a0f690c403094e5e6cbba0a7110cbee08cef
refs/heads/master
"2020-12-25T19:03:09.225000"
"2015-05-31T21:54:18"
"2015-05-31T21:54:18"
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * 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 eajsf.bean; import eajsf.ejb.UsuarioFacade; import eajsf.entity.Usuario; import javax.ejb.EJB; import javax.faces.bean.ManagedBean; import javax.faces.bean.RequestScoped; /** * * @author Azahar */ @ManagedBean @RequestScoped public class AdministrarBean { @EJB private UsuarioFacade usuarioFacade; private Usuario usuario; private String nombreBoton; private String classBoton; public UsuarioFacade getUsuarioFacade() { return usuarioFacade; } public void setUsuarioFacade(UsuarioFacade usuarioFacade) { this.usuarioFacade = usuarioFacade; } public Usuario getUsuario() { return usuario; } public void setUsuario(Usuario usuario) { this.usuario = usuario; } public String getNombreBoton() { return nombreBoton; } public void setNombreBoton(String nombreBoton) { this.nombreBoton = nombreBoton; } public String getClassBoton() { return classBoton; } public void setClassBoton(String classBoton) { this.classBoton = classBoton; } public String nombreBoton(Usuario u){ usuario = u; if(usuarioFacade.estaBloqueado(usuario)){ nombreBoton="Desbloquear"; }else{ nombreBoton="Bloquear"; } return nombreBoton; } public String classBoton(Usuario u){ usuario = u; if(usuarioFacade.estaBloqueado(usuario)){ classBoton="btn btn-success"; }else{ classBoton="btn btn-danger"; } return classBoton; } public void bloquear(Usuario u){ usuario = u; if(!usuarioFacade.estaBloqueado(usuario)){ usuario.setBloqueado("t"); usuarioFacade.edit(usuario); }else{ usuario.setBloqueado("f"); usuarioFacade.edit(usuario); } } public AdministrarBean() { } }
UTF-8
Java
2,223
java
AdministrarBean.java
Java
[ { "context": "javax.faces.bean.RequestScoped;\n\n/**\n *\n * @author Azahar\n */\n@ManagedBean\n@RequestScoped\npublic class Ad", "end": 388, "score": 0.7453562021255493, "start": 384, "tag": "NAME", "value": "Azah" }, { "context": ".faces.bean.RequestScoped;\n\n/**\n *\n * @author Azahar\n */\n@ManagedBean\n@RequestScoped\npublic class Admi", "end": 390, "score": 0.5764927268028259, "start": 388, "tag": "USERNAME", "value": "ar" } ]
null
[]
/* * 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 eajsf.bean; import eajsf.ejb.UsuarioFacade; import eajsf.entity.Usuario; import javax.ejb.EJB; import javax.faces.bean.ManagedBean; import javax.faces.bean.RequestScoped; /** * * @author Azahar */ @ManagedBean @RequestScoped public class AdministrarBean { @EJB private UsuarioFacade usuarioFacade; private Usuario usuario; private String nombreBoton; private String classBoton; public UsuarioFacade getUsuarioFacade() { return usuarioFacade; } public void setUsuarioFacade(UsuarioFacade usuarioFacade) { this.usuarioFacade = usuarioFacade; } public Usuario getUsuario() { return usuario; } public void setUsuario(Usuario usuario) { this.usuario = usuario; } public String getNombreBoton() { return nombreBoton; } public void setNombreBoton(String nombreBoton) { this.nombreBoton = nombreBoton; } public String getClassBoton() { return classBoton; } public void setClassBoton(String classBoton) { this.classBoton = classBoton; } public String nombreBoton(Usuario u){ usuario = u; if(usuarioFacade.estaBloqueado(usuario)){ nombreBoton="Desbloquear"; }else{ nombreBoton="Bloquear"; } return nombreBoton; } public String classBoton(Usuario u){ usuario = u; if(usuarioFacade.estaBloqueado(usuario)){ classBoton="btn btn-success"; }else{ classBoton="btn btn-danger"; } return classBoton; } public void bloquear(Usuario u){ usuario = u; if(!usuarioFacade.estaBloqueado(usuario)){ usuario.setBloqueado("t"); usuarioFacade.edit(usuario); }else{ usuario.setBloqueado("f"); usuarioFacade.edit(usuario); } } public AdministrarBean() { } }
2,223
0.605038
0.605038
95
22.389473
18.451241
79
false
false
0
0
0
0
0
0
0.357895
false
false
1
c4e3ddb7325658a299ef5d5705aa644f9e40da57
38,611,756,012,115
4cdb0cfee3bee21990b6b0f72c41cce3d4a79e5b
/IN1010/Ukesoppgave 5/Sau.java
bef45e3e03d1f7233601a9f4e2a81e2911591fcb
[]
no_license
MehCheniti/Java
https://github.com/MehCheniti/Java
b7d738f235374eed9111adbda1967a8662f53ebd
150e8fd4fdecd1a4a99f12828048b6a3e0d67b4e
refs/heads/master
"2021-06-24T17:07:19.833000"
"2021-03-14T21:56:53"
"2021-03-14T21:56:53"
206,415,757
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class Sau implements Planteetere{ public void beskyttDegSelv(){ System.out.println("Beskytting av seg selv."); } }
UTF-8
Java
126
java
Sau.java
Java
[]
null
[]
public class Sau implements Planteetere{ public void beskyttDegSelv(){ System.out.println("Beskytting av seg selv."); } }
126
0.746032
0.746032
7
17
19.726704
48
false
false
0
0
0
0
0
0
0.142857
false
false
1
f886fd3111d8c99462fdba9deeacec41521466da
33,792,802,745,235
753f9904b0c76f959881c6bb0ed49592a92ad8e2
/p2p_client/clientp2p/src/main/java/com/distributed_systems/group_2/impl/OtherClientImpl.java
5a8722efaba6f0b2916fa54d5c33c4affa03faae
[]
no_license
alisopp/distributed_systems_project
https://github.com/alisopp/distributed_systems_project
96c54bd4501e62109c31217120ac4e70cee16d13
9181afebf93021c715df225d583ee9f883a81898
refs/heads/master
"2020-03-17T06:34:02.043000"
"2018-07-04T10:35:16"
"2018-07-04T10:35:16"
133,360,657
0
0
null
false
"2018-06-30T16:40:49"
"2018-05-14T12:56:27"
"2018-06-29T17:51:49"
"2018-06-30T16:40:48"
208
0
0
0
Java
false
null
package com.distributed_systems.group_2.impl; import com.distributed_systems.group_2.interfaces.OtherClient; import java.net.InetAddress; public class OtherClientImpl implements OtherClient { private String userName; private int port; private InetAddress socketAddress; private int localCommunicationPartnerIndex; private boolean hasServerSocket = false; public OtherClientImpl(String userName, int port, InetAddress socketAddress) { this.userName = userName; this.port = port; this.socketAddress = socketAddress; } @Override public InetAddress getRemoteAddress() { return socketAddress; } @Override public int getSocketPort() { return port; } @Override public String getUserName() { return userName; } @Override public int localCommunicationPartnerIndex() { return localCommunicationPartnerIndex; } @Override public void setLocalCommunicationPartnerIndex(int index) { this.localCommunicationPartnerIndex = index; } @Override public boolean hasServerSocket() { return this.hasServerSocket; } @Override public void setHasServerSocket() { this.hasServerSocket = true; } }
UTF-8
Java
1,274
java
OtherClientImpl.java
Java
[ { "context": "etAddress socketAddress) {\n this.userName = userName;\n this.port = port;\n this.socketAdd", "end": 495, "score": 0.9990692734718323, "start": 487, "tag": "USERNAME", "value": "userName" }, { "context": "e\n public String getUserName() {\n return userName;\n }\n\n @Override\n public int localCommuni", "end": 815, "score": 0.9791255593299866, "start": 807, "tag": "USERNAME", "value": "userName" } ]
null
[]
package com.distributed_systems.group_2.impl; import com.distributed_systems.group_2.interfaces.OtherClient; import java.net.InetAddress; public class OtherClientImpl implements OtherClient { private String userName; private int port; private InetAddress socketAddress; private int localCommunicationPartnerIndex; private boolean hasServerSocket = false; public OtherClientImpl(String userName, int port, InetAddress socketAddress) { this.userName = userName; this.port = port; this.socketAddress = socketAddress; } @Override public InetAddress getRemoteAddress() { return socketAddress; } @Override public int getSocketPort() { return port; } @Override public String getUserName() { return userName; } @Override public int localCommunicationPartnerIndex() { return localCommunicationPartnerIndex; } @Override public void setLocalCommunicationPartnerIndex(int index) { this.localCommunicationPartnerIndex = index; } @Override public boolean hasServerSocket() { return this.hasServerSocket; } @Override public void setHasServerSocket() { this.hasServerSocket = true; } }
1,274
0.688383
0.686813
55
22.163637
20.561892
82
false
false
0
0
0
0
0
0
0.363636
false
false
1
56bfa63eb267fe946b91379b13aea6237b219905
19,756,849,619,531
e87b260718ff9a4ce4446c7814918eb41400fe32
/src/main/java/com/lineate/bench/pattern/flyweight/example/GenericRobot.java
a705e72f57ccc605e349067b9d2b2c6979338b6e
[]
no_license
dmitrybor/patterns
https://github.com/dmitrybor/patterns
dc14e59063d17d52d0223b5fd370ae2af1b09115
13d1455899fdc06f32ac00b15b983d7913d2e96b
refs/heads/master
"2023-04-02T00:56:09.225000"
"2021-04-13T02:46:27"
"2021-04-13T02:46:27"
339,705,098
0
0
null
false
"2021-04-13T02:46:28"
"2021-02-17T11:41:40"
"2021-04-10T04:44:03"
"2021-04-13T02:46:27"
115
0
0
0
Java
false
false
package com.lineate.bench.pattern.flyweight.example; public class GenericRobot implements Robot { private String type; private String color; public GenericRobot(String type) { this.type = type; } @Override public void print() { System.out.println(String.join(" ", "This is a", type, "robot with", color, "color")); } @Override public void setColor(String robotColor) { this.color = robotColor; } public void setType(String type) { this.type = type; } public String getType() { return type; } public String getColor() { return color; } }
UTF-8
Java
657
java
GenericRobot.java
Java
[]
null
[]
package com.lineate.bench.pattern.flyweight.example; public class GenericRobot implements Robot { private String type; private String color; public GenericRobot(String type) { this.type = type; } @Override public void print() { System.out.println(String.join(" ", "This is a", type, "robot with", color, "color")); } @Override public void setColor(String robotColor) { this.color = robotColor; } public void setType(String type) { this.type = type; } public String getType() { return type; } public String getColor() { return color; } }
657
0.604262
0.604262
33
18.90909
20.420376
94
false
false
0
0
0
0
0
0
0.424242
false
false
1
cb9fe6f58518fdc0ad8bdb17c3581b84a3a71194
1,090,921,696,974
ea9823b697005a693ce32cb6e3c244ec81a64535
/src/main/java/com/github/gitproject1/one/controller/detail/FormControlBuilder.java
44896a00b9e8dc8b80e68695362bcf773bd2be97
[]
no_license
gitproject1/one
https://github.com/gitproject1/one
1abfb8929e68e1c9d185f1ae0ac6dca548b83553
33ef3baf32dd21b4116996ee21c7017b679f84a1
refs/heads/master
"2021-01-20T18:28:52.802000"
"2016-06-22T01:08:19"
"2016-06-22T01:08:19"
60,175,939
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.github.gitproject1.one.controller.detail; import org.primefaces.extensions.model.dynaform.DynaFormRow; public interface FormControlBuilder { public void populateRow(DynaFormRow row); }
UTF-8
Java
200
java
FormControlBuilder.java
Java
[]
null
[]
package com.github.gitproject1.one.controller.detail; import org.primefaces.extensions.model.dynaform.DynaFormRow; public interface FormControlBuilder { public void populateRow(DynaFormRow row); }
200
0.835
0.83
7
27.571428
24.558136
60
false
false
0
0
0
0
0
0
0.571429
false
false
1
95bf5619c14eaa2df331f6f4c0ac140ecc28f956
20,968,030,384,387
f59174759209be01ec02bce403129d028e93adac
/AndBatis/src/kr/hyosang/andbatis/AndBatis.java
c84eff70ab6cfecf54b2d6c24c47711aaabd8ad7
[]
no_license
hyosang82/AndBatis
https://github.com/hyosang82/AndBatis
54f98b5f220af6e2a73369e5323d5312bedd7d47
a9ce5687186e40feeccf656b420d8a78c0e15370
refs/heads/master
"2016-09-06T04:27:18.566000"
"2015-04-07T09:10:30"
"2015-04-07T09:10:30"
32,376,723
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package kr.hyosang.andbatis; import java.util.HashMap; import android.content.Context; public class AndBatis { private static AndBatis mInstance = null; public static SqlMap getInstance(Context context, int sqlmapRawResource) throws AndBatisException { if(mInstance == null) { mInstance = new AndBatis(context); } return mInstance.getSqlmap(sqlmapRawResource); } private Context mContext = null; private HashMap<Integer, SqlMap> mSqlmapCache = null; private AndBatis(Context context) { mContext = context; mSqlmapCache = new HashMap<Integer, SqlMap>(); } private SqlMap getSqlmap(int sqlmapRes) throws AndBatisException { SqlMap s = mSqlmapCache.get(sqlmapRes); if(s == null) { //create new instance s = SqlMapLoader.load(mContext, mContext.getResources().getXml(sqlmapRes)); mSqlmapCache.put(sqlmapRes, s); } return s; } }
UTF-8
Java
1,053
java
AndBatis.java
Java
[]
null
[]
package kr.hyosang.andbatis; import java.util.HashMap; import android.content.Context; public class AndBatis { private static AndBatis mInstance = null; public static SqlMap getInstance(Context context, int sqlmapRawResource) throws AndBatisException { if(mInstance == null) { mInstance = new AndBatis(context); } return mInstance.getSqlmap(sqlmapRawResource); } private Context mContext = null; private HashMap<Integer, SqlMap> mSqlmapCache = null; private AndBatis(Context context) { mContext = context; mSqlmapCache = new HashMap<Integer, SqlMap>(); } private SqlMap getSqlmap(int sqlmapRes) throws AndBatisException { SqlMap s = mSqlmapCache.get(sqlmapRes); if(s == null) { //create new instance s = SqlMapLoader.load(mContext, mContext.getResources().getXml(sqlmapRes)); mSqlmapCache.put(sqlmapRes, s); } return s; } }
1,053
0.613485
0.613485
40
25.325001
24.85899
103
false
false
0
0
0
0
0
0
0.475
false
false
1
88ed914924aded489c73f3ecd8df429b15b87809
34,144,990,059,681
499f79018f5f6d691b7fd6a6df0dbc8fa984ef24
/Arc.java
2faa96190e4abecf685e09c8e6e9db9bb2bbb712
[]
no_license
kzh4ng/CS1501-Assignment-4
https://github.com/kzh4ng/CS1501-Assignment-4
9b26f90b2b2758cde5bae98cd36cfd7f3a83c92c
5fe7eea64a059710df7c7b719d93ded11a9a6ecf
refs/heads/master
"2021-01-10T08:00:33.260000"
"2015-11-25T02:59:49"
"2015-11-25T02:59:49"
47,891,339
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
//package com.company; /** * Created by kevin on 11/23/15. */ public class Arc { private int v; private int w; public Arc(){ v = -1; w = -1; } public Arc(int i, int j){ v = i; w = j; } public int v(){ return v; } public int w(){ return w; } }
UTF-8
Java
336
java
Arc.java
Java
[ { "context": "//package com.company;\n\n/**\n * Created by kevin on 11/23/15.\n */\npublic class Arc {\n private i", "end": 47, "score": 0.948928952217102, "start": 42, "tag": "USERNAME", "value": "kevin" } ]
null
[]
//package com.company; /** * Created by kevin on 11/23/15. */ public class Arc { private int v; private int w; public Arc(){ v = -1; w = -1; } public Arc(int i, int j){ v = i; w = j; } public int v(){ return v; } public int w(){ return w; } }
336
0.425595
0.401786
25
12.44
8.9491
32
false
false
0
0
0
0
0
0
0.4
false
false
1
00a85609db68dcebf1187cf308a2c5dd345cea2a
16,784,732,240,316
7d12ac667d6232d2a960f2011848f029260526fe
/src/main/java/com/nearsoft/utils/StringUtils.java
aaaee610fc655a52e8387a8aa828ed005e1bced2
[]
no_license
saishaddai/FlightInfoRetriever
https://github.com/saishaddai/FlightInfoRetriever
f962550692461bc8e70d101e63a5ba332ebdb62f
6aadb6f58581fdcb0972859dee42788818ef7ecc
refs/heads/master
"2016-09-06T11:19:04.424000"
"2014-04-27T23:10:04"
"2014-04-27T23:10:04"
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.nearsoft.utils; import java.util.regex.Matcher; import java.util.regex.Pattern; public class StringUtils { public static String camelize(String str, boolean... toUpper) { Pattern pattern = Pattern.compile("[^_]+"); Matcher matcher = pattern.matcher(str); StringBuffer buffer = new StringBuffer(); while (matcher.find()) { buffer.append(matcher.group(0).substring(0, 1).toUpperCase()); buffer.append(matcher.group(0).substring(1)); } String result = buffer.toString(); if (0 < toUpper.length && !toUpper[0]) result = result.substring(0, 1).toLowerCase() + result.substring(1); return result; } public static void main(String... args) { System.out.println("<<camelize>>"); String str = "under_score_style_string"; System.out.println("[source]=>" + str); System.out.println("[result(default)]=>" + camelize(str)); System.out.println("[result(toLowerCase)]=>" + camelize(str, false)); } }
UTF-8
Java
1,056
java
StringUtils.java
Java
[]
null
[]
package com.nearsoft.utils; import java.util.regex.Matcher; import java.util.regex.Pattern; public class StringUtils { public static String camelize(String str, boolean... toUpper) { Pattern pattern = Pattern.compile("[^_]+"); Matcher matcher = pattern.matcher(str); StringBuffer buffer = new StringBuffer(); while (matcher.find()) { buffer.append(matcher.group(0).substring(0, 1).toUpperCase()); buffer.append(matcher.group(0).substring(1)); } String result = buffer.toString(); if (0 < toUpper.length && !toUpper[0]) result = result.substring(0, 1).toLowerCase() + result.substring(1); return result; } public static void main(String... args) { System.out.println("<<camelize>>"); String str = "under_score_style_string"; System.out.println("[source]=>" + str); System.out.println("[result(default)]=>" + camelize(str)); System.out.println("[result(toLowerCase)]=>" + camelize(str, false)); } }
1,056
0.611742
0.602273
29
35.448277
24.846544
80
false
false
0
0
0
0
0
0
0.689655
false
false
1
2316aca7f03c800b0a5e50ee01f971bdb5298b98
12,721,693,178,809
ceb4454530a44013e0c5c46a039a9bd402782acd
/MMUKS_main/src/mmuks/projekt/SwingClient.java
56c6feccfe13135ba9f30b711cbf93f155b00675
[ "MIT" ]
permissive
vreid/MMUKS_Projekt
https://github.com/vreid/MMUKS_Projekt
5d8d8f5edc021d2c0755cacc7d52712bc52d1514
ad4897fb7a939b281462e8e2e76c47e3216ff9c0
refs/heads/master
"2016-05-27T19:05:40.950000"
"2013-12-04T20:45:51"
"2013-12-04T20:45:51"
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package mmuks.projekt; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.IOException; import java.net.UnknownHostException; import java.util.ArrayList; import java.util.LinkedList; import java.util.Observable; import java.util.Observer; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JTabbedPane; import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import mmuks.projekt.context.ClientContext; import mmuks.projekt.message.ChannelTextMessage; import mmuks.projekt.message.ConnectMessage; import mmuks.projekt.message.DisconnectMessage; import mmuks.projekt.message.JoinChannelMessage; import mmuks.projekt.message.LeaveChannelMessage; import mmuks.projekt.message.Message; import mmuks.projekt.message.WhisperTextMessage; import mmuks.projekt.net.Connection; import mmuks.projekt.net.NullConnection; import mmuks.projekt.net.ObservableConnection; import mmuks.projekt.net.SocketConnection; public class SwingClient extends javax.swing.JFrame implements Observer, ClientContext { /** * */ private static final long serialVersionUID = 1L; private final JTabbedPane tabbedPane = new JTabbedPane(); private final JTextField inputField = new JTextField(); private final JTextArea textArea = new JTextArea(); private final ArrayList<JTextArea> textAreaList = new ArrayList<JTextArea>(); private final ArrayList<JList<String>> channelUserListList = new ArrayList<JList<String>>(); private String sessionToken = ""; private String nickname = ""; private Connection conn = new NullConnection(); public SwingClient() { super(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); initializeComponents(); } public String getSessionToken() { return sessionToken; } @Override public void setSessionToken(String token) { this.sessionToken = token; } public String getNickname() { return nickname; } @Override public void setNickname(String nickname) { this.nickname = nickname; } private void initializeComponents() { getContentPane().setLayout(new BorderLayout()); setPreferredSize(new Dimension(640, 480)); addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { if (conn != null) { try { conn.sendMessage(new DisconnectMessage( getSessionToken())); conn.close(); } catch (IOException e1) { e1.printStackTrace(); } } } }); // die ganzen "/command" Anweisungen sollten in eigenen Klassen // gekapselt werdenF inputField.addKeyListener(new KeyAdapter() { @Override public void keyTyped(KeyEvent e) { if (e.getKeyChar() == KeyEvent.VK_ENTER) { try { String text = inputField.getText(); if (text.startsWith("/connect")) { String[] split = text .substring("/connect".length()).trim() .split(" "); connect(split[0], split[1]); } else if (text.startsWith("/join")) { join(text.substring("/join".length()).trim()); } else if (text.startsWith("/leave")) { leave(text.substring("/leave".length()).trim()); } else if (text.startsWith("/say")) { say(text.substring("/say".length()).trim()); } else if (text.startsWith("/whisper")) { whisper(text.substring("/whisper".length()).trim()); } inputField.setText(""); } catch (IOException e1) { e1.printStackTrace(); } } } }); tabbedPane.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { setTitle(tabbedPane.getTitleAt(tabbedPane.getSelectedIndex())); } }); tabbedPane.add("info", textArea); getContentPane().add(tabbedPane, BorderLayout.CENTER); getContentPane().add(inputField, BorderLayout.SOUTH); pack(); } private void connect(String address, String desiredNickname) { if (conn != null) { try { if (conn instanceof ObservableConnection) { ((ObservableConnection) conn).deleteObserver(this); } conn.close(); } catch (IOException e) { e.printStackTrace(); } } try { java.net.Socket socket = new java.net.Socket(address, Main.protocolPort); conn = new ObservableConnection(new SocketConnection(socket)); ((ObservableConnection) conn).addObserver(this); conn.sendMessage(new ConnectMessage(desiredNickname)); } catch (UnknownHostException e1) { e1.printStackTrace(); } catch (IOException e1) { e1.printStackTrace(); } } private void join(String channel) throws IOException { conn.sendMessage(new JoinChannelMessage(getSessionToken(), channel)); } private void leave(String channel) throws IOException { conn.sendMessage(new LeaveChannelMessage(getSessionToken(), channel)); } private void say(String content) throws IOException { String channel = tabbedPane.getTitleAt(tabbedPane.getSelectedIndex()); conn.sendMessage(new ChannelTextMessage(getNickname(), channel, content)); } private void whisper(String content) { String selectedUser = channelUserListList.get( tabbedPane.getSelectedIndex() - 1).getSelectedValue(); if (selectedUser == null || selectedUser.isEmpty()) { return; } try { conn.sendMessage(new WhisperTextMessage(getSessionToken(), getNickname(), selectedUser, content)); } catch (IOException e) { e.printStackTrace(); } } @Override public void joinChannel(String channel) { JPanel panel = new JPanel(new BorderLayout()); JTextArea textArea = new JTextArea(); JList<String> channelUserList = new JList<String>(); channelUserList.setPreferredSize(new Dimension(160, 120)); panel.add(textArea, BorderLayout.CENTER, 0); panel.add(channelUserList, BorderLayout.EAST, 1); textAreaList.add(textArea); channelUserListList.add(channelUserList); tabbedPane.addTab(channel, panel); } @Override public void leaveChannel(String channel) { for (int i = 1; i < tabbedPane.getTabCount(); ++i) { if (tabbedPane.getTitleAt(i).equals(channel)) { tabbedPane.removeTabAt(i); textAreaList.remove(i - 1); channelUserListList.remove(i - 1); break; } } } @Override public void updateUserListForChannel(String channel, LinkedList<String> users) { for (int i = 1; i < tabbedPane.getTabCount(); ++i) { if (tabbedPane.getTitleAt(i).equals(channel)) { channelUserListList.get(i - 1).setListData( users.toArray(new String[users.size()])); break; } } } @Override public void displayInfoMessage(String content) { } @Override public void displayWhisperMessage(String from, String content) { textAreaList.get(tabbedPane.getSelectedIndex() - 1).append( from + ": " + content + System.lineSeparator()); } @Override public void displayChannelMessage(String from, String channel, String content) { for (int i = 1; i < tabbedPane.getTabCount(); ++i) { if (tabbedPane.getTitleAt(i).equals(channel)) { textAreaList.get(i - 1).append( from + ": " + content + System.lineSeparator()); break; } } } @Override public void update(Observable conn, Object msg) { if (conn != null && msg != null) { try { ((Message) msg).executeOnClient(this, (Connection) conn); } catch (Exception e) { e.printStackTrace(); } } } }
UTF-8
Java
7,466
java
SwingClient.java
Java
[]
null
[]
package mmuks.projekt; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.IOException; import java.net.UnknownHostException; import java.util.ArrayList; import java.util.LinkedList; import java.util.Observable; import java.util.Observer; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JTabbedPane; import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import mmuks.projekt.context.ClientContext; import mmuks.projekt.message.ChannelTextMessage; import mmuks.projekt.message.ConnectMessage; import mmuks.projekt.message.DisconnectMessage; import mmuks.projekt.message.JoinChannelMessage; import mmuks.projekt.message.LeaveChannelMessage; import mmuks.projekt.message.Message; import mmuks.projekt.message.WhisperTextMessage; import mmuks.projekt.net.Connection; import mmuks.projekt.net.NullConnection; import mmuks.projekt.net.ObservableConnection; import mmuks.projekt.net.SocketConnection; public class SwingClient extends javax.swing.JFrame implements Observer, ClientContext { /** * */ private static final long serialVersionUID = 1L; private final JTabbedPane tabbedPane = new JTabbedPane(); private final JTextField inputField = new JTextField(); private final JTextArea textArea = new JTextArea(); private final ArrayList<JTextArea> textAreaList = new ArrayList<JTextArea>(); private final ArrayList<JList<String>> channelUserListList = new ArrayList<JList<String>>(); private String sessionToken = ""; private String nickname = ""; private Connection conn = new NullConnection(); public SwingClient() { super(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); initializeComponents(); } public String getSessionToken() { return sessionToken; } @Override public void setSessionToken(String token) { this.sessionToken = token; } public String getNickname() { return nickname; } @Override public void setNickname(String nickname) { this.nickname = nickname; } private void initializeComponents() { getContentPane().setLayout(new BorderLayout()); setPreferredSize(new Dimension(640, 480)); addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { if (conn != null) { try { conn.sendMessage(new DisconnectMessage( getSessionToken())); conn.close(); } catch (IOException e1) { e1.printStackTrace(); } } } }); // die ganzen "/command" Anweisungen sollten in eigenen Klassen // gekapselt werdenF inputField.addKeyListener(new KeyAdapter() { @Override public void keyTyped(KeyEvent e) { if (e.getKeyChar() == KeyEvent.VK_ENTER) { try { String text = inputField.getText(); if (text.startsWith("/connect")) { String[] split = text .substring("/connect".length()).trim() .split(" "); connect(split[0], split[1]); } else if (text.startsWith("/join")) { join(text.substring("/join".length()).trim()); } else if (text.startsWith("/leave")) { leave(text.substring("/leave".length()).trim()); } else if (text.startsWith("/say")) { say(text.substring("/say".length()).trim()); } else if (text.startsWith("/whisper")) { whisper(text.substring("/whisper".length()).trim()); } inputField.setText(""); } catch (IOException e1) { e1.printStackTrace(); } } } }); tabbedPane.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { setTitle(tabbedPane.getTitleAt(tabbedPane.getSelectedIndex())); } }); tabbedPane.add("info", textArea); getContentPane().add(tabbedPane, BorderLayout.CENTER); getContentPane().add(inputField, BorderLayout.SOUTH); pack(); } private void connect(String address, String desiredNickname) { if (conn != null) { try { if (conn instanceof ObservableConnection) { ((ObservableConnection) conn).deleteObserver(this); } conn.close(); } catch (IOException e) { e.printStackTrace(); } } try { java.net.Socket socket = new java.net.Socket(address, Main.protocolPort); conn = new ObservableConnection(new SocketConnection(socket)); ((ObservableConnection) conn).addObserver(this); conn.sendMessage(new ConnectMessage(desiredNickname)); } catch (UnknownHostException e1) { e1.printStackTrace(); } catch (IOException e1) { e1.printStackTrace(); } } private void join(String channel) throws IOException { conn.sendMessage(new JoinChannelMessage(getSessionToken(), channel)); } private void leave(String channel) throws IOException { conn.sendMessage(new LeaveChannelMessage(getSessionToken(), channel)); } private void say(String content) throws IOException { String channel = tabbedPane.getTitleAt(tabbedPane.getSelectedIndex()); conn.sendMessage(new ChannelTextMessage(getNickname(), channel, content)); } private void whisper(String content) { String selectedUser = channelUserListList.get( tabbedPane.getSelectedIndex() - 1).getSelectedValue(); if (selectedUser == null || selectedUser.isEmpty()) { return; } try { conn.sendMessage(new WhisperTextMessage(getSessionToken(), getNickname(), selectedUser, content)); } catch (IOException e) { e.printStackTrace(); } } @Override public void joinChannel(String channel) { JPanel panel = new JPanel(new BorderLayout()); JTextArea textArea = new JTextArea(); JList<String> channelUserList = new JList<String>(); channelUserList.setPreferredSize(new Dimension(160, 120)); panel.add(textArea, BorderLayout.CENTER, 0); panel.add(channelUserList, BorderLayout.EAST, 1); textAreaList.add(textArea); channelUserListList.add(channelUserList); tabbedPane.addTab(channel, panel); } @Override public void leaveChannel(String channel) { for (int i = 1; i < tabbedPane.getTabCount(); ++i) { if (tabbedPane.getTitleAt(i).equals(channel)) { tabbedPane.removeTabAt(i); textAreaList.remove(i - 1); channelUserListList.remove(i - 1); break; } } } @Override public void updateUserListForChannel(String channel, LinkedList<String> users) { for (int i = 1; i < tabbedPane.getTabCount(); ++i) { if (tabbedPane.getTitleAt(i).equals(channel)) { channelUserListList.get(i - 1).setListData( users.toArray(new String[users.size()])); break; } } } @Override public void displayInfoMessage(String content) { } @Override public void displayWhisperMessage(String from, String content) { textAreaList.get(tabbedPane.getSelectedIndex() - 1).append( from + ": " + content + System.lineSeparator()); } @Override public void displayChannelMessage(String from, String channel, String content) { for (int i = 1; i < tabbedPane.getTabCount(); ++i) { if (tabbedPane.getTitleAt(i).equals(channel)) { textAreaList.get(i - 1).append( from + ": " + content + System.lineSeparator()); break; } } } @Override public void update(Observable conn, Object msg) { if (conn != null && msg != null) { try { ((Message) msg).executeOnClient(this, (Connection) conn); } catch (Exception e) { e.printStackTrace(); } } } }
7,466
0.705867
0.701313
271
26.549816
22.162523
93
false
false
0
0
0
0
0
0
2.531365
false
false
1
fd33c07541b1bd3f85fce2c0ae5f5079b590abce
24,026,047,110,343
40cd4da5514eb920e6a6889e82590e48720c3d38
/desktop/applis/apps/core/common/expressionlanguage/src/test/java/code/expressionlanguage/methods/ProcessMethodArrayTest.java
da716e9fb33da97da9b4f737495948611e3c8ee5
[]
no_license
Cardman/projects
https://github.com/Cardman/projects
02704237e81868f8cb614abb37468cebb4ef4b31
23a9477dd736795c3af10bccccb3cdfa10c8123c
refs/heads/master
"2023-08-17T11:27:41.999000"
"2023-08-15T07:09:28"
"2023-08-15T07:09:28"
34,724,613
4
0
null
false
"2020-10-13T08:08:38"
"2015-04-28T10:39:03"
"2020-10-12T21:02:20"
"2020-10-13T08:08:37"
44,842
1
0
0
Java
false
false
package code.expressionlanguage.methods; import code.expressionlanguage.Argument; import code.expressionlanguage.ContextEl; import code.expressionlanguage.functionid.MethodId; import code.util.CustList; import code.util.StringMap; import org.junit.Test; public final class ProcessMethodArrayTest extends ProcessMethodCommon { @Test public void calculate1Test() { StringBuilder xml_ = new StringBuilder(); xml_.append("$public $class pkg.Ex {\n"); xml_.append(" $public $static $int catching(){\n"); xml_.append(" $int[] a;\n"); xml_.append(" a=$new $int[1i];\n"); xml_.append(" a[0i]=8i;\n"); xml_.append(" a[0i]+=2i;\n"); xml_.append(" $return a[0i];\n"); xml_.append(" }\n"); xml_.append("}\n"); StringMap<String> files_ = new StringMap<String>(); files_.put("pkg/Ex", xml_.toString()); ContextEl cont_ = ctxOk(files_); CustList<Argument> args_ = new CustList<Argument>(); MethodId id_ = getMethodId("catching"); Argument ret_ = new Argument(); ret_ = calculateNormal("pkg.Ex", id_, args_, cont_); assertEq(10, getNumber(ret_)); } @Test public void calculate2Test() { StringBuilder xml_ = new StringBuilder(); xml_.append("$public $class pkg.Ex {\n"); xml_.append(" $public $static $int catching(){\n"); xml_.append(" $int[] a;\n"); xml_.append(" a=$new $int[1i];\n"); xml_.append(" a[0i]=8i;\n"); xml_.append(" $int bk = a[0i]++;\n"); xml_.append(" $return a[0i]+bk;\n"); xml_.append(" }\n"); xml_.append("}\n"); StringMap<String> files_ = new StringMap<String>(); files_.put("pkg/Ex", xml_.toString()); ContextEl cont_ = ctxOk(files_); CustList<Argument> args_ = new CustList<Argument>(); MethodId id_ = getMethodId("catching"); Argument ret_ = new Argument(); ret_ = calculateNormal("pkg.Ex", id_, args_, cont_); assertEq(17, getNumber(ret_)); } @Test public void calculate3Test() { StringBuilder xml_ = new StringBuilder(); xml_.append("$public $class pkg.Ex {\n"); xml_.append(" $public $static $int catching(){\n"); xml_.append(" $int[] a;\n"); xml_.append(" a=$new $int[1i];\n"); xml_.append(" a[0i]=8i;\n"); xml_.append(" $int bk = ++a[0i];\n"); xml_.append(" $return a[0i]+bk;\n"); xml_.append(" }\n"); xml_.append("}\n"); StringMap<String> files_ = new StringMap<String>(); files_.put("pkg/Ex", xml_.toString()); ContextEl cont_ = ctxOk(files_); CustList<Argument> args_ = new CustList<Argument>(); MethodId id_ = getMethodId("catching"); Argument ret_ = new Argument(); ret_ = calculateNormal("pkg.Ex", id_, args_, cont_); assertEq(18, getNumber(ret_)); } @Test public void calculate4Test() { StringBuilder xml_ = new StringBuilder(); xml_.append("$public $class pkg.Ex {\n"); xml_.append(" $public $static String catching(){\n"); xml_.append(" String[] a;\n"); xml_.append(" a=$new String[1i];\n"); xml_.append(" a[0i]=\"first \";\n"); xml_.append(" a[0i]+=\"second\";\n"); xml_.append(" $return a[0i];\n"); xml_.append(" }\n"); xml_.append("}\n"); StringMap<String> files_ = new StringMap<String>(); files_.put("pkg/Ex", xml_.toString()); ContextEl cont_ = ctxOk(files_); CustList<Argument> args_ = new CustList<Argument>(); MethodId id_ = getMethodId("catching"); Argument ret_ = new Argument(); ret_ = calculateNormal("pkg.Ex", id_, args_, cont_); assertEq("first second", getString(ret_)); } @Test public void calculate5Test() { StringBuilder xml_ = new StringBuilder(); xml_.append("$public $class pkg.Ex {\n"); xml_.append(" $public $static String catching(){\n"); xml_.append(" Object a;\n"); xml_.append(" a=($new String{});\n"); xml_.append(" $return $null;\n"); xml_.append(" }\n"); xml_.append("}\n"); StringMap<String> files_ = new StringMap<String>(); files_.put("pkg/Ex", xml_.toString()); assertTrue(hasErr(files_)); } @Test public void calculate6Test() { StringBuilder xml_ = new StringBuilder(); xml_.append("$public $class pkg.Ex {\n"); xml_.append(" $public $static $int catching(){\n"); xml_.append(" $int[] a;\n"); xml_.append(" a=$new $int[1];\n"); xml_.append(" a[0]=8i;\n"); xml_.append(" $return a[0s];\n"); xml_.append(" }\n"); xml_.append("}\n"); StringMap<String> files_ = new StringMap<String>(); files_.put("pkg/Ex", xml_.toString()); ContextEl cont_ = ctxOk(files_); CustList<Argument> args_ = new CustList<Argument>(); MethodId id_ = getMethodId("catching"); Argument ret_ = new Argument(); ret_ = calculateNormal("pkg.Ex", id_, args_, cont_); assertEq(8, getNumber(ret_)); } @Test public void calculate7Test() { StringBuilder xml_ = new StringBuilder(); xml_.append("$public $class pkg.Ex {\n"); xml_.append(" $public $static $int catching(){\n"); xml_.append(" $int[] a;\n"); xml_.append(" a=$new $int[128];\n"); xml_.append(" a['0']=8i;\n"); xml_.append(" $return a['0'];\n"); xml_.append(" }\n"); xml_.append("}\n"); StringMap<String> files_ = new StringMap<String>(); files_.put("pkg/Ex", xml_.toString()); ContextEl cont_ = ctxOk(files_); CustList<Argument> args_ = new CustList<Argument>(); MethodId id_ = getMethodId("catching"); Argument ret_ = new Argument(); ret_ = calculateNormal("pkg.Ex", id_, args_, cont_); assertEq(8, getNumber(ret_)); } }
UTF-8
Java
6,059
java
ProcessMethodArrayTest.java
Java
[]
null
[]
package code.expressionlanguage.methods; import code.expressionlanguage.Argument; import code.expressionlanguage.ContextEl; import code.expressionlanguage.functionid.MethodId; import code.util.CustList; import code.util.StringMap; import org.junit.Test; public final class ProcessMethodArrayTest extends ProcessMethodCommon { @Test public void calculate1Test() { StringBuilder xml_ = new StringBuilder(); xml_.append("$public $class pkg.Ex {\n"); xml_.append(" $public $static $int catching(){\n"); xml_.append(" $int[] a;\n"); xml_.append(" a=$new $int[1i];\n"); xml_.append(" a[0i]=8i;\n"); xml_.append(" a[0i]+=2i;\n"); xml_.append(" $return a[0i];\n"); xml_.append(" }\n"); xml_.append("}\n"); StringMap<String> files_ = new StringMap<String>(); files_.put("pkg/Ex", xml_.toString()); ContextEl cont_ = ctxOk(files_); CustList<Argument> args_ = new CustList<Argument>(); MethodId id_ = getMethodId("catching"); Argument ret_ = new Argument(); ret_ = calculateNormal("pkg.Ex", id_, args_, cont_); assertEq(10, getNumber(ret_)); } @Test public void calculate2Test() { StringBuilder xml_ = new StringBuilder(); xml_.append("$public $class pkg.Ex {\n"); xml_.append(" $public $static $int catching(){\n"); xml_.append(" $int[] a;\n"); xml_.append(" a=$new $int[1i];\n"); xml_.append(" a[0i]=8i;\n"); xml_.append(" $int bk = a[0i]++;\n"); xml_.append(" $return a[0i]+bk;\n"); xml_.append(" }\n"); xml_.append("}\n"); StringMap<String> files_ = new StringMap<String>(); files_.put("pkg/Ex", xml_.toString()); ContextEl cont_ = ctxOk(files_); CustList<Argument> args_ = new CustList<Argument>(); MethodId id_ = getMethodId("catching"); Argument ret_ = new Argument(); ret_ = calculateNormal("pkg.Ex", id_, args_, cont_); assertEq(17, getNumber(ret_)); } @Test public void calculate3Test() { StringBuilder xml_ = new StringBuilder(); xml_.append("$public $class pkg.Ex {\n"); xml_.append(" $public $static $int catching(){\n"); xml_.append(" $int[] a;\n"); xml_.append(" a=$new $int[1i];\n"); xml_.append(" a[0i]=8i;\n"); xml_.append(" $int bk = ++a[0i];\n"); xml_.append(" $return a[0i]+bk;\n"); xml_.append(" }\n"); xml_.append("}\n"); StringMap<String> files_ = new StringMap<String>(); files_.put("pkg/Ex", xml_.toString()); ContextEl cont_ = ctxOk(files_); CustList<Argument> args_ = new CustList<Argument>(); MethodId id_ = getMethodId("catching"); Argument ret_ = new Argument(); ret_ = calculateNormal("pkg.Ex", id_, args_, cont_); assertEq(18, getNumber(ret_)); } @Test public void calculate4Test() { StringBuilder xml_ = new StringBuilder(); xml_.append("$public $class pkg.Ex {\n"); xml_.append(" $public $static String catching(){\n"); xml_.append(" String[] a;\n"); xml_.append(" a=$new String[1i];\n"); xml_.append(" a[0i]=\"first \";\n"); xml_.append(" a[0i]+=\"second\";\n"); xml_.append(" $return a[0i];\n"); xml_.append(" }\n"); xml_.append("}\n"); StringMap<String> files_ = new StringMap<String>(); files_.put("pkg/Ex", xml_.toString()); ContextEl cont_ = ctxOk(files_); CustList<Argument> args_ = new CustList<Argument>(); MethodId id_ = getMethodId("catching"); Argument ret_ = new Argument(); ret_ = calculateNormal("pkg.Ex", id_, args_, cont_); assertEq("first second", getString(ret_)); } @Test public void calculate5Test() { StringBuilder xml_ = new StringBuilder(); xml_.append("$public $class pkg.Ex {\n"); xml_.append(" $public $static String catching(){\n"); xml_.append(" Object a;\n"); xml_.append(" a=($new String{});\n"); xml_.append(" $return $null;\n"); xml_.append(" }\n"); xml_.append("}\n"); StringMap<String> files_ = new StringMap<String>(); files_.put("pkg/Ex", xml_.toString()); assertTrue(hasErr(files_)); } @Test public void calculate6Test() { StringBuilder xml_ = new StringBuilder(); xml_.append("$public $class pkg.Ex {\n"); xml_.append(" $public $static $int catching(){\n"); xml_.append(" $int[] a;\n"); xml_.append(" a=$new $int[1];\n"); xml_.append(" a[0]=8i;\n"); xml_.append(" $return a[0s];\n"); xml_.append(" }\n"); xml_.append("}\n"); StringMap<String> files_ = new StringMap<String>(); files_.put("pkg/Ex", xml_.toString()); ContextEl cont_ = ctxOk(files_); CustList<Argument> args_ = new CustList<Argument>(); MethodId id_ = getMethodId("catching"); Argument ret_ = new Argument(); ret_ = calculateNormal("pkg.Ex", id_, args_, cont_); assertEq(8, getNumber(ret_)); } @Test public void calculate7Test() { StringBuilder xml_ = new StringBuilder(); xml_.append("$public $class pkg.Ex {\n"); xml_.append(" $public $static $int catching(){\n"); xml_.append(" $int[] a;\n"); xml_.append(" a=$new $int[128];\n"); xml_.append(" a['0']=8i;\n"); xml_.append(" $return a['0'];\n"); xml_.append(" }\n"); xml_.append("}\n"); StringMap<String> files_ = new StringMap<String>(); files_.put("pkg/Ex", xml_.toString()); ContextEl cont_ = ctxOk(files_); CustList<Argument> args_ = new CustList<Argument>(); MethodId id_ = getMethodId("catching"); Argument ret_ = new Argument(); ret_ = calculateNormal("pkg.Ex", id_, args_, cont_); assertEq(8, getNumber(ret_)); } }
6,059
0.539693
0.532266
152
38.861843
16.456501
71
false
false
0
0
0
0
0
0
1.223684
false
false
1
6c6b31a49be5da58748e01083327dd17b0a84a3c
24,026,047,107,668
e9f4314a891f9c843b38ea308533ff794476b172
/MessageTypes/TypeOfMessage.java
dca4e9812fe2eba4ea7273aad36fd2a999edf124
[]
no_license
jruan/Chat-Application
https://github.com/jruan/Chat-Application
12620714c2c71b9518a2bb72d06d272e57a68675
c9f565b266553b3c0d71299188bd4ba797007225
refs/heads/master
"2020-03-26T16:30:11.835000"
"2015-02-21T01:09:54"
"2015-02-21T01:09:54"
31,097,095
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package MessageTypes; import java.io.Serializable; public class TypeOfMessage implements Serializable { private String messageType; public TypeOfMessage(String msg){ this.messageType = msg; } public String getMessage(){ return this.messageType; } }
UTF-8
Java
264
java
TypeOfMessage.java
Java
[]
null
[]
package MessageTypes; import java.io.Serializable; public class TypeOfMessage implements Serializable { private String messageType; public TypeOfMessage(String msg){ this.messageType = msg; } public String getMessage(){ return this.messageType; } }
264
0.765152
0.765152
15
16.6
15.982491
52
false
false
0
0
0
0
0
0
1.066667
false
false
1
14b519a438e878dbdd2dfb7738070b9b74d7f211
18,459,769,485,924
425bf32033c89acd4d58581c60fad6cf244a2ee8
/extralibrary/common/src/main/java/com/liuleshuai/common/tools/ClassUtil.java
3aaf7675fc26a0fb730a72262e55b21a0f253e87
[]
no_license
liuleshuai/MVP
https://github.com/liuleshuai/MVP
1b320076f4839987694fe1a9601836db1afbec04
5ae43f1b2df6dfc21bc0a06eea1087d85f9b2418
refs/heads/master
"2021-04-15T19:04:57.197000"
"2018-11-30T17:04:29"
"2018-11-30T17:04:29"
126,559,157
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.liuleshuai.common.tools; /** * Created by LiuKuo at 2018/3/22 */ import java.lang.reflect.ParameterizedType; /** * 类反射初始化 */ public class ClassUtil { /** * 反射生成实例 * * @param o 上下文 * @param i 泛型的位置 * @param <T> 返回类型 * @return */ public static <T> T getT(Object o, int i) { try { return ((Class<T>) ((ParameterizedType) (o.getClass() .getGenericSuperclass())).getActualTypeArguments()[i]) .newInstance(); } catch (InstantiationException e) { } catch (IllegalAccessException e) { } catch (ClassCastException e) { } return null; } /** * 返回xxx.class */ public static <T> Class<T> getTClass(Object o) { try { return (Class<T>) ((ParameterizedType) (o.getClass().getGenericSuperclass())) .getActualTypeArguments()[0]; } catch (ClassCastException e) { } return null; } /** * 由类名获取类 * * @param className * @return */ public static Class<?> forName(String className) { try { return Class.forName(className); } catch (ClassNotFoundException e) { e.printStackTrace(); } return null; } }
UTF-8
Java
1,390
java
ClassUtil.java
Java
[ { "context": "ge com.liuleshuai.common.tools;\n\n/**\n * Created by LiuKuo at 2018/3/22\n */\n\nimport java.lang.reflect.Parame", "end": 62, "score": 0.9905608892440796, "start": 56, "tag": "NAME", "value": "LiuKuo" } ]
null
[]
package com.liuleshuai.common.tools; /** * Created by LiuKuo at 2018/3/22 */ import java.lang.reflect.ParameterizedType; /** * 类反射初始化 */ public class ClassUtil { /** * 反射生成实例 * * @param o 上下文 * @param i 泛型的位置 * @param <T> 返回类型 * @return */ public static <T> T getT(Object o, int i) { try { return ((Class<T>) ((ParameterizedType) (o.getClass() .getGenericSuperclass())).getActualTypeArguments()[i]) .newInstance(); } catch (InstantiationException e) { } catch (IllegalAccessException e) { } catch (ClassCastException e) { } return null; } /** * 返回xxx.class */ public static <T> Class<T> getTClass(Object o) { try { return (Class<T>) ((ParameterizedType) (o.getClass().getGenericSuperclass())) .getActualTypeArguments()[0]; } catch (ClassCastException e) { } return null; } /** * 由类名获取类 * * @param className * @return */ public static Class<?> forName(String className) { try { return Class.forName(className); } catch (ClassNotFoundException e) { e.printStackTrace(); } return null; } }
1,390
0.5181
0.512066
59
21.474577
20.249592
89
false
false
0
0
0
0
0
0
0.169492
false
false
1
6e7cb49137b58c73a420f2fc81e47df4d1cba934
18,459,769,487,600
1d0f59a06d3e8f637367851a6f3e8c0d00d1060a
/agent-template-core-pj/src/main/java/com/indigo/esb/convertor/RestXml2ListConvertor.java
6c3cb7744618bdbb0cb643e47e49e9bb20eb6aae
[]
no_license
rexypark/devlop_adaptor
https://github.com/rexypark/devlop_adaptor
d758d6cba62682e175e7399d73ea3f34e89397e1
22c8dfa35304fc03c3a03173a1e2f419af88e663
refs/heads/master
"2022-04-16T13:17:40.578000"
"2020-04-17T09:34:21"
"2020-04-17T09:34:21"
256,460,072
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.indigo.esb.convertor; import java.util.ArrayList; import java.util.List; import java.util.Map; import org.dom4j.Document; import org.dom4j.Node; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.indigo.esb.util.XmlUtil4Dom4j; /** * @author clupine-mb * */ public class RestXml2ListConvertor implements ESBListConvertor<Map<String, Object>> { protected final static Logger logger = LoggerFactory .getLogger("RestXml2ListConvertor"); String itemsXpath = "//body/items/item"; public void setItemsXpath(String itemsXpath) { this.itemsXpath = itemsXpath; } @Override public List<Map<String, Object>> convert(Object data) throws Exception { List<Map<String, Object>> convertList = new ArrayList<Map<String, Object>>(); Document doc = XmlUtil4Dom4j.parseDoc((String) data, "utf-8"); List<Node> itemList = doc.selectNodes(itemsXpath); logger.debug("itemList = {} ", itemList.size()); for (Node item : itemList) { Map rowMap = XmlUtil4Dom4j.xml2Mapping(item.asXML()); logger.debug("item : {} ", rowMap); convertList.add(rowMap); } return convertList; } public static void main(String[] args) throws Exception { // String serviceKey = "7wN73nJrxhUgLp4Z927RGjhTqdoGFAS3ASWb9ODH/W0brHgxyRLom1eST15xFdYI7RPTF6xruKFufpcARzbERw=="; // List<NameValuePair> paramList = new ArrayList<NameValuePair>(); // paramList.add(new BasicNameValuePair("ServiceKey", serviceKey)); // paramList.add(new BasicNameValuePair("from_date", "20141022")); // paramList.add(new BasicNameValuePair("to_date", "20141022")); // paramList.add(new BasicNameValuePair("numOfRows", "10000")); // 최대 만건까지 // // paramList.add(new BasicNameValuePair("lclass_name", ")); // // paramList.add(new BasicNameValuePair("mclass_name", )); // // paramList.add(new BasicNameValuePair("sclass_name", ")); // // ServiceKey=7wN73nJrxhUgLp4Z927RGjhTqdoGFAS3ASWb9ODH%2FW0brHgxyRLom1eST15xFdYI7RPTF6xruKFufpcARzbERw%3D%3D&from_date=20141020&to_date=20141030 // String url = "http://openapi.epis.or.kr/openapi/service/InsttExaminPcService/getGarakDelngInfoList"; // String queryStr = URLEncodedUtils.format(paramList, "utf-8"); // logger.info("parameter : {}", queryStr); // HttpGet request = new HttpGet(url + "?" + queryStr); // HttpClient client = new DefaultHttpClient(); // HttpResponse response = client.execute(request); // HttpEntity entity = response.getEntity(); // // String xml = null; // if (entity != null) { // xml = IOUtils.toString(entity.getContent()); // } // // // logger.info("resultXml src : {} ", xml); // Document doc = XmlUtil4Dom4j.parseDoc(xml, "utf-8"); // // logger.info("resultXml : {} ", print(doc)); // // List<Node> itemList = doc.selectNodes("//body/items/item"); // logger.info("itemList = {} ", itemList.size()); // for (Node item : itemList) { // // item. // Map rowMap = XmlUtil4Dom4j.xml2Mapping(item.asXML()); // logger.info("item : {} ", rowMap); // // } } }
UHC
Java
3,050
java
RestXml2ListConvertor.java
Java
[ { "context": ".indigo.esb.util.XmlUtil4Dom4j;\r\n\r\n/**\r\n * @author clupine-mb\r\n *\r\n */\r\npublic class RestXml2ListConvertor impl", "end": 299, "score": 0.9995515942573547, "start": 289, "tag": "USERNAME", "value": "clupine-mb" }, { "context": "s) throws Exception {\r\n\r\n//\t\tString serviceKey = \"7wN73nJrxhUgLp4Z927RGjhTqdoGFAS3ASWb9ODH/W0brHgxyRLom1eST15xFdYI7RPTF6xruKFufpcARzbERw==\";\r\n//\t\tList<NameValuePair> paramList = new ArrayLi", "end": 1340, "score": 0.9997851252555847, "start": 1251, "tag": "KEY", "value": "7wN73nJrxhUgLp4Z927RGjhTqdoGFAS3ASWb9ODH/W0brHgxyRLom1eST15xFdYI7RPTF6xruKFufpcARzbERw==\"" }, { "context": "eValuePair(\"sclass_name\", \"));\r\n//\t\t// ServiceKey=7wN73nJrxhUgLp4Z927RGjhTqdoGFAS3ASWb9ODH%2FW0brHgxyRLom1eST15xFdYI7RPTF6xruKFufpcARzbERw%3D%3D&from_date=20141020&to_date=20141030\r\n//\t\tString u", "end": 2001, "score": 0.9993586540222168, "start": 1907, "tag": "KEY", "value": "7wN73nJrxhUgLp4Z927RGjhTqdoGFAS3ASWb9ODH%2FW0brHgxyRLom1eST15xFdYI7RPTF6xruKFufpcARzbERw%3D%3D" } ]
null
[]
package com.indigo.esb.convertor; import java.util.ArrayList; import java.util.List; import java.util.Map; import org.dom4j.Document; import org.dom4j.Node; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.indigo.esb.util.XmlUtil4Dom4j; /** * @author clupine-mb * */ public class RestXml2ListConvertor implements ESBListConvertor<Map<String, Object>> { protected final static Logger logger = LoggerFactory .getLogger("RestXml2ListConvertor"); String itemsXpath = "//body/items/item"; public void setItemsXpath(String itemsXpath) { this.itemsXpath = itemsXpath; } @Override public List<Map<String, Object>> convert(Object data) throws Exception { List<Map<String, Object>> convertList = new ArrayList<Map<String, Object>>(); Document doc = XmlUtil4Dom4j.parseDoc((String) data, "utf-8"); List<Node> itemList = doc.selectNodes(itemsXpath); logger.debug("itemList = {} ", itemList.size()); for (Node item : itemList) { Map rowMap = XmlUtil4Dom4j.xml2Mapping(item.asXML()); logger.debug("item : {} ", rowMap); convertList.add(rowMap); } return convertList; } public static void main(String[] args) throws Exception { // String serviceKey = "<KEY>; // List<NameValuePair> paramList = new ArrayList<NameValuePair>(); // paramList.add(new BasicNameValuePair("ServiceKey", serviceKey)); // paramList.add(new BasicNameValuePair("from_date", "20141022")); // paramList.add(new BasicNameValuePair("to_date", "20141022")); // paramList.add(new BasicNameValuePair("numOfRows", "10000")); // 최대 만건까지 // // paramList.add(new BasicNameValuePair("lclass_name", ")); // // paramList.add(new BasicNameValuePair("mclass_name", )); // // paramList.add(new BasicNameValuePair("sclass_name", ")); // // ServiceKey=<KEY>&from_date=20141020&to_date=20141030 // String url = "http://openapi.epis.or.kr/openapi/service/InsttExaminPcService/getGarakDelngInfoList"; // String queryStr = URLEncodedUtils.format(paramList, "utf-8"); // logger.info("parameter : {}", queryStr); // HttpGet request = new HttpGet(url + "?" + queryStr); // HttpClient client = new DefaultHttpClient(); // HttpResponse response = client.execute(request); // HttpEntity entity = response.getEntity(); // // String xml = null; // if (entity != null) { // xml = IOUtils.toString(entity.getContent()); // } // // // logger.info("resultXml src : {} ", xml); // Document doc = XmlUtil4Dom4j.parseDoc(xml, "utf-8"); // // logger.info("resultXml : {} ", print(doc)); // // List<Node> itemList = doc.selectNodes("//body/items/item"); // logger.info("itemList = {} ", itemList.size()); // for (Node item : itemList) { // // item. // Map rowMap = XmlUtil4Dom4j.xml2Mapping(item.asXML()); // logger.info("item : {} ", rowMap); // // } } }
2,877
0.687953
0.657999
83
34.602409
29.813047
148
false
false
0
0
0
0
88
0.028966
2.060241
false
false
1
aff694be5f17c05447c3be31df70c1eab22aa11c
19,834,159,023,312
bc119fc8a7da9382ae0164d728c54a7ec173967e
/app/src/main/java/com/phonebison/it/easymvp/presenter/LoginPresenterCompl.java
bb288e2d398bc456b19dce0274749fd1626e5617
[]
no_license
PhoneBison/EasyMVP
https://github.com/PhoneBison/EasyMVP
431493766d39e2704f244aedfbabc12f1d034eeb
345c6cb48b3fedd888859d55235346f6bf947c7c
refs/heads/master
"2021-01-01T16:42:21.262000"
"2017-07-21T07:42:17"
"2017-07-21T07:42:17"
97,895,305
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.phonebison.it.easymvp.presenter; import com.phonebison.it.easymvp.model.User; import com.phonebison.it.easymvp.view.ILoginView; /** * Created by Touch on 2017/7/21. */ public class LoginPresenterCompl implements ILoginPresenter { private ILoginView loginView; private User user; public LoginPresenterCompl(ILoginView loginView) { this.loginView = loginView; user=new User("提莫","123456"); } @Override public void clear() { loginView.onClearText(); } @Override public void doLogin(String userName, String passWord) { boolean result=false; int code=0; if(userName.equals(user.getPassWord())&&passWord.equals(user.getPassWord())){ result=true; code=0; }else{ result=false; code=0; } loginView.onLoginResult(result,code); } }
UTF-8
Java
905
java
LoginPresenterCompl.java
Java
[ { "context": "his.loginView = loginView;\n user=new User(\"提莫\",\"123456\");\n }\n\n @Override\n public void ", "end": 421, "score": 0.9976032376289368, "start": 419, "tag": "USERNAME", "value": "提莫" }, { "context": "oginView = loginView;\n user=new User(\"提莫\",\"123456\");\n }\n\n @Override\n public void clear() {", "end": 430, "score": 0.9515023231506348, "start": 424, "tag": "PASSWORD", "value": "123456" } ]
null
[]
package com.phonebison.it.easymvp.presenter; import com.phonebison.it.easymvp.model.User; import com.phonebison.it.easymvp.view.ILoginView; /** * Created by Touch on 2017/7/21. */ public class LoginPresenterCompl implements ILoginPresenter { private ILoginView loginView; private User user; public LoginPresenterCompl(ILoginView loginView) { this.loginView = loginView; user=new User("提莫","<PASSWORD>"); } @Override public void clear() { loginView.onClearText(); } @Override public void doLogin(String userName, String passWord) { boolean result=false; int code=0; if(userName.equals(user.getPassWord())&&passWord.equals(user.getPassWord())){ result=true; code=0; }else{ result=false; code=0; } loginView.onLoginResult(result,code); } }
909
0.63263
0.614872
37
23.351351
20.927437
85
false
false
0
0
0
0
0
0
0.486486
false
false
1
e85ed9194e5cb5dc3dd7f7e983a17ee0b31a5373
3,659,312,192,113
6f672fb72caedccb841ee23f53e32aceeaf1895e
/Photography/pic_collage_source/src/it/sephiroth/android/library/widget/HListView.java
a928add6ae0917993f63a9f2d7ce089ac057b01f
[]
no_license
cha63506/CompSecurity
https://github.com/cha63506/CompSecurity
5c69743f660b9899146ed3cf21eceabe3d5f4280
eee7e74f4088b9c02dd711c061fc04fb1e4e2654
refs/heads/master
"2018-03-23T04:15:18.480000"
"2015-12-19T01:29:58"
"2015-12-19T01:29:58"
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.geocities.com/kpdus/jad.html // Decompiler options: braces fieldsfirst space lnc package it.sephiroth.android.library.widget; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.support.v4.util.SparseArrayCompat; import android.util.AttributeSet; import android.view.FocusFinder; import android.view.KeyEvent; import android.view.SoundEffectConstants; import android.view.View; import android.view.ViewGroup; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; import android.widget.Adapter; import android.widget.ArrayAdapter; import android.widget.Checkable; import android.widget.ListAdapter; import java.util.ArrayList; // Referenced classes of package it.sephiroth.android.library.widget: // AbsHListView, b public class HListView extends AbsHListView { private ArrayList aA; private boolean aB; private boolean aC; private boolean aD; private boolean aE; private boolean aF; private boolean aG; private final Rect aH; private Paint aI; private final a aJ; private FocusSelector aK; Drawable au; int av; int aw; Drawable ax; Drawable ay; private ArrayList az; public HListView(Context context) { this(context, null); } public HListView(Context context, AttributeSet attributeset) { this(context, attributeset, it.sephiroth.android.library.R.attr.hlv_listViewStyle); } public HListView(Context context, AttributeSet attributeset, int i1) { int j1 = -1; boolean flag1 = true; super(context, attributeset, i1); az = new ArrayList(); aA = new ArrayList(); aF = true; aG = false; aH = new Rect(); /* block-local class not found */ class a {} aJ = new a(null); TypedArray typedarray = context.getTheme().obtainStyledAttributes(attributeset, it.sephiroth.android.library.R.styleable.HListView, i1, 0); Drawable drawable; Drawable drawable1; CharSequence acharsequence[]; boolean flag2; if (typedarray != null) { acharsequence = typedarray.getTextArray(it.sephiroth.android.library.R.styleable.HListView_android_entries); drawable1 = typedarray.getDrawable(it.sephiroth.android.library.R.styleable.HListView_android_divider); drawable = typedarray.getDrawable(it.sephiroth.android.library.R.styleable.HListView_hlv_overScrollHeader); attributeset = typedarray.getDrawable(it.sephiroth.android.library.R.styleable.HListView_hlv_overScrollFooter); j1 = typedarray.getDimensionPixelSize(it.sephiroth.android.library.R.styleable.HListView_hlv_dividerWidth, 0); flag2 = typedarray.getBoolean(it.sephiroth.android.library.R.styleable.HListView_hlv_headerDividersEnabled, true); flag1 = typedarray.getBoolean(it.sephiroth.android.library.R.styleable.HListView_hlv_footerDividersEnabled, true); i1 = typedarray.getInteger(it.sephiroth.android.library.R.styleable.HListView_hlv_measureWithChild, -1); typedarray.recycle(); } else { attributeset = null; drawable = null; drawable1 = null; acharsequence = null; boolean flag = false; flag2 = true; i1 = j1; j1 = ((flag) ? 1 : 0); } if (acharsequence != null) { setAdapter(new ArrayAdapter(context, 0x1090003, acharsequence)); } if (drawable1 != null) { setDivider(drawable1); } if (drawable != null) { setOverscrollHeader(drawable); } if (attributeset != null) { setOverscrollFooter(attributeset); } if (j1 != 0) { setDividerWidth(j1); } aD = flag2; aE = flag1; aw = i1; } private boolean A() { boolean flag = false; int i1 = getScrollX(); int j1 = u.left; if (V > 0 || getChildAt(0).getLeft() > i1 + j1) { flag = true; } return flag; } private boolean B() { int i1 = getChildCount(); int j1 = getChildAt(i1 - 1).getRight(); int k1 = V; int l1 = getScrollX(); int i2 = getWidth(); int j2 = u.right; return (i1 + k1) - 1 < ao - 1 || j1 < (l1 + i2) - j2; } private int a(int i1, View view, int j1) { int k1 = 0; view.getDrawingRect(aH); offsetDescendantRectToMyCoords(view, aH); if (i1 == 17) { i1 = k1; if (aH.left < u.left) { k1 = u.left - aH.left; i1 = k1; if (j1 > 0) { i1 = k1 + getArrowScrollPreviewLength(); } } } else { int i2 = getWidth() - u.right; i1 = k1; if (aH.bottom > i2) { int l1 = aH.right - i2; i1 = l1; if (j1 < ao - 1) { return l1 + getArrowScrollPreviewLength(); } } } return i1; } private View a(int i1, int j1, boolean flag, int k1, boolean flag1) { if (!aj) { View view = p.c(i1); if (view != null) { a(view, i1, j1, flag, k1, flag1, true); return view; } } View view1 = a(i1, P); a(view1, i1, j1, flag, k1, flag1, P[0]); return view1; } private View a(View view, View view1, int i1, int j1, int k1) { int i2 = getHorizontalFadingEdgeLength(); int j2 = am; int l1 = d(j1, i2, j2); i2 = c(j1, i2, j2); if (i1 > 0) { view = a(j2 - 1, view.getLeft(), true, u.top, false); i1 = av; view1 = a(j2, view.getRight() + i1, true, u.top, true); if (view1.getRight() > i2) { j2 = view1.getLeft(); int k2 = view1.getRight(); j1 = (k1 - j1) / 2; j1 = Math.min(Math.min(j2 - l1, k2 - i2), j1); view.offsetLeftAndRight(-j1); view1.offsetLeftAndRight(-j1); } if (!K) { h(am - 2, view1.getLeft() - i1); z(); g(am + 1, view1.getRight() + i1); return view1; } else { g(am + 1, view1.getRight() + i1); z(); h(am - 2, view1.getLeft() - i1); return view1; } } if (i1 < 0) { if (view1 != null) { view = a(j2, view1.getLeft(), true, u.top, true); } else { view = a(j2, view.getLeft(), false, u.top, true); } if (view.getLeft() < l1) { i1 = view.getLeft(); int l2 = view.getRight(); j1 = (k1 - j1) / 2; view.offsetLeftAndRight(Math.min(Math.min(l1 - i1, i2 - l2), j1)); } a(view, j2); return view; } i1 = view.getLeft(); view = a(j2, i1, true, u.top, true); if (i1 < j1 && view.getRight() < j1 + 20) { view.offsetLeftAndRight(j1 - view.getLeft()); } a(view, j2); return view; } private void a(View view, int i1) { int j1 = av; if (!K) { h(i1 - 1, view.getLeft() - j1); z(); g(i1 + 1, j1 + view.getRight()); return; } else { g(i1 + 1, view.getRight() + j1); z(); h(i1 - 1, view.getLeft() - j1); return; } } private void a(View view, int i1, int j1) { AbsHListView.c c2 = (AbsHListView.c)view.getLayoutParams(); AbsHListView.c c1 = c2; if (c2 == null) { c1 = (AbsHListView.c)generateDefaultLayoutParams(); view.setLayoutParams(c1); } c1.a = j.getItemViewType(i1); c1.c = true; j1 = ViewGroup.getChildMeasureSpec(j1, u.top + u.bottom, c1.height); i1 = c1.width; if (i1 > 0) { i1 = android.view.View.MeasureSpec.makeMeasureSpec(i1, 0x40000000); } else { i1 = android.view.View.MeasureSpec.makeMeasureSpec(0, 0); } view.measure(i1, j1); } private void a(View view, int i1, int j1, boolean flag) { boolean flag3 = true; if (j1 == -1) { throw new IllegalArgumentException("newSelectedPosition needs to be valid"); } int k1 = am - V; j1 -= V; View view1; int l1; if (i1 == 17) { View view2 = getChildAt(j1); i1 = k1; boolean flag1 = true; view1 = view; view = view2; k1 = j1; j1 = i1; i1 = ((flag1) ? 1 : 0); } else { view1 = getChildAt(j1); i1 = 0; } l1 = getChildCount(); if (view != null) { boolean flag2; if (!flag && i1 != 0) { flag2 = true; } else { flag2 = false; } view.setSelected(flag2); b(view, k1, l1); } if (view1 != null) { if (!flag && i1 == 0) { flag = flag3; } else { flag = false; } view1.setSelected(flag); b(view1, j1, l1); } } private void a(View view, int i1, int j1, boolean flag, int k1, boolean flag1, boolean flag2) { AbsHListView.c c1; int l1; boolean flag3; int i2; int j2; boolean flag4; if (flag1 && h()) { flag1 = true; } else { flag1 = false; } if (flag1 != view.isSelected()) { i2 = 1; } else { i2 = 0; } l1 = F; if (l1 > 0 && l1 < 3 && A == i1) { flag4 = true; } else { flag4 = false; } if (flag4 != view.isPressed()) { j2 = 1; } else { j2 = 0; } if (!flag2 || i2 != 0 || view.isLayoutRequested()) { flag3 = true; } else { flag3 = false; } c1 = (AbsHListView.c)view.getLayoutParams(); if (c1 == null) { c1 = (AbsHListView.c)generateDefaultLayoutParams(); } c1.a = j.getItemViewType(i1); if (flag2 && !c1.c || c1.b && c1.a == -2) { byte byte0; if (flag) { byte0 = -1; } else { byte0 = 0; } attachViewToParent(view, byte0, c1); } else { c1.c = false; if (c1.a == -2) { c1.b = true; } byte byte1; if (flag) { byte1 = -1; } else { byte1 = 0; } addViewInLayout(view, byte1, c1, true); } if (i2 != 0) { view.setSelected(flag1); } if (j2 != 0) { view.setPressed(flag4); } if (b != 0 && f != null) { if (view instanceof Checkable) { ((Checkable)view).setChecked(((Boolean)f.get(i1, Boolean.valueOf(false))).booleanValue()); } else if (android.os.Build.VERSION.SDK_INT >= 11) { view.setActivated(((Boolean)f.get(i1, Boolean.valueOf(false))).booleanValue()); } } if (flag3) { j2 = ViewGroup.getChildMeasureSpec(v, u.top + u.bottom, c1.height); i2 = c1.width; if (i2 > 0) { i2 = android.view.View.MeasureSpec.makeMeasureSpec(i2, 0x40000000); } else { i2 = android.view.View.MeasureSpec.makeMeasureSpec(0, 0); } view.measure(i2, j2); } else { cleanupLayoutState(view); } i2 = view.getMeasuredWidth(); j2 = view.getMeasuredHeight(); if (!flag) { j1 -= i2; } if (flag3) { view.layout(j1, k1, i2 + j1, j2 + k1); } else { view.offsetLeftAndRight(j1 - view.getLeft()); view.offsetTopAndBottom(k1 - view.getTop()); } if (y && !view.isDrawingCacheEnabled()) { view.setDrawingCacheEnabled(true); } if (android.os.Build.VERSION.SDK_INT >= 11 && flag2 && ((AbsHListView.c)view.getLayoutParams()).d != i1) { view.jumpDrawablesToCurrentState(); } } private void a(ArrayList arraylist) { if (arraylist != null) { int j1 = arraylist.size(); for (int i1 = 0; i1 < j1; i1++) { /* block-local class not found */ class b {} AbsHListView.c c1 = (AbsHListView.c)((b)arraylist.get(i1)).a.getLayoutParams(); if (c1 != null) { c1.b = false; } } } } private boolean a(int i1, int j1, KeyEvent keyevent) { if (j != null && T) goto _L2; else goto _L1 _L1: return false; _L2: if (aj) { e(); } if (android.os.Build.VERSION.SDK_INT < 11) goto _L1; else goto _L3 _L3: int i2 = keyevent.getAction(); if (i2 == 1) goto _L5; else goto _L4 _L4: i1; JVM INSTR lookupswitch 11: default 148 // 19: 381 // 20: 402 // 21: 161 // 22: 271 // 23: 423 // 62: 489 // 66: 423 // 92: 548 // 93: 631 // 122: 714 // 123: 755; goto _L5 _L6 _L7 _L8 _L9 _L10 _L11 _L10 _L12 _L13 _L14 _L15 _L5: int k1; boolean flag; flag = false; k1 = j1; goto _L16 _L8: if (!keyevent.hasNoModifiers()) { continue; /* Loop/switch isn't completed */ } flag1 = o(); flag = flag1; k1 = j1; if (flag1) goto _L16; else goto _L17 _L17: l1 = j1 - 1; flag = flag1; k1 = l1; if (j1 <= 0) goto _L16; else goto _L18 _L18: flag = flag1; k1 = l1; if (!k(17)) goto _L16; else goto _L19 _L19: flag1 = true; j1 = l1; goto _L17 if (!keyevent.hasModifiers(2)) goto _L5; else goto _L20 _L20: if (o() || j(17)) { flag = true; k1 = j1; } else { flag = false; k1 = j1; } goto _L16 _L9: if (!keyevent.hasNoModifiers()) { continue; /* Loop/switch isn't completed */ } flag1 = o(); flag = flag1; k1 = j1; if (flag1) goto _L16; else goto _L21 _L21: l1 = j1 - 1; flag = flag1; k1 = l1; if (j1 <= 0) goto _L16; else goto _L22 _L22: flag = flag1; k1 = l1; if (!k(66)) goto _L16; else goto _L23 _L23: flag1 = true; j1 = l1; goto _L21 if (!keyevent.hasModifiers(2)) goto _L5; else goto _L24 _L24: if (o() || j(66)) { flag = true; k1 = j1; } else { flag = false; k1 = j1; } goto _L16 _L6: if (!keyevent.hasNoModifiers()) goto _L5; else goto _L25 _L25: flag = n(17); k1 = j1; goto _L16 _L7: if (!keyevent.hasNoModifiers()) goto _L5; else goto _L26 _L26: flag = n(66); k1 = j1; goto _L16 _L10: if (!keyevent.hasNoModifiers()) goto _L5; else goto _L27 _L27: boolean flag2 = o(); flag = flag2; k1 = j1; if (!flag2) { flag = flag2; k1 = j1; if (keyevent.getRepeatCount() == 0) { flag = flag2; k1 = j1; if (getChildCount() > 0) { i(); flag = true; k1 = j1; } } } goto _L16 _L11: if (keyevent.hasNoModifiers()) { if (!o()) { if (!i(66)); } } else if (!keyevent.hasModifiers(1) || o() || !i(66)); flag = true; k1 = j1; goto _L16 _L12: if (!keyevent.hasNoModifiers()) { continue; /* Loop/switch isn't completed */ } if (o() || i(17)) { flag = true; k1 = j1; } else { flag = false; k1 = j1; } goto _L16 if (!keyevent.hasModifiers(2)) goto _L5; else goto _L28 _L28: if (o() || j(17)) { flag = true; k1 = j1; } else { flag = false; k1 = j1; } goto _L16 _L13: if (!keyevent.hasNoModifiers()) { continue; /* Loop/switch isn't completed */ } if (o() || i(66)) { flag = true; k1 = j1; } else { flag = false; k1 = j1; } goto _L16 if (!keyevent.hasModifiers(2)) goto _L5; else goto _L29 _L29: if (o() || j(66)) { flag = true; k1 = j1; } else { flag = false; k1 = j1; } goto _L16 _L14: if (!keyevent.hasNoModifiers()) goto _L5; else goto _L30 _L30: if (o() || j(17)) { flag = true; k1 = j1; } else { flag = false; k1 = j1; } goto _L16 _L15: if (!keyevent.hasNoModifiers()) goto _L5; else goto _L31 _L31: if (o() || j(66)) { flag = true; k1 = j1; } else { flag = false; k1 = j1; } _L16: int l1; boolean flag1; if (flag) { return true; } switch (i2) { default: return false; case 0: // '\0' return super.onKeyDown(i1, keyevent); case 1: // '\001' return super.onKeyUp(i1, keyevent); case 2: // '\002' return super.onKeyMultiple(i1, k1, keyevent); } } private boolean a(View view, View view1) { if (view == view1) { return true; } view = view.getParent(); boolean flag; if ((view instanceof ViewGroup) && a((View)view, view1)) { flag = true; } else { flag = false; } return flag; } private View b(int i1, int j1, int k1) { int i2 = getHorizontalFadingEdgeLength(); int l1 = am; j1 = d(j1, i2, l1); k1 = c(k1, i2, l1); View view = a(l1, i1, true, u.top, true); if (view.getRight() > k1) { view.offsetLeftAndRight(-Math.min(view.getLeft() - j1, view.getRight() - k1)); } else if (view.getLeft() < j1) { view.offsetLeftAndRight(Math.min(j1 - view.getLeft(), k1 - view.getRight())); } a(view, l1); if (!K) { l(getChildCount()); return view; } else { m(getChildCount()); return view; } } private View b(View view, int i1) { i1--; View view1 = a(i1, P); a(view1, i1, view.getLeft() - av, false, u.top, false, P[0]); return view1; } private void b(View view, int i1, int j1) { int k1 = view.getWidth(); e(view); if (view.getMeasuredWidth() != k1) { f(view); int l1 = view.getMeasuredWidth(); for (i1++; i1 < j1; i1++) { getChildAt(i1).offsetLeftAndRight(l1 - k1); } } } private int c(int i1, int j1, int k1) { int l1 = i1; if (k1 != ao - 1) { l1 = i1 - j1; } return l1; } private View c(View view, int i1) { i1++; View view1 = a(i1, P); int j1 = view.getRight(); a(view1, i1, av + j1, true, u.top, false, P[0]); return view1; } private int d(int i1, int j1, int k1) { int l1 = i1; if (k1 > 0) { l1 = i1 + j1; } return l1; } private boolean d(View view) { ArrayList arraylist = az; int k1 = arraylist.size(); for (int i1 = 0; i1 < k1; i1++) { if (view == ((b)arraylist.get(i1)).a) { return true; } } arraylist = aA; k1 = arraylist.size(); for (int j1 = 0; j1 < k1; j1++) { if (view == ((b)arraylist.get(j1)).a) { return true; } } return false; } private void e(View view) { android.view.ViewGroup.LayoutParams layoutparams1 = view.getLayoutParams(); android.view.ViewGroup.LayoutParams layoutparams = layoutparams1; if (layoutparams1 == null) { layoutparams = new android.view.ViewGroup.LayoutParams(-2, -1); } int j1 = ViewGroup.getChildMeasureSpec(v, u.top + u.bottom, layoutparams.height); int i1 = layoutparams.width; if (i1 > 0) { i1 = android.view.View.MeasureSpec.makeMeasureSpec(i1, 0x40000000); } else { i1 = android.view.View.MeasureSpec.makeMeasureSpec(0, 0); } view.measure(i1, j1); } private void f(View view) { int i1 = view.getMeasuredWidth(); int j1 = view.getMeasuredHeight(); int k1 = u.top; int l1 = view.getLeft(); view.layout(l1, k1, i1 + l1, j1 + k1); } private int g(View view) { int j1 = getChildCount(); for (int i1 = 0; i1 < j1; i1++) { if (a(view, getChildAt(i1))) { return i1 + V; } } throw new IllegalArgumentException("newFocus is not a child of any of the children of the list!"); } private View g(int i1, int j1) { View view = null; int k1 = getRight(); int l1 = getLeft(); while (j1 < k1 - l1 && i1 < ao) { View view1; boolean flag; if (i1 == am) { flag = true; } else { flag = false; } view1 = a(i1, j1, true, u.top, flag); j1 = view1.getRight() + av; if (flag) { view = view1; } i1++; } e(V, (V + getChildCount()) - 1); return view; } private int getArrowScrollPreviewLength() { return Math.max(2, getHorizontalFadingEdgeLength()); } private int h(View view) { int i1 = 0; view.getDrawingRect(aH); offsetDescendantRectToMyCoords(view, aH); int j1 = getRight() - getLeft() - u.right; if (aH.right < u.left) { i1 = u.left - aH.right; } else if (aH.left > j1) { return aH.left - j1; } return i1; } private View h(int i1) { V = Math.min(V, am); V = Math.min(V, ao - 1); if (V < 0) { V = 0; } return g(V, i1); } private View h(int i1, int j1) { View view = null; while (j1 > 0 && i1 >= 0) { View view1; boolean flag; if (i1 == am) { flag = true; } else { flag = false; } view1 = a(i1, j1, false, u.top, flag); j1 = view1.getLeft() - av; if (flag) { view = view1; } i1--; } V = i1 + 1; e(V, (V + getChildCount()) - 1); return view; } private View i(int i1, int j1) { j1 -= i1; int k1 = n(); View view = a(k1, i1, true, u.top, true); V = k1; i1 = view.getMeasuredWidth(); if (i1 <= j1) { view.offsetLeftAndRight((j1 - i1) / 2); } a(view, k1); if (!K) { l(getChildCount()); return view; } else { m(getChildCount()); return view; } } private View j(int i1, int j1) { View view; View view1; View view6; View view2; View view4; boolean flag; if (i1 == am) { flag = true; } else { flag = false; } view6 = a(i1, j1, true, u.top, flag); V = i1; j1 = av; if (K) goto _L2; else goto _L1 _L1: view2 = h(i1 - 1, view6.getLeft() - j1); z(); view4 = g(i1 + 1, j1 + view6.getRight()); i1 = getChildCount(); view = view2; view1 = view4; if (i1 > 0) { l(i1); view1 = view4; view = view2; } _L4: if (flag) { return view6; } break; /* Loop/switch isn't completed */ _L2: View view3 = g(i1 + 1, view6.getRight() + j1); z(); View view5 = h(i1 - 1, view6.getLeft() - j1); i1 = getChildCount(); view = view5; view1 = view3; if (i1 > 0) { m(i1); view = view5; view1 = view3; } if (true) goto _L4; else goto _L3 _L3: if (view != null) { return view; } else { return view1; } } private int k(int i1, int j1) { _L2: do { return 0; } while (view.getRight() <= i1 || j1 != -1 && i1 - view.getLeft() >= getMaxScrollAmount()); j1 = view.getRight() - i1; i1 = j1; if (V + i2 == ao) { i1 = Math.min(j1, getChildAt(i2 - 1).getRight() - k1); } return Math.min(i1, getMaxScrollAmount()); int k1 = getWidth() - u.right; int l1 = u.left; int i2 = getChildCount(); if (i1 == 66) { i1 = i2 - 1; if (j1 != -1) { i1 = j1 - V; } l1 = V; View view = getChildAt(i1); if (l1 + i1 < ao - 1) { i1 = k1 - getArrowScrollPreviewLength(); } else { i1 = k1; } break MISSING_BLOCK_LABEL_85; } if (j1 != -1) { i1 = j1 - V; } else { i1 = 0; } k1 = V; view = getChildAt(i1); if (k1 + i1 > 0) { i1 = getArrowScrollPreviewLength() + l1; } else { i1 = l1; } if (view.getLeft() < i1 && (j1 == -1 || view.getRight() - i1 < getMaxScrollAmount())) { j1 = i1 - view.getLeft(); i1 = j1; if (V == 0) { i1 = Math.min(j1, l1 - getChildAt(0).getLeft()); } return Math.min(i1, getMaxScrollAmount()); } if (true) goto _L2; else goto _L1 _L1: } private void l(int i1) { if ((V + i1) - 1 == ao - 1 && i1 > 0) { i1 = getChildAt(i1 - 1).getRight(); int j1 = getRight() - getLeft() - u.right - i1; View view = getChildAt(0); int k1 = view.getLeft(); if (j1 > 0 && (V > 0 || k1 < u.top)) { i1 = j1; if (V == 0) { i1 = Math.min(j1, u.top - k1); } d(i1); if (V > 0) { h(V - 1, view.getLeft() - av); z(); } } } } private void m(int i1) { if (V == 0 && i1 > 0) { int j1 = getChildAt(0).getLeft(); int l1 = u.left; int k1 = getRight() - getLeft() - u.right; j1 -= l1; View view = getChildAt(i1 - 1); l1 = view.getRight(); int i2 = (V + i1) - 1; if (j1 > 0) { if (i2 < ao - 1 || l1 > k1) { i1 = j1; if (i2 == ao - 1) { i1 = Math.min(j1, l1 - k1); } d(-i1); if (i2 < ao - 1) { g(i2 + 1, view.getRight() + av); z(); } } else if (i2 == ao - 1) { z(); return; } } } } private boolean n(int i1) { if (i1 != 17 && i1 != 66) { throw new IllegalArgumentException("direction must be one of {View.FOCUS_LEFT, View.FOCUS_RIGHT}"); } int j1 = getChildCount(); if (aG && j1 > 0 && am != -1) { View view1 = getSelectedView(); if (view1 != null && view1.hasFocus() && (view1 instanceof ViewGroup)) { View view = view1.findFocus(); view1 = FocusFinder.getInstance().findNextFocus((ViewGroup)view1, view, i1); if (view1 != null) { view.getFocusedRect(aH); offsetDescendantRectToMyCoords(view, aH); offsetRectIntoDescendantCoords(view1, aH); if (view1.requestFocus(i1, aH)) { return true; } } view = FocusFinder.getInstance().findNextFocus((ViewGroup)getRootView(), view, i1); if (view != null) { return a(view, this); } } } return false; } private boolean o(int i1) { if (getChildCount() > 0) { View view = getSelectedView(); int l1 = am; int j1 = p(i1); int k1 = k(i1, j1); Object obj; boolean flag; if (aG) { obj = q(i1); } else { obj = null; } if (obj != null) { j1 = ((a) (obj)).a(); k1 = ((a) (obj)).b(); } if (obj != null) { flag = true; } else { flag = false; } if (j1 != -1) { boolean flag1; if (obj != null) { flag1 = true; } else { flag1 = false; } a(view, i1, j1, flag1); setSelectedPositionInt(j1); setNextSelectedPositionInt(j1); view = getSelectedView(); if (aG && obj == null) { View view1 = getFocusedChild(); if (view1 != null) { view1.clearFocus(); } } v(); flag = true; l1 = j1; } if (k1 > 0) { if (i1 != 17) { k1 = -k1; } r(k1); flag = true; } if (aG && obj == null && view != null && view.hasFocus()) { obj = view.findFocus(); if (!a(((View) (obj)), this) || h(((View) (obj))) > 0) { ((View) (obj)).clearFocus(); } } if (j1 == -1 && view != null && !a(view, this)) { m(); M = -1; view = null; } if (flag) { if (view != null) { a(l1, view); J = view.getLeft(); } if (!awakenScrollBars()) { invalidate(); } b(); return true; } } return false; } private int p(int i1) { int l1 = V; if (i1 != 66) goto _L2; else goto _L1 _L1: int j1; if (am != -1) { j1 = am + 1; } else { j1 = l1; } if (j1 < j.getCount()) goto _L4; else goto _L3 _L3: i1 = -1; _L6: return i1; _L4: ListAdapter listadapter; int i2; i1 = j1; if (j1 < l1) { i1 = l1; } i2 = getLastVisiblePosition(); listadapter = getAdapter(); j1 = i1; _L7: if (j1 > i2) { break MISSING_BLOCK_LABEL_219; } if (!listadapter.isEnabled(j1)) { break; /* Loop/switch isn't completed */ } i1 = j1; if (getChildAt(j1 - l1).getVisibility() == 0) goto _L6; else goto _L5 _L5: j1++; goto _L7 _L2: int k1 = (getChildCount() + l1) - 1; if (am != -1) { i1 = am - 1; } else { i1 = (getChildCount() + l1) - 1; } if (i1 < 0 || i1 >= j.getCount()) { return -1; } ListAdapter listadapter1; if (i1 <= k1) { k1 = i1; } listadapter1 = getAdapter(); if (k1 < l1) goto _L9; else goto _L8 _L8: if (!listadapter1.isEnabled(k1)) { continue; /* Loop/switch isn't completed */ } i1 = k1; if (getChildAt(k1 - l1).getVisibility() != 0) { k1--; break MISSING_BLOCK_LABEL_180; } if (true) goto _L6; else goto _L9 _L9: return -1; } private a q(int i1) { int k1 = 1; int j1 = 1; View view = getSelectedView(); if (view != null && view.hasFocus()) { view = view.findFocus(); view = FocusFinder.getInstance().findNextFocus(this, view, i1); } else { if (i1 == 66) { if (V <= 0) { j1 = 0; } k1 = u.left; if (j1 != 0) { j1 = getArrowScrollPreviewLength(); } else { j1 = 0; } k1 = j1 + k1; j1 = k1; if (view != null) { j1 = k1; if (view.getLeft() > k1) { j1 = view.getLeft(); } } aH.set(j1, 0, j1, 0); } else { int l1; if ((V + getChildCount()) - 1 < ao) { j1 = k1; } else { j1 = 0; } k1 = getWidth(); l1 = u.right; if (j1 != 0) { j1 = getArrowScrollPreviewLength(); } else { j1 = 0; } k1 = k1 - l1 - j1; j1 = k1; if (view != null) { j1 = k1; if (view.getRight() < k1) { j1 = view.getRight(); } } aH.set(j1, 0, j1, 0); } view = FocusFinder.getInstance().findNextFocusFromRect(this, aH, i1); } if (view != null) { j1 = g(view); if (am != -1 && j1 != am) { k1 = p(i1); if (k1 != -1 && (i1 == 66 && k1 < j1 || i1 == 17 && k1 > j1)) { return null; } } k1 = a(i1, view, j1); int i2 = getMaxScrollAmount(); if (k1 < i2) { view.requestFocus(i1); aJ.a(j1, k1); return aJ; } if (h(view) < i2) { view.requestFocus(i1); aJ.a(j1, i2); return aJ; } } return null; } private void r(int i1) { d(i1); int j1 = getWidth() - u.right; int k1 = u.left; AbsHListView.e e1 = p; if (i1 < 0) { i1 = getChildCount(); View view = getChildAt(i1 - 1); do { if (view.getRight() >= j1) { break; } int l1 = (V + i1) - 1; if (l1 >= ao - 1) { break; } view = c(view, l1); i1++; } while (true); if (view.getBottom() < j1) { d(j1 - view.getRight()); } view = getChildAt(0); while (view.getRight() < k1) { if (e1.b(((AbsHListView.c)view.getLayoutParams()).a)) { detachViewFromParent(view); e1.a(view, V); } else { removeViewInLayout(view); } view = getChildAt(0); V = V + 1; } } else { View view1; for (view1 = getChildAt(0); view1.getLeft() > k1 && V > 0; V = V - 1) { view1 = b(view1, V); } if (view1.getLeft() > k1) { d(k1 - view1.getLeft()); } i1 = getChildCount() - 1; view1 = getChildAt(i1); while (view1.getLeft() > j1) { if (e1.b(((AbsHListView.c)view1.getLayoutParams()).a)) { detachViewFromParent(view1); e1.a(view1, V + i1); } else { removeViewInLayout(view1); } i1--; view1 = getChildAt(i1); } } } private void z() { boolean flag; int l1; flag = false; l1 = getChildCount(); if (l1 <= 0) goto _L2; else goto _L1 _L1: if (K) goto _L4; else goto _L3 _L3: int k1; k1 = getChildAt(0).getLeft() - u.left; int i1 = k1; if (V != 0) { i1 = k1 - av; } k1 = i1; if (i1 < 0) { k1 = ((flag) ? 1 : 0); } _L6: if (k1 != 0) { d(-k1); } _L2: return; _L4: k1 = getChildAt(l1 - 1).getRight() - (getWidth() - u.right); int j1 = k1; if (l1 + V < ao) { j1 = k1 + av; } k1 = ((flag) ? 1 : 0); if (j1 <= 0) { k1 = j1; } if (true) goto _L6; else goto _L5 _L5: } final int a(int i1, int j1, int k1, int l1, int i2) { Object obj; int l2; l2 = 0; obj = j; if (obj != null) goto _L2; else goto _L1 _L1: i1 = u.left + u.right; _L4: return i1; _L2: int i3 = u.left + u.right; boolean aflag[]; int j2; int k2; boolean flag; if (av > 0 && au != null) { j2 = av; } else { j2 = 0; } k2 = k1; if (k1 == -1) { k2 = ((ListAdapter) (obj)).getCount() - 1; } obj = p; flag = y(); aflag = P; k1 = j1; j1 = i3; while (k1 <= k2) { View view = a(k1, aflag); a(view, k1, i1); if (k1 > 0) { j1 += j2; } if (flag && ((AbsHListView.e) (obj)).b(((AbsHListView.c)view.getLayoutParams()).a)) { ((AbsHListView.e) (obj)).a(view, -1); } j1 = view.getMeasuredWidth() + j1; if (j1 >= l1) { i1 = l1; if (i2 >= 0) { i1 = l1; if (k1 > i2) { i1 = l1; if (l2 > 0) { i1 = l1; if (j1 != l1) { return l2; } } } } continue; /* Loop/switch isn't completed */ } int j3 = l2; if (i2 >= 0) { j3 = l2; if (k1 >= i2) { j3 = j1; } } k1++; l2 = j3; } return j1; if (true) goto _L4; else goto _L3 _L3: } void a(Canvas canvas, Rect rect, int i1) { Drawable drawable = au; drawable.setBounds(rect); drawable.draw(canvas); } void a(Canvas canvas, Drawable drawable, Rect rect) { int i1 = drawable.getMinimumWidth(); canvas.save(); canvas.clipRect(rect); if (rect.right - rect.left < i1) { rect.left = rect.right - i1; } drawable.setBounds(rect); drawable.draw(canvas); canvas.restore(); } public void a(View view, Object obj, boolean flag) { b b1 = new b(); b1.a = view; b1.b = obj; b1.c = flag; az.add(b1); if (j != null) { if (!(j instanceof b)) { j = new b(az, aA, j); } if (i != null) { i.onChanged(); } } } protected void a(boolean flag) { int i1 = 0; int j1 = getChildCount(); if (flag) { if (j1 > 0) { i1 = getChildAt(j1 - 1).getRight() + av; } g(j1 + V, i1); l(getChildCount()); return; } if (j1 > 0) { i1 = getChildAt(0).getLeft() - av; } else { i1 = getWidth() - 0; } h(V - 1, i1); m(getChildCount()); } final int[] a(int i1, int j1, int k1, int l1, int i2, int j2) { Object obj = j; if (obj == null) { return (new int[] { u.left + u.right, u.top + u.bottom }); } int i3 = u.left; int j3 = u.right; int k3 = u.top; int l3 = u.bottom; boolean aflag[]; int k2; int l2; boolean flag; if (av > 0 && au != null) { j2 = av; } else { j2 = 0; } k2 = k1; if (k1 == -1) { k2 = ((ListAdapter) (obj)).getCount() - 1; } obj = p; flag = y(); aflag = P; l2 = 0; k1 = 0; for (; j1 <= k2; j1++) { View view = a(j1, aflag); a(view, j1, i1); if (flag && ((AbsHListView.e) (obj)).b(((AbsHListView.c)view.getLayoutParams()).a)) { ((AbsHListView.e) (obj)).a(view, -1); } l2 = Math.max(l2, view.getMeasuredWidth() + j2); k1 = Math.max(k1, view.getMeasuredHeight()); } return (new int[] { Math.min(l2 + (i3 + j3), l1), Math.min(k1 + (k3 + l3), i2) }); } protected int b(int i1, boolean flag) { ListAdapter listadapter = j; if (listadapter != null && !isInTouchMode()) goto _L2; else goto _L1 _L1: int j1 = -1; _L4: return j1; _L2: int k1; k1 = listadapter.getCount(); if (aF) { break MISSING_BLOCK_LABEL_137; } if (flag) { j1 = Math.max(0, i1); do { i1 = j1; if (j1 >= k1) { break; } i1 = j1; if (listadapter.isEnabled(j1)) { break; } j1++; } while (true); } else { j1 = Math.min(i1, k1 - 1); do { i1 = j1; if (j1 < 0) { break; } i1 = j1; if (listadapter.isEnabled(j1)) { break; } j1--; } while (true); } if (i1 < 0) { break; /* Loop/switch isn't completed */ } j1 = i1; if (i1 < k1) goto _L4; else goto _L3 _L3: return -1; if (i1 < 0) { break; /* Loop/switch isn't completed */ } j1 = i1; if (i1 < k1) goto _L4; else goto _L5 _L5: return -1; } void b(Canvas canvas, Drawable drawable, Rect rect) { int i1 = drawable.getMinimumWidth(); canvas.save(); canvas.clipRect(rect); if (rect.right - rect.left < i1) { rect.right = i1 + rect.left; } drawable.setBounds(rect); drawable.draw(canvas); canvas.restore(); } public void b(View view) { a(view, null, true); } public int[] c(View view) { e(view); return (new int[] { view.getMeasuredWidth(), view.getMeasuredHeight() }); } protected boolean canAnimate() { return super.canAnimate() && ao > 0; } protected void d() { a(az); a(aA); super.d(); h = 0; } protected void dispatchDraw(Canvas canvas) { Drawable drawable; Drawable drawable1; Rect rect; ListAdapter listadapter; Paint paint; int i1; boolean flag; boolean flag1; boolean flag2; int i3; int j3; int k3; int l3; int i4; int j4; int k4; boolean flag8; boolean flag9; if (y) { z = true; } i3 = av; drawable = ax; drawable1 = ay; int k1; int i5; boolean flag10; if (drawable != null) { i1 = 1; } else { i1 = 0; } if (drawable1 != null) { flag = true; } else { flag = false; } if (i3 > 0 && au != null) { flag1 = true; } else { flag1 = false; } if (!flag1 && i1 == 0 && !flag) goto _L2; else goto _L1 _L1: rect = aH; rect.top = getPaddingTop(); rect.bottom = getBottom() - getTop() - getPaddingBottom(); j3 = getChildCount(); l3 = az.size(); k4 = ao; i4 = k4 - aA.size() - 1; flag8 = aD; flag9 = aE; k3 = V; flag10 = aF; listadapter = j; if (isOpaque() && !super.isOpaque()) { flag2 = true; } else { flag2 = false; } if (flag2 && aI == null && aB) { aI = new Paint(); aI.setColor(getCacheColorHint()); } paint = aI; j4 = (getRight() - getLeft() - 0) + getScrollX(); if (K) goto _L4; else goto _L3 _L3: k1 = getScrollX(); if (j3 <= 0 || k1 >= 0) goto _L6; else goto _L5 _L5: if (i1 == 0) goto _L8; else goto _L7 _L7: rect.right = 0; rect.left = k1; a(canvas, drawable, rect); goto _L6 _L8: if (flag1) { rect.right = 0; rect.left = -i3; a(canvas, rect, -1); } continue; /* Loop/switch isn't completed */ _L6: i1 = 0; int i2 = 0; label0: do { label1: { if (i1 >= j3) { break label0; } i5 = k3 + i1; boolean flag3; boolean flag5; int j2; int k2; if (i5 < l3) { flag3 = true; } else { flag3 = false; } if (i5 >= i4) { flag5 = true; } else { flag5 = false; } if (!flag8) { j2 = i2; if (flag3) { break label1; } } if (!flag9) { j2 = i2; if (flag5) { break label1; } } k2 = getChildAt(i1).getRight(); if (i1 == j3 - 1) { i2 = 1; } else { i2 = 0; } j2 = k2; if (!flag1) { break label1; } j2 = k2; if (k2 >= j4) { break label1; } if (flag) { j2 = k2; if (i2 != 0) { break label1; } } j2 = i5 + 1; if (listadapter.isEnabled(i5) && (flag8 || !flag3 && j2 >= l3) && (i2 != 0 || listadapter.isEnabled(j2) && (flag9 || !flag5 && j2 < i4))) { rect.left = k2; rect.right = k2 + i3; a(canvas, rect, i1); j2 = k2; } else { j2 = k2; if (flag2) { rect.left = k2; rect.right = k2 + i3; canvas.drawRect(rect, paint); j2 = k2; } } } i1++; i2 = j2; } while (true); i1 = getRight() + getScrollX(); if (flag && k3 + j3 == k4 && i1 > i2) { rect.left = i2; rect.right = i1; b(canvas, drawable1, rect); } _L2: super.dispatchDraw(canvas); return; _L4: int l2 = getScrollX(); if (j3 > 0 && i1 != 0) { rect.left = l2; rect.right = getChildAt(0).getLeft(); a(canvas, drawable, rect); } int l1; if (i1 != 0) { i1 = 1; } else { i1 = 0; } l1 = i1; while (l1 < j3) { int l4 = k3 + l1; boolean flag4; boolean flag6; int j5; if (l4 < l3) { flag4 = true; } else { flag4 = false; } if (l4 >= i4) { flag6 = true; } else { flag6 = false; } if (!flag8 && flag4 || !flag9 && flag6) { continue; } j5 = getChildAt(l1).getLeft(); if (flag1 && j5 > 0) { boolean flag7; int k5; if (l1 == i1) { flag7 = true; } else { flag7 = false; } k5 = l4 - 1; if (listadapter.isEnabled(l4) && (flag8 || !flag4 && k5 >= l3) && (flag7 || listadapter.isEnabled(k5) && (flag9 || !flag6 && k5 < i4))) { rect.left = j5 - i3; rect.right = j5; a(canvas, rect, l1 - 1); } else if (flag2) { rect.left = j5 - i3; rect.right = j5; canvas.drawRect(rect, paint); } } l1++; } if (j3 > 0 && l2 > 0) { if (flag) { int j1 = getRight(); rect.left = j1; rect.right = j1 + l2; b(canvas, drawable1, rect); } else if (flag1) { rect.left = j4; rect.right = j4 + i3; a(canvas, rect, -1); } } if (true) goto _L2; else goto _L9 _L9: if (true) goto _L6; else goto _L10 _L10: } public boolean dispatchKeyEvent(KeyEvent keyevent) { boolean flag1 = super.dispatchKeyEvent(keyevent); boolean flag = flag1; if (!flag1) { flag = flag1; if (getFocusedChild() != null) { flag = flag1; if (keyevent.getAction() == 0) { flag = onKeyDown(keyevent.getKeyCode(), keyevent); } } } return flag; } protected boolean drawChild(Canvas canvas, View view, long l1) { boolean flag = super.drawChild(canvas, view, l1); if (z) { z = false; } return flag; } protected int e(int i1) { int l1 = getChildCount(); if (l1 > 0) { if (!K) { for (int j1 = 0; j1 < l1; j1++) { if (i1 <= getChildAt(j1).getRight()) { return j1 + V; } } } else { for (int k1 = l1 - 1; k1 >= 0; k1--) { if (i1 >= getChildAt(k1).getLeft()) { return k1 + V; } } } } return -1; } protected void e() { boolean flag = at; if (!flag) goto _L2; else goto _L1 _L1: return; _L2: at = true; super.e(); invalidate(); if (j != null) { break MISSING_BLOCK_LABEL_51; } d(); b(); if (flag) goto _L1; else goto _L3 _L3: at = false; return; int j1; int l1; int i2; j1 = u.left; l1 = getRight() - getLeft() - u.right; i2 = getChildCount(); Object obj; View view; View view2; int i1; int k1; k1 = 0; i1 = 0; view2 = null; obj = null; view = null; h; JVM INSTR tableswitch 1 5: default 1178 // 1 1181 // 2 248 // 3 1181 // 4 1181 // 5 1181; goto _L4 _L5 _L6 _L5 _L5 _L5 _L4: k1 = am - V; View view1; view1 = ((View) (obj)); if (k1 < 0) { break MISSING_BLOCK_LABEL_170; } view1 = ((View) (obj)); if (k1 >= i2) { break MISSING_BLOCK_LABEL_170; } view1 = getChildAt(k1); obj = getChildAt(0); if (ak >= 0) { i1 = ak - am; } view = getChildAt(k1 + i1); view2 = view1; _L14: boolean flag1 = aj; if (!flag1) goto _L8; else goto _L7 _L7: r(); _L8: if (ao != 0) goto _L10; else goto _L9 _L9: d(); b(); if (flag) goto _L1; else goto _L11 _L11: at = false; return; _L6: i1 = ak - V; if (i1 < 0 || i1 >= i2) goto _L13; else goto _L12 _L12: view = getChildAt(i1); obj = null; i1 = k1; goto _L14 _L10: if (ao != j.getCount()) { throw new IllegalStateException((new StringBuilder()).append("The content of the adapter has changed but ListView did not receive a notification. Make sure the content of your adapter is not modified from a background thread, but only from the UI thread. [in ListView(").append(getId()).append(", ").append(getClass()).append(") with Adapter(").append(j.getClass()).append(")]").toString()); } goto _L15 obj; if (!flag) { at = false; } throw obj; _L15: setSelectedPositionInt(ak); Object obj1; obj1 = null; view1 = null; Object obj2 = getFocusedChild(); if (obj2 == null) goto _L17; else goto _L16 _L16: if (!flag1) goto _L19; else goto _L18 _L18: if (!d(((View) (obj2)))) goto _L20; else goto _L19 _L19: view1 = findFocus(); if (view1 == null) goto _L22; else goto _L21 _L21: view1.onStartTemporaryDetach(); goto _L22 _L20: requestFocus(); _L73: int j2; j2 = V; obj2 = p; if (!flag1) goto _L24; else goto _L23 _L23: k1 = 0; _L26: if (k1 >= i2) { break; /* Loop/switch isn't completed */ } ((AbsHListView.e) (obj2)).a(getChildAt(k1), j2 + k1); k1++; if (true) goto _L26; else goto _L25 _L24: ((AbsHListView.e) (obj2)).a(i2, j2); _L25: detachAllViewsFromParent(); ((AbsHListView.e) (obj2)).d(); h; JVM INSTR tableswitch 1 6: default 1197 // 1 827 // 2 759 // 3 807 // 4 846 // 5 791 // 6 862; goto _L27 _L28 _L29 _L30 _L31 _L32 _L33 _L27: if (i2 != 0) goto _L35; else goto _L34 _L34: if (K) goto _L37; else goto _L36 _L36: setSelectedPositionInt(b(0, true)); obj = h(j1); _L54: ((AbsHListView.e) (obj2)).e(); if (obj == null) goto _L39; else goto _L38 _L38: if (!aG || !hasFocus() || ((View) (obj)).hasFocus()) goto _L41; else goto _L40 _L40: if (obj != obj1 || view1 == null) goto _L43; else goto _L42 _L42: if (view1.requestFocus()) goto _L44; else goto _L43 _L43: if (!((View) (obj)).requestFocus()) goto _L45; else goto _L44 _L74: if (i1 != 0) goto _L47; else goto _L46 _L46: view = getFocusedChild(); if (view == null) goto _L49; else goto _L48 _L48: view.clearFocus(); _L49: b(-1, ((View) (obj))); _L63: J = ((View) (obj)).getLeft(); _L69: if (view1 == null) goto _L51; else goto _L50 _L50: if (view1.getWindowToken() != null) { view1.onFinishTemporaryDetach(); } _L51: h = 0; aj = false; if (O != null) { post(O); O = null; } ad = false; setNextSelectedPositionInt(am); f(); if (ao > 0) { v(); } b(); if (!flag) { at = false; return; } goto _L1 _L29: if (view == null) goto _L53; else goto _L52 _L52: obj = b(view.getLeft(), j1, l1); goto _L54 _L53: obj = i(j1, l1); goto _L54 _L32: obj = j(aa, W); goto _L54 _L30: obj = h(ao - 1, l1); z(); goto _L54 _L28: V = 0; obj = h(j1); z(); goto _L54 _L31: obj = j(n(), W); goto _L54 _L33: obj = a(view2, view, i1, j1, l1); goto _L54 _L37: setSelectedPositionInt(b(ao - 1, false)); obj = h(ao - 1, l1); goto _L54 _L35: if (am < 0 || am >= ao) goto _L56; else goto _L55 _L55: i1 = am; if (view2 != null) goto _L58; else goto _L57 _L57: obj = j(i1, j1); goto _L54 _L58: j1 = view2.getLeft(); goto _L57 _L56: if (V >= ao) goto _L60; else goto _L59 _L59: i1 = V; if (obj != null) goto _L62; else goto _L61 _L61: obj = j(i1, j1); goto _L54 _L62: j1 = ((View) (obj)).getLeft(); goto _L61 _L60: obj = j(0, j1); goto _L54 _L47: ((View) (obj)).setSelected(false); o.setEmpty(); goto _L63 _L41: b(-1, ((View) (obj))); goto _L63 _L39: if (F == 1 || F == 2) { i1 = 1; } else { i1 = 0; } if (i1 == 0) goto _L65; else goto _L64 _L64: obj = getChildAt(A - V); if (obj == null) goto _L67; else goto _L66 _L66: b(A, ((View) (obj))); _L67: if (!hasFocus() || view1 == null) goto _L69; else goto _L68 _L68: view1.requestFocus(); goto _L69 _L65: if (n == -1) goto _L71; else goto _L70 _L70: obj = getChildAt(n - V); if (obj == null) goto _L67; else goto _L72 _L72: b(n, ((View) (obj))); goto _L67 _L71: J = 0; o.setEmpty(); goto _L67 _L17: obj1 = null; view1 = null; goto _L73 _L13: obj = null; i1 = k1; goto _L14 _L5: obj = null; i1 = k1; goto _L14 _L22: obj1 = obj2; goto _L20 _L44: i1 = 1; goto _L74 _L45: i1 = 0; goto _L74 } public void f(int i1, int j1) { if (j != null) { if (!isInTouchMode()) { int k1 = b(i1, true); i1 = k1; if (k1 >= 0) { setNextSelectedPositionInt(k1); i1 = k1; } } else { M = i1; } if (i1 >= 0) { h = 4; W = u.left + j1; if (ad) { aa = i1; ab = j.getItemId(i1); } if (I != null) { I.a(); } requestLayout(); return; } } } public volatile Adapter getAdapter() { return getAdapter(); } public ListAdapter getAdapter() { return j; } public long[] getCheckItemIds() { if (j != null && j.hasStableIds()) { return getCheckedItemIds(); } if (b != 0 && f != null && j != null) { SparseArrayCompat sparsearraycompat = f; int l1 = sparsearraycompat.size(); long al[] = new long[l1]; ListAdapter listadapter = j; int j1 = 0; int i1 = 0; for (; j1 < l1; j1++) { if (((Boolean)sparsearraycompat.valueAt(j1)).booleanValue()) { int k1 = i1 + 1; al[i1] = listadapter.getItemId(sparsearraycompat.keyAt(j1)); i1 = k1; } } if (i1 == l1) { return al; } else { long al1[] = new long[i1]; System.arraycopy(al, 0, al1, 0, i1); return al1; } } else { return new long[0]; } } public Drawable getDivider() { return au; } public int getDividerWidth() { return av; } public int getFooterViewsCount() { return aA.size(); } public int getHeaderViewsCount() { return az.size(); } public boolean getItemsCanFocus() { return aG; } public int getMaxScrollAmount() { return (int)(0.33F * (float)(getRight() - getLeft())); } public Drawable getOverscrollFooter() { return ay; } public Drawable getOverscrollHeader() { return ax; } boolean i(int i1) { boolean flag; if (i1 == 17) { i1 = Math.max(0, am - getChildCount() - 1); flag = false; } else if (i1 == 66) { i1 = Math.min(ao - 1, (am + getChildCount()) - 1); flag = true; } else { i1 = -1; flag = false; } if (i1 >= 0) { i1 = b(i1, flag); if (i1 >= 0) { h = 4; W = getPaddingLeft() + getHorizontalFadingEdgeLength(); if (flag && i1 > ao - getChildCount()) { h = 3; } if (!flag && i1 < getChildCount()) { h = 1; } setSelectionInt(i1); b(); if (!awakenScrollBars()) { invalidate(); } return true; } } return false; } public boolean isOpaque() { boolean flag; if (z && aB && aC || super.isOpaque()) { flag = true; } else { flag = false; } if (flag) { View view; int i1; if (u != null) { i1 = u.left; } else { i1 = getPaddingLeft(); } view = getChildAt(0); if (view == null || view.getLeft() > i1) { return false; } int j1 = getWidth(); if (u != null) { i1 = u.right; } else { i1 = getPaddingRight(); } view = getChildAt(getChildCount() - 1); if (view == null || view.getRight() < j1 - i1) { return false; } } return flag; } boolean j(int i1) { boolean flag1 = true; if (i1 != 17) goto _L2; else goto _L1 _L1: if (am == 0) goto _L4; else goto _L3 _L3: boolean flag; i1 = b(0, true); flag = flag1; if (i1 >= 0) { h = 1; setSelectionInt(i1); b(); flag = flag1; } _L6: if (flag && !awakenScrollBars()) { awakenScrollBars(); invalidate(); } return flag; _L2: if (i1 == 66 && am < ao - 1) { i1 = b(ao - 1, true); flag = flag1; if (i1 >= 0) { h = 3; setSelectionInt(i1); b(); flag = flag1; } continue; /* Loop/switch isn't completed */ } _L4: flag = false; if (true) goto _L6; else goto _L5 _L5: } boolean k(int i1) { boolean flag; af = true; flag = o(i1); if (!flag) { break MISSING_BLOCK_LABEL_23; } playSoundEffect(SoundEffectConstants.getContantForFocusDirection(i1)); af = false; return flag; Exception exception; exception; af = false; throw exception; } protected void onFinishInflate() { super.onFinishInflate(); int j1 = getChildCount(); if (j1 > 0) { for (int i1 = 0; i1 < j1; i1++) { b(getChildAt(i1)); } removeAllViews(); } } protected void onFocusChanged(boolean flag, int i1, Rect rect) { ListAdapter listadapter; int j1; int k1; int l1; int j2; int l2; l1 = 0; k1 = 0; super.onFocusChanged(flag, i1, rect); listadapter = j; j1 = -1; j2 = l1; l2 = j1; if (listadapter == null) goto _L2; else goto _L1 _L1: j2 = l1; l2 = j1; if (!flag) goto _L2; else goto _L3 _L3: j2 = l1; l2 = j1; if (rect == null) goto _L2; else goto _L4 _L4: Rect rect1; int i2; int i3; int j3; rect.offset(getScrollX(), getScrollY()); if (listadapter.getCount() < getChildCount() + V) { h = 0; e(); } rect1 = aH; i2 = 0x7fffffff; i3 = getChildCount(); j3 = V; l1 = 0; _L6: j2 = k1; l2 = j1; if (l1 >= i3) goto _L2; else goto _L5 _L5: if (!listadapter.isEnabled(j3 + l1)) { j2 = k1; k1 = j1; j1 = j2; } else { View view = getChildAt(l1); view.getDrawingRect(rect1); offsetDescendantRectToMyCoords(view, rect1); j2 = a(rect, rect1, i1); if (j2 < i2) { j1 = view.getLeft(); k1 = l1; i2 = j2; } else { int k2 = j1; j1 = k1; k1 = k2; } } j2 = l1 + 1; l1 = k1; k1 = j1; j1 = l1; l1 = j2; if (true) goto _L6; else goto _L2 _L2: if (l2 >= 0) { f(V + l2, j2); return; } else { requestLayout(); return; } } public void onGlobalLayout() { } public void onInitializeAccessibilityEvent(AccessibilityEvent accessibilityevent) { super.onInitializeAccessibilityEvent(accessibilityevent); accessibilityevent.setClassName(it/sephiroth/android/library/widget/HListView.getName()); } public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo accessibilitynodeinfo) { super.onInitializeAccessibilityNodeInfo(accessibilitynodeinfo); accessibilitynodeinfo.setClassName(it/sephiroth/android/library/widget/HListView.getName()); } public boolean onKeyDown(int i1, KeyEvent keyevent) { return a(i1, 1, keyevent); } public boolean onKeyMultiple(int i1, int j1, KeyEvent keyevent) { return a(i1, j1, keyevent); } public boolean onKeyUp(int i1, KeyEvent keyevent) { return a(i1, 1, keyevent); } protected void onMeasure(int i1, int j1) { int k1; int j2; int k2; int k3; label0: { super.onMeasure(i1, j1); int j3 = android.view.View.MeasureSpec.getMode(i1); k3 = android.view.View.MeasureSpec.getMode(j1); j2 = android.view.View.MeasureSpec.getSize(i1); k2 = android.view.View.MeasureSpec.getSize(j1); int l2 = 0; int i3 = 0; boolean flag1 = false; boolean flag = false; View view; int l1; int i2; if (j == null) { i1 = 0; } else { i1 = j.getCount(); } ao = i1; k1 = ((flag1) ? 1 : 0); i2 = i3; l1 = l2; if (ao <= 0) { break label0; } if (j3 != 0) { k1 = ((flag1) ? 1 : 0); i2 = i3; l1 = l2; if (k3 != 0) { break label0; } } view = a(0, P); a(view, 0, j1); l2 = view.getMeasuredWidth(); i3 = view.getMeasuredHeight(); i1 = ((flag) ? 1 : 0); if (android.os.Build.VERSION.SDK_INT >= 11) { i1 = combineMeasuredStates(0, view.getMeasuredState()); } k1 = i1; i2 = i3; l1 = l2; if (y()) { k1 = i1; i2 = i3; l1 = l2; if (p.b(((AbsHListView.c)view.getLayoutParams()).a)) { p.a(view, 0); l1 = l2; i2 = i3; k1 = i1; } } } if (k3 == 0) { i1 = i2 + (u.top + u.bottom) + getHorizontalScrollbarHeight(); } else if (k3 == 0x80000000 && ao > 0 && aw > -1) { i1 = a(j1, aw, aw, j2, k2, -1)[1]; } else if (android.os.Build.VERSION.SDK_INT >= 11) { i1 = k2 | 0xff000000 & k1; } else { i1 = k2; } k1 = j2; if (j3 == 0) { k1 = u.left + u.right + l1 + getHorizontalFadingEdgeLength() * 2; } l1 = k1; if (j3 == 0x80000000) { l1 = a(j1, 0, -1, k1, -1); } setMeasuredDimension(l1, i1); v = j1; } protected void onSizeChanged(int i1, int j1, int k1, int l1) { if (getChildCount() > 0) { View view = getFocusedChild(); if (view != null) { int i2 = V; int j2 = indexOfChild(view); int k2 = Math.max(0, view.getRight() - (i1 - getPaddingLeft())); int l2 = view.getLeft(); /* block-local class not found */ class FocusSelector {} if (aK == null) { aK = new FocusSelector(null); } post(aK.a(i2 + j2, l2 - k2)); } } super.onSizeChanged(i1, j1, k1, l1); } public boolean requestChildRectangleOnScreen(View view, Rect rect, boolean flag) { int i1; int l1; int i2; int l2; label0: { int j2 = rect.left; rect.offset(view.getLeft(), view.getTop()); rect.offset(-view.getScrollX(), -view.getScrollY()); i2 = getWidth(); int j1 = getScrollX(); l1 = j1 + i2; l2 = getHorizontalFadingEdgeLength(); i1 = j1; if (!A()) { break label0; } if (am <= 0) { i1 = j1; if (j2 <= l2) { break label0; } } i1 = j1 + l2; } int k1; int k2; label1: { k2 = getChildAt(getChildCount() - 1).getRight(); k1 = l1; if (!B()) { break label1; } if (am >= ao - 1) { k1 = l1; if (rect.right >= k2 - l2) { break label1; } } k1 = l1 - l2; } if (rect.right > k1 && rect.left > i1) { if (rect.width() > i2) { i1 = (rect.left - i1) + 0; } else { i1 = (rect.right - k1) + 0; } i1 = Math.min(i1, k2 - k1); } else if (rect.left < i1 && rect.right < k1) { if (rect.width() > i2) { k1 = 0 - (k1 - rect.right); } else { k1 = 0 - (i1 - rect.left); } i1 = Math.max(k1, getChildAt(0).getLeft() - i1); } else { i1 = 0; } if (i1 != 0) { flag = true; } else { flag = false; } if (flag) { r(-i1); b(-1, view); J = view.getTop(); invalidate(); } return flag; } public volatile void setAdapter(Adapter adapter) { setAdapter((ListAdapter)adapter); } public void setAdapter(ListAdapter listadapter) { if (j != null && i != null) { j.unregisterDataSetObserver(i); } d(); p.b(); if (az.size() > 0 || aA.size() > 0) { j = new b(az, aA, listadapter); } else { j = listadapter; } ar = -1; as = 0x8000000000000000L; super.setAdapter(listadapter); if (j != null) { aF = j.areAllItemsEnabled(); ap = ao; ao = j.getCount(); t(); i = new AbsHListView.b(this); j.registerDataSetObserver(i); p.a(j.getViewTypeCount()); int i1; if (K) { i1 = b(ao - 1, false); } else { i1 = b(0, true); } setSelectedPositionInt(i1); setNextSelectedPositionInt(i1); if (ao == 0) { v(); } } else { aF = true; t(); v(); } requestLayout(); } public void setCacheColorHint(int i1) { boolean flag; if (i1 >>> 24 == 255) { flag = true; } else { flag = false; } aB = flag; if (flag) { if (aI == null) { aI = new Paint(); } aI.setColor(i1); } super.setCacheColorHint(i1); } public void setDivider(Drawable drawable) { boolean flag = false; if (drawable != null) { av = drawable.getIntrinsicWidth(); } else { av = 0; } au = drawable; if (drawable == null || drawable.getOpacity() == -1) { flag = true; } aC = flag; requestLayout(); invalidate(); } public void setDividerWidth(int i1) { av = i1; requestLayout(); invalidate(); } public void setFooterDividersEnabled(boolean flag) { aE = flag; invalidate(); } public void setHeaderDividersEnabled(boolean flag) { aD = flag; invalidate(); } public void setItemsCanFocus(boolean flag) { aG = flag; if (!flag) { setDescendantFocusability(0x60000); } } public void setOverscrollFooter(Drawable drawable) { ay = drawable; invalidate(); } public void setOverscrollHeader(Drawable drawable) { ax = drawable; if (getScrollX() < 0) { invalidate(); } } public void setSelection(int i1) { f(i1, 0); } public void setSelectionInt(int i1) { boolean flag; int j1; flag = true; setNextSelectedPositionInt(i1); j1 = am; break MISSING_BLOCK_LABEL_12; if (j1 < 0 || i1 != j1 - 1 && i1 != j1 + 1) { flag = false; } if (I != null) { I.a(); } e(); if (flag) { awakenScrollBars(); } return; } protected boolean y() { return true; } }
UTF-8
Java
82,838
java
HListView.java
Java
[ { "context": "// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.\n// Jad home page: http://www.geocities.com/kpdus", "end": 61, "score": 0.9997005462646484, "start": 45, "tag": "NAME", "value": "Pavel Kouznetsov" } ]
null
[]
// Decompiled by Jad v1.5.8e. Copyright 2001 <NAME>. // Jad home page: http://www.geocities.com/kpdus/jad.html // Decompiler options: braces fieldsfirst space lnc package it.sephiroth.android.library.widget; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.support.v4.util.SparseArrayCompat; import android.util.AttributeSet; import android.view.FocusFinder; import android.view.KeyEvent; import android.view.SoundEffectConstants; import android.view.View; import android.view.ViewGroup; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; import android.widget.Adapter; import android.widget.ArrayAdapter; import android.widget.Checkable; import android.widget.ListAdapter; import java.util.ArrayList; // Referenced classes of package it.sephiroth.android.library.widget: // AbsHListView, b public class HListView extends AbsHListView { private ArrayList aA; private boolean aB; private boolean aC; private boolean aD; private boolean aE; private boolean aF; private boolean aG; private final Rect aH; private Paint aI; private final a aJ; private FocusSelector aK; Drawable au; int av; int aw; Drawable ax; Drawable ay; private ArrayList az; public HListView(Context context) { this(context, null); } public HListView(Context context, AttributeSet attributeset) { this(context, attributeset, it.sephiroth.android.library.R.attr.hlv_listViewStyle); } public HListView(Context context, AttributeSet attributeset, int i1) { int j1 = -1; boolean flag1 = true; super(context, attributeset, i1); az = new ArrayList(); aA = new ArrayList(); aF = true; aG = false; aH = new Rect(); /* block-local class not found */ class a {} aJ = new a(null); TypedArray typedarray = context.getTheme().obtainStyledAttributes(attributeset, it.sephiroth.android.library.R.styleable.HListView, i1, 0); Drawable drawable; Drawable drawable1; CharSequence acharsequence[]; boolean flag2; if (typedarray != null) { acharsequence = typedarray.getTextArray(it.sephiroth.android.library.R.styleable.HListView_android_entries); drawable1 = typedarray.getDrawable(it.sephiroth.android.library.R.styleable.HListView_android_divider); drawable = typedarray.getDrawable(it.sephiroth.android.library.R.styleable.HListView_hlv_overScrollHeader); attributeset = typedarray.getDrawable(it.sephiroth.android.library.R.styleable.HListView_hlv_overScrollFooter); j1 = typedarray.getDimensionPixelSize(it.sephiroth.android.library.R.styleable.HListView_hlv_dividerWidth, 0); flag2 = typedarray.getBoolean(it.sephiroth.android.library.R.styleable.HListView_hlv_headerDividersEnabled, true); flag1 = typedarray.getBoolean(it.sephiroth.android.library.R.styleable.HListView_hlv_footerDividersEnabled, true); i1 = typedarray.getInteger(it.sephiroth.android.library.R.styleable.HListView_hlv_measureWithChild, -1); typedarray.recycle(); } else { attributeset = null; drawable = null; drawable1 = null; acharsequence = null; boolean flag = false; flag2 = true; i1 = j1; j1 = ((flag) ? 1 : 0); } if (acharsequence != null) { setAdapter(new ArrayAdapter(context, 0x1090003, acharsequence)); } if (drawable1 != null) { setDivider(drawable1); } if (drawable != null) { setOverscrollHeader(drawable); } if (attributeset != null) { setOverscrollFooter(attributeset); } if (j1 != 0) { setDividerWidth(j1); } aD = flag2; aE = flag1; aw = i1; } private boolean A() { boolean flag = false; int i1 = getScrollX(); int j1 = u.left; if (V > 0 || getChildAt(0).getLeft() > i1 + j1) { flag = true; } return flag; } private boolean B() { int i1 = getChildCount(); int j1 = getChildAt(i1 - 1).getRight(); int k1 = V; int l1 = getScrollX(); int i2 = getWidth(); int j2 = u.right; return (i1 + k1) - 1 < ao - 1 || j1 < (l1 + i2) - j2; } private int a(int i1, View view, int j1) { int k1 = 0; view.getDrawingRect(aH); offsetDescendantRectToMyCoords(view, aH); if (i1 == 17) { i1 = k1; if (aH.left < u.left) { k1 = u.left - aH.left; i1 = k1; if (j1 > 0) { i1 = k1 + getArrowScrollPreviewLength(); } } } else { int i2 = getWidth() - u.right; i1 = k1; if (aH.bottom > i2) { int l1 = aH.right - i2; i1 = l1; if (j1 < ao - 1) { return l1 + getArrowScrollPreviewLength(); } } } return i1; } private View a(int i1, int j1, boolean flag, int k1, boolean flag1) { if (!aj) { View view = p.c(i1); if (view != null) { a(view, i1, j1, flag, k1, flag1, true); return view; } } View view1 = a(i1, P); a(view1, i1, j1, flag, k1, flag1, P[0]); return view1; } private View a(View view, View view1, int i1, int j1, int k1) { int i2 = getHorizontalFadingEdgeLength(); int j2 = am; int l1 = d(j1, i2, j2); i2 = c(j1, i2, j2); if (i1 > 0) { view = a(j2 - 1, view.getLeft(), true, u.top, false); i1 = av; view1 = a(j2, view.getRight() + i1, true, u.top, true); if (view1.getRight() > i2) { j2 = view1.getLeft(); int k2 = view1.getRight(); j1 = (k1 - j1) / 2; j1 = Math.min(Math.min(j2 - l1, k2 - i2), j1); view.offsetLeftAndRight(-j1); view1.offsetLeftAndRight(-j1); } if (!K) { h(am - 2, view1.getLeft() - i1); z(); g(am + 1, view1.getRight() + i1); return view1; } else { g(am + 1, view1.getRight() + i1); z(); h(am - 2, view1.getLeft() - i1); return view1; } } if (i1 < 0) { if (view1 != null) { view = a(j2, view1.getLeft(), true, u.top, true); } else { view = a(j2, view.getLeft(), false, u.top, true); } if (view.getLeft() < l1) { i1 = view.getLeft(); int l2 = view.getRight(); j1 = (k1 - j1) / 2; view.offsetLeftAndRight(Math.min(Math.min(l1 - i1, i2 - l2), j1)); } a(view, j2); return view; } i1 = view.getLeft(); view = a(j2, i1, true, u.top, true); if (i1 < j1 && view.getRight() < j1 + 20) { view.offsetLeftAndRight(j1 - view.getLeft()); } a(view, j2); return view; } private void a(View view, int i1) { int j1 = av; if (!K) { h(i1 - 1, view.getLeft() - j1); z(); g(i1 + 1, j1 + view.getRight()); return; } else { g(i1 + 1, view.getRight() + j1); z(); h(i1 - 1, view.getLeft() - j1); return; } } private void a(View view, int i1, int j1) { AbsHListView.c c2 = (AbsHListView.c)view.getLayoutParams(); AbsHListView.c c1 = c2; if (c2 == null) { c1 = (AbsHListView.c)generateDefaultLayoutParams(); view.setLayoutParams(c1); } c1.a = j.getItemViewType(i1); c1.c = true; j1 = ViewGroup.getChildMeasureSpec(j1, u.top + u.bottom, c1.height); i1 = c1.width; if (i1 > 0) { i1 = android.view.View.MeasureSpec.makeMeasureSpec(i1, 0x40000000); } else { i1 = android.view.View.MeasureSpec.makeMeasureSpec(0, 0); } view.measure(i1, j1); } private void a(View view, int i1, int j1, boolean flag) { boolean flag3 = true; if (j1 == -1) { throw new IllegalArgumentException("newSelectedPosition needs to be valid"); } int k1 = am - V; j1 -= V; View view1; int l1; if (i1 == 17) { View view2 = getChildAt(j1); i1 = k1; boolean flag1 = true; view1 = view; view = view2; k1 = j1; j1 = i1; i1 = ((flag1) ? 1 : 0); } else { view1 = getChildAt(j1); i1 = 0; } l1 = getChildCount(); if (view != null) { boolean flag2; if (!flag && i1 != 0) { flag2 = true; } else { flag2 = false; } view.setSelected(flag2); b(view, k1, l1); } if (view1 != null) { if (!flag && i1 == 0) { flag = flag3; } else { flag = false; } view1.setSelected(flag); b(view1, j1, l1); } } private void a(View view, int i1, int j1, boolean flag, int k1, boolean flag1, boolean flag2) { AbsHListView.c c1; int l1; boolean flag3; int i2; int j2; boolean flag4; if (flag1 && h()) { flag1 = true; } else { flag1 = false; } if (flag1 != view.isSelected()) { i2 = 1; } else { i2 = 0; } l1 = F; if (l1 > 0 && l1 < 3 && A == i1) { flag4 = true; } else { flag4 = false; } if (flag4 != view.isPressed()) { j2 = 1; } else { j2 = 0; } if (!flag2 || i2 != 0 || view.isLayoutRequested()) { flag3 = true; } else { flag3 = false; } c1 = (AbsHListView.c)view.getLayoutParams(); if (c1 == null) { c1 = (AbsHListView.c)generateDefaultLayoutParams(); } c1.a = j.getItemViewType(i1); if (flag2 && !c1.c || c1.b && c1.a == -2) { byte byte0; if (flag) { byte0 = -1; } else { byte0 = 0; } attachViewToParent(view, byte0, c1); } else { c1.c = false; if (c1.a == -2) { c1.b = true; } byte byte1; if (flag) { byte1 = -1; } else { byte1 = 0; } addViewInLayout(view, byte1, c1, true); } if (i2 != 0) { view.setSelected(flag1); } if (j2 != 0) { view.setPressed(flag4); } if (b != 0 && f != null) { if (view instanceof Checkable) { ((Checkable)view).setChecked(((Boolean)f.get(i1, Boolean.valueOf(false))).booleanValue()); } else if (android.os.Build.VERSION.SDK_INT >= 11) { view.setActivated(((Boolean)f.get(i1, Boolean.valueOf(false))).booleanValue()); } } if (flag3) { j2 = ViewGroup.getChildMeasureSpec(v, u.top + u.bottom, c1.height); i2 = c1.width; if (i2 > 0) { i2 = android.view.View.MeasureSpec.makeMeasureSpec(i2, 0x40000000); } else { i2 = android.view.View.MeasureSpec.makeMeasureSpec(0, 0); } view.measure(i2, j2); } else { cleanupLayoutState(view); } i2 = view.getMeasuredWidth(); j2 = view.getMeasuredHeight(); if (!flag) { j1 -= i2; } if (flag3) { view.layout(j1, k1, i2 + j1, j2 + k1); } else { view.offsetLeftAndRight(j1 - view.getLeft()); view.offsetTopAndBottom(k1 - view.getTop()); } if (y && !view.isDrawingCacheEnabled()) { view.setDrawingCacheEnabled(true); } if (android.os.Build.VERSION.SDK_INT >= 11 && flag2 && ((AbsHListView.c)view.getLayoutParams()).d != i1) { view.jumpDrawablesToCurrentState(); } } private void a(ArrayList arraylist) { if (arraylist != null) { int j1 = arraylist.size(); for (int i1 = 0; i1 < j1; i1++) { /* block-local class not found */ class b {} AbsHListView.c c1 = (AbsHListView.c)((b)arraylist.get(i1)).a.getLayoutParams(); if (c1 != null) { c1.b = false; } } } } private boolean a(int i1, int j1, KeyEvent keyevent) { if (j != null && T) goto _L2; else goto _L1 _L1: return false; _L2: if (aj) { e(); } if (android.os.Build.VERSION.SDK_INT < 11) goto _L1; else goto _L3 _L3: int i2 = keyevent.getAction(); if (i2 == 1) goto _L5; else goto _L4 _L4: i1; JVM INSTR lookupswitch 11: default 148 // 19: 381 // 20: 402 // 21: 161 // 22: 271 // 23: 423 // 62: 489 // 66: 423 // 92: 548 // 93: 631 // 122: 714 // 123: 755; goto _L5 _L6 _L7 _L8 _L9 _L10 _L11 _L10 _L12 _L13 _L14 _L15 _L5: int k1; boolean flag; flag = false; k1 = j1; goto _L16 _L8: if (!keyevent.hasNoModifiers()) { continue; /* Loop/switch isn't completed */ } flag1 = o(); flag = flag1; k1 = j1; if (flag1) goto _L16; else goto _L17 _L17: l1 = j1 - 1; flag = flag1; k1 = l1; if (j1 <= 0) goto _L16; else goto _L18 _L18: flag = flag1; k1 = l1; if (!k(17)) goto _L16; else goto _L19 _L19: flag1 = true; j1 = l1; goto _L17 if (!keyevent.hasModifiers(2)) goto _L5; else goto _L20 _L20: if (o() || j(17)) { flag = true; k1 = j1; } else { flag = false; k1 = j1; } goto _L16 _L9: if (!keyevent.hasNoModifiers()) { continue; /* Loop/switch isn't completed */ } flag1 = o(); flag = flag1; k1 = j1; if (flag1) goto _L16; else goto _L21 _L21: l1 = j1 - 1; flag = flag1; k1 = l1; if (j1 <= 0) goto _L16; else goto _L22 _L22: flag = flag1; k1 = l1; if (!k(66)) goto _L16; else goto _L23 _L23: flag1 = true; j1 = l1; goto _L21 if (!keyevent.hasModifiers(2)) goto _L5; else goto _L24 _L24: if (o() || j(66)) { flag = true; k1 = j1; } else { flag = false; k1 = j1; } goto _L16 _L6: if (!keyevent.hasNoModifiers()) goto _L5; else goto _L25 _L25: flag = n(17); k1 = j1; goto _L16 _L7: if (!keyevent.hasNoModifiers()) goto _L5; else goto _L26 _L26: flag = n(66); k1 = j1; goto _L16 _L10: if (!keyevent.hasNoModifiers()) goto _L5; else goto _L27 _L27: boolean flag2 = o(); flag = flag2; k1 = j1; if (!flag2) { flag = flag2; k1 = j1; if (keyevent.getRepeatCount() == 0) { flag = flag2; k1 = j1; if (getChildCount() > 0) { i(); flag = true; k1 = j1; } } } goto _L16 _L11: if (keyevent.hasNoModifiers()) { if (!o()) { if (!i(66)); } } else if (!keyevent.hasModifiers(1) || o() || !i(66)); flag = true; k1 = j1; goto _L16 _L12: if (!keyevent.hasNoModifiers()) { continue; /* Loop/switch isn't completed */ } if (o() || i(17)) { flag = true; k1 = j1; } else { flag = false; k1 = j1; } goto _L16 if (!keyevent.hasModifiers(2)) goto _L5; else goto _L28 _L28: if (o() || j(17)) { flag = true; k1 = j1; } else { flag = false; k1 = j1; } goto _L16 _L13: if (!keyevent.hasNoModifiers()) { continue; /* Loop/switch isn't completed */ } if (o() || i(66)) { flag = true; k1 = j1; } else { flag = false; k1 = j1; } goto _L16 if (!keyevent.hasModifiers(2)) goto _L5; else goto _L29 _L29: if (o() || j(66)) { flag = true; k1 = j1; } else { flag = false; k1 = j1; } goto _L16 _L14: if (!keyevent.hasNoModifiers()) goto _L5; else goto _L30 _L30: if (o() || j(17)) { flag = true; k1 = j1; } else { flag = false; k1 = j1; } goto _L16 _L15: if (!keyevent.hasNoModifiers()) goto _L5; else goto _L31 _L31: if (o() || j(66)) { flag = true; k1 = j1; } else { flag = false; k1 = j1; } _L16: int l1; boolean flag1; if (flag) { return true; } switch (i2) { default: return false; case 0: // '\0' return super.onKeyDown(i1, keyevent); case 1: // '\001' return super.onKeyUp(i1, keyevent); case 2: // '\002' return super.onKeyMultiple(i1, k1, keyevent); } } private boolean a(View view, View view1) { if (view == view1) { return true; } view = view.getParent(); boolean flag; if ((view instanceof ViewGroup) && a((View)view, view1)) { flag = true; } else { flag = false; } return flag; } private View b(int i1, int j1, int k1) { int i2 = getHorizontalFadingEdgeLength(); int l1 = am; j1 = d(j1, i2, l1); k1 = c(k1, i2, l1); View view = a(l1, i1, true, u.top, true); if (view.getRight() > k1) { view.offsetLeftAndRight(-Math.min(view.getLeft() - j1, view.getRight() - k1)); } else if (view.getLeft() < j1) { view.offsetLeftAndRight(Math.min(j1 - view.getLeft(), k1 - view.getRight())); } a(view, l1); if (!K) { l(getChildCount()); return view; } else { m(getChildCount()); return view; } } private View b(View view, int i1) { i1--; View view1 = a(i1, P); a(view1, i1, view.getLeft() - av, false, u.top, false, P[0]); return view1; } private void b(View view, int i1, int j1) { int k1 = view.getWidth(); e(view); if (view.getMeasuredWidth() != k1) { f(view); int l1 = view.getMeasuredWidth(); for (i1++; i1 < j1; i1++) { getChildAt(i1).offsetLeftAndRight(l1 - k1); } } } private int c(int i1, int j1, int k1) { int l1 = i1; if (k1 != ao - 1) { l1 = i1 - j1; } return l1; } private View c(View view, int i1) { i1++; View view1 = a(i1, P); int j1 = view.getRight(); a(view1, i1, av + j1, true, u.top, false, P[0]); return view1; } private int d(int i1, int j1, int k1) { int l1 = i1; if (k1 > 0) { l1 = i1 + j1; } return l1; } private boolean d(View view) { ArrayList arraylist = az; int k1 = arraylist.size(); for (int i1 = 0; i1 < k1; i1++) { if (view == ((b)arraylist.get(i1)).a) { return true; } } arraylist = aA; k1 = arraylist.size(); for (int j1 = 0; j1 < k1; j1++) { if (view == ((b)arraylist.get(j1)).a) { return true; } } return false; } private void e(View view) { android.view.ViewGroup.LayoutParams layoutparams1 = view.getLayoutParams(); android.view.ViewGroup.LayoutParams layoutparams = layoutparams1; if (layoutparams1 == null) { layoutparams = new android.view.ViewGroup.LayoutParams(-2, -1); } int j1 = ViewGroup.getChildMeasureSpec(v, u.top + u.bottom, layoutparams.height); int i1 = layoutparams.width; if (i1 > 0) { i1 = android.view.View.MeasureSpec.makeMeasureSpec(i1, 0x40000000); } else { i1 = android.view.View.MeasureSpec.makeMeasureSpec(0, 0); } view.measure(i1, j1); } private void f(View view) { int i1 = view.getMeasuredWidth(); int j1 = view.getMeasuredHeight(); int k1 = u.top; int l1 = view.getLeft(); view.layout(l1, k1, i1 + l1, j1 + k1); } private int g(View view) { int j1 = getChildCount(); for (int i1 = 0; i1 < j1; i1++) { if (a(view, getChildAt(i1))) { return i1 + V; } } throw new IllegalArgumentException("newFocus is not a child of any of the children of the list!"); } private View g(int i1, int j1) { View view = null; int k1 = getRight(); int l1 = getLeft(); while (j1 < k1 - l1 && i1 < ao) { View view1; boolean flag; if (i1 == am) { flag = true; } else { flag = false; } view1 = a(i1, j1, true, u.top, flag); j1 = view1.getRight() + av; if (flag) { view = view1; } i1++; } e(V, (V + getChildCount()) - 1); return view; } private int getArrowScrollPreviewLength() { return Math.max(2, getHorizontalFadingEdgeLength()); } private int h(View view) { int i1 = 0; view.getDrawingRect(aH); offsetDescendantRectToMyCoords(view, aH); int j1 = getRight() - getLeft() - u.right; if (aH.right < u.left) { i1 = u.left - aH.right; } else if (aH.left > j1) { return aH.left - j1; } return i1; } private View h(int i1) { V = Math.min(V, am); V = Math.min(V, ao - 1); if (V < 0) { V = 0; } return g(V, i1); } private View h(int i1, int j1) { View view = null; while (j1 > 0 && i1 >= 0) { View view1; boolean flag; if (i1 == am) { flag = true; } else { flag = false; } view1 = a(i1, j1, false, u.top, flag); j1 = view1.getLeft() - av; if (flag) { view = view1; } i1--; } V = i1 + 1; e(V, (V + getChildCount()) - 1); return view; } private View i(int i1, int j1) { j1 -= i1; int k1 = n(); View view = a(k1, i1, true, u.top, true); V = k1; i1 = view.getMeasuredWidth(); if (i1 <= j1) { view.offsetLeftAndRight((j1 - i1) / 2); } a(view, k1); if (!K) { l(getChildCount()); return view; } else { m(getChildCount()); return view; } } private View j(int i1, int j1) { View view; View view1; View view6; View view2; View view4; boolean flag; if (i1 == am) { flag = true; } else { flag = false; } view6 = a(i1, j1, true, u.top, flag); V = i1; j1 = av; if (K) goto _L2; else goto _L1 _L1: view2 = h(i1 - 1, view6.getLeft() - j1); z(); view4 = g(i1 + 1, j1 + view6.getRight()); i1 = getChildCount(); view = view2; view1 = view4; if (i1 > 0) { l(i1); view1 = view4; view = view2; } _L4: if (flag) { return view6; } break; /* Loop/switch isn't completed */ _L2: View view3 = g(i1 + 1, view6.getRight() + j1); z(); View view5 = h(i1 - 1, view6.getLeft() - j1); i1 = getChildCount(); view = view5; view1 = view3; if (i1 > 0) { m(i1); view = view5; view1 = view3; } if (true) goto _L4; else goto _L3 _L3: if (view != null) { return view; } else { return view1; } } private int k(int i1, int j1) { _L2: do { return 0; } while (view.getRight() <= i1 || j1 != -1 && i1 - view.getLeft() >= getMaxScrollAmount()); j1 = view.getRight() - i1; i1 = j1; if (V + i2 == ao) { i1 = Math.min(j1, getChildAt(i2 - 1).getRight() - k1); } return Math.min(i1, getMaxScrollAmount()); int k1 = getWidth() - u.right; int l1 = u.left; int i2 = getChildCount(); if (i1 == 66) { i1 = i2 - 1; if (j1 != -1) { i1 = j1 - V; } l1 = V; View view = getChildAt(i1); if (l1 + i1 < ao - 1) { i1 = k1 - getArrowScrollPreviewLength(); } else { i1 = k1; } break MISSING_BLOCK_LABEL_85; } if (j1 != -1) { i1 = j1 - V; } else { i1 = 0; } k1 = V; view = getChildAt(i1); if (k1 + i1 > 0) { i1 = getArrowScrollPreviewLength() + l1; } else { i1 = l1; } if (view.getLeft() < i1 && (j1 == -1 || view.getRight() - i1 < getMaxScrollAmount())) { j1 = i1 - view.getLeft(); i1 = j1; if (V == 0) { i1 = Math.min(j1, l1 - getChildAt(0).getLeft()); } return Math.min(i1, getMaxScrollAmount()); } if (true) goto _L2; else goto _L1 _L1: } private void l(int i1) { if ((V + i1) - 1 == ao - 1 && i1 > 0) { i1 = getChildAt(i1 - 1).getRight(); int j1 = getRight() - getLeft() - u.right - i1; View view = getChildAt(0); int k1 = view.getLeft(); if (j1 > 0 && (V > 0 || k1 < u.top)) { i1 = j1; if (V == 0) { i1 = Math.min(j1, u.top - k1); } d(i1); if (V > 0) { h(V - 1, view.getLeft() - av); z(); } } } } private void m(int i1) { if (V == 0 && i1 > 0) { int j1 = getChildAt(0).getLeft(); int l1 = u.left; int k1 = getRight() - getLeft() - u.right; j1 -= l1; View view = getChildAt(i1 - 1); l1 = view.getRight(); int i2 = (V + i1) - 1; if (j1 > 0) { if (i2 < ao - 1 || l1 > k1) { i1 = j1; if (i2 == ao - 1) { i1 = Math.min(j1, l1 - k1); } d(-i1); if (i2 < ao - 1) { g(i2 + 1, view.getRight() + av); z(); } } else if (i2 == ao - 1) { z(); return; } } } } private boolean n(int i1) { if (i1 != 17 && i1 != 66) { throw new IllegalArgumentException("direction must be one of {View.FOCUS_LEFT, View.FOCUS_RIGHT}"); } int j1 = getChildCount(); if (aG && j1 > 0 && am != -1) { View view1 = getSelectedView(); if (view1 != null && view1.hasFocus() && (view1 instanceof ViewGroup)) { View view = view1.findFocus(); view1 = FocusFinder.getInstance().findNextFocus((ViewGroup)view1, view, i1); if (view1 != null) { view.getFocusedRect(aH); offsetDescendantRectToMyCoords(view, aH); offsetRectIntoDescendantCoords(view1, aH); if (view1.requestFocus(i1, aH)) { return true; } } view = FocusFinder.getInstance().findNextFocus((ViewGroup)getRootView(), view, i1); if (view != null) { return a(view, this); } } } return false; } private boolean o(int i1) { if (getChildCount() > 0) { View view = getSelectedView(); int l1 = am; int j1 = p(i1); int k1 = k(i1, j1); Object obj; boolean flag; if (aG) { obj = q(i1); } else { obj = null; } if (obj != null) { j1 = ((a) (obj)).a(); k1 = ((a) (obj)).b(); } if (obj != null) { flag = true; } else { flag = false; } if (j1 != -1) { boolean flag1; if (obj != null) { flag1 = true; } else { flag1 = false; } a(view, i1, j1, flag1); setSelectedPositionInt(j1); setNextSelectedPositionInt(j1); view = getSelectedView(); if (aG && obj == null) { View view1 = getFocusedChild(); if (view1 != null) { view1.clearFocus(); } } v(); flag = true; l1 = j1; } if (k1 > 0) { if (i1 != 17) { k1 = -k1; } r(k1); flag = true; } if (aG && obj == null && view != null && view.hasFocus()) { obj = view.findFocus(); if (!a(((View) (obj)), this) || h(((View) (obj))) > 0) { ((View) (obj)).clearFocus(); } } if (j1 == -1 && view != null && !a(view, this)) { m(); M = -1; view = null; } if (flag) { if (view != null) { a(l1, view); J = view.getLeft(); } if (!awakenScrollBars()) { invalidate(); } b(); return true; } } return false; } private int p(int i1) { int l1 = V; if (i1 != 66) goto _L2; else goto _L1 _L1: int j1; if (am != -1) { j1 = am + 1; } else { j1 = l1; } if (j1 < j.getCount()) goto _L4; else goto _L3 _L3: i1 = -1; _L6: return i1; _L4: ListAdapter listadapter; int i2; i1 = j1; if (j1 < l1) { i1 = l1; } i2 = getLastVisiblePosition(); listadapter = getAdapter(); j1 = i1; _L7: if (j1 > i2) { break MISSING_BLOCK_LABEL_219; } if (!listadapter.isEnabled(j1)) { break; /* Loop/switch isn't completed */ } i1 = j1; if (getChildAt(j1 - l1).getVisibility() == 0) goto _L6; else goto _L5 _L5: j1++; goto _L7 _L2: int k1 = (getChildCount() + l1) - 1; if (am != -1) { i1 = am - 1; } else { i1 = (getChildCount() + l1) - 1; } if (i1 < 0 || i1 >= j.getCount()) { return -1; } ListAdapter listadapter1; if (i1 <= k1) { k1 = i1; } listadapter1 = getAdapter(); if (k1 < l1) goto _L9; else goto _L8 _L8: if (!listadapter1.isEnabled(k1)) { continue; /* Loop/switch isn't completed */ } i1 = k1; if (getChildAt(k1 - l1).getVisibility() != 0) { k1--; break MISSING_BLOCK_LABEL_180; } if (true) goto _L6; else goto _L9 _L9: return -1; } private a q(int i1) { int k1 = 1; int j1 = 1; View view = getSelectedView(); if (view != null && view.hasFocus()) { view = view.findFocus(); view = FocusFinder.getInstance().findNextFocus(this, view, i1); } else { if (i1 == 66) { if (V <= 0) { j1 = 0; } k1 = u.left; if (j1 != 0) { j1 = getArrowScrollPreviewLength(); } else { j1 = 0; } k1 = j1 + k1; j1 = k1; if (view != null) { j1 = k1; if (view.getLeft() > k1) { j1 = view.getLeft(); } } aH.set(j1, 0, j1, 0); } else { int l1; if ((V + getChildCount()) - 1 < ao) { j1 = k1; } else { j1 = 0; } k1 = getWidth(); l1 = u.right; if (j1 != 0) { j1 = getArrowScrollPreviewLength(); } else { j1 = 0; } k1 = k1 - l1 - j1; j1 = k1; if (view != null) { j1 = k1; if (view.getRight() < k1) { j1 = view.getRight(); } } aH.set(j1, 0, j1, 0); } view = FocusFinder.getInstance().findNextFocusFromRect(this, aH, i1); } if (view != null) { j1 = g(view); if (am != -1 && j1 != am) { k1 = p(i1); if (k1 != -1 && (i1 == 66 && k1 < j1 || i1 == 17 && k1 > j1)) { return null; } } k1 = a(i1, view, j1); int i2 = getMaxScrollAmount(); if (k1 < i2) { view.requestFocus(i1); aJ.a(j1, k1); return aJ; } if (h(view) < i2) { view.requestFocus(i1); aJ.a(j1, i2); return aJ; } } return null; } private void r(int i1) { d(i1); int j1 = getWidth() - u.right; int k1 = u.left; AbsHListView.e e1 = p; if (i1 < 0) { i1 = getChildCount(); View view = getChildAt(i1 - 1); do { if (view.getRight() >= j1) { break; } int l1 = (V + i1) - 1; if (l1 >= ao - 1) { break; } view = c(view, l1); i1++; } while (true); if (view.getBottom() < j1) { d(j1 - view.getRight()); } view = getChildAt(0); while (view.getRight() < k1) { if (e1.b(((AbsHListView.c)view.getLayoutParams()).a)) { detachViewFromParent(view); e1.a(view, V); } else { removeViewInLayout(view); } view = getChildAt(0); V = V + 1; } } else { View view1; for (view1 = getChildAt(0); view1.getLeft() > k1 && V > 0; V = V - 1) { view1 = b(view1, V); } if (view1.getLeft() > k1) { d(k1 - view1.getLeft()); } i1 = getChildCount() - 1; view1 = getChildAt(i1); while (view1.getLeft() > j1) { if (e1.b(((AbsHListView.c)view1.getLayoutParams()).a)) { detachViewFromParent(view1); e1.a(view1, V + i1); } else { removeViewInLayout(view1); } i1--; view1 = getChildAt(i1); } } } private void z() { boolean flag; int l1; flag = false; l1 = getChildCount(); if (l1 <= 0) goto _L2; else goto _L1 _L1: if (K) goto _L4; else goto _L3 _L3: int k1; k1 = getChildAt(0).getLeft() - u.left; int i1 = k1; if (V != 0) { i1 = k1 - av; } k1 = i1; if (i1 < 0) { k1 = ((flag) ? 1 : 0); } _L6: if (k1 != 0) { d(-k1); } _L2: return; _L4: k1 = getChildAt(l1 - 1).getRight() - (getWidth() - u.right); int j1 = k1; if (l1 + V < ao) { j1 = k1 + av; } k1 = ((flag) ? 1 : 0); if (j1 <= 0) { k1 = j1; } if (true) goto _L6; else goto _L5 _L5: } final int a(int i1, int j1, int k1, int l1, int i2) { Object obj; int l2; l2 = 0; obj = j; if (obj != null) goto _L2; else goto _L1 _L1: i1 = u.left + u.right; _L4: return i1; _L2: int i3 = u.left + u.right; boolean aflag[]; int j2; int k2; boolean flag; if (av > 0 && au != null) { j2 = av; } else { j2 = 0; } k2 = k1; if (k1 == -1) { k2 = ((ListAdapter) (obj)).getCount() - 1; } obj = p; flag = y(); aflag = P; k1 = j1; j1 = i3; while (k1 <= k2) { View view = a(k1, aflag); a(view, k1, i1); if (k1 > 0) { j1 += j2; } if (flag && ((AbsHListView.e) (obj)).b(((AbsHListView.c)view.getLayoutParams()).a)) { ((AbsHListView.e) (obj)).a(view, -1); } j1 = view.getMeasuredWidth() + j1; if (j1 >= l1) { i1 = l1; if (i2 >= 0) { i1 = l1; if (k1 > i2) { i1 = l1; if (l2 > 0) { i1 = l1; if (j1 != l1) { return l2; } } } } continue; /* Loop/switch isn't completed */ } int j3 = l2; if (i2 >= 0) { j3 = l2; if (k1 >= i2) { j3 = j1; } } k1++; l2 = j3; } return j1; if (true) goto _L4; else goto _L3 _L3: } void a(Canvas canvas, Rect rect, int i1) { Drawable drawable = au; drawable.setBounds(rect); drawable.draw(canvas); } void a(Canvas canvas, Drawable drawable, Rect rect) { int i1 = drawable.getMinimumWidth(); canvas.save(); canvas.clipRect(rect); if (rect.right - rect.left < i1) { rect.left = rect.right - i1; } drawable.setBounds(rect); drawable.draw(canvas); canvas.restore(); } public void a(View view, Object obj, boolean flag) { b b1 = new b(); b1.a = view; b1.b = obj; b1.c = flag; az.add(b1); if (j != null) { if (!(j instanceof b)) { j = new b(az, aA, j); } if (i != null) { i.onChanged(); } } } protected void a(boolean flag) { int i1 = 0; int j1 = getChildCount(); if (flag) { if (j1 > 0) { i1 = getChildAt(j1 - 1).getRight() + av; } g(j1 + V, i1); l(getChildCount()); return; } if (j1 > 0) { i1 = getChildAt(0).getLeft() - av; } else { i1 = getWidth() - 0; } h(V - 1, i1); m(getChildCount()); } final int[] a(int i1, int j1, int k1, int l1, int i2, int j2) { Object obj = j; if (obj == null) { return (new int[] { u.left + u.right, u.top + u.bottom }); } int i3 = u.left; int j3 = u.right; int k3 = u.top; int l3 = u.bottom; boolean aflag[]; int k2; int l2; boolean flag; if (av > 0 && au != null) { j2 = av; } else { j2 = 0; } k2 = k1; if (k1 == -1) { k2 = ((ListAdapter) (obj)).getCount() - 1; } obj = p; flag = y(); aflag = P; l2 = 0; k1 = 0; for (; j1 <= k2; j1++) { View view = a(j1, aflag); a(view, j1, i1); if (flag && ((AbsHListView.e) (obj)).b(((AbsHListView.c)view.getLayoutParams()).a)) { ((AbsHListView.e) (obj)).a(view, -1); } l2 = Math.max(l2, view.getMeasuredWidth() + j2); k1 = Math.max(k1, view.getMeasuredHeight()); } return (new int[] { Math.min(l2 + (i3 + j3), l1), Math.min(k1 + (k3 + l3), i2) }); } protected int b(int i1, boolean flag) { ListAdapter listadapter = j; if (listadapter != null && !isInTouchMode()) goto _L2; else goto _L1 _L1: int j1 = -1; _L4: return j1; _L2: int k1; k1 = listadapter.getCount(); if (aF) { break MISSING_BLOCK_LABEL_137; } if (flag) { j1 = Math.max(0, i1); do { i1 = j1; if (j1 >= k1) { break; } i1 = j1; if (listadapter.isEnabled(j1)) { break; } j1++; } while (true); } else { j1 = Math.min(i1, k1 - 1); do { i1 = j1; if (j1 < 0) { break; } i1 = j1; if (listadapter.isEnabled(j1)) { break; } j1--; } while (true); } if (i1 < 0) { break; /* Loop/switch isn't completed */ } j1 = i1; if (i1 < k1) goto _L4; else goto _L3 _L3: return -1; if (i1 < 0) { break; /* Loop/switch isn't completed */ } j1 = i1; if (i1 < k1) goto _L4; else goto _L5 _L5: return -1; } void b(Canvas canvas, Drawable drawable, Rect rect) { int i1 = drawable.getMinimumWidth(); canvas.save(); canvas.clipRect(rect); if (rect.right - rect.left < i1) { rect.right = i1 + rect.left; } drawable.setBounds(rect); drawable.draw(canvas); canvas.restore(); } public void b(View view) { a(view, null, true); } public int[] c(View view) { e(view); return (new int[] { view.getMeasuredWidth(), view.getMeasuredHeight() }); } protected boolean canAnimate() { return super.canAnimate() && ao > 0; } protected void d() { a(az); a(aA); super.d(); h = 0; } protected void dispatchDraw(Canvas canvas) { Drawable drawable; Drawable drawable1; Rect rect; ListAdapter listadapter; Paint paint; int i1; boolean flag; boolean flag1; boolean flag2; int i3; int j3; int k3; int l3; int i4; int j4; int k4; boolean flag8; boolean flag9; if (y) { z = true; } i3 = av; drawable = ax; drawable1 = ay; int k1; int i5; boolean flag10; if (drawable != null) { i1 = 1; } else { i1 = 0; } if (drawable1 != null) { flag = true; } else { flag = false; } if (i3 > 0 && au != null) { flag1 = true; } else { flag1 = false; } if (!flag1 && i1 == 0 && !flag) goto _L2; else goto _L1 _L1: rect = aH; rect.top = getPaddingTop(); rect.bottom = getBottom() - getTop() - getPaddingBottom(); j3 = getChildCount(); l3 = az.size(); k4 = ao; i4 = k4 - aA.size() - 1; flag8 = aD; flag9 = aE; k3 = V; flag10 = aF; listadapter = j; if (isOpaque() && !super.isOpaque()) { flag2 = true; } else { flag2 = false; } if (flag2 && aI == null && aB) { aI = new Paint(); aI.setColor(getCacheColorHint()); } paint = aI; j4 = (getRight() - getLeft() - 0) + getScrollX(); if (K) goto _L4; else goto _L3 _L3: k1 = getScrollX(); if (j3 <= 0 || k1 >= 0) goto _L6; else goto _L5 _L5: if (i1 == 0) goto _L8; else goto _L7 _L7: rect.right = 0; rect.left = k1; a(canvas, drawable, rect); goto _L6 _L8: if (flag1) { rect.right = 0; rect.left = -i3; a(canvas, rect, -1); } continue; /* Loop/switch isn't completed */ _L6: i1 = 0; int i2 = 0; label0: do { label1: { if (i1 >= j3) { break label0; } i5 = k3 + i1; boolean flag3; boolean flag5; int j2; int k2; if (i5 < l3) { flag3 = true; } else { flag3 = false; } if (i5 >= i4) { flag5 = true; } else { flag5 = false; } if (!flag8) { j2 = i2; if (flag3) { break label1; } } if (!flag9) { j2 = i2; if (flag5) { break label1; } } k2 = getChildAt(i1).getRight(); if (i1 == j3 - 1) { i2 = 1; } else { i2 = 0; } j2 = k2; if (!flag1) { break label1; } j2 = k2; if (k2 >= j4) { break label1; } if (flag) { j2 = k2; if (i2 != 0) { break label1; } } j2 = i5 + 1; if (listadapter.isEnabled(i5) && (flag8 || !flag3 && j2 >= l3) && (i2 != 0 || listadapter.isEnabled(j2) && (flag9 || !flag5 && j2 < i4))) { rect.left = k2; rect.right = k2 + i3; a(canvas, rect, i1); j2 = k2; } else { j2 = k2; if (flag2) { rect.left = k2; rect.right = k2 + i3; canvas.drawRect(rect, paint); j2 = k2; } } } i1++; i2 = j2; } while (true); i1 = getRight() + getScrollX(); if (flag && k3 + j3 == k4 && i1 > i2) { rect.left = i2; rect.right = i1; b(canvas, drawable1, rect); } _L2: super.dispatchDraw(canvas); return; _L4: int l2 = getScrollX(); if (j3 > 0 && i1 != 0) { rect.left = l2; rect.right = getChildAt(0).getLeft(); a(canvas, drawable, rect); } int l1; if (i1 != 0) { i1 = 1; } else { i1 = 0; } l1 = i1; while (l1 < j3) { int l4 = k3 + l1; boolean flag4; boolean flag6; int j5; if (l4 < l3) { flag4 = true; } else { flag4 = false; } if (l4 >= i4) { flag6 = true; } else { flag6 = false; } if (!flag8 && flag4 || !flag9 && flag6) { continue; } j5 = getChildAt(l1).getLeft(); if (flag1 && j5 > 0) { boolean flag7; int k5; if (l1 == i1) { flag7 = true; } else { flag7 = false; } k5 = l4 - 1; if (listadapter.isEnabled(l4) && (flag8 || !flag4 && k5 >= l3) && (flag7 || listadapter.isEnabled(k5) && (flag9 || !flag6 && k5 < i4))) { rect.left = j5 - i3; rect.right = j5; a(canvas, rect, l1 - 1); } else if (flag2) { rect.left = j5 - i3; rect.right = j5; canvas.drawRect(rect, paint); } } l1++; } if (j3 > 0 && l2 > 0) { if (flag) { int j1 = getRight(); rect.left = j1; rect.right = j1 + l2; b(canvas, drawable1, rect); } else if (flag1) { rect.left = j4; rect.right = j4 + i3; a(canvas, rect, -1); } } if (true) goto _L2; else goto _L9 _L9: if (true) goto _L6; else goto _L10 _L10: } public boolean dispatchKeyEvent(KeyEvent keyevent) { boolean flag1 = super.dispatchKeyEvent(keyevent); boolean flag = flag1; if (!flag1) { flag = flag1; if (getFocusedChild() != null) { flag = flag1; if (keyevent.getAction() == 0) { flag = onKeyDown(keyevent.getKeyCode(), keyevent); } } } return flag; } protected boolean drawChild(Canvas canvas, View view, long l1) { boolean flag = super.drawChild(canvas, view, l1); if (z) { z = false; } return flag; } protected int e(int i1) { int l1 = getChildCount(); if (l1 > 0) { if (!K) { for (int j1 = 0; j1 < l1; j1++) { if (i1 <= getChildAt(j1).getRight()) { return j1 + V; } } } else { for (int k1 = l1 - 1; k1 >= 0; k1--) { if (i1 >= getChildAt(k1).getLeft()) { return k1 + V; } } } } return -1; } protected void e() { boolean flag = at; if (!flag) goto _L2; else goto _L1 _L1: return; _L2: at = true; super.e(); invalidate(); if (j != null) { break MISSING_BLOCK_LABEL_51; } d(); b(); if (flag) goto _L1; else goto _L3 _L3: at = false; return; int j1; int l1; int i2; j1 = u.left; l1 = getRight() - getLeft() - u.right; i2 = getChildCount(); Object obj; View view; View view2; int i1; int k1; k1 = 0; i1 = 0; view2 = null; obj = null; view = null; h; JVM INSTR tableswitch 1 5: default 1178 // 1 1181 // 2 248 // 3 1181 // 4 1181 // 5 1181; goto _L4 _L5 _L6 _L5 _L5 _L5 _L4: k1 = am - V; View view1; view1 = ((View) (obj)); if (k1 < 0) { break MISSING_BLOCK_LABEL_170; } view1 = ((View) (obj)); if (k1 >= i2) { break MISSING_BLOCK_LABEL_170; } view1 = getChildAt(k1); obj = getChildAt(0); if (ak >= 0) { i1 = ak - am; } view = getChildAt(k1 + i1); view2 = view1; _L14: boolean flag1 = aj; if (!flag1) goto _L8; else goto _L7 _L7: r(); _L8: if (ao != 0) goto _L10; else goto _L9 _L9: d(); b(); if (flag) goto _L1; else goto _L11 _L11: at = false; return; _L6: i1 = ak - V; if (i1 < 0 || i1 >= i2) goto _L13; else goto _L12 _L12: view = getChildAt(i1); obj = null; i1 = k1; goto _L14 _L10: if (ao != j.getCount()) { throw new IllegalStateException((new StringBuilder()).append("The content of the adapter has changed but ListView did not receive a notification. Make sure the content of your adapter is not modified from a background thread, but only from the UI thread. [in ListView(").append(getId()).append(", ").append(getClass()).append(") with Adapter(").append(j.getClass()).append(")]").toString()); } goto _L15 obj; if (!flag) { at = false; } throw obj; _L15: setSelectedPositionInt(ak); Object obj1; obj1 = null; view1 = null; Object obj2 = getFocusedChild(); if (obj2 == null) goto _L17; else goto _L16 _L16: if (!flag1) goto _L19; else goto _L18 _L18: if (!d(((View) (obj2)))) goto _L20; else goto _L19 _L19: view1 = findFocus(); if (view1 == null) goto _L22; else goto _L21 _L21: view1.onStartTemporaryDetach(); goto _L22 _L20: requestFocus(); _L73: int j2; j2 = V; obj2 = p; if (!flag1) goto _L24; else goto _L23 _L23: k1 = 0; _L26: if (k1 >= i2) { break; /* Loop/switch isn't completed */ } ((AbsHListView.e) (obj2)).a(getChildAt(k1), j2 + k1); k1++; if (true) goto _L26; else goto _L25 _L24: ((AbsHListView.e) (obj2)).a(i2, j2); _L25: detachAllViewsFromParent(); ((AbsHListView.e) (obj2)).d(); h; JVM INSTR tableswitch 1 6: default 1197 // 1 827 // 2 759 // 3 807 // 4 846 // 5 791 // 6 862; goto _L27 _L28 _L29 _L30 _L31 _L32 _L33 _L27: if (i2 != 0) goto _L35; else goto _L34 _L34: if (K) goto _L37; else goto _L36 _L36: setSelectedPositionInt(b(0, true)); obj = h(j1); _L54: ((AbsHListView.e) (obj2)).e(); if (obj == null) goto _L39; else goto _L38 _L38: if (!aG || !hasFocus() || ((View) (obj)).hasFocus()) goto _L41; else goto _L40 _L40: if (obj != obj1 || view1 == null) goto _L43; else goto _L42 _L42: if (view1.requestFocus()) goto _L44; else goto _L43 _L43: if (!((View) (obj)).requestFocus()) goto _L45; else goto _L44 _L74: if (i1 != 0) goto _L47; else goto _L46 _L46: view = getFocusedChild(); if (view == null) goto _L49; else goto _L48 _L48: view.clearFocus(); _L49: b(-1, ((View) (obj))); _L63: J = ((View) (obj)).getLeft(); _L69: if (view1 == null) goto _L51; else goto _L50 _L50: if (view1.getWindowToken() != null) { view1.onFinishTemporaryDetach(); } _L51: h = 0; aj = false; if (O != null) { post(O); O = null; } ad = false; setNextSelectedPositionInt(am); f(); if (ao > 0) { v(); } b(); if (!flag) { at = false; return; } goto _L1 _L29: if (view == null) goto _L53; else goto _L52 _L52: obj = b(view.getLeft(), j1, l1); goto _L54 _L53: obj = i(j1, l1); goto _L54 _L32: obj = j(aa, W); goto _L54 _L30: obj = h(ao - 1, l1); z(); goto _L54 _L28: V = 0; obj = h(j1); z(); goto _L54 _L31: obj = j(n(), W); goto _L54 _L33: obj = a(view2, view, i1, j1, l1); goto _L54 _L37: setSelectedPositionInt(b(ao - 1, false)); obj = h(ao - 1, l1); goto _L54 _L35: if (am < 0 || am >= ao) goto _L56; else goto _L55 _L55: i1 = am; if (view2 != null) goto _L58; else goto _L57 _L57: obj = j(i1, j1); goto _L54 _L58: j1 = view2.getLeft(); goto _L57 _L56: if (V >= ao) goto _L60; else goto _L59 _L59: i1 = V; if (obj != null) goto _L62; else goto _L61 _L61: obj = j(i1, j1); goto _L54 _L62: j1 = ((View) (obj)).getLeft(); goto _L61 _L60: obj = j(0, j1); goto _L54 _L47: ((View) (obj)).setSelected(false); o.setEmpty(); goto _L63 _L41: b(-1, ((View) (obj))); goto _L63 _L39: if (F == 1 || F == 2) { i1 = 1; } else { i1 = 0; } if (i1 == 0) goto _L65; else goto _L64 _L64: obj = getChildAt(A - V); if (obj == null) goto _L67; else goto _L66 _L66: b(A, ((View) (obj))); _L67: if (!hasFocus() || view1 == null) goto _L69; else goto _L68 _L68: view1.requestFocus(); goto _L69 _L65: if (n == -1) goto _L71; else goto _L70 _L70: obj = getChildAt(n - V); if (obj == null) goto _L67; else goto _L72 _L72: b(n, ((View) (obj))); goto _L67 _L71: J = 0; o.setEmpty(); goto _L67 _L17: obj1 = null; view1 = null; goto _L73 _L13: obj = null; i1 = k1; goto _L14 _L5: obj = null; i1 = k1; goto _L14 _L22: obj1 = obj2; goto _L20 _L44: i1 = 1; goto _L74 _L45: i1 = 0; goto _L74 } public void f(int i1, int j1) { if (j != null) { if (!isInTouchMode()) { int k1 = b(i1, true); i1 = k1; if (k1 >= 0) { setNextSelectedPositionInt(k1); i1 = k1; } } else { M = i1; } if (i1 >= 0) { h = 4; W = u.left + j1; if (ad) { aa = i1; ab = j.getItemId(i1); } if (I != null) { I.a(); } requestLayout(); return; } } } public volatile Adapter getAdapter() { return getAdapter(); } public ListAdapter getAdapter() { return j; } public long[] getCheckItemIds() { if (j != null && j.hasStableIds()) { return getCheckedItemIds(); } if (b != 0 && f != null && j != null) { SparseArrayCompat sparsearraycompat = f; int l1 = sparsearraycompat.size(); long al[] = new long[l1]; ListAdapter listadapter = j; int j1 = 0; int i1 = 0; for (; j1 < l1; j1++) { if (((Boolean)sparsearraycompat.valueAt(j1)).booleanValue()) { int k1 = i1 + 1; al[i1] = listadapter.getItemId(sparsearraycompat.keyAt(j1)); i1 = k1; } } if (i1 == l1) { return al; } else { long al1[] = new long[i1]; System.arraycopy(al, 0, al1, 0, i1); return al1; } } else { return new long[0]; } } public Drawable getDivider() { return au; } public int getDividerWidth() { return av; } public int getFooterViewsCount() { return aA.size(); } public int getHeaderViewsCount() { return az.size(); } public boolean getItemsCanFocus() { return aG; } public int getMaxScrollAmount() { return (int)(0.33F * (float)(getRight() - getLeft())); } public Drawable getOverscrollFooter() { return ay; } public Drawable getOverscrollHeader() { return ax; } boolean i(int i1) { boolean flag; if (i1 == 17) { i1 = Math.max(0, am - getChildCount() - 1); flag = false; } else if (i1 == 66) { i1 = Math.min(ao - 1, (am + getChildCount()) - 1); flag = true; } else { i1 = -1; flag = false; } if (i1 >= 0) { i1 = b(i1, flag); if (i1 >= 0) { h = 4; W = getPaddingLeft() + getHorizontalFadingEdgeLength(); if (flag && i1 > ao - getChildCount()) { h = 3; } if (!flag && i1 < getChildCount()) { h = 1; } setSelectionInt(i1); b(); if (!awakenScrollBars()) { invalidate(); } return true; } } return false; } public boolean isOpaque() { boolean flag; if (z && aB && aC || super.isOpaque()) { flag = true; } else { flag = false; } if (flag) { View view; int i1; if (u != null) { i1 = u.left; } else { i1 = getPaddingLeft(); } view = getChildAt(0); if (view == null || view.getLeft() > i1) { return false; } int j1 = getWidth(); if (u != null) { i1 = u.right; } else { i1 = getPaddingRight(); } view = getChildAt(getChildCount() - 1); if (view == null || view.getRight() < j1 - i1) { return false; } } return flag; } boolean j(int i1) { boolean flag1 = true; if (i1 != 17) goto _L2; else goto _L1 _L1: if (am == 0) goto _L4; else goto _L3 _L3: boolean flag; i1 = b(0, true); flag = flag1; if (i1 >= 0) { h = 1; setSelectionInt(i1); b(); flag = flag1; } _L6: if (flag && !awakenScrollBars()) { awakenScrollBars(); invalidate(); } return flag; _L2: if (i1 == 66 && am < ao - 1) { i1 = b(ao - 1, true); flag = flag1; if (i1 >= 0) { h = 3; setSelectionInt(i1); b(); flag = flag1; } continue; /* Loop/switch isn't completed */ } _L4: flag = false; if (true) goto _L6; else goto _L5 _L5: } boolean k(int i1) { boolean flag; af = true; flag = o(i1); if (!flag) { break MISSING_BLOCK_LABEL_23; } playSoundEffect(SoundEffectConstants.getContantForFocusDirection(i1)); af = false; return flag; Exception exception; exception; af = false; throw exception; } protected void onFinishInflate() { super.onFinishInflate(); int j1 = getChildCount(); if (j1 > 0) { for (int i1 = 0; i1 < j1; i1++) { b(getChildAt(i1)); } removeAllViews(); } } protected void onFocusChanged(boolean flag, int i1, Rect rect) { ListAdapter listadapter; int j1; int k1; int l1; int j2; int l2; l1 = 0; k1 = 0; super.onFocusChanged(flag, i1, rect); listadapter = j; j1 = -1; j2 = l1; l2 = j1; if (listadapter == null) goto _L2; else goto _L1 _L1: j2 = l1; l2 = j1; if (!flag) goto _L2; else goto _L3 _L3: j2 = l1; l2 = j1; if (rect == null) goto _L2; else goto _L4 _L4: Rect rect1; int i2; int i3; int j3; rect.offset(getScrollX(), getScrollY()); if (listadapter.getCount() < getChildCount() + V) { h = 0; e(); } rect1 = aH; i2 = 0x7fffffff; i3 = getChildCount(); j3 = V; l1 = 0; _L6: j2 = k1; l2 = j1; if (l1 >= i3) goto _L2; else goto _L5 _L5: if (!listadapter.isEnabled(j3 + l1)) { j2 = k1; k1 = j1; j1 = j2; } else { View view = getChildAt(l1); view.getDrawingRect(rect1); offsetDescendantRectToMyCoords(view, rect1); j2 = a(rect, rect1, i1); if (j2 < i2) { j1 = view.getLeft(); k1 = l1; i2 = j2; } else { int k2 = j1; j1 = k1; k1 = k2; } } j2 = l1 + 1; l1 = k1; k1 = j1; j1 = l1; l1 = j2; if (true) goto _L6; else goto _L2 _L2: if (l2 >= 0) { f(V + l2, j2); return; } else { requestLayout(); return; } } public void onGlobalLayout() { } public void onInitializeAccessibilityEvent(AccessibilityEvent accessibilityevent) { super.onInitializeAccessibilityEvent(accessibilityevent); accessibilityevent.setClassName(it/sephiroth/android/library/widget/HListView.getName()); } public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo accessibilitynodeinfo) { super.onInitializeAccessibilityNodeInfo(accessibilitynodeinfo); accessibilitynodeinfo.setClassName(it/sephiroth/android/library/widget/HListView.getName()); } public boolean onKeyDown(int i1, KeyEvent keyevent) { return a(i1, 1, keyevent); } public boolean onKeyMultiple(int i1, int j1, KeyEvent keyevent) { return a(i1, j1, keyevent); } public boolean onKeyUp(int i1, KeyEvent keyevent) { return a(i1, 1, keyevent); } protected void onMeasure(int i1, int j1) { int k1; int j2; int k2; int k3; label0: { super.onMeasure(i1, j1); int j3 = android.view.View.MeasureSpec.getMode(i1); k3 = android.view.View.MeasureSpec.getMode(j1); j2 = android.view.View.MeasureSpec.getSize(i1); k2 = android.view.View.MeasureSpec.getSize(j1); int l2 = 0; int i3 = 0; boolean flag1 = false; boolean flag = false; View view; int l1; int i2; if (j == null) { i1 = 0; } else { i1 = j.getCount(); } ao = i1; k1 = ((flag1) ? 1 : 0); i2 = i3; l1 = l2; if (ao <= 0) { break label0; } if (j3 != 0) { k1 = ((flag1) ? 1 : 0); i2 = i3; l1 = l2; if (k3 != 0) { break label0; } } view = a(0, P); a(view, 0, j1); l2 = view.getMeasuredWidth(); i3 = view.getMeasuredHeight(); i1 = ((flag) ? 1 : 0); if (android.os.Build.VERSION.SDK_INT >= 11) { i1 = combineMeasuredStates(0, view.getMeasuredState()); } k1 = i1; i2 = i3; l1 = l2; if (y()) { k1 = i1; i2 = i3; l1 = l2; if (p.b(((AbsHListView.c)view.getLayoutParams()).a)) { p.a(view, 0); l1 = l2; i2 = i3; k1 = i1; } } } if (k3 == 0) { i1 = i2 + (u.top + u.bottom) + getHorizontalScrollbarHeight(); } else if (k3 == 0x80000000 && ao > 0 && aw > -1) { i1 = a(j1, aw, aw, j2, k2, -1)[1]; } else if (android.os.Build.VERSION.SDK_INT >= 11) { i1 = k2 | 0xff000000 & k1; } else { i1 = k2; } k1 = j2; if (j3 == 0) { k1 = u.left + u.right + l1 + getHorizontalFadingEdgeLength() * 2; } l1 = k1; if (j3 == 0x80000000) { l1 = a(j1, 0, -1, k1, -1); } setMeasuredDimension(l1, i1); v = j1; } protected void onSizeChanged(int i1, int j1, int k1, int l1) { if (getChildCount() > 0) { View view = getFocusedChild(); if (view != null) { int i2 = V; int j2 = indexOfChild(view); int k2 = Math.max(0, view.getRight() - (i1 - getPaddingLeft())); int l2 = view.getLeft(); /* block-local class not found */ class FocusSelector {} if (aK == null) { aK = new FocusSelector(null); } post(aK.a(i2 + j2, l2 - k2)); } } super.onSizeChanged(i1, j1, k1, l1); } public boolean requestChildRectangleOnScreen(View view, Rect rect, boolean flag) { int i1; int l1; int i2; int l2; label0: { int j2 = rect.left; rect.offset(view.getLeft(), view.getTop()); rect.offset(-view.getScrollX(), -view.getScrollY()); i2 = getWidth(); int j1 = getScrollX(); l1 = j1 + i2; l2 = getHorizontalFadingEdgeLength(); i1 = j1; if (!A()) { break label0; } if (am <= 0) { i1 = j1; if (j2 <= l2) { break label0; } } i1 = j1 + l2; } int k1; int k2; label1: { k2 = getChildAt(getChildCount() - 1).getRight(); k1 = l1; if (!B()) { break label1; } if (am >= ao - 1) { k1 = l1; if (rect.right >= k2 - l2) { break label1; } } k1 = l1 - l2; } if (rect.right > k1 && rect.left > i1) { if (rect.width() > i2) { i1 = (rect.left - i1) + 0; } else { i1 = (rect.right - k1) + 0; } i1 = Math.min(i1, k2 - k1); } else if (rect.left < i1 && rect.right < k1) { if (rect.width() > i2) { k1 = 0 - (k1 - rect.right); } else { k1 = 0 - (i1 - rect.left); } i1 = Math.max(k1, getChildAt(0).getLeft() - i1); } else { i1 = 0; } if (i1 != 0) { flag = true; } else { flag = false; } if (flag) { r(-i1); b(-1, view); J = view.getTop(); invalidate(); } return flag; } public volatile void setAdapter(Adapter adapter) { setAdapter((ListAdapter)adapter); } public void setAdapter(ListAdapter listadapter) { if (j != null && i != null) { j.unregisterDataSetObserver(i); } d(); p.b(); if (az.size() > 0 || aA.size() > 0) { j = new b(az, aA, listadapter); } else { j = listadapter; } ar = -1; as = 0x8000000000000000L; super.setAdapter(listadapter); if (j != null) { aF = j.areAllItemsEnabled(); ap = ao; ao = j.getCount(); t(); i = new AbsHListView.b(this); j.registerDataSetObserver(i); p.a(j.getViewTypeCount()); int i1; if (K) { i1 = b(ao - 1, false); } else { i1 = b(0, true); } setSelectedPositionInt(i1); setNextSelectedPositionInt(i1); if (ao == 0) { v(); } } else { aF = true; t(); v(); } requestLayout(); } public void setCacheColorHint(int i1) { boolean flag; if (i1 >>> 24 == 255) { flag = true; } else { flag = false; } aB = flag; if (flag) { if (aI == null) { aI = new Paint(); } aI.setColor(i1); } super.setCacheColorHint(i1); } public void setDivider(Drawable drawable) { boolean flag = false; if (drawable != null) { av = drawable.getIntrinsicWidth(); } else { av = 0; } au = drawable; if (drawable == null || drawable.getOpacity() == -1) { flag = true; } aC = flag; requestLayout(); invalidate(); } public void setDividerWidth(int i1) { av = i1; requestLayout(); invalidate(); } public void setFooterDividersEnabled(boolean flag) { aE = flag; invalidate(); } public void setHeaderDividersEnabled(boolean flag) { aD = flag; invalidate(); } public void setItemsCanFocus(boolean flag) { aG = flag; if (!flag) { setDescendantFocusability(0x60000); } } public void setOverscrollFooter(Drawable drawable) { ay = drawable; invalidate(); } public void setOverscrollHeader(Drawable drawable) { ax = drawable; if (getScrollX() < 0) { invalidate(); } } public void setSelection(int i1) { f(i1, 0); } public void setSelectionInt(int i1) { boolean flag; int j1; flag = true; setNextSelectedPositionInt(i1); j1 = am; break MISSING_BLOCK_LABEL_12; if (j1 < 0 || i1 != j1 - 1 && i1 != j1 + 1) { flag = false; } if (I != null) { I.a(); } e(); if (flag) { awakenScrollBars(); } return; } protected boolean y() { return true; } }
82,828
0.375649
0.337707
3,436
23.108847
18.668804
403
false
false
0
0
0
0
0
0
0.586729
false
false
1
00b273908281c921f911c1385c17e96160b70c35
2,594,160,294,097
c36bb2b27f0b85561912db0ea849a9f39a9fb7e3
/src/transformation/ScaleTransform.java
7df0bea156d6395e31dee054c3cf225271d53a04
[]
no_license
TobySalusky/PolyArt
https://github.com/TobySalusky/PolyArt
d38c7f10f8f297a6114f0f9c30461ea19594db19
73a0ac451ec78dee041599758bd37ff41a2c6fd6
refs/heads/master
"2023-08-02T05:50:23.964000"
"2021-10-03T01:15:02"
"2021-10-03T01:15:02"
287,964,596
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package transformation; import util.Vector; public class ScaleTransform extends Transform { private final float scalarX, scalarY; private final Vector around; //public ScaleTransform() {} public ScaleTransform(float scalarX, float scalarY, Vector around) { this.scalarX = scalarX; this.scalarY = scalarY; this.around = around; } @Override public void apply(Vector vert) { Vector to = around.added(vert.subbed(around).multed2(scalarX, scalarY)); vert.setTo(to); } @Override public Transform reverse() { return new ScaleTransform(1 / scalarX, 1 / scalarY, around); } }
UTF-8
Java
597
java
ScaleTransform.java
Java
[]
null
[]
package transformation; import util.Vector; public class ScaleTransform extends Transform { private final float scalarX, scalarY; private final Vector around; //public ScaleTransform() {} public ScaleTransform(float scalarX, float scalarY, Vector around) { this.scalarX = scalarX; this.scalarY = scalarY; this.around = around; } @Override public void apply(Vector vert) { Vector to = around.added(vert.subbed(around).multed2(scalarX, scalarY)); vert.setTo(to); } @Override public Transform reverse() { return new ScaleTransform(1 / scalarX, 1 / scalarY, around); } }
597
0.730318
0.725293
28
20.321428
21.509224
74
false
false
0
0
0
0
0
0
1.392857
false
false
1
b42bf2f6a7808326021f9cb8b9f9868cdb4e6c3e
18,811,956,802,427
f456ba5e6b02fc27860a5c68118f28bdbe09e064
/src/main/java/fourinarowbot/board/BoardState.java
72741353cf102209731c719ad23c12a291d1d941
[]
no_license
KalleEnberg/kick-out_competition
https://github.com/KalleEnberg/kick-out_competition
33ac3b8aeeff454b6d2599578dc0b7387f0528d2
e4069fbf52f80138803c2220aed3ca6bde276734
refs/heads/master
"2021-01-12T11:53:03.289000"
"2016-09-30T14:30:21"
"2016-09-30T14:30:21"
69,598,858
1
1
null
true
"2016-09-29T19:05:04"
"2016-09-29T19:05:04"
"2016-09-25T20:27:14"
"2016-09-29T18:10:40"
49
0
0
0
null
null
null
package fourinarowbot.board; import fourinarowbot.domain.Marker; public class BoardState { private Marker[][] markers; private BoardState() { // For JSON-serialization } public BoardState(final Marker[][] markers) { this.markers = markers; } public Marker[][] getMarkers() { return markers; } }
UTF-8
Java
353
java
BoardState.java
Java
[]
null
[]
package fourinarowbot.board; import fourinarowbot.domain.Marker; public class BoardState { private Marker[][] markers; private BoardState() { // For JSON-serialization } public BoardState(final Marker[][] markers) { this.markers = markers; } public Marker[][] getMarkers() { return markers; } }
353
0.626062
0.626062
20
16.65
15.935102
49
false
false
0
0
0
0
0
0
0.25
false
false
1
80c7f5e9da00f27f0c32b838beaf155af3517300
16,423,954,994,532
f8a2b9e25c4e337ea426d4b6109821c2b1d7ed48
/src/main/java/com/rentacar/service/dto/CarDTO.java
817b4115e7ab52e78688883506ce67e255a22d12
[]
no_license
gamzeburcin/JhipsterProject
https://github.com/gamzeburcin/JhipsterProject
5ca43a7a720c9b7776a77f0adeea8a660ddac800
8ce97050cd4b610a96e0588a80ffb65c833319b1
refs/heads/master
"2023-06-17T07:15:44.744000"
"2021-07-13T22:34:19"
"2021-07-13T22:34:19"
381,308,785
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.rentacar.service.dto; import java.io.Serializable; import java.util.Objects; /** * A DTO for the {@link com.rentacar.domain.Car} entity. */ public class CarDTO implements Serializable { private Long id; private Long brandId; private Long colorId; private String modelYear; private Double dailyPrice; private String description; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Long getBrandId() { return brandId; } public void setBrandId(Long brandId) { this.brandId = brandId; } public Long getColorId() { return colorId; } public void setColorId(Long colorId) { this.colorId = colorId; } public String getModelYear() { return modelYear; } public void setModelYear(String modelYear) { this.modelYear = modelYear; } public Double getDailyPrice() { return dailyPrice; } public void setDailyPrice(Double dailyPrice) { this.dailyPrice = dailyPrice; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof CarDTO)) { return false; } CarDTO carDTO = (CarDTO) o; if (this.id == null) { return false; } return Objects.equals(this.id, carDTO.id); } @Override public int hashCode() { return Objects.hash(this.id); } // prettier-ignore @Override public String toString() { return "CarDTO{" + "id=" + getId() + ", brandId=" + getBrandId() + ", colorId=" + getColorId() + ", modelYear='" + getModelYear() + "'" + ", dailyPrice=" + getDailyPrice() + ", description='" + getDescription() + "'" + "}"; } }
UTF-8
Java
2,102
java
CarDTO.java
Java
[]
null
[]
package com.rentacar.service.dto; import java.io.Serializable; import java.util.Objects; /** * A DTO for the {@link com.rentacar.domain.Car} entity. */ public class CarDTO implements Serializable { private Long id; private Long brandId; private Long colorId; private String modelYear; private Double dailyPrice; private String description; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Long getBrandId() { return brandId; } public void setBrandId(Long brandId) { this.brandId = brandId; } public Long getColorId() { return colorId; } public void setColorId(Long colorId) { this.colorId = colorId; } public String getModelYear() { return modelYear; } public void setModelYear(String modelYear) { this.modelYear = modelYear; } public Double getDailyPrice() { return dailyPrice; } public void setDailyPrice(Double dailyPrice) { this.dailyPrice = dailyPrice; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof CarDTO)) { return false; } CarDTO carDTO = (CarDTO) o; if (this.id == null) { return false; } return Objects.equals(this.id, carDTO.id); } @Override public int hashCode() { return Objects.hash(this.id); } // prettier-ignore @Override public String toString() { return "CarDTO{" + "id=" + getId() + ", brandId=" + getBrandId() + ", colorId=" + getColorId() + ", modelYear='" + getModelYear() + "'" + ", dailyPrice=" + getDailyPrice() + ", description='" + getDescription() + "'" + "}"; } }
2,102
0.55471
0.55471
104
19.211538
16.771469
56
false
false
0
0
0
0
0
0
0.326923
false
false
1
95b1f1dec1d5c2d7830906222234bbe3c6e48e4d
8,418,135,955,245
f378ddd47c8b7de6e9cf1d4228c84f73e9dc59f1
/projetos/tpv/FinestraAfegirProductesATicket.java
f5e8773bacd0751a4033d123fe0ca410a8b1f339
[]
no_license
charles-marques/dataset-375
https://github.com/charles-marques/dataset-375
29e2f99ac1ba323f8cb78bf80107963fc180487c
51583daaf58d5669c69d8208b8c4ed4e009001a5
refs/heads/master
"2023-01-20T07:23:09.445000"
"2020-11-27T22:35:49"
"2020-11-27T22:35:49"
283,315,149
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ /* * FinestraAfegirProductesATicket.java * * Created on 09/11/2009, 02:27:24 */ package tpv; import java.util.Collection; import java.util.Iterator; import java.util.LinkedHashMap; /** * * @author joan */ public class FinestraAfegirProductesATicket extends javax.swing.JFrame { private Register tpv; /** Creates new form FinestraAfegirProductesATicket */ public FinestraAfegirProductesATicket() { initComponents(); } public FinestraAfegirProductesATicket(Register unTpv) { initComponents(); tpv=unTpv; LinkedHashMap productes = tpv.getStore().getItems(); Collection col = productes.values(); Iterator cIt=col.iterator(); while(cIt.hasNext()) { Item unItem = (Item)cIt.next(); String p = unItem.getDescription().getItemID()+"\t"+unItem.getDescription().getDescription()+"\t"+unItem.getQuantity()+"\n"; areaProductes.append(p); } } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { LabelAccio = new javax.swing.JLabel(); textIDProducte = new javax.swing.JTextField(); textQuantitat = new javax.swing.JTextField(); LIdProducte = new javax.swing.JLabel(); LQuantitat = new javax.swing.JLabel(); BtnIntroduir = new javax.swing.JButton(); BtnFinalitzar = new javax.swing.JButton(); LIntroduir = new javax.swing.JLabel(); LFinalitzar = new javax.swing.JLabel(); jScrollPane1 = new javax.swing.JScrollPane(); areaProductes = new javax.swing.JTextArea(); LProducts = new javax.swing.JLabel(); LId = new javax.swing.JLabel(); LDesc = new javax.swing.JLabel(); LAmount = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("Introduir productes"); LabelAccio.setText("Introdueix productes que vols comprar:"); LIdProducte.setText("idProducte:"); LQuantitat.setText("Quantitat:"); BtnIntroduir.setText("Introduir"); BtnIntroduir.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { BtnIntroduirActionPerformed(evt); } }); BtnFinalitzar.setText("Finalitzar"); BtnFinalitzar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { BtnFinalitzarActionPerformed(evt); } }); LIntroduir.setText("Utilitza 'Introduir' per agregar un altre producte."); LFinalitzar.setText("Utilitza 'Finalitzar' per passar a fer el pagament."); areaProductes.setColumns(1); areaProductes.setEditable(false); areaProductes.setRows(20); areaProductes.setTabSize(4); jScrollPane1.setViewportView(areaProductes); LProducts.setText("Productes Disponibles:"); LId.setText("id"); LDesc.setText("Descripció"); LAmount.setText("Quantitat"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(layout.createSequentialGroup() .addGap(69, 69, 69) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(LIdProducte) .addComponent(LQuantitat)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(textQuantitat, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(textIDProducte, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(layout.createSequentialGroup() .addGap(37, 37, 37) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(LIntroduir) .addComponent(LabelAccio) .addComponent(LFinalitzar))) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(BtnIntroduir, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(BtnFinalitzar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addGap(42, 42, 42) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(LId) .addGap(18, 18, 18) .addComponent(LDesc) .addGap(18, 18, 18) .addComponent(LAmount)) .addComponent(LProducts, javax.swing.GroupLayout.DEFAULT_SIZE, 196, Short.MAX_VALUE) .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 196, Short.MAX_VALUE)) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(38, 38, 38) .addComponent(LabelAccio) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(LIdProducte) .addComponent(textIDProducte, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(textQuantitat, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(LQuantitat)) .addGap(18, 18, 18) .addComponent(LIntroduir) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(LFinalitzar) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 62, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(BtnFinalitzar) .addComponent(BtnIntroduir))) .addGroup(layout.createSequentialGroup() .addGap(40, 40, 40) .addComponent(LProducts) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(LId) .addComponent(LDesc) .addComponent(LAmount)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 202, Short.MAX_VALUE))) .addContainerGap()) ); pack(); }// </editor-fold>//GEN-END:initComponents private void BtnIntroduirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BtnIntroduirActionPerformed int id=Integer.parseInt(textIDProducte.getText()); int q=Integer.parseInt(textQuantitat.getText()); if((tpv.getStore().getItem(id)==null)) { ErrID eri = new ErrID(this,true); eri.show(); } else if(q>(tpv.getStore().getItem(id).getQuantity())) { ErrQuantitat er=new ErrQuantitat(this,true); er.show(); }else { tpv.introduirProducte(tpv.getStore().getItem(id), q); this.textQuantitat.setText(""); this.textIDProducte.setText(""); } }//GEN-LAST:event_BtnIntroduirActionPerformed private void BtnFinalitzarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BtnFinalitzarActionPerformed tpv.finalitzaVenda(); FinestraPagament f4=new FinestraPagament(tpv); f4.show(); dispose(); setVisible(false); }//GEN-LAST:event_BtnFinalitzarActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new FinestraAfegirProductesATicket().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton BtnFinalitzar; private javax.swing.JButton BtnIntroduir; private javax.swing.JLabel LAmount; private javax.swing.JLabel LDesc; private javax.swing.JLabel LFinalitzar; private javax.swing.JLabel LId; private javax.swing.JLabel LIdProducte; private javax.swing.JLabel LIntroduir; private javax.swing.JLabel LProducts; private javax.swing.JLabel LQuantitat; private javax.swing.JLabel LabelAccio; private javax.swing.JTextArea areaProductes; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JTextField textIDProducte; private javax.swing.JTextField textQuantitat; // End of variables declaration//GEN-END:variables }
UTF-8
Java
11,068
java
FinestraAfegirProductesATicket.java
Java
[ { "context": "import java.util.LinkedHashMap;\n\n/**\n *\n * @author joan\n */\npublic class FinestraAfegirProductesATicket e", "end": 311, "score": 0.997802734375, "start": 307, "tag": "USERNAME", "value": "joan" } ]
null
[]
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ /* * FinestraAfegirProductesATicket.java * * Created on 09/11/2009, 02:27:24 */ package tpv; import java.util.Collection; import java.util.Iterator; import java.util.LinkedHashMap; /** * * @author joan */ public class FinestraAfegirProductesATicket extends javax.swing.JFrame { private Register tpv; /** Creates new form FinestraAfegirProductesATicket */ public FinestraAfegirProductesATicket() { initComponents(); } public FinestraAfegirProductesATicket(Register unTpv) { initComponents(); tpv=unTpv; LinkedHashMap productes = tpv.getStore().getItems(); Collection col = productes.values(); Iterator cIt=col.iterator(); while(cIt.hasNext()) { Item unItem = (Item)cIt.next(); String p = unItem.getDescription().getItemID()+"\t"+unItem.getDescription().getDescription()+"\t"+unItem.getQuantity()+"\n"; areaProductes.append(p); } } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { LabelAccio = new javax.swing.JLabel(); textIDProducte = new javax.swing.JTextField(); textQuantitat = new javax.swing.JTextField(); LIdProducte = new javax.swing.JLabel(); LQuantitat = new javax.swing.JLabel(); BtnIntroduir = new javax.swing.JButton(); BtnFinalitzar = new javax.swing.JButton(); LIntroduir = new javax.swing.JLabel(); LFinalitzar = new javax.swing.JLabel(); jScrollPane1 = new javax.swing.JScrollPane(); areaProductes = new javax.swing.JTextArea(); LProducts = new javax.swing.JLabel(); LId = new javax.swing.JLabel(); LDesc = new javax.swing.JLabel(); LAmount = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("Introduir productes"); LabelAccio.setText("Introdueix productes que vols comprar:"); LIdProducte.setText("idProducte:"); LQuantitat.setText("Quantitat:"); BtnIntroduir.setText("Introduir"); BtnIntroduir.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { BtnIntroduirActionPerformed(evt); } }); BtnFinalitzar.setText("Finalitzar"); BtnFinalitzar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { BtnFinalitzarActionPerformed(evt); } }); LIntroduir.setText("Utilitza 'Introduir' per agregar un altre producte."); LFinalitzar.setText("Utilitza 'Finalitzar' per passar a fer el pagament."); areaProductes.setColumns(1); areaProductes.setEditable(false); areaProductes.setRows(20); areaProductes.setTabSize(4); jScrollPane1.setViewportView(areaProductes); LProducts.setText("Productes Disponibles:"); LId.setText("id"); LDesc.setText("Descripció"); LAmount.setText("Quantitat"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(layout.createSequentialGroup() .addGap(69, 69, 69) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(LIdProducte) .addComponent(LQuantitat)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(textQuantitat, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(textIDProducte, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(layout.createSequentialGroup() .addGap(37, 37, 37) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(LIntroduir) .addComponent(LabelAccio) .addComponent(LFinalitzar))) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(BtnIntroduir, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(BtnFinalitzar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addGap(42, 42, 42) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(LId) .addGap(18, 18, 18) .addComponent(LDesc) .addGap(18, 18, 18) .addComponent(LAmount)) .addComponent(LProducts, javax.swing.GroupLayout.DEFAULT_SIZE, 196, Short.MAX_VALUE) .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 196, Short.MAX_VALUE)) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(38, 38, 38) .addComponent(LabelAccio) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(LIdProducte) .addComponent(textIDProducte, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(textQuantitat, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(LQuantitat)) .addGap(18, 18, 18) .addComponent(LIntroduir) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(LFinalitzar) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 62, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(BtnFinalitzar) .addComponent(BtnIntroduir))) .addGroup(layout.createSequentialGroup() .addGap(40, 40, 40) .addComponent(LProducts) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(LId) .addComponent(LDesc) .addComponent(LAmount)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 202, Short.MAX_VALUE))) .addContainerGap()) ); pack(); }// </editor-fold>//GEN-END:initComponents private void BtnIntroduirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BtnIntroduirActionPerformed int id=Integer.parseInt(textIDProducte.getText()); int q=Integer.parseInt(textQuantitat.getText()); if((tpv.getStore().getItem(id)==null)) { ErrID eri = new ErrID(this,true); eri.show(); } else if(q>(tpv.getStore().getItem(id).getQuantity())) { ErrQuantitat er=new ErrQuantitat(this,true); er.show(); }else { tpv.introduirProducte(tpv.getStore().getItem(id), q); this.textQuantitat.setText(""); this.textIDProducte.setText(""); } }//GEN-LAST:event_BtnIntroduirActionPerformed private void BtnFinalitzarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BtnFinalitzarActionPerformed tpv.finalitzaVenda(); FinestraPagament f4=new FinestraPagament(tpv); f4.show(); dispose(); setVisible(false); }//GEN-LAST:event_BtnFinalitzarActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new FinestraAfegirProductesATicket().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton BtnFinalitzar; private javax.swing.JButton BtnIntroduir; private javax.swing.JLabel LAmount; private javax.swing.JLabel LDesc; private javax.swing.JLabel LFinalitzar; private javax.swing.JLabel LId; private javax.swing.JLabel LIdProducte; private javax.swing.JLabel LIntroduir; private javax.swing.JLabel LProducts; private javax.swing.JLabel LQuantitat; private javax.swing.JLabel LabelAccio; private javax.swing.JTextArea areaProductes; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JTextField textIDProducte; private javax.swing.JTextField textQuantitat; // End of variables declaration//GEN-END:variables }
11,068
0.617783
0.608295
249
43.445782
34.488316
176
false
false
0
0
0
0
0
0
0.574297
false
false
1
e48c0ddf20424cf5ac84fde5c01162809ac04246
27,822,798,199,572
3fa60d06ea03cd4db2dff228b87fb6ea0c4d50d7
/src/main/java/com/simplyanalytics/hiveapp/udf/CompareTimeStamp.java
fffeb412e160c4d7c8233bce53a29277d6fcf0e9
[]
no_license
sunil-smile/pig_hive_udf_functions
https://github.com/sunil-smile/pig_hive_udf_functions
41f5864b58297d7aea2464ba37539c24b68131b7
19eeb9a908ab678384edf9fc254b55e6a074381a
refs/heads/master
"2020-07-23T05:27:25.882000"
"2017-06-14T16:57:03"
"2017-06-14T16:57:03"
94,352,729
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.simplyanalytics.hiveapp.udf; import java.util.Date; import java.math.BigDecimal; import java.math.BigInteger; import java.text.ParseException; import java.text.SimpleDateFormat; import org.apache.hadoop.hive.ql.exec.UDF; import org.apache.hadoop.hive.ql.exec.Description; @Description(name = "Getting Greater Date",value = "_FUNC_(date1,date2) - if date1 is equal or greater value,it returns true else false.",extended = "Example:\n"+ " > SELECT _FUNC_(date1_string,date2_string) FROM src;\n"+ " > select * from policy_lu_last_extract where lgcy_pol_number ='0192972' and GreaterUHGDate('2014-05-06-12.34.45.562234','2014-05-06-12.34.45.562228');") public class CompareTimeStamp extends UDF{ private SimpleDateFormat df; /*public CompareTimeStamp(){ df = new SimpleDateFormat("yyyy-MM-dd'-'HH.mm.ss"); }*/ public String evaluate(String date1,String date2) { String maxTs=null; try { //Long date1inmills = df.parse(date1.toString().substring(0,date1.toString().lastIndexOf("."))).getTime(); //Long date2inmills = df.parse(date2.toString().substring(0,date2.toString().lastIndexOf("."))).getTime(); //BigDecimal date1value = new BigDecimal(date1inmills+"."+date1.toString().substring(date1.toString().lastIndexOf(".")+1,date1.length())); //BigDecimal date2value = new BigDecimal(date2inmills+"."+date2.toString().substring(date2.toString().lastIndexOf(".")+1,date2.length())); BigInteger date1value = new BigInteger(date1.replaceAll("[^0-9]", "")); BigInteger date2value = new BigInteger(date2.replaceAll("[^0-9]", "")); if(date1value.compareTo(date2value)>0){ maxTs=date1; }else if(date1value.compareTo(date2value)==0){ maxTs=date1; }else{ maxTs=date2; } }catch(Exception ex) { maxTs="incorrect TS"; } return maxTs; } }//end class
UTF-8
Java
1,821
java
CompareTimeStamp.java
Java
[]
null
[]
package com.simplyanalytics.hiveapp.udf; import java.util.Date; import java.math.BigDecimal; import java.math.BigInteger; import java.text.ParseException; import java.text.SimpleDateFormat; import org.apache.hadoop.hive.ql.exec.UDF; import org.apache.hadoop.hive.ql.exec.Description; @Description(name = "Getting Greater Date",value = "_FUNC_(date1,date2) - if date1 is equal or greater value,it returns true else false.",extended = "Example:\n"+ " > SELECT _FUNC_(date1_string,date2_string) FROM src;\n"+ " > select * from policy_lu_last_extract where lgcy_pol_number ='0192972' and GreaterUHGDate('2014-05-06-12.34.45.562234','2014-05-06-12.34.45.562228');") public class CompareTimeStamp extends UDF{ private SimpleDateFormat df; /*public CompareTimeStamp(){ df = new SimpleDateFormat("yyyy-MM-dd'-'HH.mm.ss"); }*/ public String evaluate(String date1,String date2) { String maxTs=null; try { //Long date1inmills = df.parse(date1.toString().substring(0,date1.toString().lastIndexOf("."))).getTime(); //Long date2inmills = df.parse(date2.toString().substring(0,date2.toString().lastIndexOf("."))).getTime(); //BigDecimal date1value = new BigDecimal(date1inmills+"."+date1.toString().substring(date1.toString().lastIndexOf(".")+1,date1.length())); //BigDecimal date2value = new BigDecimal(date2inmills+"."+date2.toString().substring(date2.toString().lastIndexOf(".")+1,date2.length())); BigInteger date1value = new BigInteger(date1.replaceAll("[^0-9]", "")); BigInteger date2value = new BigInteger(date2.replaceAll("[^0-9]", "")); if(date1value.compareTo(date2value)>0){ maxTs=date1; }else if(date1value.compareTo(date2value)==0){ maxTs=date1; }else{ maxTs=date2; } }catch(Exception ex) { maxTs="incorrect TS"; } return maxTs; } }//end class
1,821
0.711697
0.661724
51
34.705883
59.167854
376
false
false
0
0
0
0
0
0
2.039216
false
false
1
82de06495597fe644163b1681e9bc4e4b46f25c4
31,568,009,679,913
caa8e446afedc590c4bd2a6bc442fa036a018801
/src/databaseManagement/DatabaseManager.java
d5b679cb73b152dafb034a927f5607bfdd79ea9a
[]
no_license
niloynils7/restaurantManagement
https://github.com/niloynils7/restaurantManagement
64417abe74671a6358ff5a0590848e3b61a0642a
5f2bf5f41acc9fd30c3b13a5ee6753867dd0e469
refs/heads/master
"2020-08-12T05:46:28.738000"
"2019-10-14T01:50:09"
"2019-10-14T01:50:09"
214,700,332
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package databaseManagement; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; public class DatabaseManager { public static String user ="root"; public static String pass ="niloynils7"; public static Connection GetConnection() throws SQLException { Connection connection = null; try { //Class.forName("com.mysql.cj.jdbc.Driver"); connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/onlinefood", user, pass); System.out.println("DataBase connected"); } catch (Exception e) { System.out.println("database ashe na "); // } return connection; } }
UTF-8
Java
727
java
DatabaseManager.java
Java
[ { "context": "ing user =\"root\";\n public static String pass =\"niloynils7\";\n\n\n public static Connection GetConnection() ", "end": 231, "score": 0.9986303448677063, "start": 221, "tag": "PASSWORD", "value": "niloynils7" } ]
null
[]
package databaseManagement; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; public class DatabaseManager { public static String user ="root"; public static String pass ="<PASSWORD>"; public static Connection GetConnection() throws SQLException { Connection connection = null; try { //Class.forName("com.mysql.cj.jdbc.Driver"); connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/onlinefood", user, pass); System.out.println("DataBase connected"); } catch (Exception e) { System.out.println("database ashe na "); // } return connection; } }
727
0.639615
0.632737
25
28.08
25.027857
107
false
false
0
0
0
0
0
0
0.56
false
false
1
7ac4d2abbc1b2d8f2dd883c1da35daa15a2ff5a3
14,164,802,205,718
89e729fe94d9b896636077997d0d38fec4da3979
/src/lesson3/B15_avarage.java
34cec1560be4bd4b9b2b6adb3839a533bbcd3b72
[]
no_license
kademika/jd-aug14-ingvarr-semeon
https://github.com/kademika/jd-aug14-ingvarr-semeon
6a9057f7acfdfc8aa96f580eee477f5a407936d5
82605853e9ae3aa085b0f1b91be6f5e386643510
refs/heads/master
"2016-09-06T18:05:32.719000"
"2015-06-21T15:47:15"
"2015-06-21T15:47:15"
23,434,751
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package lesson3; public class B15_avarage { public static void main(String[] args) { int[] data1 = { 1, 2, 3, 4, 5, 6, 7 }; int[] data2 = { 5, 4, 3, 2, 1, 0 }; int[] data3 = { 0 }; int[] data4 = { 9, -9, 9 }; int[] data5 = { -7, -8, -9, -11, -12 }; System.out.println(avarage(data1)); System.out.println(avarage(data2)); System.out.println(avarage(data3)); System.out.println(avarage(data4)); System.out.println(avarage(data5)); System.out.println(avarage(null)); System.out.println(avarage(new int[0])); } static double avarage(int[] data) { if (data != null && data.length > 0) { double sum = 0; for (int i : data) { sum += i; } return sum / data.length; } return -1; } }
UTF-8
Java
765
java
B15_avarage.java
Java
[]
null
[]
package lesson3; public class B15_avarage { public static void main(String[] args) { int[] data1 = { 1, 2, 3, 4, 5, 6, 7 }; int[] data2 = { 5, 4, 3, 2, 1, 0 }; int[] data3 = { 0 }; int[] data4 = { 9, -9, 9 }; int[] data5 = { -7, -8, -9, -11, -12 }; System.out.println(avarage(data1)); System.out.println(avarage(data2)); System.out.println(avarage(data3)); System.out.println(avarage(data4)); System.out.println(avarage(data5)); System.out.println(avarage(null)); System.out.println(avarage(new int[0])); } static double avarage(int[] data) { if (data != null && data.length > 0) { double sum = 0; for (int i : data) { sum += i; } return sum / data.length; } return -1; } }
765
0.554248
0.500654
34
20.5
16.345984
42
false
false
0
0
0
0
0
0
2.470588
false
false
1
9189fe5ff258600ffa76e44e788a386686487b64
18,897,856,166,586
072216667ef59e11cf4994220ea1594538db10a0
/xiaomi/yellowpages/com/miui/yellowpage/activity/U.java
216b60b60605d385efc7d9385f5a306fb7426605
[]
no_license
jackTang11/REMIUI
https://github.com/jackTang11/REMIUI
896037b74e90f64e6f7d8ddfda6f3731a8db6a74
48d65600a1b04931a510e1f036e58356af1531c0
refs/heads/master
"2021-01-18T05:43:37.754000"
"2015-07-03T04:01:06"
"2015-07-03T04:01:06"
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.miui.yellowpage.activity; import com.miui.yellowpage.base.utils.Sim; import com.miui.yellowpage.utils.C; /* compiled from: BalanceInquiryRoutingActivity */ class U implements C { final /* synthetic */ BalanceInquiryRoutingActivity uH; U(BalanceInquiryRoutingActivity balanceInquiryRoutingActivity) { this.uH = balanceInquiryRoutingActivity; } public void v(int i) { this.uH.b(i, Sim.getSimOpCode(this.uH, i)); this.uH.finish(); } public void onCancel() { this.uH.finish(); } }
UTF-8
Java
554
java
U.java
Java
[]
null
[]
package com.miui.yellowpage.activity; import com.miui.yellowpage.base.utils.Sim; import com.miui.yellowpage.utils.C; /* compiled from: BalanceInquiryRoutingActivity */ class U implements C { final /* synthetic */ BalanceInquiryRoutingActivity uH; U(BalanceInquiryRoutingActivity balanceInquiryRoutingActivity) { this.uH = balanceInquiryRoutingActivity; } public void v(int i) { this.uH.b(i, Sim.getSimOpCode(this.uH, i)); this.uH.finish(); } public void onCancel() { this.uH.finish(); } }
554
0.685921
0.685921
22
24.181818
21.609417
68
false
false
0
0
0
0
0
0
0.454545
false
false
1
d3c2852a209ff906fcd5d2d4b581bc02acabe2e1
14,731,737,825,327
7531cfbf5669a6db6ec7395595cc86bd99262da6
/app/src/main/java/com/ryougifujino/netreader/reader/NetworkRetryEvent.java
12e3453ceaaa85e6419efd9c58474f3d677ef982
[]
no_license
mhsj6621/NetReader
https://github.com/mhsj6621/NetReader
86f3a1b2ccd294d843eeb3439cfde3044b3e9c1f
0f155b2f43c144787ca4e1355f8b9ed22a8a3c71
refs/heads/master
"2018-07-03T04:25:54.712000"
"2018-06-28T01:58:17"
"2018-06-28T01:58:17"
127,942,480
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ryougifujino.netreader.reader; import com.ryougifujino.netreader.data.Chapter; /** * Created by ZH on 2018/05/04. */ public class NetworkRetryEvent { private Chapter chapter; public NetworkRetryEvent(Chapter chapter) { this.chapter = chapter; } public Chapter getChapter() { return chapter; } public void setChapter(Chapter chapter) { this.chapter = chapter; } }
UTF-8
Java
436
java
NetworkRetryEvent.java
Java
[ { "context": "ifujino.netreader.data.Chapter;\n\n/**\n * Created by ZH on 2018/05/04.\n */\npublic class NetworkRetryEvent", "end": 113, "score": 0.9984233379364014, "start": 111, "tag": "USERNAME", "value": "ZH" } ]
null
[]
package com.ryougifujino.netreader.reader; import com.ryougifujino.netreader.data.Chapter; /** * Created by ZH on 2018/05/04. */ public class NetworkRetryEvent { private Chapter chapter; public NetworkRetryEvent(Chapter chapter) { this.chapter = chapter; } public Chapter getChapter() { return chapter; } public void setChapter(Chapter chapter) { this.chapter = chapter; } }
436
0.667431
0.649083
24
17.166666
17.721613
47
false
false
0
0
0
0
0
0
0.25
false
false
1
c555281fe0f4c6b79a6a5d05307f2923b13fa997
32,547,262,169,338
1dd3cb4fabd639b6fcf1164cf966144308f114ed
/src/main/java/ws/overhead/descipar/ArtifactResolver.java
275fcd5b5ba6c0677c9e8719419c0c17285ec1ea
[]
no_license
descipar/wildfly-deployment
https://github.com/descipar/wildfly-deployment
4cbde0ab4b301c0b7d7dab839b1aef763240a657
cb6c40ce96ee8809f648b8b67356bf0d46c58814
refs/heads/master
"2021-01-10T11:58:51.150000"
"2016-03-10T18:09:22"
"2016-03-10T18:09:22"
52,474,114
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ws.overhead.descipar; import org.apache.maven.settings.Settings; import org.apache.maven.settings.building.SettingsBuilder; import org.eclipse.aether.RepositorySystem; import org.eclipse.aether.repository.Proxy; import org.eclipse.aether.repository.RemoteRepository; public class ArtifactResolver { private Options options; public ArtifactResolver(Options options) { this.options = options; } void connectRepository() { //RepositorySystem repositorySystem = new RemoteRepository.Builder() } }
UTF-8
Java
529
java
ArtifactResolver.java
Java
[]
null
[]
package ws.overhead.descipar; import org.apache.maven.settings.Settings; import org.apache.maven.settings.building.SettingsBuilder; import org.eclipse.aether.RepositorySystem; import org.eclipse.aether.repository.Proxy; import org.eclipse.aether.repository.RemoteRepository; public class ArtifactResolver { private Options options; public ArtifactResolver(Options options) { this.options = options; } void connectRepository() { //RepositorySystem repositorySystem = new RemoteRepository.Builder() } }
529
0.786389
0.786389
25
20.16
22.548933
72
false
false
0
0
0
0
0
0
0.32
false
false
1
b41a39a0f323d4174141fe7b23b60ccdc58b9b05
3,324,304,742,373
0881c60fcce9e79c7e377a4bf46653ef559ef6a5
/javaSE基础/8.io/PrintStream/SetOut.java
4a71131060f88928cccd858766cb65dc2d6b888f
[]
no_license
starrQWQ/java_code
https://github.com/starrQWQ/java_code
9e880b4027f634261a6f9ff5974ecd849f61432a
5e9630ab0decfe67a758d94b3d7d832cc509f848
refs/heads/master
"2020-04-01T17:55:27.520000"
"2019-02-27T07:43:20"
"2019-02-27T07:43:20"
153,459,400
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.io.*; import java.util.*; import java.text.*; public class SetOut{ public static void main(String[] args){ try{ System.setOut(new PrintStream(new FileOutputStream("log"))); //System.out.println("fjaslkfjs;j"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss SSS"); System.out.println("m1() begin:"+sdf.format(new Date())); m1(); System.out.println("m1() finish:"+sdf.format(new Date())); }catch(FileNotFoundException e){ e.printStackTrace(); } } public static void m1(){ System.out.println("m1() executes."); } }
UTF-8
Java
579
java
SetOut.java
Java
[]
null
[]
import java.io.*; import java.util.*; import java.text.*; public class SetOut{ public static void main(String[] args){ try{ System.setOut(new PrintStream(new FileOutputStream("log"))); //System.out.println("fjaslkfjs;j"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss SSS"); System.out.println("m1() begin:"+sdf.format(new Date())); m1(); System.out.println("m1() finish:"+sdf.format(new Date())); }catch(FileNotFoundException e){ e.printStackTrace(); } } public static void m1(){ System.out.println("m1() executes."); } }
579
0.668394
0.659758
23
24.217392
22.613878
74
false
false
0
0
0
0
0
0
2.043478
false
false
1
38c5d6666c3dd52b05f03240d99e4cd8726b6129
4,982,162,121,161
cbe5361e3430f01c8506b662f0628cab4693f250
/service/src/main/java/com/accela/service/epayments/package-info.java
423535a0b2abce9354d2b760cfae00a03c5f6cab
[]
no_license
bys-james-jiang/accela-core
https://github.com/bys-james-jiang/accela-core
ce26626c6663e36daa486e8f2bd9f1e9168dccd3
699db01dbb06d8f5888b3d1f619cec9ac94e800f
refs/heads/master
"2016-08-04T22:29:52.911000"
"2014-12-02T09:30:01"
"2014-12-02T09:30:01"
27,418,959
1
1
null
null
null
null
null
null
null
null
null
null
null
null
null
@javax.xml.bind.annotation.XmlSchema(namespace = "http://epayments.service.accela.com", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) package com.accela.service.epayments; /** * <pre> * * Accela Automation * File: package-info.java * * Accela, Inc. * Copyright (C): 2009 * * Description: * TODO * * Notes: * $Id: package-info.java 132969 2009-06-02 02:26:34Z ACHIEVO\jack.su $ * * Revision History * &lt;Date&gt;, &lt;Who&gt;, &lt;What&gt; * May 6, 2009 james.jiang Initial. * * </pre> */ /* *$Log: av-env.bat,v $ */
UTF-8
Java
614
java
package-info.java
Java
[ { "context": ",\t\t&lt;Who&gt;,\t\t\t&lt;What&gt;\r\n * May 6, 2009\t\t\tjames.jiang\t\t\t\tInitial.\r\n * \r\n * </pre>\r\n */\r\n/*\r\n *$Log: av", "end": 547, "score": 0.9993941187858582, "start": 536, "tag": "NAME", "value": "james.jiang" } ]
null
[]
@javax.xml.bind.annotation.XmlSchema(namespace = "http://epayments.service.accela.com", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) package com.accela.service.epayments; /** * <pre> * * Accela Automation * File: package-info.java * * Accela, Inc. * Copyright (C): 2009 * * Description: * TODO * * Notes: * $Id: package-info.java 132969 2009-06-02 02:26:34Z ACHIEVO\jack.su $ * * Revision History * &lt;Date&gt;, &lt;Who&gt;, &lt;What&gt; * May 6, 2009 james.jiang Initial. * * </pre> */ /* *$Log: av-env.bat,v $ */
614
0.600977
0.553746
27
20.814816
31.220882
155
false
false
0
0
0
0
0
0
0.962963
false
false
1
bcd92616709f1aa8c0eaf067c1320ec64b4d4dcc
31,731,218,447,635
863acb02a064a0fc66811688a67ce3511f1b81af
/sources/p320f/p321a/p327d/p332e/p334b/C13532ha.java
2eb5c551197279e9d4f52a8b555f104cf9a08292
[ "MIT" ]
permissive
Game-Designing/Custom-Football-Game
https://github.com/Game-Designing/Custom-Football-Game
98d33eb0c04ca2c48620aa4a763b91bc9c1b7915
47283462b2066ad5c53b3c901182e7ae62a34fc8
refs/heads/master
"2020-08-04T00:02:04.876000"
"2019-10-06T06:55:08"
"2019-10-06T06:55:08"
211,914,568
1
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package p320f.p321a.p327d.p332e.p334b; import p320f.p321a.C13773g; import p320f.p321a.C13797m; import p320f.p321a.C13804t; import p320f.p321a.p325b.C13194b; import p320f.p321a.p327d.p339i.C13737b; import p363i.p368b.C14228a; import p363i.p368b.C14230c; /* renamed from: f.a.d.e.b.ha */ /* compiled from: ObservableFromPublisher */ public final class C13532ha<T> extends C13797m<T> { /* renamed from: a */ final C14228a<? extends T> f41153a; /* renamed from: f.a.d.e.b.ha$a */ /* compiled from: ObservableFromPublisher */ static final class C13533a<T> implements C13773g<T>, C13194b { /* renamed from: a */ final C13804t<? super T> f41154a; /* renamed from: b */ C14230c f41155b; C13533a(C13804t<? super T> o) { this.f41154a = o; } public void onComplete() { this.f41154a.onComplete(); } public void onError(Throwable t) { this.f41154a.onError(t); } public void onNext(T t) { this.f41154a.onNext(t); } /* renamed from: a */ public void mo42355a(C14230c s) { if (C13737b.m43736a(this.f41155b, s)) { this.f41155b = s; this.f41154a.onSubscribe(this); s.request(Long.MAX_VALUE); } } public void dispose() { this.f41155b.cancel(); this.f41155b = C13737b.CANCELLED; } } public C13532ha(C14228a<? extends T> publisher) { this.f41153a = publisher; } /* access modifiers changed from: protected */ public void subscribeActual(C13804t<? super T> o) { this.f41153a.mo42781a(new C13533a(o)); } }
UTF-8
Java
1,737
java
C13532ha.java
Java
[]
null
[]
package p320f.p321a.p327d.p332e.p334b; import p320f.p321a.C13773g; import p320f.p321a.C13797m; import p320f.p321a.C13804t; import p320f.p321a.p325b.C13194b; import p320f.p321a.p327d.p339i.C13737b; import p363i.p368b.C14228a; import p363i.p368b.C14230c; /* renamed from: f.a.d.e.b.ha */ /* compiled from: ObservableFromPublisher */ public final class C13532ha<T> extends C13797m<T> { /* renamed from: a */ final C14228a<? extends T> f41153a; /* renamed from: f.a.d.e.b.ha$a */ /* compiled from: ObservableFromPublisher */ static final class C13533a<T> implements C13773g<T>, C13194b { /* renamed from: a */ final C13804t<? super T> f41154a; /* renamed from: b */ C14230c f41155b; C13533a(C13804t<? super T> o) { this.f41154a = o; } public void onComplete() { this.f41154a.onComplete(); } public void onError(Throwable t) { this.f41154a.onError(t); } public void onNext(T t) { this.f41154a.onNext(t); } /* renamed from: a */ public void mo42355a(C14230c s) { if (C13737b.m43736a(this.f41155b, s)) { this.f41155b = s; this.f41154a.onSubscribe(this); s.request(Long.MAX_VALUE); } } public void dispose() { this.f41155b.cancel(); this.f41155b = C13737b.CANCELLED; } } public C13532ha(C14228a<? extends T> publisher) { this.f41153a = publisher; } /* access modifiers changed from: protected */ public void subscribeActual(C13804t<? super T> o) { this.f41153a.mo42781a(new C13533a(o)); } }
1,737
0.580887
0.42487
67
24.925373
18.429626
66
false
false
0
0
0
0
0
0
0.358209
false
false
1
ec87d549c5b15c99bde790c3a742534287bad920
24,498,493,484,283
c5b1367595819bd2f1dce099340dc45a91a7c79c
/src/test/java/com/glqdlt/ex/patterns/memento/TextEditorTest.java
b340c0f7161d72cf92e1453c778aae8a9d4a5a39
[]
no_license
glqdlt/patterns
https://github.com/glqdlt/patterns
13c541329fa5fb27e59a1ebfd574b4a04f98781e
b4472b33360625fc11328c87a2796eb66d0e09fd
refs/heads/master
"2023-03-16T23:11:45.795000"
"2021-02-24T00:16:54"
"2021-02-24T00:16:54"
340,925,454
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.glqdlt.ex.patterns.memento; import org.junit.Assert; import org.junit.Test; public class TextEditorTest { @Test public void restore() { DefaultTypingWindow defaultTypingWindow = new DefaultTypingWindow(); TextEditor textEditor = new TextEditor(defaultTypingWindow); defaultTypingWindow.typing("red", "1"); textEditor.echo(); textEditor.save(); defaultTypingWindow.typing("green", "2"); textEditor.echo(); textEditor.save(); defaultTypingWindow.typing("blue", "3"); textEditor.echo(); textEditor.restore(); textEditor.echo(); textEditor.restore(); textEditor.echo(); Assert.assertEquals("[red]1", defaultTypingWindow.print()); } }
UTF-8
Java
783
java
TextEditorTest.java
Java
[]
null
[]
package com.glqdlt.ex.patterns.memento; import org.junit.Assert; import org.junit.Test; public class TextEditorTest { @Test public void restore() { DefaultTypingWindow defaultTypingWindow = new DefaultTypingWindow(); TextEditor textEditor = new TextEditor(defaultTypingWindow); defaultTypingWindow.typing("red", "1"); textEditor.echo(); textEditor.save(); defaultTypingWindow.typing("green", "2"); textEditor.echo(); textEditor.save(); defaultTypingWindow.typing("blue", "3"); textEditor.echo(); textEditor.restore(); textEditor.echo(); textEditor.restore(); textEditor.echo(); Assert.assertEquals("[red]1", defaultTypingWindow.print()); } }
783
0.634738
0.62963
33
22.757576
21.591286
76
false
false
0
0
0
0
0
0
0.666667
false
false
5
989a03bc5f4e6439b182c4335e8fbc59665a95e3
17,489,106,846,173
3a09973258469aba0dd232f29c4e2d757093ec1c
/CHAPTER_4/CreditLimitCalculator.java
d94e6515be9ded7d63c1f55b32516b8ddae892be
[]
no_license
Toyin96/JavaHow
https://github.com/Toyin96/JavaHow
91a8e514f269d967a2d21b40c9fa3e4794c99642
0be127a4e16dddaa6c33e8fcec0398fd6ba5a517
refs/heads/main
"2023-03-09T07:44:29.568000"
"2021-02-25T12:23:16"
"2021-02-25T12:23:16"
318,863,039
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class CreditLimitCalculator { private String accountNumber; private int beginningBalance; private int totalItemsChargedThisMonth; private int totalCreditsAppliedToAccountThisMonth; private int creditLimit; public String getAccountNumber() { return accountNumber; } public void setAccountNumber(String accountNumber) { this.accountNumber = accountNumber; } public int getBeginningBalance() { return beginningBalance; } public void setBeginningBalance(int beginningBalance) { this.beginningBalance = beginningBalance; } public int getTotalItemsChargedThisMonth() { return totalItemsChargedThisMonth; } public void setTotalItemsChargedThisMonth(int totalItemsChargedThisMonth) { this.totalItemsChargedThisMonth = totalItemsChargedThisMonth; } public int getTotalCreditsAppliedToAccountThisMonth() { return totalCreditsAppliedToAccountThisMonth; } public void setTotalCreditsAppliedToAccountThisMonth(int totalCreditsAppliedToAccountThisMonth) { this.totalCreditsAppliedToAccountThisMonth = totalCreditsAppliedToAccountThisMonth; } public int getCreditLimit() { return creditLimit; } public void setCreditLimit(int creditLimit) { this.creditLimit = creditLimit; } public int newBalance() { int newBalance = beginningBalance + totalItemsChargedThisMonth - totalCreditsAppliedToAccountThisMonth; if (newBalance > creditLimit) { System.out.println("Credit limit exceeded"); } return newBalance; } }
UTF-8
Java
1,647
java
CreditLimitCalculator.java
Java
[]
null
[]
public class CreditLimitCalculator { private String accountNumber; private int beginningBalance; private int totalItemsChargedThisMonth; private int totalCreditsAppliedToAccountThisMonth; private int creditLimit; public String getAccountNumber() { return accountNumber; } public void setAccountNumber(String accountNumber) { this.accountNumber = accountNumber; } public int getBeginningBalance() { return beginningBalance; } public void setBeginningBalance(int beginningBalance) { this.beginningBalance = beginningBalance; } public int getTotalItemsChargedThisMonth() { return totalItemsChargedThisMonth; } public void setTotalItemsChargedThisMonth(int totalItemsChargedThisMonth) { this.totalItemsChargedThisMonth = totalItemsChargedThisMonth; } public int getTotalCreditsAppliedToAccountThisMonth() { return totalCreditsAppliedToAccountThisMonth; } public void setTotalCreditsAppliedToAccountThisMonth(int totalCreditsAppliedToAccountThisMonth) { this.totalCreditsAppliedToAccountThisMonth = totalCreditsAppliedToAccountThisMonth; } public int getCreditLimit() { return creditLimit; } public void setCreditLimit(int creditLimit) { this.creditLimit = creditLimit; } public int newBalance() { int newBalance = beginningBalance + totalItemsChargedThisMonth - totalCreditsAppliedToAccountThisMonth; if (newBalance > creditLimit) { System.out.println("Credit limit exceeded"); } return newBalance; } }
1,647
0.720704
0.720704
60
26.450001
28.018105
111
false
false
0
0
0
0
0
0
0.3
false
false
5
9042d663fcc290f9a01d73dcc83e36edc87f0a52
5,016,521,852,821
e2e1afc468f4a5792ae28cc34b97d51e1ec93e19
/src/au/com/mineauz/PlayerSpy/wrappers/packet/Packet62NamedSoundEffect.java
db2b00a1142aef95548390bf8aecb43483dde3de
[]
no_license
Schmoller/PlayerSpy
https://github.com/Schmoller/PlayerSpy
edbb671176fabdaacf3131e956edeb88f4b13bc7
01ef9d547fd6d55976589030fc4b573b6f461e30
refs/heads/master
"2021-01-18T23:08:03.233000"
"2013-08-11T00:46:22"
"2013-08-11T00:46:22"
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package au.com.mineauz.PlayerSpy.wrappers.packet; import java.lang.reflect.Constructor; import au.com.mineauz.PlayerSpy.wrappers.WrapperClass; import au.com.mineauz.PlayerSpy.wrappers.WrapperConstructor; @WrapperClass("net.minecraft.server.*.Packet62NamedSoundEffect") public class Packet62NamedSoundEffect extends Packet { static { initialize(Packet62NamedSoundEffect.class); } Packet62NamedSoundEffect() {} @WrapperConstructor({String.class, Double.class, Double.class, Double.class, Float.class, Float.class}) private static Constructor<?> mConstructor; public Packet62NamedSoundEffect(String name, double x, double y, double z, float volume, float pitch) { super(); instanciate(mConstructor, name, x, y, z, volume, pitch); } }
UTF-8
Java
757
java
Packet62NamedSoundEffect.java
Java
[]
null
[]
package au.com.mineauz.PlayerSpy.wrappers.packet; import java.lang.reflect.Constructor; import au.com.mineauz.PlayerSpy.wrappers.WrapperClass; import au.com.mineauz.PlayerSpy.wrappers.WrapperConstructor; @WrapperClass("net.minecraft.server.*.Packet62NamedSoundEffect") public class Packet62NamedSoundEffect extends Packet { static { initialize(Packet62NamedSoundEffect.class); } Packet62NamedSoundEffect() {} @WrapperConstructor({String.class, Double.class, Double.class, Double.class, Float.class, Float.class}) private static Constructor<?> mConstructor; public Packet62NamedSoundEffect(String name, double x, double y, double z, float volume, float pitch) { super(); instanciate(mConstructor, name, x, y, z, volume, pitch); } }
757
0.780713
0.767503
27
27.037037
31.602253
104
false
false
0
0
0
0
0
0
1.592593
false
false
5
f86a45680c855fb9a2a93a169d73b45010ffcf37
11,673,721,133,994
50786e089d931c422b9a82d3aa6f49e65579d10b
/src/main/java/com/example/N11_ShopDoGiaDung/configure/DataSeedingListener.java
54db0d077597be39a5bdfca25a94d6c3b42b6c68
[]
no_license
PhamXuanVu/BTL_WWW_Nhom11
https://github.com/PhamXuanVu/BTL_WWW_Nhom11
f6a1658f0071dd079355493a9f4292a12d3db099
5aa93cf06bca8cfbac22dfd5440d57a27d9bf516
refs/heads/master
"2023-04-20T03:05:21.469000"
"2021-05-15T15:44:03"
"2021-05-15T15:44:03"
367,125,077
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.N11_ShopDoGiaDung.configure; import java.util.HashSet; import java.util.Set; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationListener; import org.springframework.context.event.ContextRefreshedEvent; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Component; import com.example.N11_ShopDoGiaDung.entity.Role; import com.example.N11_ShopDoGiaDung.entity.User; import com.example.N11_ShopDoGiaDung.repository.RoleRepository; import com.example.N11_ShopDoGiaDung.repository.UserRepository; @Component public class DataSeedingListener implements ApplicationListener<ContextRefreshedEvent> { @Autowired private UserRepository userRepository; @Autowired private RoleRepository roleRepository; @Autowired private PasswordEncoder passwordEncoder; @Override public void onApplicationEvent(ContextRefreshedEvent event) { // TODO Auto-generated method stub System.out.println("hello world"); if (roleRepository.findByName("ROLE_ADMIN") == null) { Role role = new Role(); role.setName("ROLE_ADMIN"); } if (roleRepository.findByName("ROLE_MEMBER") == null) { Role role = new Role(); role.setName("ROLE_MEMBER"); } if (userRepository.findByEmail("admin@gmail.com") == null) { User user = new User(); user.setEmail("admin@gmail.com"); user.setPassword(passwordEncoder.encode("123456")); Set<Role> roles = new HashSet<Role>(); roles.add(roleRepository.findByName("ROLE_ADMIN")); user.setRoles(roles); userRepository.save(user); } if (userRepository.findByEmail("member@gmail.com") == null) { User user = new User(); user.setEmail("member@gmail.com"); user.setPassword(passwordEncoder.encode("123456")); Set<Role> roles = new HashSet<Role>(); roles.add(roleRepository.findByName("ROLE_MEMBER")); user.setRoles(roles); userRepository.save(user); } } }
UTF-8
Java
1,997
java
DataSeedingListener.java
Java
[ { "context": "EMBER\");\n\t\t}\n\t\t\n\t\tif (userRepository.findByEmail(\"admin@gmail.com\") == null) {\n\t\t\tUser user = new User();\n\t\t\tuser.s", "end": 1347, "score": 0.9999308586120605, "start": 1332, "tag": "EMAIL", "value": "admin@gmail.com" }, { "context": "l) {\n\t\t\tUser user = new User();\n\t\t\tuser.setEmail(\"admin@gmail.com\");\n\t\t\tuser.setPassword(passwordEncoder.encode(\"12", "end": 1421, "score": 0.9999315142631531, "start": 1406, "tag": "EMAIL", "value": "admin@gmail.com" }, { "context": "om\");\n\t\t\tuser.setPassword(passwordEncoder.encode(\"123456\"));\n\t\t\tSet<Role> roles = new HashSet<Role>();\n\t\t\t", "end": 1475, "score": 0.999344527721405, "start": 1469, "tag": "PASSWORD", "value": "123456" }, { "context": "e(user);\n\t\t}\n\t\t\n\t\tif (userRepository.findByEmail(\"member@gmail.com\") == null) {\n\t\t\tUser user = new User();\n\t\t\tuser.s", "end": 1693, "score": 0.9999294281005859, "start": 1677, "tag": "EMAIL", "value": "member@gmail.com" }, { "context": "l) {\n\t\t\tUser user = new User();\n\t\t\tuser.setEmail(\"member@gmail.com\");\n\t\t\tuser.setPassword(passwordEncoder.encode(\"12", "end": 1768, "score": 0.9999303817749023, "start": 1752, "tag": "EMAIL", "value": "member@gmail.com" }, { "context": "om\");\n\t\t\tuser.setPassword(passwordEncoder.encode(\"123456\"));\n\t\t\tSet<Role> roles = new HashSet<Role>();\n\t\t\t", "end": 1822, "score": 0.9993911385536194, "start": 1816, "tag": "PASSWORD", "value": "123456" } ]
null
[]
package com.example.N11_ShopDoGiaDung.configure; import java.util.HashSet; import java.util.Set; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationListener; import org.springframework.context.event.ContextRefreshedEvent; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Component; import com.example.N11_ShopDoGiaDung.entity.Role; import com.example.N11_ShopDoGiaDung.entity.User; import com.example.N11_ShopDoGiaDung.repository.RoleRepository; import com.example.N11_ShopDoGiaDung.repository.UserRepository; @Component public class DataSeedingListener implements ApplicationListener<ContextRefreshedEvent> { @Autowired private UserRepository userRepository; @Autowired private RoleRepository roleRepository; @Autowired private PasswordEncoder passwordEncoder; @Override public void onApplicationEvent(ContextRefreshedEvent event) { // TODO Auto-generated method stub System.out.println("hello world"); if (roleRepository.findByName("ROLE_ADMIN") == null) { Role role = new Role(); role.setName("ROLE_ADMIN"); } if (roleRepository.findByName("ROLE_MEMBER") == null) { Role role = new Role(); role.setName("ROLE_MEMBER"); } if (userRepository.findByEmail("<EMAIL>") == null) { User user = new User(); user.setEmail("<EMAIL>"); user.setPassword(passwordEncoder.encode("<PASSWORD>")); Set<Role> roles = new HashSet<Role>(); roles.add(roleRepository.findByName("ROLE_ADMIN")); user.setRoles(roles); userRepository.save(user); } if (userRepository.findByEmail("<EMAIL>") == null) { User user = new User(); user.setEmail("<EMAIL>"); user.setPassword(passwordEncoder.encode("<PASSWORD>")); Set<Role> roles = new HashSet<Role>(); roles.add(roleRepository.findByName("ROLE_MEMBER")); user.setRoles(roles); userRepository.save(user); } } }
1,971
0.749624
0.738608
69
27.942028
23.837543
88
false
false
0
0
0
0
0
0
1.985507
false
false
5
6e3f81c2622915058b0637eed6dc4768f137fd5f
15,212,774,183,823
cfb27ec445cd60c60f2564a49243e8866b54d27f
/src/main/java/com/epam/izh/rd/online/service/SimpleTextService.java
79b39b9eb12c40eccbcb0c4bbc021515f73e8580
[]
no_license
m0rfox/java-data-handling-template
https://github.com/m0rfox/java-data-handling-template
f9052493cb4bc22b49bbf3dbcaede940fb41502e
78e6bbdb064fbac28d91066547772f1479c6fd69
refs/heads/master
"2023-06-07T01:41:22.306000"
"2021-06-28T16:54:24"
"2021-06-28T16:54:24"
371,446,981
0
0
null
true
"2021-05-27T17:03:30"
"2021-05-27T17:03:29"
"2021-05-27T17:03:30"
"2021-05-27T08:22:23"
24
0
0
0
null
false
false
package com.epam.izh.rd.online.service; import java.util.Locale; public class SimpleTextService implements TextService { /** * Реализовать функционал удаления строки из другой строки. * * Например для базовой строки "Hello, hello, hello, how low?" и строки для удаления ", he" * метод вернет "Hellollollo, how low?" * * @param base - базовая строка с текстом * @param remove - строка которую необходимо удалить */ @Override public String removeString(String base, String remove) { return base.replaceAll(remove, ""); } /** * Реализовать функционал проверки на то, что строка заканчивается знаком вопроса. * * Например для строки "Hello, hello, hello, how low?" метод вернет true * Например для строки "Hello, hello, hello!" метод вернет false */ @Override public boolean isQuestionString(String text) { return text.endsWith("?"); } /** * Реализовать функционал соединения переданных строк. * * Например для параметров {"Smells", " ", "Like", " ", "Teen", " ", "Spirit"} * метод вернет "Smells Like Teen Spirit" */ @Override public String concatenate(String... elements) { StringBuilder string = new StringBuilder(); for (String element : elements) { string.append(element); } return string.toString(); } /** * Реализовать функционал изменения регистра в вид лесенки. * Возвращаемый текст должен начинаться с прописного регистра. * * Например для строки "Load Up On Guns And Bring Your Friends" * метод вернет "lOaD Up oN GuNs aNd bRiNg yOuR FrIeNdS". */ @Override public String toJumpCase(String text) { char[] chars = text.toCharArray(); for (int i = 0; i < chars.length; i++) { if (i % 2 == 0) { chars[i] = Character.toLowerCase(chars[i]); } else { chars[i] = Character.toUpperCase(chars[i]); } } return String.valueOf(chars); } /** * Метод определяет, является ли строка палиндромом. * * Палиндром - строка, которая одинаково читается слева направо и справа налево. * * Например для строки "а роза упала на лапу Азора" вернется true, а для "я не палиндром" false */ @Override public boolean isPalindrome(String string) { StringBuilder stringBuilder = new StringBuilder(string); String str1 = stringBuilder.reverse().toString(); if (string.equals("")){ return false; }else return string.replaceAll("\\s+", "").toLowerCase(Locale.ROOT).equals(str1.toLowerCase(Locale.ROOT).replaceAll("\\s+", "")); } }
UTF-8
Java
3,437
java
SimpleTextService.java
Java
[]
null
[]
package com.epam.izh.rd.online.service; import java.util.Locale; public class SimpleTextService implements TextService { /** * Реализовать функционал удаления строки из другой строки. * * Например для базовой строки "Hello, hello, hello, how low?" и строки для удаления ", he" * метод вернет "Hellollollo, how low?" * * @param base - базовая строка с текстом * @param remove - строка которую необходимо удалить */ @Override public String removeString(String base, String remove) { return base.replaceAll(remove, ""); } /** * Реализовать функционал проверки на то, что строка заканчивается знаком вопроса. * * Например для строки "Hello, hello, hello, how low?" метод вернет true * Например для строки "Hello, hello, hello!" метод вернет false */ @Override public boolean isQuestionString(String text) { return text.endsWith("?"); } /** * Реализовать функционал соединения переданных строк. * * Например для параметров {"Smells", " ", "Like", " ", "Teen", " ", "Spirit"} * метод вернет "Smells Like Teen Spirit" */ @Override public String concatenate(String... elements) { StringBuilder string = new StringBuilder(); for (String element : elements) { string.append(element); } return string.toString(); } /** * Реализовать функционал изменения регистра в вид лесенки. * Возвращаемый текст должен начинаться с прописного регистра. * * Например для строки "Load Up On Guns And Bring Your Friends" * метод вернет "lOaD Up oN GuNs aNd bRiNg yOuR FrIeNdS". */ @Override public String toJumpCase(String text) { char[] chars = text.toCharArray(); for (int i = 0; i < chars.length; i++) { if (i % 2 == 0) { chars[i] = Character.toLowerCase(chars[i]); } else { chars[i] = Character.toUpperCase(chars[i]); } } return String.valueOf(chars); } /** * Метод определяет, является ли строка палиндромом. * * Палиндром - строка, которая одинаково читается слева направо и справа налево. * * Например для строки "а роза упала на лапу Азора" вернется true, а для "я не палиндром" false */ @Override public boolean isPalindrome(String string) { StringBuilder stringBuilder = new StringBuilder(string); String str1 = stringBuilder.reverse().toString(); if (string.equals("")){ return false; }else return string.replaceAll("\\s+", "").toLowerCase(Locale.ROOT).equals(str1.toLowerCase(Locale.ROOT).replaceAll("\\s+", "")); } }
3,437
0.605027
0.603232
83
32.554218
29.487288
137
false
false
0
0
0
0
0
0
0.493976
false
false
5
373ecc71318190fa9113a208ee50c7bfd789631a
11,055,245,849,923
aec943b782da45ecc4c41869850106b300d08420
/modules/unsupported/wfs-ng/src/main/java/org/geotools/data/wfs/impl/WFSContentFeatureSource.java
df4e318b77f3679150a30a5271da688227f26d3c
[]
no_license
geosolutions-it/geotools
https://github.com/geosolutions-it/geotools
d054e1dc9cd52b32d73d5f4356954e1702dcd658
24388ab4fb1a8f9af00acf35929f5273b5fe81cf
refs/heads/master
"2023-08-22T06:19:36.012000"
"2013-05-27T11:48:36"
"2013-05-27T11:48:36"
8,934,025
1
2
null
true
"2018-05-26T16:55:03"
"2013-03-21T17:10:52"
"2014-06-19T10:29:25"
"2018-05-26T16:55:02"
174,122
0
1
12
Java
false
null
package org.geotools.data.wfs.impl; import java.io.IOException; import java.util.logging.Logger; import javax.xml.namespace.QName; import org.geotools.data.DataSourceException; import org.geotools.data.DataUtilities; import org.geotools.data.DiffFeatureReader; import org.geotools.data.EmptyFeatureReader; import org.geotools.data.FeatureReader; import org.geotools.data.FeatureSource; import org.geotools.data.Query; import org.geotools.data.ReTypeFeatureReader; import org.geotools.data.Transaction; import org.geotools.data.Transaction.State; import org.geotools.data.store.ContentEntry; import org.geotools.data.store.ContentFeatureSource; import org.geotools.data.wfs.internal.GetFeatureParser; import org.geotools.data.wfs.internal.GetFeatureRequest; import org.geotools.data.wfs.internal.GetFeatureRequest.ResultType; import org.geotools.data.wfs.internal.GetFeatureResponse; import org.geotools.data.wfs.internal.WFSClient; import org.geotools.factory.Hints; import org.geotools.feature.SchemaException; import org.geotools.feature.simple.SimpleFeatureTypeBuilder; import org.geotools.geometry.jts.ReferencedEnvelope; import org.geotools.util.logging.Logging; import org.opengis.feature.FeatureVisitor; import org.opengis.feature.simple.SimpleFeature; import org.opengis.feature.simple.SimpleFeatureType; import org.opengis.feature.type.GeometryDescriptor; import org.opengis.feature.type.Name; import org.opengis.filter.Filter; import org.opengis.referencing.crs.CoordinateReferenceSystem; import com.vividsolutions.jts.geom.CoordinateSequenceFactory; import com.vividsolutions.jts.geom.GeometryFactory; import com.vividsolutions.jts.geom.impl.PackedCoordinateSequenceFactory; class WFSContentFeatureSource extends ContentFeatureSource { private static final Logger LOGGER = Logging.getLogger(WFSContentFeatureSource.class); private final WFSClient client; public WFSContentFeatureSource(final ContentEntry entry, final WFSClient client) { super(entry, null); this.client = client; } WFSClient getWfs() { return client; } @Override protected boolean handleVisitor(Query query, FeatureVisitor visitor) throws IOException { return false; } @Override protected boolean canReproject() { return true; } @Override protected boolean canOffset() { return false;// TODO: check with the WFS client } /** * @return {@code true} * @see org.geotools.data.store.ContentFeatureSource#canSort() */ @Override protected boolean canSort() { return client.canSort(); } /** * @return {@code true} * @see org.geotools.data.store.ContentFeatureSource#canRetype() */ @Override protected boolean canRetype() { return client.canRetype(); } /** * @return {@code true} * @see org.geotools.data.store.ContentFeatureSource#canFilter() */ @Override protected boolean canFilter() { return client.canFilter(); } /** * @return {@code true} * @see org.geotools.data.store.ContentFeatureSource#canLimit() */ @Override protected boolean canLimit() { return client.canLimit(); } @Override public WFSContentDataStore getDataStore() { return (WFSContentDataStore) super.getDataStore(); } /** * @return the WFS advertised bounds of the feature type if * {@code Filter.INCLUDE == query.getFilter()}, reprojected to the Query's crs, or * {@code null} otherwise as it would be too expensive to calculate. * @see FeatureSource#getBounds(Query) * @see org.geotools.data.store.ContentFeatureSource#getBoundsInternal(org.geotools.data.Query) */ @Override protected ReferencedEnvelope getBoundsInternal(Query query) throws IOException { if (!Filter.INCLUDE.equals(query.getFilter())) { return null; } final QName remoteTypeName = getRemoteTypeName(); final CoordinateReferenceSystem targetCrs; if (null == query.getCoordinateSystem()) { targetCrs = client.getDefaultCRS(remoteTypeName); } else { targetCrs = query.getCoordinateSystem(); } ReferencedEnvelope bounds = client.getBounds(remoteTypeName, targetCrs); return bounds; } /** * @return the remote WFS advertised number of features for the given query only if the query * filter is fully supported AND the wfs returns that information in as an attribute of * the FeatureCollection (since the request is performed with resultType=hits), * otherwise {@code -1} as it would be too expensive to calculate. * @see FeatureSource#getCount(Query) * @see org.geotools.data.store.ContentFeatureSource#getCountInternal(org.geotools.data.Query) */ @Override protected int getCountInternal(Query query) throws IOException { if (!client.canCount()) { return -1; } GetFeatureRequest request = createGetFeature(query, ResultType.HITS); GetFeatureResponse response = client.issueRequest(request); GetFeatureParser featureParser = response.getFeatures(null); int resultCount = featureParser.getNumberOfFeatures(); return resultCount; } private GetFeatureRequest createGetFeature(Query query, ResultType resultType) throws IOException { GetFeatureRequest request = client.createGetFeatureRequest(); final WFSContentDataStore dataStore = getDataStore(); final QName remoteTypeName = dataStore.getRemoteTypeName(getEntry().getName()); final SimpleFeatureType remoteSimpleFeatureType; remoteSimpleFeatureType = dataStore.getRemoteSimpleFeatureType(remoteTypeName); request.setTypeName(remoteTypeName); request.setFullType(remoteSimpleFeatureType); request.setFilter(query.getFilter()); request.setResultType(resultType); int maxFeatures = query.getMaxFeatures(); if (Integer.MAX_VALUE > maxFeatures) { request.setMaxFeatures(maxFeatures); } // let the request decide request.setOutputFormat(outputFormat); request.setPropertyNames(query.getPropertyNames()); request.setSortBy(query.getSortBy()); String srsName = null; CoordinateReferenceSystem crs = query.getCoordinateSystem(); if (null != crs) { System.err.println("TODO: don't forget to set the query CRS"); } request.setSrsName(srsName); return request; } /** * @see FeatureSource#getFeatures(Query) * @see org.geotools.data.store.ContentFeatureSource#getReaderInternal(org.geotools.data.Query) */ @Override protected FeatureReader<SimpleFeatureType, SimpleFeature> getReaderInternal(Query localQuery) throws IOException { if (Filter.EXCLUDE.equals(localQuery.getFilter())) { return new EmptyFeatureReader<SimpleFeatureType, SimpleFeature>(getSchema()); } GetFeatureRequest request = createGetFeature(localQuery, ResultType.RESULTS); final SimpleFeatureType contentType = getQueryType(localQuery); request.setQueryType(contentType); GetFeatureResponse response = client.issueRequest(request); GeometryFactory geometryFactory = findGeometryFactory(localQuery.getHints()); GetFeatureParser features = response.getSimpleFeatures(geometryFactory); FeatureReader<SimpleFeatureType, SimpleFeature> reader; reader = new WFSFeatureReader(features); if (!reader.hasNext()) { return new EmptyFeatureReader<SimpleFeatureType, SimpleFeature>(contentType); } final SimpleFeatureType readerType = reader.getFeatureType(); if (!contentType.equals(readerType)) { final boolean cloneContents = false; reader = new ReTypeFeatureReader(reader, contentType, cloneContents); } Transaction transaction = getTransaction(); if (!Transaction.AUTO_COMMIT.equals(transaction)) { ContentEntry entry = getEntry(); State state = transaction.getState(entry); WFSLocalTransactionState wfsState = (WFSLocalTransactionState) state; if (wfsState != null) { WFSDiff diff = wfsState.getDiff(); reader = new DiffFeatureReader<SimpleFeatureType, SimpleFeature>(reader, diff); } } return reader; } private GeometryFactory findGeometryFactory(Hints hints) { GeometryFactory geomFactory = (GeometryFactory) hints.get(Hints.JTS_GEOMETRY_FACTORY); if (geomFactory == null) { CoordinateSequenceFactory seqFac; seqFac = (CoordinateSequenceFactory) hints.get(Hints.JTS_COORDINATE_SEQUENCE_FACTORY); if (seqFac == null) { seqFac = PackedCoordinateSequenceFactory.DOUBLE_FACTORY; } geomFactory = new GeometryFactory(seqFac); } return geomFactory; } @Override protected SimpleFeatureType buildFeatureType() throws IOException { final WFSContentDataStore dataStore = getDataStore(); final Name localTypeName = getEntry().getName(); final QName remoteTypeName = dataStore.getRemoteTypeName(localTypeName); final SimpleFeatureType remoteSimpleFeatureType; remoteSimpleFeatureType = dataStore.getRemoteSimpleFeatureType(remoteTypeName); // adapt the feature type name SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder(); builder.init(remoteSimpleFeatureType); builder.setName(localTypeName); String namespaceOverride = entry.getName().getNamespaceURI(); if (namespaceOverride != null) { builder.setNamespaceURI(namespaceOverride); } GeometryDescriptor defaultGeometry = remoteSimpleFeatureType.getGeometryDescriptor(); if (defaultGeometry != null) { builder.setDefaultGeometry(defaultGeometry.getLocalName()); builder.setCRS(defaultGeometry.getCoordinateReferenceSystem()); } final SimpleFeatureType adaptedFeatureType = builder.buildFeatureType(); return adaptedFeatureType; } public QName getRemoteTypeName() throws IOException { Name localTypeName = getEntry().getName(); QName remoteTypeName = getDataStore().getRemoteTypeName(localTypeName); return remoteTypeName; } // // /** // * Checks if the query requested CRS is supported by the query feature type and if not, adapts // * the query to the feature type default CRS, returning the CRS identifier to use for the WFS // * query. // * <p> // * If the query CRS is not advertised as supported in the WFS capabilities for the requested // * feature type, the query filter is modified so that any geometry literal is reprojected to // the // * default CRS for the feature type, otherwise the query is not modified at all. In any case, // * the crs identifier to actually use in the WFS GetFeature operation is returned. // * </p> // * // * @param query // * @return // * @throws IOException // */ // private String adaptQueryForSupportedCrs(Query query) throws IOException { // // final String localTypeName = getEntry().getTypeName(); // // The CRS the query is performed in // final CoordinateReferenceSystem queryCrs = query.getCoordinateSystem(); // final String defaultCrs = client.getDefaultCRS(localTypeName); // // if (queryCrs == null) { // LOGGER.warning("Query does not provide a CRS, using default: " + query); // return defaultCrs; // } // // String epsgCode; // // final CoordinateReferenceSystem crsNative = getFeatureTypeCRS(localTypeName); // // if (CRS.equalsIgnoreMetadata(queryCrs, crsNative)) { // epsgCode = defaultCrs; // LOGGER.fine("request and native crs for " + localTypeName + " are the same: " // + epsgCode); // } else { // boolean transform = false; // epsgCode = GML2EncodingUtils.epsgCode(queryCrs); // if (epsgCode == null) { // LOGGER.fine("Can't find the identifier for the request CRS, " // + "query will be performed in native CRS"); // transform = true; // } else { // epsgCode = "EPSG:" + epsgCode; // LOGGER.fine("Request CRS is " + epsgCode + ", checking if its supported for " // + localTypeName); // // Set<String> supportedCRSIdentifiers = client // .getSupportedCRSIdentifiers(localTypeName); // if (supportedCRSIdentifiers.contains(epsgCode)) { // LOGGER.fine(epsgCode + " is supported, request will be performed asking " // + "for reprojection over it"); // } else { // LOGGER.fine(epsgCode + " is not supported for " + localTypeName // + ". Query will be adapted to default CRS " + defaultCrs); // transform = true; // } // if (transform) { // epsgCode = defaultCrs; // FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null); // SimpleFeatureType ftype = getSchema(); // ReprojectingFilterVisitor visitor = new ReprojectingFilterVisitor(ff, ftype); // Filter filter = query.getFilter(); // Filter reprojectedFilter = (Filter) filter.accept(visitor, null); // if (LOGGER.isLoggable(Level.FINER)) { // LOGGER.finer("Original Filter: " + filter + "\nReprojected filter: " // + reprojectedFilter); // } // LOGGER.fine("Query filter reprojected to native CRS for " + localTypeName); // query.setFilter(reprojectedFilter); // } // } // } // return epsgCode; // } /** * Returns the feature type that shall result of issueing the given request, adapting the * original feature type for the request's type name in terms of the query CRS and requested * attributes. * * @param query * @return * @throws IOException */ SimpleFeatureType getQueryType(final Query query) throws IOException { final SimpleFeatureType featureType = getSchema(); final CoordinateReferenceSystem coordinateSystemReproject = query .getCoordinateSystemReproject(); String[] propertyNames = query.getPropertyNames(); SimpleFeatureType queryType = featureType; if (propertyNames != null && propertyNames.length > 0) { try { queryType = DataUtilities.createSubType(queryType, propertyNames); } catch (SchemaException e) { throw new DataSourceException(e); } } else { propertyNames = DataUtilities.attributeNames(featureType); } if (coordinateSystemReproject != null) { try { queryType = DataUtilities.createSubType(queryType, propertyNames, coordinateSystemReproject); } catch (SchemaException e) { throw new DataSourceException(e); } } return queryType; } }
UTF-8
Java
15,203
java
WFSContentFeatureSource.java
Java
[]
null
[]
package org.geotools.data.wfs.impl; import java.io.IOException; import java.util.logging.Logger; import javax.xml.namespace.QName; import org.geotools.data.DataSourceException; import org.geotools.data.DataUtilities; import org.geotools.data.DiffFeatureReader; import org.geotools.data.EmptyFeatureReader; import org.geotools.data.FeatureReader; import org.geotools.data.FeatureSource; import org.geotools.data.Query; import org.geotools.data.ReTypeFeatureReader; import org.geotools.data.Transaction; import org.geotools.data.Transaction.State; import org.geotools.data.store.ContentEntry; import org.geotools.data.store.ContentFeatureSource; import org.geotools.data.wfs.internal.GetFeatureParser; import org.geotools.data.wfs.internal.GetFeatureRequest; import org.geotools.data.wfs.internal.GetFeatureRequest.ResultType; import org.geotools.data.wfs.internal.GetFeatureResponse; import org.geotools.data.wfs.internal.WFSClient; import org.geotools.factory.Hints; import org.geotools.feature.SchemaException; import org.geotools.feature.simple.SimpleFeatureTypeBuilder; import org.geotools.geometry.jts.ReferencedEnvelope; import org.geotools.util.logging.Logging; import org.opengis.feature.FeatureVisitor; import org.opengis.feature.simple.SimpleFeature; import org.opengis.feature.simple.SimpleFeatureType; import org.opengis.feature.type.GeometryDescriptor; import org.opengis.feature.type.Name; import org.opengis.filter.Filter; import org.opengis.referencing.crs.CoordinateReferenceSystem; import com.vividsolutions.jts.geom.CoordinateSequenceFactory; import com.vividsolutions.jts.geom.GeometryFactory; import com.vividsolutions.jts.geom.impl.PackedCoordinateSequenceFactory; class WFSContentFeatureSource extends ContentFeatureSource { private static final Logger LOGGER = Logging.getLogger(WFSContentFeatureSource.class); private final WFSClient client; public WFSContentFeatureSource(final ContentEntry entry, final WFSClient client) { super(entry, null); this.client = client; } WFSClient getWfs() { return client; } @Override protected boolean handleVisitor(Query query, FeatureVisitor visitor) throws IOException { return false; } @Override protected boolean canReproject() { return true; } @Override protected boolean canOffset() { return false;// TODO: check with the WFS client } /** * @return {@code true} * @see org.geotools.data.store.ContentFeatureSource#canSort() */ @Override protected boolean canSort() { return client.canSort(); } /** * @return {@code true} * @see org.geotools.data.store.ContentFeatureSource#canRetype() */ @Override protected boolean canRetype() { return client.canRetype(); } /** * @return {@code true} * @see org.geotools.data.store.ContentFeatureSource#canFilter() */ @Override protected boolean canFilter() { return client.canFilter(); } /** * @return {@code true} * @see org.geotools.data.store.ContentFeatureSource#canLimit() */ @Override protected boolean canLimit() { return client.canLimit(); } @Override public WFSContentDataStore getDataStore() { return (WFSContentDataStore) super.getDataStore(); } /** * @return the WFS advertised bounds of the feature type if * {@code Filter.INCLUDE == query.getFilter()}, reprojected to the Query's crs, or * {@code null} otherwise as it would be too expensive to calculate. * @see FeatureSource#getBounds(Query) * @see org.geotools.data.store.ContentFeatureSource#getBoundsInternal(org.geotools.data.Query) */ @Override protected ReferencedEnvelope getBoundsInternal(Query query) throws IOException { if (!Filter.INCLUDE.equals(query.getFilter())) { return null; } final QName remoteTypeName = getRemoteTypeName(); final CoordinateReferenceSystem targetCrs; if (null == query.getCoordinateSystem()) { targetCrs = client.getDefaultCRS(remoteTypeName); } else { targetCrs = query.getCoordinateSystem(); } ReferencedEnvelope bounds = client.getBounds(remoteTypeName, targetCrs); return bounds; } /** * @return the remote WFS advertised number of features for the given query only if the query * filter is fully supported AND the wfs returns that information in as an attribute of * the FeatureCollection (since the request is performed with resultType=hits), * otherwise {@code -1} as it would be too expensive to calculate. * @see FeatureSource#getCount(Query) * @see org.geotools.data.store.ContentFeatureSource#getCountInternal(org.geotools.data.Query) */ @Override protected int getCountInternal(Query query) throws IOException { if (!client.canCount()) { return -1; } GetFeatureRequest request = createGetFeature(query, ResultType.HITS); GetFeatureResponse response = client.issueRequest(request); GetFeatureParser featureParser = response.getFeatures(null); int resultCount = featureParser.getNumberOfFeatures(); return resultCount; } private GetFeatureRequest createGetFeature(Query query, ResultType resultType) throws IOException { GetFeatureRequest request = client.createGetFeatureRequest(); final WFSContentDataStore dataStore = getDataStore(); final QName remoteTypeName = dataStore.getRemoteTypeName(getEntry().getName()); final SimpleFeatureType remoteSimpleFeatureType; remoteSimpleFeatureType = dataStore.getRemoteSimpleFeatureType(remoteTypeName); request.setTypeName(remoteTypeName); request.setFullType(remoteSimpleFeatureType); request.setFilter(query.getFilter()); request.setResultType(resultType); int maxFeatures = query.getMaxFeatures(); if (Integer.MAX_VALUE > maxFeatures) { request.setMaxFeatures(maxFeatures); } // let the request decide request.setOutputFormat(outputFormat); request.setPropertyNames(query.getPropertyNames()); request.setSortBy(query.getSortBy()); String srsName = null; CoordinateReferenceSystem crs = query.getCoordinateSystem(); if (null != crs) { System.err.println("TODO: don't forget to set the query CRS"); } request.setSrsName(srsName); return request; } /** * @see FeatureSource#getFeatures(Query) * @see org.geotools.data.store.ContentFeatureSource#getReaderInternal(org.geotools.data.Query) */ @Override protected FeatureReader<SimpleFeatureType, SimpleFeature> getReaderInternal(Query localQuery) throws IOException { if (Filter.EXCLUDE.equals(localQuery.getFilter())) { return new EmptyFeatureReader<SimpleFeatureType, SimpleFeature>(getSchema()); } GetFeatureRequest request = createGetFeature(localQuery, ResultType.RESULTS); final SimpleFeatureType contentType = getQueryType(localQuery); request.setQueryType(contentType); GetFeatureResponse response = client.issueRequest(request); GeometryFactory geometryFactory = findGeometryFactory(localQuery.getHints()); GetFeatureParser features = response.getSimpleFeatures(geometryFactory); FeatureReader<SimpleFeatureType, SimpleFeature> reader; reader = new WFSFeatureReader(features); if (!reader.hasNext()) { return new EmptyFeatureReader<SimpleFeatureType, SimpleFeature>(contentType); } final SimpleFeatureType readerType = reader.getFeatureType(); if (!contentType.equals(readerType)) { final boolean cloneContents = false; reader = new ReTypeFeatureReader(reader, contentType, cloneContents); } Transaction transaction = getTransaction(); if (!Transaction.AUTO_COMMIT.equals(transaction)) { ContentEntry entry = getEntry(); State state = transaction.getState(entry); WFSLocalTransactionState wfsState = (WFSLocalTransactionState) state; if (wfsState != null) { WFSDiff diff = wfsState.getDiff(); reader = new DiffFeatureReader<SimpleFeatureType, SimpleFeature>(reader, diff); } } return reader; } private GeometryFactory findGeometryFactory(Hints hints) { GeometryFactory geomFactory = (GeometryFactory) hints.get(Hints.JTS_GEOMETRY_FACTORY); if (geomFactory == null) { CoordinateSequenceFactory seqFac; seqFac = (CoordinateSequenceFactory) hints.get(Hints.JTS_COORDINATE_SEQUENCE_FACTORY); if (seqFac == null) { seqFac = PackedCoordinateSequenceFactory.DOUBLE_FACTORY; } geomFactory = new GeometryFactory(seqFac); } return geomFactory; } @Override protected SimpleFeatureType buildFeatureType() throws IOException { final WFSContentDataStore dataStore = getDataStore(); final Name localTypeName = getEntry().getName(); final QName remoteTypeName = dataStore.getRemoteTypeName(localTypeName); final SimpleFeatureType remoteSimpleFeatureType; remoteSimpleFeatureType = dataStore.getRemoteSimpleFeatureType(remoteTypeName); // adapt the feature type name SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder(); builder.init(remoteSimpleFeatureType); builder.setName(localTypeName); String namespaceOverride = entry.getName().getNamespaceURI(); if (namespaceOverride != null) { builder.setNamespaceURI(namespaceOverride); } GeometryDescriptor defaultGeometry = remoteSimpleFeatureType.getGeometryDescriptor(); if (defaultGeometry != null) { builder.setDefaultGeometry(defaultGeometry.getLocalName()); builder.setCRS(defaultGeometry.getCoordinateReferenceSystem()); } final SimpleFeatureType adaptedFeatureType = builder.buildFeatureType(); return adaptedFeatureType; } public QName getRemoteTypeName() throws IOException { Name localTypeName = getEntry().getName(); QName remoteTypeName = getDataStore().getRemoteTypeName(localTypeName); return remoteTypeName; } // // /** // * Checks if the query requested CRS is supported by the query feature type and if not, adapts // * the query to the feature type default CRS, returning the CRS identifier to use for the WFS // * query. // * <p> // * If the query CRS is not advertised as supported in the WFS capabilities for the requested // * feature type, the query filter is modified so that any geometry literal is reprojected to // the // * default CRS for the feature type, otherwise the query is not modified at all. In any case, // * the crs identifier to actually use in the WFS GetFeature operation is returned. // * </p> // * // * @param query // * @return // * @throws IOException // */ // private String adaptQueryForSupportedCrs(Query query) throws IOException { // // final String localTypeName = getEntry().getTypeName(); // // The CRS the query is performed in // final CoordinateReferenceSystem queryCrs = query.getCoordinateSystem(); // final String defaultCrs = client.getDefaultCRS(localTypeName); // // if (queryCrs == null) { // LOGGER.warning("Query does not provide a CRS, using default: " + query); // return defaultCrs; // } // // String epsgCode; // // final CoordinateReferenceSystem crsNative = getFeatureTypeCRS(localTypeName); // // if (CRS.equalsIgnoreMetadata(queryCrs, crsNative)) { // epsgCode = defaultCrs; // LOGGER.fine("request and native crs for " + localTypeName + " are the same: " // + epsgCode); // } else { // boolean transform = false; // epsgCode = GML2EncodingUtils.epsgCode(queryCrs); // if (epsgCode == null) { // LOGGER.fine("Can't find the identifier for the request CRS, " // + "query will be performed in native CRS"); // transform = true; // } else { // epsgCode = "EPSG:" + epsgCode; // LOGGER.fine("Request CRS is " + epsgCode + ", checking if its supported for " // + localTypeName); // // Set<String> supportedCRSIdentifiers = client // .getSupportedCRSIdentifiers(localTypeName); // if (supportedCRSIdentifiers.contains(epsgCode)) { // LOGGER.fine(epsgCode + " is supported, request will be performed asking " // + "for reprojection over it"); // } else { // LOGGER.fine(epsgCode + " is not supported for " + localTypeName // + ". Query will be adapted to default CRS " + defaultCrs); // transform = true; // } // if (transform) { // epsgCode = defaultCrs; // FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null); // SimpleFeatureType ftype = getSchema(); // ReprojectingFilterVisitor visitor = new ReprojectingFilterVisitor(ff, ftype); // Filter filter = query.getFilter(); // Filter reprojectedFilter = (Filter) filter.accept(visitor, null); // if (LOGGER.isLoggable(Level.FINER)) { // LOGGER.finer("Original Filter: " + filter + "\nReprojected filter: " // + reprojectedFilter); // } // LOGGER.fine("Query filter reprojected to native CRS for " + localTypeName); // query.setFilter(reprojectedFilter); // } // } // } // return epsgCode; // } /** * Returns the feature type that shall result of issueing the given request, adapting the * original feature type for the request's type name in terms of the query CRS and requested * attributes. * * @param query * @return * @throws IOException */ SimpleFeatureType getQueryType(final Query query) throws IOException { final SimpleFeatureType featureType = getSchema(); final CoordinateReferenceSystem coordinateSystemReproject = query .getCoordinateSystemReproject(); String[] propertyNames = query.getPropertyNames(); SimpleFeatureType queryType = featureType; if (propertyNames != null && propertyNames.length > 0) { try { queryType = DataUtilities.createSubType(queryType, propertyNames); } catch (SchemaException e) { throw new DataSourceException(e); } } else { propertyNames = DataUtilities.attributeNames(featureType); } if (coordinateSystemReproject != null) { try { queryType = DataUtilities.createSubType(queryType, propertyNames, coordinateSystemReproject); } catch (SchemaException e) { throw new DataSourceException(e); } } return queryType; } }
15,203
0.676248
0.675853
407
36.353809
29.661442
100
false
false
0
0
0
0
0
0
0.486486
false
false
5
7e7f3d535b3f809ec87880c25699d81401feab3f
29,274,497,110,932
83c8f4f1c36c0601a444f84d2fb08e300527815c
/project1/src/com/example/SomeAttribute.java
17c7f4ce87e24e3ac359471c4a57ecd46ae9a1dd
[]
no_license
MelvinHazeleger/java-web-1Z0-899
https://github.com/MelvinHazeleger/java-web-1Z0-899
412764517f320b502cae15da5d904cd0dc380b36
5634f5f7c3fa44c9d007defd7d8e015d42d914d2
refs/heads/master
"2018-10-17T10:56:59.759000"
"2018-08-11T21:04:15"
"2018-08-11T21:04:15"
141,595,038
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example; import javax.servlet.http.HttpSessionActivationListener; import javax.servlet.http.HttpSessionBindingEvent; import javax.servlet.http.HttpSessionBindingListener; import javax.servlet.http.HttpSessionEvent; import java.io.Serializable; /** * @author Melvin Hazeleger * @created Tuesday 17-Jul-18 15:10 */ public class SomeAttribute implements HttpSessionBindingListener, HttpSessionActivationListener, Serializable { // instance variables (incl. some non-Serializable variables) // constructor + getters/setters @Override public void valueBound(HttpSessionBindingEvent event) { // code to run now that this Attribute is in a session } @Override public void valueUnbound(HttpSessionBindingEvent event) { // code to run now that this Attribute is no longer part of a Session } @Override public void sessionWillPassivate(HttpSessionEvent event) { // code to get non-Serializable fields in a state that // can survive the move to a new VM } @Override public void sessionDidActivate(HttpSessionEvent event) { // code to restore my fields/ to undo whatever sessionWillPassivate() did } }
UTF-8
Java
1,281
java
SomeAttribute.java
Java
[ { "context": ";\r\nimport java.io.Serializable;\r\n\r\n/**\r\n * @author Melvin Hazeleger\r\n * @created Tuesday 17-Jul-18 15:10\r\n */\r\n\r\n\r\npu", "end": 298, "score": 0.9998903274536133, "start": 282, "tag": "NAME", "value": "Melvin Hazeleger" } ]
null
[]
package com.example; import javax.servlet.http.HttpSessionActivationListener; import javax.servlet.http.HttpSessionBindingEvent; import javax.servlet.http.HttpSessionBindingListener; import javax.servlet.http.HttpSessionEvent; import java.io.Serializable; /** * @author <NAME> * @created Tuesday 17-Jul-18 15:10 */ public class SomeAttribute implements HttpSessionBindingListener, HttpSessionActivationListener, Serializable { // instance variables (incl. some non-Serializable variables) // constructor + getters/setters @Override public void valueBound(HttpSessionBindingEvent event) { // code to run now that this Attribute is in a session } @Override public void valueUnbound(HttpSessionBindingEvent event) { // code to run now that this Attribute is no longer part of a Session } @Override public void sessionWillPassivate(HttpSessionEvent event) { // code to get non-Serializable fields in a state that // can survive the move to a new VM } @Override public void sessionDidActivate(HttpSessionEvent event) { // code to restore my fields/ to undo whatever sessionWillPassivate() did } }
1,271
0.697112
0.690867
42
28.5
26.660341
77
false
false
0
0
0
0
0
0
0.190476
false
false
5
a538834b37a2b861553769a2d45d9928fb5f2880
7,327,214,261,484
71bd5c96d44647bb2168278d679957af29a6296a
/lu/tudor/agent/models/trip/libs/fuzzylib/FuzzyRule.java
f62d2343386ea84baf3745cc6f7edbeae4157527
[]
no_license
MANET-Sim/src
https://github.com/MANET-Sim/src
856aad8ec16626463395d941cf67d2a10cd06fda
6fbdba84c6a2aba64946fd4ffbf661a88094cb0a
refs/heads/master
"2021-01-16T01:01:29.815000"
"2013-08-29T21:13:49"
"2013-08-29T21:13:49"
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * "TRMSim-WSN, Trust and Reputation Models Simulator for Wireless Sensor * Networks" is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation, either version 3 of the License, or (at your option) any * later version always keeping the additional terms specified in this license. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. * * * Additional Terms of this License -------------------------------- * * 1. It is Required the preservation of specified reasonable legal notices and * author attributions in that material and in the Appropriate Legal Notices * displayed by works containing it. * * 2. It is limited the use for publicity purposes of names of licensors or * authors of the material. * * 3. It is Required indemnification of licensors and authors of that material * by anyone who conveys the material (or modified versions of it) with * contractual assumptions of liability to the recipient, for any liability that * these contractual assumptions directly impose on those licensors and authors. * * 4. It is Prohibited misrepresentation of the origin of that material, and it * is required that modified versions of such material be marked in reasonable * ways as different from the original version. * * 5. It is Declined to grant rights under trademark law for use of some trade * names, trademarks, or service marks. * * You should have received a copy of the GNU Lesser General Public License * along with this program (lgpl.txt). If not, see * <http://www.gnu.org/licenses/> */ package lu.tudor.agent.models.trip.libs.fuzzylib; import java.util.Collection; import java.util.LinkedList; /** * <p>This class models a Fuzzy rule with its antecedents * ({@link FuzzyRuleExpression}s) and consequents ({@link Variable}s), as well * as its degree of support and weight</p> <p>Example of FuzzyRule: If (x1 is * termX1) AND (x2 is termX2) .... Then (y1 is termY1) AND (y2 is termY2) * [weight: 1.0] Notes:</p> <ul> <li>- "If" clause is called "antecedent"</li> * <li>- "then" clause is called "consequent"</li> <li>- There may be 1 or more * antecedents connected using a {@link RuleConnectionMethod} (e.g. AND, * OR)</li> </ul> * * @author <a href="http://ants.dif.um.es/~felixgm/en" * target="_blank">F&eacute;lix G&oacute;mez M&aacute;rmol</a>, <a * href="http://webs.um.es/gregorio" target="_blank">Gregorio Mart&iacute;nez * P&eacute;rez</a> * @version 0.4 * @since 0.4 */ public class FuzzyRule { /** * Rule antecedent ('if' part) */ protected FuzzyRuleExpression antecedents; /** * Rule consequent ('then' part) */ protected Collection<FuzzyRuleTerm> consequents; /** * Rule's weight */ protected double weight; @Override public String toString() { String s = "IF " + antecedents + " THEN "; for (FuzzyRuleTerm fuzzyRuleTerm : consequents) { s += fuzzyRuleTerm + " AND"; } return s.substring(0, s.length() - 3) + "[" + weight + "]"; } /** * */ public FuzzyRule() { this(null, null, 1.0); } /** * * @param antecedents * @param consequents * @param weight */ public FuzzyRule(FuzzyRuleExpression antecedents, Collection<FuzzyRuleTerm> consequents, double weight) { this.antecedents = antecedents; this.consequents = consequents; this.weight = weight; } /** * Add a condition "... AND ( variable is termName)" to this rule * * @param negated * @param variable : Variable to evaluate * @param termName : FuzzyRuleTerm for this condition * @return this FuzzyRule */ public FuzzyRule addAntecedent(boolean negated, Variable variable, String termName) { if (antecedents == null) { antecedents = new FuzzyRuleExpression(); } antecedents.add(new FuzzyRuleTerm(negated, variable, termName)); return this; } /** * Add consequent "( variable is termName)" to this rule * * @param negated * @param variable : Variable to evaluate * @param termName : FuzzyRuleTerm for this condition * @return this FuzzyRule */ public FuzzyRule addConsequent(boolean negated, Variable variable, String termName) { if (consequents == null) { consequents = new LinkedList<FuzzyRuleTerm>(); } consequents.add(new FuzzyRuleTerm(negated, variable, termName)); return this; } /** * Evaluate this rule using 'RuleImplicationMethod' * * @param ruleImplicationMethod : Rule implication method to use */ public void evaluate(RuleImplicationMethod ruleImplicationMethod) { //--- // Evaluate antecedents (using 'and') //--- double degreeOfSupport = antecedents.evaluate(); // Apply weight degreeOfSupport *= weight; //--- // Imply rule consequents: Apply degreeOfSupport to consequent linguisticTerms //--- for (FuzzyRuleTerm fuzzyRuleTerm : consequents) { ruleImplicationMethod.imply(fuzzyRuleTerm, degreeOfSupport); } } /** * * @return */ public FuzzyRuleExpression getAntecedents() { return antecedents; } /** * * @return */ public Collection<FuzzyRuleTerm> getConsequents() { return consequents; } }
UTF-8
Java
5,742
java
FuzzyRule.java
Java
[ { "context": "://ants.dif.um.es/~felixgm/en\"\n * target=\"_blank\">F&eacute;lix G&oacute;mez M&aacute;rmol</a>, <a\n * href=\"http://webs.um.es/gregorio\" targ", "end": 2615, "score": 0.9993948340415955, "start": 2576, "tag": "NAME", "value": "F&eacute;lix G&oacute;mez M&aacute;rmol" }, { "context": "href=\"http://webs.um.es/gregorio\" target=\"_blank\">Gregorio Mart&iacute;nez\n * P&eacute;rez</a>\n * @version 0.4\n * @since 0.4", "end": 2701, "score": 0.9897778630256653, "start": 2677, "tag": "NAME", "value": "Gregorio Mart&iacute;nez" }, { "context": "gorio\" target=\"_blank\">Gregorio Mart&iacute;nez\n * P&eacute;rez</a>\n * @version 0.4\n * @since 0.4\n */\npublic ", "end": 2713, "score": 0.9977896213531494, "start": 2705, "tag": "NAME", "value": "P&eacute" }, { "context": "get=\"_blank\">Gregorio Mart&iacute;nez\n * P&eacute;rez</a>\n * @version 0.4\n * @since 0.4\n */\npublic clas", "end": 2717, "score": 0.999774694442749, "start": 2714, "tag": "NAME", "value": "rez" } ]
null
[]
/** * "TRMSim-WSN, Trust and Reputation Models Simulator for Wireless Sensor * Networks" is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation, either version 3 of the License, or (at your option) any * later version always keeping the additional terms specified in this license. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. * * * Additional Terms of this License -------------------------------- * * 1. It is Required the preservation of specified reasonable legal notices and * author attributions in that material and in the Appropriate Legal Notices * displayed by works containing it. * * 2. It is limited the use for publicity purposes of names of licensors or * authors of the material. * * 3. It is Required indemnification of licensors and authors of that material * by anyone who conveys the material (or modified versions of it) with * contractual assumptions of liability to the recipient, for any liability that * these contractual assumptions directly impose on those licensors and authors. * * 4. It is Prohibited misrepresentation of the origin of that material, and it * is required that modified versions of such material be marked in reasonable * ways as different from the original version. * * 5. It is Declined to grant rights under trademark law for use of some trade * names, trademarks, or service marks. * * You should have received a copy of the GNU Lesser General Public License * along with this program (lgpl.txt). If not, see * <http://www.gnu.org/licenses/> */ package lu.tudor.agent.models.trip.libs.fuzzylib; import java.util.Collection; import java.util.LinkedList; /** * <p>This class models a Fuzzy rule with its antecedents * ({@link FuzzyRuleExpression}s) and consequents ({@link Variable}s), as well * as its degree of support and weight</p> <p>Example of FuzzyRule: If (x1 is * termX1) AND (x2 is termX2) .... Then (y1 is termY1) AND (y2 is termY2) * [weight: 1.0] Notes:</p> <ul> <li>- "If" clause is called "antecedent"</li> * <li>- "then" clause is called "consequent"</li> <li>- There may be 1 or more * antecedents connected using a {@link RuleConnectionMethod} (e.g. AND, * OR)</li> </ul> * * @author <a href="http://ants.dif.um.es/~felixgm/en" * target="_blank"><NAME></a>, <a * href="http://webs.um.es/gregorio" target="_blank"><NAME> * P&eacute;rez</a> * @version 0.4 * @since 0.4 */ public class FuzzyRule { /** * Rule antecedent ('if' part) */ protected FuzzyRuleExpression antecedents; /** * Rule consequent ('then' part) */ protected Collection<FuzzyRuleTerm> consequents; /** * Rule's weight */ protected double weight; @Override public String toString() { String s = "IF " + antecedents + " THEN "; for (FuzzyRuleTerm fuzzyRuleTerm : consequents) { s += fuzzyRuleTerm + " AND"; } return s.substring(0, s.length() - 3) + "[" + weight + "]"; } /** * */ public FuzzyRule() { this(null, null, 1.0); } /** * * @param antecedents * @param consequents * @param weight */ public FuzzyRule(FuzzyRuleExpression antecedents, Collection<FuzzyRuleTerm> consequents, double weight) { this.antecedents = antecedents; this.consequents = consequents; this.weight = weight; } /** * Add a condition "... AND ( variable is termName)" to this rule * * @param negated * @param variable : Variable to evaluate * @param termName : FuzzyRuleTerm for this condition * @return this FuzzyRule */ public FuzzyRule addAntecedent(boolean negated, Variable variable, String termName) { if (antecedents == null) { antecedents = new FuzzyRuleExpression(); } antecedents.add(new FuzzyRuleTerm(negated, variable, termName)); return this; } /** * Add consequent "( variable is termName)" to this rule * * @param negated * @param variable : Variable to evaluate * @param termName : FuzzyRuleTerm for this condition * @return this FuzzyRule */ public FuzzyRule addConsequent(boolean negated, Variable variable, String termName) { if (consequents == null) { consequents = new LinkedList<FuzzyRuleTerm>(); } consequents.add(new FuzzyRuleTerm(negated, variable, termName)); return this; } /** * Evaluate this rule using 'RuleImplicationMethod' * * @param ruleImplicationMethod : Rule implication method to use */ public void evaluate(RuleImplicationMethod ruleImplicationMethod) { //--- // Evaluate antecedents (using 'and') //--- double degreeOfSupport = antecedents.evaluate(); // Apply weight degreeOfSupport *= weight; //--- // Imply rule consequents: Apply degreeOfSupport to consequent linguisticTerms //--- for (FuzzyRuleTerm fuzzyRuleTerm : consequents) { ruleImplicationMethod.imply(fuzzyRuleTerm, degreeOfSupport); } } /** * * @return */ public FuzzyRuleExpression getAntecedents() { return antecedents; } /** * * @return */ public Collection<FuzzyRuleTerm> getConsequents() { return consequents; } }
5,691
0.653257
0.648903
173
32.196533
29.270447
109
false
false
0
0
0
0
0
0
0.32948
false
false
5
efeda92582698867630421626d418c607a3da023
24,773,371,398,638
c6d6ac720febd5406274bd374c378e742ae2bccd
/YearBooks/src/com/java/lang/learn/UnicodeAndUTF.java
d5a7b12f1039d791f8541680a21eb6a87d422576
[ "MIT" ]
permissive
Jolin25/Woniu
https://github.com/Jolin25/Woniu
3e02d7ed2707122f388f3512372b12205f3a5ed9
3643c9d55edab67a791f0ee2fd06067f39b5f966
refs/heads/master
"2023-04-21T16:32:17.103000"
"2021-05-14T02:48:13"
"2021-05-14T02:48:13"
360,418,631
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.java.lang.learn; import java.io.UnsupportedEncodingException; import java.util.Arrays; public class UnicodeAndUTF { public static void main(String[] args) throws UnsupportedEncodingException { UnicodeAndUTF uu = new UnicodeAndUTF(); uu.two(); } public void one() { char ch = '\u5639'; Character.UnicodeBlock cu = Character.UnicodeBlock.of(ch); System.out.println(cu); } public void two() throws UnsupportedEncodingException { String str = "abc\u5639\u563b"; byte[] utf8 = str.getBytes("UTF-8");// charsetú║▒Ó┬Ű System.out.println(Arrays.toString(utf8)); } }
IBM852
Java
609
java
UnicodeAndUTF.java
Java
[]
null
[]
package com.java.lang.learn; import java.io.UnsupportedEncodingException; import java.util.Arrays; public class UnicodeAndUTF { public static void main(String[] args) throws UnsupportedEncodingException { UnicodeAndUTF uu = new UnicodeAndUTF(); uu.two(); } public void one() { char ch = '\u5639'; Character.UnicodeBlock cu = Character.UnicodeBlock.of(ch); System.out.println(cu); } public void two() throws UnsupportedEncodingException { String str = "abc\u5639\u563b"; byte[] utf8 = str.getBytes("UTF-8");// charsetú║▒Ó┬Ű System.out.println(Arrays.toString(utf8)); } }
609
0.721667
0.698333
25
23
22.579638
77
false
false
0
0
0
0
0
0
1.4
false
false
5
236a83b224d0ea875483a64472e9114b890c1366
32,882,269,647,889
5c9e6a47c03be6fe81bc46fc748610fae5300282
/web-api/src/main/java/com/wejoyclass/itops/local/controller/UserController.java
c719108a949782e47a20cc281fcf12a028b0f2b2
[]
no_license
Sololan/itops-native-web-api
https://github.com/Sololan/itops-native-web-api
8ae4a706d4a4053ad4f183bb7b4ad707bd4c3a19
f3b140c915917eb1d697b32150d5c11a0650ae04
refs/heads/master
"2022-04-25T03:17:25.932000"
"2020-04-17T05:49:55"
"2020-04-17T05:49:55"
256,412,257
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.wejoyclass.itops.local.controller; import com.wejoyclass.core.dto.security.UserDto; import com.wejoyclass.core.params.Request; import com.wejoyclass.core.util.CtrlUtil; import com.wejoyclass.core.util.RespEntity; import com.wejoyclass.itops.local.dto.User4SaveDto; import com.wejoyclass.itops.local.feign.UcService; import com.wejoyclass.uc.entity.User; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; /** * @Author lixu * @Date 2020/1/13 21:06 * @Version 1.0 */ @RestController @RequestMapping("/users") @Api(tags = "用户管理") public class UserController { @Autowired private UcService ucService; @ApiOperation("添加用户") @PostMapping("/save") public RespEntity saveUser(@RequestBody User4SaveDto userDto){ //调用uc return ucService.saveUser(userDto); //同步到云端 //cloudService.synchroAddUser() } @ApiOperation("根据用户id更新用户信息") @PostMapping("/{id}") public RespEntity updateUser(@PathVariable("id") Long id, @RequestBody User4SaveDto userDto){ //调用uc更新 return ucService.updateUser(id, userDto); //同步到云端-更新 //cloudService.synchroUpdateUser(id,user); } @ApiOperation("根据用户id删除用户") @PostMapping("/{id}/delete") public RespEntity deleteUser(@PathVariable("id") Long id){ //调用uc删除 return ucService.deleteUser(id); //云端删除 //cloudService.synchroDeleteUser(id); } @ApiOperation("用户重置密码") @PostMapping("/{id}/resetPwd") public RespEntity resetPassword(@PathVariable("id") Long id){ //调用uc重置密码 return ucService.resetPassword(id); //云端重置密码 //cloudService.synchroResetPassword(id); } }
UTF-8
Java
2,011
java
UserController.java
Java
[ { "context": "otation.*;\n\nimport java.util.List;\n\n/**\n * @Author lixu\n * @Date 2020/1/13 21:06\n * @Version 1.0\n */\n\n@Re", "end": 603, "score": 0.9995338916778564, "start": 599, "tag": "USERNAME", "value": "lixu" } ]
null
[]
package com.wejoyclass.itops.local.controller; import com.wejoyclass.core.dto.security.UserDto; import com.wejoyclass.core.params.Request; import com.wejoyclass.core.util.CtrlUtil; import com.wejoyclass.core.util.RespEntity; import com.wejoyclass.itops.local.dto.User4SaveDto; import com.wejoyclass.itops.local.feign.UcService; import com.wejoyclass.uc.entity.User; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; /** * @Author lixu * @Date 2020/1/13 21:06 * @Version 1.0 */ @RestController @RequestMapping("/users") @Api(tags = "用户管理") public class UserController { @Autowired private UcService ucService; @ApiOperation("添加用户") @PostMapping("/save") public RespEntity saveUser(@RequestBody User4SaveDto userDto){ //调用uc return ucService.saveUser(userDto); //同步到云端 //cloudService.synchroAddUser() } @ApiOperation("根据用户id更新用户信息") @PostMapping("/{id}") public RespEntity updateUser(@PathVariable("id") Long id, @RequestBody User4SaveDto userDto){ //调用uc更新 return ucService.updateUser(id, userDto); //同步到云端-更新 //cloudService.synchroUpdateUser(id,user); } @ApiOperation("根据用户id删除用户") @PostMapping("/{id}/delete") public RespEntity deleteUser(@PathVariable("id") Long id){ //调用uc删除 return ucService.deleteUser(id); //云端删除 //cloudService.synchroDeleteUser(id); } @ApiOperation("用户重置密码") @PostMapping("/{id}/resetPwd") public RespEntity resetPassword(@PathVariable("id") Long id){ //调用uc重置密码 return ucService.resetPassword(id); //云端重置密码 //cloudService.synchroResetPassword(id); } }
2,011
0.690005
0.681454
82
21.817074
21.542431
97
false
false
0
0
0
0
0
0
0.292683
false
false
5
1fcec3eded6d2c16da1cb68a911cbc7a10c29cd7
25,993,142,088,026
6bebc930c21834a2ae5a4ac5d3f49fdc708f109a
/component/l2-provider-api/src/main/java/at/joma/apidesign/component/l2/provider/api/AsXML.java
6fc967ab7ec16f2dade124bcce43a75157bff86c
[ "Apache-2.0" ]
permissive
joma74/apidesign
https://github.com/joma74/apidesign
7b9fb9b2e77dc82d169ef67b1bbe3f0aa12af2c2
e00aa8d8efb943081eb905bd352b48de81a6800a
refs/heads/master
"2021-01-21T13:53:45.740000"
"2016-05-13T11:04:20"
"2016-05-13T11:04:20"
54,284,432
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package at.joma.apidesign.component.l2.provider.api; import java.lang.annotation.Annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import javax.enterprise.context.ApplicationScoped; import javax.enterprise.util.Nonbinding; import javax.inject.Qualifier; @Qualifier @Retention(RetentionPolicy.RUNTIME) @Target({ ElementType.FIELD, ElementType.TYPE, ElementType.METHOD }) public @interface AsXML { @Nonbinding public Class<? extends Annotation> inScope() default ApplicationScoped.class; }
UTF-8
Java
641
java
AsXML.java
Java
[]
null
[]
package at.joma.apidesign.component.l2.provider.api; import java.lang.annotation.Annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import javax.enterprise.context.ApplicationScoped; import javax.enterprise.util.Nonbinding; import javax.inject.Qualifier; @Qualifier @Retention(RetentionPolicy.RUNTIME) @Target({ ElementType.FIELD, ElementType.TYPE, ElementType.METHOD }) public @interface AsXML { @Nonbinding public Class<? extends Annotation> inScope() default ApplicationScoped.class; }
641
0.794072
0.792512
25
24.639999
20.651159
82
false
false
0
0
0
0
0
0
0.48
false
false
5
e9918fbc9000dc289df1aedd54bf1c2ec27692eb
19,146,964,271,143
af7345ca23f77ab44018d888fc2ebe554ff3e5b0
/Labs/Lab Group Project 2/src/BlackAndWhiteTiles.java
11210fe1ddccbf7d60770e9ed8e3cbe29b7d9718
[]
no_license
cbussen7/CPS150
https://github.com/cbussen7/CPS150
10b9842869f4701f3fada611d8934fc05c2db372
00ddb70d9af3d2e0f787050623ba11d6479a18a2
refs/heads/main
"2023-08-17T03:34:17.326000"
"2021-06-23T14:04:38"
"2021-06-23T14:04:38"
379,623,434
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* Christopher Bussen CPS 150 02 Lab Group Project 2 BlackAndWhiteTiles: number, number; number, number, number, number, number program takes in a value from the user for the total width of the space and tile width, and calculates the total number of black, white, and gray tiles, and the width of the gap on each side # of groups = (total width - tile width) / (4 * tile width) # of tiles = (# of groups * 4) + 1 # of black = # of groups + 1 -- one black per group and need one at the end # of white = # of groups -- one white per group # of gray = # of groups * 2 -- two grays per group ex1: user inputs 150, 5 program outputs 29, 8, 7, 14, 2.5 ex2: user inputs 212, 8.5 - program outputs 21, 6, 5, 10, 16.75 ex3: user inputs 42391, 5000.5 - program outputs 5, 2, 1, 2, 8694.25 ex4: user inputs five hundred, x - program outputs error ex5: user inputs -412, 6.25 - program outputs -63, -15, -16, -32, -9.125 -- doesn't make sense because number is negative */ import javax.swing.JOptionPane; public class BlackAndWhiteTiles { public static void main(String [] args){ //import JOption class and prompt user to enter total width and tile width String input1 = JOptionPane.showInputDialog("Enter the total width: "); double totalWidth = Double.parseDouble(input1); String input2 = JOptionPane.showInputDialog("Enter the tile width: "); double tileWidth = Double.parseDouble(input2); //calculate number of groups int numGroups = (int) ((totalWidth - tileWidth) / (4 * tileWidth)); //calculate number of tiles int numTiles = 1 + (numGroups * 4); //calculate the number of black, white, and gray tiles int numBlack = numGroups + 1; int numWhite = numGroups; int numGray = 2 * numGroups; //calculate the gap double gap = (totalWidth - (tileWidth * numTiles)) / 2; //show results using dialog box JOptionPane.showMessageDialog(null, "Total number of tiles: " + numTiles + "\n Total number of black tiles: " + numBlack + "\n Total number of white tiles: " + numWhite + "\n Total number of gray tiles: " + numGray + "\n Gap on each side should be: " + gap + "inches"); } }
UTF-8
Java
2,222
java
BlackAndWhiteTiles.java
Java
[ { "context": "/*\nChristopher Bussen\nCPS 150 02\nLab Group Project 2\nBlackAndWhiteTiles", "end": 21, "score": 0.9998729825019836, "start": 3, "tag": "NAME", "value": "Christopher Bussen" } ]
null
[]
/* <NAME> CPS 150 02 Lab Group Project 2 BlackAndWhiteTiles: number, number; number, number, number, number, number program takes in a value from the user for the total width of the space and tile width, and calculates the total number of black, white, and gray tiles, and the width of the gap on each side # of groups = (total width - tile width) / (4 * tile width) # of tiles = (# of groups * 4) + 1 # of black = # of groups + 1 -- one black per group and need one at the end # of white = # of groups -- one white per group # of gray = # of groups * 2 -- two grays per group ex1: user inputs 150, 5 program outputs 29, 8, 7, 14, 2.5 ex2: user inputs 212, 8.5 - program outputs 21, 6, 5, 10, 16.75 ex3: user inputs 42391, 5000.5 - program outputs 5, 2, 1, 2, 8694.25 ex4: user inputs five hundred, x - program outputs error ex5: user inputs -412, 6.25 - program outputs -63, -15, -16, -32, -9.125 -- doesn't make sense because number is negative */ import javax.swing.JOptionPane; public class BlackAndWhiteTiles { public static void main(String [] args){ //import JOption class and prompt user to enter total width and tile width String input1 = JOptionPane.showInputDialog("Enter the total width: "); double totalWidth = Double.parseDouble(input1); String input2 = JOptionPane.showInputDialog("Enter the tile width: "); double tileWidth = Double.parseDouble(input2); //calculate number of groups int numGroups = (int) ((totalWidth - tileWidth) / (4 * tileWidth)); //calculate number of tiles int numTiles = 1 + (numGroups * 4); //calculate the number of black, white, and gray tiles int numBlack = numGroups + 1; int numWhite = numGroups; int numGray = 2 * numGroups; //calculate the gap double gap = (totalWidth - (tileWidth * numTiles)) / 2; //show results using dialog box JOptionPane.showMessageDialog(null, "Total number of tiles: " + numTiles + "\n Total number of black tiles: " + numBlack + "\n Total number of white tiles: " + numWhite + "\n Total number of gray tiles: " + numGray + "\n Gap on each side should be: " + gap + "inches"); } }
2,210
0.665617
0.624662
52
41.71154
43.982224
277
false
false
0
0
0
0
0
0
0.884615
false
false
5
8e6e3e0bb2c744c9641c56b94c77fee5a40da34e
16,406,775,106,836
2103b833497e538ca24fd8ac99299d9ee5667030
/nettydemo/src/main/java/com/rafel/netty/CustomHandler.java
738f2c663fe91cea2e8912ecdd36dabdbd8a4fd7
[]
no_license
JFIA/nettydemo
https://github.com/JFIA/nettydemo
bcb0a4db66dc8ada8036e19ab6b57f9737c46e7e
4df284cd01216600dd4d06c21dd8867809422dd8
refs/heads/master
"2021-04-23T20:32:05.244000"
"2020-03-25T16:33:18"
"2020-03-25T16:33:18"
249,997,179
0
0
null
false
"2020-03-25T14:38:25"
"2020-03-25T14:13:51"
"2020-03-25T14:38:05"
"2020-03-25T14:38:24"
0
0
0
1
Java
false
false
package com.rafel.netty; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.channel.Channel; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.SimpleChannelInboundHandler; import io.netty.handler.codec.http.*; import io.netty.util.CharsetUtil; import java.nio.ByteBuffer; import java.nio.charset.Charset; /*** * 自定义助手类 */ // SimpleChannelInboundHandler:对于请求来讲相当于:入境 public class CustomHandler extends SimpleChannelInboundHandler<HttpObject> { protected void channelRead0(ChannelHandlerContext channelHandlerContext, HttpObject httpObject) throws Exception { // 获得管道 Channel channel = channelHandlerContext.channel(); if (httpObject instanceof HttpRequest) { System.out.println(channel.remoteAddress()); // 定义发送的数据 ByteBuf content=Unpooled.copiedBuffer("HelloNetty", CharsetUtil.UTF_8); // 构建一个httpResponse FullHttpResponse response=new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK,content); // 为响应增加数据类型和长度 response.headers().set(HttpHeaderNames.CONTENT_TYPE,"text/plain"); response.headers().set(HttpHeaderNames.CONTENT_LENGTH, content.readableBytes()); // 把响应刷到客户端 channelHandlerContext.writeAndFlush(response); } } }
UTF-8
Java
1,477
java
CustomHandler.java
Java
[]
null
[]
package com.rafel.netty; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.channel.Channel; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.SimpleChannelInboundHandler; import io.netty.handler.codec.http.*; import io.netty.util.CharsetUtil; import java.nio.ByteBuffer; import java.nio.charset.Charset; /*** * 自定义助手类 */ // SimpleChannelInboundHandler:对于请求来讲相当于:入境 public class CustomHandler extends SimpleChannelInboundHandler<HttpObject> { protected void channelRead0(ChannelHandlerContext channelHandlerContext, HttpObject httpObject) throws Exception { // 获得管道 Channel channel = channelHandlerContext.channel(); if (httpObject instanceof HttpRequest) { System.out.println(channel.remoteAddress()); // 定义发送的数据 ByteBuf content=Unpooled.copiedBuffer("HelloNetty", CharsetUtil.UTF_8); // 构建一个httpResponse FullHttpResponse response=new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK,content); // 为响应增加数据类型和长度 response.headers().set(HttpHeaderNames.CONTENT_TYPE,"text/plain"); response.headers().set(HttpHeaderNames.CONTENT_LENGTH, content.readableBytes()); // 把响应刷到客户端 channelHandlerContext.writeAndFlush(response); } } }
1,477
0.716581
0.71366
45
29.422222
32.012836
119
false
false
0
0
0
0
0
0
0.511111
false
false
5
21539a70a1349160a5294fca52849423326cd2a6
16,406,775,104,842
2fc74f3cd1987ad7671ba4d9dc338334e4bb2159
/src/hackerrank/SampleTest.java
04c37c821a7693910826e5926e00f9939a70c685
[]
no_license
vudph/CodingPractices
https://github.com/vudph/CodingPractices
d8f9b4c62dd58e637f38e66879ae50d3f4539bfe
bac6a584e8850f11a2b73b38d44f4811e54c78b9
refs/heads/master
"2021-10-16T05:15:31.332000"
"2019-02-08T04:44:14"
"2019-02-08T04:44:14"
116,070,341
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package hackerrank; import java.util.ArrayList; import java.util.List; public class SampleTest { static String findNumber(int[] arr, int k) { for (int i = 0; i < arr.length; i++) { if (arr[i] == k) return "YES"; } return "NO"; } static int[] oddNumbers(int l, int r) { List<Integer> odds = new ArrayList<>(); for (int i = l; i <= r; i++) { if (i % 2 != 0) { odds.add(i); } } int a[] = new int[odds.size()]; for (int i = 0; i < a.length; i++) { a[i] = odds.get(i); } return a; } public static void main(String[] args) { } }
UTF-8
Java
586
java
SampleTest.java
Java
[]
null
[]
package hackerrank; import java.util.ArrayList; import java.util.List; public class SampleTest { static String findNumber(int[] arr, int k) { for (int i = 0; i < arr.length; i++) { if (arr[i] == k) return "YES"; } return "NO"; } static int[] oddNumbers(int l, int r) { List<Integer> odds = new ArrayList<>(); for (int i = l; i <= r; i++) { if (i % 2 != 0) { odds.add(i); } } int a[] = new int[odds.size()]; for (int i = 0; i < a.length; i++) { a[i] = odds.get(i); } return a; } public static void main(String[] args) { } }
586
0.535836
0.52901
34
16.235294
14.943145
45
false
false
0
0
0
0
0
0
1.941176
false
false
5
affd13544ea3ce71623335a41d3d204153da2301
30,923,764,565,996
cb74f7dfc74dd47f71d7d65abc63781eda1a9555
/DrugNotification/app/src/main/java/com/example/karmolrut/drugnotification/addnoti1.java
0ef684b28c2aca899a96c1128efde164d841fe55
[]
no_license
karmolrut/DrugNotification
https://github.com/karmolrut/DrugNotification
ec026cc83c45b6059f18a23f0cf2088347cf51e5
49b602eb78bb45975009d55e4f5665d96ee62c11
refs/heads/master
"2020-12-24T19:12:45.257000"
"2016-05-18T17:51:46"
"2016-05-18T17:51:46"
57,111,865
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.karmolrut.drugnotification; import android.annotation.TargetApi; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.Intent; import android.media.RingtoneManager; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.View; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.ListView; import android.widget.SimpleAdapter; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.StatusLine; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.HashMap; import java.util.List; import okhttp3.OkHttpClient; /** * Created by karmolrut on 6/5/2559. */ public class addnoti1 extends AppCompatActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.addnoti1); final Button addnoti1 = (Button) findViewById(R.id.addnoti11); addnoti1.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent homepage = new Intent(addnoti1.this, addnoti.class); startActivity(homepage); } }); addnotii(); } @TargetApi(Build.VERSION_CODES.JELLY_BEAN) public void addnotii() { final ListView lisView2 = (ListView) findViewById(R.id.listView2); // bt11 = (Button) findViewById(R.id.button11); String url = "http://activityen.azurewebsites.net/drugnotification/boxlist2.php"; // Paste Parameters List<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair("txtKeyword", "mmm")); //params.add(new BasicNameValuePair("time", "jjj")); System.currentTimeMillis(); Calendar clock = Calendar.getInstance(); SimpleDateFormat format1; format1 = new SimpleDateFormat("HH"); String time = format1.format(clock.getTime()) + ""; int realtime = Integer.parseInt(time); Calendar minn = Calendar.getInstance(); SimpleDateFormat format2; format2 = new SimpleDateFormat("mm"); String minni = format2.format(minn.getTime()) + ""; int mint = Integer.parseInt(minni); String sum; sum = (realtime + "" + mint); int summ; summ = Integer.parseInt(sum); Calendar day = Calendar.getInstance(); SimpleDateFormat format3; format3 = new SimpleDateFormat("dd"); String dayy = format3.format(day.getTime()) + ""; int daydate = Integer.parseInt(dayy); Calendar mount = Calendar.getInstance(); SimpleDateFormat format4; format4 = new SimpleDateFormat("MM"); String mountt = format4.format(mount.getTime()) + ""; int mountdate = Integer.parseInt(mountt); Calendar year = Calendar.getInstance(); SimpleDateFormat format5; format5 = new SimpleDateFormat("yyyy"); String yearr = format5.format(year.getTime()) + ""; int yeardate = Integer.parseInt(yearr); String dmy; dmy = (daydate + "" + mountdate + "" + (yeardate + 543)); int daymy; daymy = Integer.parseInt(dmy); try { JSONArray data = new JSONArray(getJSONUrl(url, params)); final ArrayList<HashMap<String, String>> addlist2 = new ArrayList<HashMap<String, String>>(); HashMap<String, String> map; String[] hourmin = new String[data.length()]; int[] hour_min = new int[data.length()]; String[] datem = new String[data.length()]; int[] date_dmy = new int[data.length()]; String[] timea = new String[data.length()]; int[] timee = new int[data.length()]; for (int i = 0; i < data.length(); i++) { JSONObject c = data.getJSONObject(i); map = new HashMap<String, String>(); map.put("CustomerID", c.getString("Drug_name") + " " + c.getString("Drug_amount") + " " + c.getString("Drug_type") + "\n" + "เวลา " + c.getString("time_hour") + ":" + c.getString("time_min") + " น. " + "\n" + c.getString("day") + "/" + c.getString("mount") + "/" + c.getString("year") + " ถึง " + c.getString("time") + "/" + c.getString("mount2") + "/" + c.getString("yearr")); addlist2.add(map); timea[i] = c.getString("time") + c.getString("mount2") + c.getString("yearr"); timee[i] = Integer.parseInt(timea[i]); hourmin[i] = c.getString("time_hour") + c.getString("time_min"); hour_min[i] = Integer.parseInt(hourmin[i]); datem[i] = c.getString("day") + c.getString("mount") + c.getString("year"); date_dmy[i] = Integer.parseInt(datem[i]); Uri soundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); final NotificationManager mNM = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); Intent intent1 = new Intent(this.getApplicationContext(), MainActivity.class); PendingIntent pIntent = PendingIntent.getActivity(this, 0, intent1, 0); Notification mNotification = new Notification.Builder(this) .setContentTitle(c.getString("Drug_name") + " " + c.getString("Drug_amount") + " " + c.getString("Drug_type")) //ให้โชว์ชื่อยา จำนวน ขนาด .setContentText(c.getString("message_warn")) .setSmallIcon(R.drawable.iconapp) .setSound(soundUri) .setContentIntent(pIntent) .setAutoCancel(true) .build(); if (summ == hour_min[i]) { //sum เวลาในเครื่อง hourmin เวลา if (daymy == date_dmy[i]) { //daymy วันที่เดือนพศในเครื่อง date_dmy วันที่เดือนพศในดาต้าเบส NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); mNotification.flags |= Notification.FLAG_AUTO_CANCEL; notificationManager.notify(0, mNotification); } else if (date_dmy[i] < timee[i] && daymy >= date_dmy[i] && daymy <= timee[i]) { NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); notificationManager.notify(0, mNotification); } } } SimpleAdapter sAdap; sAdap = new SimpleAdapter(addnoti1.this, addlist2, R.layout.activity_column, new String[]{"CustomerID"}, new int[]{R.id.ColCustomerID}); lisView2.setAdapter(sAdap); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public String getJSONUrl(String url, List<NameValuePair> params) { StringBuilder str = new StringBuilder(); HttpClient client = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(url); try { httpPost.setEntity(new UrlEncodedFormEntity(params)); HttpResponse response = client.execute(httpPost); StatusLine statusLine = response.getStatusLine(); int statusCode = statusLine.getStatusCode(); if (statusCode == 200) { // Download OK HttpEntity entity = response.getEntity(); InputStream content = entity.getContent(); BufferedReader reader = new BufferedReader(new InputStreamReader(content)); String line; while ((line = reader.readLine()) != null) { str.append(line); } } else { Log.e("Log", "Failed to download file.."); } } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return str.toString(); } public void onBackPressed() { Intent homepage = new Intent(addnoti1.this, home.class); startActivity(homepage); } }
UTF-8
Java
9,319
java
addnoti1.java
Java
[ { "context": "package com.example.karmolrut.drugnotification;\n\nimport android.annotation.Targ", "end": 29, "score": 0.9693618416786194, "start": 20, "tag": "USERNAME", "value": "karmolrut" }, { "context": ";\n\nimport okhttp3.OkHttpClient;\n\n/**\n * Created by karmolrut on 6/5/2559.\n */\npublic class addnoti1 extends Ap", "end": 1464, "score": 0.9993184804916382, "start": 1455, "tag": "USERNAME", "value": "karmolrut" } ]
null
[]
package com.example.karmolrut.drugnotification; import android.annotation.TargetApi; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.Intent; import android.media.RingtoneManager; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.View; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.ListView; import android.widget.SimpleAdapter; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.StatusLine; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.HashMap; import java.util.List; import okhttp3.OkHttpClient; /** * Created by karmolrut on 6/5/2559. */ public class addnoti1 extends AppCompatActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.addnoti1); final Button addnoti1 = (Button) findViewById(R.id.addnoti11); addnoti1.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent homepage = new Intent(addnoti1.this, addnoti.class); startActivity(homepage); } }); addnotii(); } @TargetApi(Build.VERSION_CODES.JELLY_BEAN) public void addnotii() { final ListView lisView2 = (ListView) findViewById(R.id.listView2); // bt11 = (Button) findViewById(R.id.button11); String url = "http://activityen.azurewebsites.net/drugnotification/boxlist2.php"; // Paste Parameters List<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair("txtKeyword", "mmm")); //params.add(new BasicNameValuePair("time", "jjj")); System.currentTimeMillis(); Calendar clock = Calendar.getInstance(); SimpleDateFormat format1; format1 = new SimpleDateFormat("HH"); String time = format1.format(clock.getTime()) + ""; int realtime = Integer.parseInt(time); Calendar minn = Calendar.getInstance(); SimpleDateFormat format2; format2 = new SimpleDateFormat("mm"); String minni = format2.format(minn.getTime()) + ""; int mint = Integer.parseInt(minni); String sum; sum = (realtime + "" + mint); int summ; summ = Integer.parseInt(sum); Calendar day = Calendar.getInstance(); SimpleDateFormat format3; format3 = new SimpleDateFormat("dd"); String dayy = format3.format(day.getTime()) + ""; int daydate = Integer.parseInt(dayy); Calendar mount = Calendar.getInstance(); SimpleDateFormat format4; format4 = new SimpleDateFormat("MM"); String mountt = format4.format(mount.getTime()) + ""; int mountdate = Integer.parseInt(mountt); Calendar year = Calendar.getInstance(); SimpleDateFormat format5; format5 = new SimpleDateFormat("yyyy"); String yearr = format5.format(year.getTime()) + ""; int yeardate = Integer.parseInt(yearr); String dmy; dmy = (daydate + "" + mountdate + "" + (yeardate + 543)); int daymy; daymy = Integer.parseInt(dmy); try { JSONArray data = new JSONArray(getJSONUrl(url, params)); final ArrayList<HashMap<String, String>> addlist2 = new ArrayList<HashMap<String, String>>(); HashMap<String, String> map; String[] hourmin = new String[data.length()]; int[] hour_min = new int[data.length()]; String[] datem = new String[data.length()]; int[] date_dmy = new int[data.length()]; String[] timea = new String[data.length()]; int[] timee = new int[data.length()]; for (int i = 0; i < data.length(); i++) { JSONObject c = data.getJSONObject(i); map = new HashMap<String, String>(); map.put("CustomerID", c.getString("Drug_name") + " " + c.getString("Drug_amount") + " " + c.getString("Drug_type") + "\n" + "เวลา " + c.getString("time_hour") + ":" + c.getString("time_min") + " น. " + "\n" + c.getString("day") + "/" + c.getString("mount") + "/" + c.getString("year") + " ถึง " + c.getString("time") + "/" + c.getString("mount2") + "/" + c.getString("yearr")); addlist2.add(map); timea[i] = c.getString("time") + c.getString("mount2") + c.getString("yearr"); timee[i] = Integer.parseInt(timea[i]); hourmin[i] = c.getString("time_hour") + c.getString("time_min"); hour_min[i] = Integer.parseInt(hourmin[i]); datem[i] = c.getString("day") + c.getString("mount") + c.getString("year"); date_dmy[i] = Integer.parseInt(datem[i]); Uri soundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); final NotificationManager mNM = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); Intent intent1 = new Intent(this.getApplicationContext(), MainActivity.class); PendingIntent pIntent = PendingIntent.getActivity(this, 0, intent1, 0); Notification mNotification = new Notification.Builder(this) .setContentTitle(c.getString("Drug_name") + " " + c.getString("Drug_amount") + " " + c.getString("Drug_type")) //ให้โชว์ชื่อยา จำนวน ขนาด .setContentText(c.getString("message_warn")) .setSmallIcon(R.drawable.iconapp) .setSound(soundUri) .setContentIntent(pIntent) .setAutoCancel(true) .build(); if (summ == hour_min[i]) { //sum เวลาในเครื่อง hourmin เวลา if (daymy == date_dmy[i]) { //daymy วันที่เดือนพศในเครื่อง date_dmy วันที่เดือนพศในดาต้าเบส NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); mNotification.flags |= Notification.FLAG_AUTO_CANCEL; notificationManager.notify(0, mNotification); } else if (date_dmy[i] < timee[i] && daymy >= date_dmy[i] && daymy <= timee[i]) { NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); notificationManager.notify(0, mNotification); } } } SimpleAdapter sAdap; sAdap = new SimpleAdapter(addnoti1.this, addlist2, R.layout.activity_column, new String[]{"CustomerID"}, new int[]{R.id.ColCustomerID}); lisView2.setAdapter(sAdap); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public String getJSONUrl(String url, List<NameValuePair> params) { StringBuilder str = new StringBuilder(); HttpClient client = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(url); try { httpPost.setEntity(new UrlEncodedFormEntity(params)); HttpResponse response = client.execute(httpPost); StatusLine statusLine = response.getStatusLine(); int statusCode = statusLine.getStatusCode(); if (statusCode == 200) { // Download OK HttpEntity entity = response.getEntity(); InputStream content = entity.getContent(); BufferedReader reader = new BufferedReader(new InputStreamReader(content)); String line; while ((line = reader.readLine()) != null) { str.append(line); } } else { Log.e("Log", "Failed to download file.."); } } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return str.toString(); } public void onBackPressed() { Intent homepage = new Intent(addnoti1.this, home.class); startActivity(homepage); } }
9,319
0.609414
0.603065
255
34.819607
36.940956
393
false
false
0
0
0
0
0
0
0.643137
false
false
5
a9cc8f83b4dee290f75486aca5a7652eac3d5406
23,545,010,778,098
5afe82df939b097cdd3554d8960fc30e61739262
/src/com/example/universalautomaton/BoardClickListener.java
1e9123d7c64025ebc1aeb0a916fdcfbfddd040d5
[]
no_license
matlaczj/WireWorld
https://github.com/matlaczj/WireWorld
c50a29f59dd556f411ad5626dc58e858e3143b15
ddc13386b7acfc98ccee71419d908baa411eff44
refs/heads/master
"2022-09-04T17:29:58.776000"
"2020-06-01T17:03:19"
"2020-06-01T17:03:19"
259,112,074
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.universalautomaton; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class BoardClickListener implements ActionListener { private byte stateChangeClock = 0; private byte chosenGame; public BoardClickListener(byte chosenGame) { super(); this.chosenGame = chosenGame; } @Override public void actionPerformed(ActionEvent e) { Cell cell = (Cell) e.getSource(); stateChangeClock = cell.getState(); stateChangeClock++; if (chosenGame == C.WW) cell.setState((byte) (stateChangeClock % 4)); else if (chosenGame == C.GOL) cell.setState((byte) (stateChangeClock % 2)); } }
UTF-8
Java
647
java
BoardClickListener.java
Java
[]
null
[]
package com.example.universalautomaton; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class BoardClickListener implements ActionListener { private byte stateChangeClock = 0; private byte chosenGame; public BoardClickListener(byte chosenGame) { super(); this.chosenGame = chosenGame; } @Override public void actionPerformed(ActionEvent e) { Cell cell = (Cell) e.getSource(); stateChangeClock = cell.getState(); stateChangeClock++; if (chosenGame == C.WW) cell.setState((byte) (stateChangeClock % 4)); else if (chosenGame == C.GOL) cell.setState((byte) (stateChangeClock % 2)); } }
647
0.737249
0.732612
26
23.846153
18.647938
59
false
false
0
0
0
0
0
0
1.5
false
false
5
457a5a19d6bbc9028c166cf5c2139c6899f78263
2,542,620,678,288
fdf863480d12babaa93d695961cff64069ab55b5
/app/src/main/java/com/example/Settle_Group_Expenses/Summary.java
04a3bd2a65aaed04c89aeca42efd0d945ce4dbce
[]
no_license
sumitbane/settle-group-expenses
https://github.com/sumitbane/settle-group-expenses
11ab1884c7da9622a4d404b937ee84324515ff37
fec8366c00288fa47cccf48cb69e901f1f8902ea
refs/heads/master
"2023-01-03T19:30:15.560000"
"2020-10-31T13:51:25"
"2020-10-31T13:51:25"
288,203,355
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.Settle_Group_Expenses; import androidx.appcompat.app.AppCompatActivity; import android.database.Cursor; import android.os.Bundle; import android.util.Log; import com.github.mikephil.charting.charts.PieChart; import com.github.mikephil.charting.data.Entry; import com.github.mikephil.charting.data.PieData; import com.github.mikephil.charting.data.PieDataSet; import com.github.mikephil.charting.utils.ColorTemplate; import org.w3c.dom.NameList; import java.util.ArrayList; public class Summary extends AppCompatActivity { public static String groupId,groupName; public static DatabaseHelper myDB; public static ArrayList MemberList; public static ArrayList DebtList; PieChart pieChart; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_summary); Bundle bundle=getIntent().getExtras(); if(bundle==null) { return; } else { groupId=bundle.getString("groupID"); groupName=bundle.getString("groupNAME"); } myDB=new DatabaseHelper(this); pieChart = findViewById(R.id.pieChart); createPie(); } protected void createPie(){ MemberList=new ArrayList(); DebtList=new ArrayList(); int i=0; Cursor cursor=myDB.getMemberName(groupId); if (cursor.getCount()==0){ } else { cursor.moveToFirst(); do{ String name=cursor.getString(1); float debts=cursor.getFloat(4); MemberList.add(name); DebtList.add(new Entry(debts, i)); i++; }while (cursor.moveToNext()); } PieDataSet dataSet = new PieDataSet(DebtList, "Members"); PieData data = new PieData(dataSet); pieChart.setData(data); dataSet.setColors(ColorTemplate.COLORFUL_COLORS); pieChart.animateXY(5000, 5000); } }
UTF-8
Java
2,050
java
Summary.java
Java
[ { "context": "ndle;\nimport android.util.Log;\n\nimport com.github.mikephil.charting.charts.PieChart;\nimport com.github.mikep", "end": 204, "score": 0.9757689237594604, "start": 196, "tag": "USERNAME", "value": "mikephil" }, { "context": "ephil.charting.charts.PieChart;\nimport com.github.mikephil.charting.data.Entry;\nimport com.github.mikephil.c", "end": 257, "score": 0.9747790694236755, "start": 249, "tag": "USERNAME", "value": "mikephil" }, { "context": "b.mikephil.charting.data.Entry;\nimport com.github.mikephil.charting.data.PieData;\nimport com.github.mikephil", "end": 305, "score": 0.9639880657196045, "start": 297, "tag": "USERNAME", "value": "mikephil" }, { "context": "mikephil.charting.data.PieData;\nimport com.github.mikephil.charting.data.PieDataSet;\nimport com.github.mikep", "end": 355, "score": 0.9528079628944397, "start": 347, "tag": "USERNAME", "value": "mikephil" }, { "context": "ephil.charting.data.PieDataSet;\nimport com.github.mikephil.charting.utils.ColorTemplate;\n\nimport org.w3c.dom", "end": 408, "score": 0.926224410533905, "start": 400, "tag": "USERNAME", "value": "mikephil" } ]
null
[]
package com.example.Settle_Group_Expenses; import androidx.appcompat.app.AppCompatActivity; import android.database.Cursor; import android.os.Bundle; import android.util.Log; import com.github.mikephil.charting.charts.PieChart; import com.github.mikephil.charting.data.Entry; import com.github.mikephil.charting.data.PieData; import com.github.mikephil.charting.data.PieDataSet; import com.github.mikephil.charting.utils.ColorTemplate; import org.w3c.dom.NameList; import java.util.ArrayList; public class Summary extends AppCompatActivity { public static String groupId,groupName; public static DatabaseHelper myDB; public static ArrayList MemberList; public static ArrayList DebtList; PieChart pieChart; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_summary); Bundle bundle=getIntent().getExtras(); if(bundle==null) { return; } else { groupId=bundle.getString("groupID"); groupName=bundle.getString("groupNAME"); } myDB=new DatabaseHelper(this); pieChart = findViewById(R.id.pieChart); createPie(); } protected void createPie(){ MemberList=new ArrayList(); DebtList=new ArrayList(); int i=0; Cursor cursor=myDB.getMemberName(groupId); if (cursor.getCount()==0){ } else { cursor.moveToFirst(); do{ String name=cursor.getString(1); float debts=cursor.getFloat(4); MemberList.add(name); DebtList.add(new Entry(debts, i)); i++; }while (cursor.moveToNext()); } PieDataSet dataSet = new PieDataSet(DebtList, "Members"); PieData data = new PieData(dataSet); pieChart.setData(data); dataSet.setColors(ColorTemplate.COLORFUL_COLORS); pieChart.animateXY(5000, 5000); } }
2,050
0.641463
0.635122
70
28.299999
19.013792
65
false
false
0
0
0
0
0
0
0.657143
false
false
5
e496e8a179570e1d61783cfb42718da467cfc6a0
30,081,951,000,000
dff4efad34a2fcd607ac112b0e63f1788a329339
/client/src/com/androidme/app/framework/base/AndroidMeHttpTask.java
bd91f19c37b7fd396d71e30f4283a2b4b470f67c
[]
no_license
dalinhuang/zhangjiang
https://github.com/dalinhuang/zhangjiang
1add9d84388397a66ca6e1bde05530bc5db1df49
9fc644708ea10f6c062851fffb0840765be56b93
refs/heads/master
"2016-09-13T23:20:27.430000"
"2012-04-20T05:43:59"
"2012-04-20T05:43:59"
56,269,192
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.androidme.app.framework.base; import android.util.Log; import com.androidme.app.framework.http.BetterHttp; import com.androidme.app.framework.http.BetterHttpRequest; import com.androidme.app.framework.http.BetterHttpResponse; import com.suishile.util.OAuthUtil; import org.apache.http.HttpEntity; import org.apache.http.NameValuePair; import org.apache.http.client.entity.UrlEncodedFormEntity; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; public abstract class AndroidMeHttpTask implements Runnable { private String uri; private HttpMethod method; private ArrayList<NameValuePair> formparams = new ArrayList<NameValuePair>(); private long delayMillis; private String ctxName; protected boolean isMainTask = true; private boolean cached = false; public AndroidMeHttpTask(String ctxName, String uri) { this(ctxName, uri, false); } public AndroidMeHttpTask(String ctxName, String uri, boolean cached) { this(ctxName, uri, HttpMethod.GET, null, false, cached); } public AndroidMeHttpTask(String ctxName, String uri, boolean isMainTask, boolean cached) { this(ctxName, uri, HttpMethod.GET, null, isMainTask, cached); } public AndroidMeHttpTask(String ctxName, String uri, HttpMethod method, ArrayList<NameValuePair> formparams) { this(ctxName, uri, method, formparams, 0L); } public AndroidMeHttpTask(String ctxName, String uri, HttpMethod method, ArrayList<NameValuePair> formparams, boolean isMainTask, boolean cached) { this(ctxName, uri, method, formparams, 0L, isMainTask, cached); } public AndroidMeHttpTask(String ctxName, String uri, HttpMethod method, ArrayList<NameValuePair> formparams, long delayMillis) { this.uri = uri; this.method = method; this.formparams = formparams; this.delayMillis = delayMillis; this.ctxName = ctxName; } public AndroidMeHttpTask(String ctxName, String uri, HttpMethod method, ArrayList<NameValuePair> formparams, long delayMillis, boolean isMainTask, boolean cached) { this.uri = uri; this.method = method; this.formparams = formparams; this.delayMillis = delayMillis; this.ctxName = ctxName; this.isMainTask = isMainTask; this.cached = cached; } public void run() { if ((AndroidMeService.application != null && AndroidMeService.application.containActiveContext(ctxName)) || (AndroidMeActivity.application != null && AndroidMeActivity.application.containActiveContext(ctxName))) { onStart(); } else { return; } String response = null; Log.v(getClass().getName(), "uri : " + uri); if (delayMillis > 0) { try { Thread.sleep(delayMillis); } catch (InterruptedException ie) { Log.e(getClass().getName(), "thread sleep error", ie); } } try { if ((AndroidMeService.application != null && AndroidMeService.application.containActiveContext(ctxName)) || (AndroidMeActivity.application != null && AndroidMeActivity.application.containActiveContext(ctxName))) { BetterHttpResponse resp = null; //add oauth authentication OAuthUtil.setDefaultHeader(uri); if (method == HttpMethod.GET) { BetterHttpRequest req = BetterHttp.get(uri, cached).withTimeout(1000); resp = req.send(); } else if (method == HttpMethod.POST) { HttpEntity entity = new UrlEncodedFormEntity(formparams, "UTF-8"); BetterHttpRequest req = BetterHttp.post(uri, entity); resp = req.send(); } StringBuilder stringBuilder = new StringBuilder(); BufferedReader reader = new BufferedReader(new InputStreamReader(resp.getResponseBody(), "UTF-8")); for (String s = reader.readLine(); s != null; s = reader.readLine()) { stringBuilder.append(s); } reader.close(); response = stringBuilder.toString(); if (resp == null) { throw new Exception("response is null"); } else if (resp.getStatusCode() < 200 || resp.getStatusCode() >= 400) { onHttpResponseError(resp.getStatusCode()); } } else { return; } } catch (Exception e) { Log.e(getClass().getName(), "http connect error!", e); if ((AndroidMeService.application != null && AndroidMeService.application.containActiveContext(ctxName)) || (AndroidMeActivity.application != null && AndroidMeActivity.application.containActiveContext(ctxName))) { onHTTPException(); } else { return; } return; } finally { onStop(); } if ((AndroidMeService.application != null && AndroidMeService.application.containActiveContext(ctxName)) || (AndroidMeActivity.application != null && AndroidMeActivity.application.containActiveContext(ctxName))) { Log.v(getClass().getName(), "response: " + response); onSuccess(response); } } protected abstract void onHTTPException(); protected abstract void onHttpResponseError(int statusCode); protected abstract void onSuccess(String s); protected abstract void onStart(); protected abstract void onStop(); public enum HttpMethod { GET, POST } }
UTF-8
Java
6,055
java
AndroidMeHttpTask.java
Java
[]
null
[]
package com.androidme.app.framework.base; import android.util.Log; import com.androidme.app.framework.http.BetterHttp; import com.androidme.app.framework.http.BetterHttpRequest; import com.androidme.app.framework.http.BetterHttpResponse; import com.suishile.util.OAuthUtil; import org.apache.http.HttpEntity; import org.apache.http.NameValuePair; import org.apache.http.client.entity.UrlEncodedFormEntity; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; public abstract class AndroidMeHttpTask implements Runnable { private String uri; private HttpMethod method; private ArrayList<NameValuePair> formparams = new ArrayList<NameValuePair>(); private long delayMillis; private String ctxName; protected boolean isMainTask = true; private boolean cached = false; public AndroidMeHttpTask(String ctxName, String uri) { this(ctxName, uri, false); } public AndroidMeHttpTask(String ctxName, String uri, boolean cached) { this(ctxName, uri, HttpMethod.GET, null, false, cached); } public AndroidMeHttpTask(String ctxName, String uri, boolean isMainTask, boolean cached) { this(ctxName, uri, HttpMethod.GET, null, isMainTask, cached); } public AndroidMeHttpTask(String ctxName, String uri, HttpMethod method, ArrayList<NameValuePair> formparams) { this(ctxName, uri, method, formparams, 0L); } public AndroidMeHttpTask(String ctxName, String uri, HttpMethod method, ArrayList<NameValuePair> formparams, boolean isMainTask, boolean cached) { this(ctxName, uri, method, formparams, 0L, isMainTask, cached); } public AndroidMeHttpTask(String ctxName, String uri, HttpMethod method, ArrayList<NameValuePair> formparams, long delayMillis) { this.uri = uri; this.method = method; this.formparams = formparams; this.delayMillis = delayMillis; this.ctxName = ctxName; } public AndroidMeHttpTask(String ctxName, String uri, HttpMethod method, ArrayList<NameValuePair> formparams, long delayMillis, boolean isMainTask, boolean cached) { this.uri = uri; this.method = method; this.formparams = formparams; this.delayMillis = delayMillis; this.ctxName = ctxName; this.isMainTask = isMainTask; this.cached = cached; } public void run() { if ((AndroidMeService.application != null && AndroidMeService.application.containActiveContext(ctxName)) || (AndroidMeActivity.application != null && AndroidMeActivity.application.containActiveContext(ctxName))) { onStart(); } else { return; } String response = null; Log.v(getClass().getName(), "uri : " + uri); if (delayMillis > 0) { try { Thread.sleep(delayMillis); } catch (InterruptedException ie) { Log.e(getClass().getName(), "thread sleep error", ie); } } try { if ((AndroidMeService.application != null && AndroidMeService.application.containActiveContext(ctxName)) || (AndroidMeActivity.application != null && AndroidMeActivity.application.containActiveContext(ctxName))) { BetterHttpResponse resp = null; //add oauth authentication OAuthUtil.setDefaultHeader(uri); if (method == HttpMethod.GET) { BetterHttpRequest req = BetterHttp.get(uri, cached).withTimeout(1000); resp = req.send(); } else if (method == HttpMethod.POST) { HttpEntity entity = new UrlEncodedFormEntity(formparams, "UTF-8"); BetterHttpRequest req = BetterHttp.post(uri, entity); resp = req.send(); } StringBuilder stringBuilder = new StringBuilder(); BufferedReader reader = new BufferedReader(new InputStreamReader(resp.getResponseBody(), "UTF-8")); for (String s = reader.readLine(); s != null; s = reader.readLine()) { stringBuilder.append(s); } reader.close(); response = stringBuilder.toString(); if (resp == null) { throw new Exception("response is null"); } else if (resp.getStatusCode() < 200 || resp.getStatusCode() >= 400) { onHttpResponseError(resp.getStatusCode()); } } else { return; } } catch (Exception e) { Log.e(getClass().getName(), "http connect error!", e); if ((AndroidMeService.application != null && AndroidMeService.application.containActiveContext(ctxName)) || (AndroidMeActivity.application != null && AndroidMeActivity.application.containActiveContext(ctxName))) { onHTTPException(); } else { return; } return; } finally { onStop(); } if ((AndroidMeService.application != null && AndroidMeService.application.containActiveContext(ctxName)) || (AndroidMeActivity.application != null && AndroidMeActivity.application.containActiveContext(ctxName))) { Log.v(getClass().getName(), "response: " + response); onSuccess(response); } } protected abstract void onHTTPException(); protected abstract void onHttpResponseError(int statusCode); protected abstract void onSuccess(String s); protected abstract void onStart(); protected abstract void onStop(); public enum HttpMethod { GET, POST } }
6,055
0.597688
0.595211
150
38.366665
33.289322
125
false
false
0
0
0
0
0
0
0.92
false
false
5
6a9cbac9712800d844d0f429d177f0b4b76718a5
29,076,928,594,990
27511a2f9b0abe76e3fcef6d70e66647dd15da96
/src/com/instagram/creation/capture/ba.java
fe1a365de5fc870f1386a5d7d1c5ceab363f9a61
[]
no_license
biaolv/com.instagram.android
https://github.com/biaolv/com.instagram.android
7edde43d5a909ae2563cf104acfc6891f2a39ebe
3fcd3db2c3823a6d29a31ec0f6abcf5ceca995de
refs/heads/master
"2022-05-09T15:05:05.412000"
"2016-07-21T03:48:36"
"2016-07-21T03:48:36"
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.instagram.creation.capture; import com.facebook.q.ao; import com.instagram.g.f.b; final class ba implements ao { ba(bq parambq) {} public final void a() { b.a.b("camera_init_perf"); } } /* Location: * Qualified Name: com.instagram.creation.capture.ba * Java Class Version: 6 (50.0) * JD-Core Version: 0.7.1 */
UTF-8
Java
352
java
ba.java
Java
[]
null
[]
package com.instagram.creation.capture; import com.facebook.q.ao; import com.instagram.g.f.b; final class ba implements ao { ba(bq parambq) {} public final void a() { b.a.b("camera_init_perf"); } } /* Location: * Qualified Name: com.instagram.creation.capture.ba * Java Class Version: 6 (50.0) * JD-Core Version: 0.7.1 */
352
0.650568
0.630682
21
15.809524
15.267828
56
false
false
0
0
0
0
0
0
0.190476
false
false
5
e96efbdff6baf2f7fd6411e5f130b99e629f10fb
12,481,174,984,253
cadaf8cbe10c8627e1de67f27bc9e66d9efb1c23
/src/main/java/com/sawant/springsecurityjwt/config/SpringSecurityRoutingConfig.java
89c67fbff07c3ff3b44f6019f569cd4a8af7446b
[]
no_license
andysawant/spring-security-jwt
https://github.com/andysawant/spring-security-jwt
1eeec66b554dad492ec06d7973c498640ac9178d
9316caf521d415a659a4dcc19007ca0bb388cc43
refs/heads/main
"2023-02-04T16:21:35.207000"
"2020-12-15T12:32:39"
"2020-12-15T12:32:39"
321,286,650
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.sawant.springsecurityjwt.config; import com.sawant.springsecurityjwt.model.AuthenticationRequest; import com.sawant.springsecurityjwt.model.AuthenticationResponse; import com.sawant.springsecurityjwt.service.MyUserDetailsService; import com.sawant.springsecurityjwt.util.JwtUtil; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.http.MediaType; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.BadCredentialsException; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.web.reactive.function.server.RouterFunction; import org.springframework.web.reactive.function.server.RouterFunctions; import org.springframework.web.reactive.function.server.ServerResponse; import reactor.core.publisher.Mono; import static org.springframework.web.reactive.function.BodyInserters.fromValue; import static org.springframework.web.reactive.function.server.RequestPredicates.GET; import static org.springframework.web.reactive.function.server.RequestPredicates.POST; @Slf4j @Configuration public class SpringSecurityRoutingConfig { @Value("${welcome.url}") private String welcomeUrl; @Value("${authenticate.url}") private String authenticateUrl; @Autowired private MyUserDetailsService userdetailService; @Autowired private AuthenticationManager authenticationManager; @Autowired private JwtUtil jwtUtil; @Bean public RouterFunction<ServerResponse> welcome(){ return RouterFunctions.route(GET(welcomeUrl), request ->{ return ServerResponse.ok().contentType(MediaType.TEXT_PLAIN).body(fromValue("Welcome")); }); } @Bean public RouterFunction<ServerResponse> createAuthenticationToken(){ return RouterFunctions.route(POST(authenticateUrl), request ->{ AuthenticationRequest authenticationRequest=request.bodyToMono(AuthenticationRequest.class).block(); try { authenticationManager.authenticate( new UsernamePasswordAuthenticationToken(authenticationRequest.getUsername(), authenticationRequest.getPassword())); }catch (BadCredentialsException e){ System.out.println("bad credentials"); } final UserDetails userDetails=userdetailService.loadUserByUsername(authenticationRequest.getUsername()); final String jwt=jwtUtil.generateToken(userDetails); return ServerResponse.ok().contentType(MediaType.APPLICATION_JSON).body(fromValue(new AuthenticationResponse(jwt))); }); } }
UTF-8
Java
2,976
java
SpringSecurityRoutingConfig.java
Java
[]
null
[]
package com.sawant.springsecurityjwt.config; import com.sawant.springsecurityjwt.model.AuthenticationRequest; import com.sawant.springsecurityjwt.model.AuthenticationResponse; import com.sawant.springsecurityjwt.service.MyUserDetailsService; import com.sawant.springsecurityjwt.util.JwtUtil; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.http.MediaType; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.BadCredentialsException; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.web.reactive.function.server.RouterFunction; import org.springframework.web.reactive.function.server.RouterFunctions; import org.springframework.web.reactive.function.server.ServerResponse; import reactor.core.publisher.Mono; import static org.springframework.web.reactive.function.BodyInserters.fromValue; import static org.springframework.web.reactive.function.server.RequestPredicates.GET; import static org.springframework.web.reactive.function.server.RequestPredicates.POST; @Slf4j @Configuration public class SpringSecurityRoutingConfig { @Value("${welcome.url}") private String welcomeUrl; @Value("${authenticate.url}") private String authenticateUrl; @Autowired private MyUserDetailsService userdetailService; @Autowired private AuthenticationManager authenticationManager; @Autowired private JwtUtil jwtUtil; @Bean public RouterFunction<ServerResponse> welcome(){ return RouterFunctions.route(GET(welcomeUrl), request ->{ return ServerResponse.ok().contentType(MediaType.TEXT_PLAIN).body(fromValue("Welcome")); }); } @Bean public RouterFunction<ServerResponse> createAuthenticationToken(){ return RouterFunctions.route(POST(authenticateUrl), request ->{ AuthenticationRequest authenticationRequest=request.bodyToMono(AuthenticationRequest.class).block(); try { authenticationManager.authenticate( new UsernamePasswordAuthenticationToken(authenticationRequest.getUsername(), authenticationRequest.getPassword())); }catch (BadCredentialsException e){ System.out.println("bad credentials"); } final UserDetails userDetails=userdetailService.loadUserByUsername(authenticationRequest.getUsername()); final String jwt=jwtUtil.generateToken(userDetails); return ServerResponse.ok().contentType(MediaType.APPLICATION_JSON).body(fromValue(new AuthenticationResponse(jwt))); }); } }
2,976
0.782594
0.781586
69
42.130436
35.147274
139
false
false
0
0
0
0
0
0
0.565217
false
false
5
0badb19b2b479bf85ca2d126586d9fec291776cc
8,881,992,411,135
d98fc14a35420c39c7120c875a3db9daf4131eaa
/algorithms/src/main/java/org/algorithms/BinarySearchIteration.java
c1c9c2b090c5388419f73eb4ba4ad7ab57e9932e
[]
no_license
jayaprakashkaluva/core-java
https://github.com/jayaprakashkaluva/core-java
1132601c063679a8c0d9b10b5175c0d8a668af2c
874e2d9605a0208fff679abdd7a51ffe74e25799
refs/heads/master
"2021-07-19T13:34:51.275000"
"2019-11-11T22:58:31"
"2019-11-11T22:58:31"
194,196,938
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.algorithms; public class BinarySearchIteration { public static int search(int[] source, int start, int end, int data) { while (start <= end) { int mid = start + (end - start) / 2; if (source[mid] == data) { return mid; } else if (source[mid] > data) { end = mid - 1; } else if (source[mid] < data) { start = mid + 1; } } return -1; } }
UTF-8
Java
403
java
BinarySearchIteration.java
Java
[]
null
[]
package org.algorithms; public class BinarySearchIteration { public static int search(int[] source, int start, int end, int data) { while (start <= end) { int mid = start + (end - start) / 2; if (source[mid] == data) { return mid; } else if (source[mid] > data) { end = mid - 1; } else if (source[mid] < data) { start = mid + 1; } } return -1; } }
403
0.548387
0.538462
18
20.388889
18.095852
71
false
false
0
0
0
0
0
0
2.444444
false
false
5
3957c7e8d80621bac591beb3a675bdd79375fe3c
12,326,556,186,952
4808a927a586de01a373e089456e24cf32ee40cf
/feign/client-feign-api/src/main/java/top/zpliu/cloud/feign/consumer/exception/GlobalExceptionHandler.java
147813dcf866f8afcc8efcef8b53ae3ebc2f9e54
[]
no_license
zpliuzpliu/spring-cloud-demo
https://github.com/zpliuzpliu/spring-cloud-demo
55036351efd996a06dce9c9c7f0f65c37731a4ee
e9c5d3cd00c25548adfc0bc4c22dc50a57111ee8
refs/heads/master
"2022-06-26T11:58:17.163000"
"2020-04-08T06:05:53"
"2020-04-08T06:05:53"
253,997,693
0
0
null
false
"2022-06-17T03:05:16"
"2020-04-08T05:52:39"
"2020-04-08T06:06:06"
"2022-06-17T03:05:16"
103
0
0
2
Java
false
false
package top.zpliu.cloud.feign.consumer.exception; import lombok.extern.slf4j.Slf4j; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ResponseBody; import top.zpliu.cloud.common.constant.ApiResultCode; import top.zpliu.cloud.common.dto.ApiResponse; import top.zpliu.cloud.common.exception.InternalApiException; import javax.servlet.http.HttpServletResponse; @Slf4j @ControllerAdvice public class GlobalExceptionHandler { @ExceptionHandler(Exception.class) @ResponseBody public ApiResponse processDefaultException(HttpServletResponse response, Exception e) { response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value()); response.setContentType("application/json;charset=UTF-8"); ApiResponse result = new ApiResponse(ApiResultCode.INTERNAL_SERVER_ERROR); log.error("未知异常错误,错误信息:{}",e); return result; } @ExceptionHandler(InternalApiException.class) @ResponseBody public ApiResponse processApiException(HttpServletResponse response, InternalApiException e) { response.setStatus(HttpStatus.SERVICE_UNAVAILABLE.value()); response.setContentType("application/json;charset=UTF-8"); ApiResponse result = new ApiResponse(ApiResultCode.INTERNAL_SERVER_ERROR); result.setCode(e.getCode()); result.setMsg(e.getMsg()); log.error("API异常错误,错误码:{},错误信息:{}",e.getCode(),e.getMsg()); log.error("API异常错误:",e); return result; } }
UTF-8
Java
1,688
java
GlobalExceptionHandler.java
Java
[]
null
[]
package top.zpliu.cloud.feign.consumer.exception; import lombok.extern.slf4j.Slf4j; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ResponseBody; import top.zpliu.cloud.common.constant.ApiResultCode; import top.zpliu.cloud.common.dto.ApiResponse; import top.zpliu.cloud.common.exception.InternalApiException; import javax.servlet.http.HttpServletResponse; @Slf4j @ControllerAdvice public class GlobalExceptionHandler { @ExceptionHandler(Exception.class) @ResponseBody public ApiResponse processDefaultException(HttpServletResponse response, Exception e) { response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value()); response.setContentType("application/json;charset=UTF-8"); ApiResponse result = new ApiResponse(ApiResultCode.INTERNAL_SERVER_ERROR); log.error("未知异常错误,错误信息:{}",e); return result; } @ExceptionHandler(InternalApiException.class) @ResponseBody public ApiResponse processApiException(HttpServletResponse response, InternalApiException e) { response.setStatus(HttpStatus.SERVICE_UNAVAILABLE.value()); response.setContentType("application/json;charset=UTF-8"); ApiResponse result = new ApiResponse(ApiResultCode.INTERNAL_SERVER_ERROR); result.setCode(e.getCode()); result.setMsg(e.getMsg()); log.error("API异常错误,错误码:{},错误信息:{}",e.getCode(),e.getMsg()); log.error("API异常错误:",e); return result; } }
1,688
0.753695
0.750616
41
38.609756
28.203856
98
false
false
0
0
0
0
0
0
0.756098
false
false
5
b668d4c671356f46e863d6a8936a6b769208bb30
13,331,578,542,942
5fd337f64cee2ec5eba52e2fcc02b97beb3014ba
/PhotoAlbum04WebApp/src/main/java/es/udc/fi/dc/photoalbum/webapp/wicket/pages/auth/share/SharedAlbums.java
67c74cd61f97224e26c53b5275d2f433d89f11a2
[]
no_license
EliasGrande/Practica-FD-2013-14-PhotoAlbum
https://github.com/EliasGrande/Practica-FD-2013-14-PhotoAlbum
d09b4eaaf18ec990567b91f680d775afa46a603f
10bdd6b3e37cc1cdda283f4a5b8a4eee50c76a09
refs/heads/master
"2020-05-19T10:45:26.984000"
"2013-12-20T22:59:07"
"2013-12-20T22:59:07"
22,402,922
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package es.udc.fi.dc.photoalbum.webapp.wicket.pages.auth.share; import java.util.List; import org.apache.wicket.RestartResponseException; import org.apache.wicket.Session; import org.apache.wicket.markup.head.CssHeaderItem; import org.apache.wicket.markup.head.IHeaderResponse; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.link.BookmarkablePageLink; import org.apache.wicket.markup.repeater.Item; import org.apache.wicket.markup.repeater.data.DataView; import org.apache.wicket.markup.repeater.data.ListDataProvider; import org.apache.wicket.request.mapper.parameter.PageParameters; import org.apache.wicket.request.resource.CssResourceReference; import org.apache.wicket.spring.injection.annot.SpringBean; import es.udc.fi.dc.photoalbum.model.hibernate.Album; import es.udc.fi.dc.photoalbum.model.hibernate.File; import es.udc.fi.dc.photoalbum.model.hibernate.User; import es.udc.fi.dc.photoalbum.model.spring.AlbumService; import es.udc.fi.dc.photoalbum.model.spring.UserService; import es.udc.fi.dc.photoalbum.webapp.wicket.AjaxDataView; import es.udc.fi.dc.photoalbum.webapp.wicket.MySession; import es.udc.fi.dc.photoalbum.webapp.wicket.pages.auth.BasePageAuth; import es.udc.fi.dc.photoalbum.webapp.wicket.pages.auth.ErrorPage404; /** * Page that allows to view the shared {@link Album}s. */ @SuppressWarnings("serial") public class SharedAlbums extends BasePageAuth { /** * @see UserService */ @SpringBean private UserService userService; /** * @see AlbumService */ @SpringBean private AlbumService albumService; /** * The maximum number ({@link Album}s or {@link File}) per * page. */ private static final int ITEMS_PER_PAGE = 10; /** * The {@link User} who wants to view the {@link Album}s. */ private User user; /** * Constructor for SharedAlbums. * * @param parameters The parameters necessaries for load the page. */ public SharedAlbums(final PageParameters parameters) { super(parameters); if (parameters.getNamedKeys().contains("user")) { final String email = parameters.get("user").toString(); User user = new User(); user.setEmail(email); if (userService.getUser(user) == null) { throw new RestartResponseException(ErrorPage404.class); } this.user = user; add(new AjaxDataView("dataContainer", "navigator", createShareDataView())); } else { throw new RestartResponseException(ErrorPage404.class); } } /** * Method createShareDataView that shown a list of shared {@link Album}s. * * @return DataView<{@link Album}> the data view with the list of {@link Album}. */ private DataView<Album> createShareDataView() { List<Album> list = albumService .getAlbumsSharedWith( ((MySession) Session.get()).getuId(), user.getEmail()); DataView<Album> dataView = new DataView<Album>("pageable", new ListDataProvider<Album>(list)) { public void populateItem(final Item<Album> item) { final Album album = item.getModelObject(); PageParameters pars = new PageParameters(); pars.add("user", user.getEmail()); pars.add("album", album.getName()); BookmarkablePageLink<Void> bp = new BookmarkablePageLink<Void>( "link", SharedFiles.class, pars); bp.add(new Label("name", album.getName())); item.add(bp); } }; dataView.setItemsPerPage(ITEMS_PER_PAGE); return dataView; } /** * Method renderHead, that allow to use CSS to render the page. * * @param response IHeaderResponse * @see org.apache.wicket.markup.html.IHeaderContributor#renderHead(IHeaderResponse) */ @Override public void renderHead(IHeaderResponse response) { super.renderHead(response); response.render(CssHeaderItem .forReference(new CssResourceReference( SharedAlbums.class, "SharedAlbums.css"))); } }
UTF-8
Java
4,306
java
SharedAlbums.java
Java
[]
null
[]
package es.udc.fi.dc.photoalbum.webapp.wicket.pages.auth.share; import java.util.List; import org.apache.wicket.RestartResponseException; import org.apache.wicket.Session; import org.apache.wicket.markup.head.CssHeaderItem; import org.apache.wicket.markup.head.IHeaderResponse; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.link.BookmarkablePageLink; import org.apache.wicket.markup.repeater.Item; import org.apache.wicket.markup.repeater.data.DataView; import org.apache.wicket.markup.repeater.data.ListDataProvider; import org.apache.wicket.request.mapper.parameter.PageParameters; import org.apache.wicket.request.resource.CssResourceReference; import org.apache.wicket.spring.injection.annot.SpringBean; import es.udc.fi.dc.photoalbum.model.hibernate.Album; import es.udc.fi.dc.photoalbum.model.hibernate.File; import es.udc.fi.dc.photoalbum.model.hibernate.User; import es.udc.fi.dc.photoalbum.model.spring.AlbumService; import es.udc.fi.dc.photoalbum.model.spring.UserService; import es.udc.fi.dc.photoalbum.webapp.wicket.AjaxDataView; import es.udc.fi.dc.photoalbum.webapp.wicket.MySession; import es.udc.fi.dc.photoalbum.webapp.wicket.pages.auth.BasePageAuth; import es.udc.fi.dc.photoalbum.webapp.wicket.pages.auth.ErrorPage404; /** * Page that allows to view the shared {@link Album}s. */ @SuppressWarnings("serial") public class SharedAlbums extends BasePageAuth { /** * @see UserService */ @SpringBean private UserService userService; /** * @see AlbumService */ @SpringBean private AlbumService albumService; /** * The maximum number ({@link Album}s or {@link File}) per * page. */ private static final int ITEMS_PER_PAGE = 10; /** * The {@link User} who wants to view the {@link Album}s. */ private User user; /** * Constructor for SharedAlbums. * * @param parameters The parameters necessaries for load the page. */ public SharedAlbums(final PageParameters parameters) { super(parameters); if (parameters.getNamedKeys().contains("user")) { final String email = parameters.get("user").toString(); User user = new User(); user.setEmail(email); if (userService.getUser(user) == null) { throw new RestartResponseException(ErrorPage404.class); } this.user = user; add(new AjaxDataView("dataContainer", "navigator", createShareDataView())); } else { throw new RestartResponseException(ErrorPage404.class); } } /** * Method createShareDataView that shown a list of shared {@link Album}s. * * @return DataView<{@link Album}> the data view with the list of {@link Album}. */ private DataView<Album> createShareDataView() { List<Album> list = albumService .getAlbumsSharedWith( ((MySession) Session.get()).getuId(), user.getEmail()); DataView<Album> dataView = new DataView<Album>("pageable", new ListDataProvider<Album>(list)) { public void populateItem(final Item<Album> item) { final Album album = item.getModelObject(); PageParameters pars = new PageParameters(); pars.add("user", user.getEmail()); pars.add("album", album.getName()); BookmarkablePageLink<Void> bp = new BookmarkablePageLink<Void>( "link", SharedFiles.class, pars); bp.add(new Label("name", album.getName())); item.add(bp); } }; dataView.setItemsPerPage(ITEMS_PER_PAGE); return dataView; } /** * Method renderHead, that allow to use CSS to render the page. * * @param response IHeaderResponse * @see org.apache.wicket.markup.html.IHeaderContributor#renderHead(IHeaderResponse) */ @Override public void renderHead(IHeaderResponse response) { super.renderHead(response); response.render(CssHeaderItem .forReference(new CssResourceReference( SharedAlbums.class, "SharedAlbums.css"))); } }
4,306
0.651184
0.64863
115
36.443478
24.754866
88
false
false
0
0
0
0
0
0
0.513043
false
false
5
82a2611230abb904e2827b95de67f2084da3df89
1,228,360,697,122
9e056008cb3339358f5ec242d83a66bd925cb9f6
/src/main/java/com/whale/sell/order/service/PushMessageService.java
b4c5951e4ddeeecbc5da901f7cea77c9c93f05d8
[]
no_license
whaleBoot/sell
https://github.com/whaleBoot/sell
300c3e5dbe651fe384a6ca52c011dbc92a0c3cc0
fa791339533398cabee28ccae7c4f08871b8ba34
refs/heads/master
"2021-08-20T04:53:24.615000"
"2020-04-29T02:14:53"
"2020-04-29T02:14:53"
174,300,409
5
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.whale.sell.order.service; import com.whale.sell.order.domain.DTO.OrderDTO; /** *@ClassName PushMessageService *@Description 推送消息 *@Author coco *@Data 2019/5/5 10:53 *@Version 1.0 **/ public interface PushMessageService { /** * 订单状态变更消息 * @param orderDTO */ void orderStatus(OrderDTO orderDTO); }
UTF-8
Java
371
java
PushMessageService.java
Java
[ { "context": "PushMessageService\n *@Description 推送消息\n *@Author coco\n *@Data 2019/5/5 10:53\n *@Version 1.0\n **/\npub", "end": 163, "score": 0.9991936087608337, "start": 159, "tag": "USERNAME", "value": "coco" } ]
null
[]
package com.whale.sell.order.service; import com.whale.sell.order.domain.DTO.OrderDTO; /** *@ClassName PushMessageService *@Description 推送消息 *@Author coco *@Data 2019/5/5 10:53 *@Version 1.0 **/ public interface PushMessageService { /** * 订单状态变更消息 * @param orderDTO */ void orderStatus(OrderDTO orderDTO); }
371
0.665706
0.631124
20
16.35
15.067431
48
false
false
0
0
0
0
0
0
0.15
false
false
5
7d7058da813210cffce3f8086f6de6a67cbf2e30
11,330,123,776,702
2cf2f0d7b26981fc3287e92f8a69fef4351f6c7b
/app/src/main/java/com/lmtri/sharespace/fragment/share/search/SearchShareHousingInputDataFragment.java
a3637ad1e40db4961cc0e1df349d1e2c4e997faa
[]
no_license
trile1511/ShareSpace
https://github.com/trile1511/ShareSpace
fb07b640d04f7fe6e864736bd4dbc4c7a758381e
a842ad3619a96df78e30df9686eb89359a3fd801
refs/heads/master
"2021-09-06T23:03:00.090000"
"2018-02-13T04:28:59"
"2018-02-13T04:28:59"
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.lmtri.sharespace.fragment.share.search; import android.app.ProgressDialog; import android.content.DialogInterface; import android.content.Intent; import android.graphics.PorterDuff; import android.os.Build; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.content.ContextCompat; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.SeekBar; import android.widget.Spinner; import android.widget.TextView; import android.widget.Toast; import com.google.android.gms.common.api.Status; import com.google.android.gms.location.places.AutocompleteFilter; import com.google.android.gms.location.places.Place; import com.google.android.gms.location.places.ui.PlaceSelectionListener; import com.google.android.gms.location.places.ui.SupportPlaceAutocompleteFragment; import com.lmtri.sharespace.R; import com.lmtri.sharespace.ShareSpaceApplication; import com.lmtri.sharespace.api.model.SearchShareHousingData; import com.lmtri.sharespace.api.model.ShareHousing; import com.lmtri.sharespace.api.service.RetrofitClient; import com.lmtri.sharespace.api.service.sharehousing.ShareHousingClient; import com.lmtri.sharespace.api.service.sharehousing.search.ISearchShareHousingCallback; import com.lmtri.sharespace.customview.CustomEditText; import com.lmtri.sharespace.helper.Constants; import com.lmtri.sharespace.helper.KeyboardHelper; import com.lmtri.sharespace.helper.ToastHelper; import com.lmtri.sharespace.helper.busevent.sharehousing.search.ReturnSearchShareHousingResultEvent; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** * A simple {@link Fragment} subclass. * Use the {@link SearchShareHousingInputDataFragment#newInstance} factory method to * create an instance of this fragment. */ public class SearchShareHousingInputDataFragment extends Fragment { public static final String TAG = SearchShareHousingInputDataFragment.class.getSimpleName(); private Toolbar mToolbar; private SupportPlaceAutocompleteFragment mPlaceAutocompleteFragment; private Place mSelectedPlace; private TextView mRadiusText; private SeekBar mRadiusBar; private int mRadiusInKm = Constants.SEARCH_HOUSING_INITIAL_RADIUS_IN_KM; private CustomEditText mInputKeywords; private LinearLayout mHouseTypeOption; private String[] mHouseTypeArray; private boolean[] mIsSelectedHouseTypeArray; private TextView mHouseTypesText; private List<Integer> mFullIntPriceList; private List<Integer> mMaxIntPriceList; private Spinner mMinPriceSpinner; private List<String> mMinStringPriceList; private ArrayAdapter<String> mMinPriceSpinnerAdapter; private Spinner mMaxPriceSpinner; private List<String> mMaxStringPriceList; private ArrayAdapter<String> mMaxPriceSpinnerAdapter; private List<Integer> mFullIntAreaList; private List<Integer> mMaxIntAreaList; private Spinner mMinAreaSpinner; private List<CharSequence> mMinStringAreaList; private ArrayAdapter<CharSequence> mMinAreaSpinnerAdapter; private Spinner mMaxAreaSpinner; private List<CharSequence> mMaxStringAreaList; private ArrayAdapter<CharSequence> mMaxAreaSpinnerAdapter; private LinearLayout mNumPeople; private int mSelectedNumPeople = 0; private LinearLayout mNumRoom; private int mSelectedNumRoom = 0; private LinearLayout mNumBed; private int mSelectedNumBed = 0; private LinearLayout mNumBath; private int mSelectedNumBath = 0; private LinearLayout mAmenitiesOption; private String[] mAmenityArray; private boolean[] mIsSelectedAmenityArray; private TextView mAmenitiesText; private List<Integer> mFullIntTimeRestrictionList; private List<Integer> mMaxIntTimeRestrictionList; private Spinner mMinTimeRestrictionSpinner; private List<String> mMinStringTimeRestrictionList; private ArrayAdapter<String> mMinTimeRestrictionSpinnerAdapter; private Spinner mMaxTimeRestrictionSpinner; private List<String> mMaxStringTimeRestrictionList; private ArrayAdapter<String> mMaxTimeRestrictionSpinnerAdapter; private LinearLayout mNumRoommate; private int mSelectedNumRoommate = 1; private Spinner mRequiredGenderSpinner; private Spinner mRequiredWorkTypeSpinner; private LinearLayout mOtherInfoOption; private String[] mOtherInfoArray; private boolean[] mIsSelectedOtherInfoArray; private TextView mOtherInfoText; private TextView mResetSearchingDataButton; private TextView mSearchButton; public SearchShareHousingInputDataFragment() { // Required empty public constructor } /** * Use this factory method to create a new instance of * this fragment using the provided parameters. * * @return A new instance of fragment SearchShareHousingInputDataFragment. */ // TODO: Rename and change types and number of parameters public static SearchShareHousingInputDataFragment newInstance() { SearchShareHousingInputDataFragment fragment = new SearchShareHousingInputDataFragment(); Bundle args = new Bundle(); fragment.setArguments(args); return fragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { } } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_search_share_housing_input_data, container, false); mToolbar = (Toolbar) view.findViewById(R.id.fragment_search_housing_input_data_toolbar); ((AppCompatActivity) getActivity()).setSupportActionBar(mToolbar); if (((AppCompatActivity) getActivity()).getSupportActionBar() != null) { ((AppCompatActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true); ((AppCompatActivity) getActivity()).getSupportActionBar().setDisplayShowTitleEnabled(false); } if (mToolbar.getNavigationIcon() != null) { mToolbar.getNavigationIcon().setColorFilter( ContextCompat.getColor(getContext(), android.R.color.white), PorterDuff.Mode.SRC_ATOP ); } mToolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { getActivity().finish(); getActivity().overridePendingTransition(R.anim.stay_still, R.anim.slide_down_out); } }); mPlaceAutocompleteFragment = (SupportPlaceAutocompleteFragment) getChildFragmentManager() .findFragmentById(R.id.fragment_search_housing_input_data_places_autocomplete_fragment); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { ((EditText) mPlaceAutocompleteFragment.getView().findViewById(R.id.place_autocomplete_search_input)).setTextAppearance(getContext(), android.R.style.TextAppearance_Medium); } else { ((EditText) mPlaceAutocompleteFragment.getView().findViewById(R.id.place_autocomplete_search_input)).setTextAppearance(android.R.style.TextAppearance_Medium); } mPlaceAutocompleteFragment.setOnPlaceSelectedListener(new PlaceSelectionListener() { @Override public void onPlaceSelected(Place place) { mSelectedPlace = place; } @Override public void onError(Status status) { } }); AutocompleteFilter filter = new AutocompleteFilter.Builder() .setCountry("VN") .build(); mPlaceAutocompleteFragment.setFilter(filter); mRadiusText = (TextView) view.findViewById(R.id.fragment_search_housing_input_data_radius); mRadiusText.setText(getString(R.string.fragment_search_housing_input_data_radius_section, Constants.SEARCH_HOUSING_INITIAL_RADIUS_IN_KM)); mRadiusBar = (SeekBar) view.findViewById(R.id.fragment_search_housing_input_data_radius_bar); mRadiusBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { if (fromUser) { mRadiusInKm = progress; mRadiusText.setText(getString(R.string.fragment_search_housing_input_data_radius_section, progress)); } } @Override public void onStartTrackingTouch(SeekBar seekBar) { KeyboardHelper.hideSoftKeyboard(getActivity(), false); } @Override public void onStopTrackingTouch(SeekBar seekBar) { } }); mRadiusBar.setMax(Constants.SEARCH_HOUSING_MAX_RADIUS_IN_KM); mRadiusBar.setProgress(Constants.SEARCH_HOUSING_INITIAL_RADIUS_IN_KM); mInputKeywords = (CustomEditText) view.findViewById(R.id.fragment_search_housing_input_data_key_word_input); mHouseTypeOption = (LinearLayout) view.findViewById(R.id.fragment_search_housing_input_data_house_type_layout); mHouseTypeOption.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { KeyboardHelper.hideSoftKeyboard(getActivity(), false); new AlertDialog.Builder(getContext()) .setTitle(R.string.fragment_search_housing_input_data_house_type_option_dialog_title) .setMultiChoiceItems(mHouseTypeArray, mIsSelectedHouseTypeArray, new DialogInterface.OnMultiChoiceClickListener() { @Override public void onClick(DialogInterface dialog, int which, boolean isChecked) { if (which != 0) { if (mIsSelectedHouseTypeArray[0]) { mIsSelectedHouseTypeArray[0] = false; ((AlertDialog) dialog).getListView().setItemChecked(0, false); } } else { for (int i = 0; i < mIsSelectedHouseTypeArray.length; ++i) { if (i != 0) { mIsSelectedHouseTypeArray[i] = false; ((AlertDialog) dialog).getListView().setItemChecked(i, false); } } } } }) .setPositiveButton(R.string.fragment_search_housing_input_data_house_type_option_dialog_positive, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { String houseTypes = ""; for (int i = 0; i < mIsSelectedHouseTypeArray.length; ++i) { if (mIsSelectedHouseTypeArray[i] == true) { houseTypes += mHouseTypeArray[i] + ", "; } } mHouseTypesText.setText(houseTypes.substring(0, houseTypes.length() - 2)); } }) .setNegativeButton(R.string.fragment_search_housing_input_data_house_type_option_dialog_negative, null) .show(); } }); mHouseTypeArray = getResources().getStringArray(R.array.fragment_search_housing_input_data_house_type_array); mIsSelectedHouseTypeArray = new boolean[mHouseTypeArray.length]; for (int i = 0; i < mIsSelectedHouseTypeArray.length; ++i) { mIsSelectedHouseTypeArray[i] = (i == 0) ? true : false; } mHouseTypesText = (TextView) view.findViewById(R.id.fragment_search_housing_input_data_house_types); mFullIntPriceList = new ArrayList<>(); mMaxIntPriceList = new ArrayList<>(); int[] fullIntPriceArray = getResources().getIntArray(R.array.fragment_search_housing_input_data_price_integer_array); for (int i = 0; i < fullIntPriceArray.length; ++i) { mFullIntPriceList.add(fullIntPriceArray[i]); mMaxIntPriceList.add(fullIntPriceArray[i]); } mMinPriceSpinner = (Spinner) view.findViewById(R.id.fragment_search_housing_input_data_min_price_per_month_of_one_spinner); mMinPriceSpinner.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { KeyboardHelper.hideSoftKeyboard(getActivity(), false); return false; } }); mMinPriceSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { if (position > 1) { int previousMaxPrice = mMaxIntPriceList.get(mMaxPriceSpinner.getSelectedItemPosition()); mMaxStringPriceList.clear(); mMaxStringPriceList.add(mMinStringPriceList.get(0)); mMaxStringPriceList.add(mMinStringPriceList.get(1)); mMaxIntPriceList.clear(); mMaxIntPriceList.add(mFullIntPriceList.get(0)); mMaxIntPriceList.add(mFullIntPriceList.get(1)); for (int i = position; i < mMinStringPriceList.size(); ++i) { mMaxStringPriceList.add(mMinStringPriceList.get(i)); mMaxIntPriceList.add(mFullIntPriceList.get(i)); } if (mFullIntPriceList.get(position) > previousMaxPrice) { mMaxPriceSpinnerAdapter.notifyDataSetChanged(); mMaxPriceSpinner.setSelection(0); } else { mMaxPriceSpinnerAdapter.notifyDataSetChanged(); } } else if (position == 1) { mMaxStringPriceList.clear(); mMaxStringPriceList.add(mMinStringPriceList.get(1)); mMaxIntPriceList.clear(); mMaxIntPriceList.add(mFullIntPriceList.get(1)); mMaxPriceSpinnerAdapter.notifyDataSetChanged(); mMaxPriceSpinner.setSelection(0); } else if (position == 0) { mMaxStringPriceList.clear(); mMaxIntPriceList.clear(); for (int i = 0; i < mMinStringPriceList.size(); ++i) { mMaxStringPriceList.add(mMinStringPriceList.get(i)); mMaxIntPriceList.add(mFullIntPriceList.get(i)); } mMaxPriceSpinnerAdapter.notifyDataSetChanged(); } } @Override public void onNothingSelected(AdapterView<?> parent) { } }); mMinStringPriceList = new ArrayList<>( Arrays.asList(getResources() .getStringArray(R.array.fragment_search_housing_input_data_price_array) ) ); mMinPriceSpinnerAdapter = new ArrayAdapter<>( getContext(), android.R.layout.simple_spinner_item, mMinStringPriceList ); mMinPriceSpinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mMinPriceSpinner.setAdapter(mMinPriceSpinnerAdapter); mMaxPriceSpinner = (Spinner) view.findViewById(R.id.fragment_search_housing_input_data_max_price_per_month_of_one_spinner); mMaxPriceSpinner.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { KeyboardHelper.hideSoftKeyboard(getActivity(), false); return false; } }); mMaxPriceSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { if (mMaxStringPriceList.size() > 1) { if (position == 1) { mMinPriceSpinner.setSelection(1); mMaxStringPriceList.clear(); mMaxStringPriceList.add(mMinStringPriceList.get(1)); mMaxIntPriceList.clear(); mMaxIntPriceList.add(mFullIntPriceList.get(1)); mMaxPriceSpinnerAdapter.notifyDataSetChanged(); } } } @Override public void onNothingSelected(AdapterView<?> parent) { } }); mMaxStringPriceList = new ArrayList<>( Arrays.asList(getResources() .getStringArray(R.array.fragment_search_housing_input_data_price_array) ) ); mMaxPriceSpinnerAdapter = new ArrayAdapter<>( getContext(), android.R.layout.simple_spinner_item, mMaxStringPriceList ); mMaxPriceSpinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mMaxPriceSpinner.setAdapter(mMaxPriceSpinnerAdapter); mFullIntAreaList = new ArrayList<>(); mMaxIntAreaList = new ArrayList<>(); int[] fullIntAreaArray = getResources().getIntArray(R.array.fragment_search_housing_input_data_area_integer_array); for (int i = 0; i < fullIntAreaArray.length; ++i) { mFullIntAreaList.add(fullIntAreaArray[i]); mMaxIntAreaList.add(fullIntAreaArray[i]); } mMinAreaSpinner = (Spinner) view.findViewById(R.id.fragment_search_housing_input_data_min_area_spinner); mMinAreaSpinner.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { KeyboardHelper.hideSoftKeyboard(getActivity(), false); return false; } }); mMinAreaSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { if (position > 0) { int previousMaxArea = mMaxIntAreaList.get(mMaxAreaSpinner.getSelectedItemPosition()); mMaxStringAreaList.clear(); mMaxStringAreaList.add(mMinStringAreaList.get(0)); mMaxIntAreaList.clear(); mMaxIntAreaList.add(mFullIntAreaList.get(0)); for (int i = position; i < mMinStringAreaList.size(); ++i) { mMaxStringAreaList.add(mMinStringAreaList.get(i)); mMaxIntAreaList.add(mFullIntAreaList.get(i)); } if (mFullIntAreaList.get(position) > previousMaxArea) { mMaxAreaSpinnerAdapter.notifyDataSetChanged(); mMaxAreaSpinner.setSelection(0); } else { mMaxAreaSpinnerAdapter.notifyDataSetChanged(); } } else if (position == 0) { mMaxStringAreaList.clear(); mMaxIntAreaList.clear(); for (int i = 0; i < mMinStringAreaList.size(); ++i) { mMaxStringAreaList.add(mMinStringAreaList.get(i)); mMaxIntAreaList.add(mFullIntAreaList.get(i)); } mMaxAreaSpinnerAdapter.notifyDataSetChanged(); } } @Override public void onNothingSelected(AdapterView<?> parent) { } }); mMinStringAreaList = new ArrayList<>(Arrays.asList( getResources() .getTextArray(R.array.fragment_search_housing_input_data_area_array) )); mMinAreaSpinnerAdapter = new ArrayAdapter<>( getContext(), android.R.layout.simple_spinner_item, mMinStringAreaList ); mMinAreaSpinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mMinAreaSpinner.setAdapter(mMinAreaSpinnerAdapter); mMaxAreaSpinner = (Spinner) view.findViewById(R.id.fragment_search_housing_input_data_max_area_spinner); mMaxAreaSpinner.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { KeyboardHelper.hideSoftKeyboard(getActivity(), false); return false; } }); mMaxStringAreaList = new ArrayList<>(Arrays.asList( getResources() .getTextArray(R.array.fragment_search_housing_input_data_area_array) )); mMaxAreaSpinnerAdapter = new ArrayAdapter<>( getContext(), android.R.layout.simple_spinner_item, mMaxStringAreaList ); mMaxAreaSpinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mMaxAreaSpinner.setAdapter(mMaxAreaSpinnerAdapter); mNumPeople = (LinearLayout) view.findViewById(R.id.fragment_search_housing_input_data_number_picker_num_people_layout); for (int i = 0; i < mNumPeople.getChildCount(); ++i) { mNumPeople.getChildAt(i).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { KeyboardHelper.hideSoftKeyboard(getActivity(), false); ((TextView) v).setTextColor(ContextCompat.getColor(getContext(), R.color.white)); v.setBackground(ContextCompat.getDrawable(getContext(), R.drawable.search_housing_square_option_border_primary_color_background)); int tag = Integer.parseInt((String) v.getTag()); mSelectedNumPeople = tag; for (int j = 0; j < mNumPeople.getChildCount(); ++j) { if (j != tag) { ((TextView) mNumPeople.getChildAt(j)).setTextColor(ContextCompat.getColor(getContext(), R.color.textColorSecondary)); mNumPeople.getChildAt(j).setBackground(ContextCompat.getDrawable(getContext(), R.drawable.search_housing_square_option_border)); } } } }); } mNumRoom = (LinearLayout) view.findViewById(R.id.fragment_search_housing_input_data_number_picker_num_room_layout); for (int i = 0; i < mNumRoom.getChildCount(); ++i) { mNumRoom.getChildAt(i).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { KeyboardHelper.hideSoftKeyboard(getActivity(), false); ((TextView) v).setTextColor(ContextCompat.getColor(getContext(), R.color.white)); v.setBackground(ContextCompat.getDrawable(getContext(), R.drawable.search_housing_square_option_border_primary_color_background)); int tag = Integer.parseInt((String) v.getTag()); mSelectedNumRoom = tag; for (int j = 0; j < mNumRoom.getChildCount(); ++j) { if (j != tag) { ((TextView) mNumRoom.getChildAt(j)).setTextColor(ContextCompat.getColor(getContext(), R.color.textColorSecondary));; mNumRoom.getChildAt(j).setBackground(ContextCompat.getDrawable(getContext(), R.drawable.search_housing_square_option_border)); } } } }); } mNumBed = (LinearLayout) view.findViewById(R.id.fragment_search_housing_input_data_number_picker_num_bed_layout); for (int i = 0; i < mNumBed.getChildCount(); ++i) { mNumBed.getChildAt(i).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { KeyboardHelper.hideSoftKeyboard(getActivity(), false); ((TextView) v).setTextColor(ContextCompat.getColor(getContext(), R.color.white)); v.setBackground(ContextCompat.getDrawable(getContext(), R.drawable.search_housing_square_option_border_primary_color_background)); int tag = Integer.parseInt((String) v.getTag()); mSelectedNumBed = tag; for (int j = 0; j < mNumBed.getChildCount(); ++j) { if (j != tag) { ((TextView) mNumBed.getChildAt(j)).setTextColor(ContextCompat.getColor(getContext(), R.color.textColorSecondary));; mNumBed.getChildAt(j).setBackground(ContextCompat.getDrawable(getContext(), R.drawable.search_housing_square_option_border)); } } } }); } mNumBath = (LinearLayout) view.findViewById(R.id.fragment_search_housing_input_data_number_picker_num_bath_layout); for (int i = 0; i < mNumBath.getChildCount(); ++i) { mNumBath.getChildAt(i).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { KeyboardHelper.hideSoftKeyboard(getActivity(), false); ((TextView) v).setTextColor(ContextCompat.getColor(getContext(), R.color.white)); v.setBackground(ContextCompat.getDrawable(getContext(), R.drawable.search_housing_square_option_border_primary_color_background)); int tag = Integer.parseInt((String) v.getTag()); mSelectedNumBath = tag; for (int j = 0; j < mNumBath.getChildCount(); ++j) { if (j != tag) { ((TextView) mNumBath.getChildAt(j)).setTextColor(ContextCompat.getColor(getContext(), R.color.textColorSecondary));; mNumBath.getChildAt(j).setBackground(ContextCompat.getDrawable(getContext(), R.drawable.search_housing_square_option_border)); } } } }); } mAmenitiesOption = (LinearLayout) view.findViewById(R.id.fragment_search_housing_input_data_amenities_layout); mAmenitiesOption.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { KeyboardHelper.hideSoftKeyboard(getActivity(), false); new AlertDialog.Builder(getContext()) .setTitle(R.string.fragment_search_housing_input_data_amenities_option_dialog_title) .setMultiChoiceItems(mAmenityArray, mIsSelectedAmenityArray, new DialogInterface.OnMultiChoiceClickListener() { @Override public void onClick(DialogInterface dialog, int which, boolean isChecked) { if (which != 0) { if (mIsSelectedAmenityArray[0]) { mIsSelectedAmenityArray[0] = false; ((AlertDialog) dialog).getListView().setItemChecked(0, false); } } else { for (int i = 0; i < mIsSelectedAmenityArray.length; ++i) { if (i != 0) { mIsSelectedAmenityArray[i] = false; ((AlertDialog) dialog).getListView().setItemChecked(i, false); } } } } }) .setPositiveButton(R.string.fragment_search_housing_input_data_amenities_option_dialog_positive, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { String amenities = ""; for (int i = 0; i < mIsSelectedAmenityArray.length; ++i) { if (mIsSelectedAmenityArray[i] == true) { amenities += mAmenityArray[i] + ", "; } } mAmenitiesText.setText(amenities.substring(0, amenities.length() - 2)); } }) .setNegativeButton(R.string.fragment_search_housing_input_data_amenities_option_dialog_negative, null) .show(); } }); mAmenityArray = getResources().getStringArray(R.array.fragment_search_housing_input_data_amenity_array); mIsSelectedAmenityArray = new boolean[mAmenityArray.length]; for (int i = 0; i < mIsSelectedAmenityArray.length; ++i) { mIsSelectedAmenityArray[i] = (i == 0) ? true : false; } mAmenitiesText = (TextView) view.findViewById(R.id.fragment_search_housing_input_data_amenities); mFullIntTimeRestrictionList = new ArrayList<>(); mMaxIntTimeRestrictionList = new ArrayList<>(); int[] fullIntTimeRestrictionArray = getResources().getIntArray(R.array.fragment_search_housing_input_data_time_restriction_integer_array); for (int i = 0; i < fullIntTimeRestrictionArray.length; ++i) { mFullIntTimeRestrictionList.add(fullIntTimeRestrictionArray[i]); mMaxIntTimeRestrictionList.add(fullIntTimeRestrictionArray[i]); } mMinTimeRestrictionSpinner = (Spinner) view.findViewById(R.id.fragment_search_housing_input_data_min_time_restriction_spinner); mMinTimeRestrictionSpinner.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { KeyboardHelper.hideSoftKeyboard(getActivity(), false); return false; } }); mMinTimeRestrictionSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { if (position > 0) { int previousMaxTimeRestriction = mMaxIntTimeRestrictionList.get(mMaxTimeRestrictionSpinner.getSelectedItemPosition()); mMaxStringTimeRestrictionList.clear(); mMaxStringTimeRestrictionList.add(mMinStringTimeRestrictionList.get(0)); mMaxIntTimeRestrictionList.clear(); mMaxIntTimeRestrictionList.add(mFullIntTimeRestrictionList.get(0)); for (int i = position; i < mMinStringTimeRestrictionList.size(); ++i) { mMaxStringTimeRestrictionList.add(mMinStringTimeRestrictionList.get(i)); mMaxIntTimeRestrictionList.add(mFullIntTimeRestrictionList.get(i)); } if (mFullIntTimeRestrictionList.get(position) > previousMaxTimeRestriction) { mMaxTimeRestrictionSpinnerAdapter.notifyDataSetChanged(); mMaxTimeRestrictionSpinner.setSelection(0); } else { mMaxTimeRestrictionSpinnerAdapter.notifyDataSetChanged(); } } else if (position == 0) { mMaxStringTimeRestrictionList.clear(); mMaxIntTimeRestrictionList.clear(); for (int i = 0; i < mMinStringTimeRestrictionList.size(); ++i) { mMaxStringTimeRestrictionList.add(mMinStringTimeRestrictionList.get(i)); mMaxIntTimeRestrictionList.add(mFullIntTimeRestrictionList.get(i)); } mMaxTimeRestrictionSpinnerAdapter.notifyDataSetChanged(); } } @Override public void onNothingSelected(AdapterView<?> parent) { } }); mMinStringTimeRestrictionList = new ArrayList<>( Arrays.asList(getResources() .getStringArray(R.array.fragment_search_housing_input_data_time_restriction_array) ) ); mMinTimeRestrictionSpinnerAdapter = new ArrayAdapter<>( getContext(), android.R.layout.simple_spinner_item, mMinStringTimeRestrictionList ); mMinTimeRestrictionSpinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mMinTimeRestrictionSpinner.setAdapter(mMinTimeRestrictionSpinnerAdapter); mMaxTimeRestrictionSpinner = (Spinner) view.findViewById(R.id.fragment_search_housing_input_data_max_time_restriction_spinner); mMaxTimeRestrictionSpinner.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { KeyboardHelper.hideSoftKeyboard(getActivity(), false); return false; } }); mMaxStringTimeRestrictionList = new ArrayList<>( Arrays.asList(getResources() .getStringArray(R.array.fragment_search_housing_input_data_time_restriction_array) ) ); mMaxTimeRestrictionSpinnerAdapter = new ArrayAdapter<>( getContext(), android.R.layout.simple_spinner_item, mMaxStringTimeRestrictionList ); mMaxTimeRestrictionSpinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mMaxTimeRestrictionSpinner.setAdapter(mMaxTimeRestrictionSpinnerAdapter); mNumRoommate = (LinearLayout) view.findViewById(R.id.fragment_search_share_housing_input_data_number_picker_num_roommate_layout); for (int i = 0; i < mNumRoommate.getChildCount(); ++i) { mNumRoommate.getChildAt(i).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { KeyboardHelper.hideSoftKeyboard(getActivity(), false); ((TextView) v).setTextColor(ContextCompat.getColor(getContext(), R.color.white)); v.setBackground(ContextCompat.getDrawable(getContext(), R.drawable.search_housing_square_option_border_primary_color_background)); int tag = Integer.parseInt((String) v.getTag()); mSelectedNumRoommate = tag; for (int j = 0; j < mNumRoommate.getChildCount(); ++j) { if (j != tag - 1) { // tag = [1, 5] ((TextView) mNumRoommate.getChildAt(j)).setTextColor(ContextCompat.getColor(getContext(), R.color.textColorSecondary));; mNumRoommate.getChildAt(j).setBackground(ContextCompat.getDrawable(getContext(), R.drawable.search_housing_square_option_border)); } } } }); } mRequiredGenderSpinner = (Spinner) view.findViewById(R.id.fragment_search_share_housing_input_data_required_gender_spinner); mRequiredGenderSpinner.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { KeyboardHelper.hideSoftKeyboard(getActivity(), false); return false; } }); mRequiredWorkTypeSpinner = (Spinner) view.findViewById(R.id.fragment_search_share_housing_input_data_required_work_type_spinner); mRequiredWorkTypeSpinner.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { KeyboardHelper.hideSoftKeyboard(getActivity(), false); return false; } }); mOtherInfoOption = (LinearLayout) view.findViewById(R.id.fragment_search_housing_input_data_other_info_layout); mOtherInfoOption.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { KeyboardHelper.hideSoftKeyboard(getActivity(), false); new AlertDialog.Builder(getContext()) .setTitle(R.string.fragment_search_housing_input_data_house_type_option_dialog_title) .setMultiChoiceItems(mOtherInfoArray, mIsSelectedOtherInfoArray, new DialogInterface.OnMultiChoiceClickListener() { @Override public void onClick(DialogInterface dialog, int which, boolean isChecked) { if (which != 0) { if (mIsSelectedOtherInfoArray[0]) { mIsSelectedOtherInfoArray[0] = false; ((AlertDialog) dialog).getListView().setItemChecked(0, false); } } else { for (int i = 0; i < mIsSelectedOtherInfoArray.length; ++i) { if (i != 0) { mIsSelectedOtherInfoArray[i] = false; ((AlertDialog) dialog).getListView().setItemChecked(i, false); } } } } }) .setPositiveButton(R.string.fragment_search_housing_input_data_house_type_option_dialog_positive, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { String otherInfo = ""; for (int i = 0; i < mIsSelectedOtherInfoArray.length; ++i) { if (mIsSelectedOtherInfoArray[i] == true) { otherInfo += mOtherInfoArray[i] + ", "; } } mOtherInfoText.setText(otherInfo.substring(0, otherInfo.length() - 2)); } }) .setNegativeButton(R.string.fragment_search_housing_input_data_house_type_option_dialog_negative, null) .show(); } }); mOtherInfoArray = getResources().getStringArray(R.array.fragment_search_share_housing_input_data_other_info_array); mIsSelectedOtherInfoArray = new boolean[mOtherInfoArray.length]; for (int i = 0; i < mIsSelectedOtherInfoArray.length; ++i) { mIsSelectedOtherInfoArray[i] = (i == 0) ? true : false; } mOtherInfoText = (TextView) view.findViewById(R.id.fragment_search_housing_input_data_other_info); mResetSearchingDataButton = (TextView) view.findViewById(R.id.fragment_search_housing_input_data_search_bar_reset_searching_data); mResetSearchingDataButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { KeyboardHelper.hideSoftKeyboard(getActivity(), false); ((EditText) mPlaceAutocompleteFragment.getView().findViewById(R.id.place_autocomplete_search_input)).setText(""); mSelectedPlace = null; mRadiusBar.setProgress(Constants.SEARCH_HOUSING_INITIAL_RADIUS_IN_KM); mRadiusInKm = Constants.SEARCH_HOUSING_INITIAL_RADIUS_IN_KM; mRadiusText.setText(getString(R.string.fragment_search_housing_input_data_radius_section, mRadiusInKm)); mInputKeywords.setText(""); for (int i = 0; i < mIsSelectedHouseTypeArray.length; ++i) { mIsSelectedHouseTypeArray[i] = (i == 0) ? true : false; } mHouseTypesText.setText(mHouseTypeArray[0]); mMinPriceSpinner.setSelection(0); mMaxStringPriceList.clear(); mMaxIntPriceList.clear(); for (int i = 0; i < mMinStringPriceList.size(); ++i) { mMaxStringPriceList.add(mMinStringPriceList.get(i)); mMaxIntPriceList.add(mFullIntPriceList.get(i)); } mMaxPriceSpinnerAdapter.notifyDataSetChanged(); mMaxPriceSpinner.setSelection(0); mMinAreaSpinner.setSelection(0); mMaxStringAreaList.clear(); mMaxIntAreaList.clear(); for (int i = 0; i < mMinStringAreaList.size(); ++i) { mMaxStringAreaList.add(mMinStringAreaList.get(i)); mMaxIntAreaList.add(mFullIntAreaList.get(i)); } mMaxAreaSpinnerAdapter.notifyDataSetChanged(); mMaxAreaSpinner.setSelection(0); mSelectedNumPeople = 0; for (int i = 0; i < mNumPeople.getChildCount(); ++i) { if (i == 0) { ((TextView) mNumPeople.getChildAt(i)).setTextColor(ContextCompat.getColor(getContext(), R.color.white)); mNumPeople.getChildAt(i).setBackground(ContextCompat.getDrawable(getContext(), R.drawable.search_housing_square_option_border_primary_color_background)); } else { ((TextView) mNumPeople.getChildAt(i)).setTextColor(ContextCompat.getColor(getContext(), R.color.textColorSecondary)); mNumPeople.getChildAt(i).setBackground(ContextCompat.getDrawable(getContext(), R.drawable.search_housing_square_option_border)); } } mSelectedNumRoom = 0; for (int i = 0; i < mNumRoom.getChildCount(); ++i) { if (i == 0) { ((TextView) mNumRoom.getChildAt(i)).setTextColor(ContextCompat.getColor(getContext(), R.color.white)); mNumRoom.getChildAt(i).setBackground(ContextCompat.getDrawable(getContext(), R.drawable.search_housing_square_option_border_primary_color_background)); } else { ((TextView) mNumRoom.getChildAt(i)).setTextColor(ContextCompat.getColor(getContext(), R.color.textColorSecondary)); mNumRoom.getChildAt(i).setBackground(ContextCompat.getDrawable(getContext(), R.drawable.search_housing_square_option_border)); } } mSelectedNumBed = 0; for (int i = 0; i < mNumBed.getChildCount(); ++i) { if (i == 0) { ((TextView) mNumBed.getChildAt(i)).setTextColor(ContextCompat.getColor(getContext(), R.color.white)); mNumBed.getChildAt(i).setBackground(ContextCompat.getDrawable(getContext(), R.drawable.search_housing_square_option_border_primary_color_background)); } else { ((TextView) mNumBed.getChildAt(i)).setTextColor(ContextCompat.getColor(getContext(), R.color.textColorSecondary)); mNumBed.getChildAt(i).setBackground(ContextCompat.getDrawable(getContext(), R.drawable.search_housing_square_option_border)); } } mSelectedNumBath = 0; for (int i = 0; i < mNumBath.getChildCount(); ++i) { if (i == 0) { ((TextView) mNumBath.getChildAt(i)).setTextColor(ContextCompat.getColor(getContext(), R.color.white)); mNumBath.getChildAt(i).setBackground(ContextCompat.getDrawable(getContext(), R.drawable.search_housing_square_option_border_primary_color_background)); } else { ((TextView) mNumBath.getChildAt(i)).setTextColor(ContextCompat.getColor(getContext(), R.color.textColorSecondary)); mNumBath.getChildAt(i).setBackground(ContextCompat.getDrawable(getContext(), R.drawable.search_housing_square_option_border)); } } for (int i = 0; i < mIsSelectedAmenityArray.length; ++i) { mIsSelectedAmenityArray[i] = (i == 0) ? true : false; } mAmenitiesText.setText(mAmenityArray[0]); mMinTimeRestrictionSpinner.setSelection(0); mMaxStringTimeRestrictionList.clear(); mMaxIntTimeRestrictionList.clear(); for (int i = 0; i < mMinStringTimeRestrictionList.size(); ++i) { mMaxStringTimeRestrictionList.add(mMinStringTimeRestrictionList.get(i)); mMaxIntTimeRestrictionList.add(mFullIntTimeRestrictionList.get(i)); } mMaxTimeRestrictionSpinnerAdapter.notifyDataSetChanged(); mMaxTimeRestrictionSpinner.setSelection(0); mSelectedNumRoommate = 1; for (int i = 0; i < mNumRoommate.getChildCount(); ++i) { if (i == 0) { ((TextView) mNumRoommate.getChildAt(i)).setTextColor(ContextCompat.getColor(getContext(), R.color.white)); mNumRoommate.getChildAt(i).setBackground(ContextCompat.getDrawable(getContext(), R.drawable.search_housing_square_option_border_primary_color_background)); } else { ((TextView) mNumRoommate.getChildAt(i)).setTextColor(ContextCompat.getColor(getContext(), R.color.textColorSecondary)); mNumRoommate.getChildAt(i).setBackground(ContextCompat.getDrawable(getContext(), R.drawable.search_housing_square_option_border)); } } } }); mSearchButton = (TextView) view.findViewById(R.id.fragment_search_housing_input_data_search_bar_search); mSearchButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { KeyboardHelper.hideSoftKeyboard(getActivity(), false); if (mSelectedPlace != null) { BigDecimal latitude = BigDecimal.valueOf(mSelectedPlace.getLatLng().latitude); BigDecimal longitude = BigDecimal.valueOf(mSelectedPlace.getLatLng().longitude); int minPricePerMonthOfOne = mFullIntPriceList.get(mMinPriceSpinner.getSelectedItemPosition()); int maxPricePerMonthOfOne = mMaxIntPriceList.get(mMaxPriceSpinner.getSelectedItemPosition()); int minArea = mFullIntAreaList.get(mMinAreaSpinner.getSelectedItemPosition()); int maxArea = mMaxIntAreaList.get(mMaxAreaSpinner.getSelectedItemPosition()); String minTimeRestriction = mMinStringTimeRestrictionList .get(mMinTimeRestrictionSpinner.getSelectedItemPosition()); String maxTimeRestriction = mMaxStringTimeRestrictionList .get(mMaxTimeRestrictionSpinner.getSelectedItemPosition()); SearchShareHousingData searchHousingData = new SearchShareHousingData( latitude, longitude, mRadiusInKm * 1000, mInputKeywords.getText().toString(), mIsSelectedHouseTypeArray, minPricePerMonthOfOne, maxPricePerMonthOfOne, minArea, maxArea, mSelectedNumPeople == 0 ? -1 : mSelectedNumPeople, mSelectedNumRoom == 0 ? -1 : mSelectedNumRoom, mSelectedNumBed == 0 ? -1 : mSelectedNumBed, mSelectedNumBath == 0 ? -1 : mSelectedNumBath, mIsSelectedAmenityArray, minTimeRestriction .equalsIgnoreCase(getString(R.string.fragment_search_housing_input_data_time_restriction_any)) ? "" : minTimeRestriction, maxTimeRestriction .equalsIgnoreCase(getString(R.string.fragment_search_housing_input_data_time_restriction_any)) ? "" : maxTimeRestriction, mSelectedNumRoommate, mRequiredGenderSpinner.getSelectedItem().toString(), mRequiredWorkTypeSpinner.getSelectedItem().toString(), mIsSelectedOtherInfoArray ); final ProgressDialog progressDialog = new ProgressDialog(getContext(), R.style.LoginProgressDialog); progressDialog.setIndeterminate(true); progressDialog.setMessage(getString(R.string.fragment_search_housing_input_data_searching)); progressDialog.setCanceledOnTouchOutside(false); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { progressDialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent); } progressDialog.show(); ShareHousingClient.searchShareHousing( searchHousingData, new ISearchShareHousingCallback() { @Override public void onSearchComplete(List<ShareHousing> shareHousingResults) { progressDialog.dismiss(); if (shareHousingResults != null && shareHousingResults.size() > 0) { ShareSpaceApplication.BUS.post(new ReturnSearchShareHousingResultEvent(shareHousingResults)); } else { ToastHelper.showCenterToast( getContext(), R.string.fragment_search_housing_input_data_not_found_matched_result, Toast.LENGTH_LONG ); } } @Override public void onSearchFailure(Throwable t) { RetrofitClient.showShareSpaceServerConnectionErrorDialog(getContext(), t); } } ); } else { ToastHelper.showCenterToast( getContext(), R.string.fragment_search_housing_input_data_search_error_missing_location, Toast.LENGTH_LONG ); } } }); return view; } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); mPlaceAutocompleteFragment.onActivityResult(requestCode, resultCode, data); // For Place Auto Complete Fragment' onPlaceSelected Callback to be called after User selected a Place // and Place Auto Complete Edit Text to be filled in. } }
UTF-8
Java
53,497
java
SearchShareHousingInputDataFragment.java
Java
[]
null
[]
package com.lmtri.sharespace.fragment.share.search; import android.app.ProgressDialog; import android.content.DialogInterface; import android.content.Intent; import android.graphics.PorterDuff; import android.os.Build; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.content.ContextCompat; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.SeekBar; import android.widget.Spinner; import android.widget.TextView; import android.widget.Toast; import com.google.android.gms.common.api.Status; import com.google.android.gms.location.places.AutocompleteFilter; import com.google.android.gms.location.places.Place; import com.google.android.gms.location.places.ui.PlaceSelectionListener; import com.google.android.gms.location.places.ui.SupportPlaceAutocompleteFragment; import com.lmtri.sharespace.R; import com.lmtri.sharespace.ShareSpaceApplication; import com.lmtri.sharespace.api.model.SearchShareHousingData; import com.lmtri.sharespace.api.model.ShareHousing; import com.lmtri.sharespace.api.service.RetrofitClient; import com.lmtri.sharespace.api.service.sharehousing.ShareHousingClient; import com.lmtri.sharespace.api.service.sharehousing.search.ISearchShareHousingCallback; import com.lmtri.sharespace.customview.CustomEditText; import com.lmtri.sharespace.helper.Constants; import com.lmtri.sharespace.helper.KeyboardHelper; import com.lmtri.sharespace.helper.ToastHelper; import com.lmtri.sharespace.helper.busevent.sharehousing.search.ReturnSearchShareHousingResultEvent; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** * A simple {@link Fragment} subclass. * Use the {@link SearchShareHousingInputDataFragment#newInstance} factory method to * create an instance of this fragment. */ public class SearchShareHousingInputDataFragment extends Fragment { public static final String TAG = SearchShareHousingInputDataFragment.class.getSimpleName(); private Toolbar mToolbar; private SupportPlaceAutocompleteFragment mPlaceAutocompleteFragment; private Place mSelectedPlace; private TextView mRadiusText; private SeekBar mRadiusBar; private int mRadiusInKm = Constants.SEARCH_HOUSING_INITIAL_RADIUS_IN_KM; private CustomEditText mInputKeywords; private LinearLayout mHouseTypeOption; private String[] mHouseTypeArray; private boolean[] mIsSelectedHouseTypeArray; private TextView mHouseTypesText; private List<Integer> mFullIntPriceList; private List<Integer> mMaxIntPriceList; private Spinner mMinPriceSpinner; private List<String> mMinStringPriceList; private ArrayAdapter<String> mMinPriceSpinnerAdapter; private Spinner mMaxPriceSpinner; private List<String> mMaxStringPriceList; private ArrayAdapter<String> mMaxPriceSpinnerAdapter; private List<Integer> mFullIntAreaList; private List<Integer> mMaxIntAreaList; private Spinner mMinAreaSpinner; private List<CharSequence> mMinStringAreaList; private ArrayAdapter<CharSequence> mMinAreaSpinnerAdapter; private Spinner mMaxAreaSpinner; private List<CharSequence> mMaxStringAreaList; private ArrayAdapter<CharSequence> mMaxAreaSpinnerAdapter; private LinearLayout mNumPeople; private int mSelectedNumPeople = 0; private LinearLayout mNumRoom; private int mSelectedNumRoom = 0; private LinearLayout mNumBed; private int mSelectedNumBed = 0; private LinearLayout mNumBath; private int mSelectedNumBath = 0; private LinearLayout mAmenitiesOption; private String[] mAmenityArray; private boolean[] mIsSelectedAmenityArray; private TextView mAmenitiesText; private List<Integer> mFullIntTimeRestrictionList; private List<Integer> mMaxIntTimeRestrictionList; private Spinner mMinTimeRestrictionSpinner; private List<String> mMinStringTimeRestrictionList; private ArrayAdapter<String> mMinTimeRestrictionSpinnerAdapter; private Spinner mMaxTimeRestrictionSpinner; private List<String> mMaxStringTimeRestrictionList; private ArrayAdapter<String> mMaxTimeRestrictionSpinnerAdapter; private LinearLayout mNumRoommate; private int mSelectedNumRoommate = 1; private Spinner mRequiredGenderSpinner; private Spinner mRequiredWorkTypeSpinner; private LinearLayout mOtherInfoOption; private String[] mOtherInfoArray; private boolean[] mIsSelectedOtherInfoArray; private TextView mOtherInfoText; private TextView mResetSearchingDataButton; private TextView mSearchButton; public SearchShareHousingInputDataFragment() { // Required empty public constructor } /** * Use this factory method to create a new instance of * this fragment using the provided parameters. * * @return A new instance of fragment SearchShareHousingInputDataFragment. */ // TODO: Rename and change types and number of parameters public static SearchShareHousingInputDataFragment newInstance() { SearchShareHousingInputDataFragment fragment = new SearchShareHousingInputDataFragment(); Bundle args = new Bundle(); fragment.setArguments(args); return fragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { } } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_search_share_housing_input_data, container, false); mToolbar = (Toolbar) view.findViewById(R.id.fragment_search_housing_input_data_toolbar); ((AppCompatActivity) getActivity()).setSupportActionBar(mToolbar); if (((AppCompatActivity) getActivity()).getSupportActionBar() != null) { ((AppCompatActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true); ((AppCompatActivity) getActivity()).getSupportActionBar().setDisplayShowTitleEnabled(false); } if (mToolbar.getNavigationIcon() != null) { mToolbar.getNavigationIcon().setColorFilter( ContextCompat.getColor(getContext(), android.R.color.white), PorterDuff.Mode.SRC_ATOP ); } mToolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { getActivity().finish(); getActivity().overridePendingTransition(R.anim.stay_still, R.anim.slide_down_out); } }); mPlaceAutocompleteFragment = (SupportPlaceAutocompleteFragment) getChildFragmentManager() .findFragmentById(R.id.fragment_search_housing_input_data_places_autocomplete_fragment); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { ((EditText) mPlaceAutocompleteFragment.getView().findViewById(R.id.place_autocomplete_search_input)).setTextAppearance(getContext(), android.R.style.TextAppearance_Medium); } else { ((EditText) mPlaceAutocompleteFragment.getView().findViewById(R.id.place_autocomplete_search_input)).setTextAppearance(android.R.style.TextAppearance_Medium); } mPlaceAutocompleteFragment.setOnPlaceSelectedListener(new PlaceSelectionListener() { @Override public void onPlaceSelected(Place place) { mSelectedPlace = place; } @Override public void onError(Status status) { } }); AutocompleteFilter filter = new AutocompleteFilter.Builder() .setCountry("VN") .build(); mPlaceAutocompleteFragment.setFilter(filter); mRadiusText = (TextView) view.findViewById(R.id.fragment_search_housing_input_data_radius); mRadiusText.setText(getString(R.string.fragment_search_housing_input_data_radius_section, Constants.SEARCH_HOUSING_INITIAL_RADIUS_IN_KM)); mRadiusBar = (SeekBar) view.findViewById(R.id.fragment_search_housing_input_data_radius_bar); mRadiusBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { if (fromUser) { mRadiusInKm = progress; mRadiusText.setText(getString(R.string.fragment_search_housing_input_data_radius_section, progress)); } } @Override public void onStartTrackingTouch(SeekBar seekBar) { KeyboardHelper.hideSoftKeyboard(getActivity(), false); } @Override public void onStopTrackingTouch(SeekBar seekBar) { } }); mRadiusBar.setMax(Constants.SEARCH_HOUSING_MAX_RADIUS_IN_KM); mRadiusBar.setProgress(Constants.SEARCH_HOUSING_INITIAL_RADIUS_IN_KM); mInputKeywords = (CustomEditText) view.findViewById(R.id.fragment_search_housing_input_data_key_word_input); mHouseTypeOption = (LinearLayout) view.findViewById(R.id.fragment_search_housing_input_data_house_type_layout); mHouseTypeOption.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { KeyboardHelper.hideSoftKeyboard(getActivity(), false); new AlertDialog.Builder(getContext()) .setTitle(R.string.fragment_search_housing_input_data_house_type_option_dialog_title) .setMultiChoiceItems(mHouseTypeArray, mIsSelectedHouseTypeArray, new DialogInterface.OnMultiChoiceClickListener() { @Override public void onClick(DialogInterface dialog, int which, boolean isChecked) { if (which != 0) { if (mIsSelectedHouseTypeArray[0]) { mIsSelectedHouseTypeArray[0] = false; ((AlertDialog) dialog).getListView().setItemChecked(0, false); } } else { for (int i = 0; i < mIsSelectedHouseTypeArray.length; ++i) { if (i != 0) { mIsSelectedHouseTypeArray[i] = false; ((AlertDialog) dialog).getListView().setItemChecked(i, false); } } } } }) .setPositiveButton(R.string.fragment_search_housing_input_data_house_type_option_dialog_positive, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { String houseTypes = ""; for (int i = 0; i < mIsSelectedHouseTypeArray.length; ++i) { if (mIsSelectedHouseTypeArray[i] == true) { houseTypes += mHouseTypeArray[i] + ", "; } } mHouseTypesText.setText(houseTypes.substring(0, houseTypes.length() - 2)); } }) .setNegativeButton(R.string.fragment_search_housing_input_data_house_type_option_dialog_negative, null) .show(); } }); mHouseTypeArray = getResources().getStringArray(R.array.fragment_search_housing_input_data_house_type_array); mIsSelectedHouseTypeArray = new boolean[mHouseTypeArray.length]; for (int i = 0; i < mIsSelectedHouseTypeArray.length; ++i) { mIsSelectedHouseTypeArray[i] = (i == 0) ? true : false; } mHouseTypesText = (TextView) view.findViewById(R.id.fragment_search_housing_input_data_house_types); mFullIntPriceList = new ArrayList<>(); mMaxIntPriceList = new ArrayList<>(); int[] fullIntPriceArray = getResources().getIntArray(R.array.fragment_search_housing_input_data_price_integer_array); for (int i = 0; i < fullIntPriceArray.length; ++i) { mFullIntPriceList.add(fullIntPriceArray[i]); mMaxIntPriceList.add(fullIntPriceArray[i]); } mMinPriceSpinner = (Spinner) view.findViewById(R.id.fragment_search_housing_input_data_min_price_per_month_of_one_spinner); mMinPriceSpinner.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { KeyboardHelper.hideSoftKeyboard(getActivity(), false); return false; } }); mMinPriceSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { if (position > 1) { int previousMaxPrice = mMaxIntPriceList.get(mMaxPriceSpinner.getSelectedItemPosition()); mMaxStringPriceList.clear(); mMaxStringPriceList.add(mMinStringPriceList.get(0)); mMaxStringPriceList.add(mMinStringPriceList.get(1)); mMaxIntPriceList.clear(); mMaxIntPriceList.add(mFullIntPriceList.get(0)); mMaxIntPriceList.add(mFullIntPriceList.get(1)); for (int i = position; i < mMinStringPriceList.size(); ++i) { mMaxStringPriceList.add(mMinStringPriceList.get(i)); mMaxIntPriceList.add(mFullIntPriceList.get(i)); } if (mFullIntPriceList.get(position) > previousMaxPrice) { mMaxPriceSpinnerAdapter.notifyDataSetChanged(); mMaxPriceSpinner.setSelection(0); } else { mMaxPriceSpinnerAdapter.notifyDataSetChanged(); } } else if (position == 1) { mMaxStringPriceList.clear(); mMaxStringPriceList.add(mMinStringPriceList.get(1)); mMaxIntPriceList.clear(); mMaxIntPriceList.add(mFullIntPriceList.get(1)); mMaxPriceSpinnerAdapter.notifyDataSetChanged(); mMaxPriceSpinner.setSelection(0); } else if (position == 0) { mMaxStringPriceList.clear(); mMaxIntPriceList.clear(); for (int i = 0; i < mMinStringPriceList.size(); ++i) { mMaxStringPriceList.add(mMinStringPriceList.get(i)); mMaxIntPriceList.add(mFullIntPriceList.get(i)); } mMaxPriceSpinnerAdapter.notifyDataSetChanged(); } } @Override public void onNothingSelected(AdapterView<?> parent) { } }); mMinStringPriceList = new ArrayList<>( Arrays.asList(getResources() .getStringArray(R.array.fragment_search_housing_input_data_price_array) ) ); mMinPriceSpinnerAdapter = new ArrayAdapter<>( getContext(), android.R.layout.simple_spinner_item, mMinStringPriceList ); mMinPriceSpinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mMinPriceSpinner.setAdapter(mMinPriceSpinnerAdapter); mMaxPriceSpinner = (Spinner) view.findViewById(R.id.fragment_search_housing_input_data_max_price_per_month_of_one_spinner); mMaxPriceSpinner.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { KeyboardHelper.hideSoftKeyboard(getActivity(), false); return false; } }); mMaxPriceSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { if (mMaxStringPriceList.size() > 1) { if (position == 1) { mMinPriceSpinner.setSelection(1); mMaxStringPriceList.clear(); mMaxStringPriceList.add(mMinStringPriceList.get(1)); mMaxIntPriceList.clear(); mMaxIntPriceList.add(mFullIntPriceList.get(1)); mMaxPriceSpinnerAdapter.notifyDataSetChanged(); } } } @Override public void onNothingSelected(AdapterView<?> parent) { } }); mMaxStringPriceList = new ArrayList<>( Arrays.asList(getResources() .getStringArray(R.array.fragment_search_housing_input_data_price_array) ) ); mMaxPriceSpinnerAdapter = new ArrayAdapter<>( getContext(), android.R.layout.simple_spinner_item, mMaxStringPriceList ); mMaxPriceSpinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mMaxPriceSpinner.setAdapter(mMaxPriceSpinnerAdapter); mFullIntAreaList = new ArrayList<>(); mMaxIntAreaList = new ArrayList<>(); int[] fullIntAreaArray = getResources().getIntArray(R.array.fragment_search_housing_input_data_area_integer_array); for (int i = 0; i < fullIntAreaArray.length; ++i) { mFullIntAreaList.add(fullIntAreaArray[i]); mMaxIntAreaList.add(fullIntAreaArray[i]); } mMinAreaSpinner = (Spinner) view.findViewById(R.id.fragment_search_housing_input_data_min_area_spinner); mMinAreaSpinner.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { KeyboardHelper.hideSoftKeyboard(getActivity(), false); return false; } }); mMinAreaSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { if (position > 0) { int previousMaxArea = mMaxIntAreaList.get(mMaxAreaSpinner.getSelectedItemPosition()); mMaxStringAreaList.clear(); mMaxStringAreaList.add(mMinStringAreaList.get(0)); mMaxIntAreaList.clear(); mMaxIntAreaList.add(mFullIntAreaList.get(0)); for (int i = position; i < mMinStringAreaList.size(); ++i) { mMaxStringAreaList.add(mMinStringAreaList.get(i)); mMaxIntAreaList.add(mFullIntAreaList.get(i)); } if (mFullIntAreaList.get(position) > previousMaxArea) { mMaxAreaSpinnerAdapter.notifyDataSetChanged(); mMaxAreaSpinner.setSelection(0); } else { mMaxAreaSpinnerAdapter.notifyDataSetChanged(); } } else if (position == 0) { mMaxStringAreaList.clear(); mMaxIntAreaList.clear(); for (int i = 0; i < mMinStringAreaList.size(); ++i) { mMaxStringAreaList.add(mMinStringAreaList.get(i)); mMaxIntAreaList.add(mFullIntAreaList.get(i)); } mMaxAreaSpinnerAdapter.notifyDataSetChanged(); } } @Override public void onNothingSelected(AdapterView<?> parent) { } }); mMinStringAreaList = new ArrayList<>(Arrays.asList( getResources() .getTextArray(R.array.fragment_search_housing_input_data_area_array) )); mMinAreaSpinnerAdapter = new ArrayAdapter<>( getContext(), android.R.layout.simple_spinner_item, mMinStringAreaList ); mMinAreaSpinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mMinAreaSpinner.setAdapter(mMinAreaSpinnerAdapter); mMaxAreaSpinner = (Spinner) view.findViewById(R.id.fragment_search_housing_input_data_max_area_spinner); mMaxAreaSpinner.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { KeyboardHelper.hideSoftKeyboard(getActivity(), false); return false; } }); mMaxStringAreaList = new ArrayList<>(Arrays.asList( getResources() .getTextArray(R.array.fragment_search_housing_input_data_area_array) )); mMaxAreaSpinnerAdapter = new ArrayAdapter<>( getContext(), android.R.layout.simple_spinner_item, mMaxStringAreaList ); mMaxAreaSpinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mMaxAreaSpinner.setAdapter(mMaxAreaSpinnerAdapter); mNumPeople = (LinearLayout) view.findViewById(R.id.fragment_search_housing_input_data_number_picker_num_people_layout); for (int i = 0; i < mNumPeople.getChildCount(); ++i) { mNumPeople.getChildAt(i).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { KeyboardHelper.hideSoftKeyboard(getActivity(), false); ((TextView) v).setTextColor(ContextCompat.getColor(getContext(), R.color.white)); v.setBackground(ContextCompat.getDrawable(getContext(), R.drawable.search_housing_square_option_border_primary_color_background)); int tag = Integer.parseInt((String) v.getTag()); mSelectedNumPeople = tag; for (int j = 0; j < mNumPeople.getChildCount(); ++j) { if (j != tag) { ((TextView) mNumPeople.getChildAt(j)).setTextColor(ContextCompat.getColor(getContext(), R.color.textColorSecondary)); mNumPeople.getChildAt(j).setBackground(ContextCompat.getDrawable(getContext(), R.drawable.search_housing_square_option_border)); } } } }); } mNumRoom = (LinearLayout) view.findViewById(R.id.fragment_search_housing_input_data_number_picker_num_room_layout); for (int i = 0; i < mNumRoom.getChildCount(); ++i) { mNumRoom.getChildAt(i).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { KeyboardHelper.hideSoftKeyboard(getActivity(), false); ((TextView) v).setTextColor(ContextCompat.getColor(getContext(), R.color.white)); v.setBackground(ContextCompat.getDrawable(getContext(), R.drawable.search_housing_square_option_border_primary_color_background)); int tag = Integer.parseInt((String) v.getTag()); mSelectedNumRoom = tag; for (int j = 0; j < mNumRoom.getChildCount(); ++j) { if (j != tag) { ((TextView) mNumRoom.getChildAt(j)).setTextColor(ContextCompat.getColor(getContext(), R.color.textColorSecondary));; mNumRoom.getChildAt(j).setBackground(ContextCompat.getDrawable(getContext(), R.drawable.search_housing_square_option_border)); } } } }); } mNumBed = (LinearLayout) view.findViewById(R.id.fragment_search_housing_input_data_number_picker_num_bed_layout); for (int i = 0; i < mNumBed.getChildCount(); ++i) { mNumBed.getChildAt(i).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { KeyboardHelper.hideSoftKeyboard(getActivity(), false); ((TextView) v).setTextColor(ContextCompat.getColor(getContext(), R.color.white)); v.setBackground(ContextCompat.getDrawable(getContext(), R.drawable.search_housing_square_option_border_primary_color_background)); int tag = Integer.parseInt((String) v.getTag()); mSelectedNumBed = tag; for (int j = 0; j < mNumBed.getChildCount(); ++j) { if (j != tag) { ((TextView) mNumBed.getChildAt(j)).setTextColor(ContextCompat.getColor(getContext(), R.color.textColorSecondary));; mNumBed.getChildAt(j).setBackground(ContextCompat.getDrawable(getContext(), R.drawable.search_housing_square_option_border)); } } } }); } mNumBath = (LinearLayout) view.findViewById(R.id.fragment_search_housing_input_data_number_picker_num_bath_layout); for (int i = 0; i < mNumBath.getChildCount(); ++i) { mNumBath.getChildAt(i).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { KeyboardHelper.hideSoftKeyboard(getActivity(), false); ((TextView) v).setTextColor(ContextCompat.getColor(getContext(), R.color.white)); v.setBackground(ContextCompat.getDrawable(getContext(), R.drawable.search_housing_square_option_border_primary_color_background)); int tag = Integer.parseInt((String) v.getTag()); mSelectedNumBath = tag; for (int j = 0; j < mNumBath.getChildCount(); ++j) { if (j != tag) { ((TextView) mNumBath.getChildAt(j)).setTextColor(ContextCompat.getColor(getContext(), R.color.textColorSecondary));; mNumBath.getChildAt(j).setBackground(ContextCompat.getDrawable(getContext(), R.drawable.search_housing_square_option_border)); } } } }); } mAmenitiesOption = (LinearLayout) view.findViewById(R.id.fragment_search_housing_input_data_amenities_layout); mAmenitiesOption.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { KeyboardHelper.hideSoftKeyboard(getActivity(), false); new AlertDialog.Builder(getContext()) .setTitle(R.string.fragment_search_housing_input_data_amenities_option_dialog_title) .setMultiChoiceItems(mAmenityArray, mIsSelectedAmenityArray, new DialogInterface.OnMultiChoiceClickListener() { @Override public void onClick(DialogInterface dialog, int which, boolean isChecked) { if (which != 0) { if (mIsSelectedAmenityArray[0]) { mIsSelectedAmenityArray[0] = false; ((AlertDialog) dialog).getListView().setItemChecked(0, false); } } else { for (int i = 0; i < mIsSelectedAmenityArray.length; ++i) { if (i != 0) { mIsSelectedAmenityArray[i] = false; ((AlertDialog) dialog).getListView().setItemChecked(i, false); } } } } }) .setPositiveButton(R.string.fragment_search_housing_input_data_amenities_option_dialog_positive, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { String amenities = ""; for (int i = 0; i < mIsSelectedAmenityArray.length; ++i) { if (mIsSelectedAmenityArray[i] == true) { amenities += mAmenityArray[i] + ", "; } } mAmenitiesText.setText(amenities.substring(0, amenities.length() - 2)); } }) .setNegativeButton(R.string.fragment_search_housing_input_data_amenities_option_dialog_negative, null) .show(); } }); mAmenityArray = getResources().getStringArray(R.array.fragment_search_housing_input_data_amenity_array); mIsSelectedAmenityArray = new boolean[mAmenityArray.length]; for (int i = 0; i < mIsSelectedAmenityArray.length; ++i) { mIsSelectedAmenityArray[i] = (i == 0) ? true : false; } mAmenitiesText = (TextView) view.findViewById(R.id.fragment_search_housing_input_data_amenities); mFullIntTimeRestrictionList = new ArrayList<>(); mMaxIntTimeRestrictionList = new ArrayList<>(); int[] fullIntTimeRestrictionArray = getResources().getIntArray(R.array.fragment_search_housing_input_data_time_restriction_integer_array); for (int i = 0; i < fullIntTimeRestrictionArray.length; ++i) { mFullIntTimeRestrictionList.add(fullIntTimeRestrictionArray[i]); mMaxIntTimeRestrictionList.add(fullIntTimeRestrictionArray[i]); } mMinTimeRestrictionSpinner = (Spinner) view.findViewById(R.id.fragment_search_housing_input_data_min_time_restriction_spinner); mMinTimeRestrictionSpinner.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { KeyboardHelper.hideSoftKeyboard(getActivity(), false); return false; } }); mMinTimeRestrictionSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { if (position > 0) { int previousMaxTimeRestriction = mMaxIntTimeRestrictionList.get(mMaxTimeRestrictionSpinner.getSelectedItemPosition()); mMaxStringTimeRestrictionList.clear(); mMaxStringTimeRestrictionList.add(mMinStringTimeRestrictionList.get(0)); mMaxIntTimeRestrictionList.clear(); mMaxIntTimeRestrictionList.add(mFullIntTimeRestrictionList.get(0)); for (int i = position; i < mMinStringTimeRestrictionList.size(); ++i) { mMaxStringTimeRestrictionList.add(mMinStringTimeRestrictionList.get(i)); mMaxIntTimeRestrictionList.add(mFullIntTimeRestrictionList.get(i)); } if (mFullIntTimeRestrictionList.get(position) > previousMaxTimeRestriction) { mMaxTimeRestrictionSpinnerAdapter.notifyDataSetChanged(); mMaxTimeRestrictionSpinner.setSelection(0); } else { mMaxTimeRestrictionSpinnerAdapter.notifyDataSetChanged(); } } else if (position == 0) { mMaxStringTimeRestrictionList.clear(); mMaxIntTimeRestrictionList.clear(); for (int i = 0; i < mMinStringTimeRestrictionList.size(); ++i) { mMaxStringTimeRestrictionList.add(mMinStringTimeRestrictionList.get(i)); mMaxIntTimeRestrictionList.add(mFullIntTimeRestrictionList.get(i)); } mMaxTimeRestrictionSpinnerAdapter.notifyDataSetChanged(); } } @Override public void onNothingSelected(AdapterView<?> parent) { } }); mMinStringTimeRestrictionList = new ArrayList<>( Arrays.asList(getResources() .getStringArray(R.array.fragment_search_housing_input_data_time_restriction_array) ) ); mMinTimeRestrictionSpinnerAdapter = new ArrayAdapter<>( getContext(), android.R.layout.simple_spinner_item, mMinStringTimeRestrictionList ); mMinTimeRestrictionSpinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mMinTimeRestrictionSpinner.setAdapter(mMinTimeRestrictionSpinnerAdapter); mMaxTimeRestrictionSpinner = (Spinner) view.findViewById(R.id.fragment_search_housing_input_data_max_time_restriction_spinner); mMaxTimeRestrictionSpinner.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { KeyboardHelper.hideSoftKeyboard(getActivity(), false); return false; } }); mMaxStringTimeRestrictionList = new ArrayList<>( Arrays.asList(getResources() .getStringArray(R.array.fragment_search_housing_input_data_time_restriction_array) ) ); mMaxTimeRestrictionSpinnerAdapter = new ArrayAdapter<>( getContext(), android.R.layout.simple_spinner_item, mMaxStringTimeRestrictionList ); mMaxTimeRestrictionSpinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mMaxTimeRestrictionSpinner.setAdapter(mMaxTimeRestrictionSpinnerAdapter); mNumRoommate = (LinearLayout) view.findViewById(R.id.fragment_search_share_housing_input_data_number_picker_num_roommate_layout); for (int i = 0; i < mNumRoommate.getChildCount(); ++i) { mNumRoommate.getChildAt(i).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { KeyboardHelper.hideSoftKeyboard(getActivity(), false); ((TextView) v).setTextColor(ContextCompat.getColor(getContext(), R.color.white)); v.setBackground(ContextCompat.getDrawable(getContext(), R.drawable.search_housing_square_option_border_primary_color_background)); int tag = Integer.parseInt((String) v.getTag()); mSelectedNumRoommate = tag; for (int j = 0; j < mNumRoommate.getChildCount(); ++j) { if (j != tag - 1) { // tag = [1, 5] ((TextView) mNumRoommate.getChildAt(j)).setTextColor(ContextCompat.getColor(getContext(), R.color.textColorSecondary));; mNumRoommate.getChildAt(j).setBackground(ContextCompat.getDrawable(getContext(), R.drawable.search_housing_square_option_border)); } } } }); } mRequiredGenderSpinner = (Spinner) view.findViewById(R.id.fragment_search_share_housing_input_data_required_gender_spinner); mRequiredGenderSpinner.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { KeyboardHelper.hideSoftKeyboard(getActivity(), false); return false; } }); mRequiredWorkTypeSpinner = (Spinner) view.findViewById(R.id.fragment_search_share_housing_input_data_required_work_type_spinner); mRequiredWorkTypeSpinner.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { KeyboardHelper.hideSoftKeyboard(getActivity(), false); return false; } }); mOtherInfoOption = (LinearLayout) view.findViewById(R.id.fragment_search_housing_input_data_other_info_layout); mOtherInfoOption.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { KeyboardHelper.hideSoftKeyboard(getActivity(), false); new AlertDialog.Builder(getContext()) .setTitle(R.string.fragment_search_housing_input_data_house_type_option_dialog_title) .setMultiChoiceItems(mOtherInfoArray, mIsSelectedOtherInfoArray, new DialogInterface.OnMultiChoiceClickListener() { @Override public void onClick(DialogInterface dialog, int which, boolean isChecked) { if (which != 0) { if (mIsSelectedOtherInfoArray[0]) { mIsSelectedOtherInfoArray[0] = false; ((AlertDialog) dialog).getListView().setItemChecked(0, false); } } else { for (int i = 0; i < mIsSelectedOtherInfoArray.length; ++i) { if (i != 0) { mIsSelectedOtherInfoArray[i] = false; ((AlertDialog) dialog).getListView().setItemChecked(i, false); } } } } }) .setPositiveButton(R.string.fragment_search_housing_input_data_house_type_option_dialog_positive, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { String otherInfo = ""; for (int i = 0; i < mIsSelectedOtherInfoArray.length; ++i) { if (mIsSelectedOtherInfoArray[i] == true) { otherInfo += mOtherInfoArray[i] + ", "; } } mOtherInfoText.setText(otherInfo.substring(0, otherInfo.length() - 2)); } }) .setNegativeButton(R.string.fragment_search_housing_input_data_house_type_option_dialog_negative, null) .show(); } }); mOtherInfoArray = getResources().getStringArray(R.array.fragment_search_share_housing_input_data_other_info_array); mIsSelectedOtherInfoArray = new boolean[mOtherInfoArray.length]; for (int i = 0; i < mIsSelectedOtherInfoArray.length; ++i) { mIsSelectedOtherInfoArray[i] = (i == 0) ? true : false; } mOtherInfoText = (TextView) view.findViewById(R.id.fragment_search_housing_input_data_other_info); mResetSearchingDataButton = (TextView) view.findViewById(R.id.fragment_search_housing_input_data_search_bar_reset_searching_data); mResetSearchingDataButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { KeyboardHelper.hideSoftKeyboard(getActivity(), false); ((EditText) mPlaceAutocompleteFragment.getView().findViewById(R.id.place_autocomplete_search_input)).setText(""); mSelectedPlace = null; mRadiusBar.setProgress(Constants.SEARCH_HOUSING_INITIAL_RADIUS_IN_KM); mRadiusInKm = Constants.SEARCH_HOUSING_INITIAL_RADIUS_IN_KM; mRadiusText.setText(getString(R.string.fragment_search_housing_input_data_radius_section, mRadiusInKm)); mInputKeywords.setText(""); for (int i = 0; i < mIsSelectedHouseTypeArray.length; ++i) { mIsSelectedHouseTypeArray[i] = (i == 0) ? true : false; } mHouseTypesText.setText(mHouseTypeArray[0]); mMinPriceSpinner.setSelection(0); mMaxStringPriceList.clear(); mMaxIntPriceList.clear(); for (int i = 0; i < mMinStringPriceList.size(); ++i) { mMaxStringPriceList.add(mMinStringPriceList.get(i)); mMaxIntPriceList.add(mFullIntPriceList.get(i)); } mMaxPriceSpinnerAdapter.notifyDataSetChanged(); mMaxPriceSpinner.setSelection(0); mMinAreaSpinner.setSelection(0); mMaxStringAreaList.clear(); mMaxIntAreaList.clear(); for (int i = 0; i < mMinStringAreaList.size(); ++i) { mMaxStringAreaList.add(mMinStringAreaList.get(i)); mMaxIntAreaList.add(mFullIntAreaList.get(i)); } mMaxAreaSpinnerAdapter.notifyDataSetChanged(); mMaxAreaSpinner.setSelection(0); mSelectedNumPeople = 0; for (int i = 0; i < mNumPeople.getChildCount(); ++i) { if (i == 0) { ((TextView) mNumPeople.getChildAt(i)).setTextColor(ContextCompat.getColor(getContext(), R.color.white)); mNumPeople.getChildAt(i).setBackground(ContextCompat.getDrawable(getContext(), R.drawable.search_housing_square_option_border_primary_color_background)); } else { ((TextView) mNumPeople.getChildAt(i)).setTextColor(ContextCompat.getColor(getContext(), R.color.textColorSecondary)); mNumPeople.getChildAt(i).setBackground(ContextCompat.getDrawable(getContext(), R.drawable.search_housing_square_option_border)); } } mSelectedNumRoom = 0; for (int i = 0; i < mNumRoom.getChildCount(); ++i) { if (i == 0) { ((TextView) mNumRoom.getChildAt(i)).setTextColor(ContextCompat.getColor(getContext(), R.color.white)); mNumRoom.getChildAt(i).setBackground(ContextCompat.getDrawable(getContext(), R.drawable.search_housing_square_option_border_primary_color_background)); } else { ((TextView) mNumRoom.getChildAt(i)).setTextColor(ContextCompat.getColor(getContext(), R.color.textColorSecondary)); mNumRoom.getChildAt(i).setBackground(ContextCompat.getDrawable(getContext(), R.drawable.search_housing_square_option_border)); } } mSelectedNumBed = 0; for (int i = 0; i < mNumBed.getChildCount(); ++i) { if (i == 0) { ((TextView) mNumBed.getChildAt(i)).setTextColor(ContextCompat.getColor(getContext(), R.color.white)); mNumBed.getChildAt(i).setBackground(ContextCompat.getDrawable(getContext(), R.drawable.search_housing_square_option_border_primary_color_background)); } else { ((TextView) mNumBed.getChildAt(i)).setTextColor(ContextCompat.getColor(getContext(), R.color.textColorSecondary)); mNumBed.getChildAt(i).setBackground(ContextCompat.getDrawable(getContext(), R.drawable.search_housing_square_option_border)); } } mSelectedNumBath = 0; for (int i = 0; i < mNumBath.getChildCount(); ++i) { if (i == 0) { ((TextView) mNumBath.getChildAt(i)).setTextColor(ContextCompat.getColor(getContext(), R.color.white)); mNumBath.getChildAt(i).setBackground(ContextCompat.getDrawable(getContext(), R.drawable.search_housing_square_option_border_primary_color_background)); } else { ((TextView) mNumBath.getChildAt(i)).setTextColor(ContextCompat.getColor(getContext(), R.color.textColorSecondary)); mNumBath.getChildAt(i).setBackground(ContextCompat.getDrawable(getContext(), R.drawable.search_housing_square_option_border)); } } for (int i = 0; i < mIsSelectedAmenityArray.length; ++i) { mIsSelectedAmenityArray[i] = (i == 0) ? true : false; } mAmenitiesText.setText(mAmenityArray[0]); mMinTimeRestrictionSpinner.setSelection(0); mMaxStringTimeRestrictionList.clear(); mMaxIntTimeRestrictionList.clear(); for (int i = 0; i < mMinStringTimeRestrictionList.size(); ++i) { mMaxStringTimeRestrictionList.add(mMinStringTimeRestrictionList.get(i)); mMaxIntTimeRestrictionList.add(mFullIntTimeRestrictionList.get(i)); } mMaxTimeRestrictionSpinnerAdapter.notifyDataSetChanged(); mMaxTimeRestrictionSpinner.setSelection(0); mSelectedNumRoommate = 1; for (int i = 0; i < mNumRoommate.getChildCount(); ++i) { if (i == 0) { ((TextView) mNumRoommate.getChildAt(i)).setTextColor(ContextCompat.getColor(getContext(), R.color.white)); mNumRoommate.getChildAt(i).setBackground(ContextCompat.getDrawable(getContext(), R.drawable.search_housing_square_option_border_primary_color_background)); } else { ((TextView) mNumRoommate.getChildAt(i)).setTextColor(ContextCompat.getColor(getContext(), R.color.textColorSecondary)); mNumRoommate.getChildAt(i).setBackground(ContextCompat.getDrawable(getContext(), R.drawable.search_housing_square_option_border)); } } } }); mSearchButton = (TextView) view.findViewById(R.id.fragment_search_housing_input_data_search_bar_search); mSearchButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { KeyboardHelper.hideSoftKeyboard(getActivity(), false); if (mSelectedPlace != null) { BigDecimal latitude = BigDecimal.valueOf(mSelectedPlace.getLatLng().latitude); BigDecimal longitude = BigDecimal.valueOf(mSelectedPlace.getLatLng().longitude); int minPricePerMonthOfOne = mFullIntPriceList.get(mMinPriceSpinner.getSelectedItemPosition()); int maxPricePerMonthOfOne = mMaxIntPriceList.get(mMaxPriceSpinner.getSelectedItemPosition()); int minArea = mFullIntAreaList.get(mMinAreaSpinner.getSelectedItemPosition()); int maxArea = mMaxIntAreaList.get(mMaxAreaSpinner.getSelectedItemPosition()); String minTimeRestriction = mMinStringTimeRestrictionList .get(mMinTimeRestrictionSpinner.getSelectedItemPosition()); String maxTimeRestriction = mMaxStringTimeRestrictionList .get(mMaxTimeRestrictionSpinner.getSelectedItemPosition()); SearchShareHousingData searchHousingData = new SearchShareHousingData( latitude, longitude, mRadiusInKm * 1000, mInputKeywords.getText().toString(), mIsSelectedHouseTypeArray, minPricePerMonthOfOne, maxPricePerMonthOfOne, minArea, maxArea, mSelectedNumPeople == 0 ? -1 : mSelectedNumPeople, mSelectedNumRoom == 0 ? -1 : mSelectedNumRoom, mSelectedNumBed == 0 ? -1 : mSelectedNumBed, mSelectedNumBath == 0 ? -1 : mSelectedNumBath, mIsSelectedAmenityArray, minTimeRestriction .equalsIgnoreCase(getString(R.string.fragment_search_housing_input_data_time_restriction_any)) ? "" : minTimeRestriction, maxTimeRestriction .equalsIgnoreCase(getString(R.string.fragment_search_housing_input_data_time_restriction_any)) ? "" : maxTimeRestriction, mSelectedNumRoommate, mRequiredGenderSpinner.getSelectedItem().toString(), mRequiredWorkTypeSpinner.getSelectedItem().toString(), mIsSelectedOtherInfoArray ); final ProgressDialog progressDialog = new ProgressDialog(getContext(), R.style.LoginProgressDialog); progressDialog.setIndeterminate(true); progressDialog.setMessage(getString(R.string.fragment_search_housing_input_data_searching)); progressDialog.setCanceledOnTouchOutside(false); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { progressDialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent); } progressDialog.show(); ShareHousingClient.searchShareHousing( searchHousingData, new ISearchShareHousingCallback() { @Override public void onSearchComplete(List<ShareHousing> shareHousingResults) { progressDialog.dismiss(); if (shareHousingResults != null && shareHousingResults.size() > 0) { ShareSpaceApplication.BUS.post(new ReturnSearchShareHousingResultEvent(shareHousingResults)); } else { ToastHelper.showCenterToast( getContext(), R.string.fragment_search_housing_input_data_not_found_matched_result, Toast.LENGTH_LONG ); } } @Override public void onSearchFailure(Throwable t) { RetrofitClient.showShareSpaceServerConnectionErrorDialog(getContext(), t); } } ); } else { ToastHelper.showCenterToast( getContext(), R.string.fragment_search_housing_input_data_search_error_missing_location, Toast.LENGTH_LONG ); } } }); return view; } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); mPlaceAutocompleteFragment.onActivityResult(requestCode, resultCode, data); // For Place Auto Complete Fragment' onPlaceSelected Callback to be called after User selected a Place // and Place Auto Complete Edit Text to be filled in. } }
53,497
0.581902
0.579453
966
54.379917
39.294735
190
false
false
0
0
0
0
0
0
0.718427
false
false
5
9a1dbd464cdf3e2f993345782678b4d977fdc513
24,412,594,161,914
ccdbf9c70e6190f474b7f20286124a953c4aa742
/Timetable/app/src/main/java/com/hs5233/timetable/Other.java
c46f0aa8f29338146bd4b0151456c333f18f2194
[]
no_license
HS5233/Timetable
https://github.com/HS5233/Timetable
2c257b9ff45ee03039ac02844584281e45957f2f
f114d0b97365e991ed3edc12d38cda87448188d4
refs/heads/master
"2021-01-13T07:00:45.060000"
"2017-02-09T07:33:38"
"2017-02-09T07:33:38"
81,422,430
7
2
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.hs5233.timetable; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; public class Other extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_other); init(); } private void init(){ Button timetable = (Button)findViewById(R.id.button); timetable.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); final Button scoresInfo = (Button)findViewById(R.id.button3); scoresInfo.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent _intent = new Intent(Other.this,scoresInfo.class); startActivity(_intent); } }); final Button examInfo = (Button)findViewById(R.id.button4); examInfo.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent _intent = new Intent(Other.this,examInfo.class); startActivity(_intent); } }); } }
UTF-8
Java
1,381
java
Other.java
Java
[]
null
[]
package com.hs5233.timetable; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; public class Other extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_other); init(); } private void init(){ Button timetable = (Button)findViewById(R.id.button); timetable.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); final Button scoresInfo = (Button)findViewById(R.id.button3); scoresInfo.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent _intent = new Intent(Other.this,scoresInfo.class); startActivity(_intent); } }); final Button examInfo = (Button)findViewById(R.id.button4); examInfo.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent _intent = new Intent(Other.this,examInfo.class); startActivity(_intent); } }); } }
1,381
0.611151
0.606083
42
31.880953
22.250952
73
false
false
0
0
0
0
0
0
0.52381
false
false
5
6c43195bc0d11c9dfcc6b95dc8fc8eb92f3c3e55
20,014,547,652,476
2c28bceb15a708ddbc2e103a3344b3bab3e40cd0
/ft_login/src/main/java/com/wl/ft_login/FtLoginModel.java
4113974dc04b47bbc488439f20bf00d902660a00
[]
no_license
yaotai/Tracking
https://github.com/yaotai/Tracking
14ed894e83936fb9e5b23519f4ef1f6dc143ba03
84ff36349c83778c56bdad1a8336a872bfb956ef
refs/heads/main
"2023-04-10T05:01:52.106000"
"2021-04-21T09:11:16"
"2021-04-21T09:11:16"
360,101,586
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.wl.ft_login; import com.wl.lib_http.ApiManager; import retrofit2.Call; import rx.Observable; public class FtLoginModel implements FtLoginLoginContract.Model{ @Override public Observable<String> getAuthorize(String userName) { // Call<String> call= ApiManager.l().createApiService(null,ILoginService.class).getAuthorize(client_id,response_type,redirect_uri); return Observable.just(userName); } }
UTF-8
Java
440
java
FtLoginModel.java
Java
[]
null
[]
package com.wl.ft_login; import com.wl.lib_http.ApiManager; import retrofit2.Call; import rx.Observable; public class FtLoginModel implements FtLoginLoginContract.Model{ @Override public Observable<String> getAuthorize(String userName) { // Call<String> call= ApiManager.l().createApiService(null,ILoginService.class).getAuthorize(client_id,response_type,redirect_uri); return Observable.just(userName); } }
440
0.754545
0.752273
16
26.5
35.494717
138
false
false
0
0
0
0
0
0
0.5625
false
false
5
55423b39158ff92ffbcec1e8d0ee55e31b92de2f
31,774,168,115,000
1a4fe74b9561bdae43e3e7166107a6f81b552cc9
/src/main/java/com/github/dennyphilipp/api/ApiApplication.java
ab5b87c090fcd00d7bcac8186c565e54602c186b
[]
no_license
dennyphilipp/java-api-estados
https://github.com/dennyphilipp/java-api-estados
43f77db77455243cec6cc25dd6b0c4043e495176
58e2bf3348f3c801b08ce605be5e38445b3d06c3
refs/heads/master
"2022-11-28T10:01:44.563000"
"2020-08-11T18:50:35"
"2020-08-11T18:50:35"
285,674,796
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.github.dennyphilipp.api; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.openfeign.EnableFeignClients; @EnableFeignClients(basePackages = {"com.github.dennyphilipp.terceiro"}) @SpringBootApplication(scanBasePackages = { "com.github.dennyphilipp" }) class ApiApplication { public static void main(String[] args) { SpringApplication.run(ApiApplication.class, args); } }
UTF-8
Java
564
java
ApiApplication.java
Java
[ { "context": "package com.github.dennyphilipp.api;\n\nimport org.springframework.boot.SpringAppli", "end": 31, "score": 0.9994257092475891, "start": 19, "tag": "USERNAME", "value": "dennyphilipp" }, { "context": "\n\n@EnableFeignClients(basePackages = {\"com.github.dennyphilipp.terceiro\"})\n@SpringBootApplication(scanBasePackag", "end": 353, "score": 0.9994584918022156, "start": 341, "tag": "USERNAME", "value": "dennyphilipp" }, { "context": "gBootApplication(scanBasePackages = { \"com.github.dennyphilipp\" })\nclass ApiApplication {\n\n\tpublic static void m", "end": 434, "score": 0.9995155334472656, "start": 422, "tag": "USERNAME", "value": "dennyphilipp" } ]
null
[]
package com.github.dennyphilipp.api; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.openfeign.EnableFeignClients; @EnableFeignClients(basePackages = {"com.github.dennyphilipp.terceiro"}) @SpringBootApplication(scanBasePackages = { "com.github.dennyphilipp" }) class ApiApplication { public static void main(String[] args) { SpringApplication.run(ApiApplication.class, args); } }
564
0.828014
0.828014
16
34.25
29.194391
72
false
false
0
0
0
0
0
0
0.6875
false
false
5
a58fcef885a976ce12c00678263999703b522f1b
12,266,426,627,933
54c7ee818661ab92c81b012ca2291585c0d4372e
/cobranzaTricar/src/java/Bean/ventaBean.java
ad50709c80d51d4308b401594decde47bcb4774f
[]
no_license
Tricar/py_cobranzas
https://github.com/Tricar/py_cobranzas
64d90800627c02f4f1c42ab4877c32dfde02db62
b568d586543130606a6c038afb32a37cb6ea0fa3
refs/heads/master
"2021-04-19T01:17:12.655000"
"2017-08-09T23:01:45"
"2017-08-09T23:01:45"
39,257,698
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Bean; import Dao.AnexoDao; import Dao.AnexoDaoImplements; import Dao.ConceptosDao; import Dao.ConceptosDaoImp; import Dao.CredavalDao; import Dao.CredavalDaoImp; import Dao.CreditoDao; import Dao.CreditoDaoImp; import Dao.LetrasDao; import Dao.LetrasDaoImplements; import Dao.VehiculoDao; import Dao.VehiculoDaoImplements; import Model.Anexo; import Model.Conceptos; import Model.Credito; import Model.Creditoaval; import Model.Creditogestor; import Model.Letras; import Model.Modelo; import Model.Ocupacion; import Model.Pagos; import Model.Usuario; import Model.Vehiculo; import Persistencia.HibernateUtil; import java.io.File; import java.io.IOException; import java.io.Serializable; import java.math.BigDecimal; import java.sql.Connection; import java.sql.SQLException; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.faces.application.FacesMessage; import javax.faces.bean.ManagedBean; import javax.faces.bean.SessionScoped; import javax.faces.context.FacesContext; import javax.naming.NamingException; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import net.sf.jasperreports.engine.JRException; import net.sf.jasperreports.engine.JRExporterParameter; import net.sf.jasperreports.engine.JasperExportManager; import net.sf.jasperreports.engine.JasperFillManager; import net.sf.jasperreports.engine.JasperPrint; import net.sf.jasperreports.engine.export.JRXlsExporter; import net.sf.jasperreports.engine.export.ooxml.JRXlsxExporter; import org.apache.commons.lang3.StringUtils; import org.hibernate.Session; import org.hibernate.Transaction; import org.primefaces.context.RequestContext; import utiles.dbManager; import utiles.precio; @ManagedBean @SessionScoped public class ventaBean implements Serializable { private Session session; private Transaction transaction; public Anexo anexo = new Anexo(); private String razonsocial; public Credito credito = new Credito(); public List<Credito> creditos = new ArrayList(); public List<Letras> letraslista = new ArrayList(); private List<Anexo> avales = new ArrayList(); public List<Credito> filtradafecha; private BigDecimal precio; private List<Ocupacion> ocupsxanexo = new ArrayList(); private ocupacionBean ocupbean = new ocupacionBean(); private int sw = 0; private String codigo; private String tipo; private boolean value; private boolean value2; private boolean valuei2; private boolean valuesi; private boolean valuesi2; private String btnaprobar; private String btnguardar; private List<Modelo> listafiltrada; private List<Pagos> pagosxcredito; private List<Ocupacion> ocupsxcredito; private modeloBean modbean = new modeloBean(); private Conceptos concepto = new Conceptos(); public Vehiculo vehiculo = new Vehiculo(); private String numdigitos; public ventaBean() { } public String venta() { creditos = new ArrayList(); letraslista = new ArrayList(); filtradafecha = new ArrayList(); codigo = ""; return "/despacho/venta.xhtml"; } public void nuevoanexo() { anexo = new Anexo(); RequestContext.getCurrentInstance().update("formInsertar"); RequestContext.getCurrentInstance().execute("PF('dlginsert').show()"); } public void modeloTipo(String tipo) { listafiltrada = modbean.modeloTipo(tipo); } public boolean disableGuardar() { if (sw == 1) { return true; } return false; } public void cargarxCodigoVenta() { creditos = new ArrayList(); letraslista = new ArrayList(); CreditoDao creditodao = new CreditoDaoImp(); Credito modelocredito = new Credito(); try { modelocredito = creditodao.cargarxCodigoVenta(codigo, "CO", "CD"); creditos.add(modelocredito); if (creditos.get(0) == null) { creditos = null; } } catch (Exception e) { } codigo = ""; } public void precioModeloVenta() { precio Precio = new precio(); precio = (Precio.precioModelo(credito.getModelo().getModelo())); } public String indexventa() { creditos = new ArrayList(); letraslista = new ArrayList(); filtradafecha = new ArrayList(); return "/despacho/venta.xhtml"; } public void actualizarCampos(String tipodoc) { if (tipodoc.equals("DNI")) { numdigitos = "99999999"; } else { numdigitos = "99999999999"; } System.out.println("ejecuté campos"); } public String nuevo() { credito = new Credito(); value2 = true; sw = 0; value = false; valuei2 = true; valuesi = false; valuesi2 = false; btnaprobar = "Aprobar"; btnguardar = "Guardar"; ocupsxanexo = new ArrayList(); return "/despacho/form.xhtml"; } public void insertarcliente() { this.session = null; this.transaction = null; try { this.session = HibernateUtil.getSessionFactory().openSession(); this.transaction = session.beginTransaction(); AnexoDao daotanexo = new AnexoDaoImplements(); List<Anexo> clientes = new ArrayList(); clientes = daotanexo.ListaConDocumento(this.session, anexo.getNumdocumento()); boolean valida = false; if (this.razonsocial != null) { this.anexo.setNombre(this.razonsocial); this.anexo.setApemat(""); this.anexo.setApepat(""); } if (this.anexo.getTipodocumento().equals("DNI")) { this.anexo.setTipoanexo("CN"); } else { this.anexo.setTipoanexo("CJ"); } for (int i = 0; i < clientes.size(); i++) { Anexo get = clientes.get(i); if ((get != null) && (get.getTipoanexo().equals(anexo.getTipoanexo()))) { valida = true; } } if (valida) { FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Error", "El Anexo ya existe en la Base de Datos.")); this.anexo = new Anexo(); return; } Date d = new Date(); this.anexo.setFechareg(d); this.anexo.setFechanac(d); this.anexo.setEdad(0); this.anexo.setEstcivil("SO"); this.anexo.setCpropia("NO"); this.anexo.setCodven(""); daotanexo.registrar(this.session, this.anexo); this.transaction.commit(); FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Correcto", "El registro fue satisfactorio.")); this.anexo = new Anexo(); RequestContext.getCurrentInstance().update("frmRealizarVentas"); RequestContext.getCurrentInstance().execute("PF('dlginsert').hide()"); } catch (Exception e) { if (this.transaction != null) { this.transaction.rollback(); } FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_FATAL, "Error Fatal:", "Por favor contacte con su administrador " + e.getMessage())); this.anexo = new Anexo(); } finally { if (this.session != null) { this.session.close(); } } razonsocial = null; } public void insertarVenta(Usuario usuario) { CreditoDao creditodao = new CreditoDaoImp(); ConceptosDao condao = new ConceptosDaoImp(); VehiculoDao vehidao = new VehiculoDaoImplements(); if (creditodao.veryLiqventa(this.credito.getLiqventa()) != null) { FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Error", "El código de venta ya existe.")); } else { if (sw == 0) { try { credito.setTotaldeuda(BigDecimal.ZERO); credito.setDeudactual(BigDecimal.ZERO); credito.setCondicionpago("CO"); credito.setEstado("AP"); credito.setEmpresa("CA"); credito.setCalificacion("PN"); credito.setSwinicial(false); credito.setInicial(credito.getPrecio()); credito.setSaldo(BigDecimal.ZERO); credito.setElaborado(usuario.getAnexo().getIdanexo()); creditodao.insertarVenta(credito); concepto.setMontopago(credito.getInicial()); concepto.setTipo("CO"); concepto.setTotal(credito.getInicial()); concepto.setFecreg(credito.getFechareg()); concepto.setCobrado(false); concepto.setCredito(credito); condao.insertarConcepto(concepto); vehiculo = credito.getVehiculo(); vehiculo.setEstado('N'); vehidao.modificarVehiculo(vehiculo); sw = 1; FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Correcto", "La venta se registró correctamente.")); } catch (Exception e) { } } else { if (sw == 1) { btnaprobar = "Desaprobar"; FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error", "Este crédito ya ha sido registrado")); return; } } } } public void eliminar() { CreditoDao creditodao = new CreditoDaoImp(); LetrasDao letrasdao = new LetrasDaoImplements(); Vehiculo vehiculo = new Vehiculo(); if (credito.getEstado().equals("EM")) { creditodao.eliminarVenta(credito); ocupsxanexo = ocupbean.cargarxCredito(credito); for (int i = 0; i < ocupsxanexo.size(); i++) { Ocupacion get = ocupsxanexo.get(i); ocupbean.eliminar(get); } } else { FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error", "Este crédito ya ha sido procesado. No se puede eliminar.")); return; } credito = new Credito(); creditos = new ArrayList(); } public void exportarFormato(String codigo, String tipo, String estado) throws JRException, NamingException, SQLException, IOException { dbManager conn = new dbManager(); Connection con = null; con = conn.getConnection(); Credito cred = new Credito(); CreditoDao credao = new CreditoDaoImp(); cred = credao.veryLiqventa(codigo); CredavalDao linkdao = new CredavalDaoImp(); List<Creditoaval> listafiltrada = new ArrayList(); avales = new ArrayList(); String naval1 = null; String dniaval1 = null; String naval2 = null; String dniaval2 = null; try { listafiltrada = linkdao.avales(cred); for (int i = 0; i < listafiltrada.size(); i++) { Creditoaval get = listafiltrada.get(i); avales.add(get.getAnexo()); } if (avales.size() >= 0) { naval1 = avales.get(0).getNombre().concat(" ").concat(avales.get(0).getApepat()).concat(" ").concat(avales.get(0).getApemat()); dniaval1 = avales.get(0).getNumdocumento(); naval2 = avales.get(1).getNombre().concat(" ").concat(avales.get(1).getApepat()).concat(" ").concat(avales.get(1).getApemat()); dniaval2 = avales.get(1).getNumdocumento(); } } catch (Exception e) { } if (naval1 == null) { naval1 = " "; } if (dniaval1 == null) { dniaval1 = " "; } if (naval2 == null) { naval2 = " "; } if (dniaval2 == null) { dniaval2 = " "; } Map<String, Object> parametros = new HashMap<String, Object>(); if (estado.equals("DP")) { if (tipo.equals("CO")) { parametros.put("liqventa", codigo); File jasper = new File("D:/reporte/liquicontado.jasper"); JasperPrint jasperPrint = JasperFillManager.fillReport(jasper.getPath(), parametros, con); HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse(); response.addHeader("Content-disposition", "attachment; filename=LIQUIDACION-" + codigo + ".xls"); ServletOutputStream stream = response.getOutputStream(); JRXlsExporter docxExporter = new JRXlsExporter(); docxExporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); docxExporter.setParameter(JRExporterParameter.OUTPUT_STREAM, stream); docxExporter.exportReport(); stream.flush(); stream.close(); FacesContext.getCurrentInstance().responseComplete(); } else if (tipo.equals("CD")) { parametros.put("liqventa", codigo); parametros.put("nombresaval1", naval1); parametros.put("dniaval1", dniaval1); parametros.put("nombresaval2", naval2); parametros.put("dniaval2", dniaval2); parametros.put("liqventa", codigo); File jasper = new File("D:/reporte/liquicredito.jasper"); JasperPrint jasperPrint = JasperFillManager.fillReport(jasper.getPath(), parametros, con); HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse(); response.addHeader("Content-disposition", "attachment; filename=LIQUIDACION-" + codigo + ".xls"); ServletOutputStream stream = response.getOutputStream(); JRXlsxExporter docxExporter = new JRXlsxExporter(); docxExporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); docxExporter.setParameter(JRExporterParameter.OUTPUT_STREAM, stream); docxExporter.exportReport(); stream.flush(); stream.close(); FacesContext.getCurrentInstance().responseComplete(); } } else { FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error", "La venta no se encuentra despachada.")); return; } con.close(); } public void exportarCronograma(String codigo, String tipo, String estado) throws JRException, NamingException, SQLException, IOException { dbManager conn = new dbManager(); Connection con = null; con = conn.getConnection(); CredavalDao linkdao = new CredavalDaoImp(); List<Creditogestor> listafiltrada = new ArrayList(); avales = new ArrayList(); Map<String, Object> parametros = new HashMap<String, Object>(); if (estado.equals("DP")) { if (StringUtils.isNotBlank(codigo)) { parametros.put("codigo", codigo); File jasper = new File("D:/reporte/cronograma.jasper"); JasperPrint jasperPrint = JasperFillManager.fillReport(jasper.getPath(), parametros, con); HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse(); response.addHeader("Content-disposition", "attachment; filename=Cronograma" + codigo + ".pdf"); ServletOutputStream stream = response.getOutputStream(); JasperExportManager.exportReportToPdfStream(jasperPrint, stream); stream.flush(); stream.close(); FacesContext.getCurrentInstance().responseComplete(); } else { FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_WARN, "Error", "Genere el crédito primero")); } } else { FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error", "El credito no se encuentra despachada.")); return; } con.close(); } public void addMessageini2() { if (valuesi) { valuesi2 = true; } else { valuesi2 = false; } } public Credito getCredito() { return credito; } public void setCredito(Credito credito) { this.credito = credito; } public List<Credito> getVentas() { CreditoDao linkdao = new CreditoDaoImp(); creditos = linkdao.mostrarVentas(); return creditos; } public List<Credito> getCreditos() { return creditos; } public List<Credito> getFiltradafecha() { return filtradafecha; } public void setVentas(List<Credito> creditos) { this.creditos = creditos; } public List<Letras> getLetraslista() { return letraslista; } public void setLetraslista(List<Letras> letraslista) { this.letraslista = letraslista; } public String getCodigo() { return codigo; } public void setCodigo(String codigo) { this.codigo = codigo; } public String getTipo() { return tipo; } public void setTipo(String tipo) { this.tipo = tipo; } public void setCreditos(List<Credito> creditos) { this.creditos = creditos; } public BigDecimal getPrecio() { return precio; } public void setPrecio(BigDecimal precio) { this.precio = precio; } public int getSw() { return sw; } public void setSw(int sw) { this.sw = sw; } public boolean isValue() { return value; } public void setValue(boolean value) { this.value = value; } public boolean isValue2() { return value2; } public void setValue2(boolean value2) { this.value2 = value2; } public boolean isValuei2() { return valuei2; } public void setValuei2(boolean valuei2) { this.valuei2 = valuei2; } public String getBtnaprobar() { return btnaprobar; } public void setBtnaprobar(String btnaprobar) { this.btnaprobar = btnaprobar; } public List<Ocupacion> getOcupsxanexo() { return ocupsxanexo; } public void setOcupsxanexo(List<Ocupacion> ocupsxanexo) { this.ocupsxanexo = ocupsxanexo; } public ocupacionBean getOcupbean() { return ocupbean; } public void setOcupbean(ocupacionBean ocupbean) { this.ocupbean = ocupbean; } public modeloBean getModbean() { return modbean; } public void setModbean(modeloBean modbean) { this.modbean = modbean; } public List<Modelo> getListafiltrada() { return listafiltrada; } public void setListafiltrada(List<Modelo> listafiltrada) { this.listafiltrada = listafiltrada; } public List<Pagos> getPagosxcredito() { return pagosxcredito; } public void setPagosxcredito(List<Pagos> pagosxcredito) { this.pagosxcredito = pagosxcredito; } public String getBtnguardar() { return btnguardar; } public void setBtnguardar(String btnguardar) { this.btnguardar = btnguardar; } public List<Ocupacion> getOcupsxcredito() { return ocupsxcredito; } public void setOcupsxcredito(List<Ocupacion> ocupsxcredito) { this.ocupsxcredito = ocupsxcredito; } public Anexo getAnexo() { return anexo; } public void setAnexo(Anexo anexo) { this.anexo = anexo; } public void setRazonsocial(String razonsocial) { this.razonsocial = razonsocial; } public String getRazonsocial() { return razonsocial; } public Conceptos getConcepto() { return concepto; } public void setConcepto(Conceptos concepto) { this.concepto = concepto; } public Vehiculo getVehiculo() { return vehiculo; } public void setVehiculo(Vehiculo vehiculo) { this.vehiculo = vehiculo; } public List<Anexo> getAvales() { return avales; } public void setAvales(List<Anexo> avales) { this.avales = avales; } public boolean isValuesi() { return valuesi; } public void setValuesi(boolean valuesi) { this.valuesi = valuesi; } public boolean isValuesi2() { return valuesi2; } public void setValuesi2(boolean valuesi2) { this.valuesi2 = valuesi2; } public String getNumdigitos() { return numdigitos; } public void setNumdigitos(String numdigitos) { this.numdigitos = numdigitos; } }
UTF-8
Java
22,174
java
ventaBean.java
Java
[]
null
[]
package Bean; import Dao.AnexoDao; import Dao.AnexoDaoImplements; import Dao.ConceptosDao; import Dao.ConceptosDaoImp; import Dao.CredavalDao; import Dao.CredavalDaoImp; import Dao.CreditoDao; import Dao.CreditoDaoImp; import Dao.LetrasDao; import Dao.LetrasDaoImplements; import Dao.VehiculoDao; import Dao.VehiculoDaoImplements; import Model.Anexo; import Model.Conceptos; import Model.Credito; import Model.Creditoaval; import Model.Creditogestor; import Model.Letras; import Model.Modelo; import Model.Ocupacion; import Model.Pagos; import Model.Usuario; import Model.Vehiculo; import Persistencia.HibernateUtil; import java.io.File; import java.io.IOException; import java.io.Serializable; import java.math.BigDecimal; import java.sql.Connection; import java.sql.SQLException; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.faces.application.FacesMessage; import javax.faces.bean.ManagedBean; import javax.faces.bean.SessionScoped; import javax.faces.context.FacesContext; import javax.naming.NamingException; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import net.sf.jasperreports.engine.JRException; import net.sf.jasperreports.engine.JRExporterParameter; import net.sf.jasperreports.engine.JasperExportManager; import net.sf.jasperreports.engine.JasperFillManager; import net.sf.jasperreports.engine.JasperPrint; import net.sf.jasperreports.engine.export.JRXlsExporter; import net.sf.jasperreports.engine.export.ooxml.JRXlsxExporter; import org.apache.commons.lang3.StringUtils; import org.hibernate.Session; import org.hibernate.Transaction; import org.primefaces.context.RequestContext; import utiles.dbManager; import utiles.precio; @ManagedBean @SessionScoped public class ventaBean implements Serializable { private Session session; private Transaction transaction; public Anexo anexo = new Anexo(); private String razonsocial; public Credito credito = new Credito(); public List<Credito> creditos = new ArrayList(); public List<Letras> letraslista = new ArrayList(); private List<Anexo> avales = new ArrayList(); public List<Credito> filtradafecha; private BigDecimal precio; private List<Ocupacion> ocupsxanexo = new ArrayList(); private ocupacionBean ocupbean = new ocupacionBean(); private int sw = 0; private String codigo; private String tipo; private boolean value; private boolean value2; private boolean valuei2; private boolean valuesi; private boolean valuesi2; private String btnaprobar; private String btnguardar; private List<Modelo> listafiltrada; private List<Pagos> pagosxcredito; private List<Ocupacion> ocupsxcredito; private modeloBean modbean = new modeloBean(); private Conceptos concepto = new Conceptos(); public Vehiculo vehiculo = new Vehiculo(); private String numdigitos; public ventaBean() { } public String venta() { creditos = new ArrayList(); letraslista = new ArrayList(); filtradafecha = new ArrayList(); codigo = ""; return "/despacho/venta.xhtml"; } public void nuevoanexo() { anexo = new Anexo(); RequestContext.getCurrentInstance().update("formInsertar"); RequestContext.getCurrentInstance().execute("PF('dlginsert').show()"); } public void modeloTipo(String tipo) { listafiltrada = modbean.modeloTipo(tipo); } public boolean disableGuardar() { if (sw == 1) { return true; } return false; } public void cargarxCodigoVenta() { creditos = new ArrayList(); letraslista = new ArrayList(); CreditoDao creditodao = new CreditoDaoImp(); Credito modelocredito = new Credito(); try { modelocredito = creditodao.cargarxCodigoVenta(codigo, "CO", "CD"); creditos.add(modelocredito); if (creditos.get(0) == null) { creditos = null; } } catch (Exception e) { } codigo = ""; } public void precioModeloVenta() { precio Precio = new precio(); precio = (Precio.precioModelo(credito.getModelo().getModelo())); } public String indexventa() { creditos = new ArrayList(); letraslista = new ArrayList(); filtradafecha = new ArrayList(); return "/despacho/venta.xhtml"; } public void actualizarCampos(String tipodoc) { if (tipodoc.equals("DNI")) { numdigitos = "99999999"; } else { numdigitos = "99999999999"; } System.out.println("ejecuté campos"); } public String nuevo() { credito = new Credito(); value2 = true; sw = 0; value = false; valuei2 = true; valuesi = false; valuesi2 = false; btnaprobar = "Aprobar"; btnguardar = "Guardar"; ocupsxanexo = new ArrayList(); return "/despacho/form.xhtml"; } public void insertarcliente() { this.session = null; this.transaction = null; try { this.session = HibernateUtil.getSessionFactory().openSession(); this.transaction = session.beginTransaction(); AnexoDao daotanexo = new AnexoDaoImplements(); List<Anexo> clientes = new ArrayList(); clientes = daotanexo.ListaConDocumento(this.session, anexo.getNumdocumento()); boolean valida = false; if (this.razonsocial != null) { this.anexo.setNombre(this.razonsocial); this.anexo.setApemat(""); this.anexo.setApepat(""); } if (this.anexo.getTipodocumento().equals("DNI")) { this.anexo.setTipoanexo("CN"); } else { this.anexo.setTipoanexo("CJ"); } for (int i = 0; i < clientes.size(); i++) { Anexo get = clientes.get(i); if ((get != null) && (get.getTipoanexo().equals(anexo.getTipoanexo()))) { valida = true; } } if (valida) { FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Error", "El Anexo ya existe en la Base de Datos.")); this.anexo = new Anexo(); return; } Date d = new Date(); this.anexo.setFechareg(d); this.anexo.setFechanac(d); this.anexo.setEdad(0); this.anexo.setEstcivil("SO"); this.anexo.setCpropia("NO"); this.anexo.setCodven(""); daotanexo.registrar(this.session, this.anexo); this.transaction.commit(); FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Correcto", "El registro fue satisfactorio.")); this.anexo = new Anexo(); RequestContext.getCurrentInstance().update("frmRealizarVentas"); RequestContext.getCurrentInstance().execute("PF('dlginsert').hide()"); } catch (Exception e) { if (this.transaction != null) { this.transaction.rollback(); } FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_FATAL, "Error Fatal:", "Por favor contacte con su administrador " + e.getMessage())); this.anexo = new Anexo(); } finally { if (this.session != null) { this.session.close(); } } razonsocial = null; } public void insertarVenta(Usuario usuario) { CreditoDao creditodao = new CreditoDaoImp(); ConceptosDao condao = new ConceptosDaoImp(); VehiculoDao vehidao = new VehiculoDaoImplements(); if (creditodao.veryLiqventa(this.credito.getLiqventa()) != null) { FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Error", "El código de venta ya existe.")); } else { if (sw == 0) { try { credito.setTotaldeuda(BigDecimal.ZERO); credito.setDeudactual(BigDecimal.ZERO); credito.setCondicionpago("CO"); credito.setEstado("AP"); credito.setEmpresa("CA"); credito.setCalificacion("PN"); credito.setSwinicial(false); credito.setInicial(credito.getPrecio()); credito.setSaldo(BigDecimal.ZERO); credito.setElaborado(usuario.getAnexo().getIdanexo()); creditodao.insertarVenta(credito); concepto.setMontopago(credito.getInicial()); concepto.setTipo("CO"); concepto.setTotal(credito.getInicial()); concepto.setFecreg(credito.getFechareg()); concepto.setCobrado(false); concepto.setCredito(credito); condao.insertarConcepto(concepto); vehiculo = credito.getVehiculo(); vehiculo.setEstado('N'); vehidao.modificarVehiculo(vehiculo); sw = 1; FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Correcto", "La venta se registró correctamente.")); } catch (Exception e) { } } else { if (sw == 1) { btnaprobar = "Desaprobar"; FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error", "Este crédito ya ha sido registrado")); return; } } } } public void eliminar() { CreditoDao creditodao = new CreditoDaoImp(); LetrasDao letrasdao = new LetrasDaoImplements(); Vehiculo vehiculo = new Vehiculo(); if (credito.getEstado().equals("EM")) { creditodao.eliminarVenta(credito); ocupsxanexo = ocupbean.cargarxCredito(credito); for (int i = 0; i < ocupsxanexo.size(); i++) { Ocupacion get = ocupsxanexo.get(i); ocupbean.eliminar(get); } } else { FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error", "Este crédito ya ha sido procesado. No se puede eliminar.")); return; } credito = new Credito(); creditos = new ArrayList(); } public void exportarFormato(String codigo, String tipo, String estado) throws JRException, NamingException, SQLException, IOException { dbManager conn = new dbManager(); Connection con = null; con = conn.getConnection(); Credito cred = new Credito(); CreditoDao credao = new CreditoDaoImp(); cred = credao.veryLiqventa(codigo); CredavalDao linkdao = new CredavalDaoImp(); List<Creditoaval> listafiltrada = new ArrayList(); avales = new ArrayList(); String naval1 = null; String dniaval1 = null; String naval2 = null; String dniaval2 = null; try { listafiltrada = linkdao.avales(cred); for (int i = 0; i < listafiltrada.size(); i++) { Creditoaval get = listafiltrada.get(i); avales.add(get.getAnexo()); } if (avales.size() >= 0) { naval1 = avales.get(0).getNombre().concat(" ").concat(avales.get(0).getApepat()).concat(" ").concat(avales.get(0).getApemat()); dniaval1 = avales.get(0).getNumdocumento(); naval2 = avales.get(1).getNombre().concat(" ").concat(avales.get(1).getApepat()).concat(" ").concat(avales.get(1).getApemat()); dniaval2 = avales.get(1).getNumdocumento(); } } catch (Exception e) { } if (naval1 == null) { naval1 = " "; } if (dniaval1 == null) { dniaval1 = " "; } if (naval2 == null) { naval2 = " "; } if (dniaval2 == null) { dniaval2 = " "; } Map<String, Object> parametros = new HashMap<String, Object>(); if (estado.equals("DP")) { if (tipo.equals("CO")) { parametros.put("liqventa", codigo); File jasper = new File("D:/reporte/liquicontado.jasper"); JasperPrint jasperPrint = JasperFillManager.fillReport(jasper.getPath(), parametros, con); HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse(); response.addHeader("Content-disposition", "attachment; filename=LIQUIDACION-" + codigo + ".xls"); ServletOutputStream stream = response.getOutputStream(); JRXlsExporter docxExporter = new JRXlsExporter(); docxExporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); docxExporter.setParameter(JRExporterParameter.OUTPUT_STREAM, stream); docxExporter.exportReport(); stream.flush(); stream.close(); FacesContext.getCurrentInstance().responseComplete(); } else if (tipo.equals("CD")) { parametros.put("liqventa", codigo); parametros.put("nombresaval1", naval1); parametros.put("dniaval1", dniaval1); parametros.put("nombresaval2", naval2); parametros.put("dniaval2", dniaval2); parametros.put("liqventa", codigo); File jasper = new File("D:/reporte/liquicredito.jasper"); JasperPrint jasperPrint = JasperFillManager.fillReport(jasper.getPath(), parametros, con); HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse(); response.addHeader("Content-disposition", "attachment; filename=LIQUIDACION-" + codigo + ".xls"); ServletOutputStream stream = response.getOutputStream(); JRXlsxExporter docxExporter = new JRXlsxExporter(); docxExporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); docxExporter.setParameter(JRExporterParameter.OUTPUT_STREAM, stream); docxExporter.exportReport(); stream.flush(); stream.close(); FacesContext.getCurrentInstance().responseComplete(); } } else { FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error", "La venta no se encuentra despachada.")); return; } con.close(); } public void exportarCronograma(String codigo, String tipo, String estado) throws JRException, NamingException, SQLException, IOException { dbManager conn = new dbManager(); Connection con = null; con = conn.getConnection(); CredavalDao linkdao = new CredavalDaoImp(); List<Creditogestor> listafiltrada = new ArrayList(); avales = new ArrayList(); Map<String, Object> parametros = new HashMap<String, Object>(); if (estado.equals("DP")) { if (StringUtils.isNotBlank(codigo)) { parametros.put("codigo", codigo); File jasper = new File("D:/reporte/cronograma.jasper"); JasperPrint jasperPrint = JasperFillManager.fillReport(jasper.getPath(), parametros, con); HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse(); response.addHeader("Content-disposition", "attachment; filename=Cronograma" + codigo + ".pdf"); ServletOutputStream stream = response.getOutputStream(); JasperExportManager.exportReportToPdfStream(jasperPrint, stream); stream.flush(); stream.close(); FacesContext.getCurrentInstance().responseComplete(); } else { FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_WARN, "Error", "Genere el crédito primero")); } } else { FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error", "El credito no se encuentra despachada.")); return; } con.close(); } public void addMessageini2() { if (valuesi) { valuesi2 = true; } else { valuesi2 = false; } } public Credito getCredito() { return credito; } public void setCredito(Credito credito) { this.credito = credito; } public List<Credito> getVentas() { CreditoDao linkdao = new CreditoDaoImp(); creditos = linkdao.mostrarVentas(); return creditos; } public List<Credito> getCreditos() { return creditos; } public List<Credito> getFiltradafecha() { return filtradafecha; } public void setVentas(List<Credito> creditos) { this.creditos = creditos; } public List<Letras> getLetraslista() { return letraslista; } public void setLetraslista(List<Letras> letraslista) { this.letraslista = letraslista; } public String getCodigo() { return codigo; } public void setCodigo(String codigo) { this.codigo = codigo; } public String getTipo() { return tipo; } public void setTipo(String tipo) { this.tipo = tipo; } public void setCreditos(List<Credito> creditos) { this.creditos = creditos; } public BigDecimal getPrecio() { return precio; } public void setPrecio(BigDecimal precio) { this.precio = precio; } public int getSw() { return sw; } public void setSw(int sw) { this.sw = sw; } public boolean isValue() { return value; } public void setValue(boolean value) { this.value = value; } public boolean isValue2() { return value2; } public void setValue2(boolean value2) { this.value2 = value2; } public boolean isValuei2() { return valuei2; } public void setValuei2(boolean valuei2) { this.valuei2 = valuei2; } public String getBtnaprobar() { return btnaprobar; } public void setBtnaprobar(String btnaprobar) { this.btnaprobar = btnaprobar; } public List<Ocupacion> getOcupsxanexo() { return ocupsxanexo; } public void setOcupsxanexo(List<Ocupacion> ocupsxanexo) { this.ocupsxanexo = ocupsxanexo; } public ocupacionBean getOcupbean() { return ocupbean; } public void setOcupbean(ocupacionBean ocupbean) { this.ocupbean = ocupbean; } public modeloBean getModbean() { return modbean; } public void setModbean(modeloBean modbean) { this.modbean = modbean; } public List<Modelo> getListafiltrada() { return listafiltrada; } public void setListafiltrada(List<Modelo> listafiltrada) { this.listafiltrada = listafiltrada; } public List<Pagos> getPagosxcredito() { return pagosxcredito; } public void setPagosxcredito(List<Pagos> pagosxcredito) { this.pagosxcredito = pagosxcredito; } public String getBtnguardar() { return btnguardar; } public void setBtnguardar(String btnguardar) { this.btnguardar = btnguardar; } public List<Ocupacion> getOcupsxcredito() { return ocupsxcredito; } public void setOcupsxcredito(List<Ocupacion> ocupsxcredito) { this.ocupsxcredito = ocupsxcredito; } public Anexo getAnexo() { return anexo; } public void setAnexo(Anexo anexo) { this.anexo = anexo; } public void setRazonsocial(String razonsocial) { this.razonsocial = razonsocial; } public String getRazonsocial() { return razonsocial; } public Conceptos getConcepto() { return concepto; } public void setConcepto(Conceptos concepto) { this.concepto = concepto; } public Vehiculo getVehiculo() { return vehiculo; } public void setVehiculo(Vehiculo vehiculo) { this.vehiculo = vehiculo; } public List<Anexo> getAvales() { return avales; } public void setAvales(List<Anexo> avales) { this.avales = avales; } public boolean isValuesi() { return valuesi; } public void setValuesi(boolean valuesi) { this.valuesi = valuesi; } public boolean isValuesi2() { return valuesi2; } public void setValuesi2(boolean valuesi2) { this.valuesi2 = valuesi2; } public String getNumdigitos() { return numdigitos; } public void setNumdigitos(String numdigitos) { this.numdigitos = numdigitos; } }
22,174
0.588371
0.584266
638
32.746082
29.622728
187
false
false
0
0
0
0
0
0
0.65674
false
false
5
18118587ead926bf2e80446bea7b7fbb82c330e4
29,205,777,661,351
5886c81b7b114a1086310d78a82889902ba4a9f9
/src/javaexercises/PalindromeCheck.java
c3923a7d15aefa8c4e4767d210c8459e04a5a448
[]
no_license
kata-agata/JavaExercises
https://github.com/kata-agata/JavaExercises
b10ef6564478259bdca81bbcc089972224c20eb5
0477642eae32e99f3a18f5a565129b1de0788a70
refs/heads/master
"2020-04-02T19:12:07.488000"
"2018-10-25T19:12:39"
"2018-10-25T19:12:39"
154,726,120
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * 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 javaexercises; /** * * @author agataj */ public class PalindromeCheck { public static boolean checkPalindrome(String s){ String reverse = ReverseString.reverseStringWithBuffer(s); if (reverse.equals(s)) return true; else return false; } }
UTF-8
Java
493
java
PalindromeCheck.java
Java
[ { "context": "*/\r\npackage javaexercises;\r\n \r\n/**\r\n *\r\n * @author agataj\r\n */\r\npublic class PalindromeCheck {\r\n \r\n p", "end": 243, "score": 0.9994306564331055, "start": 237, "tag": "USERNAME", "value": "agataj" } ]
null
[]
/* * 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 javaexercises; /** * * @author agataj */ public class PalindromeCheck { public static boolean checkPalindrome(String s){ String reverse = ReverseString.reverseStringWithBuffer(s); if (reverse.equals(s)) return true; else return false; } }
493
0.663286
0.663286
19
23.947369
24.549572
79
false
false
0
0
0
0
0
0
0.368421
false
false
5
a97ce5335261697d02c14b34bdc328a97fa425ab
1,056,562,006,896
896bb9ae6806996bf33da286b91786bc806d5b68
/src/main/java/com/example/ocr/test/Outer.java
759eb5c9e1ca2ffde77eb7b1b3acd2d1bae0975a
[]
no_license
neversettle2018/ocr
https://github.com/neversettle2018/ocr
14b0ca3459d196791c286ac90c8bc3b99de62b11
e1144f5475273460c103bb711361db5e4dd054cb
refs/heads/master
"2022-07-09T01:05:29.520000"
"2019-09-30T07:56:49"
"2019-09-30T07:56:49"
211,806,030
0
0
null
false
"2022-06-30T20:20:25"
"2019-09-30T07:53:58"
"2019-09-30T08:00:49"
"2022-06-30T20:20:25"
43,033
0
0
5
Java
false
false
package com.example.ocr.test; class Outer{ int a=5; static int b=6; void show() { System.out.println("hello world"); } class Inner{ void use() { System.out.println(a);//5 System.out.println(b);//6 show();//hello world } } void create() { new Inner().use(); } } class Demo { public static void main(String[] args) { new Outer().create(); Outer.Inner inner = new Outer().new Inner(); inner.use(); } }
UTF-8
Java
538
java
Outer.java
Java
[]
null
[]
package com.example.ocr.test; class Outer{ int a=5; static int b=6; void show() { System.out.println("hello world"); } class Inner{ void use() { System.out.println(a);//5 System.out.println(b);//6 show();//hello world } } void create() { new Inner().use(); } } class Demo { public static void main(String[] args) { new Outer().create(); Outer.Inner inner = new Outer().new Inner(); inner.use(); } }
538
0.490706
0.483271
32
15.84375
14.998144
52
false
false
0
0
0
0
0
0
0.34375
false
false
5
cbc0b7de3f9ec732c9a1fc4306a9d88443618f32
4,750,233,829,693
7e38dcdfd4636e4ff316021c4986d1a2ef3ff3ea
/src/main/java/com/digisigner/client/http/ClientResponse.java
80b6f431c10e57baadabff4a0fcecb5410150bfa
[]
no_license
DigiSigner/digi-signer-java-client
https://github.com/DigiSigner/digi-signer-java-client
68c20954be9b4d8f544d1e99f9829b8251dba1e6
3b5a2b132023f1403e199cd1b1edbfc0a5812323
refs/heads/master
"2023-04-30T13:12:47.144000"
"2022-09-27T14:27:37"
"2022-09-27T14:27:37"
75,736,166
0
4
null
false
"2023-04-14T17:13:11"
"2016-12-06T13:55:27"
"2022-04-19T10:26:55"
"2023-04-14T17:13:11"
958
0
4
3
Java
false
false
package com.digisigner.client.http; /** * Class represents response of API service. */ public class ClientResponse { private final int code; private final String content; public ClientResponse(int code, String content) { this.code = code; this.content = content; } public int getCode() { return code; } public String getContent() { return content; } }
UTF-8
Java
446
java
ClientResponse.java
Java
[]
null
[]
package com.digisigner.client.http; /** * Class represents response of API service. */ public class ClientResponse { private final int code; private final String content; public ClientResponse(int code, String content) { this.code = code; this.content = content; } public int getCode() { return code; } public String getContent() { return content; } }
446
0.59417
0.59417
23
17.391304
16.126509
53
false
false
0
0
0
0
0
0
0.347826
false
false
5
f4f9c2b0c8614bd5316f77391514d01ba52098ad
17,437,567,277,781
9fa30428ae9bbb4d74839406f882a5886fa6c7f4
/app/src/main/java/cz/pia/cagy/accountingApp/config/WebSecurityConfig.java
539bf79e812cc9cfc089e3caea24556bf2dc6ff7
[]
no_license
cagysek/accountingApp
https://github.com/cagysek/accountingApp
3ae55e64471473d9a42ad2973dbb9129249a882c
fe6c5e5d8c41fe14050c1288aabc17beb77b4344
refs/heads/master
"2020-12-01T14:38:11.559000"
"2020-01-06T11:32:50"
"2020-01-06T11:32:50"
230,663,082
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cz.pia.cagy.accountingApp.config; import cz.pia.cagy.accountingApp.service.UserDetailsServiceImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.web.util.matcher.AntPathRequestMatcher; import org.springframework.security.web.util.matcher.RegexRequestMatcher; /** * The type Web security config. */ @Configuration @EnableWebSecurity public class WebSecurityConfig extends WebSecurityConfigurerAdapter { @Autowired private UserDetailsServiceImpl userDetailsServiceImpl; /** * B crypt password encoder b crypt password encoder. * * @return the b crypt password encoder */ @Bean public BCryptPasswordEncoder bCryptPasswordEncoder() { return new BCryptPasswordEncoder(); } /** * * @param http * @throws Exception */ @Override protected void configure(HttpSecurity http) throws Exception { http .authorizeRequests() .antMatchers("/admin/**").hasRole("ADMIN") .antMatchers("/purser/**").hasRole("PURSER") .antMatchers("/resources/**", "/css/**", "/js/**", "/webfonts/**", "/registration", "/", "/pages/**", "/logout", "/invoice-list", "/invoice-detail").permitAll() .anyRequest().authenticated() .and() .formLogin() .loginPage("/login") .successForwardUrl("/") .permitAll() .and() .logout() .logoutRequestMatcher(new RegexRequestMatcher("/logout", "POST")) .invalidateHttpSession(true) .deleteCookies("JSESSIONID") .permitAll(); } /** * Custom authentication manager authentication manager. * * @return the authentication manager * @throws Exception the exception */ @Bean public AuthenticationManager customAuthenticationManager() throws Exception { return authenticationManager(); } /** * Configure global. * * @param auth the auth * @throws Exception the exception */ @Autowired public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { auth.userDetailsService(userDetailsServiceImpl).passwordEncoder(bCryptPasswordEncoder()); } }
UTF-8
Java
3,135
java
WebSecurityConfig.java
Java
[]
null
[]
package cz.pia.cagy.accountingApp.config; import cz.pia.cagy.accountingApp.service.UserDetailsServiceImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.web.util.matcher.AntPathRequestMatcher; import org.springframework.security.web.util.matcher.RegexRequestMatcher; /** * The type Web security config. */ @Configuration @EnableWebSecurity public class WebSecurityConfig extends WebSecurityConfigurerAdapter { @Autowired private UserDetailsServiceImpl userDetailsServiceImpl; /** * B crypt password encoder b crypt password encoder. * * @return the b crypt password encoder */ @Bean public BCryptPasswordEncoder bCryptPasswordEncoder() { return new BCryptPasswordEncoder(); } /** * * @param http * @throws Exception */ @Override protected void configure(HttpSecurity http) throws Exception { http .authorizeRequests() .antMatchers("/admin/**").hasRole("ADMIN") .antMatchers("/purser/**").hasRole("PURSER") .antMatchers("/resources/**", "/css/**", "/js/**", "/webfonts/**", "/registration", "/", "/pages/**", "/logout", "/invoice-list", "/invoice-detail").permitAll() .anyRequest().authenticated() .and() .formLogin() .loginPage("/login") .successForwardUrl("/") .permitAll() .and() .logout() .logoutRequestMatcher(new RegexRequestMatcher("/logout", "POST")) .invalidateHttpSession(true) .deleteCookies("JSESSIONID") .permitAll(); } /** * Custom authentication manager authentication manager. * * @return the authentication manager * @throws Exception the exception */ @Bean public AuthenticationManager customAuthenticationManager() throws Exception { return authenticationManager(); } /** * Configure global. * * @param auth the auth * @throws Exception the exception */ @Autowired public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { auth.userDetailsService(userDetailsServiceImpl).passwordEncoder(bCryptPasswordEncoder()); } }
3,135
0.675598
0.675598
85
35.882355
33.277943
180
false
false
0
0
0
0
0
0
0.341176
false
false
5
a5a784d385ddc33d9b9d9f7cb69aa5902fd29d63
25,048,249,286,316
b7cb5282a22f550571acdb11e436980e03ef44a4
/finalProject/src/main/java/web/dao/face/CalendarDao.java
64208e446ed5fc9a7536fc130a88bb9ca60d2db2
[]
no_license
jeihomme/finalProject
https://github.com/jeihomme/finalProject
75e40b66687953cc0455f3ca2bc005422fbb0cd1
640e33bff28b23ff04400921a25f6b2d25080083
refs/heads/master
"2020-04-09T22:17:13.786000"
"2019-01-21T08:11:14"
"2019-01-21T08:11:14"
160,611,200
0
0
null
false
"2018-12-06T03:30:29"
"2018-12-06T03:07:49"
"2018-12-06T03:28:02"
"2018-12-06T03:30:28"
0
0
0
0
Java
false
null
package web.dao.face; import java.util.List; import java.util.Map; import org.apache.ibatis.annotations.Param; public interface CalendarDao { // 모든 스케쥴 가져오기 public List schedule(@Param("map") Map map, @Param("bandNo") String bandNo); // 모든 시간 가져오기 public List getTime(); // 바 리스트 가져오기 public List getBars(); // 밴드가 바 추가 public void insertBar(@Param("thisDate") String thisDate, @Param("stTime") String stTime, @Param("edTime") String edTime, @Param("barNo") String barNo, @Param("bandNo") String bandNo); // 해당 날짜 정보 가져오기 public List getInfoBand(@Param("bandNo") String bandNo, @Param("tDate") String tDate); public List getInfoBar(@Param("barNo") String barNo, @Param("tDate") String tDate); public List getEmptySched(@Param("barNo") String barNo, @Param("tDate") String tDate); // 초청 public void inviteBand(@Param("calendarNo") String calendarNo, @Param("barNo") String barNo, @Param("bandNo") String bandNo); public int cntApp(); }
UTF-8
Java
1,111
java
CalendarDao.java
Java
[]
null
[]
package web.dao.face; import java.util.List; import java.util.Map; import org.apache.ibatis.annotations.Param; public interface CalendarDao { // 모든 스케쥴 가져오기 public List schedule(@Param("map") Map map, @Param("bandNo") String bandNo); // 모든 시간 가져오기 public List getTime(); // 바 리스트 가져오기 public List getBars(); // 밴드가 바 추가 public void insertBar(@Param("thisDate") String thisDate, @Param("stTime") String stTime, @Param("edTime") String edTime, @Param("barNo") String barNo, @Param("bandNo") String bandNo); // 해당 날짜 정보 가져오기 public List getInfoBand(@Param("bandNo") String bandNo, @Param("tDate") String tDate); public List getInfoBar(@Param("barNo") String barNo, @Param("tDate") String tDate); public List getEmptySched(@Param("barNo") String barNo, @Param("tDate") String tDate); // 초청 public void inviteBand(@Param("calendarNo") String calendarNo, @Param("barNo") String barNo, @Param("bandNo") String bandNo); public int cntApp(); }
1,111
0.668293
0.668293
37
25.702703
27.847912
94
false
false
0
0
0
0
0
0
1.621622
false
false
5
3a02af285f48064e4fd945b41587205ca0bf0bf2
32,298,154,127,925
f2d5d9c8a9e99c04d9e5c4c193946567d223c8a7
/src/edu/asu/mgb/problem/Util.java
b03b3fcc56ed02c65a9951dfc4dcb1e2a9af3d62
[]
no_license
victorgirotto/log-video-analysis
https://github.com/victorgirotto/log-video-analysis
5a8867771a43158949d6376a764f4270d2160ee9
b6a20b28487f95b3d85b2151230f9755ac71f6cf
refs/heads/master
"2021-01-18T16:16:48.374000"
"2014-08-03T17:16:24"
"2014-08-03T17:33:26"
22,579,032
1
1
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * 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.asu.mgb.problem; import java.util.HashMap; /** * * @author victorgirotto */ public class Util { private static final HashMap<String, Float> angles; static { angles = new HashMap<>(); angles.put("E", 0f); angles.put("N", 90f); angles.put("W", 180f); angles.put("S", 270f); } public static Integer getStudentNumber(String action, String removeString){ return new Integer(action.replaceAll(removeString, "")); } public static Integer getProblemNumber(String action){ return new Integer(action.split(":")[1].trim()); } public static float getMoveUnits(String units){ return Float.parseFloat(units); } public static float getTurnUnits(String turn){ float angle; if(isNumeric(turn)){ angle = Float.parseFloat(turn); } else { angle = angles.get(turn); } return angle; } public static boolean isNumeric(String str) { return str.matches("-?\\d+(\\.\\d+)?"); //match a number with optional '-' and decimal. } }
UTF-8
Java
1,329
java
Util.java
Java
[ { "context": "lem;\n\nimport java.util.HashMap;\n\n/**\n *\n * @author victorgirotto\n */\npublic class Util {\n \n private static f", "end": 274, "score": 0.9870834350585938, "start": 261, "tag": "USERNAME", "value": "victorgirotto" } ]
null
[]
/* * 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.asu.mgb.problem; import java.util.HashMap; /** * * @author victorgirotto */ public class Util { private static final HashMap<String, Float> angles; static { angles = new HashMap<>(); angles.put("E", 0f); angles.put("N", 90f); angles.put("W", 180f); angles.put("S", 270f); } public static Integer getStudentNumber(String action, String removeString){ return new Integer(action.replaceAll(removeString, "")); } public static Integer getProblemNumber(String action){ return new Integer(action.split(":")[1].trim()); } public static float getMoveUnits(String units){ return Float.parseFloat(units); } public static float getTurnUnits(String turn){ float angle; if(isNumeric(turn)){ angle = Float.parseFloat(turn); } else { angle = angles.get(turn); } return angle; } public static boolean isNumeric(String str) { return str.matches("-?\\d+(\\.\\d+)?"); //match a number with optional '-' and decimal. } }
1,329
0.598947
0.591422
53
24.075472
23.906933
94
false
false
0
0
0
0
0
0
0.490566
false
false
5
9cd84ccee9b1045368f72bdd9e4122e0b6990530
32,298,154,129,692
48884a2d0630633ed4ad2c1c39e00db96bd7e0b0
/src/main/java/corn/ironman/jay/controller/FriendController.java
395f0cc5827aba3b3c8a139717bcadb9e40cc528
[]
no_license
darkcorn1997/Classmates
https://github.com/darkcorn1997/Classmates
8ce6eefd70574a6b23340015d983fc4e8ce1dfe0
69a5abc6abbd1a38bb2e9d26bd50481dc95022b0
refs/heads/main
"2023-07-29T00:27:04.031000"
"2021-09-15T10:19:30"
"2021-09-15T10:19:30"
313,055,216
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package corn.ironman.jay.controller; import com.github.pagehelper.PageInfo; import corn.ironman.jay.Service.FriendService; import corn.ironman.jay.bean.Friend; import corn.ironman.jay.object.BaseConditionVO; import corn.ironman.jay.object.PageResult; import corn.ironman.jay.util.FileUtil; import corn.ironman.jay.util.ResultUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.util.ResourceUtils; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.servlet.ModelAndView; import java.io.FileNotFoundException; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.nio.charset.StandardCharsets; import java.util.Map; /**好友列表信息页管理**/ @Controller public class FriendController { @Autowired private FriendService friendService; @GetMapping("/goMainView") public ModelAndView goMainView() { return ResultUtil.view("main"); } @GetMapping("/goFriendListView") public ModelAndView goFriendListView() { return ResultUtil.view("friendList"); } /** * @description: 分页查询:根据好友姓名获取指定/所有好友列表信息 * @param: pageNum 当前页码 * @param: pageSize 列表行数 * @param: username 好友姓名 * @return: PageResult */ @PostMapping("/getFriendList") @ResponseBody public PageResult getFriendList(String username, Integer page, Integer rows) { // 获取封装查询结果 PageInfo<Friend> pageInfo = friendService.selectForPage(new Friend(username), new BaseConditionVO(page, rows)); // 返回分页数据 return ResultUtil.tablePage(pageInfo); } /** * @description: 添加好友信息 * @param: friend 好友信息 * @return: java.util.Map<java.lang.String, java.lang.Object> */ @PostMapping("/addFriend") @ResponseBody public Map<String, Object> addFriend(Friend friend) { return friendService.insertBySelective(friend) > 0 ? ResultUtil.success("添加成功") : ResultUtil.error("添加失败:服务器端发生异常!"); } /** * @description: 更新好友信息 * @param: friend 好友信息 * @return: java.util.Map<java.lang.String, java.lang.Object> */ @PostMapping("/editFriend") @ResponseBody public Map<String, Object> editFriend(Friend friend) { return friendService.updateByPrimaryKey(friend) > 0 ? ResultUtil.success("更新成功") : ResultUtil.error("更新失败:服务器端发生异常!"); } /** * @description: 删除好友信息 * @param: ids * @return: java.util.Map<java.lang.String, java.lang.Object> */ @PostMapping("/deleteFriend") @ResponseBody public Map<String, Object> deleteFriend(@RequestParam(value = "ids[]") Integer[] ids) { return friendService.deleteByPrimaryKey(ids) > 0 ? ResultUtil.success("更新成功") : ResultUtil.error("删除失败:服务器端发生异常!"); } @PostMapping("/uploadPhoto") @ResponseBody public Map<String, Object> uploadPhoto(MultipartFile photo) throws FileNotFoundException, UnsupportedEncodingException { //指定存储头像目录的完整路径(项目发布路径): 若不使用绝对路径,则Spring boot会默认将上传的文件存储到临时目录中 var dirPath = URLDecoder.decode(ResourceUtils.getURL("classpath:").getPath(), String.valueOf(StandardCharsets.UTF_8)) + FileUtil.uploadPath; //返回头像的上传结果 return FileUtil.getUploadResult(photo, dirPath, FileUtil.uploadPath); } }
UTF-8
Java
4,029
java
FriendController.java
Java
[]
null
[]
package corn.ironman.jay.controller; import com.github.pagehelper.PageInfo; import corn.ironman.jay.Service.FriendService; import corn.ironman.jay.bean.Friend; import corn.ironman.jay.object.BaseConditionVO; import corn.ironman.jay.object.PageResult; import corn.ironman.jay.util.FileUtil; import corn.ironman.jay.util.ResultUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.util.ResourceUtils; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.servlet.ModelAndView; import java.io.FileNotFoundException; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.nio.charset.StandardCharsets; import java.util.Map; /**好友列表信息页管理**/ @Controller public class FriendController { @Autowired private FriendService friendService; @GetMapping("/goMainView") public ModelAndView goMainView() { return ResultUtil.view("main"); } @GetMapping("/goFriendListView") public ModelAndView goFriendListView() { return ResultUtil.view("friendList"); } /** * @description: 分页查询:根据好友姓名获取指定/所有好友列表信息 * @param: pageNum 当前页码 * @param: pageSize 列表行数 * @param: username 好友姓名 * @return: PageResult */ @PostMapping("/getFriendList") @ResponseBody public PageResult getFriendList(String username, Integer page, Integer rows) { // 获取封装查询结果 PageInfo<Friend> pageInfo = friendService.selectForPage(new Friend(username), new BaseConditionVO(page, rows)); // 返回分页数据 return ResultUtil.tablePage(pageInfo); } /** * @description: 添加好友信息 * @param: friend 好友信息 * @return: java.util.Map<java.lang.String, java.lang.Object> */ @PostMapping("/addFriend") @ResponseBody public Map<String, Object> addFriend(Friend friend) { return friendService.insertBySelective(friend) > 0 ? ResultUtil.success("添加成功") : ResultUtil.error("添加失败:服务器端发生异常!"); } /** * @description: 更新好友信息 * @param: friend 好友信息 * @return: java.util.Map<java.lang.String, java.lang.Object> */ @PostMapping("/editFriend") @ResponseBody public Map<String, Object> editFriend(Friend friend) { return friendService.updateByPrimaryKey(friend) > 0 ? ResultUtil.success("更新成功") : ResultUtil.error("更新失败:服务器端发生异常!"); } /** * @description: 删除好友信息 * @param: ids * @return: java.util.Map<java.lang.String, java.lang.Object> */ @PostMapping("/deleteFriend") @ResponseBody public Map<String, Object> deleteFriend(@RequestParam(value = "ids[]") Integer[] ids) { return friendService.deleteByPrimaryKey(ids) > 0 ? ResultUtil.success("更新成功") : ResultUtil.error("删除失败:服务器端发生异常!"); } @PostMapping("/uploadPhoto") @ResponseBody public Map<String, Object> uploadPhoto(MultipartFile photo) throws FileNotFoundException, UnsupportedEncodingException { //指定存储头像目录的完整路径(项目发布路径): 若不使用绝对路径,则Spring boot会默认将上传的文件存储到临时目录中 var dirPath = URLDecoder.decode(ResourceUtils.getURL("classpath:").getPath(), String.valueOf(StandardCharsets.UTF_8)) + FileUtil.uploadPath; //返回头像的上传结果 return FileUtil.getUploadResult(photo, dirPath, FileUtil.uploadPath); } }
4,029
0.704018
0.702924
108
32.879631
26.706123
124
false
false
0
0
0
0
0
0
0.444444
false
false
5
bb09e64b71cd49693a07513c3467291e635019ee
3,977,139,786,310
8af32381673f0ce7aaddc5913b544dad9e2ec998
/reports-app/src/main/java/sp/service/SuggestServiceImpl.java
d532e8dcee636eb96a869eeee26169a59ebfb5e2
[ "Unlicense" ]
permissive
pkshowcase/reports
https://github.com/pkshowcase/reports
d41ed0fd5617d467c5114906b00d9942098fe5df
6442e603b6a78c77f1664bfd1d7cb1eafff09c72
refs/heads/master
"2016-09-06T00:42:09.991000"
"2013-10-30T08:59:04"
"2013-10-30T08:59:04"
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package sp.service; import java.util.ArrayList; import java.util.List; import javax.inject.Inject; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import sp.model.Report; import sp.model.ajax.Prompt; import sp.repository.SuggestRepository; /** * Reports! Suggest service {@link SuggestReportService} basic implementation. * * @author Paul Kulitski * @see Service */ @Service public class SuggestServiceImpl implements SuggestService { @Inject SuggestRepository suggestRepository; @Override @Transactional(readOnly = true, propagation = Propagation.SUPPORTS) public Long getAllCount(String query) { return suggestRepository.getAllCount(query); } @Override @Transactional(readOnly = true, propagation = Propagation.SUPPORTS) public List<Long> getIdsByQuery(String query) { return suggestRepository.getIdsByQuery(query); } @Override @Transactional(readOnly = true, propagation = Propagation.SUPPORTS) public List<Long> getIdsByQuery(String query, Long limit) { return suggestRepository.getIdsByQuery(query, limit); } @Override @Transactional(readOnly = true, propagation = Propagation.SUPPORTS) public List<Report> getReportsByQuery(String query) { return suggestRepository.getReportsByQuery(query); } @Override @Transactional(readOnly = true, propagation = Propagation.SUPPORTS) public List<Report> getReportsByQuery(String query, Long limit) { return suggestRepository.getReportsByQuery(query, limit); } @Override public List<Prompt> getPrompts(String query, Long limit) { return suggestRepository.getPrompts(query, limit); } @Override public List<String> getPromptsAsString(String query, Long limit) { List<Prompt> prompts = getPrompts(query, limit); List<String> result = new ArrayList<String>(prompts.size()); for (Prompt prompt : prompts) { result.add(prompt.toString()); } return result; } @Override @Transactional(readOnly = true, propagation = Propagation.SUPPORTS) public List<Long> getIdsByQuery(String query, Long limit, Long offset) { return suggestRepository.getIdsByQuery(query, limit, offset); } @Override @Transactional(readOnly = true, propagation = Propagation.SUPPORTS) public List<Report> getReportsByQuery(String query, Long limit, Long offset) { return suggestRepository.getReportsByQuery(query, limit, offset); } @Override public List<Prompt> getPrompts(String query) { return suggestRepository.getPrompts(query); } @Override public List<String> getPromptStrings(String query, Long limit) { return suggestRepository.getPromptStrings(query, limit); } }
UTF-8
Java
2,919
java
SuggestServiceImpl.java
Java
[ { "context": "ReportService} basic implementation.\n *\n * @author Paul Kulitski\n * @see Service\n */\n@Service\npublic class Suggest", "end": 479, "score": 0.982894778251648, "start": 466, "tag": "NAME", "value": "Paul Kulitski" } ]
null
[]
package sp.service; import java.util.ArrayList; import java.util.List; import javax.inject.Inject; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import sp.model.Report; import sp.model.ajax.Prompt; import sp.repository.SuggestRepository; /** * Reports! Suggest service {@link SuggestReportService} basic implementation. * * @author <NAME> * @see Service */ @Service public class SuggestServiceImpl implements SuggestService { @Inject SuggestRepository suggestRepository; @Override @Transactional(readOnly = true, propagation = Propagation.SUPPORTS) public Long getAllCount(String query) { return suggestRepository.getAllCount(query); } @Override @Transactional(readOnly = true, propagation = Propagation.SUPPORTS) public List<Long> getIdsByQuery(String query) { return suggestRepository.getIdsByQuery(query); } @Override @Transactional(readOnly = true, propagation = Propagation.SUPPORTS) public List<Long> getIdsByQuery(String query, Long limit) { return suggestRepository.getIdsByQuery(query, limit); } @Override @Transactional(readOnly = true, propagation = Propagation.SUPPORTS) public List<Report> getReportsByQuery(String query) { return suggestRepository.getReportsByQuery(query); } @Override @Transactional(readOnly = true, propagation = Propagation.SUPPORTS) public List<Report> getReportsByQuery(String query, Long limit) { return suggestRepository.getReportsByQuery(query, limit); } @Override public List<Prompt> getPrompts(String query, Long limit) { return suggestRepository.getPrompts(query, limit); } @Override public List<String> getPromptsAsString(String query, Long limit) { List<Prompt> prompts = getPrompts(query, limit); List<String> result = new ArrayList<String>(prompts.size()); for (Prompt prompt : prompts) { result.add(prompt.toString()); } return result; } @Override @Transactional(readOnly = true, propagation = Propagation.SUPPORTS) public List<Long> getIdsByQuery(String query, Long limit, Long offset) { return suggestRepository.getIdsByQuery(query, limit, offset); } @Override @Transactional(readOnly = true, propagation = Propagation.SUPPORTS) public List<Report> getReportsByQuery(String query, Long limit, Long offset) { return suggestRepository.getReportsByQuery(query, limit, offset); } @Override public List<Prompt> getPrompts(String query) { return suggestRepository.getPrompts(query); } @Override public List<String> getPromptStrings(String query, Long limit) { return suggestRepository.getPromptStrings(query, limit); } }
2,912
0.718739
0.718739
91
31.076923
27.812256
82
false
false
0
0
0
0
0
0
0.549451
false
false
5
2d782ed89597122b7cc653739c49b5e788dc2677
21,981,642,641,151
cefa355cb23a000f0262fded6ba75233caa04289
/src/test/java/com/helospark/lightdi/it/PropertySourceNotFoundIT.java
1d5973389bd1640db7ed56f975bb89b1f543cbe8
[ "MIT" ]
permissive
helospark/light-di
https://github.com/helospark/light-di
1754fdd53daf0c9f8cc2ceb4692fc332fe6b3403
fd5e8d00f30ffa99a090a5be194eb453c1eb41c4
refs/heads/master
"2021-06-03T03:45:11.218000"
"2020-03-08T20:31:54"
"2020-03-08T20:31:54"
101,509,965
10
0
MIT
false
"2020-10-12T22:23:39"
"2017-08-26T19:59:41"
"2020-09-21T07:43:52"
"2020-10-12T22:23:38"
364
6
0
1
Java
false
false
package com.helospark.lightdi.it; import static org.junit.Assert.assertNotNull; import org.junit.Test; import com.helospark.lightdi.LightDi; import com.helospark.lightdi.LightDiContext; import com.helospark.lightdi.exception.ContextInitializationFailedException; import com.helospark.lightdi.it.propertysourcenotfoundcontext.NonRequiredPropertySourceNotFoundConfiguration; import com.helospark.lightdi.it.propertysourcenotfoundcontext.RequiredPropertySourceNotFoundConfiguration; public class PropertySourceNotFoundIT { LightDi lightDi = new LightDi(); @Test(expected = ContextInitializationFailedException.class) public void testContextLoadWithMissingRequiredPropertySource() { // GIVEN // WHEN LightDi.initContextByClass(RequiredPropertySourceNotFoundConfiguration.class); // THEN throws } @Test public void testCollectionInject() { // GIVEN // WHEN LightDiContext context = LightDi.initContextByClass(NonRequiredPropertySourceNotFoundConfiguration.class); // THEN assertNotNull(context); } }
UTF-8
Java
1,106
java
PropertySourceNotFoundIT.java
Java
[]
null
[]
package com.helospark.lightdi.it; import static org.junit.Assert.assertNotNull; import org.junit.Test; import com.helospark.lightdi.LightDi; import com.helospark.lightdi.LightDiContext; import com.helospark.lightdi.exception.ContextInitializationFailedException; import com.helospark.lightdi.it.propertysourcenotfoundcontext.NonRequiredPropertySourceNotFoundConfiguration; import com.helospark.lightdi.it.propertysourcenotfoundcontext.RequiredPropertySourceNotFoundConfiguration; public class PropertySourceNotFoundIT { LightDi lightDi = new LightDi(); @Test(expected = ContextInitializationFailedException.class) public void testContextLoadWithMissingRequiredPropertySource() { // GIVEN // WHEN LightDi.initContextByClass(RequiredPropertySourceNotFoundConfiguration.class); // THEN throws } @Test public void testCollectionInject() { // GIVEN // WHEN LightDiContext context = LightDi.initContextByClass(NonRequiredPropertySourceNotFoundConfiguration.class); // THEN assertNotNull(context); } }
1,106
0.771248
0.771248
37
28.891891
33.370796
114
false
false
0
0
0
0
0
0
0.324324
false
false
5
14a6aee7c87aabb6754e44f036e3b175f4ece57c
29,815,663,021,222
a10efa544f77aea45df77f9004b7b26545e79685
/LabExercise/Lab1/src/DriveT2T3T4T5.java
117566e7a2519358094eb19bd4a9259374101f7c
[]
no_license
GenadyKogan/JavaSCE
https://github.com/GenadyKogan/JavaSCE
27678f549e91ec5b933e4a6db8044bb7da72383d
fdcee419bbb683c216d6fa3c20fe7a78317ae90b
refs/heads/master
"2022-11-13T03:00:10.868000"
"2020-07-08T12:15:50"
"2020-07-08T12:15:50"
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import sun.net.www.content.audio.x_aiff; import java.util.Scanner; public class DriveT2T3T4T5 { private static Scanner s=new Scanner (System.in); public static void main(String[] args) { final int EXIT=-1; int answer; do { System.out.println(); System.out.println("Choose one of the following options: "); System.out.println("1)(Task 2) N elements of Fibonacci"); System.out.println("2)(Task 3) Max-Min digits of numbers"); System.out.println("3)(Task 4) First N prime numbers"); System.out.println("4)(Task 5) Convert decimal to binary"); System.out.println(EXIT +") Exit"); System.out.println("Enter your choise --> "); answer=s.nextInt(); switch(answer) { case 1: System.out.print("Entre your number: "); int number = s.nextInt(); Number x1=new Number(number); for(int i=0; i<x1.getNum(); i++) System.out.print(getFib(i)+" "); System.out.println(""); break; case 2: System.out.print("Entre your number: "); int number2 = s.nextInt(); Number x2=new Number(number2); x2.Digits(); break; case 3: System.out.print("Enter two numbers(intervals) "); int number3 = s.nextInt(); int number4 = s.nextInt(); Number x3=new Number(number3); Number x4=new Number(number4); primeR(x3.getNum(),x4.getNum()); break; case 4: System.out.print("Entre your number: "); int number5 = s.nextInt(); Number x5=new Number(number5); System.out.print("Binary number is: "+decimalToBinary(x5.getNum())); break; case EXIT: System.out.println("Goodby"); break; default: System.out.println("Invalid option"); break; } }while(answer!=EXIT); s.close(); } static long getFib(int num) { if(num<2) return 1; else return getFib(num-1) + getFib(num-2); } static int primeR(int low,int high) { int flag; while (low < high) { flag = 0; // if low is a non-prime number, flag will be 1 for (int i = 2; i <= low / 2; ++i) { if (low % i == 0) { flag = 1; break; } } if (flag == 0) System.out.println(low); ++low; } return 0; } static long decimalToBinary(int decimalnum) { long binarynum = 0; int rem, temp = 1; while (decimalnum!=0) { rem = decimalnum%2; decimalnum = decimalnum / 2; binarynum = binarynum + rem*temp; temp = temp * 10; } return binarynum; } }
UTF-8
Java
2,675
java
DriveT2T3T4T5.java
Java
[]
null
[]
import sun.net.www.content.audio.x_aiff; import java.util.Scanner; public class DriveT2T3T4T5 { private static Scanner s=new Scanner (System.in); public static void main(String[] args) { final int EXIT=-1; int answer; do { System.out.println(); System.out.println("Choose one of the following options: "); System.out.println("1)(Task 2) N elements of Fibonacci"); System.out.println("2)(Task 3) Max-Min digits of numbers"); System.out.println("3)(Task 4) First N prime numbers"); System.out.println("4)(Task 5) Convert decimal to binary"); System.out.println(EXIT +") Exit"); System.out.println("Enter your choise --> "); answer=s.nextInt(); switch(answer) { case 1: System.out.print("Entre your number: "); int number = s.nextInt(); Number x1=new Number(number); for(int i=0; i<x1.getNum(); i++) System.out.print(getFib(i)+" "); System.out.println(""); break; case 2: System.out.print("Entre your number: "); int number2 = s.nextInt(); Number x2=new Number(number2); x2.Digits(); break; case 3: System.out.print("Enter two numbers(intervals) "); int number3 = s.nextInt(); int number4 = s.nextInt(); Number x3=new Number(number3); Number x4=new Number(number4); primeR(x3.getNum(),x4.getNum()); break; case 4: System.out.print("Entre your number: "); int number5 = s.nextInt(); Number x5=new Number(number5); System.out.print("Binary number is: "+decimalToBinary(x5.getNum())); break; case EXIT: System.out.println("Goodby"); break; default: System.out.println("Invalid option"); break; } }while(answer!=EXIT); s.close(); } static long getFib(int num) { if(num<2) return 1; else return getFib(num-1) + getFib(num-2); } static int primeR(int low,int high) { int flag; while (low < high) { flag = 0; // if low is a non-prime number, flag will be 1 for (int i = 2; i <= low / 2; ++i) { if (low % i == 0) { flag = 1; break; } } if (flag == 0) System.out.println(low); ++low; } return 0; } static long decimalToBinary(int decimalnum) { long binarynum = 0; int rem, temp = 1; while (decimalnum!=0) { rem = decimalnum%2; decimalnum = decimalnum / 2; binarynum = binarynum + rem*temp; temp = temp * 10; } return binarynum; } }
2,675
0.549159
0.528598
106
23.235849
17.645649
72
false
false
0
0
0
0
0
0
2.820755
false
false
5
bd48e435de901853a5f59a63253ce5f5f3e7ac3f
21,036,749,819,267
a4314bfaffbcf8ca3f20b39d2e8d55d7c56ecf77
/dmmonerylibrary/src/main/java/com/example/dmmonerylibrary/TestUserVo.java
355de28873fa84e558a59677b29690f1c95f18e2
[]
no_license
wrrgit/DomeUtlis
https://github.com/wrrgit/DomeUtlis
1959dd4cbfbc967e81aecd336719b4655108b7ff
7b9f8ba961ea1673f971147efd2917dacef70882
refs/heads/master
"2021-09-28T17:03:41.870000"
"2017-12-11T09:46:08"
"2017-12-11T09:46:08"
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.dmmonerylibrary; import android.arch.persistence.room.ColumnInfo; import android.arch.persistence.room.Entity; import android.arch.persistence.room.ForeignKey; import android.arch.persistence.room.Ignore; import android.arch.persistence.room.Index; /** * @作者: PJ * @创建时间: 2017/11/30 / 11:32 * @描述: 这是一个 TestUserVo 类. */ @Entity(tableName = "TestUserVo", indices = @Index(value = "_new_password", unique = false), inheritSuperIndices = true, foreignKeys = @ForeignKey(entity = TestVoBase.class, parentColumns = "_id", childColumns = "_new_password")) public class TestUserVo extends TestVoBase{ @ColumnInfo(name = "_userName") private String userName; // 用户名 @ColumnInfo(name = "_new_password") protected String new_password; // 密码 @Ignore public TestUserVo() { } public TestUserVo(String userName, String nickName, String password, String new_password) { super(nickName, password); this.userName = userName; this.new_password = new_password; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public String getNickName() { return nickName; } public void setNickName(String nickName) { this.nickName = nickName; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getNew_password() { return new_password; } public void setNew_password(String new_password) { this.new_password = new_password; } @Override public String toString() { return "TestUserVo{" + "id='" + id + '\'' + ", userName='" + userName + '\'' + ", nickName='" + nickName + '\'' + ", password='" + password + '\'' + ", new_password='" + new_password + '\'' + '}'; } }
UTF-8
Java
2,072
java
TestUserVo.java
Java
[ { "context": " android.arch.persistence.room.Index;\n\n/**\n * @作者: PJ\n * @创建时间: 2017/11/30 / 11:32\n * @描述: 这是一个 TestUse", "end": 285, "score": 0.9986893534660339, "start": 283, "tag": "USERNAME", "value": "PJ" }, { "context": "super(nickName, password);\n this.userName = userName;\n this.new_password = new_password;\n }\n", "end": 991, "score": 0.946518063545227, "start": 983, "tag": "USERNAME", "value": "userName" }, { "context": "s.userName = userName;\n this.new_password = new_password;\n }\n\n public String getUserName() {\n ", "end": 1033, "score": 0.9798586964607239, "start": 1021, "tag": "PASSWORD", "value": "new_password" }, { "context": "\n\n public String getUserName() {\n return userName;\n }\n\n public void setUserName(String userNa", "end": 1099, "score": 0.8937646150588989, "start": 1091, "tag": "USERNAME", "value": "userName" }, { "context": "serName(String userName) {\n this.userName = userName;\n }\n\n public String getNickName() {\n ", "end": 1187, "score": 0.8904303312301636, "start": 1179, "tag": "USERNAME", "value": "userName" }, { "context": "\n\n public String getPassword() {\n return password;\n }\n\n public void setPassword(String passwo", "end": 1407, "score": 0.701391339302063, "start": 1399, "tag": "PASSWORD", "value": "password" }, { "context": "assword(String password) {\n this.password = password;\n }\n\n public String getNew_password() {\n ", "end": 1495, "score": 0.9013853073120117, "start": 1487, "tag": "PASSWORD", "value": "password" }, { "context": "String new_password) {\n this.new_password = new_password;\n }\n\n @Override\n public String ", "end": 1664, "score": 0.8483973741531372, "start": 1661, "tag": "PASSWORD", "value": "new" }, { "context": "g new_password) {\n this.new_password = new_password;\n }\n\n @Override\n public String toString(", "end": 1673, "score": 0.6975997090339661, "start": 1665, "tag": "PASSWORD", "value": "password" }, { "context": "='\" + id + '\\'' +\n \", userName='\" + userName + '\\'' +\n \", nickName='\" + nickNam", "end": 1836, "score": 0.9822324514389038, "start": 1828, "tag": "USERNAME", "value": "userName" }, { "context": "nickName + '\\'' +\n \", password='\" + password + '\\'' +\n \", new_password='\" + new", "end": 1938, "score": 0.9803656935691833, "start": 1930, "tag": "PASSWORD", "value": "password" }, { "context": "word + '\\'' +\n \", new_password='\" + new_password + '\\'' +\n '}';\n }\n}\n", "end": 1988, "score": 0.9409077763557434, "start": 1985, "tag": "PASSWORD", "value": "new" } ]
null
[]
package com.example.dmmonerylibrary; import android.arch.persistence.room.ColumnInfo; import android.arch.persistence.room.Entity; import android.arch.persistence.room.ForeignKey; import android.arch.persistence.room.Ignore; import android.arch.persistence.room.Index; /** * @作者: PJ * @创建时间: 2017/11/30 / 11:32 * @描述: 这是一个 TestUserVo 类. */ @Entity(tableName = "TestUserVo", indices = @Index(value = "_new_password", unique = false), inheritSuperIndices = true, foreignKeys = @ForeignKey(entity = TestVoBase.class, parentColumns = "_id", childColumns = "_new_password")) public class TestUserVo extends TestVoBase{ @ColumnInfo(name = "_userName") private String userName; // 用户名 @ColumnInfo(name = "_new_password") protected String new_password; // 密码 @Ignore public TestUserVo() { } public TestUserVo(String userName, String nickName, String password, String new_password) { super(nickName, password); this.userName = userName; this.new_password = <PASSWORD>; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public String getNickName() { return nickName; } public void setNickName(String nickName) { this.nickName = nickName; } public String getPassword() { return <PASSWORD>; } public void setPassword(String password) { this.password = <PASSWORD>; } public String getNew_password() { return new_password; } public void setNew_password(String new_password) { this.new_password = new_<PASSWORD>; } @Override public String toString() { return "TestUserVo{" + "id='" + id + '\'' + ", userName='" + userName + '\'' + ", nickName='" + nickName + '\'' + ", password='" + <PASSWORD> + '\'' + ", new_password='" + new_password + '\'' + '}'; } }
2,078
0.608055
0.602161
76
25.789474
30.959785
229
false
false
0
0
0
0
0
0
0.447368
false
false
5
2d62ea346c672d09ba4bfd842065c298c4889d01
32,229,434,637,374
41b001886440610ff9303616d06e3abf001b5452
/src/main/java/com/tigratius/javacore/chapter07/PassObjRef/PassObjRef.java
dc944c433d30f2b917191ddd759ff51d64fa2362
[]
no_license
tigratius/JavaCore
https://github.com/tigratius/JavaCore
8514180d929216afdc5699436977830659bc9574
50f68a967b70eed39a90f6eb60e8bcd8d2fedde1
refs/heads/master
"2020-04-22T14:25:25.083000"
"2019-06-03T17:13:52"
"2019-06-03T17:14:54"
170,443,048
3
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package main.java.com.alex.javacore.chapter07.PassObjRef; class Test { int a, b; Test(int i, int j) { a = i; b = j; } void meth(Test o) { o.a *= 2; o.b /= 2; } } public class PassObjRef { public static void main(String args[]) { Test ob = new Test(15, 20); System.out.println("ob.a и ob.b до вызова метода: " + ob.a + " " + ob.b); ob.meth(ob); System.out.println("ob.a и ob.b после вызова метода: " + ob.a + " " + ob.b); } }
UTF-8
Java
590
java
PassObjRef.java
Java
[]
null
[]
package main.java.com.alex.javacore.chapter07.PassObjRef; class Test { int a, b; Test(int i, int j) { a = i; b = j; } void meth(Test o) { o.a *= 2; o.b /= 2; } } public class PassObjRef { public static void main(String args[]) { Test ob = new Test(15, 20); System.out.println("ob.a и ob.b до вызова метода: " + ob.a + " " + ob.b); ob.meth(ob); System.out.println("ob.a и ob.b после вызова метода: " + ob.a + " " + ob.b); } }
590
0.472172
0.45781
30
17.566668
19.069492
64
false
false
0
0
0
0
0
0
0.433333
false
false
5
3ce60ad5c22690d9bc3cd13243fc0a49dadd415f
32,023,276,207,588
ce5bddee88c804f846c7def48578839d97df3f3a
/service/company/company-core/src/main/java/com/sean/company/bean/DeptBeanImpl.java
e44a1fe2145f787a33fd3daff9c920ed24b354f0
[]
no_license
seanzwx/service
https://github.com/seanzwx/service
d3d380e095374070a31cc9ad4621174cfca447f0
8a0156e7e0364aae09aab878aa7f37863cb9d469
refs/heads/master
"2016-08-06T12:02:27.710000"
"2014-11-07T09:45:38"
"2014-11-07T09:45:38"
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.sean.company.bean; import java.util.ArrayList; import java.util.List; import org.apache.log4j.Logger; import com.sean.common.ioc.BeanConfig; import com.sean.common.util.TimeUtil; import com.sean.company.api.Dept; import com.sean.company.api.StaffsExistsException; import com.sean.company.constant.L; import com.sean.company.entity.DeptEntity; import com.sean.log.core.LogFactory; import com.sean.persist.core.Dao; import com.sean.persist.enums.OrderEnum; import com.sean.persist.ext.Condition; import com.sean.persist.ext.Order; import com.sean.persist.ext.Value; @BeanConfig("部门接口") public class DeptBeanImpl { private static final Logger logger = LogFactory.getLogger(L.Dept); /** * 创建部门 * @param companyId * @param deptName * @param parentDept * @return */ public DeptEntity createDept(Dept dept) { DeptEntity de = new DeptEntity(); de.setCompanyId(dept.getCompanyId()); de.setCreateTime(TimeUtil.getYYYYMMDDHHMMSSTime()); de.setDeptName(dept.getDeptName().toString()); de.setParentDept(dept.getParentDept()); de.setDeptLeaderId(dept.getDeptLeaderId()); Dao.persist(DeptEntity.class, de); logger.debug("创建部门:" + de); return de; } /** * 读取公司部门, 按照parentDept排序 * @param companyId * @return */ public List<DeptEntity> getDeptsOfCompany(long companyId) { return Dao.getListByColumn(DeptEntity.class, "companyId", companyId, new Order("parentDept", OrderEnum.Asc)); } /** * 删除部门 * @param companyId * @param deptId * @return */ public boolean deleteDept(long companyId, long deptId) throws StaffsExistsException { StaffBeanImpl ssi = new StaffBeanImpl(); // 如果部门下存在员工抛出业务异常 int count = ssi.getStaffCountOfDept(companyId, deptId); if (count > 0) { throw new StaffsExistsException(); } List<Condition> conds = getBaseCond(companyId, deptId, 2); Dao.remove(DeptEntity.class, conds); logger.debug("删除部门:companyId=" + companyId + ",deptId=" + deptId); return true; } /** * 修改部门 * @param companyId * @param deptId * @param deptName */ public void updateDept(Dept dept) { List<Condition> conds = getBaseCond(dept.getCompanyId(), dept.getDeptId(), 2); List<Value> vals = new ArrayList<>(3); vals.add(new Value("deptName", dept.getDeptName().toString())); vals.add(new Value("deptLeaderId", dept.getDeptLeaderId())); vals.add(new Value("parentDept", dept.getParentDept())); Dao.update(DeptEntity.class, conds, vals); logger.debug("删除部门: companyId=" + dept.getCompanyId() + ",deptId=" + dept.getDeptId() + ": " + vals); } /** * 转换 * @param deptList * @return */ public List<Dept> convert(List<DeptEntity> deptList) { List<Dept> list = new ArrayList<>(deptList.size()); for (DeptEntity it : deptList) { Dept d = new Dept(it.getDeptId(), it.getDeptName(), it.getCreateTime(), it.getCompanyId(), it.getParentDept(), it.getDeptLeaderId()); list.add(d); } return list; } private List<Condition> getBaseCond(long companyId, long deptId, int size) { List<Condition> conds = new ArrayList<>(size); conds.add(new Condition("companyId", companyId)); conds.add(new Condition("deptId", deptId)); return conds; } }
UTF-8
Java
3,279
java
DeptBeanImpl.java
Java
[]
null
[]
package com.sean.company.bean; import java.util.ArrayList; import java.util.List; import org.apache.log4j.Logger; import com.sean.common.ioc.BeanConfig; import com.sean.common.util.TimeUtil; import com.sean.company.api.Dept; import com.sean.company.api.StaffsExistsException; import com.sean.company.constant.L; import com.sean.company.entity.DeptEntity; import com.sean.log.core.LogFactory; import com.sean.persist.core.Dao; import com.sean.persist.enums.OrderEnum; import com.sean.persist.ext.Condition; import com.sean.persist.ext.Order; import com.sean.persist.ext.Value; @BeanConfig("部门接口") public class DeptBeanImpl { private static final Logger logger = LogFactory.getLogger(L.Dept); /** * 创建部门 * @param companyId * @param deptName * @param parentDept * @return */ public DeptEntity createDept(Dept dept) { DeptEntity de = new DeptEntity(); de.setCompanyId(dept.getCompanyId()); de.setCreateTime(TimeUtil.getYYYYMMDDHHMMSSTime()); de.setDeptName(dept.getDeptName().toString()); de.setParentDept(dept.getParentDept()); de.setDeptLeaderId(dept.getDeptLeaderId()); Dao.persist(DeptEntity.class, de); logger.debug("创建部门:" + de); return de; } /** * 读取公司部门, 按照parentDept排序 * @param companyId * @return */ public List<DeptEntity> getDeptsOfCompany(long companyId) { return Dao.getListByColumn(DeptEntity.class, "companyId", companyId, new Order("parentDept", OrderEnum.Asc)); } /** * 删除部门 * @param companyId * @param deptId * @return */ public boolean deleteDept(long companyId, long deptId) throws StaffsExistsException { StaffBeanImpl ssi = new StaffBeanImpl(); // 如果部门下存在员工抛出业务异常 int count = ssi.getStaffCountOfDept(companyId, deptId); if (count > 0) { throw new StaffsExistsException(); } List<Condition> conds = getBaseCond(companyId, deptId, 2); Dao.remove(DeptEntity.class, conds); logger.debug("删除部门:companyId=" + companyId + ",deptId=" + deptId); return true; } /** * 修改部门 * @param companyId * @param deptId * @param deptName */ public void updateDept(Dept dept) { List<Condition> conds = getBaseCond(dept.getCompanyId(), dept.getDeptId(), 2); List<Value> vals = new ArrayList<>(3); vals.add(new Value("deptName", dept.getDeptName().toString())); vals.add(new Value("deptLeaderId", dept.getDeptLeaderId())); vals.add(new Value("parentDept", dept.getParentDept())); Dao.update(DeptEntity.class, conds, vals); logger.debug("删除部门: companyId=" + dept.getCompanyId() + ",deptId=" + dept.getDeptId() + ": " + vals); } /** * 转换 * @param deptList * @return */ public List<Dept> convert(List<DeptEntity> deptList) { List<Dept> list = new ArrayList<>(deptList.size()); for (DeptEntity it : deptList) { Dept d = new Dept(it.getDeptId(), it.getDeptName(), it.getCreateTime(), it.getCompanyId(), it.getParentDept(), it.getDeptLeaderId()); list.add(d); } return list; } private List<Condition> getBaseCond(long companyId, long deptId, int size) { List<Condition> conds = new ArrayList<>(size); conds.add(new Condition("companyId", companyId)); conds.add(new Condition("deptId", deptId)); return conds; } }
3,279
0.70811
0.706532
122
24.97541
25.842989
136
false
false
0
0
0
0
0
0
1.696721
false
false
5
69460d9e603c91de2cc0a630b2f2435827a3c27b
5,196,910,481,625
4c3adc395b5999406a811406b22e35351e14df61
/app/src/main/java/com/example/studentinfo/model/Student.java
a33902e91b11c5591ccd2935d53c5ab5982fcac9
[]
no_license
androidstudentreg/StudentRegistration
https://github.com/androidstudentreg/StudentRegistration
31383da1edfd91398e4394599bb66d7b8e128b70
bdb2283993a80ac96159b7b3bc43bec73c9cabbc
refs/heads/master
"2020-06-04T21:34:07.131000"
"2015-08-13T10:24:36"
"2015-08-13T10:24:36"
40,652,850
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.studentinfo.model; /** * Created by vinay on 28/6/15. */ public class Student { String regNo; String name; String dept; String degree; public String getRegNo() { return regNo; } public void setRegNo(String regNo) { this.regNo = regNo; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDept() { return dept; } public void setDept(String dept) { this.dept = dept; } public String getDegree() { return degree; } public void setDegree(String degree) { this.degree = degree; } }
UTF-8
Java
718
java
Student.java
Java
[ { "context": " com.example.studentinfo.model;\n\n/**\n * Created by vinay on 28/6/15.\n */\npublic class Student {\n\n Strin", "end": 63, "score": 0.9989577531814575, "start": 58, "tag": "USERNAME", "value": "vinay" } ]
null
[]
package com.example.studentinfo.model; /** * Created by vinay on 28/6/15. */ public class Student { String regNo; String name; String dept; String degree; public String getRegNo() { return regNo; } public void setRegNo(String regNo) { this.regNo = regNo; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDept() { return dept; } public void setDept(String dept) { this.dept = dept; } public String getDegree() { return degree; } public void setDegree(String degree) { this.degree = degree; } }
718
0.564067
0.557103
47
14.276596
13.832896
42
false
false
0
0
0
0
0
0
0.276596
false
false
5
3e9f8165fbd7adc92b8be491518a99429fb6b876
14,130,442,456,677
200b8d9107a43a177350c9fb89780989482d1e25
/qbase/src/main/java/com/lqcool/qbase/base/annotation/Column.java
1eac51d66d312e040933cba258e2d53d673b8414
[]
no_license
LQ55/source
https://github.com/LQ55/source
f9fc7c24d052e5fded0a71ecf67d042beac80660
67b9aceb34539790156e6afe0f4de3b8d7da418d
refs/heads/master
"2021-01-01T16:54:52.661000"
"2019-01-08T06:35:53"
"2019-01-08T06:35:53"
97,952,386
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.lqcool.qbase.base.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Target(ElementType.FIELD)//作用于字段 @Retention(RetentionPolicy.RUNTIME)//注解作到于运行时 public @interface Column { /** * 字段映射到数据库字段名 * @return */ public String DBColumnName() default ""; /** * 字段中文名称 * @return */ public String label() default ""; /** * 字段注释 * @return */ public String conment() default ""; /** * 字段是否为空,默认允许为空 * @return */ public boolean nullable() default true; /** * 字段的长度 * @return */ public int length() default -1; /** * 外键名称 * @return */ public String FKName() default ""; /** * 字段是否自增 * @return */ public boolean isidentity() default false; /** * 字段是否为主键 * @return */ public boolean isprimarykey() default false; /** * 字段是否唯一 * @return */ public boolean isunique() default false; }
UTF-8
Java
1,144
java
Column.java
Java
[]
null
[]
package com.lqcool.qbase.base.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Target(ElementType.FIELD)//作用于字段 @Retention(RetentionPolicy.RUNTIME)//注解作到于运行时 public @interface Column { /** * 字段映射到数据库字段名 * @return */ public String DBColumnName() default ""; /** * 字段中文名称 * @return */ public String label() default ""; /** * 字段注释 * @return */ public String conment() default ""; /** * 字段是否为空,默认允许为空 * @return */ public boolean nullable() default true; /** * 字段的长度 * @return */ public int length() default -1; /** * 外键名称 * @return */ public String FKName() default ""; /** * 字段是否自增 * @return */ public boolean isidentity() default false; /** * 字段是否为主键 * @return */ public boolean isprimarykey() default false; /** * 字段是否唯一 * @return */ public boolean isunique() default false; }
1,144
0.643863
0.642857
66
14.060606
14.921896
45
false
false
0
0
0
0
0
0
1.030303
false
false
5
9bae5a140793ce70c0087b3365e5d7becb56d15b
489,626,336,107
a66e899edfcca1c3676ae19db15fd770cd87037e
/src/com/kissan/javadesign/solid/d/IDatabase.java
9e121bb3896dd24518d200dadd4ce9c65cf76b18
[]
no_license
kissannaik/javadesign
https://github.com/kissannaik/javadesign
57da5216fb24b478d85b4c156841b07791747c02
78be267f2c7b30b7422a30369dadfa1b9d5c5699
refs/heads/master
"2022-12-07T09:06:26.104000"
"2020-08-30T06:42:58"
"2020-08-30T06:42:58"
291,208,960
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.kissan.javadesign.solid.d; public interface IDatabase { void connect(); void disconnect(); }
UTF-8
Java
114
java
IDatabase.java
Java
[]
null
[]
package com.kissan.javadesign.solid.d; public interface IDatabase { void connect(); void disconnect(); }
114
0.710526
0.710526
6
18
13.723459
38
false
false
0
0
0
0
0
0
0.5
false
false
5
0e9c1965e78e04499fbb2368d13de0be2226e9da
27,874,337,798,636
a2b699456c94eed6cc54bf8366d1fab91781aeca
/pangu/pangu-taishang/pangu-taishang-biz/src/main/java/com/colourfulchina/pangu/taishang/mapper/CityMapper.java
32c7ed3daa06cc45dd8e1a9f29403c76f2e857b2
[]
no_license
elephant5/old-code
https://github.com/elephant5/old-code
8a35aa17163e87f506c6f12da032b1978b0c4ec3
bfb27297d5fcb6aaea8eac5a4032eba7d01cc7ee
refs/heads/master
"2023-01-24T12:25:53.549000"
"2020-12-04T01:50:15"
"2020-12-04T01:50:15"
318,364,156
1
2
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.colourfulchina.pangu.taishang.mapper; import com.baomidou.mybatisplus.mapper.BaseMapper; import com.colourfulchina.pangu.taishang.api.entity.City; import com.colourfulchina.pangu.taishang.api.vo.CityVo; import com.colourfulchina.pangu.taishang.api.vo.res.city.CityRes; import java.util.List; public interface CityMapper extends BaseMapper<City> { List<CityVo> selectByCountryId(String countryId); List<CityRes> selectCityInfoList(Integer goodsId); }
UTF-8
Java
475
java
CityMapper.java
Java
[]
null
[]
package com.colourfulchina.pangu.taishang.mapper; import com.baomidou.mybatisplus.mapper.BaseMapper; import com.colourfulchina.pangu.taishang.api.entity.City; import com.colourfulchina.pangu.taishang.api.vo.CityVo; import com.colourfulchina.pangu.taishang.api.vo.res.city.CityRes; import java.util.List; public interface CityMapper extends BaseMapper<City> { List<CityVo> selectByCountryId(String countryId); List<CityRes> selectCityInfoList(Integer goodsId); }
475
0.814737
0.814737
15
30.666666
26.355686
65
false
false
0
0
0
0
0
0
0.533333
false
false
5
df0f91bc500f1cca4f3afb00d4421cb29e46a9df
4,097,398,856,430
ded009ac0b873fc3b643a1d7e69f71789d56f47e
/src/gui/ParametersPanelController.java
b715748248a0e6c7d8beeb80f3ea0f3381d2f210
[]
no_license
BramDB24/TaijitanAdminPlatform
https://github.com/BramDB24/TaijitanAdminPlatform
b2c4ec4065f2f7ef374e1eba815286f65cc467bc
f9439e19e5ed2df26d42bdff4fcfdfe924cc1ea7
refs/heads/master
"2022-10-15T04:14:55.565000"
"2019-05-23T06:53:33"
"2019-05-23T06:53:33"
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * 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 gui; import domein.Observer; import java.io.IOException; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.scene.control.Button; import javafx.scene.control.DatePicker; import javafx.scene.layout.GridPane; /** * FXML Controller class * * @author Johanna */ public class ParametersPanelController extends GridPane implements Observer{ private MainPanelController mainPanel; @FXML private DatePicker datumParameter; @FXML private Button toonOverzicht; public ParametersPanelController (MainPanelController mainPanel) { FXMLLoader loader = new FXMLLoader(getClass().getResource("ParametersPanel.fxml")); loader.setRoot(this); loader.setController(this); try { loader.load(); } catch (IOException ex) { throw new RuntimeException(ex); } } @Override public void update(Object object) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } }
UTF-8
Java
1,286
java
ParametersPanelController.java
Java
[ { "context": "dPane;\n\n/**\n * FXML Controller class\n *\n * @author Johanna\n */\npublic class ParametersPanelController extend", "end": 471, "score": 0.9996712803840637, "start": 464, "tag": "NAME", "value": "Johanna" } ]
null
[]
/* * 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 gui; import domein.Observer; import java.io.IOException; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.scene.control.Button; import javafx.scene.control.DatePicker; import javafx.scene.layout.GridPane; /** * FXML Controller class * * @author Johanna */ public class ParametersPanelController extends GridPane implements Observer{ private MainPanelController mainPanel; @FXML private DatePicker datumParameter; @FXML private Button toonOverzicht; public ParametersPanelController (MainPanelController mainPanel) { FXMLLoader loader = new FXMLLoader(getClass().getResource("ParametersPanel.fxml")); loader.setRoot(this); loader.setController(this); try { loader.load(); } catch (IOException ex) { throw new RuntimeException(ex); } } @Override public void update(Object object) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } }
1,286
0.694401
0.694401
47
26.361702
27.583086
135
false
false
0
0
0
0
0
0
0.468085
false
false
5
b07bf4225a456861f420828dd5ef501dd453defb
19,585,050,925,051
94965db0a6742ff229f23f1d93f4f3831cb641d9
/GestionARG/src/java/Servelet/Servelet_Clientes.java
17ee53d0bbbe971edbb676ec87ec9f1be7609f48
[]
no_license
MaxiRaza/GestionARG
https://github.com/MaxiRaza/GestionARG
beae0969726de1effed7c19ff5fbd4f5b2fe581e
b51c1c2b896d78202bbed7f26c9385d401ff280c
refs/heads/main
"2023-06-19T10:43:52.234000"
"2021-07-16T19:29:29"
"2021-07-16T19:29:29"
361,981,496
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Servelet; import Gestor.Gestor_Clientes; import Gestor.Gestor_Contactos; import Gestor.Gestor_Tipo_Clientes; import Modelo.Cliente; import Modelo.Contacto; import Modelo.DTO.DTO_Cliente; import java.io.IOException; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @WebServlet(name = "Clientes", urlPatterns = {"/Clientes"}) public class Servelet_Clientes extends HttpServlet { Gestor_Clientes gc = new Gestor_Clientes(); Gestor_Contactos gco = new Gestor_Contactos(); Gestor_Tipo_Clientes gtc = new Gestor_Tipo_Clientes(); @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //Variable global para asignar cantidad de filas de la tabla (Arranca por la fila N = 0) int filas = 9; request.getSession().setAttribute("servelet", "Clientes"); String modo = request.getParameter("modo"); request.getSession().setAttribute("modificar", false); request.getSession().setAttribute("accion", "Registrar"); request.getSession().setAttribute("t", true); request.getSession().setAttribute("co", false); if (modo == null) { if (request.getSession().getAttribute("log") != null) { request.getSession().setAttribute("activar", 4); request.getSession().setAttribute("cantidad", filas); request.getSession().setAttribute("db", "disabled"); if (gc.obtenerClientesDTO().size() > filas) { request.getSession().setAttribute("da", "enabled"); } else { request.getSession().setAttribute("da", "disabled"); } request.setAttribute("listadoClientes", gc.obtenerClientesDTO()); RequestDispatcher rd = getServletContext().getRequestDispatcher("/Clientes/listado_Clientes.jsp"); rd.forward(request, response); } else { RequestDispatcher rd = getServletContext().getRequestDispatcher("/Login/login.jsp"); rd.forward(request, response); } } else if (modo.equals("AM")) { request.getSession().setAttribute("t", false); if (request.getParameter("id_cliente") != null) { request.getSession().setAttribute("modificar", true); request.getSession().setAttribute("accion", "Editar"); int id_cliente = Integer.parseInt(request.getParameter("id_cliente")); DTO_Cliente c = gc.obtenerClienteDTO(id_cliente); request.setAttribute("cliente", c); } request.setAttribute("listadoTipos", gtc.obtenerTipoClientes()); RequestDispatcher rd = getServletContext().getRequestDispatcher("/Clientes/AM_Cliente.jsp"); rd.forward(request, response); } else if (modo.equals("eliminar")) { if (request.getParameter("a") != null) { request.getSession().setAttribute("e", true); request.getSession().setAttribute("id", Integer.parseInt(request.getParameter("id"))); request.getSession().setAttribute("nombre", "el cliente " + (gc.obtenerCliente(Integer.parseInt(request.getParameter("id"))).getNombre() + " " + gc.obtenerCliente(Integer.parseInt(request.getParameter("id"))).getApellido())); } else if (request.getParameter("e") != null) { request.getSession().setAttribute("e", false); gc.eliminarCliente(Integer.parseInt(request.getParameter("id"))); } else { request.getSession().setAttribute("e", false); } request.setAttribute("listadoClientes", gc.obtenerClientesDTO()); RequestDispatcher rd = getServletContext().getRequestDispatcher("/Clientes/listado_Clientes.jsp"); rd.forward(request, response); } else if (modo.equals("limite")) { if (gc.obtenerClientesDTO().size() > Integer.parseInt(request.getParameter("cantidad")) && Integer.parseInt(request.getParameter("cantidad")) > filas) { request.getSession().setAttribute("da", "enable"); request.getSession().setAttribute("db", "enabled"); } else if (Integer.parseInt(request.getParameter("cantidad")) > filas) { request.getSession().setAttribute("da", "disabled"); request.getSession().setAttribute("db", "enable"); } else { request.getSession().setAttribute("da", "enabled"); request.getSession().setAttribute("db", "disabled"); } } else if (modo.equals("tema")) { if (request.getParameter("color").equals("oscuro")) { request.getSession().setAttribute("color", "claro"); } else { request.getSession().setAttribute("color", "oscuro"); } } request.getSession().setAttribute("n", filas); if (request.getParameter("cantidad") != null) { request.getSession().setAttribute("cantidad", (Integer.parseInt(request.getParameter("cantidad")))); } request.setAttribute("listadoClientes", gc.obtenerClientesDTO()); RequestDispatcher rd = getServletContext().getRequestDispatcher("/Clientes/listado_Clientes.jsp"); rd.forward(request, response); } @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Cliente c = new Cliente(); Contacto co = new Contacto(); c.setId_cliente(Integer.parseInt(request.getParameter("txtIdCliente"))); c.setId_contacto(Integer.parseInt(request.getParameter("txtIdContacto"))); co.setId_contacto(Integer.parseInt(request.getParameter("txtIdContacto"))); c.setNombre(request.getParameter("txtNombre")); c.setApellido(request.getParameter("txtApellido")); c.setDocumento(request.getParameter("txtDocumento")); c.setFecha_nac(request.getParameter("txtFechaNac")); c.setDireccion(request.getParameter("txtDireccion")); co.setCorreo(request.getParameter("txtCorreo")); co.setTelefono(request.getParameter("txtTelefono")); c.setId_tipo_cliente(Integer.parseInt(request.getParameter("cmbTipos"))); if (c.getId_cliente() == 0) { if (gco.obtenerIdContacto(co.getCorreo(), co.getTelefono()) == 0) { gco.agregarContacto(co); } c.setId_contacto(gco.obtenerIdContacto(co.getCorreo(), co.getTelefono())); gc.agregarCliente(c); } else { gco.actualizarContacto(co); gc.actualizarCliente(c); } request.getSession().setAttribute("co", true); request.getSession().setAttribute("t", true); request.setAttribute("listadoClientes", gc.obtenerClientesDTO()); RequestDispatcher rd = getServletContext().getRequestDispatcher("/Clientes/listado_Clientes.jsp"); rd.forward(request, response); } @Override public String getServletInfo() { return "GestionARG"; } }
UTF-8
Java
7,507
java
Servelet_Clientes.java
Java
[]
null
[]
package Servelet; import Gestor.Gestor_Clientes; import Gestor.Gestor_Contactos; import Gestor.Gestor_Tipo_Clientes; import Modelo.Cliente; import Modelo.Contacto; import Modelo.DTO.DTO_Cliente; import java.io.IOException; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @WebServlet(name = "Clientes", urlPatterns = {"/Clientes"}) public class Servelet_Clientes extends HttpServlet { Gestor_Clientes gc = new Gestor_Clientes(); Gestor_Contactos gco = new Gestor_Contactos(); Gestor_Tipo_Clientes gtc = new Gestor_Tipo_Clientes(); @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //Variable global para asignar cantidad de filas de la tabla (Arranca por la fila N = 0) int filas = 9; request.getSession().setAttribute("servelet", "Clientes"); String modo = request.getParameter("modo"); request.getSession().setAttribute("modificar", false); request.getSession().setAttribute("accion", "Registrar"); request.getSession().setAttribute("t", true); request.getSession().setAttribute("co", false); if (modo == null) { if (request.getSession().getAttribute("log") != null) { request.getSession().setAttribute("activar", 4); request.getSession().setAttribute("cantidad", filas); request.getSession().setAttribute("db", "disabled"); if (gc.obtenerClientesDTO().size() > filas) { request.getSession().setAttribute("da", "enabled"); } else { request.getSession().setAttribute("da", "disabled"); } request.setAttribute("listadoClientes", gc.obtenerClientesDTO()); RequestDispatcher rd = getServletContext().getRequestDispatcher("/Clientes/listado_Clientes.jsp"); rd.forward(request, response); } else { RequestDispatcher rd = getServletContext().getRequestDispatcher("/Login/login.jsp"); rd.forward(request, response); } } else if (modo.equals("AM")) { request.getSession().setAttribute("t", false); if (request.getParameter("id_cliente") != null) { request.getSession().setAttribute("modificar", true); request.getSession().setAttribute("accion", "Editar"); int id_cliente = Integer.parseInt(request.getParameter("id_cliente")); DTO_Cliente c = gc.obtenerClienteDTO(id_cliente); request.setAttribute("cliente", c); } request.setAttribute("listadoTipos", gtc.obtenerTipoClientes()); RequestDispatcher rd = getServletContext().getRequestDispatcher("/Clientes/AM_Cliente.jsp"); rd.forward(request, response); } else if (modo.equals("eliminar")) { if (request.getParameter("a") != null) { request.getSession().setAttribute("e", true); request.getSession().setAttribute("id", Integer.parseInt(request.getParameter("id"))); request.getSession().setAttribute("nombre", "el cliente " + (gc.obtenerCliente(Integer.parseInt(request.getParameter("id"))).getNombre() + " " + gc.obtenerCliente(Integer.parseInt(request.getParameter("id"))).getApellido())); } else if (request.getParameter("e") != null) { request.getSession().setAttribute("e", false); gc.eliminarCliente(Integer.parseInt(request.getParameter("id"))); } else { request.getSession().setAttribute("e", false); } request.setAttribute("listadoClientes", gc.obtenerClientesDTO()); RequestDispatcher rd = getServletContext().getRequestDispatcher("/Clientes/listado_Clientes.jsp"); rd.forward(request, response); } else if (modo.equals("limite")) { if (gc.obtenerClientesDTO().size() > Integer.parseInt(request.getParameter("cantidad")) && Integer.parseInt(request.getParameter("cantidad")) > filas) { request.getSession().setAttribute("da", "enable"); request.getSession().setAttribute("db", "enabled"); } else if (Integer.parseInt(request.getParameter("cantidad")) > filas) { request.getSession().setAttribute("da", "disabled"); request.getSession().setAttribute("db", "enable"); } else { request.getSession().setAttribute("da", "enabled"); request.getSession().setAttribute("db", "disabled"); } } else if (modo.equals("tema")) { if (request.getParameter("color").equals("oscuro")) { request.getSession().setAttribute("color", "claro"); } else { request.getSession().setAttribute("color", "oscuro"); } } request.getSession().setAttribute("n", filas); if (request.getParameter("cantidad") != null) { request.getSession().setAttribute("cantidad", (Integer.parseInt(request.getParameter("cantidad")))); } request.setAttribute("listadoClientes", gc.obtenerClientesDTO()); RequestDispatcher rd = getServletContext().getRequestDispatcher("/Clientes/listado_Clientes.jsp"); rd.forward(request, response); } @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Cliente c = new Cliente(); Contacto co = new Contacto(); c.setId_cliente(Integer.parseInt(request.getParameter("txtIdCliente"))); c.setId_contacto(Integer.parseInt(request.getParameter("txtIdContacto"))); co.setId_contacto(Integer.parseInt(request.getParameter("txtIdContacto"))); c.setNombre(request.getParameter("txtNombre")); c.setApellido(request.getParameter("txtApellido")); c.setDocumento(request.getParameter("txtDocumento")); c.setFecha_nac(request.getParameter("txtFechaNac")); c.setDireccion(request.getParameter("txtDireccion")); co.setCorreo(request.getParameter("txtCorreo")); co.setTelefono(request.getParameter("txtTelefono")); c.setId_tipo_cliente(Integer.parseInt(request.getParameter("cmbTipos"))); if (c.getId_cliente() == 0) { if (gco.obtenerIdContacto(co.getCorreo(), co.getTelefono()) == 0) { gco.agregarContacto(co); } c.setId_contacto(gco.obtenerIdContacto(co.getCorreo(), co.getTelefono())); gc.agregarCliente(c); } else { gco.actualizarContacto(co); gc.actualizarCliente(c); } request.getSession().setAttribute("co", true); request.getSession().setAttribute("t", true); request.setAttribute("listadoClientes", gc.obtenerClientesDTO()); RequestDispatcher rd = getServletContext().getRequestDispatcher("/Clientes/listado_Clientes.jsp"); rd.forward(request, response); } @Override public String getServletInfo() { return "GestionARG"; } }
7,507
0.623152
0.622486
187
39.144386
36.272373
241
false
false
0
0
0
0
0
0
0.737968
false
false
5
0cf4fbf05978b1840a92c0509ec32f1b30287837
7,138,235,702,519
fe838feb9e277107af435ff1c0d483143b70f1cd
/September/0908/com/nctu02/Query.java
17197284ee07e335d779479ed158552f0f9a613e
[]
no_license
long171507090/Myproject
https://github.com/long171507090/Myproject
d3659142e630950bf003deb2666e6e61330dc744
36a7e617865ad7f479f53e3b4f1c8f378e6922c1
refs/heads/master
"2021-09-01T05:07:21.114000"
"2017-12-25T00:43:15"
"2017-12-25T00:43:15"
103,264,819
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.nctu02; import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JButton; import javax.swing.JTextField; import javax.swing.JLabel; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.table.DefaultTableModel; import com.nctu02.dao.userdao; import com.nctu02.user.Users; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.util.List; public class Query { JFrame frame; private JTextField textField; private JTable table; private JTextField textField_1; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { Query window = new Query(); window.frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the application. */ public Query() { initialize(); } /** * Initialize the contents of the frame. */ private void initialize() { frame = new JFrame(); frame.setBounds(100, 100, 450, 300); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(null); textField = new JTextField(); textField.setBounds(90, 35, 108, 21); frame.getContentPane().add(textField); textField.setColumns(10); JLabel lblNewLabel = new JLabel("请输入查询名字:"); lblNewLabel.setBounds(90, 10, 108, 15); frame.getContentPane().add(lblNewLabel); JLabel label = new JLabel("查询性别:"); label.setBounds(235, 10, 80, 15); frame.getContentPane().add(label); textField_1 = new JTextField(); textField_1.setBounds(235, 35, 108, 21); frame.getContentPane().add(textField_1); textField_1.setColumns(10); JButton btnNewButton = new JButton("查 询"); btnNewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String name = textField.getText(); String sax = textField_1.getText(); userdao dao = new userdao(); List<Users> list = dao.query(name,sax); Object[][] data = new Object[list.size()][4]; for (int i = 0; i <list.size();i++) { data[i][0] = list.get(i).getName(); data[i][1] = list.get(i).getSax(); data[i][2] = list.get(i).getHobby(); data[i][3] = list.get(i).getBirthday(); } JScrollPane scrollPane = new JScrollPane(); scrollPane.setBounds(90, 66, 273, 115); frame.getContentPane().add(scrollPane); table = new JTable(); table.setModel(new DefaultTableModel( data, new String[] { "姓名", "性别", "爱好", "生日" } )); scrollPane.setViewportView(table); } }); btnNewButton.setBounds(90, 191, 93, 30); frame.getContentPane().add(btnNewButton); JButton btnNewButton_1 = new JButton("返 回"); btnNewButton_1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Jframe2 window = new Jframe2(); window.frame.setVisible(true); frame.setVisible(false); } }); btnNewButton_1.setBounds(251, 191, 93, 30); frame.getContentPane().add(btnNewButton_1); } }
UTF-8
Java
3,160
java
Query.java
Java
[]
null
[]
package com.nctu02; import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JButton; import javax.swing.JTextField; import javax.swing.JLabel; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.table.DefaultTableModel; import com.nctu02.dao.userdao; import com.nctu02.user.Users; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.util.List; public class Query { JFrame frame; private JTextField textField; private JTable table; private JTextField textField_1; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { Query window = new Query(); window.frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the application. */ public Query() { initialize(); } /** * Initialize the contents of the frame. */ private void initialize() { frame = new JFrame(); frame.setBounds(100, 100, 450, 300); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(null); textField = new JTextField(); textField.setBounds(90, 35, 108, 21); frame.getContentPane().add(textField); textField.setColumns(10); JLabel lblNewLabel = new JLabel("请输入查询名字:"); lblNewLabel.setBounds(90, 10, 108, 15); frame.getContentPane().add(lblNewLabel); JLabel label = new JLabel("查询性别:"); label.setBounds(235, 10, 80, 15); frame.getContentPane().add(label); textField_1 = new JTextField(); textField_1.setBounds(235, 35, 108, 21); frame.getContentPane().add(textField_1); textField_1.setColumns(10); JButton btnNewButton = new JButton("查 询"); btnNewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String name = textField.getText(); String sax = textField_1.getText(); userdao dao = new userdao(); List<Users> list = dao.query(name,sax); Object[][] data = new Object[list.size()][4]; for (int i = 0; i <list.size();i++) { data[i][0] = list.get(i).getName(); data[i][1] = list.get(i).getSax(); data[i][2] = list.get(i).getHobby(); data[i][3] = list.get(i).getBirthday(); } JScrollPane scrollPane = new JScrollPane(); scrollPane.setBounds(90, 66, 273, 115); frame.getContentPane().add(scrollPane); table = new JTable(); table.setModel(new DefaultTableModel( data, new String[] { "姓名", "性别", "爱好", "生日" } )); scrollPane.setViewportView(table); } }); btnNewButton.setBounds(90, 191, 93, 30); frame.getContentPane().add(btnNewButton); JButton btnNewButton_1 = new JButton("返 回"); btnNewButton_1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Jframe2 window = new Jframe2(); window.frame.setVisible(true); frame.setVisible(false); } }); btnNewButton_1.setBounds(251, 191, 93, 30); frame.getContentPane().add(btnNewButton_1); } }
3,160
0.662171
0.628131
129
23.139534
17.262562
57
false
false
0
0
0
0
0
0
2.930233
false
false
5
4b940da079c5675f2756a5c14f8e1cb68d7dd833
10,376,641,049,514
586093246b2368c38f787c1f923d53363eab9be0
/src/main/java/com/answer/binarysearch/Q69_Sqrt.java
933d967a46922d6dd1a5270f857638bf96020ed1
[]
permissive
KevinXie0131/leetcode
https://github.com/KevinXie0131/leetcode
3d81581eb1baa69561900852c56d01a78211fda9
58e043fb95d1bf2b6a69212522d42df336e58b31
refs/heads/master
"2023-08-05T20:32:13.297000"
"2023-07-27T22:24:22"
"2023-07-27T22:24:22"
199,320,102
0
0
Apache-2.0
false
"2022-10-27T03:07:25"
"2019-07-28T17:55:46"
"2022-10-27T03:06:01"
"2022-10-27T03:07:24"
9
0
0
0
Java
false
false
package com.answer.binarysearch; public class Q69_Sqrt { public int mySqrt(int x) { int left = 0, right = x; while(left <= right){ int mid = (left + right) >>> 1; if((long)mid * mid <= x) { left = mid + 1; } else { right = mid - 1; } } return left - 1; } /** * */ public int mySqrt_1(int x) { if (x < 2) return x; long num; int pivot, left = 2, right = x / 2; while (left <= right) { pivot = left + (right - left) / 2; num = (long)pivot * pivot; if (num > x) right = pivot - 1; else if (num < x) left = pivot + 1; else return pivot; } return right; } }
UTF-8
Java
809
java
Q69_Sqrt.java
Java
[]
null
[]
package com.answer.binarysearch; public class Q69_Sqrt { public int mySqrt(int x) { int left = 0, right = x; while(left <= right){ int mid = (left + right) >>> 1; if((long)mid * mid <= x) { left = mid + 1; } else { right = mid - 1; } } return left - 1; } /** * */ public int mySqrt_1(int x) { if (x < 2) return x; long num; int pivot, left = 2, right = x / 2; while (left <= right) { pivot = left + (right - left) / 2; num = (long)pivot * pivot; if (num > x) right = pivot - 1; else if (num < x) left = pivot + 1; else return pivot; } return right; } }
809
0.401731
0.384425
37
20.864864
15.46253
47
false
false
0
0
0
0
0
0
0.486486
false
false
5