blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
sequencelengths
1
1
author_id
stringlengths
0
313
df38b599ac4de33c1f27976ecb03ef20a207af77
3c416386a4f49060f904f5ec6af0dc1ca4910096
/SC_Q2_2015/Chapter_5/src/pets/Swimmable.java
a38ecd6e740ba5d2eb72f7a62522e35b9dd8c47a
[]
no_license
imusiievych/java_for_kids
d5a7fe1be1ad259878467cd4ed3e8a1444897a47
dc99783347f6f92d52b3e40fe8e4e7e9ac54feea
refs/heads/master
2021-01-19T03:12:39.378227
2015-07-06T12:48:58
2015-07-06T12:48:58
37,852,143
0
1
null
null
null
null
UTF-8
Java
false
false
324
java
package pets; /** * Created by imusiievych on 5/19/15. */ public interface Swimmable { static final int MAX_DEPTH = 10; // in feet public void swim(int howFar); public default void dive(int howDeep){ if (howDeep > MAX_DEPTH){ System.out.println("Can't dive, sorry"); } }; }
a027333a820f4a28fb34c42402d1385e70b3b399
9efc27280e78318f9b9447fb0d64bad786068541
/src/com/shopping/test/bean/CartBeanTest.java
27f3d75f83a3e10e30800ea0f4ed2fb66772541b
[]
no_license
krishna1994/ShoppingCart
2f51afa025ce884cb3b3fb244f23c45b74385482
3437a9b1fe2607861e8d5c59c1e5fb2e80871dc1
refs/heads/master
2021-01-13T15:09:09.992756
2016-12-20T11:24:09
2016-12-20T11:24:09
76,228,937
0
0
null
null
null
null
UTF-8
Java
false
false
809
java
package com.shopping.test.bean; import static org.junit.Assert.*; import org.junit.Test; import com.shopping.bean.CartBean; public class CartBeanTest { @Test public void setCartIdtest() { CartBean cartBean=new CartBean(); cartBean.setCartId(0); //assertEquals(0, cartBean.getCartId()); } @Test public void setuserNametest() { CartBean cartBean=new CartBean(); cartBean.setUserName(null); assertEquals(null,cartBean.getUserName()); cartBean.setUserName("abc"); assertEquals(0,cartBean.getUserName()); } @Test public void setTotalPrice() { CartBean cartBean=new CartBean(); cartBean.setTotalPrice(0.0); // assertEquals(0.0,cartBean.getTotalPrice()); cartBean.setTotalPrice(20000.0); //assertEquals(20000,cartBean.getTotalPrice()); } }
1c99e909d4341816968320cfc263c3ad8cf22f07
f8d7766d896452161118814098709600347d3f25
/src/test/java/facades/LikedMovieFacadeTest.java
3e70b02177c0452d061213446761789c090620d3
[]
no_license
PatrickJahn/eksamens_prep
1eaa1f08d38541217993c3f9649983e7fdaa784f
6372f8678e309226ed2c35f4fc716dd379438d9f
refs/heads/master
2023-02-10T17:15:39.461065
2021-01-12T18:22:11
2021-01-12T18:22:11
328,954,950
0
0
null
null
null
null
UTF-8
Java
false
false
3,187
java
package facades; import utils.EMF_Creator; import entities.LikedMovie; import entities.User; import errorhandling.API_Exception; import java.io.IOException; import java.util.concurrent.ExecutionException; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; import static org.junit.jupiter.api.Assertions.assertEquals; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; //Uncomment the line below, to temporarily disable this test @Disabled public class LikedMovieFacadeTest { private static EntityManagerFactory emf; private static LikedMovieFacade facade; private static RemoteServerFacade remoteFacade; public LikedMovieFacadeTest() { } @BeforeAll public static void setUpClass() { emf = EMF_Creator.createEntityManagerFactoryForTest(); facade = LikedMovieFacade.getFacadeExample(emf); remoteFacade = RemoteServerFacade.getRemoteServerFacade(emf); EntityManager em = emf.createEntityManager(); try { User u = new User("bobby", "123456"); em.getTransaction().begin(); em.persist(u); em.getTransaction().commit(); } finally { em.close(); } } @AfterAll public static void tearDownClass() { // Clean up database after test is done or use a persistence unit with drop-and-create to start up clean on every test } // Setup the DataBase in a known state BEFORE EACH TEST //TODO -- Make sure to change the code below to use YOUR OWN entity class @BeforeEach public void setUp() { EntityManager em = emf.createEntityManager(); try { User u = new User("bobby", "123456"); em.getTransaction().begin(); em.createNamedQuery("LikedMovie.deleteAllRows").executeUpdate(); em.persist(new LikedMovie("Some txt")); em.persist(new LikedMovie("aaa")); em.getTransaction().commit(); } finally { em.close(); } } @AfterEach public void tearDown() { // Remove any data after each test was run } // TODO: Delete or change this method @Test public void testAFacadeMethod() { assertEquals(2, facade.getRenameMeCount(), "Expects two rows in the database"); } @Test public void testGetAllFilms() throws IOException, InterruptedException, ExecutionException, API_Exception { String films = remoteFacade.getAllFilmsParallel(); assertEquals(true, films.contains("A New Hope"), "Expects to have the movie title A New Hope"); } @Test public void testaddLikedMovie() throws IOException, InterruptedException, ExecutionException, API_Exception { LikedMovie m = facade.addLikedMovie("bobby", "Some url"); assertEquals(3, facade.getRenameMeCount(), "Expects to have the movie title A New Hope"); } }
fa8cb22ab81843d59d048299d0a34f8c49b7f5ee
9f691c6207e1f053f8c77534e40b87c0872a8b25
/app/src/main/java/com/codepath/apps/restclienttemplate/TimeLineActivity.java
511aca55ac6fc27134fd8a5b9987e92ad5d10be5
[ "MIT", "Apache-2.0" ]
permissive
noahlee24/SimpleTweet2
1cd88fa5a728f0cb1dbcf966b855cd422027a8b6
4aaa45f51c92837be1d8fbdee9d97fcd9215c60f
refs/heads/master
2022-12-20T03:34:07.214254
2020-09-29T03:36:05
2020-09-29T03:36:05
299,495,510
0
0
null
null
null
null
UTF-8
Java
false
false
2,947
java
package com.codepath.apps.restclienttemplate; import androidx.appcompat.app.AppCompatActivity; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; import android.os.Bundle; import android.util.Log; import com.codepath.apps.restclienttemplate.models.Tweet; import com.codepath.asynchttpclient.callback.JsonHttpResponseHandler; import com.github.scribejava.apis.TwitterApi; import org.json.JSONArray; import org.json.JSONException; import java.util.ArrayList; import java.util.List; import okhttp3.Headers; public class TimeLineActivity extends AppCompatActivity { public static final String TAG = "TimeLineActivity"; TwitterClient client; RecyclerView rvTweets; List<Tweet> tweets; TweetsAdapter adapter; SwipeRefreshLayout swipeContainer; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_time_line); client = TwitterApp.getRestClient(this); swipeContainer = findViewById(R.id.swipeContainer); swipeContainer.setColorSchemeResources(android.R.color.holo_blue_bright, android.R.color.holo_green_light, android.R.color.holo_orange_light, android.R.color.holo_red_light); swipeContainer.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { Log.i(TAG, "fetching new data!"); } }); // find the recycler review rvTweets = findViewById(R.id.rvTweets); //initiaalize the list of tweets tweets = new ArrayList<>(); adapter = new TweetsAdapter( this, tweets); //recycler view setup: layou manager and adapater rvTweets.setLayoutManager(new LinearLayoutManager( this)); rvTweets.setAdapter(adapter); populatedHomeTimeline(); } private void populatedHomeTimeline() { client.getHomeTimeLine(new JsonHttpResponseHandler() { @Override public void onSuccess(int statusCode, Headers headers, JSON json) { Log.i(TAG, "onSucess!" + json.toString()); JSONArray jsonArray = json.jsonArray; try { adapter.clear(); tweets.addAll(Tweet.fromJsonArray(jsonArray)); adapter.notifyDataSetChanged(); swipeContainer.setRefreshing(false); } catch (JSONException e) { Log.e(TAG, "Json exception", e); } } @Override public void onFailure(int statusCode, Headers headers, String response, Throwable throwable) { Log.e(TAG, "onFailure", throwable); } }); } }
fe297a1c8043260d05b3cae04cb2650361259634
77c823615f8bca9105829ce0d5bb254e6cecca75
/src/main/java/com/csx/mooc/singleton/Singleton3.java
7e824339404c2faaefb38c9d217d48c7da8f378a
[]
no_license
chensongxian/concurrency
a2b0d772cadab20c1acc9bdcf23c151590bc1ae7
6d80e95b2000b3c746e85b24822b356652fd5998
refs/heads/master
2021-08-19T03:29:05.346345
2021-06-25T06:13:55
2021-06-25T06:13:55
138,052,819
0
0
null
null
null
null
UTF-8
Java
false
false
353
java
package com.csx.mooc.singleton; /** * 描述: 懒汉式(线程不安全) */ public class Singleton3 { private static Singleton3 instance; private Singleton3() { } public static Singleton3 getInstance() { if (instance == null) { instance = new Singleton3(); } return instance; } }
fddb1254e7191f04be7412156e61475bdf93e7f4
20888864ed6a19cfca7a500582c3d0cee735103d
/app/src/main/java/de/choesel/blechwiki/DividerItemDecoration.java
4f46b9427ee631676e801081bfe9c78c8b3a8763
[ "Apache-2.0" ]
permissive
ChristianHoesel/android-blechwiki
be88db68253560193c8f6ce252e7cd913304370b
17e9ac7a0ddb1bbcea461640cb2ec9dd45f2d22d
refs/heads/master
2021-01-01T05:19:53.276539
2018-11-04T08:43:35
2018-11-04T08:43:35
58,205,267
0
0
null
null
null
null
UTF-8
Java
false
false
4,651
java
package de.choesel.blechwiki; /** * Created by Christian on 16.05.2016. */ import android.content.Context; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.AttributeSet; import android.view.View; public class DividerItemDecoration extends RecyclerView.ItemDecoration { private Drawable mDivider; private boolean mShowFirstDivider = false; private boolean mShowLastDivider = false; public DividerItemDecoration(Context context, AttributeSet attrs) { final TypedArray a = context .obtainStyledAttributes(attrs, new int[]{android.R.attr.listDivider}); mDivider = a.getDrawable(0); a.recycle(); } public DividerItemDecoration(Context context, AttributeSet attrs, boolean showFirstDivider, boolean showLastDivider) { this(context, attrs); mShowFirstDivider = showFirstDivider; mShowLastDivider = showLastDivider; } public DividerItemDecoration(Drawable divider) { mDivider = divider; } public DividerItemDecoration(Drawable divider, boolean showFirstDivider, boolean showLastDivider) { this(divider); mShowFirstDivider = showFirstDivider; mShowLastDivider = showLastDivider; } @Override public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { super.getItemOffsets(outRect, view, parent, state); if (mDivider == null) { return; } if (parent.getChildAdapterPosition(view) < 1) { return; } if (getOrientation(parent) == LinearLayoutManager.VERTICAL) { outRect.top = mDivider.getIntrinsicHeight(); } else { outRect.left = mDivider.getIntrinsicWidth(); } } @Override public void onDrawOver(Canvas c, RecyclerView parent, RecyclerView.State state) { if (mDivider == null) { super.onDrawOver(c, parent, state); return; } // Initialization needed to avoid compiler warning int left = 0, right = 0, top = 0, bottom = 0, size; int orientation = getOrientation(parent); int childCount = parent.getChildCount(); if (orientation == LinearLayoutManager.VERTICAL) { size = mDivider.getIntrinsicHeight(); left = parent.getPaddingLeft(); right = parent.getWidth() - parent.getPaddingRight(); } else { //horizontal size = mDivider.getIntrinsicWidth(); top = parent.getPaddingTop(); bottom = parent.getHeight() - parent.getPaddingBottom(); } for (int i = mShowFirstDivider ? 0 : 1; i < childCount; i++) { View child = parent.getChildAt(i); RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams(); if (orientation == LinearLayoutManager.VERTICAL) { top = child.getTop() - params.topMargin; bottom = top + size; } else { //horizontal left = child.getLeft() - params.leftMargin; right = left + size; } mDivider.setBounds(left, top, right, bottom); mDivider.draw(c); } // show last divider if (mShowLastDivider && childCount > 0) { View child = parent.getChildAt(childCount - 1); RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams(); if (orientation == LinearLayoutManager.VERTICAL) { top = child.getBottom() + params.bottomMargin; bottom = top + size; } else { // horizontal left = child.getRight() + params.rightMargin; right = left + size; } mDivider.setBounds(left, top, right, bottom); mDivider.draw(c); } } private int getOrientation(RecyclerView parent) { if (parent.getLayoutManager() instanceof LinearLayoutManager) { LinearLayoutManager layoutManager = (LinearLayoutManager) parent.getLayoutManager(); return layoutManager.getOrientation(); } else { throw new IllegalStateException( "DividerItemDecoration can only be used with a LinearLayoutManager."); } } }
91f9b884c6ae29934eb7aed8f7db5a87881dd3ba
8ebfdb74ba11e74b2a36de0c66d844f4ae05379b
/src/ny/how2j/j_1_java_se/jdbc/j_5_预编译Statement/TestJDBC5_1_使用PreparedStatement.java
94b478c9b897d06eb63334ec62b0e5b587bfbb27
[]
no_license
Newyear-181121/Learning-code
f9b13d237ce44eb9bd64ff19df7f096c898ff4b6
a67d1447bdbd6904eb1fabfe8fc5e43b9f3c817b
refs/heads/main
2021-06-19T18:10:11.067487
2020-12-08T11:33:11
2020-12-08T11:33:11
199,288,301
3
0
null
null
null
null
UTF-8
Java
false
false
1,795
java
package jdbc.j_5_预编译Statement; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.SQLException; /** * 和 Statement一样,PreparedStatement也是用来执行sql语句的 * 与创建Statement不同的是,需要根据sql语句创建PreparedStatement * 除此之外,还能够通过设置参数,指定相应的值,而不是Statement那样使用字符串拼接 * * 注: 这是JAVA里唯二的基1的地方,另一个是查询语句中的ResultSet也是基1的。 */ public class TestJDBC5_1_使用PreparedStatement { public static void main(String[] args) { try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException e) { e.printStackTrace(); } String sql = "insert into hero values(null,?,?,?)"; try (Connection c = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/how2java?characterEncoding=UTF-8","root", "root"); // 根据sql语句创建PreparedStatement PreparedStatement ps = c.prepareStatement(sql); ) { // 设置参数 ps.setString(1, "提莫"); ps.setFloat(2, 313.0f); ps.setInt(3, 50); // 执行 ps.execute(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } /** * 2 : PreparedStatement的优点1-参数设置 * * Statement 需要进行字符串拼接,可读性和维护性比较差 * * String sql = "insert into hero values(null,"+"'提莫'"+","+313.0f+","+50+")"; * * * PreparedStatement 使用参数设置,可读性好,不易犯错 * * String sql = "insert into hero values(null,?,?,?)"; * */
5227b83ed38b1705b9306ed1a9105b2401f86408
1732809b5d514dae71ef6b750585a70303764216
/MiniWeather/app/src/main/java/com/xiantos/miniWeather/NavigationDrawerFragment.java
72a5a524857d251fbb16ed1c656aa8d6eea4c5bc
[]
no_license
JesseWeiand/MiniWeiather
b8a85640a555b0ee73fc5a6302678fff9ffe046a
22c7867f8eedf92f6769a3d372fb2dad6578fd78
refs/heads/master
2021-01-19T19:37:50.770913
2014-03-06T06:10:18
2014-03-06T06:10:18
17,467,975
1
0
null
null
null
null
UTF-8
Java
false
false
10,768
java
package com.xiantos.miniWeather; import android.support.v7.app.ActionBarActivity;; import android.app.Activity; import android.support.v7.app.ActionBar; import android.support.v4.app.Fragment; import android.support.v4.app.ActionBarDrawerToggle; import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; import android.content.SharedPreferences; import android.content.res.Configuration; import android.os.Bundle; import android.preference.PreferenceManager; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.Toast; /** * Fragment used for managing interactions for and presentation of a navigation drawer. * See the <a href="https://developer.android.com/design/patterns/navigation-drawer.html#Interaction"> * design guidelines</a> for a complete explanation of the behaviors implemented here. */ public class NavigationDrawerFragment extends Fragment { /** * Remember the position of the selected item. */ private static final String STATE_SELECTED_POSITION = "selected_navigation_drawer_position"; /** * Per the design guidelines, you should show the drawer on launch until the user manually * expands it. This shared preference tracks this. */ private static final String PREF_USER_LEARNED_DRAWER = "navigation_drawer_learned"; /** * A pointer to the current callbacks instance (the Activity). */ private NavigationDrawerCallbacks mCallbacks; /** * Helper component that ties the action bar to the navigation drawer. */ private ActionBarDrawerToggle mDrawerToggle; private DrawerLayout mDrawerLayout; private ListView mDrawerListView; private View mFragmentContainerView; private int mCurrentSelectedPosition = 0; private boolean mFromSavedInstanceState; private boolean mUserLearnedDrawer; public NavigationDrawerFragment() { } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Read in the flag indicating whether or not the user has demonstrated awareness of the // drawer. See PREF_USER_LEARNED_DRAWER for details. SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getActivity()); mUserLearnedDrawer = sp.getBoolean(PREF_USER_LEARNED_DRAWER, false); if (savedInstanceState != null) { mCurrentSelectedPosition = savedInstanceState.getInt(STATE_SELECTED_POSITION); mFromSavedInstanceState = true; } // Select either the default item (0) or the last selected item. selectItem(mCurrentSelectedPosition); } @Override public void onActivityCreated (Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); // Indicate that this fragment would like to influence the set of actions in the action bar. setHasOptionsMenu(true); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mDrawerListView = (ListView) inflater.inflate( R.layout.fragment_navigation_drawer, container, false); mDrawerListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { selectItem(position); } }); mDrawerListView.setAdapter(new ArrayAdapter<String>( getActionBar().getThemedContext(), android.R.layout.simple_list_item_1, android.R.id.text1, new String[]{ getString(R.string.title_section1), getString(R.string.title_section2), getString(R.string.title_section3), getString(R.string.title_section4), })); mDrawerListView.setItemChecked(mCurrentSelectedPosition, true); return mDrawerListView; } public boolean isDrawerOpen() { return mDrawerLayout != null && mDrawerLayout.isDrawerOpen(mFragmentContainerView); } /** * Users of this fragment must call this method to set up the navigation drawer interactions. * * @param fragmentId The android:id of this fragment in its activity's layout. * @param drawerLayout The DrawerLayout containing this fragment's UI. */ public void setUp(int fragmentId, DrawerLayout drawerLayout) { mFragmentContainerView = getActivity().findViewById(fragmentId); mDrawerLayout = drawerLayout; // set a custom shadow that overlays the main content when the drawer opens mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); // set up the drawer's list view with items and click listener ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeButtonEnabled(true); // ActionBarDrawerToggle ties together the the proper interactions // between the navigation drawer and the action bar app icon. mDrawerToggle = new ActionBarDrawerToggle( getActivity(), /* host Activity */ mDrawerLayout, /* DrawerLayout object */ R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */ R.string.navigation_drawer_open, /* "open drawer" description for accessibility */ R.string.navigation_drawer_close /* "close drawer" description for accessibility */ ) { @Override public void onDrawerClosed(View drawerView) { super.onDrawerClosed(drawerView); if (!isAdded()) { return; } getActivity().supportInvalidateOptionsMenu(); // calls onPrepareOptionsMenu() } @Override public void onDrawerOpened(View drawerView) { super.onDrawerOpened(drawerView); if (!isAdded()) { return; } if (!mUserLearnedDrawer) { // The user manually opened the drawer; store this flag to prevent auto-showing // the navigation drawer automatically in the future. mUserLearnedDrawer = true; SharedPreferences sp = PreferenceManager .getDefaultSharedPreferences(getActivity()); sp.edit().putBoolean(PREF_USER_LEARNED_DRAWER, true).commit(); } getActivity().supportInvalidateOptionsMenu(); // calls onPrepareOptionsMenu() } }; // If the user hasn't 'learned' about the drawer, open it to introduce them to the drawer, // per the navigation drawer design guidelines. if (!mUserLearnedDrawer && !mFromSavedInstanceState) { mDrawerLayout.openDrawer(mFragmentContainerView); } // Defer code dependent on restoration of previous instance state. mDrawerLayout.post(new Runnable() { @Override public void run() { mDrawerToggle.syncState(); } }); mDrawerLayout.setDrawerListener(mDrawerToggle); } private void selectItem(int position) { mCurrentSelectedPosition = position; if (mDrawerListView != null) { mDrawerListView.setItemChecked(position, true); } if (mDrawerLayout != null) { mDrawerLayout.closeDrawer(mFragmentContainerView); } if (mCallbacks != null) { mCallbacks.onNavigationDrawerItemSelected(position); } } @Override public void onAttach(Activity activity) { super.onAttach(activity); try { mCallbacks = (NavigationDrawerCallbacks) activity; } catch (ClassCastException e) { throw new ClassCastException("Activity must implement NavigationDrawerCallbacks."); } } @Override public void onDetach() { super.onDetach(); mCallbacks = null; } @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putInt(STATE_SELECTED_POSITION, mCurrentSelectedPosition); } @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); // Forward the new configuration the drawer toggle component. mDrawerToggle.onConfigurationChanged(newConfig); } @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { // If the drawer is open, show the global app actions in the action bar. See also // showGlobalContextActionBar, which controls the top-left area of the action bar. if (mDrawerLayout != null && isDrawerOpen()) { inflater.inflate(R.menu.global, menu); showGlobalContextActionBar(); } super.onCreateOptionsMenu(menu, inflater); } @Override public boolean onOptionsItemSelected(MenuItem item) { if (mDrawerToggle.onOptionsItemSelected(item)) { return true; } if (item.getItemId() == R.id.action_example) { Toast.makeText(getActivity(), "Example action.", Toast.LENGTH_SHORT).show(); return true; } return super.onOptionsItemSelected(item); } /** * Per the navigation drawer design guidelines, updates the action bar to show the global app * 'context', rather than just what's in the current screen. */ private void showGlobalContextActionBar() { ActionBar actionBar = getActionBar(); actionBar.setDisplayShowTitleEnabled(true); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setTitle(R.string.app_name); } private ActionBar getActionBar() { return ((ActionBarActivity) getActivity()).getSupportActionBar(); } /** * Callbacks interface that all activities using this fragment must implement. */ public static interface NavigationDrawerCallbacks { /** * Called when an item in the navigation drawer is selected. */ void onNavigationDrawerItemSelected(int position); } }
b9b466b099834dacf0ad14acb0e0bda7552781c0
ae7fb24f79ecf6ac2f90242093db5beeea49ac57
/media/src/main/java/com/example/media/task/AudioPlayTask.java
9521104c2ddb36374918dd215c030b7edd306f78
[]
no_license
AnPMe/android
52060b739aeaab66b195db8d9205eb2228cb0e0d
5159e423016086456ed317193584593c624ec690
refs/heads/master
2020-03-21T12:43:34.406385
2017-11-04T14:08:10
2017-11-04T14:08:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,954
java
package com.example.media.task; import java.io.BufferedInputStream; import java.io.DataInputStream; import java.io.File; import java.io.FileInputStream; import android.media.AudioManager; import android.media.AudioTrack; import android.media.AudioTrack.OnPlaybackPositionUpdateListener; import android.os.AsyncTask; import android.os.Handler; public class AudioPlayTask extends AsyncTask<String, Integer, Void> { private final static String TAG = "AudioPlayTask"; private Handler mHandler = new Handler(); private int mPlayTime = 0; @Override protected Void doInBackground(String... arg0) { File recordFile = new File(arg0[0]); int frequence = Integer.parseInt(arg0[1]); int channelConfig = Integer.parseInt(arg0[2]); int audioFormat = Integer.parseInt(arg0[3]); try { // 定义输入流,将音频写入到AudioTrack类中,实现播放 DataInputStream dis = new DataInputStream( new BufferedInputStream(new FileInputStream(recordFile))); int bsize = AudioTrack.getMinBufferSize(frequence, channelConfig, audioFormat); short[] buffer = new short[bsize / 4]; AudioTrack track = new AudioTrack(AudioManager.STREAM_MUSIC, frequence, channelConfig, audioFormat, bsize, AudioTrack.MODE_STREAM); //track.setNotificationMarkerPosition(1000); track.setPositionNotificationPeriod(1000); track.setPlaybackPositionUpdateListener(new PlaybackUpdateListener()); track.play(); // 由于AudioTrack播放的是流,所以,我们需要一边播放一边读取 while (isCancelled() != true && dis.available() > 0) { int i = 0; while (dis.available() > 0 && i < buffer.length) { buffer[i] = dis.readShort(); i++; } // 然后将数据写入到AudioTrack中 track.write(buffer, 0, buffer.length); } track.stop(); dis.close(); } catch (Exception e) { e.printStackTrace(); } return null; } @Override protected void onPreExecute() { mPlayTime = 0; mHandler.postDelayed(mPlayRun, 1000); } @Override protected void onPostExecute(Void result) { if (mListener != null) { mListener.onPlayFinish(); } mHandler.removeCallbacks(mPlayRun); } private class PlaybackUpdateListener implements OnPlaybackPositionUpdateListener { @Override public void onMarkerReached(AudioTrack track) { } @Override public void onPeriodicNotification(AudioTrack track) { if (mListener != null) { mListener.onPlayUpdate(mPlayTime); } } } private Runnable mPlayRun = new Runnable() { @Override public void run() { mPlayTime++; mHandler.postDelayed(this, 1000); } }; private OnPlayListener mListener; public void setOnPlayListener(OnPlayListener listener) { mListener = listener; } public static interface OnPlayListener { public abstract void onPlayFinish(); public abstract void onPlayUpdate(int duration); } }
6ae2410b074d6e7cea5b4e65d1f2a7d0cec523e3
bbf9e6e7df71e3ccc7d7883ee516bd06e9715072
/src/main/java/com/bits/r8d/content/domain/Price.java
ac177deb80bec1fd411f8e8e23bf71fd684fb8fd
[]
no_license
bitsofalex/infinispan_cassandra_mongo
9e5475b9b61cdd4d926350ff8af89fde5b4f3184
6b6d0498174015f2374d2bff4567652c75425e4b
refs/heads/master
2020-06-02T22:19:31.990633
2014-06-25T06:20:34
2014-06-25T06:20:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
832
java
package com.bits.r8d.content.domain; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import javax.validation.constraints.NotNull; import java.io.Serializable; import java.math.BigDecimal; /** * Created by alexl on 20/06/2014. */ public class Price extends Publishable implements Serializable { @NotNull private Type type; @NotNull private final BigDecimal amount; @JsonCreator public Price(@JsonProperty("type") final Type type, @JsonProperty("price") final BigDecimal amount) { this.type = type; this.amount = amount; } public Type getType() { return type; } public BigDecimal getAmount() { return amount; } public enum Type{ RETAILER_NORMAL_PRICE } }
023a70e294b8c35c1887e58f9ae87e7f22587ff2
73c82ec7716da9edb41485b57b0e055047aaffba
/76-Minimum-Window-Substring/solution.java
f49f95b36cde1d124fa069abeb5591542f708885
[]
no_license
cassieyrh/LeetCode
8960e038fffe3df33984002315e484dda1149560
4aed8cdb539f1c5b7a4fe92388e5fcd489afdc45
refs/heads/master
2020-05-29T15:07:00.168805
2016-10-11T20:25:17
2016-10-11T20:25:17
61,564,877
0
0
null
null
null
null
UTF-8
Java
false
false
1,141
java
public class Solution { public String minWindow(String s, String t) { Map<Character, Integer> map = new HashMap<>(); for(char c : s.toCharArray()){ map.put(c, 0); } for(char cha : t.toCharArray()){ if(map.containsKey(cha)){ map.put(cha, map.get(cha)+1); } else return ""; } int start = 0, end = 0, head = 0, count = t.length(), minLen = Integer.MAX_VALUE; while(end < s.length()){ char cur = s.charAt(end); if(map.get(cur) > 0) count--; map.put(cur, map.get(cur)-1); end++; while(count == 0){ if(end-start < minLen){ minLen = end - start; head = start; } char cur2 = s.charAt(start); map.put(cur2, map.get(cur2)+1); if(map.get(cur2) >0){ count++; } start++; } } return minLen == Integer.MAX_VALUE ? "" : s.substring(head, head+minLen); } }
4a84983168ee3848954a12fadbd2216e25115a62
25cef6667f0a00bd56bcb617e8f00aad2c9b0972
/src/week4/statesexample/states/IdleState.java
40b5e31b8026b5f7af37630984a5e9d0584af503
[ "MIT" ]
permissive
gvdijk/OOP3-Weekly
e2492243d72cda7c1e216eff0693ef09aac2a64c
15da5326ba63d272dc837efc6454a5dd162d83d9
refs/heads/master
2020-04-22T09:50:45.550062
2019-03-28T11:14:18
2019-03-28T11:14:18
170,285,433
0
0
null
null
null
null
UTF-8
Java
false
false
1,047
java
package week4.statesexample.states; import week4.statesexample.Grabber; public class IdleState implements State { Grabber grabber; public IdleState(Grabber grabber) { this.grabber = grabber; } @Override public void start() { System.out.println("Please insert a coin"); } @Override public void insert(int amount) { System.out.println("Adding " + amount + " funds!"); grabber.setFunds(amount); grabber.setState(grabber.getHasFundsState()); } @Override public void refund() { System.out.println("No funds available"); } @Override public void grab() { System.out.println("Please insert a coin"); } @Override public void release() { System.out.println("Cannot release now..."); } @Override public void refill(int amount) { if (amount > 0) { System.out.println("Adding " + amount + " extra prices!"); grabber.setPrices(grabber.getPrices() + amount); } } }
97e4c1424d24d69b91ef9b9c49f466a3351b51ed
f1e7fec608c6fd890d3f486b722c457fdbc52138
/src/util/VisualTools.java
a915bc305d7025a6b718476d763f569ad9778b37
[]
no_license
christophernarciso/ExcellentVorkathUI
6821878b35fe3374521bb262f9848b6cd41e6254
50e47a708a3152d683849e3424c95f14c6f74433
refs/heads/master
2023-01-30T03:00:47.943691
2020-12-18T04:57:37
2020-12-18T04:57:37
322,492,705
0
0
null
null
null
null
UTF-8
Java
false
false
674
java
package util; import java.awt.*; import java.awt.image.BufferedImage; public class VisualTools { public static BufferedImage resize(Image originalImage, int scaledWidth, int scaledHeight, boolean preserveAlpha) { int imageType = preserveAlpha ? BufferedImage.TYPE_INT_ARGB : BufferedImage.TYPE_INT_RGB; BufferedImage scaledBI = new BufferedImage(scaledWidth, scaledHeight, imageType); Graphics2D g = scaledBI.createGraphics(); if (preserveAlpha) { g.setComposite(AlphaComposite.Src); } g.drawImage(originalImage, 0, 0, scaledWidth, scaledHeight, null); g.dispose(); return scaledBI; } }
c0b1b9219711e3c70c5e167a044777a7f850a98a
ef7ada3b9cf5ed63b985eae9c8ad190f2fe582a8
/CursusOefeninenOpl/exercise15_06/graphics/Shape.java
b132b4dac2425670026de07dc3fdf76cacb077ad
[]
no_license
93design/Java_Basis_Opl
5a5269c06549bc59bde1e4741a3c1fcd32dae1e4
a0ce0702bbeaa55992969e1f6ec568b67ed21e48
refs/heads/master
2022-03-25T17:14:07.152279
2019-12-02T00:11:16
2019-12-02T00:11:16
169,244,098
2
1
null
null
null
null
UTF-8
Java
false
false
1,255
java
package graphics; public abstract class Shape implements Drawable { private int x; private int y; private static int count = 0; { count++; } public Shape() { this(0, 0); } public Shape(int x, int y) { this.x = x; this.y = y; } public void setX(int x) { this.x = x; } public int getX() { return x; } public void setY(int y) { this.y = y; } public int getY() { return y; } public void setPosition(int x, int y) { this.x = x; this.y = y; } public static int getCount() { return count; } public abstract double getArea(); public abstract double getPerimeter(); @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + x; result = prime * result + y; return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Shape other = (Shape) obj; if (x != other.x) return false; if (y != other.y) return false; return true; } }
eff1727f0b8977a4c558d08336bbf1c4469a0b3a
643837a460b587f7574988a7abaddf3b7ca2514c
/src/main/java/com/evolvingreality/onleave/config/metrics/JHipsterHealthIndicatorConfiguration.java
c2089afa9973f1acbb40cbd5b8d44c71673398c6
[]
no_license
derekreynolds/onleave
a09a82f64966276dd202f917e99d39a37ccdefe8
b4d840b59bec87e8de828d5d1fde1d86f5629ad9
refs/heads/master
2020-04-04T01:57:05.483469
2015-12-05T21:09:05
2015-12-05T21:09:05
23,024,984
0
0
null
null
null
null
UTF-8
Java
false
false
777
java
package com.evolvingreality.onleave.config.metrics; import org.springframework.boot.actuate.health.HealthIndicator; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.mail.javamail.JavaMailSenderImpl; import javax.inject.Inject; import javax.sql.DataSource; @Configuration public class JHipsterHealthIndicatorConfiguration { @Inject private JavaMailSenderImpl javaMailSender; @Inject private DataSource dataSource; @Bean public HealthIndicator dbHealthIndicator() { return new DatabaseHealthIndicator(dataSource); } @Bean public HealthIndicator mailHealthIndicator() { return new JavaMailHealthIndicator(javaMailSender); } }
cee3f6bb0b303d66dbcb60e3717b6cff862f9c47
7d678a8d334927d1658d55e7ddc9620995daee89
/src/main/java/Entity_types/Beams/FiringBeam.java
0c59ce4045b30d97e5b543bab961f025e92db84a
[]
no_license
lawlessc/starseige
6f3462de1e1bf438e66a3bf426fc7b8076fb7408
04ab22d0ee1f3e9bfcb7d12992050f9499b198c2
refs/heads/main
2023-04-04T22:48:22.507255
2021-04-16T03:12:45
2021-04-16T03:12:45
358,415,608
0
0
null
null
null
null
UTF-8
Java
false
false
1,066
java
package Entity_types.Beams; import com.threed.jpct.GLSLShader; import com.threed.jpct.Object3D; import com.threed.jpct.SimpleVector; import Entity_types.BaseEntitys.Entity; /** * Created by Chris on 11/10/2017. */ public abstract class FiringBeam extends Beam { // Entity Target; int laserLife =30; public FiringBeam(Entity parent, Entity target, Object3D bodyReference, GLSLShader shader) { super(parent.getPosition(), target.getPosition(), bodyReference, shader); Parent_Entity = parent; Target_Entity= target; Endpoint = new SimpleVector(Target_Entity.getPosition()); Startpoint = new SimpleVector(Parent_Entity.getPosition()); } @Override public void Update() { super.Update();//eventually need add a seeking like effect to this. Endpoint = new SimpleVector(Target_Entity.getPosition()); Startpoint = new SimpleVector(Parent_Entity.getPosition()); laserLife--; if(laserLife <= 0) { this.delete(); } } }
8c5fce0f8a4b72fdec319030c02a5b75b76a2e1a
df24f1b8f1f8223cab4edaeab5dd15ff6b5b314f
/src/main/java/br/com/zupacademy/bruno/proposta/criarCartao/Cartao.java
79d2c3607be820d574a840b850801b985b30e83b
[ "Apache-2.0" ]
permissive
brunolv6/orange-talents-05-template-proposta
e46ab43d30cc034ae6afa8314e5ed186299c75e5
8a3202d45df5d03f945129094a00b7b664d41b46
refs/heads/main
2023-06-07T13:10:21.679213
2021-07-06T12:59:10
2021-07-06T12:59:10
377,161,421
0
0
Apache-2.0
2021-06-15T12:51:26
2021-06-15T12:51:25
null
UTF-8
Java
false
false
2,853
java
package br.com.zupacademy.bruno.proposta.criarCartao; import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EnumType; import javax.persistence.Enumerated; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; import javax.validation.constraints.PositiveOrZero; import br.com.zupacademy.bruno.proposta.adicionarBiometria.Biometria; import br.com.zupacademy.bruno.proposta.associarCarteira.Carteira; import br.com.zupacademy.bruno.proposta.avisarViagemCartao.Aviso; import br.com.zupacademy.bruno.proposta.bloquearCartao.Bloqueio; @Entity public class Cartao { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @NotNull @NotEmpty @Column(unique = true) private String idCartao; @NotNull private LocalDateTime emitidoEm; @NotNull @PositiveOrZero private BigDecimal limite; @NotNull @NotEmpty private String userId; @OneToMany(mappedBy = "cartao", cascade = CascadeType.ALL) private List<Biometria> biometrias = new ArrayList<>(); @OneToMany(mappedBy = "cartao", cascade = CascadeType.ALL) private List<Bloqueio> bloqueios = new ArrayList<>(); @OneToMany(mappedBy = "cartao", cascade = CascadeType.ALL) private List<Aviso> avisos = new ArrayList<>(); @OneToMany(mappedBy = "cartao", cascade = CascadeType.ALL) private List<Carteira> carteiras = new ArrayList<>(); @Enumerated(EnumType.STRING) private Status status = Status.DISPONIVEL; @Deprecated public Cartao() { super(); } public Cartao(@NotNull @NotEmpty String idCartao, @NotNull LocalDateTime emitidoEm, @NotNull @PositiveOrZero BigDecimal limite, @NotEmpty @NotNull String userId) { super(); this.idCartao = idCartao; this.emitidoEm = emitidoEm; this.limite = limite; this.userId = userId; } public Long getId() { return id; } public String getIdCartao() { return idCartao; } public LocalDateTime getEmitidoEm() { return emitidoEm; } public BigDecimal getLimite() { return limite; } public void setBiometrias(Biometria biometria) { this.biometrias.add(biometria); } public void setBloqueio(Bloqueio bloqueio) { this.bloqueios.add(bloqueio); } public void setAviso(Aviso aviso) { this.avisos.add(aviso); } public void setCarteiras(Carteira carteira) { this.carteiras.add(carteira); } public Boolean isThisUserId(String possivelUserId){ return userId.equals(possivelUserId); } public void setStatus(Status status) { this.status = status; } public String getUserId() { return userId; } }
da5bbb2d590431e5293bb9e31d031b19c87f3ef6
0e97723fbd150cfabde52895e9c2f50469b99892
/src/main/java/com/hjy/common/utils/file/SmbFileUtil.java
1f83f231472dfa8299e4ffb03e7823605350e090
[]
no_license
lc84188418/hjyRepository-ywjg
0195effaeb8f5a8c76cfd6b5fbb327aa2a2a2d28
7be56317a31c74fbc60407ff05b7b8745e62b876
refs/heads/master
2023-06-09T16:52:10.655860
2021-06-17T07:33:04
2021-06-17T07:33:04
290,639,959
0
0
null
null
null
null
UTF-8
Java
false
false
5,195
java
package com.hjy.common.utils.file; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import com.hjy.common.utils.PropertiesUtil; import com.hjy.synthetical.entity.TSyntheticalMakecard; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import jcifs.smb.NtlmPasswordAuthentication; import jcifs.smb.SmbFile; import jcifs.smb.SmbFileInputStream; import jcifs.smb.SmbFileOutputStream; public class SmbFileUtil { private static Logger log = LoggerFactory.getLogger(SmbFileUtil.class); //字节长度 private static final int byteLen = 1024; private static String USER_DOMAIN = null; private static String USER_ACCOUNT = "hjyshare"; private static String USER_PWS = "hjyshare"; /** * @Title listFiles * @Description 遍历指定目录下的文件 * @date 2019-01-11 09:56 */ public static void smbFile(String shareDirectory) throws Exception { // 域服务器验证 NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication(USER_DOMAIN, USER_ACCOUNT, USER_PWS); SmbFile remoteFile = new SmbFile(shareDirectory, auth); if (remoteFile.exists()) { // SmbFile[] files = remoteFile.listFiles(); // remoteFile.listFiles(shareDirectory); // for (SmbFile f : files) { // log.info(f.getName()); // } //共享目录中的文件路径,如smb://132.20.2.33/CIMPublicTest/eg.txt String shareUrl = PropertiesUtil.getValue("share.file.path"); //本地目录,如tempStore/smb String localDirectory = "d://hjy//ywjg//makeCard"; //将共享文件下载到本地 SmbFileUtil.smbGet(shareUrl,localDirectory); //将本地文件上传到共享文件 SmbFileUtil.smbPut(PropertiesUtil.getValue("share.file.directory"),PropertiesUtil.getValue("makeCard.file.local.path")); } else { log.info("文件不存在"); } } /** * @Title smbGet * @Param shareUrl 共享目录中的文件路径,如smb://132.20.2.33/CIMPublicTest/eg.txt * @Param localDirectory 本地目录,如tempStore/smb */ public static void smbGet(String shareUrl, String localDirectory) throws Exception { NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication(USER_DOMAIN, USER_ACCOUNT, USER_PWS); SmbFile remoteFile = new SmbFile(shareUrl, auth); if (!remoteFile.exists()) { log.info("共享文件不存在"); return; } // 有文件的时候再初始化输入输出流 InputStream in = null; OutputStream out = null; log.info("下载共享目录的文件 shareUrl 到 localDirectory"); try { String fileName = remoteFile.getName(); File localFile = new File(localDirectory + File.separator + fileName); File fileParent = localFile.getParentFile(); if (null != fileParent && !fileParent.exists()) { fileParent.mkdirs(); } in = new BufferedInputStream(new SmbFileInputStream(remoteFile)); out = new BufferedOutputStream(new FileOutputStream(localFile)); byte[] buffer = new byte[1024]; while (in.read(buffer) != -1) { out.write(buffer); buffer = new byte[1024]; } out.flush(); //刷新缓冲区输出流 } catch (Exception e) { e.printStackTrace(); } finally { out.close(); in.close(); } } /** * * @Title smbPut * @Description 向共享目录上传文件 * @Param shareDirectory 共享目录 * @Param localFilePath 本地目录中的文件路径 * @date 2019-01-10 20:16 */ public static void smbPut(String shareDirectory, String localFilePath) { InputStream in = null; OutputStream out = null; try { File localFile = new File(localFilePath); String fileName = localFile.getName(); // 域服务器验证 NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication(USER_DOMAIN, USER_ACCOUNT, USER_PWS); SmbFile remoteFile = new SmbFile(shareDirectory + "/" + fileName, auth); in = new BufferedInputStream(new FileInputStream(localFile)); out = new BufferedOutputStream(new SmbFileOutputStream(remoteFile)); byte[] buffer = new byte[byteLen]; while (in.read(buffer) != -1) { out.write(buffer); buffer = new byte[byteLen]; } out.flush(); } catch (Exception e) { e.printStackTrace(); } finally { try { out.close(); in.close(); } catch (IOException e) { e.printStackTrace(); } } } }
1521a80baa45b297cbe96d28632d7c1abaaca3f8
a4e30c0d1be25ef085806a7921154a15e2554a2a
/src/Ch10_Using_Input_and_Output/CopyFileAutoClose.java
a8eaae8a837ddbbfb6d96f99c378295b89ade77b
[]
no_license
akapne01/Java-A-Beginner-s-Guide
ba82220c052006ffd3225341eaafb1e92beea11f
d661e066ca99f4ae5a8986a0da70d1593ac301cb
refs/heads/master
2022-02-20T12:45:16.345966
2019-08-24T10:26:51
2019-08-24T10:26:51
186,996,853
0
0
null
null
null
null
UTF-8
Java
false
false
1,051
java
package Ch10_Using_Input_and_Output; /* * p. 353 * A version of Copy File that uses try-with-resources. * It demonstrates two resources (in this case files) being * managed by a single try statement. */ import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; public class CopyFileAutoClose { public static void main(String[] args) { int i; // Confirm that both files have been specified if (args.length != 2) { System.out.println("Usage: CopyFileAutoClose from to"); return; } /* * Open and manage 2 files via the try statement. * Both defined in the try statement and separated via semicolon */ try (FileInputStream fin = new FileInputStream(args[0]); FileOutputStream fout = new FileOutputStream(args[1])) { do { i = fin.read(); if (i != -1) fout.write(i); } while (i != -1); } catch (IOException e) { System.out.println("I/O Error: " + e); } } }
47bef20bdb83e0e7014eb8510ea757fcff60d877
95e944448000c08dd3d6915abb468767c9f29d3c
/sources/com/p280ss/android/ugc/aweme/emoji/p1207e/C27558e.java
dd8d31b424c66bc059df97df2549a39542b9496d
[]
no_license
xrealm/tiktok-src
261b1faaf7b39d64bb7cb4106dc1a35963bd6868
90f305b5f981d39cfb313d75ab231326c9fca597
refs/heads/master
2022-11-12T06:43:07.401661
2020-07-04T20:21:12
2020-07-04T20:21:12
null
0
0
null
null
null
null
UTF-8
Java
false
false
769
java
package com.p280ss.android.ugc.aweme.emoji.p1207e; import bolts.C1591g; import bolts.C1592h; import com.p280ss.android.ugc.aweme.emoji.emojichoose.model.Resources; import java.util.List; /* renamed from: com.ss.android.ugc.aweme.emoji.e.e */ final /* synthetic */ class C27558e implements C1591g { /* renamed from: a */ private final C27554a f72629a; /* renamed from: b */ private final Resources f72630b; /* renamed from: c */ private final List f72631c; C27558e(C27554a aVar, Resources resources, List list) { this.f72629a = aVar; this.f72630b = resources; this.f72631c = list; } public final Object then(C1592h hVar) { return this.f72629a.mo70779a(this.f72630b, this.f72631c, hVar); } }
520f5444b81fa515a8e519a69cde56dd49154266
89c511de69a52cbd5e0c77af771bb60900c3cbe8
/src/uy/edu/um/clases/RelacionEquipoCantidad.java
9a276ba24eed68ebb130ad6530db0142a3099504
[]
no_license
diegogibert/Oblig
936a5a1f11e35fd6c46536604e149352ba186b53
2f80facfb132ba97f18a6c0b8f0ad846a402786c
refs/heads/master
2022-02-11T13:08:13.858650
2019-06-21T02:30:03
2019-06-21T02:30:03
188,903,873
0
0
null
null
null
null
UTF-8
Java
false
false
1,092
java
package uy.edu.um.clases; import java.util.Objects; public class RelacionEquipoCantidad { private Team team; private int cantidadMedallas; private int cantidadCompetidores; public RelacionEquipoCantidad(Team team) { this.team = team; } public Team getTeam() { return team; } public int getCantidadMedallas() { return cantidadMedallas; } public int getCantidadCompetidores() { return cantidadCompetidores; } public void setTeam(Team team) { this.team = team; } public void setCantidadMedallas(int cantidadMedallas) { this.cantidadMedallas = cantidadMedallas; } public void setCantidadCompetidores(int cantidadCompetidores) { this.cantidadCompetidores = cantidadCompetidores; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; RelacionEquipoCantidad that = (RelacionEquipoCantidad) o; return Objects.equals(team, that.team); } }
a43a95106e105bc002024e182d308f90cbb299bb
8d5732bee6a437f1673f12e442eae8ca16d15806
/a3framework-webclient/src/main/java/cc/aileron/webclient/html/entity/HtmlImageElement.java
b126e57a11cf3b41ad8b6ebf6c0d32f7195a109e
[]
no_license
aileron/framework
e7467087481ffe601db2ae32b18bd2f8cd77bb5c
fb8c1e088b74c89edafe5a44ac65f5c888a26cd6
refs/heads/master
2020-12-24T14:52:47.270834
2011-07-20T09:11:03
2011-07-20T09:11:03
1,933,849
2
0
null
null
null
null
UTF-8
Java
false
false
461
java
package cc.aileron.webclient.html.entity; import java.io.File; import java.io.IOException; import java.net.URISyntaxException; import org.apache.http.HttpException; /** * @author aileron */ public interface HtmlImageElement extends HtmlElement { /** * @return {@link File} * @throws HttpException * @throws IOException * @throws URISyntaxException */ File getFile() throws URISyntaxException, IOException, HttpException; }
a71673d0228fa3c3aa64015ca7c9a489be2d874b
bae43fb98bb40007ac0311374b6341c5a9b93d42
/app/src/main/java/food2you/hp/shoitout/model/CreateEventModel.java
62ae05721e475c9504b6fef74be8dd2da1f19a5d
[]
no_license
aliSabirDogar/shoutitout
dd5ecfc8e3a6c955761f3fdbcda3268a0f9637d9
5c53def45eb60efc6863c3439c29c87d236f19ed
refs/heads/master
2022-11-18T23:32:19.017652
2020-07-24T07:23:34
2020-07-24T07:23:34
281,975,927
0
0
null
null
null
null
UTF-8
Java
false
false
2,134
java
package food2you.hp.shoitout.model; import com.google.gson.annotations.SerializedName; public class CreateEventModel { public String getFull_name() { return full_name; } public void setFull_name(String full_name) { this.full_name = full_name; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getTicket_price() { return ticket_price; } public void setTicket_price(String ticket_price) { this.ticket_price = ticket_price; } public String getNo_of_people() { return no_of_people; } public void setNo_of_people(String no_of_people) { this.no_of_people = no_of_people; } public String getEvent_date() { return event_date; } public void setEvent_date(String event_date) { this.event_date = event_date; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getEvent_banner() { return event_banner; } public void setEvent_banner(String event_banner) { this.event_banner = event_banner; } public CreateEventModel(String full_name, String email, String ticket_price, String no_of_people, String event_date, String description, String event_banner) { this.full_name = full_name; this.email = email; this.ticket_price = ticket_price; this.no_of_people = no_of_people; this.event_date = event_date; this.description = description; this.event_banner = event_banner; } @SerializedName("full_name") String full_name; @SerializedName("email") String email; @SerializedName("ticket_price") String ticket_price; @SerializedName("no_of_people") String no_of_people; @SerializedName("event_date") String event_date; @SerializedName("description") String description; @SerializedName("event_banner") String event_banner; }
5bd2b51bb6bbbe91072e9d46dfbaedab826f7aac
a9eff9b857fe0dab989303817e19a96edecd1bfb
/fasebooke/src/com/fase/controller/FAskpermissionControl.java
aac7d52eb4baeb7194d51f5b9b1fd669fd872219
[]
no_license
nibilin33/java-javaweb
f4042493a204f85432e8fbafc2ad6263f597fa52
dea9382536f58f97bf45f53336e063356d3d7f11
refs/heads/master
2021-06-08T21:58:29.116625
2016-12-20T07:40:49
2016-12-20T07:40:49
68,161,074
2
0
null
null
null
null
UTF-8
Java
false
false
2,988
java
package com.fase.controller; import java.io.IOException; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import net.sf.json.JSONObject; import org.apache.commons.collections.map.HashedMap; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import com.fase.iservice.IBlock; import com.fase.iservice.Iaskpermisson; import com.fase.iservice.Iufriend; import com.fase.po.Askpermission; import com.fase.po.Settime; @Controller @RequestMapping(value="/aska") public class FAskpermissionControl { @Resource private Iaskpermisson perservice; @Resource private IBlock ib; @Resource private Iufriend iu; @RequestMapping(value="/aa.action") public void allow(@RequestBody Askpermission ask,HttpServletResponse response){ Settime si= ib.selectsetting(ask.getFfid()); System.out.println(si.getFbefriend()); if(si.getFbefriend().equals("公开")){ perservice.insertP(ask); } else if(si.getFbefriend().equals("朋友的朋友")){ Map<String, Object> param = new HashMap<String, Object>(); param.put("fuid", ask.getFuid()); param.put("askfuid", ask.getFfid()); if(iu.isinfriendfriend(param)){ perservice.insertP(ask); } } try { response.setContentType("application/json"); response.setHeader("Pragma", "No-cache"); response.setHeader("Cache-Control", "no-cache"); response.setCharacterEncoding("UTF-8"); response.getWriter().print("sucess"); } catch (IOException e) { // TODO 自动生成的 catch 块 e.printStackTrace(); } } @RequestMapping(value="/opennotice.action") public void opennotice(HttpServletRequest re,HttpServletResponse response){ String fuid=re.getParameter("fuid"); JSONObject jsonobject=new JSONObject(); List<Askpermission> ask = perservice.selectall(fuid); jsonobject.put("newnotice", ask); System.out.println(jsonobject.toString()); try { response.setContentType("application/json"); response.setHeader("Pragma", "No-cache"); response.setHeader("Cache-Control", "no-cache"); response.setCharacterEncoding("UTF-8"); response.getWriter().print(jsonobject); } catch (IOException e) { // TODO 自动生成的 catch 块 e.printStackTrace(); } } @RequestMapping(value="/updatenotice.action") public void notification(@RequestBody Askpermission ask,HttpServletResponse response){ perservice.updateP(ask); try { response.setContentType("application/json"); response.setHeader("Pragma", "No-cache"); response.setHeader("Cache-Control", "no-cache"); response.setCharacterEncoding("UTF-8"); response.getWriter().print("sucess"); } catch (IOException e) { // TODO 自动生成的 catch 块 e.printStackTrace(); } } }
6a94bc119eab019f8a24b3fb2ff393b795eecd08
11a2d6b3df679d6fce7c67457a5ca9b319905b28
/bitcamp-java-basic/src/step09/Exam02_3.java
00e2dbbd79f2feeba4bf1ca2b8d003acf69f7c05
[]
no_license
BokJinKim/bitcamp
c5fd1dcef0d49bbdb586ab5cf6223639f2d9a613
676a85d13e12959ff6fbe1d612b3bfcc71024832
refs/heads/master
2021-01-24T10:28:56.544011
2018-09-12T11:02:47
2018-09-12T11:02:47
123,054,728
0
0
null
null
null
null
UTF-8
Java
false
false
1,098
java
// 인스턴스 메서드와 클래스 메서드의 활용 - Math 클래스 package step09; public class Exam02_3 { public static void main(String[] args) throws Exception { // Math 클래스는 수학 관련 메서드를 모아둔 클래스이다. // 전체의 메서드가 "클래스 메서드 = 스태틱 메서드"이다. // => 절대값 계산 System.out.println(Math.abs(-200)); // => ceil() : 파라미터로 주어진 부동소수점이 바로 큰 정수 값을 리턴 // -> floor() : 파라미터로 주어진 부동소수점의 바로 밑 작은 정수 값을 리턴한다. System.out.println(Math.ceil(3.28)); System.out.println(Math.floor(3.28)); System.out.println(Math.ceil(-3.28)); System.out.println(Math.floor(-3.28)); // => 2의 7승 값을 알고 싶을 때 System.out.println(Math.pow(2, 7)); // => 반올림하여 정수 값 리턴 System.out.println(Math.round(3.14)); System.out.println(Math.round(3.54)); } }
588337f16fd3f9ebf93500df08164adb11abbc20
ed9d41290c15c9e72c39e98f252b968658f42cef
/android/app/src/main/java/com/drawmythingfrontend/MainActivity.java
04f5f7717712073c871c7a2bae768b79da974dfd
[]
no_license
myfatemi04/draw-my-thing-frontend
4ab7cc65a8476c51e4fd5bd1512550706ba09f06
156f900cd911ec860b41922a31c199e080537169
refs/heads/master
2023-05-06T06:15:37.690989
2021-06-03T19:45:37
2021-06-03T19:45:37
373,273,171
0
0
null
null
null
null
UTF-8
Java
false
false
1,404
java
package com.drawmythingfrontend; import android.os.Bundle; import com.facebook.react.ReactActivity; import com.facebook.react.ReactActivityDelegate; import com.facebook.react.ReactRootView; import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView; import expo.modules.splashscreen.singletons.SplashScreen; import expo.modules.splashscreen.SplashScreenImageResizeMode; public class MainActivity extends ReactActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(null); // SplashScreen.show(...) has to be called after super.onCreate(...) // Below line is handled by '@expo/configure-splash-screen' command and it's discouraged to modify it manually SplashScreen.show(this, SplashScreenImageResizeMode.CONTAIN, ReactRootView.class, false); } /** * Returns the name of the main component registered from JavaScript. * This is used to schedule rendering of the component. */ @Override protected String getMainComponentName() { return "main"; } @Override protected ReactActivityDelegate createReactActivityDelegate() { return new ReactActivityDelegate(this, getMainComponentName()) { @Override protected ReactRootView createRootView() { return new RNGestureHandlerEnabledRootView(MainActivity.this); } }; } }
d0f3bce943d764585038aac3299de94210dab512
5f9a4f3ba03e2c440be8e71bf71f7a7dd718af46
/lambdas-and-fields/javaspec-sandbox/src/test/java/info/javaspec/sandbox/spec/DescriptiveContextTest.java
552e196a845eb93c9428dfb1b1a41d1ee684c8b3
[ "MIT" ]
permissive
kkrull/javaspec
4a25a5f05e652c475bbb5379b05008201f127a04
f655d150e4a32a6aa6d1fa1b4adb13f4a365840b
refs/heads/main
2023-03-17T01:03:41.250081
2023-03-07T18:27:28
2023-03-07T18:27:28
22,241,929
15
1
MIT
2023-03-07T18:27:30
2014-07-25T02:23:57
Java
UTF-8
Java
false
false
525
java
package info.javaspec.sandbox.spec; import info.javaspec.dsl.It; import info.javaspec.runner.JavaSpecRunner; import org.junit.runner.RunWith; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; @RunWith(JavaSpecRunner.class) public class DescriptiveContextTest { public class given_one_input { It should_do_one_thing = () -> assertThat(1, equalTo(1)); } public class given_some_other_input { It should_do_something_else = () -> assertThat(2, equalTo(2)); } }
0c5a6f78a8e6c1bb1229c943ed7c970f390e1cae
ede486d7ec2aa400590345cfee1d3cd554e18d4d
/iMatrix/imatrix-oracle-5.2.0.RC/src/main/java/com/norteksoft/wf/engine/web/TreeAction.java
e1e03e55b3390e0404158b807a7afeab14e939e4
[]
no_license
roelay/5.2.0.RC
df57afa64d306a31478c0bab15975da15f6ce1e1
51e56c0bcf9ad678ca2702e01a4b572e8848c6ee
refs/heads/master
2021-01-21T03:15:59.908935
2013-06-13T09:11:46
2013-06-13T09:11:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
17,768
java
package com.norteksoft.wf.engine.web; import java.util.List; import org.apache.struts2.convention.annotation.Action; import org.apache.struts2.convention.annotation.Namespace; import org.apache.struts2.convention.annotation.ParentPackage; import org.apache.struts2.convention.annotation.Result; import org.apache.struts2.convention.annotation.Results; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Required; import com.norteksoft.acs.entity.authorization.BusinessSystem; import com.norteksoft.acs.entity.organization.Department; import com.norteksoft.acs.entity.organization.DepartmentUser; import com.norteksoft.acs.service.authorization.AcsApiManager; import com.norteksoft.acs.service.organization.DepartmentManager; import com.norteksoft.product.api.ApiFactory; import com.norteksoft.product.api.entity.User; import com.norteksoft.product.util.ContextUtils; import com.norteksoft.product.util.JsTreeUtils; import com.norteksoft.product.util.ParameterUtils; import com.norteksoft.product.util.ThreadParameters; import com.norteksoft.product.web.struts2.CrudActionSupport; import com.norteksoft.wf.engine.entity.WorkflowDefinition; import com.norteksoft.wf.engine.entity.WorkflowType; import com.norteksoft.wf.engine.service.TaskService; import com.norteksoft.wf.engine.service.WorkflowDefinitionManager; import com.norteksoft.wf.engine.service.WorkflowInstanceManager; import com.norteksoft.wf.engine.service.WorkflowTypeManager; @SuppressWarnings("unchecked") @Namespace("/engine") @ParentPackage("default") @Results( { @Result(name = CrudActionSupport.RELOAD, location = "tree", type = "redirectAction")}) public class TreeAction extends CrudActionSupport { private static final long serialVersionUID = 1L; private DepartmentManager departmentManager; private String currentId; private WorkflowInstanceManager workflowInstanceManager; private WorkflowDefinitionManager workflowDefinitionManager; private TaskService taskService; private AcsApiManager acsApiManager; private WorkflowTypeManager workflowTypeManager; @Autowired public void setAcsApiManager(AcsApiManager acsApiManager) { this.acsApiManager = acsApiManager; } @Autowired public void setWorkflowTypeManager(WorkflowTypeManager workflowTypeManager) { this.workflowTypeManager = workflowTypeManager; } @Override public String list() throws Exception { return SUCCESS; } public Long getCompanyId(){ return ContextUtils.getCompanyId(); } public String getCompanyName(){ return ContextUtils.getCompanyName(); } public String getCurrentUser(){ return ContextUtils.getLoginName(); } /** * 我的流程树 * @return * @throws Exception */ @Action("tree-myProcess") public String myProcess() throws Exception{ StringBuilder tree = new StringBuilder("[ "); if("INITIALIZED".equals(currentId)){ List<WorkflowType> wfTypes = workflowTypeManager.getAllWorkflowType(); StringBuilder subNodes = new StringBuilder(); //办理中 for(WorkflowType wft : wfTypes){ subNodes.append(JsTreeUtils.generateJsTreeNodeDefault("ING_"+wft.getId(), null, wft.getName() + "(" + getInstanceNumByType(wft.getId(), false) + ")", myInstanceByType(wft.getId(), false) )).append(","); } JsTreeUtils.removeLastComma(subNodes); tree.append(JsTreeUtils.generateJsTreeNodeDefault("ING", "open", getText("workflow.doing")+"("+getInstanceNumByEnable(false)+")", subNodes.toString())).append(","); //已完成 subNodes = new StringBuilder(); for(WorkflowType wft : wfTypes){ subNodes.append(JsTreeUtils.generateJsTreeNodeDefault("END_"+wft.getId(), null, wft.getName() + "(" + getInstanceNumByType(wft.getId(), true) + ")", myInstanceByType(wft.getId(), true) )).append(","); } JsTreeUtils.removeLastComma(subNodes); tree.append(JsTreeUtils.generateJsTreeNodeDefault("END", "", getText("workflow.complete")+"("+getInstanceNumByEnable(true)+")", subNodes.toString())).append(","); }else if(currentId.startsWith("ING_")){ } JsTreeUtils.removeLastComma(tree); tree.append(" ]"); renderText(tree.toString()); return null; } //我委托的流程 public String delegateMonitor() throws Exception{ StringBuilder tree = new StringBuilder("[ "); tree.append(JsTreeUtils.generateJsTreeNodeDefault("DEL_ING", null, getText("workflow.doing") + "(" + taskService.getDelegateTasksNum(getCompanyId(), getCurrentUser(), false) + ")" )).append(","); tree.append(JsTreeUtils.generateJsTreeNodeDefault("DEL_END", null, getText("workflow.complete") + "(" + taskService.getDelegateTasksNum(getCompanyId(), getCurrentUser(), true) + ")" )); tree.append(" ]"); renderText(tree.toString()); return null; } //我受托的流程 public String superviseAsTrusteeTree() throws Exception{ StringBuilder tree = new StringBuilder("[ "); tree.append(JsTreeUtils.generateJsTreeNodeDefault("TRUSTEE_ING", null, getText("workflow.doing") + "(" + taskService.getTrusteeTasksNum(getCompanyId(), getCurrentUser(), false) + ")" )).append(","); tree.append(JsTreeUtils.generateJsTreeNodeDefault("TRUSTEE_END", null, getText("workflow.complete") + "(" + taskService.getTrusteeTasksNum(getCompanyId(), getCurrentUser(), true) + ")" )); tree.append(" ]"); renderText(tree.toString()); return null; } private String myInstanceByType(Long typeId, boolean isEnd){ StringBuilder subNodes = new StringBuilder(); List<WorkflowDefinition> definitions = workflowDefinitionManager.getWfDefinitionsByType(getCompanyId(), typeId); for(WorkflowDefinition wfd : definitions){ if(isEnd){ subNodes.append(JsTreeUtils.generateJsTreeNodeDefault("END_WFD_" + wfd.getId(), "", wfd.getName() + "(" + getInstanceNumByDefinition(wfd, isEnd) + ")")).append(","); }else{ subNodes.append(JsTreeUtils.generateJsTreeNodeDefault("ING_WFD_" + wfd.getId(), "", wfd.getName() + "(" + getInstanceNumByDefinition(wfd, isEnd) + ")")).append(","); } } JsTreeUtils.removeLastComma(subNodes); return subNodes.toString(); } private Integer getInstanceNumByEnable(boolean isEnd){ if(isEnd){ return workflowInstanceManager.getEndInstanceNumByEnable(getCompanyId(), getCurrentUser()); }else{ return workflowInstanceManager.getNotEndInstanceNumByEnable(getCompanyId(), getCurrentUser()); } } /* * 根据流程定义查询流程实例个数 */ private Integer getInstanceNumByDefinition(WorkflowDefinition definition, boolean isEnd){ if(isEnd){ return workflowInstanceManager.getEndInstanceNumByDefinition(getCompanyId(), getCurrentUser(), definition); }else{ return workflowInstanceManager.getNotEndInstanceNumByDefinition(getCompanyId(), getCurrentUser(), definition); } } /* * 根据流程实例类型查询当前用户流程实例个数 */ private Integer getInstanceNumByType(Long typeId, boolean isEnd){ if(isEnd){ return workflowInstanceManager.getEndInstanceNumByCreatorAndType(getCompanyId(), getCurrentUser(), typeId); }else{ return workflowInstanceManager.getNotEndInstanceNumByCreatorAndType(getCompanyId(), getCurrentUser(), typeId); } } /** * 流程汇编树 * @return * @throws Exception */ public String process() throws Exception{ StringBuilder tree = new StringBuilder("[ "); if("INITIALIZED".equals(currentId)){ List<WorkflowType> wfTypes = workflowTypeManager.getAllWorkflowType(); boolean isFirstNode = true; for(WorkflowType wft : wfTypes){ if(isFirstNode){ tree.append(JsTreeUtils.generateJsTreeNodeDefault("WFDTYPE_" + wft.getId(), "open",wft.getName(), processDefs(wft.getId()))).append(","); isFirstNode = false; }else{ tree.append(JsTreeUtils.generateJsTreeNodeDefault("WFDTYPE_" + wft.getId(), "", wft.getName(), processDefs(wft.getId()))).append(","); } } } JsTreeUtils.removeLastComma(tree); tree.append(" ]"); renderText(tree.toString()); return null; } public String processDefs(Long typeId){ StringBuilder subNodes = new StringBuilder(); List<WorkflowDefinition> definitions = workflowDefinitionManager.getWfDefinitionsByType(getCompanyId(), typeId); for(WorkflowDefinition wfd : definitions){ subNodes.append(JsTreeUtils.generateJsTreeNodeDefault("WFDID_" + wfd.getId(), "", wfd.getName())).append(","); } JsTreeUtils.removeLastComma(subNodes); return subNodes.toString(); } /** * 流程及表单类型树 * @return * @throws Exception */ public String wfTypes() throws Exception{ List<WorkflowType> wfTypes = workflowTypeManager.getAllWorkflowType(); List<BusinessSystem> businessSystemList = acsApiManager.getAllBusiness(getCompanyId()); StringBuilder tree = new StringBuilder("[ "); if( "INITIALIZED_PROCESS".equals(currentId)){ tree.append(JsTreeUtils.generateJsTreeNodeDefault("ENABLE_ALL_1", "open", "当前版本",getSecondNodesInWftypeTree(wfTypes,businessSystemList,"ENABLE"))).append(","); tree.append(JsTreeUtils.generateJsTreeNodeDefault("UNABLE_ALL_1", "", "历史版本",getSecondNodesInWftypeTree(wfTypes,businessSystemList,"UNABLE"))).append(","); }else if( "INITIALIZED_MONITOR".equals(currentId)){ tree.append(JsTreeUtils.generateJsTreeNodeDefault("WFT_monitor_0", null, "所有流程")).append(","); boolean isSuperWf=workflowDefinitionManager.isSuperWf(); for(WorkflowType wft : wfTypes){ tree.append(JsTreeUtils.generateJsTreeNodeDefault("WFT_monitor_"+wft.getId(), null, wft.getName(),monitorTree(wft,isSuperWf))).append(","); } }else if("INITIALIZED_FORM".equals(currentId)){ tree.append(JsTreeUtils.generateJsTreeNodeDefault("parent_default_0", "open", "自定义表单" ,formTypes(wfTypes,"default"))).append(","); tree.append(JsTreeUtils.generateJsTreeNodeDefault("parent_standard_0", null, "标准表单",formTypes(wfTypes,"standard"))).append(","); }else if("INITIALIZED_DICT".equals(currentId)){ tree.append(JsTreeUtils.generateJsTreeNodeDefault("WFT_myCreate_0", null, "所有数据" )).append(","); tree.append(JsTreeUtils.generateJsTreeNodeDefault("WFT_type_0", null, "类型管理")).append(","); }else if("INITIALIZED_TEMPLATE".equals(currentId)){ tree.append(JsTreeUtils.generateJsTreeNodeDefault("WFT_0", null, getText("workflow.allTemplate") )).append(","); for(WorkflowType wft : wfTypes){ tree.append(JsTreeUtils.generateJsTreeNodeDefault("WFT_"+wft.getId(), null, wft.getName())).append(","); } }else if("INITIALIZED_WFD_TEMPLATE".equals(currentId)){ tree.append(JsTreeUtils.generateJsTreeNodeDefault("WFDT_0", null, getText("workflow.allTemplate") )).append(","); for(WorkflowType wft : wfTypes){ tree.append(JsTreeUtils.generateJsTreeNodeDefault("WFDT_"+wft.getId(), null, wft.getName())).append(","); } } JsTreeUtils.removeLastComma(tree); tree.append(" ]"); renderText(tree.toString()); return null; } private String monitorTree(WorkflowType type,boolean isSuperWf){ StringBuilder tree = new StringBuilder(); List<String> definitionCodes=workflowDefinitionManager.getWfDefinitionCodesByType(getCompanyId(), type.getId()); for(String def : definitionCodes){ WorkflowDefinition wf=workflowDefinitionManager.getWorkflowDefinitionByCodeAndVersion(def, 1,ContextUtils.getCompanyId(),isSuperWf); if(wf!=null){ tree.append(JsTreeUtils.generateJsTreeNodeDefault("WFT_monitor_"+type.getId()+"_"+def, null, wf.getName())).append(","); } } JsTreeUtils.removeLastComma(tree); return tree.toString(); } public String getSecondNodesInWftypeTree(List<WorkflowType> wfTypes,List<BusinessSystem> businessSystemList,String belongType){ StringBuilder secondNodes = new StringBuilder(); //流程类型 StringBuilder subNodes = new StringBuilder(); for(WorkflowType wft : wfTypes){ subNodes.append(JsTreeUtils.generateJsTreeNodeDefault(belongType+"_WFT_"+wft.getId(), null, wft.getName())).append(","); } JsTreeUtils.removeLastComma(subNodes); secondNodes.append(JsTreeUtils.generateJsTreeNodeDefault(belongType+"_WFT_0", "open", "流程类型", subNodes.toString())).append(","); //所有系统 subNodes = new StringBuilder(); for(BusinessSystem bs : businessSystemList){ subNodes.append(JsTreeUtils.generateJsTreeNodeDefault(belongType+"_BSYS_"+bs.getId(), null, bs.getName())).append(","); } JsTreeUtils.removeLastComma(subNodes); secondNodes.append(JsTreeUtils.generateJsTreeNodeDefault(belongType+"_BSYS_0", "", "所有系统", subNodes.toString())).append(","); JsTreeUtils.removeLastComma(secondNodes); return secondNodes.toString(); } public String formTypes(List<WorkflowType> wfTypes,String formType){ StringBuilder tree = new StringBuilder(); tree.append(JsTreeUtils.generateJsTreeNodeDefault("WFT_"+formType+"_0", null, getText("workflow.allForm"))).append(","); for(WorkflowType wft : wfTypes){ tree.append(JsTreeUtils.generateJsTreeNodeDefault("WFT_"+formType+"_"+wft.getId(), null, wft.getName())).append(","); } return tree.toString(); } public String load() throws Exception{ StringBuilder tree = new StringBuilder("[ "); if("INITIALIZED".equals(currentId)){ //公司里的部门节点 StringBuilder subNodes = new StringBuilder(); List<Department> departments = departmentManager.getAllDepartment(); for(Department d : departments){ String nodeString = getDdeptNodes(d); if(nodeString.length() > 0) subNodes.append(nodeString).append(","); } subNodes.append(JsTreeUtils.generateJsTreeNodeDefault("NODEPARTMENTUS," + getCompanyId(), "closed", getText("user.noDepartment"), "")); JsTreeUtils.removeLastComma(subNodes); //公司节点 tree.append(JsTreeUtils.generateJsTreeNodeDefault("", "open", getCompanyName(), subNodes.toString())); }else if(currentId.startsWith("DEPARTMENT")){ tree.append(getUserNodes(Long.valueOf(currentId.substring(currentId.indexOf(',')+1, currentId.length())))); }else if(currentId.startsWith("NODEPARTMENTUS")){ tree.append(getNoDepartmentUserNodes(Long.valueOf(currentId.substring(currentId.indexOf(',')+1, currentId.length())))); } tree.append(" ]"); renderText(tree.toString()); return null; } /** * 部门节点 */ private String getDdeptNodes(Department dept){ StringBuilder nodes = new StringBuilder(); if(dept.getParent() == null){ //部门树节点 nodes.append(JsTreeUtils.generateJsTreeNodeDefault("DEPARTMENT," + dept.getId(), "closed", dept.getName(), "")); } return nodes.toString(); } /** * 用户节点 */ public String getUserNodes(Long deptId) throws Exception{ StringBuilder nodes = new StringBuilder(); Department dept = departmentManager.getDepartment(deptId); for(Department d : dept.getChildren()){ nodes.append(getDdeptNodes(d)).append(","); } for(DepartmentUser du : dept.getDepartmentUsers()){ if(du.isDeleted()) continue; com.norteksoft.acs.entity.organization.User user = du.getUser(); if(user.isDeleted()) continue; nodes.append(JsTreeUtils.generateJsTreeNodeDefault("USER," + user.getId() + "," + user.getLoginName(), "", user.getName(), "")).append(","); } JsTreeUtils.removeLastComma(nodes); return nodes.toString(); } /** * 没有部门的用户的树节点 * @param companyId * @return */ public String getNoDepartmentUserNodes(Long companyId){ StringBuilder nodes = new StringBuilder(); ThreadParameters parameters=new ThreadParameters(companyId); ParameterUtils.setParameters(parameters); List<User> users = ApiFactory.getAcsService().getUsersWithoutDepartment(); for(User user : users){ if(user.isDeleted()) continue; nodes.append(JsTreeUtils.generateJsTreeNodeDefault("USER," + user.getId() + "," + user.getLoginName(), "", user.getName(), "")).append(","); } JsTreeUtils.removeLastComma(nodes); return nodes.toString(); } /** * 选择用户、部门和工作组,并将它们分装为json格式。 * 格式如:{user:"用户登录名1,用户登录名2,...",department:"部门1,部门2,...",workGroup:"工作组1,工作组2,..."} */ public String selectUserPackToJson() throws Exception{ return "selectUserPackToJson"; } @Required public void setDepartmentManager(DepartmentManager departmentManager) { this.departmentManager = departmentManager; } @Required public void setWorkflowInstanceManager( WorkflowInstanceManager workflowInstanceManager) { this.workflowInstanceManager = workflowInstanceManager; } @Required public void setWorkflowDefinitionManager( WorkflowDefinitionManager workflowDefinitionManager) { this.workflowDefinitionManager = workflowDefinitionManager; } @Required public void setTaskService(TaskService taskService) { this.taskService = taskService; } public String getCurrentId() { return currentId; } public void setCurrentId(String currentId) { this.currentId = currentId; } @Override public String delete() throws Exception { return null; } @Override public String input() throws Exception { return null; } @Override protected void prepareModel() throws Exception { } @Override public String save() throws Exception { return null; } public Object getModel() { return null; } }
1da34fc701095434050969f7cab9bbb040d8de05
14d641b793f0a1312b9582e7cbdaf12df47e06b8
/chals/play-a-game/classes-decompiled/android/support/v7/widget/bb.java
986f79371c0d1c4631b86432457cfd1f3a97af18
[]
no_license
eskildsen/google-ctf-2018
153ae3dc04d07ed55fe1aae8f21f228f445a9dd2
0dd8517035fad829e9537e6924b6a1a9f0ddda2b
refs/heads/master
2020-03-21T08:39:40.939125
2018-06-30T12:33:55
2018-06-30T12:33:55
138,357,102
3
0
null
null
null
null
UTF-8
Java
false
false
1,014
java
// // Decompiled by Procyon v0.5.30 // package android.support.v7.widget; import android.graphics.drawable.Drawable; import android.os.Build$VERSION; import android.support.v7.app.e; import android.content.Context; import java.lang.ref.WeakReference; import android.content.res.Resources; public class bb extends Resources { private final WeakReference<Context> a; public bb(final Context context, final Resources resources) { super(resources.getAssets(), resources.getDisplayMetrics(), resources.getConfiguration()); this.a = new WeakReference<Context>(context); } public static boolean a() { return e.k() && Build$VERSION.SDK_INT <= 20; } final Drawable a(final int n) { return super.getDrawable(n); } public Drawable getDrawable(final int n) { final Context context = this.a.get(); if (context != null) { return l.a().a(context, this, n); } return super.getDrawable(n); } }
60938c1a37b632364377afbe24a316dd83e9da4e
f8cd8b42e49079ba718ffe54a621414da7b86860
/app/src/main/java/com/pubnub/examples/pubnubExample10/AlarmPanel.java
e8b3b93ea4f9ac6f265f988d516bf9adfa2822e0
[]
no_license
dddonkuro/AlarmProject
d4231eff97d8855f6d673e8d17f51fc483850add
b8035ebcb63f7a1d6d4af075a2374bfb038290d6
refs/heads/master
2021-01-10T21:43:56.799038
2015-03-16T04:48:35
2015-03-16T04:48:35
32,301,916
0
0
null
null
null
null
UTF-8
Java
false
false
5,618
java
package com.pubnub.examples.pubnubExample10; import android.app.Activity; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.SharedPreferences; import android.net.ConnectivityManager; import android.os.AsyncTask; import android.os.Bundle; import android.text.TextUtils; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.ImageButton; import android.widget.Toast; import com.google.android.gms.gcm.GoogleCloudMessaging; import com.pubnub.api.Callback; import com.pubnub.api.Pubnub; import com.pubnub.api.PubnubError; import com.pubnub.api.PubnubException; import java.io.IOException; import java.util.LinkedHashMap; import java.util.Map; public class AlarmPanel extends Activity { Button mButton; Intent mainPanelIntent; ImageButton lockButton, unLockButton; Pubnub pubnub; // public static String SENDER_ID = "914467891927"; // public static String REG_ID; // private static final String APP_VERSION = "3.6.1"; // pub-c-ae38895f-098b-4f2e-97b3-2b7f07bc28f2 // sub-c-22258e30-bf6d-11e4-b42d-02ee2ddab7fe //pc's keyset //pub-c-ef34a7ed-52a5-4e3b-8d12-39a96d416b02 //Subscribe Key sub-c-930dd836-acd1-11e4-815e-0619f8945a4f SharedPreferences prefs; //MainActivity mainActivity = new MainActivity(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.panelmain); lockButton = (ImageButton) findViewById(R.id.imageLockButton); unLockButton = (ImageButton) findViewById(R.id.imageUnlockButton); lockButton.setOnClickListener( new View.OnClickListener(){ public void onClick(View view) { //.pubnubFromMainActivity myPubnubFromAct = new MainActivity.pubnubFromMainActivity(); try { //mainActivity.subscribe();//"sub-c-22258e30-bf6d-11e4-b42d-02ee2ddab7fe", new Callback() { // @Override // public void connectCallback(String channel, // Object message) { // Toast.makeText(getApplicationContext(), "SUBSCRIBE : CONNECT on channel:" // + channel // + " : " // + message.getClass() // + " : " // + message.toString(), Toast.LENGTH_SHORT).show(); // } // // @Override // public void disconnectCallback(String channel, // Object message) { // Toast.makeText(getApplicationContext(), "SUBSCRIBE : DISCONNECT on channel:" // + channel // + " : " // + message.getClass() // + " : " // + message.toString(), Toast.LENGTH_LONG).show(); // } // // @Override // public void reconnectCallback(String channel, // Object message) { // Toast.makeText(getApplicationContext(), "SUBSCRIBE : RECONNECT on channel:" // + channel // + " : " // + message.getClass() // + " : " // + message.toString(), Toast.LENGTH_LONG); // } // // @Override // public void successCallback(String channel, // Object message) { // Toast.makeText(getApplicationContext(), "SUBSCRIBE : " + channel + " : " // + message.getClass() + " : " // + message.toString(), Toast.LENGTH_LONG); // } // // @Override // public void errorCallback(String channel, // PubnubError error) { // Toast.makeText(getApplicationContext(), "SUBSCRIBE : ERROR on channel " // + channel + " : " // + error.toString(), Toast.LENGTH_LONG); // } // }); } catch (Exception e) { } } }); unLockButton.setOnClickListener( new View.OnClickListener() { public void onClick(View view) { //mainActivity.unsubscribe("sub-c-22258e30-bf6d-11e4-b42d-02ee2ddab7fe"); } }); } }
b8f1cbe2eea988dda8280fb1855bb8b463a4278f
9c01b9a7b8b2708e30c6ac916e4c797d97ca5349
/aggregation/simple/src/main/java/com/spotify/heroic/aggregation/simple/MetricMappingAggregation.java
380bbc9c90ebb95d94e9cc04615bb4386a400a92
[ "Apache-2.0" ]
permissive
gabrielgerhardsson/heroic
f08e940456631a1e4de7bd8d75b8e0e577fd4c83
c56fa088a8a1d5205a7fc09478d87ed79b4beb3d
refs/heads/master
2021-01-13T13:31:57.228003
2017-01-04T16:32:07
2017-01-04T16:32:07
72,422,692
0
0
null
2016-12-08T15:18:31
2016-10-31T09:39:55
Java
UTF-8
Java
false
false
4,227
java
/* * Copyright (c) 2015 Spotify AB. * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package com.spotify.heroic.aggregation.simple; import com.spotify.heroic.aggregation.AggregationInstance; import com.spotify.heroic.aggregation.AggregationResult; import com.spotify.heroic.aggregation.AggregationSession; import com.spotify.heroic.aggregation.EmptyInstance; import com.spotify.heroic.aggregation.AggregationOutput; import com.spotify.heroic.common.DateRange; import com.spotify.heroic.common.Series; import com.spotify.heroic.metric.Event; import com.spotify.heroic.metric.MetricGroup; import com.spotify.heroic.metric.Payload; import com.spotify.heroic.metric.Point; import lombok.Data; import java.util.List; import java.util.Map; import java.util.Set; import static java.util.stream.Collectors.toList; @Data public abstract class MetricMappingAggregation implements AggregationInstance { private final MetricMappingStrategy metricMappingStrategy; @Override public long estimate(DateRange range) { return -1; } @Override public long cadence() { return 0; } @Override public AggregationSession session(DateRange range) { return new Session(EmptyInstance.INSTANCE.session(range)); } @Override public AggregationInstance distributed() { return EmptyInstance.INSTANCE; } class Session implements AggregationSession { private final AggregationSession childSession; public Session(AggregationSession childSession) { this.childSession = childSession; } @Override public void updatePoints( final Map<String, String> key, final Set<Series> series, final List<Point> values ) { this.childSession.updatePoints(key, series, values); } @Override public void updateEvents( final Map<String, String> key, final Set<Series> series, final List<Event> values ) { this.childSession.updateEvents(key, series, values); } @Override public void updatePayload( final Map<String, String> key, final Set<Series> series, final List<Payload> values ) { this.childSession.updatePayload(key, series, values); } @Override public void updateGroup( final Map<String, String> key, final Set<Series> series, final List<MetricGroup> values ) { this.childSession.updateGroup(key, series, values); } @Override public void updateSpreads( final Map<String, String> key, final Set<Series> series, final List<com.spotify.heroic.metric.Spread> values ) { this.childSession.updateSpreads(key, series, values); } @Override public AggregationResult result() { AggregationResult aggregationResult = this.childSession.result(); List<AggregationOutput> outputs = aggregationResult .getResult() .stream() .map(aggregationOutput -> new AggregationOutput( aggregationOutput.getKey(), aggregationOutput.getSeries(), metricMappingStrategy.apply(aggregationOutput.getMetrics()) )) .collect(toList()); return new AggregationResult(outputs, aggregationResult.getStatistics()); } } }
9d4597f51e0b64d3eac19ad839fd8c361ccb807c
6e7e4bd483cd27e14faa4e7cad8a485ffa0e57ed
/src/main/java/org/example/utils/ImageFilterUtil.java
e3d20c59bd3b0fc1fcc815709ea3ba9eb13334b2
[]
no_license
liyitongxue/idCardIdentify
ca3f9ad361acb4fb368f36828172a5048228747a
925d955b5dc67ccd7ca4e7e7c0f097e4d5f852be
refs/heads/main
2023-04-24T03:49:09.851695
2021-05-05T13:07:28
2021-05-05T13:07:28
362,684,007
1
0
null
null
null
null
UTF-8
Java
false
false
10,113
java
package org.example.utils; import net.sourceforge.tess4j.util.ImageHelper; import java.awt.*; import java.awt.image.BufferedImage; /** * @author ly * @since 2021/4/21 */ public class ImageFilterUtil { //比较三个数的大小并取最大数 public static int getBiggest(int x, int y, int z) { if (x >= y && x >= z) { return x; } else if (y >= x && y >= z) { return y; } else if (z >= x && z >= y) { return z; } else { return 0; } } //比较三个数的大小并取最小数 public static int getSmallest(int x, int y, int z) { if (x <= y && x <= z) { return x; } else if (y <= x && y <= z) { return y; } else if (z <= x && z <= y) { return z; } else { return 0; } } //计算并返回三个数的平均值 public static int getAvg(int x, int y, int z) { int avg = (x + y + z) / 3; return avg; } /** * 图片对比度设置 * * @param image 原始图片 * @param rate 对比率 * @return 调整后的图片(引用原始图片) */ public static BufferedImage imageContrast(BufferedImage image, float rate) { for (int x = image.getMinX(); x < image.getWidth(); x++) { for (int y = image.getMinY(); y < image.getHeight(); y++) { Object data = image.getRaster().getDataElements(x, y, null); int dataRed = image.getColorModel().getRed(data); int dataBlue = image.getColorModel().getBlue(data); int dataGreen = image.getColorModel().getGreen(data); float newRed = dataRed * rate > 255 ? 255 : dataRed * rate; newRed = newRed < 0 ? 0 : newRed; float newGreen = dataGreen * rate > 255 ? 255 : dataGreen * rate; newGreen = newGreen < 0 ? 0 : newGreen; float newBlue = dataBlue * rate > 255 ? 255 : dataBlue * rate; newBlue = newBlue < 0 ? 0 : newBlue; Color dataColor = new Color(newRed, newGreen, newBlue); image.setRGB(x, y, dataColor.getRGB()); } } return image; } /** * 图片亮度调整 * * @param image * @param brightness * @return */ public static BufferedImage imageBrightness(BufferedImage image, int brightness) { for (int x = image.getMinX(); x < image.getWidth(); x++) { for (int y = image.getMinY(); y < image.getHeight(); y++) { Object data = image.getRaster().getDataElements(x, y, null); int dataRed = image.getColorModel().getRed(data); int dataBlue = image.getColorModel().getBlue(data); int dataGreen = image.getColorModel().getGreen(data); int dataAlpha = image.getColorModel().getAlpha(data); int newRed = dataRed + brightness > 255 ? 255 : dataRed + brightness; newRed = newRed < 0 ? 0 : newRed; int newBlue = dataBlue + brightness > 255 ? 255 : dataBlue + brightness; newBlue = newBlue < 0 ? 0 : newBlue; int newGreen = dataGreen + brightness > 255 ? 255 : dataGreen + brightness; newGreen = newGreen < 0 ? 0 : newGreen; Color dataColor = new Color(newRed, newGreen, newBlue, dataAlpha); image.setRGB(x, y, dataColor.getRGB()); } } return image; } /** * 获取图片亮度 * * @param image * @return */ public static int imageBrightness(BufferedImage image) { long totalRed = 0; long totalGreen = 0; long totalBlue = 0; for (int x = image.getMinX(); x < image.getWidth(); x++) { for (int y = image.getMinY(); y < image.getHeight(); y++) { Object data = image.getRaster().getDataElements(x, y, null); int dataRed = image.getColorModel().getRed(data); int dataBlue = image.getColorModel().getBlue(data); int dataGreen = image.getColorModel().getGreen(data); int dataAlpha = image.getColorModel().getAlpha(data); totalRed += dataRed; totalGreen += dataGreen; totalBlue += dataBlue; // totalBrightness += dataColor.getRGB(); } } float avgRed = totalRed / (image.getHeight() * image.getWidth()); float avgGreen = totalGreen / (image.getWidth() * image.getHeight()); float avgBlue = totalBlue / (image.getWidth() * image.getHeight()); int avgBrightNess = (int) ((avgRed + avgGreen + avgBlue) / 3); return avgBrightNess; } /** * 灰度化 * * @param image 灰度化处理的图片 * @return */ public static BufferedImage gray(BufferedImage image) { int[] rgb = new int[3]; int width = image.getWidth(); int height = image.getHeight(); int minx = image.getMinX(); int miny = image.getMinY(); BufferedImage grayImage = new BufferedImage(width, height, image.getType()); for (int i = minx; i < width - 1; i++) { for (int j = miny; j < height; j++) { int pixel = image.getRGB(i, j); rgb[0] = (pixel & 0xff0000) >> 16; rgb[1] = (pixel & 0xff00) >> 8; rgb[2] = (pixel & 0xff); int gray = getBiggest(rgb[0], rgb[1], rgb[2]);//最大值法灰度化 // int gray = getSmallest(rgb[0], rgb[1], rgb[2]);//最小值法灰度化 // int gray = getAvg(rgb[0], rgb[1], rgb[2]);//均值法灰度化 // int gray = (int) (0.3 * rgb[0] + 0.59 * rgb[1] + 0.11 * rgb[2]);//加权法灰度化 Color newColor = new Color(gray, gray, gray); int newRgb = newColor.getRGB(); grayImage.setRGB(i, j, newRgb); } } return grayImage; } /** * 把图像处理成黑白照片 * * @param image 黑白处理的图片 * @return */ public static BufferedImage replaceWithWhiteColor(BufferedImage image) { int[] rgb = new int[3]; int width = image.getWidth(); int height = image.getHeight(); int minx = image.getMinX(); int miny = image.getMinY(); //遍历图片的像素,为处理图片上的杂色,所以要把指定像素上的颜色换成目标白色 用二层循环遍历长和宽上的每个像素 int hitCount = 0; for (int i = minx; i < width; i++) { for (int j = miny; j < height; j++) { //得到指定像素(i,j)上的RGB值, int pixel = image.getRGB(i, j); //分别进行位操作得到 r g b上的值 rgb[0] = (pixel & 0xff0000) >> 16; rgb[1] = (pixel & 0xff00) >> 8; rgb[2] = (pixel & 0xff); /** * * 进行换色操作,我这里是要换成白底,那么就判断图片中rgb值是否在范围内的像素 * */ // 经过不断尝试,RGB数值相互间相差15以内的都基本上是灰色, // 对以身份证来说特别是介于73到78之间,还有大于100的部分RGB值都是干扰色,将它们一次性转变成白色 if ( (Math.abs(rgb[0] - rgb[1]) < 15) && (Math.abs(rgb[0] - rgb[2]) < 15) && (Math.abs(rgb[1] - rgb[2]) < 15) && (((rgb[0] > 73) && (rgb[0] < 78)) || (rgb[0] > 100)) || (rgb[0] + rgb[1] + rgb[2] > 300 && Math.abs(rgb[0] - rgb[1]) < 20 && Math.abs(rgb[0] - rgb[2]) < 20 && Math.abs(rgb[1] - rgb[2]) < 20) || (rgb[0] + rgb[1] + rgb[2] > 300) ) { // 进行换色操作,0xffffff是白色 image.setRGB(i, j, 0xffffff); } } } return image; } /** * 图片像素RGB差值滤镜--将彩色的地方涂白 * * @param image * @param differenceValue 最大允许差值 * @return */ public static BufferedImage imageRGBDifferenceFilter(BufferedImage image, int differenceValue) { int[] rgb = new int[3]; int width = image.getWidth(); int height = image.getHeight(); int minx = image.getMinX(); int miny = image.getMinY(); for (int i = minx; i < width; i++) { for (int j = miny; j < height; j++) { Object data = image.getRaster().getDataElements(i, j, null); int r = image.getColorModel().getRed(data); int g = image.getColorModel().getGreen(data); int b = image.getColorModel().getBlue(data); if (differenceValue <= Math.abs(r - b) && differenceValue <= Math.abs(r - g) && differenceValue <= Math.abs(b - g) && b - g > 0) { //把超过最大差值的像素涂白 image.setRGB(i, j, Color.white.getRGB()); } } } return image; } /** * 作用:图片缩放 * * @param image 需要缩放的图片 * @param width 需要缩放宽度 * @param height 需要缩放高度 * @return */ public static BufferedImage testZoom(BufferedImage image, int width, int height) { return ImageHelper.getScaledInstance(image, width, height); } /** * 作用:图片缩放 * * @param image 需要缩放的图片 * @return */ public static BufferedImage zoom(BufferedImage image) { return ImageHelper.getScaledInstance(image, 673, 425); } }
87f6d1767329a6f4c6744dc78d916fbf0aa3df3b
1ef7e8bc40a641a7f7fe6e0c053d0b4f63e14a87
/Coupon/app/src/main/java/com/myideaway/coupon/model/comment/service/biz/CommentBSGetListData.java
72b2750e958ce82fdfe724397081f485461db89c
[]
no_license
myideaway1024/coupon
7aff95dee4e76f475edd1a453bf545532dba2aca
f06d82c60036b02c54c32cfbbb7b594c64576a17
refs/heads/master
2021-01-19T19:17:19.366297
2016-03-15T03:18:17
2016-03-15T03:18:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,484
java
package com.myideaway.coupon.model.comment.service.biz; import android.content.Context; import com.myideaway.coupon.model.comment.Comment; import com.myideaway.coupon.model.comment.service.remote.CommentRSGetListData; import com.myideaway.coupon.model.user.User; import com.myideaway.easyapp.core.service.BizService; import org.json.JSONArray; import org.json.JSONObject; import java.util.ArrayList; import java.util.Date; import java.util.List; /** * Created with IntelliJ IDEA. * User: Administrator * Date: 13-12-2 * Time: 上午9:41 * To change this template use File | Settings | File Templates. */ public class CommentBSGetListData extends BizService { private int couponID; private int page; public CommentBSGetListData(Context context) { super(context); } @Override protected Object onExecute() throws Exception { CommentRSGetListData commentRSGetListData = new CommentRSGetListData(); CommentBSGetListDataResult commentBSGetListDataResult = new CommentBSGetListDataResult(); commentRSGetListData.setPage(page); commentRSGetListData.setCouponID(couponID); JSONObject commentJsonObject = (JSONObject) commentRSGetListData.syncExecute(); JSONArray commentListJSONArray = commentJsonObject.optJSONArray("item"); List<Comment> commentList = new ArrayList<Comment>(); for (int i = 0; i < commentListJSONArray.length(); i++) { Comment comment = new Comment(); JSONObject commentJSONObject = commentListJSONArray.optJSONObject(i); comment.setId(commentJSONObject.optInt("id")); User user = new User(); user.setUsername(commentJSONObject.optString("user_name")); comment.setWriter(user); Date date = new Date(commentJSONObject.optInt("create_time")); comment.setCreateTime(date); comment.setContent(commentJSONObject.optString("content")); comment.setCreateTimeString(commentJSONObject.optString("create_time_format")); commentList.add(comment); } commentBSGetListDataResult.setCommentList(commentList); String page = commentJsonObject.optJSONObject("page").optString("page"); commentBSGetListDataResult.setPage(page); String pageTotal = commentJsonObject.optJSONObject("page").optString("page_total"); commentBSGetListDataResult.setPageTotal(pageTotal); return commentBSGetListDataResult; } public class CommentBSGetListDataResult { List<Comment> commentList = new ArrayList<Comment>(); String page; String pageTotal; public List<Comment> getCommentList() { return commentList; } public void setCommentList(List<Comment> commentList) { this.commentList = commentList; } public String getPage() { return page; } public void setPage(String page) { this.page = page; } public String getPageTotal() { return pageTotal; } public void setPageTotal(String pageTotal) { this.pageTotal = pageTotal; } } public int getCouponID() { return couponID; } public void setCouponID(int couponID) { this.couponID = couponID; } public int getPage() { return page; } public void setPage(int page) { this.page = page; } }
463798aebc39d8b1ffb89ddf23cf70820d9037b0
a589e41db6e5dad643d2c9081e4d2bc513f48a1e
/src/main/java/net/openhft/chronicle/engine2/map/VanillaSubscriptionKeyValueStore.java
17abbaaa422b16ed11ad09dec6b7d2f1c6574634
[]
no_license
ashelleyhft/Chronicle-Engine
c9ccea2bd346099bf2b565aade11ff6d77c71a85
d9314450eb22ac0557b5710b97a11102aea4efb9
refs/heads/master
2021-01-21T03:49:51.844879
2015-05-24T16:32:10
2015-05-24T16:32:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,922
java
package net.openhft.chronicle.engine2.map; import net.openhft.chronicle.engine2.api.FactoryContext; import net.openhft.chronicle.engine2.api.Subscriber; import net.openhft.chronicle.engine2.api.TopicSubscriber; import net.openhft.chronicle.engine2.api.map.KeyValueStore; import net.openhft.chronicle.engine2.api.map.SubscriptionKeyValueStore; /** * Created by peter on 22/05/15. */ public class VanillaSubscriptionKeyValueStore<K, V> extends AbstractKeyValueStore<K, V> implements SubscriptionKeyValueStore<K, V> { final SubscriptionKVSCollection<K, V> subscriptions = new SubscriptionKVSCollection<>(this); public VanillaSubscriptionKeyValueStore(FactoryContext<KeyValueStore<K, V>> context) { super(context); } @Override public V getAndPut(K key, V value) { V oldValue = kvStore.getAndPut(key, value); subscriptions.notifyUpdate(key, oldValue, value); return oldValue; } @Override public V getAndRemove(K key) { V oldValue = kvStore.getAndRemove(key); if (oldValue != null) subscriptions.notifyRemoval(key, oldValue); return oldValue; } @Override public <E> void registerSubscriber(Class<E> eClass, Subscriber<E> subscriber, String query) { subscriptions.registerSubscriber(eClass, subscriber, query); } @Override public <E> void registerSubscriber(Class<E> eClass, TopicSubscriber<E> subscriber, String query) { subscriptions.registerSubscriber(eClass, subscriber, query); } @Override public <E> void unregisterSubscriber(Class<E> eClass, Subscriber<E> subscriber, String query) { subscriptions.unregisterSubscriber(eClass, subscriber, query); } @Override public <E> void unregisterSubscriber(Class<E> eClass, TopicSubscriber<E> subscriber, String query) { subscriptions.unregisterSubscriber(eClass, subscriber, query); } }
8d7b1ddacd9645aea623f0cb3447ee6dee8c821f
55c1162c86452a410c94b9138f02b301aead331e
/blless/src/com/infoyb/manage/dao/system/impl/DictDaoImpl.java
8b98e1e715db7f203ac0083a7b1e49ba6e91caaf
[]
no_license
liuhp1641/beamzhang
45937ac06a680cc19298917e1c35134df1164c90
61766c2cb84ae05fc3f55bb1de00d7e02dc9d702
refs/heads/master
2021-01-10T08:44:19.856172
2016-01-30T12:58:14
2016-01-30T12:58:14
50,724,320
0
1
null
null
null
null
UTF-8
Java
false
false
9,268
java
package com.cm.manage.dao.system.impl; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import com.cm.manage.dao.base.IBaseDao; import com.cm.manage.dao.system.IDictDao; import com.cm.manage.util.base.CommonUtil; import com.cm.manage.util.base.DateUtil; import com.cm.manage.vo.base.EasyuiDataGrid; import com.cm.manage.vo.base.EasyuiDataGridJson; import com.cm.manage.vo.base.EasyuiTreeNode; import com.cm.manage.vo.system.DictDetail; import com.cm.manage.vo.system.DictType; @Repository("dictDao") public class DictDaoImpl implements IDictDao { @Autowired private IBaseDao<Object> baseDao; @Override public List<EasyuiTreeNode> getDictType(String model) { List<EasyuiTreeNode> tree = new ArrayList<EasyuiTreeNode>(); String tableName=""; if(CommonUtil.isNotEmpty(model)){ //0:账号;1: 订单; 2: 用户 if(model.equals("0")){ tableName="ACCOUNT_DICT_TYPE"; } if(model.equals("1")){ tableName="TMS_DICT_TYPE"; } if(model.equals("2")){ tableName="USER_DICT_TYPE"; } String sql="select ID,CODE,NAME,STATUS,CREATE_TIME,UPDATE_TIME from "+tableName; List<Map> dictList=baseDao.findBySql(sql); if (dictList != null && dictList.size() > 0) { for (Map map : dictList) { EasyuiTreeNode node = new EasyuiTreeNode(); BigDecimal id = (BigDecimal) map.get("ID"); node.setId(id.toString()); node.setIconCls("ext-icon-bullet_wrench"); node.setText((String)map.get("NAME")); tree.add(node); } } } return tree; } @Override public EasyuiDataGridJson getDictDetail(EasyuiDataGrid dg, String model, Long type_id) { EasyuiDataGridJson j = new EasyuiDataGridJson(); String tableName=""; if(CommonUtil.isNotEmpty(model)){ //0:账号;1: 订单; 2: 用户 if(model.equals("0")){ tableName="ACCOUNT_DICT_DETAIL"; } if(model.equals("1")){ tableName="TMS_DICT_DETAIL"; } if(model.equals("2")){ tableName="USER_DICT_DETAIL"; } String sql="select ID,TYPE_ID,CODE,NAME,STATUS,CREATE_TIME,UPDATE_TIME from "+tableName+" where 1=1 "; List<Object> values = new ArrayList<Object>(); if(CommonUtil.isNotEmpty(type_id)){ sql+=" and TYPE_ID= ?"; values.add(type_id); } String totalHql = " select count(*) from (" + sql + ")"; j.setTotal(baseDao.countBySql(totalHql,values).longValue());// 设置总记录数 if (dg.getSort() != null) {// 设置排序 String sort = ""; if (dg.getSort().toString().equalsIgnoreCase("createTime")) { sort = " CREATE_TIME"; } if (dg.getSort().toString().equalsIgnoreCase("updateTime")) { sort = " UPDATE_TIME"; } if (!sort.equals("")) { sql += " order by " + sort + " " + dg.getOrder(); } } List<Map> dictList = baseDao.findBySql(sql,values, dg.getPage(), dg.getRows());// 查询分页 List<DictDetail> details = new ArrayList<DictDetail>(); if (dictList != null && dictList.size() > 0) { for (Map map : dictList) { DictDetail vo=new DictDetail(); BigDecimal id = (BigDecimal) map.get("ID"); vo.setId(id.longValue()); vo.setCode((String)map.get("CODE")); Date createTime = (Date) map.get("CREATE_TIME"); vo.setCreateTime(DateUtil.format(createTime, "yyyy-MM-dd HH:mm:ss")); Date updateTime = (Date) map.get("UPDATE_TIME"); vo.setUpdateTime(DateUtil.format(updateTime, "yyyy-MM-dd HH:mm:ss")); vo.setName((String)map.get("NAME")); Object typeId = map.get("TYPE_ID"); if(typeId instanceof BigDecimal){ vo.setTypeId(((BigDecimal) typeId).longValue()); } if(typeId instanceof String){ vo.setTypeId(Long.parseLong((String)typeId)); } details.add(vo); } } j.setRows(details); } return j; } @Override public DictType typeAdd(DictType dict) { String tableName=""; String model=dict.getModel(); String seqId=""; if(CommonUtil.isNotEmpty(model)){ //0:账号;1: 订单; 2: 用户 if(model.equals("0")){ tableName="ACCOUNT_DICT_TYPE"; seqId="SEQ_ACCOUNT_DICT_TYPE.NEXTVAL"; } if(model.equals("1")){ tableName="TMS_DICT_TYPE"; seqId="SEQ_TMS_DICT_TYPE.NEXTVAL"; } if(model.equals("2")){ tableName="USER_DICT_TYPE"; seqId="SEQ_USER_DICT_TYPE.NEXTVAL"; } Long id=dict.getId(); List<Object> values = new ArrayList<Object>(); values.add(dict.getCode()); values.add(dict.getName()); if(id==null){ String sql=" insert into "+tableName+"(ID,CODE,NAME,STATUS,CREATE_TIME,UPDATE_TIME) values ("+seqId+",?,?,0,sysdate,sysdate)"; baseDao.executeSql(sql,values); }else{ String sql="update "+tableName+" set CODE= ? ,NAME=?,UPDATE_TIME=sysdate where ID="+id; baseDao.executeSql(sql,values); } } return dict; } /** * 字典类型信息 * @param model * @param id * @return */ public DictType typeInfo(String model,Long id){ String tableName=""; DictType t=new DictType(); if(CommonUtil.isNotEmpty(model)){ //0:账号;1: 订单; 2: 用户 if(model.equals("0")){ tableName="ACCOUNT_DICT_TYPE"; } if(model.equals("1")){ tableName="TMS_DICT_TYPE"; } if(model.equals("2")){ tableName="USER_DICT_TYPE"; } String sql="select ID,CODE,NAME,STATUS,CREATE_TIME,UPDATE_TIME from "+tableName+" where ID="+id; List<Map> dictList=baseDao.findBySql(sql); if (dictList != null && dictList.size() > 0) { Map map=dictList.get(0); t.setId(id.longValue()); t.setCode((String)map.get("CODE")); t.setName((String)map.get("NAME")); Date createTime = (Date) map.get("CREATE_TIME"); t.setCreateTime(DateUtil.format(createTime, "yyyy-MM-dd HH:mm:ss")); Date updateTime = (Date) map.get("UPDATE_TIME"); t.setUpdateTime(DateUtil.format(updateTime, "yyyy-MM-dd HH:mm:ss")); } } return t; } /** * 字典类型删除 * @param id */ public void typeDel(String model,Long id){ String tableName=""; String detailTable=""; if(CommonUtil.isNotEmpty(model)){ //0:账号;1: 订单; 2: 用户 if(model.equals("0")){ tableName="ACCOUNT_DICT_TYPE"; detailTable="ACCOUNT_DICT_DETAIL"; } if(model.equals("1")){ tableName="TMS_DICT_TYPE"; detailTable="TMS_DICT_DETAIL"; } if(model.equals("2")){ tableName="USER_DICT_TYPE"; detailTable="USER_DICT_DETAIL"; } String sql=" delete from "+tableName+" where ID="+id; baseDao.executeSql(sql); sql=" delete from "+detailTable+" where TYPE_ID="+id; baseDao.executeSql(sql); } } @Override public DictDetail detailAdd(DictDetail dict) { String tableName=""; String model=dict.getModel(); String seqId=""; if(CommonUtil.isNotEmpty(model)){ //0:账号;1: 订单; 2: 用户 if(model.equals("0")){ tableName="ACCOUNT_DICT_DETAIL"; seqId="SEQ_ACCOUNT_DICT_DETAIL.NEXTVAL"; } if(model.equals("1")){ tableName="TMS_DICT_DETAIL"; seqId="SEQ_TMS_DICT_DETAIL.NEXTVAL"; } if(model.equals("2")){ tableName="USER_DICT_DETAIL"; seqId="SEQ_USER_DICT_DETAIL.NEXTVAL"; } Long id=dict.getId(); List<Object> values = new ArrayList<Object>(); values.add(dict.getTypeId()); values.add(dict.getCode()); values.add(dict.getName()); if(id==null){ String sql=" insert into "+tableName+"(ID,TYPE_ID,CODE,NAME,STATUS,CREATE_TIME,UPDATE_TIME) values ("+seqId+",?,?,?,0,sysdate,sysdate)"; baseDao.executeSql(sql,values); }else{ String sql="update "+tableName+" set TYPE_ID=?,CODE= ? ,NAME=?,UPDATE_TIME=sysdate where ID="+id; baseDao.executeSql(sql,values); } } return dict; } public void detailDel(String model,String ids){ String tableName=""; if(CommonUtil.isNotEmpty(model)){ //0:账号;1: 订单; 2: 用户 if(model.equals("0")){ tableName="ACCOUNT_DICT_DETAIL"; } if(model.equals("1")){ tableName="TMS_DICT_DETAIL"; } if(model.equals("2")){ tableName="USER_DICT_DETAIL"; } for (String id : ids.split(",")) { String sql=" delete from "+tableName+" where id="+id; baseDao.executeSql(sql); } } } @Override public List getDictDetailList(Long typeId, String model) { String tableName = ""; if (CommonUtil.isNotEmpty(model)) { //0:账号;1: 订单; 2: 用户 if (model.equals("0")) { tableName = "ACCOUNT_DICT_DETAIL"; } if (model.equals("1")) { tableName = "TMS_DICT_DETAIL"; } if (model.equals("2")) { tableName = "USER_DICT_DETAIL"; } } String sql = "select * from " + tableName + " where type_id = ?"; List<Object> paramList = new ArrayList<Object>(); paramList.add(typeId); return baseDao.findBySql(sql, paramList); } }
b8d62438d6cb9d038558be07d0bbf97d52ddce46
5638240301cb5ec841907e999e3b45b9dd333f57
/src/main/java/melonslise/subwild/unused/SubWildTileEntityTypes.java
28222e32c6dd4e23fb62c9f32aca53f036b8b53c
[]
no_license
kernegal/Subterranean-Wilderness
798ca2ac1d738e0af15020c3933a0a5e9466399a
ab10606fb9e90da80596a193fe691e4405237fae
refs/heads/master
2023-02-22T16:14:15.815235
2021-01-23T10:48:42
2021-01-23T10:48:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,092
java
/* package melonslise.expedition.unused; import java.util.List; import java.util.function.Supplier; import com.google.common.collect.Lists; import melonslise.expedition.Expedition; import net.minecraft.block.Block; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityType; import net.minecraftforge.event.RegistryEvent; public final class ExpeditionTileEntityTypes { private ExpeditionTileEntityTypes() {} public static final List<TileEntityType> TILE_ENTITY_TYPES = Lists.newArrayList(); //public static final TileEntityType MIMIC = add("mimic", MimicTileEntity::new, ExpeditionBlocks.SPELEOTHEM); public static void register(RegistryEvent.Register<TileEntityType<?>> event) { for(TileEntityType type : TILE_ENTITY_TYPES) event.getRegistry().register(type); } public static TileEntityType add(String name, Supplier<? extends TileEntity> factory, Block... blocks) { TileEntityType type = TileEntityType.Builder.create(factory, blocks).build(null).setRegistryName(Expedition.ID, name); TILE_ENTITY_TYPES.add(type); return type; } } */
c5ca37de2cae8648486176c965ed66cb2674744b
30b616047212d6f474c78c0d960e4fab336edc13
/app/src/main/java/com/example/alannahcooke/callofthewild/pop_cat.java
fe37cc35de00701148ec05ac81295b22f66bf41b
[]
no_license
lannahcookie/CallOfTheWild
90ed62e3a5d363f4f20dc395500aefc88b9d4db5
3c8b6d370b08581f2d3362ac6ca96c79fb9e12f4
refs/heads/master
2020-09-22T07:23:03.270946
2016-08-19T12:45:21
2016-08-19T12:45:21
66,081,753
0
0
null
null
null
null
UTF-8
Java
false
false
1,120
java
package com.example.alannahcooke.callofthewild; import android.media.MediaPlayer; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.util.DisplayMetrics; import android.view.View; import android.widget.Button; /** * Created by alannahcooke on 17/08/16. */ public class pop_cat extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.pop_cat); final MediaPlayer catSound = MediaPlayer.create(this, R.raw.catmeow); Button playCatMeow = (Button) this.findViewById(R.id.audioCat); playCatMeow.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { catSound.start(); } }); DisplayMetrics dm = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(dm); int width = dm.widthPixels; int height = dm.heightPixels; getWindow().setLayout((int) (width * .8), (int) (height * .6)); } }
20222b0aed0f9e9e80ef262c31d966fa64ef50e9
130c3232030e5a913c0ae93cbe820cf620125646
/MyApplication/app/src/main/java/com/example/hamlet/newproj/MyFileClass.java
c86a7d49f1e815ce4a8093936d657b74e0170987
[]
no_license
DariuszGorgon/MyApplication
f709971c9562c44364332aa1941560afda967dda
0bb06477d7c4fc0455877dd36f5a739be0a97370
refs/heads/master
2021-01-18T23:29:31.289529
2016-05-29T18:28:36
2016-05-29T18:28:36
53,803,503
0
1
null
2016-05-16T18:48:02
2016-03-13T19:30:21
Java
UTF-8
Java
false
false
4,938
java
package com.example.hamlet.newproj; import android.widget.Toast; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FileWriter; import java.io.IOException; import java.io.InputStreamReader; /** * Created by Kamil on 2016-04-12. */ public class MyFileClass { public static void SaveFile(File file, String[] data) { FileOutputStream fos = null; try { fos = new FileOutputStream(file); } catch (FileNotFoundException e) {e.printStackTrace();} try { try { for (int i = 0; i<data.length; i++) { fos.write(data[i].getBytes()); fos.write("\n".getBytes()); } } catch (IOException e) {e.printStackTrace();} } finally { try { fos.close(); } catch (IOException e) {e.printStackTrace();} } } //============================================================================================= public static String[] LoadFile(File file) { FileInputStream fis = null; try { fis = new FileInputStream(file); } catch (FileNotFoundException e) {e.printStackTrace();} InputStreamReader isr = new InputStreamReader(fis); BufferedReader br = new BufferedReader(isr); //===========get nuber of lines in file================= int anzahl=0; try { while ((br.readLine()) != null) { anzahl++;//nuber of line } } catch (IOException e) {e.printStackTrace();} //===================================================== try { fis.getChannel().position(0); } catch (IOException e) {e.printStackTrace();} String[] array = new String[anzahl]; String line; int i = 0; try { while((line=br.readLine())!=null) { array[i] = line; i++; } } catch (IOException e) {e.printStackTrace();} return array; } //============================================================================================= public static void AddNewDataToLoadedFile(File file,String[] data) { String[] s ; s=MyFileClass.LoadFile(file); FileOutputStream fos = null; try { fos = new FileOutputStream(file); } catch (FileNotFoundException e) {e.printStackTrace();} try { try { for (int i = 0; i<s.length; i++) { fos.write(s[i].getBytes()); fos.write("\n".getBytes()); } for (int i = 0; i<data.length; i++) { fos.write(data[i].getBytes()); fos.write("\n".getBytes()); } } catch (IOException e) {e.printStackTrace();} } finally { try { fos.close(); } catch (IOException e) {e.printStackTrace();} } } //============================================================================================= public static void AddNewDataToLoadedFile2(File file,String data) { FileWriter fileWriter=null; try { fileWriter = new FileWriter(WepViewActivity.path + "/weather.txt",true); fileWriter.write(data); fileWriter.write("\n"); } catch (IOException e) { e.printStackTrace(); } finally { if(fileWriter!=null) { try { fileWriter.close(); } catch (IOException e) { e.printStackTrace(); } } } } //============================================================================================= public static void ClearFile(File file) { FileOutputStream fos = null; try { fos = new FileOutputStream(file); } catch (FileNotFoundException e) {e.printStackTrace();} try { try { fos.write("".getBytes()); } catch (IOException e) {e.printStackTrace();} } finally { try { fos.close(); } catch (IOException e) {e.printStackTrace();} } } //============================================================================================= }
744c44d867b3881f64cd8d85fb5c838d7b4de600
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/9/9_d3f142f6e4bfbf00dd6117dfb4c27b76b88b03ae/Kunde/9_d3f142f6e4bfbf00dd6117dfb4c27b76b88b03ae_Kunde_t.java
773cb6769470b166391e4e42af03f828b59bcbaa
[]
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
10,854
java
package de.shop.Kundenverwaltung.domain; import static de.shop.Util.Constants.KEINE_ID; import static de.shop.Util.Constants.LONG_ANZ_ZIFFERN; import static java.util.logging.Level.FINER; import static javax.persistence.CascadeType.PERSIST; import static javax.persistence.TemporalType.TIMESTAMP; import java.io.Serializable; import java.lang.invoke.MethodHandles; import java.net.URI; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.List; import java.util.logging.Logger; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.OneToMany; import javax.persistence.OneToOne; import javax.persistence.PostLoad; import javax.persistence.PostPersist; import javax.persistence.PrePersist; import javax.persistence.PreUpdate; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.Transient; import javax.validation.constraints.AssertTrue; import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlTransient; import org.hibernate.validator.constraints.Email; import de.shop.Auftragsverwaltung.domain.Auftrag; /** * The persistent class for the kunde database table. * */ @Entity @Table(name = "kunde") @NamedQueries({ @NamedQuery(name = Kunde.KUNDE_BY_NACHNAME, query = "FROM Kunde k WHERE k.nachname = :" + Kunde.PARAM_NACHNAME), @NamedQuery(name = Kunde.KUNDE_BY_EMAIL, query = "FROM Kunde k WHERE k.email = :" + Kunde.PARAM_EMAIL), @NamedQuery(name = Kunde.KUNDE_BY_PLZ, query = "FROM Kunde k WHERE k.adresse.plz = :" + Kunde.PARAM_PLZ), @NamedQuery(name = Kunde.KUNDE_BY_KNR, query = "FROM Kunde k WHERE k.kundenNr = :" + Kunde.PARAM_KUNDENNUMMER), @NamedQuery(name = Kunde.KUNDEN_ALL, query = "SELECT k FROM Kunde k"), @NamedQuery(name = Kunde.KUNDE_BY_NAME_AUFTRAEGE, query = "SELECT DISTINCT k" + " FROM Kunde k" + " LEFT JOIN FETCH k.auftraege" + " WHERE k.nachname = :" + Kunde.PARAM_NACHNAME), @NamedQuery(name = Kunde.KUNDE_BY_ID_AUFTRAEGE, query = "SELECT DISTINCT k" + " FROM Kunde k" + " LEFT JOIN FETCH k.auftraege" + " WHERE k.kundenNr = :" + Kunde.PARAM_KUNDENNUMMER) }) @XmlRootElement public class Kunde implements Serializable { private static final long serialVersionUID = 3925016425151715847L; private static final Logger LOGGER = Logger.getLogger(MethodHandles.lookup().lookupClass().getName()); private static final String PREFIX = "Kunde."; public static final String KUNDEN_ALL = PREFIX + "findKundenAll"; public static final String KUNDE_BY_EMAIL = PREFIX + "findKundenByEmail"; public static final String KUNDE_BY_NACHNAME = PREFIX + "findKundenByNachname"; public static final String KUNDE_BY_PLZ = PREFIX + "findKundenByPlz"; public static final String KUNDE_BY_KNR = PREFIX + "findKundenByKundennummer"; public static final String KUNDE_BY_NAME_AUFTRAEGE = PREFIX + "findKundenByNachnameFetchAufraege"; public static final String KUNDE_BY_ID_AUFTRAEGE = PREFIX + "findKundenByIdFetchAufraege"; public static final String PARAM_PLZ = "plz"; public static final String PARAM_NACHNAME = "nachname"; public static final String PARAM_KUNDENNUMMER = "kundenNr"; public static final String PARAM_EMAIL = "email"; @Id @GeneratedValue @Column(nullable = false, updatable = false, precision = LONG_ANZ_ZIFFERN) @XmlAttribute private Long kundenNr = KEINE_ID; @Email @NotNull(message = "{kundenverwaltung.kunde.email.notNull}") private String email; @Column(name = "erstellt_am") @Temporal(TIMESTAMP) @XmlTransient private Date erstelltAm; @Column(name = "geaendert_am") @Temporal(TIMESTAMP) @XmlTransient private Date geaendertAm; @NotNull(message = "{kundenverwaltung.kunde.nachname.notNull}") @Pattern(regexp = "[A-Z][a-z]+", message = "{kundenverwaltung.kunde.nachname.pattern}") private String nachname; @NotNull(message = "{kundenverwaltung.kunde.passwort.notNull}") private String passwort; @Transient private String passwortWdh; @AssertTrue(groups = PasswordGroup.class, message = "{kundenverwaltung.kunde.passwort.notEqual}") public boolean isPasswordEqual() { if (passwort == null) return passwortWdh == null; return passwort.equals(passwortWdh); } @NotNull(message = "{kundenverwaltung.kunde.vorname.notNull}") private String vorname; //EAGER-Fetching @OneToOne(mappedBy = "kunde", cascade = PERSIST) @NotNull(message = "{kundenverwaltung.kunde.adresse.notNull}") @XmlElement(required = true) private Adresse adresse; @PrePersist protected void prePersist() { erstelltAm = new Date(); geaendertAm = new Date(); } @PostPersist protected void postPersist() { LOGGER.log(FINER, "Neuer Kunde mit Kundenummer={0}", kundenNr); } @PreUpdate protected void preUpdate() { geaendertAm = new Date(); } @PostLoad protected void postLoad() { passwortWdh = passwort; } //LAZY-Fetching @OneToMany(mappedBy = "kunde") @XmlTransient private List<Auftrag> auftraege; @Transient @XmlElement(name = "auftraege") private URI auftraegeUri; public List<Auftrag> getAuftraege() { return Collections.unmodifiableList(auftraege); } public URI getAuftraegeUri() { return auftraegeUri; } public void setAuftraege(List<Auftrag> auftraege) { if (auftraege == null) { this.auftraege = auftraege; return; } // Wiederverwendung der vorhandenen Collection auftraege.clear(); if (auftraege != null) { this.auftraege.addAll(auftraege); } } public void setAuftraegeUri(URI auftraegeUri) { this.auftraegeUri = auftraegeUri; } public Kunde addAuftrag(Auftrag auftrag) { if (auftraege == null) { auftraege = new ArrayList<>(); } auftraege.add(auftrag); return this; } public void setValues(Kunde k) { nachname = k.nachname; vorname = k.vorname; email = k.email; passwort = k.passwort; passwortWdh = k.passwort; adresse.setValues(k.getAdresse()); } public Adresse getAdresse() { return adresse; } public void setAdresse(Adresse adresse) { this.adresse = adresse; } public Kunde() { } public Long getKundenNr() { return this.kundenNr; } public void setKundenNr(Long kundenNr) { this.kundenNr = kundenNr; } public String getEmail() { return this.email; } public void setEmail(String email) { this.email = email; } public Date getErstelltAm() { return this.erstelltAm == null ? null : (Date) this.erstelltAm.clone(); } public void setErstelltAm(Date erstelltAm) { this.erstelltAm = erstelltAm == null ? null : (Date) erstelltAm.clone(); } public Date getGeaendertAm() { return this.geaendertAm == null ? null : (Date) this.geaendertAm.clone(); } public void setGeaendertAm(Date geaendertAm) { this.geaendertAm = geaendertAm == null ? null : (Date) geaendertAm.clone(); } public String getNachname() { return this.nachname; } public void setNachname(String nachname) { this.nachname = nachname; } public String getPasswort() { return this.passwort; } public void setPasswort(String passwort) { this.passwort = passwort; } public String getPasswortWdh() { return passwortWdh; } public void setPasswortWdh(String passwortWdh) { this.passwortWdh = passwortWdh; } public String getVorname() { return this.vorname; } public void setVorname(String vorname) { this.vorname = vorname; } /* (non-Javadoc) * @see java.lang.Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((adresse == null) ? 0 : adresse.hashCode()); result = prime * result + ((email == null) ? 0 : email.hashCode()); result = prime * result + ((erstelltAm == null) ? 0 : erstelltAm.hashCode()); result = prime * result + ((geaendertAm == null) ? 0 : geaendertAm.hashCode()); result = prime * result + ((nachname == null) ? 0 : nachname.hashCode()); result = prime * result + ((passwort == null) ? 0 : passwort.hashCode()); result = prime * result + ((kundenNr == null) ? 0 : kundenNr.hashCode()); result = prime * result + ((vorname == null) ? 0 : vorname.hashCode()); return result; } /* (non-Javadoc) * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Kunde other = (Kunde) obj; if (adresse == null) { if (other.adresse != null) return false; } else if (!adresse.equals(other.adresse)) return false; if (email == null) { if (other.email != null) return false; } else if (!email.equals(other.email)) return false; if (erstelltAm == null) { if (other.erstelltAm != null) return false; } else if (!erstelltAm.equals(other.erstelltAm)) return false; if (geaendertAm == null) { if (other.geaendertAm != null) return false; } else if (!geaendertAm.equals(other.geaendertAm)) return false; if (kundenNr.equals(other.kundenNr)) return false; if (nachname == null) { if (other.nachname != null) return false; } else if (!nachname.equals(other.nachname)) return false; if (passwort == null) { if (other.passwort != null) return false; } else if (!passwort.equals(other.passwort)) return false; if (vorname == null) { if (other.vorname != null) return false; } else if (!vorname.equals(other.vorname)) return false; return true; } @Override public String toString() { return "Kunde [kundenNr=" + kundenNr + ", vorname=" + vorname + ", nachname=" + nachname + ", email=" + email + ", passwort=" + passwort + ", passwortWdh=" + passwortWdh + " erstelltAm=" + erstelltAm + ", geaendertAm=" + geaendertAm + "]"; } }
590f688f8084aa869fbf6f026334deb91b71bf50
855d2882ac8d4a65ea261675177f6f76e7da6e67
/sgic-internal-services/product-service/src/main/java/com/sgic/internal/product/ProductApplication.java
a62358f556b7739ba0ba9a3af52a377241f23ceb
[]
no_license
DefectTracker-InvictaInnovation/Defect-Tracker-Final-Backend
c79a44ef03980020114ae75a4d7ebbc6ca1549c6
d2936e65c116cbed3ba3bca5a94e53737abb7a98
refs/heads/master
2023-04-28T07:06:51.391621
2019-11-26T07:44:23
2019-11-26T07:44:23
224,125,481
0
0
null
null
null
null
UTF-8
Java
false
false
436
java
package com.sgic.internal.product; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; @SpringBootApplication public class ProductApplication extends SpringBootServletInitializer{ public static void main(String[] args) { SpringApplication.run(ProductApplication.class, args); } }
24187c8c0401e0bd3023100705331bba0169bed0
77b15e06f57386c659e3e65a1ff8f1e9586228f6
/src/main/java/com/javahowdoi/challengeq/BoilerPlateQ.java
342361abd1fd2f7645f4d6ca858402fd71a7bdca
[]
no_license
harimkblog/javahowdoi
b63cf7cfedb46a1f392263748b6bf8800fd314d6
bb3df077fb133c2ee3b241c9e3dbf3ad670bd3c9
refs/heads/master
2023-02-18T20:33:09.270480
2021-01-22T21:47:44
2021-01-22T21:47:44
331,365,946
0
0
null
null
null
null
UTF-8
Java
false
false
457
java
package com.javahowdoi.challengeq; /** * Created by Hari on 11/24/2019. */ public class BoilerPlateQ { private int i; private String s; public BoilerPlateQ(int i, String s) { this.i = i; this.s = s; } public int getI() { return i; } public void setI(int i) { this.i = i; } public String getS() { return s; } public void setS(String s) { this.s = s; } }
0cc0799c0f709052b841575fedd8271bb733ee3e
ac3ec5bed4613d11cdd4f5b6638f10cc5e679065
/SpringBootJPA/src/test/java/com/example/test/OneToManyFk.java
a92e73bb23295ebde036bd6cd53308954c4050c1
[]
no_license
18753377299/SpringBootBTest
156ba3af8848d091f0ae47b364f8d2deb896065e
13a5e94dee10558e207779889cd16b4e57469eef
refs/heads/master
2022-07-03T19:45:55.933080
2020-11-03T14:20:11
2020-11-03T14:20:11
233,329,701
0
0
null
2022-06-21T02:37:22
2020-01-12T02:56:49
Java
UTF-8
Java
false
false
1,436
java
package com.example.test; import java.util.ArrayList; import java.util.List; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import com.example.JpaApplication; import com.example.dao.TestTwoRepository; import com.example.pojo.TestTwo; import com.example.pojo.TestTwoKey; import com.example.pojo.TestTwoKeyId; /** * 一对多关联关系测试 * * */ @RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest(classes=JpaApplication.class) public class OneToManyFk { @Autowired private TestTwoRepository testTwoRepository; /** * 一对多关联关系的添加,使用@Data不能成功,自己添加get、set方法就可以成功 */ @Test public void testTwoSave(){ try { TestTwo testTwo = new TestTwo(); testTwo.setId("1"); testTwo.setName("lqk"); List<TestTwoKey> testTwoKeyList = new ArrayList<TestTwoKey>(); TestTwoKey testTwoKey = new TestTwoKey(); TestTwoKeyId id =new TestTwoKeyId(); id.setTestId("1"); id.setTestType("aa"); testTwoKey.setId(id); testTwoKeyList.add(testTwoKey); // testTwo.setTestTwoKeyList(testTwoKeyList); //保存 this.testTwoRepository.save(testTwo); System.out.println(testTwo); } catch (Exception e) { e.printStackTrace(); } } }
fcd533f45410bc082fb559229da4bc4f9922dfcf
d727a84017994e492159d6787bb725769627ac42
/org.insightech.er/src/org/insightech/er/editor/view/dialog/dbimport/SelectImportedObjectFromDBDialog.java
f9c639994185d44a586b743a8dbee89ee50b86f8
[]
no_license
xsano33/ERMaster-fork-db2
8d507c8352eb0c3e52c7f97f9765cd228fcbf9a5
4a16d6c397d2511c638b2749d50313eedb5e0628
refs/heads/master
2016-08-04T18:00:38.205629
2014-03-26T08:37:26
2014-03-26T08:37:26
18,124,775
0
1
null
null
null
null
UTF-8
Java
false
false
1,716
java
package org.insightech.er.editor.view.dialog.dbimport; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Shell; import org.insightech.er.Activator; import org.insightech.er.common.exception.InputException; import org.insightech.er.common.widgets.CompositeFactory; import org.insightech.er.editor.ERDiagramEditor; import org.insightech.er.editor.model.ERDiagram; import org.insightech.er.editor.model.dbimport.DBObjectSet; public class SelectImportedObjectFromDBDialog extends AbstractSelectImportedObjectDialog { private Button clearDiagramButton; private ERDiagramEditor editor; private ERDiagram diagram; public SelectImportedObjectFromDBDialog(Shell parentShell, ERDiagram diagram, DBObjectSet allObjectSet, ERDiagramEditor editor) { super(parentShell, diagram, allObjectSet); this.editor = editor; this.diagram = diagram; } @Override protected void initializeOptionGroup(Group group) { this.clearDiagramButton = CompositeFactory.createCheckbox(this, group, "label.clear.diagram"); this.clearDiagramButton.setSelection(true); this.useCommentAsLogicalNameButton = CompositeFactory.createCheckbox( this, group, "label.use.comment.as.logical.name"); super.initializeOptionGroup(group); } @Override protected void perfomeOK() throws InputException { super.perfomeOK(); this.resultUseCommentAsLogicalName = this.useCommentAsLogicalNameButton .getSelection(); if (this.clearDiagramButton.getSelection()) { if (!Activator.showConfirmDialog("label.clear.diagram.confirm")) { throw new InputException(null); } else { this.diagram.clear(); this.editor.resetCommandStack(); } } } }
9408bcc3a689340bad12c82c1fc280d7c8f37653
4f31c254e125dede3e185697a05328f130a17bca
/src/com/baskarks/design/patterns/behavioral/observer/StatusBar.java
0284de117773af2a2d8d42334da54529391ec133
[]
no_license
BaskarKS/JavaDesignPatterns
345e04f1fa9dc94be8e0baa54cd61e188996a3ce
49af74f1d7260681fb5c488f47514e8b2a9fdb6c
refs/heads/master
2020-12-23T19:22:45.333566
2020-11-27T04:29:10
2020-11-27T04:29:10
237,246,495
0
0
null
null
null
null
UTF-8
Java
false
false
451
java
package com.baskarks.design.patterns.behavioral.observer; import java.util.ArrayList; import java.util.List; public class StatusBar implements Observer{ private List<Stock> stocks = new ArrayList<>(); public void addStock(Stock stock) { stocks.add(stock); } public void show() { for (var stock : stocks) System.out.println(stock); } @Override public void update() { show(); } }
db267bc753450cbb925c272a7aaf3e2b4bf57d81
0035db6b09acf11efcf4e2fb4df25eedfa9af4c5
/zt-common/src/main/java/com/mt/zt/utils/DateUtils.java
f8ff4d7cad40729d7799f02a3e3dad2648736259
[]
no_license
fengmiao/zt
b80ace3beb15b3dd084855847eff4fcbc52a2e39
468d05b414c2e6d9063eff9a41bd8b8f8789a46e
refs/heads/master
2021-01-10T20:31:58.886283
2015-06-10T03:39:58
2015-06-10T03:39:58
35,486,638
0
0
null
null
null
null
UTF-8
Java
false
false
2,869
java
package com.mt.zt.utils; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import org.joda.time.DateTime; import org.joda.time.Duration; import org.joda.time.Period; import org.joda.time.PeriodType; import com.mt.zt.exception.AllztException; public class DateUtils { public static int getAge(Date date){ DateTime end = new DateTime(); DateTime begin = new DateTime(date); Period p = new Period(begin, end, PeriodType.years()); return p.getYears(); } public static String formatyyyyMMdd(Date date){ SimpleDateFormat sf=new SimpleDateFormat("yyyy-MM-dd"); return sf.format(date); } public static Date parseyyyyMMdd(String source){ SimpleDateFormat sf=new SimpleDateFormat("yyyy-MM-dd"); try { return sf.parse(source); } catch (ParseException e) { throw new IllegalArgumentException("生日格式错误"); } } public static Date parseTime(String str){ String patter = "yyyy-MM-dd HH:mm:ss.SSS"; SimpleDateFormat sf=new SimpleDateFormat(patter); try { return sf.parse(str); } catch (ParseException e) { throw new IllegalArgumentException("时间格式错误"); } } public static String formatTime(Date date){ String patter = "yyyy-MM-dd HH:mm:ss.SSS"; SimpleDateFormat sf=new SimpleDateFormat(patter); return sf.format(date); } public static String getIntervalTime(Date date){ String result = ""; DateTime end = new DateTime(); DateTime begin = new DateTime(date); Duration d = new Duration(begin, end); int[] arr = new int[]{1,24,7*24,4*7*24,365*24}; int index = 0; for (int i = 0; i < arr.length; i++) { if(d.getStandardHours() >= arr[i]){ index = index + 1; } } switch (index) { case 0: result = d.getStandardMinutes()+"分前"; break; case 1: result = d.getStandardHours()+"小时前"; break; case 2: result = d.getStandardDays()+"天前"; break; case 3: Period pw = new Period(begin, end, PeriodType.weeks()); result = pw.getWeeks()+"周前"; break; case 4: Period pm = new Period(begin, end, PeriodType.months()); if(pm.getMonths() > 0){ result = pm.getMonths()+"月前"; }else{ result = "4周前"; } break; case 5: Period py = new Period(begin, end, PeriodType.years()); result = py.getYears()+"年前"; break; default: break; } return result; } public static void main(String[] args) { DateTime begin = new DateTime(2014,10,18,10,10,30); DateTime end = new DateTime(); Period pw = new Period(begin, end, PeriodType.weeks()); System.out.println(pw.getWeeks()); String aa = "2014-07-05"; //Date date = DateUtils.parseBirthday(aa); //String r = DateUtils.getIntervalTime(date); //System.out.println(r); } }
e312ce232060ec2567c1dc0cc9c0625de6f3f26c
0af8b92686a58eb0b64e319b22411432aca7a8f3
/api-vs-impl-small/utils/src/main/java/org/gradle/testutils/performancenull_20/Productionnull_1926.java
11874b53abd36004dc574cfb342b0b1e6dff888f
[]
no_license
gradle/performance-comparisons
b0d38db37c326e0ce271abebdb3c91769b860799
e53dc7182fafcf9fedf07920cbbea8b40ee4eef4
refs/heads/master
2023-08-14T19:24:39.164276
2022-11-24T05:18:33
2022-11-24T05:18:33
80,121,268
17
15
null
2022-09-30T08:04:35
2017-01-26T14:25:33
null
UTF-8
Java
false
false
590
java
package org.gradle.testutils.performancenull_20; public class Productionnull_1926 { private final String property; public Productionnull_1926(String param) { this.property = param; } public String getProperty() { return property; } private String prop0; public String getProp0() { return prop0; } public void setProp0(String value) { prop0 = value; } private String prop1; public String getProp1() { return prop1; } public void setProp1(String value) { prop1 = value; } }
09339696b61a200176a76d617b03c46dfe4a7510
5c32ca76e7892eb853875a72e40b42bc1bb9da33
/src/main/java/java8/ObjectReference.java
12b0e48583c4901291a91159683b2bbf756ea454
[]
no_license
madalin93cc/Java8Features
e326f45a610e5e9ede6bad1ae33a0a3339077d85
973f920e0fcf1966b09fbf0c287f41bdba03f18e
refs/heads/master
2020-05-18T00:10:53.811959
2015-01-06T10:08:40
2015-01-06T10:08:40
28,186,660
0
0
null
null
null
null
UTF-8
Java
false
false
169
java
package main.java.java8; /** * ObjectReference.java */ class ObjectReference { String startsWith(String s){ return String.valueOf(s.charAt(0)); } }
dd7eb602c1a34c862cc89f94136dd4a2f5265463
97bf70e31357da2af8c169e63cf0bea9066dc312
/src/main/java/com/example/identifier/controllers/PersonController.java
3daf0af6480f348c504b2d8fbd2548c115aad9e6
[]
no_license
AlexandrovV/identifier
0e9df252533dfd0b682918a3c67fb2bca38d8f41
3379df4ea43fd402a77f000618361e26955c9276
refs/heads/master
2020-03-19T22:02:30.269693
2018-06-12T08:56:12
2018-06-12T08:56:12
136,957,770
0
0
null
null
null
null
UTF-8
Java
false
false
1,915
java
package com.example.identifier.controllers; import com.example.identifier.dao.PersonDao; import com.example.identifier.mappers.PersonMapper; import com.example.identifier.models.Person; import com.example.identifier.pojo.FilterRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.NoSuchElementException; @RestController @RequestMapping("/api/persons") public class PersonController { @Autowired PersonDao personDao; @Autowired PersonMapper personMapper; @RequestMapping(value = "/", method = RequestMethod.GET) public List<Person> getAllPersons() { return (List<Person>) personDao.findAll(); } @RequestMapping(value = "/", method = RequestMethod.POST) public Person createPerson(@RequestBody Person person) { return personDao.save(person); } @RequestMapping(value = "/{id}", method = RequestMethod.GET) public Person getPersonById(@PathVariable long id) { return personDao.findById(id).orElseThrow(() -> new NoSuchElementException("No person with id " + id + " was found")); } @RequestMapping(value = "/{id}", method = RequestMethod.PUT) public Person updatePerson(@RequestBody Person person, @PathVariable long id) { person.setId(id); return personDao.save(person); } @RequestMapping(value = "/{id}", method = RequestMethod.DELETE) public boolean deletePerson(@PathVariable long id) { Person person = personDao.findById(id).orElseThrow(() -> new NoSuchElementException("No person with id " + id + " was found")); personDao.delete(person); return true; } @RequestMapping(value = "/search", method = RequestMethod.POST) public List<Person> search(@RequestBody FilterRequest filterRequest) { return personMapper.search(filterRequest); } }
d4091b86fe3afba52464abfae393b8b0ac6c9913
e98854c1e0796f678ae1ac460ced9c85e464a350
/src/main/java/es/udc/pojoapp/model/pedidoservice/PedidoService.java
f9060900d377eb5acd552bfcca462f21f10c0474
[]
no_license
emilio89/tiendaOnline
94e732938b0adf038823cfbd19fdfc7476ffb898
7fa29c8ed440dcee6d3a1a598ff5dae282f0a5e4
refs/heads/master
2020-04-10T04:11:36.406513
2015-04-06T22:25:33
2015-04-06T22:25:33
24,675,476
2
0
null
null
null
null
UTF-8
Java
false
false
1,177
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package es.udc.pojoapp.model.pedidoservice; import es.udc.pojo.modelutil.exceptions.InstanceNotFoundException; import es.udc.pojoapp.model.lineapedido.LineaPedido; import es.udc.pojoapp.model.pedido.Pedido; import es.udc.pojoapp.model.recomendacion.Recomendacion; import java.util.List; /** * * @author Emilio */ public interface PedidoService { public void registrarPedido (Pedido pedido) ; public List<Pedido> listaPedidos(); public Pedido buscarPedido (long idPedido) throws InstanceNotFoundException; public List<LineaPedido> listaPedidosLineas(long idPedido); public void actualizarEstado (long idPedido, String estado) throws InstanceNotFoundException; public void actualizarNumVeces (long id1, long id2) throws InstanceNotFoundException; public long findIdRopa1 (long idRopa); public long findIdRopa2 (long idRopa); public void insertarPedidoService (long id1, long id2); public List<Recomendacion> listaRecomendaciones () ; public List<Long> ids1 (long idRopa2); public List<Long> ids2 (long idRopa1); }
ce527848019a57cbf04f9936cc769667b047f69e
6c53b2b97e7d6873709ae1106e929bbe181a9379
/src/java/com/eviware/soapui/support/resolver/DisablePropertyTransferResolver.java
9915a83226508cb73373066ba43d94ff00d932c2
[]
no_license
stallewar/soapui-
ca7824f4c4bc268b9a7798383f4f2a141d38214b
0464f7826945709032964af67906e7d6e61b698a
refs/heads/master
2023-03-19T05:23:56.746903
2011-07-12T08:29:36
2011-07-12T08:29:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,513
java
/* * soapUI, copyright (C) 2004-2011 eviware.com * * soapUI is free software; you can redistribute it and/or modify it under the * terms of version 2.1 of the GNU Lesser General Public License as published by * the Free Software Foundation. * * soapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details at gnu.org. */ package com.eviware.soapui.support.resolver; import com.eviware.soapui.impl.wsdl.teststeps.PropertyTransfer; import com.eviware.soapui.support.UISupport; import com.eviware.soapui.support.resolver.ResolveContext.Resolver; public class DisablePropertyTransferResolver implements Resolver { PropertyTransfer transfer = null; private boolean resolved; public DisablePropertyTransferResolver( PropertyTransfer transfer ) { this.transfer = transfer; } public String toString() { return getDescription(); } public String getDescription() { return "Disable Property Transfer"; } public String getResolvedPath() { return null; } public boolean isResolved() { return resolved; } public boolean resolve() { if( UISupport.confirm( "Are you sure you want to disable property?", "Property Disable" ) && transfer != null ) { transfer.setDisabled( true ); resolved = true; } return resolved; } }
[ "oysteigi@bluebear.(none)" ]
oysteigi@bluebear.(none)
20d1586d689c1296e0f11f66487ad397dad877e3
702fe1fbc4f39b507a25feaef8d37035cc231c37
/app/src/test/java/com/lei/okhttpdemo/ExampleUnitTest.java
a40c3626a843fee0f67026e28c213f303d10f2dc
[]
no_license
nobodylei/okHttpDemo
6b9b8e3823e9f809b220b96c52465e9295208073
2057de36baff0f0664cebcd7304d8aa13ffcb34a
refs/heads/master
2021-04-27T06:07:17.333236
2018-02-23T10:32:44
2018-02-23T10:32:44
122,607,516
0
0
null
null
null
null
UTF-8
Java
false
false
396
java
package com.lei.okhttpdemo; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
31276fc86876414ceb052febddff4b266658f325
bb94161b1a68c6790be1f1a1027cf3a180f913b8
/scrm-service/src/main/java/com/scrm/service/wecom/customer/CustomerClient.java
b71a613cbbf2731c356142cfcd5b48c46d2349c7
[]
no_license
1099469599/scrm
0e879c72f847e96f7e34aa8228417c97c23e7698
ef7cb0b89b3ca3fe5a9c320d72124e73bc67928c
refs/heads/main
2023-08-24T06:53:02.716974
2021-10-18T12:19:32
2021-10-18T12:19:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,963
java
package com.scrm.service.wecom.customer; import com.github.lianjiatech.retrofit.spring.boot.annotation.Intercept; import com.github.lianjiatech.retrofit.spring.boot.annotation.RetrofitClient; import com.github.lianjiatech.retrofit.spring.boot.retry.Retry; import com.scrm.entity.enums.AccessTokenEnum; import com.scrm.retrofit.interceptor.AccessTokenInterceptor; import com.scrm.retrofit.interceptor.annotation.AccessToken; import retrofit2.http.Body; import retrofit2.http.GET; import retrofit2.http.POST; import retrofit2.http.Query; import java.util.Map; /** * @author liuKevin * @date 2021年10月13日 16:15 */ @RetrofitClient(baseUrl = "https://qyapi.weixin.qq.com/cgi-bin/") @Intercept(handler = AccessTokenInterceptor.class) public interface CustomerClient { /** * 获取配置了客户联系功能的成员列表 */ @GET(value = "externalcontact/get_follow_user_list") @AccessToken(type = AccessTokenEnum.CONTACT) @Retry(maxRetries = 4) String getFollowUserList(); /** * 获取该用户管理的客户集合 * * @param userId 用户Id */ @GET(value = "externalcontact/list") @AccessToken(type = AccessTokenEnum.CONTACT) @Retry(maxRetries = 4) String list(@Query(value = "userid") String userId); /** * 获取客户详情 * * @param externalUserId 客户Id */ @GET(value = "externalcontact/get") @AccessToken(type = AccessTokenEnum.CONTACT) @Retry(maxRetries = 4) String get(@Query(value = "external_userid") String externalUserId); /** * 根据企业成员id批量获取客户详情 * userid ----> 用户Id * cursor ----> 上一次请求的游标值, 默认为 "" * limit ----> 偏移量 * * @param query 请求参数 */ @POST(value = "batch/get_by_user") @AccessToken(type = AccessTokenEnum.CONTACT) @Retry(maxRetries = 4) String getByUser(@Body Map<String, Object> query); }
41542ed0d0e06ca69d03302ed0650e0518479700
dcb279c3342611023fd139970ec30fdbd45d01df
/app/src/androidTest/java/com/example/administrator/card2d/ApplicationTest.java
1824b65efe48947038b658902d772786edb6a162
[]
no_license
gdmec07131046/Card2D
04ef320bbf7bfb2a2f8c76ba41c4d7f336208446
55d7246d98b53145e49d70aca731fe91818c6257
refs/heads/master
2021-01-10T11:18:04.906360
2015-10-11T11:16:58
2015-10-11T11:16:58
44,049,069
0
0
null
null
null
null
UTF-8
Java
false
false
363
java
package com.example.administrator.card2d; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
a1c625a546da09452cfb9720f0e8db72448f7732
c4b56e39b0bcdb98fd0b576c1af5c5ec54b4cccf
/amdocs-savings-demo/src/main/java/com/amdocs/SavingsAccount.java
c2f82f89621cce4be3924e9898ff94b275d2ccec
[]
no_license
shubhankar7/New-Onboarding-Repository-
0e419984e6ed833f4ae840d797b46da43e8cd685
e2617206b7c89f27f0387a8107cc81f34a102b58
refs/heads/master
2021-06-13T08:47:06.424028
2019-08-20T12:57:39
2019-08-20T12:57:39
203,148,071
0
0
null
2021-06-04T02:08:45
2019-08-19T10:09:13
JavaScript
UTF-8
Java
false
false
672
java
package com.amdocs; public class SavingsAccount { public double getBalance() { System.out.println("From database"); return 7000.00; } public double withdraw(double amountToBeWithdrawn) throws InsufficientBalanceException{ System.out.println("Inside withdraw"); double currentBalance=getBalance(); if(amountToBeWithdrawn<currentBalance) currentBalance = currentBalance-amountToBeWithdrawn; else throw new InsufficientBalanceException(); updateBalanceIntoDb(currentBalance); return currentBalance; } public void updateBalanceIntoDb(double currentBalance) { System.out.println("Balance Update In the database"); } }
9551a47d66a182e76b7c0e162de37a0ce92cce34
1f2ce299268385b16b59c352572b74074d54d195
/faculdade20201bimestre/src/programacao1/terca/aula12/aovivo/Controle.java
07ad07125d14f8c8f62d18c409f9a4ad869f94a7
[]
no_license
FabricioHein/Programacao1e2
3aba9d1b591e0d6f0e96f062acaca0187385be41
2955573777cdfb3c3de985bba092178a3a2779e1
refs/heads/master
2022-04-23T05:00:18.241957
2020-04-23T23:11:02
2020-04-23T23:11:02
null
0
0
null
null
null
null
ISO-8859-1
Java
false
false
1,388
java
package programacao1.terca.aula12.aovivo; import java.util.Scanner; //https://github.com/douglasrm87/Programacao1e2 public class Controle { public static void main(String[] args) { Controle c = new Controle(); c.processar(); } Scanner leia = new Scanner(System.in); private void processar() { int op = 0; Camera cam = new Camera(); do { System.out.println("1 - Aumentar Volume"); System.out.println("2 - Reduzir Volume"); System.out.println("3 - Aumentar Canal"); System.out.println("4 - Reduzir canal"); System.out.println("5 - Ligar TV"); System.out.println("6 - Setar Canal"); System.out.println("7 - Configuração atual"); System.out.println("Digite sua opção:"); op = this.leia.nextInt(); switch (op) { case 1: cam.aumentarVolume(); break; case 2: cam.reduzirVolume(); break; case 3: cam.aumentarCanal(); break; case 4: cam.reduzirCanal(); break; case 5: cam.ligatTV(); break; case 6: try { System.out.println("Digite sua novo canal:"); int canal = this.leia.nextInt(); cam.setarCanal(canal); } catch (IllegalArgumentException e) { System.out.println("MSG:" + e.toString()); } case 7: System.out.println(cam.toString()); break; default: System.out.println("Opção inválida."); break; } } while (op != 9); } }
67d37c36e5b969fc970c55fcce5cb73259229a64
3fcdca1ea49c02188eb1d9e253f47cbb49380833
/Prod/fin.scfw/fin.scfw-meta/src/main/java/com/yqjr/fin/scfw/meta/rest/RoleRest.java
026d8be3ff58d738333ca1fde1c583f14ff1908d
[]
no_license
jsdelivrbot/yqjr
f13f50dc765b1c7aa7ad513ee455c9380ab3d7c6
08c7182c3d4dcc303f512b55b4405266dd3ad66c
refs/heads/master
2020-04-10T13:50:37.840713
2018-12-09T11:08:44
2018-12-09T11:08:44
161,060,607
0
0
null
null
null
null
UTF-8
Java
false
false
3,974
java
package com.yqjr.fin.scfw.meta.rest; import java.util.*; import javax.validation.Valid; import org.hibernate.validator.constraints.NotBlank; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.util.StringUtils; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; import com.yqjr.scfw.common.pagination.model.PageBounds; import com.yqjr.scfw.common.model.pagination.PageInfo; import com.yqjr.scfw.common.Const; import com.yqjr.scfw.common.rest.BaseRest; import com.yqjr.scfw.common.results.ObjectResultResponse; import com.yqjr.scfw.common.results.PageResultResponse; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import com.yqjr.fin.scfw.meta.entity.Role; import com.yqjr.fin.scfw.meta.common.JQGridJsonResult; import com.yqjr.fin.scfw.meta.condition.RoleCondition; import com.yqjr.fin.scfw.meta.services.RoleService; @Api(consumes = "application/json",produces = "application/json",protocols = "http", basePath = "roles") @RestController @RequestMapping(value = "/roles") public class RoleRest extends BaseRest<RoleService, Role> { private Logger logger = LoggerFactory.getLogger(getClass()); @ApiOperation(value = "分页查询角色表(参数:实体对象属性、pageNum、pageSize)", tags = "角色表信息:RoleRest") @ApiImplicitParams({ @ApiImplicitParam(name = "pageNum", value = "页数", required = true, dataType = "Integer"), @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = true, dataType = "Integer") }) @RequestMapping(value = "/page", method = RequestMethod.GET) public PageResultResponse<Role> page( @RequestParam(value = "pageNum", required = true, defaultValue = "1") Integer pageNum, @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize, RoleCondition condition) { List<Role> list = baseService.selectList(condition, PageBounds.of(pageNum, pageSize)); PageInfo<Role> p = new PageInfo<>(list); return this.getPageResultResponse(Const.SUCCESS, Const.CODE_SUCCESS, null, p); } @ApiOperation(value = "分页查询角色表信息(参数:实体对象属性、pageNum、pageSize)", tags = "角色表信息:RoleRest") @ApiImplicitParams({ @ApiImplicitParam(name = "pageNum", value = "页数", required = true, dataType = "Integer"), @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = true, dataType = "Integer") }) @RequestMapping(value = "/pageByJqGrid", method = RequestMethod.GET) public JQGridJsonResult<Role> pageByJqGrid( @RequestParam(value = "pageNum", required = true, defaultValue = "1") Integer pageNum, @RequestParam(value = "pageSize", required = true, defaultValue = "10") Integer pageSize, @RequestParam(value = "sord", required = true) String sord, RoleCondition condition) { List<Role> list = baseService.selectList(condition, PageBounds.of(pageNum, pageSize)); PageInfo<Role> pageList = new PageInfo<>(list); JQGridJsonResult<Role> jqGridJson = new JQGridJsonResult<>(); jqGridJson.setPage(pageList.getPageNum()); jqGridJson.setTotal(pageList.getPages()); jqGridJson.setRecords(pageList.getTotal()); jqGridJson.setRows(list); return jqGridJson; } }
975c361a655bcc3f8d0a80841aa8df160a2b7179
458c5b3251fcef9d587f56895a78452d1d164845
/app/src/main/java/openAPI/StationInfo/getLowStationByNameList.java
9ca594dc4361d4e739ad234c5f9fa535bda107dc
[]
no_license
mgkim9/LowfloorBus
8cbebd35433ee64eef24557e8b38e24a3e8752e8
1a60d86e6f1da8909bf180afd8031e05c589c3a9
refs/heads/master
2020-05-18T06:17:21.900298
2018-07-30T15:27:33
2018-07-30T15:27:33
184,231,276
1
0
null
2019-04-30T09:17:52
2019-04-30T09:17:51
null
UTF-8
Java
false
false
5,087
java
package openAPI.StationInfo; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import openAPI.BusXMLparser.BusXMLPullParserFactory; import org.xmlpull.v1.XmlPullParser; import android.os.Handler; /* 저상버스가 운행되는 정류소 명칭 검색 * 역명(stSrch), 노선Id(busRouteId) 를 입력 받는다. */ public class getLowStationByNameList extends Thread { Handler mhandler; int mwhat; int count; String addr = "http://ws.bus.go.kr/api/rest/stationinfo/"; String function = "getLowStationByName"; String servicekey; String fullparam = ""; String param1 = "&stSrch="; getLowStationByNameList_Element Data; public getLowStationByNameList(Handler phandler, int pwhat) { mhandler = phandler; mwhat = pwhat; this.servicekey = ""; setParam(""); } public getLowStationByNameList(Handler phandler, int pwhat, String serviceKey, String parameter1) { mhandler = phandler; mwhat = pwhat; this.servicekey = serviceKey; setParam(parameter1); } public void setParam(String parameter1) { try { fullparam = param1 + URLEncoder.encode(parameter1, "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); fullparam = param1 + parameter1; } } public void run() { Data = new getLowStationByNameList_Element(); request(addr, function, servicekey, fullparam); mhandler.sendEmptyMessage(mwhat); } public getLowStationByNameList_Element getElement() { return Data; } public int getheaderCd() { return Data.headerCd; } public String getheaderMsg() { return Data.headerMsg; } public int getitemCount() { return Data.itemCount; } public int getarsId(int index) { return Data.arsId.get(index); } public int getstId(int index) { return Data.stId.get(index); } public String getstNm(int index) { return Data.stNm.get(index); } public double gettmX(int index) { return Data.tmX.get(index); } public double gettmY(int index) { return Data.tmY.get(index); } protected void request(String addr, String function, String servicekey, String full_parameter) { try { BusXMLPullParserFactory factory = new BusXMLPullParserFactory(addr, function, servicekey, full_parameter); XmlPullParser parser = factory.getParser(); if(parser == null) { Data.headerCd = -1; Data.headerMsg = "Parser 생성 실패"; return; } String tag; int parserEvent = parser.getEventType(); int tagnum = -1; count = 0; while (parserEvent != XmlPullParser.END_DOCUMENT ) { switch(parserEvent) { case XmlPullParser.START_TAG: tag = parser.getName(); if(tag.equals("itemList")) { count++; } else if(tag.equals("headerCd")) { tagnum = 0; } else if(tag.equals("headerMsg")) { tagnum = 1; } else if(tag.equals("itemCount")) { tagnum = 2; } else if(tag.equals("arsId")) { tagnum = 3; } else if(tag.equals("stId")) { tagnum = 4; } else if(tag.equals("stNm")) { tagnum = 5; } else if(tag.equals("tmX")) { tagnum = 6; } else if(tag.equals("tmY")) { tagnum = 7; } else { tagnum = -1; } break; /* XmlPullParser.START_TAG 끝 */ case XmlPullParser.TEXT: tag = parser.getName(); switch(tagnum) { case 0: Data.headerCd = Integer.parseInt( parser.getText() ); break; case 1: Data.headerMsg = parser.getText(); break; case 2: Data.itemCount = Integer.parseInt( parser.getText() ); break; case 3: Data.arsId.add( Integer.parseInt( parser.getText() ) ); break; case 4: Data.stId.add( Integer.parseInt( parser.getText() ) ); break; case 5: Data.stNm.add( parser.getText() ); break; case 6: Data.tmX.add( Double.parseDouble( parser.getText() ) ); break; case 7: Data.tmY.add( Double.parseDouble( parser.getText() ) ); break; default: break; } /* Switch 끝 */ break; /* XmlPullParser.TEXT 끝 */ case XmlPullParser.END_TAG: tag = parser.getName(); break; /* XmlPullParser.END_TAG 끝 */ case XmlPullParser.IGNORABLE_WHITESPACE: // 빈칸을 무시 break; /* XmlPullParser.IGNORABLE_WHITESPACE 끝 */ default: break; } /* Switch 끝 */ parserEvent = parser.nextToken(); } /* while 끝 */ } catch (Exception e) { e.printStackTrace(); } // 전송받은 itemCount 값이 정확하게 않는 경우도 있기 떄문에 직접 세서 저장 Data.itemCount = count; return; } /* request 함수 끝 */ }
4417092f0fcf75bf2886ee7455d53bb9c599812d
790464692ab27babd6fd75ebe049c602a1e830cf
/Basic_Fundamental/src/mb/app3/src/Y.java
7058183385f666c071a90dee21480bdd47640463
[ "MIT" ]
permissive
mkp1104/localEclipseWorkspaceJava
1bbfbbe06984a2a75b749988fa3fe38873724891
3523a0400ac95c0495c2714b8fb17c05f03d8dba
refs/heads/master
2021-05-02T03:03:52.121194
2018-03-09T13:21:36
2018-03-09T13:21:36
120,890,874
0
0
null
null
null
null
UTF-8
Java
false
false
128
java
package mb.app3.src; class Y { public static void main(String[] args) { int i=0; i= --i; System.out.println(i); } }
187f0347f7c39878324c97699b9048e63ec9e187
77f1b9ed496a4259101eeb9f8d29dda6374b8376
/app/src/main/java/uzi/media/smk/ui/opening/AfterOpeningActivity.java
5e07e793c892b4ac797f84d7a5d0c9f10291e7b1
[]
no_license
TaufikTS/mediasekolah-mediago
e7cbc39727899e99e9858527059ef507d0eec7d6
b04036c6c207211d2d17879ce6ab02a792db8471
refs/heads/master
2020-03-28T16:51:39.156899
2018-09-14T23:01:44
2018-09-14T23:01:44
148,735,450
0
0
null
null
null
null
UTF-8
Java
false
false
1,963
java
package uzi.media.smk.ui.opening; import android.content.Intent; import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import android.widget.VideoView; import uzi.media.smk.R; import uzi.media.smk.ui.listJudul.ListPelajaranActivity; import uzi.media.smk.ui.listmateri.ListMateriMenu; /** * Created by uzi on 29/09/17. * Email : [email protected] */ public class AfterOpeningActivity extends AppCompatActivity { @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_after_opening); Button bntNext = (Button) findViewById(R.id.btnNext); bntNext.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(AfterOpeningActivity.this, ListMateriMenu.class)); finish(); } }); Button btnBack = (Button) findViewById(R.id.btnBack); btnBack.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(AfterOpeningActivity.this, OpeningActivity.class)); } }); VideoView view = (VideoView) findViewById(R.id.vvOpening); String path = "android.resource://" + getPackageName() + "/" + R.raw.afteropening; view.setVideoURI(Uri.parse(path)); view.start(); view.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { @Override public void onCompletion(MediaPlayer mp) { Intent i = new Intent(getBaseContext(), ListPelajaranActivity.class); startActivity(i); } }); } }
9f4afbd8ee0481e8037038325c48aac1becc3ec8
5aec4b3def8cff06dc9f789220e19caa43e5142e
/src/main/java/DefaultMoveHeuristic.java
10c21c5f445c5924ea54c9f10946ada7d72866e7
[]
no_license
tgass/ai-challenge-2011--Ants-
edc67619330be3fcaba30fb06fd776a87310fa29
d750b1c723009d1cc0bc75cb69f8000a83b56f1d
refs/heads/master
2021-01-23T18:51:19.683261
2012-02-19T17:17:12
2012-02-19T17:17:12
3,408,031
0
0
null
null
null
null
UTF-8
Java
false
false
1,722
java
import java.util.ArrayList; import java.util.List; import java.util.SortedMap; public class DefaultMoveHeuristic implements Heuristic { private int maxRows; private int maxCols; // distance / ant private List<Integer> sortedIds = new ArrayList<Integer>(); // distance / hills private SortedMap<Integer, Integer> myHills; private DefaultMoveHeuristic() { } public static Heuristic of(SortedMap<Integer, List<Integer>> sortedIds, SortedMap<Integer, Integer> myHillsSorted, int size, int maxRows, int maxCols) { DefaultMoveHeuristic h = new DefaultMoveHeuristic(); h.maxRows = maxRows; h.maxCols = maxCols; for(List<Integer> ids : sortedIds.values()) { h.sortedIds.addAll(ids); if(h.sortedIds.size() >= size) { break; } } h.myHills = myHillsSorted; return h; } @Override public double getCostEstimate(int from) { int fromRow = (int)Math.floor(from / maxCols); int fromCol = from % maxCols; double addedPathLength = 0; for(int id : sortedIds) { addedPathLength += getDistance(id, fromRow, fromCol); } if(sortedIds.size() <= 1 && myHills.size() >= 1) { int actualDistance = myHills.firstKey(); addedPathLength += getDistance(myHills.get(actualDistance), fromRow, fromCol); } return addedPathLength; } public double getDistance(int id, int fromRow, int fromCol) { int row = (int)Math.floor(id / maxCols); int col = id % maxCols; int rowDelta = Math.abs(row - fromRow); int colDelta = Math.abs(col - fromCol); rowDelta = Math.min(rowDelta, maxRows-rowDelta); colDelta = Math.min(colDelta, maxCols-colDelta); return Math.sqrt(rowDelta*rowDelta + colDelta*colDelta); } }
2df5f675b74df6bc7eb66f93a2b6255bec8b9b90
2a9764d28f872672b40bd3cb525d4a22fcfa1c3e
/src/main/java/executavel/CaixaEletronico.java
e0e90162d656209662d2bb68862bd62c574791f1
[]
no_license
AnaAliceCosta/PrideDevBank
d8093c8b153301c983dfa5316f811f88e938b8c2
47b0d68bf4531da89495e233706a90017356f084
refs/heads/master
2023-06-30T19:45:01.615678
2021-08-05T00:37:28
2021-08-05T00:37:28
390,169,377
1
2
null
null
null
null
UTF-8
Java
false
false
435
java
package executavel; public class CaixaEletronico { public static int [] retirar(int valor) { int notas[] = { 100, 50, 20, 10, 2 }; int i = 0; int quantidadeDeNotas[] = new int[notas.length]; // enquanto o resto for divisivel pelas notas a divisao // contunua while (valor > 0) { while (valor >= notas[i]) { valor -= notas[i]; quantidadeDeNotas[i]++; } } return quantidadeDeNotas; } }
42df47e4cfc4e72d05cfce3f2da0f628b3d8f3a3
f52b44eac62879e680c4da4345169990e82f93ec
/SolarStation/app/src/main/java/com/shuorigf/solarstaition/data/service/HomeService.java
3035a14ec52e3fce2f13dede0407d0e9026ec2fe
[]
no_license
185368123/SolarStation
2e2814e1027e576e655f7f3d954402408dda3fc9
81dd79fb284fbd9dcf0c6e9bd59ec91ac3440bc8
refs/heads/master
2020-03-23T14:38:19.787283
2018-08-29T01:33:09
2018-08-29T01:33:09
141,689,366
0
1
null
null
null
null
UTF-8
Java
false
false
493
java
package com.shuorigf.solarstaition.data.service; import com.shuorigf.solarstaition.constants.ApiConstants; import com.shuorigf.solarstaition.data.response.HttpResult; import com.shuorigf.solarstaition.data.response.home.HomeDataInfo; import io.reactivex.Flowable; import retrofit2.http.POST; /** * Created by clx on 18/2/27. */ public interface HomeService { /** * 首页数据 */ @POST(ApiConstants.HOME_DATA) Flowable<HttpResult<HomeDataInfo>> getHomeData(); }
3238e6cf267511bef67d6afec09f193b197ca714
1f9191cbecc775ff8d39665984eff6d1ad83295d
/Java/com/aop/ThrowAdvice/ThrowadviceDemo01.java
e8d31694b0b7fe44166a0340109febd6cb70aca6
[]
no_license
z944733142/Spring
2a50bc87388df9ce1f74a87c9369ef3bb871f670
6df3dbf4c9f25dfe699550dee9d17b8f785f1536
refs/heads/master
2020-04-09T02:06:12.567465
2018-12-05T13:21:41
2018-12-05T13:21:41
159,928,624
0
0
null
null
null
null
UTF-8
Java
false
false
229
java
package com.aop.ThrowAdvice; import org.springframework.aop.ThrowsAdvice; public class ThrowadviceDemo01 { public void myException(Exception e) { System.out.println("something wrong " + e.getMessage()); } }
a5c2272a9002f67c7103ca3a807f1d9b4e788cab
252d6fb0b2aad34ef298e7bef2ed80931ec02d57
/src/org/smarttechies/model/Product.java
e2a0887fbb9f35d2765da6dbade21082f54b4be1
[]
no_license
2013techsmarts/SampleREST
70e569d8f2b323596ff35302cd1461bd8ec23054
80e86d44dcf1a48e914c4d1bcf545f6f35344c17
refs/heads/master
2021-01-01T19:33:58.486930
2013-04-27T07:22:47
2013-04-27T07:22:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,366
java
package org.smarttechies.model; import java.util.Map; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement public class Product { private String prodName; private double prodPrice; private String prodDesc; private boolean active; private Map<String,String> features; /** * @return the prodName */ public String getProdName() { return prodName; } /** * @param pProdName the prodName to set */ public void setProdName(String pProdName) { prodName = pProdName; } /** * @return the prodPrice */ public double getProdPrice() { return prodPrice; } /** * @param pProdPrice the prodPrice to set */ public void setProdPrice(double pProdPrice) { prodPrice = pProdPrice; } /** * @return the prodDesc */ public String getProdDesc() { return prodDesc; } /** * @param pProdDesc the prodDesc to set */ public void setProdDesc(String pProdDesc) { prodDesc = pProdDesc; } /** * @return the active */ public boolean isActive() { return active; } /** * @param pActive the active to set */ public void setActive(boolean pActive) { active = pActive; } /** * @param pFeatures the features to set */ public void setFeatures(Map<String, String> pFeatures) { features = pFeatures; } /** * @return the features */ public Map<String, String> getFeatures() { return features; } }
8aff68cdb3edeb827268936e7140c0d97d777763
558ef1af0996098e797e98d10803f0cb70dddf7d
/employees/src/controller/GetEmployeesListServlet.java
3777d7f92bde6df93d8504a8d09fed08414845a9
[]
no_license
arm04092/employees
0627ca2314d9d9565f1bb45b480fb0e1aa181aab
b54fa6468cd1c85505b5aff1bcaefc6c05ba214b
refs/heads/master
2020-07-26T19:51:03.449117
2019-12-31T06:57:52
2019-12-31T06:57:52
208,749,900
0
0
null
null
null
null
UTF-8
Java
false
false
1,468
java
package controller; import java.io.IOException; import java.util.List; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import model.EmployeesDao; import vo.Employees; @WebServlet("/employees/getEmployeesList") public class GetEmployeesListServlet extends HttpServlet { // 사원 목록 출력할 페이지 MODEL 추가 private EmployeesDao employeesDao; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // 단위 테스트 System.out.println("/employees/getEmployeesList URL 요청"); System.out.println("GetEmployeesListServlet.doGet() param limit: " + request.getParameter("limit")); // 목록 출력할 행의 개수를 저장하는 변수 생성 int limit = 10; if(request.getParameter("limit") != null) { limit = Integer.parseInt(request.getParameter("limit")); } // model 객체 생성 employeesDao = new EmployeesDao(); // 사원 목록 리스트 리턴 값 저장 List<Employees> list = employeesDao.selectEmployeesListByLimit(limit); // view로 넘길 request에 리스트 저장 request.setAttribute("list", list); // view로 forward request.getRequestDispatcher("/WEB-INF/views/employees/employeesList.jsp").forward(request, response); } }
[ "GD3@DESKTOP-KK3U52K" ]
GD3@DESKTOP-KK3U52K
4a26da4f2c17cf8ce9190b4fb7d42b091ed8ef6d
5f5e1304fbaabd3411e1d2c6223d729d274c7bd0
/src/main/java/com/mycompany/model/Book.java
fe78d8aff57f2410f6b3955065ea94f481bd81b0
[]
no_license
PriyatamRoy/spring-mybatis-xml
29be01d52fdb54ca0af0698b1860d9c42a337ba0
829971494ad0c9a92836f7a0086912bc784456c6
refs/heads/master
2021-04-30T05:29:23.122151
2018-02-13T17:53:29
2018-02-13T17:53:29
121,416,278
0
0
null
null
null
null
UTF-8
Java
false
false
1,737
java
package com.mycompany.model; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; @Entity(name="Book") @Table(name="book") public class Book { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private int id; @Column(name = "title") private String bookTitle; @Column(name = "author") private String authorName; @Column(name = "description") private String bookDescription; @Column(name = "price") private int bookPrice; @Column(name = "isbn") private int isbn; @Column(name = "create_date") private Date createDate = new Date(); public Date getCreateDate() { return createDate; } public void setCreateDate(Date createDate) { this.createDate = createDate; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getBookTitle() { return bookTitle; } public void setBookTitle(String bookTitle) { this.bookTitle = bookTitle; } public String getAuthorName() { return authorName; } public void setAuthorName(String authorName) { this.authorName = authorName; } public String getBookDescription() { return bookDescription; } public void setBookDescription(String bookDescription) { this.bookDescription = bookDescription; } public int getBookPrice() { return bookPrice; } public void setBookPrice(int bookPrice) { this.bookPrice = bookPrice; } public int getIsbn() { return isbn; } public void setIsbn(int isbn) { this.isbn = isbn; } }
d14e924470525aa8ab4dfdeb409980efb8552cf5
e3c1bf4fa9fa9922fc040745c84faeadc0c8e156
/app/src/main/java/mobi/tet_a_tet/atda/tet_a_tet/controllers/ActivityControllerService.java
ec4f4129e4b6dd5f56c34b8896c6e8f237b093d5
[ "Apache-2.0" ]
permissive
autooz/ATDA_1
1113e3db41ade7de6d6f3b36f032bec20f62feea
e867d6236e810e2d9200be0f067ec853d23bcbd7
refs/heads/master
2020-05-19T15:05:16.812153
2019-05-06T09:34:15
2019-05-06T09:34:15
185,072,919
1
0
null
null
null
null
UTF-8
Java
false
false
9,251
java
package mobi.tet_a_tet.atda.tet_a_tet.controllers; import android.app.Service; import android.content.Context; import android.content.Intent; import android.os.IBinder; import android.util.Log; import android.widget.Toast; import java.util.StringTokenizer; import mobi.tet_a_tet.atda.R; import mobi.tet_a_tet.atda.mutual.mut_ulils.eventbus.EventBus; import mobi.tet_a_tet.atda.mutual.mut_ulils.eventbus.EventFromControllerActivityMessage; import mobi.tet_a_tet.atda.mutual.mut_ulils.eventbus.EventJabIncomMessage; import mobi.tet_a_tet.atda.mutual.mut_ulils.eventbus.Subscriber; import mobi.tet_a_tet.atda.mutual.mut_ulils.gps.GPSListnerZone; import mobi.tet_a_tet.atda.mutual.mut_ulils.gps.GPSbyTimeListner; import mobi.tet_a_tet.atda.off_lline.DriverTaximetreActivity; import mobi.tet_a_tet.atda.tet_a_tet.DriverNormalWork.activitis.TetOnCabStandPriceActivity; import mobi.tet_a_tet.atda.tet_a_tet.DriverNormalWork.activitis.TetOnCabStandPriceActivtyParcer; import mobi.tet_a_tet.atda.tet_a_tet.DriverNormalWork.activitis.TetTaximetreActivity; import mobi.tet_a_tet.atda.tet_a_tet.DriverNormalWork.activitis.TetZoneListActivity; import mobi.tet_a_tet.atda.tet_a_tet.dates.TetDriverData; import mobi.tet_a_tet.atda.tet_a_tet.dates.TetDriverSettings; import mobi.tet_a_tet.atda.tet_a_tet.dates.TetGlobalData; import mobi.tet_a_tet.atda.tet_a_tet.utils.UpdateATDAActivity; public class ActivityControllerService extends Service { Context mContext; private String pseudo_tag; private IBinder mBind; // http://stackoverflow.com/questions/3456034/how-to-start-an-activity-from-a-service // http://stackoverflow.com/questions/6925968/how-to-close-an-activity-finish-from-service public ActivityControllerService(Context context) { this.mContext = context; } public ActivityControllerService() { } @Override public int onStartCommand(Intent intent, int flags, int startId) { EventBus.getDefault().register(this); String action = getClass().getCanonicalName(); int pos = action.lastIndexOf('.') + 1; String onlyClass = action.substring(pos); pseudo_tag = "ActivityControllerService"; Log.e(pseudo_tag, "onStartCommand STARTED flag ="+flags+" startId ="+startId+""); return START_STICKY; } @Override public void onCreate() { super.onCreate(); } @Override public void onDestroy() { Log.e(pseudo_tag,"Am DESTROED LOOK REAZON"); EventBus.getDefault().unregister(this); super.onDestroy(); } @Override public IBinder onBind(Intent intent) { // TODO: Return the communication channel to the service. //throw new UnsupportedOperationException("Not yet implemented"); return mBind; } @Subscriber(tag = "INCOMING_MESSAGE") private void updateEventsJabberdMessagesWithTag(EventJabIncomMessage msg) { Log.e(pseudo_tag, "### update user with my_tag, name = " + msg.INCOMMING_MESSAGE); StringTokenizer st = new StringTokenizer(msg.INCOMMING_MESSAGE, TetGlobalData.TOKEN_SEPARATOR); String token = st.nextToken(); Log.e(pseudo_tag, "### token = " + token); if (token.equals(TetGlobalData.RESPONCE)) { String tokenres = st.nextToken(); Log.e(pseudo_tag, "### tokenres = " + tokenres); switch (tokenres){ case TetGlobalData.OW_APP_ACTUAL: Toast.makeText(getApplicationContext(), R.string.versionOK, Toast.LENGTH_LONG).show(); Intent ACS = new Intent(getApplicationContext(), ActivityControllerService.class); stopService(ACS); break; case TetGlobalData.OW_UPDATE_APP: do_UPDATE(); break; case TetGlobalData.OW_STOPLIST: Log.e(pseudo_tag, "### WI are It intent start OW_STOPLIST" ); do_OW_STOPLIST(st); break; case TetGlobalData.OW_TAXIMETRE: do_OW_TAXIMETRE(st); break; case TetGlobalData.CLW_TAXIMETR: do_CLOSETAXIM(st); break; case TetGlobalData.OW_ONSTOP: do_OW_ONSTOP(st); break; case TetGlobalData.UP_ONSTOP: do_UP_ONSTOP(st); break; case TetGlobalData.UP_DRVSTATE: do_UP_DRVSTATE(st); break; case TetGlobalData.CLOSEPROG: do_CLOSEPROG(tokenres); break; case TetGlobalData.ERROR: do_ERROR(); break; default: do_ERROR(); break; } } else if (token.equals(TetGlobalData.REQUEST)){ } else{ android.util.Log.e(pseudo_tag, "---- ERROR jn first tocken ="+token+" with Message=" + msg.INCOMMING_MESSAGE + "---"); } } private void do_CLOSETAXIM(StringTokenizer st) { String close = TetGlobalData.CLW_TAXIMETR; EventBus.getDefault().post(new EventFromControllerActivityMessage(close), "UPDATE_VIEW"); } private void do_UPDATE() { Intent uA = new Intent(getApplicationContext(), UpdateATDAActivity.class); startActivity(uA); } private void do_ERROR() { Toast.makeText(getApplicationContext(), R.string.errorWithRequest, Toast.LENGTH_LONG).show(); } private void do_UP_DRVSTATE(StringTokenizer st) { String state = st.nextToken(); TetDriverData.drvstate = state; int update_view = 0; EventBus.getDefault().post(new EventFromControllerActivityMessage(update_view), "UPDATE_VIEW"); android.util.Log.e(pseudo_tag, "Send Message UPDATE_POSITIOON_ACTIVITY_TO_ONSTOP"); } private void do_CLOSEPROG(String string) { EventBus.getDefault().post(new EventFromControllerActivityMessage(string), "CLOSEPROG"); Intent TLS = new Intent(getApplicationContext(), GPSbyTimeListner.class); stopService(TLS); Intent PLS = new Intent(getApplicationContext(), GPSListnerZone.class); stopService(PLS); // Intent JS = new Intent(this, JabberListenerService.class); // stopService(JS); // Intent TLS1 = new Intent(this, GPSbyTimeListner.class); // stopService(TLS1); // Intent PLS1 = new Intent(this, GPSListnerZone.class); // stopService(PLS1); EventBus.getDefault().post(new EventFromControllerActivityMessage(""), "CLOSEPROG"); // Intent wHt = new Intent(getApplicationContext(), GoodByActivity.class); // wHt.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); // startActivity(wHt); } private void do_UP_ONSTOP(StringTokenizer st) { Boolean auto_update_false_or_true = true; TetOnCabStandPriceActivtyParcer parcer = new TetOnCabStandPriceActivtyParcer(); parcer.setParams(st); EventBus.getDefault().post(new EventFromControllerActivityMessage(auto_update_false_or_true), "UPDATE_POSITIOON"); android.util.Log.e(pseudo_tag, "Send Message UPDATE_POSITIOON_ACTIVITY_TO_ONSTOP"); } private void do_OW_ONSTOP(StringTokenizer s) { TetOnCabStandPriceActivtyParcer parcer = new TetOnCabStandPriceActivtyParcer(); parcer.setParams(s); Intent i = new Intent(); i.setClass(getApplicationContext(), TetOnCabStandPriceActivity.class); i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(i); } private void do_OW_TAXIMETRE(StringTokenizer s) { EventBus.getDefault().postSticky(new EventFromControllerActivityMessage(s), "CTRL_ACTIVITY_TO_TAXIMETRE"); android.util.Log.e(pseudo_tag, "Send Message CTRL_ACTIVITY_TO_TAXIMETRE"); Intent i = new Intent(); //@// TODO: 24.10.15 make difference tetData fnd Driver dsta if (TetDriverSettings.own_price_in_taximetre_from_border) { TetDriverData.taxomode =TetDriverData.taxoRUN; i.setClass(this, DriverTaximetreActivity.class); } else { TetDriverData.taxomode =TetDriverData.taxoRUN; i.setClass(this, TetTaximetreActivity.class); } i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(i); } private void do_OW_STOPLIST(StringTokenizer s) { EventBus.getDefault().postSticky(new EventFromControllerActivityMessage(s), "CTRL_ACTIVITY_TO_ZL"); android.util.Log.e(pseudo_tag, "Send Message CTRL_ACTIVITY_TO_ZL"); TetDriverData.choiseZoneByHand = true; Intent i = new Intent(); i.setClass(getApplicationContext(), TetZoneListActivity.class); i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(i); } // set Kill frtivity in onCreate // if(this.getIntent().getExtras().getInt("kill")==1) // finish(); }
57d45c8ef6617b55bad4ec697422ef9fc8bd3b8f
d7139b8d312097d2d94c67912167028e7543d188
/SDProject/src/main/java/com/utcn/model/User.java
259b0aa65f7fc1c9a3ac45611fc9a6f887912a21
[]
no_license
sd-2020-30431/final-project-MaghiarCatalin
4e4957be8de60af4f22be8e68f4cdcf432a49eed
1a293bf88474b2524101218897ca5dafa435ef1c
refs/heads/master
2022-12-17T21:35:48.644934
2020-06-03T19:33:58
2020-06-03T19:33:58
249,226,062
0
0
null
2022-12-16T15:32:19
2020-03-22T16:36:54
CSS
UTF-8
Java
false
false
2,251
java
package com.utcn.model; import javax.persistence.*; import java.io.Serializable; import java.util.List; @Entity(name = "users") public class User implements Serializable { private String email; private String password; private String firstName; private String lastName; private String phoneNumber; private BillingAddress billingAddress; private UserRole role; private String IDNumber; public User() { } @Id @Column(name = "email", unique = true) public String getEmail() { return email; } public void setEmail(String username) { this.email = username; } @Column(name = "password", nullable = false) public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } @Column(name = "first_name", nullable = false) public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } @Column(name = "last_name", nullable = false) public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } @Column(name = "phone_number", unique = true, nullable = false) public String getPhoneNumber() { return phoneNumber; } public void setPhoneNumber(String phoneNumber) { this.phoneNumber = phoneNumber; } @OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL) @JoinColumn(name = "id", nullable = false) public BillingAddress getBillingAddress() { return billingAddress; } public void setBillingAddress(BillingAddress billingAddress) { this.billingAddress = billingAddress; } @Enumerated(EnumType.STRING) @Column(name = "role", nullable = false) public UserRole getRole() { return role; } public void setRole(UserRole role) { this.role = role; } @Column(name = "id_number", nullable = false, unique = true) public String getIDNumber() { return IDNumber; } public void setIDNumber(String IDNumber) { this.IDNumber = IDNumber; } }
ff069cfc52c393420df2ea94cb6cf940e7d0b7ff
c95e4bd3b0f382af4d81aa2eebe3dc126387632b
/Threads/src/main/java/com/snebot/fbmoll/object/Cook.java
e6addc4245bbace021796867589f7190118781e1
[]
no_license
snebotcifpfbmoll/PSER
1d72e1093d5780b76b745c42e4c56710687945cb
9e7407f1e90c2b07731eb36f27848d19d03e8592
refs/heads/master
2023-03-05T12:35:00.250138
2021-02-18T15:37:50
2021-02-18T15:37:50
307,340,231
0
0
null
null
null
null
UTF-8
Java
false
false
1,453
java
package com.snebot.fbmoll.object; import java.awt.*; public class Cook extends RestaurantObject { private int id = 0; private Table table = null; public int getId() { return id; } public void setId(int id) { this.id = id; } public Table getTable() { return table; } public void setTable(Table table) { this.table = table; } public Cook(int id, Table table) { super(); this.id = id; this.table = table; this.width = 50; this.height = 50; this.color = Color.BLUE; super.start(() -> { try { Thread.sleep(getRandomTime()); int initialY = y; int diff = table.y - y - height; int nsteps = diff / step; int res = diff % step; for (int i = 0; i < nsteps; i++) { y += step; Thread.sleep(speed); } y += res; table.put(this); diff = y - initialY; nsteps = diff / step; res = diff % step; for (int i = 0; i < nsteps; i++) { y -= step; Thread.sleep(speed); } y -= res; } catch (Exception e) { System.out.println(e.getMessage()); } }); } }
a4810c686ae02afc326d16373b8970e73a564eaf
fb13d03cb3d6e8babc35471c0036a1ae8f01eb8e
/FactoryMethodPattern/src/main/java/com/rajeshchinta/factorymethod/pizza/ChicagoStylePepperoniPizza.java
0ba80eb754d40622871b9d234ced6b82382f871f
[]
no_license
rreddych/DesignPatterns
06a79c23c35181a1b4e5aa432346ba56e60ce357
b82844c10fcf6900101e18623840dea447488ae5
refs/heads/master
2022-12-25T09:31:05.846608
2020-05-13T11:34:15
2020-05-13T11:34:15
254,812,820
0
0
null
2020-10-13T21:57:46
2020-04-11T07:08:33
Java
UTF-8
Java
false
false
200
java
package com.rajeshchinta.factorymethod.pizza; public class ChicagoStylePepperoniPizza extends Pizza { public ChicagoStylePepperoniPizza() { this.name = "ChicagoStylePepperoniPizza"; } }
269b5bc7d826dd9dc43f42f98facf2c6f93bc3b1
b9957466447ea7631f28f35edcc0fac682609414
/app/src/main/java/com/loveseries/tdrama/EpisodesAdapter.java
41d01505eef6d41d9c16103d5792ac2e3c75ba62
[]
no_license
Chetandj87/TurkDramaAndroid
1a993d1a7cd548771d46df5efceeabc3b8db9e1e
50b1972ce76c0ee41ea94cc37a4015c23e67696f
refs/heads/master
2022-11-24T00:51:20.650023
2020-08-04T14:12:45
2020-08-04T14:12:45
280,605,796
0
0
null
null
null
null
UTF-8
Java
false
false
1,860
java
package com.loveseries.tdrama; import android.content.Context; import android.content.Intent; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import java.util.List; public class EpisodesAdapter extends RecyclerView.Adapter<EpisodesAdapter.EpisodeViewHolder> { private Context mCtx; private List<Episode> episodeList; public EpisodesAdapter(Context mCtx, List<Episode> episodeList){ this.mCtx=mCtx; this.episodeList=episodeList; } @NonNull @Override public EpisodeViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { return new EpisodeViewHolder( LayoutInflater.from(mCtx).inflate(R.layout.layout_episode, parent, false) ); } @Override public void onBindViewHolder(@NonNull EpisodeViewHolder holder, int position) { Episode episode = episodeList.get(position); holder.textEpisode_view.setText("Episode "+episode.getNumber()); } @Override public int getItemCount() { return episodeList.size(); } class EpisodeViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener{ TextView textEpisode_view; public EpisodeViewHolder(View itemView){ super(itemView); textEpisode_view = itemView.findViewById(R.id.textEpisode_number); itemView.setOnClickListener(this); } @Override public void onClick(View v) { Episode episode = episodeList.get(getAdapterPosition()); Intent intent = new Intent(mCtx, ServerActivity.class); intent.putExtra("episode",episode); mCtx.startActivity(intent); } } }
994845fe49367d0e241fa2e13260f5a8a9cf70b5
9f34421efde234e0bdfd43f9405ec67bcee4c573
/dreamweb/src/main/java/com/du/www/service/impl/RoleServiceImpl.java
851c96946bf85de6e7511841ceb75fb3398c0ae3
[]
no_license
duzining/dream
40c5f17cc17931833cae85d023cdb4d6d3eb6e7f
933d7dc5949f275edbcdd6abec9bf1aae534296d
refs/heads/master
2021-10-11T01:52:09.094059
2019-01-21T06:49:13
2019-01-21T06:49:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
612
java
package com.du.www.service.impl; import com.du.www.dao.RoleMapper; import com.du.www.entity.Role; import com.du.www.service.RoleService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service public class RoleServiceImpl implements RoleService{ @Autowired private RoleMapper roleMapper; @Override public Role findById(long id) { Role role = new Role(); role.setId(id); return roleMapper.selectOne(role); } @Override public int add(Role role) { return roleMapper.insert(role); } }
5109a64e671de2a14694888909d0fbec77cef45a
847b0afe9fb03279aef9d621c0bc298c97dbb443
/src/main/java/com/example/ProjectWebServices/entities/User.java
1e561802d7ec08ee1303fadbcb23d1ce6b614ba0
[]
no_license
BrunoPereira-2331/courseProject-springBoot-java-11
ea457622a200422943eef566d1d2ecbc94bffd5d
529430207846150e64e4c1d89d902d21ac9ca305
refs/heads/master
2020-12-05T14:30:38.152468
2020-01-14T23:15:41
2020-01-14T23:15:41
232,139,548
0
0
null
null
null
null
UTF-8
Java
false
false
2,110
java
package com.example.ProjectWebServices.entities; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; import com.fasterxml.jackson.annotation.JsonIgnore; @Entity @Table(name = "tb_user") public class User implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private String name; private String email; private String phone; private String password; @JsonIgnore @OneToMany(mappedBy = "client") private List<Order> orders = new ArrayList<>(); public User() { } public User(Long id, String name, String email, String phone, String password) { this.id = id; this.name = name; this.email = email; this.phone = phone; this.password = password; } 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 getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public List<Order> getOrders() { return orders; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((id == null) ? 0 : id.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; User other = (User) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; return true; } }
ba416c5049d0582b8250d5ca2038889ada3d11a0
d4faf842711275f49c8a446d4017852c8824c6fc
/design-patterns/src/main/java/com/bucur/patterns/behavioral/visitor/DemoVisitorPattern.java
b15f97a45e04e89c724c353bfd7f8123b88cc55a
[]
no_license
cosminbucur/sda-group10
537970e72268b2148584a11b942c3a4544ef9897
9052a99cd19d8ecec0a1fe275d458c546ab81355
refs/heads/master
2022-11-20T05:10:25.077044
2020-02-26T12:11:21
2020-02-26T12:11:21
195,580,491
2
0
null
2022-10-30T00:19:33
2019-07-06T20:27:49
Java
UTF-8
Java
false
false
637
java
package com.bucur.patterns.behavioral.visitor; import com.bucur.patterns.behavioral.visitor.shapes.MyShape; import com.bucur.patterns.behavioral.visitor.visitor.XMLExportVisitor; public class DemoVisitorPattern { public static void main(String[] args) { // TODO: create a main compound shape with a dot a circle and a rectangle // TODO: create a child shape with a dot // TODO: export a circle and main shape } private static void export(MyShape... myShapes) { XMLExportVisitor exportVisitor = new XMLExportVisitor(); System.out.println(exportVisitor.export(myShapes)); } }
880bb080604ff9b26e1dc1c14a56d71044ec4f32
0628f908e5169126b52999a478ef7dcfcd0d743d
/Java/JavaFundamentals/OptionalTask/src/Third.java
4d008f76ba60b98dc070114df24c7ca4af1f1b14
[]
no_license
KirillBelyakov/tasks
a178424966c88d7a63585043863e28d0a9999fb1
46562539dde90cae64408a558ad5aeacf4a32e72
refs/heads/master
2022-12-27T01:22:23.732232
2020-07-31T16:33:58
2020-07-31T16:33:58
278,885,773
0
0
null
null
null
null
UTF-8
Java
false
false
1,433
java
import java.util.Scanner; public class Third { public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.println("Введите количество чисел:"); int arrayLength = scan.nextInt();//количество необходимы чисел String numbers[] = new String[arrayLength];//создаём массив заданной длинны int i; for (i = 0; i < arrayLength; i++) {// вводим все элементы массива System.out.println("Введите число:"); numbers[i] = scan.next(); } int summaryLength = 0;//суммарная длинна элементов массива for (i = 0; i < arrayLength; i++) { summaryLength += numbers[i].length(); } int averageLength = summaryLength / 2;//получаем среднюю длинну элементов массива for (i = 0; i < arrayLength; i++) { if (numbers[i].length() > averageLength) {//сравнивем длинну элемента массива со средней длинной //и выводим элемент массива и его длинну, если она больше средней System.out.println(numbers[i] + " Длинна=" + numbers[i].length()); } } } }
ca6c8dcd9c4ea2abacd12d2b6e2e2d6cdbb427d8
f7f659eb946de6e8fc1a990f97326ad42e4c9214
/app/src/main/java/com/dowhy_ehry/roommates/Login.java
f3cf3dd07866db99a42e800e780c2f86b70e002d
[]
no_license
TannerDowhy/Roommates
d69ee60056697adade8bf88041277b16c76bd21e
1396ab252c8f9df44e6cc6579a9e78dde7f733e2
refs/heads/master
2020-07-03T18:48:45.083371
2017-03-29T21:51:05
2017-03-29T21:51:05
73,732,464
0
0
null
null
null
null
UTF-8
Java
false
false
5,317
java
package com.dowhy_ehry.roommates; import android.content.Intent; import android.support.annotation.NonNull; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.View; import com.firebase.ui.auth.AuthUI; import com.google.android.gms.tasks.OnCompleteListener; 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 java.util.HashMap; import java.util.Map; import java.util.Random; public class Login extends AppCompatActivity implements View.OnClickListener { private static final int RC_SIGN_IN = 0; private FirebaseAuth mAuth; // public String email; private DatabaseReference db_ref = FirebaseDatabase.getInstance().getReference().getRoot(); // private boolean r_value; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); mAuth = FirebaseAuth.getInstance(); if(mAuth.getCurrentUser() != null) { //user already signed in Log.d("AUTH", mAuth.getCurrentUser().getEmail()); } else { startActivityForResult(AuthUI.getInstance() .createSignInIntentBuilder() .setProviders( AuthUI.FACEBOOK_PROVIDER, AuthUI.GOOGLE_PROVIDER) .build(), RC_SIGN_IN); } findViewById(R.id.sign_out_button).setOnClickListener(this); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if(requestCode == RC_SIGN_IN) { if(resultCode == RESULT_OK) { //user logged in Log.d("AUTH", mAuth.getCurrentUser().getEmail()); // email = mAuth.getCurrentUser().getEmail(); // if (doesExist(email)) { // goToOptions(); // } // else { // Person person = new Person(null, mAuth.getCurrentUser().getPhotoUrl() // .toString(), mAuth.getCurrentUser().getDisplayName(), mAuth.getCurrentUser().getEmail()); // Map<String, Object> map = new HashMap<String, Object>(); // map.put("Person" + genID(), person.getEmail()); // db_ref.child("Person").updateChildren(map); // } } else { //user not authenticated Log.d("AUTH", "User not authenticated."); } //Code executes once logged in. Changes view to Options view. goToOptions(); } } @Override public void onClick(View v) { if(v.getId() == R.id.sign_out_button) { AuthUI.getInstance() .signOut(this) .addOnCompleteListener(new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { Log.d("AUTH", "USER LOGGED OUT."); reLoginIn(); } }); } } public void reLoginIn(){ Intent intent = new Intent(this,Login.class); startActivity(intent); } public void goToOptions(){ Intent intent = new Intent(this, Options.class); startActivity(intent); } public int genID() { Random rnd = new Random(); int n = 10000 + rnd.nextInt(90000); return n; } // public boolean doesExist(final String email) { // FirebaseDatabase.getInstance().getReference().child("Person") // .addListenerForSingleValueEvent(new ValueEventListener() { // @Override // public void onDataChange(DataSnapshot dataSnapshot) { // for (DataSnapshot snapshot : dataSnapshot.getChildren()) { // String thisss = (String)snapshot.getValue(); // if(thisss != email) { // r_value=false; // continue; // } // else if (thisss == email){ // if(person.getCurrRoom() != null) { // r_value=true; // break; // } // else { // r_value=false; // break; // } // } // } // } // @Override // public void onCancelled(DatabaseError databaseError) { // } // }); // return r_value; // } }
7b2330c3e7b199774f257ff108b292bc2048d0bf
96465094beda817d496ce63239ed23eb23e64a31
/MyFriends/app/src/test/java/com/liuguoping/myfriends/ExampleUnitTest.java
277daa68de7163d55c2538edd02a59f1d42ce693
[]
no_license
andy-liu/Automation
e52aa77fea598f79a027997cabdfe500014cd93d
2e2e5d18a54a879a3313039391207831cb07cb5e
refs/heads/master
2022-11-24T08:05:05.952755
2019-07-09T10:18:34
2019-07-09T10:18:34
76,019,046
2
0
null
2022-11-16T12:23:24
2016-12-09T09:00:13
HTML
UTF-8
Java
false
false
402
java
package com.liuguoping.myfriends; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
1170d1116349d8fb0bf8eede5779fecc49ba0796
b7b75cb6e5a712c59bde9fb1bd21cf4003ff80c8
/src/main/java/org/cactoos/time/DateOf.java
46c1351b920afa783ee22de3d7dcf387ec82d343
[ "MIT" ]
permissive
Tianhao25/cactoos
908c8918594e52560ce460f67a724a7e450b87ac
28a2560f456c76dc4112aa103f757c8f0c1690df
refs/heads/master
2021-08-31T15:04:47.909622
2017-12-21T16:42:23
2017-12-21T16:42:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,654
java
/** * The MIT License (MIT) * * Copyright (c) 2017 Yegor Bugayenko * * 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 NON-INFRINGEMENT. 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. */ package org.cactoos.time; import java.time.LocalDateTime; import java.time.ZoneOffset; import java.time.format.DateTimeFormatter; import java.util.Date; import org.cactoos.Scalar; import org.cactoos.scalar.UncheckedScalar; /** * Parser for {@link Date} instances. * @author Sven Diedrichsen ([email protected]) * @version $Id$ * @since 1.0 */ public class DateOf implements Scalar<Date> { /** * The parsed date. */ private final Scalar<Date> parsed; /** * Parses the provided date as ISO formatted. * @param date The date to parse. */ public DateOf(final String date) { this(date, DateTimeFormatter.ISO_DATE_TIME); } /** * Parses the date using the provided format. * @param date The date to parse. * @param format The format to use. */ public DateOf(final String date, final String format) { this(date, DateTimeFormatter.ofPattern(format)); } /** * Parsing the date using the provided formatter. * @param date The date to parse. * @param formatter The formatter to use. */ public DateOf(final String date, final DateTimeFormatter formatter) { this.parsed = new UncheckedScalar<>( () -> Date.from( LocalDateTime.from(formatter.parse(date)) .toInstant(ZoneOffset.UTC) ) ); } @Override public final Date value() throws Exception { return this.parsed.value(); } }
529f00cc7d4e290afcf0104b5072bf456153825f
c2d9b47d4b905c5cceed50126dff206aee7f8a8d
/backend complete code/src/main/java/com/golive/rest/webservcies/restfulwebservices/jwt/JwtInMemoryUserDetailsService.java
ddb2c4fb02c5712cd06e85fd53aa750794227b43
[]
no_license
saiteja-gatadi1996/Java-Full-Stack-with-Spring-Boot-and-React
1c54caa73d176f0a723f50df742514a7a484866a
1b457f1497ec488451b00a93b4987e5a3e9dbdde
refs/heads/master
2023-02-11T12:36:57.175634
2020-07-24T13:20:13
2020-07-24T13:20:13
277,087,522
0
0
null
2021-01-06T06:15:43
2020-07-04T10:25:21
Java
UTF-8
Java
false
false
1,326
java
package com.golive.rest.webservcies.restfulwebservices.jwt; import java.util.ArrayList; import java.util.List; import java.util.Optional; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.stereotype.Service; @Service public class JwtInMemoryUserDetailsService implements UserDetailsService { static List<JwtUserDetails> inMemoryUserList = new ArrayList<>(); static { inMemoryUserList.add(new JwtUserDetails(1L, "SaiTeja", "$2a$10$3zHzb.Npv1hfZbLEU5qsdOju/tk2je6W6PnNnY.c1ujWPcZh4PL6e", "ROLE_USER_2")); inMemoryUserList.add(new JwtUserDetails(2L, "Teja", "$2a$10$6qwCEEjgg4mYCVIW6nm7t.caNUyA/XDcWg7u.A4tjOexPqUFMxHOC", "ROLE_USER_2")); } @Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { Optional<JwtUserDetails> findFirst = inMemoryUserList.stream() .filter(user -> user.getUsername().equals(username)).findFirst(); if (!findFirst.isPresent()) { throw new UsernameNotFoundException(String.format("USER_NOT_FOUND '%s'.", username)); } return findFirst.get(); } }
d6bee96ac25a601bb669cd75d317b4e2b84b16c9
355e078667391d2a420664d5b8c3b2c7e5e83a34
/src/main/java/pl/sevet/cbrestapi/model/Measurement.java
fbb97546110c7c26b655acff885e847689b32f19
[]
no_license
TomSeVeT/cb-restapi-tryout
4991236476535c4e0ed1cf7f583d652a434fc9d0
7646611b4d3ef35fd23a63d95cdcdbe1d8914067
refs/heads/master
2023-08-23T20:27:57.038575
2021-10-20T16:43:04
2021-10-20T16:43:04
419,412,279
0
0
null
null
null
null
UTF-8
Java
false
false
82
java
package pl.sevet.cbrestapi.model; public enum Measurement { PIECES, AMOUNT }
c6cf368281918397fe17ad54cab8f7e63a530cbb
f2857fdff35e6b3e6d4da1cf411cbc5ca6ee25e9
/src/main/java/br/com/fiap/tds/cp/entity/Funcionario.java
125508155ac5d9a8138a7b54e3349ad54a439c45
[]
no_license
Luisrobbo22/Checkpoint02
63a885e83b8020562556a356c90c48114114a0be
cbfc45cda61944a3b5e6c7abd9e664aeac6d29ea
refs/heads/master
2023-04-20T12:51:34.508100
2021-05-10T21:54:36
2021-05-10T21:54:36
366,054,918
0
0
null
null
null
null
UTF-8
Java
false
false
3,022
java
package main.java.br.com.fiap.tds.cp.entity; import javax.persistence.*; import java.io.Serializable; import java.util.ArrayList; import java.util.Calendar; import java.util.List; @Entity @SequenceGenerator(name = "funcionario", sequenceName = "SQ_LFL_FUNCIONARIO", allocationSize = 1) @Table(name = "LFL_FUNCIONARIO") public class Funcionario implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(generator = "funcionario", strategy = GenerationType.SEQUENCE) @Column(name = "id_funcionario_solicitante") private Integer id; @Column(name = "nm_funcionario", length = 100, nullable = false) private String nome; @Column(name = "num_cpf", length = 20, nullable = false) private String cpf; @Column(name = "num_rg", length = 20, nullable = false) private String rg; @Temporal(TemporalType.DATE) @Column(name = "dt_nascimento", nullable = false) private Calendar dataNascimento; @OneToMany(mappedBy = "funcionario") private List<SolicitacaoCompra> solicitacaoCompras; @ManyToMany(cascade = CascadeType.PERSIST, fetch = FetchType.EAGER) @JoinTable(name = "LFL_FUNCIONARIO_ATIVIDADE", joinColumns = @JoinColumn(name = "id_funcionario_solicitante"), inverseJoinColumns = @JoinColumn(name = "id_atividade")) private List<Atividade> atividades; public void addSolicitacaoCompra(SolicitacaoCompra solicitacaoCompra) { if (solicitacaoCompras == null) solicitacaoCompras = new ArrayList<>(); solicitacaoCompras.add(solicitacaoCompra); solicitacaoCompra.setFuncionario(this); } public Funcionario(){} public Funcionario(String nome, String cpf, String rg, Calendar dataNascimento) { this.nome = nome; this.cpf = cpf; this.rg = rg; this.dataNascimento = dataNascimento; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } public String getCpf() { return cpf; } public void setCpf(String cpf) { this.cpf = cpf; } public String getRg() { return rg; } public void setRg(String rg) { this.rg = rg; } public Calendar getDataNascimento() { return dataNascimento; } public void setDataNascimento(Calendar dataNascimento) { this.dataNascimento = dataNascimento; } public List<SolicitacaoCompra> getSolicitacaoCompras() { return solicitacaoCompras; } public void setSolicitacaoCompras(List<SolicitacaoCompra> solicitacaoCompras) { this.solicitacaoCompras = solicitacaoCompras; } public List<Atividade> getAtividades() { return atividades; } public void setAtividades(List<Atividade> atividades) { this.atividades = atividades; } }
c75f25bf0cb07644345ea7d1981207baac0a4dd8
8ce0671d68f1427c8dfcd125c7fbd82d9dd3e028
/jbb-web-app-e2e-tests/src/test/java/org/jbb/e2e/serenity/lockout/AcpMemberLockoutSteps.java
c309ae325ac5e9416bb94449a638fb813866a181
[ "Apache-2.0" ]
permissive
viviand2020/jbb
740cecc3ccc9a4a9b99510a4546caf4689e23630
fcfccadf55e5de9e65a13e6f4ef3f5b20453fbb7
refs/heads/master
2020-03-07T06:07:26.247758
2017-10-11T05:03:17
2017-10-11T05:03:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,308
java
/* * Copyright (C) 2017 the original author or authors. * * This file is part of jBB Application Project. * * Licensed under the Apache License, Version 2.0 (the "License"); * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 */ package org.jbb.e2e.serenity.lockout; import net.thucydides.core.annotations.Step; import net.thucydides.core.steps.ScenarioSteps; public class AcpMemberLockoutSteps extends ScenarioSteps { AcpMemberLockoutSettingsPage lockoutSettingsPage; @Step public void open_member_lockout_settings() { lockoutSettingsPage.open(); } @Step public void click_for_enabling_lockout_feature() { lockoutSettingsPage.clickEnableLockoutRadioButton(); } @Step public void click_for_disabling_lockout_feature() { lockoutSettingsPage.clickDisableLockoutRadioButton(); } @Step public void type_failed_attempts_threshold(String failedAttemptsThreshold) { lockoutSettingsPage.typeFailedAttemptsThreshold(failedAttemptsThreshold); } @Step public void type_failed_attempts_expiration(String failedAttemptsExpiration) { lockoutSettingsPage.typeFailedAttemptsExpiration(failedAttemptsExpiration); } @Step public void type_lockout_duration(String lockoutDuration) { lockoutSettingsPage.typeLockoutDuration(lockoutDuration); } @Step public void set_lockout_settings(boolean enabled, String attemptsThreshold, String attemptsExpiration, String lockoutDuration) { if (enabled) { click_for_enabling_lockout_feature(); } else { click_for_disabling_lockout_feature(); } type_failed_attempts_threshold(attemptsThreshold); type_failed_attempts_expiration(attemptsExpiration); type_lockout_duration(lockoutDuration); } @Step public void save_lockout_settings_form() { lockoutSettingsPage.clickSaveButton(); } @Step public void should_be_informed_that_value_must_be_equal_or_greater_than_one() { lockoutSettingsPage.shouldBeVisibleInfoAboutPositiveValue(); } @Step public void should_be_informed_that_value_is_invalid() { lockoutSettingsPage.shouldBeVisibleInfoAboutInvalidValue(); } }
832e5a84267f9a0f122b7a3d0ba9a3056c32a456
bc8140b7f164f9917fe361de59703f17fda0c2a5
/XML/ParcerSAX.java
a80c13b4da48207535f117c6aed4efab75609313
[]
no_license
malyariv/Java-Practice
daaf6a9f526dfbf427e842a773ded9b6facffa8c
add2b0d190918f8a42b58a9dfda7248b6ba35a41
refs/heads/master
2021-06-26T18:46:30.997717
2017-07-14T14:39:45
2017-07-14T14:39:45
96,932,512
0
0
null
null
null
null
UTF-8
Java
false
false
1,073
java
import java.io.*; import org.xml.sax.*; import org.xml.sax.helpers.*; public class ParcerSAX{ public static void main(String[] args){ try{ XMLReader reader=XMLReaderFactory.createXMLReader(); reader.setContentHandler(new PersonHandler()); reader.parse("person_marsh.xml"); } catch(Exception e) {e.printStackTrace();} } } //__________________________ class PersonHandler extends DefaultHandler{ //@Override public void startDocument(){System.out.println("Начало");} @Override public void startElement(String uri, String localName, String qName, Attributes attrs){ String s=qName; for (int i=0; i<attrs.getLength(); i++) s+=" "+attrs.getLocalName(i)+"="+attrs.getValue(i); System.out.println(s.trim()); } @Override public void characters(char[] ch, int start, int length){ String info=new String(ch, start,length); System.out.println(info.trim()); } public void endElement(String uri, String localName, String qName){ System.out.println(qName.trim()); } public void endDocument(){System.out.println("Конец");} }
b2fca10aee58ab9bd05239d3c1fd132792a1a486
bb0f1b4e60d8e7dfae35bc2cb2fcf0ae8ea86d3a
/common/src/main/java/com/android/ide/common/blame/SourceFile.java
9ef0913d328e915ea7d1eb1f086a3265bca47ffa
[]
no_license
jabin-ma/TouchEventMonitor_FX
3c0d78d789b9796c974422f09149e39016944fff
8c72d2b3d218cc4690d12c5132735c9de0dd0be2
refs/heads/master
2021-09-03T01:13:07.204337
2018-01-04T13:38:32
2018-01-04T13:38:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,353
java
/* * Copyright (C) 2015 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.ide.common.blame; import com.android.annotations.NonNull; import com.android.annotations.Nullable; import com.android.annotations.concurrency.Immutable; import com.google.common.base.Objects; import java.io.File; /** * Represents a source file. */ @Immutable public final class SourceFile { public static final SourceFile UNKNOWN = new SourceFile(); @Nullable private final File mSourceFile; /** * A human readable description * <p> * Usually the file name is OK for the short output, but for the manifest merger, * where all of the files will be named AndroidManifest.xml the variant name is more useful. */ @Nullable private final String mDescription; @SuppressWarnings("NullableProblems") public SourceFile( @NonNull File sourceFile, @NonNull String description) { mSourceFile = sourceFile; mDescription = description; } public SourceFile( @SuppressWarnings("NullableProblems") @NonNull File sourceFile) { mSourceFile = sourceFile; mDescription = null; } public SourceFile( @SuppressWarnings("NullableProblems") @NonNull String description) { mSourceFile = null; mDescription = description; } private SourceFile() { mSourceFile = null; mDescription = null; } @Nullable public File getSourceFile() { return mSourceFile; } @Nullable public String getDescription() { return mDescription; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof SourceFile)) { return false; } SourceFile other = (SourceFile) obj; return Objects.equal(mDescription, other.mDescription) && Objects.equal(mSourceFile, other.mSourceFile); } @Override public int hashCode() { return Objects.hashCode(mSourceFile, mDescription); } @Override public String toString() { return print(false /* shortFormat */); } public String print(boolean shortFormat) { if (mSourceFile == null) { if (mDescription == null) { return "Unknown source file"; } return mDescription; } String fileName = mSourceFile.getName(); String fileDisplayName = shortFormat ? fileName : mSourceFile.getAbsolutePath(); if (mDescription == null || mDescription.equals(fileName)) { return fileDisplayName; } else { return String.format("[%1$s] %2$s", mDescription, fileDisplayName); } } }
34611a9fde90c96411991f2fd06a7367196d542d
9987f4e89b87b1cb5501b9db4c110a9c63c0b4eb
/src/BDD/DerbySalvar.java
de12cd867af95b8a0722ba439d5bb4354099ea6f
[]
no_license
Hanto/MyrranMultiplayerTest
cd57a59f14865ecc101b7ffaf731d1260555db48
e0e8eb922750ffded61cd123f0a274fb81a4889b
refs/heads/master
2021-01-01T06:32:52.480567
2013-11-07T15:53:27
2013-11-07T15:53:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,867
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package BDD; import Main.Myrran; import java.awt.Color; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.SQLException; import java.sql.Statement; /** * * @author Hanto */ public class DerbySalvar implements Runnable { private Connection con = null; @Override public void run () { SalvarTodo (); } public void SalvarTodo () { BorrarTabla("Estaticos"); CrearTabla_Estaticos(); SalvarTabla_Estaticos(); BorrarTabla("Terrenos"); CrearTabla_Terrenos(); SalvarTabla_Terrenos(); BorrarTabla("Mapas"); CrearTabla_Mapas(); SalvarTabla_Mapas(); BorrarTabla("MapTemplates"); CrearTabla_MapTemplates (); SalvarTabla_MapTemplates (); } public void SalvarTabla_Estaticos () { Conectar (); try { for (int i=0;i<Myrran.getMundo().ListaEstaticos().size();i++) { String stringSQL = "INSERT INTO Estaticos (id, Nombre, DireccionBitmap, isSolido) VALUES (?,?,?,?)"; PreparedStatement SentenciaSQL = con.prepareStatement(stringSQL); SentenciaSQL.setInt(1, Myrran.getMundo().ListaEstaticos().get(i).getID()); SentenciaSQL.setString(2, Myrran.getMundo().ListaEstaticos().get(i).getNombre()); SentenciaSQL.setString(3, Myrran.getMundo().ListaEstaticos().get(i).getIMGFilename()); SentenciaSQL.setBoolean(4, Myrran.getMundo().ListaEstaticos().get(i).isSolido()); SentenciaSQL.executeUpdate(); } } catch (Exception e) { System.out.println(" + ERROR: salvando la tabla [Estaticos]: "+e.getMessage()); } Desconectar(); } public void SalvarTabla_Terrenos () { Conectar (); try { for (int i=0;i<Myrran.getMundo().ListaTerrenos().size();i++) { String stringSQL = "INSERT INTO Terrenos (id, Nombre, Imagen, DireccionBitmap, Color, FlagMuro, FlagPuerta) VALUES (?,?,?,?,?,?,?)"; PreparedStatement SentenciaSQL = con.prepareStatement(stringSQL); SentenciaSQL.setInt(1, Myrran.getMundo().ListaTerrenos().get(i).getID()); SentenciaSQL.setString(2, Myrran.getMundo().ListaTerrenos().get(i).getNombre()); SentenciaSQL.setString(3, Myrran.getMundo().ListaTerrenos().get(i).getCaracter()); SentenciaSQL.setString(4, Myrran.getMundo().ListaTerrenos().get(i).getIMGFile()); SentenciaSQL.setInt(5, Myrran.getMundo().ListaTerrenos().get(i).getColorTerreno().getRGB()); SentenciaSQL.setBoolean(6, Myrran.getMundo().ListaTerrenos().get(i).getFlagMuro()); SentenciaSQL.setBoolean(7, Myrran.getMundo().ListaTerrenos().get(i).getFlagPuerta()); SentenciaSQL.executeUpdate(); } } catch (Exception e) { System.out.println(" + ERROR: salvando la tabla [Terrenos]: "+e.getMessage()); } Desconectar(); } public void SalvarTabla_Mapas () { Conectar (); try { for (int i=0;i<Myrran.getMundo().ListaMapas().size();i++) { String stringSQL = "INSERT INTO Mapas (id, Nombre) VALUES (?,?)"; PreparedStatement SentenciaSQL = con.prepareStatement(stringSQL); SentenciaSQL.setInt(1, Myrran.getMundo().ListaMapas().get(i).getID()); SentenciaSQL.setString(2, Myrran.getMundo().ListaMapas().get(i).getNombre()); SentenciaSQL.executeUpdate(); } } catch (Exception e) { System.out.println(" + ERROR: salvando la tabla [Mapas]: "+e.getMessage()); } Desconectar(); } public void SalvarTabla_MapTemplates () { Conectar (); try { String SSQL1 ="", SSQL2=""; for (int i=0; i<Myrran.getMundo().getMapaMaxX();i++) { SSQL1 = SSQL1 + "R"+i+","; SSQL2 = SSQL2 + "?,"; } SSQL1 = SSQL1.substring(0, SSQL1.length()-1); SSQL2 = SSQL2.substring(0, SSQL2.length()-1); for (int numMapa=0;numMapa<Myrran.getMundo().ListaMapas().size();numMapa++) { for (int fila=0;fila<Myrran.getMundo().getMapaMaxY();fila++) { String stringSQL = "INSERT INTO MapTemplates (Mapid, Fila,"+SSQL1+") VALUES (?,?,"+SSQL2+")"; PreparedStatement SentenciaSQL = con.prepareStatement(stringSQL); SentenciaSQL.setInt(1, Myrran.getMundo().ListaMapas().get(numMapa).getID()); SentenciaSQL.setInt(2, fila); for (int columna=3;columna<Myrran.getMundo().getMapaMaxX()+3;columna++) { SentenciaSQL.setInt(columna, Myrran.getMundo().ListaMapas().get(numMapa).map()[fila][columna-3].getTerrenoBase()); } SentenciaSQL.executeUpdate(); } } } catch (Exception e) { System.out.println(" + ERROR: salvando la tabla [MapaTemplates]: "+e.getMessage()); } Desconectar(); } public void CrearTabla_MapTemplates () { Conectar(); try { String stringSQL = "CREATE TABLE MapTemplates (" + "MapID INTEGER," + "Fila INTEGER,"; for (int i=0; i<Myrran.getMundo().getMapaMaxX();i++) stringSQL = stringSQL + "R"+i+" INTEGER,"; stringSQL = stringSQL + "PRIMARY KEY (MapID, Fila))"; Statement SentenciaSQL = con.createStatement(); SentenciaSQL.execute(stringSQL); System.out.println(" TABLA [MapTemplates] creada con exito"); } catch (Exception e) { System.out.println(" + ERROR: creando la tabla [MapTemplates]: "+e.getMessage()); } Desconectar(); } public void CrearTabla_Mapas () { Conectar (); try { Statement SentenciaSQL = con.createStatement(); String stringSQL = "CREATE TABLE Mapas (" + "id INTEGER PRIMARY KEY," + "Nombre VARCHAR(50))"; SentenciaSQL.execute(stringSQL); System.out.println(" TABLA [Mapas] creada con exito"); } catch (Exception e) { System.out.println(" + ERROR: creando la tabla [Mapas]: "+e.getMessage()); } Desconectar(); } public void CrearTabla_Terrenos () { Conectar (); try { Statement SentenciaSQL = con.createStatement(); String stringSQL = "CREATE TABLE Terrenos (" + "id INTEGER PRIMARY KEY," + "Nombre VARCHAR(50)," + "Imagen VARCHAR(1)," + "DireccionBitmap VARCHAR(50)," + "Color INTEGER," + "FlagMuro BOOLEAN," + "FlagPuerta Boolean)"; SentenciaSQL.execute(stringSQL); System.out.println(" TABLA [Terrenos] creada con exito"); } catch (Exception e) { System.out.println(" + ERROR: creando la tabla [Terrenos]: "+e.getMessage()); } Desconectar(); } public void CrearTabla_Estaticos () { Conectar (); try { Statement SentenciaSQL = con.createStatement(); String stringSQL = "CREATE TABLE Estaticos (" + "id INTEGER PRIMARY KEY," + "Nombre VARCHAR(50)," + "DireccionBitmap VARCHAR(50)," + "isSolido BOOLEAN)"; SentenciaSQL.execute(stringSQL); System.out.println(" TABLA [Terrenos] creada con exito"); } catch (Exception e) { System.out.println(" + ERROR: creando la tabla [Terrenos]: "+e.getMessage()); } Desconectar(); } public void BorrarTabla (String nombretabla) { Conectar(); String stringSQL; try { stringSQL = "DROP TABLE "+nombretabla; Statement SentenciaSQL = con.createStatement(); SentenciaSQL.execute(stringSQL); } catch (Exception e) { System.out.println(" + ERROR: borrando la tabla ["+nombretabla+"]: "+e.getMessage()); } Desconectar(); } public boolean Conectar () { try { Class.forName("org.apache.derby.jdbc.EmbeddedDriver"); con = DriverManager.getConnection("jdbc:derby:APP;create=true;user=app;password=app"); return true; } catch (Exception e) { System.out.println(" + Error al conectar: "+e); return false; } } public String Desconectar () { try { con.close(); return "Desconexion con la Base de datos Loterial del Motor SQL."; } catch (Exception e) { return "Problemas con la desconexion de la BDD"; } } }
[ "Hanto@Shodan" ]
Hanto@Shodan
660f92b9ddb1d3447188bf95259f6c162930aa0b
c63505adf93e05216942fb9d5b9d59a4ed933b07
/app/src/main/java/com/example/sondrehj/familymedicinereminderclient/dialogs/CreateReminderForMedicationDialogFragment.java
4029be1d67ebd2747657ab0e03a44257bb134c40
[ "Apache-2.0" ]
permissive
martidor/familyMedicineReminderClient
880b51a7976d1b7affff2433cc47bfc4c1541a37
6bb03bab985cae7dd249ccc32d78f2c41807e53a
refs/heads/master
2021-06-04T14:48:52.677268
2016-06-03T16:15:01
2016-06-03T16:15:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,354
java
package com.example.sondrehj.familymedicinereminderclient.dialogs; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; import android.app.DialogFragment; import android.content.Context; import android.content.DialogInterface; import android.os.Bundle; import com.example.sondrehj.familymedicinereminderclient.MainActivity; import com.example.sondrehj.familymedicinereminderclient.fragments.MedicationListFragment; import com.example.sondrehj.familymedicinereminderclient.models.Medication; public class CreateReminderForMedicationDialogFragment extends DialogFragment{ private CreateReminderForMedicationDialogListener mListener; public static CreateReminderForMedicationDialogFragment newInstance(Medication medication) { CreateReminderForMedicationDialogFragment fragment = new CreateReminderForMedicationDialogFragment(); if (medication != null) { Bundle bundle = new Bundle(); bundle.putSerializable("medication", medication); fragment.setArguments(bundle); } return fragment; } @Override public Dialog onCreateDialog(Bundle savedInstanceState) { // Use the Builder class for convenient dialog construction AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); // Set the dialog title builder.setMessage("Do you want to create a reminder for this medicine?") // Set the action buttons .setPositiveButton("Yes", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { Medication medication = (Medication) getArguments().getSerializable("medication"); mListener.onPositiveCreateReminderForMedicationDialogResult(medication); } }) .setNegativeButton("No", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { ((MainActivity) getActivity()).changeFragment(new MedicationListFragment()); } }); // Create the AlertDialog object and return it return builder.create(); } //API >= 23 @Override public void onAttach(Context context) { super.onAttach(context); if (context instanceof CreateReminderForMedicationDialogListener) { mListener = (CreateReminderForMedicationDialogListener) context; } else { throw new RuntimeException(context.toString() + " must implement OnFragmentInteractionListener"); } } //API < 23 @Override public void onAttach(Activity activity) { super.onAttach(activity); if (activity instanceof CreateReminderForMedicationDialogListener) { mListener = (CreateReminderForMedicationDialogListener) activity; } else { throw new RuntimeException(activity.toString() + " must implement DeleteReminderDialogListener"); } } public interface CreateReminderForMedicationDialogListener { void onPositiveCreateReminderForMedicationDialogResult(Medication medication); } }
345b6ea3502fd246ef12128909fb1a268905f9d9
a5028598f173a0bbfaba040769f3f96f4b1d5700
/app/src/main/java/com/tomtom/snowflake/MyGLRenderer.java
9369275b1a739e61b71c578e5b9f602e23828f0b
[]
no_license
tbalogh77/SnowFlake
1b0ab129e3d78a6f89a3e23f1eb27c3c3c722376
562a8f3e98943d83a83fb11c84ea7f84d55203a3
refs/heads/master
2023-01-22T00:45:02.748741
2020-11-09T00:46:37
2020-11-09T00:46:37
284,146,468
0
0
null
null
null
null
UTF-8
Java
false
false
4,550
java
/* * Copyright (C) 2011 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.tomtom.snowflake; import javax.microedition.khronos.egl.EGLConfig; import javax.microedition.khronos.opengles.GL10; import android.content.Context; import android.opengl.GLES20; import android.opengl.GLSurfaceView; import android.opengl.Matrix; import android.os.SystemClock; /** * Provides drawing instructions for a GLSurfaceView object. This class * must override the OpenGL ES drawing lifecycle methods: * <ul> * <li>{@link android.opengl.GLSurfaceView.Renderer#onSurfaceCreated}</li> * <li>{@link android.opengl.GLSurfaceView.Renderer#onDrawFrame}</li> * <li>{@link android.opengl.GLSurfaceView.Renderer#onSurfaceChanged}</li> * </ul> */ public class MyGLRenderer implements GLSurfaceView.Renderer { private scoreBoard sb = new scoreBoard(); private float[] mProjMatrix = new float[16]; //private int[] mTextures = new int[2]; //private static final String TAG = "MyGLRenderer"; private myContent mContent = new myContent(); private long mLastTime = 0; boolean mbInited = false; private Context context; // Context (from Activity) public MyGLRenderer(Context context) { super(); this.context = context; // Save Specified Context } @Override public void onSurfaceCreated(GL10 unused, EGLConfig config) { ///GLES20.glClearColor(0.0f, 0.0f, 0.0f, 1.0f); ///mContent.create(); mLastTime = SystemClock.uptimeMillis(); mbInited = false; sb.create(context); } private long getdt() { long time = SystemClock.uptimeMillis(); long dt = time - mLastTime; mLastTime = time; return dt; } @Override public void onDrawFrame(GL10 unused) { this.drawContent(); if (mContent.mLevel.dm != null ) sb.drawScoreBoard(mContent.mLevel.dm); } private void drawContent() { if (!mbInited) { mbInited = true; mContent.create(); if (!myContent.inst.mLevel.isVboCreated()) mLastTime = SystemClock.uptimeMillis(); } final long lMaxTime = 1000 / 31; long dt = getdt(); mContent.simu(dt); long physTime = SystemClock.uptimeMillis() - mLastTime; mContent.draw(); long allTime = SystemClock.uptimeMillis() - mLastTime; float fps = 1000.f / (float)dt; myContent.inst.mActFps = fps; long sleepTime = 0; boolean bFrameDrop = false; if ( allTime < lMaxTime) { try { sleepTime = lMaxTime-allTime; Thread.sleep(sleepTime); } catch (InterruptedException e) { e.printStackTrace(); } }else { bFrameDrop = true; } /*Log.e("FPSEK: ", (bFrameDrop ?"__SZOPOL__ " : "__________ " ) + fps + " vbos: " + mContent.mLevel.getVboCount() + " fps dt: " + dt + " st " + sleepTime + " at: " + allTime + " pt " + physTime + " mdst: " + (0.1f - Ball.mfMinDist));*/ //Log.e("FPSEK: ", " " + mAccl[0] + " " + mAccl[1] + " " + mAccl[2]); } @Override public void onSurfaceChanged(GL10 unused, int width, int height) { // Adjust the viewport based on geometry changes, // such as screen rotation mContent.onResized(width,height); setMatrices(width, height); } private void setMatrices( int width, int height) { // gl.glViewport( 0, 0, width, height ); GLES20.glViewport(0, 0, width, height); float ratio = (float) width / height; // Take into account device orientation if (width > height) { Matrix.frustumM(mProjMatrix, 0, -ratio, ratio, -1, 1, 1, 10); } else { Matrix.frustumM(mProjMatrix, 0, -1, 1, -1/ratio, 1/ratio, 1, 10); } sb.setWH(width, height, mProjMatrix); } }
b7ac4c3b850b68a7e09286f36e826f0232397956
b24d0783c39dfc577943824ac09390dd47a28321
/src/main/java/com/brunotarditi/api/instrumentos/InstrumentosApplication.java
686ebf777fee6b27a7205712c7e68678377d3b11
[]
no_license
brunotarditi/api-instrumentos
cddbffef89bb3c50f5e9ef601c63e2138ff951ea
043ac5ab0b0cdacdfb40fd2f2da72ebee3227497
refs/heads/main
2023-06-01T18:23:02.578619
2021-06-15T00:47:03
2021-06-15T00:47:03
376,660,405
0
0
null
null
null
null
UTF-8
Java
false
false
350
java
package com.brunotarditi.api.instrumentos; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class InstrumentosApplication { public static void main(String[] args) { SpringApplication.run(InstrumentosApplication.class, args); } }
d06450e3a9313bb54bcf29cef9e10f99edf1d2ad
99366b7e62611ce9728e62a6fd79dec89653a901
/src/main/java/yijiahu/RemoteConsultation/controller/YcwzIndexController.java
dd5587773bea22a4dbc12b0e4683e13282a71c66
[]
no_license
zgSanYangzg/bootemplete
fad80d9f6ee72903051bcd0c40bb0e86a2f2f0cb
99f24c06e637b978241858c5297cc502517770cb
refs/heads/master
2020-05-22T23:35:37.214562
2019-05-14T07:01:10
2019-05-14T07:01:10
186,562,384
0
0
null
null
null
null
UTF-8
Java
false
false
436
java
package yijiahu.RemoteConsultation.controller; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @Controller @RequestMapping("") public class YcwzIndexController { @RequestMapping("/index") public String index(ModelMap map) { return "index"; } }
c8f9063054e383a81cf924fb1d03d5e093e87727
8f8b5f8b802f83c614ad78af032fe9936e5ffb6e
/enterprise-web-services-camel/target/generated/src/main/java/com/sforce/soap/enterprise/Update.java
01731847d4f26f225618e7b2d71bb6f883f17000
[]
no_license
praveen4students/hmh_backup
1b8d54bfa241f5a6412ef2423f1547d6262a530c
45630529b61126976ee0663d9f78b60690a65df7
refs/heads/master
2022-01-05T12:09:18.641190
2019-05-01T18:30:30
2019-05-01T18:30:30
114,189,899
0
0
null
null
null
null
UTF-8
Java
false
false
1,890
java
package com.sforce.soap.enterprise; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import com.sforce.soap.enterprise.sobject.SObjectType; /** * <p>Java class for anonymous complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="sObjects" type="{urn:sobject.enterprise.soap.sforce.com}sObject" maxOccurs="unbounded" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "sObjects" }) @XmlRootElement(name = "update") public class Update { protected List<SObjectType> sObjects; /** * Gets the value of the sObjects property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the sObjects property. * * <p> * For example, to add a new item, do as follows: * <pre> * getSObjects().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link SObjectType } * * */ public List<SObjectType> getSObjects() { if (sObjects == null) { sObjects = new ArrayList<SObjectType>(); } return this.sObjects; } }
a4929eedd827d6fddc82fb4e155a7318abfb036c
c06c258bf1dbcc1270af1dd702b99ec62cd80c4e
/plugins/android/weiui/src/main/java/cc/weiui/framework/extend/integration/glide/load/data/mediastore/FileService.java
aa1fa5d69ec06eede4bc072f38d0e4d7fea569d9
[ "MIT" ]
permissive
wtowto7207/weiui-template
566d26f4e89203ff47088074c9febf35c4cab5f1
45c239c356f36653412c11602182183ed63dd224
refs/heads/master
2020-04-04T22:25:22.273884
2018-11-08T07:51:13
2018-11-08T07:51:13
156,323,694
0
1
null
2018-11-06T04:00:10
2018-11-06T04:00:10
null
UTF-8
Java
false
false
316
java
package cc.weiui.framework.extend.integration.glide.load.data.mediastore; import java.io.File; class FileService { public boolean exists(File file) { return file.exists(); } public long length(File file) { return file.length(); } public File get(String path) { return new File(path); } }
7ea72120650b98da8cb6f2612e2f80ad73591c76
21128bc1a86b1fb1ab0fc241fe82e5f30f8374fe
/src/UserInterface/Lender/CreateContractJPanel.java
a3966ba21ca70c2a7143e89ef8b5498574421013
[]
no_license
shinde-ha/JAVA_Project
dbb9e9ba269a196cfca9b52ce864cf1acf70d982
d3168d190c2b462047e8ae2815b43c2411413b20
refs/heads/master
2021-09-04T13:15:40.364563
2018-01-19T03:31:28
2018-01-19T03:31:28
118,070,806
0
0
null
2018-01-19T03:31:28
2018-01-19T03:19:59
null
UTF-8
Java
false
false
8,717
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 UserInterface.Lender; import Business.Ecosystem; import Business.Enterprise.Enterprise; import Business.UserAccount.UserAccount; import javax.swing.JPanel; /** * * @author murta */ public class CreateContractJPanel extends javax.swing.JPanel { /** * Creates new form CreateContractJPanel */ private JPanel rightContainer; private Enterprise enterprise; private UserAccount userAccount; private Ecosystem system; public CreateContractJPanel(JPanel rightContainer, Enterprise enterprise, UserAccount userAccount, Ecosystem system) { initComponents(); this.enterprise = enterprise; this.rightContainer = rightContainer; this.system = system; this.userAccount = userAccount; } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jTextField1 = new javax.swing.JTextField(); jLabel3 = new javax.swing.JLabel(); jTextField2 = new javax.swing.JTextField(); jLabel4 = new javax.swing.JLabel(); jTextField3 = new javax.swing.JTextField(); jLabel5 = new javax.swing.JLabel(); jTextField4 = new javax.swing.JTextField(); jLabel6 = new javax.swing.JLabel(); jTextField5 = new javax.swing.JTextField(); jLabel1.setText("Create Contract"); jLabel2.setText("jLabel2"); jLabel3.setText("jLabel2"); jLabel4.setText("jLabel2"); jTextField3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField3ActionPerformed(evt); } }); jLabel5.setText("jLabel2"); jTextField4.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField4ActionPerformed(evt); } }); jLabel6.setText("jLabel2"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap(359, Short.MAX_VALUE) .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(371, 371, 371)) .addGroup(layout.createSequentialGroup() .addGap(119, 119, 119) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(layout.createSequentialGroup() .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(32, 32, 32) .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(76, 76, 76) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(245, Short.MAX_VALUE)) ); }// </editor-fold>//GEN-END:initComponents private void jTextField3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField3ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jTextField3ActionPerformed private void jTextField4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField4ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jTextField4ActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JTextField jTextField1; private javax.swing.JTextField jTextField2; private javax.swing.JTextField jTextField3; private javax.swing.JTextField jTextField4; private javax.swing.JTextField jTextField5; // End of variables declaration//GEN-END:variables }
04189faff36a902bed985993c481021a81a58d3e
25e025e2ea944c17311075470a29be4d419a1321
/OCRManager/ocr-system/src/main/java/com/ocr/system/mapper/UserChannelMapper.java
437d7209b59dfb37bafe917efd2479c324483440
[ "MIT" ]
permissive
Fanbb/XTOCR
4eba91b5b66349348cdb40a965b0681bd2f268f5
8e5e8641cf7f375aa69d374086405e33b1c7e622
refs/heads/main
2023-03-30T06:13:00.256868
2021-03-26T06:30:00
2021-03-26T06:30:00
351,686,682
0
0
null
null
null
null
UTF-8
Java
false
false
1,507
java
package com.ocr.system.mapper; import com.ocr.system.domain.SysUserChannel; import java.util.List; /** * 用户渠道关联 数据层 * * @author ocr * @date 2020-06-19 */ public interface UserChannelMapper { /** * 查询用户渠道关联信息 * * @param userId 用户渠道关联ID * @return 用户渠道关联信息 */ public SysUserChannel selectUserChannelById(Integer userId); /** * 查询用户渠道关联列表 * * @param userChannel 用户渠道关联信息 * @return 用户渠道关联集合 */ public List<SysUserChannel> selectUserChannelList(SysUserChannel userChannel); /** * 新增用户渠道关联 * * @param userChannel 用户渠道关联信息 * @return 结果 */ public int insertUserChannel(SysUserChannel userChannel); /** * 修改用户渠道关联 * * @param userChannel 用户渠道关联信息 * @return 结果 */ public int updateUserChannel(SysUserChannel userChannel); /** * 删除用户渠道关联 * * @param userId 用户渠道关联ID * @return 结果 */ public int deleteUserChannelById(Integer userId); /** * 批量删除用户渠道关联 * * @param userIds 需要删除的数据ID * @return 结果 */ public int deleteUserChannelByIds(String[] userIds); void batchUserChannel(List<SysUserChannel> list); void deleteUserChannelsById(Long userId); }
4ac602a56e110e2914a7993a99d8414900aec669
2d226b42de181d325df9d0b2c7ff167112417b9d
/src/net/hunter/gameconfig/RoleNumberAcquiredWrapper.java
7a2f061d6c48c788ea20cdc6f6bf5326ee3e644a
[]
no_license
Aksyo/HunterxHunter-UHC
33de08987acc58e8982736cb199838b62be3488f
4edbb84196ab51519ece7fc69a2d797377633eeb
refs/heads/master
2020-09-16T12:36:53.598960
2019-11-24T16:09:22
2019-11-24T16:09:22
223,772,089
0
0
null
null
null
null
UTF-8
Java
false
false
1,297
java
package net.hunter.gameconfig; import net.hunter.gameroles.GameRole; import net.hunter.gameroles.RoleInput; import net.hunter.main.Main; import java.util.Iterator; public class RoleNumberAcquiredWrapper { private Main main; public RoleNumberAcquiredWrapper(Main main){ this.main = main; } public void roleSetNumberAcquired(String roleName, int numberAcquired){ if(main.uhcRolesName.contains(roleName)){ Iterator it = RoleInput.uhcRoles.listIterator(); Boolean isFound = false; int index = 0; while (!isFound && it.hasNext()){ if( RoleInput.uhcRoles.get(index + 1).getRoleName() == roleName){ index++; isFound = true; RoleInput.uhcRoles.get(index).setNumberAcquired(numberAcquired); } } } } public Integer getRoleNumberAfterConfig(){ int index = 0; Integer numberAq = 0; Iterator it = RoleInput.uhcRoles.listIterator(); while (it.hasNext()){ index++; numberAq = numberAq + RoleInput.uhcRoles.get(index).getNumberAcquired(); } return numberAq; } }
4f779661544888eb197aef50ae43c92932e6a637
a68d5aeb0be7ed40f8dd5acb642c9dfdf3a71df3
/app/src/main/java/com/dl/dlexerciseandroid/features/doitlater/handleintent/InHouseDoItLaterTask.java
1f1f9f5d7ba188c3dc3ef73cb1b86c9b1d89a5c0
[]
no_license
logicmelody/DLExerciseAndroid
ffbf6825dd66e1c08b9c152bf70e92090d21d2f6
ba9a462c75624d16a40ae4a9fc1ef00ba38bc018
refs/heads/master
2022-08-30T14:50:45.881460
2022-08-12T15:50:35
2022-08-12T15:50:35
54,878,288
0
0
null
2017-09-06T05:38:09
2016-03-28T08:30:53
C++
UTF-8
Java
false
false
4,582
java
package com.dl.dlexerciseandroid.features.doitlater.handleintent; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.os.Bundle; import android.text.TextUtils; import android.util.Log; import com.dl.dlexerciseandroid.widget.PackedString; import com.dl.dlexerciseandroid.utils.DoItLaterUtils; import java.util.Iterator; /** * Created by logicmelody on 2016/4/27. */ public class InHouseDoItLaterTask extends DoItLaterTask { public InHouseDoItLaterTask(Context context, Intent intent) { super(context, intent); } @Override public void retrieveIntent() { Intent callBackIntent = mIntent.getParcelableExtra(DoItLaterUtils.ExtraKey.CALL_BACK); mTitle = mIntent.getStringExtra(DoItLaterUtils.ExtraKey.TITLE); mDescription = mIntent.getStringExtra(DoItLaterUtils.ExtraKey.DESCRIPTION); mTime = System.currentTimeMillis(); retrieveCallbackIntent(callBackIntent); } private void retrieveCallbackIntent(Intent callBackIntent) { // 以下資訊可能不會有 String action = callBackIntent.getAction(); String type = callBackIntent.getType(); String data = callBackIntent.getData() != null ? callBackIntent.getData().toString() : null; String flag = String.valueOf(callBackIntent.getFlags()); // 一定會有以下兩個資訊 String packageName = callBackIntent.getComponent().getPackageName(); String className = callBackIntent.getComponent().getClassName(); Log.d("danny", "Receive callBackIntent action = " + action); Log.d("danny", "Receive callBackIntent packageName = " + packageName); Log.d("danny", "Receive callBackIntent className = " + className); Log.d("danny", "Receive callBackIntent type = " + type); Log.d("danny", "Receive callBackIntent data = " + data); Log.d("danny", "Receive callBackIntent flag = " + flag); PackedString.Builder psBuilder = new PackedString.Builder(); // 超級重要:為了可以傳遞別的app中自己定義的class,PackedString.Builder一定要設定package name psBuilder.setPackageName(packageName); if (!TextUtils.isEmpty(action)) { psBuilder.put(PackedString.Key.ACTION, action); } if (!TextUtils.isEmpty(type)) { psBuilder.put(PackedString.Key.TYPE, type); } if (!TextUtils.isEmpty(data)) { psBuilder.put(PackedString.Key.DATA, data); } if (!TextUtils.isEmpty(flag)) { psBuilder.put(PackedString.Key.FLAG, flag); } if (!TextUtils.isEmpty(packageName)) { psBuilder.put(PackedString.Key.PACKAGE_NAME, packageName); } if (!TextUtils.isEmpty(className)) { psBuilder.put(PackedString.Key.CLASS_NAME, className); } // 可以取得所有intent中的extra data Bundle bundle = callBackIntent.getExtras(); if (bundle != null) { try { // 取得別的app環境底下的class loader,如此一來才可以認得別的app中自己定義的class // 還要搭配兩個東西,才可以使這個功能正常運作: // 1. 在AndroidManifest中要加入android:sharedUserId="android.uid.latertask",如此一來有加入這個property的 // app彼此的resources或是class才可以共用 // 2. 彼此app都要sign相同的key Context remote = mContext.createPackageContext(packageName, Context.CONTEXT_INCLUDE_CODE | Context.CONTEXT_IGNORE_SECURITY); // 因為我們要擷取別的app傳來的intent資訊,所以必須要assign那個app環境底下的class loader bundle.setClassLoader(remote.getClassLoader()); // Extra data // Note: 在Do It Later的架構中,extra data的部分所有可以Serializable的object都可以傳遞 Iterator<String> it = bundle.keySet().iterator(); while (it.hasNext()) { String key = it.next(); psBuilder.put(key, bundle.get(key)); Log.d("danny", "Extra [" + key + "] = " + bundle.get(key)); } } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } } mLaterPackageName = packageName; mLaterCallback = psBuilder.toString(); } }
4b686476d47ba8bd4fa7a99f5ad6d3499027cfce
8acf9a96f6a028b378dcf1cbcddf2c18736aca77
/wescape/src/main/java/com/dii/ids/application/views/exceptions/DestinationNotSettedException.java
beb8b9f2fbdf9c59a847043d578ebf9e48e52340
[ "Apache-2.0" ]
permissive
ilario-pierbattista/wescape-android
e22e041e78447c7d7e18d63679de36fded73610a
0174ec532ebcb8659ace39725d2232fd5f21149d
refs/heads/master
2021-01-20T06:23:14.618134
2018-01-17T13:26:10
2018-01-17T13:26:10
51,361,490
0
1
null
null
null
null
UTF-8
Java
false
false
124
java
package com.dii.ids.application.views.exceptions; public class DestinationNotSettedException extends MapViewException { }
a7f3a00ec5fb4d9675f1696c44ea78a429beb2ec
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/25/25_aa883e55ede2331251f19218dd899a14f9e89204/MPDStatus/25_aa883e55ede2331251f19218dd899a14f9e89204_MPDStatus_t.java
4a664754f1b79e1566e803aaec3af42f1f0fa72b
[]
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,597
java
package org.a0z.mpd; import java.util.List; /** * Class representing MPD Server status. * * @author Felipe Gustavo de Almeida * @version $Id: MPDStatus.java 2941 2005-02-09 02:34:21Z galmeida $ */ public class MPDStatus { /** * MPD State: playing. */ public static final String MPD_STATE_PLAYING = "play"; /** * MPD State: stopped. */ public static final String MPD_STATE_STOPPED = "stop"; /** * MPD State: paused. */ public static final String MPD_STATE_PAUSED = "pause"; /** * MPD State: unknown. */ public static final String MPD_STATE_UNKNOWN = "unknown"; private int playlistVersion; private int playlistLength; private int song; private int songId; private int nextSong; private int nextSongId; private boolean repeat; private boolean random; private boolean updating; private boolean single; private boolean consume; private String state; private String error; private long elapsedTime; private long totalTime; private int crossfade; private int volume; private long bitrate; private int sampleRate; private int bitsPerSample; private int channels; MPDStatus() { volume = -1; bitrate = -1; playlistVersion = -1; playlistLength = -1; song = -1; songId = -1; repeat = false; random = false; state = null; error = null; elapsedTime = -1; totalTime = -1; crossfade = 0; sampleRate = 0; channels = 0; bitsPerSample = 0; updating = false; } /** * Updates the state of the MPD Server... * * @param response */ public void updateStatus(List<String> response) { // reset values this.updating = false; if (response == null) return; for (String line : response) { try { if (line.startsWith("volume:")) { this.volume = Integer.parseInt(line.substring("volume: ".length())); } else if (line.startsWith("bitrate:")) { this.bitrate = Long.parseLong(line.substring("bitrate: ".length())); } else if (line.startsWith("playlist:")) { this.playlistVersion = Integer.parseInt(line.substring("playlist: ".length())); } else if (line.startsWith("playlistlength:")) { this.playlistLength = Integer.parseInt(line.substring("playlistlength: ".length())); } else if (line.startsWith("song:")) { this.song = Integer.parseInt(line.substring("song: ".length())); } else if (line.startsWith("songid:")) { this.songId = Integer.parseInt(line.substring("songid: ".length())); } else if (line.startsWith("repeat:")) { this.repeat = "1".equals(line.substring("repeat: ".length())) ? true : false; } else if (line.startsWith("random:")) { this.random = "1".equals(line.substring("random: ".length())) ? true : false; } else if (line.startsWith("state:")) { String state = line.substring("state: ".length()); if (MPD_STATE_PAUSED.equals(state)) { this.state = MPD_STATE_PAUSED; } else if (MPD_STATE_PLAYING.equals(state)) { this.state = MPD_STATE_PLAYING; } else if (MPD_STATE_STOPPED.equals(state)) { this.state = MPD_STATE_STOPPED; } else { this.state = MPD_STATE_UNKNOWN; } } else if (line.startsWith("error:")) { this.error = line.substring("error: ".length()); } else if (line.startsWith("time:")) { String[] time = line.substring("time: ".length()).split(":"); elapsedTime = Long.parseLong(time[0]); totalTime = Long.parseLong(time[1]); } else if (line.startsWith("audio:")) { String[] audio = line.substring("audio: ".length()).split(":"); try { sampleRate = Integer.parseInt(audio[0]); bitsPerSample = Integer.parseInt(audio[1]); channels = Integer.parseInt(audio[2]); } catch (NumberFormatException e) { // Sometimes mpd sends "?" as a sampleRate or bitsPerSample, etc ... hotfix for a bugreport I had. } } else if (line.startsWith("xfade:")) { this.crossfade = Integer.parseInt(line.substring("xfade: ".length())); } else if (line.startsWith("updating_db:")) { this.updating = true; } else if (line.startsWith("nextsong:")) { this.nextSong = Integer.parseInt(line.substring("nextsong: ".length())); } else if (line.startsWith("nextsongid:")) { this.nextSongId = Integer.parseInt(line.substring("nextsongid: ".length())); } else if (line.startsWith("consume:")) { this.consume = "1".equals(line.substring("consume: ".length())) ? true : false; } else if (line.startsWith("single:")) { this.single = "1".equals(line.substring("single: ".length())) ? true : false; } else { // TODO : This floods logcat too much, will fix later // (new InvalidResponseException("unknown response: " + line)).printStackTrace(); } } catch (RuntimeException e) { // Do nothing, these should be harmless e.printStackTrace(); } } } /** * Retrieves current track bitrate. * * @return current track bitrate. */ public long getBitrate() { return bitrate; } /** * Retrieves current track elapsed time. * * @return current track elapsed time. */ public long getElapsedTime() { return elapsedTime; } /** * Retrieves error message. * * @return error message. */ public String getError() { return error; } /** * Retrieves playlist version. * * @return playlist version. */ public int getPlaylistVersion() { return playlistVersion; } /** * Retrieves the length of the playlist. * * @return the length of the playlist. */ public int getPlaylistLength() { return playlistLength; } /** * If random is enabled return true, return false if random is disabled. * * @return true if random is enabled, false if random is disabled */ public boolean isRandom() { return random; } /** * If repeat is enabled return true, return false if repeat is disabled. * * @return true if repeat is enabled, false if repeat is disabled. */ public boolean isRepeat() { return repeat; } /** * Retrieves the process id of any database update task. * * @return the process id of any database update task. */ public boolean isUpdating() { return updating; } public boolean isSingle() { return single; } public boolean isConsume() { return consume; } /** * Retrieves current song playlist number. * * @return current song playlist number. */ public int getSongPos() { return song; } /** * Retrieves current song playlist id. * * @return current song playlist id. */ public int getSongId() { return songId; } public int getNextSongPos() { return nextSong; } public int getNextSongId() { return nextSongId; } /** * Retrieves player state. MPD_STATE_PLAYING, MPD_STATE_PAUSED, MPD_STATE_STOPPED or MPD_STATE_UNKNOWN * * @return player state. */ public String getState() { return state; } /** * Retrieves current track total time. * * @return current track total time. */ public long getTotalTime() { return totalTime; } /** * Retrieves volume (0-100). * * @return volume. */ public int getVolume() { return volume; } /** * Retrieves bits resolution from playing song. * * @return bits resolution from playing song. */ public int getBitsPerSample() { return bitsPerSample; } /** * Retrieves number of channels from playing song. * * @return number of channels from playing song. */ public int getChannels() { return channels; } /** * Retrieves current cross-fade time. * * @return current cross-fade time in seconds. */ public int getCrossfade() { return crossfade; } /** * Retrieves sample rate from playing song. * * @return sample rate from playing song. */ public int getSampleRate() { return sampleRate; } /** * Retrieves a string representation of the object. * * @return a string representation of the object. * @see java.lang.Object#toString() */ public String toString() { return "volume: " + volume + ", bitrate: " + bitrate + ", playlist: " + playlistVersion + ", playlistLength: " + playlistLength + ", song: " + song + ", songid: " + songId + ", repeat: " + repeat + ", random: " + random + ", state: " + state + ", error: " + error + ", elapsedTime: " + elapsedTime + ", totalTime: " + totalTime; } }
8ca96278bf167df0c4a97fd5cd58960cf5a2087f
9c7f70770307dbb6b825a1198f44a669bdb909e8
/kodilla-testing/src/main/java/com/kodilla/testing/forum/statistics/StatCalculator.java
9e72c953b70fa9db75a695a57b5c1a76e8438bbf
[]
no_license
mickaras/java-kodilla
fa580cefacdc514c193f1cdfcd1c53b0d6c300ec
797c1e8f053905af5280d1b4a2529682b82fa6dd
refs/heads/master
2020-03-24T03:59:48.741810
2019-01-05T10:00:41
2019-01-05T10:00:41
140,197,363
0
0
null
null
null
null
UTF-8
Java
false
false
1,404
java
package com.kodilla.testing.forum.statistics; public class StatCalculator{ private int numUsers; private int numPosts; private int numComments; private double avgPostsPerUser; private double avgCommentsPerUser; private double avgCommentsPerPost; public StatCalculator(Statistics stats) { this.numUsers = stats.usersNames().size(); this.numPosts = stats.postsCount(); this.numComments = stats.commentsCount(); calculateAdvStatistics(); } public void calculateAdvStatistics(){ if(numUsers>0) { avgPostsPerUser = (double)numPosts / numUsers; avgCommentsPerUser = (double)numComments / numUsers; } else{ avgPostsPerUser = 0; avgCommentsPerUser =0; } if(numPosts>0) { avgCommentsPerPost = (double)numComments / numPosts; } else{ avgCommentsPerPost =0; } } public double getAvgPostsPerUser() { return avgPostsPerUser; } public double getAvgCommentsPerUser() { return avgCommentsPerUser; } public double getAvgCommentsPerPost() { return avgCommentsPerPost; } public void showStats(){ System.out.println("Posts per user: "+avgPostsPerUser+"/nComments per user: "+avgCommentsPerUser+"/n Comments per post: "+avgCommentsPerPost); } }
f57455e5c8ead0c86cb9e77745abfe02257d3a49
d543738e304222f2b46dd3aa84837546873b26ed
/src/Concrete/CustomerCheckManager.java
4c175b87f0056dbeecbae273d7f0673b9e936ada
[]
no_license
Dyavas/KahveDukkani
9f72456379a392fe02d2f819bc0b8e1292c221a8
5843550771c2de1aff5d086553c67823935ae7b8
refs/heads/master
2023-04-28T22:08:58.582630
2021-05-24T12:16:14
2021-05-24T12:16:14
370,340,663
0
0
null
null
null
null
UTF-8
Java
false
false
292
java
package Concrete; import Abstract.CustomerCheckService; import Abstract.CustomerService; import Entities.Customer; public class CustomerCheckManager implements CustomerCheckService { @Override public boolean checkIfRealPerson(Customer customer) { return true; } }
5feb4299874b861bb20fd02505330f487f48b921
ba98769dd7071fe404ba1e84612d78a31343ee1b
/src/edu/jabs/canina/mundo/Perro.java
b2a77ce44bc8d1448ca457b60e2e47262dffe309
[]
no_license
Andres6936/N7-ExposicionCanina-Java
67df0ed3e21f5f349349b2daf911339eba3ac9fc
1577fe61714e3af074e855e9db44fb7f4cd2be88
refs/heads/master
2021-04-29T16:27:37.578365
2018-02-15T16:17:33
2018-02-15T16:17:33
121,651,213
0
0
null
null
null
null
UTF-8
Java
false
false
6,166
java
package edu.jabs.canina.mundo; /** * Es la clase que representa a un perro. <br> * <b>inv: </b> <br> * puntos >= 0 <br> * edad > 0 <br> * imagen != null <br> * nombre != null <br> * raza != null */ public class Perro { // ----------------------------------------------------------------- // Atributos // ----------------------------------------------------------------- /** * El nombre del perro */ private String nombre; /** * La raza del perro */ private String raza; /** * La ruta hasta la imagen del perro */ private String imagen; /** * Los puntos del perro en la exposición */ private int puntos; /** * La edad en meses del perro */ private int edad; // ----------------------------------------------------------------- // Constructores // ----------------------------------------------------------------- /** * Construye un nuevo perro con los parámetros indicados. <br> * <b>post: </b> Se construyó un perro con los parámetros especificados. * @param nombreP es el nombre del perro - nombreP != null * @param razaP es la raza del perro - razaP != null * @param imagenP es la ruta a la imagen del perro - imagenP != null * @param puntosP son los puntos del perro - puntosP >= 0 * @param edadP es la edad en meses del perro - edadP > 0 */ public Perro( String nombreP, String razaP, String imagenP, int puntosP, int edadP ) { nombre = nombreP; raza = razaP; imagen = imagenP; puntos = puntosP; edad = edadP; verificarInvariante( ); } // ----------------------------------------------------------------- // Métodos // ----------------------------------------------------------------- /** * Retorna el nombre del perro. * @return Nombre del perro */ public String darNombre( ) { return nombre; } /** * Retorna la raza del perro. * @return La raza del perro */ public String darRaza( ) { return raza; } /** * Retorna la ruta a la imagen del perro. * @return La imagen del perro */ public String darImagen( ) { return imagen; } /** * Retorna los puntos del perro en la exposición. * @return Los puntos del perro en la exposición */ public int darPuntos( ) { return puntos; } /** * Retorna la edad en meses del perro. * @return La edad en meses del perro. */ public int darEdad( ) { return edad; } /** * Compara dos perros según el nombre. <br> * @param p es el perro contra el que se está comparando - p !=null * @return Retorna 0 si los perros tienen el mismo nombre. <br> * Retorna -1 si el perro p tiene una valor "MAYOR" para el nombre. <br> * Retorna 1 si el perro p tiene una valor "MENOR" para el nombre. <br> */ public int compararPorNombre( Perro p ) { int valorComparacion = nombre.compareToIgnoreCase( p.nombre ); if(valorComparacion < 0){ valorComparacion = -1; }else if(valorComparacion == 0){ valorComparacion = 0; }else{ valorComparacion = 1; } return valorComparacion; } /** * Compara dos perros según su raza. <br> * @param p es el perro contra el que se está comparando - p != null * @return Retorna 0 si los perros tienen la misma raza. <br> * Retorna -1 si el perro p tiene una valor "MAYOR" para la raza. <br> * Retorna 1 si el perro p tiene una valor "MENOR" para la raza. <br> */ public int compararPorRaza( Perro p ) { int valorComparacion = raza.compareToIgnoreCase( p.raza ); if(valorComparacion < 0){ valorComparacion = -1; }else if(valorComparacion == 0){ valorComparacion = 0; }else{ valorComparacion = 1; } return valorComparacion; } /** * Compara dos perros según sus puntos. <br> * @param p El perro contra el que se está comparando - p!= null * @return Retorna 0 si los perros tienen los mismos puntos. <br> * Retorna -1 si el perro p tiene una valor "MAYOR" para puntos . <br> * Retorna 1 si el perro p tiene una valor "MENOR" para los puntos. <br> */ public int compararPorPuntos( Perro p ) { if( puntos == p.puntos ) return 0; else if( puntos > p.puntos ) return 1; else return -1; } /** * Compara dos perros según su edad. <br> * @param p El perro contra el que se está comparando - p!=null * @return Retorna 0 si los perros tienen la misma edad. <br> * Retorna -1 si el perro p tiene una valor "MAYOR" para la edad. <br> * Retorna 1 si el perro p tiene una valor "MENOR" para la edad. <br> */ public int compararPorEdad( Perro p ) { if( edad == p.edad ) return 0; else if( edad > p.edad ) return 1; else return -1; } /** * Retorna una cadena con el nombre del perro * @return La representación del perro en String */ public String toString( ) { return nombre + " (" + raza + ")"; } // ----------------------------------------------------------------- // Invariante // ----------------------------------------------------------------- /** * Verifica el invariante de la clase. <br> * <b>inv: </b> altura > 0 y edad > 0 y imagen != null y nombre != null y raza != null */ private void verificarInvariante( ) { assert ( puntos >= 0 ) : "Los puntos no pueden ser menores a 0"; assert ( edad > 0 ) : "La edad no puede ser 0"; assert ( imagen != null ) : "La imagen no puede ser null"; assert ( nombre != null ) : "El nombre no puede ser null"; assert ( raza != null ) : "La raza no puede ser null"; } }