blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
313
cd6aeb0af9013b08bba169dc279b696de9eefcc7
94be142ad501fdaf5ef73c96abb10bda28b647c6
/JavaRushHomeWork/src/com/javarush/test/level02/lesson08/task06/Solution.java
e6e0952b6eeaa5dc8b5ef87f127698a8e882de8d
[]
no_license
KirillKarelin/Javarush
51d713e6f81c75dcfcd60e53d60c4166120b04aa
d5e278208e803011ca9aa68df7b7ebc5f707f8ee
refs/heads/master
2020-07-19T22:48:40.898182
2016-11-14T22:31:32
2016-11-14T22:31:32
73,752,304
0
0
null
null
null
null
UTF-8
Java
false
false
669
java
package com.javarush.test.level02.lesson08.task06; /* Вывод текста на экран Написать функцию, которая выводит переданную строку (слово) на экран три раза, но в одной строке. Слова должны быть разделены пробелом и не должны сливаться в одно. */ public class Solution { public static void print3(String s) { System.out.println(s + " " + s + " " + s);//напишите тут ваш код } public static void main(String[] args) { print3("window"); print3("file"); } }
d204f97db4c5bbba913db9172683f3fd61316854
6e47ca8b27d8df5fa51cfe24fcd5f22f8f14b45d
/apptentive/src/main/java/com/apptentive/android/sdk/conversation/ConversationMetadataLoadException.java
6c14178be7cae4e6035645c0f641286e40692422
[]
permissive
apptentive/apptentive-android
bbcaa9f39a5f081763a8e4d8fa944ca77a9afb09
91aebf3fa758edddd40924f06aecdf1be4f12683
refs/heads/master
2022-10-09T17:50:08.570575
2022-09-26T17:42:28
2022-09-26T17:42:28
2,466,190
43
35
BSD-3-Clause
2022-09-26T17:42:29
2011-09-27T07:51:41
Java
UTF-8
Java
false
false
224
java
package com.apptentive.android.sdk.conversation; public class ConversationMetadataLoadException extends Exception { public ConversationMetadataLoadException(String message, Throwable cause) { super(message, cause); } }
fe5d36e4619050f6b7d3bd6dcbc793747cbdb14a
be73270af6be0a811bca4f1710dc6a038e4a8fd2
/crash-reproduction-moho/results/XWIKI-14122-17-19-MOEAD-WeightedSum:TestLen:CallDiversity/com/xpn/xwiki/store/XWikiHibernateStore_ESTest.java
60255ce42b6e9308cd0282a8aab96d7d88514578
[]
no_license
STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application
cf118b23ecb87a8bf59643e42f7556b521d1f754
3bb39683f9c343b8ec94890a00b8f260d158dfe3
refs/heads/master
2022-07-29T14:44:00.774547
2020-08-10T15:14:49
2020-08-10T15:14:49
285,804,495
0
0
null
null
null
null
UTF-8
Java
false
false
564
java
/* * This file was automatically generated by EvoSuite * Thu Apr 09 12:11:35 UTC 2020 */ package com.xpn.xwiki.store; import org.junit.Test; import static org.junit.Assert.*; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.junit.runner.RunWith; @RunWith(EvoRunner.class) @EvoRunnerParameters(useVFS = true, useJEE = true) public class XWikiHibernateStore_ESTest extends XWikiHibernateStore_ESTest_scaffolding { @Test public void notGeneratedAnyTest() { // EvoSuite did not generate any tests } }
a8200a3e4ecae6fe21fb15e0c9229fdc6d8d2885
7ca2639cdea890027f52f6221a7d728d950a0ebd
/DevChat/.svn/pristine/a8/a8200a3e4ecae6fe21fb15e0c9229fdc6d8d2885.svn-base
e01c3c567c3f081a32b0438c34628e0fadc6b631
[]
no_license
dsaraon/workspace
0fc63c901e4ceb998e3433bbecbee4d023ee0543
86f5a83f7276ded4090f1c2b03b6b030c6da4273
refs/heads/master
2020-05-21T08:48:01.660892
2016-09-27T13:35:48
2016-09-27T13:35:48
69,360,108
0
0
null
null
null
null
UTF-8
Java
false
false
226
package tests; import client.Client; public class TestableClient extends Client { public TestableClient(String host, int portNumber) { super(host, portNumber); // TODO Auto-generated constructor stub } }
4616e7a58851299586c9becc78b300d5dd8ae1e9
5f20dbbef5f313f836bde5962d155d4c7722f7cb
/app/src/main/java/com/example/administrator/practice/basis/Fibonacci.java
8641fd92ed0788de33127151918bde2c8b267c43
[]
no_license
YangRT/practice
61b2ffd7524e5fa3386f557dc317e4263a0aa8f7
d108ba4c0dd8f53fe8d5f12b2fcd9b0e25b89238
refs/heads/master
2022-04-13T07:17:14.781590
2020-04-10T13:35:35
2020-04-10T13:35:35
254,642,769
0
0
null
null
null
null
UTF-8
Java
false
false
308
java
package com.example.administrator.practice.basis; public class Fibonacci implements Generator<Integer>{ private int count = 0; private int fib(int n){ if(n < 2) return 1; return fib(n-2)+fib(n-1); } @Override public Integer next() { return fib(count++); } }
7ea240eef27c70b206149686e59c5d32ca6992c4
82f952ef3523fe0a7f5e07f1eb15f6e5849627ae
/MyShop/src/main/java/com/myshop/demo/service/ShopService.java
508cf38e9cdf31c8427c81c151344dd7bcb64fea
[]
no_license
santoshsh2307/MyShop0909
62c26d4099aad64df899418dad7fb0e355e303c2
d0bebd0fc1a6900ff10c5917de9cd63bb24e9fa4
refs/heads/main
2023-07-19T11:38:01.942118
2021-09-09T04:47:38
2021-09-09T04:47:38
404,586,743
0
0
null
null
null
null
UTF-8
Java
false
false
399
java
package com.myshop.demo.service; import java.util.List; import java.util.Optional; import com.myshop.demo.entity.ShopDetails; public interface ShopService { ShopDetails saveShop(ShopDetails s); ShopDetails findShopById(Long id); List<ShopDetails> findAll(); List<ShopDetails> findShopByShopName(String shopName); Optional<ShopDetails> findByAddress(String add); }
7204fc6c044dd30af2fe69d87ad8005655842b9a
3450fbb15528bb84427089b8ba46822e2535fea6
/src/test/java/sun/springframework/springrestclientexamples/services/impl/ApiServiceImplTest.java
e05e6d75372ef28669fa17a2bb4981ff9b34ae9e
[]
no_license
SunilKushwah/spring-rest-client-examples
9050bc8ee0cb807730d1bbe224222b005ccfc7a5
d7cbd8be66309ca3e3ebaedd75fba4237f144ada
refs/heads/main
2023-06-28T06:00:43.141589
2021-08-02T19:47:10
2021-08-02T19:47:10
389,875,496
0
0
null
null
null
null
UTF-8
Java
false
false
883
java
package sun.springframework.springrestclientexamples.services.impl; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit.jupiter.SpringExtension; import sun.springframework.api.domain.User; import sun.springframework.springrestclientexamples.services.ApiService; import java.util.List; import static org.junit.jupiter.api.Assertions.*; @ExtendWith(SpringExtension.class) @SpringBootTest class ApiServiceImplTest { @Autowired private ApiService apiService; @BeforeEach void setUp() { } @Test void getUsers() { List<User> users = apiService.getUsers(1); assertEquals(1,users.size()); } }
e591372686725dd11dd18a015c75ea557dfd5e88
7a2aadf19c1cbb6074d66720e7722b8245506325
/src/main/java/org/lx/patterns/creational/factorymethod/Creator.java
49f7700a85bc825b42ab568d53ad24dcf43b569f
[]
no_license
fspore/shiro_hello
95b037e566c51582d51acf152dc008837016dfb7
7b1375619bb67b329f39ba8323ee5a313d319f81
refs/heads/master
2021-01-01T04:26:55.643667
2016-05-15T10:42:36
2016-05-15T10:42:36
58,849,209
0
0
null
null
null
null
UTF-8
Java
false
false
622
java
package org.lx.patterns.creational.factorymethod; /** * abstract Creator which establishes the * logic without any concrete implementation. * The construction of the concrete product---ConcreteLogger * is defered by abstracting the {@link #factoryMethod()}. * * @author lx * */ public abstract class Creator { public void anOperation() { Logger logger = factoryMethod(); //complex logic here: logger.regiter(); logger.doStuff(); logger.doOtherStuff(); } /**abstract this method. So the construction is defered. But relationship can be established.*/ protected abstract Logger factoryMethod(); }
0b06d0e266c5c8f8207cfc18ec24335f7d5cf0f6
a4d8a757427cbeb8621a1c8e0167170780111234
/practice/src/main/java/ca/jrvs/apps/practice/codingChallenge/ValidParentheses.java
fb904c7df815b8eb81a3b6991266ac428af90f59
[]
no_license
mephistoshadow/jarvis_data_eng_SiqiYang
23ae9337026035ac8727031f60534ccaebac3c4e
4a2a11c9d335287142861c43a7369826ff7735b7
refs/heads/master
2023-01-24T18:20:16.230134
2020-12-04T15:06:01
2020-12-04T15:06:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,080
java
package ca.jrvs.apps.practice.codingChallenge; import java.util.HashMap; import java.util.Stack; /** * link: https://www.notion.so/b4a0204920ca4ea2a0f507e3d4eda4b5?v=1ae54ae9d0894f1fb0db44bed1409821&p=28a5cbda565d48228d10a5265075d416 */ public class ValidParentheses { private HashMap map = new HashMap(); private Stack stack; /** * O(n) * we use the the stack data structure's characteristic to implement it. Because the problem has the * recursive structure, then if we can not pop up all the elements. Then it is the invalid string. * @param s * @return */ public boolean isValid(String s) { stack = new Stack(); map.put(')','('); map.put(']','['); map.put('}','{'); for(int i =0; i<s.length(); i ++) { if(s.charAt(i) == '(' || s.charAt(i) == '['|| s.charAt(i) == '{') { stack.push(s.charAt(i)); }else if (s.charAt(i) == ')' || s.charAt(i) == ']'|| s.charAt(i) == '}') { if(stack.peek() == map.get(s.charAt(i))) { stack.pop(); } } } return stack.isEmpty(); } }
4a9aeeb00ced994be7fcb66d89a087c2fcd04a4f
95e1e57a81e8bf0fda33bd071386f78e347541b8
/src/com/game/net/m15/M1501.java
0360729a32140f23ca2ec7a8c01bc04144a66a72
[]
no_license
itfvck/lywg
053ef3228c9c030cf0cb2f5de787c29174646424
c5d453004841c4b2f2c3a8349798f04cb09d8558
refs/heads/master
2021-01-01T04:41:01.815819
2016-03-03T00:50:51
2016-03-03T00:50:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,554
java
package com.game.net.m15; import org.frkd.io.InputByteArray; import org.frkd.net.socket.protocol.BasicMessage; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * new player appeared */ public class M1501 extends BasicMessage { public long result; public int type; public Map info; @Override public void decode(byte[] data) { InputByteArray dis = new InputByteArray(data); int _local2 = dis.readByte(); this.info = new HashMap(); this.info.put("id", dis.readUnsignedInt()); this.info.put("x", dis.readShort()); this.info.put("y", dis.readShort()); this.info.put("angle", dis.readByte()); _local2 = dis.readByte(); if (_local2 == 0) { this.info.put("state", dis.readByte()); this.info.put("buff", dis.readShort()); this.info.put("hp", dis.readUnsignedInt()); this.info.put("maxhp", dis.readUnsignedInt()); this.info.put("level", dis.readByte()); this.info.put("sex", dis.readByte()); this.info.put("job", dis.readByte()); this.info.put("name", dis.readUTF()); this.info.put("clothtid", dis.readShort()); this.info.put("swordid", dis.readShort()); this.info.put("group", dis.readByte()); this.info.put("faction", dis.readUTF()); this.info.put("title", dis.readUnsignedInt()); this.info.put("guildid", dis.readUnsignedInt()); this.info.put("color", dis.readByte()); if (dis.available() > 0) { int _local3 = dis.readShort(); List _local4 = new ArrayList(); while (_local3-- > 0) { Map _local5 = new HashMap(); _local5.put("id", dis.readByte()); _local5.put("title", dis.readUTF()); _local4.add(_local5); } this.info.put("titleary", _local4); } this.info.put("mp1", dis.readUnsignedInt()); this.info.put("maxmp1", dis.readUnsignedInt()); } else { if (_local2 == 1) { this.info.put("state", dis.readByte()); this.info.put("buff", dis.readShort()); this.info.put("hp", dis.readUnsignedInt()); this.info.put("maxhp", dis.readUnsignedInt()); this.info.put("name", dis.readUTF()); this.info.put("clothtid", dis.readShort()); if (dis.available() > 0) { this.info.put("level", dis.readShort()); } if (dis.available() > 0) { this.info.put("warcamp", dis.readByte()); } } else { this.info.put("clothtid", dis.readShort()); this.info.put("name", dis.readUTF()); } } } @Override public String toString() { return "M1501{" + "result=" + result + ", type=" + type + ", info=" + info + '}'; } }
11a43b91701b449d58efcd1f5af9b99a0462c652
2ba35f7430572bc098cb8ffdc2e5f92b3bdf04a4
/src/com/automessaging/groups/GroupsActivity.java
0b345e85fdd88bf20802a4898902af5adf2da93e
[]
no_license
srikanthkancheti/AutoMessaging
ffa5198545f6b3fe533fdaab84ec51b7d43b0c14
bb422801778e447938e6c8424f4a2ba2872fc01d
refs/heads/master
2021-01-22T09:05:26.294422
2014-12-29T09:31:59
2014-12-29T09:31:59
27,624,241
1
1
null
null
null
null
UTF-8
Java
false
false
13,254
java
package com.automessaging.groups; import java.sql.SQLException; import java.util.ArrayList; import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; import android.database.Cursor; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.AdapterView.OnItemLongClickListener; import android.widget.BaseAdapter; import android.widget.EditText; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; import com.automessaging.ProfileActivity; import com.automessaging.R; import com.automessaging.database.ProfilesDatabaseHelper; import com.automessaging.readContacts.ContactListActivity; public class GroupsActivity extends Activity { private ProfilesDatabaseHelper mDBHelper; private boolean[] checkArray; private ArrayList<GroupsModel> groups_list = null; private ListView groups_listView; private boolean isUpdateAB = false; private GroupsListAdapter _GroupsListAdapter = null; private int count; protected void onCreate(Bundle bundle) { super.onCreate(bundle); setContentView(R.layout.activity_groups); groups_listView = (ListView) findViewById(R.id.groups_listView); groups_list = new ArrayList<GroupsActivity.GroupsModel>(); mDBHelper = new ProfilesDatabaseHelper(this); try { mDBHelper.open(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } getGroups(); _GroupsListAdapter.notifyDataSetChanged(); SelectAB_Update(); groups_listView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // TODO Auto-generated method stub TextView temp = (TextView) view.findViewById(R.id.groups_list_item_textView); String groupName = temp.getText().toString(); String replyMsg = mDBHelper.getRelpyMessage(groupName); Intent selectContactsIntent = new Intent(GroupsActivity.this, ContactListActivity.class).putExtra("group_name", groupName).putExtra("from_groups_reply_msg", replyMsg); startActivity(selectContactsIntent); } }); groups_listView.setOnItemLongClickListener(new OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { // TODO Auto-generated method stub TextView temp = (TextView) view.findViewById(R.id.groups_list_item_textView); final String groupName = temp.getText().toString(); AlertDialog.Builder alert = new AlertDialog.Builder(GroupsActivity.this); // alert.setTitle("Note Search"); alert.setTitle("Delete"); alert.setMessage("Are you sure ! you want to delete "+groupName +"?"); alert.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { mDBHelper.deleteGroups(groupName); mDBHelper.deleteGroupContacts(groupName); getGroups(); _GroupsListAdapter.notifyDataSetChanged(); if(!(groups_listView.getCount()>0)){ finish(); } SelectAB_Update(); invalidateOptionsMenu(); } }); alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { // Canceled. dialog.dismiss(); } }); alert.show(); return false; } }); } private void getGroups() { // TODO Auto-generated method stub groups_list.clear(); Cursor objcur=mDBHelper.getGroupNames("SELECT * FROM GroupDetails"); try{ if(objcur!=null&&objcur.moveToFirst()){ int count=0; objcur.moveToPosition(count); do{ GroupsModel _groupsModel = new GroupsModel(); _groupsModel.setGroupName(objcur.getString(1)); _groupsModel.set_id(objcur.getLong(0)); groups_list.add(_groupsModel); _groupsModel = null; }while(objcur.moveToNext()); } }catch(Exception e){ System.out.print("get Groups check...."+e.getMessage()); }finally{ //objcur.close(); } checkArray = new boolean[groups_list.size()]; _GroupsListAdapter = new GroupsListAdapter(); groups_listView.setAdapter(_GroupsListAdapter); _GroupsListAdapter.notifyDataSetChanged(); invalidateOptionsMenu(); } protected void onResume() { super.onResume(); overridePendingTransition(R.anim.slide_in_up, R.anim.slide_out_up); getGroups(); SelectAB_Update(); invalidateOptionsMenu(); } protected void onPause() { super.onPause(); overridePendingTransition(R.anim.slide_in_down, R.anim.slide_out_down); getGroups(); SelectAB_Update(); _GroupsListAdapter.notifyDataSetChanged(); invalidateOptionsMenu(); } @Override public void onBackPressed() { super.onBackPressed(); // Intent intent = new Intent(GroupsActivity.this, ProfileActivity.class); // startActivity(intent); finish(); } public void SelectAB_Update(){ if(groups_listView.getCount()>0){ isUpdateAB = false; } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.activity_groups_actions, menu); MenuItem item = null; if (groups_listView.getCount() > 0) { if(!isUpdateAB){ //menu.findItem(R.id.action_discard).setEnabled(true).setVisible(true); menu.findItem(R.id.action_select).setEnabled(true).setVisible(true); menu.findItem(R.id.action_new).setEnabled(true).setVisible(true); menu.findItem(R.id.action_done).setEnabled(false).setVisible(false); item = menu.add(Menu.NONE, R.id.action_new, Menu.NONE, R.string.new_group); //item = menu.add(Menu.NONE, R.id.action_discard , Menu.NONE,R.string.delete); item = menu.add(Menu.NONE, R.id.action_select, Menu.NONE, "Select"); }else{ menu.findItem(R.id.action_done).setEnabled(true).setVisible(true); //menu.findItem(R.id.action_discard).setEnabled(false).setVisible(false); menu.findItem(R.id.action_select).setEnabled(false).setVisible(false); menu.findItem(R.id.action_new).setEnabled(false).setVisible(false); item = menu.add(Menu.NONE, R.id.action_done, Menu.NONE,R.string.done); } }else{ menu.findItem(R.id.action_select).setEnabled(false).setVisible(false); //menu.findItem(R.id.action_discard).setEnabled(false).setVisible(false); menu.findItem(R.id.action_done).setEnabled(false).setVisible(false); menu.findItem(R.id.action_new).setEnabled(true).setVisible(true); item = menu.add(Menu.NONE, R.id.action_new, Menu.NONE, R.string.new_group); } return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. switch (item.getItemId()) { case R.id.action_new: // New profile action GroupDialog(); return true; case R.id.action_done: StringBuilder _itemBuilder = new StringBuilder(); StringBuilder _itemBuild = new StringBuilder(); _GroupsListAdapter.setEditMode(false); _GroupsListAdapter.notifyDataSetChanged(); isUpdateAB = false; invalidateOptionsMenu(); for(int i =0;i<groups_list.size();i++){ if(checkArray[i]) { count = mDBHelper.groupDetailsCount(groups_list.get(i).getGroupName()); if(count >0){ _itemBuilder.append(groups_list.get(i).getGroupName()+ ","); } else{ _itemBuild.append(groups_list.get(i).getGroupName()+", "); } } } if(!(_itemBuild.length()>0)){ _itemBuilder.deleteCharAt(_itemBuilder.length()-1); Log.v(getClass().getName(), "Check.."+_itemBuilder.toString()); Intent groupsIntent = new Intent(GroupsActivity.this, ProfileActivity.class).putExtra("selected_groups", _itemBuilder.toString()); startActivity(groupsIntent); //finish(); }else{ _itemBuild.deleteCharAt(_itemBuild.length()-1); Toast.makeText(getApplicationContext(), ""+_itemBuild+" has no contacts !", Toast.LENGTH_LONG).show(); } getGroups(); break; case R.id.action_select: _GroupsListAdapter.setEditMode(true); _GroupsListAdapter.notifyDataSetChanged(); isUpdateAB = true; invalidateOptionsMenu(); } return true; } private void GroupDialog() { // TODO Auto-generated method stub AlertDialog.Builder alert = new AlertDialog.Builder(GroupsActivity.this); // alert.setTitle("Note Search"); alert.setTitle("Enter Group Name"); // Set an EditText view to get user input final EditText input = new EditText(GroupsActivity.this); input.setHint("Group Name"); alert.setView(input); alert.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { String value = input.getText().toString(); // Do something with value! if (value.length() == 0) { input.setError("Please enter a group name"); } else { mDBHelper.executeSQL("INSERT INTO GroupDetails (GroupName) VALUES ('"+ value + "')"); getGroups(); dialog.dismiss(); } } }); alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { // Canceled. dialog.dismiss(); } }); alert.show(); } public class GroupsListAdapter extends BaseAdapter{ LayoutInflater inflater; private boolean isEdit; public GroupsListAdapter(){ this.inflater = LayoutInflater.from(GroupsActivity.this); } public void setEditMode(boolean b) { // TODO Auto-generated method stub this.isEdit = b; } @Override public int getCount() { // TODO Auto-generated method stub return groups_list == null ? 0 : groups_list.size(); } @Override public Object getItem(int position) { // TODO Auto-generated method stub return groups_list.get(position); } @Override public long getItemId(int position) { // TODO Auto-generated method stub return 0; } @Override public View getView(final int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub final ViewHolder holder = convertView == null ? new ViewHolder() : (ViewHolder) convertView.getTag(); if(convertView == null){ convertView = inflater.inflate(R.layout.groups_list_item, null); // holder.tv = (TextView) findViewById(R.id.groups_list_item_textView); holder.tv = (TextView) convertView.findViewById(R.id.groups_list_item_textView); holder.iv = (ImageView) convertView.findViewById(R.id.group_checkbox_imageView); holder.rv = (RelativeLayout) convertView.findViewById(R.id.groups_relativeLayout); holder.ll = (LinearLayout) convertView.findViewById(R.id.groups_listItem_groupName_ll); convertView.setTag(holder); } holder.tv.setText(groups_list.get(position).getGroupName()); if(isEdit){ holder.iv.setVisibility(View.VISIBLE); holder.iv.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub if(checkArray != null && checkArray[position]){ checkArray[position] = false; _GroupsListAdapter.notifyDataSetChanged(); }else{ checkArray[position] = true; _GroupsListAdapter.notifyDataSetChanged(); } } }); if(checkArray != null && checkArray[position]){ holder.iv.setImageResource(R.drawable.setting_check); }else{ holder.iv.setImageResource(R.drawable.setting_check_box_bg); } }else{ holder.iv.setVisibility(View.GONE); } return convertView; } public class ViewHolder { public LinearLayout ll; public ImageView iv; public RelativeLayout rv; public TextView tv; } } public class GroupsModel { public String groupName; Long _id; public long get_id() { return _id; } public void set_id(long _id) { this._id = _id; } public String getGroupName() { return groupName; } public void setGroupName(String title) { this.groupName = title; } } }
7fa6781ead2d0008b8da200d3358757097e4258e
7b73756ba240202ea92f8f0c5c51c8343c0efa5f
/classes6/com/tencent/biz/qqstory/model/StoryManager.java
6b78d8bd77028ca4f5bff5cf2f9be029125bfefe
[]
no_license
meeidol-luo/qooq
588a4ca6d8ad579b28dec66ec8084399fb0991ef
e723920ac555e99d5325b1d4024552383713c28d
refs/heads/master
2020-03-27T03:16:06.616300
2016-10-08T07:33:58
2016-10-08T07:33:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
23,861
java
package com.tencent.biz.qqstory.model; import com.tencent.biz.qqstory.app.QQStoryContext; import com.tencent.biz.qqstory.base.Copyable; import com.tencent.biz.qqstory.base.OneObjectCacheList; import com.tencent.biz.qqstory.base.preload.storylist.IPreloadVideoSource; import com.tencent.biz.qqstory.base.preload.storylist.PreloadVideoSource; import com.tencent.biz.qqstory.database.HotTopicEntry; import com.tencent.biz.qqstory.database.LiveVideoEntry; import com.tencent.biz.qqstory.database.StoryEntry; import com.tencent.biz.qqstory.database.StoryVideoEntry; import com.tencent.biz.qqstory.database.StoryVideoListEntry; import com.tencent.biz.qqstory.model.item.HotTopicItem; import com.tencent.biz.qqstory.model.item.StoryItem; import com.tencent.biz.qqstory.model.item.StoryVideoItem; import com.tencent.mobileqq.hotpatch.NotVerifyClass; import com.tencent.mobileqq.persistence.Entity; import com.tencent.mobileqq.persistence.EntityManager; import com.tencent.mobileqq.persistence.EntityManagerFactory; import com.tencent.mobileqq.persistence.EntityTransaction; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; public class StoryManager implements IManager { public static final int a = 0; public static final int b = 1; public static final int c = 0; public static final int d = 1; protected OneObjectCacheList a; private IPreloadVideoSource jdField_a_of_type_ComTencentBizQqstoryBasePreloadStorylistIPreloadVideoSource; private ArrayList jdField_a_of_type_JavaUtilArrayList; private Map jdField_a_of_type_JavaUtilMap; protected OneObjectCacheList b; private IPreloadVideoSource b; public StoryManager() { boolean bool = NotVerifyClass.DO_VERIFY_CLASS; this.jdField_a_of_type_ComTencentBizQqstoryBaseOneObjectCacheList = new OneObjectCacheList(300); this.jdField_b_of_type_ComTencentBizQqstoryBaseOneObjectCacheList = new OneObjectCacheList(300); this.jdField_a_of_type_JavaUtilArrayList = new ArrayList(); this.jdField_a_of_type_JavaUtilMap = new HashMap(); } private QQStoryContext a() { return QQStoryContext.a(); } private StoryVideoEntry a(EntityManager paramEntityManager, String paramString) { paramEntityManager = paramEntityManager.a(StoryVideoEntry.class, StoryVideoEntry.class.getSimpleName(), true, StoryVideoEntry.getVidSelectionNoArgs(), new String[] { paramString }, null, null, null, null); if ((paramEntityManager != null) && (paramEntityManager.size() == 1)) { return (StoryVideoEntry)paramEntityManager.get(0); } return null; } public static List a(EntityManager paramEntityManager, Class paramClass, String paramString1, String paramString2, String[] paramArrayOfString) { return paramEntityManager.a(paramClass, paramString1, false, paramString2, paramArrayOfString, null, null, null, null, null); } private StoryItem b(long paramLong, int paramInt) { Object localObject = a(a().a().createEntityManager(), StoryEntry.class, StoryEntry.class.getSimpleName(), StoryEntry.getUidSelectionNoArg(), new String[] { String.valueOf(paramLong), String.valueOf(paramInt) }); if ((localObject == null) || (((List)localObject).size() == 0)) { return null; } localObject = (StoryEntry)((List)localObject).get(0); StoryItem localStoryItem = new StoryItem((StoryEntry)localObject); return (StoryItem)this.jdField_b_of_type_ComTencentBizQqstoryBaseOneObjectCacheList.a(StoryItem.makeFriendKey(((StoryEntry)localObject).uid), localStoryItem); } private StoryVideoItem b(String paramString) { paramString = a(a().a().createEntityManager(), StoryVideoEntry.class, StoryVideoEntry.class.getSimpleName(), StoryVideoEntry.getVidSelectionNoArgs(), new String[] { paramString }); if ((paramString == null) || (paramString.size() == 0)) { return null; } paramString = (StoryVideoEntry)paramString.get(0); StoryVideoItem localStoryVideoItem = new StoryVideoItem(paramString); return (StoryVideoItem)this.jdField_a_of_type_ComTencentBizQqstoryBaseOneObjectCacheList.a(paramString.vid, localStoryVideoItem); } public long a() { List localList = a().a().createEntityManager().a(StoryEntry.class, StoryEntry.class.getSimpleName(), false, StoryEntry.getTypeSelection(1), null, null, null, "updateTime desc", "1"); if ((localList == null) || (localList.size() == 0)) { return 0L; } return ((StoryEntry)localList.get(0)).updateTime; } public IPreloadVideoSource a() { if (this.jdField_a_of_type_ComTencentBizQqstoryBasePreloadStorylistIPreloadVideoSource == null) { this.jdField_a_of_type_ComTencentBizQqstoryBasePreloadStorylistIPreloadVideoSource = new PreloadVideoSource(); this.jdField_a_of_type_ComTencentBizQqstoryBasePreloadStorylistIPreloadVideoSource.b(); } return this.jdField_a_of_type_ComTencentBizQqstoryBasePreloadStorylistIPreloadVideoSource; } public LiveVideoEntry a(long paramLong) { return (LiveVideoEntry)this.jdField_a_of_type_JavaUtilMap.get(Long.valueOf(paramLong)); } public StoryItem a(long paramLong, int paramInt) { if (paramInt == 0) {} for (Object localObject = StoryItem.makeFriendKey(paramLong);; localObject = StoryItem.makeRecentKey(paramLong)) { localObject = (StoryItem)this.jdField_b_of_type_ComTencentBizQqstoryBaseOneObjectCacheList.a(localObject); if (localObject == null) { break; } return (StoryItem)localObject; } return b(paramLong, paramInt); } public StoryItem a(long paramLong, int paramInt, StoryItem paramStoryItem) { a(paramLong, paramInt); paramStoryItem = (StoryItem)this.jdField_b_of_type_ComTencentBizQqstoryBaseOneObjectCacheList.a(paramStoryItem.key, paramStoryItem); a().a().createEntityManager().b(paramStoryItem.cover2StoryEntry()); return paramStoryItem; } public StoryVideoItem a(String paramString) { StoryVideoItem localStoryVideoItem = (StoryVideoItem)this.jdField_a_of_type_ComTencentBizQqstoryBaseOneObjectCacheList.a(paramString); if (localStoryVideoItem != null) { return localStoryVideoItem; } return b(paramString); } public StoryVideoItem a(String paramString, StoryVideoItem paramStoryVideoItem) { a(paramString); paramStoryVideoItem.mVid = paramString; paramString = (StoryVideoItem)this.jdField_a_of_type_ComTencentBizQqstoryBaseOneObjectCacheList.a(paramStoryVideoItem.mVid, paramStoryVideoItem); a().a().createEntityManager().b(paramString.cover2StoryEntry()); return paramString; } public ArrayList a() { if (this.jdField_a_of_type_JavaUtilArrayList.size() == 0) { Object localObject = (ArrayList)a(a().a().createEntityManager(), HotTopicEntry.class, HotTopicEntry.class.getSimpleName(), "", null); if (localObject != null) { localObject = ((ArrayList)localObject).iterator(); while (((Iterator)localObject).hasNext()) { HotTopicEntry localHotTopicEntry = (HotTopicEntry)((Iterator)localObject).next(); this.jdField_a_of_type_JavaUtilArrayList.add(new HotTopicItem(localHotTopicEntry)); } } } return this.jdField_a_of_type_JavaUtilArrayList; } public List a() { ArrayList localArrayList = new ArrayList(); Object localObject = a().a().createEntityManager().a(StoryVideoEntry.class, StoryVideoEntry.class.getSimpleName(), false, StoryVideoEntry.getLocalVideo(), null, null, null, null, null); if (localObject == null) { return localArrayList; } localObject = ((List)localObject).iterator(); while (((Iterator)localObject).hasNext()) { StoryVideoEntry localStoryVideoEntry = (StoryVideoEntry)((Iterator)localObject).next(); StoryVideoItem localStoryVideoItem = (StoryVideoItem)this.jdField_a_of_type_ComTencentBizQqstoryBaseOneObjectCacheList.a(localStoryVideoEntry.vid); if (localStoryVideoItem == null) { localStoryVideoEntry.uploadStatus = 3; localArrayList.add(this.jdField_a_of_type_ComTencentBizQqstoryBaseOneObjectCacheList.a(localStoryVideoEntry.vid, new StoryVideoItem(localStoryVideoEntry))); } else { localArrayList.add(localStoryVideoItem); } } return localArrayList; } public List a(int paramInt) { Object localObject = a().a().createEntityManager(); ArrayList localArrayList = new ArrayList(); localObject = a((EntityManager)localObject, StoryEntry.class, StoryEntry.class.getSimpleName(), StoryEntry.getTypeSelection(paramInt), null); if (localObject == null) { return localArrayList; } localObject = ((List)localObject).iterator(); while (((Iterator)localObject).hasNext()) { StoryItem localStoryItem = new StoryItem((StoryEntry)((Iterator)localObject).next()); this.jdField_b_of_type_ComTencentBizQqstoryBaseOneObjectCacheList.a(localStoryItem.key, localStoryItem); localArrayList.add(localStoryItem); } return localArrayList; } public List a(int paramInt, String paramString) { Object localObject = a().a().createEntityManager(); ArrayList localArrayList = new ArrayList(); paramString = a((EntityManager)localObject, StoryVideoListEntry.class, StoryVideoListEntry.class.getSimpleName(), StoryVideoListEntry.getLabelSelectionNoArg(), new String[] { String.valueOf(paramInt), paramString }); if (paramString == null) { return localArrayList; } paramString = paramString.iterator(); while (paramString.hasNext()) { localObject = b(((StoryVideoListEntry)paramString.next()).vid); if (localObject != null) { localArrayList.add((StoryVideoItem)this.jdField_a_of_type_ComTencentBizQqstoryBaseOneObjectCacheList.a(((StoryVideoItem)localObject).mVid, (Copyable)localObject)); } } return localArrayList; } public List a(int paramInt, String paramString, List paramList, boolean paramBoolean) { EntityManager localEntityManager = a().a().createEntityManager(); ArrayList localArrayList = new ArrayList(paramList.size()); EntityTransaction localEntityTransaction = localEntityManager.a(); try { localEntityTransaction.a(); Object localObject; if (paramBoolean) { localObject = new StoryVideoListEntry(); ((StoryVideoListEntry)localObject).setStatus(1001); localEntityManager.a((Entity)localObject, StoryVideoListEntry.getLabelSelectionNoArg(), new String[] { String.valueOf(paramInt), paramString }); } paramList = paramList.iterator(); while (paramList.hasNext()) { localObject = (StoryVideoItem)paramList.next(); a(((StoryVideoItem)localObject).mVid); localObject = (StoryVideoItem)this.jdField_a_of_type_ComTencentBizQqstoryBaseOneObjectCacheList.a(((StoryVideoItem)localObject).mVid, (Copyable)localObject); localArrayList.add(localObject); localEntityManager.b(((StoryVideoItem)localObject).cover2StoryEntry()); StoryVideoListEntry localStoryVideoListEntry = new StoryVideoListEntry(); localStoryVideoListEntry.listType = paramInt; localStoryVideoListEntry.label = paramString; localStoryVideoListEntry.vid = ((StoryVideoItem)localObject).mVid; localEntityManager.b(localStoryVideoListEntry); } } finally { localEntityTransaction.b(); } localEntityTransaction.b(); return localArrayList; } public List a(long paramLong) { Object localObject = a().a().createEntityManager(); ArrayList localArrayList = new ArrayList(); localObject = a((EntityManager)localObject, StoryVideoListEntry.class, StoryVideoListEntry.class.getSimpleName(), StoryVideoListEntry.getTopicIdSelection(paramLong), null); if (localObject == null) { return localArrayList; } localObject = ((List)localObject).iterator(); while (((Iterator)localObject).hasNext()) { StoryVideoItem localStoryVideoItem = b(((StoryVideoListEntry)((Iterator)localObject).next()).vid); if (localStoryVideoItem != null) { localArrayList.add((StoryVideoItem)this.jdField_a_of_type_ComTencentBizQqstoryBaseOneObjectCacheList.a(localStoryVideoItem.mVid, localStoryVideoItem)); } } return localArrayList; } public List a(long paramLong, int paramInt, List paramList, boolean paramBoolean) { if (paramList == null) { return paramList; } EntityManager localEntityManager = a().a().createEntityManager(); ArrayList localArrayList = new ArrayList(paramList.size()); EntityTransaction localEntityTransaction = localEntityManager.a(); for (;;) { StoryVideoListEntry localStoryVideoListEntry; try { localEntityTransaction.a(); Object localObject; if (paramBoolean) { localObject = new StoryVideoListEntry(); ((StoryVideoListEntry)localObject).setStatus(1001); if (paramInt == 1) { localEntityManager.a((Entity)localObject, StoryVideoListEntry.getRecentUidSelection(paramLong), null); } } else { paramList = paramList.iterator(); if (!paramList.hasNext()) { break; } localObject = (StoryVideoItem)paramList.next(); a(((StoryVideoItem)localObject).mVid); localObject = (StoryVideoItem)this.jdField_a_of_type_ComTencentBizQqstoryBaseOneObjectCacheList.a(((StoryVideoItem)localObject).mVid, (Copyable)localObject); localArrayList.add(localObject); localEntityManager.b(((StoryVideoItem)localObject).cover2StoryEntry()); localStoryVideoListEntry = new StoryVideoListEntry(); localStoryVideoListEntry.uid = paramLong; localStoryVideoListEntry.vid = ((StoryVideoItem)localObject).mVid; if (paramInt != 1) { break label240; } localStoryVideoListEntry.listType = 3; localEntityManager.b(localStoryVideoListEntry); continue; } localEntityManager.a((Entity)localObject, StoryVideoListEntry.getUserUidSelection(paramLong), null); } finally { localEntityTransaction.b(); } continue; label240: localStoryVideoListEntry.listType = 0; } localEntityTransaction.c(); localEntityTransaction.b(); return localArrayList; } public List a(long paramLong, List paramList, boolean paramBoolean) { EntityManager localEntityManager = a().a().createEntityManager(); ArrayList localArrayList = new ArrayList(paramList.size()); EntityTransaction localEntityTransaction = localEntityManager.a(); try { localEntityTransaction.a(); Object localObject; if (paramBoolean) { localObject = new StoryVideoListEntry(); ((StoryVideoListEntry)localObject).setStatus(1001); localEntityManager.a((Entity)localObject, StoryVideoListEntry.getTopicIdSelection(paramLong), null); } paramList = paramList.iterator(); while (paramList.hasNext()) { localObject = (StoryVideoItem)paramList.next(); a(((StoryVideoItem)localObject).mVid); localObject = (StoryVideoItem)this.jdField_a_of_type_ComTencentBizQqstoryBaseOneObjectCacheList.a(((StoryVideoItem)localObject).mVid, (Copyable)localObject); localArrayList.add(localObject); localEntityManager.b(((StoryVideoItem)localObject).cover2StoryEntry()); StoryVideoListEntry localStoryVideoListEntry = new StoryVideoListEntry(); localStoryVideoListEntry.listType = 2; localStoryVideoListEntry.uid = paramLong; localStoryVideoListEntry.vid = ((StoryVideoItem)localObject).mVid; localEntityManager.b(localStoryVideoListEntry); } } finally { localEntityTransaction.b(); } localEntityTransaction.b(); return localArrayList; } public void a() {} public void a(int paramInt) { switch (paramInt) { default: return; case 0: a().b(); b().c(); return; } a().c(); b().b(); } public void a(long paramLong) { this.jdField_a_of_type_JavaUtilMap.remove(Long.valueOf(paramLong)); } public void a(long paramLong, int paramInt) { EntityManager localEntityManager = a().a().createEntityManager(); StoryEntry localStoryEntry = new StoryEntry(); localStoryEntry.setStatus(1001); localEntityManager.a(localStoryEntry, StoryEntry.getUidSelectionNoArg(), new String[] { String.valueOf(paramLong), String.valueOf(paramInt) }); } public void a(long paramLong, LiveVideoEntry paramLiveVideoEntry) { this.jdField_a_of_type_JavaUtilMap.put(Long.valueOf(paramLong), paramLiveVideoEntry); } public void a(String paramString) { EntityManager localEntityManager = a().a().createEntityManager(); Object localObject = new StoryVideoListEntry(); ((StoryVideoListEntry)localObject).setStatus(1001); localEntityManager.a((Entity)localObject, StoryVideoListEntry.getVidSelectionNoArg(), new String[] { paramString }); localObject = new StoryVideoEntry(); ((StoryVideoEntry)localObject).setStatus(1001); localEntityManager.a((Entity)localObject, StoryVideoEntry.getVidSelectionNoArgs(), new String[] { paramString }); } public void a(ArrayList paramArrayList) { this.jdField_a_of_type_JavaUtilArrayList.clear(); this.jdField_a_of_type_JavaUtilArrayList.addAll(paramArrayList); EntityManager localEntityManager = a().a().createEntityManager(); localEntityManager.a().a(); try { localEntityManager.a(HotTopicEntry.class); paramArrayList = paramArrayList.iterator(); while (paramArrayList.hasNext()) { localEntityManager.b(((HotTopicItem)paramArrayList.next()).cover2StoryEntry()); } } finally { localEntityManager.a().b(); } localEntityManager.a().b(); } public void a(List paramList, int paramInt, boolean paramBoolean) { EntityManager localEntityManager = a().a().createEntityManager(); localEntityManager.a().a(); Object localObject; if (paramBoolean) { try { localObject = a(localEntityManager, StoryEntry.class, StoryEntry.class.getSimpleName(), StoryEntry.getTypeSelection(paramInt), null); if (localObject != null) { localObject = ((List)localObject).iterator(); while (((Iterator)localObject).hasNext()) { StoryEntry localStoryEntry = (StoryEntry)((Iterator)localObject).next(); localStoryEntry.setStatus(1001); localEntityManager.b(localStoryEntry); } } paramList = paramList.iterator(); } finally { localEntityManager.a().b(); } } while (paramList.hasNext()) { localObject = (StoryItem)paramList.next(); this.jdField_b_of_type_ComTencentBizQqstoryBaseOneObjectCacheList.a(((StoryItem)localObject).key, (Copyable)localObject); localEntityManager.b(((StoryItem)localObject).cover2StoryEntry()); if ((((StoryItem)localObject).liveVideo != null) && (((StoryItem)localObject).liveVideo.roomId > 0)) { localEntityManager.b(((StoryItem)localObject).liveVideo); } } localEntityManager.a().c(); localEntityManager.a().b(); } public IPreloadVideoSource b() { if (this.jdField_b_of_type_ComTencentBizQqstoryBasePreloadStorylistIPreloadVideoSource == null) { this.jdField_b_of_type_ComTencentBizQqstoryBasePreloadStorylistIPreloadVideoSource = new PreloadVideoSource(); } return this.jdField_b_of_type_ComTencentBizQqstoryBasePreloadStorylistIPreloadVideoSource; } public List b(long paramLong) { ArrayList localArrayList = new ArrayList(); EntityManager localEntityManager = a().a().createEntityManager(); Object localObject = localEntityManager.a(StoryVideoListEntry.class, StoryVideoListEntry.class.getSimpleName(), true, StoryVideoListEntry.getUserUidSelection(paramLong), null, null, null, null, null); if (localObject == null) { return localArrayList; } Iterator localIterator = ((List)localObject).iterator(); while (localIterator.hasNext()) { StoryVideoListEntry localStoryVideoListEntry = (StoryVideoListEntry)localIterator.next(); StoryVideoItem localStoryVideoItem = (StoryVideoItem)this.jdField_a_of_type_ComTencentBizQqstoryBaseOneObjectCacheList.a(localStoryVideoListEntry.vid); localObject = localStoryVideoItem; if (localStoryVideoItem == null) { StoryVideoEntry localStoryVideoEntry = a(localEntityManager, localStoryVideoListEntry.vid); localObject = localStoryVideoItem; if (localStoryVideoEntry != null) { localObject = (StoryVideoItem)this.jdField_a_of_type_ComTencentBizQqstoryBaseOneObjectCacheList.a(localStoryVideoListEntry.vid, new StoryVideoItem(localStoryVideoEntry)); } } if ((localObject != null) && (!StoryVideoItem.isFakeVid(((StoryVideoItem)localObject).mVid))) { localArrayList.add(localObject); } } return localArrayList; } public void b() { if (this.jdField_a_of_type_ComTencentBizQqstoryBasePreloadStorylistIPreloadVideoSource != null) { this.jdField_a_of_type_ComTencentBizQqstoryBasePreloadStorylistIPreloadVideoSource.d(); } if (this.jdField_b_of_type_ComTencentBizQqstoryBasePreloadStorylistIPreloadVideoSource != null) { this.jdField_b_of_type_ComTencentBizQqstoryBasePreloadStorylistIPreloadVideoSource.d(); } } public List c(long paramLong) { if (paramLong != QQStoryContext.a().a()) { return b(paramLong); } List localList = a(); Object localObject = b(paramLong); HashSet localHashSet = new HashSet(localList); localObject = ((List)localObject).iterator(); while (((Iterator)localObject).hasNext()) { StoryVideoItem localStoryVideoItem = (StoryVideoItem)((Iterator)localObject).next(); if (localHashSet.add(localStoryVideoItem)) { localList.add(localStoryVideoItem); } } return localList; } public void c() { this.jdField_a_of_type_ComTencentBizQqstoryBaseOneObjectCacheList.a(20); this.jdField_b_of_type_ComTencentBizQqstoryBaseOneObjectCacheList.a(20); if (this.jdField_a_of_type_ComTencentBizQqstoryBasePreloadStorylistIPreloadVideoSource != null) { this.jdField_a_of_type_ComTencentBizQqstoryBasePreloadStorylistIPreloadVideoSource.a(); } if (this.jdField_b_of_type_ComTencentBizQqstoryBasePreloadStorylistIPreloadVideoSource != null) { this.jdField_b_of_type_ComTencentBizQqstoryBasePreloadStorylistIPreloadVideoSource.a(); } } public List d(long paramLong) { ArrayList localArrayList = new ArrayList(); Object localObject = a().a().createEntityManager().a(StoryVideoListEntry.class, StoryVideoListEntry.class.getSimpleName(), true, StoryVideoListEntry.getRecentUidSelection(paramLong), null, null, null, null, null); if (localObject == null) { return localArrayList; } localObject = ((List)localObject).iterator(); while (((Iterator)localObject).hasNext()) { StoryVideoItem localStoryVideoItem = a(((StoryVideoListEntry)((Iterator)localObject).next()).vid); if ((localStoryVideoItem != null) && (!localStoryVideoItem.mHasWatched)) { localArrayList.add(localStoryVideoItem); } } return localArrayList; } } /* Location: E:\apk\QQ_91\classes6-dex2jar.jar!\com\tencent\biz\qqstory\model\StoryManager.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */
00ec82c2be6e8f2da36d9534dd0ef630a44d2fd9
9c5396e61e5d80540c821da274cc9dc1942c92cd
/src/image_data.java
b4cc3c85d70c6f5b5cb48abb04d8c0f9db91aaf3
[]
no_license
Leader-board/EMD
df2a5cee8f34ac9b4462b2c802537444cc3e1c0e
b21f7758a4f01c486246d1f17e8267b466c267fe
refs/heads/main
2023-06-27T08:20:41.659220
2021-08-03T09:02:54
2021-08-03T09:02:54
383,854,376
0
0
null
null
null
null
UTF-8
Java
false
false
5,523
java
import java.io.IOException; import java.util.Arrays; public class image_data { public static void core() throws IOException { /* given: two images with their grayscale values defined this is in the form of two 2-D integer arrays, which we will define as int[][] image1 and int[][] image2 */ // int[][] image1 = new int[][]{{23,42},{9,12}}; int[][] image1 = get_grayscale.getGrayscale("C:\\Users\\vishn\\OneDrive - University of St Andrews\\EMD2\\MNISTExtractor\\Extracted images\\test set\\1\\2.png"); // int[][] image2 = new int[][]{{44,25},{92,1}}; int[][] image2 = get_grayscale.getGrayscale("C:\\Users\\vishn\\OneDrive - University of St Andrews\\EMD2\\MNISTExtractor\\Extracted images\\test set\\1\\5.png"); // normalise them first (to double arrays) double[][] imagen1 = new double[image1.length][image1[0].length]; double[][] imagen2 = new double[image2.length][image2[0].length]; int image1sum = 0; for (int[] i: image1) { for (int j: i) image1sum+=j; } int image2sum = 0; for (int[] i: image2) { for (int j: i) image2sum+=j; } for (int i = 0; i < image1.length; i++) { for (int j = 0; j < image1[0].length; j++) { imagen1[i][j] = (double)image1[i][j]/(double)image1sum; } } for (int i = 0; i < image2.length; i++) { for (int j = 0; j < image2[0].length; j++) { imagen2[i][j] = (double)image2[i][j]/(double)image2sum; } } // compare double[][] comp = new double[image1.length][image1[0].length]; int supplynum = 0; int demandnum = 0; for (int i = 0; i < comp.length; i++) { for (int j = 0; j < comp[0].length; j++) { comp[i][j] = imagen1[i][j] - imagen2[i][j]; if (comp[i][j] > 0) supplynum++; else if (comp[i][j] < 0) demandnum++; } } // now convert to graph /* Example: if the array at this point is [[-0.4, 0], [0.3, 0.5]], then the distance can be easily computed. Remember that the format of supply and demand arrays is (vertex number, how much to supply) Let's do that first. */ // define the core array int[][] supplyarr = new int[supplynum][2]; int[][] demandarr = new int[demandnum][2]; int supplyptr = 0; int demandptr = 0; double supplydoub = 0; double demanddoub = 0; for (int i = 0; i < comp.length; i++) { for (int j = 0; j < comp[0].length; j++) { if (comp[i][j] > 0) { supplyarr[supplyptr][0] = (1000*i + j); // hack for vertex number supplyarr[supplyptr][1] = (int) (1000000*comp[i][j]); // normalise to 1000 for now supplyptr++; supplydoub+=comp[i][j]; } else if (comp[i][j] < 0) { demandarr[demandptr][0] = (1000*i + j); // hack for vertex number demandarr[demandptr][1] = (-1)*(int)(1000000*comp[i][j]); // normalise to 1000 for now demandptr++; demanddoub+=comp[i][j]; } } } int supplysum = 0; int demandsum = 0; for (int[] ints : supplyarr) supplysum += ints[1]; for (int[] ints : demandarr) demandsum += ints[1]; if (supplysum != demandsum) { // temporary hack to allow the algorithm to run supplyarr[supplyarr.length - 1][1] -= (supplysum - demandsum); } System.out.println("Supplysum = " + supplysum + " and demandsum is " + demandsum + " while supplydoub is " + supplydoub + " and demanddoub is " + demanddoub); // next step is to define the vertices themselves and the edge. Complete graph int R = comp.length; int[] vertices = new int[comp.length * comp[0].length]; int[][] edges = new int[R*R*(R*R - 1)][2]; int[] capacity = new int[R*R*(R*R - 1)]; int vertptr = 0; int edgeptr = 0; int[] edge_weights = new int[R*R*(R*R - 1)]; // weight of each edge - basically their distance for (int i = 0; i < comp.length; i++) { for (int j = 0; j < comp[0].length; j++) { int locator = 1000*i + j; vertices[vertptr] = locator; for (int k = 0; k < R; k++) { for (int l = 0; l < R; l++) { if (k == i && l == j) continue; edges[edgeptr][0] = locator; edges[edgeptr][1] = 1000*k + l; edge_weights[edgeptr] = Math.abs(k - i) + Math.abs(l - j); edgeptr++; } } vertptr++; } } // consider the capacity as infinite Arrays.fill(capacity, 999999999); // now send it to the minflow function System.out.println("final flow = " + Main.getEMD(vertices, edges, edge_weights, supplyarr, demandarr, capacity)); } }
ca4a8d8402da5bd55cbbedad5fa70a7b4db44879
2669e5d930b1ff1a5c899362379bb36153191409
/alura-jdbc/src/main/java/br/com/alura/h2/extra/TestaCategorias.java
665920fc55810e26068a5a426bbbd0f56f6bac77
[]
no_license
kwakassa/cursos-alura
9c5c2839a45cab7060f0c874f30dee4e0683c883
16f34c331c1ef9e11238b9d6b5c6cc94514483b6
refs/heads/master
2021-07-09T03:58:02.237680
2019-02-01T16:20:08
2019-02-01T16:20:08
114,280,661
0
0
null
null
null
null
UTF-8
Java
false
false
616
java
package br.com.alura.h2.extra; import java.sql.Connection; import java.sql.SQLException; import java.util.List; public class TestaCategorias { //Executar public static void main(String[] args) throws SQLException { try(Connection con = new ConnectionPool().getConnectionPool()){ List<Categoria> categorias = new CategoriasDAO(con).listaComProdutos(); for (Categoria categoria : categorias) { System.out.println(); System.out.println(categoria); for (Produto produto : categoria.getProdutos()) { System.out.println(categoria.getNome() + " - " + produto.getNome()); } } } } }
9414363cb569164b11f961b8c56f31187e4a4ba2
8a59b1563a0bd39648b8aabe0b1a40dc8715f41f
/src/DungeonEscape/items/Item.java
f511bfc7c1752a5aa527c8723f8926f036bf29b0
[]
no_license
nicolettepascual/dungeon-escape
6ba2e577af14f8174120a0cbb31aed6dea4a75a3
01ea421413e78383ce9bd606b48309a6842dab64
refs/heads/master
2020-08-01T23:30:20.192345
2019-09-28T16:15:52
2019-09-28T16:15:52
211,156,747
0
0
null
null
null
null
UTF-8
Java
false
false
3,205
java
package DungeonEscape.items; import DungeonEscape.Handler; import DungeonEscape.graphics.Assets; import java.awt.Graphics; import java.awt.Rectangle; import java.awt.image.BufferedImage; public class Item { //Handler public static Item[] items = new Item[256]; public static Item RedchestItem = new Item(Assets.red, "Red Key", 0); public static Item OrangechestItem = new Item(Assets.orange, "Orange Key", 1); public static Item YellowchestItem = new Item(Assets.yellow, "Yellow Key", 2); public static Item GreenchestItem = new Item(Assets.green, "Green Key", 3); public static Item BluechestItem = new Item(Assets.blue, "Blue Key", 4); public static Item IndigochestItem = new Item(Assets.indigo, "Indigo Key", 5); public static Item VioletchestItem = new Item(Assets.violet, "Violet Key", 6); //Class public static final int ITEMWIDTH = 32, ITEMHEIGHT = 32; protected Handler handler; protected BufferedImage texture; protected String name; protected final int id; //bounding rectangle protected Rectangle bounds; protected int x, y, count; protected boolean pickedUp = false; public Item(BufferedImage texture, String name, int id){ this.texture = texture; this.name = name; this.id = id; count = 1; //Rectangle bounds of the key bounds = new Rectangle(x, y, ITEMWIDTH, ITEMHEIGHT); items[id] = this; } public void tick(){ if(handler.getWorld().getEntityManager().getPlayer().getCollisionBounds(0f, 0f).intersects(bounds)){ pickedUp = true; handler.getWorld().getEntityManager().getPlayer().getInventory().addItem(this); } } public void render(Graphics g){ if(handler == null) return; render(g, (int)(x - handler.getGameCamera().getxOffset()), (int)(y - handler.getGameCamera().getyOffset())); } public void render(Graphics g, int x, int y){ g.drawImage(texture, x, y, ITEMWIDTH, ITEMHEIGHT, null); } public Item createNew(int x, int y){ Item i = new Item(texture, name, id); i.setPosition(x, y); return i; } public void setPosition(int x, int y){ this.x = x; this.y = y; bounds.x = x; bounds.y = y; } // Getters and Setters public Handler getHandler() { return handler; } public void setHandler(Handler handler) { this.handler = handler; } public BufferedImage getTexture() { return texture; } public void setTexture(BufferedImage texture) { this.texture = texture; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getX() { return x; } public void setX(int x) { this.x = x; } public int getY() { return y; } public void setY(int y) { this.y = y; } public int getCount() { return count; } public void setCount(int count) { this.count = count; } public int getId() { return id; } public boolean isPickedUp() { return pickedUp; } }
f1d971e59a63e8e2ca35e71fb4b7f62c566f9ea9
a9a6169637e2c6344f2bb6de4bdff137eafa6ec1
/src/main/java/com/hussein/singleton/HungrySingleton.java
afe4420571b76b9771daa0f86fad6b6a2437c9b7
[]
no_license
hwangsiyuan/multithreading
fe6c4519de9dc37366818e323fb74f3d609dc3fb
3497a0b25c5b8f33c0862e78dece4ea8e3d2abbb
refs/heads/master
2021-06-28T16:09:40.601265
2020-12-14T02:17:48
2020-12-14T02:17:48
196,203,434
0
0
null
null
null
null
UTF-8
Java
false
false
469
java
package com.hussein.singleton; /** * <p>Title: HungrySingleton</p> * <p>Description: 饿汉式单例</p> * <p>Company: www.hussein.com</p> * * @author hwangsy * @date 2019/7/31 2:32 PM */ public final class HungrySingleton { private byte[] data = new byte[1024]; private static HungrySingleton INSTANCE = new HungrySingleton(); private HungrySingleton() { } public static HungrySingleton getInstance() { return INSTANCE; } }
c55ca6a322647433747594534a0b28659df23500
aef16f48aed1687a6cb5d68fef31f4ec27964b0d
/JUnit/Sample Student Submitting Folders/Project4/Student11/Property.java
392a0bce0ea5cda0f4115018cd615f8d949d64bb
[]
no_license
thoang43/JUnitTest
7299cde8a5a0fd20da350c8c6097425ed1ffb1fd
6e53ed6d48cb61b9056ef43f4f69788f6f123e4b
refs/heads/master
2020-09-06T04:27:39.049331
2020-05-23T02:18:59
2020-05-23T02:18:59
220,321,698
0
0
null
null
null
null
UTF-8
Java
false
false
4,037
java
/** * This class creates a Property object, calls the Plot constructor, * and displays the Property's info * * */ public class Property extends Object{ private String propertyName; private String city; private double rentAmount; private String owner; private Plot plot; public Plot plot1; public int x, y, width, depth; /** * No-arg constructor sets default fields and creates Plot object */ public Property(){ propertyName = ""; city = ""; owner = ""; plot = new Plot(); } /** * Copy constructor takes Property object and copies it's field values * @param pr Property object */ public Property(Property pr) { //Property prop = new Property(pr); propertyName = pr.propertyName; city = pr.city; rentAmount = pr.rentAmount; owner = pr.owner; //is this right? this.x = pr.x;// these correct? this.y = pr.y; this.width = pr.width; this.depth = pr.depth; } /** * Constructor takes parameters and creates Property object with values * passed, creates Plot object * @param pN The property's name * @param c Name of the city * @param rA The rent amount * @param o Owner's name */ public Property(String pN, String c, double rA, String o) { propertyName = pN; city = c; rentAmount = rA; owner = o; plot = new Plot(); // add plot variable & set to default } /** * Constructor takes parameters and creates Property object with values * passed, creates Plot object * @param pN The property's name * @param c Name of the city * @param rA The rent amount * @param o Owner's name * @param x X coordinate of plot * @param y Y coordinate of plot * @param width Width of plot * @param depth Depth of plot */ public Property(String pN, String c, double rA, String o, int x, int y, int width, int depth) { propertyName = pN; city = c; rentAmount = rA; owner = o; //plot = new Plot(x, y, width, depth); this.x = x;// these correct? this.y = y; this.width = width; this.depth = depth; plot = new Plot(this.x, this.y, this.width,this.depth); } /** * Method to display Property's info */ public String toString() { return "\nProperty Name: " + getPropertyName() + "\nLocated in " + getCity() + "\nBelonging to: " + getOwner() + "\nRent amount: " + getRentAmount() + "\n"; } /** * Method to return a Plot object * @return plot */ public Plot getPlot() { return new Plot(getX(), getY(), getWidth(), getDepth()); // supposed to return new plot object? } /** * Method takes String parameter and sets property name * @param pn Property name */ public void setPropertyName(String pn) { propertyName = pn; } /** * Method takes String parameter and sets city * @param c City */ public void setCity(String c) { city = c; } /** * Method takes double and sets rent amount * @param ra Rent amount */ public void setRendAmount(double ra) { rentAmount = ra; } /** * Method takes String and sets owner * @param o Owner */ public void setOwner(String o) { owner = o; } /** * Method returns property name * @return Property name */ public String getPropertyName() { return propertyName; } /** * Method returns city * @return City */ public String getCity() { return city; } /** * Method returns rent amount * @return Rent amount */ public double getRentAmount() { return rentAmount; } /** * Method returns owner * @return Owner */ public String getOwner() { return owner; } /** Method returns x value * * @return X */ public int getX() { return x; } /** * Method returns y value * @return Y */ public int getY() { return y; } /** * Method returns width value * @return Width */ public int getWidth() { return width; } /** * Method returns depth value * @return Depth */ public int getDepth() { return depth; } }
413ec117f25a0840a21e6c741a379cf928ee2bf5
23926949cc04ef8811e79b4bb4a2bdb9bf9a702f
/src/chap04/exercises/Exercise03.java
8aa19b7c2f4708b45fcd7b8bf661808507b50806
[]
no_license
moonlt93/java20200929
c8c4af18ce07dce60393b0ffd6df91d41984d2d8
bfc51feda3236cd908655954079ca734e5133f90
refs/heads/master
2022-12-26T20:05:52.903316
2020-10-15T08:49:59
2020-10-15T08:49:59
299,485,660
0
0
null
null
null
null
UHC
Java
false
false
303
java
package chap04.exercises; //1. sum, i 0으로 초기화 ,2. for 함수 설정 3. 출력 public class Exercise03 { public static void main(String[] args) { int sum=0; for(int i=1;i<=100;i++) { if(i%3 == 0) { sum += i; } System.out.println(sum); //for(; i<=100;;i+=3) } } }
6501f51a976306583c5b28cbc19cc32aa37b576b
331392ee26f47b45ac9dc68f72727eacde6f022d
/src/main/java/com/heyrudy/mybatissample/controller/rest/dto/mapper/CityRequestMapper.java
be13ad897dcc31e8304d9d5d6e2b9d77a294a02f
[]
no_license
heyrudy/mybatis-sample
a310184ff6cc3f05b76fa2ad820e04e2bed567a6
80ed4b740548679f7a98b12d0ce86718b3a7f329
refs/heads/master
2023-08-05T07:27:55.982331
2023-07-26T17:00:01
2023-07-26T17:00:01
300,960,189
2
0
null
null
null
null
UTF-8
Java
false
false
775
java
package com.heyrudy.mybatissample.controller.rest.dto.mapper; import com.heyrudy.mybatissample.domain.model.city.City; import com.heyrudy.mybatissample.controller.rest.dto.CityRequestDTO; public class CityRequestMapper { public static final CityRequestMapper CITY_RESQUEST_MAPPER = new CityRequestMapper(); public City toModel(CityRequestDTO dto) { return City.builder() .name(dto.name()) .state(dto.state()) .country(dto.country()) .build(); } public CityRequestDTO toDto(City city) { return CityRequestDTO.builder() .name(city.getName()) .state(city.getState()) .country(city.getCountry()) .build(); } }
26a1ce78da42c67b3b1db2782b90b02ecea3f1ae
7c0360eae585e6db2613720afda264458c7626e9
/src/main/java/be/intecbrussel/restdemo/configurations/DataBaseLoader.java
2390adaf4f70c89c707767b174f85345607e9f1a
[]
no_license
Jolison01/SpringRestApp
62aa1daa595cc294295c9dd9e180d6a7b5e71acf
e3b5feed31acb7cbd053ce4214a8c0c05679332d
refs/heads/master
2023-01-07T10:58:16.906378
2020-11-11T20:35:31
2020-11-11T20:35:31
312,084,862
0
0
null
null
null
null
UTF-8
Java
false
false
832
java
package be.intecbrussel.restdemo.configurations; import be.intecbrussel.restdemo.entities.Employee; import be.intecbrussel.restdemo.repositories.EmployeeRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.boot.CommandLineRunner; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration public class DataBaseLoader { private static final Logger log = LoggerFactory.getLogger(DataBaseLoader.class); @Bean CommandLineRunner initDatabase(EmployeeRepository repository) { return args ->{ log.info("Preloading" + repository.save( new Employee("David","Developer"))); log.info("Preloading" + repository.save(new Employee("Wilson", "Music-maker"))); }; } }
8cb468c09e16e9591749935e854d884f80bb785a
f200a63a691c5773eabe52ba339c557978b1b8d2
/FirstSpringApp/util/Util.java
2ce201c7e5c58372cd8fed6e30f19e4fd2e0e787
[]
no_license
NitheshKrishnan/HESE5
874634276c9ad140aeb422b8d0c439a7ff7ae2c2
1b27e2d3f8a098d4e99ae2a3ffc5b10fb35c80de
refs/heads/master
2020-08-12T22:35:28.682877
2019-10-14T12:14:54
2019-10-14T12:14:54
214,855,942
0
0
null
null
null
null
UTF-8
Java
false
false
619
java
package edu.jspiders.firstspringapp.util; import org.springframework.context.support.ClassPathXmlApplicationContext; import edu.jspiders.firstspringapp.beans.ClassA; import edu.jspiders.firstspringapp.beans.ClassB; public class Util { public static void main(String[] args) { // create the container ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("springconfig.xml"); // use the Bean ClassA a = (ClassA) context.getBean("a"); ClassB b = (ClassB) context.getBean("b"); a.m1(); b.m2(); // close the container context.close(); } }
15494eab727780ee5d1f6a66c808af6a3102f883
0de3d7b27e4a7df87f8ce2c07357705acb1d01b2
/java/src/kr/ac/kopo/day200519/DirMain2.java
f480a56b73e8457be43cc84cf76c168d7390b1a6
[]
no_license
kimhyeju-a/kopo_java
1192c398d947e4791fd420cd210f79de19e510a9
9081c78d6c68ba665b4c39952ad2fe635fd6f75e
refs/heads/master
2021-06-12T20:51:38.348563
2020-06-11T15:00:30
2020-06-11T15:00:30
254,394,400
0
0
null
2020-05-21T00:22:13
2020-04-09T14:29:42
Java
UTF-8
Java
false
false
2,106
java
package kr.ac.kopo.day200519; import java.io.File; import java.text.SimpleDateFormat; import java.util.Arrays; import java.util.Date; public class DirMain2 { public static void main(String[] args) { File dirObj = new File("test\\test2"); boolean bool = dirObj.exists(); System.out.println(bool ? "유효한 디렉토리입니다." : "유효하지 않는 디렉토리입니다."); if(!bool) { System.out.println(dirObj.mkdir()? "만들었" : "아니"); } System.out.println("path : "+ dirObj.getPath()); //내폴더에 들어있는 여러개의 다른 아이들이 누구있냐 String[] list = dirObj.list(); System.out.println("-------------------------------------"); System.out.println("\t" + dirObj.getName()+ "디렉토리 정보"); System.out.println("-------------------------------------"); for(String element : list) { System.out.println(element); } System.out.println("getParent()" + dirObj.getParent()); System.out.println("-------------------------------------"); //새로운 디렉토리 만들기 - 이미 만들어진 것은 생성 실패 File newDirObj = new File("iotest/하마"); System.out.println(newDirObj.mkdir()? "dir 생성 성공" : "dir 생성 실패"); String path = newDirObj.getPath(); String name = newDirObj.getName(); newDirObj = new File("iotest/하마/test"); System.out.println(newDirObj.getParent()); System.out.println(path); String[] path2 = path.split("\\\\"); System.out.println(Arrays.toString(path2)); //mkdirs : 중간경로에 없는 폴더도 만든다. newDirObj = new File("iotest/새폴더/오리"); System.out.println(newDirObj.mkdirs() ? "dir 생성 성공" : "dir 생성 실패"); //child가 기준임 오리만 지워짐 //newDirObj = new File("iotest/새폴더"); //만약 파일안에 정보가 있다면 삭제할 수 없다 bool = newDirObj.delete(); System.out.println(bool ? "삭제성공" : "삭제실패"); //빈폴더가 아닌 File dirObj2 = new File("test2"); System.out.println(dirObj.renameTo(dirObj2) ? "변경" : "변경안됨"); } }
3b921a5123000bebeb001129df4041e2ab88c8d0
e089b8ba4fc22bf297f4c210a841efce14c328f1
/mpresa/src/dao/EmpresaDao.java
258227ef8ec2d5ee253a9718fa2ef41a3e0218be
[]
no_license
mateuslobleinnicolodi/Empresa
3a57d6b14188c9c0299dc69f28d060cfa84d4a3a
65c656e4e4e9e732859c276463de35072f9e2b93
refs/heads/master
2020-07-29T01:47:08.006043
2019-09-19T19:17:46
2019-09-19T19:17:46
209,621,858
0
0
null
null
null
null
UTF-8
Java
false
false
4,715
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package dao; import java.sql.PreparedStatement; import java.sql.SQLException; import javax.swing.JOptionPane; import modelo.Empresa; import java.sql.ResultSet; import java.util.ArrayList; import java.util.List; /** * * @author Administrador */ public class EmpresaDao { public static boolean inserir(Empresa objeto) { String sql = "INSERT INTO Empresa (nome_fantasia, razao_social) VALUES (?, ?)"; try { PreparedStatement ps = conexao.Conexao.getConexao().prepareStatement(sql); ps.setString(1, objeto.getNome_fantasia()); ps.setString(2, objeto.getRazao_social()); ps.executeUpdate(); return true; } catch (SQLException | ClassNotFoundException ex) { System.out.println(ex.getMessage()); return false; } } public static void main(String[] args) { Empresa objeto = new Empresa(); objeto.setNome_fantasia("Doom"); objeto.setRazao_social("yeah"); boolean resultado = inserir(objeto); if (resultado) { JOptionPane.showMessageDialog(null, "Inserido com sucesso!"); } else { JOptionPane.showMessageDialog(null, "Erro!"); } } public static boolean alterar(Empresa objeto) { String sql = "UPDATE Empresa SET nome_fantasia = ?, razao_social = ? WHERE codigo=?"; try { PreparedStatement ps = conexao.Conexao.getConexao().prepareStatement(sql); ps.setString(1, objeto.getNome_fantasia()); ps.setString(2, objeto.getRazao_social()); ps.setInt(3, objeto.getCodigo()); ps.executeUpdate(); return true; } catch (SQLException | ClassNotFoundException ex) { System.out.println(ex.getMessage()); return false; } } public static boolean excluir(Empresa objeto) { String sql = "DELETE FROM Empresa WHERE codigo=?"; try { PreparedStatement ps = conexao.Conexao.getConexao().prepareStatement(sql); ps.setInt(1, objeto.getCodigo()); ps.executeUpdate(); return true; } catch (SQLException | ClassNotFoundException ex) { System.out.println(ex.getMessage()); return false; } } public static List<Empresa> consultar() { List<Empresa> resultados = new ArrayList<>(); //editar o SQL conforme a entidade String sql = "SELECT codigo, nome_fantasia, razao_social FROM Empresa"; PreparedStatement ps; try { ps = conexao.Conexao.getConexao().prepareStatement(sql); ResultSet rs = ps.executeQuery(); while (rs.next()) { Empresa objeto = new Empresa(); //definir um set para cada atributo da entidade, cuidado com o tipo objeto.setCodigo(rs.getInt("codigo")); objeto.setNome_fantasia(rs.getString("nome_fantasia")); objeto.setRazao_social(rs.getString("razao_social")); resultados.add(objeto);//não mexa nesse, ele adiciona o objeto na lista } return resultados; } catch (SQLException | ClassNotFoundException ex) { System.out.println(ex.getMessage()); return null; } } public static Empresa consultar(int primaryKey) { //editar o SQL conforme a entidade String sql = "SELECT codigo, nome_fantasia, razao_social FROM Empresa WHERE codigo=?"; PreparedStatement ps; try { ps = conexao.Conexao.getConexao().prepareStatement(sql); ps.setInt(1, primaryKey); ResultSet rs = ps.executeQuery(); while (rs.next()) { Empresa objeto = new Empresa(); //definir um set para cada atributo da entidade, cuidado com o tipo objeto.setCodigo(rs.getInt("codigo")); objeto.setNome_fantasia(rs.getString("nome_fantasia")); objeto.setRazao_social(rs.getString("razao_social")); return objeto;//não mexa nesse, ele adiciona o objeto na lista } } catch (SQLException | ClassNotFoundException ex) { System.out.println(ex.getMessage()); } return null; } }
e1da0710304585af385550e7f627f408b3e4e255
5407c08f7df21fdca2d59a49f8ac9134b9860dd6
/src/model/Report.java
49d9461c6d710f70354f350365b5adadb85510a1
[]
no_license
cavanxatiniu42/DmTool
65ab353e6e73f0f53955304fb881e28cf1273837
da4f289f83798b7b4c99323e0bb612dcc387dfbe
refs/heads/master
2021-01-21T20:24:00.174134
2017-05-24T00:28:56
2017-05-24T00:28:56
90,961,104
0
0
null
null
null
null
UTF-8
Java
false
false
3,390
java
package model; import com.sun.org.apache.regexp.internal.RE; import domainapp.basics.exceptions.ConstraintViolationException; import domainapp.basics.model.meta.DAssoc; import domainapp.basics.model.meta.DAttr; import domainapp.basics.model.meta.DOpt; import domainapp.basics.model.meta.Select; import domainapp.basics.util.Tuple; import java.util.List; /** * Created by Asus on 5/24/2017. */ public class Report { @DAttr(name = "id", type = DAttr.Type.String, mutable = false, id = true, auto = true, length = 10) private String id; private static int idCounter= 0; @DAttr(name = "heroes", type = DAttr.Type.Collection, optional = false, serialisable = false, filter = @Select(clazz = Hero.class)) @DAssoc(ascName = "report-has-heroes", role = "report", ascType = DAssoc.AssocType.One2Many, endType = DAssoc.AssocEndType.One, associate = @DAssoc.Associate(type = Hero.class, cardMin = 0, cardMax = 25), dependsOn = true) private List<Hero> heroes; public Report(String id, List<Hero> heroes) { this.id = nextID(id); this.heroes = heroes; } public Report(String id){ this(id, null); } public Report(){ this(null, null); } private String nextID(String currId) { if (currId == null) { idCounter++; return Report.class.getSimpleName()+idCounter; } else { int num = Integer.parseInt(currId.substring(6)); if (num > idCounter) { idCounter = num; } } return currId; } @DOpt(type = DOpt.Type.AutoAttributeValueSynchroniser) public static void updateAutoGeneratedValue ( DAttr attrib, Tuple derivingValue, Object minVal, Object maxVal) throws ConstraintViolationException { if (minVal != null && maxVal != null) { if (attrib.name().equals("id")) { int maxIdVal = Integer.parseInt(maxVal.toString().replaceAll("[^\\d.]", "")); if (maxIdVal > idCounter) idCounter = maxIdVal; } } } @DOpt(type = DOpt.Type.LinkAdder) public boolean addHero(Hero hero) { if (!this.heroes.contains(hero)) { this.heroes.add(hero); return true; } return false; } @DOpt(type = DOpt.Type.LinkAdderNew) public boolean addNewHero(Hero hero) { this.heroes.add(hero); return true; } @DOpt(type = DOpt.Type.LinkAdder) public boolean addHeroes(List<Hero> heroes) { for (Hero hero : heroes) { if (!this.heroes.contains(hero)) { this.heroes.add(hero); return true; } } return false; } @DOpt(type = DOpt.Type.LinkAdderNew) public boolean addNewHeroes(List<Hero> heroes) { this.heroes.addAll(heroes); return false; } @DOpt(type = DOpt.Type.LinkRemover) public boolean removeHero(Hero hero) { this.heroes.remove(hero); return true; } public String getId() { return id; } public void setId(String id) { this.id = id; } public List<Hero> getHeroes() { return heroes; } public void setHeroes(List<Hero> heroes) { this.heroes = heroes; } }
201593fc1e54d6f2db83b91f6aef33c71f0ef1b5
98c2dfbcf4aa9dea0688f7fd007e18cd2b5c5c7d
/JuanGuarinJuanGutierrez.java
64c1bb0c96b49d57557756e9670168edb307ceda
[]
no_license
juan-guarin/Sistemico2
f80db67bfbd77eb6b6e94896b8e79f3a327a973a
15c18e627e2bb56d21677751eafa50ecac5c9ecd
refs/heads/master
2022-11-09T04:43:48.913175
2020-06-25T03:29:23
2020-06-25T03:29:23
274,725,969
0
0
null
null
null
null
UTF-8
Java
false
false
535
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package juan.guarin.juan.gutierrez; /** * * @author Juanes Guarin */ public class JuanGuarinJuanGutierrez { /** * @param args the command line arguments */ public static void main(String[] args) { Principal principal = new Principal(); principal.setVisible(true); } }
a9935477be6c82f5ad8fe4ee29d59d5e57f506a8
b63e6df42707563d2e45eb23005d9dad3611a13d
/src/main/java/testRun/DiceRoller.java
5ab9148933b85a28608246e78d7c22cd533dd898
[]
no_license
silver1248/tests
bc8e2d01cf23b386874badfd58e518e30f9b3cf1
b0290efc8092ea5b0fd16996ca85442a324e6a47
refs/heads/master
2023-05-10T15:58:49.612657
2020-04-22T00:12:35
2020-04-22T00:12:35
132,671,686
0
0
null
2023-05-09T18:37:25
2018-05-08T22:25:41
Java
UTF-8
Java
false
false
555
java
package testRun; import java.util.Random; public class DiceRoller { private static final int NUM_SIDES = 6; String foo = new String(); Integer bar = new Integer(1); Double doug = new Double(4.5); private static int getRandomBetweenOneAnd(int bound) { Random dice = new Random(); return dice.nextInt(6) + 1; } public static void main(String[] args) { int sides = 6; System.out.println("Here is a random number between 1 and "+sides+" = " + getRandomBetweenOneAnd(6)); } }
[ "" ]
a3a5a903db8331df173f5ccdcd1225e3551604c1
3c973342c62967d188cbc4496f66666fe3021f75
/app/src/main/java/com/example/lenovo/myapplication/ProfilDuzenlemeEkrani.java
c26e2f87e8f67e24f8486bd5f469dbfa5c2ccde6
[]
no_license
betulsakarya/Gozlerini-Benimle-Paylas
5639fbdc4332dcbe40bb01a81c65e778b736d4b6
c350f3f94a00f4421ad46164d1b7ada1c109aa2e
refs/heads/master
2020-07-05T19:28:22.458791
2019-08-16T15:12:15
2019-08-16T15:12:15
202,747,675
1
1
null
null
null
null
UTF-8
Java
false
false
11,589
java
package com.example.lenovo.myapplication; import android.Manifest; import android.app.DownloadManager; import android.app.ProgressDialog; import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.net.Uri; import android.os.Bundle; import android.text.TextUtils; import android.util.Log; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; import android.widget.Toast; import com.bumptech.glide.Glide; import com.bumptech.glide.request.RequestOptions; import com.google.android.gms.tasks.Continuation; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.OnFailureListener; import com.google.android.gms.tasks.OnSuccessListener; import com.google.android.gms.tasks.Task; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import com.google.firebase.storage.FirebaseStorage; import com.google.firebase.storage.StorageReference; import com.google.firebase.storage.UploadTask; import com.theartofdev.edmodo.cropper.CropImage; import com.theartofdev.edmodo.cropper.CropImageView; import java.util.HashMap; import java.util.Map; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import androidx.core.app.ActivityCompat; import androidx.core.app.NavUtils; import de.hdodenhof.circleimageview.CircleImageView; public class ProfilDuzenlemeEkrani extends AppCompatActivity implements ValueEventListener{ EditText etAd, etSoyad, etEmail; Button btnProfiliGuncelle; CircleImageView profilResmii; Context context; private FirebaseAuth mAuth; private DatabaseReference mDatabase; private Uri imageUri = null; private ProgressDialog profilProgress; private StorageReference storageReference; private Boolean kontrol = false; private String kullaniciId; protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.profili_duzenle); getSupportActionBar().setDisplayHomeAsUpEnabled(true); etAd = (EditText) findViewById(R.id.etAd); etSoyad = (EditText) findViewById(R.id.etSoyad); etEmail = (EditText) findViewById(R.id.etEmail); profilResmii = (CircleImageView) findViewById(R.id.profilResmi); btnProfiliGuncelle = (Button) findViewById(R.id.btnProfiliGuncelle); profilProgress = new ProgressDialog(this); etEmail.setEnabled(false); mAuth = FirebaseAuth.getInstance(); storageReference = FirebaseStorage.getInstance().getReference(); kullaniciId = mAuth.getCurrentUser().getUid(); mDatabase = FirebaseDatabase.getInstance().getReference().child("GonulluKullanicilar").child(kullaniciId); // Profili Düzenle Sayfası Sadece Gonullu Kullanıcı İçin var. mDatabase.addValueEventListener(this); // implements ValueEventListener --> onDataChange calısır. btnProfiliGuncelle.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String gonulluKullaniciAdi = etAd.getText().toString(); String gonulluKullaniciSoyadi = etSoyad.getText().toString(); profilProgress.setTitle("Güncelleniyor."); profilProgress.setMessage("Bilgileriniz güncelleniyor.Lütfen bekleyiniz."); profilProgress.setCancelable(false); profilProgress.show(); if (!TextUtils.isEmpty(gonulluKullaniciAdi) && !TextUtils.isEmpty(gonulluKullaniciSoyadi) && imageUri != null) { Log.d("ProfilDuzenlemeEkranı", "if içi"); if (kontrol) { // Kırpma islemi gerceklesmis ise ( Imageview de kırpılmıs resim var ise ) calısır Log.d("ProfilDuzenlemeEkranı", "if içi 2"); final StorageReference kullaniciResim = storageReference.child("GonulluKullaniciResimleri").child(kullaniciId + ".jpg"); UploadTask task = kullaniciResim.putFile(imageUri); Task<Uri> urlTask = task.continueWithTask(new Continuation<UploadTask.TaskSnapshot, Task<Uri>>() { @Override public Task<Uri> then(@NonNull Task<UploadTask.TaskSnapshot> task) throws Exception { if (!task.isSuccessful()) { if(profilProgress.isShowing()) profilProgress.dismiss(); } return kullaniciResim.getDownloadUrl(); } }).addOnCompleteListener(ProfilDuzenlemeEkrani.this, new OnCompleteListener<Uri>() { @Override public void onComplete(@NonNull Task<Uri> task) { if(task.isSuccessful()){ Log.d("ProfilDuzenlemee", "Upload task successful: " + task.getResult().toString()); Uri download_uri; Bitmap bitmap = BitmapFactory.decodeFile(imageUri.getPath()); profilResmii.setImageBitmap(bitmap); download_uri = task.getResult(); kullaniciGuncelle(download_uri); } } }); } else{ // Profil düzenlemeden - Ayarlar a geçip tekrar Profiluzenleme yaptıgımızda veya sadece adsoyad guncellediğimizde profilProgress.dismiss(); adSoyadGuncelle(); } } else{ profilProgress.dismiss(); Toast.makeText(ProfilDuzenlemeEkrani.this, "Ad, soyad bilgilerinin dolu olması zorunludur.", Toast.LENGTH_SHORT).show(); } } }); profilResmii.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ActivityCompat.requestPermissions(ProfilDuzenlemeEkrani.this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, 1); CropImage.activity() // Profil Fotografı Kırpma İşlemi için .setGuidelines(CropImageView.Guidelines.ON) .start(ProfilDuzenlemeEkrani.this); } }); } private void kullaniciGuncelle(Uri download_uri) { mDatabase.removeEventListener(this); // ?? Map<String, Object> userUpdateMap = new HashMap<>(); userUpdateMap.put("ad", etAd.getText().toString()); userUpdateMap.put("soyad", etSoyad.getText().toString()); userUpdateMap.put("profilResmi", download_uri.toString()); if(mDatabase == null){ Log.d("ProfilDuzenleme", "mDatabase null"); return; } mDatabase.updateChildren(userUpdateMap).addOnCompleteListener(new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { if(task.isSuccessful()) { Log.d("ProfilDuzenleme", "task succ"); profilProgress.dismiss(); Toast.makeText(getApplicationContext(), "Güncelleme Başarı İle Tamamlandı.", Toast.LENGTH_SHORT).show(); } } }).addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { Log.d("ProfilDuzenleme", "exception: " + e.getMessage()); if(profilProgress.isShowing()) profilProgress.dismiss(); } }); } private void adSoyadGuncelle() { mDatabase.removeEventListener(this); // ?? Map<String, Object> userUpdateMap = new HashMap<>(); userUpdateMap.put("ad", etAd.getText().toString()); userUpdateMap.put("soyad", etSoyad.getText().toString()); if(mDatabase == null){ Log.d("ProfilDuzenleme", "mDatabase null"); return; } mDatabase.updateChildren(userUpdateMap).addOnCompleteListener(new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { if(task.isSuccessful()) { Log.d("ProfilDuzenleme", "task succ"); profilProgress.dismiss(); Toast.makeText(getApplicationContext(), "Profil Güncelleme Başarı İle Tamamlandı.", Toast.LENGTH_SHORT).show(); } } }).addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { Log.d("ProfilDuzenleme", "exception: " + e.getMessage()); if(profilProgress.isShowing()) profilProgress.dismiss(); } }); } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { // Kırpma işleminden sonra geri gelen kırpılmıs resmi yakalama kodu if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) { CropImage.ActivityResult result = CropImage.getActivityResult(data); if (resultCode == RESULT_OK) { imageUri = result.getUri(); // kırpılmış resmi imageUri ye at profilResmii.setImageURI(imageUri); kontrol = true; } else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) { Exception error = result.getError(); } } } @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { String gonulluAd = dataSnapshot.child("ad").getValue().toString(); String gonulluSoyad = dataSnapshot.child("soyad").getValue().toString(); String gonulluEmail = dataSnapshot.child("email").getValue().toString(); String profilResmi = dataSnapshot.child("profilResmi").getValue().toString(); imageUri = Uri.parse(profilResmi); RequestOptions requestOptions = new RequestOptions(); requestOptions.placeholder(R.drawable.indir); Glide.with(ProfilDuzenlemeEkrani.this).setDefaultRequestOptions(requestOptions).load(imageUri).into(profilResmii); etAd.setText(gonulluAd); etSoyad.setText(gonulluSoyad); etEmail.setText(gonulluEmail); } @Override public void onCancelled(@NonNull DatabaseError databaseError) { } @Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == android.R.id.home) { Intent intent = new Intent(getApplicationContext(), NavigationBar.class); NavUtils.navigateUpTo(this, intent); return true; } return super.onOptionsItemSelected(item); } }
05bbd58bca0560e31547136de1ac21d24aa45013
f72a42231222380567079da4a76c12c23f6ab4f7
/v3/Protagonist.java
a8d694394f456e219f7e5bd7b88564bdd6d53296
[]
no_license
dkeriazisStuy/RPG_period05_team03
13579e26bd70b496068f50b9abeb3c200c79e19c
2f057376d44195fc75258edf089121216d917052
refs/heads/master
2021-08-29T13:14:00.811205
2017-12-14T02:24:46
2017-12-14T02:24:46
112,501,088
0
0
null
null
null
null
UTF-8
Java
false
false
1,662
java
public abstract class Protagonist extends Character { /* fields name life/health/HP as an int strength as an int defense as an int attack rating as a double methods constructor takes String input to name the Protagonist initializes all attributes (eg, 125, 100, 40, 0.4) isAlive returns boolean indicating living or dead getDefense getName lowerHP takes an int parameter, decreases life attribute by that amount attack takes a Monster as a parameter calculates damage using this formula: damage = (strength * attack rating) - monster defense damage should be an integer value specialize prepares the Protagonist to perform a special attack decreases defense attribute increases attack attribute normalize prepares the Protagonist to perform a normal attack resets defense attribute resets attack attribute */ protected String name; protected int start_defense; protected double start_attack; public Protagonist(String name) { this.name = name; health = 100; strength = 10; start_defense = 5; start_attack = 5; normalize(); } // Error if class not abstract: // Protagonist is not abstract and does not override abstract method toString() in Protagonist public abstract String toString(); public String getName() { return name; } public abstract void specialize(); public abstract void normalize(); }
269232900794eaf9e8c56d6070a3d3dad657680a
3a5d2c5a11bcf5601b90bb949864086d0192d508
/fizzBuzz71/src/main/java/FizzBuzz.java
5ba3468efe6d9dcaef35941b7ceab462d042eb98
[]
no_license
akshaychoudhary92/PbdJava
bebe4b7b9a6dc695d7954626f187dd94f0e5f37e
89628e04207612312c67e38d17d79b8d41e11d1e
refs/heads/main
2023-06-15T05:43:18.844681
2021-07-04T15:24:48
2021-07-04T15:24:48
378,246,211
0
0
null
null
null
null
UTF-8
Java
false
false
573
java
public class FizzBuzz { public void start() { fizzBuzzOutput(); } public String fizzBuzzOutput(){ String output = ""; for(int i = 1; i <= 100; i++){ if(i % 3 == 0 && i % 5 == 0){ System.out.println("fizzbuzz"); }else if(i % 5 == 0){ System.out.println("buzz"); }else if(i % 3 == 0){ System.out.println("Fizz"); } else{ System.out.println(i); } } return output; } }
2b68f5f34ce138f5337885999d46848b32f63ed0
4312a71c36d8a233de2741f51a2a9d28443cd95b
/RawExperiments/Math/math98/1/AstorMain-math_98/src/variant-411/org/apache/commons/math/linear/RealMatrixImpl.java
18ea5f01df0845d1b5a15ece236769c9e822c903
[]
no_license
SajjadZaidi/AutoRepair
5c7aa7a689747c143cafd267db64f1e365de4d98
e21eb9384197bae4d9b23af93df73b6e46bb749a
refs/heads/master
2021-05-07T00:07:06.345617
2017-12-02T18:48:14
2017-12-02T18:48:14
112,858,432
0
0
null
null
null
null
UTF-8
Java
false
false
30,341
java
package org.apache.commons.math.linear; public class RealMatrixImpl implements java.io.Serializable , org.apache.commons.math.linear.RealMatrix { private static final long serialVersionUID = -4828886979278117018L; protected double[][] data = null; protected double[][] lu = null; protected int[] permutation = null; protected int parity = 1; private static final double TOO_SMALL = 1.0E-11; public RealMatrixImpl() { } public RealMatrixImpl(int rowDimension ,int columnDimension) { if ((rowDimension <= 0) || (columnDimension <= 0)) { throw new java.lang.IllegalArgumentException("row and column dimensions must be postive"); } data = new double[rowDimension][columnDimension]; lu = null; } public RealMatrixImpl(double[][] d) { copyIn(d); lu = null; } public RealMatrixImpl(double[][] d ,boolean copyArray) { if (copyArray) { copyIn(d); } else { if (d == null) { throw new java.lang.NullPointerException(); } final int nRows = d.length; if (nRows == 0) { throw new java.lang.IllegalArgumentException("Matrix must have at least one row."); } final int nCols = d[0].length; if (nCols == 0) { throw new java.lang.IllegalArgumentException("Matrix must have at least one column."); } for (int r = 1 ; r < nRows ; r++) { if ((d[r].length) != nCols) { throw new java.lang.IllegalArgumentException("All input rows must have the same length."); } } data = d; } lu = null; } public RealMatrixImpl(double[] v) { final int nRows = v.length; data = new double[nRows][1]; for (int row = 0 ; row < nRows ; row++) { data[row][0] = v[row]; } } public org.apache.commons.math.linear.RealMatrix copy() { return new org.apache.commons.math.linear.RealMatrixImpl(copyOut() , false); } public org.apache.commons.math.linear.RealMatrix add(org.apache.commons.math.linear.RealMatrix m) throws java.lang.IllegalArgumentException { try { return add(((org.apache.commons.math.linear.RealMatrixImpl)(m))); } catch (java.lang.ClassCastException cce) { final int rowCount = getRowDimension(); final int columnCount = getColumnDimension(); if ((columnCount != (m.getColumnDimension())) || (rowCount != (m.getRowDimension()))) { throw new java.lang.IllegalArgumentException("matrix dimension mismatch"); } final double[][] outData = new double[rowCount][columnCount]; for (int row = 0 ; row < rowCount ; row++) { final double[] dataRow = data[row]; final double[] outDataRow = outData[row]; for (int col = 0 ; col < columnCount ; col++) { outDataRow[col] = (dataRow[col]) + (m.getEntry(row, col)); } } return new org.apache.commons.math.linear.RealMatrixImpl(outData , false); } } public org.apache.commons.math.linear.RealMatrixImpl add(org.apache.commons.math.linear.RealMatrixImpl m) throws java.lang.IllegalArgumentException { final int rowCount = getRowDimension(); final int columnCount = getColumnDimension(); if ((columnCount != (m.getColumnDimension())) || (rowCount != (m.getRowDimension()))) { throw new java.lang.IllegalArgumentException("matrix dimension mismatch"); } final double[][] outData = new double[rowCount][columnCount]; for (int row = 0 ; row < rowCount ; row++) { final double[] dataRow = data[row]; final double[] mRow = m.data[row]; final double[] outDataRow = outData[row]; for (int col = 0 ; col < columnCount ; col++) { outDataRow[col] = (dataRow[col]) + (mRow[col]); } } return new org.apache.commons.math.linear.RealMatrixImpl(outData , false); } public org.apache.commons.math.linear.RealMatrix subtract(org.apache.commons.math.linear.RealMatrix m) throws java.lang.IllegalArgumentException { try { return subtract(((org.apache.commons.math.linear.RealMatrixImpl)(m))); } catch (java.lang.ClassCastException cce) { final int rowCount = getRowDimension(); final int columnCount = getColumnDimension(); if ((columnCount != (m.getColumnDimension())) || (rowCount != (m.getRowDimension()))) { throw new java.lang.IllegalArgumentException("matrix dimension mismatch"); } final double[][] outData = new double[rowCount][columnCount]; for (int row = 0 ; row < rowCount ; row++) { final double[] dataRow = data[row]; final double[] outDataRow = outData[row]; for (int col = 0 ; col < columnCount ; col++) { outDataRow[col] = (dataRow[col]) - (m.getEntry(row, col)); } } return new org.apache.commons.math.linear.RealMatrixImpl(outData , false); } } public org.apache.commons.math.linear.RealMatrixImpl subtract(org.apache.commons.math.linear.RealMatrixImpl m) throws java.lang.IllegalArgumentException { final int rowCount = getRowDimension(); final int columnCount = getColumnDimension(); if ((columnCount != (m.getColumnDimension())) || (rowCount != (m.getRowDimension()))) { throw new java.lang.IllegalArgumentException("matrix dimension mismatch"); } final double[][] outData = new double[rowCount][columnCount]; for (int row = 0 ; row < rowCount ; row++) { final double[] dataRow = data[row]; final double[] mRow = m.data[row]; final double[] outDataRow = outData[row]; for (int col = 0 ; col < columnCount ; col++) { outDataRow[col] = (dataRow[col]) - (mRow[col]); } } return new org.apache.commons.math.linear.RealMatrixImpl(outData , false); } public org.apache.commons.math.linear.RealMatrix scalarAdd(double d) { final int rowCount = getRowDimension(); final int columnCount = getColumnDimension(); final double[][] outData = new double[rowCount][columnCount]; for (int row = 0 ; row < rowCount ; row++) { final double[] dataRow = data[row]; final double[] outDataRow = outData[row]; for (int col = 0 ; col < columnCount ; col++) { outDataRow[col] = (dataRow[col]) + d; } } return new org.apache.commons.math.linear.RealMatrixImpl(outData , false); } public org.apache.commons.math.linear.RealMatrix scalarMultiply(double d) { final int rowCount = getRowDimension(); final int columnCount = getColumnDimension(); final double[][] outData = new double[rowCount][columnCount]; for (int row = 0 ; row < rowCount ; row++) { final double[] dataRow = data[row]; final double[] outDataRow = outData[row]; for (int col = 0 ; col < columnCount ; col++) { outDataRow[col] = (dataRow[col]) * d; } } return new org.apache.commons.math.linear.RealMatrixImpl(outData , false); } public org.apache.commons.math.linear.RealMatrix multiply(org.apache.commons.math.linear.RealMatrix m) throws java.lang.IllegalArgumentException { try { return multiply(((org.apache.commons.math.linear.RealMatrixImpl)(m))); } catch (java.lang.ClassCastException cce) { if ((org.apache.commons.math.linear.RealMatrixImpl.this.getColumnDimension()) != (m.getRowDimension())) { throw new java.lang.IllegalArgumentException("Matrices are not multiplication compatible."); } final int nRows = org.apache.commons.math.linear.RealMatrixImpl.this.getRowDimension(); final int nCols = m.getColumnDimension(); final int nSum = org.apache.commons.math.linear.RealMatrixImpl.this.getColumnDimension(); final double[][] outData = new double[nRows][nCols]; for (int row = 0 ; row < nRows ; row++) { final double[] dataRow = data[row]; final double[] outDataRow = outData[row]; for (int col = 0 ; col < nCols ; col++) { double sum = 0; for (int i = 0 ; i < nSum ; i++) { sum += (dataRow[i]) * (m.getEntry(i, col)); } outDataRow[col] = sum; } } return new org.apache.commons.math.linear.RealMatrixImpl(outData , false); } } public org.apache.commons.math.linear.RealMatrixImpl multiply(org.apache.commons.math.linear.RealMatrixImpl m) throws java.lang.IllegalArgumentException { if ((org.apache.commons.math.linear.RealMatrixImpl.this.getColumnDimension()) != (m.getRowDimension())) { throw new java.lang.IllegalArgumentException("Matrices are not multiplication compatible."); } final int nRows = org.apache.commons.math.linear.RealMatrixImpl.this.getRowDimension(); final int nCols = m.getColumnDimension(); final int nSum = org.apache.commons.math.linear.RealMatrixImpl.this.getColumnDimension(); final double[][] outData = new double[nRows][nCols]; for (int row = 0 ; row < nRows ; row++) { final double[] dataRow = data[row]; final double[] outDataRow = outData[row]; for (int col = 0 ; col < nCols ; col++) { double sum = 0; for (int i = 0 ; i < nSum ; i++) { sum += (dataRow[i]) * (m.data[i][col]); } outDataRow[col] = sum; } } return new org.apache.commons.math.linear.RealMatrixImpl(outData , false); } public org.apache.commons.math.linear.RealMatrix preMultiply(org.apache.commons.math.linear.RealMatrix m) throws java.lang.IllegalArgumentException { return m.multiply(org.apache.commons.math.linear.RealMatrixImpl.this); } public double[][] getData() { return copyOut(); } public double[][] getDataRef() { return data; } public double getNorm() { double maxColSum = 0; for (int col = 0 ; col < (org.apache.commons.math.linear.RealMatrixImpl.this.getColumnDimension()) ; col++) { double sum = 0; for (int row = 0 ; row < (org.apache.commons.math.linear.RealMatrixImpl.this.getRowDimension()) ; row++) { sum += java.lang.Math.abs(data[row][col]); } maxColSum = java.lang.Math.max(maxColSum, sum); } return maxColSum; } public org.apache.commons.math.linear.RealMatrix getSubMatrix(int startRow, int endRow, int startColumn, int endColumn) throws org.apache.commons.math.linear.MatrixIndexException { if ((((((startRow < 0) || (startRow > endRow)) || (endRow > (data.length))) || (startColumn < 0)) || (startColumn > endColumn)) || (endColumn > (data[0].length))) { throw new org.apache.commons.math.linear.MatrixIndexException("invalid row or column index selection"); } final double[][] subMatrixData = new double[(endRow - startRow) + 1][(endColumn - startColumn) + 1]; for (int i = startRow ; i <= endRow ; i++) { java.lang.System.arraycopy(data[i], startColumn, subMatrixData[(i - startRow)], 0, ((endColumn - startColumn) + 1)); } return new org.apache.commons.math.linear.RealMatrixImpl(subMatrixData , false); } public org.apache.commons.math.linear.RealMatrix getSubMatrix(int[] selectedRows, int[] selectedColumns) throws org.apache.commons.math.linear.MatrixIndexException { if (((selectedRows.length) * (selectedColumns.length)) == 0) { throw new org.apache.commons.math.linear.MatrixIndexException("selected row and column index arrays must be non-empty"); } final double[][] subMatrixData = new double[selectedRows.length][selectedColumns.length]; try { for (int i = 0 ; i < (selectedRows.length) ; i++) { final double[] subI = subMatrixData[i]; final double[] dataSelectedI = data[selectedRows[i]]; for (int j = 0 ; j < (selectedColumns.length) ; j++) { subI[j] = dataSelectedI[selectedColumns[j]]; } } } catch (java.lang.ArrayIndexOutOfBoundsException e) { throw new org.apache.commons.math.linear.MatrixIndexException("matrix dimension mismatch"); } return new org.apache.commons.math.linear.RealMatrixImpl(subMatrixData , false); } public void setSubMatrix(double[][] subMatrix, int row, int column) throws org.apache.commons.math.linear.MatrixIndexException { if ((row < 0) || (column < 0)) { throw new org.apache.commons.math.linear.MatrixIndexException("invalid row or column index selection"); } final int nRows = subMatrix.length; if (nRows == 0) { throw new java.lang.IllegalArgumentException("Matrix must have at least one row."); } final int nCols = subMatrix[0].length; if (nCols == 0) { throw new java.lang.IllegalArgumentException("Matrix must have at least one column."); } for (int r = 1 ; r < nRows ; r++) { if ((subMatrix[r].length) != nCols) { throw new java.lang.IllegalArgumentException("All input rows must have the same length."); } } if ((data) == null) { if ((row > 0) || (column > 0)) { throw new org.apache.commons.math.linear.MatrixIndexException("matrix must be initialized to perfom this method"); } data = new double[nRows][nCols]; java.lang.System.arraycopy(subMatrix, 0, data, 0, subMatrix.length); } if (((nRows + row) > (org.apache.commons.math.linear.RealMatrixImpl.this.getRowDimension())) || ((nCols + column) > (org.apache.commons.math.linear.RealMatrixImpl.this.getColumnDimension()))) { throw new org.apache.commons.math.linear.MatrixIndexException("invalid row or column index selection"); } for (int i = 0 ; i < nRows ; i++) { java.lang.System.arraycopy(subMatrix[i], 0, data[(row + i)], column, nCols); } lu = null; } public org.apache.commons.math.linear.RealMatrix getRowMatrix(int row) throws org.apache.commons.math.linear.MatrixIndexException { if (!(isValidCoordinate(row, 0))) { throw new org.apache.commons.math.linear.MatrixIndexException("illegal row argument"); } final int ncols = org.apache.commons.math.linear.RealMatrixImpl.this.getColumnDimension(); final double[][] out = new double[1][ncols]; java.lang.System.arraycopy(data[row], 0, out[0], 0, ncols); return new org.apache.commons.math.linear.RealMatrixImpl(out , false); } public org.apache.commons.math.linear.RealMatrix getColumnMatrix(int column) throws org.apache.commons.math.linear.MatrixIndexException { if (!(isValidCoordinate(0, column))) { throw new org.apache.commons.math.linear.MatrixIndexException("illegal column argument"); } final int nRows = org.apache.commons.math.linear.RealMatrixImpl.this.getRowDimension(); final double[][] out = new double[nRows][1]; for (int row = 0 ; row < nRows ; row++) { out[row][0] = data[row][column]; } return new org.apache.commons.math.linear.RealMatrixImpl(out , false); } public double[] getRow(int row) throws org.apache.commons.math.linear.MatrixIndexException { if (!(isValidCoordinate(row, 0))) { throw new org.apache.commons.math.linear.MatrixIndexException("illegal row argument"); } final int ncols = org.apache.commons.math.linear.RealMatrixImpl.this.getColumnDimension(); final double[] out = new double[ncols]; java.lang.System.arraycopy(data[row], 0, out, 0, ncols); return out; } public double[] getColumn(int col) throws org.apache.commons.math.linear.MatrixIndexException { if (!(isValidCoordinate(0, col))) { throw new org.apache.commons.math.linear.MatrixIndexException("illegal column argument"); } final int nRows = org.apache.commons.math.linear.RealMatrixImpl.this.getRowDimension(); final double[] out = new double[nRows]; for (int row = 0 ; row < nRows ; row++) { out[row] = data[row][col]; } return out; } public double getEntry(int row, int column) throws org.apache.commons.math.linear.MatrixIndexException { try { return data[row][column]; } catch (java.lang.ArrayIndexOutOfBoundsException e) { throw new org.apache.commons.math.linear.MatrixIndexException("matrix entry does not exist"); } } public org.apache.commons.math.linear.RealMatrix transpose() { final int nRows = getRowDimension(); final int nCols = getColumnDimension(); final double[][] outData = new double[nCols][nRows]; for (int row = 0 ; row < nRows ; row++) { final double[] dataRow = data[row]; for (int col = 0 ; col < nCols ; col++) { outData[col][row] = dataRow[col]; } } return new org.apache.commons.math.linear.RealMatrixImpl(outData , false); } public org.apache.commons.math.linear.RealMatrix inverse() throws org.apache.commons.math.linear.InvalidMatrixException { return solve(org.apache.commons.math.linear.MatrixUtils.createRealIdentityMatrix(getRowDimension())); } public double getDeterminant() throws org.apache.commons.math.linear.InvalidMatrixException { if (!(isSquare())) { throw new org.apache.commons.math.linear.InvalidMatrixException("matrix is not square"); } if (isSingular()) { return 0.0; } else { double det = parity; for (int i = 0 ; i < (org.apache.commons.math.linear.RealMatrixImpl.this.getRowDimension()) ; i++) { det *= lu[i][i]; } return det; } } public boolean isSquare() { return (org.apache.commons.math.linear.RealMatrixImpl.this.getColumnDimension()) == (org.apache.commons.math.linear.RealMatrixImpl.this.getRowDimension()); } public boolean isSingular() { if ((lu) == null) { try { luDecompose(); return false; } catch (org.apache.commons.math.linear.InvalidMatrixException ex) { return true; } } else { return false; } } public int getRowDimension() { return data.length; } public int getColumnDimension() { return data[0].length; } public double getTrace() throws java.lang.IllegalArgumentException { if (!(isSquare())) { throw new java.lang.IllegalArgumentException("matrix is not square"); } double trace = data[0][0]; for (int i = 1 ; i < (org.apache.commons.math.linear.RealMatrixImpl.this.getRowDimension()) ; i++) { trace += data[i][i]; } return trace; } public double[] operate(double[] v) throws java.lang.IllegalArgumentException { final int nRows = org.apache.commons.math.linear.RealMatrixImpl.this.getRowDimension(); final int nCols = org.apache.commons.math.linear.RealMatrixImpl.this.getColumnDimension(); if ((v.length) != nCols) { throw new java.lang.IllegalArgumentException("vector has wrong length"); } final java.math.BigDecimal[] bd = new java.math.BigDecimal[v.length]; for (int row = 0 ; row < nRows ; row++) { final double[] dataRow = data[row]; double sum = 0; for (int i = 0 ; i < nCols ; i++) { sum += (dataRow[i]) * (v[i]); } out[row] = sum; } return out; } public double[] preMultiply(double[] v) throws java.lang.IllegalArgumentException { final int nRows = org.apache.commons.math.linear.RealMatrixImpl.this.getRowDimension(); if ((v.length) != nRows) { throw new java.lang.IllegalArgumentException("vector has wrong length"); } final int nCols = org.apache.commons.math.linear.RealMatrixImpl.this.getColumnDimension(); final double[] out = new double[nCols]; for (int col = 0 ; col < nCols ; col++) { double sum = 0; for (int i = 0 ; i < nRows ; i++) { sum += (data[i][col]) * (v[i]); } out[col] = sum; } return out; } public double[] solve(double[] b) throws java.lang.IllegalArgumentException, org.apache.commons.math.linear.InvalidMatrixException { final int nRows = org.apache.commons.math.linear.RealMatrixImpl.this.getRowDimension(); if ((b.length) != nRows) { throw new java.lang.IllegalArgumentException("constant vector has wrong length"); } final org.apache.commons.math.linear.RealMatrix bMatrix = new org.apache.commons.math.linear.RealMatrixImpl(b); final double[][] solution = ((org.apache.commons.math.linear.RealMatrixImpl)(solve(bMatrix))).getDataRef(); final double[] out = new double[nRows]; for (int row = 0 ; row < nRows ; row++) { out[row] = solution[row][0]; } return out; } public org.apache.commons.math.linear.RealMatrix solve(org.apache.commons.math.linear.RealMatrix b) throws java.lang.IllegalArgumentException, org.apache.commons.math.linear.InvalidMatrixException { if ((b.getRowDimension()) != (org.apache.commons.math.linear.RealMatrixImpl.this.getRowDimension())) { throw new java.lang.IllegalArgumentException("Incorrect row dimension"); } if (!(org.apache.commons.math.linear.RealMatrixImpl.this.isSquare())) { throw new org.apache.commons.math.linear.InvalidMatrixException("coefficient matrix is not square"); } if (org.apache.commons.math.linear.RealMatrixImpl.this.isSingular()) { throw new org.apache.commons.math.linear.InvalidMatrixException("Matrix is singular."); } final int nCol = org.apache.commons.math.linear.RealMatrixImpl.this.getColumnDimension(); final int nColB = b.getColumnDimension(); final int nRowB = b.getRowDimension(); final double[][] bp = new double[nRowB][nColB]; for (int row = 0 ; row < nRowB ; row++) { final double[] bpRow = bp[row]; for (int col = 0 ; col < nColB ; col++) { bpRow[col] = b.getEntry(permutation[row], col); } } for (int col = 0 ; col < nCol ; col++) { for (int i = col + 1 ; i < nCol ; i++) { final double[] bpI = bp[i]; final double[] luI = lu[i]; for (int j = 0 ; j < nColB ; j++) { bpI[j] -= (bp[col][j]) * (luI[col]); } } } for (int col = nCol - 1 ; col >= 0 ; col--) { final double[] bpCol = bp[col]; final double luDiag = lu[col][col]; for (int j = 0 ; j < nColB ; j++) { bpCol[j] /= luDiag; } for (int i = 0 ; i < col ; i++) { final double[] bpI = bp[i]; final double[] luI = lu[i]; for (int j = 0 ; j < nColB ; j++) { bpI[j] -= (bp[col][j]) * (luI[col]); } } } return new org.apache.commons.math.linear.RealMatrixImpl(bp , false); } public void luDecompose() throws org.apache.commons.math.linear.InvalidMatrixException { final int nRows = org.apache.commons.math.linear.RealMatrixImpl.this.getRowDimension(); final int nCols = org.apache.commons.math.linear.RealMatrixImpl.this.getColumnDimension(); if (nRows != nCols) { throw new org.apache.commons.math.linear.InvalidMatrixException("LU decomposition requires that the matrix be square."); } lu = getData(); permutation = new int[nRows]; for (int row = 0 ; row < nRows ; row++) { permutation[row] = row; } parity = 1; for (int col = 0 ; col < nCols ; col++) { double sum = 0; for (int row = 0 ; row < col ; row++) { final double[] luRow = lu[row]; sum = luRow[col]; for (int i = 0 ; i < row ; i++) { sum -= (luRow[i]) * (lu[i][col]); } luRow[col] = sum; } int max = col; double largest = 0.0; for (int row = col ; row < nRows ; row++) { final double[] luRow = lu[row]; sum = luRow[col]; for (int i = 0 ; i < col ; i++) { sum -= (luRow[i]) * (lu[i][col]); } luRow[col] = sum; if ((java.lang.Math.abs(sum)) > largest) { largest = java.lang.Math.abs(sum); max = row; } } if ((java.lang.Math.abs(lu[max][col])) < (org.apache.commons.math.linear.RealMatrixImpl.TOO_SMALL)) { lu = null; throw new org.apache.commons.math.linear.InvalidMatrixException("matrix is singular"); } if (max != col) { double tmp = 0; for (int i = 0 ; i < nCols ; i++) { tmp = lu[max][i]; lu[max][i] = lu[col][i]; lu[col][i] = tmp; } int temp = permutation[max]; permutation[max] = permutation[col]; permutation[col] = temp; parity = -(parity); } final double luDiag = lu[col][col]; for (int row = col + 1 ; row < nRows ; row++) { lu[row][col] /= luDiag; } } } public java.lang.String toString() { java.lang.StringBuffer res = new java.lang.StringBuffer(); res.append("RealMatrixImpl{"); if ((data) != null) { for (int i = 0 ; i < (data.length) ; i++) { if (i > 0) { res.append(","); } res.append("{"); for (int j = 0 ; j < (data[0].length) ; j++) { if (j > 0) { res.append(","); } res.append(data[i][j]); } res.append("}"); } } res.append("}"); return res.toString(); } public boolean equals(java.lang.Object object) { if (object == (org.apache.commons.math.linear.RealMatrixImpl.this)) { return true; } if ((object instanceof org.apache.commons.math.linear.RealMatrixImpl) == false) { return false; } org.apache.commons.math.linear.RealMatrix m = ((org.apache.commons.math.linear.RealMatrix)(object)); final int nRows = getRowDimension(); final int nCols = getColumnDimension(); if (((m.getColumnDimension()) != nCols) || ((m.getRowDimension()) != nRows)) { return false; } for (int row = 0 ; row < nRows ; row++) { final double[] dataRow = data[row]; for (int col = 0 ; col < nCols ; col++) { if ((java.lang.Double.doubleToLongBits(dataRow[col])) != (java.lang.Double.doubleToLongBits(m.getEntry(row, col)))) { return false; } } } return true; } public int hashCode() { int ret = 7; final int nRows = getRowDimension(); final int nCols = getColumnDimension(); ret = (ret * 31) + nRows; ret = (ret * 31) + nCols; for (int row = 0 ; row < nRows ; row++) { final double[] dataRow = data[row]; for (int col = 0 ; col < nCols ; col++) { ret = (ret * 31) + (((11 * (row + 1)) + (17 * (col + 1))) * (org.apache.commons.math.util.MathUtils.hash(dataRow[col]))); } } return ret; } protected org.apache.commons.math.linear.RealMatrix getLUMatrix() throws org.apache.commons.math.linear.InvalidMatrixException { if ((lu) == null) { luDecompose(); } return new org.apache.commons.math.linear.RealMatrixImpl(lu); } protected int[] getPermutation() { final int[] out = new int[permutation.length]; java.lang.System.arraycopy(permutation, 0, out, 0, permutation.length); return out; } private double[][] copyOut() { final int nRows = org.apache.commons.math.linear.RealMatrixImpl.this.getRowDimension(); final double[][] out = new double[nRows][org.apache.commons.math.linear.RealMatrixImpl.this.getColumnDimension()]; for (int i = 0 ; i < nRows ; i++) { java.lang.System.arraycopy(data[i], 0, out[i], 0, data[i].length); } return out; } private void copyIn(double[][] in) { setSubMatrix(in, 0, 0); } private boolean isValidCoordinate(int row, int col) { final int nRows = getRowDimension(); final int nCols = getColumnDimension(); return !((((row < 0) || (row > (nRows - 1))) || (col < 0)) || (col > (nCols - 1))); } }
3ea5581005342f4ad699eb88f26530066b7051e9
65435a099a3919e4079e651412ed8c0bfb02fa52
/trunk/app/src/main/java/com/aibinong/tantan/ui/adapter/message/viewholder/ChatItemOppositeVideoHolder.java
6d26cd4dfe94267a9db4776e7b6156bdab892938
[]
no_license
tomdev2008/trunk-1
d632c837fc2c503fdfe12df62097db9e86495bd5
365752e68d64b665fb493d825887073ed9fea316
refs/heads/master
2021-06-15T18:59:22.750699
2017-04-03T13:56:42
2017-04-03T13:56:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,041
java
package com.aibinong.tantan.ui.adapter.message.viewholder; // _______________________________________________________________________________________________\ //| | //| Created by yourfriendyang on 16/11/14. | //| [email protected] | //|_______________________________________________________________________________________________| import android.content.Intent; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import com.aibinong.tantan.R; import com.aibinong.tantan.ui.activity.message.EaseShowVideoActivity; import com.bumptech.glide.Glide; import com.bumptech.glide.load.resource.drawable.GlideDrawable; import com.bumptech.glide.request.animation.GlideAnimation; import com.bumptech.glide.request.target.SimpleTarget; import com.fatalsignal.util.DeviceUtils; import com.fatalsignal.util.Log; import com.fatalsignal.util.StringUtils; import com.fatalsignal.view.RoundAngleImageView; import com.hyphenate.chat.EMMessage; import com.hyphenate.chat.EMVideoMessageBody; import butterknife.Bind; import butterknife.ButterKnife; public class ChatItemOppositeVideoHolder extends ChatItemBaseHolder { @Bind(R.id.tv_item_chat_self_video_content) RoundAngleImageView mTvItemChatSelfVideoContent; @Bind(R.id.ibtn_item_chat_self_video_load) ImageView mIbtnItemChatSelfVideoLoad; @Bind(R.id.tv_item_chat_self_video_load) TextView mTvItemChatSelfVideoLoad; @Bind(R.id.ll_item_chat_self_video_load) LinearLayout mLlItemChatSelfVideoLoad; private EMVideoMessageBody mVideoBody; public ChatItemOppositeVideoHolder(View itemView) { super(itemView); } @Override protected void bindContentView(ViewGroup viewGroup) { LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.abn_yueai_item_chat_self_video, viewGroup, true); ButterKnife.bind(this, viewGroup); } @Override protected void onBindData(EMMessage msg) { if (msg.getBody() instanceof EMVideoMessageBody) { mVideoBody = (EMVideoMessageBody) mEMMessage.getBody(); int maxW = (int) ((DeviceUtils.getScreenWidth(itemView.getContext()) * 2) / 3.0f); ViewGroup.LayoutParams vlp = mTvItemChatSelfVideoContent.getLayoutParams(); vlp.width = maxW; vlp.height = maxW; mTvItemChatSelfVideoContent.setLayoutParams(vlp); String imageUrl = mVideoBody.getThumbnailUrl(); if (StringUtils.isEmpty(imageUrl)) { imageUrl = mVideoBody.getLocalThumb(); } if (StringUtils.isEmpty(imageUrl)) { imageUrl = mVideoBody.getLocalUrl(); } if (StringUtils.isEmpty(imageUrl)) { imageUrl = mVideoBody.getRemoteUrl(); } Log.i("ChatItemOppositeVideoHolder", "pos=" + getAdapterPosition() + "imageUrl=" + imageUrl); Glide.with(itemView.getContext()).load(imageUrl).into(new SimpleTarget<GlideDrawable>(maxW, maxW) { @Override public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> glideAnimation) { mTvItemChatSelfVideoContent.setImageDrawable(resource); } }); } } @Override protected void onContentClick() { Intent intent = new Intent(itemView.getContext(), EaseShowVideoActivity.class); intent.putExtra("localpath", mVideoBody.getLocalUrl()); intent.putExtra("secret", mVideoBody.getSecret()); intent.putExtra("remotepath", mVideoBody.getRemoteUrl()); itemView.getContext().startActivity(intent); markMsgAsReaded(); } }
d4ab102d60e6ef0819937a21fa3a005314b0b50f
9235a03646a084ba1d597fcb77055688fa85e102
/src/client/Client.java
fa7d9b76629c37e12a8499752f1fff5730af6b98
[]
no_license
wthadeo/loja_carros
099f30e70407ff07e886225e3630a26a410c9a85
b23fc346a1ce817b2b86e2bc7113800dad4cf880
refs/heads/master
2023-08-20T08:24:53.702704
2021-10-05T00:45:02
2021-10-05T00:45:02
404,914,935
0
0
null
null
null
null
UTF-8
Java
false
false
18,581
java
package client; import server.classes.Invoice; import server.classes.User; import server.classes.Car; import server.LojaFunctions; import java.rmi.RemoteException; import java.rmi.registry.LocateRegistry; import java.rmi.registry.Registry; import java.util.ArrayList; import java.util.Scanner; public class Client { public Client(){} public static void main(String[] args) { boolean allFunctions = false; User actualUser = new User("", "", ""); boolean logged = false, closeProgram = false; Scanner inputClient = new Scanner(System.in); String username, pass; ArrayList<Car> referenceCars = new ArrayList<>(); ArrayList<Car> foundedCars = new ArrayList<>(); Car foundCar = new Car(); try { Registry registro = LocateRegistry.getRegistry("localhost", 20002); LojaFunctions stubClient = (LojaFunctions) registro.lookup("LojaServer"); do{ System.out.println("Insira o seu username: "); username = inputClient.nextLine(); System.out.println("Insira a sua senha: "); pass = inputClient.nextLine(); actualUser = stubClient.login(username, pass); if(actualUser != null){ logged = true; if(actualUser.function.equals("Employee")){ allFunctions = true; } System.out.println("Login efetuado com sucesso!"); } else { System.out.println("Falha ao logar, tente novamente."); } } while(!logged); while(!closeProgram) { String choice; if (allFunctions) { menuEmployee(); choice = inputClient.nextLine(); switch (Integer.parseInt(choice)){ case 1: String a,b,c, d, resultado; System.out.println("Informe os dados do veiculo para adiciona-lo"); System.out.println("Renavan:"); a = inputClient.nextLine(); System.out.println("Nome:"); b = inputClient.nextLine(); System.out.println("Ano de Fabricação:"); c = (inputClient.nextLine()); System.out.println("Preço:"); d = inputClient.nextLine(); resultado = stubClient.addCar(a, b, Integer.parseInt(c), Double.parseDouble(d)); System.out.println(resultado); referenceCars = stubClient.referenceCars(); listCars(referenceCars); break; case 2: String renavamDeletar; System.out.println("Informe o renavam do carro que deseja deletar"); renavamDeletar = inputClient.nextLine(); resultado = stubClient.deleteCar(renavamDeletar); System.out.println(resultado); referenceCars = stubClient.referenceCars(); listCars(referenceCars); break; case 3: System.out.println("Deseja Listar por categoria? (S/N)"); String yesOrNo, categoryChoosed; yesOrNo = inputClient.nextLine(); if(yesOrNo.equalsIgnoreCase("s")){ System.out.println("Digite qual categoria deseja: "); System.out.println("1. Econômica | 2. Intermediária | 3. Executiva"); categoryChoosed = inputClient.nextLine(); if(Integer.parseInt(categoryChoosed) == 1){ referenceCars = stubClient.referenceCars(); listCars(referenceCars, Car.Category.ECONOMIC); } else if (Integer.parseInt(categoryChoosed) == 2){ referenceCars = stubClient.referenceCars(); listCars(referenceCars, Car.Category.INTERMEDIARY); } else if (Integer.parseInt(categoryChoosed) == 3){ referenceCars = stubClient.referenceCars(); listCars(referenceCars, Car.Category.EXECUTIVE); } else { System.out.println("Opção Inválida"); } } else { referenceCars = stubClient.referenceCars(); listCars(referenceCars); } break; case 4: String searchChoosed; System.out.println("Digite como deseja fazer a consulta: "); System.out.println("1. Por Renavam | 2. Por nome"); searchChoosed = inputClient.nextLine(); if(Integer.parseInt(searchChoosed) == 1){ String renavamConsulta; System.out.println("Digite o número do renavam: "); renavamConsulta = inputClient.nextLine(); foundCar = stubClient.searchCarRenavam(renavamConsulta); System.out.println("Renavam: " + foundCar.renavam + " | Nome: " + foundCar.name + " | Categoria: " + foundCar.category + " | Ano de Fab: " + foundCar.year + "| Preço: " + foundCar.price); } else if (Integer.parseInt(searchChoosed) == 2){ String nomeConsulta; System.out.println("Digite o nome do carro: "); nomeConsulta = inputClient.nextLine(); foundedCars = stubClient.searchCarName(nomeConsulta); listCars(foundedCars); } else { System.out.println("Opção Inválida"); } break; case 5: String carEdit; referenceCars = stubClient.referenceCars(); listCars(referenceCars); System.out.println("Informe o renavam do carro a editar: "); carEdit = inputClient.nextLine(); Car carToEdit = stubClient.searchCarRenavam(carEdit); if(carToEdit !=null) { System.out.println("Renavam: " + carToEdit.renavam + " | Nome: " + carToEdit.name + " | Categoria: " + carToEdit.category + " | Ano de Fab: " + carToEdit.year + "| Preço: " + carToEdit.price); System.out.println("Informe os novos dados para renavam, Nome, Ano de Fab e Preço: "); String e = inputClient.nextLine(); String f = inputClient.nextLine(); String g = inputClient.nextLine(); String h = inputClient.nextLine(); resultado = stubClient.editCar(carEdit, e, f, Integer.parseInt(g), Double.parseDouble(h)); } else{ resultado = "Este Renavam não pertence à um carro cadastrado no sistema."; } System.out.println(resultado); break; case 6: System.out.println("Atualmente existem " + stubClient.infoQuantity() + " carros cadastrados no sistema."); break; case 7: String carBuy; referenceCars = stubClient.referenceCars(); listCars(referenceCars); System.out.println("Informe o renavam do carro que deseja comprar: "); carBuy = inputClient.nextLine(); Car carToBuy = stubClient.searchCarRenavam(carBuy); if(carToBuy !=null) { System.out.println("Renavam: " + carToBuy.renavam + " | Nome: " + carToBuy.name + " | Categoria: " + carToBuy.category + " | Ano de Fab: " + carToBuy.year + "| Preço: " + carToBuy.price); System.out.println("Para concluir a transação, "); System.out.println("Por favor informe os dados a seguir"); System.out.println("Nome Completo: "); String nomeCompleto = inputClient.nextLine(); System.out.println("CPF: "); String cpf = inputClient.nextLine(); System.out.println("Data de Nascimento: (dd/mm/aaaa) "); String dataNasc = inputClient.nextLine(); System.out.println("Endereço: "); String endereco = inputClient.nextLine(); resultado = stubClient.buyCar(carToBuy); System.out.println(resultado); Invoice invoiceCarBuyed = new Invoice(nomeCompleto, cpf, dataNasc, endereco, carToBuy); invoiceCarBuyed.showInvoice(); } break; case 8: System.out.println("Até logo!"); closeProgram = true; break; } } else { menuClient(); choice = inputClient.nextLine(); switch (Integer.parseInt(choice)){ case 1: System.out.println("Deseja Listar por categoria? (S/N)"); String yesOrNo, categoryChoosed; yesOrNo = inputClient.nextLine(); if(yesOrNo.equalsIgnoreCase("s")){ System.out.println("Digite qual categoria deseja: "); System.out.println("1. Econômica | 2. Intermediária | 3. Executiva"); categoryChoosed = inputClient.nextLine(); if(Integer.parseInt(categoryChoosed) == 1){ referenceCars = stubClient.referenceCars(); listCars(referenceCars, Car.Category.ECONOMIC); } else if (Integer.parseInt(categoryChoosed) == 2){ referenceCars = stubClient.referenceCars(); listCars(referenceCars, Car.Category.INTERMEDIARY); } else if (Integer.parseInt(categoryChoosed) == 3){ referenceCars = stubClient.referenceCars(); listCars(referenceCars, Car.Category.EXECUTIVE); } else { System.out.println("Opção Inválida"); } } else { referenceCars = stubClient.referenceCars(); listCars(referenceCars); } break; case 2: String searchChoosed; System.out.println("Digite como deseja fazer a consulta: "); System.out.println("1. Por Renavam | 2. Por nome"); searchChoosed = inputClient.nextLine(); if(Integer.parseInt(searchChoosed) == 1){ String renavamConsulta; System.out.println("Digite o número do renavam: "); renavamConsulta = inputClient.nextLine(); foundCar = stubClient.searchCarRenavam(renavamConsulta); System.out.println("Renavam: " + foundCar.renavam + " | Nome: " + foundCar.name + " | Categoria: " + foundCar.category + " | Ano de Fab: " + foundCar.year + "| Preço: " + foundCar.price); } else if (Integer.parseInt(searchChoosed) == 2){ String nomeConsulta; System.out.println("Digite o nome do carro: "); nomeConsulta = inputClient.nextLine(); foundedCars = stubClient.searchCarName(nomeConsulta); listCars(foundedCars); } else { System.out.println("Opção Inválida"); } break; case 3: System.out.println("Atualmente existem " + stubClient.infoQuantity() + " carros cadastrados no sistema."); break; case 4: String carBuy; referenceCars = stubClient.referenceCars(); listCars(referenceCars); System.out.println("Informe o renavam do carro que deseja comprar: "); carBuy = inputClient.nextLine(); Car carToBuy = stubClient.searchCarRenavam(carBuy); if(carToBuy !=null) { System.out.println("Renavam: " + carToBuy.renavam + " | Nome: " + carToBuy.name + " | Categoria: " + carToBuy.category + " | Ano de Fab: " + carToBuy.year + "| Preço: " + carToBuy.price); System.out.println("Para concluir a transação, "); System.out.println("Por favor informe os dados a seguir"); System.out.println("Nome Completo: "); String nomeCompleto = inputClient.nextLine(); System.out.println("CPF: "); String cpf = inputClient.nextLine(); System.out.println("Data de Nascimento: (dd/mm/aaaa) "); String dataNasc = inputClient.nextLine(); System.out.println("Endereço: "); String endereco = inputClient.nextLine(); String resultado2 = stubClient.buyCar(carToBuy); System.out.println(resultado2); Invoice invoiceCarBuyed = new Invoice(nomeCompleto, cpf, dataNasc, endereco, carToBuy); invoiceCarBuyed.showInvoice(); } break; case 5: System.out.println("Até logo!"); closeProgram = true; break; } } } } catch (Exception e) { System.err.println("Client exception: " + e.toString()); e.printStackTrace(); } } public static void listCars(ArrayList<Car> cars){ for(Car atualCar: cars){ System.out.println("Renavam: " + atualCar.renavam + " | Nome: " + atualCar.name + " | Categoria: " + atualCar.category + " | Ano de Fab: " + atualCar.year + "| Preço: " + atualCar.price); } } public static void listCars(ArrayList<Car> cars, Car.Category category){ for(Car atualCar: cars){ if(atualCar.category.equals(category)) { System.out.println("Renavam: " + atualCar.renavam + " | Nome: " + atualCar.name + " | Categoria: " + atualCar.category + " | Ano de Fab: " + atualCar.year + "| Preço: " + atualCar.price); } } } public static void menuEmployee(){ System.out.println("SISTEMA RENT A CAR"); System.out.println("ESCOLHA UMA DAS OPÇÕES ABAIXO PARA CONTINUAR"); System.out.println("1. ADICIONAR CARRO"); System.out.println("2. DELETAR CARRO"); System.out.println("3. LISTAR CARROS"); System.out.println("4. CONSULTAR CARRO"); System.out.println("5. EDITAR CARRO"); System.out.println("6. EXIBIR QUANTIDADE DE CARROS"); System.out.println("7. COMPRAR CARRO"); System.out.println("8. ENCERRAR SESSÃO"); } public static void menuClient(){ System.out.println("BEM VINDO A RENT A CAR"); System.out.println("ESCOLHA UMA DAS OPÇÕES ABAIXO PARA CONTINUAR"); System.out.println("1. LISTAR CARROS"); System.out.println("2. CONSULTAR CARRO"); System.out.println("3. EXIBIR QUANTIDADE DE CARROS"); System.out.println("4. COMPRAR CARRO"); System.out.println("5. ENCERRAR SESSÃO"); } }
af01f1a12e7e37e37ed6dc2dce51e0e98e52d28a
187d562b2b7ba015ad6b4f6a22ef2dd425a93cad
/src/main/java/com/dextra/gymapp/domain/model/Preset.java
9a089bcbc840aebef51b9bfd8cd77b31a02c2778
[]
no_license
rafaelpcustodio/gym-back-api
88c0c4fc140a106c726fb4bcb7f158c0ed555919
ead818b9085191458e58efc10abe6377fc07e5de
refs/heads/master
2020-09-23T11:34:33.888973
2020-01-20T18:37:22
2020-01-20T18:37:22
225,491,883
0
0
null
null
null
null
UTF-8
Java
false
false
1,274
java
package com.dextra.gymapp.domain.model; import com.dextra.gymapp.domain.enums.ExerciseLevelTypes; import javax.persistence.*; import java.io.Serializable; import java.util.HashSet; import java.util.Set; @Entity @Table(name = "PRESET") public class Preset implements Serializable { @Id @GeneratedValue private Long id; @Column(name="NAME") private String name; @Column(name="DESCRIPTION") private String description; @Column(name="LEVEL") private ExerciseLevelTypes level; @OneToMany(fetch = FetchType.LAZY, mappedBy = "pk.preset", cascade = CascadeType.ALL) private Set<PresetExercise> presetExercises = new HashSet<>(); public Preset(){} public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public ExerciseLevelTypes getLevel() { return level; } public void setLevel(ExerciseLevelTypes level) { this.level = level; } }
2c77599413d53814da6c781a5fddba420b327f0a
0353e86a389641d0c7e0bb060c9d45d87f5ec3a8
/android/app/src/main/java/uniquelypresent/com/ishopping/MainActivity.java
36e0662aad9bb31b33ec0a944f8a42a185b7d991
[]
no_license
demmydwi/iShopping-Flutter
e88cf67602867140c1f2bd6d61819cae62d4fc9e
71d46a590f5fbf55ba2c4f9c3b30d75d754cc85f
refs/heads/master
2020-04-02T09:55:50.606129
2018-10-23T11:35:44
2018-10-23T11:35:44
154,316,915
1
0
null
null
null
null
UTF-8
Java
false
false
374
java
package uniquelypresent.com.ishopping; import android.os.Bundle; import io.flutter.app.FlutterActivity; import io.flutter.plugins.GeneratedPluginRegistrant; public class MainActivity extends FlutterActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); GeneratedPluginRegistrant.registerWith(this); } }
f228e1035e8d05e9684d52342a6bb504cae31ccc
dc631e3894b6062676c027b74a9956c9e0370132
/src/hackerearth/RoyAndProfilePicture.java
30650ffeb9815008c0270ce5e623b9c9f9a2a9f5
[]
no_license
ramasamykasiviswanathan/bankBazaar-and-HackerEarth
fd87f7e1ae914c2f76c709afbb29f0007e1320b3
0041c2ff393bf43ef4c17d7b00674dca81ee0091
refs/heads/master
2020-12-25T18:22:42.616811
2019-03-04T05:41:23
2019-03-04T05:41:23
35,136,112
0
0
null
2017-05-15T08:09:55
2015-05-06T02:55:21
Java
UTF-8
Java
false
false
1,187
java
package hackerearth; import java.util.LinkedList; import java.util.Scanner; public class RoyAndProfilePicture { public static void main(String[] args) { int _length = 0, _no_of_testCase; LinkedList<String> linkedList = new LinkedList<String>(); try (Scanner scanner = new Scanner(System.in)) { _length = scanner.nextInt(); _no_of_testCase = scanner.nextInt(); for (int _iterate = 0; _iterate <= _no_of_testCase; _iterate++) linkedList.add(scanner.nextLine()); } catch (Exception e) { e.printStackTrace(); } for (String _elements : linkedList) { if (!_elements.trim().equals("")) { String[] _list_elements = _elements.split(" "); int[] _integer_values = new int[] { Integer.valueOf( _list_elements[0].trim()), Integer.valueOf(_list_elements[1].trim()) }; if (_integer_values[0] < _length || _integer_values[1] < _length) System.out.println("UPLOAD ANOTHER"); else if (_integer_values[0] >= _length && _integer_values[1] >= _length && _integer_values[0] == _integer_values[1]) System.out.println("ACCEPTED"); else System.out.println("CROP IT"); } } } }
2e7d34edd3f8ed83b05fb9f89056103e3c873a3d
30bde930a3290a6766551962302f4751bf985eb4
/Prac_Server/app/src/main/java/com/jmdroid/prac_server/network/resmodel/ResHeader.java
91425f1bccdc151003c5c685a8e41b5216ad4f9e
[]
no_license
jimin530/Prac_Android
adb4a3e4ba24982c171b48c2c65301f0db5cb873
61e2d8b3220dd8906e25c483926e3f853e4dc803
refs/heads/master
2021-03-24T13:43:34.445431
2017-09-21T11:47:05
2017-09-21T11:47:05
86,223,790
0
0
null
null
null
null
UTF-8
Java
false
false
403
java
package com.jmdroid.prac_server.network.resmodel; /** * Created by Tacademy on 2017-01-17. */ public class ResHeader { int code; String msg; public int getCode() { return code; } public void setCode(int code) { this.code = code; } public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } }
d898f3b751e4d108e8a6d509028324a85e373e21
18d5d85e6cf404299b6ecbee705d49ae0f114d6a
/src/java/TestPlayer.java
72a45323af1984eea18f6c927847843ff8610cac
[]
no_license
hark7/DecisionTreeTest
b33d4bc9c11ffcb8ad9db77ee85b80ca2fc56c45
bd4503a5fbedeb604d0934e63fd66b1adf745ddd
refs/heads/master
2021-01-13T14:54:58.506767
2016-12-17T00:21:43
2016-12-17T00:21:43
76,693,843
0
0
null
null
null
null
UTF-8
Java
false
false
1,547
java
import com.knowlegevalues.assignment.model.Result; import com.knowlegevalues.assignment.service.Player; /** * This class uses a normal java main class to invoke * one among the different test scenarios * For testing a scenario, just use the test method name inside main function * @author harikrishnankesavan * */ public class TestPlayer { public static void main(String [] args) { test2(); } private static Result test1() { Result result = null; Player player = new Player(); String selectedNode = null; do { result = player.consult("Start.xml", selectedNode, "Decrease by 5 degrees"); selectedNode = result.getSelectedNode(); } while (!result.isLeaf()); return result; } private static Result test2() { Result result = null; Player player = new Player(); result = player.consult("Start.xml", null, null); System.out.println("\nOptions to select are:"); for(String name:result.getChildNodeNames()) { System.out.println("- "+name); } return result; } private static Result test3() { Result result = null; Player player = new Player(); do { result = player.consult("Start.xml", "Decrease", "Decrease by 5 degrees"); } while (!result.isLeaf()); return result; } private static Result test4() { Result result = null; Player player = new Player(); result = player.consult("Start.xml", "Decrease", null); System.out.println("\nOptions to select are:"); for(String name:result.getChildNodeNames()) { System.out.println("- "+name); } return result; } }
[ "scorfiene.live.in" ]
scorfiene.live.in
309f553e9bda2914aecdf26cf82fac2f7048b5ae
b96d4ddf58e5d38754c1afed079051ac6bbcef95
/abs/Bookmark.java
6a240f18dfb7fd8b6790d55653a79627a9105e8e
[]
no_license
nikkiumar1993/JavaCodes
82f60c683d8ef188d1f8ece25d61e594d3092e52
1851d55af5815b39993660508c309bf719bd497a
refs/heads/master
2021-01-01T23:34:04.396352
2020-02-10T00:14:32
2020-02-10T00:14:32
239,392,423
0
0
null
null
null
null
UTF-8
Java
false
false
128
java
package abs; public interface Bookmark { void addUrlBookmark(String url); void removeUrlFromBookmark(String url); }
0f73d3c7714e4f52b6dcfb0e14bf5dc05afd5140
abcc3c208767952ff8ee4fafc4934aeca1d46ffb
/RapidQuiz/src/main/java/in/com/online/exam/model/UserModel.java
3ce4e2d7fb6864b784ab55a14f6cf27d23a4f562
[]
no_license
rahulmerugula/onlinequizsystem
d1740ec524629c440dcd1f624d0a44422249678c
d2633f488d35194a3783acabaea9293e515ee806
refs/heads/master
2023-06-02T00:14:43.923412
2021-06-16T05:19:26
2021-06-16T05:19:26
377,378,837
0
0
null
null
null
null
UTF-8
Java
false
false
14,115
java
package in.com.online.exam.model; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import org.apache.log4j.Logger; import in.com.online.exam.bean.UserBean; import in.com.online.exam.exeption.ApplicationException; import in.com.online.exam.exeption.DatabaseException; import in.com.online.exam.exeption.DuplicateRecordException; import in.com.online.exam.exeption.RecordNotFoundException; import in.com.online.exam.util.EmailBuilder; import in.com.online.exam.util.EmailMessage; import in.com.online.exam.util.EmailUtility; import in.com.online.exam.util.JDBCDataSource; public class UserModel { private static Logger log = Logger.getLogger(UserModel.class); public Integer nextPK() throws DatabaseException { log.debug("Model nextPK Started"); Connection conn = null; int pk = 0; try { conn = JDBCDataSource.getConnection(); PreparedStatement pstmt = conn.prepareStatement("SELECT MAX(ID) FROM EX_USER"); ResultSet rs = pstmt.executeQuery(); while (rs.next()) { pk = rs.getInt(1); } rs.close(); } catch (Exception e) { log.error("Database Exception..", e); throw new DatabaseException("Exception : Exception in getting PK"); } finally { JDBCDataSource.closeConnection(conn); } log.debug("Model nextPK End"); return pk + 1; } public long add(UserBean bean) throws ApplicationException, DuplicateRecordException { Connection conn = null; int pk = 0; UserBean existbean = findByLogin(bean.getLogin()); if (existbean != null) { throw new DuplicateRecordException("Login Id already exists"); } try { conn = JDBCDataSource.getConnection(); pk = nextPK(); // Get auto-generated next primary key System.out.println(pk + " in ModelJDBC"); conn.setAutoCommit(false); // Begin transaction PreparedStatement pstmt = conn.prepareStatement("INSERT INTO EX_USER VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); pstmt.setInt(1, pk); pstmt.setString(2, bean.getFName()); pstmt.setString(3, bean.getLName()); pstmt.setString(4, bean.getLogin()); pstmt.setString(5, bean.getPassword()); pstmt.setString(6, bean.getMobileNo()); pstmt.setDate(7, new java.sql.Date(bean.getDob().getTime())); pstmt.setString(8, bean.getGender()); pstmt.setString(9,bean.getAddress()); pstmt.setString(10, bean.getCreatedBy()); pstmt.setString(11, bean.getModifiedBy()); pstmt.setTimestamp(12, bean.getCreatedDatetime()); pstmt.setTimestamp(13, bean.getModifiedDatetime()); pstmt.setString(14,bean.getRoleName()); pstmt.setLong(15, bean.getRole_Id()); pstmt.executeUpdate(); conn.commit(); // End transaction pstmt.close(); } catch (Exception e) { try { conn.rollback(); } catch (Exception ex) { ex.printStackTrace(); throw new ApplicationException("Exception : add rollback exception " + ex.getMessage()); } throw new ApplicationException("Exception : Exception in add User"); } finally { JDBCDataSource.closeConnection(conn); } return pk; } public UserBean findByLogin(String login) throws ApplicationException { log.debug("Model findByLogin Started"); StringBuffer sql = new StringBuffer("SELECT * FROM EX_USER WHERE LOGIN=?"); UserBean bean = null; Connection conn = null; System.out.println("sql" + sql); try { conn = JDBCDataSource.getConnection(); PreparedStatement pstmt = conn.prepareStatement(sql.toString()); pstmt.setString(1, login); ResultSet rs = pstmt.executeQuery(); while (rs.next()) { bean = new UserBean(); bean.setId(rs.getLong(1)); bean.setFName(rs.getString(2)); bean.setLName(rs.getString(3)); bean.setLogin(rs.getString(4)); bean.setPassword(rs.getString(5)); bean.setMobileNo(rs.getString(6)); bean.setDob(rs.getDate(7)); bean.setAddress(rs.getString(8)); bean.setGender(rs.getString(9)); bean.setCreatedBy(rs.getString(10)); bean.setModifiedBy(rs.getString(11)); bean.setCreatedDatetime(rs.getTimestamp(12)); bean.setModifiedDatetime(rs.getTimestamp(13)); bean.setRoleName(rs.getString(14)); bean.setRole_Id(rs.getLong(15)); } rs.close(); } catch (Exception e) { e.printStackTrace(); log.error("Database Exception..", e); throw new ApplicationException("Exception : Exception in getting User by login"); } finally { JDBCDataSource.closeConnection(conn); } log.debug("Model findByLogin End"); return bean; } public UserBean findByPK(long pk) throws ApplicationException { log.debug("Model findByPK Started"); StringBuffer sql = new StringBuffer("SELECT * FROM EX_USER WHERE ID=?"); UserBean bean = null; Connection conn = null; try { conn = JDBCDataSource.getConnection(); PreparedStatement pstmt = conn.prepareStatement(sql.toString()); pstmt.setLong(1, pk); ResultSet rs = pstmt.executeQuery(); while (rs.next()) { bean = new UserBean(); bean.setId(rs.getLong(1)); bean.setFName(rs.getString(2)); bean.setLName(rs.getString(3)); bean.setLogin(rs.getString(4)); bean.setPassword(rs.getString(5)); bean.setMobileNo(rs.getString(6)); bean.setDob(rs.getDate(7)); bean.setAddress(rs.getString(8)); bean.setGender(rs.getString(9)); bean.setCreatedBy(rs.getString(10)); bean.setModifiedBy(rs.getString(11)); bean.setCreatedDatetime(rs.getTimestamp(12)); bean.setModifiedDatetime(rs.getTimestamp(13)); bean.setRoleName(rs.getString(14)); bean.setRole_Id(rs.getLong(15)); } rs.close(); } catch (Exception e) { e.printStackTrace(); log.error("Database Exception..", e); throw new ApplicationException("Exception : Exception in getting User by pk"); } finally { JDBCDataSource.closeConnection(conn); } log.debug("Model findByPK End"); return bean; } public UserBean authenticate(String login, String password) throws ApplicationException { log.debug("Model authenticate Started"); StringBuffer sql = new StringBuffer("SELECT * FROM EX_USER WHERE LOGIN = ? AND PASSWORD = ?"); UserBean bean = null; Connection conn = null; try { conn = JDBCDataSource.getConnection(); PreparedStatement pstmt = conn.prepareStatement(sql.toString()); pstmt.setString(1, login); pstmt.setString(2, password); ResultSet rs = pstmt.executeQuery(); while (rs.next()) { bean = new UserBean(); bean.setId(rs.getLong(1)); bean.setFName(rs.getString(2)); bean.setLName(rs.getString(3)); bean.setLogin(rs.getString(4)); bean.setPassword(rs.getString(5)); bean.setMobileNo(rs.getString(6)); bean.setDob(rs.getDate(7)); bean.setAddress(rs.getString(8)); bean.setGender(rs.getString(9)); bean.setCreatedBy(rs.getString(10)); bean.setModifiedBy(rs.getString(11)); bean.setCreatedDatetime(rs.getTimestamp(12)); bean.setModifiedDatetime(rs.getTimestamp(13)); bean.setRoleName(rs.getString(14)); bean.setRole_Id(rs.getLong(15)); System.out.println("Usermodel here"); } } catch (Exception e) { log.error("Database Exception..", e); throw new ApplicationException("Exception : Exception in get roles"); } finally { JDBCDataSource.closeConnection(conn); } log.debug("Model authenticate End"); return bean; } public long registerUser(UserBean bean) throws ApplicationException, DuplicateRecordException { log.debug("Model add Started"); long pk = add(bean); HashMap<String, String> map = new HashMap<String, String>(); map.put("login", bean.getLogin()); map.put("password", bean.getPassword()); String message = EmailBuilder.getUserRegistrationMessage(map); EmailMessage msg = new EmailMessage(); msg.setTo(bean.getLogin()); msg.setSubject("Registration is successful for ORS Project SunilOS"); msg.setMessage(message); msg.setMessageType(EmailMessage.HTML_MSG); try { EmailUtility.sendMail(msg); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return pk; } public void update(UserBean bean) throws ApplicationException, DuplicateRecordException { log.debug("Model update Started"); Connection conn = null; UserBean beanExist = findByLogin(bean.getLogin()); // Check if updated LoginId already exist if (beanExist != null && !(beanExist.getId() == bean.getId())) { throw new DuplicateRecordException("LoginId is already exist"); } try { conn = JDBCDataSource.getConnection(); conn.setAutoCommit(false); // Begin transaction PreparedStatement pstmt = conn.prepareStatement( "UPDATE EX_USER SET FNAME=?,LNAME=?,LOGIN=?,PASSWORD=?,MOBILENO=?,DOB=?,address=?,GENDER=?," + "CREATEDBY=?,MODIFIEDBY=?,CREATEDDATETIME=?,MODIFIEDDATETIME=?,ROLE_NAME=?,ROLE_ID=? WHERE ID=?"); pstmt.setString(1, bean.getFName()); pstmt.setString(2, bean.getLName()); pstmt.setString(3, bean.getLogin()); pstmt.setString(4, bean.getPassword()); pstmt.setString(5, bean.getMobileNo()); pstmt.setDate(6, new java.sql.Date(bean.getDob().getTime()) ); pstmt.setString(7, bean.getAddress()); pstmt.setString(8, bean.getGender()); pstmt.setString(9, bean.getCreatedBy()); pstmt.setString(10, bean.getModifiedBy()); pstmt.setTimestamp(11, bean.getCreatedDatetime()); pstmt.setTimestamp(12, bean.getModifiedDatetime()); pstmt.setString(13,bean.getRoleName()); pstmt.setLong(14,bean.getRole_Id()); pstmt.setLong(15,bean.getId()); pstmt.executeUpdate(); conn.commit(); // End transaction pstmt.close(); } catch (Exception e) { e.printStackTrace(); log.error("Database Exception..", e); e.printStackTrace(); try { conn.rollback(); } catch (Exception ex) { throw new ApplicationException("Exception : Delete rollback exception " + ex.getMessage()); } throw new ApplicationException("Exception in updating User "); } finally { JDBCDataSource.closeConnection(conn); } log.debug("Model update End"); } public void delete(UserBean bean) throws ApplicationException { Connection conn = null; try { conn = JDBCDataSource.getConnection(); conn.setAutoCommit(false); // Begin transaction PreparedStatement pstmt = conn.prepareStatement("DELETE FROM EX_USER WHERE ID=?"); pstmt.setLong(1, bean.getId()); pstmt.executeUpdate(); conn.commit(); // End transaction pstmt.close(); } catch (Exception e) { try { conn.rollback(); } catch (Exception ex) { throw new ApplicationException("Exception : Delete rollback exception " + ex.getMessage()); } throw new ApplicationException("Exception : Exception in delete User"); } finally { JDBCDataSource.closeConnection(conn); } } public List search(UserBean bean, int pageNo, int pageSize) throws ApplicationException { log.debug("Model search Started"); StringBuffer sql = new StringBuffer("SELECT * FROM EX_USER WHERE 1=1"); if (bean != null) { if (bean.getId() > 0) { sql.append(" AND id = " + bean.getId()); } if (bean.getFName() != null && bean.getFName().length() > 0) { sql.append(" AND FNAME like '" + bean.getFName() + "%'"); } if (bean.getLogin() != null && bean.getLogin().length() > 0) { sql.append(" AND LOGIN like '" + bean.getLogin() + "%'"); } } // if page size is greater than zero then apply pagination if (pageSize > 0) { // Calculate start record index pageNo = (pageNo - 1) * pageSize; sql.append(" Limit " + pageNo + ", " + pageSize); // sql.append(" limit " + pageNo + "," + pageSize); } System.out.println("user model search :"+sql); ArrayList list = new ArrayList(); Connection conn = null; try { conn = JDBCDataSource.getConnection(); PreparedStatement pstmt = conn.prepareStatement(sql.toString()); ResultSet rs = pstmt.executeQuery(); while (rs.next()) { bean = new UserBean(); bean.setId(rs.getLong(1)); bean.setFName(rs.getString(2)); bean.setLName(rs.getString(3)); bean.setLogin(rs.getString(4)); bean.setPassword(rs.getString(5)); bean.setMobileNo(rs.getString(6)); bean.setDob(rs.getDate(7)); bean.setAddress(rs.getString(8)); bean.setGender(rs.getString(9)); bean.setCreatedBy(rs.getString(10)); bean.setModifiedBy(rs.getString(11)); bean.setCreatedDatetime(rs.getTimestamp(12)); bean.setModifiedDatetime(rs.getTimestamp(13)); bean.setRoleName(rs.getString(14)); bean.setRole_Id(rs.getLong(15)); list.add(bean); } rs.close(); } catch (Exception e) { log.error("Database Exception..", e); throw new ApplicationException("Exception : Exception in search user"); } finally { JDBCDataSource.closeConnection(conn); } log.debug("Model search End"); return list; } public boolean changePassword(Long id, String oldPassword, String newPassword) throws RecordNotFoundException, ApplicationException { log.debug("model changePassword Started"); boolean flag = false; UserBean beanExist = null; beanExist = findByPK(id); if (beanExist != null && beanExist.getPassword().equals(oldPassword)) { beanExist.setPassword(newPassword); try { update(beanExist); } catch (DuplicateRecordException e) { log.error(e); throw new ApplicationException("LoginId is already exist"); } flag = true; } else { throw new RecordNotFoundException("Old password is Invalid"); } HashMap<String, String> map = new HashMap<String, String>(); map.put("login", beanExist.getLogin()); map.put("password", beanExist.getPassword()); map.put("firstName", beanExist.getFName()); map.put("lastName", beanExist.getFName()); String message = EmailBuilder.getChangePasswordMessage(map); EmailMessage msg = new EmailMessage(); msg.setTo(beanExist.getLogin()); msg.setSubject("SUNARYS ORS Password has been changed Successfully."); msg.setMessage(message); msg.setMessageType(EmailMessage.HTML_MSG); try { EmailUtility.sendMail(msg); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } log.debug("Model changePassword End"); return flag; } }
80e742724848f42c241a681de1d948739442ba57
9bd6957cf55883cedc33b138558d235cc5558b94
/src/main/java/com/xcodeassociated/service/exception/codes/ErrorCode.java
e0d66bef17b9734370c5361c1c4baeaf9d3eee08
[]
no_license
xcodeassociated/elp-user-service
ffa680d0eb24317e84072c0cec8e391ada90ba37
823e0e599a92033375942d551fa5c8773c90abc2
refs/heads/master
2023-08-08T01:39:58.192858
2021-05-02T15:37:29
2021-05-02T15:37:29
268,065,485
0
0
null
null
null
null
UTF-8
Java
false
false
669
java
package com.xcodeassociated.service.exception.codes; import lombok.Getter; @Getter public enum ErrorCode { // generic: E000("Unknown error"), E001("User not found by id: %d"), E002("Error: %s"), E003("User not found by email: %s"), E004("User not found by auth id: %s"), E005("User not found: %s"), // service: S000("Service exception: %s"), // kafka: K000("Kafka exception: %s"), // validation: V000("Validation exception: %s"), // keycloak api: A000("Could not fetch data from keycloak api: %s"); private final String message; ErrorCode(String message) { this.message = message; } }
53c0f04eb0ddfbde0f2d3400234e99628ab9a2a3
14a9cfea324672bcb4e7e44f997e6c014efe9670
/AndroidRTC-master (2)/app/src/main/java/me/kevingleason/androidrtc/MainActivity.java
cefb69d9ffc53981a2e828ed9c823b69e949a24c
[ "MIT" ]
permissive
Nazmul56/TestingProjects
a3cae3ae533147267ad41355dd2d5a3d3bb3390a
aaaf571ba2749061ad51c739f1f8d332741113d7
refs/heads/master
2022-05-02T10:02:34.947804
2022-03-24T16:53:32
2022-03-24T16:53:32
101,139,315
4
1
null
null
null
null
UTF-8
Java
false
false
10,150
java
package me.kevingleason.androidrtc; import android.app.ListActivity; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.EditText; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import com.pubnub.api.Callback; import com.pubnub.api.Pubnub; import com.pubnub.api.PubnubError; import com.pubnub.api.PubnubException; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; import me.kevingleason.androidrtc.adapters.HistoryAdapter; import me.kevingleason.androidrtc.adt.HistoryItem; import me.kevingleason.androidrtc.util.Constants; public class MainActivity extends ListActivity { private SharedPreferences mSharedPreferences; private String username; private String stdByChannel; private Pubnub mPubNub; private ListView mHistoryList; private HistoryAdapter mHistoryAdapter; private EditText mCallNumET; private TextView mUsernameTV; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); this.mSharedPreferences = getSharedPreferences(Constants.SHARED_PREFS, MODE_PRIVATE); if (!this.mSharedPreferences.contains(Constants.USER_NAME)){ Intent intent = new Intent(this, LoginActivity.class); startActivity(intent); finish(); return; } this.username = this.mSharedPreferences.getString(Constants.USER_NAME, ""); this.stdByChannel = this.username + Constants.STDBY_SUFFIX; this.mHistoryList = getListView(); this.mCallNumET = (EditText) findViewById(R.id.call_num); this.mUsernameTV = (TextView) findViewById(R.id.main_username); this.mUsernameTV.setText(this.username); initPubNub(); this.mHistoryAdapter = new HistoryAdapter(this, new ArrayList<HistoryItem>(), this.mPubNub); this.mHistoryList.setAdapter(this.mHistoryAdapter); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement switch(id){ case R.id.action_settings: return true; case R.id.action_sign_out: signOut(); return true; } return super.onOptionsItemSelected(item); } @Override protected void onStop() { super.onStop(); if(this.mPubNub!=null){ this.mPubNub.unsubscribeAll(); } } @Override protected void onRestart() { super.onRestart(); if(this.mPubNub==null){ initPubNub(); } else { subscribeStdBy(); } } /** * Subscribe to standby channel so that it doesn't interfere with the WebRTC Signaling. */ public void initPubNub(){ this.mPubNub = new Pubnub(Constants.PUB_KEY, Constants.SUB_KEY); this.mPubNub.setUUID(this.username); subscribeStdBy(); } /** * Subscribe to standby channel */ private void subscribeStdBy(){ try { this.mPubNub.subscribe(this.stdByChannel, new Callback() { @Override public void successCallback(String channel, Object message) { Log.d("MA-iPN", "MESSAGE: " + message.toString()); if (!(message instanceof JSONObject)) return; // Ignore if not JSONObject JSONObject jsonMsg = (JSONObject) message; try { if (!jsonMsg.has(Constants.JSON_CALL_USER)) return; //Ignore Signaling messages. String user = jsonMsg.getString(Constants.JSON_CALL_USER); dispatchIncomingCall(user); } catch (JSONException e){ e.printStackTrace(); } } @Override public void connectCallback(String channel, Object message) { Log.d("MA-iPN", "CONNECTED: " + message.toString()); setUserStatus(Constants.STATUS_AVAILABLE); } @Override public void errorCallback(String channel, PubnubError error) { Log.d("MA-iPN","ERROR: " + error.toString()); } }); } catch (PubnubException e){ Log.d("HERE","HEREEEE"); e.printStackTrace(); } } /** * Take the user to a video screen. USER_NAME is a required field. * @param view button that is clicked to trigger toVideo */ public void makeCall(View view){ String callNum = mCallNumET.getText().toString(); if (callNum.isEmpty() || callNum.equals(this.username)){ showToast("Enter a valid user ID to call."); return; } dispatchCall(callNum); } /**TODO: Debate who calls who. Should one be on standby? Or use State API for busy/available * Check that user is online. If they are, dispatch the call by publishing to their standby * channel. If the publish was successful, then change activities over to the video chat. * The called user will then have the option to accept of decline the call. If they accept, * they will be brought to the video chat activity as well, to connect video/audio. If * they decline, a hangup will be issued, and the VideoChat adapter's onHangup callback will * be invoked. * @param callNum Number to publish a call to. */ public void dispatchCall(final String callNum){ final String callNumStdBy = callNum + Constants.STDBY_SUFFIX; this.mPubNub.hereNow(callNumStdBy, new Callback() { @Override public void successCallback(String channel, Object message) { Log.d("MA-dC", "HERE_NOW: " +" CH - " + callNumStdBy + " " + message.toString()); try { int occupancy = ((JSONObject) message).getInt(Constants.JSON_OCCUPANCY); if (occupancy == 0) { showToast("User is not online!"); return; } JSONObject jsonCall = new JSONObject(); jsonCall.put(Constants.JSON_CALL_USER, username); jsonCall.put(Constants.JSON_CALL_TIME, System.currentTimeMillis()); mPubNub.publish(callNumStdBy, jsonCall, new Callback() { @Override public void successCallback(String channel, Object message) { Log.d("MA-dC", "SUCCESS: " + message.toString()); Intent intent = new Intent(MainActivity.this, VideoChatActivity.class); intent.putExtra(Constants.USER_NAME, username); intent.putExtra(Constants.CALL_USER, callNum); // Only accept from this number? startActivity(intent); } }); } catch (JSONException e) { e.printStackTrace(); } } }); } /** * Handle incoming calls. TODO: Implement an accept/reject functionality. * @param userId */ private void dispatchIncomingCall(String userId){ showToast("Call from: " + userId); Intent intent = new Intent(MainActivity.this, IncomingCallActivity.class); intent.putExtra(Constants.USER_NAME, username); intent.putExtra(Constants.CALL_USER, userId); startActivity(intent); } private void setUserStatus(String status){ try { JSONObject state = new JSONObject(); state.put(Constants.JSON_STATUS, status); this.mPubNub.setState(this.stdByChannel, this.username, state, new Callback() { @Override public void successCallback(String channel, Object message) { Log.d("MA-sUS","State Set: " + message.toString()); } }); } catch (JSONException e){ e.printStackTrace(); } } private void getUserStatus(String userId){ String stdByUser = userId + Constants.STDBY_SUFFIX; this.mPubNub.getState(stdByUser, userId, new Callback() { @Override public void successCallback(String channel, Object message) { Log.d("MA-gUS", "User Status: " + message.toString()); } }); } /** * Ensures that toast is run on the UI thread. * @param message */ private void showToast(final String message){ runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(MainActivity.this, message, Toast.LENGTH_SHORT).show(); } }); } /** * Log out, remove username from SharedPreferences, unsubscribe from PubNub, and send user back * to the LoginActivity */ public void signOut(){ this.mPubNub.unsubscribeAll(); SharedPreferences.Editor edit = this.mSharedPreferences.edit(); edit.remove(Constants.USER_NAME); edit.apply(); Intent intent = new Intent(this, LoginActivity.class); intent.putExtra("oldUsername", this.username); startActivity(intent); } }
0f36dd7a3a328399063f613ba2e4bad576833542
5e04542894cd3b183bd679b5a78c9478e9f2013c
/src/test/java/com/mangopay/core/BankingAliasApiImplTest.java
a98a7c633268f3434237e20efd6d7982143d3283
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
vionescu/mangopay2-java-sdk
bd0a39589631321329893a7d3d1df0f0a9db545c
6fa6e511a35057d1bbade7d123bc970b6c5792b7
refs/heads/master
2020-07-21T08:26:27.503065
2019-09-04T15:04:36
2019-09-04T15:04:36
206,796,868
0
0
MIT
2019-09-06T13:12:30
2019-09-06T13:12:29
null
UTF-8
Java
false
false
1,608
java
package com.mangopay.core; import com.mangopay.entities.BankingAlias; import com.mangopay.entities.Wallet; import org.junit.Test; import java.util.List; import static junit.framework.TestCase.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; /** * Tests concerning the banking alias API. */ public class BankingAliasApiImplTest extends BaseTest { @Test public void createBankingAlias() throws Exception { BankingAlias bankingAlias = getJohnsBankingAlias(); assertTrue(bankingAlias.getId().length() > 0); } @Test public void getBankingAlias() throws Exception { BankingAlias bankingAlias = getJohnsBankingAlias(); BankingAlias getBankingAlias = this.api.getBankingAliases().get(bankingAlias.getId()); assertEquals(bankingAlias.getId(), getBankingAlias.getId()); } @Test public void getWalletBankingAliases() throws Exception { Wallet wallet = getJohnsWallet(); BankingAlias bankingAlias = getJohnsBankingAlias(); List<BankingAlias> bankingAliases = this.api.getBankingAliases().listForWallet(wallet.getId()); assertEquals(bankingAlias.getId(), bankingAliases.get(0).getId()); } @Test public void deactivateBankingAlias() throws Exception { BankingAlias bankingAlias = getJohnsBankingAlias(); bankingAlias.setActive(false); BankingAlias deactivatedBankingAlias = this.api.getBankingAliases().deactivate(bankingAlias.getId(), bankingAlias); assertFalse(deactivatedBankingAlias.isActive()); } }
5dd58b9f677b0a435aa3a43d77c3d6bd8174eb59
4ec0d18654f11ecefb7b131f1467d3d0f97ea035
/src/com/kola/kmp/logic/combat/support/IOperationRecorder.java
73913ae6d49341dbd5efc9457f96c61b60c7d7ff
[]
no_license
cietwwl/CFLogic
b5394afd4c10fdf41a14389f171f088958089c97
40f1044ea44fd3b6fa50412ffcb7954e3a9d4d3f
refs/heads/master
2021-01-23T16:04:51.113635
2015-05-16T06:24:00
2015-05-16T06:24:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
512
java
package com.kola.kmp.logic.combat.support; /** * * @author PERRY CHAN */ public interface IOperationRecorder { /** * * 获取目标的id * * @return */ public short getTargetId(); /** * * 是否伤害 * * @return */ public boolean isDamage(); /** * * 是否命中 * * @return */ public boolean isHit(); /** * * 是否暴击 * * @return */ public boolean isCrit(); /** * * 获取伤害数量 * * @return */ public int getDm(); }
890bbef5988fbc879882c08a862cedd32e6f02f2
476a0cd88298014affd3624d92ec2b235535e180
/src/com/android/cts/tradefed/device/DeviceUnlock.java
ddb3a1d594117080db7e4ea5675766bca09be833
[]
no_license
hi-cbh/CrashMonkey4Android_C
3b24492dabda4696f6a4d08387950e5301d5bc7c
f18314924ff79b36731c7fd9ab8addd357961f67
refs/heads/master
2020-12-24T10:11:19.737103
2016-11-11T08:28:44
2016-11-11T08:28:44
73,243,943
1
0
null
null
null
null
UTF-8
Java
false
false
2,556
java
/* * Copyright (C) 2010 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.cts.tradefed.device; import com.android.ddmlib.Log; import com.android.tradefed.device.DeviceNotAvailableException; import com.android.tradefed.device.ITestDevice; import com.android.tradefed.log.LogUtil.CLog; import com.android.tradefed.result.ITestInvocationListener; import com.android.tradefed.testtype.InstrumentationTest; import java.io.File; /** * Collects info from device under test. * <p/> * This class simply serves as a conduit for grabbing info from device using the * device info collector apk, and forwarding that data directly to the * {@link ITestInvocationListener} as run metrics. */ public class DeviceUnlock { private static final String LOG_TAG = "DeviceUnlock"; private static final String APK_NAME = "unlock_apk-debug"; public static final String APP_PACKAGE_NAME = "io.appium.unlock"; private static final String ACTIVITY_NAME = ".Unlock"; /** * Installs and runs the device info collector instrumentation, and forwards * results to the <var>listener</var> * * @param device * @param listener * @throws DeviceNotAvailableException */ public static void unlockDevice(ITestDevice device, File testApkDir) throws DeviceNotAvailableException { File apkFile = new File(testApkDir, String.format("%s.apk", APK_NAME)); if (!apkFile.exists()) { Log.e(LOG_TAG, String.format("Could not find %s", apkFile.getAbsolutePath())); } // collect the instrumentation bundle results using instrumentation test // should work even though no tests will actually be run device.installPackage(apkFile, true); String start = "am start " + APP_PACKAGE_NAME + "/" + ACTIVITY_NAME; CLog.i(start); device.executeShellCommand(start); //device.uninstallPackage(APP_PACKAGE_NAME); CLog.i("Finsihed to disable keyguard on %s using %s ", device.getSerialNumber(), APK_NAME); } }
8e8c6f398dd22d935b152ccada2d98b1741c3960
5d05be7fd05e97f0b38164b52f846a219adf040b
/src/java/Servlets/RegistroTarjetaBasico.java
a997f3407012c183104788e5b6c770f817092abf
[]
no_license
JuanFernandez87/tpCombi19
e101bb3947750f8226e045db4043e2844ec6e6da
1cbcbec7171c04eed641c49323be3cc6424642d1
refs/heads/main
2023-06-24T19:40:22.662715
2021-07-12T18:07:11
2021-07-12T18:07:11
364,767,660
0
0
null
null
null
null
UTF-8
Java
false
false
5,085
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package Servlets; import Logica.Controladora; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * * @author juanf */ public class RegistroTarjetaBasico extends HttpServlet { /** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); try (PrintWriter out = response.getWriter()) { /* TODO output your page here. You may use following sample code. */ out.println("<!DOCTYPE html>"); out.println("<html>"); out.println("<head>"); out.println("<title>Servlet RegistroTarjetaBasico</title>"); out.println("</head>"); out.println("<body>"); out.println("<h1>Servlet RegistroTarjetaBasico at " + request.getContextPath() + "</h1>"); out.println("</body>"); out.println("</html>"); } } // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> /** * Handles the HTTP <code>GET</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Handles the HTTP <code>POST</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { int idCliente = Integer.parseInt(request.getParameter("idCliente")); String num1 = (request.getParameter("num1")); String num2 = (request.getParameter("num2")); String num3 = (request.getParameter("num3")); String num4 = (request.getParameter("num4")); String nombre = request.getParameter("nombre"); int mesVenc = Integer.parseInt(request.getParameter("mes")); int anioVenc = Integer.parseInt(request.getParameter("anio")); int codigo = Integer.parseInt(request.getParameter("codigo")); String numeroTarjeta = num1 + num2 + num3 + num4; request.getSession().setAttribute("idCliente", idCliente); request.getSession().setAttribute("nombre", nombre); request.getSession().setAttribute("numeroTarjeta", numeroTarjeta); String fechaVenc = mesVenc + "/" + anioVenc; request.getSession().setAttribute("fechaVenc", fechaVenc); request.getSession().setAttribute("codigo", codigo); Controladora control = new Controladora(); boolean tarjetaRegistrada = control.verificarExistencia(numeroTarjeta); //chequeo que la tarjeta no este registrada if(!tarjetaRegistrada){ control.registrarTarjeta(numeroTarjeta, codigo, fechaVenc, nombre); int idTarjeta = control.idTarjeta(numeroTarjeta); control.asignarTarjetaCliente(idCliente, idTarjeta); response.sendRedirect("popUpModificacionCorrectoTarjeta.jsp"); }else{ request.setAttribute("num1", num1); request.setAttribute("num2", num2); request.setAttribute("num3", num3); request.setAttribute("num4", num4); request.setAttribute("nombre", nombre); request.setAttribute("mes", mesVenc); request.setAttribute("anio", anioVenc); request.setAttribute("codigo", codigo); request.getRequestDispatcher("popUpRegistroErroneoBasico.jsp").forward(request, response); //response.sendRedirect("popUpRegistroErroneoBasico.jsp"); //si la tarjeta ya se encuentra registrada se envia a popup } } /** * Returns a short description of the servlet. * * @return a String containing servlet description */ @Override public String getServletInfo() { return "Short description"; }// </editor-fold> }
030710083355249a6bff2d40cfcebe2d7401609b
eb97ee5d4f19d7bf028ae9a400642a8c644f8fe3
/tags/2008-07-03/seasar2-2.4.26/seasar-benchmark/src/main/java/benchmark/many/b07/NullBean07966.java
5a376f67717a5aafea68baef12d0c1a97648506b
[]
no_license
svn2github/s2container
54ca27cf0c1200a93e1cb88884eb8226a9be677d
625adc6c4e1396654a7297d00ec206c077a78696
refs/heads/master
2020-06-04T17:15:02.140847
2013-08-09T09:38:15
2013-08-09T09:38:15
10,850,644
0
1
null
null
null
null
UTF-8
Java
false
false
62
java
package benchmark.many.b07; public class NullBean07966 { }
[ "koichik@319488c0-e101-0410-93bc-b5e51f62721a" ]
koichik@319488c0-e101-0410-93bc-b5e51f62721a
49c072bcec02c7c0ba74e17768edcd48c27684af
3663f7e7ef4407eb419b72fb70e92d259f998b89
/src/simple/FizzBuzz.java
b8f98b23969706772d5c5a88c1f8ca4196f94823
[]
no_license
akhilhandoo/problems
68869f631ce07d18594b7e58b69b5409e34d1d3e
7a7807dcb184212ed48846a86197253d26d9d44e
refs/heads/main
2023-04-22T15:13:14.232795
2021-05-15T19:02:01
2021-05-15T19:02:01
334,429,119
0
0
null
null
null
null
UTF-8
Java
false
false
511
java
package simple; import java.util.stream.IntStream; public class FizzBuzz { public static void main(String[] args) { fizzBuzz(20); } public static void fizzBuzz(int n) { IntStream.range(1, n+1).forEach(x -> { if (x % 3 == 0 && x % 5 == 0) { System.out.println("FizzBuzz"); } else if (x % 3 == 0) { System.out.println("Fizz"); } else if (x % 5 == 0) { System.out.println("Buzz"); } else { System.out.println(x); } } ); } }
d9dcaa209dd3724a3946f017ebcf09ecae118478
702f7ae59176d08c141e60a0a9a97b7c00b8549e
/procesor/src/main/java/com/example/procesor/ProcessorTime.java
5e6be72536c4a0e40f5edf22cf30f50501656850
[]
no_license
mateuszmrozewski/spring-cloud-stream-playground
048828ed6e1430a296faeea9b67ee3a9a0288505
0d66c97635c71663dd08630ce7a3aa14cb45d8e8
refs/heads/master
2021-08-24T14:10:11.637892
2017-12-10T05:26:24
2017-12-10T05:26:24
113,725,290
0
0
null
null
null
null
UTF-8
Java
false
false
497
java
package com.example.procesor; import org.springframework.cloud.stream.annotation.Input; import org.springframework.cloud.stream.annotation.Output; import org.springframework.messaging.MessageChannel; import org.springframework.messaging.SubscribableChannel; public interface ProcessorTime { String IN_QUEUE = "generated-time"; String OUT_QUEUE = "modified-time"; @Output(OUT_QUEUE) MessageChannel modifiedTime(); @Input(IN_QUEUE) SubscribableChannel receivedTime(); }
3b3ef33da863919213b2b488ead15fea6f1c0bc4
1bd1a921948e5b33c3656cdbf30bccec2c15b80d
/src/GetUserInfoServlet.java
47eb0787c1967bfe65e7c1340e74032189a577e7
[]
no_license
momo609/analyazknowledge
58484c785c54250b2ebce0064b3abba207010d7a
52c6d82683b8b7b1ae4d689a914c119854f146b0
refs/heads/master
2020-04-16T18:05:14.550849
2019-01-15T07:02:28
2019-01-15T07:15:28
165,802,865
0
0
null
null
null
null
UTF-8
Java
false
false
1,644
java
import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.http.cookie.Cookie; import util.CheckopenId; import net.sf.json.JSONObject; import com.jizhibackend.bean.User; import com.jizhitest.service.UserDaoImpl; public class GetUserInfoServlet extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out = response.getWriter(); User user=(User)request.getSession().getAttribute("user"); int userid = Integer.parseInt(request.getParameter("userid")) ; UserDaoImpl dao = new UserDaoImpl(); if((user==null)) user = dao.findUser(userid); // String currentOpenid = (String)request.getSession().getAttribute("openid"); // CheckopenId c = new CheckopenId(); // boolean flag = c.check(user, currentOpenid); UserDaoImpl userdao=new UserDaoImpl(); if((user==null)) { out.print("{\"errcode\":105,\"errmsg\":\"登录过期\"}"); }else { user=userdao.findUser(user.getUsername()); user.setPassword(""); user.setUsername(""); JSONObject userJo=JSONObject.fromObject(user); userJo.element("errcode", 0); userJo.element("errmsg",userid); out.print(userJo); } out.flush(); out.close(); } public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); } }
35de2d6790fdca4061da4800b5b0664b25ef898e
9a52fe3bcdd090a396e59c68c63130f32c54a7a8
/sources/com/applovin/impl/mediation/C0906a.java
243a2383ffa32797c9438ae4ed1564e808032486
[]
no_license
mzkh/LudoKing
19d7c76a298ee5bd1454736063bc392e103a8203
ee0d0e75ed9fa8894ed9877576d8e5589813b1ba
refs/heads/master
2022-04-25T06:08:41.916017
2020-04-14T17:00:45
2020-04-14T17:00:45
255,670,636
1
0
null
null
null
null
UTF-8
Java
false
false
2,993
java
package com.applovin.impl.mediation; import android.app.Activity; import android.os.Bundle; import com.applovin.impl.mediation.p014b.C0960c; import com.applovin.impl.sdk.C1061a; import com.applovin.impl.sdk.C1192i; import com.applovin.impl.sdk.C1227o; import com.applovin.impl.sdk.utils.C1239a; /* renamed from: com.applovin.impl.mediation.a */ public class C0906a extends C1239a { /* renamed from: a */ private final C1061a f1676a; /* renamed from: b */ private final C1227o f1677b; /* renamed from: c */ private C0907a f1678c; /* renamed from: d */ private C0960c f1679d; /* renamed from: e */ private int f1680e; /* renamed from: f */ private boolean f1681f; /* renamed from: com.applovin.impl.mediation.a$a */ public interface C0907a { /* renamed from: a */ void mo9300a(C0960c cVar); } C0906a(C1192i iVar) { this.f1677b = iVar.mo10249v(); this.f1676a = iVar.mo10217aa(); } /* renamed from: a */ public void mo9297a() { this.f1677b.mo10378b("AdActivityObserver", "Cancelling..."); this.f1676a.mo9737b(this); this.f1678c = null; this.f1679d = null; this.f1680e = 0; this.f1681f = false; } /* renamed from: a */ public void mo9298a(C0960c cVar, C0907a aVar) { C1227o oVar = this.f1677b; StringBuilder sb = new StringBuilder(); sb.append("Starting for ad "); sb.append(cVar.getAdUnitId()); sb.append("..."); oVar.mo10378b("AdActivityObserver", sb.toString()); mo9297a(); this.f1678c = aVar; this.f1679d = cVar; this.f1676a.mo9736a(this); } public void onActivityCreated(Activity activity, Bundle bundle) { if (!this.f1681f) { this.f1681f = true; } this.f1680e++; C1227o oVar = this.f1677b; StringBuilder sb = new StringBuilder(); sb.append("Created Activity: "); sb.append(activity); sb.append(", counter is "); sb.append(this.f1680e); oVar.mo10378b("AdActivityObserver", sb.toString()); } public void onActivityDestroyed(Activity activity) { if (this.f1681f) { this.f1680e--; C1227o oVar = this.f1677b; StringBuilder sb = new StringBuilder(); sb.append("Destroyed Activity: "); sb.append(activity); sb.append(", counter is "); sb.append(this.f1680e); String sb2 = sb.toString(); String str = "AdActivityObserver"; oVar.mo10378b(str, sb2); if (this.f1680e <= 0) { this.f1677b.mo10378b(str, "Last ad Activity destroyed"); if (this.f1678c != null) { this.f1677b.mo10378b(str, "Invoking callback..."); this.f1678c.mo9300a(this.f1679d); } mo9297a(); } } } }
12778a4224c4bcf17f85f6fc12fa26111d4296ca
4bb809c04faf55608bf3d798c11b270d95b40caa
/core/src/main/java/pl/magrab/core/schedulers/SimpleScheduledTask.java
8981bef3e9dfcc20f33c316cb9c52cd7c13d1466
[]
no_license
grabmateusz/sample-ams-app
f0b7ab947077459590a55978d2fb0a78bb7389bf
9c6709339fddf5ba5dcfb2a79a64f4f1a92cb2aa
refs/heads/master
2022-07-31T20:30:16.906212
2020-02-21T10:23:46
2020-02-21T10:23:46
242,106,611
0
0
null
2021-04-26T19:58:45
2020-02-21T09:51:48
JavaScript
UTF-8
Java
false
false
2,428
java
/* * Copyright 2015 Adobe Systems Incorporated * * 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 pl.magrab.core.schedulers; import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; import org.osgi.service.metatype.annotations.AttributeDefinition; import org.osgi.service.metatype.annotations.Designate; import org.osgi.service.metatype.annotations.ObjectClassDefinition; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * A simple demo for cron-job like tasks that get executed regularly. * It also demonstrates how property values can be set. Users can * set the property values in /system/console/configMgr */ @Designate(ocd=SimpleScheduledTask.Config.class) @Component(service=Runnable.class) public class SimpleScheduledTask implements Runnable { @ObjectClassDefinition(name="A scheduled task", description = "Simple demo for cron-job like task with properties") public static @interface Config { @AttributeDefinition(name = "Cron-job expression") String scheduler_expression() default "*/30 * * * * ?"; @AttributeDefinition(name = "Concurrent task", description = "Whether or not to schedule this task concurrently") boolean scheduler_concurrent() default false; @AttributeDefinition(name = "A parameter", description = "Can be configured in /system/console/configMgr") String myParameter() default ""; } private final Logger logger = LoggerFactory.getLogger(getClass()); private String myParameter; @Override public void run() { logger.debug("SimpleScheduledTask is now running, myParameter='{}'", myParameter); } @Activate protected void activate(final Config config) { myParameter = config.myParameter(); } }
feb93d0d476c24d95d8d914b9ca1a357382e0101
fe8ddaa094d9f6002cbcf46c06f74fbb4d8f6200
/programas/serverBasico/src/server/algo/AlgoritmoOrdenar.java
c03bbb43335cb672d8168dce6a2839ce63801603
[]
no_license
vecalciskay/javabits
88268534f232a78bd5cbabfdd6a4485d59f2b5ed
dbe56a95a693219921173e9cebe1bf6713cff7db
refs/heads/master
2022-01-18T20:26:02.750795
2021-07-16T22:28:18
2021-07-16T22:28:18
34,032,776
13
16
null
2022-01-04T16:33:59
2015-04-16T03:40:46
Java
UTF-8
Java
false
false
111
java
package server.algo; public abstract class AlgoritmoOrdenar { public abstract void ordenar(int[] lista); }
4310fd345078c4219af9c2c1d67fba42b5ecb600
14c3e33fac741f9f7ef9b753d51aa8fd5e72f8da
/NexWorkflow/src/main/java/com/nexcloud/api/kafka/HostConsumer.java
4e916defe1f3b90b72d030f69dfe7768cbb36113
[ "Apache-2.0" ]
permissive
NexClipper/NexClipperBasic
e263d455bc9e28e9ce794dbdbf02fbe60501e987
53466580ca88b2b51bfcab3b7ac1358d46a7331f
refs/heads/master
2022-06-27T15:54:12.010089
2020-12-15T07:30:54
2020-12-15T07:30:54
215,319,914
15
4
Apache-2.0
2022-06-21T02:03:44
2019-10-15T14:29:37
JavaScript
UTF-8
Java
false
false
3,594
java
/* * Copyright 2019 NexCloud Co.,Ltd. * * 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.nexcloud.api.kafka; import java.util.Arrays; import java.util.Properties; import org.apache.kafka.clients.consumer.ConsumerRecords; import org.apache.kafka.clients.consumer.KafkaConsumer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class HostConsumer { private static HostConsumer thisObj = null; static final Logger logger = LoggerFactory.getLogger(HostConsumer.class); private KafkaConsumer<String, String> consumer = null; public synchronized static HostConsumer getInstance(){ if ( thisObj == null ){ logger.debug("Kafka Consumer!!!!!!!!!!!!!!!"); try { thisObj = new HostConsumer(); }catch(IndexOutOfBoundsException ie){ logger.error("Consumer Class getInstance IndexOutOfBoundsException Error = " +ie); }catch(NullPointerException ne){ logger.error("Consumer Class getInstance NullPointerException Error = " +ne); } catch(Exception e) { logger.error("Consumer Class getInstance Exception Error = " + e); } } return thisObj; } /** * Kafka Producer세팅 * * @param kafka_host : kafaka 접속 IP 또는 도메인 * @param kafka_port : Kafka port * @param topic : Kafka topic * @param message : 전송할 message */ public boolean init( String kafka_zookeeper, String kafka_host, String kafka_port, String topic, String kafka_group ) { Properties props = new Properties(); if( consumer != null ) return true; try{ logger.debug("Consumer init 실행!!!!!!!!!!!!!!!"); int bufferSize = 33554432; props.put("group.id", kafka_group); props.put("bootstrap.servers", kafka_host+":"+kafka_port); props.put("zookeeper.connect", kafka_zookeeper); props.put("enable.auto.commit", "true"); props.put("auto.offset.reset", "earliest"); props.put("consumer.timeout.ms", "5000"); props.put("auto.commit.interval.ms", "1000"); //props.put("fetch.message.max.bytes", bufferSize ); props.put("key.deserializer", "org.apache.kafka.common.serialization.StringDeserializer"); props.put("value.deserializer", "org.apache.kafka.common.serialization.StringDeserializer"); // /System.out.println("Consumer Properties::"+ props); consumer = new KafkaConsumer<String, String>(props); consumer.subscribe(Arrays.asList(topic)); return true; }catch(Exception e){ e.printStackTrace(); return false; } } /** * Kafka Producer세팅 * * @param kafka_host : kafaka 접속 IP 또는 도메인 * @param kafka_port : Kafka port * @param topic : Kafka topic * @param message : 전송할 message */ public ConsumerRecords<String, String> read( ) { ConsumerRecords<String, String> records = null; Properties props = new Properties(); try{ logger.debug("Consumer read 실행!!!!!!!!!!!!!!!"); records = consumer.poll(100); }catch(Exception e){ e.printStackTrace(); } return records; } }
395ba78578572ffbde7cdd25d0ca383ec4dcc9fc
ee64fbda264b9edd3f8d8e709654d8a55425448e
/user-tracking-producer/src/main/java/com/pluralsight/kafka/producer/model/Orders.java
a17544116daf34ddc1bf3de66d08a25cd3cd305e
[]
no_license
IngJavierR/kafkalimits
b8a8dbbb49f4cf2fd22df3ba773c6d6309b20047
0f35711e9e97f877d641c7fcfff12a7f39db018e
refs/heads/master
2022-11-26T03:19:03.366552
2020-04-13T16:40:07
2020-04-13T16:40:07
248,273,852
0
1
null
2023-09-05T22:02:43
2020-03-18T15:43:19
Java
UTF-8
Java
false
false
723
java
package com.pluralsight.kafka.producer.model; import java.io.Serializable; public class Orders implements Serializable { private int id; private String name; private int quantiy; public Orders(int id, String name, int quantiy) { this.id = id; this.name = name; this.quantiy = quantiy; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getQuantiy() { return quantiy; } public void setQuantiy(int quantiy) { this.quantiy = quantiy; } }
9d9bd6485794d1c0b9be05ff8d47de4d2cb7ba0f
99c6b5211f7b7681958aa6d30f04ad0f6ec74817
/tk/framework/src/main/java/com/tk/orm/publicuser/model/PublicUserPo.java
e5dff73ccadd934b3c695fe6024e76b39a4912b0
[]
no_license
mupengX/RestfulFrameWork
1755f5d20e33376781218cc692ac106f73522530
f18a2e9a020b298aa65d8c45e2891790806696e3
refs/heads/master
2021-01-22T21:32:16.045002
2015-09-02T09:59:12
2015-09-02T09:59:12
42,916,482
0
0
null
null
null
null
UTF-8
Java
false
false
9,231
java
package com.tk.orm.publicuser.model; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import org.hibernate.annotations.GenericGenerator; /** * TK Automation * @File:PublicUserPo.java * @author TK * @Description: * <关于这个类的基本作用> * @Notes: * <一些特别的描述的信息> * @Revision History: * <<2014年12月16日下午4:52:51>>, <<TK>>, <<Create>> */ @Entity @Table(name = "pu_user") public class PublicUserPo implements java.io.Serializable { // Fields /** * Comment for &lt;code&gt;serialVersionUID&lt;/code&gt; */ private static final long serialVersionUID = 3804481017888309687L; private String puserUid; private String userId; private String password; private String fname; private String address1; private String address2; private String address3; private String province; private String city; private String conutry; private String phone1; private String phone2; private String phone3; private String preContactChnl; private String gender; private Date birthDate; private String avatar; private String reciveSms; private String recivePush; private Date registerDate; private String needChangePassword; private String registerSource; private String authAgentId; private String qq; private Date recDate; private String recUserid; private String recStatus; private String EMail; private String extend1; private String extend2; private String extend3; private String description; // Constructors /** default constructor */ public PublicUserPo() { } /** full constructor */ public PublicUserPo(String userId, String password, String fname, String address1, String address2, String address3, String province, String city, String conutry, String phone1, String phone2, String phone3, String preContactChnl, String gender, Date birthDate, String avatar, String reciveSms, String recivePush, Date registerDate, String needChangePassword, String registerSource, String authAgentId, String qq, Date recDate, String recUserid, String recStatus, String EMail, String extend1, String extend2, String extend3, String description) { this.userId = userId; this.password = password; this.fname = fname; this.address1 = address1; this.address2 = address2; this.address3 = address3; this.province = province; this.city = city; this.conutry = conutry; this.phone1 = phone1; this.phone2 = phone2; this.phone3 = phone3; this.preContactChnl = preContactChnl; this.gender = gender; this.birthDate = birthDate; this.avatar = avatar; this.reciveSms = reciveSms; this.recivePush = recivePush; this.registerDate = registerDate; this.needChangePassword = needChangePassword; this.registerSource = registerSource; this.authAgentId = authAgentId; this.qq = qq; this.recDate = recDate; this.recUserid = recUserid; this.recStatus = recStatus; this.EMail = EMail; this.extend1 = extend1; this.extend2 = extend2; this.extend3 = extend3; this.description = description; } // Property accessors @GenericGenerator(name = "generator", strategy = "uuid.hex") @Id @GeneratedValue(generator = "generator") @Column(name = "PUSER_UID", unique = true, nullable = false, length = 32) public String getPuserUid() { return this.puserUid; } public void setPuserUid(String puserUid) { this.puserUid = puserUid; } @Column(name = "USER_ID", length = 32) public String getUserId() { return this.userId; } public void setUserId(String userId) { this.userId = userId; } @Column(name = "PASSWORD", length = 32) public String getPassword() { return this.password; } public void setPassword(String password) { this.password = password; } @Column(name = "FNAME", length = 16) public String getFname() { return this.fname; } public void setFname(String fname) { this.fname = fname; } @Column(name = "ADDRESS1", length = 200) public String getAddress1() { return this.address1; } public void setAddress1(String address1) { this.address1 = address1; } @Column(name = "ADDRESS2", length = 200) public String getAddress2() { return this.address2; } public void setAddress2(String address2) { this.address2 = address2; } @Column(name = "ADDRESS3", length = 200) public String getAddress3() { return this.address3; } public void setAddress3(String address3) { this.address3 = address3; } @Column(name = "PROVINCE", length = 8) public String getProvince() { return this.province; } public void setProvince(String province) { this.province = province; } @Column(name = "CITY", length = 8) public String getCity() { return this.city; } public void setCity(String city) { this.city = city; } @Column(name = "CONUTRY", length = 8) public String getConutry() { return this.conutry; } public void setConutry(String conutry) { this.conutry = conutry; } @Column(name = "PHONE1", length = 20) public String getPhone1() { return this.phone1; } public void setPhone1(String phone1) { this.phone1 = phone1; } @Column(name = "PHONE2", length = 20) public String getPhone2() { return this.phone2; } public void setPhone2(String phone2) { this.phone2 = phone2; } @Column(name = "PHONE3", length = 20) public String getPhone3() { return this.phone3; } public void setPhone3(String phone3) { this.phone3 = phone3; } @Column(name = "PRE_CONTACT_CHNL", length = 1) public String getPreContactChnl() { return this.preContactChnl; } public void setPreContactChnl(String preContactChnl) { this.preContactChnl = preContactChnl; } @Column(name = "GENDER", length = 1) public String getGender() { return this.gender; } public void setGender(String gender) { this.gender = gender; } @Temporal(TemporalType.DATE) @Column(name = "BIRTH_DATE", length = 10) public Date getBirthDate() { return this.birthDate; } public void setBirthDate(Date birthDate) { this.birthDate = birthDate; } @Column(name = "AVATAR") public String getAvatar() { return this.avatar; } public void setAvatar(String avatar) { this.avatar = avatar; } @Column(name = "RECIVE_SMS", length = 1) public String getReciveSms() { return this.reciveSms; } public void setReciveSms(String reciveSms) { this.reciveSms = reciveSms; } @Column(name = "RECIVE_PUSH", length = 1) public String getRecivePush() { return this.recivePush; } public void setRecivePush(String recivePush) { this.recivePush = recivePush; } @Temporal(TemporalType.DATE) @Column(name = "REGISTER_DATE", length = 10) public Date getRegisterDate() { return this.registerDate; } public void setRegisterDate(Date registerDate) { this.registerDate = registerDate; } @Column(name = "NEED_CHANGE_PASSWORD", length = 1) public String getNeedChangePassword() { return this.needChangePassword; } public void setNeedChangePassword(String needChangePassword) { this.needChangePassword = needChangePassword; } @Column(name = "REGISTER_SOURCE", length = 1) public String getRegisterSource() { return this.registerSource; } public void setRegisterSource(String registerSource) { this.registerSource = registerSource; } @Column(name = "AUTH_AGENT_ID", length = 100) public String getAuthAgentId() { return this.authAgentId; } public void setAuthAgentId(String authAgentId) { this.authAgentId = authAgentId; } @Column(name = "QQ", length = 32) public String getQq() { return this.qq; } public void setQq(String qq) { this.qq = qq; } @Temporal(TemporalType.DATE) @Column(name = "REC_DATE", length = 10) public Date getRecDate() { return this.recDate; } public void setRecDate(Date recDate) { this.recDate = recDate; } @Column(name = "REC_USERID", length = 32) public String getRecUserid() { return this.recUserid; } public void setRecUserid(String recUserid) { this.recUserid = recUserid; } @Column(name = "REC_STATUS", length = 1) public String getRecStatus() { return this.recStatus; } public void setRecStatus(String recStatus) { this.recStatus = recStatus; } @Column(name = "E_MAIL", length = 100) public String getEMail() { return this.EMail; } public void setEMail(String EMail) { this.EMail = EMail; } @Column(name = "EXTEND1", length = 32) public String getExtend1() { return this.extend1; } public void setExtend1(String extend1) { this.extend1 = extend1; } @Column(name = "EXTEND2", length = 32) public String getExtend2() { return this.extend2; } public void setExtend2(String extend2) { this.extend2 = extend2; } @Column(name = "EXTEND3", length = 32) public String getExtend3() { return this.extend3; } public void setExtend3(String extend3) { this.extend3 = extend3; } @Column(name = "DESCRIPTION") public String getDescription() { return this.description; } public void setDescription(String description) { this.description = description; } }
a7a83b0b540855801f25d85f6f7c37b6fd0cb8a4
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/4/4_b07b5fe96638cee770d7a8c2e4e6d766aacc6e5d/PoissonAssembler/4_b07b5fe96638cee770d7a8c2e4e6d766aacc6e5d_PoissonAssembler_s.java
84f742e720d15e2c11d6ee1b008a1475b3adf033
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
1,411
java
/* (c) Copyright by Man YUAN */ package net.epsilony.mf.process.assembler; /** * * @author <a href="mailto:[email protected]">Man YUAN</a> */ public class PoissonAssembler extends AbstractLagrangeAssembler { @Override public void assembleVolume() { for (int testPos = 0; testPos < nodesAssemblyIndes.size(); testPos++) { for (int trialPos = 0; trialPos < nodesAssemblyIndes.size(); trialPos++) { assembleVolumeElem(testPos, trialPos); } } } private void assembleVolumeElem(int testPos, int trialPos) { int testId = nodesAssemblyIndes.getQuick(testPos); int trialId = nodesAssemblyIndes.getQuick(trialPos); final int dim = dimension; for (int dmRow = 0; dmRow < dim; dmRow++) { int row = testId * dim + dmRow; double rowShpf = testShapeFunctionValues[dmRow + 1][testPos]; double td = rowShpf * weight; mainVector.add(row, td * load[dmRow]); for (int dmCol = 0; dmCol < dim; dmCol++) { int col = trialId * dim + dmCol; if (upperSymmetric && col < row) { continue; } double colShpf = trialShapeFunctionValues[dmCol + 1][trialPos]; mainMatrix.add(row, col, td * colShpf); } } } }
3698b83f43581f8910363f6de319e8433a7da745
702ac8a8cef383abf122895b90ccccfe30ed3022
/app/src/androidTest/java/com/plusend/sample/ExampleInstrumentedTest.java
5e0418ff6aa27d5d4d6dba2b5b86d474d0ee06c0
[ "Apache-2.0" ]
permissive
plusend/AndroidSample
1d2fba3a7b8a2dc5cbc0ada64f77a975099b9a7d
bd632a0bf6579b878564f7b1c1a9355839aad1e8
refs/heads/master
2021-08-22T07:22:40.121080
2017-11-29T16:06:29
2017-11-29T16:06:29
112,225,730
0
0
null
null
null
null
UTF-8
Java
false
false
737
java
package com.plusend.sample; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.plusend.sample", appContext.getPackageName()); } }
c49f2a7c6ad21aaafb5d788b5ea6c81ac08b4436
7c4600a96679dd20e2015acdecec7b99cbfe0eb3
/domain/src/main/java/za/co/entelect/bootcamp/flash/domain/CustomerOrders.java
7a7e9281f64051bcc73f5eeea45ccff2dab9377e
[]
no_license
SV-ZeroOne/Flash
c4bb397d86ba85c29f62213d350de738e79570a4
b424ad624be3890069d95628d569190cc1246f46
refs/heads/master
2021-01-13T04:50:43.325645
2017-02-17T07:28:25
2017-02-17T07:28:25
78,621,774
0
0
null
null
null
null
UTF-8
Java
false
false
8,655
java
package za.co.entelect.bootcamp.flash.domain; import za.co.entelect.bootcamp.flash.domain.interfaces.EntityInterface; import javax.persistence.*; import java.math.BigDecimal; import java.sql.Timestamp; /** * @author kevin.gouws - Created on 2017/02/01. */ @Entity public class CustomerOrders implements EntityInterface<Integer> { private int customerOrderId; private BigDecimal orderAmount; private Timestamp orderDate; private String orderReference; private String orderAddress1; private String orderAddress2; private String orderSuburb; private String orderCity; private String orderPostalCode; private String orderPhone; private String orderEmail; private Timestamp orderShippedDate; private String orderTrackingNumber; private String orderDeliveryMethod; private String orderStatus; private CustomerAccounts customerAccountsByCustomerId; @Id @Column(name = "CustomerOrderID", nullable = false) @GeneratedValue (strategy = GenerationType.IDENTITY) public Integer getID() { return this.customerOrderId; } public void setID(Integer entityKey) { this.customerOrderId = entityKey; } @Basic @Column(name = "OrderAmount", nullable = true, precision = 2) public BigDecimal getOrderAmount() { return orderAmount; } public void setOrderAmount(BigDecimal orderAmount) { this.orderAmount = orderAmount; } @Basic @Column(name = "OrderDate", nullable = true) public Timestamp getOrderDate() { return orderDate; } public void setOrderDate(Timestamp orderDate) { this.orderDate = orderDate; } @Basic @Column(name = "OrderReference", nullable = false, length = 50) public String getOrderReference() { return orderReference; } public void setOrderReference(String orderReference) { this.orderReference = orderReference; } @Basic @Column(name = "OrderAddress1", nullable = false, length = 100) public String getOrderAddress1() { return orderAddress1; } public void setOrderAddress1(String orderAddress1) { this.orderAddress1 = orderAddress1; } @Basic @Column(name = "OrderAddress2", nullable = true, length = 100) public String getOrderAddress2() { return orderAddress2; } public void setOrderAddress2(String orderAddress2) { this.orderAddress2 = orderAddress2; } @Basic @Column(name = "OrderSuburb", nullable = true, length = 50) public String getOrderSuburb() { return orderSuburb; } public void setOrderSuburb(String orderSuburb) { this.orderSuburb = orderSuburb; } @Basic @Column(name = "OrderCity", nullable = false, length = 50) public String getOrderCity() { return orderCity; } public void setOrderCity(String orderCity) { this.orderCity = orderCity; } @Basic @Column(name = "OrderPostalCode", nullable = false, length = 4) public String getOrderPostalCode() { return orderPostalCode; } public void setOrderPostalCode(String orderPostalCode) { this.orderPostalCode = orderPostalCode; } @Basic @Column(name = "OrderPhone", nullable = true, length = 10) public String getOrderPhone() { return orderPhone; } public void setOrderPhone(String orderPhone) { this.orderPhone = orderPhone; } @Basic @Column(name = "OrderEmail", nullable = false, length = 320) public String getOrderEmail() { return orderEmail; } public void setOrderEmail(String orderEmail) { this.orderEmail = orderEmail; } @Basic @Column(name = "OrderShippedDate", nullable = true) public Timestamp getOrderShippedDate() { return orderShippedDate; } public void setOrderShippedDate(Timestamp orderShippedDate) { this.orderShippedDate = orderShippedDate; } @Basic @Column(name = "OrderTrackingNumber", nullable = true, length = 50) public String getOrderTrackingNumber() { return orderTrackingNumber; } public void setOrderTrackingNumber(String orderTrackingNumber) { this.orderTrackingNumber = orderTrackingNumber; } @Basic @Column(name = "OrderDeliveryMethod", nullable = false, length = 50) public String getOrderDeliveryMethod() { return orderDeliveryMethod; } public void setOrderDeliveryMethod(String orderDeliveryMethod) { this.orderDeliveryMethod = orderDeliveryMethod; } @Basic @Column(name = "OrderStatus", nullable = true, length = 20) public String getOrderStatus() { return orderStatus; } public void setOrderStatus(String orderStatus) { this.orderStatus = orderStatus; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; CustomerOrders that = (CustomerOrders) o; if (customerOrderId != that.customerOrderId) return false; if (orderAmount != null ? !orderAmount.equals(that.orderAmount) : that.orderAmount != null) return false; if (orderDate != null ? !orderDate.equals(that.orderDate) : that.orderDate != null) return false; if (orderReference != null ? !orderReference.equals(that.orderReference) : that.orderReference != null) return false; if (orderAddress1 != null ? !orderAddress1.equals(that.orderAddress1) : that.orderAddress1 != null) return false; if (orderAddress2 != null ? !orderAddress2.equals(that.orderAddress2) : that.orderAddress2 != null) return false; if (orderSuburb != null ? !orderSuburb.equals(that.orderSuburb) : that.orderSuburb != null) return false; if (orderCity != null ? !orderCity.equals(that.orderCity) : that.orderCity != null) return false; if (orderPostalCode != null ? !orderPostalCode.equals(that.orderPostalCode) : that.orderPostalCode != null) return false; if (orderPhone != null ? !orderPhone.equals(that.orderPhone) : that.orderPhone != null) return false; if (orderEmail != null ? !orderEmail.equals(that.orderEmail) : that.orderEmail != null) return false; if (orderShippedDate != null ? !orderShippedDate.equals(that.orderShippedDate) : that.orderShippedDate != null) return false; if (orderTrackingNumber != null ? !orderTrackingNumber.equals(that.orderTrackingNumber) : that.orderTrackingNumber != null) return false; if (orderDeliveryMethod != null ? !orderDeliveryMethod.equals(that.orderDeliveryMethod) : that.orderDeliveryMethod != null) return false; if (orderStatus != null ? !orderStatus.equals(that.orderStatus) : that.orderStatus != null) return false; return true; } @Override public int hashCode() { int result = customerOrderId; result = 31 * result + (orderAmount != null ? orderAmount.hashCode() : 0); result = 31 * result + (orderDate != null ? orderDate.hashCode() : 0); result = 31 * result + (orderReference != null ? orderReference.hashCode() : 0); result = 31 * result + (orderAddress1 != null ? orderAddress1.hashCode() : 0); result = 31 * result + (orderAddress2 != null ? orderAddress2.hashCode() : 0); result = 31 * result + (orderSuburb != null ? orderSuburb.hashCode() : 0); result = 31 * result + (orderCity != null ? orderCity.hashCode() : 0); result = 31 * result + (orderPostalCode != null ? orderPostalCode.hashCode() : 0); result = 31 * result + (orderPhone != null ? orderPhone.hashCode() : 0); result = 31 * result + (orderEmail != null ? orderEmail.hashCode() : 0); result = 31 * result + (orderShippedDate != null ? orderShippedDate.hashCode() : 0); result = 31 * result + (orderTrackingNumber != null ? orderTrackingNumber.hashCode() : 0); result = 31 * result + (orderDeliveryMethod != null ? orderDeliveryMethod.hashCode() : 0); result = 31 * result + (orderStatus != null ? orderStatus.hashCode() : 0); return result; } @ManyToOne @JoinColumn(name = "CustomerID", referencedColumnName = "CustomerID", nullable = false) public CustomerAccounts getCustomerAccountsByCustomerId() { return customerAccountsByCustomerId; } public void setCustomerAccountsByCustomerId(CustomerAccounts customerAccountsByCustomerId) { this.customerAccountsByCustomerId = customerAccountsByCustomerId; } }
b80b51b660ffce895c7f06db44b8fa74c5846b90
947fc9eef832e937f09f04f1abd82819cd4f97d3
/src/apk/io/intercom/okhttp3/Response.java
a2cf96830af83e7a73226dd02b0eddab84f66276
[]
no_license
thistehneisen/cifra
04f4ac1b230289f8262a0b9cf7448a1172d8f979
d46c6f4764c9d4f64e45c56fa42fddee9b44ff5a
refs/heads/master
2020-09-22T09:35:57.739040
2019-12-01T19:39:59
2019-12-01T19:39:59
225,136,583
1
0
null
null
null
null
UTF-8
Java
false
false
10,475
java
package io.intercom.okhttp3; import e.a.b.g; import e.a.b.i; import io.intercom.okhttp3.internal.http.HttpHeaders; import java.io.Closeable; import java.io.IOException; import java.util.Collections; import java.util.List; public final class Response implements Closeable { final ResponseBody body; private volatile CacheControl cacheControl; final Response cacheResponse; final int code; final Handshake handshake; final Headers headers; final String message; final Response networkResponse; final Response priorResponse; final Protocol protocol; final long receivedResponseAtMillis; final Request request; final long sentRequestAtMillis; public static class Builder { ResponseBody body; Response cacheResponse; int code; Handshake handshake; io.intercom.okhttp3.Headers.Builder headers; String message; Response networkResponse; Response priorResponse; Protocol protocol; long receivedResponseAtMillis; Request request; long sentRequestAtMillis; public Builder() { this.code = -1; this.headers = new io.intercom.okhttp3.Headers.Builder(); } private void checkPriorResponse(Response response) { if (response.body != null) { throw new IllegalArgumentException("priorResponse.body != null"); } } private void checkSupportResponse(String str, Response response) { if (response.body != null) { StringBuilder sb = new StringBuilder(); sb.append(str); sb.append(".body != null"); throw new IllegalArgumentException(sb.toString()); } else if (response.networkResponse != null) { StringBuilder sb2 = new StringBuilder(); sb2.append(str); sb2.append(".networkResponse != null"); throw new IllegalArgumentException(sb2.toString()); } else if (response.cacheResponse != null) { StringBuilder sb3 = new StringBuilder(); sb3.append(str); sb3.append(".cacheResponse != null"); throw new IllegalArgumentException(sb3.toString()); } else if (response.priorResponse != null) { StringBuilder sb4 = new StringBuilder(); sb4.append(str); sb4.append(".priorResponse != null"); throw new IllegalArgumentException(sb4.toString()); } } public Builder addHeader(String str, String str2) { this.headers.add(str, str2); return this; } public Builder body(ResponseBody responseBody) { this.body = responseBody; return this; } public Response build() { if (this.request == null) { throw new IllegalStateException("request == null"); } else if (this.protocol == null) { throw new IllegalStateException("protocol == null"); } else if (this.code < 0) { StringBuilder sb = new StringBuilder(); sb.append("code < 0: "); sb.append(this.code); throw new IllegalStateException(sb.toString()); } else if (this.message != null) { return new Response(this); } else { throw new IllegalStateException("message == null"); } } public Builder cacheResponse(Response response) { if (response != null) { checkSupportResponse("cacheResponse", response); } this.cacheResponse = response; return this; } public Builder code(int i2) { this.code = i2; return this; } public Builder handshake(Handshake handshake2) { this.handshake = handshake2; return this; } public Builder header(String str, String str2) { this.headers.set(str, str2); return this; } public Builder headers(Headers headers2) { this.headers = headers2.newBuilder(); return this; } public Builder message(String str) { this.message = str; return this; } public Builder networkResponse(Response response) { if (response != null) { checkSupportResponse("networkResponse", response); } this.networkResponse = response; return this; } public Builder priorResponse(Response response) { if (response != null) { checkPriorResponse(response); } this.priorResponse = response; return this; } public Builder protocol(Protocol protocol2) { this.protocol = protocol2; return this; } public Builder receivedResponseAtMillis(long j2) { this.receivedResponseAtMillis = j2; return this; } public Builder removeHeader(String str) { this.headers.removeAll(str); return this; } public Builder request(Request request2) { this.request = request2; return this; } public Builder sentRequestAtMillis(long j2) { this.sentRequestAtMillis = j2; return this; } Builder(Response response) { this.code = -1; this.request = response.request; this.protocol = response.protocol; this.code = response.code; this.message = response.message; this.handshake = response.handshake; this.headers = response.headers.newBuilder(); this.body = response.body; this.networkResponse = response.networkResponse; this.cacheResponse = response.cacheResponse; this.priorResponse = response.priorResponse; this.sentRequestAtMillis = response.sentRequestAtMillis; this.receivedResponseAtMillis = response.receivedResponseAtMillis; } } Response(Builder builder) { this.request = builder.request; this.protocol = builder.protocol; this.code = builder.code; this.message = builder.message; this.handshake = builder.handshake; this.headers = builder.headers.build(); this.body = builder.body; this.networkResponse = builder.networkResponse; this.cacheResponse = builder.cacheResponse; this.priorResponse = builder.priorResponse; this.sentRequestAtMillis = builder.sentRequestAtMillis; this.receivedResponseAtMillis = builder.receivedResponseAtMillis; } public ResponseBody body() { return this.body; } public CacheControl cacheControl() { CacheControl cacheControl2 = this.cacheControl; if (cacheControl2 != null) { return cacheControl2; } CacheControl parse = CacheControl.parse(this.headers); this.cacheControl = parse; return parse; } public Response cacheResponse() { return this.cacheResponse; } public List<Challenge> challenges() { String str; int i2 = this.code; if (i2 == 401) { str = "WWW-Authenticate"; } else if (i2 != 407) { return Collections.emptyList(); } else { str = "Proxy-Authenticate"; } return HttpHeaders.parseChallenges(headers(), str); } public void close() { ResponseBody responseBody = this.body; if (responseBody != null) { responseBody.close(); return; } throw new IllegalStateException("response is not eligible for a body and must not be closed"); } public int code() { return this.code; } public Handshake handshake() { return this.handshake; } public String header(String str) { return header(str, null); } public List<String> headers(String str) { return this.headers.values(str); } public boolean isRedirect() { int i2 = this.code; if (!(i2 == 307 || i2 == 308)) { switch (i2) { case 300: case 301: case 302: case 303: break; default: return false; } } return true; } public boolean isSuccessful() { int i2 = this.code; return i2 >= 200 && i2 < 300; } public String message() { return this.message; } public Response networkResponse() { return this.networkResponse; } public Builder newBuilder() { return new Builder(this); } public ResponseBody peekBody(long j2) throws IOException { i source = this.body.source(); source.a(j2); g clone = source.n().clone(); if (clone.size() > j2) { g gVar = new g(); gVar.write(clone, j2); clone.a(); clone = gVar; } return ResponseBody.create(this.body.contentType(), clone.size(), clone); } public Response priorResponse() { return this.priorResponse; } public Protocol protocol() { return this.protocol; } public long receivedResponseAtMillis() { return this.receivedResponseAtMillis; } public Request request() { return this.request; } public long sentRequestAtMillis() { return this.sentRequestAtMillis; } public String toString() { StringBuilder sb = new StringBuilder(); sb.append("Response{protocol="); sb.append(this.protocol); sb.append(", code="); sb.append(this.code); sb.append(", message="); sb.append(this.message); sb.append(", url="); sb.append(this.request.url()); sb.append('}'); return sb.toString(); } public String header(String str, String str2) { String str3 = this.headers.get(str); return str3 != null ? str3 : str2; } public Headers headers() { return this.headers; } }
7312eaed193a288fae14529a9da56472f70bbfbc
e4e95dfa3422accf33e3271848eac18ac4916dd2
/src/main/java/org/team3128/bluepercents/autonomous/AutoPriority.java
4c0b1650b788f2a6043d960a8a270900fb1b61f9
[]
no_license
Amisha0099/Infinite-Re-Do-
34be3d1dd4c9cde9ea4e683bd9b178b0ba663724
3d75a807b8e36c190016926437f0c5e59d00d8df
refs/heads/master
2021-05-23T14:37:02.439330
2020-06-06T19:53:13
2020-06-06T19:53:13
253,343,487
0
1
null
null
null
null
UTF-8
Java
false
false
2,693
java
package org.team3128.bluepercents.autonomous; import edu.wpi.first.wpilibj.command.CommandGroup; //import org.team3128.bluepercents.autonomous.CmdArmInitialize; import org.team3128.bluepercents.autonomous.CmdDrive; import org.team3128.bluepercents.autonomous.CmdAutoTrajectory; import org.team3128.common.utility.math.Pose2D; import org.team3128.common.utility.math.Rotation2D; import org.team3128.common.drive.Drive; import org.team3128.common.hardware.limelight.Limelight; import org.team3128.common.drive.DriveCommandRunning; import org.team3128.bluepercents.autonomous.*; import org.team3128.bluepercents.commands.*; import org.team3128.bluepercents.subsystems.Constants; import org.team3128.bluepercents.subsystems.Arm.ArmState; import org.team3128.bluepercents.subsystems.*; import org.team3128.common.utility.Log; import com.kauailabs.navx.frc.AHRS; import org.team3128.common.generics.ThreadScheduler; public class AutoPriority extends CommandGroup{ public AutoPriority(FalconDrive drive, Arm arm, BellIntake bellIntake, AHRS ahrs, Limelight limelight, DriveCommandRunning cmdRunning, double timeoutMs, ThreadScheduler scheduler){ addSequential(new CmdDrive(drive, 1)); addSequential(new CmdAutoTrajectory(drive, 130, 0.5, 10000, new Pose2D(0, 0, Rotation2D.fromDegrees(0)), new Pose2D(0* Constants.MechanismConstants.inchesToMeters, -77.058419 * Constants.MechanismConstants.inchesToMeters, Rotation2D.fromDegrees(0))));//move to smartbell goal //eject pre-loaded smartbell addSequential(new CmdAlignBell(drive, arm, bellIntake, ahrs, limelight, cmdRunning, Constants.VisionConstants.TX_OFFSET)); addSequential(new CmdAutoTrajectory(drive, 130, 0.5, 10000, new Pose2D(0, 0, Rotation2D.fromDegrees(0)), new Pose2D(276.476124* Constants.MechanismConstants.inchesToMeters, 0 * Constants.MechanismConstants.inchesToMeters, Rotation2D.fromDegrees(0)))); //move from smartbell goal to smartbell depot //pick up smartbell from depot arm.setState(ArmState.INTAKEBELL); bellIntake.intakingBell(); addSequential(new CmdAutoTrajectory(drive, 130, 0.5, 10000, new Pose2D(0, 0, Rotation2D.fromDegrees(0)), new Pose2D(-276.476124* Constants.MechanismConstants.inchesToMeters, 0 * Constants.MechanismConstants.inchesToMeters, Rotation2D.fromDegrees(0)))); //move from smartbell depot to smartbell goal //eject new smartbell addSequential(new CmdAlignBell(drive, arm, bellIntake, ahrs, limelight, cmdRunning, Constants.VisionConstants.TX_OFFSET)); } }
bd8cc7957c3b645b890da78794338c7062b0485a
6138af219efc3a8f31060e30ebc532ffcbad1768
/astrogrid/registry/webapp/src/webapp-java/ORG/oclc/oai/server/catalog/AbstractCatalog.java
978a50917a63cc590349dbf7a724d4af384e1234
[]
no_license
Javastro/astrogrid-legacy
dd794b7867a4ac650d1a84bdef05dfcd135b8bb6
51bdbec04bacfc3bcc3af6a896e8c7f603059cd5
refs/heads/main
2023-06-26T10:23:01.083788
2021-07-30T11:17:12
2021-07-30T11:17:12
391,028,616
0
0
null
null
null
null
UTF-8
Java
false
false
23,657
java
/** *Copyright (c) 2000-2002 OCLC Online Computer Library Center, *Inc. and other contributors. All rights reserved. The contents of this file, as updated *from time to time by the OCLC Office of Research, are subject to OCLC Research *Public License Version 2.0 (the "License"); you may not use this file except in *compliance with the License. You may obtain a current copy of the License at *http://purl.oclc.org/oclc/research/ORPL/. Software distributed under the License is *distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express *or implied. See the License for the specific language governing rights and limitations *under the License. This software consists of voluntary contributions made by many *individuals on behalf of OCLC Research. For more information on OCLC Research, *please see http://www.oclc.org/oclc/research/. * *The Original Code is AbstractCatalog.java. *The Initial Developer of the Original Code is Jeff Young. *Portions created by ______________________ are *Copyright (C) _____ _______________________. All Rights Reserved. *Contributor(s):______________________________________. */ package ORG.oclc.oai.server.catalog; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Properties; import java.util.Vector; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import ORG.oclc.oai.server.crosswalk.Crosswalks; import ORG.oclc.oai.server.verb.BadArgumentException; import ORG.oclc.oai.server.verb.BadResumptionTokenException; import ORG.oclc.oai.server.verb.CannotDisseminateFormatException; import ORG.oclc.oai.server.verb.IdDoesNotExistException; import ORG.oclc.oai.server.verb.NoItemsMatchException; import ORG.oclc.oai.server.verb.NoMetadataFormatsException; import ORG.oclc.oai.server.verb.NoSetHierarchyException; import ORG.oclc.oai.server.verb.OAIInternalServerError; import ORG.oclc.oai.server.verb.ServerVerb; /** * AbstractCatalog is the generic interface between OAICat and any arbitrary * database. Implement this interface to have OAICat work with your database. * * @author Jeffrey A. Young, OCLC Online Computer Library Center */ public abstract class AbstractCatalog { private static final boolean debug = true; /** * The RecordFactory that understands how to convert this database's * native "item" to the various metadataFormats to be supported. */ private RecordFactory recordFactory; /** * is this repository harvestable? */ private boolean harvestable = true; /** * optional property to limit the life of resumptionTokens (<0 indicates no limit) **/ private int millisecondsToLive = -1; /** * Index into VALID_GRANULARITIES and FROM_GRANULARITIES */ private int supportedGranularityOffset = -1; /** * All possible valid granularities */ private static final String[] VALID_GRANULARITIES = { "YYYY-MM-DD", "YYYY-MM-DDThh:mm:ssZ" }; /** * minimum valid 'from' granularities */ private static final String[] FROM_GRANULARITIES = { "0000-01-01", "0000-01-01T00:00:00Z" }; /** * return a handle to the RecordFactory * @return guess */ public RecordFactory getRecordFactory() { return recordFactory; } /** * Is this repository harvestable? * @return true if harvestable, false otherwise. */ public boolean isHarvestable() { return harvestable; } /** * get the optional millisecondsToLive property (<0 indicates no limit) **/ public int getMillisecondsToLive() { return millisecondsToLive; } public void setRecordFactory(RecordFactory recordFactory) { this.recordFactory = recordFactory; } public void setSupportedGranularityOffset(int i) { supportedGranularityOffset = i; } /** * Convert the requested 'from' parameter to the finest granularity supported * by this repository. * @exception BadArgumentException one or more of the arguments are bad. */ public String toFinestFrom(String from) throws BadArgumentException { if (debug) { System.out.println("AbstractCatalog.toFinestFrom: from=" + from); System.out.println(" target=" + VALID_GRANULARITIES[supportedGranularityOffset]); } if (from.length() > VALID_GRANULARITIES[supportedGranularityOffset].length()) { throw new BadArgumentException(); } if (from.length() != VALID_GRANULARITIES[supportedGranularityOffset].length()) { StringBuffer sb = new StringBuffer(from); if (sb.charAt(sb.length()-1) == 'Z') sb.setLength(sb.length()-1); sb.append(FROM_GRANULARITIES[supportedGranularityOffset].substring(sb.length())); from = sb.toString(); } if (!isValidGranularity(from)) { throw new BadArgumentException(); } return from; } /** * Convert the requested 'until' paramter to the finest granularity supported * by this repository * @exception BadArgumentException one or more of the arguments are bad. */ public String toFinestUntil(String until) throws BadArgumentException { if (until.length() == VALID_GRANULARITIES[supportedGranularityOffset].length()) { if (!isValidGranularity(until)) throw new BadArgumentException(); return until; } if (until.length() > VALID_GRANULARITIES[supportedGranularityOffset].length()) { throw new BadArgumentException(); } StringBuffer sb = new StringBuffer(until); if (sb.charAt(sb.length()-1) == 'Z') sb.setLength(sb.length()-1); if (sb.length() < VALID_GRANULARITIES[0].length()) { while (sb.length() < 4) sb.append("9"); switch (sb.length()) { case 4: // YYYY sb.append("-"); case 5: // YYYY- sb.append("12"); case 7: // YYYY-MM sb.append("-"); case 8: // YYYY-MM- sb.append("31"); break; case 6: // YYYY-M case 9: // YYYY-MM-D throw new BadArgumentException(); } } until = sb.toString(); if (until.length() == VALID_GRANULARITIES[supportedGranularityOffset].length()) { if (!isValidGranularity(until)) throw new BadArgumentException(); return until; } if (sb.length() < VALID_GRANULARITIES[1].length()) { switch (sb.length()) { case 10: // YYYY-MM-DD sb.append("T"); case 11: // YYYY-MM-DDT sb.append("23"); case 13: // YYYY-MM-DDThh sb.append(":"); case 14: // YYYY-MM-DDThh: sb.append("59"); // case 16: // YYYY-MM-DDThh:mm // sb.append("Z"); // break; // case 12: // YYYY-MM-DDTh // case 15: // YYYY-MM-DDThh:m // throw new BadGranularityException(); // } // } // until = sb.toString(); // if (until.length() == VALID_GRANULARITIES[supportedGranularityOffset].length()) { // if (!isValidGranularity(until)) // throw new BadGranularityException(); // return until; // } // if (sb.charAt(sb.length()-1) == 'Z') // sb.setLength(sb.length()-1); // remove the trailing 'Z' // if (sb.length() < VALID_GRANULARITIES[2].length()) { // switch (sb.length()) { case 16: // YYYY-MM-DDThh:mm sb.append(":"); case 17: // YYYY-MM-DDThh:mm: sb.append("59"); case 19: // YYYY-MM-DDThh:mm:ss sb.append("Z"); break; case 18: // YYYY-MM-DDThh:mm:s throw new BadArgumentException(); } } // until = sb.toString(); // if (until.length() == VALID_GRANULARITIES[supportedGranularityOffset].length()) { // if (!isValidGranularity(until)) // throw new BadGranularityException(); // return until; // } // if (sb.charAt(sb.length()-1) == 'Z') // sb.setLength(sb.length()-1); // remove the trailing 'Z' // switch (sb.length()) { // case 19: // YYYY-MM-DDThh:mm:ss // sb.append("."); // case 20: // YYYY-MM-DDThh:mm:ss. // sb.append("0"); // case 21: // YYYY-MM-DDThh:mm:ss.s // sb.append("Z"); // break; // } until = sb.toString(); if (!isValidGranularity(until)) throw new BadArgumentException(); return until; } /** * Does the specified date conform to the supported granularity of this repository? * @param date a UTC date * @return true if date conforms to the supported granularity of this repository, * false otherwise. */ private boolean isValidGranularity(String date) { if (date.length() > VALID_GRANULARITIES[supportedGranularityOffset].length()) return false; if (date.length() < VALID_GRANULARITIES[0].length() || !Character.isDigit(date.charAt(0)) // YYYY || !Character.isDigit(date.charAt(1)) || !Character.isDigit(date.charAt(2)) || !Character.isDigit(date.charAt(3)) || date.charAt(4) != '-' || !Character.isDigit(date.charAt(5)) // MM || !Character.isDigit(date.charAt(6)) || date.charAt(7) != '-' || !Character.isDigit(date.charAt(8)) // DD || !Character.isDigit(date.charAt(9))) { return false; } if (date.length() > VALID_GRANULARITIES[0].length()) { if (date.charAt(10) != 'T' || date.charAt(date.length()-1) != 'Z' || !Character.isDigit(date.charAt(11)) // hh || !Character.isDigit(date.charAt(12)) || date.charAt(13) != ':' || !Character.isDigit(date.charAt(14)) // mm || !Character.isDigit(date.charAt(15)) // ) { // return false; // } // } // if (date.length() > VALID_GRANULARITIES[1].length()) { // if ( || date.charAt(16) != ':' || !Character.isDigit(date.charAt(17)) // ss || !Character.isDigit(date.charAt(18))) { return false; } } // if (date.length() > VALID_GRANULARITIES[2].length()) { // if (date.charAt(19) != '.' // || !Character.isDigit(date.charAt(20))) { // s // return false; // } // } return true; } /** * Retrieve the Crosswalks property * * @return the Crosswalks object containing a detailed list of oai * formats supported by this application. */ public Crosswalks getCrosswalks() { return recordFactory.getCrosswalks(); } /** * Retrieve the list of supported Sets. This should probably be initialized * by the constructor from the properties object that is passed to it. * * @return a Map object containing <setSpec> values as the Map keys and * <setName> values for the corresponding the Map values. * @exception NoSetHierarchyException No sets are defined for this repository * @exception OAIInternalServerError An error occurred */ public abstract Map listSets() throws NoSetHierarchyException, OAIInternalServerError; /** * Retrieve the next cluster of supported sets. * @return a Map object containing <setSpec> values as the Map keys and * <setName> values for the corresponding the Map values. * @exception BadResumptionTokenException The resumptionToken is bad. * @exception OAIInternalServerError An error occurred */ public abstract Map listSets(String resumptionToken) throws BadResumptionTokenException, OAIInternalServerError; /** * Factory method for creating an AbstractCatalog instance. The properties * object must contain the following entries: * <ul> * <li><b>AbstractCatalog.className</b> property which points to a class * that implements the AbstractCatalog interface. Note that this class * must have a constructor that accepts a properties object as a * parameter.</li> * <li><b>Crosswalks.&lt;supported formats&gt;</b> properties which * satisfy the constructor for the Crosswalks class</li> * </ul> * * @param properties Properties object containing entries necessary to * initialize the class * to be created. * @return on object instantiating the AbstractCatalog interface. * @exception Throwable some sort of problem occurred. */ public static AbstractCatalog factory(Properties properties) throws Throwable { AbstractCatalog oaiCatalog = null; String oaiCatalogClassName = properties.getProperty("AbstractCatalog.oaiCatalogClassName"); String recordFactoryClassName = properties.getProperty("AbstractCatalog.recordFactoryClassName"); System.out.println("the catalog name found in the factory = " + oaiCatalogClassName); System.out.println("the record name found in the factory = " + recordFactoryClassName); if (oaiCatalogClassName == null) { throw new ClassNotFoundException( "AbstractCatalog.oaiCatalogClassName is missing from properties file"); } if (recordFactoryClassName == null) { throw new ClassNotFoundException( "AbstractCatalog.recordFactoryClassName is missing from properties file"); } Class oaiCatalogClass = Class.forName(oaiCatalogClassName); Constructor oaiCatalogConstructor = oaiCatalogClass.getConstructor(new Class[] {Properties.class}); try { oaiCatalog = (AbstractCatalog)oaiCatalogConstructor.newInstance(new Object[] {properties}); if (debug) { System.out.println("AbstractCatalog.factory: recordFactoryClassName=" + recordFactoryClassName); } Class recordFactoryClass = Class.forName(recordFactoryClassName); Constructor recordFactoryConstructor = recordFactoryClass.getConstructor(new Class[] {Properties.class}); oaiCatalog.recordFactory = (RecordFactory)recordFactoryConstructor.newInstance(new Object[] {properties}); if (debug) { System.out.println("AbstractCatalog.factory: recordFactory=" + oaiCatalog.recordFactory); } String harvestable = properties.getProperty("AbstractCatalog.harvestable"); if (harvestable != null && harvestable.equals("false")) { oaiCatalog.harvestable = false; } String secondsToLive = properties.getProperty("AbstractCatalog.secondsToLive"); if (secondsToLive != null) { oaiCatalog.millisecondsToLive = Integer.parseInt(secondsToLive) * 1000; } String granularity = properties.getProperty("AbstractCatalog.granularity"); for (int i = 0; granularity != null && i < VALID_GRANULARITIES.length; ++i) { if (granularity.equalsIgnoreCase(VALID_GRANULARITIES[i])) { oaiCatalog.supportedGranularityOffset = i; break; } } if (oaiCatalog.supportedGranularityOffset == -1) { oaiCatalog.supportedGranularityOffset = 0; System.err.println("AbstractCatalog.factory: Invalid or missing AbstractCatalog.granularity property. Setting value to default: " + VALID_GRANULARITIES[oaiCatalog.supportedGranularityOffset]); } } catch (InvocationTargetException e) { throw e.getTargetException(); } return oaiCatalog; } /** * Retrieve a list of schemaLocation values associated with the specified * identifier. * * @param identifier the OAI identifier * @return a Vector containing schemaLocation Strings * @exception IdDoesNotExistException The specified identifier doesn't exist. * @exception NoMetadataFormatsException The identifier exists, but no metadataFormats are * provided for it. * @exception OAIInternalServerError signals an http status code 500 problem */ public abstract Vector getSchemaLocations(String identifier) throws IdDoesNotExistException, NoMetadataFormatsException, OAIInternalServerError; /** * Retrieve a list of Identifiers that satisfy the criteria parameters * * @param from beginning date in the form of YYYY-MM-DD or null if earliest * date is desired * @param until ending date in the form of YYYY-MM-DD or null if latest * date is desired * @param set set name or null if no set is desired * @return a Map object containing an optional "resumptionToken" key/value * pair and an "headers" Map object. The "headers" Map contains OAI * identifier keys with corresponding values of "true" or null depending on * whether the identifier is deleted or not. * @exception BadArgumentException one or more of the arguments are bad. * @exception CannotDisseminateFormatException the requested metadataPrefix isn't supported * @exception NoItemsMatchException no items fit the criteria * @exception NoSetHierarchyException sets aren't defined for this repository * @exception OAIInternalServerError signals an http status code 500 problem */ public abstract Map listIdentifiers(String from, String until, String set, String metadataPrefix) throws BadArgumentException, CannotDisseminateFormatException, NoItemsMatchException, NoSetHierarchyException, OAIInternalServerError; /** * Retrieve the next set of Identifiers associated with the resumptionToken * * @param resumptionToken implementation-dependent format taken from the * previous listIdentifiers() Map result. * @return a Map object containing an optional "resumptionToken" key/value * pair and an "headers" Map object. The "headers" Map contains OAI * identifier keys with corresponding values of "true" or null depending on * whether the identifier is deleted or not. * @exception BadResumptionTokenException The resumptionToken is bad. * @exception OAIInternalServerError signals an http status code 500 problem */ public abstract Map listIdentifiers(String resumptionToken) throws BadResumptionTokenException, OAIInternalServerError; /** * Retrieve the specified metadata for the specified identifier * * @param identifier the OAI identifier * @return the String containing the result record. * @exception IdDoesNotExistException The specified identifier doesn't exist. * @exception CannotDisseminateFormatException The identifier exists, but doesn't support * the specified metadataPrefix. * @exception OAIInternalServerError signals an http status code 500 problem */ public abstract String getRecord(String identifier, String metadataPrefix) throws IdDoesNotExistException, CannotDisseminateFormatException, OAIInternalServerError; /** * Retrieve the specified metadata for the specified identifier * * @param identifier the OAI identifier * @return the String containing the result record. * @exception IdDoesNotExistException The specified identifier doesn't exist. * @exception CannotDisseminateFormatException The identifier exists, but doesn't support * the specified metadataPrefix. * @exception OAIInternalServerError signals an http status code 500 problem */ public String getMetadata(String identifier, String metadataPrefix) throws IdDoesNotExistException, CannotDisseminateFormatException, OAIInternalServerError { throw new OAIInternalServerError("You need to override AbstractCatalog.getMetadata()"); } /** * Retrieve a list of records that satisfy the specified criteria * * @param from beginning date in the form of YYYY-MM-DD or null if earliest * date is desired * @param until ending date in the form of YYYY-MM-DD or null if latest * date is desired * @param set set name or null if no set is desired * @return a Map object containing an optional "resumptionToken" key/value * pair and a "records" Iterator object. The "records" Iterator contains a * set of Records objects. * @exception BadArgumentException one or more of the arguments are bad. * @exception CannotDisseminateFormatException the requested metadataPrefix isn't supported * @exception NoItemsMatchException no items fit the criteria * @exception NoSetHierarchyException sets aren't defined for this repository * @exception OAIInternalServerError signals an http status code 500 problem */ public Map listRecords(String from, String until, String set, String metadataPrefix) throws BadArgumentException, CannotDisseminateFormatException, NoItemsMatchException, NoSetHierarchyException, OAIInternalServerError { if (debug) { System.out.println("in AbstractCatalog.listRecords"); } Map listIdentifiersMap = listIdentifiers(from, until, set, metadataPrefix); String resumptionToken = (String)listIdentifiersMap.get("resumptionToken"); Iterator identifiers = (Iterator)listIdentifiersMap.get("identifiers"); Map listRecordsMap = new HashMap(); ArrayList records = new ArrayList(); while (identifiers.hasNext()) { String identifier = (String)identifiers.next(); try { records.add(getRecord(identifier, metadataPrefix)); } catch (IdDoesNotExistException e) { throw new OAIInternalServerError("GetRecord failed to retrieve identifier '" + identifier + "'"); } } listRecordsMap.put("records", records.iterator()); if (resumptionToken != null) { listRecordsMap.put("resumptionToken", resumptionToken); } return listRecordsMap; } /** * Retrieve the next set of records associated with the resumptionToken * * @param resumptionToken implementation-dependent format taken from the * previous listRecords() Map result. * @return a Map object containing an optional "resumptionToken" key/value * pair and a "records" Iterator object. The "records" Iterator contains a * set of Records objects. * @exception BadResumptionTokenException The resumptionToken is bad. * @exception OAIInternalServerError signals an http status code 500 problem */ public Map listRecords(String resumptionToken) throws BadResumptionTokenException, OAIInternalServerError { Map listIdentifiersMap = listIdentifiers(resumptionToken); resumptionToken = (String)listIdentifiersMap.get("resumptionToken"); Iterator identifiers = (Iterator)listIdentifiersMap.get("identifiers"); String metadataPrefix = (String)listIdentifiersMap.get("metadataPrefix"); Map listRecordsMap = new HashMap(); ArrayList records = new ArrayList(); while (identifiers.hasNext()) { String identifier = (String)identifiers.next(); try { records.add(getRecord(identifier, metadataPrefix)); } catch (IdDoesNotExistException e) { throw new OAIInternalServerError("GetRecord failed to retrieve identifier '" + identifier + "'"); } catch (CannotDisseminateFormatException e) { // someone cheated throw new BadResumptionTokenException(); } } listRecordsMap.put("records", records.iterator()); if (resumptionToken != null) { listRecordsMap.put("resumptionToken", resumptionToken); } return listRecordsMap; } public Map getResumptionMap(String resumptionToken) { return getResumptionMap(resumptionToken, -1, -1); } public Map getResumptionMap(String resumptionToken, int completeListSize, int cursor) { Map resumptionMap = null; if (resumptionToken != null) { resumptionMap = new HashMap(); resumptionMap.put("resumptionToken", resumptionToken); if (millisecondsToLive > 0) { Date now = new Date(); Date then = new Date((new Date()).getTime() + millisecondsToLive); resumptionMap.put("expirationDate", ServerVerb.createResponseDate(then)); } if (completeListSize >= 0) { resumptionMap.put("completeListSize", Integer.toString(completeListSize)); } if (cursor >= 0) { resumptionMap.put("cursor", Integer.toString(cursor)); } } return resumptionMap; } /** * close the repository */ public abstract void close(); }
8a9848c9c6dc8d396790a56735347f38135d9989
68e21b6e31efbc096e1721cd3d0810cefb2d4cf3
/Test5_0511.java
dab8879cedfd85e2474d48a331ba5e9e5795c9fc
[]
no_license
Kang-Min-hyuk/Mh-Test
e03fe0d609b901d9360a99589572ba27f30f97e0
86cb284a146d748c75544c21ff4dc6514f7343a8
refs/heads/master
2021-01-20T15:31:21.949970
2017-05-25T07:23:43
2017-05-25T07:23:43
90,780,731
0
0
null
null
null
null
UTF-8
Java
false
false
2,481
java
package io.test1.com; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; import java.io.Serializable; /* * [ 메모리에 생성된 객체는 비영속성(=일시성)을 가짐 ] * * 자바에서는 '객체 직렬화(Object Serialization)' 기능을 제공함. * 객체 직렬화를 적용하면 메모리에 생성된 인스턴스 정보를 * 파일이나 네트워크를 통해서 영속성을 유지할 수 있음. * * <객체 직렬화를 명시하는 방법> * public class 클래스명 implements Serializable{} * * <Serializable> * - 단지 마킹 기능을 가지는 용도로 사용하는 마커(marker) 인터페이스 * * <객체 직렬화를 위한 I/O클래스> * * - ObjectInputStream * : 객체 직렬화된 데이터를 읽을 때 사용함. 역직렬화할 때 사용함. * * - ObjectOutputStream * : 인스턴스를 객체 직렬화로 출력할 때 사용함. * * <객체 직렬화의 특징> * - Sereializable 인터페이스를 사용함. * - 메모리에 생성된 인스턴스를 내부적으로 byte로 처리함. * - byte 단위로 처리되기 때문에 반드시 ObjectInputStream과 * ObjectOutputStream을 사용해야 됨. * - 연쇄적으로 발생됨. 직렬화 될 객체의 멤버변수가 참조하는 * 객체까지도 연쇄적으로 객체 직렬화된다는 의미. * - 대부분의 API는 모두 객체 지렬화 가능한 클래스들임.(String,ArrayList) * - 객체 직렬화에서 제외시는 방법은 transient 키워드로 명시하면 됨. * * */ // Person 객체를 직렬화 시켜서 파일로 가져오기 public class Test5_0511 { public static void main(String[] args) { Person person = new Person("홍길동",30); File file = new File("C:\\bustest","serial.dat"); try { // 출력스트림 준비 FileOutputStream fos = new FileOutputStream(file); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(person); // 직렬화 시키기 // 자원닫기 (기본입출력이 아닌 입출력 자원은 꼭 닫아야 됨) oos.close(); } catch (FileNotFoundException e) { // FileOutputStream e.printStackTrace(); } catch (IOException e) { // ObjectOutputStream e.printStackTrace(); } } }
02d84ee1006115afade64eac9d8d367b603a097f
1564e09e4d915ef02f6dd04525092ba378c1c446
/app/src/androidTest/java/com/muflihundev/recipeapp/ExampleInstrumentedTest.java
fa4789ccd7121d0288216b0f997b4337ef2a30d1
[]
no_license
muflihunaf/RecipeAppStatic
902be0ad0ff810e0443da11a9f3e91908de5925d
839e8060f96cedcdd0c9f340748d58eb688552ea
refs/heads/master
2022-12-14T05:30:40.098908
2020-08-26T14:16:23
2020-08-26T14:16:23
290,516,163
0
0
null
null
null
null
UTF-8
Java
false
false
764
java
package com.muflihundev.recipeapp; import android.content.Context; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("com.muflihundev.recipeapp", appContext.getPackageName()); } }
[ "muflihun@[email protected]" ]
b85f5220fe306e9eb0c0aed83da6ff20f9a14752
e9c134d5bc065c13315256b9922c7b0c903412dc
/Java/Eclipse Microprofile/src/main/java/org/freifeld/extremebenchmark/boundary/TestResources.java
f36e4ba5768fc3e17a7ab46d1d073bd96bb450a2
[ "MIT" ]
permissive
FreifeldRoyi/Extreme-Benchmark
d13aeebab760f26c1564e0e0e1779d531b6da530
43b1173141742e536462a2eb35eff73fbfce517a
refs/heads/master
2020-03-29T11:37:03.018289
2018-09-24T18:28:18
2018-09-24T18:28:18
149,861,723
2
0
null
null
null
null
UTF-8
Java
false
false
957
java
package org.freifeld.extremebenchmark.boundary; import javax.enterprise.context.RequestScoped; import javax.inject.Inject; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.client.Client; import javax.ws.rs.client.Invocation; import javax.ws.rs.client.WebTarget; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; @RequestScoped @Path("/tests") public class TestResources { @Inject private Client httpClient; @GET @Path("/test-1-simple") @Produces(MediaType.APPLICATION_JSON) public String simpleString() { return "Hello World!"; } @GET @Path("/test-2-site-fetch") @Produces(MediaType.TEXT_HTML) public Response fetchSite() { WebTarget target = this.httpClient.target("https://www.google.com"); Invocation.Builder request = target.request(); Response response = request.get(); return response; } }
cd915cf75c1808a0b7a8fadea166a0d4d54d8449
9a3675172cf4b5afec2e6f47c8526a0108949740
/app/src/main/java/com/a99live/zhibo/live/receiver/NotificationService.java
2ffad32cdeac33a4c2368f374d799bddce76240f
[]
no_license
luomingstar/StarLive
c7f5421ed380d78d73cac9becab41a48b000b39a
1aa414e5acc21f3483cc58db6daf6aab9b5b95f3
refs/heads/master
2021-07-21T03:15:53.184466
2017-10-28T06:33:27
2017-10-28T06:33:27
108,625,336
0
0
null
null
null
null
UTF-8
Java
false
false
4,795
java
package com.a99live.zhibo.live.receiver; import android.content.ContentValues; import android.content.Context; import com.a99live.zhibo.live.model.XGNotification; public class NotificationService { // private DBOpenHelper dbOpenHelper; private static NotificationService instance = null; public NotificationService(Context context) { // this.dbOpenHelper = new DBOpenHelper(context); } public synchronized static NotificationService getInstance(Context ctx) { if (null == instance) { instance = new NotificationService(ctx); } return instance; } // public void save(XGNotification notification) { // SQLiteDatabase db = dbOpenHelper.getWritableDatabase(); ContentValues values = new ContentValues(); values.put("msg_id", notification.getMsg_id()); values.put("title", notification.getTitle()); values.put("content", notification.getContent()); values.put("activity", notification.getActivity()); values.put("notificationActionType", notification.getNotificationActionType()); values.put("update_time", notification.getUpdate_time()); // db.insert("notification", null, values); } // public void delete(Integer id) { // SQLiteDatabase db = dbOpenHelper.getWritableDatabase(); // db.delete("notification", "id=?", new String[] { id.toString() }); // } // // public void deleteAll() { // SQLiteDatabase db = dbOpenHelper.getWritableDatabase(); // db.delete("notification", "", null); // } // // public void update(XGNotification notification) { // SQLiteDatabase db = dbOpenHelper.getWritableDatabase(); // ContentValues values = new ContentValues(); // values.put("msg_id", notification.getMsg_id()); // values.put("title", notification.getTitle()); // values.put("content", notification.getContent()); // values.put("activity", notification.getActivity()); // values.put("notificationActionType", notification.getNotificationActionType()); // values.put("update_time", notification.getUpdate_time()); // db.update("notification", values, "id=?", new String[] { notification // .getId().toString() }); // } // // public XGNotification find(Integer id) { // SQLiteDatabase db = dbOpenHelper.getReadableDatabase(); // Cursor cursor = db // .query("notification", // new String[] { "id,msg_id,title,content,activity,notificationActionType,update_time" }, // "id=?", new String[] { id.toString() }, null, null, // null, "1"); // try { // if (cursor.moveToFirst()) { // return new XGNotification(cursor.getInt(cursor // .getColumnIndex("id")), cursor.getLong(cursor // .getColumnIndex("msg_id")), cursor.getString(cursor // .getColumnIndex("title")), cursor.getString(cursor // .getColumnIndex("content")), cursor.getString(cursor // .getColumnIndex("activity")), cursor.getInt(cursor // .getColumnIndex("notificationActionType")), cursor.getString(cursor // .getColumnIndex("update_time"))); // } // return null; // } finally { // cursor.close(); // } // } // // public List<XGNotification> getScrollData(int currentPage, int lineSize, // String msg_id) { // String firstResult = String.valueOf((currentPage - 1) * lineSize); // SQLiteDatabase db = dbOpenHelper.getReadableDatabase(); // Cursor cursor = null; // try { // if (msg_id == null || "".equals(msg_id)) { // cursor = db // .query("notification", // new String[] { "id,msg_id,title,content,activity,notificationActionType,update_time" }, // null, null, null, null, "update_time DESC", // firstResult + "," + lineSize); // } else { // cursor = db // .query("notification", // new String[] { "id,msg_id,title,content,activity,notificationActionType,update_time" }, // "msg_id like ?", new String[] { msg_id + "%" }, // null, null, "update_time DESC", firstResult // + "," + lineSize); // } // List<XGNotification> notifications = new ArrayList<XGNotification>(); // while (cursor.moveToNext()) { // notifications.add(new XGNotification(cursor.getInt(cursor // .getColumnIndex("id")), cursor.getLong(cursor // .getColumnIndex("msg_id")), cursor.getString(cursor // .getColumnIndex("title")), cursor.getString(cursor // .getColumnIndex("content")), cursor.getString(cursor // .getColumnIndex("activity")), cursor.getInt(cursor // .getColumnIndex("notificationActionType")), cursor.getString(cursor // .getColumnIndex("update_time")))); // } // return notifications; // } finally { // cursor.close(); // } // } // // public int getCount() { // SQLiteDatabase db = dbOpenHelper.getReadableDatabase(); // Cursor cursor = db.rawQuery("select count(*) from notification", null); // try { // cursor.moveToFirst(); // return cursor.getInt(0); // } finally { // cursor.close(); // } // } }
0a6b9c4cbcfe5f26356b98af08fce9f102597f45
327d615dbf9e4dd902193b5cd7684dfd789a76b1
/base_source_from_JADX/sources/com/google/android/gms/internal/ads/zzdcw.java
0f2391383abf4731986b422fcb902abd8eb96531
[]
no_license
dnosauro/singcie
e53ce4c124cfb311e0ffafd55b58c840d462e96f
34d09c2e2b3497dd452246b76646b3571a18a100
refs/heads/main
2023-01-13T23:17:49.094499
2020-11-20T10:46:19
2020-11-20T10:46:19
314,513,307
0
0
null
null
null
null
UTF-8
Java
false
false
371
java
package com.google.android.gms.internal.ads; import com.google.android.gms.ads.internal.zzp; import java.util.concurrent.Callable; final /* synthetic */ class zzdcw implements Callable { static final Callable zzgzz = new zzdcw(); private zzdcw() { } public final Object call() { return new zzdcu(zzp.zzla().zzys(), zzp.zzla().zzyt()); } }
b7b1dae93f8c3ed44bc698d61f595125e8c88646
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/24/24_9c3f71489e344f02d68e22608cdaf28dcb867d25/ScanDescription/24_9c3f71489e344f02d68e22608cdaf28dcb867d25_ScanDescription_s.java
61d3e104f0843c745836e670e0daf0974295ccd9
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
19,481
java
package de.ptb.epics.eve.data.scandescription; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.concurrent.CopyOnWriteArrayList; import org.apache.log4j.Logger; import de.ptb.epics.eve.data.EventTypes; import de.ptb.epics.eve.data.measuringstation.Detector; import de.ptb.epics.eve.data.measuringstation.DetectorChannel; import de.ptb.epics.eve.data.measuringstation.Motor; import de.ptb.epics.eve.data.measuringstation.MotorAxis; import de.ptb.epics.eve.data.measuringstation.Device; import de.ptb.epics.eve.data.measuringstation.Event; import de.ptb.epics.eve.data.measuringstation.IMeasuringStation; import de.ptb.epics.eve.data.measuringstation.Option; import de.ptb.epics.eve.data.measuringstation.filter.ExcludeFilter; import de.ptb.epics.eve.data.scandescription.errors.IModelError; import de.ptb.epics.eve.data.scandescription.errors.IModelErrorProvider; import de.ptb.epics.eve.data.scandescription.updatenotification.ControlEventManager; import de.ptb.epics.eve.data.scandescription.updatenotification.IModelUpdateListener; import de.ptb.epics.eve.data.scandescription.updatenotification.IModelUpdateProvider; import de.ptb.epics.eve.data.scandescription.updatenotification.ModelUpdateEvent; /** * <code>ScanDescription</code> is the representation of a scan. It contains * all components necessary to describe a scan (e.g. chains, scan modules). * * @author Stephan Rehfeld <stephan.rehfeld( -at -) ptb.de> * @author Hartmut Scherr * @author Marcus Michalsky */ public class ScanDescription implements IModelUpdateProvider, IModelUpdateListener, IModelErrorProvider { private static Logger logger = Logger.getLogger(ScanDescription.class.getName()); /** */ public static final String REPEAT_COUNT_PROP = "repeatCount"; /** */ public static final String MONITOR_OPTION_PROP = "monitorOption"; /** */ public static final String MONITOR_OPTIONS_LIST_PROP = "monitors"; private String fileName; // version of the scan description. private int inputVersion; // the input revision. private int inputRevision; // the input modification. private int inputModification; // the number of times the scan is repeated. private int repeatCount; // the chains of the scan description. private List<Chain> chains; // the events of the scan description. private Map<String, Event> eventsMap; // monitor options type private MonitorOption monitorOption; // options that should be monitored private List<Option> monitors; // the listeners that will be notified if something changed. private List<IModelUpdateListener> modelUpdateListener; // the measuring station used by this scan description. private final IMeasuringStation measuringStation; private boolean dirty; /** */ public static final String DIRTY_PROP = "dirty"; private PropertyChangeSupport propertyChangeSupport; /** * Constructs a <code>ScanDescription</code> and adds the S0 start event * to it's event list. * * @param measuringStation the measuring station the scan description is * based on */ public ScanDescription(final IMeasuringStation measuringStation) { super(); this.chains = new ArrayList<Chain>(); //this.events = new ArrayList<Event>(); this.eventsMap = new HashMap<String, Event>(); this.modelUpdateListener = new ArrayList<IModelUpdateListener>(); // default start event Event s0 = new Event(EventTypes.SCHEDULE); s0.setName("Start"); this.add(s0); this.fileName = ""; this.measuringStation = measuringStation; this.dirty = false; this.monitorOption = MonitorOption.NONE; this.monitors = new ArrayList<Option>(); this.propertyChangeSupport = new PropertyChangeSupport(this); } /** * Adds a chain to the scan description. * * @param chain the chain that should be added * @return <code>true</code> if the chain was added, * <code>false</code> otherwise */ public boolean add(final Chain chain) { chain.setScanDescription(this); boolean returnValue = chains.add(chain); chain.addModelUpdateListener(this); updateListeners(); return returnValue; } /** * Removes a chain from the scan description. * * @param chain the chain that should be removed * @return <code>true</code> if the chain was removed, * <code>false</code> otherwise */ public boolean remove(final Chain chain) { boolean returnValue = chains.remove(chain); chain.removeModelUpdateListener(this); updateListeners(); return returnValue; } /** * Adds an event to the scan description. * * @param event the event that should be added * @return <code>true</code> if the event was added, * <code>false</code> otherwise */ public boolean add(final Event event) { this.eventsMap.put(event.getID(), event); updateListeners(); return true; // TODO always return true ? } /** * Removes an event from the scan description. * * @param event the event that should be removed * @return <code>true</code> if the event has been removed, * <code>false</code> otherwise */ public boolean remove(final Event event) { boolean returnValue = this.eventsMap.containsValue(event); // TODO return Value ??? updateListeners(); this.eventsMap.remove(event.getID()); //TODO // we loop through chains and collect all ControlEvents // this should be done easier List<ControlEvent> eventList = new ArrayList<ControlEvent>(); for (Chain loopChain : chains) { removeControlEventIfNotInList( loopChain.getBreakControlEventManager(), event); removeControlEventIfNotInList( loopChain.getStartControlEventManager(), event); removeControlEventIfNotInList( loopChain.getStopControlEventManager(), event); removeControlEventIfNotInList( loopChain.getRedoControlEventManager(), event); removeControlEventIfNotInList( loopChain.getPauseControlEventManager(), event); for (ScanModule loopScanModule : loopChain.getScanModules()){ removeControlEventIfNotInList( loopScanModule.getBreakControlEventManager(), event); removeControlEventIfNotInList( loopScanModule.getRedoControlEventManager(), event); removeControlEventIfNotInList( loopScanModule.getTriggerControlEventManager(), event); removeControlEventIfNotInList( loopScanModule.getPauseControlEventManager(), event); } } // if a controlEvent uses the event, remove the ControlEvent for (ControlEvent cevent : eventList) { Event embeddedEvent = cevent.getEvent(); if (embeddedEvent != null){ if (embeddedEvent.equals(event)) { cevent.updateEvent(new ModelUpdateEvent(this, null)); } } } return returnValue; } /** * This method removes a control event if it is not longer in the list. * * @param manager The control event manager. * @param event The event. */ private void removeControlEventIfNotInList( final ControlEventManager manager, final Event event) { final List<? extends ControlEvent> eventList = manager.getControlEventsList(); // if a controlEvent uses the event, remove the ControlEvent for(ControlEvent cevent : eventList) { final Event embeddedEvent = cevent.getEvent(); if(embeddedEvent != null) { if(embeddedEvent.equals(event)) { manager.removeControlEvent(cevent); } } } } /** * @return the fileName */ public String getFileName() { return fileName; } /** * @param fileName the fileName to set */ public void setFileName(String fileName) { this.fileName = fileName; } /** * Returns the version of the scan description. * * @return the version of the scan description. */ public String getVersion() { return String.valueOf(inputVersion) + "." + String.valueOf(inputRevision) + "." + String.valueOf(inputModification); } /** * Sets the version of the scan description. * * @param version The version of the scan description. */ public void setVersion(final String version) { String[] versionArray = version.split("\\."); if(versionArray.length == 3) { inputVersion = Integer.parseInt(versionArray[0]); inputRevision = Integer.parseInt(versionArray[1]); inputModification = Integer.parseInt(versionArray[2]); } } /** * Gives back the repeat count of the scan description. * * @return repeatCount The number of repeats of the scan description. */ public int getRepeatCount() { return this.repeatCount; } /** * Sets the repeat count of the scan description. * * @param repeatCount the scan will be repeated repeatCount times */ public void setRepeatCount(final int repeatCount) { this.propertyChangeSupport.firePropertyChange(REPEAT_COUNT_PROP, this.repeatCount, this.repeatCount=repeatCount); updateListeners(); } /** * Returns a list holding all chains. * * @return a list holding all chain. */ public List<Chain> getChains() { return new ArrayList<Chain>(this.chains); } /** * Returns a list holding all monitors. * * @return a list holding all monitors. */ public List<Option> getMonitors() { return new ArrayList<Option>(this.monitors); } /** * Returns the type of the monitor options. * @return * * @return a MonitorOption for the monitor option type. */ public MonitorOption getMonitorOption() { return this.monitorOption; } /** * Sets the type of the monitor options. * @param monitorOption the selection of monitored options will be * specific by monitorOption */ public void setMonitorOption(final MonitorOption monitorOption) { this.propertyChangeSupport.firePropertyChange(MONITOR_OPTION_PROP, this.monitorOption, this.monitorOption=monitorOption); updateListeners(); } /** * Returns the chain corresponding to the given id. * * @param chainId the id of the chain * @return the chain corresponding to the given id or * <code>null</code> if none */ public Chain getChain(int chainId) { Chain retChain = null; for (Chain chain : this.chains) { if (chain.getId() == chainId) { retChain = chain; } } return retChain; } /** * Returns the event corresponding to the given id. * * @param id id of an event * @return the event corresponding to the given id or * <code>null</code> if none */ public Event getEventById(final String id) { return this.eventsMap.get(id); } /** * Convenience method * * @param id A id of a event. * @return true if successful */ public boolean removeEventById(final String id) { return remove(getEventById(id)); } /** * Returns a default start event for chains without start event tag * this is a hack to not break existing code * * @return the default StartEvent */ public Event getDefaultStartEvent() { // TODO replace hack with real code ? return this.getEventById("S-0-0-E"); } /** * Returns a list holding all events. * * @return a list holding all events */ public List<Event> getEvents() { return new ArrayList<Event>(this.eventsMap.values()); } /** * Returns a valid id for a plot. * * @return a valid id for a plot */ public int getAvailablePlotId() { List<Integer> plotIds = new ArrayList<Integer>(); for(Chain ch : this.chains) { for(ScanModule sm : ch.getScanModules()) { for(PlotWindow pw : sm.getPlotWindows()) { plotIds.add(pw.getId()); } } } Collections.sort(plotIds); int i=1; while(plotIds.contains(i)) { i++; } return i; } /** * This method returns the used measuring station of this scan description. * * @return The used measuring station. Never returns 'null'. */ public IMeasuringStation getMeasuringStation() { return this.measuringStation; } /** * @return the dirty */ public boolean isDirty() { return dirty; } /** * @param dirty the dirty to set */ public void setDirty(boolean dirty) { this.dirty = dirty; } /** * Adds an option to the list of monitors * @param option the option to add * @since 1.12 */ public void addMonitor(Option option) { this.monitors.add(option); this.propertyChangeSupport.firePropertyChange( ScanDescription.MONITOR_OPTIONS_LIST_PROP, null, monitors); } /** * Removes an option to the list of monitors * @param option the option to remove * @since 1.12 */ public void removeMonitor(Option option) { this.monitors.remove(option); this.propertyChangeSupport.firePropertyChange( ScanDescription.MONITOR_OPTIONS_LIST_PROP, null, monitors); } /** * Removes all option to the list of monitors * @since 1.14 */ public void removeAllMonitor() { this.monitors.clear(); this.propertyChangeSupport.firePropertyChange( ScanDescription.MONITOR_OPTIONS_LIST_PROP, null, monitors); } /** * Adds all options to the list of monitors which are marked in the * messplatz.xml File with monitor="true" * @since 1.14 */ public void addMpMonitor() { // first, clear List this.monitors.clear(); // add option to list for (Detector d : measuringStation.getDetectors()) { for (Option o : d.getOptions()) { if(!o.isMonitor()) { continue; } this.monitors.add(o); } for (DetectorChannel ch : d.getChannels()) { for (Option o : ch.getOptions()) { if(!o.isMonitor()) { continue; } this.monitors.add(o); } } } for (Motor m : measuringStation.getMotors()) { for (Option o : m.getOptions()) { if(!o.isMonitor()) { continue; } this.monitors.add(o); } for (MotorAxis ma : m.getAxes()) { for (Option o : ma.getOptions()) { if(!o.isMonitor()) { continue; } this.monitors.add(o); } } } for (Device dev : measuringStation.getDevices()) { for (Option o : dev.getOptions()) { if(!o.isMonitor()) { continue; } this.monitors.add(o); } } this.propertyChangeSupport.firePropertyChange( ScanDescription.MONITOR_OPTIONS_LIST_PROP, null, monitors); } /** * Adds all options of the scan devices to the list of * monitors which are marked in the * messplatz.xml File with monitor="true" * @since 1.15 */ public void addInvolvedMonitor() { // first, clear List this.monitors.clear(); // add option to list // do the filtering if(logger.isDebugEnabled()) { logger.debug("ScanDescription " + this.getMonitorOption().name() + " selected."); } ExcludeFilter measuringStation2 = new ExcludeFilter(); measuringStation2.setSource(this.getMeasuringStation()); measuringStation2.excludeUnusedDevices(this); for (Detector d : measuringStation2.getDetectors()) { if(logger.isDebugEnabled()) { logger.debug("Detector " + d.getName() + " is used in Scan"); } for (Option o : d.getOptions()) { if(!o.isMonitor()) { continue; } this.monitors.add(o); if(logger.isDebugEnabled()) { logger.debug("Option of Detector " + d.getName() + ": " + o.toString()); } } for (DetectorChannel ch : d.getChannels()) { for (Option o : ch.getOptions()) { if(!o.isMonitor()) { continue; } this.monitors.add(o); } } } for (Motor m : measuringStation2.getMotors()) { for (Option o : m.getOptions()) { if(!o.isMonitor()) { continue; } this.monitors.add(o); } for (MotorAxis ma : m.getAxes()) { for (Option o : ma.getOptions()) { if(!o.isMonitor()) { continue; } this.monitors.add(o); } } } for (Device dev : measuringStation2.getDevices()) { for (Option o : dev.getOptions()) { if(!o.isMonitor()) { continue; } this.monitors.add(o); } } this.propertyChangeSupport.firePropertyChange( ScanDescription.MONITOR_OPTIONS_LIST_PROP, null, monitors); } /** * Adds all options of the messplatz.xml File to the list of monitors * @since 1.14 */ public void addAllMonitor() { // first, clear List this.monitors.clear(); // add option to list for (Detector d : measuringStation.getDetectors()) { for (Option o : d.getOptions()) { this.monitors.add(o); } for (DetectorChannel ch : d.getChannels()) { for (Option o : ch.getOptions()) { this.monitors.add(o); } } } for (Motor m : measuringStation.getMotors()) { for (Option o : m.getOptions()) { this.monitors.add(o); } for (MotorAxis ma : m.getAxes()) { for (Option o : ma.getOptions()) { this.monitors.add(o); } } } for (Device dev : measuringStation.getDevices()) { for (Option o : dev.getOptions()) { this.monitors.add(o); } } this.propertyChangeSupport.firePropertyChange( ScanDescription.MONITOR_OPTIONS_LIST_PROP, null, monitors); } /** * {@inheritDoc} */ @Override public void updateEvent(final ModelUpdateEvent modelUpdateEvent) { if(logger.isDebugEnabled()) { if(modelUpdateEvent != null) { logger.debug(modelUpdateEvent.getSender()); } } updateListeners(); } /** * {@inheritDoc} */ @Override public boolean addModelUpdateListener( final IModelUpdateListener modelUpdateListener) { return this.modelUpdateListener.add(modelUpdateListener); } /** * {@inheritDoc} */ @Override public boolean removeModelUpdateListener( final IModelUpdateListener modelUpdateListener) { return this.modelUpdateListener.remove(modelUpdateListener); } /** * {@inheritDoc} */ @Override public List<IModelError> getModelErrors() { final List<IModelError> errorList = new ArrayList<IModelError>(); final Iterator<Chain> it = this.chains.iterator(); while(it.hasNext()) { errorList.addAll(it.next().getModelErrors()); } return errorList; } /* * */ private void updateListeners() { final CopyOnWriteArrayList<IModelUpdateListener> list = new CopyOnWriteArrayList<IModelUpdateListener>(this.modelUpdateListener); Iterator<IModelUpdateListener> it = list.iterator(); while(it.hasNext()) { it.next().updateEvent(new ModelUpdateEvent(this, null)); } } /** * @see java.beans.PropertyChangeSupport#addPropertyChangeListener(String, PropertyChangeListener) */ public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) { this.propertyChangeSupport.addPropertyChangeListener(propertyName, listener); } /** * @see java.beans.PropertyChangeSupport#removePropertyChangeListener(String, PropertyChangeListener) */ public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) { this.propertyChangeSupport.removePropertyChangeListener(propertyName, listener); } }
8738e592db8b992105ca5b2e1963d05b7a3800c8
fb4d0f782d3f6b4c6442a813b132292b8eca442f
/SKILL TRACKERS APP/25-09-Employee-DTO-mysql/src/main/java/com/example/demo/repo/SubSkillRepository.java
9f5c8b6d06a5600554d8f197117908bc8bc8668b
[]
no_license
PriyaRavi97/backup
cfdd387290f0ba434381296e3f0ec84f2940c0b8
8470e753c0669e2c828df77796319991af778c10
refs/heads/master
2023-01-31T12:57:16.888585
2019-10-21T10:23:50
2019-10-21T10:23:50
216,502,491
0
0
null
2023-01-07T22:08:04
2019-10-21T07:19:21
JavaScript
UTF-8
Java
false
false
257
java
package com.example.demo.repo; import org.springframework.data.repository.CrudRepository; import com.example.demo.Entity.Employee; import com.example.demo.Entity.SubSkill; public interface SubSkillRepository extends CrudRepository<SubSkill, Integer>{ }
59010aa2aebb0c75fcc550e36c736adc7530fbad
eb83c5739ff4aadcbe702aff33b9c908a408d220
/uBike2-web/src/main/java/com/ubike/rest/security/MemberShipsVoter.java
6831437f9d5446860a663749a6745c67739f477d
[]
no_license
benothman/uBike
c3c586bb7b93a6c2d66fcc0d1be94d4350d0c33f
e8ed37a40fe9bb863a7ca80d700b4ba665e6fbfb
refs/heads/master
2021-01-10T20:35:07.237598
2011-06-20T13:43:58
2011-06-20T13:43:58
1,876,727
0
0
null
null
null
null
UTF-8
Java
false
false
2,766
java
/* * Copyright 2009 Nabil BENOTHMAN <[email protected]>. * * 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. * under the License. * * This class is a part of uBike projet (HEIG-VD) */ package com.ubike.rest.security; import com.ubike.model.MemberShip; import com.ubike.model.UbikeUser; import com.ubike.rest.service.MemberShipsResource; import java.lang.reflect.Method; import org.aopalliance.intercept.MethodInvocation; import org.springframework.security.Authentication; import org.springframework.security.ConfigAttributeDefinition; /** * To implement the security policies, we choose to use the voter mecanism * This class is used as a voter for access to the <code>MemberShipsResource</code> * If the requested resource is <code>MemberShipsResource</code> the vote method * check if the user has permission to access and it returns <tt>ACCESS_GRANTED</tt> * if it is the case else returns <tt>ACCESS_DENIED</tt> * If the requested resource is not <code>MemberShipsResource</code> so it returns * <tt>ACCESS_ABSTAIN</tt> * * @author Benothman */ public class MemberShipsVoter extends UbikeResourceAccessVoter { public int vote(Authentication auth, Object secureObj, ConfigAttributeDefinition cad) { if (supports(secureObj.getClass())) { try { MethodInvocation mi = (MethodInvocation) secureObj; if (mi.getThis().getClass() == MemberShipsResource.class) { MemberShipsResource resource = (MemberShipsResource) mi.getThis(); Method method = mi.getMethod(); if (method.getName().equals("getMemberShipResource")) { Object arguments[] = mi.getArguments(); Long id = (Long) arguments[0]; MemberShip tmp = resource.getById(id); UbikeUser current = (UbikeUser) getSessionAttribute("user"); return checkAccess(tmp.getMember(), current); } return ACCESS_GRANTED; } } catch (Exception exp) { System.out.println(exp); } } return ACCESS_ABSTAIN; } }
784880295051b580db23fb0cea0aa2a6222b5b73
773feceb38d879b92c0e9f1fda34b3b4f482dfb3
/src/com/company/Results.java
4aef9f9145f593724e56a8235796ae92187f1dfc
[]
no_license
Hyeeun92/oop-ca-final-g3-21314-21520-21545
1da84a0afe8314fb29f0e478a8463b80ca55c432
2563f7c71e5a765ebd408d07514dfd626e99f9b4
refs/heads/master
2023-04-29T17:27:25.906468
2021-05-11T13:37:30
2021-05-11T13:37:30
350,719,981
0
1
null
null
null
null
UTF-8
Java
false
false
1,010
java
package com.company; /* 21545 - Hyeeun Lee 21520 - Liubov Eremenko 21314 - Nathalie Flores */ import javax.swing.*; import java.awt.*; public class Results extends Database { //action listener interface JFrame frame; JLabel title; public Results(){ Database db = new Database(); //List<AdmFunctions> getList = db.getList(); //create JFrame frame = new JFrame(); title = new JLabel("Student list of results",SwingConstants.CENTER); title.setBounds(0, 0, 640, 47); title.setBackground(new Color(39, 87, 144)); title.setForeground(new Color(255, 250, 224)); title.setFont(new Font("Serif", Font.ITALIC + Font.BOLD, 20)); title.setOpaque(true); /* btnChangeScreen.addActionListener(); */ frame.add(title); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(null); frame.setSize(640, 480); frame.setVisible(true); } }
9155c34fcc97885fd8bbe446a7ae5f4521951448
041e03dc14073f79360514c6f1caed04069b7227
/app/src/main/java/me/computoMovil/smartAlarm/data/preference/ThemePreferenceData.java
8df437a4320420781463a75c16ad70437cd65aaa
[ "Apache-2.0" ]
permissive
misaelastorgac/smartalarm
398bc179e40d56693d17f9ccee3d73aa054f9406
76712aa080855b6ab5a44d778e257439af2f96dc
refs/heads/master
2020-05-02T17:30:06.566487
2019-03-28T01:22:45
2019-03-28T01:22:45
178,100,503
0
0
null
null
null
null
UTF-8
Java
false
false
10,120
java
package me.computoMovil.smartAlarm.data.preference; import android.Manifest; import android.content.pm.PackageManager; import android.content.res.ColorStateList; import android.graphics.drawable.ColorDrawable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.CompoundButton; import android.widget.TextView; import com.afollestad.aesthetic.Aesthetic; import java.util.Calendar; import java.util.Date; import androidx.appcompat.widget.AppCompatCheckBox; import androidx.appcompat.widget.AppCompatSpinner; import androidx.core.content.ContextCompat; import io.reactivex.functions.Consumer; import me.computoMovil.smartAlarm.Alarmio; import me.computoMovil.smartAlarm.R; import me.computoMovil.smartAlarm.data.PreferenceData; import me.computoMovil.smartAlarm.dialogs.AestheticTimeSheetPickerDialog; import me.computoMovil.smartAlarm.utils.FormatUtils; import me.computoMovil.sunrisesunsetview.SunriseSunsetView; import me.computoMovil.timedatepickers.dialogs.PickerDialog; import me.computoMovil.timedatepickers.views.LinearTimePickerView; public class ThemePreferenceData extends BasePreferenceData<ThemePreferenceData.ViewHolder> { private static final long HOUR_LENGTH = 3600000L; public ThemePreferenceData() { } @Override public BasePreferenceData.ViewHolder getViewHolder(LayoutInflater inflater, ViewGroup parent) { return new ViewHolder(inflater.inflate(R.layout.item_preference_theme, parent, false)); } @Override public void bindViewHolder(final ViewHolder holder) { holder.themeSpinner.setAdapter(ArrayAdapter.createFromResource(holder.itemView.getContext(), R.array.array_themes, R.layout.support_simple_spinner_dropdown_item)); int theme = ((Alarmio) holder.itemView.getContext().getApplicationContext()).getActivityTheme(); holder.themeSpinner.setOnItemSelectedListener(null); holder.themeSpinner.setSelection(theme); holder.sunriseAutoSwitch.setVisibility(theme == Alarmio.THEME_DAY_NIGHT ? View.VISIBLE : View.GONE); holder.sunriseLayout.setVisibility(theme == Alarmio.THEME_DAY_NIGHT ? View.VISIBLE : View.GONE); holder.themeSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { Integer selection = null; @Override public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { if (selection != null) { PreferenceData.THEME.setValue(adapterView.getContext(), i); holder.sunriseAutoSwitch.setVisibility(i == Alarmio.THEME_DAY_NIGHT ? View.VISIBLE : View.GONE); holder.sunriseLayout.setVisibility(i == Alarmio.THEME_DAY_NIGHT ? View.VISIBLE : View.GONE); ((Alarmio) holder.itemView.getContext().getApplicationContext()).updateTheme(); } else selection = i; } @Override public void onNothingSelected(AdapterView<?> adapterView) { } }); final SunriseSunsetView.SunriseListener listener = new SunriseSunsetView.SunriseListener() { @Override public void onSunriseChanged(SunriseSunsetView sunriseSunsetView, long l) { int hour = Math.round((float) l / HOUR_LENGTH); holder.sunriseTextView.setText(getText(hour)); sunriseSunsetView.setSunrise(hour * HOUR_LENGTH, true); PreferenceData.DAY_START.setValue(holder.getContext(), hour); holder.getAlarmio().updateTheme(); } @Override public void onSunsetChanged(SunriseSunsetView sunriseSunsetView, long l) { int hour = Math.round((float) l / HOUR_LENGTH); holder.sunsetTextView.setText(getText(hour)); sunriseSunsetView.setSunset(hour * HOUR_LENGTH, true); PreferenceData.DAY_END.setValue(holder.getContext(), hour); holder.getAlarmio().updateTheme(); } private String getText(int hour) { Calendar cal = Calendar.getInstance(); cal.set(Calendar.HOUR_OF_DAY, hour); cal.set(Calendar.MINUTE, 0); return FormatUtils.formatShort(holder.getContext(), new Date(cal.getTimeInMillis())); } }; holder.sunriseAutoSwitch.setOnCheckedChangeListener(null); holder.sunriseAutoSwitch.setChecked(holder.getAlarmio().isDayAuto()); holder.sunriseAutoSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean b) { PreferenceData.DAY_AUTO.setValue(holder.getContext(), b); if (b && ContextCompat.checkSelfPermission(holder.getContext(), Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { holder.getAlarmio().requestPermissions(Manifest.permission.ACCESS_COARSE_LOCATION); holder.sunriseAutoSwitch.setChecked(false); } else { listener.onSunriseChanged(holder.sunriseView, holder.getAlarmio().getDayStart() * HOUR_LENGTH); listener.onSunsetChanged(holder.sunriseView, holder.getAlarmio().getDayEnd() * HOUR_LENGTH); } } }); listener.onSunriseChanged(holder.sunriseView, holder.getAlarmio().getDayStart() * HOUR_LENGTH); listener.onSunsetChanged(holder.sunriseView, holder.getAlarmio().getDayEnd() * HOUR_LENGTH); holder.sunriseView.setListener(new SunriseSunsetView.SunriseListener() { @Override public void onSunriseChanged(SunriseSunsetView sunriseSunsetView, long l) { holder.sunriseAutoSwitch.setChecked(false); listener.onSunriseChanged(sunriseSunsetView, l); } @Override public void onSunsetChanged(SunriseSunsetView sunriseSunsetView, long l) { holder.sunriseAutoSwitch.setChecked(false); listener.onSunsetChanged(sunriseSunsetView, l); } }); holder.sunriseTextView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { new AestheticTimeSheetPickerDialog(view.getContext(), holder.getAlarmio().getDayStart(), 0) .setListener(new PickerDialog.OnSelectedListener<LinearTimePickerView>() { @Override public void onSelect(PickerDialog<LinearTimePickerView> dialog, LinearTimePickerView view) { holder.sunriseAutoSwitch.setChecked(false); if (view.getHourOfDay() < holder.getAlarmio().getDayEnd()) listener.onSunriseChanged(holder.sunriseView, view.getHourOfDay() * HOUR_LENGTH); } @Override public void onCancel(PickerDialog<LinearTimePickerView> dialog) { } }) .show(); } }); holder.sunsetTextView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { new AestheticTimeSheetPickerDialog(view.getContext(), holder.getAlarmio().getDayEnd(), 0) .setListener(new PickerDialog.OnSelectedListener<LinearTimePickerView>() { @Override public void onSelect(PickerDialog<LinearTimePickerView> dialog, LinearTimePickerView view) { holder.sunriseAutoSwitch.setChecked(false); if (view.getHourOfDay() > holder.getAlarmio().getDayStart()) listener.onSunsetChanged(holder.sunriseView, view.getHourOfDay() * HOUR_LENGTH); } @Override public void onCancel(PickerDialog<LinearTimePickerView> dialog) { } }).show(); } }); Aesthetic.Companion.get() .textColorSecondary() .take(1) .subscribe(new Consumer<Integer>() { @Override public void accept(Integer textColorSecondary) throws Exception { holder.themeSpinner.setSupportBackgroundTintList(ColorStateList.valueOf(textColorSecondary)); } }); Aesthetic.Companion.get() .colorCardViewBackground() .take(1) .subscribe(new Consumer<Integer>() { @Override public void accept(Integer colorForeground) throws Exception { holder.themeSpinner.setPopupBackgroundDrawable(new ColorDrawable(colorForeground)); } }); } public static class ViewHolder extends BasePreferenceData.ViewHolder { private AppCompatSpinner themeSpinner; private AppCompatCheckBox sunriseAutoSwitch; private View sunriseLayout; private SunriseSunsetView sunriseView; private TextView sunriseTextView; private TextView sunsetTextView; public ViewHolder(View v) { super(v); themeSpinner = v.findViewById(R.id.themeSpinner); sunriseAutoSwitch = v.findViewById(R.id.sunriseAutoSwitch); sunriseLayout = v.findViewById(R.id.sunriseLayout); sunriseView = v.findViewById(R.id.sunriseView); sunriseTextView = v.findViewById(R.id.sunriseTextView); sunsetTextView = v.findViewById(R.id.sunsetTextView); } } }
32c3a15747d1702e7956f09ea59fa08aa313382a
bf84d65cccc368afcd68adebfbfe5c2d53bf452e
/CursoUdemy/src/herancaepolimorfismo/sobreposicao/SavingsAccount.java
5a44cfa5f8e30f7fe2aebd10273ee95746195704
[]
no_license
joseeduardoleite/udemy-java-course
c0ee941b2b449782fd489ffcd92c220b5b6029ff
26ec392c3d8b910c394b7bf32aa1a52e6643d051
refs/heads/master
2023-08-22T05:02:55.181423
2021-09-30T23:23:44
2021-09-30T23:23:44
390,733,167
0
0
null
null
null
null
UTF-8
Java
false
false
635
java
package herancaepolimorfismo.sobreposicao; public class SavingsAccount extends Account { private Double interestRate; public SavingsAccount() { super(); } public SavingsAccount(Integer number, String holder, Double balance, Double interestRate) { super(number, holder, balance); this.interestRate = interestRate; } public Double getInterestRate() { return interestRate; } public void setInterestRate(Double interestRate) { this.interestRate = interestRate; } public void updateBalance() { balance += balance * interestRate; } @Override public void withdraw(double amount) { balance -= amount; } }
81570448d92412fd78f5d03c829c43c41c1e945b
bf7e68f504d1f4e1a8a1ee94f5856575dcfd5e1c
/src/java/longpt/tblroom/TblRoomDTO.java
fd5304ab3b020aed8bff83de562f36bd5973349a
[]
no_license
redore1234/J3.L.P0003_BookHotelOnline
66695f2bc146da3ef3dd1d61f76fc2231e1971c0
d750de0f56c35ba25ddd17394d567fcaf880f664
refs/heads/master
2023-02-04T08:43:19.655952
2020-12-25T09:11:22
2020-12-25T09:11:22
321,543,816
0
1
null
null
null
null
UTF-8
Java
false
false
1,370
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package longpt.tblroom; import java.io.Serializable; /** * * @author phamt */ public class TblRoomDTO implements Serializable { private int roomId; private String typeId; private String image; private double price; public TblRoomDTO() { } public TblRoomDTO(int roomId, String typeId, double price) { this.roomId = roomId; this.typeId = typeId; this.price = price; } public TblRoomDTO(int roomId, String typeId, String image, double price) { this.roomId = roomId; this.typeId = typeId; this.image = image; this.price = price; } public int getRoomId() { return roomId; } public void setRoomId(int roomId) { this.roomId = roomId; } public String getTypeId() { return typeId; } public void setTypeId(String typeId) { this.typeId = typeId; } public String getImage() { return image; } public void setImage(String image) { this.image = image; } public double getPrice() { return price; } public void setPrice(double price) { this.price = price; } }
2d9cefaef65c4db0077c8ed1c524a8bf4ca7aed9
171944de8491b52797a2445132c1321e2fd2b5c8
/src/StrategyPtn/Hand.java
29b1086ccbcefcf3bf879b0ffca7425851cdca79
[]
no_license
treetrunks2/designPatternStudy
7c46f496c9499feece41e2b7a14d19508bd4d970
fc3d8520c7428ce811dafc5ffc39417e0e1b2c4d
refs/heads/master
2022-07-30T21:43:33.514811
2020-01-05T13:46:41
2020-01-05T13:46:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,196
java
package StrategyPtn; public class Hand { public static final int HANDVALUE_ROCK = 0; public static final int HANDVALUE_SISSER = 1; public static final int HANDVALUE_PAPER = 2; public static final Hand[] hand = { new Hand(HANDVALUE_ROCK), new Hand(HANDVALUE_SISSER), new Hand(HANDVALUE_PAPER) }; private static final String[] name = { "가위", "바위", "보" }; private int handvalue; private Hand(int handvalue) { this.handvalue = handvalue; } public static Hand getHand(int handvalue) { return hand[handvalue]; } public boolean isStrongerThan(Hand h) { return fight(h) == 1; } public boolean isWeakerThan(Hand h) { return fight(h) == -1; } private int fight(Hand h) { if (this == h) //인스턴스가 3개만 만들어지기 떄문에 굳이 value값을 비교하지않아도 인스턴스로 비교해도됨 return 0; else if ((this.handvalue + 1) % 3 == h.handvalue) return 1; else return -1; } public String toString() { return name[handvalue]; } }
40dc3b46fb15b6e6b486d01a1ab739fbb334a7c1
28763c3d0bee63ad4d8bab5db5025e4aa82f8c56
/n26/src/main/java/com/n26/statistic/model/Statistic.java
1242fc027311a11fd40c5b8c45786b37127727de
[]
no_license
jobandosanjh/Assignment
82267be389d6d0215d5c1c74f30d74f0c5d70197
82e095f64efb8455fbe388c96da95919f797cf3f
refs/heads/master
2020-03-17T03:39:51.493874
2018-05-13T14:41:54
2018-05-13T14:41:54
133,245,142
0
0
null
null
null
null
UTF-8
Java
false
false
1,479
java
package com.n26.statistic.model; /** * Entity to hold data related to transaction statistics. This model is mainly used for the communication between * different layers of the application. * * @author jobanpreetsingh * */ public class Statistic { private double sum; private double avg; private double max; private double min; private long count; public Statistic() { this.max = Double.MIN_VALUE; this.min = Double.MAX_VALUE; } public double getSum() { return this.sum; } public void setSum(final double sum) { this.sum = sum; } public double getAvg() { this.avg = this.count == 0 ? 0 : this.sum / this.count; return this.avg; } public double getMax() { return this.count == 0 ? 0 : this.max; } public void setMax(final double max) { this.max = max; } public double getMin() { return this.count == 0 ? 0 : this.min; } public void setMin(final double min) { this.min = min; } public long getCount() { return this.count; } public void setCount(final long count) { this.count = count; } @Override public String toString() { return "Statistic [sum=" + this.sum + ", avg=" + this.avg + ", max=" + this.max + ", min=" + this.min + ", count=" + this.count + "]"; } }
ec0916967aed46047eb7ed2bf724ccd3a89f8fef
160d4aeeacd7a53133e1d6bc13388e4f488fc9a4
/src/com/braveway/recursion/Queen8.java
7db0b3ab4ff0d087d2d20374e40be29b899e5f87
[]
no_license
BraveWay/DataStructures
d0bd49b75854965744c7077069827092c2472d79
60d1d0b6719a756dd0ca4c5fee0d67a8c0049ce8
refs/heads/master
2023-03-08T03:47:13.354168
2021-02-25T12:06:42
2021-02-25T12:06:42
326,003,629
1
0
null
null
null
null
GB18030
Java
false
false
1,074
java
package com.braveway.recursion; public class Queen8 { static int max = 8; static int[] array = new int[max]; static int count = 0; public static void main(String[] args) { check(0); System.out.println("死亡八皇后共有"+count+"种解法"); } public static void check(int n) { if(n == 8) { count++; print(); return ; }else { for(int i=0;i<max;i++) { array[n] = i; if(judge(n)) { check(n+1); } } } } /** * 判断第n个皇后所在的位置是否与 * 前面所有的皇后在同一列,或者斜线上 * @param n * @return */ public static boolean judge(int n) { for(int i=0;i<n;i++) { /** * array[i] == array[n] 表示同一列 * Math.abs(n-i) == Math.abs(array[n]-array[i]) 行值等于列值,即同一条斜线上 */ if(array[i] == array[n] || Math.abs(n-i) == Math.abs(array[n]-array[i])) { return false; } } return true; } public static void print() { for(int i =0;i<array.length;i++) { System.out.print(array[i]+" "); } System.out.println(); } }
1f8f5d7033c34059a52f0a5a588e65818592749a
ee215f5e8bd16ebbad2394d3923ad0dfbae39699
/EveryHour/src/ty/pas/analy/GetType.java
aaea7866c240a9f0e5504072520975c8f0a6ceef
[]
no_license
gting/CodeAlgo
e568c16062712842c4756256b3c2785958c59d8b
101ba29cb4eb8e7aaf96d94d9d7e486d3bab1248
refs/heads/master
2020-04-10T20:59:12.922735
2018-12-11T05:41:12
2018-12-11T05:41:12
161,283,502
0
0
null
null
null
null
UTF-8
Java
false
false
202
java
package ty.pas.analy; public class GetType { public static String getType(Object o){ //获取变量类型方法 return o.getClass().toString(); //使用int类型的getClass()方法 } }
ae50a3e177457d6963af3f3a4780a25fb961be72
a847139275b42a55a76c6f1ddc1c352340a0e355
/src/com/googol24/java/thread/TestProducerConsumer2.java
6a06d5d5e56038bb8ea70755cebdca219c7b519c
[ "MIT" ]
permissive
googol24/javase
484dda5ea800f019f22c284699277231a8a8ad72
72c4b2b0382c748cdbdb03153c03bbe5cfb965c2
refs/heads/master
2021-11-08T07:31:54.728220
2021-10-31T13:44:05
2021-10-31T13:44:05
228,348,858
0
1
null
null
null
null
UTF-8
Java
false
false
3,267
java
package com.googol24.java.thread; import java.util.*; /** * 生产者消费者问题2 * * 多个生产者和多个消费者的情形 */ public class TestProducerConsumer2 { public static void main(String[] args) { Storage storage = new Storage(); Thread pThread1 = new Thread(new Producer2(storage));pThread1.setName("pThread1"); Thread pThread2 = new Thread(new Producer2(storage));pThread2.setName("pThread2"); Thread pThread3 = new Thread(new Producer2(storage));pThread3.setName("pThread3"); Thread cThread1 = new Thread(new Consumer2(storage));cThread1.setName("cThread1"); Thread cThread2 = new Thread(new Consumer2(storage));cThread2.setName("cThread2"); Thread cThread3 = new Thread(new Consumer2(storage));cThread3.setName("cThread3"); pThread1.start(); pThread2.start(); pThread3.start(); cThread1.start(); cThread2.start(); cThread3.start(); } } class Storage { // 仓库容量 private static final int MAX_SIZE = 10; // 仓库存储的载体 private final LinkedList<Object> list = new LinkedList<>(); // 向仓库中生产产品 void produce() { synchronized (list) { while (list.size() + 1 > MAX_SIZE) { System.out.println("【生产者" + Thread.currentThread().getName() + "】仓库已满"); try { list.wait(); } catch (InterruptedException e) { e.printStackTrace(); } } list.add(new Object()); System.out.println("【生产者" + Thread.currentThread().getName() + "】生产一个产品,现库存" + list.size()); list.notifyAll(); } } // 从仓库中消费产品 void consume() { synchronized (list) { while (list.size() == 0) { System.out.println("【消费者" + Thread.currentThread().getName() + "】仓库为空"); try { list.wait(); } catch (InterruptedException e) { e.printStackTrace(); } } list.remove(); System.out.println("【消费者" + Thread.currentThread().getName() + "】消费一个产品,现库存" + list.size()); list.notifyAll(); } } } /** * 生产者 */ class Producer2 implements Runnable { private Storage storage; Producer2(Storage storage) { this.storage = storage; } @Override public void run() { while (true) { try { Thread.sleep(1000); storage.produce(); } catch (InterruptedException e) { e.printStackTrace(); } } } } /** * 消费者 */ class Consumer2 implements Runnable { private Storage storage; Consumer2(Storage storage) { this.storage = storage; } @Override public void run() { while (true) { try { Thread.sleep(1000); storage.consume(); } catch (InterruptedException e) { e.printStackTrace(); } } } }
bfcf17dfa689efca8776ee05b828bb759ebd294a
36c29f9c676b6f41585f432419a0584b2ac813cb
/146Notes/src/test.java
474e405a24436775108a96b693c6b1d3c3e70419
[]
no_license
KdrainEE/Old-CS-Projects
116d4c12a8827a3d8fcb3e4909eb590151c403f3
bcc675e5589d7a02839035f469f7ae7bb3b6cdd3
refs/heads/master
2021-01-12T10:31:34.363815
2017-02-11T15:09:26
2017-02-11T15:09:26
76,472,873
0
0
null
null
null
null
UTF-8
Java
false
false
438
java
public class test { public static void main(String[] args) { // TODO Auto-generated method stub int[] a = {0,1,2,3,4,5,6,7,8,9}; recur(a); } public static void recur(int[] a){ int size = a.length; int mid = size/2; System.out.println(mid); System.out.println(a[mid]); if (size>1){ int[] b = new int[mid]; for(int i=0;i<mid;i++){ b[i] = a[mid+i]*10; } recur(b); } } }
60253a9b037fc852a54349683c8cab66d9c907df
13cbb329807224bd736ff0ac38fd731eb6739389
/org/w3c/dom/traversal/NodeIterator.java
def4763509ce82f13c185a1b00d189bccb16a6d0
[]
no_license
ZhipingLi/rt-source
5e2537ed5f25d9ba9a0f8009ff8eeca33930564c
1a70a036a07b2c6b8a2aac6f71964192c89aae3c
refs/heads/master
2023-07-14T15:00:33.100256
2021-09-01T04:49:04
2021-09-01T04:49:04
401,933,858
0
0
null
null
null
null
UTF-8
Java
false
false
462
java
package org.w3c.dom.traversal; import org.w3c.dom.Node; public interface NodeIterator { Node getRoot(); int getWhatToShow(); NodeFilter getFilter(); boolean getExpandEntityReferences(); Node nextNode(); Node previousNode(); void detach(); } /* Location: D:\software\jd-gui\jd-gui-windows-1.6.3\rt.jar!\org\w3c\dom\traversal\NodeIterator.class * Java compiler version: 8 (52.0) * JD-Core Version: 1.0.7 */
e047bbb95dceeb3055024452cbe4edd909da4ef8
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/7/7_c9d0fb6791c2e36b55094147aec9900fc52a8ab5/CommandProcessor/7_c9d0fb6791c2e36b55094147aec9900fc52a8ab5_CommandProcessor_t.java
958d89f6250355326c79b1f51de84bba52034cfb
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
8,599
java
/** * Copyright (c) 2012 Daniele Pantaleone, Mathias Van Malderen * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * * @author Mathias Van Malderen, Daniele Pantaleone * @version 1.1 * @copyright Mathias Van Malderen, 04 February, 2012 * @package com.orion.utility **/ package com.orion.utility; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.concurrent.BlockingQueue; import org.apache.commons.logging.Log; import com.orion.annotation.Usage; import com.orion.bot.Orion; import com.orion.command.Command; import com.orion.command.RegisteredCommand; import com.orion.console.Console; import com.orion.exception.CommandRuntimeException; import com.orion.exception.CommandSyntaxException; import com.orion.plugin.Plugin; import com.orion.urt.Color; public class CommandProcessor implements Runnable { private final Log log; private final Console console; private BlockingQueue<Command> commandqueue; private MultiKeyMap<String, String, RegisteredCommand> regcommands; /** * Object constructor * * @author Mathias Van Malderen, Daniele Pantaleone * @param orion <tt>Orion</tt> object reference **/ public CommandProcessor(Orion orion) { this.log = orion.log; this.console = orion.console; this.commandqueue = orion.commandqueue; this.regcommands = orion.regcommands; // Printing some info in the log. this.log.debug("Command processor initialized [ commands : " + this.regcommands.getMap1().size() + " | buffer : " + (this.commandqueue.remainingCapacity() + this.commandqueue.size()) + " ]"); } /** * Runnable implementation<br> * Will iterate through all the events stored by the parser in the * command queue. It peeks a command from the queue and process it over * all the mapped Methods retrieved from the registered command map * * @author Mathias Van Malderen, Daniele Pantaleone **/ @Override public void run() { // Notifying Thread start in the log file this.log.debug("Starting command processor [ systime : " + System.currentTimeMillis() + " ]"); while (true) { try { Command command = this.commandqueue.take(); // If the thread was interrupted, then the event won't be processed // We'll notify it with an Exception so we can break the while cycle // and gracefully stop the running thread if (Thread.interrupted()) throw new InterruptedException(); // Checking for a match in the HashMap. if (!this.regcommands.containsKey(command.handle)) { // Informing the client that the command is not mapped this.console.tell(command.client, "Unable to find command: " + Color.YELLOW + command.prefix.name + Color.RED + command.handle); continue; } // Retrieving the correct RegisteredCommand from the HashMap RegisteredCommand regcommand = this.regcommands.get(command.handle); // Checking correct client minLevel if ((command.client.getGroup().getLevel() < regcommand.minGroup.getLevel()) && (!command.force)) { // Informing the client that he has not sufficient access for this command this.console.tell(command.client, "You have no sufficient access: " + Color.YELLOW + command.prefix.name + Color.RED + command.handle); continue; } try { Method method = regcommand.method; Plugin plugin = regcommand.plugin; // Discard if disabled if (!plugin.isEnabled()) { // Informing the client that the plugin is disabled this.console.tell(command.client, "Unable to execute command " + Color.YELLOW + command.prefix.name + command.handle + ": " + Color.RED + "plugin disabled"); continue; } try { // Executing the command. If the command syntax is invalid, // a CommandRuntimeException will be raised, but it will be // incapsulated into an InvocationTargetException object. method.invoke(plugin, command); } catch (InvocationTargetException e) { if (e.getCause().getClass().equals(CommandRuntimeException.class)) { // Displaying the error in the game chat this.console.tell(command.client, e.getCause().getMessage()); } else if (e.getCause().getClass().equals(CommandSyntaxException.class)) { // Display a little help text so the user can // try again using the correct command syntax Usage usage = method.getAnnotation(Usage.class); this.console.tell(command.client, e.getCause().getMessage()); this.console.tell(command.client, "Usage: " + Color.YELLOW + usage.syntax()); continue; } else { // Informing the client of the Exception and log it. We'll keep processing anyway... this.console.tell(command.client, "There was an error processing your command"); this.log.error("[" + regcommand.plugin.getClass().getSimpleName() + "] Unable to process command " + command.prefix.name + command.handle, e); continue; } } } catch (IllegalAccessException | IllegalArgumentException e) { // Informing the client of the Exception and log it. We'll keep processing anyway... this.console.tell(command.client, "There was an error processing your command"); this.log.error("[" + regcommand.plugin.getClass().getSimpleName() + "] Unable to process command " + command.prefix.name + command.handle, e); continue; } } catch (InterruptedException e) { // Thread has received interrupt signal. // Breaking the cycle so it will terminate. break; } } // Notify that the thread is shutting down. this.log.debug("Stopping command processor [ systime : " + System.currentTimeMillis() + " ]"); } }
ce5d7430f93477f11e700655a5051c38ef01c2b6
0fe0fdce7c3f1e0f210b6ad6a121847fc942d97c
/src/main/java/com/alipay/api/response/AlipayEcoEduKtStudentQueryResponse.java
8c009605cb82c5afe4ba64ee248ff36ace869abb
[ "Apache-2.0" ]
permissive
rico-bee/alipay-sdk
d9f6d9d481a0e2fbdf17aa61e37335281597d02f
1386001bb496ab0e5dfe0c2455ed06a38d1799e6
refs/heads/master
2021-04-09T15:50:59.171276
2018-03-04T04:44:29
2018-03-04T04:44:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,951
java
package com.alipay.api.response; import java.util.List; import com.alipay.api.internal.mapping.ApiField; import com.alipay.api.internal.mapping.ApiListField; import com.alipay.api.domain.UserDetails; import com.alipay.api.AlipayResponse; /** * ALIPAY API: alipay.eco.edu.kt.student.query response. * * @author auto create * @since 1.0, 2017-08-14 11:04:55 */ public class AlipayEcoEduKtStudentQueryResponse extends AlipayResponse { private static final long serialVersionUID = 1777155923731618163L; /** * 学生姓名 */ @ApiField("child_name") private String childName; /** * 班级名字 */ @ApiField("class_name") private String className; /** * 学校名称 */ @ApiField("school_name") private String schoolName; /** * 学生编号 */ @ApiField("student_code") private String studentCode; /** * 学生身份证 */ @ApiField("student_identify") private String studentIdentify; /** * 家长信息 */ @ApiListField("users") @ApiField("user_details") private List<UserDetails> users; public void setChildName(String childName) { this.childName = childName; } public String getChildName( ) { return this.childName; } public void setClassName(String className) { this.className = className; } public String getClassName( ) { return this.className; } public void setSchoolName(String schoolName) { this.schoolName = schoolName; } public String getSchoolName( ) { return this.schoolName; } public void setStudentCode(String studentCode) { this.studentCode = studentCode; } public String getStudentCode( ) { return this.studentCode; } public void setStudentIdentify(String studentIdentify) { this.studentIdentify = studentIdentify; } public String getStudentIdentify( ) { return this.studentIdentify; } public void setUsers(List<UserDetails> users) { this.users = users; } public List<UserDetails> getUsers( ) { return this.users; } }
1e09f6743762baf3bd0bedb89f3c466db1a05ad3
eec8d730de131e6ec64dc89ccb2663f3ee96739c
/src/ScanerSwitch.java
49741b23a54e2e390f8c446f9c37c661ee63ddee
[]
no_license
KucherenkoDmt/TestLocal
1abe2979761289ea17c264a4273489c5a74f6e47
e1b28d48708041a0bcebcd2c4cd60864b9b04850
refs/heads/master
2021-04-27T17:26:14.365279
2018-02-22T16:03:04
2018-02-22T16:03:04
122,321,997
0
0
null
null
null
null
UTF-8
Java
false
false
1,012
java
import java.util.Scanner; public class ScanerSwitch { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Введи возраст"); int age = scanner.nextInt(); switch (age){ case 0: System.out.println("ты родился"); break; case 7: System.out.println("ты пошел в школу"); break; case 18: System.out.println("ты закончил школу"); break; default: System.out.println("ничего нет"); } } } /* BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in)); String day = bufferedReader.readLine(4); int d = Integer.parseInt(day); */ //BufferedReader bf = new BufferedReader(InputStreamReader(System.in)); // int i = Integer.parseInt(bf.readLine());
de8c0358b45725b70e381a5bc9e31ca063018723
8bf0e17e2c3439307c4c2a61c7a5ab2c4ef36eed
/bseries/server/dbmodel/B6DSLServiceSpecificDetails.java
7525c7902a68e9b634e4e83dfd8ff71840646be5
[]
no_license
flybetter/workflow
4514400e5ee02d55d8c8c36c9a9871228d7bd3d6
3622cea99fc447264eeb24498ceba17df538bdc7
refs/heads/master
2021-08-29T23:24:26.702647
2017-12-15T08:26:03
2017-12-15T08:26:03
114,345,570
0
0
null
null
null
null
UTF-8
Java
false
false
12,816
java
/* * $Id$ */ package com.calix.bseries.server.dbmodel; //---------------------------------/ //- Imported classes and packages -/ //BEGIN IMPORTS import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import com.calix.ems.database.C7Database; import com.calix.ems.database.DbTransaction; import com.calix.ems.exception.EMSDatabaseException; import com.calix.ems.exception.EMSException; import com.calix.ems.query.EMSGetAllQuery; import com.calix.ems.query.ICMSQuery; import com.calix.system.common.log.Log; //END IMPORTS //---------------------------------/ import com.calix.ems.util.TLVHelper; import com.calix.system.common.protocol.tlv.TLV; import com.calix.system.server.dbmodel.*; import com.calix.system.server.dbmodel.ICMSAid; /** * Class B6DSLServiceSpecificDetails. * * @version $Revision$ $Date$ */ public class B6DSLServiceSpecificDetails extends com.calix.system.server.dbmodel.CMSObject { //--------------------------/ //- Class/Member Variables -/ //--------------------------/ /** * Field m_bondDescription */ public String m_bondDescription; /** * Field m_bondedPorts */ public String m_bondedPorts; /** * Field m_dsBitRate_DSLService */ public Integer m_dsBitRate_DSLService; /** * Field m_dslProfileName */ public String m_dslProfileName; /** * Field m_id */ public com.calix.system.server.dbmodel.ICMSAid m_id; /** * Field m_serviceIdentifier */ public Integer m_serviceIdentifier; /** * Field m_usBitRate_DSLService */ public Integer m_usBitRate_DSLService; /** * Field TYPE_NAME */ public static String TYPE_NAME = "B6DSLServiceSpecificDetails"; /** * Field flowID */ public static final int flowID = 1; //----------------/ //- Constructors -/ //----------------/ public B6DSLServiceSpecificDetails() { super(); } //-- com.calix.bseries.server.dbmodel.B6DSLServiceSpecificDetails() //-----------/ //- Methods -/ //-----------/ /** * Method copyFields * * @param obj1 */ protected void copyFields(CMSObject obj1) { if( obj1 instanceof B6DSLServiceSpecificDetails ) { super.copyFields(obj1); B6DSLServiceSpecificDetails obj = (B6DSLServiceSpecificDetails)obj1; setbondDescription((String)Helper.copy(obj.getbondDescription())); setbondedPorts((String)Helper.copy(obj.getbondedPorts())); setdsBitRate_DSLService((Integer)Helper.copy(obj.getdsBitRate_DSLService())); setdslProfileName((String)Helper.copy(obj.getdslProfileName())); setid((com.calix.system.server.dbmodel.ICMSAid)Helper.copy(obj.getid())); setserviceIdentifier((Integer)Helper.copy(obj.getserviceIdentifier())); setusBitRate_DSLService((Integer)Helper.copy(obj.getusBitRate_DSLService())); setIdentityValue((com.calix.system.server.dbmodel.ICMSAid)Helper.copy(obj.getIdentityValue())); } } //-- void copyFields(CMSObject) /** * Method getIdentityValue */ public com.calix.system.server.dbmodel.ICMSAid getIdentityValue() { return this.m_id; } //-- com.calix.system.server.dbmodel.ICMSAid getIdentityValue() /** * Method getTlvType */ public int getTlvType() { return BseriesTlvConstants.B6DSLServiceSpecificDetails; } //-- int getTlvType() /** * Method getTypeName */ public String getTypeName() { return TYPE_NAME; } //-- String getTypeName() /** * Method getbondDescription */ public String getbondDescription() { return this.m_bondDescription; } //-- String getbondDescription() /** * Method getbondedPorts */ public String getbondedPorts() { return this.m_bondedPorts; } //-- String getbondedPorts() /** * Method getdsBitRate_DSLService */ public Integer getdsBitRate_DSLService() { return this.m_dsBitRate_DSLService; } //-- Integer getdsBitRate_DSLService() /** * Method getdslProfileName */ public String getdslProfileName() { return this.m_dslProfileName; } //-- String getdslProfileName() /** * Method getid */ public com.calix.system.server.dbmodel.ICMSAid getid() { return this.m_id; } //-- com.calix.system.server.dbmodel.ICMSAid getid() /** * Method getserviceIdentifier */ public Integer getserviceIdentifier() { return this.m_serviceIdentifier; } //-- Integer getserviceIdentifier() /** * Method getusBitRate_DSLService */ public Integer getusBitRate_DSLService() { return this.m_usBitRate_DSLService; } //-- Integer getusBitRate_DSLService() /** * Method populateAttributeFromTLV * * @param tlv * @param from_version */ public void populateAttributeFromTLV(TLV tlv, SwVersionNo from_version) { if (tlv == null) return; switch (tlv.getType()) { case 0x343E: if (m_serviceIdentifier == null) { m_serviceIdentifier = TLVHelper.getIntegerValueOfTLV(tlv ); return; } break; case 0x343F: if (m_bondedPorts == null) { m_bondedPorts = TLVHelper.getStringValueOfTLV(tlv ); return; } break; case 0x3440: if (m_bondDescription == null) { m_bondDescription = TLVHelper.getStringValueOfTLV(tlv ); return; } break; case 0x3441: if (m_dsBitRate_DSLService == null) { m_dsBitRate_DSLService = TLVHelper.getIntegerValueOfTLV(tlv ); return; } break; case 0x3442: if (m_usBitRate_DSLService == null) { m_usBitRate_DSLService = TLVHelper.getIntegerValueOfTLV(tlv ); return; } break; case 0x3443: if (m_dslProfileName == null) { m_dslProfileName = TLVHelper.getStringValueOfTLV(tlv ); return; } break; } super.populateAttributeFromTLV(tlv, from_version); } //-- void populateAttributeFromTLV(TLV, SwVersionNo) /** * Method populateTLVFromAttributes * * @param tlv * @param to_version */ public void populateTLVFromAttributes(TLV tlv, SwVersionNo to_version) { if (tlv == null) return; super.populateTLVFromAttributes(tlv, to_version); TLVHelper.addEmbeddedTLV(tlv, 0x3440, m_bondDescription); TLVHelper.addEmbeddedTLV(tlv, 0x343F, m_bondedPorts); TLVHelper.addEmbeddedTLV(tlv, 0x3441, m_dsBitRate_DSLService); TLVHelper.addEmbeddedTLV(tlv, 0x3443, m_dslProfileName); TLVHelper.addEmbeddedTLV(tlv, 0x343E, m_serviceIdentifier); TLVHelper.addEmbeddedTLV(tlv, 0x3442, m_usBitRate_DSLService); } //-- void populateTLVFromAttributes(TLV, SwVersionNo) /** * Method setIdentityValue * * @param id */ public boolean setIdentityValue(com.calix.system.server.dbmodel.ICMSAid id) { this.m_id = (com.calix.system.server.dbmodel.ICMSAid)id; return true; } //-- boolean setIdentityValue(com.calix.system.server.dbmodel.ICMSAid) /** * Method setTypeName * * @param typeName */ public boolean setTypeName(String typeName) { return false; } //-- boolean setTypeName(String) /** * Method setbondDescription * * @param bondDescription */ public void setbondDescription(String bondDescription) { this.m_bondDescription = bondDescription; } //-- void setbondDescription(String) /** * Method setbondedPorts * * @param bondedPorts */ public void setbondedPorts(String bondedPorts) { this.m_bondedPorts = bondedPorts; } //-- void setbondedPorts(String) /** * Method setdsBitRate_DSLService * * @param dsBitRate_DSLService */ public void setdsBitRate_DSLService(Integer dsBitRate_DSLService) { this.m_dsBitRate_DSLService = dsBitRate_DSLService; } //-- void setdsBitRate_DSLService(Integer) /** * Method setdslProfileName * * @param dslProfileName */ public void setdslProfileName(String dslProfileName) { this.m_dslProfileName = dslProfileName; } //-- void setdslProfileName(String) /** * Method setid * * @param id */ public void setid(com.calix.system.server.dbmodel.ICMSAid id) { this.m_id = id; } //-- void setid(com.calix.system.server.dbmodel.ICMSAid) /** * Method setserviceIdentifier * * @param serviceIdentifier */ public void setserviceIdentifier(Integer serviceIdentifier) { this.m_serviceIdentifier = serviceIdentifier; } //-- void setserviceIdentifier(Integer) /** * Method setusBitRate_DSLService * * @param usBitRate_DSLService */ public void setusBitRate_DSLService(Integer usBitRate_DSLService) { this.m_usBitRate_DSLService = usBitRate_DSLService; } //-- void setusBitRate_DSLService(Integer) /** * Method updateFields * * @param obj1 */ protected void updateFields(CMSObject obj1) { if( obj1 instanceof B6DSLServiceSpecificDetails ) { super.updateFields(obj1); B6DSLServiceSpecificDetails obj = (B6DSLServiceSpecificDetails)obj1; if (obj.getbondDescription() != null ) setbondDescription((String)Helper.copy(obj.getbondDescription())); if (obj.getbondedPorts() != null ) setbondedPorts((String)Helper.copy(obj.getbondedPorts())); if (obj.getdsBitRate_DSLService() != null ) setdsBitRate_DSLService((Integer)Helper.copy(obj.getdsBitRate_DSLService())); if (obj.getdslProfileName() != null ) setdslProfileName((String)Helper.copy(obj.getdslProfileName())); if (obj.getid() != null ) setid((com.calix.system.server.dbmodel.ICMSAid)Helper.copy(obj.getid())); if (obj.getserviceIdentifier() != null ) setserviceIdentifier((Integer)Helper.copy(obj.getserviceIdentifier())); if (obj.getusBitRate_DSLService() != null ) setusBitRate_DSLService((Integer)Helper.copy(obj.getusBitRate_DSLService())); if (obj.getIdentityValue() != null ) setIdentityValue((com.calix.system.server.dbmodel.ICMSAid)Helper.copy(obj.getIdentityValue())); } } //-- void updateFields(CMSObject) //BEGIN CODE public void setconvertId(Integer id) { this.m_id = new BSeriesAid(String.valueOf(id)); } // -- void setconvertName(String) public Integer getconvertId() { return Integer.valueOf(this.m_id.toString()); } public Collection doQuery(DbTransaction tx, String filter) throws EMSException { if (Log.db().isDebugEnabled()) Log.db().debug("Inside doQuery"); ICMSQuery query = getDBQuery(this.getTypeName(), null); Collection coll = query.exec((Object) tx.getDatabase(), (Object) tx); if (Log.db().isDebugEnabled()) Log.db().debug("Out of doQuery"); return coll; } public CMSObject doLoad(DbTransaction tx) throws EMSException { C7Database db =C7Database.getInstance(); CMSObject obj = null; try{ db.beginTransaction(); Collection resultList = db.executeQuery(this.getClass(), "id = "+this.getIdentityValue().toString(), -1, -1); if(resultList != null&&!resultList.isEmpty()){ Iterator itr = resultList.iterator(); obj = (CMSObject)itr.next(); } }catch(Exception e){ e.printStackTrace(); db.close(); } finally{ db.close(); } if(obj == null) throw new EMSDatabaseException(EMSDatabaseException._loadNonExistentFail_, "Object does not exist"); else return obj; } public ICMSQuery getDBQuery(String type, String filter) { if (filter == null || filter.equals("")) return new EMSGetAllQuery(type); else { Log.meta().error("BaseEMSObject: filterQuery is not supported"); return null; } } public boolean isIdentityValuePrimaryKey() { return true; } //END CODE }
a79f9e3294d525569e00ceaa057f3d6b873db962
febdc543d531ddbb6210ef91b1206a9459aaeac0
/workspace/Bubbles/src/BallExtJpanelThread/Ball.java
182bf66d3af871a28199c5abdc3554eada642ae5
[]
no_license
lannav/mcpp
34e26e19f8db5ffd26659fce3c0fa2b8a4ebd029
2975f71056ebc8ea1fa54db4cd9d405fad9fe46c
refs/heads/master
2020-03-28T11:12:18.444181
2018-11-26T18:45:17
2018-11-26T18:48:16
148,188,293
0
0
null
null
null
null
UTF-8
Java
false
false
932
java
package BallExtJpanelThread; import java.awt.Color; import java.awt.Graphics; import java.awt.Point; import javax.swing.JPanel; public class Ball extends JPanel implements Runnable { int R = 50; int dx = 1; int dy = 1; int clr = (int)(Math.random() *10000000); Point p; Thread tr; public Ball(int x, int y) { tr = new Thread(this); tr.start(); setBounds(x-R, y-R, R+2, R+2); p = getLocation(); } public void move() { if(p.x + R >= 785 - R) dx *= -1; if(p.x + R <= 0 + R) dx *= -1; if(p.y + R >= 560 - R) dy *= -1; if(p.y + R <= 0 + R) dy *= -1; p.x += dx; p.y += dy; setLocation(p); } @Override public void run() { while(true) { move(); try { tr.sleep(10); } catch (InterruptedException e) { e.printStackTrace(); } } } @Override public void paint(Graphics g) { g.setColor(new Color(clr)); g.fillOval(p.x, p.y, R*2, R*2); } }
c36ca7e95e8dd44f0d7512312152d23c326f311c
a6a45ae482c5dd6efb2edfa73eda22fefaed3402
/app/src/main/java/com/example/pem_test/data/Repository.java
cc51cf7618c2142161b3d656587413654c7b7141
[]
no_license
KevinMaikath/android-pem-test
5a0af9233421a14108f03b48819299ff907b85dd
1a743427a29a34850a89603d161e0ac3110f6be9
refs/heads/master
2020-12-04T03:55:12.118729
2020-01-07T13:57:36
2020-01-07T13:57:36
231,594,314
0
0
null
null
null
null
UTF-8
Java
false
false
2,625
java
package com.example.pem_test.data; import android.content.Context; import android.util.Log; import java.util.Map; import io.realm.OrderedCollectionChangeSet; import io.realm.OrderedRealmCollectionChangeListener; import io.realm.Realm; import io.realm.RealmConfiguration; import io.realm.RealmResults; public class Repository implements RepositoryContract { private static Repository instance = null; private Realm realm; private Contact[] contactList; public static Repository getInstance(Context context) { if (instance == null) { instance = new Repository(context); } return instance; } private Repository(Context context) { Realm.init(context); this.realm = Realm.getDefaultInstance(); } @Override public void loadContactList(final LoadContactListCallback callback) { final RealmResults<Contact> contacts = realm.where(Contact.class).findAllAsync(); contacts.addChangeListener(new OrderedRealmCollectionChangeListener<RealmResults<Contact>>() { @Override public void onChange(RealmResults<Contact> contacts, OrderedCollectionChangeSet changeSet) { changeSet.getInsertions(); callback.setContactList(contacts); } }); } @Override public void addContact(final Map<String, String> data, AddContactDoneCallback callback) { // TODO addContact Number currentIdNum = realm.where(Contact.class).max("id"); int nextId; if (currentIdNum == null) { nextId = 1; } else { nextId = currentIdNum.intValue() + 1; } realm.beginTransaction(); Contact newContact = realm.createObject(Contact.class); newContact.setId(nextId); newContact.setName(data.get("name")); newContact.setSurname(data.get("surname")); newContact.setAge(Integer.parseInt(data.get("age"))); newContact.setOccupation(data.get("occupation")); newContact.setDni(data.get("dni")); newContact.setCv(data.get("cv")); newContact.setRating(Integer.parseInt(data.get("rating"))); realm.commitTransaction(); callback.done(); } @Override public void removeContact(final Contact contact, RemoveContactDoneCallback callback) { realm.beginTransaction(); contact.deleteFromRealm(); realm.commitTransaction(); callback.done(); } @Override public void editRating(Contact currentContact, String newRatingValue) { realm.beginTransaction(); Contact contactToUpdate = realm.where(Contact.class) .equalTo("id", currentContact.getId()).findFirst(); contactToUpdate.setRating(Integer.parseInt(newRatingValue)); realm.commitTransaction(); } }
e716611fdc5894817cd96b354a33f958dd08f276
a9a23d533b7c479b1b83ed4e2f2a399e1445b9be
/src/main/java/net/devstudy/resume/model/AbstractModel.java
abd88df06da634797c9367448c91756eaed7f099
[]
no_license
fatum09/resume
827b91232072c0865f8c4058af1e9e8b15d574e4
967b890f7aa80b150b5446a6676cf04fd5619d7a
refs/heads/master
2023-04-19T08:11:10.138905
2019-08-07T16:00:59
2019-08-07T16:00:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
370
java
package net.devstudy.resume.model; import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.commons.lang.builder.ToStringStyle; /** * * @author devstudy * @see http://devstudy.net */ public abstract class AbstractModel { @Override public String toString() { return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE); } }
352b6f73a6433f858f5e91cb702af706855b936f
d5d470272bcd91428d5dd228dc31148e007267e1
/raiz/src/main/java/com/utfpr/entidades/RiscoCardiaco.java
a1582d4d411dbd7b9eb7531c58463e6ca2d290b7
[]
no_license
gabriel-magalhaes/Grupo-2-Grupo-2
436807d90255e9c2b9c8186961ea2129eb179380
89661584f6d6b9e1ad8a8d327a6bae948da8c262
refs/heads/master
2021-01-21T14:48:52.829435
2016-06-30T04:15:26
2016-06-30T04:15:26
59,137,855
0
0
null
null
null
null
UTF-8
Java
false
false
1,729
java
package com.utfpr.entidades; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; /** * Created by laisa on 12/06/2016. */ @Entity public class RiscoCardiaco { @Id @GeneratedValue private long id; private int idade; private int sexo; private int peso; private int atividadeFisica; private int fumante; private int pressao; private int doenca; private int colesterol; public long getId() { return id; } public void setId(long id) { this.id = id; } public int getIdade() { return idade; } public void setIdade(int idade) { this.idade = idade; } public int getSexo() { return sexo; } public void setSexo(int sexo) { this.sexo = sexo; } public int getPeso() { return peso; } public void setPeso(int peso) { this.peso = peso; } public int getAtividadeFisica() { return atividadeFisica; } public void setAtividadeFisica(int atividadeFisica) { this.atividadeFisica = atividadeFisica; } public int getFumante() { return fumante; } public void setFumante(int fumante) { this.fumante = fumante; } public int getPressao() { return pressao; } public void setPressao(int pressao) { this.pressao = pressao; } public int getDoenca() { return doenca; } public void setDoenca(int doenca) { this.doenca = doenca; } public int getColesterol() { return colesterol; } public void setColesterol(int colesterol) { this.colesterol = colesterol; } }
184f8c18be0a1e081b4c4dc044bc269b78537c01
c7cc01df2308b63ec7009ae20ee91780c9583343
/Java/Java2/ch04/examples/WriteText.java
78fe267471d6fa395023dd797573573a7d1387ce
[]
no_license
harakara51/harakara51.github.io
49623da79c4bea169111abfc1aa8d6ad58339509
c26bf0f104d38fcd6215222fd112bc0404bb3b92
refs/heads/master
2021-01-10T11:32:33.281722
2016-01-05T19:54:06
2016-01-05T19:54:06
47,153,008
0
0
null
null
null
null
UTF-8
Java
false
false
630
java
package examples; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; public class WriteText { public static void main(String[] args) { try { FileWriter fw = new FileWriter("test.txt"); PrintWriter pw = new PrintWriter(fw); pw.println(12 + "thisets"); pw.printf("%1$.2f %n", 12.5); pw.println(false); pw.println('a'); pw.println("A String"); pw.close(); } catch (IOException e) { System.err.println(e.getMessage()); } } }
52b0790b5a0951647bf94de341eed47ae97cbf15
5077855b8eee7dc8e86a5baaa42ab7e1a3c072c0
/RealmWithRx/app/src/androidTest/java/nl/sense_os/realmwithrx/realm/RxRealmService.java
5dcc1be081fa4940e97112f741d12eaae35b680d
[]
no_license
panjiyudasetya/fun-projects
b6fd722969fcfa5e98f1a48bff4ce3306e4044ad
a80f75b7706afe1364d100d8a44ae1716eb648f2
refs/heads/master
2021-08-10T11:56:12.600439
2021-01-21T05:27:33
2021-01-21T05:27:33
78,810,941
0
0
null
null
null
null
UTF-8
Java
false
false
2,425
java
package nl.sense_os.realmwithrx.realm; import android.content.Context; import android.support.annotation.NonNull; import android.support.annotation.VisibleForTesting; import java.util.List; import java.util.concurrent.Callable; import io.reactivex.Observable; import io.realm.Realm; import io.realm.RealmConfiguration; import nl.sense_os.realmwithrx.realm.objects.RealmModule; /** * Created by panjiyudasetya on 2/23/17. */ public class RxRealmService extends RealmService { public RxRealmService(Context context) { super(context); Realm.init(context); } @VisibleForTesting public RxRealmService(Context context, String name) { Realm.init(context); defaultConfiguration = new RealmConfiguration.Builder() .modules(new RealmModule()) .name(name) .inMemory() .build(); Realm.setDefaultConfiguration(defaultConfiguration); } public Observable<Boolean> rxCreateOrUpdateInput(@NonNull final Input input) { return Observable.fromCallable(new Callable<Boolean>() { @Override public Boolean call() throws Exception { Realm realm = Realm.getInstance(defaultConfiguration); try { createOrUpdateInput(input); return Boolean.TRUE; } finally { realm.close(); } } }); } public Observable<List<Input>> rxGetInputs() { return Observable.fromCallable(new Callable() { @Override public List<Input> call() throws Exception { Realm realm = Realm.getInstance(defaultConfiguration); try { return getInputs(); } finally { realm.close(); } } }); } public Observable<List<Input>> rxCreateAndGetInputs(@NonNull final Input input) { return Observable.fromCallable(new Callable() { @Override public List<Input> call() throws Exception { Realm realm = Realm.getInstance(defaultConfiguration); try { createOrUpdateInput(input); return getInputs(); } finally { realm.close(); } } }); } }
08f9f2cd151bbb6cdfcffb090cb8faee4d78c04e
bc15c6ccca916de9ad21959c52a7ccd4227ac5f6
/plugins/org.erlide.jinterface/src/org/erlide/jinterface/rpc/RpcHelper.java
9d36388a314bbd2246a6260d9d49fa4301c1f053
[]
no_license
erlide/erlide_xtext
42130184f3f4016ac592107a8f6e7041d5895241
1fea0b6968175e91d1086231b204368405a2bf7c
refs/heads/master
2021-01-17T11:19:19.787794
2016-04-22T07:41:34
2016-04-22T07:41:34
3,560,418
2
0
null
null
null
null
UTF-8
Java
false
false
13,354
java
/******************************************************************************* * Copyright (c) 2004 Vlad Dumitrescu and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Vlad Dumitrescu *******************************************************************************/ package org.erlide.jinterface.rpc; import org.erlide.common.util.ErlLogger; import org.erlide.jinterface.TypeConverter; import org.erlide.jinterface.internal.rpc.RpcFutureImpl; import com.ericsson.otp.erlang.OtpErlang; import com.ericsson.otp.erlang.OtpErlangAtom; import com.ericsson.otp.erlang.OtpErlangDecodeException; import com.ericsson.otp.erlang.OtpErlangExit; import com.ericsson.otp.erlang.OtpErlangList; import com.ericsson.otp.erlang.OtpErlangObject; import com.ericsson.otp.erlang.OtpErlangPid; import com.ericsson.otp.erlang.OtpErlangRef; import com.ericsson.otp.erlang.OtpErlangTuple; import com.ericsson.otp.erlang.OtpMbox; import com.ericsson.otp.erlang.OtpNode; import com.ericsson.otp.erlang.Signature; import com.ericsson.otp.erlang.SignatureException; public final class RpcHelper { // use this for debugging private static final boolean CHECK_RPC = Boolean .getBoolean("erlide.checkrpc"); public static final int INFINITY = -1; private static volatile RpcHelper instance; /** * Convenience method to send a remote message. * * @param node * @param pid * @param msg * @throws RpcException */ public void send(final OtpNode node, final OtpErlangPid pid, final Object msg) throws SignatureException { final OtpMbox mbox = node.createMbox(); try { if (mbox != null) { if (CHECK_RPC) { debug("SEND " + pid + "-> " + msg); } mbox.send(pid, TypeConverter.java2erlang(msg, "x")); } } finally { node.closeMbox(mbox); } } /** * Convenience method to send a remote message. * * @param node * @param peer * @param name * @param msg * @throws RpcException */ public void send(final OtpNode node, final String peer, final String name, final Object msg) throws SignatureException { final OtpMbox mbox = node.createMbox(); try { if (mbox != null) { if (CHECK_RPC) { debug("SEND " + name + "-> " + msg); } mbox.send(name, peer, TypeConverter.java2erlang(msg, "x")); } } finally { node.closeMbox(mbox); } } /** * Make a regular RPC to the given node, with the given arguments. * * @param node * @param peer * @param module * @param fun * @param timeout * @param signature * @param args0 * @return * @throws RpcException */ public OtpErlangObject rpcCall(final OtpNode node, final String peer, final boolean logCalls, final OtpErlangObject gleader, final String module, final String fun, final int timeout, final String signature, final Object... args0) throws RpcException, SignatureException { final IRpcFuture future = sendRpcCall(node, peer, logCalls, gleader, module, fun, signature, args0); OtpErlangObject result; result = future.get(timeout); if (CHECK_RPC) { debug("RPC result:: " + result); } if (isBadRpc(result)) { throw new RpcException(result.toString()); } return result; } public boolean isBadRpc(final OtpErlangObject result) { if (result instanceof OtpErlangTuple) { final OtpErlangTuple t = (OtpErlangTuple) result; if (t.elementAt(0) instanceof OtpErlangAtom) { final OtpErlangAtom a = (OtpErlangAtom) t.elementAt(0); return "badrpc".equals(a.atomValue()); } } return false; } /** * Calls a function that supports sending progress reports back. The first * argument is implicit and is the pid where the reports are to be sent. */ public void rpcCastWithProgress(final IRpcResultCallback callback, final OtpNode node, final String peer, final boolean logCalls, final OtpErlangObject gleader, final String module, final String fun, final String signature, final Object... args0) throws SignatureException { final Object[] args = new Object[args0.length + 1]; System.arraycopy(args0, 0, args, 1, args0.length); final OtpMbox mbox = node.createMbox(); args[0] = mbox.self(); new RpcResultReceiver(mbox, callback); rpcCast(node, peer, logCalls, gleader, module, fun, signature, args); } /** * Send a RPC request and return the mailbox that will receive the result * once it's delivered. * * @param node * @param peer * @param module * @param fun * @param signature * @param args0 * @return * @throws RpcException */ public synchronized IRpcFuture sendRpcCall(final OtpNode node, final String peer, final boolean logCalls, final OtpErlangObject gleader, final String module, final String fun, final String signature, final Object... args0) throws SignatureException { final OtpErlangObject[] args = convertArgs(signature, args0); OtpErlangObject res = null; final OtpMbox mbox = node.createMbox(); res = buildRpcCall(mbox.self(), gleader, module, fun, args); if (logCalls) { debugLogCallArgs("call -> %s:%s(%s)", module, fun, argString(args)); } // final OtpErlangRef ref = RpcMonitor.recordRequest(node, peer, module, fun, args, OtpErlang.sizeOf(res)); // mbox.send("rex", peer, res); if (CHECK_RPC) { debug("RPC " + mbox.hashCode() + "=> " + res); } return new RpcFutureImpl(ref, mbox, module + ":" + fun + "/" + args0.length, logCalls, this); } private final static String SEP = ", "; private Object argString(final OtpErlangObject[] args) { final StringBuilder result = new StringBuilder(); for (final OtpErlangObject arg : args) { final String s = arg.toString(); result.append(s).append(SEP); } final String r = result.length() == 0 ? "" : result.substring(0, result.length() - SEP.length()); return r; } /** * Retrieve the result of a RPC. * * @param mbox * @return * @throws RpcException */ public OtpErlangObject getRpcResult(final OtpMbox mbox, final String env) throws RpcException { return getRpcResult(mbox, INFINITY, env); } /** * Retrieve the result of a RPC. * * @param mbox * @param timeout * @param env * @return * @throws RpcException */ public OtpErlangObject getRpcResult(final OtpMbox mbox, final long timeout, final String env) throws RpcException { assert mbox != null; OtpErlangObject res = null; try { try { if (timeout == INFINITY) { res = mbox.receive(); } else { res = mbox.receive(timeout); } if (CHECK_RPC) { debug("RPC " + mbox.hashCode() + "<= " + res); } } finally { if (res != null) { mbox.close(); } } if (res == null) { final String msg = env != null ? env : "??"; throw new RpcTimeoutException(msg); } if (!(res instanceof OtpErlangTuple)) { throw new RpcException(res.toString()); } final OtpErlangTuple t = (OtpErlangTuple) res; if (t.arity() != 2) { throw new RpcException(res.toString()); } res = t.elementAt(1); } catch (final OtpErlangExit e) { throw new RpcException(e); } catch (final OtpErlangDecodeException e) { throw new RpcException(e); } return res; } private OtpErlangObject buildRpcCall(final OtpErlangPid pid, final OtpErlangObject gleader, final String module, final String fun, final OtpErlangObject[] args) { final OtpErlangObject m = new OtpErlangAtom(module); final OtpErlangObject f = new OtpErlangAtom(fun); final OtpErlangObject a = new OtpErlangList(args); return OtpErlang.mkTuple(pid, OtpErlang.mkTuple(new OtpErlangAtom("call"), m, f, a, gleader)); } /** * Make a RPC but don't wait for any result. * * @param node * @param peer * @param logCalls * @param module * @param fun * @param signature * @param args0 * @throws RpcException */ public void rpcCast(final OtpNode node, final String peer, final boolean logCalls, final OtpErlangObject gleader, final String module, final String fun, final String signature, final Object... args0) throws SignatureException { final OtpErlangObject[] args = convertArgs(signature, args0); OtpErlangObject msg = null; msg = buildRpcCastMsg(gleader, module, fun, args); if (logCalls) { debugLogCallArgs("cast -> %s:%s(%s)", module, fun, argString(args)); } send(node, peer, "rex", msg); if (CHECK_RPC) { debug("RPC _cast_" + "=> " + msg); } } public void debugLogCallArgs(final String fmt, final Object... args0) { ErlLogger.getInstance().debug(fmt, args0); } private OtpErlangObject[] convertArgs(final String signature, Object... args0) throws SignatureException { if (args0 == null) { args0 = new OtpErlangObject[] {}; } Signature[] type; type = Signature.parse(signature); if (type == null) { type = new Signature[args0.length]; for (int i = 0; i < args0.length; i++) { type[i] = new Signature('x'); } } if (type.length != args0.length) { throw new SignatureException( "Signature doesn't match parameter number: " + type.length + "/" + args0.length); } final OtpErlangObject[] args = new OtpErlangObject[args0.length]; for (int i = 0; i < args.length; i++) { args[i] = TypeConverter.java2erlang(args0[i], type[i]); } return args; } private OtpErlangObject buildRpcCastMsg(final OtpErlangObject gleader, final String module, final String fun, final OtpErlangObject[] args) { final OtpErlangObject m = new OtpErlangAtom(module); final OtpErlangObject f = new OtpErlangAtom(fun); final OtpErlangObject a = new OtpErlangList(args); final OtpErlangAtom castTag = new OtpErlangAtom("$gen_cast"); return OtpErlang.mkTuple(castTag, OtpErlang.mkTuple(new OtpErlangAtom("cast"), m, f, a, gleader)); } private void debug(final String s) { ErlLogger.getInstance().debug(s); } @SuppressWarnings("unused") private void warn(final Exception e) { ErlLogger.getInstance().warn(e); } public void makeAsyncCbCall(final OtpNode node, final String peer, final IRpcCallback cb, final int timeout, final OtpErlangObject gleader, final String module, final String fun, final String signature, final Object... args) throws SignatureException { final IRpcFuture future = sendRpcCall(node, peer, false, gleader, module, fun, signature, args); final Runnable target = new Runnable() { @Override public void run() { OtpErlangObject result; try { result = future.get(timeout); cb.run(result); } catch (final RpcException e) { // TODO do we want to treat a timeout differently? ErlLogger.getInstance().error( "Could not execute RPC " + module + ":" + fun + " : " + e.getMessage()); } } }; // We can't use jobs here, it's an Eclipse dependency final Thread thread = new Thread(target); thread.setDaemon(true); thread.setName("async " + module + ":" + fun); thread.start(); } private RpcHelper() { } public static RpcHelper getInstance() { if (instance == null) { instance = new RpcHelper(); } return instance; } }
9f7c9cb0909661bc2e1dda70fafb76f0969aea6d
1b51721ce7fddb4a4007b19fe2f75f01a9bc81b0
/app/src/main/java/com/example/samridhi/miwok/NumbersClickListener.java
9dfe929b7a2b410c96a21916b38852f52f4abd42
[]
no_license
samridhi03/Miwok
add8a481508c0e0a6bad350c6826e91b427171ef
8feddfce9c885beedbfdab0ac2706db1dff95923
refs/heads/master
2021-09-04T09:27:54.465561
2018-01-17T18:08:03
2018-01-17T18:08:03
117,874,866
0
0
null
null
null
null
UTF-8
Java
false
false
362
java
package com.example.samridhi.miwok; import android.view.View; import android.widget.Toast; /** * Created by Samridhi on 10-01-2018. */ public class NumbersClickListener implements View.OnClickListener{ @Override public void onClick(View view) { Toast.makeText(view.getContext(),"Open the list of numbers",Toast.LENGTH_SHORT).show(); } }
0c31d7be6a08d1868d70c32e983a433bc31e93c0
fcd4e39ed6be245de15bc850fbfe046537c016fb
/holleylib/src/main/java/com/halohoop/holley/http/json/JsonHttpListener.java
c9c543a0beed1626534d9937fee33a333dd53fb5
[ "Apache-2.0" ]
permissive
halohoop/Holley
0c939a8e108b17de730cb3a4da4ffb1e2a820021
13c5821e25a6d160d0430c066f05bdc44195a11a
refs/heads/master
2020-12-30T15:54:56.039855
2017-05-14T11:00:54
2017-05-14T11:00:54
91,185,838
0
0
null
null
null
null
UTF-8
Java
false
false
3,140
java
package com.halohoop.holley.http.json; import android.os.Handler; import android.os.Looper; import com.halohoop.holley.http.core.interfaces.IDataListener; import com.halohoop.holley.http.core.interfaces.IHttpListener; import com.halohoop.holley.utils.Utils; import org.apache.http.HttpEntity; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; /** * Created by Pooholah on 2017/5/13. */ /** * * @param <M> 实体 */ public class JsonHttpListener<M> implements IHttpListener { private Class<M> mResponse; /** * 回调调用层的接口 */ private IDataListener<M> mDataListener; /** * 用于切换线程的handler */ private Handler mHandler = new Handler(Looper.getMainLooper()); public JsonHttpListener(Class<M> response, IDataListener<M> mDataListener) { this.mResponse = response; this.mDataListener = mDataListener; } @Override public void onSuccess(HttpEntity httpEntity) { InputStream inputStream = null; try { inputStream = httpEntity.getContent(); //得到返回的数据,此处还是在子线程,接下去会有切换线程 String content = getContent(inputStream); final M m = Utils.parseObject(content, mResponse); //切换线程 mHandler.post(new Runnable() { @Override public void run() { //回调在主线程 mDataListener.onSuccess(m); } }); } catch (IOException e) { e.printStackTrace(); mDataListener.onFail(); } } @Override public void onFail() { mDataListener.onFail(); } /** * @param inputStream * @return */ private String getContent(InputStream inputStream) { String content = null; BufferedReader reader = null; try { reader = new BufferedReader(new InputStreamReader(inputStream)); StringBuilder sb = new StringBuilder(); String line = null; try { while ((line = reader.readLine()) != null) { sb.append(line + "\n"); } } catch (IOException e) { mDataListener.onFail(); Utils.logI("Error=" + e.toString()); } finally { if (inputStream != null) { try { inputStream.close(); } catch (IOException e) { Utils.logI("Error=" + e.toString()); } } } return sb.toString(); } catch (Exception e) { e.printStackTrace(); mDataListener.onFail(); } finally { if (reader != null) { try { reader.close(); } catch (IOException e) { e.printStackTrace(); } } } return content; } }
c91a93632a9e71e701c8cc902e50d17e40dc032e
e14bf5e674e0b32ea1309979cf631e20918fe209
/app/src/main/java/com/example/sx/practicalassistant/utils/LogUtils.java
7b2039ed061f199b2271dac87c63401d7f0e0a89
[]
no_license
wqlljj/PracticalAssistant
8fb625cdcf8956ef1171b5f6eeba86c7668e46f9
0a4a6649a7ac3c6a7d6027db73bcc26558793347
refs/heads/master
2020-06-10T13:55:14.483299
2019-06-25T07:04:48
2019-06-25T07:04:48
193,653,093
0
0
null
null
null
null
UTF-8
Java
false
false
1,567
java
package com.example.sx.practicalassistant.utils; import android.util.Log; /** * Log统一管理类 * */ public class LogUtils { public static boolean isDebug = true;// 是否需要打印bug,可以在application的onCreate函数里面初始化 private static final String TAG = "smart"; // 下面四个是默认tag的函数 public static void i(String msg) { if (isDebug) Log.i(TAG, msg); } public static void d(String msg) { if (isDebug) Log.d(TAG, msg); } public static void e(String msg) { if (isDebug) Log.e(TAG, msg); } public static void v(String msg) { if (isDebug) Log.v(TAG, msg); } // 下面是传入类名打印log public static void i(Class<?> _class, String msg) { if (isDebug) Log.i(_class.getName(), msg); } public static void d(Class<?> _class, String msg) { if (isDebug) Log.i(_class.getName(), msg); } public static void e(Class<?> _class, String msg) { if (isDebug) Log.i(_class.getName(), msg); } public static void v(Class<?> _class, String msg) { if (isDebug) Log.i(_class.getName(), msg); } // 下面是传入自定义tag的函数 public static void i(String tag, String msg) { if (isDebug) Log.i(tag, msg); } public static void d(String tag, String msg) { if (isDebug) Log.i(tag, msg); } public static void e(String tag, String msg) { if (isDebug) Log.i(tag, msg); } public static void v(String tag, String msg) { if (isDebug) Log.i(tag, msg); } public static void w(String tag, String msg) { if (isDebug) Log.w(tag, msg); } }
89156fe09a0d551ae5adb10415fed3f032708f71
757c59da9f70291c39fe22a2e12df8c05df2d937
/src/org/openbravo/costing/InventoryAmountUpdateProcess.java
c2ca27421c4c5d184c6206c0ca863bc4062cc3fc
[]
no_license
bravocode-erp/bravocode-platform
e517bb8ce890cc67e6ff582329e4a8d1762ae607
466de9a7e9efb72780aef965bf5e23acc94abe68
refs/heads/master
2023-01-31T06:43:50.293401
2020-03-23T21:46:46
2020-03-23T22:03:27
249,534,779
0
0
null
null
null
null
UTF-8
Java
false
false
19,089
java
/* ************************************************************************* * The contents of this file are subject to the Openbravo Public License * Version 1.1 (the "License"), being the Mozilla Public License * Version 1.1 with a permitted attribution clause; you may not use this * file except in compliance with the License. You may obtain a copy of * the License at http://www.openbravo.com/legal/license.html * Software distributed under the License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the * License for the specific language governing rights and limitations * under the License. * The Original Code is Openbravo ERP. * The Initial Developer of the Original Code is Openbravo SLU * All portions are Copyright (C) 2014-2020 Openbravo SLU * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************ */ package org.openbravo.costing; import java.math.BigDecimal; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.codehaus.jettison.json.JSONObject; import org.hibernate.ScrollMode; import org.hibernate.ScrollableResults; import org.hibernate.criterion.Restrictions; import org.hibernate.query.Query; import org.openbravo.base.provider.OBProvider; import org.openbravo.client.kernel.BaseActionHandler; import org.openbravo.dal.core.OBContext; import org.openbravo.dal.security.OrganizationStructureProvider; import org.openbravo.dal.service.OBCriteria; import org.openbravo.dal.service.OBDal; import org.openbravo.erpCommon.utility.OBMessageUtils; import org.openbravo.materialmgmt.InventoryCountProcess; import org.openbravo.model.ad.system.Client; import org.openbravo.model.common.enterprise.Locator; import org.openbravo.model.common.enterprise.Organization; import org.openbravo.model.common.enterprise.Warehouse; import org.openbravo.model.common.plm.AttributeSetInstance; import org.openbravo.model.common.plm.Product; import org.openbravo.model.common.plm.ProductUOM; import org.openbravo.model.common.uom.UOM; import org.openbravo.model.materialmgmt.cost.CostingRule; import org.openbravo.model.materialmgmt.cost.InvAmtUpdLnInventories; import org.openbravo.model.materialmgmt.cost.InventoryAmountUpdate; import org.openbravo.model.materialmgmt.cost.InventoryAmountUpdateLine; import org.openbravo.model.materialmgmt.transaction.InventoryCount; import org.openbravo.model.materialmgmt.transaction.InventoryCountLine; import org.openbravo.service.db.DbUtility; public class InventoryAmountUpdateProcess extends BaseActionHandler { private static final Logger log = LogManager.getLogger(); @Override protected JSONObject execute(final Map<String, Object> parameters, final String data) { final JSONObject result = new JSONObject(); JSONObject errorMessage = new JSONObject(); OBContext.setAdminMode(true); try { final JSONObject jsonData = new JSONObject(data); final String orgId = jsonData.getString("inpadOrgId"); final String invAmtUpdId = jsonData.getString("M_Ca_Inventoryamt_ID"); InventoryAmountUpdate invAmtUpd = OBDal.getInstance() .get(InventoryAmountUpdate.class, invAmtUpdId); final OBCriteria<InventoryAmountUpdateLine> qLines = OBDal.getInstance() .createCriteria(InventoryAmountUpdateLine.class); qLines.add(Restrictions.eq(InventoryAmountUpdateLine.PROPERTY_CAINVENTORYAMT, invAmtUpd)); final ScrollableResults scrollLines = qLines.scroll(ScrollMode.FORWARD_ONLY); try { int cnt = 0; while (scrollLines.next()) { final InventoryAmountUpdateLine line = (InventoryAmountUpdateLine) scrollLines.get()[0]; final String lineId = line.getId(); final CostingRule rule = CostingUtils.getCostDimensionRule( OBDal.getInstance().get(Organization.class, orgId), line.getReferenceDate()); final String ruleId = rule.getId(); final OrganizationStructureProvider osp = OBContext.getOBContext() .getOrganizationStructureProvider(rule.getClient().getId()); final Set<String> childOrgs = osp.getChildTree(rule.getOrganization().getId(), true); if (!rule.isWarehouseDimension()) { createInventories(lineId, null, ruleId, childOrgs, line.getReferenceDate()); } else { createInventories(lineId, line.getWarehouse(), ruleId, childOrgs, line.getReferenceDate()); } if ((cnt++ % 10) == 0) { OBDal.getInstance().flush(); // clear session after each line iteration because the number of objects read in memory // is big OBDal.getInstance().getSession().clear(); } } invAmtUpd = OBDal.getInstance().get(InventoryAmountUpdate.class, invAmtUpdId); invAmtUpd.setProcessed(true); OBDal.getInstance().save(invAmtUpd); OBDal.getInstance().flush(); try { // to ensure that the closed inventory is created before opening inventory Thread.sleep(2000); } catch (InterruptedException e) { log.error("Error waiting between processing close an open inventories", e); } //@formatter:off final String hql = " as inv" + " where exists (" + " select 1 from InventoryAmountUpdateLineInventories invAmtUpd" + " where invAmtUpd.caInventoryamtline.caInventoryamt.id =:invAmtUpdId" + " and invAmtUpd.initInventory.id = inv.id" + " )"; //@formatter:on ScrollableResults invLines = OBDal.getInstance() .createQuery(InventoryCount.class, hql) .setNamedParameter("invAmtUpdId", invAmtUpdId) .scroll(ScrollMode.FORWARD_ONLY); try { while (invLines.next()) { final InventoryCount inventory = (InventoryCount) invLines.get()[0]; new InventoryCountProcess().processInventory(inventory, false, true); } } finally { invLines.close(); } } finally { scrollLines.close(); } errorMessage.put("severity", "success"); errorMessage.put("text", OBMessageUtils.messageBD("Success")); result.put("message", errorMessage); } catch (Exception e) { OBDal.getInstance().rollbackAndClose(); log.error(e.getMessage(), e); try { final Throwable ex = DbUtility.getUnderlyingSQLException(e); final String message = OBMessageUtils.translateError(ex.getMessage()).getMessage(); errorMessage = new JSONObject(); errorMessage.put("severity", "error"); errorMessage.put("title", OBMessageUtils.messageBD("Error")); errorMessage.put("text", message); result.put("message", errorMessage); } catch (Exception ignore) { } } finally { OBContext.restorePreviousMode(); } return result; } protected void createInventories(final String lineId, final Warehouse warehouse, final String ruleId, final Set<String> childOrgs, final Date date) { final CostingRule costRule = OBDal.getInstance().get(CostingRule.class, ruleId); InventoryAmountUpdateLine line = OBDal.getInstance() .get(InventoryAmountUpdateLine.class, lineId); final ScrollableResults stockLines = getStockLines(childOrgs, date, line.getProduct(), warehouse, costRule.isBackdatedTransactionsFixed()); // The key of the Map is the concatenation of orgId and warehouseId final Map<String, String> inventories = new HashMap<>(); final Map<String, Long> maxLineNumbers = new HashMap<>(); final InventoryCountLine closingInventoryLine = null; InventoryCountLine openInventoryLine = null; int i = 1; try { while (stockLines.next()) { final Object[] stockLine = stockLines.get(); final String attrSetInsId = (String) stockLine[0]; final String uomId = (String) stockLine[1]; final String orderUOMId = (String) stockLine[2]; final String locatorId = (String) stockLine[3]; final String warehouseId = (String) stockLine[4]; final BigDecimal qty = (BigDecimal) stockLine[5]; final BigDecimal orderQty = (BigDecimal) stockLine[6]; // final String invId = inventories.get(warehouseId); InvAmtUpdLnInventories inv = null; if (invId == null) { inv = createInventorieLine(line, warehouseId, date); inventories.put(warehouseId, inv.getId()); } else { inv = OBDal.getInstance().get(InvAmtUpdLnInventories.class, invId); } final Long lineNo = (maxLineNumbers.get(inv.getId()) == null ? 0L : maxLineNumbers.get(inv.getId())) + 10L; maxLineNumbers.put(inv.getId(), lineNo); if (BigDecimal.ZERO.compareTo(qty) < 0) { // Do not insert negative values in Inventory lines, instead reverse the Quantity Count // and the Book Quantity. For example: // Instead of CountQty=0 and BookQty=-5 insert CountQty=5 and BookQty=0 // By doing so the difference between both quantities remains the same and no negative // values have been inserted. openInventoryLine = insertInventoryLine(inv.getInitInventory(), line.getProduct().getId(), attrSetInsId, uomId, orderUOMId, locatorId, qty, BigDecimal.ZERO, orderQty, BigDecimal.ZERO, lineNo, null, line.getUnitCost()); insertInventoryLine(inv.getCloseInventory(), line.getProduct().getId(), attrSetInsId, uomId, orderUOMId, locatorId, BigDecimal.ZERO, qty, BigDecimal.ZERO, orderQty, lineNo, openInventoryLine, null); } else { openInventoryLine = insertInventoryLine(inv.getInitInventory(), line.getProduct().getId(), attrSetInsId, uomId, orderUOMId, locatorId, BigDecimal.ZERO, qty.negate(), BigDecimal.ZERO, orderQty == null ? null : orderQty, lineNo, closingInventoryLine, line.getUnitCost()); insertInventoryLine(inv.getCloseInventory(), line.getProduct().getId(), attrSetInsId, uomId, orderUOMId, locatorId, qty == null ? null : qty.negate(), BigDecimal.ZERO, orderQty == null ? null : orderQty, BigDecimal.ZERO, lineNo, openInventoryLine, null); } if ((i % 100) == 0) { OBDal.getInstance().flush(); OBDal.getInstance().getSession().clear(); // Reload line after clear session. line = OBDal.getInstance().get(InventoryAmountUpdateLine.class, lineId); } i++; } } finally { stockLines.close(); } // Process closing physical inventories. for (InvAmtUpdLnInventories inv : line.getInventoryAmountUpdateLineInventoriesList()) { new InventoryCountProcess().processInventory(inv.getCloseInventory(), false); } } private ScrollableResults getStockLines(final Set<String> childOrgs, final Date date, final Product product, final Warehouse warehouse, final boolean backdatedTransactionsFixed) { Date localDate = date; //@formatter:off String hqlSelect = "select trx.attributeSetValue.id" + " , trx.uOM.id" + " , trx.orderUOM.id" + " , trx.storageBin.id" + " , loc.warehouse.id" + " , sum(trx.movementQuantity)" + " , sum(trx.orderQuantity)" + " from MaterialMgmtMaterialTransaction as trx" + " join trx.storageBin as loc" + " where trx.organization.id in (:orgIds)"; //@formatter:on if (localDate != null) { if (backdatedTransactionsFixed) { //@formatter:off hqlSelect += " and trx.movementDate <= :date"; //@formatter:on } else { //@formatter:off String hqlSubSelect = "select min(trx.transactionProcessDate)" + " from MaterialMgmtMaterialTransaction as trx"; //@formatter:on if (warehouse != null) { //@formatter:off hqlSubSelect += " join trx.storageBin as locator"; //@formatter:on } //@formatter:off hqlSubSelect += " where trx.product.id = :productId" + " and trx.movementDate > :date" + // Include only transactions that have its cost calculated " and trx.isCostCalculated = true"; //@formatter:on if (warehouse != null) { //@formatter:off hqlSubSelect += " and locator.warehouse.id = :warehouseId"; //@formatter:on } //@formatter:off hqlSubSelect += " and trx.organization.id in (:orgIds)"; //@formatter:on final Query<Date> trxsubQry = OBDal.getInstance() .getSession() .createQuery(hqlSubSelect, Date.class) .setParameter("date", localDate) .setParameter("productId", product.getId()); if (warehouse != null) { trxsubQry.setParameter("warehouseId", warehouse.getId()); } final Date trxprocessDate = trxsubQry.setParameterList("orgIds", childOrgs).uniqueResult(); if (trxprocessDate != null) { localDate = trxprocessDate; //@formatter:off hqlSelect += " and trx.transactionProcessDate < :date"; //@formatter:on } else { //@formatter:off hqlSelect += " and trx.movementDate <= :date"; //@formatter:on } } } if (warehouse != null) { //@formatter:off hqlSelect += " and loc.warehouse.id = :warehouseId"; //@formatter:on } //@formatter:off hqlSelect += " and trx.product.id = :productId" + " group by trx.attributeSetValue.id" + " , trx.uOM.id" + " , trx.orderUOM.id" + " , trx.storageBin.id" + " , loc.warehouse.id" + " having sum(trx.movementQuantity) <> 0" + " order by loc.warehouse.id" + " , trx.storageBin.id" + " , trx.attributeSetValue.id" + " , trx.uOM.id" + " , trx.orderUOM.id"; //@formatter:on final Query<Object[]> stockLinesQry = OBDal.getInstance() .getSession() .createQuery(hqlSelect, Object[].class) .setParameterList("orgIds", childOrgs); if (localDate != null) { stockLinesQry.setParameter("date", localDate); } if (warehouse != null) { stockLinesQry.setParameter("warehouseId", warehouse.getId()); } return stockLinesQry.setParameter("productId", product.getId()) .setFetchSize(1000) .scroll(ScrollMode.FORWARD_ONLY); } private InvAmtUpdLnInventories createInventorieLine(final InventoryAmountUpdateLine invLine, final String warehouseId, final Date date) { Date localDate = date; if (localDate == null) { localDate = new Date(); } final Client client = (Client) OBDal.getInstance() .getProxy(Client.ENTITY_NAME, invLine.getClient().getId()); final String orgId = invLine.getOrganization().getId(); final Warehouse warehouse = (Warehouse) OBDal.getInstance() .getProxy(Warehouse.ENTITY_NAME, warehouseId); final InvAmtUpdLnInventories inv = OBProvider.getInstance().get(InvAmtUpdLnInventories.class); inv.setClient(client); inv.setOrganization( (Organization) OBDal.getInstance().getProxy(Organization.ENTITY_NAME, orgId)); inv.setWarehouse(warehouse); inv.setCaInventoryamtline(invLine); final List<InvAmtUpdLnInventories> invList = invLine .getInventoryAmountUpdateLineInventoriesList(); invList.add(inv); invLine.setInventoryAmountUpdateLineInventoriesList(invList); final InventoryCount closeInv = OBProvider.getInstance().get(InventoryCount.class); final Organization invOrg = CostingUtils.getOrganizationForCloseAndOpenInventories(orgId, warehouse); closeInv.setClient(client); closeInv.setName(OBMessageUtils.messageBD("InvAmtUpdCloseInventory")); closeInv.setWarehouse(warehouse); closeInv.setOrganization(invOrg); closeInv.setMovementDate(localDate); closeInv.setInventoryType("C"); inv.setCloseInventory(closeInv); final InventoryCount initInv = OBProvider.getInstance().get(InventoryCount.class); initInv.setClient(client); initInv.setName(OBMessageUtils.messageBD("InvAmtUpdInitInventory")); initInv.setWarehouse(warehouse); initInv.setOrganization(invOrg); initInv.setMovementDate(localDate); initInv.setInventoryType("O"); inv.setInitInventory(initInv); OBDal.getInstance().save(invLine); OBDal.getInstance().save(closeInv); OBDal.getInstance().save(initInv); OBDal.getInstance().flush(); return inv; } private InventoryCountLine insertInventoryLine(final InventoryCount inventory, final String productId, final String attrSetInsId, final String uomId, final String orderUOMId, final String locatorId, final BigDecimal qtyCount, final BigDecimal qtyBook, final BigDecimal orderQtyCount, final BigDecimal orderQtyBook, final Long lineNo, final InventoryCountLine relatedInventoryLine, final BigDecimal cost) { final InventoryCountLine icl = OBProvider.getInstance().get(InventoryCountLine.class); icl.setClient(inventory.getClient()); icl.setOrganization(inventory.getOrganization()); icl.setPhysInventory(inventory); icl.setLineNo(lineNo); icl.setStorageBin((Locator) OBDal.getInstance().getProxy(Locator.ENTITY_NAME, locatorId)); icl.setProduct((Product) OBDal.getInstance().getProxy(Product.ENTITY_NAME, productId)); icl.setAttributeSetValue((AttributeSetInstance) OBDal.getInstance() .getProxy(AttributeSetInstance.ENTITY_NAME, attrSetInsId)); icl.setQuantityCount(qtyCount); icl.setBookQuantity(qtyBook); icl.setUOM((UOM) OBDal.getInstance().getProxy(UOM.ENTITY_NAME, uomId)); if (orderUOMId != null) { icl.setOrderQuantity(orderQtyCount); icl.setQuantityOrderBook(orderQtyBook); icl.setOrderUOM( (ProductUOM) OBDal.getInstance().getProxy(ProductUOM.ENTITY_NAME, orderUOMId)); } icl.setRelatedInventory(relatedInventoryLine); if (cost != null) { icl.setCost(cost); } final List<InventoryCountLine> invLines = inventory.getMaterialMgmtInventoryCountLineList(); invLines.add(icl); inventory.setMaterialMgmtInventoryCountLineList(invLines); OBDal.getInstance().save(inventory); OBDal.getInstance().flush(); return icl; } }
99414d425a527ef3a7d3d81c16a422120b8f8de6
10465998727a431dccb7c4ca2c7737e155caf364
/hadoop-definitive-guide4-learn/src/main/java/com/hawk/hadoop/defguid4/ch05/SequenceFileWriteDemo.java
ebfc6a331dc6e2ca9daf0e396d4d498ea257beae
[]
no_license
zeatul/hadoop
7dc575582cd5279338fbc0adb123919cf104198a
98c6647d8d2aeaea781b52bb9cb5016493b634d2
refs/heads/master
2020-12-31T07:09:29.856603
2016-06-03T09:16:20
2016-06-03T09:16:20
57,134,919
0
0
null
null
null
null
UTF-8
Java
false
false
1,417
java
package com.hawk.hadoop.defguid4.ch05; import java.io.IOException; import java.net.URI; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.io.IOUtils; import org.apache.hadoop.io.IntWritable; import org.apache.hadoop.io.SequenceFile; import org.apache.hadoop.io.Text; /** * Example 5-10. Writing a SequenceFile * @author pzhang1 * */ public class SequenceFileWriteDemo { private static final String[] DATA = { // "One, two, buckle my shoe",// "Three, four, shut the door",// "Five, six, pick up sticks",// "Seven, eight, lay them straight",// "Nine, ten, a big fat hen" }; public static void main(String[] args) throws IOException { System.out.println("start SequenceFileWriteDemo"); String uri = args[0]; Configuration conf = new Configuration(); FileSystem fs = FileSystem.get(URI.create(uri), conf); Path path = new Path(uri); IntWritable key = new IntWritable(); Text value = new Text(); SequenceFile.Writer writer = null; try { writer = SequenceFile.createWriter(fs, conf, path, key.getClass(), value.getClass()); for (int i=0; i<100; i++){ key.set(100-i); value.set(DATA[i % DATA.length]); System.out.printf("[%s]\t%s\t%s\n", writer.getLength(), key, value); writer.append(key, value); } } finally { IOUtils.closeStream(writer); } } }
bfcc33753c12fa6c0a5c8b6ea1f3d96b154ce7bf
3d8d9a4bf15efab8c630176402364c5a59207e14
/src/org/tyaa/ws/dao/interfaces/SalesDAO.java
462445fef922d7bdfa136ac0fb0766aae51d48d0
[]
no_license
YuriiTrofimenko/javafx-water-sales
9319da3f28c5d83c7fc46d6d179ffd4051aa2da4
6fac1e2d2fd1c74c12f70cbb20eff08985da971e
refs/heads/master
2020-12-12T04:57:24.083540
2020-01-15T09:48:01
2020-01-15T09:48:01
234,047,939
0
0
null
null
null
null
UTF-8
Java
false
false
925
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package org.tyaa.ws.dao.interfaces; import java.util.Date; import java.util.List; import org.tyaa.ws.entity.Sale; /** * * @author Yurii */ public interface SalesDAO { List<Sale> getAllSales(); List<Sale> getSalesRange(int _maxResults, int _firstResult); Sale getSale(int _id); void createSale(Sale _sale); int updateSale(Sale _sale); int getSalesCount(); List<Sale> getFilteredSales( int _shopId , int _barrelId , int _carId , Date _fromDate , Date _toDate , int _driverId , int _maxResults , int _firstResult ); int deleteSale(Integer _saleId); //Sale getSaleXDaysBefore(int _daysInt); }
88848b99e4d38a3d4a192753929e14b22dde4207
400a56b8432f3ee74b54619720c4537a1d6dbfcd
/order/src/main/java/com/chen/order/enums/PayStatusEnum.java
fb8e280a3190b8fefc9437a10c37cf6fce53f5dc
[]
no_license
leifchen/springcloud-sell-demo
baab6eb22c7a9ef56257a63485b64f579c3bb2c5
56df66fac7c4bdafa7867e000271ae3727bc6897
refs/heads/master
2022-12-30T19:32:22.186023
2020-10-16T09:10:24
2020-10-16T09:10:24
267,019,920
0
0
null
null
null
null
UTF-8
Java
false
false
442
java
package com.chen.order.enums; import lombok.Getter; /** * 支付状态枚举 * <p> * @Author LeifChen * @Date 2020-05-29 */ @Getter public enum PayStatusEnum { /** * 支付状态 */ WAIT(0, "等待支付"), SUCCESS(1, "支付成功"), ; private Integer code; private String message; PayStatusEnum(Integer code, String message) { this.code = code; this.message = message; } }
08df09c82c4b26e425e018ce156447bc9d0655d6
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/2/2_8e7fa499e26a429158ad9a9ca709a5c60e06c879/UploadedFileValidator/2_8e7fa499e26a429158ad9a9ca709a5c60e06c879_UploadedFileValidator_t.java
6cfba34d39bcbfdec119ceaf5d2b668d4023a04f
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
1,519
java
/** * ValidFileValidator.java. * * @copyright 2011 Monits * @license Copyright (C) 2011. All rights reserved * @version Release: 1.0.0 * @link http://www.monits.com/ * @since 1.0.0 */ package com.monits.commons.validation; import javax.validation.ConstraintValidator; import javax.validation.ConstraintValidatorContext; /** * ValidFileValidator.java. * * @author Gaston Muñiz <[email protected]> * @copyright 2011 Monits * @license Copyright (C) 2011. All rights reserved * @version Release: 1.0.0 * @link http://www.monits.com/ * @since 1.0.0 */ public class UploadedFileValidator implements ConstraintValidator<UploadedFile, Object> { @Override public void initialize(UploadedFile constraintAnnotation) { } @Override public boolean isValid(Object value, ConstraintValidatorContext context) { final String methodIsEmpty = "isEmpty"; final String methodGetOriginalName = "getOriginalFilename"; // This class should be "CommonMultipartFile" final Class<? extends Object> clazz = value.getClass(); // Minimum size for the file, at least the extension. final long minLength = 3; try { if((Boolean)clazz.getMethod(methodIsEmpty).invoke(value)) { return false; } } catch (Exception e) { // Ignored } try { if(((String)clazz.getMethod(methodGetOriginalName).invoke(value)).length() >= minLength) { return true; } } catch (Exception e) { // Ignored } return false; } }
316e938c5e6060462b08ae48a039d148fce8eecc
74246a2b21a20254c531ae6cd2d2df6b174db7d6
/code/api/MaaSServlet/src/dhbk/maas/servlet/mahout/clustering/Streaming_KMeans.java
915a3f64fd5a54db1bd96bffae1e9180609e74bc
[]
no_license
daicathn92/Maas
2c0ee6acd8f4646922598f839a7682556ca46618
7bce6bf8324522124ee7c80c3b916e2a32f7ba6d
refs/heads/master
2020-12-11T09:08:49.697197
2014-09-27T09:09:40
2014-09-27T09:09:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
86
java
package dhbk.maas.servlet.mahout.clustering; public class Streaming_KMeans { }