blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
listlengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
listlengths
1
1
author
stringlengths
0
161
402c5fafb810b594c3a46965238c25df6e1f85fc
0647772ae4eaa3b3b1734bdebced1cc3d9f47502
/app/src/main/java/com/sun/bingo/ui/activity/BingoDetailActivity.java
13f8e05cb3b1b1668c827dce2145250ab8af26f7
[]
no_license
Anomymouse/Bingo
981a3767aa8f7851199046df5fa06d4d7873710d
b49b2e9dc09e871156923754597900dee119cf68
refs/heads/master
2021-01-15T13:11:50.225413
2016-03-07T05:22:40
2016-03-07T05:22:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,712
java
package com.sun.bingo.ui.activity; import android.graphics.Bitmap; import android.os.Build; import android.os.Bundle; import android.support.v7.widget.Toolbar; import android.text.TextUtils; import android.view.KeyEvent; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.webkit.WebChromeClient; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.TextView; import com.sun.bingo.R; import com.sun.bingo.control.NavigateManager; import com.sun.bingo.entity.BingoEntity; import com.sun.bingo.framework.dialog.ToastTip; import butterknife.ButterKnife; import butterknife.Bind; import fr.castorflex.android.smoothprogressbar.SmoothProgressBar; public class BingoDetailActivity extends BaseActivity { @Bind(R.id.toolbar) Toolbar toolbar; @Bind(R.id.webView) WebView webView; @Bind(R.id.smoothProgressBar) SmoothProgressBar smoothProgressBar; @Bind(R.id.tv_error_msg) TextView tvErrorMsg; private BingoEntity bingoEntity; private WebSettings settings; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_bingo_detail); ButterKnife.bind(this); initToolBar(toolbar, true, "加载中..."); initData(); initView(); } private void initData() { bingoEntity = (BingoEntity) getIntent().getSerializableExtra("entity"); if (bingoEntity == null) { ToastTip.show("该作者提交的Bingo有问题"); } } private void initView() { settings = webView.getSettings(); // settings.setJavaScriptEnabled(true); //如果访问的页面中有Javascript,则WebView必须设置支持Javascript settings.setJavaScriptCanOpenWindowsAutomatically(true); settings.setSupportZoom(true); //支持缩放 settings.setBuiltInZoomControls(true); //支持手势缩放 settings.setDisplayZoomControls(false); //是否显示缩放按钮 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null); //启动硬件加速 } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { settings.setLoadsImagesAutomatically(true); //支持自动加载图片 } else { settings.setLoadsImagesAutomatically(false); } settings.setUseWideViewPort(true); //将图片调整到适合WebView的大小 settings.setLoadWithOverviewMode(true); //自适应屏幕 settings.setDomStorageEnabled(true); settings.setAppCacheEnabled(true); settings.setSaveFormData(true); settings.setSupportMultipleWindows(true); settings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); //优先使用缓存 webView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); //可使滚动条不占位 webView.setHorizontalScrollbarOverlay(true); webView.setHorizontalScrollBarEnabled(true); webView.requestFocus(); webView.loadUrl(bingoEntity.getWebsite()); webView.setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { super.onPageStarted(view, url, favicon); smoothProgressBar.setVisibility(View.VISIBLE); } @Override public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); smoothProgressBar.setVisibility(View.GONE); if (!settings.getLoadsImagesAutomatically()) { settings.setLoadsImagesAutomatically(true); } } @Override public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { super.onReceivedError(view, errorCode, description, failingUrl); smoothProgressBar.setVisibility(View.GONE); toolbar.setTitle("加载失败"); if (!TextUtils.isEmpty(description)) { tvErrorMsg.setVisibility(View.VISIBLE); tvErrorMsg.setText("errorCode: " + errorCode + "\ndescription: " + description); } } }); webView.setWebChromeClient(new WebChromeClient() { @Override public void onReceivedTitle(WebView view, String title) { super.onReceivedTitle(view, title); toolbar.setTitle(title); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_bingo_detail, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.item_open_by_explore: NavigateManager.gotoSystemExplore(this, bingoEntity.getWebsite()); return true; default: return super.onOptionsItemSelected(item); } } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK && webView.canGoBack()) { webView.goBack();//返回上一页面 return true; } return super.onKeyDown(keyCode, event); } }
[ "sfsheng0322@gmail.com" ]
sfsheng0322@gmail.com
b1b4d904f44a972f55e1cd2b1d8107f4ed086848
93c0d0e869531c3d2f25c90d0735434b5d7da4e2
/ShagAcademy/PublisherReceiversAnother/TaskManager.java
8e328b517c70201cd8ce06ee392110669ce3fd4c
[]
no_license
antronset/MyJava
8a06f431c0ef2db6313299b3e385f6557d19a39e
1a219b3da2e993d346aa124202f698dd08537f9c
refs/heads/master
2020-07-18T23:04:51.233818
2017-07-01T15:47:10
2017-07-01T15:47:10
94,325,621
0
0
null
null
null
null
UTF-8
Java
false
false
1,097
java
package ShagAcademy.PublisherReceiversAnother; import java.util.ArrayList; import java.util.Random; /** * Created by Антон on 24.06.2017. */ public class TaskManager { private ArrayList<TaskListener> listenersList = new ArrayList<>(); public synchronized void addTaskListener(TaskListener tlist) { listenersList.add(tlist); } public synchronized void removeTaskListener(TaskListener tlist) { listenersList.remove(tlist); } private void notifyTargets(int eventID, String name) { ArrayList<TaskListener> copy; synchronized (this) { copy = (ArrayList<TaskListener>) listenersList.clone(); } TaskData ev = new TaskData(this, name); for (TaskListener temp : copy) { if (eventID == 1) temp.start(ev); else temp.stop(ev); } } public void works() throws InterruptedException { Random rnd = new Random(); Thread.sleep(rnd.nextInt(2000)); notifyTargets(1,""); Thread.sleep(rnd.nextInt(4000)); notifyTargets(2,""); } }
[ "antronset@gmail.com" ]
antronset@gmail.com
dbe72da75c747373e82bba83a2b7a96197513e62
a8e705a01d4429be9bd236cb00cb6701805ec830
/XYZReader/src/main/java/com/example/xyzreader/ui/ArticleListActivity.java
be980f6e41b414a40e2ab89a7dbf8a4a0b562ed5
[]
no_license
saivarunkoyyana/xyz-reader-starter-code-master
0f163a22aa765fe71ad68bc0a4235feb7022913d
465e31af2daa8b60cbc57c051581693c7a2db1c1
refs/heads/master
2020-05-30T09:18:35.883241
2019-05-31T18:40:02
2019-05-31T18:40:02
189,641,813
0
0
null
null
null
null
UTF-8
Java
false
false
7,916
java
package com.example.xyzreader.ui; import android.app.LoaderManager; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.Loader; import android.database.Cursor; import android.os.Bundle; import android.support.v4.widget.SwipeRefreshLayout; import android.support.v7.app.ActionBarActivity; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.StaggeredGridLayoutManager; import android.support.v7.widget.Toolbar; import android.text.Html; import android.text.format.DateUtils; import android.util.Log; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import com.example.xyzreader.R; import com.example.xyzreader.data.ArticleLoader; import com.example.xyzreader.data.ItemsContract; import com.example.xyzreader.data.UpdaterService; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.GregorianCalendar; /** * An activity representing a list of Articles. This activity has different presentations for * handset and tablet-size devices. On handsets, the activity presents a list of items, which when * touched, lead to a {@link ArticleDetailActivity} representing item details. On tablets, the * activity presents a grid of items as cards. */ public class ArticleListActivity extends ActionBarActivity implements LoaderManager.LoaderCallbacks<Cursor> { private static final String TAG = ArticleListActivity.class.toString(); private Toolbar mToolbar; private SwipeRefreshLayout mSwipeRefreshLayout; private RecyclerView mRecyclerView; private SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.sss"); // Use default locale format private SimpleDateFormat outputFormat = new SimpleDateFormat(); // Most time functions can only handle 1902 - 2037 private GregorianCalendar START_OF_EPOCH = new GregorianCalendar(2,1,1); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_article_list); mToolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(mToolbar); /* final View toolbarContainerView = findViewById(R.id.toolbar); setSupportActionBar((Toolbar) toolbarContainerView);*/ mSwipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_refresh_layout); mRecyclerView = (RecyclerView) findViewById(R.id.recycler_view); getLoaderManager().initLoader(0, null, this); if (savedInstanceState == null) { refresh(); } } private void refresh() { startService(new Intent(this, UpdaterService.class)); } @Override protected void onStart() { super.onStart(); registerReceiver(mRefreshingReceiver, new IntentFilter(UpdaterService.BROADCAST_ACTION_STATE_CHANGE)); } @Override protected void onStop() { super.onStop(); unregisterReceiver(mRefreshingReceiver); } private boolean mIsRefreshing = false; private BroadcastReceiver mRefreshingReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if (UpdaterService.BROADCAST_ACTION_STATE_CHANGE.equals(intent.getAction())) { mIsRefreshing = intent.getBooleanExtra(UpdaterService.EXTRA_REFRESHING, false); updateRefreshingUI(); } } }; private void updateRefreshingUI() { mSwipeRefreshLayout.setRefreshing(mIsRefreshing); } @Override public Loader<Cursor> onCreateLoader(int i, Bundle bundle) { return ArticleLoader.newAllArticlesInstance(this); } @Override public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) { Adapter adapter = new Adapter(cursor); adapter.setHasStableIds(true); mRecyclerView.setAdapter(adapter); int columnCount = getResources().getInteger(R.integer.list_column_count); StaggeredGridLayoutManager sglm = new StaggeredGridLayoutManager(columnCount, StaggeredGridLayoutManager.VERTICAL); mRecyclerView.setLayoutManager(sglm); } @Override public void onLoaderReset(Loader<Cursor> loader) { mRecyclerView.setAdapter(null); } private class Adapter extends RecyclerView.Adapter<ViewHolder> { private Cursor mCursor; public Adapter(Cursor cursor) { mCursor = cursor; } @Override public long getItemId(int position) { mCursor.moveToPosition(position); return mCursor.getLong(ArticleLoader.Query._ID); } @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view = getLayoutInflater().inflate(R.layout.list_item_article, parent, false); final ViewHolder vh = new ViewHolder(view); view.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { startActivity(new Intent(Intent.ACTION_VIEW, ItemsContract.Items.buildItemUri(getItemId(vh.getAdapterPosition())))); } }); return vh; } private Date parsePublishedDate() { try { String date = mCursor.getString(ArticleLoader.Query.PUBLISHED_DATE); return dateFormat.parse(date); } catch (ParseException ex) { Log.e(TAG, ex.getMessage()); Log.i(TAG, "passing today's date"); return new Date(); } } @Override public void onBindViewHolder(ViewHolder holder, int position) { mCursor.moveToPosition(position); holder.titleView.setText(mCursor.getString(ArticleLoader.Query.TITLE)); Date publishedDate = parsePublishedDate(); if (!publishedDate.before(START_OF_EPOCH.getTime())) { holder.subtitleView.setText(Html.fromHtml( DateUtils.getRelativeTimeSpanString( publishedDate.getTime(), System.currentTimeMillis(), DateUtils.HOUR_IN_MILLIS, DateUtils.FORMAT_ABBREV_ALL).toString() + "<br/>" + " by " + mCursor.getString(ArticleLoader.Query.AUTHOR))); } else { holder.subtitleView.setText(Html.fromHtml( outputFormat.format(publishedDate) + "<br/>" + " by " + mCursor.getString(ArticleLoader.Query.AUTHOR))); } holder.thumbnailView.setImageUrl( mCursor.getString(ArticleLoader.Query.THUMB_URL), ImageLoaderHelper.getInstance(ArticleListActivity.this).getImageLoader()); holder.thumbnailView.setAspectRatio(mCursor.getFloat(ArticleLoader.Query.ASPECT_RATIO)); } @Override public int getItemCount() { return mCursor.getCount(); } } public static class ViewHolder extends RecyclerView.ViewHolder { public DynamicHeightNetworkImageView thumbnailView; public TextView titleView; public TextView subtitleView; public ViewHolder(View view) { super(view); thumbnailView = (DynamicHeightNetworkImageView) view.findViewById(R.id.thumbnail); titleView = (TextView) view.findViewById(R.id.article_title); subtitleView = (TextView) view.findViewById(R.id.article_subtitle); } } }
[ "sai.varun170598@gmail.com" ]
sai.varun170598@gmail.com
84d45b64f2acf3eac603e613b11ada5db90af40d
ae64bd58b3330689279a6889fb2e514a36a18e1b
/src/thread/Mandelbrot.java
6e8cd309fcb8fac3f14e45f5f8686524c93ce015
[]
no_license
alaurent34/Mandelbrot_Java
fb17cdd03e48f2b7cff68501baec387a14f196e1
056041212e0611ba8911e37cb4e36709f1f523ac
refs/heads/master
2021-06-12T18:23:43.485825
2017-04-23T19:07:14
2017-04-23T19:07:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
961
java
package thread; import java.nio.ByteBuffer; import java.util.concurrent.LinkedBlockingQueue; /** * Thread pour Mandlebrot * @author abrunel * */ public class Mandelbrot extends ThreadFractal implements Runnable{ /** * Constructeur * @param link Liaision entre le thread et la classe mere * @param width Largeur du thread * @param height Hauteur du thread * @param iter_max Iteration maximale * @param x_min X minimum * @param x_max X maximun * @param y_min Y minimum * @param y_max Y maximun * @param nbThreads Nombre de thread * @param idThread Id du thread */ public Mandelbrot(LinkedBlockingQueue<ByteBuffer> link, int width, int height, double iter_max, double x_min, double x_max, double y_min, double y_max,int nbThreads,int idThread) { super(link, width, height, iter_max, x_min, x_max, y_min, y_max,nbThreads,idThread); } /** * Lancement du thread */ public void run() { super.mandlebrotCalcul(); } }
[ "antoine@famille-laurent" ]
antoine@famille-laurent
667bace44e3114cf21bca1daea2e070c69bc6d7e
b1d596a918d77dc5fe3718d943b0d651b8cf2494
/Salon-HairDressing/src/main/java/com/cas/sim/CardShuffleControl.java
ea58c6d7e7c6befcbe7181b7e26f688a5c54b22e
[ "BSD-3-Clause" ]
permissive
Knjlexus/circuit
63293ffe1a67c8d2a498aaa820e653684241ca6c
ec01c35279cdf527819495b86a50c236cbb300c5
refs/heads/master
2021-05-19T23:39:55.235660
2020-04-01T06:19:42
2020-04-01T06:19:42
252,087,876
0
0
BSD-3-Clause
2020-04-01T06:12:16
2020-04-01T06:12:16
null
UTF-8
Java
false
false
1,280
java
package com.cas.sim; import java.util.function.Consumer; import com.jme3.math.FastMath; import com.jme3.math.Vector3f; import com.jme3.renderer.RenderManager; import com.jme3.renderer.ViewPort; import com.jme3.scene.control.AbstractControl; public class CardShuffleControl extends AbstractControl { private float rotated; private float speed = 4; private Vector3f dist; private float wait; private Consumer<Void> finish; public CardShuffleControl(Vector3f dist, Consumer<Void> finish) { this.dist = dist; this.finish = finish; } @Override protected void controlUpdate(float tpf) { if (rotated < FastMath.PI) { tpf += tpf * speed; if (FastMath.PI - rotated > tpf) { spatial.rotate(0, 0, tpf); } else { spatial.rotate(0, 0, FastMath.PI - rotated); } rotated += tpf; } else { if (wait > 1) { if (spatial.getLocalTranslation().distance(dist) > .1f) { Vector3f v = FastMath.extrapolateLinear(tpf * speed, spatial.getLocalTranslation(), dist); spatial.setLocalTranslation(v); } else { spatial.removeControl(this); if(finish != null) { finish.accept(null); } } } else { wait += tpf; } } } @Override protected void controlRender(RenderManager rm, ViewPort vp) { } }
[ "sco_pra@126.com" ]
sco_pra@126.com
11dd995f3481e9c0d1ad2459e32f9c7d24fe838c
d968e22f1757576dc82c16a5a920e7657b78c6bb
/src/messages/OmissionDefense/AccusationMessage.java
448872923d52fee4464ba8b385b9a1ba923b5407
[ "BSD-2-Clause" ]
permissive
alibov/StreamAid
1723b57eca34e54d0c6da3dfe9d5bb8163ce297a
169d9be831b274ac2e5932f380fbf6b27a28df03
refs/heads/master
2021-01-23T12:22:35.552030
2015-11-19T16:07:26
2015-11-19T16:07:26
41,051,257
4
0
null
null
null
null
UTF-8
Java
false
false
975
java
package messages.OmissionDefense; import messages.Message; import entites.DNVP.DNVPAuthorizationApproval; import experiment.frameworks.NodeAddress; public class AccusationMessage extends Message { private static final long serialVersionUID = 7306198281455982993L; public NodeAddress blamedNode; public DNVPAuthorizationApproval approval; public AccusationMessage(final String tag, final NodeAddress sourceId, final NodeAddress destID, final NodeAddress blamedNode, final DNVPAuthorizationApproval approval) { super(tag, sourceId, destID); this.blamedNode = blamedNode; this.approval = approval; } @Override protected String getContents() { return "Blamed node: " + blamedNode.toString() + " " + approval.toString(); } @Override public boolean isOverheadMessage() { return true; } @Override public long getSimulatedSize() { return super.getSimulatedSize() + NodeAddress.SIZE + approval.getSimulatedSize(); } }
[ "alibov@cs.technion.ac.il" ]
alibov@cs.technion.ac.il
a9de373efd6c5e0c4d942777c33d0dc6210533ca
5b4ddddc30d785d39a50c6fee46109d3f7faf3e5
/lesson_12_euclidean/src/lesson_12_euclidean/GCDcalculation.java
75b5a632999b7b8ea59fb13c2954be218e9c589f
[]
no_license
MeidanNasi/Codility
5c36065f99f162558d217a74da9dd67212814270
20f99a213fb89ce19498dbcda789cd6bdb596747
refs/heads/master
2020-11-26T12:39:07.269535
2019-12-19T14:44:13
2019-12-19T14:44:13
229,073,621
0
0
null
null
null
null
UTF-8
Java
false
false
173
java
package lesson_12_euclidean; public class GCDcalculation { public int gcd(int N, int M) { if (N % M == 0) { return M; } else { return gcd(M, N % M); } } }
[ "meidanasi94@gmail.com" ]
meidanasi94@gmail.com
d31af642d06fead78ed54751bd142db46ed46685
c1b1894938856233e897482d631c007b14128c3d
/src/Komunikaty.java
9266d8ba43cb5fa2e0cefe19e603cf862b6cfd72
[ "MIT" ]
permissive
gchilczuk/kik_java
9c60246606e941ff11cd1dc322460b7d60ad8b48
92fc4e176cd31f8725d8376ab6e201e9d270c29f
refs/heads/master
2021-01-10T11:16:56.820865
2016-03-01T13:44:18
2016-03-01T13:44:18
50,947,697
1
3
null
2016-02-13T21:39:39
2016-02-02T19:56:48
Java
UTF-8
Java
false
false
1,656
java
/** * Moduł zawierający Komunikaty do gry */ public class Komunikaty { public Komunikaty() {} /** * Zwraca komunikat o tym kto wygrał * @param kto -1 - kółko, 1 - krzyżyk, 0 - remis * @return komunikat o zwycięzcy */ public String wygrana(int kto){ String wynik; switch (kto){ case -1: wynik = "Wygrało KÓŁKO. Gratulacje!"; break; case 1: wynik = "Wygrał KRZYŻYK. Gratulacje!"; break; case 0: wynik = "REMIS!"; break; default: throw new NullPointerException("Nieprawidłowa wartość gracza wygrywającego"); } return wynik; } /** DUŻE PYTANIE: CZY -1 i 1 PRZYPISANE MAJĄ BYĆ NA STAŁE DO KÓŁKA I KRZYŻYKA * CZY DO Gracz1 i Gracz2, którzy mogą zamieniać się znakami */ /** * Komunikat o tym kto teraz wykonuje ruch * @param kto -1 kółko, 1 krzyżyk, 0 komputer (AI) * @return komunikat o tym kto ma wykonać ruch */ public String twojRuch(int kto){ String ruch; switch (kto){ case -1: ruch = "Ruch gracza O"; break; case 1: ruch = "Ruch gracza X"; break; case 0: ruch = "Ruch wykonuje komputer"; break; default: throw new NullPointerException("Nieprawidłowa wartość gracza"); } return ruch; } //public static String infoRuch(int kto, int k, int w) }
[ "chilczukg@gmail.com" ]
chilczukg@gmail.com
2319e6f11ba50ad00614218ce890cea90bf0bb33
2aceb2ac1329bc132a45e212e5f2744655686855
/src/day33_CustomClass/ExtractChars.java
b75a3fa2d7e3287580b644c24a801c60ed8c397f
[]
no_license
Gannusi/Spring2020_JavaPractice
730708cf41f8ade620394b9c33359dff8dd02b9f
8812e3597fa28ac2c150e92712b77237638c2041
refs/heads/master
2022-11-10T22:16:13.447967
2020-06-22T20:03:26
2020-06-22T20:03:26
257,789,141
0
0
null
null
null
null
UTF-8
Java
false
false
1,278
java
package day33_CustomClass; import com.sun.tools.javac.util.Log; import java.util.ArrayList; public class ExtractChars { /* 1. create an ArrayList of string called country names 2. write a program that can remove all the country names that have length of 10 or greater 4. write a program that can extract the sepecial characters, digits and alphebets from a string and stores them into seperate ArrayLists of Character: ex: str = "ABCD123$%#@&456EFG!"; list1: {$, %, #, @, &, !} list2: {A, B, C, D, E, F, G} list3: {1, 2, 3, 4, 5, 6} */ public static void main(String[] args) { String str = "ABCD123$%#@&456EFG!"; char[] arr= str.toCharArray(); ArrayList<Character> letters = new ArrayList<>(); ArrayList<Character> digits = new ArrayList<>(); ArrayList<Character> specialChars = new ArrayList<>(); for(char each:arr){ if(Character.isLetter(each)){ letters.add(each); }else if(Character.isDigit(each)){ digits.add(each); }else { specialChars.add(each); } } System.out.println(letters); System.out.println(digits); System.out.println(specialChars); } }
[ "mega.anya22@gmail.com" ]
mega.anya22@gmail.com
f47132e10b77b240ce0f39ffb4a81ffa700f83fc
ddad0f5dc82be49494ad558c6990d88cbfce5d44
/spring/gdcp_spring_jdbc/src/main/java/cn/gdcp/test/JdbcTemplateCRUDTest.java
9e1853a4db7e432d45cd893a1024139c9823b590
[]
no_license
lcz-sys/javaProject
f234558fae4885d4a8f3a992a37e65193638bb0b
c4891a485b35ee378f51ebb03b94269ac7b1aca1
refs/heads/master
2023-04-10T05:42:24.725486
2021-04-17T07:25:24
2021-04-17T07:25:24
358,810,404
1
0
null
null
null
null
UTF-8
Java
false
false
2,462
java
package cn.gdcp.test; import cn.gdcp.config.SpringConfig; import cn.gdcp.domain.Account; import com.alibaba.druid.pool.DruidPooledResultSet; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.jdbc.core.BeanPropertyRowMapper; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import javax.annotation.Resource; import java.sql.ResultSet; import java.util.List; @RunWith(SpringJUnit4ClassRunner.class) //@ContextConfiguration("classpath:applicationContext.xml") @ContextConfiguration(classes = {SpringConfig.class}) public class JdbcTemplateCRUDTest { @Resource(name = "jdbcTemplate") private JdbcTemplate jdbcTemplate; @Test public void test(){ String sql = "update account set balance = balance + 50000 where id = ?"; int count = jdbcTemplate.update(sql, 6); if(count>0){ System.out.println("修改成功"); }else{ System.out.println("修改失败"); } } @Test public void test2(){ String sql = "delete from account where balance < ?"; int count = jdbcTemplate.update(sql, 5000); if(count>0){ System.out.println("删除成功"); }else{ System.out.println("删除失败"); } } @Test public void test3(){ String sql = "insert into account values(null,?,?)"; int count = jdbcTemplate.update(sql, "libai",10000000); if(count>0){ System.out.println("插入成功"); }else{ System.out.println("插入失败"); } } @Test public void test4(){ String sql = "select * from account"; List<Account> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper<Account>(Account.class)); for(Account account:list){ System.out.println(account); } } @Test public void test5(){ String sql = "select * from account where id = ?"; Account account = jdbcTemplate.queryForObject(sql, new BeanPropertyRowMapper<Account>(Account.class), 16); System.out.println(account); } @Test public void test6(){ String sql = "select count(*) from account"; Long count = jdbcTemplate.queryForObject(sql, Long.class); System.out.println(count); } }
[ "212065370@qq.com" ]
212065370@qq.com
d2dd611d3dd1fa3fdc82d8afc00340a46eae235d
b219bda20c42bcd17d5c4a51fe8c1e286dd64b24
/src/com/edutilos/main1/Person.java
357b28dd2b46acc62c911009d9b27fc3649e5526
[]
no_license
edutilos6666/SpringApplication1
f4f0ffcf50560e5616c68e7ed1e28a2c826d22c7
2f1e9742a2baa3875c3533b2d83c40130ed7369d
refs/heads/master
2021-01-19T01:22:42.311052
2017-04-04T22:36:21
2017-04-04T22:36:21
87,241,371
0
0
null
null
null
null
UTF-8
Java
false
false
1,006
java
package com.edutilos.main1; /** * Created by edutilos on 04/04/2017. */ public class Person { private String first; private String last; private Address address; public Person(String first, String last, Address address) { this.first = first; this.last = last; this.address = address; } public Person() { } public String getFirst() { return first; } public void setFirst(String first) { this.first = first; } public String getLast() { return last; } public void setLast(String last) { this.last = last; } public Address getAddress() { return address; } public void setAddress(Address address) { this.address = address; } @Override public String toString() { return "Person{" + "first='" + first + '\'' + ", last='" + last + '\'' + ", address=" + address + '}'; } }
[ "edutilosaghayev@gmail.com" ]
edutilosaghayev@gmail.com
1c4132eef36e2d907e5d5bbb3033d62326845a94
4fb74dfd806154aec72da5e98da307ade648a1f7
/src/main/java/studio/akim/restaurantvoting/util/exception/NotFoundException.java
b867d037ed25d5597c188f8e3d5a28f7438bab1e
[]
no_license
AnDongMeng/topjava20grad
45d264a97d7d44a815c3fa73918d1bbe6a2804f6
40de97f04f059c4c9a052470bbfb7f6839f3bec7
refs/heads/master
2022-12-24T07:36:56.457096
2020-09-27T15:24:58
2020-09-27T16:15:10
294,479,256
0
0
null
null
null
null
UTF-8
Java
false
false
208
java
package studio.akim.restaurantvoting.util.exception; public class NotFoundException extends RuntimeException { public NotFoundException(String msgCode) { super("Not found " + msgCode); } }
[ "akimdmv@gmail.com" ]
akimdmv@gmail.com
a09c929a22a0ec0fdf149d1e55c01da3281efd83
e55d283d8e85424f1f203a9cfe9d65c60dbb95b1
/app/src/main/java/com/examafdila/nurafdila/MainActivity.java
215940d548a5ffee966ebba4b1c7e10c7d02afe4
[]
no_license
nrafdilapebriyani/nurafdila
fb52ae05095b618231562c6fbe21b82e3dd46dcd
3f6d45325d2dc55613e7515d23cbfd1dfdcfd387
refs/heads/master
2023-06-13T00:46:42.006188
2021-07-04T14:05:25
2021-07-04T14:05:25
382,866,666
0
0
null
null
null
null
UTF-8
Java
false
false
796
java
package com.examafdila.nurafdila; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; import android.view.View; import android.widget.Button; import android.view.View.OnClickListener; import android.content.Intent; public class MainActivity extends AppCompatActivity { Button login; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); login= (Button)findViewById(R.id.Login); login.setOnClickListener(v -> { intent intent1 = new intent(getApplicationContext(),MenuUtama,class); startActivity(intent1); }); } }
[ "nrafdilafebri29@gmailcom" ]
nrafdilafebri29@gmailcom
0556e128ccc9db246b223abd38e373b3f54703c7
ff3e333da610ba00eb1732307a6afd1b82b7e50a
/sdks/java/http_client/v1/src/main/java/org/openapitools/client/api/AgentsV1Api.java
a208f4e82ae1507912a3cdc7308859a6452f0380
[ "Apache-2.0" ]
permissive
wenxinax/polyaxon
a5580ad9d164b0b2b3cfd619abeb522146b2093d
6c56ee31e223351cbe3a0f55997c76a246accadd
refs/heads/master
2022-10-09T09:35:27.865746
2020-06-11T11:22:41
2020-06-11T11:22:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
84,609
java
// Copyright 2018-2020 Polyaxon, Inc. // // 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. /* * Polyaxon SDKs and REST API specification. * Polyaxon SDKs and REST API specification. * * The version of the OpenAPI document: 1.0.96 * Contact: contact@polyaxon.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ package org.openapitools.client.api; import org.openapitools.client.ApiCallback; import org.openapitools.client.ApiClient; import org.openapitools.client.ApiException; import org.openapitools.client.ApiResponse; import org.openapitools.client.Configuration; import org.openapitools.client.Pair; import org.openapitools.client.ProgressRequestBody; import org.openapitools.client.ProgressResponseBody; import com.google.gson.reflect.TypeToken; import java.io.IOException; import org.openapitools.client.model.RuntimeError; import org.openapitools.client.model.V1Agent; import org.openapitools.client.model.V1AgentStateResponse; import org.openapitools.client.model.V1AgentStatusBodyRequest; import org.openapitools.client.model.V1ListAgentsResponse; import org.openapitools.client.model.V1Status; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class AgentsV1Api { private ApiClient localVarApiClient; public AgentsV1Api() { this(Configuration.getDefaultApiClient()); } public AgentsV1Api(ApiClient apiClient) { this.localVarApiClient = apiClient; } public ApiClient getApiClient() { return localVarApiClient; } public void setApiClient(ApiClient apiClient) { this.localVarApiClient = apiClient; } /** * Build call for createAgent * @param owner Owner of the namespace (required) * @param body Agent body (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> A successful response. </td><td> - </td></tr> <tr><td> 204 </td><td> No content. </td><td> - </td></tr> <tr><td> 403 </td><td> You don&#39;t have permission to access the resource. </td><td> - </td></tr> <tr><td> 404 </td><td> Resource does not exist. </td><td> - </td></tr> <tr><td> 0 </td><td> An unexpected error response </td><td> - </td></tr> </table> */ public okhttp3.Call createAgentCall(String owner, V1Agent body, final ApiCallback _callback) throws ApiException { Object localVarPostBody = body; // create path and map variables String localVarPath = "/api/v1/orgs/{owner}/agents" .replaceAll("\\{" + "owner" + "\\}", localVarApiClient.escapeString(owner.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { "application/json" }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); String[] localVarAuthNames = new String[] { "ApiKey" }; return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call createAgentValidateBeforeCall(String owner, V1Agent body, final ApiCallback _callback) throws ApiException { // verify the required parameter 'owner' is set if (owner == null) { throw new ApiException("Missing the required parameter 'owner' when calling createAgent(Async)"); } // verify the required parameter 'body' is set if (body == null) { throw new ApiException("Missing the required parameter 'body' when calling createAgent(Async)"); } okhttp3.Call localVarCall = createAgentCall(owner, body, _callback); return localVarCall; } /** * Create agent * * @param owner Owner of the namespace (required) * @param body Agent body (required) * @return V1Agent * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> A successful response. </td><td> - </td></tr> <tr><td> 204 </td><td> No content. </td><td> - </td></tr> <tr><td> 403 </td><td> You don&#39;t have permission to access the resource. </td><td> - </td></tr> <tr><td> 404 </td><td> Resource does not exist. </td><td> - </td></tr> <tr><td> 0 </td><td> An unexpected error response </td><td> - </td></tr> </table> */ public V1Agent createAgent(String owner, V1Agent body) throws ApiException { ApiResponse<V1Agent> localVarResp = createAgentWithHttpInfo(owner, body); return localVarResp.getData(); } /** * Create agent * * @param owner Owner of the namespace (required) * @param body Agent body (required) * @return ApiResponse&lt;V1Agent&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> A successful response. </td><td> - </td></tr> <tr><td> 204 </td><td> No content. </td><td> - </td></tr> <tr><td> 403 </td><td> You don&#39;t have permission to access the resource. </td><td> - </td></tr> <tr><td> 404 </td><td> Resource does not exist. </td><td> - </td></tr> <tr><td> 0 </td><td> An unexpected error response </td><td> - </td></tr> </table> */ public ApiResponse<V1Agent> createAgentWithHttpInfo(String owner, V1Agent body) throws ApiException { okhttp3.Call localVarCall = createAgentValidateBeforeCall(owner, body, null); Type localVarReturnType = new TypeToken<V1Agent>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * Create agent (asynchronously) * * @param owner Owner of the namespace (required) * @param body Agent body (required) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> A successful response. </td><td> - </td></tr> <tr><td> 204 </td><td> No content. </td><td> - </td></tr> <tr><td> 403 </td><td> You don&#39;t have permission to access the resource. </td><td> - </td></tr> <tr><td> 404 </td><td> Resource does not exist. </td><td> - </td></tr> <tr><td> 0 </td><td> An unexpected error response </td><td> - </td></tr> </table> */ public okhttp3.Call createAgentAsync(String owner, V1Agent body, final ApiCallback<V1Agent> _callback) throws ApiException { okhttp3.Call localVarCall = createAgentValidateBeforeCall(owner, body, _callback); Type localVarReturnType = new TypeToken<V1Agent>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for createAgentStatus * @param owner Owner of the namespace (required) * @param uuid Uuid identifier of the entity (required) * @param body (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> A successful response. </td><td> - </td></tr> <tr><td> 204 </td><td> No content. </td><td> - </td></tr> <tr><td> 403 </td><td> You don&#39;t have permission to access the resource. </td><td> - </td></tr> <tr><td> 404 </td><td> Resource does not exist. </td><td> - </td></tr> <tr><td> 0 </td><td> An unexpected error response </td><td> - </td></tr> </table> */ public okhttp3.Call createAgentStatusCall(String owner, String uuid, V1AgentStatusBodyRequest body, final ApiCallback _callback) throws ApiException { Object localVarPostBody = body; // create path and map variables String localVarPath = "/api/v1/orgs/{owner}/agents/{uuid}/statuses" .replaceAll("\\{" + "owner" + "\\}", localVarApiClient.escapeString(owner.toString())) .replaceAll("\\{" + "uuid" + "\\}", localVarApiClient.escapeString(uuid.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { "application/json" }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); String[] localVarAuthNames = new String[] { "ApiKey" }; return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call createAgentStatusValidateBeforeCall(String owner, String uuid, V1AgentStatusBodyRequest body, final ApiCallback _callback) throws ApiException { // verify the required parameter 'owner' is set if (owner == null) { throw new ApiException("Missing the required parameter 'owner' when calling createAgentStatus(Async)"); } // verify the required parameter 'uuid' is set if (uuid == null) { throw new ApiException("Missing the required parameter 'uuid' when calling createAgentStatus(Async)"); } // verify the required parameter 'body' is set if (body == null) { throw new ApiException("Missing the required parameter 'body' when calling createAgentStatus(Async)"); } okhttp3.Call localVarCall = createAgentStatusCall(owner, uuid, body, _callback); return localVarCall; } /** * Create new run status * * @param owner Owner of the namespace (required) * @param uuid Uuid identifier of the entity (required) * @param body (required) * @return V1Status * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> A successful response. </td><td> - </td></tr> <tr><td> 204 </td><td> No content. </td><td> - </td></tr> <tr><td> 403 </td><td> You don&#39;t have permission to access the resource. </td><td> - </td></tr> <tr><td> 404 </td><td> Resource does not exist. </td><td> - </td></tr> <tr><td> 0 </td><td> An unexpected error response </td><td> - </td></tr> </table> */ public V1Status createAgentStatus(String owner, String uuid, V1AgentStatusBodyRequest body) throws ApiException { ApiResponse<V1Status> localVarResp = createAgentStatusWithHttpInfo(owner, uuid, body); return localVarResp.getData(); } /** * Create new run status * * @param owner Owner of the namespace (required) * @param uuid Uuid identifier of the entity (required) * @param body (required) * @return ApiResponse&lt;V1Status&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> A successful response. </td><td> - </td></tr> <tr><td> 204 </td><td> No content. </td><td> - </td></tr> <tr><td> 403 </td><td> You don&#39;t have permission to access the resource. </td><td> - </td></tr> <tr><td> 404 </td><td> Resource does not exist. </td><td> - </td></tr> <tr><td> 0 </td><td> An unexpected error response </td><td> - </td></tr> </table> */ public ApiResponse<V1Status> createAgentStatusWithHttpInfo(String owner, String uuid, V1AgentStatusBodyRequest body) throws ApiException { okhttp3.Call localVarCall = createAgentStatusValidateBeforeCall(owner, uuid, body, null); Type localVarReturnType = new TypeToken<V1Status>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * Create new run status (asynchronously) * * @param owner Owner of the namespace (required) * @param uuid Uuid identifier of the entity (required) * @param body (required) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> A successful response. </td><td> - </td></tr> <tr><td> 204 </td><td> No content. </td><td> - </td></tr> <tr><td> 403 </td><td> You don&#39;t have permission to access the resource. </td><td> - </td></tr> <tr><td> 404 </td><td> Resource does not exist. </td><td> - </td></tr> <tr><td> 0 </td><td> An unexpected error response </td><td> - </td></tr> </table> */ public okhttp3.Call createAgentStatusAsync(String owner, String uuid, V1AgentStatusBodyRequest body, final ApiCallback<V1Status> _callback) throws ApiException { okhttp3.Call localVarCall = createAgentStatusValidateBeforeCall(owner, uuid, body, _callback); Type localVarReturnType = new TypeToken<V1Status>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for deleteAgent * @param owner Owner of the namespace (required) * @param uuid Uuid identifier of the entity (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> A successful response. </td><td> - </td></tr> <tr><td> 204 </td><td> No content. </td><td> - </td></tr> <tr><td> 403 </td><td> You don&#39;t have permission to access the resource. </td><td> - </td></tr> <tr><td> 404 </td><td> Resource does not exist. </td><td> - </td></tr> <tr><td> 0 </td><td> An unexpected error response </td><td> - </td></tr> </table> */ public okhttp3.Call deleteAgentCall(String owner, String uuid, final ApiCallback _callback) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/api/v1/orgs/{owner}/agents/{uuid}" .replaceAll("\\{" + "owner" + "\\}", localVarApiClient.escapeString(owner.toString())) .replaceAll("\\{" + "uuid" + "\\}", localVarApiClient.escapeString(uuid.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); String[] localVarAuthNames = new String[] { "ApiKey" }; return localVarApiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call deleteAgentValidateBeforeCall(String owner, String uuid, final ApiCallback _callback) throws ApiException { // verify the required parameter 'owner' is set if (owner == null) { throw new ApiException("Missing the required parameter 'owner' when calling deleteAgent(Async)"); } // verify the required parameter 'uuid' is set if (uuid == null) { throw new ApiException("Missing the required parameter 'uuid' when calling deleteAgent(Async)"); } okhttp3.Call localVarCall = deleteAgentCall(owner, uuid, _callback); return localVarCall; } /** * Delete agent * * @param owner Owner of the namespace (required) * @param uuid Uuid identifier of the entity (required) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> A successful response. </td><td> - </td></tr> <tr><td> 204 </td><td> No content. </td><td> - </td></tr> <tr><td> 403 </td><td> You don&#39;t have permission to access the resource. </td><td> - </td></tr> <tr><td> 404 </td><td> Resource does not exist. </td><td> - </td></tr> <tr><td> 0 </td><td> An unexpected error response </td><td> - </td></tr> </table> */ public void deleteAgent(String owner, String uuid) throws ApiException { deleteAgentWithHttpInfo(owner, uuid); } /** * Delete agent * * @param owner Owner of the namespace (required) * @param uuid Uuid identifier of the entity (required) * @return ApiResponse&lt;Void&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> A successful response. </td><td> - </td></tr> <tr><td> 204 </td><td> No content. </td><td> - </td></tr> <tr><td> 403 </td><td> You don&#39;t have permission to access the resource. </td><td> - </td></tr> <tr><td> 404 </td><td> Resource does not exist. </td><td> - </td></tr> <tr><td> 0 </td><td> An unexpected error response </td><td> - </td></tr> </table> */ public ApiResponse<Void> deleteAgentWithHttpInfo(String owner, String uuid) throws ApiException { okhttp3.Call localVarCall = deleteAgentValidateBeforeCall(owner, uuid, null); return localVarApiClient.execute(localVarCall); } /** * Delete agent (asynchronously) * * @param owner Owner of the namespace (required) * @param uuid Uuid identifier of the entity (required) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> A successful response. </td><td> - </td></tr> <tr><td> 204 </td><td> No content. </td><td> - </td></tr> <tr><td> 403 </td><td> You don&#39;t have permission to access the resource. </td><td> - </td></tr> <tr><td> 404 </td><td> Resource does not exist. </td><td> - </td></tr> <tr><td> 0 </td><td> An unexpected error response </td><td> - </td></tr> </table> */ public okhttp3.Call deleteAgentAsync(String owner, String uuid, final ApiCallback<Void> _callback) throws ApiException { okhttp3.Call localVarCall = deleteAgentValidateBeforeCall(owner, uuid, _callback); localVarApiClient.executeAsync(localVarCall, _callback); return localVarCall; } /** * Build call for getAgent * @param owner Owner of the namespace (required) * @param uuid Uuid identifier of the entity (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> A successful response. </td><td> - </td></tr> <tr><td> 204 </td><td> No content. </td><td> - </td></tr> <tr><td> 403 </td><td> You don&#39;t have permission to access the resource. </td><td> - </td></tr> <tr><td> 404 </td><td> Resource does not exist. </td><td> - </td></tr> <tr><td> 0 </td><td> An unexpected error response </td><td> - </td></tr> </table> */ public okhttp3.Call getAgentCall(String owner, String uuid, final ApiCallback _callback) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/api/v1/orgs/{owner}/agents/{uuid}" .replaceAll("\\{" + "owner" + "\\}", localVarApiClient.escapeString(owner.toString())) .replaceAll("\\{" + "uuid" + "\\}", localVarApiClient.escapeString(uuid.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); String[] localVarAuthNames = new String[] { "ApiKey" }; return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call getAgentValidateBeforeCall(String owner, String uuid, final ApiCallback _callback) throws ApiException { // verify the required parameter 'owner' is set if (owner == null) { throw new ApiException("Missing the required parameter 'owner' when calling getAgent(Async)"); } // verify the required parameter 'uuid' is set if (uuid == null) { throw new ApiException("Missing the required parameter 'uuid' when calling getAgent(Async)"); } okhttp3.Call localVarCall = getAgentCall(owner, uuid, _callback); return localVarCall; } /** * Get agent * * @param owner Owner of the namespace (required) * @param uuid Uuid identifier of the entity (required) * @return V1Agent * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> A successful response. </td><td> - </td></tr> <tr><td> 204 </td><td> No content. </td><td> - </td></tr> <tr><td> 403 </td><td> You don&#39;t have permission to access the resource. </td><td> - </td></tr> <tr><td> 404 </td><td> Resource does not exist. </td><td> - </td></tr> <tr><td> 0 </td><td> An unexpected error response </td><td> - </td></tr> </table> */ public V1Agent getAgent(String owner, String uuid) throws ApiException { ApiResponse<V1Agent> localVarResp = getAgentWithHttpInfo(owner, uuid); return localVarResp.getData(); } /** * Get agent * * @param owner Owner of the namespace (required) * @param uuid Uuid identifier of the entity (required) * @return ApiResponse&lt;V1Agent&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> A successful response. </td><td> - </td></tr> <tr><td> 204 </td><td> No content. </td><td> - </td></tr> <tr><td> 403 </td><td> You don&#39;t have permission to access the resource. </td><td> - </td></tr> <tr><td> 404 </td><td> Resource does not exist. </td><td> - </td></tr> <tr><td> 0 </td><td> An unexpected error response </td><td> - </td></tr> </table> */ public ApiResponse<V1Agent> getAgentWithHttpInfo(String owner, String uuid) throws ApiException { okhttp3.Call localVarCall = getAgentValidateBeforeCall(owner, uuid, null); Type localVarReturnType = new TypeToken<V1Agent>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * Get agent (asynchronously) * * @param owner Owner of the namespace (required) * @param uuid Uuid identifier of the entity (required) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> A successful response. </td><td> - </td></tr> <tr><td> 204 </td><td> No content. </td><td> - </td></tr> <tr><td> 403 </td><td> You don&#39;t have permission to access the resource. </td><td> - </td></tr> <tr><td> 404 </td><td> Resource does not exist. </td><td> - </td></tr> <tr><td> 0 </td><td> An unexpected error response </td><td> - </td></tr> </table> */ public okhttp3.Call getAgentAsync(String owner, String uuid, final ApiCallback<V1Agent> _callback) throws ApiException { okhttp3.Call localVarCall = getAgentValidateBeforeCall(owner, uuid, _callback); Type localVarReturnType = new TypeToken<V1Agent>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for getAgentState * @param owner Owner of the namespace (required) * @param uuid Uuid identifier of the entity (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> A successful response. </td><td> - </td></tr> <tr><td> 204 </td><td> No content. </td><td> - </td></tr> <tr><td> 403 </td><td> You don&#39;t have permission to access the resource. </td><td> - </td></tr> <tr><td> 404 </td><td> Resource does not exist. </td><td> - </td></tr> <tr><td> 0 </td><td> An unexpected error response </td><td> - </td></tr> </table> */ public okhttp3.Call getAgentStateCall(String owner, String uuid, final ApiCallback _callback) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/api/v1/orgs/{owner}/agents/{uuid}/state" .replaceAll("\\{" + "owner" + "\\}", localVarApiClient.escapeString(owner.toString())) .replaceAll("\\{" + "uuid" + "\\}", localVarApiClient.escapeString(uuid.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); String[] localVarAuthNames = new String[] { "ApiKey" }; return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call getAgentStateValidateBeforeCall(String owner, String uuid, final ApiCallback _callback) throws ApiException { // verify the required parameter 'owner' is set if (owner == null) { throw new ApiException("Missing the required parameter 'owner' when calling getAgentState(Async)"); } // verify the required parameter 'uuid' is set if (uuid == null) { throw new ApiException("Missing the required parameter 'uuid' when calling getAgentState(Async)"); } okhttp3.Call localVarCall = getAgentStateCall(owner, uuid, _callback); return localVarCall; } /** * Get State (queues/runs) * * @param owner Owner of the namespace (required) * @param uuid Uuid identifier of the entity (required) * @return V1AgentStateResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> A successful response. </td><td> - </td></tr> <tr><td> 204 </td><td> No content. </td><td> - </td></tr> <tr><td> 403 </td><td> You don&#39;t have permission to access the resource. </td><td> - </td></tr> <tr><td> 404 </td><td> Resource does not exist. </td><td> - </td></tr> <tr><td> 0 </td><td> An unexpected error response </td><td> - </td></tr> </table> */ public V1AgentStateResponse getAgentState(String owner, String uuid) throws ApiException { ApiResponse<V1AgentStateResponse> localVarResp = getAgentStateWithHttpInfo(owner, uuid); return localVarResp.getData(); } /** * Get State (queues/runs) * * @param owner Owner of the namespace (required) * @param uuid Uuid identifier of the entity (required) * @return ApiResponse&lt;V1AgentStateResponse&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> A successful response. </td><td> - </td></tr> <tr><td> 204 </td><td> No content. </td><td> - </td></tr> <tr><td> 403 </td><td> You don&#39;t have permission to access the resource. </td><td> - </td></tr> <tr><td> 404 </td><td> Resource does not exist. </td><td> - </td></tr> <tr><td> 0 </td><td> An unexpected error response </td><td> - </td></tr> </table> */ public ApiResponse<V1AgentStateResponse> getAgentStateWithHttpInfo(String owner, String uuid) throws ApiException { okhttp3.Call localVarCall = getAgentStateValidateBeforeCall(owner, uuid, null); Type localVarReturnType = new TypeToken<V1AgentStateResponse>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * Get State (queues/runs) (asynchronously) * * @param owner Owner of the namespace (required) * @param uuid Uuid identifier of the entity (required) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> A successful response. </td><td> - </td></tr> <tr><td> 204 </td><td> No content. </td><td> - </td></tr> <tr><td> 403 </td><td> You don&#39;t have permission to access the resource. </td><td> - </td></tr> <tr><td> 404 </td><td> Resource does not exist. </td><td> - </td></tr> <tr><td> 0 </td><td> An unexpected error response </td><td> - </td></tr> </table> */ public okhttp3.Call getAgentStateAsync(String owner, String uuid, final ApiCallback<V1AgentStateResponse> _callback) throws ApiException { okhttp3.Call localVarCall = getAgentStateValidateBeforeCall(owner, uuid, _callback); Type localVarReturnType = new TypeToken<V1AgentStateResponse>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for getAgentStatuses * @param owner Owner of the namespace (required) * @param uuid Uuid identifier of the entity (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> A successful response. </td><td> - </td></tr> <tr><td> 204 </td><td> No content. </td><td> - </td></tr> <tr><td> 403 </td><td> You don&#39;t have permission to access the resource. </td><td> - </td></tr> <tr><td> 404 </td><td> Resource does not exist. </td><td> - </td></tr> <tr><td> 0 </td><td> An unexpected error response </td><td> - </td></tr> </table> */ public okhttp3.Call getAgentStatusesCall(String owner, String uuid, final ApiCallback _callback) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/api/v1/orgs/{owner}/agents/{uuid}/statuses" .replaceAll("\\{" + "owner" + "\\}", localVarApiClient.escapeString(owner.toString())) .replaceAll("\\{" + "uuid" + "\\}", localVarApiClient.escapeString(uuid.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); String[] localVarAuthNames = new String[] { "ApiKey" }; return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call getAgentStatusesValidateBeforeCall(String owner, String uuid, final ApiCallback _callback) throws ApiException { // verify the required parameter 'owner' is set if (owner == null) { throw new ApiException("Missing the required parameter 'owner' when calling getAgentStatuses(Async)"); } // verify the required parameter 'uuid' is set if (uuid == null) { throw new ApiException("Missing the required parameter 'uuid' when calling getAgentStatuses(Async)"); } okhttp3.Call localVarCall = getAgentStatusesCall(owner, uuid, _callback); return localVarCall; } /** * Get agent status * * @param owner Owner of the namespace (required) * @param uuid Uuid identifier of the entity (required) * @return V1Status * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> A successful response. </td><td> - </td></tr> <tr><td> 204 </td><td> No content. </td><td> - </td></tr> <tr><td> 403 </td><td> You don&#39;t have permission to access the resource. </td><td> - </td></tr> <tr><td> 404 </td><td> Resource does not exist. </td><td> - </td></tr> <tr><td> 0 </td><td> An unexpected error response </td><td> - </td></tr> </table> */ public V1Status getAgentStatuses(String owner, String uuid) throws ApiException { ApiResponse<V1Status> localVarResp = getAgentStatusesWithHttpInfo(owner, uuid); return localVarResp.getData(); } /** * Get agent status * * @param owner Owner of the namespace (required) * @param uuid Uuid identifier of the entity (required) * @return ApiResponse&lt;V1Status&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> A successful response. </td><td> - </td></tr> <tr><td> 204 </td><td> No content. </td><td> - </td></tr> <tr><td> 403 </td><td> You don&#39;t have permission to access the resource. </td><td> - </td></tr> <tr><td> 404 </td><td> Resource does not exist. </td><td> - </td></tr> <tr><td> 0 </td><td> An unexpected error response </td><td> - </td></tr> </table> */ public ApiResponse<V1Status> getAgentStatusesWithHttpInfo(String owner, String uuid) throws ApiException { okhttp3.Call localVarCall = getAgentStatusesValidateBeforeCall(owner, uuid, null); Type localVarReturnType = new TypeToken<V1Status>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * Get agent status (asynchronously) * * @param owner Owner of the namespace (required) * @param uuid Uuid identifier of the entity (required) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> A successful response. </td><td> - </td></tr> <tr><td> 204 </td><td> No content. </td><td> - </td></tr> <tr><td> 403 </td><td> You don&#39;t have permission to access the resource. </td><td> - </td></tr> <tr><td> 404 </td><td> Resource does not exist. </td><td> - </td></tr> <tr><td> 0 </td><td> An unexpected error response </td><td> - </td></tr> </table> */ public okhttp3.Call getAgentStatusesAsync(String owner, String uuid, final ApiCallback<V1Status> _callback) throws ApiException { okhttp3.Call localVarCall = getAgentStatusesValidateBeforeCall(owner, uuid, _callback); Type localVarReturnType = new TypeToken<V1Status>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for listAgentNames * @param owner Owner of the namespace (required) * @param offset Pagination offset. (optional) * @param limit Limit size. (optional) * @param sort Sort to order the search. (optional) * @param query Query filter the search search. (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> A successful response. </td><td> - </td></tr> <tr><td> 204 </td><td> No content. </td><td> - </td></tr> <tr><td> 403 </td><td> You don&#39;t have permission to access the resource. </td><td> - </td></tr> <tr><td> 404 </td><td> Resource does not exist. </td><td> - </td></tr> <tr><td> 0 </td><td> An unexpected error response </td><td> - </td></tr> </table> */ public okhttp3.Call listAgentNamesCall(String owner, Integer offset, Integer limit, String sort, String query, final ApiCallback _callback) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/api/v1/orgs/{owner}/agents/names" .replaceAll("\\{" + "owner" + "\\}", localVarApiClient.escapeString(owner.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); if (offset != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); } if (limit != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); } if (sort != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("sort", sort)); } if (query != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("query", query)); } Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); String[] localVarAuthNames = new String[] { "ApiKey" }; return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call listAgentNamesValidateBeforeCall(String owner, Integer offset, Integer limit, String sort, String query, final ApiCallback _callback) throws ApiException { // verify the required parameter 'owner' is set if (owner == null) { throw new ApiException("Missing the required parameter 'owner' when calling listAgentNames(Async)"); } okhttp3.Call localVarCall = listAgentNamesCall(owner, offset, limit, sort, query, _callback); return localVarCall; } /** * List agents names * * @param owner Owner of the namespace (required) * @param offset Pagination offset. (optional) * @param limit Limit size. (optional) * @param sort Sort to order the search. (optional) * @param query Query filter the search search. (optional) * @return V1ListAgentsResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> A successful response. </td><td> - </td></tr> <tr><td> 204 </td><td> No content. </td><td> - </td></tr> <tr><td> 403 </td><td> You don&#39;t have permission to access the resource. </td><td> - </td></tr> <tr><td> 404 </td><td> Resource does not exist. </td><td> - </td></tr> <tr><td> 0 </td><td> An unexpected error response </td><td> - </td></tr> </table> */ public V1ListAgentsResponse listAgentNames(String owner, Integer offset, Integer limit, String sort, String query) throws ApiException { ApiResponse<V1ListAgentsResponse> localVarResp = listAgentNamesWithHttpInfo(owner, offset, limit, sort, query); return localVarResp.getData(); } /** * List agents names * * @param owner Owner of the namespace (required) * @param offset Pagination offset. (optional) * @param limit Limit size. (optional) * @param sort Sort to order the search. (optional) * @param query Query filter the search search. (optional) * @return ApiResponse&lt;V1ListAgentsResponse&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> A successful response. </td><td> - </td></tr> <tr><td> 204 </td><td> No content. </td><td> - </td></tr> <tr><td> 403 </td><td> You don&#39;t have permission to access the resource. </td><td> - </td></tr> <tr><td> 404 </td><td> Resource does not exist. </td><td> - </td></tr> <tr><td> 0 </td><td> An unexpected error response </td><td> - </td></tr> </table> */ public ApiResponse<V1ListAgentsResponse> listAgentNamesWithHttpInfo(String owner, Integer offset, Integer limit, String sort, String query) throws ApiException { okhttp3.Call localVarCall = listAgentNamesValidateBeforeCall(owner, offset, limit, sort, query, null); Type localVarReturnType = new TypeToken<V1ListAgentsResponse>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * List agents names (asynchronously) * * @param owner Owner of the namespace (required) * @param offset Pagination offset. (optional) * @param limit Limit size. (optional) * @param sort Sort to order the search. (optional) * @param query Query filter the search search. (optional) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> A successful response. </td><td> - </td></tr> <tr><td> 204 </td><td> No content. </td><td> - </td></tr> <tr><td> 403 </td><td> You don&#39;t have permission to access the resource. </td><td> - </td></tr> <tr><td> 404 </td><td> Resource does not exist. </td><td> - </td></tr> <tr><td> 0 </td><td> An unexpected error response </td><td> - </td></tr> </table> */ public okhttp3.Call listAgentNamesAsync(String owner, Integer offset, Integer limit, String sort, String query, final ApiCallback<V1ListAgentsResponse> _callback) throws ApiException { okhttp3.Call localVarCall = listAgentNamesValidateBeforeCall(owner, offset, limit, sort, query, _callback); Type localVarReturnType = new TypeToken<V1ListAgentsResponse>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for listAgents * @param owner Owner of the namespace (required) * @param offset Pagination offset. (optional) * @param limit Limit size. (optional) * @param sort Sort to order the search. (optional) * @param query Query filter the search search. (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> A successful response. </td><td> - </td></tr> <tr><td> 204 </td><td> No content. </td><td> - </td></tr> <tr><td> 403 </td><td> You don&#39;t have permission to access the resource. </td><td> - </td></tr> <tr><td> 404 </td><td> Resource does not exist. </td><td> - </td></tr> <tr><td> 0 </td><td> An unexpected error response </td><td> - </td></tr> </table> */ public okhttp3.Call listAgentsCall(String owner, Integer offset, Integer limit, String sort, String query, final ApiCallback _callback) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/api/v1/orgs/{owner}/agents" .replaceAll("\\{" + "owner" + "\\}", localVarApiClient.escapeString(owner.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); if (offset != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); } if (limit != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); } if (sort != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("sort", sort)); } if (query != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("query", query)); } Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); String[] localVarAuthNames = new String[] { "ApiKey" }; return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call listAgentsValidateBeforeCall(String owner, Integer offset, Integer limit, String sort, String query, final ApiCallback _callback) throws ApiException { // verify the required parameter 'owner' is set if (owner == null) { throw new ApiException("Missing the required parameter 'owner' when calling listAgents(Async)"); } okhttp3.Call localVarCall = listAgentsCall(owner, offset, limit, sort, query, _callback); return localVarCall; } /** * List agents * * @param owner Owner of the namespace (required) * @param offset Pagination offset. (optional) * @param limit Limit size. (optional) * @param sort Sort to order the search. (optional) * @param query Query filter the search search. (optional) * @return V1ListAgentsResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> A successful response. </td><td> - </td></tr> <tr><td> 204 </td><td> No content. </td><td> - </td></tr> <tr><td> 403 </td><td> You don&#39;t have permission to access the resource. </td><td> - </td></tr> <tr><td> 404 </td><td> Resource does not exist. </td><td> - </td></tr> <tr><td> 0 </td><td> An unexpected error response </td><td> - </td></tr> </table> */ public V1ListAgentsResponse listAgents(String owner, Integer offset, Integer limit, String sort, String query) throws ApiException { ApiResponse<V1ListAgentsResponse> localVarResp = listAgentsWithHttpInfo(owner, offset, limit, sort, query); return localVarResp.getData(); } /** * List agents * * @param owner Owner of the namespace (required) * @param offset Pagination offset. (optional) * @param limit Limit size. (optional) * @param sort Sort to order the search. (optional) * @param query Query filter the search search. (optional) * @return ApiResponse&lt;V1ListAgentsResponse&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> A successful response. </td><td> - </td></tr> <tr><td> 204 </td><td> No content. </td><td> - </td></tr> <tr><td> 403 </td><td> You don&#39;t have permission to access the resource. </td><td> - </td></tr> <tr><td> 404 </td><td> Resource does not exist. </td><td> - </td></tr> <tr><td> 0 </td><td> An unexpected error response </td><td> - </td></tr> </table> */ public ApiResponse<V1ListAgentsResponse> listAgentsWithHttpInfo(String owner, Integer offset, Integer limit, String sort, String query) throws ApiException { okhttp3.Call localVarCall = listAgentsValidateBeforeCall(owner, offset, limit, sort, query, null); Type localVarReturnType = new TypeToken<V1ListAgentsResponse>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * List agents (asynchronously) * * @param owner Owner of the namespace (required) * @param offset Pagination offset. (optional) * @param limit Limit size. (optional) * @param sort Sort to order the search. (optional) * @param query Query filter the search search. (optional) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> A successful response. </td><td> - </td></tr> <tr><td> 204 </td><td> No content. </td><td> - </td></tr> <tr><td> 403 </td><td> You don&#39;t have permission to access the resource. </td><td> - </td></tr> <tr><td> 404 </td><td> Resource does not exist. </td><td> - </td></tr> <tr><td> 0 </td><td> An unexpected error response </td><td> - </td></tr> </table> */ public okhttp3.Call listAgentsAsync(String owner, Integer offset, Integer limit, String sort, String query, final ApiCallback<V1ListAgentsResponse> _callback) throws ApiException { okhttp3.Call localVarCall = listAgentsValidateBeforeCall(owner, offset, limit, sort, query, _callback); Type localVarReturnType = new TypeToken<V1ListAgentsResponse>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for patchAgent * @param owner Owner of the namespace (required) * @param agentUuid UUID (required) * @param body Agent body (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> A successful response. </td><td> - </td></tr> <tr><td> 204 </td><td> No content. </td><td> - </td></tr> <tr><td> 403 </td><td> You don&#39;t have permission to access the resource. </td><td> - </td></tr> <tr><td> 404 </td><td> Resource does not exist. </td><td> - </td></tr> <tr><td> 0 </td><td> An unexpected error response </td><td> - </td></tr> </table> */ public okhttp3.Call patchAgentCall(String owner, String agentUuid, V1Agent body, final ApiCallback _callback) throws ApiException { Object localVarPostBody = body; // create path and map variables String localVarPath = "/api/v1/orgs/{owner}/agents/{agent.uuid}" .replaceAll("\\{" + "owner" + "\\}", localVarApiClient.escapeString(owner.toString())) .replaceAll("\\{" + "agent.uuid" + "\\}", localVarApiClient.escapeString(agentUuid.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { "application/json" }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); String[] localVarAuthNames = new String[] { "ApiKey" }; return localVarApiClient.buildCall(localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call patchAgentValidateBeforeCall(String owner, String agentUuid, V1Agent body, final ApiCallback _callback) throws ApiException { // verify the required parameter 'owner' is set if (owner == null) { throw new ApiException("Missing the required parameter 'owner' when calling patchAgent(Async)"); } // verify the required parameter 'agentUuid' is set if (agentUuid == null) { throw new ApiException("Missing the required parameter 'agentUuid' when calling patchAgent(Async)"); } // verify the required parameter 'body' is set if (body == null) { throw new ApiException("Missing the required parameter 'body' when calling patchAgent(Async)"); } okhttp3.Call localVarCall = patchAgentCall(owner, agentUuid, body, _callback); return localVarCall; } /** * Patch agent * * @param owner Owner of the namespace (required) * @param agentUuid UUID (required) * @param body Agent body (required) * @return V1Agent * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> A successful response. </td><td> - </td></tr> <tr><td> 204 </td><td> No content. </td><td> - </td></tr> <tr><td> 403 </td><td> You don&#39;t have permission to access the resource. </td><td> - </td></tr> <tr><td> 404 </td><td> Resource does not exist. </td><td> - </td></tr> <tr><td> 0 </td><td> An unexpected error response </td><td> - </td></tr> </table> */ public V1Agent patchAgent(String owner, String agentUuid, V1Agent body) throws ApiException { ApiResponse<V1Agent> localVarResp = patchAgentWithHttpInfo(owner, agentUuid, body); return localVarResp.getData(); } /** * Patch agent * * @param owner Owner of the namespace (required) * @param agentUuid UUID (required) * @param body Agent body (required) * @return ApiResponse&lt;V1Agent&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> A successful response. </td><td> - </td></tr> <tr><td> 204 </td><td> No content. </td><td> - </td></tr> <tr><td> 403 </td><td> You don&#39;t have permission to access the resource. </td><td> - </td></tr> <tr><td> 404 </td><td> Resource does not exist. </td><td> - </td></tr> <tr><td> 0 </td><td> An unexpected error response </td><td> - </td></tr> </table> */ public ApiResponse<V1Agent> patchAgentWithHttpInfo(String owner, String agentUuid, V1Agent body) throws ApiException { okhttp3.Call localVarCall = patchAgentValidateBeforeCall(owner, agentUuid, body, null); Type localVarReturnType = new TypeToken<V1Agent>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * Patch agent (asynchronously) * * @param owner Owner of the namespace (required) * @param agentUuid UUID (required) * @param body Agent body (required) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> A successful response. </td><td> - </td></tr> <tr><td> 204 </td><td> No content. </td><td> - </td></tr> <tr><td> 403 </td><td> You don&#39;t have permission to access the resource. </td><td> - </td></tr> <tr><td> 404 </td><td> Resource does not exist. </td><td> - </td></tr> <tr><td> 0 </td><td> An unexpected error response </td><td> - </td></tr> </table> */ public okhttp3.Call patchAgentAsync(String owner, String agentUuid, V1Agent body, final ApiCallback<V1Agent> _callback) throws ApiException { okhttp3.Call localVarCall = patchAgentValidateBeforeCall(owner, agentUuid, body, _callback); Type localVarReturnType = new TypeToken<V1Agent>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for syncAgent * @param owner Owner of the namespace (required) * @param agentUuid UUID (required) * @param body Agent body (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> A successful response. </td><td> - </td></tr> <tr><td> 204 </td><td> No content. </td><td> - </td></tr> <tr><td> 403 </td><td> You don&#39;t have permission to access the resource. </td><td> - </td></tr> <tr><td> 404 </td><td> Resource does not exist. </td><td> - </td></tr> <tr><td> 0 </td><td> An unexpected error response </td><td> - </td></tr> </table> */ public okhttp3.Call syncAgentCall(String owner, String agentUuid, V1Agent body, final ApiCallback _callback) throws ApiException { Object localVarPostBody = body; // create path and map variables String localVarPath = "/api/v1/orgs/{owner}/agents/{agent.uuid}/sync" .replaceAll("\\{" + "owner" + "\\}", localVarApiClient.escapeString(owner.toString())) .replaceAll("\\{" + "agent.uuid" + "\\}", localVarApiClient.escapeString(agentUuid.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { "application/json" }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); String[] localVarAuthNames = new String[] { "ApiKey" }; return localVarApiClient.buildCall(localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call syncAgentValidateBeforeCall(String owner, String agentUuid, V1Agent body, final ApiCallback _callback) throws ApiException { // verify the required parameter 'owner' is set if (owner == null) { throw new ApiException("Missing the required parameter 'owner' when calling syncAgent(Async)"); } // verify the required parameter 'agentUuid' is set if (agentUuid == null) { throw new ApiException("Missing the required parameter 'agentUuid' when calling syncAgent(Async)"); } // verify the required parameter 'body' is set if (body == null) { throw new ApiException("Missing the required parameter 'body' when calling syncAgent(Async)"); } okhttp3.Call localVarCall = syncAgentCall(owner, agentUuid, body, _callback); return localVarCall; } /** * Sync agent * * @param owner Owner of the namespace (required) * @param agentUuid UUID (required) * @param body Agent body (required) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> A successful response. </td><td> - </td></tr> <tr><td> 204 </td><td> No content. </td><td> - </td></tr> <tr><td> 403 </td><td> You don&#39;t have permission to access the resource. </td><td> - </td></tr> <tr><td> 404 </td><td> Resource does not exist. </td><td> - </td></tr> <tr><td> 0 </td><td> An unexpected error response </td><td> - </td></tr> </table> */ public void syncAgent(String owner, String agentUuid, V1Agent body) throws ApiException { syncAgentWithHttpInfo(owner, agentUuid, body); } /** * Sync agent * * @param owner Owner of the namespace (required) * @param agentUuid UUID (required) * @param body Agent body (required) * @return ApiResponse&lt;Void&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> A successful response. </td><td> - </td></tr> <tr><td> 204 </td><td> No content. </td><td> - </td></tr> <tr><td> 403 </td><td> You don&#39;t have permission to access the resource. </td><td> - </td></tr> <tr><td> 404 </td><td> Resource does not exist. </td><td> - </td></tr> <tr><td> 0 </td><td> An unexpected error response </td><td> - </td></tr> </table> */ public ApiResponse<Void> syncAgentWithHttpInfo(String owner, String agentUuid, V1Agent body) throws ApiException { okhttp3.Call localVarCall = syncAgentValidateBeforeCall(owner, agentUuid, body, null); return localVarApiClient.execute(localVarCall); } /** * Sync agent (asynchronously) * * @param owner Owner of the namespace (required) * @param agentUuid UUID (required) * @param body Agent body (required) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> A successful response. </td><td> - </td></tr> <tr><td> 204 </td><td> No content. </td><td> - </td></tr> <tr><td> 403 </td><td> You don&#39;t have permission to access the resource. </td><td> - </td></tr> <tr><td> 404 </td><td> Resource does not exist. </td><td> - </td></tr> <tr><td> 0 </td><td> An unexpected error response </td><td> - </td></tr> </table> */ public okhttp3.Call syncAgentAsync(String owner, String agentUuid, V1Agent body, final ApiCallback<Void> _callback) throws ApiException { okhttp3.Call localVarCall = syncAgentValidateBeforeCall(owner, agentUuid, body, _callback); localVarApiClient.executeAsync(localVarCall, _callback); return localVarCall; } /** * Build call for updateAgent * @param owner Owner of the namespace (required) * @param agentUuid UUID (required) * @param body Agent body (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> A successful response. </td><td> - </td></tr> <tr><td> 204 </td><td> No content. </td><td> - </td></tr> <tr><td> 403 </td><td> You don&#39;t have permission to access the resource. </td><td> - </td></tr> <tr><td> 404 </td><td> Resource does not exist. </td><td> - </td></tr> <tr><td> 0 </td><td> An unexpected error response </td><td> - </td></tr> </table> */ public okhttp3.Call updateAgentCall(String owner, String agentUuid, V1Agent body, final ApiCallback _callback) throws ApiException { Object localVarPostBody = body; // create path and map variables String localVarPath = "/api/v1/orgs/{owner}/agents/{agent.uuid}" .replaceAll("\\{" + "owner" + "\\}", localVarApiClient.escapeString(owner.toString())) .replaceAll("\\{" + "agent.uuid" + "\\}", localVarApiClient.escapeString(agentUuid.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { "application/json" }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); String[] localVarAuthNames = new String[] { "ApiKey" }; return localVarApiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call updateAgentValidateBeforeCall(String owner, String agentUuid, V1Agent body, final ApiCallback _callback) throws ApiException { // verify the required parameter 'owner' is set if (owner == null) { throw new ApiException("Missing the required parameter 'owner' when calling updateAgent(Async)"); } // verify the required parameter 'agentUuid' is set if (agentUuid == null) { throw new ApiException("Missing the required parameter 'agentUuid' when calling updateAgent(Async)"); } // verify the required parameter 'body' is set if (body == null) { throw new ApiException("Missing the required parameter 'body' when calling updateAgent(Async)"); } okhttp3.Call localVarCall = updateAgentCall(owner, agentUuid, body, _callback); return localVarCall; } /** * Update agent * * @param owner Owner of the namespace (required) * @param agentUuid UUID (required) * @param body Agent body (required) * @return V1Agent * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> A successful response. </td><td> - </td></tr> <tr><td> 204 </td><td> No content. </td><td> - </td></tr> <tr><td> 403 </td><td> You don&#39;t have permission to access the resource. </td><td> - </td></tr> <tr><td> 404 </td><td> Resource does not exist. </td><td> - </td></tr> <tr><td> 0 </td><td> An unexpected error response </td><td> - </td></tr> </table> */ public V1Agent updateAgent(String owner, String agentUuid, V1Agent body) throws ApiException { ApiResponse<V1Agent> localVarResp = updateAgentWithHttpInfo(owner, agentUuid, body); return localVarResp.getData(); } /** * Update agent * * @param owner Owner of the namespace (required) * @param agentUuid UUID (required) * @param body Agent body (required) * @return ApiResponse&lt;V1Agent&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> A successful response. </td><td> - </td></tr> <tr><td> 204 </td><td> No content. </td><td> - </td></tr> <tr><td> 403 </td><td> You don&#39;t have permission to access the resource. </td><td> - </td></tr> <tr><td> 404 </td><td> Resource does not exist. </td><td> - </td></tr> <tr><td> 0 </td><td> An unexpected error response </td><td> - </td></tr> </table> */ public ApiResponse<V1Agent> updateAgentWithHttpInfo(String owner, String agentUuid, V1Agent body) throws ApiException { okhttp3.Call localVarCall = updateAgentValidateBeforeCall(owner, agentUuid, body, null); Type localVarReturnType = new TypeToken<V1Agent>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * Update agent (asynchronously) * * @param owner Owner of the namespace (required) * @param agentUuid UUID (required) * @param body Agent body (required) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> A successful response. </td><td> - </td></tr> <tr><td> 204 </td><td> No content. </td><td> - </td></tr> <tr><td> 403 </td><td> You don&#39;t have permission to access the resource. </td><td> - </td></tr> <tr><td> 404 </td><td> Resource does not exist. </td><td> - </td></tr> <tr><td> 0 </td><td> An unexpected error response </td><td> - </td></tr> </table> */ public okhttp3.Call updateAgentAsync(String owner, String agentUuid, V1Agent body, final ApiCallback<V1Agent> _callback) throws ApiException { okhttp3.Call localVarCall = updateAgentValidateBeforeCall(owner, agentUuid, body, _callback); Type localVarReturnType = new TypeToken<V1Agent>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } }
[ "mouradmourafiq@gmail.com" ]
mouradmourafiq@gmail.com
0419007b0da10169b6a4503d6405f2bbd9f62697
58633310f922850adf08213cc92458d0015549f4
/java/dip/ApplyingWatermark.java
b174af54172d692c54f801f03de177c0441541a5
[]
no_license
vsuns/opencv4_java_tutorial
45cb6f1e52f738faa67ecbd9ce58706b7ad42a93
ac3e16295c818742f022fa6616d65a989cf06741
refs/heads/master
2020-05-29T14:31:27.426773
2018-12-17T05:00:38
2018-12-17T05:00:38
189,197,948
1
0
null
2019-05-29T09:50:52
2019-05-29T09:50:51
null
UTF-8
Java
false
false
766
java
package dip; import org.opencv.core.Core; import org.opencv.core.Mat; import org.opencv.core.Point; import org.opencv.core.Scalar; import org.opencv.imgcodecs.Imgcodecs; import org.opencv.imgproc.Imgproc; import org.scijava.nativelib.NativeLoader; import java.io.IOException; public class ApplyingWatermark { public static void main(String[] args) throws IOException { NativeLoader.loadLibrary(Core.NATIVE_LIBRARY_NAME); Mat source = Imgcodecs.imread("data/dip/digital_image_processing.jpg", Imgcodecs.CV_LOAD_IMAGE_COLOR); Imgproc.putText(source, "dip.hellonico.info", new Point(source.rows() / 2, source.cols() / 2), Imgproc.FONT_ITALIC, new Double(1), new Scalar(255)); Imgcodecs.imwrite("watermarked.jpg", source); } }
[ "nico@karabiner-software.com" ]
nico@karabiner-software.com
ec3abbdbceae9d02821342ca824062e2c5ef7980
6b2e1f5fdd3668b32c471ff872f03f043b18d5f7
/mutants/dataset/lcs_length/11755/LCS_LENGTH.java
cd3176cddeb0c4089199d3f28333ec5bb09220b4
[]
no_license
mou23/Impact-of-Similarity-on-Repairing-Small-Programs
87e58676348f1b55666171128ecced3571979d44
6704d78b2bc9c103d97bcf55ecd5c12810ba2851
refs/heads/master
2023-03-25T10:42:17.464870
2021-03-20T04:55:17
2021-03-20T04:55:17
233,513,246
0
0
null
null
null
null
UTF-8
Java
false
false
1,954
java
package buggy_java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class LCS_LENGTH { public static Integer lcs_length(String s, String t) { // make a Counter // pair? no! just hashtable to a hashtable.. woo.. currying Map<Integer, Map<Integer,Integer>> dp = new HashMap<Integer,Map<Integer,Integer>>(); // just set all the internal maps to 0 for (int i=0; i < s.length(); i++) { Map<Integer,Integer> initialize = new HashMap<Integer,Integer>(); dp.put(i, initialize); for (int j=0; j < t.length(); j++) { Map<Integer,Integer> internal_map = dp.get(i); internal_map.put(j,0); dp.put(i, internal_map); } } // now the actual code for (int i=0; i < s.length(); i++) { for (int j=0; j < t.length(); j++) { if (s.charAt(i) == t.charAt(j)) { if (dp.containsKey(i-1)) { Map<Integer, Integer> internal_map = dp.get(i); int insert_value = dp.get(i-1).get(j) + 1; internal_map.put(j, insert_value); dp.put(i,internal_map); } else { Map<Integer, Integer> internal_map = dp.get(i); internal_map.put(j,1); dp.put(i,internal_map); } } } } if (!dp.isEmpty()) { List<Integer> ret_list = new ArrayList<Integer>(); for (int i=0; i<s.length(); i++) { ret_list.add(!dp.get(i).isEmpty() ? String.max(dp.get(i).values()) : 0); } return Collections.max(ret_list); } else { return 0; } } }
[ "bsse0731@iit.du.ac.bd" ]
bsse0731@iit.du.ac.bd
ba7ca92305bf37d549a72da40c3e6593460a4501
b964771ee6e7003f0e17ff8321a48836f7a7e20e
/src/main/java/com/github/EPIICTHUNDERCAT/TameableMobs/mobs/TameableSilverfish.java
53eaba46d56772c93a4a8fed21b68df58ee4a980
[ "MIT" ]
permissive
EPIICTHUNDERCAT/TameableMobs
7c21792b279ffb7cff5d6a79b2c818c6beeaceea
50ab00b1d021e44fc2ed9772e79754a0efa5a407
refs/heads/master
2020-06-15T17:56:27.828835
2017-05-15T05:24:34
2017-05-15T05:24:34
75,273,598
0
0
null
null
null
null
UTF-8
Java
false
false
36,373
java
package com.github.epiicthundercat.tameablemobs.mobs; import java.util.Random; import java.util.UUID; import javax.annotation.Nullable; import com.github.epiicthundercat.tameablemobs.init.TMItems; import com.google.common.base.Function; import com.google.common.base.Optional; import net.minecraft.block.Block; import net.minecraft.block.BlockSilverfish; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityAgeable; import net.minecraft.entity.EntityCreature; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EnumCreatureAttribute; import net.minecraft.entity.IEntityOwnable; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.EntityAIAttackMelee; import net.minecraft.entity.ai.EntityAIBase; import net.minecraft.entity.ai.EntityAIFollowParent; import net.minecraft.entity.ai.EntityAIHurtByTarget; import net.minecraft.entity.ai.EntityAINearestAttackableTarget; import net.minecraft.entity.ai.EntityAISwimming; import net.minecraft.entity.ai.EntityAITarget; import net.minecraft.entity.ai.EntityAIWander; import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.monster.EntityGhast; import net.minecraft.entity.passive.EntityAnimal; import net.minecraft.entity.passive.EntityHorse; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.init.SoundEvents; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.datasync.DataParameter; import net.minecraft.network.datasync.DataSerializers; import net.minecraft.network.datasync.EntityDataManager; import net.minecraft.pathfinding.Path; import net.minecraft.pathfinding.PathNavigate; import net.minecraft.pathfinding.PathNavigateGround; import net.minecraft.pathfinding.PathNodeType; import net.minecraft.server.management.PreYggdrasilConverter; import net.minecraft.util.DamageSource; import net.minecraft.util.EntityDamageSource; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; import net.minecraft.util.datafix.DataFixer; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; import net.minecraft.world.EnumDifficulty; import net.minecraft.world.World; import net.minecraft.world.storage.loot.LootTableList; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class TameableSilverfish extends EntityAnimal implements IEntityOwnable { private static final DataParameter<Float> DATA_HEALTH_ID = EntityDataManager .<Float>createKey(TameableSilverfish.class, DataSerializers.FLOAT); private static final DataParameter<Boolean> BEGGING = EntityDataManager.<Boolean>createKey(TameableSilverfish.class, DataSerializers.BOOLEAN); protected static final DataParameter<Byte> TAMED = EntityDataManager.<Byte>createKey(TameableSilverfish.class, DataSerializers.BYTE); protected static final DataParameter<Optional<UUID>> OWNER_UNIQUE_ID = EntityDataManager .<Optional<UUID>>createKey(TameableSilverfish.class, DataSerializers.OPTIONAL_UNIQUE_ID); protected EntityAISit aiSit; public TameableSilverfish(World worldIn) { super(worldIn); setTamed(false); this.setSize(0.4F, 0.3F); } @Override protected void initEntityAI() { this.summonSilverfish = new TameableSilverfish.AISummonSilverfish(this); this.tasks.addTask(1, new EntityAISwimming(this)); this.tasks.addTask(3, this.summonSilverfish); tasks.addTask(4, new EntityAIAttackMelee(this, 1.0D, false)); tasks.addTask(5, new TameableSilverfish.AIHideInStone(this)); targetTasks.addTask(1, new EntityAIHurtByTarget(this, true, new Class[0])); targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true)); tasks.addTask(4, new EntityAIFollowParent(this, 1.1D)); aiSit = new TameableSilverfish.EntityAISit(this); tasks.addTask(1, aiSit); tasks.addTask(5, new EntityAIFollowOwner(this, 2.0D, 5.0F, 2.0F)); tasks.addTask(2, new TameableSilverfish.AIMeleeAttack(this, 1.0D, false)); tasks.addTask(8, new TameableSilverfish.EntityAIBeg(this, 8.0F)); targetTasks.addTask(1, new EntityAIOwnerHurtByTarget(this)); targetTasks.addTask(2, new EntityAIOwnerHurtByTarget(this)); targetTasks.addTask(3, new TameableSilverfish.AIFindPlayer(this)); targetTasks.addTask(4, new EntityAIHurtByTarget(this, false, new Class[0])); } @Override protected void applyEntityAttributes() { super.applyEntityAttributes(); getAttributeMap().registerAttribute(SharedMonsterAttributes.ATTACK_DAMAGE); if (isTamed()) { getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(20.0D); getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.4D); getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(60.0D); } else { getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(8.0D); getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(1.0D); this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.25D); } getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).setBaseValue(64.0D); } @Override protected void entityInit() { super.entityInit(); dataManager.register(TAMED, Byte.valueOf((byte) 0)); dataManager.register(OWNER_UNIQUE_ID, Optional.<UUID>absent()); dataManager.register(DATA_HEALTH_ID, Float.valueOf(getHealth())); dataManager.register(BEGGING, Boolean.valueOf(false)); } @Override public boolean isBreedingItem(@Nullable ItemStack stack) { return stack == null ? false : stack.getItem() == Items.IRON_INGOT; } private boolean shouldAttackPlayer(EntityPlayer player) { return false; } @Override public void writeEntityToNBT(NBTTagCompound compound) { super.writeEntityToNBT(compound); if (getOwnerId() == null) { compound.setString("OwnerUUID", ""); } else { compound.setString("OwnerUUID", getOwnerId().toString()); } compound.setBoolean("Sitting", isSitting()); } @Override public void readEntityFromNBT(NBTTagCompound compound) { super.readEntityFromNBT(compound); String s; if (compound.hasKey("OwnerUUID", 8)) { s = compound.getString("OwnerUUID"); } else { String s1 = compound.getString("Owner"); s = PreYggdrasilConverter.convertMobOwnerIfNeeded(getServer(), s1); } if (!s.isEmpty()) { try { setOwnerId(UUID.fromString(s)); setTamed(true); } catch (Throwable var4) { setTamed(false); } } if (aiSit != null) { aiSit.setSitting(compound.getBoolean("Sitting")); } setSitting(compound.getBoolean("Sitting")); } @Override public boolean canBeLeashedTo(EntityPlayer player) { return isTamed() && isOwner(player); } @Override public boolean processInteract(EntityPlayer player, EnumHand hand, @Nullable ItemStack stack) { if (isTamed()) { if (stack != null) { if (stack.getItem() == Items.IRON_INGOT) { if (dataManager.get(DATA_HEALTH_ID).floatValue() < 60.0F) { if (!player.capabilities.isCreativeMode) { --stack.stackSize; } heal(20.0F); return true; } } if (this.isOwner(player) && !this.worldObj.isRemote && !this.isBreedingItem(stack)) { this.aiSit.setSitting(!this.isSitting()); this.isJumping = false; this.navigator.clearPathEntity(); this.setAttackTarget((EntityLivingBase) null); } } else { if (isOwner(player) && !worldObj.isRemote) { aiSit.setSitting(!isSitting()); isJumping = false; navigator.clearPathEntity(); setAttackTarget((EntityLivingBase) null); } } } else if (stack != null && stack.getItem() == Items.IRON_INGOT) { if (!player.capabilities.isCreativeMode) { --stack.stackSize; } if (!worldObj.isRemote) { if (rand.nextInt(5) == 0) { setTamed(true); navigator.clearPathEntity(); setAttackTarget((EntityLivingBase) null); // aiSit.setSitting(true); setHealth(60.0F); setOwnerId(player.getUniqueID()); playTameEffect(true); worldObj.setEntityState(this, (byte) 7); } else { playTameEffect(false); worldObj.setEntityState(this, (byte) 6); } } return true; } return super.processInteract(player, hand, stack); } public boolean isTamed() { return (dataManager.get(TAMED).byteValue() & 4) != 0; } public void setTamed(boolean tamed) { byte b0 = dataManager.get(TAMED).byteValue(); if (tamed) { dataManager.set(TAMED, Byte.valueOf((byte) (b0 | 4))); getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(60.0D); } else { dataManager.set(TAMED, Byte.valueOf((byte) (b0 & -5))); getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(8.0D); } // getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(16.0D); } public boolean isSitting() { return (dataManager.get(TAMED).byteValue() & 1) != 0; } public void setSitting(boolean sitting) { byte b0 = dataManager.get(TAMED).byteValue(); if (sitting) { dataManager.set(TAMED, Byte.valueOf((byte) (b0 | 1))); } else { dataManager.set(TAMED, Byte.valueOf((byte) (b0 & -2))); } } public boolean isBegging() { return ((Boolean) this.dataManager.get(BEGGING)).booleanValue(); } public void setBegging(boolean beg) { this.dataManager.set(BEGGING, Boolean.valueOf(beg)); } @Override public int getMaxSpawnedInChunk() { return 8; } public boolean canMateWith(EntityAnimal otherAnimal) { if (otherAnimal == this) { return false; } else if (!this.isTamed()) { return false; } else if (!(otherAnimal instanceof TameableSilverfish)) { return false; } else { TameableSilverfish entityTameableSilverfish = (TameableSilverfish) otherAnimal; return !entityTameableSilverfish.isTamed() ? false : (entityTameableSilverfish.isSitting() ? false : this.isInLove() && entityTameableSilverfish.isInLove()); } } @Override @Nullable public UUID getOwnerId() { return (UUID) ((Optional) dataManager.get(OWNER_UNIQUE_ID)).orNull(); } public void setOwnerId(@Nullable UUID p_184754_1_) { dataManager.set(OWNER_UNIQUE_ID, Optional.fromNullable(p_184754_1_)); } @Override @Nullable public EntityLivingBase getOwner() { try { UUID uuid = getOwnerId(); return uuid == null ? null : worldObj.getPlayerEntityByUUID(uuid); } catch (IllegalArgumentException var2) { return null; } } public boolean isOwner(EntityLivingBase entityIn) { return entityIn == getOwner(); } public EntityAISit getAISit() { return aiSit; } protected void playTameEffect(boolean play) { EnumParticleTypes enumparticletypes = EnumParticleTypes.HEART; if (!play) { enumparticletypes = EnumParticleTypes.SMOKE_LARGE; } for (int i = 0; i < 7; ++i) { double d0 = rand.nextGaussian() * 0.02D; double d1 = rand.nextGaussian() * 0.02D; double d2 = rand.nextGaussian() * 0.02D; worldObj.spawnParticle(enumparticletypes, posX + rand.nextFloat() * width * 2.0F - width, posY + 0.5D + rand.nextFloat() * height, posZ + rand.nextFloat() * width * 2.0F - width, d0, d1, d2, new int[0]); } } @Override @SideOnly(Side.CLIENT) public void handleStatusUpdate(byte id) { if (id == 7) { playTameEffect(true); } else if (id == 6) { playTameEffect(false); } else { super.handleStatusUpdate(id); } } public boolean shouldAttackEntity(EntityLivingBase p_142018_1_, EntityLivingBase p_142018_2_) { if (!(p_142018_1_ instanceof EntityCreeper) && !(p_142018_1_ instanceof EntityGhast)) { if (p_142018_1_ instanceof TameableSilverfish) { TameableSilverfish entityChicken = (TameableSilverfish) p_142018_1_; if (entityChicken.isTamed() && entityChicken.getOwner() == p_142018_2_) { return false; } } return p_142018_1_ instanceof EntityPlayer && p_142018_2_ instanceof EntityPlayer && !((EntityPlayer) p_142018_2_).canAttackPlayer((EntityPlayer) p_142018_1_) ? false : !(p_142018_1_ instanceof EntityHorse) || !((EntityHorse) p_142018_1_).isTame(); } else { return false; } } static class EntityAIBeg extends EntityAIBase { private final TameableSilverfish theBat; private EntityPlayer thePlayer; private final World worldObject; private final float minPlayerDistance; private int timeoutCounter; public EntityAIBeg(TameableSilverfish blaze, float minDistance) { theBat = blaze; worldObject = blaze.worldObj; minPlayerDistance = minDistance; setMutexBits(2); } /** * Returns whether the EntityAIBase should begin execution. */ @Override public boolean shouldExecute() { thePlayer = worldObject.getClosestPlayerToEntity(theBat, (double) minPlayerDistance); return thePlayer == null ? false : hasPlayerGotBlazePowderInHand(this.thePlayer); } /** * Returns whether an in-progress EntityAIBase should continue executing */ @Override public boolean continueExecuting() { return !thePlayer.isEntityAlive() ? false : (theBat.getDistanceSqToEntity(thePlayer) > (double) (minPlayerDistance * minPlayerDistance) ? false : timeoutCounter > 0 && hasPlayerGotBlazePowderInHand(thePlayer)); } /** * Execute a one shot task or start executing a continuous task */ @Override public void startExecuting() { theBat.setBegging(true); timeoutCounter = 40 + theBat.getRNG().nextInt(40); } /** * Resets the task */ @Override public void resetTask() { theBat.setBegging(false); thePlayer = null; } /** * Updates the task */ @Override public void updateTask() { theBat.getLookHelper().setLookPosition(thePlayer.posX, thePlayer.posY + (double) thePlayer.getEyeHeight(), thePlayer.posZ, 10.0F, (float) theBat.getVerticalFaceSpeed()); --timeoutCounter; } /** * Gets if the Player has the BlazePowder in the hand. */ private boolean hasPlayerGotBlazePowderInHand(EntityPlayer player) { for (EnumHand enumhand : EnumHand.values()) { ItemStack itemstack = player.getHeldItem(enumhand); if (itemstack != null) { if (theBat.isTamed() && itemstack.getItem() == Items.BLAZE_POWDER) { return true; } if (theBat.isBreedingItem(itemstack)) { return true; } } } return false; } } static class EntityAISit extends EntityAIBase { private final TameableSilverfish theEntity; /** If the EntityTameable is sitting. */ private boolean isSitting; public EntityAISit(TameableSilverfish entityIn) { theEntity = entityIn; setMutexBits(5); } /** * Returns whether the EntityAIBase should begin execution. */ @Override public boolean shouldExecute() { if (!theEntity.isTamed()) { return false; } else if (theEntity.isInWater()) { return false; } else if (!theEntity.onGround) { return false; } else { EntityLivingBase entitylivingbase = theEntity.getOwner(); return entitylivingbase == null ? true : (theEntity.getDistanceSqToEntity(entitylivingbase) < 144.0D && entitylivingbase.getAITarget() != null ? false : isSitting); } } /** * Execute a one shot task or start executing a continuous task */ @Override public void startExecuting() { theEntity.getNavigator().clearPathEntity(); theEntity.setSitting(true); } /** * Resets the task */ @Override public void resetTask() { theEntity.setSitting(false); } /** * Sets the sitting flag. */ public void setSitting(boolean sitting) { isSitting = sitting; } } @Override public TameableSilverfish createChild(EntityAgeable ageable) { TameableSilverfish entityTameableSilverfish = new TameableSilverfish(this.worldObj); UUID uuid = this.getOwnerId(); if (uuid != null) { entityTameableSilverfish.setOwnerId(uuid); entityTameableSilverfish.setTamed(true); } return entityTameableSilverfish; } static class EntityAIFollowOwner extends EntityAIBase { private final TameableSilverfish thePet; private EntityLivingBase theOwner; World theWorld; private final double followSpeed; private final PathNavigate petPathfinder; private int timeToRecalcPath; float maxDist; float minDist; private float oldWaterCost; public EntityAIFollowOwner(TameableSilverfish thePetIn, double followSpeedIn, float minDistIn, float maxDistIn) { thePet = thePetIn; theWorld = thePetIn.worldObj; followSpeed = followSpeedIn; petPathfinder = thePetIn.getNavigator(); minDist = minDistIn; maxDist = maxDistIn; setMutexBits(3); if (!(thePetIn.getNavigator() instanceof PathNavigateGround)) { throw new IllegalArgumentException("Unsupported mob type for FollowOwnerGoal"); } } /** * Returns whether the EntityAIBase should begin execution. */ @Override public boolean shouldExecute() { EntityLivingBase entitylivingbase = thePet.getOwner(); if (entitylivingbase == null) { return false; } else if (entitylivingbase instanceof EntityPlayer && ((EntityPlayer) entitylivingbase).isSpectator()) { return false; } else if (thePet.isSitting()) { return false; } else if (thePet.getDistanceSqToEntity(entitylivingbase) < minDist * minDist) { return false; } else { theOwner = entitylivingbase; return true; } } /** * Returns whether an in-progress EntityAIBase should continue executing */ @Override public boolean continueExecuting() { return !petPathfinder.noPath() && thePet.getDistanceSqToEntity(theOwner) > maxDist * maxDist && !thePet.isSitting(); } /** * Execute a one shot task or start executing a continuous task */ @Override public void startExecuting() { timeToRecalcPath = 0; oldWaterCost = thePet.getPathPriority(PathNodeType.WATER); thePet.setPathPriority(PathNodeType.WATER, 0.0F); } /** * Resets the task */ @Override public void resetTask() { theOwner = null; petPathfinder.clearPathEntity(); thePet.setPathPriority(PathNodeType.WATER, oldWaterCost); } private boolean isEmptyBlock(BlockPos pos) { IBlockState iblockstate = theWorld.getBlockState(pos); return iblockstate.getMaterial() == Material.AIR ? true : !iblockstate.isFullCube(); } /** * Updates the task */ @Override public void updateTask() { thePet.getLookHelper().setLookPositionWithEntity(theOwner, 10.0F, thePet.getVerticalFaceSpeed()); if (!thePet.isSitting()) { if (--timeToRecalcPath <= 0) { timeToRecalcPath = 10; if (!petPathfinder.tryMoveToEntityLiving(theOwner, followSpeed)) { if (!thePet.getLeashed()) { if (thePet.getDistanceSqToEntity(theOwner) >= 144.0D) { int i = MathHelper.floor_double(theOwner.posX) - 2; int j = MathHelper.floor_double(theOwner.posZ) - 2; int k = MathHelper.floor_double(theOwner.getEntityBoundingBox().minY); for (int l = 0; l <= 4; ++l) { for (int i1 = 0; i1 <= 4; ++i1) { if ((l < 1 || i1 < 1 || l > 3 || i1 > 3) && theWorld.getBlockState(new BlockPos(i + l, k - 1, j + i1)) .isFullyOpaque() && isEmptyBlock(new BlockPos(i + l, k, j + i1)) && isEmptyBlock(new BlockPos(i + l, k + 1, j + i1))) { thePet.setLocationAndAngles(i + l + 0.5F, k, j + i1 + 0.5F, thePet.rotationYaw, thePet.rotationPitch); petPathfinder.clearPathEntity(); return; } } } } } } } } } } static class EntityAIOwnerHurtByTarget extends EntityAITarget { TameableSilverfish theDefendingTameable; EntityLivingBase theOwnerAttacker; private int timestamp; public EntityAIOwnerHurtByTarget(TameableSilverfish theDefendingTameableIn) { super(theDefendingTameableIn, false); theDefendingTameable = theDefendingTameableIn; setMutexBits(1); } /** * Returns whether the EntityAIBase should begin execution. */ @Override public boolean shouldExecute() { if (!theDefendingTameable.isTamed()) { return false; } else { EntityLivingBase entitylivingbase = theDefendingTameable.getOwner(); if (entitylivingbase == null) { return false; } else { theOwnerAttacker = entitylivingbase.getAITarget(); int i = entitylivingbase.getRevengeTimer(); return i != timestamp && this.isSuitableTarget(theOwnerAttacker, false) && theDefendingTameable.shouldAttackEntity(theOwnerAttacker, entitylivingbase); } } } /** * Execute a one shot task or start executing a continuous task */ @Override public void startExecuting() { taskOwner.setAttackTarget(theOwnerAttacker); EntityLivingBase entitylivingbase = theDefendingTameable.getOwner(); if (entitylivingbase != null) { timestamp = entitylivingbase.getRevengeTimer(); } super.startExecuting(); } } static class AIFindPlayer extends EntityAINearestAttackableTarget<EntityPlayer> { private final TameableSilverfish TameableSilverfish; private EntityPlayer player; private int aggroTime; private int teleportTime; public AIFindPlayer(TameableSilverfish p_i45842_1_) { super(p_i45842_1_, EntityPlayer.class, false); TameableSilverfish = p_i45842_1_; } @Override public boolean shouldExecute() { double d0 = getTargetDistance(); player = TameableSilverfish.worldObj.getNearestAttackablePlayer(TameableSilverfish.posX, TameableSilverfish.posY, TameableSilverfish.posZ, d0, d0, (Function) null, (@Nullable EntityPlayer player) -> (player != null) && (TameableSilverfish.shouldAttackPlayer(player))); return player != null; } @Override public void startExecuting() { aggroTime = 5; teleportTime = 0; } @Override public void resetTask() { player = null; super.resetTask(); } @Override public boolean continueExecuting() { if (player != null) { if (!TameableSilverfish.shouldAttackPlayer(player)) { return false; } TameableSilverfish.faceEntity(player, 10.0F, 10.0F); return true; } return (targetEntity != null) && (targetEntity.isEntityAlive()) ? true : super.continueExecuting(); } @Override public void updateTask() { if (player != null) { if (--aggroTime <= 0) { targetEntity = player; player = null; super.startExecuting(); } } else { if (targetEntity != null) { if (TameableSilverfish.shouldAttackPlayer(targetEntity)) { if (targetEntity.getDistanceSqToEntity(TameableSilverfish) < 16.0D) { } teleportTime = 0; } else if ((targetEntity.getDistanceSqToEntity(TameableSilverfish) > 256.0D) && (teleportTime++ >= 30) && (TameableSilverfish.teleportToEntity(targetEntity))) { teleportTime = 0; } } super.updateTask(); } } } protected boolean teleportToEntity(Entity p_70816_1_) { Vec3d vec3d = new Vec3d(this.posX - p_70816_1_.posX, this.getEntityBoundingBox().minY + (double) (this.height / 2.0F) - p_70816_1_.posY + (double) p_70816_1_.getEyeHeight(), this.posZ - p_70816_1_.posZ); vec3d = vec3d.normalize(); double d0 = 16.0D; double d1 = this.posX + (this.rand.nextDouble() - 0.5D) * 8.0D - vec3d.xCoord * 16.0D; double d2 = this.posY + (double) (this.rand.nextInt(16) - 8) - vec3d.yCoord * 16.0D; double d3 = this.posZ + (this.rand.nextDouble() - 0.5D) * 8.0D - vec3d.zCoord * 16.0D; return this.teleportTo(d1, d2, d3); } private boolean teleportTo(double x, double y, double z) { net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent( this, x, y, z, 0); if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return false; boolean flag = this.attemptTeleport(event.getTargetX(), event.getTargetY(), event.getTargetZ()); if (flag) { this.worldObj.playSound((EntityPlayer) null, this.prevPosX, this.prevPosY, this.prevPosZ, SoundEvents.ENTITY_ENDERMEN_TELEPORT, this.getSoundCategory(), 1.0F, 1.0F); this.playSound(SoundEvents.ENTITY_ENDERMEN_TELEPORT, 1.0F, 1.0F); } return flag; } static class AIMeleeAttack extends EntityAIAttackMelee { World worldObj; protected EntityCreature attacker; /** * An amount of decrementing ticks that allows the entity to attack once * the tick reaches 0. */ protected int attackTick; /** The speed with which the mob will approach the target */ double speedTowardsTarget; /** * When true, the mob will continue chasing its target, even if it can't * find a path to them right now. */ boolean longMemory; /** The PathEntity of our entity. */ Path entityPathEntity; private int delayCounter; private double targetX; private double targetY; private double targetZ; protected final int attackInterval = 20; private int failedPathFindingPenalty = 0; private boolean canPenalize = false; public AIMeleeAttack(EntityCreature creature, double speedIn, boolean useLongMemory) { super(creature, speedIn, useLongMemory); this.attacker = creature; this.worldObj = creature.worldObj; this.speedTowardsTarget = speedIn; this.longMemory = useLongMemory; this.setMutexBits(3); } /** * Returns whether the EntityAIBase should begin execution. */ public boolean shouldExecute() { EntityLivingBase entitylivingbase = this.attacker.getAttackTarget(); if (entitylivingbase == null) { return false; } else if (!entitylivingbase.isEntityAlive()) { return false; } else { if (canPenalize) { if (--this.delayCounter <= 0) { this.entityPathEntity = this.attacker.getNavigator().getPathToEntityLiving(entitylivingbase); this.delayCounter = 4 + this.attacker.getRNG().nextInt(7); return this.entityPathEntity != null; } else { return true; } } this.entityPathEntity = this.attacker.getNavigator().getPathToEntityLiving(entitylivingbase); return this.entityPathEntity != null; } } /** * Returns whether an in-progress EntityAIBase should continue executing */ public boolean continueExecuting() { EntityLivingBase entitylivingbase = this.attacker.getAttackTarget(); return entitylivingbase == null ? false : (!entitylivingbase.isEntityAlive() ? false : (!this.longMemory ? !this.attacker.getNavigator().noPath() : (!this.attacker.isWithinHomeDistanceFromPosition(new BlockPos(entitylivingbase)) ? false : !(entitylivingbase instanceof EntityPlayer) || !((EntityPlayer) entitylivingbase).isSpectator() && !((EntityPlayer) entitylivingbase).isCreative()))); } /** * Execute a one shot task or start executing a continuous task */ public void startExecuting() { this.attacker.getNavigator().setPath(this.entityPathEntity, this.speedTowardsTarget); this.delayCounter = 0; } /** * Resets the task */ public void resetTask() { EntityLivingBase entitylivingbase = this.attacker.getAttackTarget(); if (entitylivingbase instanceof EntityPlayer && (((EntityPlayer) entitylivingbase).isSpectator() || ((EntityPlayer) entitylivingbase).isCreative())) { this.attacker.setAttackTarget((EntityLivingBase) null); } this.attacker.getNavigator().clearPathEntity(); } /** * Updates the task */ public void updateTask() { EntityLivingBase entitylivingbase = this.attacker.getAttackTarget(); this.attacker.getLookHelper().setLookPositionWithEntity(entitylivingbase, 30.0F, 30.0F); double d0 = this.attacker.getDistanceSq(entitylivingbase.posX, entitylivingbase.getEntityBoundingBox().minY, entitylivingbase.posZ); --this.delayCounter; if ((this.longMemory || this.attacker.getEntitySenses().canSee(entitylivingbase)) && this.delayCounter <= 0 && (this.targetX == 0.0D && this.targetY == 0.0D && this.targetZ == 0.0D || entitylivingbase.getDistanceSq(this.targetX, this.targetY, this.targetZ) >= 1.0D || this.attacker.getRNG().nextFloat() < 0.05F)) { this.targetX = entitylivingbase.posX; this.targetY = entitylivingbase.getEntityBoundingBox().minY; this.targetZ = entitylivingbase.posZ; this.delayCounter = 4 + this.attacker.getRNG().nextInt(7); if (this.canPenalize) { this.delayCounter += failedPathFindingPenalty; if (this.attacker.getNavigator().getPath() != null) { net.minecraft.pathfinding.PathPoint finalPathPoint = this.attacker.getNavigator().getPath() .getFinalPathPoint(); if (finalPathPoint != null && entitylivingbase.getDistanceSq(finalPathPoint.xCoord, finalPathPoint.yCoord, finalPathPoint.zCoord) < 1) failedPathFindingPenalty = 0; else failedPathFindingPenalty += 10; } else { failedPathFindingPenalty += 10; } } if (d0 > 1024.0D) { this.delayCounter += 10; } else if (d0 > 256.0D) { this.delayCounter += 5; } if (!this.attacker.getNavigator().tryMoveToEntityLiving(entitylivingbase, this.speedTowardsTarget)) { this.delayCounter += 15; } } this.attackTick = Math.max(this.attackTick - 1, 0); this.checkAndPerformAttack(entitylivingbase, d0); } protected void checkAndPerformAttack(EntityLivingBase p_190102_1_, double p_190102_2_) { double d0 = this.getAttackReachSqr(p_190102_1_); if (p_190102_2_ <= d0 && this.attackTick <= 0) { this.attackTick = 20; this.attacker.swingArm(EnumHand.MAIN_HAND); this.attacker.attackEntityAsMob(p_190102_1_); } } protected double getAttackReachSqr(EntityLivingBase attackTarget) { return (double) (this.attacker.width * 2.0F * this.attacker.width * 2.0F + attackTarget.width); } } private TameableSilverfish.AISummonSilverfish summonSilverfish; public static void registerFixesSilverfish(DataFixer fixer) { EntityLiving.registerFixesMob(fixer, "Silverfish"); } /** * Returns the Y Offset of this entity. */ public double getYOffset() { return 0.2D; } public float getEyeHeight() { return 0.1F; } /** * returns if this entity triggers Block.onEntityWalking on the blocks they * walk on. used for spiders and wolves to prevent them from trampling crops */ protected boolean canTriggerWalking() { return false; } protected SoundEvent getAmbientSound() { return SoundEvents.ENTITY_SILVERFISH_AMBIENT; } protected SoundEvent getHurtSound() { return SoundEvents.ENTITY_SILVERFISH_HURT; } protected SoundEvent getDeathSound() { return SoundEvents.ENTITY_SILVERFISH_DEATH; } protected void playStepSound(BlockPos pos, Block blockIn) { this.playSound(SoundEvents.ENTITY_SILVERFISH_STEP, 0.15F, 1.0F); } /** * Called when the entity is attacked. */ public boolean attackEntityFrom(DamageSource source, float amount) { if (this.isEntityInvulnerable(source)) { return false; } else { if ((source instanceof EntityDamageSource || source == DamageSource.magic) && this.summonSilverfish != null) { this.summonSilverfish.notifyHurt(); } return super.attackEntityFrom(source, amount); } } @Nullable protected ResourceLocation getLootTable() { return LootTableList.ENTITIES_SILVERFISH; } /** * Called to update the entity's position/logic. */ public void onUpdate() { this.renderYawOffset = this.rotationYaw; super.onUpdate(); } public float getBlockPathWeight(BlockPos pos) { return this.worldObj.getBlockState(pos.down()).getBlock() == Blocks.STONE ? 10.0F : super.getBlockPathWeight(pos); } /** * Checks to make sure the light is not too bright where the mob is spawning */ protected boolean isValidLightLevel() { return true; } /** * Get this Entity's EnumCreatureAttribute */ public EnumCreatureAttribute getCreatureAttribute() { return EnumCreatureAttribute.ARTHROPOD; } static class AIHideInStone extends EntityAIWander { private final TameableSilverfish silverfish; private EnumFacing facing; private boolean doMerge; public AIHideInStone(TameableSilverfish silverfishIn) { super(silverfishIn, 1.0D, 10); this.silverfish = silverfishIn; this.setMutexBits(1); } /** * Returns whether the EntityAIBase should begin execution. */ public boolean shouldExecute() { if (!this.silverfish.worldObj.getGameRules().getBoolean("mobGriefing")) { return false; } else if (this.silverfish.getAttackTarget() != null) { return false; } else if (!this.silverfish.getNavigator().noPath()) { return false; } else { Random random = this.silverfish.getRNG(); if (random.nextInt(10) == 0) { this.facing = EnumFacing.random(random); BlockPos blockpos = (new BlockPos(this.silverfish.posX, this.silverfish.posY + 0.5D, this.silverfish.posZ)).offset(this.facing); IBlockState iblockstate = this.silverfish.worldObj.getBlockState(blockpos); if (BlockSilverfish.canContainSilverfish(iblockstate)) { this.doMerge = true; return true; } } this.doMerge = false; return super.shouldExecute(); } } /** * Returns whether an in-progress EntityAIBase should continue executing */ public boolean continueExecuting() { return this.doMerge ? false : super.continueExecuting(); } /** * Execute a one shot task or start executing a continuous task */ public void startExecuting() { if (!this.doMerge) { super.startExecuting(); } else { World world = this.silverfish.worldObj; BlockPos blockpos = (new BlockPos(this.silverfish.posX, this.silverfish.posY + 0.5D, this.silverfish.posZ)).offset(this.facing); IBlockState iblockstate = world.getBlockState(blockpos); if (BlockSilverfish.canContainSilverfish(iblockstate)) { world.setBlockState(blockpos, Blocks.MONSTER_EGG.getDefaultState().withProperty( BlockSilverfish.VARIANT, BlockSilverfish.EnumType.forModelBlock(iblockstate)), 3); this.silverfish.spawnExplosionParticle(); this.silverfish.setDead(); } } } } static class AISummonSilverfish extends EntityAIBase { private final TameableSilverfish silverfish; private int lookForFriends; public AISummonSilverfish(TameableSilverfish silverfishIn) { this.silverfish = silverfishIn; } public void notifyHurt() { if (this.lookForFriends == 0) { this.lookForFriends = 20; } } /** * Returns whether the EntityAIBase should begin execution. */ public boolean shouldExecute() { return this.lookForFriends > 0; } /** * Updates the task */ public void updateTask() { --this.lookForFriends; if (this.lookForFriends <= 0) { World world = this.silverfish.worldObj; Random random = this.silverfish.getRNG(); BlockPos blockpos = new BlockPos(this.silverfish); for (int i = 0; i <= 5 && i >= -5; i = i <= 0 ? 1 - i : 0 - i) { for (int j = 0; j <= 10 && j >= -10; j = j <= 0 ? 1 - j : 0 - j) { for (int k = 0; k <= 10 && k >= -10; k = k <= 0 ? 1 - k : 0 - k) { BlockPos blockpos1 = blockpos.add(j, i, k); IBlockState iblockstate = world.getBlockState(blockpos1); if (iblockstate.getBlock() == Blocks.MONSTER_EGG) { if (world.getGameRules().getBoolean("mobGriefing")) { world.destroyBlock(blockpos1, true); } else { world.setBlockState(blockpos1, ((BlockSilverfish.EnumType) iblockstate.getValue(BlockSilverfish.VARIANT)) .getModelBlock(), 3); } if (random.nextBoolean()) { return; } } } } } } } } @Override public boolean getCanSpawnHere() { if (super.getCanSpawnHere()) { EntityPlayer entityplayer = this.worldObj.getNearestPlayerNotCreative(this, 5.0D); return entityplayer == null; } else { return this.worldObj.getDifficulty() != EnumDifficulty.PEACEFUL && !isValidLightLevel() && super.getCanSpawnHere(); } } @Override protected void despawnEntity() { if (!isTamed()) { super.despawnEntity(); } } }
[ "rvillalobos102299@gmail.com" ]
rvillalobos102299@gmail.com
13ba89440db6c1c1f569bce39a61d75fa8ad97ed
05f222b80448aa2fb991774527f5261e905837b8
/manufacturing_o2o/src/main/java/ajax/AjaxServlet.java
7f8d705c73ec1d1c4ca18d2fbf7a998d8b89142b
[]
no_license
InkstarONE/manufacturing_o2o
3b727c84a78c182c357816789eb31e568659af0c
dec1fb53d0a21399b51fed0b776bfd2f66ffbccd
refs/heads/master
2021-03-27T19:46:07.695382
2018-08-20T08:14:03
2018-08-20T08:14:03
100,456,816
0
0
null
null
null
null
UTF-8
Java
false
false
856
java
package ajax; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import static java.lang.Thread.sleep; public class AjaxServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { try { sleep(5000); } catch (InterruptedException e) { e.printStackTrace(); } resp.getWriter().write("shahs"); System.out.println(req.getParameter("name")); } @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { System.out.println("post.."); doGet(req,resp); } }
[ "noreply@github.com" ]
noreply@github.com
75b8b79a52b6ff05a3958c7c21ce265bdfaab7a6
5b82e2f7c720c49dff236970aacd610e7c41a077
/QueryReformulation-master 2/data/ExampleSourceCodeFiles/Snippet017TableViewerHideShowColumns.java
ee4853a6b7f2c24dadfe619350bef1d2ce74b774
[]
no_license
shy942/EGITrepoOnlineVersion
4b157da0f76dc5bbf179437242d2224d782dd267
f88fb20497dcc30ff1add5fe359cbca772142b09
refs/heads/master
2021-01-20T16:04:23.509863
2016-07-21T20:43:22
2016-07-21T20:43:22
63,737,385
0
0
null
null
null
null
UTF-8
Java
false
false
2,712
java
/Users/user/eclipse.platform.ui/examples/org.eclipse.jface.snippets/Eclipse JFace Snippets/org/eclipse/jface/snippets/viewers/Snippet017TableViewerHideShowColumns.java org eclipse jface snippets viewers org eclipse jface action action org eclipse jface action menu manager org eclipse jface viewers array content provider org eclipse jface viewers table label provider org eclipse jface viewers label provider org eclipse jface viewers table viewer org eclipse swt org eclipse swt graphics image org eclipse swt layout fill layout org eclipse swt widgets display org eclipse swt widgets event org eclipse swt widgets shell org eclipse swt widgets table column example usage mandatory interfaces table font provider table color provider snippet table viewer hide show columns shrink thread thread width table column column shrink thread width table column column width width column column override column display sync exec runnable override column set data restored width integer width width column display sync exec runnable override column set width expand thread thread width table column column expand thread width table column column width width column column override width column display sync exec runnable override column set width model counter model counter counter counter override string string item counter label provider label provider table label provider override image column image object element column index null override string column text object element column index column column index element string snippet table viewer hide show columns shell shell table viewer table viewer shell set label provider label provider set content provider array content provider instance table column column table column table column set width column set text column column table column table column set width column set text column column table column table column set width column set text column model model create model set input model table set lines visible true table set header visible true add menu add menu table viewer menu manager mgr menu manager action action table column count table column column table column action action table column text override with event event event checked shrink thread shrink thread column width column expand thread expand thread integer column data restored width value column action set checked true mgr add action control set menu mgr create context menu control model create model model elements model elements model elements param args main string args display display display shell shell shell display shell set layout fill layout snippet table viewer hide show columns shell shell open shell disposed display read and dispatch display sleep display dispose
[ "muktacseku@gmail.com" ]
muktacseku@gmail.com
9229aded670329939e2b3e74eed90befec19c140
db80a294090f9f57238a123723a1db256ec32de6
/XCL-Charts/src/org/xclcharts/chart/StackBarChart.java
125fe9d10d3c9ef1eff5bc96c5069675eef987aa
[ "Apache-2.0" ]
permissive
lsjwzh/XCL-Charts
44dd73397860954674a2dde0cbc21289515a588e
4c49abb6b4feb2a8016a4c7879115ce4d3e1a5c6
refs/heads/master
2020-12-26T04:05:28.796902
2014-12-25T15:54:56
2014-12-25T15:54:56
28,500,186
1
0
null
null
null
null
UTF-8
Java
false
false
7,638
java
/** * Copyright 2014 XCL-Charts * * 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. * * @Project XCL-Charts * @Description Android图表基类库 * @author XiongChuanLiang<br/>(xcl_168@aliyun.com) * @license http://www.apache.org/licenses/ Apache v2 License * @version 1.0 */ package org.xclcharts.chart; import java.util.List; import org.xclcharts.common.MathHelper; import org.xclcharts.renderer.XEnum; import org.xclcharts.renderer.bar.Bar; import org.xclcharts.renderer.bar.FlatBar; import android.graphics.Canvas; /** * @ClassName StackBarChart * @Description 堆叠图基类 * @author XiongChuanLiang<br/>(xcl_168@aliyun.com) * */ public class StackBarChart extends BarChart{ private FlatBar flatBar = null; private boolean mTotalLabelVisible = true; public StackBarChart() { if(null == flatBar)flatBar = new FlatBar(); } @Override public XEnum.ChartType getType() { return XEnum.ChartType.STACKBAR; } /** * 是否在柱形的最上方,显示汇总标签 * @param visible 是否显示 */ public void setTotalLabelVisible(boolean visible) { mTotalLabelVisible = visible; } @Override public Bar getBar() { return flatBar; } @Override protected boolean renderHorizontalBar(Canvas canvas) { if(null == categoryAxis.getDataSet()) return false; float axisScreenWidth = getPlotScreenWidth(); float axisDataRange = (float) dataAxis.getAxisRange(); float valueWidth = axisDataRange; //步长 float YSteps = getHorizontalYSteps(); int barHeight = (int) MathHelper.getInstance().round(mul(YSteps,0.5f),2); int cateSize = categoryAxis.getDataSet().size(); int dataSize = 0; //分类轴 for(int r=0;r < cateSize ;r++) { float currentX = plotArea.getLeft(); float currentY = sub(plotArea.getBottom() , mul((r+1) , YSteps)); double total = 0d; //得到数据源 List<BarData> chartDataSource = this.getDataSource(); if(null==chartDataSource||chartDataSource.size() == 0)continue; dataSize = chartDataSource.size(); for(int i=0;i<dataSize;i++) //轴上的每个标签各自所占的高度 { BarData bd = chartDataSource.get(i); if(null == bd.getDataSet()) continue ; flatBar.getBarPaint().setColor(bd.getColor()); if(bd.getDataSet().size() < r+1) continue; //参数值与最大值的比例 照搬到 y轴高度与矩形高度的比例上来 Double bv = bd.getDataSet().get(r); total = MathHelper.getInstance().add(total, bv); float valuePostion = 0.0f; if(i == 0 ) { double t = MathHelper.getInstance().sub( bv , dataAxis.getAxisMin() ); valuePostion = mul( axisScreenWidth,div(dtof(t),valueWidth) ); }else{ float t2 = div(dtof(bv) , valueWidth) ; valuePostion = mul( axisScreenWidth , t2); } //宽度 float topY = sub(currentY , barHeight/2); float rightX = add(currentX , valuePostion); float bottomY = add(currentY , barHeight/2); flatBar.renderBar(currentX ,topY,rightX,bottomY,canvas); //保存位置 saveBarRectFRecord(i,r,currentX + mMoveX, topY + mMoveY,rightX + mMoveX, bottomY+ mMoveY); //显示焦点框 drawFocusRect(canvas,i,r,currentX ,topY,rightX,bottomY); //柱形的当前值 flatBar.renderBarItemLabel(getFormatterItemLabel(bv), add(currentX , valuePostion/2), currentY , canvas); currentX = add(currentX,valuePostion); } //合计 if(mTotalLabelVisible) { double t = MathHelper.getInstance().sub(total , dataAxis.getAxisMin()); float totalPostion = mul(div(axisScreenWidth,axisDataRange),dtof(t)); flatBar.renderBarItemLabel(getFormatterItemLabel(total), add(plotArea.getLeft() , totalPostion), currentY, canvas); } } return true; } @Override protected boolean renderVerticalBar(Canvas canvas) { //得到分类轴数据集 List<String> dataSet = categoryAxis.getDataSet(); if(null == dataSet) return false; //得到数据源 List<BarData> chartDataSource = this.getDataSource(); if(null == chartDataSource) return false; float XSteps = getVerticalXSteps(dataSet.size() + 1 ); float axisScreenHeight = getAxisScreenHeight(); float axisDataHeight = (float) dataAxis.getAxisRange(); float barWidht = mul(XSteps,0.5f); float currentX = 0.0f,currentY = 0.0f; int dataSize = dataSet.size(); int sourceSize = 0; for(int r=0;r<dataSize;r++) //轴上的每个标签 { currentX = add(plotArea.getLeft() , mul( (r+1) , XSteps)); currentY = plotArea.getBottom() ; Double total = 0d; sourceSize = chartDataSource.size(); for(int i=0; i < sourceSize;i++) //各自所占的高度 { BarData bd = chartDataSource.get(i); if(null == bd.getDataSet()) continue ; flatBar.getBarPaint().setColor(bd.getColor()); if(bd.getDataSet().size() < r+1) continue; //参数值与最大值的比例 照搬到 y轴高度与矩形高度的比例上来 Double bv = bd.getDataSet().get(r); total = MathHelper.getInstance().add(total, bv); float valuePostion = 0.0f; if(i == 0 ) { double t = MathHelper.getInstance().sub( bv , dataAxis.getAxisMin() ); valuePostion = mul( axisScreenHeight,div( dtof(t),axisDataHeight) ); }else{ double t2 = MathHelper.getInstance().div(bv, axisDataHeight) ; valuePostion = mul( axisScreenHeight , dtof(t2)); } //柱形 float leftX = sub(currentX , barWidht/2); float topY = sub(currentY , valuePostion); float rightX = add(currentX , barWidht/2); flatBar.renderBar(leftX, topY, rightX, currentY, canvas); //保存位置 saveBarRectFRecord(i,r,leftX + mMoveX, topY + mMoveY,rightX + mMoveX, currentY + mMoveY); //显示焦点框 drawFocusRect(canvas,i,r,leftX, topY, rightX, currentY); //柱形的当前值 flatBar.renderBarItemLabel(getFormatterItemLabel(bv), currentX, sub(currentY , valuePostion/2), canvas); currentY = sub(currentY,valuePostion); } //合计 if(mTotalLabelVisible) { double per = MathHelper.getInstance().sub(total , dataAxis.getAxisMin()); float totalPostion = MathHelper.getInstance().mul(div(axisScreenHeight,axisDataHeight) , dtof(per)); flatBar.renderBarItemLabel(getFormatterItemLabel(total), currentX, sub(plotArea.getBottom() , totalPostion), canvas); } } return true; } }
[ "xcl_168@aliyun.com" ]
xcl_168@aliyun.com
1bca5c9af1cae8210647a2ff55a339ada2f838e1
0acd482828538c961cfd985c92c968c3d22ecaf2
/app/src/main/java/com/capstone/nik/mixology/Fragments/FragmentDetails.java
0b47aa40c1eae7f1d6a842e3df2b1ba7d4f0501e
[ "Apache-2.0" ]
permissive
nikhil-31/Mixology
c4f18daae4ced0a15009bd9a1c8efc56606a605f
61be4f864aeb067d14be9a8c88d727caf884a37e
refs/heads/master
2020-06-10T23:03:38.191489
2019-09-28T15:31:00
2019-09-28T15:31:00
75,850,238
37
0
null
null
null
null
UTF-8
Java
false
false
15,652
java
package com.capstone.nik.mixology.Fragments; import android.app.Activity; import android.content.ContentValues; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.design.widget.Snackbar; import android.support.v4.app.Fragment; import android.support.v4.content.ContextCompat; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.LayoutInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import com.capstone.nik.mixology.Adapters.IngredientsAdapter; import com.capstone.nik.mixology.Model.Cocktail; import com.capstone.nik.mixology.Model.Measures; import com.capstone.nik.mixology.Network.CocktailService; import com.capstone.nik.mixology.Network.CocktailURLs; import com.capstone.nik.mixology.Network.MyApplication; import com.capstone.nik.mixology.Network.remoteModel.Cocktails; import com.capstone.nik.mixology.Network.remoteModel.Drink; import com.capstone.nik.mixology.R; import com.capstone.nik.mixology.utils.ContentProviderHelperMethods; import com.google.android.gms.ads.AdListener; import com.google.android.gms.ads.AdRequest; import com.google.android.gms.ads.AdView; import com.google.android.gms.ads.MobileAds; import com.squareup.picasso.Picasso; import java.util.ArrayList; import java.util.List; import javax.inject.Inject; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Retrofit; import retrofit2.converter.gson.GsonConverterFactory; import static com.capstone.nik.mixology.data.AlcoholicColumn.DRINK_NAME; import static com.capstone.nik.mixology.data.AlcoholicColumn.DRINK_THUMB; import static com.capstone.nik.mixology.data.AlcoholicColumn._ID; /** * A placeholder fragment containing a simple view. */ public class FragmentDetails extends Fragment { private static final String TAG = "FragmentDetails"; @Inject Context applicationContext; private String mCocktailId; private TextView mInstructionsText; private TextView mAlcoholicText; private TextView mInstruction; private TextView mIngredients; private TextView mDrinkName; private Toolbar mToolbar; private IngredientsAdapter mIngredientsAdapter; private ImageView mDrinkImage; private ImageView mDetailIcon; private boolean isInDatabase; private Activity mActivity; private LinearLayout mLinearBottom; private CocktailService service; public FragmentDetails() { } @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); mActivity = getActivity(); if (mActivity != null) { ((MyApplication) mActivity.getApplication()).getApplicationComponent().inject(this); } } @Override public View onCreateView(@NonNull final LayoutInflater inflater, final ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_activity_details, container, false); Cocktail cocktail = mActivity.getIntent().getParcelableExtra(getString(R.string.intent_details_intent_cocktail)); setHasOptionsMenu(true); MobileAds.initialize(applicationContext, getString(R.string.admob_app_id)); AdView adView = view.findViewById(R.id.adViewDetails); AdRequest adRequest = new AdRequest.Builder().build(); adView.loadAd(adRequest); adView.setAdListener(new AdListener() { @Override public void onAdLoaded() { // Code to be executed when an ad finishes loading. Log.d(TAG, "onAdLoaded: "); } @Override public void onAdFailedToLoad(int errorCode) { // Code to be executed when an ad request fails. Log.d(TAG, "onAdFailedToLoad: " + errorCode); } @Override public void onAdOpened() { // Code to be executed when an ad opens an overlay that // covers the screen. Log.d(TAG, "onAdOpened: "); } @Override public void onAdLeftApplication() { // Code to be executed when the user has left the app. Log.d(TAG, "onAdLeftApplication: "); } @Override public void onAdClosed() { // Code to be executed when when the user is about to return // to the app after tapping on an ad. Log.d(TAG, "onAdClosed: "); } }); mToolbar = view.findViewById(R.id.toolbar); mToolbar.setNavigationIcon(ContextCompat.getDrawable(mActivity, R.drawable.ic_back_black)); mToolbar.setNavigationContentDescription(getString(R.string.content_desc_up_navigation)); mToolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mActivity.finish(); } }); mToolbar.inflateMenu(R.menu.menu_activity_details); mInstructionsText = view.findViewById(R.id.detail_instructions); mAlcoholicText = view.findViewById(R.id.detail_alcoholic); mDrinkImage = view.findViewById(R.id.detail_imageView); mInstruction = view.findViewById(R.id.detail_instructions_text); mIngredients = view.findViewById(R.id.detail_ingredients_text); mDrinkName = view.findViewById(R.id.detail_name); mDetailIcon = view.findViewById(R.id.detail_fav_button); mLinearBottom = view.findViewById(R.id.linear_bottom); mIngredientsAdapter = new IngredientsAdapter(mActivity); RecyclerView ingredientsRecyclerView = view.findViewById(R.id.recycler_ingredients); ingredientsRecyclerView.setNestedScrollingEnabled(false); LinearLayoutManager linearLayoutManager = new LinearLayoutManager(mActivity, LinearLayoutManager.VERTICAL, false); ingredientsRecyclerView.setLayoutManager(linearLayoutManager); ingredientsRecyclerView.setAdapter(mIngredientsAdapter); final Retrofit.Builder builder = new Retrofit.Builder().baseUrl(CocktailURLs.BASE_URL) .addConverterFactory(GsonConverterFactory.create()); Retrofit retrofit = builder.build(); service = retrofit.create(CocktailService.class); if (cocktail != null) { startNetworkRequest(cocktail); } return view; } public void updateContent(Cocktail cocktail) { if (isAdded()) { startNetworkRequest(cocktail); } } private void startNetworkRequest(final Cocktail cocktail) { mCocktailId = cocktail.getmDrinkId(); // Sends request to get data from the network sendJsonRequest(mCocktailId); mToolbar.setTitle(cocktail.getmDrinkName()); Picasso.with(mActivity).load(cocktail.getmDrinkThumb()).error(R.drawable.empty_glass).into(mDrinkImage); } private void shareRecipe(ArrayList<Measures> measuresArrayList, Drink drink) { final StringBuilder builder = new StringBuilder(); builder.append(getString(R.string.detail_share_sent_from_mixology)).append(" \n"); builder.append(getString(R.string.detail_share_name)).append(" ").append(drink.getStrDrink()).append("\n"); builder.append(getString(R.string.detail_share_alcoholic)).append(" ").append(drink.getStrAlcoholic()).append("\n"); builder.append(getString(R.string.detail_share_instructions)).append(" ").append("\n").append(drink.getStrInstructions()).append("\n"); builder.append(getString(R.string.detail_share_ingredients)).append("\n"); for (int i = 0; i < measuresArrayList.size(); i++) { Measures measures = measuresArrayList.get(i); builder.append(measures.getIngredient()).append(" -- ").append(measures.getMeasure()).append("\n"); } mToolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { if (item.getItemId() == R.id.action_share) { startActivity(Intent.createChooser(shareIntent(builder.toString()), getString(R.string.detail_share_via))); } return false; } }); } public Intent shareIntent(String data) { Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND); sharingIntent.setType("text/plain"); sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, getString(R.string.detail_share_sent_from_mixology)); sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, data); return sharingIntent; } private void sendJsonRequest(String id) { service.getDrinkById(id).enqueue(new Callback<Cocktails>() { @Override public void onResponse(@NonNull Call<Cocktails> call, @NonNull retrofit2.Response<Cocktails> response) { Cocktails cocktails = response.body(); if (cocktails != null) { List<Drink> drinks = cocktails.getDrinks(); if (drinks != null && drinks.size() != 0) { setUIData(drinks); } } } @Override public void onFailure(@NonNull Call<Cocktails> call, @NonNull Throwable t) { } }); } public void setUIData(List<Drink> drinkList) { Animation bottomUp = AnimationUtils.loadAnimation(getContext(), R.anim.bottom_up); mLinearBottom.startAnimation(bottomUp); mLinearBottom.setVisibility(View.VISIBLE); final Drink drink = drinkList.get(0); mInstructionsText.setText(drink.getStrInstructions()); mAlcoholicText.setText(drink.getStrAlcoholic()); mInstruction.setText(getResources().getString(R.string.detail_screen_instructions)); mIngredients.setText(getResources().getString(R.string.detail_screen_ingredients)); mDrinkName.setText(drink.getStrDrink()); isInDatabase = ContentProviderHelperMethods.isDrinkSavedInDb(mActivity, drink.getIdDrink()); if (isInDatabase) { mDetailIcon.setImageResource(R.drawable.ic_fav_filled); } else { mDetailIcon.setImageResource(R.drawable.ic_fav_unfilled_black); } mDetailIcon.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { isInDatabase = ContentProviderHelperMethods.isDrinkSavedInDb(mActivity, drink.getIdDrink()); if (isInDatabase) { mDetailIcon.setImageResource(R.drawable.ic_fav_filled); Snackbar.make(mDetailIcon, getString(R.string.drink_deleted), Snackbar.LENGTH_LONG).show(); ContentProviderHelperMethods.deleteData(mActivity, drink.getIdDrink()); mDetailIcon.setImageResource(R.drawable.ic_fav_unfilled_black); } else { mDetailIcon.setImageResource(R.drawable.ic_fav_unfilled_black); Snackbar.make(mDetailIcon, getString(R.string.drink_added), Snackbar.LENGTH_LONG).show(); ContentValues cv = new ContentValues(); cv.put(_ID, drink.getIdDrink()); cv.put(DRINK_NAME, drink.getStrDrink()); cv.put(DRINK_THUMB, drink.getStrDrinkThumb()); ContentProviderHelperMethods.insertData(mActivity, drink.getIdDrink(), cv); mDetailIcon.setImageResource(R.drawable.ic_fav_filled); } } }); ArrayList<Measures> measuresArrayList = new ArrayList<>(); if (drink.getStrIngredient1() != null && !drink.getStrIngredient1().equals("")) { Measures measure = new Measures(); measure.setIngredient(drink.getStrIngredient1()); measure.setMeasure(drink.getStrMeasure1()); measuresArrayList.add(measure); } if (drink.getStrIngredient2() != null && !drink.getStrIngredient2().equals("")) { Measures measure = new Measures(); measure.setIngredient(drink.getStrIngredient2()); measure.setMeasure(drink.getStrMeasure2()); measuresArrayList.add(measure); } if (drink.getStrIngredient3() != null && !drink.getStrIngredient3().equals("")) { Measures measure = new Measures(); measure.setIngredient(drink.getStrIngredient3()); measure.setMeasure(drink.getStrMeasure3()); measuresArrayList.add(measure); } if (drink.getStrIngredient4() != null && !drink.getStrIngredient4().equals("")) { Measures measure = new Measures(); measure.setIngredient(drink.getStrIngredient4()); measure.setMeasure(drink.getStrMeasure4()); measuresArrayList.add(measure); } if (drink.getStrIngredient5() != null && !drink.getStrIngredient5().equals("")) { Measures measure = new Measures(); measure.setIngredient(drink.getStrIngredient5()); measure.setMeasure(drink.getStrMeasure5()); measuresArrayList.add(measure); } if (drink.getStrIngredient6() != null && !drink.getStrIngredient6().equals("")) { Measures measure = new Measures(); measure.setIngredient(drink.getStrIngredient6()); measure.setMeasure(drink.getStrMeasure6()); measuresArrayList.add(measure); } if (drink.getStrIngredient7() != null && !drink.getStrIngredient7().equals("")) { Measures measure = new Measures(); measure.setIngredient(drink.getStrIngredient7()); measure.setMeasure(drink.getStrMeasure7()); measuresArrayList.add(measure); } if (drink.getStrIngredient8() != null && !drink.getStrIngredient8().equals("")) { Measures measure = new Measures(); measure.setIngredient(drink.getStrIngredient8()); measure.setMeasure(drink.getStrMeasure8()); measuresArrayList.add(measure); } if (drink.getStrIngredient9() != null && !drink.getStrIngredient9().equals("")) { Measures measure = new Measures(); measure.setIngredient(drink.getStrIngredient9()); measure.setMeasure(drink.getStrMeasure9()); measuresArrayList.add(measure); } if (drink.getStrIngredient10() != null && !drink.getStrIngredient10().equals("")) { Measures measure = new Measures(); measure.setIngredient(drink.getStrIngredient10()); measure.setMeasure(drink.getStrMeasure10()); measuresArrayList.add(measure); } if (drink.getStrIngredient11() != null && !drink.getStrIngredient11().equals("")) { Measures measure = new Measures(); measure.setIngredient(drink.getStrIngredient11()); measure.setMeasure(drink.getStrMeasure11()); measuresArrayList.add(measure); } if (drink.getStrIngredient12() != null && !drink.getStrIngredient12().equals("")) { Measures measure = new Measures(); measure.setIngredient(drink.getStrIngredient12()); measure.setMeasure(drink.getStrMeasure12()); measuresArrayList.add(measure); } if (drink.getStrIngredient13() != null && !drink.getStrIngredient13().equals("")) { Measures measure = new Measures(); measure.setIngredient(drink.getStrIngredient13()); measure.setMeasure(drink.getStrMeasure13()); measuresArrayList.add(measure); } if (drink.getStrIngredient14() != null && !drink.getStrIngredient14().equals("")) { Measures measure = new Measures(); measure.setIngredient(drink.getStrIngredient14()); measure.setMeasure(drink.getStrMeasure14()); measuresArrayList.add(measure); } if (drink.getStrIngredient15() != null && !drink.getStrIngredient15().equals("")) { Measures measure = new Measures(); measure.setIngredient(drink.getStrIngredient15()); measure.setMeasure(drink.getStrMeasure15()); measuresArrayList.add(measure); } if (isAdded() && mActivity != null) { shareRecipe(measuresArrayList, drink); } mIngredientsAdapter.setMeasuresList(measuresArrayList); } }
[ "nkl07ba@gmail.com" ]
nkl07ba@gmail.com
e38ec66ac87306bc8d77e7cf01d276a532deaf75
e56a51aeeb52f7fc1788df64467fc98a2803e643
/Gateway_DAO.java
e2c88b271caf3ddf41c36d5f1a861d1507a514e3
[]
no_license
shivam153/para_project1
68791e79410b9070c191c623287ccda850e356bc
51bb04ad6e9e4443b0546785f708588eea01b8bb
refs/heads/master
2020-06-25T00:37:09.689717
2019-07-27T09:08:10
2019-07-27T09:08:10
199,141,812
0
0
null
null
null
null
UTF-8
Java
false
false
1,508
java
import java.util.HashMap; public class Gateway_DAO { static HashMap<Integer, Information> map = new HashMap<>(); public void addAccount(Information inf) { map.put(inf.getCustomerID(),inf); //System.out.println(map.get(inf.getCustomerID())); } public Information search(int id) { //System.out.println("DAO search=" +(Information)map.get(id)); return (Information)map.get(id); } public void addBalance(int id,int amt) { Information inf = map.get(id); //stem.out.println(inf.toString()); inf.setAccountBalance(inf.getAccountBalance()+amt); map.put(id,inf); System.out.println("New Balance =" +inf.getAccountBalance()+amt); } public void withdrawBalance(int id,int amt) { Information inf = map.get(id); //stem.out.println(inf.toString()); inf.setAccountBalance(inf.getAccountBalance()-amt); map.put(id,inf); inf.getTransaction().add(amt+" withrawl from account"); System.out.println("New Balance =" +inf.getAccountBalance()+amt); } public void transfer(int sid,int rid,int amt) { Information inf = map.get(sid); Information inf1= map.get(rid); if(inf.getAccountBalance()<amt) { System.out.println("Insufficient Account Balance"); } else { inf.setAccountBalance(inf.getAccountBalance()-amt); inf1.setAccountBalance(inf1.getAccountBalance()+amt); System.out.println("Transfer successfully executed"); inf.getTransaction().add(amt+" amount transferred to ID: "+rid); } } }
[ "noreply@github.com" ]
noreply@github.com
43b14e8d4e02e11885315b372c2d1de0c7fb7b8d
dd5271f1d05d49b9c173d6c7ce2742d541bec165
/PictureDTO.java
abf267f4332e982d7debd024c74eff93ad08baf5
[]
no_license
diwei77chen/Database_Design_OnlineBookStore
1ecac42a951c953c50ef312546129acc03c8bb47
08af28725d61dd0d9f9dbdbdf4d0ccd10e3b9713
refs/heads/master
2021-01-11T20:48:46.156825
2017-01-17T05:00:48
2017-01-17T05:00:48
79,190,087
0
0
null
null
null
null
UTF-8
Java
false
false
825
java
package database; import java.sql.Blob; public class PictureDTO { private int pictureID; private String pictureName; private Blob pictureSource; private int itemID; public PictureDTO() { pictureID = 0; pictureName = ""; pictureSource = null; itemID = 0; } public int getPictureID() { return pictureID; } public void setPictureID(int pictureID) { this.pictureID = pictureID; } public String getPictureName() { return pictureName; } public void setPictureName(String pictureName) { this.pictureName = pictureName; } public Blob getPictureSource() { return pictureSource; } public void setPictureSource(Blob pictureSource) { this.pictureSource = pictureSource; } public int getItemID() { return itemID; } public void setItemID(int itemID) { this.itemID = itemID; } }
[ "diwei77chen@gmail.com" ]
diwei77chen@gmail.com
23419ef8acd1eb48c297a3f0861cba757c7a69cc
3cb3c22ac546ef5b4e8a8270d30491f4fc020609
/module-home/src/main/java/com/runjing/debug/DebugActivity.java
0adbd14e75e895649144f514f9e0d6ff0533cf8f
[]
no_license
GrassJuly/Frame_MVVM_ARouter
1468519be6d4fbe0c5e76b7c2d55a0c0297be9f6
2fbbca89ed43e3902316d3a59e6b4752dc121041
refs/heads/master
2022-12-14T12:01:11.106052
2020-08-12T16:27:53
2020-08-12T16:27:53
287,062,088
0
0
null
null
null
null
UTF-8
Java
false
false
700
java
package com.runjing.debug; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.support.annotation.Nullable; import org.frame.base.ContainerActivity; /** * 组件单独运行时的调试界面,不会被编译进release里 * Created by goldze on 2018/6/21 */ public class DebugActivity extends Activity { @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Intent intent = new Intent(this, ContainerActivity.class); // intent.putExtra("fragment", HomeFragment.class.getCanonicalName()); // this.startActivity(intent); // finish(); } }
[ "qianyu@runjingchina.com" ]
qianyu@runjingchina.com
c7bcc51ce1c41333af417b38abcdb5dec1918867
a2a016ec7878ebe4ce0ac103433309be02894dc0
/src/main/java/org/jdesktop/swingx/image/StackBlurFilter.java
73a2f3ec8e40def875c3a230af16b05462cbd991
[]
no_license
huagetai/TribuneClipper
3483169c8a82b6b5d163e2148626965407f5ba90
1bfaf63a464be22aa8027713f43068531297b8f1
refs/heads/master
2021-05-03T05:47:23.273941
2017-09-15T02:23:32
2017-09-15T02:23:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,658
java
/* * $Id: StackBlurFilter.java 1516 2006-10-25 11:34:35Z gfx $ * * Dual-licensed under LGPL (Sun and Romain Guy) and BSD (Romain Guy). * * Copyright 2006 Sun Microsystems, Inc., 4150 Network Circle, * Santa Clara, California 95054, U.S.A. All rights reserved. * * Copyright (c) 2006 Romain Guy <romain.guy@mac.com> * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.jdesktop.swingx.image; import org.jdesktop.swingx.graphics.GraphicsUtilities; import java.awt.image.BufferedImage; /** * <p>A stack blur filter can be used to create an approximation of a * gaussian blur. The approximation is controlled by the number of times the * {@link org.jdesktop.swingx.image.FastBlurFilter} is applied onto the source * picture. The default number of iterations, 3, provides a decent compromise * between speed and rendering quality.</p> * <p>The force of the blur can be controlled with a radius and the * default radius is 3. Since the blur clamps values on the edges of the * source picture, you might need to provide a picture with empty borders * to avoid artifacts at the edges. The performance of this filter are * independant from the radius.</p> * * @author Romain Guy <romain.guy@mac.com> */ public class StackBlurFilter extends AbstractFilter { private final int radius; private final int iterations; /** * <p>Creates a new blur filter with a default radius of 3 and 3 iterations.</p> */ public StackBlurFilter() { this(3, 3); } /** * <p>Creates a new blur filter with the specified radius and 3 iterations. * If the radius is lower than 1, a radius of 1 will be used automatically.</p> * * @param radius the radius, in pixels, of the blur */ public StackBlurFilter(int radius) { this(radius, 3); } /** * <p>Creates a new blur filter with the specified radius. If the radius * is lower than 1, a radius of 1 will be used automatically. The number * of iterations controls the approximation to a gaussian blur. If the * number of iterations is lower than 1, one iteration will be used * automatically.</p> * * @param radius the radius, in pixels, of the blur * @param iterations the number of iterations to approximate a gaussian blur */ public StackBlurFilter(int radius, int iterations) { if (radius < 1) { radius = 1; } if (iterations < 1) { iterations = 1; } this.radius = radius; this.iterations = iterations; } /** * <p>Returns the effective radius of the stack blur. If the radius of the * blur is 1 and the stack iterations count is 3, then the effective blur * radius is 1 * 3 = 3.</p> * * @return the number of iterations times the blur radius */ public int getEffectiveRadius() { return getIterations() * getRadius(); } /** * <p>Returns the radius used by this filter, in pixels.</p> * * @return the radius of the blur */ public int getRadius() { return radius; } /** * <p>Returns the number of iterations used to approximate a gaussian * blur.</p> * * @return the number of iterations used by this blur */ public int getIterations() { return iterations; } /** * {@inheritDoc} */ @Override public BufferedImage filter(BufferedImage src, BufferedImage dst) { int width = src.getWidth(); int height = src.getHeight(); if (dst == null) { dst = createCompatibleDestImage(src, null); } int[] srcPixels = new int[width * height]; int[] dstPixels = new int[width * height]; GraphicsUtilities.getPixels(src, 0, 0, width, height, srcPixels); for (int i = 0; i < iterations; i++) { // horizontal pass FastBlurFilter.blur(srcPixels, dstPixels, width, height, radius); // vertical pass FastBlurFilter.blur(dstPixels, srcPixels, height, width, radius); } // the result is now stored in srcPixels due to the 2nd pass GraphicsUtilities.setPixels(dst, 0, 0, width, height, srcPixels); return dst; } }
[ "drewmutt@gmail.com" ]
drewmutt@gmail.com
3e73be7cb1f13f17a7c6b8a418fe91b5bf27fe71
d28a07848644a72e77e588d4c09a2a2f58c97498
/1.JavaSyntax/src/com/javarush/task/task08/task0803/Solution.java
78b8cd727ebc52222dbd7c799bed36b9e29be89a
[]
no_license
ishbuldin/JavaRushTasks
7ed194972c9b004405a8c1b7c903935cea7e7ca1
3def2f49e3471cfa4f135ea6b26e870c7b955400
refs/heads/master
2020-04-22T09:03:29.452960
2019-02-12T05:56:36
2019-02-12T05:56:36
167,354,168
0
0
null
null
null
null
UTF-8
Java
false
false
1,217
java
package com.javarush.task.task08.task0803; import java.util.HashMap; import java.util.Map; /* Коллекция HashMap из котов */ public class Solution { public static void main(String[] args) throws Exception { String[] cats = new String[]{"васька", "мурка", "дымка", "рыжик", "серый", "снежок", "босс", "борис", "визя", "гарфи"}; HashMap<String, Cat> map = addCatsToMap(cats); for (Map.Entry<String, Cat> pair : map.entrySet()) { System.out.println(pair.getKey() + " - " + pair.getValue()); } } public static HashMap<String, Cat> addCatsToMap(String[] cats) { //напишите тут ваш код HashMap<String, Cat> map = new HashMap<String, Cat>(); for (int i = 0; i < cats.length; i++) { Cat cat = new Cat(cats[i]); map.put(cat.name, cat); } return map; } public static class Cat { String name; public Cat(String name) { this.name = name; } @Override public String toString() { return name != null ? name.toUpperCase() : null; } } }
[ "ishbuldin89@gmail.com" ]
ishbuldin89@gmail.com
e165ef405e0388618a0d56440f8cca5b2544f30d
447e248e9f740a32d0bbc5f91c6d8093faebe0b5
/src/Search.java
7e540112265e227f5d5edb3dbfa692925e36dbe3
[]
no_license
VadimKirillov/prak14.1
b0bce5faa74813867b1199b2971ec791c6efd4af
f4e4bab09a5d24974775a91b67b625a696a35990
refs/heads/master
2022-12-26T15:03:53.603805
2020-10-04T16:55:53
2020-10-04T16:55:53
301,179,708
0
0
null
null
null
null
UTF-8
Java
false
false
720
java
public class Search { public Student search(Student[] students, String name){ for (Student student : students){ if (student.getName() == name){ return student; } } return null; } public Student[] sort(Student[] students){ int min; Student temp; for (int i= 0; i < students.length-1; i++) { min = i; for (int j = i+1; j < students.length; j++) if (students[j].getID() < (students[min]).getID()) min = j; temp = students[min]; students[min] = students[i]; students[i] = temp; } return students; } }
[ "vadim.kirillov2001@gmail.com" ]
vadim.kirillov2001@gmail.com
149a28a5381247acb2235a0994b9d29c8693795b
f9e5e888e1c2f64c2716b3683598ad7485bd1881
/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/security/credential/impl/X509InlineCredentialFactoryBean.java
bdb5658866d3f3522f598f2b837ba63403fdda3c
[]
no_license
nagyistge/shibboleth-idp-v3
cc53646106761727f26941d9358e84520dcc6212
e3fbf872a8e5fc74657bfc89cabd584751e92336
refs/heads/master
2021-05-02T12:14:18.926237
2015-11-19T20:26:49
2015-11-19T20:26:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,886
java
/* * Licensed to the University Corporation for Advanced Internet Development, * Inc. (UCAID) under one or more contributor license agreements. See the * NOTICE file distributed with this work for additional information regarding * copyright ownership. The UCAID 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 net.shibboleth.idp.profile.spring.relyingparty.security.credential.impl; import java.security.PrivateKey; import java.security.cert.CRLException; import java.security.cert.CertificateException; import java.security.cert.X509CRL; import java.security.cert.X509Certificate; import java.util.List; import javax.annotation.Nonnull; import javax.annotation.Nullable; import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty; import net.shibboleth.utilities.java.support.collection.LazyList; import org.cryptacular.util.KeyPairUtil; import org.opensaml.security.x509.X509Support; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.FatalBeanException; /** * A factory bean to understand X509Inline credentials. */ public class X509InlineCredentialFactoryBean extends AbstractX509CredentialFactoryBean { /** log. */ private final Logger log = LoggerFactory.getLogger(X509InlineCredentialFactoryBean.class); /** The entity certificate. */ private String entityCertificate; /** The certificates. */ private List<String> certificates; /** The private key. */ private byte[] privateKey; /** The crls. */ private List<String> crls; /** * Set the file with the entity certificate. * * @param entityCert The file to set. */ public void setEntity(@Nonnull final String entityCert) { entityCertificate = entityCert; } /** * Sets the files which contain the certificates. * * @param certs The value to set. */ public void setCertificates(@Nullable @NotEmpty final List<String> certs) { certificates = certs; } /** * Set the file with the entity certificate. * * @param key The file to set. */ public void setPrivateKey(@Nullable final byte[] key) { privateKey = key; } /** * Sets the files which contain the crls. * * @param list The value to set. */ public void setCRLs(@Nullable @NotEmpty final List<String> list) { crls = list; } /** {@inheritDoc}. */ @Override @Nullable protected X509Certificate getEntityCertificate() { if (null == entityCertificate) { return null; } try { return X509Support.decodeCertificate(entityCertificate); } catch (CertificateException e) { log.error("{}: Could not decode provided Entity Certificate", getConfigDescription(), e); throw new FatalBeanException("Could not decode provided Entity Certificate", e); } } /** {@inheritDoc} */ @Override @Nonnull protected List<X509Certificate> getCertificates() { List<X509Certificate> certs = new LazyList<>(); for (String cert : certificates) { try { certs.add(X509Support.decodeCertificate(cert.trim())); } catch (CertificateException e) { log.error("{}: Could not decode provided Certificate", getConfigDescription(), e); throw new FatalBeanException("Could not decode provided Certificate", e); } } return certs; } /** {@inheritDoc} */ @Override @Nullable protected PrivateKey getPrivateKey() { if (null == privateKey) { return null; } return KeyPairUtil.decodePrivateKey(privateKey, getPrivateKeyPassword()); } /** {@inheritDoc} */ @Override @Nullable protected List<X509CRL> getCRLs() { if (null == crls) { return null; } List<X509CRL> result = new LazyList<>(); for (String crl : crls) { try { result.add(X509Support.decodeCRL(crl)); } catch (CRLException | CertificateException e) { log.error("{}: Could not decode provided CRL", getConfigDescription(), e); throw new FatalBeanException("Could not decode provided CRL", e); } } return result; } }
[ "tzeller@03af267c-bfd3-464a-89ef-4aea903fec54" ]
tzeller@03af267c-bfd3-464a-89ef-4aea903fec54
59577583632b3ab0da4c28329dea3f10bc585ab7
6fbc8fa0266c120c806c10b33a9d3b1957debe18
/app/src/main/java/id/sch/smktelkom_mlg/learn/hellogit/MainActivity.java
7416a0d2f8b38856e7ed929a12131b2e69113080
[]
no_license
Dessyafaulia/HelloGit
f0289416ab0e9ab613ab1ee51a8c73f35c645ae3
cf331a9f1260a77591bd189101182b1f849267b7
refs/heads/master
2022-04-19T04:08:40.381936
2020-04-13T08:49:09
2020-04-13T08:49:09
255,284,753
0
0
null
null
null
null
UTF-8
Java
false
false
348
java
package id.sch.smktelkom_mlg.learn.hellogit; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } }
[ "dessyafaauliawardana@gmail.com" ]
dessyafaauliawardana@gmail.com
ce17e418ad7467f0571a7a6130d6cab4a6db7916
bea4cebce9d2fbfb80c6c965347ef8efa6236e3d
/src/main/java/com/main/centfor/frame/dao/dialect/MysqlDialect.java
1e4366279cf22aeb32094fda861b208ee8e878b6
[]
no_license
wm20111003/ops
02dd728f0a7fca8c970b5c552142d833ce8122d3
9d10be67eccab81c6d469bb444de13582e991519
refs/heads/master
2021-01-12T12:18:54.004102
2016-11-07T15:18:02
2016-11-07T15:18:02
72,431,392
0
0
null
null
null
null
UTF-8
Java
false
false
842
java
package com.main.centfor.frame.dao.dialect; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Component; import com.main.centfor.frame.util.Page; @Component("mysqlDialect") public class MysqlDialect implements IDialect { @Override public String getPageSql(String sql, String orderby, Page page) { // 设置分页参数 int pageSize = page.getPageSize(); int pageNo = page.getPageIndex(); StringBuffer sb = new StringBuffer(sql); if (StringUtils.isNotBlank(orderby)) { sb.append(" ").append(orderby); } sb.append(" limit ").append(pageSize * (pageNo - 1)).append(",") .append(pageSize); return sb.toString(); } @Override public String getDataDaseType() { return "mysql"; } @Override public boolean isRowNumber() { return false; } }
[ "wm20111003@163.com" ]
wm20111003@163.com
33df31d228fe824891184bd4b547d8f26dd06b07
6822bd79488b172fb9721e8bcf22f7e6b7e3129f
/src/com/company/Main.java
58f9bff5ffe5d753d3e0b2e5b7a095b76d7be811
[]
no_license
ZakharenkoDaniil/Java-leetcode-859
d402e1c399462ed056035eccaf4bdd0cf3bae10f
9ac6c37192766d311793d30d75c2201e6320c6ec
refs/heads/master
2023-04-20T16:10:01.554637
2021-04-28T16:21:33
2021-04-28T16:21:33
362,535,623
0
0
null
null
null
null
UTF-8
Java
false
false
2,776
java
package com.company; import java.util.Iterator; public class Main { public static void main(String[] args) { String a = "aa"; String b = "aa"; Solution s = new Solution(); System.out.println(s.buddyStrings(a,b)); } } class Solution { public boolean buddyStrings(String a, String b) { if(a.length()!=b.length()) { return false; } char[] chars_a = a.toCharArray(); char[] chars_b = b.toCharArray(); if(a.equals(b)) { for(int i = 0;i<chars_a.length-1;i++) { for(int j = i+1;j< chars_a.length;j++) { if(chars_a[i] == chars_a[j]) { return true; } } } return false; } int unpos = 0; for(int i = 0;i<chars_a.length-1;i++) { if(chars_a[i] != chars_b[i]) { unpos++; } if(unpos>2) { return false; } } int start = -1, end = -1; String aa = new String(); String bb = new String(); boolean flag = false; for(int i = 0;i<chars_a.length;i++) { if(chars_a[i]==chars_b[i]) { if(start==-1) { start = i; } else { end = i; } } else { if(start!=-1) { aa += a.substring(0, start); aa += a.substring(end+1); bb += b.substring(0, start); bb += b.substring(end+1); start = -1; end = -1; flag = true; break; } } } if(!flag) { aa = a; bb = b; } chars_a = aa.toCharArray(); chars_b = bb.toCharArray(); System.out.println(chars_a); System.out.println(chars_b); char buf; for(int i = 0;i<chars_a.length-1;i++) { for(int j = i+1; j<chars_a.length; j++) { buf = chars_a[i]; chars_a[i] = chars_a[j]; chars_a[j] = buf; String s1 = new String(chars_a); if(s1.equals(bb)) { return true; } buf = chars_a[i]; chars_a[i] = chars_a[j]; chars_a[j] = buf; } } return false; } }
[ "zakharenko1dany@gmail.com" ]
zakharenko1dany@gmail.com
68521132ac6f386fba9c59b1fb825640e4a62e54
00f3ee98fcc69dbee56ad2e5ade9366e263d64bf
/calculator-docker/src/main/java/com/matheusvargas481/calculator-docker/service/CalculadoraService.java
15e41e563825eff57b5d9517ce3f095f3d658816
[]
no_license
matheusvargas481/Java
0f8c65a8e007fc09a75fbedbd8a3f7c971e5e23d
bd1377cfb3565ee02670e43adf7443786661132f
refs/heads/master
2020-09-30T03:49:37.481617
2019-12-10T19:05:21
2019-12-10T19:05:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
972
java
package com.matheusvargas481.cloudnative.tema6.service; import com.matheusvargas481.cloudnative.tema6.operacao.OperacaoMatematica; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; @Service public class CalculadoraService { @Autowired private ApplicationContext applicationContext; private static List<OperacaoMatematica> historicoDeOperacoes = new ArrayList<>(); public List<OperacaoMatematica> listarHistorico() { return historicoDeOperacoes; } public Double calcular(String operacao, Double numeroUm, Double numeroDois) { OperacaoMatematica operacaoMatematica = (OperacaoMatematica) applicationContext.getBean(operacao, numeroUm, numeroDois); this.historicoDeOperacoes.add(operacaoMatematica); return operacaoMatematica.executar(); } }
[ "matheus.vargas@ilegra.com" ]
matheus.vargas@ilegra.com
b8efa3ed9e7401041543f0c1b7df90186c18550c
a0f36ce396e565475839f301ac2b9c589c023568
/resource-adapter/src/main/java/org/jboss/cassandra/ra/CassandraDriverConnectionFactory.java
9699a699179a2b0f7b227486451d60e51877f296
[ "Apache-2.0" ]
permissive
jpkrohling/cassandra-driver-ra
16310798626b418f4d05a58d6ce5a024c4d381df
0e8e7a5d9a6a02da48fe5c88b38db0f707411eba
refs/heads/master
2021-01-19T06:53:28.934834
2015-12-17T14:53:11
2015-12-17T14:53:11
47,982,987
0
0
null
2015-12-17T14:47:08
2015-12-14T15:20:13
Java
UTF-8
Java
false
false
1,595
java
/* * IronJacamar, a Java EE Connector Architecture implementation * Copyright 2013, Red Hat Inc, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.cassandra.ra; import java.io.Serializable; import javax.resource.Referenceable; import javax.resource.ResourceException; /** * CassandraDriverConnectionFactory * * @version $Revision: $ */ public interface CassandraDriverConnectionFactory extends Serializable, Referenceable { /** * Get connection from factory * * @return CassandraDriverConnection instance * @exception ResourceException Thrown if a connection can't be obtained */ CassandraDriverConnection getConnection() throws ResourceException; }
[ "juraci@kroehling.de" ]
juraci@kroehling.de
9aaade61143967bfbcd75cbab05d698cf7b0dbd9
57e2c665a5506044f7b665bbbfeba16404002039
/src/cliente/app/src/androidTest/java/com/example/cayo/alarmsysmovel/ExampleInstrumentedTest.java
5f829a24245cb66568200b75ff18523d9c9b0467
[]
no_license
cayofontana/alarmsys
4e6ab426f3b82279faa629e8a413cf710fe41371
0271eec5fcbfebaecc0546624a38b97090907bc3
refs/heads/master
2021-04-28T10:37:00.727938
2021-02-06T19:45:18
2021-02-06T19:45:18
122,069,970
0
1
null
null
null
null
UTF-8
Java
false
false
744
java
package com.example.cayo.alarmsysmovel; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.example.cayo.alarmsysmovel", appContext.getPackageName()); } }
[ "cayofontana@gmail.com" ]
cayofontana@gmail.com
c105e9435d0365edb05933af67f9b51a3f914af4
3c34a5fdfe54feb44e450e44a5f643f2488256f4
/project/615Project/src/org/sjtu/p615/am/action/RoleAction.java
09399b48af9c702eb07f221ccf3b20f0286387ae
[]
no_license
csfldf/615
d2cfc8bf9c1588daf3a4364f63e1732246d565bc
7e14e2d56b0ef51c10e06fb3eb85277eefbb0fc7
refs/heads/master
2021-01-09T20:15:26.817933
2016-08-07T12:19:29
2016-08-07T12:19:29
65,131,723
0
0
null
null
null
null
UTF-8
Java
false
false
10,071
java
package org.sjtu.p615.am.action; import java.util.ArrayList; import java.util.Enumeration; import java.util.Iterator; import java.util.List; import java.util.Map; import javax.management.relation.RoleInfo; import javax.servlet.http.HttpServletRequest; import net.sf.json.JSONArray; import net.sf.json.JSONObject; import net.sf.json.JsonConfig; import net.sf.json.util.PropertyFilter; import org.apache.struts2.ServletActionContext; import org.sjtu.p615.am.service.IRoleInfoService; import org.sjtu.p615.am.service.IRoleService; import org.sjtu.p615.entity.Employee; import org.sjtu.p615.entity.Role; import org.sjtu.p615.entity.Roleinfo; import org.sjtu.p615.util.json.JsonDateValueProcessor; import com.opensymphony.xwork2.ActionSupport; public class RoleAction extends ActionSupport{ private IRoleService roleService; private IRoleInfoService roleInfoService; private String employeeNumber; private String employeeId; private String projectName; private String fracasRoleCombine; private String result; private String groupId; private String projectId; private JSONArray jsonary; private Role role; private String roleKey; private String roleId; private Employee[] newGrpMembers; public String getRoleName() { return roleName; } public void setRoleName(String roleName) { this.roleName = roleName; } private String roleName; private JSONObject jsonobj; public String assertRoleByEmployeeId(){ List<Role> roles = roleService.getRoleList(employeeId); boolean ok=false; String trueRoleName = null; if(roleName.equals("TeamLeader")) trueRoleName="组长"; else if(roleName.equalsIgnoreCase("Manager")) trueRoleName="项目经理"; else if(roleName.equalsIgnoreCase("ProjectLeader")) trueRoleName="项目领导"; else if(roleName.equalsIgnoreCase("Worker")) trueRoleName="组员"; else if(roleName.equalsIgnoreCase("DepartmentLeader")) trueRoleName="部门领导"; if(trueRoleName != null) for(Role role : roles){ if(role.getProjectId().equals(projectId) && role.getRoleName().equals(trueRoleName)){ ok = true; break; } } jsonobj = new JSONObject(); jsonobj.put("success",ok); return SUCCESS; } public String getRoleByEmployee() { // List<Role> roles = roleService.getRoleList(projectName); List<Role> roles = roleService.getRoleList(employeeId); JSONArray jArray = JSONArray.fromObject(roles); // setResult(jArray.toString()); setJsonary(jArray); return SUCCESS; } public String getRoleByProject() { List<Role> roles = roleService.getRoleListByProject(projectName); JSONArray jArray = JSONArray.fromObject(roles); setResult(jArray.toString()); return SUCCESS; } public String getRolesForFracas(){ List<Role> roles = roleService.getRoleListByProject(projectName); List<Role> temp_roles = new ArrayList<Role>(); Iterator<Role> it = roles.iterator(); while(it.hasNext()){ Role role=it.next(); boolean exist = false; for(int i=0; i<temp_roles.size(); i++){ Role temp_role = roles.get(i); if(temp_role.getEmployeeName().equals(role.getEmployeeName())){ exist = true; } } if(!exist){ temp_roles.add(role); } } JSONArray jArray = JSONArray.fromObject(temp_roles); setResult(jArray.toString()); return SUCCESS; } public String getRoleByGroup(){ List<Role> roles = roleService.getRoleListByGroup(Integer.parseInt(groupId)); JSONArray jArray = JSONArray.fromObject(roles); this.setJsonary(jArray); setResult(jArray.toString()); return SUCCESS; } public String changeFracasRole() { String[] params = fracasRoleCombine.split(" "); List<Role> roles = roleService.getRoleListByProject(params[0]); for (Role role : roles) { if (role.getRoleName() == null) { continue; } if (role.getRoleName().equals("project_leader")) { role.setEmployeeId(params[1]); role.setEmployeeName(params[2]); } else if (role.getRoleName().equals("qa_leader")) { role.setEmployeeId(params[3]); role.setEmployeeName(params[4]); } else if (role.getRoleName().equals("mrb")) { role.setEmployeeId(params[5]); role.setEmployeeName(params[6]); } roleService.saveRole(role); } return SUCCESS; } public String saveRole(){ roleService.saveRole(role); return SUCCESS; } public String addRoles(){ // HttpServletRequest request=null; // try { // request=ServletActionContext.getRequest(); // Map<String,String[]> mm=request.getParameterMap(); // JSONObject json=JSONObject.fromObject(mm); // Enumeration enu=request.getParameterNames(); // while(enu.hasMoreElements()){ // String paraName=(String)enu.nextElement(); // System.out.println(paraName+": "+request.getParameter(paraName)); // } // } // catch (Exception e) { // // TODO: handle exception // e.printStackTrace(); // } List<Role> roles=null; Role role=null; jsonobj=new JSONObject(); for(Employee tmp:newGrpMembers){ role=new Role(); role.setEmployeeId(tmp.getEmployeeNumber()); role.setGroupId(Integer.parseInt(groupId)); role.setProjectId(projectId); role.setProjectName(projectName); role.setEmployeeName(tmp.getEmployeeName()); role.setRoleId(12); role.setDeleteMark(false); role.setRoleName("组员"); roles.add(role); } try{ roleService.addRoles(roles); jsonobj.put("msg", "success"); } catch(Exception e){ e.printStackTrace(); jsonobj.put("msg", "error"); } return SUCCESS; } public String changeOneRole(){ Role role=roleService.getOneRole(Integer.parseInt(roleKey)); role.setRoleId(Integer.parseInt(roleId)); //Roleinfo roleInfo=roleInfoService.getById(Integer.parseInt(roleId)); //role.setRoleName(roleInfo.getRoleName()); jsonobj=new JSONObject(); try{ roleService.saveRole(role); } catch(Exception e){ e.printStackTrace(); jsonobj.put("msg", "error"); } jsonobj.put("msg","success"); return SUCCESS; } public String deleteOneRole(){ jsonobj=new JSONObject(); try{ roleService.deleteOneRole(Integer.parseInt(roleKey)); } catch(Exception e){ e.printStackTrace(); jsonobj.put("msg", "error"); } jsonobj.put("msg","success"); return SUCCESS; } public String addOneRole(){ jsonobj=new JSONObject(); try{ Role role=new Role(); role.setEmployeeId(employeeId); role.setGroupId(Integer.parseInt(groupId)); role.setProjectId(projectId); role.setRoleId(1); role.setDeleteMark(false); roleService.saveRole(role); } catch(Exception e){ e.printStackTrace(); jsonobj.put("msg", "error"); } jsonobj.put("msg","success"); return SUCCESS; } public String addGrpMember(){ jsonobj=new JSONObject(); try{ Role role=new Role(); role.setEmployeeId(employeeId); role.setGroupId(Integer.parseInt(groupId)); role.setProjectId(projectId); role.setRoleId(1); role.setDeleteMark(false); roleService.saveRole(role); } catch(Exception e){ e.printStackTrace(); jsonobj.put("msg", "error"); } jsonobj.put("msg","success"); return SUCCESS; } //��ȡ�������ƻ�Ȩ�� public String getUserPrivilege(){ List<Role> roleList = roleService.getRoleList(employeeId); for(Role tmp:roleList){ if(tmp.getRoleId().equals(7)){ setResult("approval"); return SUCCESS; } } setResult("disapproval"); return SUCCESS; } //��ȡ��Ŀ���� public String getallManager(){ List<Role> roleList = roleService.getRoleByRoleId(3); JsonConfig cfg = new JsonConfig(); cfg.registerJsonValueProcessor(java.sql.Date.class, new JsonDateValueProcessor()); JSONArray jsonarray=JSONArray.fromObject(roleList,cfg); this.setJsonary(jsonarray); return SUCCESS; } public String getEmployeeNumber() { return employeeNumber; } public void setEmployeeNumber(String employeeNumber) { this.employeeNumber = employeeNumber; } public IRoleService getRoleService() { return roleService; } public void setRoleService(IRoleService roleService) { this.roleService = roleService; } public String getResult() { return result; } public void setResult(String result) { this.result = result; } public String getEmployeeId() { return employeeId; } public void setEmployeeId(String employeeId) { this.employeeId = employeeId; } public String getProjectName() { return projectName; } public void setProjectName(String projectName) { this.projectName = projectName; } public String getFracasRoleCombine() { return fracasRoleCombine; } public void setFracasRoleCombine(String fracasRoleCombine) { this.fracasRoleCombine = fracasRoleCombine; } public String getGroupId() { return groupId; } public void setGroupId(String groupId) { this.groupId = groupId; } public JSONArray getJsonary() { return jsonary; } public void setJsonary(JSONArray jsonary) { this.jsonary = jsonary; } public Role getRole() { return role; } public void setRole(Role role) { this.role = role; } public Employee[] getNewGrpMembers() { return newGrpMembers; } public void setNewGrpMembers(Employee[] newGrpMembers) { this.newGrpMembers = newGrpMembers; } public String getProjectId() { return projectId; } public void setProjectId(String projectId) { this.projectId = projectId; } public String getRoleKey() { return roleKey; } public void setRoleKey(String roleKey) { this.roleKey = roleKey; } public String getRoleId() { return roleId; } public void setRoleId(String roleId) { this.roleId = roleId; } public IRoleInfoService getRoleInfoService() { return roleInfoService; } public void setRoleInfoService(IRoleInfoService roleInfoService) { this.roleInfoService = roleInfoService; } public JSONObject getJsonobj() { return jsonobj; } public void setJsonobj(JSONObject jsonobj) { this.jsonobj = jsonobj; } }
[ "t-jis@microsoft.com" ]
t-jis@microsoft.com
5ba2616ed611905c8135166b1bf88a69eb98a748
6f2ac6abe8598d4066f485e6924fe081017169dc
/src/lk/ijse/hos/business/custom/DoctorBO.java
5443fffa7d1cf4e84c288885577ddc6ea1b7ee28
[]
no_license
sashikassn/Health-Care-System-JavaFX-Layered-
8c553872f4c9cf8f552ad0e95f02b64ebfd7cbe4
6897de05d15fa09adcc8ea2ba25c7b446117499e
refs/heads/master
2020-03-27T21:24:56.367827
2019-07-25T04:03:48
2019-07-25T04:03:48
147,141,627
2
2
null
null
null
null
UTF-8
Java
false
false
736
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 lk.ijse.hos.business.custom; import java.util.ArrayList; import lk.ijse.hos.business.SuperBO; import lk.ijse.hos.dto.DoctorDTO; /** * * @author slash */ public interface DoctorBO extends SuperBO{ public boolean saveDoctor(DoctorDTO doctor)throws Exception; public boolean updateDoctor(DoctorDTO doctor)throws Exception; public boolean deleteDoctor(String id)throws Exception; public DoctorDTO findByID(String id)throws Exception; public ArrayList<DoctorDTO> getAllDoctors()throws Exception; }
[ "sashikassn@gmail.com" ]
sashikassn@gmail.com
0eb18b5b293cae82afdf83b02fab1e6ac6bf82d2
07b37c41f2df33cc9025a8a8f2f910751b00a94e
/Ejercicio8/ejercicio8App.java
6704f2779d37474d7d7b0ee650af8f50b0e93b8b
[]
no_license
Pobito/UD20
08b4b48a90a828f6e8ff64ee49e6532c31501611
cf61436f0cdb241a30828b7525afc6aaafff9600
refs/heads/main
2023-07-02T02:00:31.647968
2021-08-07T20:11:34
2021-08-07T20:11:34
392,659,975
0
0
null
null
null
null
UTF-8
Java
false
false
182
java
package Ejercicio8; public class ejercicio8App { public static void main(String[] args) { // TODO Auto-generated method stub ConvertidorPro pro = new ConvertidorPro(); } }
[ "adrianpoboadell@gmail.com" ]
adrianpoboadell@gmail.com
dfb97a07020f1f432d31b7bc2fa47c3b4d15cda7
cf5a475a01cb9122f585ca096ac48b9ded2ad3c6
/c/beginner_level/set8/perfect_square.java
61472ceb916e08cdc5e55a1fc31706735d148776
[]
no_license
Mohanraj007/GUVI_codekata1
2b8ba72c0bb6beb32f16e9679b82170bee829ca4
209b5ab791cf43c80c15b3013cb1ab92baab4f83
refs/heads/master
2021-04-28T06:38:33.806875
2018-06-19T14:12:47
2018-06-19T14:12:47
122,206,359
0
0
null
null
null
null
UTF-8
Java
false
false
395
java
import java.util.*; import java.lang.*; import java.util.ArrayList; public class sqrt{ public static void main(String aa[]){ int b; Scanner s=new Scanner(System.in); b=s.nextInt(); int c=s.nextInt(); int h1=b*c; double j=Math.sqrt(h1); if(j==c){ System.out.println("Yes"); } else{ System.out.println("No"); } } }
[ "noreply@github.com" ]
noreply@github.com
28370dd3de07a2455bfaeab5253d6b26611a8f02
47015643ec90d81b19544b60a4e1ce7b6c956d40
/src/main/java/com/launchdarkly/api/model/RelayProxyConfig.java
92969fa4c26ef7353a6cdc7f443e30becb322e32
[ "Apache-2.0" ]
permissive
AlphaLazer/api-client-java
6d5a7ce25a3f6a19e667c8cedb52ce693190b4ce
ffca8431f21be58b54a7f4110f0119abdafcfa92
refs/heads/master
2023-02-05T16:57:25.639071
2020-12-15T02:55:15
2020-12-15T02:55:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,396
java
/* * LaunchDarkly REST API * Build custom integrations with the LaunchDarkly REST API * * OpenAPI spec version: 4.0.0 * Contact: support@launchdarkly.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ package com.launchdarkly.api.model; import java.util.Objects; import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.launchdarkly.api.model.Member; import com.launchdarkly.api.model.Policy; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.util.ArrayList; import java.util.List; /** * RelayProxyConfig */ @javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2020-12-15T02:54:39.973Z") public class RelayProxyConfig { @SerializedName("_id") private String id = null; @SerializedName("_creator") private Member creator = null; @SerializedName("name") private String name = null; @SerializedName("policy") private List<Policy> policy = new ArrayList<Policy>(); @SerializedName("fullKey") private String fullKey = null; @SerializedName("displayKey") private String displayKey = null; @SerializedName("creationDate") private Long creationDate = null; @SerializedName("lastModified") private Long lastModified = null; public RelayProxyConfig id(String id) { this.id = id; return this; } /** * Get id * @return id **/ @ApiModelProperty(required = true, value = "") public String getId() { return id; } public void setId(String id) { this.id = id; } public RelayProxyConfig creator(Member creator) { this.creator = creator; return this; } /** * Get creator * @return creator **/ @ApiModelProperty(required = true, value = "") public Member getCreator() { return creator; } public void setCreator(Member creator) { this.creator = creator; } public RelayProxyConfig name(String name) { this.name = name; return this; } /** * A human-friendly name for the relay proxy configuration * @return name **/ @ApiModelProperty(example = "My relay proxy config", required = true, value = "A human-friendly name for the relay proxy configuration") public String getName() { return name; } public void setName(String name) { this.name = name; } public RelayProxyConfig policy(List<Policy> policy) { this.policy = policy; return this; } public RelayProxyConfig addPolicyItem(Policy policyItem) { this.policy.add(policyItem); return this; } /** * Get policy * @return policy **/ @ApiModelProperty(required = true, value = "") public List<Policy> getPolicy() { return policy; } public void setPolicy(List<Policy> policy) { this.policy = policy; } public RelayProxyConfig fullKey(String fullKey) { this.fullKey = fullKey; return this; } /** * Full secret key. Only included if creating or resetting the relay proxy configuration * @return fullKey **/ @ApiModelProperty(example = "rel-8a3a773d-b75e-48eb-a850-492cda9266eo", value = "Full secret key. Only included if creating or resetting the relay proxy configuration") public String getFullKey() { return fullKey; } public void setFullKey(String fullKey) { this.fullKey = fullKey; } public RelayProxyConfig displayKey(String displayKey) { this.displayKey = displayKey; return this; } /** * The last 4 digits of the unique secret key for this relay proxy configuration * @return displayKey **/ @ApiModelProperty(example = "66eo", required = true, value = "The last 4 digits of the unique secret key for this relay proxy configuration") public String getDisplayKey() { return displayKey; } public void setDisplayKey(String displayKey) { this.displayKey = displayKey; } public RelayProxyConfig creationDate(Long creationDate) { this.creationDate = creationDate; return this; } /** * A unix epoch time in milliseconds specifying the creation time of this relay proxy configuration * @return creationDate **/ @ApiModelProperty(example = "1443652232590", required = true, value = "A unix epoch time in milliseconds specifying the creation time of this relay proxy configuration") public Long getCreationDate() { return creationDate; } public void setCreationDate(Long creationDate) { this.creationDate = creationDate; } public RelayProxyConfig lastModified(Long lastModified) { this.lastModified = lastModified; return this; } /** * A unix epoch time in milliseconds specifying the last time this relay proxy configuration was modified * @return lastModified **/ @ApiModelProperty(example = "1469326565348", required = true, value = "A unix epoch time in milliseconds specifying the last time this relay proxy configuration was modified") public Long getLastModified() { return lastModified; } public void setLastModified(Long lastModified) { this.lastModified = lastModified; } @Override public boolean equals(java.lang.Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } RelayProxyConfig relayProxyConfig = (RelayProxyConfig) o; return Objects.equals(this.id, relayProxyConfig.id) && Objects.equals(this.creator, relayProxyConfig.creator) && Objects.equals(this.name, relayProxyConfig.name) && Objects.equals(this.policy, relayProxyConfig.policy) && Objects.equals(this.fullKey, relayProxyConfig.fullKey) && Objects.equals(this.displayKey, relayProxyConfig.displayKey) && Objects.equals(this.creationDate, relayProxyConfig.creationDate) && Objects.equals(this.lastModified, relayProxyConfig.lastModified); } @Override public int hashCode() { return Objects.hash(id, creator, name, policy, fullKey, displayKey, creationDate, lastModified); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class RelayProxyConfig {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" creator: ").append(toIndentedString(creator)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" policy: ").append(toIndentedString(policy)).append("\n"); sb.append(" fullKey: ").append(toIndentedString(fullKey)).append("\n"); sb.append(" displayKey: ").append(toIndentedString(displayKey)).append("\n"); sb.append(" creationDate: ").append(toIndentedString(creationDate)).append("\n"); sb.append(" lastModified: ").append(toIndentedString(lastModified)).append("\n"); sb.append("}"); return sb.toString(); } /** * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } }
[ "team@launchdarkly.com" ]
team@launchdarkly.com
6687bc6e39fb77515fff791de02a4a557733e8ef
2ba30ff60b31576decccb83f33bda63c376e9a47
/springbatch/src/main/java/test/springbatch/Application.java
1f1899c132dd5497a8d3ea75c20e4749b4b39a37
[]
no_license
kenti-lan/framework
74fc09afee70a0545a47c1c9213fbeb8ff8c4380
88cd8f7b20e93bc06bcb4158a2c50b322a86a030
refs/heads/master
2021-01-15T14:23:19.437876
2017-03-29T07:12:14
2017-03-29T07:12:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
313
java
package test.springbatch; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class Application { public static void main(String[] args) throws Exception { SpringApplication.run(Application.class, args); } }
[ "809707651@qq.com" ]
809707651@qq.com
1cb79ff14f63ce4f9ae85439b2f110515a3e4906
33ce1b6b55b7d36baf532f358cbd6dedd118a537
/app/src/main/java/com/example/guillaume_grand_clement/herowars/network/request/impl/SampleRequest.java
32a6c51431f277d23b3ddd467d254981826ac01b
[]
no_license
ggrandclement/Realm
c62bcb19b62384be1df24d2facd60f3d756afee9
a2f10ed350a1b063dc4f539782f441c6fa190f06
refs/heads/master
2021-01-12T09:45:54.654521
2016-12-12T09:57:43
2016-12-12T09:57:43
76,243,519
2
0
null
null
null
null
UTF-8
Java
false
false
1,484
java
package com.example.guillaume_grand_clement.herowars.network.request.impl; import android.content.Context; import com.example.guillaume_grand_clement.herowars.data.pojo.SamplePojo; import com.example.guillaume_grand_clement.herowars.network.client.WebClient; import com.example.guillaume_grand_clement.herowars.network.request.AbsRequest; import rx.Observable; public class SampleRequest extends AbsRequest<SamplePojo> { //region Constants ***************************************************************************** //endregion //region Fields ******************************************************************************** //endregion //region Override Methods ********************************************************************** //endregion //region Public Methods ************************************************************************ public SampleRequest(Context context) { super(context); } @Override public Observable<SamplePojo> asObservable() { return WebClient.getService(mContext).sampleService().asObservable(); } //endregion //region Protected Methods ********************************************************************* //endregion //region Private Methods *********************************************************************** //endregion //region Inner Classes or Interfaces *********************************************************** //endregion }
[ "guillaume.grand-clement@niji.fr" ]
guillaume.grand-clement@niji.fr
41be7be8b185b2d839a021053e74f97116e1bcb2
53330fdbf3ef129d8b8bee73a7c27b2da55f7612
/src/leetcode竞赛/十月/sf10_9/滑动窗口的最大值.java
b73af285e91f0ca169ab919ec30d70ab0b583b9e
[]
no_license
HuYaXing/DataStructures
a96c2c95c54abda75c88579989fb7ad1c4ccf65b
08e24e4d60ee6d1b8e09c8c172703a169b8365bf
refs/heads/master
2021-07-21T17:46:20.357646
2020-10-10T09:27:53
2020-10-10T09:27:53
220,730,480
0
0
null
null
null
null
GB18030
Java
false
false
899
java
package leetcode竞赛.十月.sf10_9; import java.util.Deque; import java.util.LinkedList; /** * @author :huyaxing * @date :Created in 2020/10/9 下午3:09 */ public class 滑动窗口的最大值 { public int[] maxSlidingWindow(int[] nums, int k) { if (nums.length == 0 || k == 0) { return new int[0]; } int[] res = new int[nums.length - k + 1]; Deque<Integer> deque = new LinkedList<>(); for (int j = 0, i = 1 - k; j < nums.length; i++, j++) { if (i > 0 && deque.peekFirst() == nums[i - 1]){ deque.removeFirst(); } while (!deque.isEmpty() && deque.peekLast() < nums[j]){ deque.removeLast(); } deque.addLast(nums[j]); if (i >= 0){ res[i] = deque.peekFirst(); } } return res; } }
[ "huyaxing@xiaomi.com" ]
huyaxing@xiaomi.com
ed7480946eda30406fe3cad510e753239fdb6d0b
0b72c88b4b4603952e8d59b68a39ebc5ab3d2da4
/Week_08/shardingsphere-sharding-demo/src/main/java/com/task/java/week08/shardingsphereshardingdemo/service/GoodsService.java
590725e7b3c565c2604c29f8a9984b6ffe4f378d
[]
no_license
wjdeng/JAVA-000
0d7d6dda1aaf7fe6ce20bca920f01e085e3d6f34
32395383f0fe1fb7f37cd903f6aa898f14992313
refs/heads/main
2023-01-28T01:51:32.832829
2020-12-09T03:31:03
2020-12-09T03:31:03
302,827,440
0
0
null
2020-10-10T06:02:19
2020-10-10T06:02:19
null
UTF-8
Java
false
false
390
java
package com.task.java.week08.shardingsphereshardingdemo.service; import com.task.java.week08.shardingsphereshardingdemo.entity.Goods; import java.util.List; /** * @Author Wayne.Deng * @Date 2020/12/8 上午10:29 * @Version 1.0 **/ public interface GoodsService { public Goods insert(Goods goods); public List<Goods> listAll(); public void delete(Long goodsId, Long buyerId); }
[ "392126858@qq.com" ]
392126858@qq.com
b05027fcd13ad67ad8920be3d6f6a9464955c100
5abe0e0094925099481f72033e2129e7e995d93e
/app/src/test/java/com/example/naim/postit/ExampleUnitTest.java
26e06a92bb7d32b8bdd99c3fdf15a4b566230aaf
[]
no_license
JannatulNaim/PostIt
9d4eecdeccf6c9a68689ed13aa3af7b332202f79
76bafecbe1c2cfd80beba21d06e7dbafaa4fea97
refs/heads/master
2020-04-08T23:20:22.294236
2018-12-05T03:46:40
2018-12-05T03:46:40
159,820,757
0
0
null
null
null
null
UTF-8
Java
false
false
384
java
package com.example.naim.postit; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
[ "uwork23@gmail.com" ]
uwork23@gmail.com
14fe79e5e52a8c87f6db29d2ad075f00a181e409
c0784a62132637db3a14615348698af7ebad9799
/app/src/main/java/com/teamfrugal/budgetapp/ui/shoppinglist/StringAdapter.java
bfaa7521e30a4d27bc7be26500bff2282a3a5c3e
[ "Apache-2.0" ]
permissive
msg91b/budgetapp
9c874d3897b472e8430864ebca10bd9ced178b4e
a17bb53366bc3746d39b81b27a92be3d95dc6b9b
refs/heads/master
2020-05-25T15:42:06.605606
2017-07-11T05:54:05
2017-07-11T05:54:05
69,082,739
0
2
null
2017-05-05T10:22:42
2016-09-24T05:40:52
Java
UTF-8
Java
false
false
1,004
java
package com.teamfrugal.budgetapp.ui.shoppinglist; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; import com.teamfrugal.budgetapp.R; import java.util.ArrayList; /** * Created by kevin on 4/16/15. */ public class StringAdapter extends ArrayAdapter<Item> { View.OnTouchListener mTouchListener; public StringAdapter(Context context, ArrayList<Item> values, View.OnTouchListener listener) { super(context, R.layout.listview_item, values); mTouchListener = listener; } @Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = LayoutInflater.from(getContext()); View v = inflater.inflate(R.layout.listview_item, parent, false); TextView b = (TextView) v.findViewById(R.id.row_item); b.setText(getItem(position).toString()); v.setOnTouchListener(mTouchListener); return v; } }
[ "liannelouie@gmail.com" ]
liannelouie@gmail.com
4e5da0d3d90de721dc16bd1633ed9903a10855e4
bf2abac403a9936108b70b21369faa454c8223bb
/199-Binary Tree Right Side View.java
16c089c346c3dfe05c57ba20f11acf7da6a6060c
[]
no_license
wangyf1229/Algorithm-Implementation
0977549e49395446dc7b15c88ef7d9062f328c87
23da958fff8270f2dbf68b8e04c15d66533df4dd
refs/heads/master
2021-05-06T00:01:15.505504
2018-11-05T22:18:56
2018-11-05T22:18:56
116,877,849
0
0
null
null
null
null
UTF-8
Java
false
false
895
java
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ class Solution { public List<Integer> rightSideView(TreeNode root) { //do a level order traversal and add the rightest(last) one into the result List<Integer> list = new ArrayList<>(); if (root == null) return list; Queue<TreeNode> queue = new LinkedList<>(); queue.offer(root); while(!queue.isEmpty()) { int size = queue.size(); for (int i = 0; i < size; i++) { TreeNode node = queue.poll(); if (node.left != null) queue.offer(node.left); if (node.right != null) queue.offer(node.right); if (i == size - 1) list.add(node.val); } } return list; } }
[ "ywang@Yifeis-MacBook-Pro.local" ]
ywang@Yifeis-MacBook-Pro.local
8576df0a2b968ae090a529e343045b3f9e71ac13
007755a5c1806f22ff0688ae36a4a36c9d87a096
/src/main/java/com/gg/petclinic/model/PetType.java
4b67a252fd0f6f577bd54ddc3df4a8594cef0b15
[]
no_license
harunyardimci/spring-training
5434caa3b3e4a415f500d82daedf35683661789b
d0647e61b956548692724d4322bfc4003598ad91
refs/heads/master
2021-01-22T03:08:49.943456
2013-05-12T11:46:40
2013-05-12T11:46:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,108
java
package com.gg.petclinic.model; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Table; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.commons.lang.builder.ToStringStyle; @Entity @Table(name="types") public class PetType extends BaseEntity { private static final long serialVersionUID = 1L; @Column(name="name") private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } public boolean equals(Object o) { if (o == null) return false; if(this == o) return true; if (!PetType.class.isAssignableFrom(o.getClass())) return false; PetType pt = (PetType) o; return new EqualsBuilder().append(getName(), pt.getName()).isEquals(); } public int hashCode() { return new HashCodeBuilder().append(getName()).toHashCode(); } public String toString() { return ToStringBuilder.reflectionToString(this,ToStringStyle.SIMPLE_STYLE); } }
[ "hyardimci@ebay.com" ]
hyardimci@ebay.com
9ffb2bc6a1c502f9b11d61507535cd2ebf54549f
de1bbecf074fd3cfd4f213e69fe77e815c147d46
/Ex1/src/Exercise/Ex4.java
aae05691601ef3833c01be6e7476c301302b50d4
[]
no_license
cuongdang1998/BaiTapString
00a2d12c4f1c60f9e9947b91a66672b4e81fbf49
08b09666103f3a477ec61b147f68c079ce23dea7
refs/heads/master
2022-11-27T22:38:53.488502
2020-08-06T01:13:10
2020-08-06T01:13:10
285,311,851
0
0
null
null
null
null
UTF-8
Java
false
false
1,409
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 Exercise; import java.util.Scanner; /** * * @author quoccuong */ public class Ex4 { public static final char CHAR_55 = 55; private static Scanner scanner = new Scanner(System.in); public static void main(String[] args) { System.out.print("Nhập số nguyên dương n = "); int n = scanner.nextInt(); System.out.println("So " + n + " trong he co so 2 = " + convertNumber(n, 2)); System.out.println("So " + n + " trong he co so 16 = " + convertNumber(n, 16)); } public static String convertNumber(int n, int b) { if (n < 0 || b < 2 || b > 16 ) { return ""; } StringBuilder sb = new StringBuilder(); int m; int remainder = n; while (remainder > 0) { if (b > 10) { m = remainder % b; if (m >= 10) { sb.append((char) (CHAR_55 + m)); } else { sb.append(m); } } else { sb.append(remainder % b); } remainder = remainder / b; } return sb.reverse().toString(); } }
[ "quoccuong.aha@gmail.com" ]
quoccuong.aha@gmail.com
de3e3cf9b744a855e9b5526744c8f4cade11d728
e9affefd4e89b3c7e2064fee8833d7838c0e0abc
/aws-java-sdk-timestreamwrite/src/main/java/com/amazonaws/services/timestreamwrite/model/Tag.java
e9a88799c0d68b6a39d1ae7b3358329ef960f844
[ "Apache-2.0" ]
permissive
aws/aws-sdk-java
2c6199b12b47345b5d3c50e425dabba56e279190
bab987ab604575f41a76864f755f49386e3264b4
refs/heads/master
2023-08-29T10:49:07.379135
2023-08-28T21:05:55
2023-08-28T21:05:55
574,877
3,695
3,092
Apache-2.0
2023-09-13T23:35:28
2010-03-22T23:34:58
null
UTF-8
Java
false
false
5,660
java
/* * Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.timestreamwrite.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** * <p> * A tag is a label that you assign to a Timestream database and/or table. Each tag consists of a key and an optional * value, both of which you define. With tags, you can categorize databases and/or tables, for example, by purpose, * owner, or environment. * </p> * * @see <a href="http://docs.aws.amazon.com/goto/WebAPI/timestream-write-2018-11-01/Tag" target="_top">AWS API * Documentation</a> */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class Tag implements Serializable, Cloneable, StructuredPojo { /** * <p> * The key of the tag. Tag keys are case sensitive. * </p> */ private String key; /** * <p> * The value of the tag. Tag values are case-sensitive and can be null. * </p> */ private String value; /** * <p> * The key of the tag. Tag keys are case sensitive. * </p> * * @param key * The key of the tag. Tag keys are case sensitive. */ public void setKey(String key) { this.key = key; } /** * <p> * The key of the tag. Tag keys are case sensitive. * </p> * * @return The key of the tag. Tag keys are case sensitive. */ public String getKey() { return this.key; } /** * <p> * The key of the tag. Tag keys are case sensitive. * </p> * * @param key * The key of the tag. Tag keys are case sensitive. * @return Returns a reference to this object so that method calls can be chained together. */ public Tag withKey(String key) { setKey(key); return this; } /** * <p> * The value of the tag. Tag values are case-sensitive and can be null. * </p> * * @param value * The value of the tag. Tag values are case-sensitive and can be null. */ public void setValue(String value) { this.value = value; } /** * <p> * The value of the tag. Tag values are case-sensitive and can be null. * </p> * * @return The value of the tag. Tag values are case-sensitive and can be null. */ public String getValue() { return this.value; } /** * <p> * The value of the tag. Tag values are case-sensitive and can be null. * </p> * * @param value * The value of the tag. Tag values are case-sensitive and can be null. * @return Returns a reference to this object so that method calls can be chained together. */ public Tag withValue(String value) { setValue(value); return this; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getKey() != null) sb.append("Key: ").append(getKey()).append(","); if (getValue() != null) sb.append("Value: ").append(getValue()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof Tag == false) return false; Tag other = (Tag) obj; if (other.getKey() == null ^ this.getKey() == null) return false; if (other.getKey() != null && other.getKey().equals(this.getKey()) == false) return false; if (other.getValue() == null ^ this.getValue() == null) return false; if (other.getValue() != null && other.getValue().equals(this.getValue()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getKey() == null) ? 0 : getKey().hashCode()); hashCode = prime * hashCode + ((getValue() == null) ? 0 : getValue().hashCode()); return hashCode; } @Override public Tag clone() { try { return (Tag) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } @com.amazonaws.annotation.SdkInternalApi @Override public void marshall(ProtocolMarshaller protocolMarshaller) { com.amazonaws.services.timestreamwrite.model.transform.TagMarshaller.getInstance().marshall(this, protocolMarshaller); } }
[ "" ]
4ffa370e29e5fe75b450b037396503d20a15e56b
5b5366b7e851675093161d1cbd6682cf1a59bba3
/x509_policy_client/src/main/java/com/pd/DoubleIt.java
d0a9dabf5ce0612f6d4a1e457365ec52b59dc16d
[]
no_license
pdholakia/mule_ws_policy
ad1fd97654d432ed56a87e997629321d0a38617a
4c03087eafedace241d974deb2ded4d1d34e5a19
refs/heads/master
2021-01-25T07:44:26.724154
2017-06-07T17:35:48
2017-06-07T17:35:48
93,661,743
0
0
null
null
null
null
UTF-8
Java
false
false
1,291
java
package com.pd; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * <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="numberToDouble" type="{http://www.w3.org/2001/XMLSchema}int"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "numberToDouble" }) @XmlRootElement(name = "DoubleIt") public class DoubleIt { protected int numberToDouble; /** * Gets the value of the numberToDouble property. * */ public int getNumberToDouble() { return numberToDouble; } /** * Sets the value of the numberToDouble property. * */ public void setNumberToDouble(int value) { this.numberToDouble = value; } }
[ "noreply@github.com" ]
noreply@github.com
07ec592492482988bf0ee6c1e8beb8d0c1e9ea92
322b75b9fabb0028dc99f2caa41afed6a9f11e63
/src/OOP/Them10/Laba5/Share.java
1006c11c3441c24193d0f782582ca943294260ff
[]
no_license
Deni007a/ProjectDeni007
fe162cdf3ca68ab9085a9f894b6a4ec64c5faaf8
aff5e62b9ca9f0e6a923089c393bb3199759abd2
refs/heads/master
2020-12-30T11:27:30.701595
2017-05-18T15:06:42
2017-05-18T15:06:42
91,553,502
0
0
null
null
null
null
UTF-8
Java
false
false
985
java
package OOP.Them10.Laba5; /** * Created by Den on 16.02.2017. */ public abstract class Share implements Drawable { private String shapeColor; public abstract double calcArea(); public static Share parseShape(String inputString){ String[]tokkens = inputString.split(" "); switch (tokkens[0]){ case "Circle": return Circle.parseCircle(tokkens); case "Rectangle": return Rectangle.parseRectangle(tokkens); case "Triangle": return Triangle.parseTriangle(tokkens); default: return null; } } public Share(String shapeColor) { this.shapeColor = shapeColor; } public Share() { } public String getShapeColor() { return shapeColor; } @Override public String toString() { return "Share: " + "shapeColor=" + shapeColor; } }
[ "Deni007a@yandex.ru" ]
Deni007a@yandex.ru
26d78b389ddcac7198f7e551ca34c8f8e0dfce94
f2117528be329c448c963b69714872fcb8367a1a
/Leader/src/test/java/com/sample/security/SecurityApplicationTests.java
86484ad9756df9fc6a89f9e94283a3ee08c36648
[]
no_license
Shekhan17/ExecutorSystem
6106be5a1b3b48efa5f8fe7aa07ea8c37038b90b
d1f5e77d3cc573ffe57b5d98fe224e03244765f2
refs/heads/master
2023-03-25T19:45:57.501175
2021-03-28T13:48:18
2021-03-28T13:48:18
347,603,006
0
0
null
null
null
null
UTF-8
Java
false
false
213
java
package com.sample.security; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class workerApplicationTests { //@Test void contextLoads() { } }
[ "IlyaBirjukov@gmail.com" ]
IlyaBirjukov@gmail.com
fabd6346150747435fc7b50df3b1a517eb6ef724
466011096bd1cb660b483350d51512abd9b5a2d8
/src/main/java/xdptdr/ulhiunteco/cf/FooCF.java
75ab934f9151f4c2ab7dd1d016932d1c8501d466
[]
no_license
xdptdr/UlHiUnTeCo
8a9a50e374d624be5293123c3ab08d0f10ea4d78
f6a551946af5013a9a3089a762db6ae3897d2a0e
refs/heads/master
2021-01-01T05:21:40.233214
2016-05-20T19:56:41
2016-05-20T19:56:41
58,808,647
2
0
null
null
null
null
UTF-8
Java
false
false
1,033
java
package xdptdr.ulhiunteco.cf; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; @Entity @Table(name = "FOO_CF") public class FooCF { @Id @GeneratedValue @Column(name = "FOO_ID") private Long id; @Column(name = "NAME") private String name; @OneToMany(cascade = { CascadeType.ALL }, mappedBy = "foo") private Collection<BarCF> bars = new ArrayList<>(); public FooCF() { } public FooCF(String name) { this.name = name; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Collection<BarCF> getBars() { return Collections.unmodifiableCollection(bars); } public void addBar(BarCF bar) { this.bars.add(bar); } }
[ "xavierdpt@knowit.foo" ]
xavierdpt@knowit.foo
8820e4dfa0bc1d340724ef6ea796cc3f34a1f09b
a00326c0e2fc8944112589cd2ad638b278f058b9
/src/main/java/000/143/100/CWE789_Uncontrolled_Mem_Alloc__connect_tcp_HashSet_53a.java
3075ea4fb295908ec1d255e95271a658958be665
[]
no_license
Lanhbao/Static-Testing-for-Juliet-Test-Suite
6fd3f62713be7a084260eafa9ab221b1b9833be6
b095b11c7cb6d4a5bb2b76181e35d6ee00e96e68
refs/heads/master
2020-08-24T13:34:04.004149
2019-10-25T09:26:00
2019-10-25T09:26:00
216,822,684
0
1
null
2019-11-08T09:51:54
2019-10-22T13:37:13
Java
UTF-8
Java
false
false
4,698
java
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE789_Uncontrolled_Mem_Alloc__connect_tcp_HashSet_53a.java Label Definition File: CWE789_Uncontrolled_Mem_Alloc.int.label.xml Template File: sources-sink-53a.tmpl.java */ /* * @description * CWE: 789 Uncontrolled Memory Allocation * BadSource: connect_tcp Read data using an outbound tcp connection * GoodSource: A hardcoded non-zero, non-min, non-max, even number * Sinks: HashSet * BadSink : Create a HashSet using data as the initial size * Flow Variant: 53 Data flow: data passed as an argument from one method through two others to a fourth; all four functions are in different classes in the same package * * */ import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; import java.net.Socket; import java.util.logging.Level; public class CWE789_Uncontrolled_Mem_Alloc__connect_tcp_HashSet_53a extends AbstractTestCase { public void bad() throws Throwable { int data; data = Integer.MIN_VALUE; /* Initialize data */ /* Read data using an outbound tcp connection */ { Socket socket = null; BufferedReader readerBuffered = null; InputStreamReader readerInputStream = null; try { /* Read data using an outbound tcp connection */ socket = new Socket("host.example.org", 39544); /* read input from socket */ readerInputStream = new InputStreamReader(socket.getInputStream(), "UTF-8"); readerBuffered = new BufferedReader(readerInputStream); /* POTENTIAL FLAW: Read data using an outbound tcp connection */ String stringNumber = readerBuffered.readLine(); if (stringNumber != null) /* avoid NPD incidental warnings */ { try { data = Integer.parseInt(stringNumber.trim()); } catch(NumberFormatException exceptNumberFormat) { IO.logger.log(Level.WARNING, "Number format exception parsing data from string", exceptNumberFormat); } } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error with stream reading", exceptIO); } finally { /* clean up stream reading objects */ try { if (readerBuffered != null) { readerBuffered.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing BufferedReader", exceptIO); } try { if (readerInputStream != null) { readerInputStream.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing InputStreamReader", exceptIO); } /* clean up socket objects */ try { if (socket != null) { socket.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing Socket", exceptIO); } } } (new CWE789_Uncontrolled_Mem_Alloc__connect_tcp_HashSet_53b()).badSink(data ); } public void good() throws Throwable { goodG2B(); } /* goodG2B() - use goodsource and badsink */ private void goodG2B() throws Throwable { int data; /* FIX: Use a hardcoded number that won't cause underflow, overflow, divide by zero, or loss-of-precision issues */ data = 2; (new CWE789_Uncontrolled_Mem_Alloc__connect_tcp_HashSet_53b()).goodG2BSink(data ); } /* Below is the main(). It is only used when building this testcase on * its own for testing or for building a binary to use in testing binary * analysis tools. It is not used when compiling all the testcases as one * application, which is how source code analysis tools are tested. */ public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException { mainFromParent(args); } }
[ "anhtluet12@gmail.com" ]
anhtluet12@gmail.com
321f891310b3e2cc9d761e1eccc2938442e43d6c
2ea6eb69f719acd61bdf73a6c2e42d0a95f0bf21
/src/main/java/com/lrm/po/Group.java
1e0c2788a1deda1a3ed4aeafc8fea6f80b935b5f
[]
no_license
greent2008/hrms
1f1694a8712f0741371c0e1611a6283b651dd5a9
a7d0f1ff17e8e977aaeb61e9777b00c1dfa9da56
refs/heads/master
2021-05-19T07:12:33.041764
2020-04-01T05:55:59
2020-04-01T05:55:59
251,580,158
0
0
null
null
null
null
UTF-8
Java
false
false
2,096
java
package com.lrm.po; import javax.persistence.*; import java.util.ArrayList; import java.util.Date; import java.util.List; /** * Created by jianengxi on 2020/2/19 */ @Entity @Table(name = "t_group") public class Group { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private String groupName; private String groupName_CN; private Long priority; @OneToMany(mappedBy = "group") private List<User> users = new ArrayList<>(); @Temporal(TemporalType.TIMESTAMP) private Date createTime; @Temporal(TemporalType.TIMESTAMP) private Date updateTime; public Group() { } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getGroupName() { return groupName; } public void setGroupName(String groupName) { this.groupName = groupName; } public String getGroupName_CN() { return groupName_CN; } public void setGroupName_CN(String groupName_CN) { this.groupName_CN = groupName_CN; } public Long getPriority() { return priority; } public void setPriority(Long priority) { this.priority = priority; } public List<User> getUsers() { return users; } public void setUsers(List<User> users) { this.users = users; } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public Date getUpdateTime() { return updateTime; } public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; } @Override public String toString() { return "Group{" + "id=" + id + ", groupName='" + groupName + '\'' + ", groupName_CN='" + groupName_CN + '\'' + ", priority=" + priority + ", createTime=" + createTime + ", updateTime=" + updateTime + '}'; } }
[ "jianengxi@yahoo.com" ]
jianengxi@yahoo.com
53f8dc6b3646f82eee034974ec04c6d0b50329b7
3b150be1b781b17495e43c73daab94a940ba1fef
/lib_common/src/main/java/com/sg/cj/common/base/App.java
db4d99360c0bf44202c50d4992e00ead75f3fd4b
[]
no_license
DreamFly01/SuanNiHen
e43346a86eb156e36b3eb643e176e735811c4024
c10832fb402a011a93923d074d5755b64ccf1d93
refs/heads/master
2022-01-06T21:52:02.597929
2019-08-02T03:06:49
2019-08-02T03:06:49
195,406,683
1
0
null
null
null
null
UTF-8
Java
false
false
2,118
java
package com.sg.cj.common.base; import android.app.Activity; import android.app.Application; import android.content.Context; import android.support.v7.app.AppCompatDelegate; import android.util.DisplayMetrics; import android.view.Display; import android.view.WindowManager; import java.util.HashSet; import java.util.Set; /** * author : ${CHENJIE} * created at 2018/10/25 16:13 * e_mail : chenjie_goodboy@163.com * describle : */ public class App extends Application { private static App instance; private Set<Activity> allActivities; public static int SCREEN_WIDTH = -1; public static int SCREEN_HEIGHT = -1; public static float DIMEN_RATE = -1.0F; public static int DIMEN_DPI = -1; public static synchronized App getInstance() { return instance; } static { AppCompatDelegate.setDefaultNightMode( AppCompatDelegate.MODE_NIGHT_NO); } @Override public void onCreate() { super.onCreate(); instance = this; //初始化屏幕宽高 getScreenSize(); } public void addActivity(Activity act) { if (allActivities == null) { allActivities = new HashSet<>(); } allActivities.add(act); } public void removeActivity(Activity act) { if (allActivities != null) { allActivities.remove(act); } } public void exitApp() { if (allActivities != null) { synchronized (allActivities) { for (Activity act : allActivities) { act.finish(); } } } android.os.Process.killProcess(android.os.Process.myPid()); System.exit(0); } public void getScreenSize() { WindowManager windowManager = (WindowManager)this.getSystemService(Context.WINDOW_SERVICE); DisplayMetrics dm = new DisplayMetrics(); Display display = windowManager.getDefaultDisplay(); display.getMetrics(dm); DIMEN_RATE = dm.density / 1.0F; DIMEN_DPI = dm.densityDpi; SCREEN_WIDTH = dm.widthPixels; SCREEN_HEIGHT = dm.heightPixels; if(SCREEN_WIDTH > SCREEN_HEIGHT) { int t = SCREEN_HEIGHT; SCREEN_HEIGHT = SCREEN_WIDTH; SCREEN_WIDTH = t; } } }
[ "y290206959@163.com" ]
y290206959@163.com
f52221a269ce242c14090a5bab625eac5a07cadf
93d65ab2a4414f3aab7294135481c89a441410d3
/src/main/java/tech/seekback/tools/Encrypter.java
1f3a9b6de71a51946bd6e93f78f94bdda57950fd
[]
no_license
GKentaurus/seekback-java
4f0de52025e9401bfbaefa4d865d7fa3b4f61f6b
962ca527115b8447740adf399fd6cb0ce65563cd
refs/heads/master
2023-06-09T04:45:41.103966
2021-06-26T03:30:02
2021-06-26T03:30:02
309,847,275
1
0
null
null
null
null
UTF-8
Java
false
false
4,249
java
package tech.seekback.tools; import javax.crypto.SecretKeyFactory; import javax.crypto.spec.PBEKeySpec; import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; import java.security.spec.InvalidKeySpecException; import java.util.Arrays; import java.util.Base64; import java.util.Random; /** * Por medio de una llave generada de forma aleatoria (salt), permite la * encriptación de las contraseñas enviadas por parte del usuario, para ser * almacenadas en la base de datos. * <p> * Tanto la llave (salt) como la contraseña, son almacenadas en la base de datos * de forma que, al momento de requerir la verificación de contraseña, esta * indique si es verdadero o falso. * * @author camorenoc */ public class Encrypter { private static final Random RANDOM = new SecureRandom(); private static final String ALPHABET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; private static final int ITERATIONS = 10000; private static final int KEY_LENGTH = 256; /** * Genera una llave aleatoria con caracteres alfabéticos y numéricos (sin * acentos ni caracteres especiales), la cual será la base de encriptación de * una contraseña, y que será almacenada en la base de datos junto con la * contraseña encriptada. * * @param length Longitud de la llave a generar. * @return Llave de encriptación. */ public static String getSalt(int length) { StringBuilder returnValue = new StringBuilder(length); for (int i = 0; i < length; i++) { returnValue.append(ALPHABET.charAt(RANDOM.nextInt(ALPHABET.length()))); } String saltKey = new String(returnValue); return saltKey; } /** * Genera un Array de tipo byte, el cual servirá como base de encriptación pra * la contraseña. * * @param password Contraseña indicada por el usuario. * @param salt Llave de encriptación. * @return Hash para la generación de contraseña segura. */ public static byte[] hash(char[] password, byte[] salt) { PBEKeySpec spec = new PBEKeySpec(password, salt, ITERATIONS, KEY_LENGTH); Arrays.fill(password, Character.MIN_VALUE); try { SecretKeyFactory skf = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1"); return skf.generateSecret(spec).getEncoded(); } catch (NoSuchAlgorithmException | InvalidKeySpecException e) { throw new AssertionError("Error while hashing a password: " + e.getMessage(), e); } finally { spec.clearPassword(); } } /** * Genera la contraseña encriptada para ser almacenada en la base de datos. * * @param password Contraseña indicada por el usuario. * @param salt Llave de encriptación generada previamente. * @return Contraseña encriptada. */ public static String generateSecurePassword(String password, String salt) { String returnValue = null; byte[] securePassword = hash(password.toCharArray(), salt.getBytes()); returnValue = Base64.getEncoder().encodeToString(securePassword); return returnValue; } /** * Comprueba si la clave proveida por el usuario, al momento de pasar por el * proceso de encriptación con la llave (salt), retorna la misma cadena de * caracteres o una totalmente distinta. * * @param providedPassword Contraseña proveida para el inicio de sesión. * @param securedPassword Contraseña encriptada, almacenada en la base de * datos. * @param salt Llave de encriptación correspondiente al usuario, con la que se * encriptará la contraseña proveida. * @return <code>true</code> si la llave encriptada almacenada y la proveida * encriptada son la misma. */ public static boolean verifyUserPassword(String providedPassword, String securedPassword, String salt) { boolean returnValue = false; // Genera una nueva contraseña segura con la misma llave (salt). String newSecurePassword = generateSecurePassword(providedPassword, salt); // Comprueba si la nueva contraseña segura coincide con la almacenada. returnValue = newSecurePassword.equalsIgnoreCase(securedPassword); return returnValue; } }
[ "gkent@outlook.com" ]
gkent@outlook.com
168347403571931d3869ac5e03f975518877d395
bd1c56a1a00d7f444ba270bffbc68ddd78200d46
/Springcore_Handson/CourseRevenue/src/main/java/com/ll/Main1.java
8698ab25eccc5a2c750a924ebbc5c9280ac69f21
[]
no_license
chandusbu/Hcl-handson
a2a92785c4e1eeae34ab335ecac78ab33acc7acd
d8191836d077e2926e5f35b4edf1ba6de2f23e1b
refs/heads/master
2022-12-31T22:46:22.586585
2020-10-23T11:54:19
2020-10-23T11:54:19
293,853,071
1
0
null
null
null
null
UTF-8
Java
false
false
1,010
java
package com.ll; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public class Main1 { public static void main(String[] args) { // TODO Auto-generated method stub ApplicationContext context=new ClassPathXmlApplicationContext("applicationContext2.xml"); CourserevenueList courselist=new CourserevenueList(); ArrayList<String> list=new ArrayList<>(); Courserevenue Course1=context.getBean("Course1",Courserevenue.class); Courserevenue Course2=context.getBean("Course2",Courserevenue.class); Courserevenue Course3=context.getBean("Course3",Courserevenue.class); courselist.insert(Course1); courselist.insert(Course2); courselist.insert(Course3); System.out.println("Total Revenue:"+courselist.Revenue()); ((ClassPathXmlApplicationContext)context).close(); } }
[ "noreply@github.com" ]
noreply@github.com
c2fb8970388e0dc8aeb208bfb2ec26102ddaa358
051fe1aa43491964d6e2eedd48caa8044c26f41a
/app/src/main/java/sheetsoft/com/mkmnavigator/android/backend/motor/OldMethods.java
d96430bb0f38a2cc5eb8d674140ca60605d6cc24
[]
no_license
reischapa/mkm-navigator
3dd3736fcb631c55353452a598b07cf0b16e875a
0a69ccbd40eb2ea0b99ab7bd61dc5000d9fee7e9
refs/heads/master
2021-01-19T09:00:33.496978
2016-12-31T07:21:55
2016-12-31T07:21:55
87,710,034
0
0
null
null
null
null
UTF-8
Java
false
false
3,618
java
package sheetsoft.com.mkmnavigator.android.backend.motor; import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import java.util.Random; import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.SSLContext; /** * Created by chapa on 17-11-2016. */ public class OldMethods { public static String returnImageExtension(String imgurl, String tag){ return imgurl.substring(findLastCharInString(imgurl, tag)+1); } public static boolean isInList(ArrayList<?> input, final Object comparison){ for (int i = 0; i < input.size(); i++ ){ if (input.get(i).equals(comparison)){ return true; } } return false; } public static String genRandomString(int length){ Random rand = new Random(); char[] symbols = new char[36]; for (int idx = 0; idx < 10; ++idx) symbols[idx] = (char) ('0' + idx); for (int idx = 10; idx < 36; ++idx) symbols[idx] = (char) ('a' + idx - 10); char[] buf = new char[length]; for (int idx = 0; idx < buf.length; ++idx) { double e = rand.nextDouble(); if (e<0.5){ buf[idx] = Character.toUpperCase(symbols[rand.nextInt(symbols.length)]); } else { buf[idx] = Character.toLowerCase(symbols[rand.nextInt(symbols.length)]); } }; return new String(buf); } public static ArrayList<Integer> findSubStringLocations(String tested, String f){ char[] elem = tested.toCharArray(); ArrayList hm = new ArrayList(); char holder; int locationInString = 0; int index =0; for (char el : elem){ if ((elem.length-locationInString)>=f.length()){ if (el== f.charAt(0)){ String Holder2 = tested.substring(locationInString,locationInString+f.length()); //System.out.println(Holder2); if (Holder2.equals(f)){ hm.add(locationInString); //System.out.println(tested.substring(locationInString)); //System.out.println(hm.get(index).toString()); } index++; } } locationInString++; } return hm; } public static int findLastCharInString(String tested, String f){ ArrayList hm = findSubStringLocations(tested, f); Integer foo = (Integer) hm.get(hm.size()-1); if (foo==null){ return -1; } else if (foo!=null){ return foo; } return -1; } public static String retrieveSiteStatus(URL u){ HttpURLConnection ht; String temp = null; try { ht = (HttpURLConnection) u.openConnection(); temp = ht.getResponseMessage(); ht.disconnect(); } catch (MalformedURLException k) {} catch (IOException l) {} return temp; } public static String retrieveSiteStatus(String url){ String temp = null; URL r; try { r = new URL(url); return retrieveSiteStatus(r); } catch (MalformedURLException e) { e.printStackTrace(); } return temp; } }
[ "Reischapa@gmail.com" ]
Reischapa@gmail.com
4790168180d1ed869b066956948380ceb54d38f3
bc3e61091c0f3edd1e9d27e78e022bec217b44e3
/app/src/test/java/br/com/erudio/converter/DozerConverterTest.java
6f7781f1850f9d032d6f245f66478c0acb3ad0ab
[ "Apache-2.0" ]
permissive
elcarvalho/DockerFromZeroToMastery-SpingBootAndJava
3d80b9a9940901078100cbd009e335725b5b94cb
f4d98dd7e456b7cf118c155ff5037bc6c6d7c008
refs/heads/master
2022-11-13T07:19:46.538903
2020-07-09T13:18:11
2020-07-09T13:18:11
278,365,851
0
0
Apache-2.0
2020-07-09T13:00:47
2020-07-09T13:00:47
null
UTF-8
Java
false
false
4,242
java
package br.com.erudio.converter; import java.util.List; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import br.com.erudio.converter.mocks.MockPerson; import br.com.erudio.data.model.Person; import br.com.erudio.data.vo.v1.PersonVO; public class DozerConverterTest { MockPerson inputObject; @Before public void setUp() { inputObject = new MockPerson(); } @Test public void parseEntityToVOTest() { PersonVO output = DozerConverter.parseObject(inputObject.mockEntity(), PersonVO.class); Assert.assertEquals(Long.valueOf(0L), output.getKey()); Assert.assertEquals("First Name Test0", output.getFirstName()); Assert.assertEquals("Last Name Test0", output.getLastName()); Assert.assertEquals("Addres Test0", output.getAddress()); Assert.assertEquals("Male", output.getGender()); } @Test public void parseEntityListToVOListTest() { List<PersonVO> outputList = DozerConverter.parseListObjects(inputObject.mockEntityList(), PersonVO.class); PersonVO outputZero = outputList.get(0); Assert.assertEquals(Long.valueOf(0L), outputZero.getKey()); Assert.assertEquals("First Name Test0", outputZero.getFirstName()); Assert.assertEquals("Last Name Test0", outputZero.getLastName()); Assert.assertEquals("Addres Test0", outputZero.getAddress()); Assert.assertEquals("Male", outputZero.getGender()); PersonVO outputSeven = outputList.get(7); Assert.assertEquals(Long.valueOf(7L), outputSeven.getKey()); Assert.assertEquals("First Name Test7", outputSeven.getFirstName()); Assert.assertEquals("Last Name Test7", outputSeven.getLastName()); Assert.assertEquals("Addres Test7", outputSeven.getAddress()); Assert.assertEquals("Female", outputSeven.getGender()); PersonVO outputTwelve = outputList.get(12); Assert.assertEquals(Long.valueOf(12L), outputTwelve.getKey()); Assert.assertEquals("First Name Test12", outputTwelve.getFirstName()); Assert.assertEquals("Last Name Test12", outputTwelve.getLastName()); Assert.assertEquals("Addres Test12", outputTwelve.getAddress()); Assert.assertEquals("Male", outputTwelve.getGender()); } @Test public void parseVOToEntityTest() { Person output = DozerConverter.parseObject(inputObject.mockVO(), Person.class); Assert.assertEquals(Long.valueOf(0L), output.getId()); Assert.assertEquals("First Name Test0", output.getFirstName()); Assert.assertEquals("Last Name Test0", output.getLastName()); Assert.assertEquals("Addres Test0", output.getAddress()); Assert.assertEquals("Male", output.getGender()); } @Test public void parserVOListToEntityListTest() { List<Person> outputList = DozerConverter.parseListObjects(inputObject.mockVOList(), Person.class); Person outputZero = outputList.get(0); Assert.assertEquals(Long.valueOf(0L), outputZero.getId()); Assert.assertEquals("First Name Test0", outputZero.getFirstName()); Assert.assertEquals("Last Name Test0", outputZero.getLastName()); Assert.assertEquals("Addres Test0", outputZero.getAddress()); Assert.assertEquals("Male", outputZero.getGender()); Person outputSeven = outputList.get(7); Assert.assertEquals(Long.valueOf(7L), outputSeven.getId()); Assert.assertEquals("First Name Test7", outputSeven.getFirstName()); Assert.assertEquals("Last Name Test7", outputSeven.getLastName()); Assert.assertEquals("Addres Test7", outputSeven.getAddress()); Assert.assertEquals("Female", outputSeven.getGender()); Person outputTwelve = outputList.get(12); Assert.assertEquals(Long.valueOf(12L), outputTwelve.getId()); Assert.assertEquals("First Name Test12", outputTwelve.getFirstName()); Assert.assertEquals("Last Name Test12", outputTwelve.getLastName()); Assert.assertEquals("Addres Test12", outputTwelve.getAddress()); Assert.assertEquals("Male", outputTwelve.getGender()); } }
[ "leandrocgsi@gmail.com" ]
leandrocgsi@gmail.com
995b3aca45a935d49750d0fd30b471933458be94
af9d82a9eaf1a29a49c6a2193e9003624d4c04fe
/src/main/java/org/bluesoft/app/ws/shared/dto/UserDTO.java
c49675d75caaaa3f2c5f53830b1cf05f24129524
[]
no_license
jstolorz/java-rest-app
1d14e9b666a1f2db87e311363da76383cc8857bf
c414e259bf81f57c1e1b09c2d3120ce15fb4801d
refs/heads/master
2020-03-22T11:37:44.073517
2018-07-26T13:07:09
2018-07-26T13:07:09
139,983,479
0
0
null
null
null
null
UTF-8
Java
false
false
2,331
java
package org.bluesoft.app.ws.shared.dto; import java.io.Serializable; public class UserDTO implements Serializable { private static final long serialVersionUID = 1L; private long id; private String firstName; private String lastName; private String email; private String password; private String salt; private String encryptedPassword; private String userId; private String token; private String emailVerificationToken; private Boolean emailVerificationStatus; public long getId() { return id; } public void setId(long id) { this.id = id; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getSalt() { return salt; } public void setSalt(String salt) { this.salt = salt; } public String getEncryptedPassword() { return encryptedPassword; } public void setEncryptedPassword(String encryptedPassword) { this.encryptedPassword = encryptedPassword; } public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public String getToken() { return token; } public void setToken(String token) { this.token = token; } public String getEmailVerificationToken() { return emailVerificationToken; } public void setEmailVerificationToken(String emailVerificationToken) { this.emailVerificationToken = emailVerificationToken; } public Boolean getEmailVerificationStatus() { return emailVerificationStatus; } public void setEmailVerificationStatus(Boolean emailVerificationStatus) { this.emailVerificationStatus = emailVerificationStatus; } }
[ "Jmnz1234" ]
Jmnz1234
2a8be2e1d5420f3aa1575a8e089034de81b205b8
c0881ce04d4726e4485fa06a987aa8646025b561
/Places/app/src/main/java/com/example/bhavya/places/ui/activity/SignUpActivity.java
c54ab2504316f1feb97874e311e2e8ab020967a4
[]
no_license
bhavyarachel/sampleproject
6f4ca423df3de3ca879ef859af77bd9d30e866a8
2f19af81ed4e2508201061a6fdee32a9f48e6be2
refs/heads/master
2021-01-13T09:24:52.217032
2016-09-22T12:45:41
2016-09-22T12:45:41
68,919,378
0
0
null
null
null
null
UTF-8
Java
false
false
11,671
java
package com.example.bhavya.places.ui.activity; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.support.design.widget.TextInputEditText; import android.support.design.widget.TextInputLayout; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.Toolbar; import android.text.Editable; import android.text.TextWatcher; import android.view.View; import android.widget.Button; import com.example.bhavya.places.pojoclass.userdetailspojoclass.UserDetails; import com.example.bhavya.places.R; import com.example.bhavya.places.sharedpreferences.LoggedInUserSharedPreference; import com.example.bhavya.places.validationclass.ValidationClass; import com.google.gson.Gson; /** * Created by bhavya on 9/8/16. * * Checks if the email ID entered is already existing in the shared preference. If yes, Sign Up * not possible, else, Sign Up successful. * If Sign Up successful, the details are stored into the shared preference with email as key. */ public class SignUpActivity extends AppCompatActivity { public static String PREF_FILE_NAME = "UserDetailsStorage"; public static String PREF_LOGIN ="CurrentLogin"; private SharedPreferences mSharedPreferences; private SharedPreferences mPrefs; private SharedPreferences.Editor mEditor; private SharedPreferences.Editor mPrefsEditor; private Toolbar mToolbar; private TextInputLayout mInputLayoutPhoneno; private TextInputLayout mInputLayoutEmailID; private TextInputLayout mInputLayoutPswd; private TextInputLayout mInputLayoutConfirmPswd; private TextInputLayout mInputLayoutFirstName; private TextInputLayout mInputLayoutLastName; private TextInputEditText mEditTextInputPhone; private TextInputEditText mEditTextInputEmail; private TextInputEditText mEditTextInputPassword; private TextInputEditText mEditTextInputFirstName; private TextInputEditText mEditTextInputLastName; private TextInputEditText mEditTextInputConfirmPassword; private Button mSignUpButton; UserDetails newUser = new UserDetails(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_sign_up); setCustomActionBar(); setViewProperties(); } TextWatcher enableDisableSignupTW = new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void afterTextChanged(Editable s) { if (s.length() > 0) { mSignUpButton.setEnabled(true); } else { mSignUpButton.setEnabled(false); } } }; View.OnClickListener signUpButtonClicked = new View.OnClickListener() { @Override public void onClick(View v) { if (isValidInputs() && !checkIfEmailAlreadyExists()) //to get Signed up { writeToUserDetails(); saveIntoSharedPreference(); setLoginStatus(); final Intent i = new Intent(getBaseContext(), DrawerActivity.class); startActivity(i); finish(); } else if (checkIfEmailAlreadyExists()) { //email already exists AlertDialog.Builder builder = new AlertDialog.Builder(SignUpActivity.this); builder.setMessage(getString(R.string.emailAlreadyExists)) .setCancelable(false) .setPositiveButton(getString(R.string.ok), new DialogInterface .OnClickListener() { public void onClick(DialogInterface dialog, int id) { } }); AlertDialog alert = builder.create(); alert.show(); } else { //not signed up AlertDialog.Builder builder = new AlertDialog.Builder(SignUpActivity.this); builder.setMessage(getString(R.string.signupNotSuccessful)) .setCancelable(false) .setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { } }); AlertDialog alert = builder.create(); alert.show(); } } }; /** * Customizing toolbar with no title */ private void setCustomActionBar() { mToolbar = (Toolbar) findViewById(R.id.toolbar); // to refer the toolbar setSupportActionBar(mToolbar); //to eliminate the app name from the toolbar getSupportActionBar().setDisplayShowTitleEnabled(false); mToolbar.setTitle(""); mToolbar.setSubtitle(""); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); } /** * Initializing view properties and adding button clicks and text change listeners */ private void setViewProperties() { // Assigning View References mSignUpButton = (Button) findViewById(R.id.btn_new_sign_up); mInputLayoutPhoneno = (TextInputLayout) findViewById(R.id.input_layout_phone); mInputLayoutEmailID = (TextInputLayout) findViewById(R.id.input_layout_email); mInputLayoutPswd = (TextInputLayout) findViewById(R.id.input_layout_password); mInputLayoutConfirmPswd = (TextInputLayout) findViewById(R.id.input_layout_confirm_password); mInputLayoutFirstName = (TextInputLayout) findViewById(R.id.input_layout_firstname); mInputLayoutLastName = (TextInputLayout) findViewById(R.id.input_layout_lastname); mEditTextInputFirstName = (TextInputEditText) findViewById(R.id.edittext_input_firstname); mEditTextInputLastName = (TextInputEditText) findViewById(R.id.edittext_input_lastname); mEditTextInputPhone = (TextInputEditText) findViewById(R.id.edittext_input_phone); mEditTextInputEmail = (TextInputEditText) findViewById(R.id.edittext_input_email); mEditTextInputPassword = (TextInputEditText) findViewById(R.id.edittext_input_password); mEditTextInputConfirmPassword = (TextInputEditText) findViewById(R.id.edittext_input_confirm_password); // Adding Text change listeners mEditTextInputFirstName.addTextChangedListener(enableDisableSignupTW); mEditTextInputLastName.addTextChangedListener(enableDisableSignupTW); mEditTextInputPhone.addTextChangedListener(enableDisableSignupTW); mEditTextInputEmail.addTextChangedListener(enableDisableSignupTW); mEditTextInputPassword.addTextChangedListener(enableDisableSignupTW); mEditTextInputConfirmPassword.addTextChangedListener(enableDisableSignupTW); // Adding button Clicks mSignUpButton.setOnClickListener(signUpButtonClicked); } /** * checks if any field is invalid * */ private boolean isValidInputs() { boolean isValidInput = true; final String firstname = mEditTextInputFirstName.getText().toString(); final String lastname = mEditTextInputLastName.getText().toString(); final String phone = mEditTextInputPhone.getText().toString(); final String email = mEditTextInputEmail.getText().toString(); final String password = mEditTextInputPassword.getText().toString(); final String confirmpass = mEditTextInputConfirmPassword.getText().toString(); mInputLayoutFirstName.setError(null); mInputLayoutLastName.setError(null); mInputLayoutPhoneno.setError(null); mInputLayoutEmailID.setError(null); mInputLayoutPswd.setError(null); mInputLayoutConfirmPswd.setError(null); if (!ValidationClass.isValidFirstName(firstname)) { mInputLayoutFirstName.setError(getString(R.string.invalidFirstName)); isValidInput = false; } if (!ValidationClass.isValidLastName(lastname)) { mInputLayoutLastName.setError(getString(R.string.invalidLastName)); isValidInput = false; } if (!ValidationClass.isValidPhone(phone)) { mInputLayoutPhoneno.setError(getString(R.string.invalidPhone)); isValidInput = false; } if (!ValidationClass.isValidEmail(email)) { mInputLayoutEmailID.setError(getString(R.string.invalidEmail)); isValidInput = false; } if (!ValidationClass.isValidPassword(password)) { mInputLayoutPswd.setError(getString(R.string.invalidPswd)); isValidInput = false; } if (!isValidConfirmPass(confirmpass)) { mInputLayoutConfirmPswd.setError(getString(R.string.pswdsDonotMatch)); isValidInput = false; } return isValidInput; } /** * Write user details into userdetails POJO class */ private UserDetails writeToUserDetails() { String firstname = mEditTextInputFirstName.getText().toString(); String lastname = mEditTextInputLastName.getText().toString(); String phone = mEditTextInputPhone.getText().toString(); String email = mEditTextInputEmail.getText().toString(); String password = mEditTextInputPassword.getText().toString(); newUser.setFirstname(firstname); newUser.setLastname(lastname); newUser.setEmail(email); newUser.setPhone(phone); newUser.setPassword(password); newUser.setPasscode(""); newUser.setRadius(String.valueOf(500)); newUser.setImageURI(""); return newUser; } /** * convert the pojo user object into json format and save into shared preference */ private void saveIntoSharedPreference() { String email = mEditTextInputEmail.getText().toString(); mPrefs = getSharedPreferences(PREF_FILE_NAME, MODE_PRIVATE); mPrefsEditor = mPrefs.edit(); Gson gson = new Gson(); String jsonNewUserObj = gson.toJson(newUser); mPrefsEditor.putString(email, jsonNewUserObj); mPrefsEditor.commit(); } /** * Set user as logged in */ private void setLoginStatus() { mSharedPreferences = getSharedPreferences(PREF_FILE_NAME, MODE_PRIVATE); mEditor = mSharedPreferences.edit(); mEditor.putString(PREF_LOGIN, mEditTextInputEmail.getText().toString()); mEditor.commit(); LoggedInUserSharedPreference.setUserName(getBaseContext(), PREF_FILE_NAME); } /** * check if email id entered already exists */ private boolean checkIfEmailAlreadyExists() { mPrefs = getSharedPreferences(PREF_FILE_NAME, MODE_PRIVATE); boolean hasEmail = mPrefs.contains(mEditTextInputEmail.getText().toString()); if (hasEmail) return true; else return false; } /** * validating confirm password */ private boolean isValidConfirmPass(String confirmpass) { if (confirmpass.length() > 0 && mEditTextInputConfirmPassword.getText().toString().equals (mEditTextInputPassword.getText().toString())) { return true; } return false; } }
[ "bhavya@qburst.com" ]
bhavya@qburst.com
3014f753bb989fa63c5be0f61efc9529eacb41a4
c80ea3920f859001aff96e330d700105de88bf52
/TouZi.java
ff8ec585e0d45ee9eae08e7a9527cb80196ca9c7
[]
no_license
captianZHQ/javaCode
2ca40fd964b0fda283c6de0542dfa174dcd73fb5
64889eb7baf646da37164e3de34a6f8b66053fb5
refs/heads/master
2023-02-04T23:10:53.648496
2020-12-24T16:10:42
2020-12-24T16:10:42
318,796,454
1
0
null
null
null
null
UTF-8
Java
false
false
489
java
package test; public class TouZi { // f最终收入,p本金,r年利率,n存了多少年 public static void main(String[] args) { System.out.println("************20201221**********"); int n = 1; int p = 10000; final double r = 0.05; double f = 1; double F = 0; for (int i = 0; i < n; i++) { f *= (1 + r); } F = f * p; System.out.println(n + "年的复利收入为:" + F); } }
[ "1289309491@qq.com" ]
1289309491@qq.com
e063b8e5d08adc935e84f37dae213f98770cb73b
18cfb24c4914acd5747e533e88ce7f3a52eee036
/src/main/jdk8/javax/swing/text/html/FormSubmitEvent.java
3127f1a6b2920fb0880c256830517f44a87c2aca
[]
no_license
douguohai/jdk8-code
f0498e451ec9099e4208b7030904e1b4388af7c5
c8466ed96556bfd28cbb46e588d6497ff12415a0
refs/heads/master
2022-12-19T03:10:16.879386
2020-09-30T05:43:20
2020-09-30T05:43:20
273,399,965
0
0
null
null
null
null
UTF-8
Java
false
false
2,149
java
/* * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * * * */ package javax.swing.text.html; import javax.swing.text.*; import java.net.URL; /** * FormSubmitEvent is used to notify interested * parties that a form was submitted. * * @since 1.5 * @author Denis Sharypov */ public class FormSubmitEvent extends HTMLFrameHyperlinkEvent { /** * Represents an HTML form method type. * <UL> * <LI><code>GET</code> corresponds to the GET form method</LI> * <LI><code>POST</code> corresponds to the POST from method</LI> * </UL> * @since 1.5 */ public enum MethodType { GET, POST }; /** * Creates a new object representing an html form submit event. * * @param source the object responsible for the event * @param type the event type * @param actionURL the form action URL * @param sourceElement the element that corresponds to the source * of the event * @param targetFrame the Frame to display the document in * @param method the form method type * @param data the form submission data */ FormSubmitEvent(Object source, EventType type, URL targetURL, Element sourceElement, String targetFrame, MethodType method, String data) { super(source, type, targetURL, sourceElement, targetFrame); this.method = method; this.data = data; } /** * Gets the form method type. * * @return the form method type, either * <code>Method.GET</code> or <code>Method.POST</code>. */ public MethodType getMethod() { return method; } /** * Gets the form submission data. * * @return the string representing the form submission data. */ public String getData() { return data; } private MethodType method; private String data; }
[ "douguohai@163.com" ]
douguohai@163.com
4aa02855466525e1db0ae9f40e9b2098832901b0
a86f0a17b2a2c2f6bc0aa08482eeee32c852f15f
/algo/kotlin/src/test/java/me/tooster/TreePrinter.java
f0039be419ba34b18ae05d9299d30be836c9d3f5
[]
no_license
T3sT3ro/T3sT3ro.github.io
a651757d12800b0a36b4da8a89f741aa3e24023c
d988f4b2a34f1384eca583175294cecb9a32442a
refs/heads/master
2023-07-21T06:23:29.096266
2023-06-20T18:34:10
2023-06-20T18:34:10
79,792,934
2
0
null
2023-07-12T17:57:50
2017-01-23T10:10:13
JavaScript
UTF-8
Java
false
false
11,826
java
package me.tooster; // from https://github.com/billvanyo/tree_printer by billvanyo // I (Tooster) claim no rights to this import java.io.PrintStream; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.function.Function; public class TreePrinter<T> { private Function<T, String> getLabel; private Function<T, T> getLeft; private Function<T, T> getRight; private PrintStream outStream = System.out; private boolean squareBranches = false; private boolean lrAgnostic = false; private int hspace = 2; private int tspace = 1; public TreePrinter(Function<T, String> getLabel, Function<T, T> getLeft, Function<T, T> getRight) { this.getLabel = getLabel; this.getLeft = getLeft; this.getRight = getRight; } public TreePrinter<T> withPrintStream(PrintStream outStream) { this.outStream = outStream; return this; } public TreePrinter<T> withSquareBranches() { this.squareBranches = true; return this; } public TreePrinter<T> withLrAgnostic() { this.lrAgnostic = true; return this; } public TreePrinter<T> withHspace(int hspace) { this.hspace = hspace; return this; } public TreePrinter<T> withTspace(int tspace) { this.hspace = tspace; return this; } /* Prints ascii representation of binary tree. Parameter hspace is minimum number of spaces between adjacent node labels. Parameter squareBranches, when set to true, results in branches being printed with ASCII box drawing characters. */ public void printTree(T root) { List<TreeLine> treeLines = buildTreeLines(root); printTreeLines(treeLines); } /* Prints ascii representations of multiple trees across page. Parameter hspace is minimum number of spaces between adjacent node labels in a tree. Parameter tspace is horizontal distance between trees, as well as number of blank lines between rows of trees. Parameter lineWidth is maximum width of output Parameter squareBranches, when set to true, results in branches being printed with ASCII box drawing characters. */ public void printTrees(List<T> trees, int lineWidth) { List<List<TreeLine>> allTreeLines = new ArrayList<>(); int[] treeWidths = new int[trees.size()]; int[] minLeftOffsets = new int[trees.size()]; int[] maxRightOffsets = new int[trees.size()]; for (int i = 0; i < trees.size(); i++) { T treeNode = trees.get(i); List<TreeLine> treeLines = buildTreeLines(treeNode); allTreeLines.add(treeLines); minLeftOffsets[i] = minLeftOffset(treeLines); maxRightOffsets[i] = maxRightOffset(treeLines); treeWidths[i] = maxRightOffsets[i] - minLeftOffsets[i] + 1; } int nextTreeIndex = 0; while (nextTreeIndex < trees.size()) { // print a row of trees starting at nextTreeIndex // first figure range of trees we can print for next row int sumOfWidths = treeWidths[nextTreeIndex]; int endTreeIndex = nextTreeIndex + 1; while (endTreeIndex < trees.size() && sumOfWidths + tspace + treeWidths[endTreeIndex] < lineWidth) { sumOfWidths += (tspace + treeWidths[endTreeIndex]); endTreeIndex++; } endTreeIndex--; // find max number of lines for tallest tree int maxLines = allTreeLines.stream().mapToInt(List::size).max().orElse(0); // print trees line by line for (int i = 0; i < maxLines; i++) { for (int j = nextTreeIndex; j <= endTreeIndex; j++) { List<TreeLine> treeLines = allTreeLines.get(j); if (i >= treeLines.size()) { System.out.print(spaces(treeWidths[j])); } else { int leftSpaces = -(minLeftOffsets[j] - treeLines.get(i).leftOffset); int rightSpaces = maxRightOffsets[j] - treeLines.get(i).rightOffset; System.out.print(spaces(leftSpaces) + treeLines.get(i).line + spaces(rightSpaces)); } if (j < endTreeIndex) System.out.print(spaces(tspace)); } System.out.println(); } for (int i = 0; i < tspace; i++) { System.out.println(); } nextTreeIndex = endTreeIndex + 1; } } private void printTreeLines(List<TreeLine> treeLines) { if (treeLines.size() > 0) { int minLeftOffset = minLeftOffset(treeLines); int maxRightOffset = maxRightOffset(treeLines); for (TreeLine treeLine : treeLines) { int leftSpaces = -(minLeftOffset - treeLine.leftOffset); int rightSpaces = maxRightOffset - treeLine.rightOffset; outStream.println(spaces(leftSpaces) + treeLine.line + spaces(rightSpaces)); } } } private List<TreeLine> buildTreeLines(T root) { if (root == null) return Collections.emptyList(); else { String rootLabel = getLabel.apply(root); List<TreeLine> leftTreeLines = buildTreeLines(getLeft.apply(root)); List<TreeLine> rightTreeLines = buildTreeLines(getRight.apply(root)); int leftCount = leftTreeLines.size(); int rightCount = rightTreeLines.size(); int minCount = Math.min(leftCount, rightCount); int maxCount = Math.max(leftCount, rightCount); // The left and right subtree print representations have jagged edges, and we essentially we have to // figure out how close together we can bring the left and right roots so that the edges just meet on // some line. Then we add hspace, and round up to next odd number. int maxRootSpacing = 0; for (int i = 0; i < minCount; i++) { int spacing = leftTreeLines.get(i).rightOffset - rightTreeLines.get(i).leftOffset; if (spacing > maxRootSpacing) maxRootSpacing = spacing; } int rootSpacing = maxRootSpacing + hspace; if (rootSpacing % 2 == 0) rootSpacing++; // rootSpacing is now the number of spaces between the roots of the two subtrees List<TreeLine> allTreeLines = new ArrayList<>(); // strip the ANSI escape codes to get length of rendered string. Fixes wrong padding when labels use ANSI escapes for colored nodes. String visibleRootLabel = rootLabel.replaceAll("\\e\\[[\\d;]*[^\\d;]", ""); // add the root and the two branches leading to the subtrees allTreeLines.add(new TreeLine(rootLabel, -(visibleRootLabel.length() - 1) / 2, visibleRootLabel.length() / 2)); // also calculate offset adjustments for left and right subtrees int leftTreeAdjust = 0; int rightTreeAdjust = 0; if (leftTreeLines.isEmpty()) { if (!rightTreeLines.isEmpty()) { // there's a right subtree only if (squareBranches) { if (lrAgnostic) { allTreeLines.add(new TreeLine("\u2502", 0, 0)); } else { allTreeLines.add(new TreeLine("\u2514\u2510", 0, 1)); rightTreeAdjust = 1; } } else { allTreeLines.add(new TreeLine("\\", 1, 1)); rightTreeAdjust = 2; } } } else if (rightTreeLines.isEmpty()) { // there's a left subtree only if (squareBranches) { if (lrAgnostic) { allTreeLines.add(new TreeLine("\u2502", 0, 0)); } else { allTreeLines.add(new TreeLine("\u250C\u2518", -1, 0)); leftTreeAdjust = -1; } } else { allTreeLines.add(new TreeLine("/", -1, -1)); leftTreeAdjust = -2; } } else { // there's a left and right subtree if (squareBranches) { int adjust = (rootSpacing / 2) + 1; String horizontal = String.join("", Collections.nCopies(rootSpacing / 2, "\u2500")); String branch = "\u250C" + horizontal + "\u2534" + horizontal + "\u2510"; allTreeLines.add(new TreeLine(branch, -adjust, adjust)); rightTreeAdjust = adjust; leftTreeAdjust = -adjust; } else { if (rootSpacing == 1) { allTreeLines.add(new TreeLine("/ \\", -1, 1)); rightTreeAdjust = 2; leftTreeAdjust = -2; } else { for (int i = 1; i < rootSpacing; i += 2) { String branches = "/" + spaces(i) + "\\"; allTreeLines.add(new TreeLine(branches, -((i + 1) / 2), (i + 1) / 2)); } rightTreeAdjust = (rootSpacing / 2) + 1; leftTreeAdjust = -((rootSpacing / 2) + 1); } } } // now add joined lines of subtrees, with appropriate number of separating spaces, and adjusting offsets for (int i = 0; i < maxCount; i++) { TreeLine leftLine, rightLine; if (i >= leftTreeLines.size()) { // nothing remaining on left subtree rightLine = rightTreeLines.get(i); rightLine.leftOffset += rightTreeAdjust; rightLine.rightOffset += rightTreeAdjust; allTreeLines.add(rightLine); } else if (i >= rightTreeLines.size()) { // nothing remaining on right subtree leftLine = leftTreeLines.get(i); leftLine.leftOffset += leftTreeAdjust; leftLine.rightOffset += leftTreeAdjust; allTreeLines.add(leftLine); } else { leftLine = leftTreeLines.get(i); rightLine = rightTreeLines.get(i); int adjustedRootSpacing = (rootSpacing == 1 ? (squareBranches ? 1 : 3) : rootSpacing); TreeLine combined = new TreeLine(leftLine.line + spaces(adjustedRootSpacing - leftLine.rightOffset + rightLine.leftOffset) + rightLine.line, leftLine.leftOffset + leftTreeAdjust, rightLine.rightOffset + rightTreeAdjust); allTreeLines.add(combined); } } return allTreeLines; } } private static int minLeftOffset(List<TreeLine> treeLines) { return treeLines.stream().mapToInt(l -> l.leftOffset).min().orElse(0); } private static int maxRightOffset(List<TreeLine> treeLines) { return treeLines.stream().mapToInt(l -> l.rightOffset).max().orElse(0); } private static String spaces(int n) { return String.join("", Collections.nCopies(n, " ")); } private static class TreeLine { String line; int leftOffset; int rightOffset; TreeLine(String line, int leftOffset, int rightOffset) { this.line = line; this.leftOffset = leftOffset; this.rightOffset = rightOffset; } } }
[ "5300963+T3sT3ro@users.noreply.github.com" ]
5300963+T3sT3ro@users.noreply.github.com
1029628b04460dbaa374ab6226ed2b405577cd6b
6b9812c4d0abe3506d2edfd170989996f5b5089c
/src/com/fontar/web/action/administracion/PaqueteAction.java
cab970675cebd48fd816136baea53d521d50237f
[]
no_license
zorzal2/zorzal-tomcat
e570acd9826f8313fff6fc68f61ae2d39c20b402
4009879d14c6fe1b97fa8cf66a447067aeef7e2e
refs/heads/master
2022-12-24T19:53:56.790015
2019-07-28T20:56:25
2019-07-28T20:56:25
195,703,062
0
0
null
2022-12-15T23:23:46
2019-07-07T22:32:10
Java
IBM852
Java
false
false
7,624
java
package com.fontar.web.action.administracion; import java.util.ArrayList; import java.util.Collection; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.beanutils.BeanUtils; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionMessages; import org.apache.struts.action.DynaActionForm; import com.fontar.bus.api.workflow.WFPaqueteServicio; import com.fontar.bus.impl.misc.CollectionHandler; import com.fontar.data.api.dao.InstrumentoDAO; import com.fontar.data.impl.domain.codes.paquete.TipoPaquete; import com.fontar.data.impl.domain.codes.paquete.TratamientoPaquete; import com.fontar.web.util.ActionUtil; import com.pragma.util.FormUtil; import com.pragma.web.WebContextUtil; import com.pragma.web.action.BaseMappingDispatchAction; /** * Acci˛n para la administraci˛n de paquetes en el sistema * @author ssanchez */ public class PaqueteAction extends BaseMappingDispatchAction { private WFPaqueteServicio wfPaqueteServicio; public void setWfPaqueteServicio(WFPaqueteServicio wfPaqueteServicio) { this.wfPaqueteServicio = wfPaqueteServicio; } /** * PaqueteAction */ // TODO: Cambiar el nombre del mÚtodo public ActionForward agregarPaquete(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { ActionMessages messages = getErrors(request); ActionUtil.checkValidEncryptionContext(messages); if (messages.isEmpty() ){ if(isTokenValid(request)) { resetToken(request); // obtengo los valores del formulario String instrumentoFiltrado = BeanUtils.getProperty(form, "instrumentoFiltrado"); String tratamientoFiltrado = BeanUtils.getProperty(form, "tratamientoFiltrado"); String[] proyectoArray = ((DynaActionForm) form).getStrings("proyectoArray"); Long idInstrumento = FormUtil.getLongValue(form, "instrumentoFiltrado"); String tratamiento = FormUtil.getStringValue(form, "tratamientoFiltrado"); String tipoPaquete = FormUtil.getStringValue(form, "tipoPaquete"); request.setAttribute("tipoPaquete", tipoPaquete); if (instrumentoFiltrado.equals("")) { addError(messages, "app.paquete.requiereInstrumento"); } else if (tratamientoFiltrado.equals("")) { addError(messages, "app.paquete.requiereTratamiento"); } else if (proyectoArray.length <= 0) { addError(messages, "app.paquete.requiereUnProyecto"); } else { wfPaqueteServicio.armarPaquete(proyectoArray, idInstrumento, tratamiento, tipoPaquete); } } else { addError(messages, "app.error.abmAction"); } } // ┐hay errores? if (!messages.isEmpty()) { saveErrors(request, messages); if (mapping.getInput() != null) { return mapping.getInputForward(); } else { return mapping.findForward("invalid"); } } else { return mapping.findForward("success"); } } /** * Muestra la pantalla inicial para armar paquetes */ public ActionForward armarPaquete(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { saveToken(request); setCollections(request); // seteo el tipo de paquete que se quiere generar String tipoPaquete = request.getParameter("tipoPaquete"); request.setAttribute("tipoPaquete", tipoPaquete); // obtengo el listado de proyecto segun los filtros instrumento y tratamiento String instrumentoFiltrado = FormUtil.getStringValue(form, "instrumentoFiltrado"); String tratamientoFiltrado = FormUtil.getStringValue(form, "tratamientoFiltrado"); List proyectosList = null; if (instrumentoFiltrado != null && tratamientoFiltrado != null) { // cargo la lista de proyectos proyectosList = wfPaqueteServicio.obtenerProyectos(new Long(instrumentoFiltrado), tratamientoFiltrado, tipoPaquete); // usados para validar que los filtros se hayan aplicados ((DynaActionForm) form).set("instrumento", instrumentoFiltrado); ((DynaActionForm) form).set("tratamiento", tratamientoFiltrado); // guardo la collection en el request request.setAttribute("proyectosList", proyectosList); } return mapping.findForward("success"); } /** * Muestra los proyectos que cumplen con los filtros de instrumento y * tratamiento */ public ActionForward mostrarProyectos(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { form.validate(mapping, request); // Cola de mensajes de error ActionMessages messages = getErrors(request); String tipoPaquete = null; List proyectosList = null; setCollections(request); //requiere contexto de encriptacion ActionUtil.checkValidEncryptionContext(messages); // seteo el tipo de paquete que se quiere generar tipoPaquete = request.getParameter("tipoPaquete"); // obtengo el listado de proyecto segun los filtros instrumento y tratamiento String instrumento = FormUtil.getStringValue(form, "instrumento"); String tratamiento = FormUtil.getStringValue(form, "tratamiento"); if (instrumento == null || instrumento.equals("")) { addError(messages, "app.paquete.requiereInstrumento"); } else if (tratamiento == null || tratamiento.equals("")) { addError(messages, "app.paquete.requiereTratamiento"); } // ┐hay errores? if (!messages.isEmpty()) { saveErrors(request, messages); if (mapping.getInput() != null) { return mapping.getInputForward(); } else { return mapping.findForward("invalid"); } } else { proyectosList = wfPaqueteServicio.obtenerProyectos(new Long(instrumento), tratamiento, tipoPaquete); // usados para validar que los filtros se hayan aplicados ((DynaActionForm) form).set("instrumentoFiltrado", instrumento); ((DynaActionForm) form).set("tratamientoFiltrado", tratamiento); // guardo la collection en el request request.setAttribute("proyectosList", proyectosList); request.setAttribute("tipoPaquete", tipoPaquete); return mapping.findForward("success"); } } /** * LLeno los combos para agregar y editar * @param request: usado para setear collections * @throws Exception */ @SuppressWarnings("unchecked") private void setCollections(HttpServletRequest request) throws Exception { CollectionHandler collectionHandler = new CollectionHandler(); String tipoPaquete; if (request.getParameter("tipoPaquete") != null && !request.getParameter("tipoPaquete").equals("")) { tipoPaquete = request.getParameter("tipoPaquete"); } else { tipoPaquete = request.getAttribute("tipoPaquete").toString(); } InstrumentoDAO instrumentoDAO = (InstrumentoDAO) WebContextUtil.getBeanFactory().getBean("instrumentoDao"); Collection instrumentoList = new ArrayList(); if (tipoPaquete.equals(TipoPaquete.COMISION.getName())) { instrumentoList.addAll(collectionHandler.getInstrumentoComision(instrumentoDAO)); } else if (tipoPaquete.equals(TipoPaquete.SECRETARIA.getName())) { instrumentoList.addAll(collectionHandler.getInstrumentoSecretaria(instrumentoDAO)); } else { instrumentoList.addAll(collectionHandler.getInstrumentoDirectorio(instrumentoDAO)); } Collection tratamientoList = new ArrayList(); tratamientoList.addAll(collectionHandler.getTratamientosPaquete(TratamientoPaquete.class, tipoPaquete)); request.setAttribute("instrumentos", instrumentoList); request.setAttribute("tratamientos", tratamientoList); } }
[ "15364292+llobeto@users.noreply.github.com" ]
15364292+llobeto@users.noreply.github.com
c16e8a7f04b0a1eb1e38e5c9b32290d7ad606de1
dba08dbd9c841dbee1ae6e6717249bde69740a9a
/src/streams/IntermediaryAndFinal.java
6469ae65ddf660e4d14753a291bebdea1595b3cc
[]
no_license
vaske05/Java8-Practice
da1f03e5bc65fe5ff48fc8765a58826f1592b7a5
71dffdfe64bb15de6d2f2141d608c26b5898f2a0
refs/heads/master
2020-06-23T09:47:46.249786
2019-07-24T13:40:45
2019-07-24T13:40:45
198,589,141
0
0
null
2019-07-24T13:40:46
2019-07-24T08:10:54
Java
UTF-8
Java
false
false
666
java
package streams; import java.util.ArrayList; import java.util.List; import java.util.function.Predicate; import java.util.stream.Stream; public class IntermediaryAndFinal { public static void main(String[] args) { Stream<String> stream = Stream.of("one", "two", "three", "four", "five"); Predicate<String> p1 = Predicate.isEqual("two"); Predicate<String> p2 = Predicate.isEqual("three"); List<String> list = new ArrayList<>(); stream .peek(System.out::println) //Intermediary operation .filter(p1.or(p2)) .forEach(list::add); //Final operation System.out.println("Done!"); System.out.println("size = " + list.size()); } }
[ "vaske494@gmail.com" ]
vaske494@gmail.com
6be521059269f54d01f18760209f24c099b80b39
ff2dda57308ecf03a1ed93eb734d978f3176b09c
/src/org/academiadecodigo/javabank/domain/Customer.java
cf11a67b2923091d469adf052b0bf47a6d05ad76
[]
no_license
silvaney007/javaBank
c40da3b08086dbab34ae17db2d1ec0a50980e1e4
509ae88d67cd50ccdf02919cbb18e69d180d3d8b
refs/heads/master
2023-01-14T13:06:09.092311
2020-07-15T20:35:02
2020-07-15T20:35:02
315,149,090
1
0
null
null
null
null
UTF-8
Java
false
false
1,622
java
package org.academiadecodigo.javabank.domain; import org.academiadecodigo.javabank.domain.account.Account; import org.academiadecodigo.javabank.domain.account.AccountType; import org.academiadecodigo.javabank.managers.AccountManager; import java.util.HashMap; import java.util.Map; /** * The customer domain entity */ public class Customer { private AccountManager accountManager; private Map<Integer, Account> accounts = new HashMap<>(); /** * Sets the account manager * * @param accountManager the account manager to set */ public void setAccountManager(AccountManager accountManager) { this.accountManager = accountManager; } /** * Opens a new account * * @param accountType the account type to be opened * @return the new account id * @see AccountManager#openAccount(AccountType) */ public int openAccount(AccountType accountType) { Account account = accountManager.openAccount(accountType); accounts.put(account.getId(), account); return account.getId(); } /** * Gets the balance of an {@link Account} * * @param id the id of the account * @return the account balance */ public double getBalance(int id) { return accounts.get(id).getBalance(); } /** * Gets the total customer balance * * @return the customer balance */ public double getBalance() { double balance = 0; for (Account account : accounts.values()) { balance += account.getBalance(); } return balance; } }
[ "sara.lopes@academiadecodigo.org" ]
sara.lopes@academiadecodigo.org
70c9572232b266e999d1d9358d7cb8fd97ce65b6
c885ef92397be9d54b87741f01557f61d3f794f3
/tests-without-trycatch/Mockito-7/org.mockito.internal.util.reflection.GenericMetadataSupport/BBC-F0-opt-30/5/org/mockito/internal/util/reflection/GenericMetadataSupport_ESTest.java
b01d2caa8bc8652e02754b35820c1dac1772ce1f
[ "CC-BY-4.0", "MIT" ]
permissive
pderakhshanfar/EMSE-BBC-experiment
f60ac5f7664dd9a85f755a00a57ec12c7551e8c6
fea1a92c2e7ba7080b8529e2052259c9b697bbda
refs/heads/main
2022-11-25T00:39:58.983828
2022-04-12T16:04:26
2022-04-12T16:04:26
309,335,889
0
1
null
2021-11-05T11:18:43
2020-11-02T10:30:38
null
UTF-8
Java
false
false
14,837
java
/* * This file was automatically generated by EvoSuite * Tue Oct 19 20:49:16 GMT 2021 */ package org.mockito.internal.util.reflection; import org.junit.Test; import static org.junit.Assert.*; import static org.evosuite.shaded.org.mockito.Mockito.*; import static org.evosuite.runtime.EvoAssertions.*; import java.lang.reflect.Method; import java.lang.reflect.Type; import java.lang.reflect.TypeVariable; import java.lang.reflect.WildcardType; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.evosuite.runtime.ViolatedAssumptionAnswer; import org.junit.runner.RunWith; import org.mockito.internal.util.reflection.GenericMetadataSupport; @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true) public class GenericMetadataSupport_ESTest extends GenericMetadataSupport_ESTest_scaffolding { @Test(timeout = 4000) public void test00() throws Throwable { Type[] typeArray0 = new Type[1]; WildcardType wildcardType0 = mock(WildcardType.class, new ViolatedAssumptionAnswer()); doReturn(typeArray0).when(wildcardType0).getLowerBounds(); doReturn(typeArray0).when(wildcardType0).getUpperBounds(); GenericMetadataSupport.WildCardBoundedType genericMetadataSupport_WildCardBoundedType0 = new GenericMetadataSupport.WildCardBoundedType(wildcardType0); // Undeclared exception! // try { GenericMetadataSupport.inferFrom(genericMetadataSupport_WildCardBoundedType0); // fail("Expecting exception: RuntimeException"); // } catch(RuntimeException e) { // } } @Test(timeout = 4000) public void test01() throws Throwable { Type[] typeArray0 = new Type[1]; Type[] typeArray1 = new Type[0]; WildcardType wildcardType0 = mock(WildcardType.class, new ViolatedAssumptionAnswer()); GenericMetadataSupport.WildCardBoundedType genericMetadataSupport_WildCardBoundedType0 = new GenericMetadataSupport.WildCardBoundedType(wildcardType0); typeArray0[0] = (Type) genericMetadataSupport_WildCardBoundedType0; TypeVariable<Method> typeVariable0 = (TypeVariable<Method>) mock(TypeVariable.class, new ViolatedAssumptionAnswer()); GenericMetadataSupport.TypeVarBoundedType genericMetadataSupport_TypeVarBoundedType0 = new GenericMetadataSupport.TypeVarBoundedType(typeVariable0); } @Test(timeout = 4000) public void test02() throws Throwable { WildcardType wildcardType0 = mock(WildcardType.class, new ViolatedAssumptionAnswer()); doReturn((Type[]) null).when(wildcardType0).getLowerBounds(); doReturn((Type[]) null).when(wildcardType0).getUpperBounds(); GenericMetadataSupport.WildCardBoundedType genericMetadataSupport_WildCardBoundedType0 = new GenericMetadataSupport.WildCardBoundedType(wildcardType0); // Undeclared exception! // try { genericMetadataSupport_WildCardBoundedType0.toString(); // fail("Expecting exception: NullPointerException"); // } catch(NullPointerException e) { // // // // no message in exception (getMessage() returned null) // // // verifyException("org.mockito.internal.util.reflection.GenericMetadataSupport$WildCardBoundedType", e); // } } @Test(timeout = 4000) public void test03() throws Throwable { Type[] typeArray0 = new Type[10]; TypeVariable<Method> typeVariable0 = (TypeVariable<Method>) mock(TypeVariable.class, new ViolatedAssumptionAnswer()); doReturn((Object) typeArray0, (Object) typeArray0, (Object) typeArray0, (Object) typeArray0).when(typeVariable0).getBounds(); GenericMetadataSupport.TypeVarBoundedType genericMetadataSupport_TypeVarBoundedType0 = new GenericMetadataSupport.TypeVarBoundedType(typeVariable0); String string0 = genericMetadataSupport_TypeVarBoundedType0.toString(); assertEquals("{firstBound=null, interfaceBounds=[null, null, null, null, null, null, null, null, null]}", string0); } @Test(timeout = 4000) public void test04() throws Throwable { Type[] typeArray0 = new Type[1]; TypeVariable<Method> typeVariable0 = (TypeVariable<Method>) mock(TypeVariable.class, new ViolatedAssumptionAnswer()); doReturn((Object) typeArray0, (Object) null).when(typeVariable0).getBounds(); GenericMetadataSupport.TypeVarBoundedType genericMetadataSupport_TypeVarBoundedType0 = new GenericMetadataSupport.TypeVarBoundedType(typeVariable0); // Undeclared exception! // try { GenericMetadataSupport.inferFrom(genericMetadataSupport_TypeVarBoundedType0); // fail("Expecting exception: NullPointerException"); // } catch(NullPointerException e) { // // // // no message in exception (getMessage() returned null) // // // verifyException("org.mockito.internal.util.reflection.GenericMetadataSupport$TypeVarBoundedType", e); // } } @Test(timeout = 4000) public void test05() throws Throwable { // Undeclared exception! // try { GenericMetadataSupport.inferFrom((Type) null); // fail("Expecting exception: NullPointerException"); // } catch(NullPointerException e) { // // // // type should not be null // // // verifyException("org.mockito.internal.util.Checks", e); // } } @Test(timeout = 4000) public void test06() throws Throwable { Type[] typeArray0 = new Type[19]; Type[] typeArray1 = new Type[0]; TypeVariable<Method> typeVariable0 = (TypeVariable<Method>) mock(TypeVariable.class, new ViolatedAssumptionAnswer()); doReturn((Object) typeArray0, (Object) typeArray0, (Object) typeArray0, (Object) typeArray0, (Object) typeArray1).when(typeVariable0).getBounds(); GenericMetadataSupport.TypeVarBoundedType genericMetadataSupport_TypeVarBoundedType0 = new GenericMetadataSupport.TypeVarBoundedType(typeVariable0); genericMetadataSupport_TypeVarBoundedType0.interfaceBounds(); // Undeclared exception! // try { GenericMetadataSupport.inferFrom(genericMetadataSupport_TypeVarBoundedType0); // fail("Expecting exception: NegativeArraySizeException"); // } catch(NegativeArraySizeException e) { // // // // no message in exception (getMessage() returned null) // // // verifyException("org.mockito.internal.util.reflection.GenericMetadataSupport$TypeVarBoundedType", e); // } } @Test(timeout = 4000) public void test07() throws Throwable { Type[] typeArray0 = new Type[0]; WildcardType wildcardType0 = mock(WildcardType.class, new ViolatedAssumptionAnswer()); doReturn(typeArray0).when(wildcardType0).getLowerBounds(); doReturn(typeArray0).when(wildcardType0).getUpperBounds(); GenericMetadataSupport.WildCardBoundedType genericMetadataSupport_WildCardBoundedType0 = new GenericMetadataSupport.WildCardBoundedType(wildcardType0); // Undeclared exception! // try { genericMetadataSupport_WildCardBoundedType0.firstBound(); // fail("Expecting exception: ArrayIndexOutOfBoundsException"); // } catch(ArrayIndexOutOfBoundsException e) { // // // // 0 // // // verifyException("org.mockito.internal.util.reflection.GenericMetadataSupport$WildCardBoundedType", e); // } } @Test(timeout = 4000) public void test08() throws Throwable { Type[] typeArray0 = new Type[1]; WildcardType wildcardType0 = mock(WildcardType.class, new ViolatedAssumptionAnswer()); doReturn(typeArray0).when(wildcardType0).getLowerBounds(); doReturn(typeArray0).when(wildcardType0).getUpperBounds(); GenericMetadataSupport.WildCardBoundedType genericMetadataSupport_WildCardBoundedType0 = new GenericMetadataSupport.WildCardBoundedType(wildcardType0); Type type0 = genericMetadataSupport_WildCardBoundedType0.firstBound(); assertNull(type0); } @Test(timeout = 4000) public void test09() throws Throwable { WildcardType wildcardType0 = mock(WildcardType.class, new ViolatedAssumptionAnswer()); GenericMetadataSupport.WildCardBoundedType genericMetadataSupport_WildCardBoundedType0 = new GenericMetadataSupport.WildCardBoundedType(wildcardType0); WildcardType wildcardType1 = mock(WildcardType.class, new ViolatedAssumptionAnswer()); GenericMetadataSupport.WildCardBoundedType genericMetadataSupport_WildCardBoundedType1 = new GenericMetadataSupport.WildCardBoundedType(wildcardType1); // Undeclared exception! // try { genericMetadataSupport_WildCardBoundedType0.equals(genericMetadataSupport_WildCardBoundedType1); // fail("Expecting exception: ClassCastException"); // } catch(ClassCastException e) { // // // // org.mockito.internal.util.reflection.GenericMetadataSupport$WildCardBoundedType cannot be cast to org.mockito.internal.util.reflection.GenericMetadataSupport$TypeVarBoundedType // // // verifyException("org.mockito.internal.util.reflection.GenericMetadataSupport$WildCardBoundedType", e); // } } @Test(timeout = 4000) public void test10() throws Throwable { WildcardType wildcardType0 = mock(WildcardType.class, new ViolatedAssumptionAnswer()); GenericMetadataSupport.WildCardBoundedType genericMetadataSupport_WildCardBoundedType0 = new GenericMetadataSupport.WildCardBoundedType(wildcardType0); boolean boolean0 = genericMetadataSupport_WildCardBoundedType0.equals((Object) null); assertFalse(boolean0); } @Test(timeout = 4000) public void test11() throws Throwable { WildcardType wildcardType0 = mock(WildcardType.class, new ViolatedAssumptionAnswer()); GenericMetadataSupport.WildCardBoundedType genericMetadataSupport_WildCardBoundedType0 = new GenericMetadataSupport.WildCardBoundedType(wildcardType0); boolean boolean0 = genericMetadataSupport_WildCardBoundedType0.equals(genericMetadataSupport_WildCardBoundedType0); assertTrue(boolean0); } @Test(timeout = 4000) public void test12() throws Throwable { GenericMetadataSupport.WildCardBoundedType genericMetadataSupport_WildCardBoundedType0 = new GenericMetadataSupport.WildCardBoundedType((WildcardType) null); boolean boolean0 = genericMetadataSupport_WildCardBoundedType0.equals("w#Fir+_GPJ"); assertFalse(boolean0); } @Test(timeout = 4000) public void test13() throws Throwable { TypeVariable<Method> typeVariable0 = (TypeVariable<Method>) mock(TypeVariable.class, new ViolatedAssumptionAnswer()); GenericMetadataSupport.TypeVarBoundedType genericMetadataSupport_TypeVarBoundedType0 = new GenericMetadataSupport.TypeVarBoundedType(typeVariable0); boolean boolean0 = genericMetadataSupport_TypeVarBoundedType0.equals(""); assertFalse(boolean0); } @Test(timeout = 4000) public void test14() throws Throwable { GenericMetadataSupport.TypeVarBoundedType genericMetadataSupport_TypeVarBoundedType0 = new GenericMetadataSupport.TypeVarBoundedType((TypeVariable) null); GenericMetadataSupport.TypeVarBoundedType genericMetadataSupport_TypeVarBoundedType1 = new GenericMetadataSupport.TypeVarBoundedType((TypeVariable) null); // Undeclared exception! // try { genericMetadataSupport_TypeVarBoundedType1.equals(genericMetadataSupport_TypeVarBoundedType0); // fail("Expecting exception: NullPointerException"); // } catch(NullPointerException e) { // // // // no message in exception (getMessage() returned null) // // // verifyException("org.mockito.internal.util.reflection.GenericMetadataSupport$TypeVarBoundedType", e); // } } @Test(timeout = 4000) public void test15() throws Throwable { GenericMetadataSupport.TypeVarBoundedType genericMetadataSupport_TypeVarBoundedType0 = new GenericMetadataSupport.TypeVarBoundedType((TypeVariable) null); boolean boolean0 = genericMetadataSupport_TypeVarBoundedType0.equals(genericMetadataSupport_TypeVarBoundedType0); assertTrue(boolean0); } @Test(timeout = 4000) public void test16() throws Throwable { GenericMetadataSupport.TypeVarBoundedType genericMetadataSupport_TypeVarBoundedType0 = new GenericMetadataSupport.TypeVarBoundedType((TypeVariable) null); boolean boolean0 = genericMetadataSupport_TypeVarBoundedType0.equals((Object) null); assertFalse(boolean0); } @Test(timeout = 4000) public void test17() throws Throwable { WildcardType wildcardType0 = mock(WildcardType.class, new ViolatedAssumptionAnswer()); doReturn((String) null).when(wildcardType0).toString(); GenericMetadataSupport.WildCardBoundedType genericMetadataSupport_WildCardBoundedType0 = new GenericMetadataSupport.WildCardBoundedType(wildcardType0); WildcardType wildcardType1 = genericMetadataSupport_WildCardBoundedType0.wildCard(); assertSame(wildcardType1, wildcardType0); } @Test(timeout = 4000) public void test18() throws Throwable { Type[] typeArray0 = new Type[0]; WildcardType wildcardType0 = mock(WildcardType.class, new ViolatedAssumptionAnswer()); doReturn(typeArray0).when(wildcardType0).getLowerBounds(); doReturn(typeArray0).when(wildcardType0).getUpperBounds(); GenericMetadataSupport.WildCardBoundedType genericMetadataSupport_WildCardBoundedType0 = new GenericMetadataSupport.WildCardBoundedType(wildcardType0); // Undeclared exception! // try { GenericMetadataSupport.inferFrom(genericMetadataSupport_WildCardBoundedType0); // fail("Expecting exception: ArrayIndexOutOfBoundsException"); // } catch(ArrayIndexOutOfBoundsException e) { // // // // 0 // // // verifyException("org.mockito.internal.util.reflection.GenericMetadataSupport$WildCardBoundedType", e); // } } @Test(timeout = 4000) public void test19() throws Throwable { WildcardType wildcardType0 = mock(WildcardType.class, new ViolatedAssumptionAnswer()); GenericMetadataSupport.WildCardBoundedType genericMetadataSupport_WildCardBoundedType0 = new GenericMetadataSupport.WildCardBoundedType(wildcardType0); Type[] typeArray0 = genericMetadataSupport_WildCardBoundedType0.interfaceBounds(); assertEquals(0, typeArray0.length); } @Test(timeout = 4000) public void test20() throws Throwable { GenericMetadataSupport.TypeVarBoundedType genericMetadataSupport_TypeVarBoundedType0 = new GenericMetadataSupport.TypeVarBoundedType((TypeVariable) null); TypeVariable typeVariable0 = genericMetadataSupport_TypeVarBoundedType0.typeVariable(); assertNull(typeVariable0); } }
[ "pouria.derakhshanfar@gmail.com" ]
pouria.derakhshanfar@gmail.com
9efc4c1f94715c1cb6ff378ea699a8cb641111f8
e7e54f71048e47bc7ca58b96d79c48bf7d7df390
/app/src/main/java/com/qingyii/hxtz/zhf/base/Basepresenter.java
5328dc988f30f4cd062c237643417d089a3f7e89
[]
no_license
a523746668/xianfeng
e34646a2198a982bad02b36bc8898866507c97fd
ae87ff86c5903bbf3612c62a1499c9daee86ce77
refs/heads/master
2020-03-11T00:42:37.681485
2018-07-27T03:45:11
2018-07-27T03:45:12
129,670,143
0
1
null
null
null
null
UTF-8
Java
false
false
461
java
package com.qingyii.hxtz.zhf.base; import android.content.Context; /** * Created by zhf on 2017/9/24. */ public abstract class Basepresenter<T extends BaseActivityview> { protected Context context; protected T Acvitivtyview; public Basepresenter(Context context, T acvitivtyview) { this.context = context; Acvitivtyview = acvitivtyview; } public void unbind(){ context=null; Acvitivtyview=null; } }
[ "523746668@qq.com" ]
523746668@qq.com
021bda98055fd5ae0f479d03c125f6c3c7505fa1
0da40259673d642aaf8b5685d36d9f240a5fc67a
/projects/jasn1-compiler/src/test/java-gen/org/openmuc/jasn1/compiler/rspdefinitions/generated/pkix1implicit88/CRLReason.java
af340b375fc527d5d6d5aa440e216486c1533b5d
[]
no_license
leerduo/jASN1
ae389412e3ba47b3ad48b79fb9ffa36188f571ba
48cc84955590db91313c3c73b468c311d803c706
refs/heads/master
2021-01-11T21:35:10.565155
2016-11-29T17:57:09
2016-11-29T17:57:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
931
java
/** * This class file was automatically generated by jASN1 v1.6.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.jasn1.compiler.rspdefinitions.generated.pkix1implicit88; import java.io.IOException; import java.io.EOFException; import java.io.InputStream; import java.util.List; import java.util.ArrayList; import java.util.Iterator; import java.io.UnsupportedEncodingException; import org.openmuc.jasn1.ber.*; import org.openmuc.jasn1.ber.types.*; import org.openmuc.jasn1.ber.types.string.*; import org.openmuc.jasn1.compiler.rspdefinitions.generated.teletexdomaindefinedattributes.*; import org.openmuc.jasn1.compiler.rspdefinitions.generated.rspdefinitions.*; import org.openmuc.jasn1.compiler.rspdefinitions.generated.pkix1explicit88.*; public class CRLReason extends BerEnum { public CRLReason() { } public CRLReason(byte[] code) { super(code); } public CRLReason(long value) { super(value); } }
[ "karsten.ohme@ohmesoftware.de" ]
karsten.ohme@ohmesoftware.de
af57cd15574c71d519d6fe32bcfcc01d458751d1
0296b3482b281192a021c6e9d64f92fa7de41b1e
/core/src/com/mygdx/game/Enemy.java
260d17e9dcd95ab186b7013dcd5f65cb3a5b8e32
[]
no_license
koneill7/starterGame
6819f81c3e22cff6ddb62543c5776c44b27ae61a
5376bc30432e2cbadb298371f0f50297662deafe
refs/heads/master
2023-04-02T20:23:09.512454
2021-04-11T19:03:09
2021-04-11T19:03:09
351,810,430
0
0
null
null
null
null
UTF-8
Java
false
false
929
java
package com.mygdx.game; import com.badlogic.gdx.physics.box2d.Body; import com.badlogic.gdx.physics.box2d.BodyDef; import com.badlogic.gdx.physics.box2d.FixtureDef; import com.badlogic.gdx.physics.box2d.World; public class Enemy { Body body; World newWorld; int health = 100; public Enemy(){ createBox(20f,30f); //what to set this to? } private void createBox(float x, float y){ BodyDef bodyDef = new BodyDef(); FixtureDef fixtureDef = new FixtureDef(); bodyDef.fixedRotation = true; bodyDef.type = BodyDef.BodyType.DynamicBody; bodyDef.position.set(x,y); // fixtureDef.density = 1.0f; body = newWorld.createBody(bodyDef); body.createFixture(fixtureDef).setUserData(this); } public void attack(Player player){ player.injured(); } public void injured(int damage){ health -= damage; } }
[ "koneill7@binghamton.edu" ]
koneill7@binghamton.edu
8d9df6f92ff1b94d32be5b25862de40ac0899949
c37cc036ea35489c574f0815e3735815a5daeca8
/WEB-INF/src/jc/family/game/snow/SnowGameService.java
d4aecb7f1427d34ce09b094f1068c20157f2a301
[]
no_license
liuyang0923/joycool
ac032b616d65ecc54fae8c08ae8e6f3e9ce139d3
e7fcd943d536efe34f2c77b91dddf20844e7cab9
refs/heads/master
2020-06-12T17:14:31.104162
2016-12-09T07:15:40
2016-12-09T07:15:40
75,793,605
0
0
null
null
null
null
UTF-8
Java
false
false
11,584
java
package jc.family.game.snow; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import jc.family.FamilyUserBean; import jc.family.game.GameService; import jc.family.game.MemberBean; import net.joycool.wap.util.db.DbOperation; public class SnowGameService extends GameService { /** * 返回一个int型的属性 * * @param sql * @return */ public int selectIntResult(String sql) { DbOperation db = new DbOperation(5); try { int c = db.getIntResult(sql); return c; } catch (SQLException e) { e.printStackTrace(); } finally { db.release(); } return 0; } /** * 用户雪币修改及插入 * * @param money * @param uid * @return */ public boolean updateSnowMoney(int money, int uid) { DbOperation db = new DbOperation(5); String query = "insert into fm_game_snow_money(uid, money)values(" + uid + "," + money + ") on duplicate key update money=" + money; boolean update = db.executeUpdate(query); db.release(); return update; } // 修改用户最后雪币数 public boolean setSnowMoney(int money, int uid) { DbOperation db = new DbOperation(5); String query = "update fm_game_snow_money set money="+ money+" where uid="+uid; boolean update = db.executeUpdate(query); db.release(); return update; } /** * 根据赛事id,按积分和参赛人数排列参赛家族 * * @param mid * @return */ public List selectFmByScore(int mid) {// 得到参加雪仗游戏的家族的id列表,按积分和参加人数排列 DbOperation db = new DbOperation(5); String query = "select a.fid from fm_game_fmapply a left outer join fm_game_score b on a.fid=b.fmid where a.m_id=" + mid + " and a.total_apply>0 order by ifnull(b.snow_score,0) desc,a.total_apply desc"; List list = new ArrayList(); ResultSet rs = db.executeQuery(query); try { if(rs==null){ return null; } while (rs.next()) { Integer fid = Integer.valueOf(rs.getInt(1)); list.add(fid); } return list; } catch (SQLException e) { e.printStackTrace(); return null; } finally { db.release(); } } public SnowBean selectOneMatch(int fid, int mid) {// 取到赛事统计信息 DbOperation db = new DbOperation(5); String query = "select spend_time, prize, num_total, rank, snow_score,hold_time,fid2,game_point from fm_game_game where fid1=" + fid + " and m_id=" + mid + " and game_type=2"; ResultSet rs = db.executeQuery(query); try { while (rs.next()) { SnowBean bean = new SnowBean(); bean.setFid1(fid); bean.setMid(mid); bean.setSpendTime(rs.getLong(1)); bean.setPrize(rs.getLong(2)); bean.setNumTotal(rs.getInt(3)); bean.setRank(rs.getInt(4)); bean.setScore(rs.getInt(5)); bean.setHoldTime(rs.getDate(6).toString()); bean.setFid2(rs.getInt(7)); bean.setGamePoint(rs.getInt(8)); return bean; } } catch (SQLException e) { e.printStackTrace(); } finally { db.release(); } return null; } // 比赛对抗列表,用于展示某期比赛,对抗家族的胜负情况 public List selectGameList(int mid) { DbOperation db = new DbOperation(5); String query = "select fid1, fid2,rank from fm_game_game where game_type=2 and m_id=" + mid + " and (rank=1 or rank=3) order by id asc"; ResultSet rs = db.executeQuery(query); List list = new ArrayList(); try { while (rs.next()) { SnowBean bean = new SnowBean(); bean.setFid1(rs.getInt(1)); bean.setFid2(rs.getInt(2)); bean.setRank(rs.getInt(3)); list.add(bean); } return list; } catch (SQLException e) { e.printStackTrace(); return null; } finally { db.release(); } } // 取到某个家族参加的各期比赛情况列表 public List selectFmList(int fid, int getStartIndex, int countPerPage) { DbOperation db = new DbOperation(5); String query = "select fid1, fid2, rank,hold_time,m_id from fm_game_game where game_type=2 and fid1=" + fid + " order by id desc limit " + getStartIndex + "," + countPerPage; ResultSet rs = db.executeQuery(query); List list = new ArrayList(); try { while (rs.next()) { SnowBean bean = new SnowBean(); bean.setFid1(rs.getInt(1)); bean.setFid2(rs.getInt(2)); bean.setRank(rs.getInt(3)); bean.setHoldTime(rs.getDate(4).toString()); bean.setMid(rs.getInt(5)); list.add(bean); } return list; } catch (SQLException e) { e.printStackTrace(); return null; } finally { db.release(); } } // 查出命中次数、扫雪的花费、做雪球花费的金额 public List selectGameData(String cmd, int mid, int fid, int getStartIndex, int countPerPage) { DbOperation db = new DbOperation(5); String query = "select uid, " + cmd + " from fm_game_member where m_id=" + mid + " and fid=" + fid + " order by " + cmd + " desc limit " + getStartIndex + "," + countPerPage; ResultSet rs = db.executeQuery(query); List list = new ArrayList(); try { while (rs.next()) { MemberBean bean = new MemberBean(); bean.setUid(rs.getInt(1)); bean.setMid(mid); bean.setFid(fid); if (cmd.equals("total_hit")) { bean.setTotalHit(rs.getInt(2)); } else if (cmd.equals("pay_sweep")) { bean.setPaySweep(rs.getInt(2)); } else if (cmd.equals("pay_make")) { bean.setPayMake(rs.getInt(2)); } list.add(bean); } return list; } catch (SQLException e) { return null; } finally { db.release(); } } /** * 随机出题 * * @return */ public SnowQuestionBean selectQuestion() { DbOperation db = new DbOperation(5); String query = "select t1.id, t1.question, t1.answer from fm_game_snow_question as t1 join (select round(rand() * ((select max(id) from fm_game_snow_question)-(select min(id) from fm_game_snow_question))+(select min(id) from fm_game_snow_question)) as id) as t2 where t1.id >= t2.id order by t1.id limit 1"; ResultSet rs = db.executeQuery(query); try { while (rs.next()) { SnowQuestionBean bean = new SnowQuestionBean(); bean.setId(rs.getInt(1)); bean.setQuestion(rs.getString(2)); bean.setAnswer(rs.getInt(3)); return bean; } } catch (SQLException e) { return null; } finally { db.release(); } return null; } // 查出一个问题的答案 public SnowQuestionBean selectQuestionById(int id) { DbOperation db = new DbOperation(5); String query = "select answer from fm_game_snow_question where id=" + id; ResultSet rs = db.executeQuery(query); try { while (rs.next()) { SnowQuestionBean bean = new SnowQuestionBean(); bean.setAnswer(rs.getInt(1)); return bean; } } catch (SQLException e) { return null; } finally { db.release(); } return null; } // 查出报名的人的列表 public List selectApplyMembers(String cond) { DbOperation db = new DbOperation(5); String query = "select uid,fid from fm_game_apply where state=2 and " + cond; ResultSet rs = db.executeQuery(query); List list = new ArrayList(); try { while (rs.next()) { MemberBean bean = new MemberBean(); int uid = rs.getInt(1); bean.setUid(uid); bean.setFid(rs.getInt(2)); list.add(bean); } return list; } catch (SQLException e) { e.printStackTrace(); return null; } finally { db.release(); } } // 返回一个类型的道具 public SnowGameToolTypeBean selectToolType(int tid) { DbOperation db = new DbOperation(5); String query = "select id, t_name, use_time, action_type, spend_time, snow_effect, spend_money from fm_game_snow_tools where id=" + tid; ResultSet rs = db.executeQuery(query); try { while (rs.next()) { SnowGameToolTypeBean bean = new SnowGameToolTypeBean(); bean.setId(rs.getInt(1)); bean.settName(rs.getString(2)); bean.setUseTime(rs.getInt(3)); bean.setActionType(rs.getInt(4)); bean.setSpendTime(rs.getInt(5)); bean.setSnowEffect(rs.getInt(6)); bean.setSpendMoney(rs.getInt(7)); return bean; } } catch (SQLException e) { e.printStackTrace(); return null; } finally { db.release(); } return null; } /** * 查询用户扣钱没有 * * @param mid * @param uid * @return */ public boolean updatePay(int mid, int uid) { DbOperation db = new DbOperation(5); String query = "update fm_game_apply set is_Pay=1 where m_id=" + mid + " and uid=" + uid; boolean update = db.executeUpdate(query); db.release(); return update; } // 得到家族用户 public FamilyUserBean selectfmUser(int id) { DbOperation db = new DbOperation(5); ResultSet rs = db .executeQuery("select fm_id,gift_fm,con_fm,fm_name,fm_money_used,leave_fm_time,fm_state,fm_flags from fm_user where id=" + id); try { if (rs.next()) { FamilyUserBean fmuser = new FamilyUserBean(); fmuser.setId(id); fmuser.setFm_id(rs.getInt(1)); fmuser.setGift_fm(rs.getLong(2)); fmuser.setCon_fm(rs.getInt(3)); fmuser.setFm_name(rs.getString(4)); fmuser.setFm_money_used(rs.getLong(5)); fmuser.setLeave_fm_time(rs.getTimestamp(6)); fmuser.setFm_state(rs.getInt(7)); fmuser.setFm_flags(rs.getInt(8)); return fmuser; } return null; } catch (SQLException e) { e.printStackTrace(); return null; } finally { db.release(); } } // 判断家族是否参赛 public boolean isAttend(int mid, int fid) { DbOperation db = new DbOperation(5); String query = "select count(id) from fm_game_apply where is_pay=1 and fid=" + fid + " and m_id=" + mid;// 成功进入游戏才会付费1代表付费,即有人参加了比赛 try { int rs = db.getIntResult(query); if (rs > 0) { return true; } } catch (SQLException e) { e.printStackTrace(); return false; } finally { db.release(); } return false; } /** * 存入家族赛事 * * @param bean * @return */ public boolean insertFmGame(SnowBean bean) { // 数据库操作类 DbOperation dbOp = new DbOperation(5); String query = "insert into fm_game_game(m_id,fid1,fid2,num_total,rank,game_type,spend_time,prize,hold_time,snow_score,game_point) VALUES(?,?,?,?,?,?,?,?,now(),?,?)"; // 准备 if (!dbOp.prepareStatement(query)) { dbOp.release(); return false; } // 传递参数 PreparedStatement pstmt = dbOp.getPStmt(); try { pstmt.setInt(1, bean.getMid()); pstmt.setInt(2, bean.getFid1()); pstmt.setInt(3, bean.getFid2()); pstmt.setInt(4, bean.getNumTotal()); pstmt.setInt(5, bean.getRank()); pstmt.setInt(6, bean.getType()); pstmt.setLong(7, bean.getSpendTime()); pstmt.setLong(8, bean.getPrize()); pstmt.setInt(9, bean.getScore()); pstmt.setInt(10, bean.getGamePoint()); } catch (SQLException e) { e.printStackTrace(); dbOp.release(); return false; } // 执行 dbOp.executePstmt(); // 释放资源 dbOp.release(); return true; } public String getStartTime() { DbOperation db = new DbOperation(5); String query = "select start_hour, start_min effect from fm_game_weekgame "; ResultSet rs = db.executeQuery(query); try { while (rs.next()) { int hour = rs.getInt(1); int min = rs.getInt(2); String time =hour+""; if (hour < 10) { time = "0" + time+":"; }else{ time=hour+":"; } if (min < 10) { time = time + "0"; } time = time + min + ":00"; return time; } } catch (SQLException e) { e.printStackTrace(); return "08:30"; } finally { db.release(); } return "08:30"; } }
[ "liu_yang_0923@163.com" ]
liu_yang_0923@163.com
fef1b5284cc4336884c1b923151d263356f146db
bb5219895ff1ce0067638eaada7997c7d8286c89
/citrix-client-win/src/main/java/com/blazemeter/jmeter/citrix/client/windows/com4j/ICAWindowType.java
c28b6454facba3618adb2a9f91536c3a91d70eab
[ "Apache-2.0", "CC-BY-3.0", "BSD-2-Clause" ]
permissive
3dgiordano/CitrixPlugin
cbc10f41e3f9b54b0b4a384388e379e481cfa530
5daf7dff4db170feec5fc3d1e6eb144cc05ed72a
refs/heads/master
2022-05-25T08:39:41.794099
2020-01-31T08:24:53
2020-01-31T08:24:53
267,336,065
2
0
Apache-2.0
2020-05-27T14:07:11
2020-05-27T14:07:11
null
UTF-8
Java
false
false
561
java
package com.blazemeter.jmeter.citrix.client.windows.com4j ; /** * <p> * List of ICA window types * </p> */ public enum ICAWindowType { /** * <p> * The value of this constant is 0 * </p> */ WindowTypeICAClientObject, // 0 /** * <p> * The value of this constant is 1 * </p> */ WindowTypeControl, // 1 /** * <p> * The value of this constant is 2 * </p> */ WindowTypeClient, // 2 /** * <p> * The value of this constant is 3 * </p> */ WindowTypeContainer, // 3 }
[ "p.mouawad@ubik-ingenierie.com" ]
p.mouawad@ubik-ingenierie.com
04f830b77bd2b83d426752b0b877318dba209cda
75c4712ae3f946db0c9196ee8307748231487e4b
/src/main/java/com/alipay/api/domain/AlipayCommerceLotteryPresentlistQueryModel.java
9c0905ecccd7c093d13c49ad38a21f894478cb6d
[ "Apache-2.0" ]
permissive
yuanbaoMarvin/alipay-sdk-java-all
70a72a969f464d79c79d09af8b6b01fa177ac1be
25f3003d820dbd0b73739d8e32a6093468d9ed92
refs/heads/master
2023-06-03T16:54:25.138471
2021-06-25T14:48:21
2021-06-25T14:48:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,407
java
package com.alipay.api.domain; import com.alipay.api.AlipayObject; import com.alipay.api.internal.mapping.ApiField; /** * 查询调用者指定时间范围内的彩票赠送列表,由亚博科技提供服务 * * @author auto create * @since 1.0, 2020-12-14 15:46:59 */ public class AlipayCommerceLotteryPresentlistQueryModel extends AlipayObject { private static final long serialVersionUID = 8465552662464167413L; /** * 结束日期,格式为yyyyMMdd */ @ApiField("gmt_end") private String gmtEnd; /** * 开始日期,格式为yyyyMMdd */ @ApiField("gmt_start") private String gmtStart; /** * 页号,必须大于0,默认为1 */ @ApiField("page_no") private Long pageNo; /** * 页大小,必须大于0,最大为500,默认为500 */ @ApiField("page_size") private Long pageSize; public String getGmtEnd() { return this.gmtEnd; } public void setGmtEnd(String gmtEnd) { this.gmtEnd = gmtEnd; } public String getGmtStart() { return this.gmtStart; } public void setGmtStart(String gmtStart) { this.gmtStart = gmtStart; } public Long getPageNo() { return this.pageNo; } public void setPageNo(Long pageNo) { this.pageNo = pageNo; } public Long getPageSize() { return this.pageSize; } public void setPageSize(Long pageSize) { this.pageSize = pageSize; } }
[ "ben.zy@antfin.com" ]
ben.zy@antfin.com
d7394b946dafdd6b36356df94e0f6f21127e751c
d844f14ca281e64b9b9cf4e2761a6d1509f7d2d0
/src/main/java/com/lxisoft/sas/domain/ExamHall.java
9eda7e72c0f7cc72d57b17d705802a456a1f5551
[]
no_license
INTERNS-LXI-TECHNOLOGIES/cms
f1d21aa6b7148513d9600f0f2eb58e4363f50ef0
3a4494c2b59ad75ee41d4c54f0a1cde69e82d196
refs/heads/master
2022-08-14T12:11:08.971063
2019-06-11T19:36:31
2019-06-11T19:36:31
179,790,724
1
0
null
2022-07-07T04:07:06
2019-04-06T05:01:38
Java
UTF-8
Java
false
false
3,989
java
package com.lxisoft.sas.domain; import com.fasterxml.jackson.annotation.JsonIgnore; import javax.persistence.*; import java.io.Serializable; import java.util.HashSet; import java.util.Set; import java.util.Objects; /** * A ExamHall. */ @Entity @Table(name = "exam_hall") public class ExamHall implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Column(name = "hall_number") private Integer hallNumber; @Column(name = "batch") private String batch; @Column(name = "roll_num_from") private Integer rollNumFrom; @Column(name = "roll_num_to") private Integer rollNumTo; @Column(name = "invigialtor") private String invigialtor; @ManyToMany(mappedBy = "halls") @JsonIgnore private Set<Exam> exams = new HashSet<>(); // jhipster-needle-entity-add-field - JHipster will add fields here, do not remove public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Integer getHallNumber() { return hallNumber; } public ExamHall hallNumber(Integer hallNumber) { this.hallNumber = hallNumber; return this; } public void setHallNumber(Integer hallNumber) { this.hallNumber = hallNumber; } public String getBatch() { return batch; } public ExamHall batch(String batch) { this.batch = batch; return this; } public void setBatch(String batch) { this.batch = batch; } public Integer getRollNumFrom() { return rollNumFrom; } public ExamHall rollNumFrom(Integer rollNumFrom) { this.rollNumFrom = rollNumFrom; return this; } public void setRollNumFrom(Integer rollNumFrom) { this.rollNumFrom = rollNumFrom; } public Integer getRollNumTo() { return rollNumTo; } public ExamHall rollNumTo(Integer rollNumTo) { this.rollNumTo = rollNumTo; return this; } public void setRollNumTo(Integer rollNumTo) { this.rollNumTo = rollNumTo; } public String getInvigialtor() { return invigialtor; } public ExamHall invigialtor(String invigialtor) { this.invigialtor = invigialtor; return this; } public void setInvigialtor(String invigialtor) { this.invigialtor = invigialtor; } public Set<Exam> getExams() { return exams; } public ExamHall exams(Set<Exam> exams) { this.exams = exams; return this; } public ExamHall addExams(Exam exam) { this.exams.add(exam); exam.getHalls().add(this); return this; } public ExamHall removeExams(Exam exam) { this.exams.remove(exam); exam.getHalls().remove(this); return this; } public void setExams(Set<Exam> exams) { this.exams = exams; } // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } ExamHall examHall = (ExamHall) o; if (examHall.getId() == null || getId() == null) { return false; } return Objects.equals(getId(), examHall.getId()); } @Override public int hashCode() { return Objects.hashCode(getId()); } @Override public String toString() { return "ExamHall{" + "id=" + getId() + ", hallNumber=" + getHallNumber() + ", batch='" + getBatch() + "'" + ", rollNumFrom=" + getRollNumFrom() + ", rollNumTo=" + getRollNumTo() + ", invigialtor='" + getInvigialtor() + "'" + "}"; } }
[ "ansalkhan.k.a@lxisoft.com" ]
ansalkhan.k.a@lxisoft.com
2e7962425df7b130aec4b1f820d05aa4d21d4447
b902735672b98663f9dffeae2e13f8eb3e142eca
/struts-sandbox/struts2/apps/mailreader-ibatis/src/main/java/mailreader2/AuthenticationInterceptor.java
627c456bcf04faacf3c5342feeb2862a901a367e
[ "Apache-2.0" ]
permissive
apache/struts-archive
52fefb96b7e3dbdbf7c7872ca7b52aefb291f8ab
5003fc247ad9b0599ebcde7e2a39ba3543638c10
refs/heads/master
2023-08-22T21:57:32.171775
2022-04-23T08:39:06
2022-04-23T08:39:06
33,766,201
1
11
null
2022-04-23T08:39:27
2015-04-11T07:00:06
HTML
UTF-8
Java
false
false
824
java
package mailreader2; import com.opensymphony.xwork2.Action; import com.opensymphony.xwork2.ActionInvocation; import com.opensymphony.xwork2.interceptor.Interceptor; import org.apache.struts.apps.mailreader.dao.User; import java.util.Map; public class AuthenticationInterceptor implements Interceptor { public void destroy() { } public void init() { } public String intercept(ActionInvocation actionInvocation) throws Exception { Map session = actionInvocation.getInvocationContext().getSession(); User user = (User) session.get(Constants.USER_KEY); boolean isAuthenticated = (null != user) && (null != user.getDatabase()); if (!isAuthenticated) { return Action.LOGIN; } else { return actionInvocation.invoke(); } } }
[ "lukaszlenart@apache.org" ]
lukaszlenart@apache.org
561eb9bb55b7737047b95945a151fda4a9c5cef5
26cf17915c6f6fedb489de48c35fa018e7c9b869
/src/main/java/seedu/todo/model/task/BaseTask.java
ad0a75142b3e40bc108557b9147eaef97b8ef2aa
[ "MIT" ]
permissive
CS2103AUG2016-W10-C4/main
9b53bf596855b631c1c89801096f1d7955b13bcf
6d5c9fdcfdf78acf827b1f2eca7c2a6dc8452170
refs/heads/master
2020-05-21T10:10:41.825907
2016-11-07T17:46:16
2016-11-07T17:46:16
69,737,747
1
3
null
2016-11-07T14:17:30
2016-10-01T12:34:11
Java
UTF-8
Java
false
false
687
java
package seedu.todo.model.task; import java.util.UUID; //@@author A0135817B public abstract class BaseTask implements ImmutableTask { protected UUID uuid = UUID.randomUUID(); @Override public UUID getUUID() { return uuid; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof ImmutableTask)) { return false; } return getUUID().equals(((ImmutableTask) o).getUUID()); } @Override public int hashCode() { return getUUID().hashCode(); } @Override public String toString() { return getTitle(); } }
[ "mediumdeviation@gmail.com" ]
mediumdeviation@gmail.com
b8c2ce6e0f50395606dead85e0bbcafabf18a28f
e67dd613de34d8516e8b23557afbb91c162f857b
/cloud2020/cloud-config-client-3355/src/main/java/com/atguigu/springcloud/ctrl/ConfigClientController.java
96b3c661e186dcecfd64148eb29998979b751f5b
[]
no_license
1304068397/springcloudAlibaba
36f3731d140787413171cfad1ebc031c2b86544b
d09dcf85a92a38197f1621ca21289117a0c8b8cf
refs/heads/main
2023-04-08T18:13:59.806382
2021-04-09T08:01:51
2021-04-09T08:01:51
310,038,458
0
0
null
null
null
null
UTF-8
Java
false
false
525
java
package com.atguigu.springcloud.ctrl; import org.springframework.beans.factory.annotation.Value; import org.springframework.cloud.context.config.annotation.RefreshScope; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RefreshScope public class ConfigClientController { @Value("${config.info}") private String configInfo; @GetMapping("/configInfo") public String getConfigInfo(){ return configInfo; } }
[ "1304068397@qq.com" ]
1304068397@qq.com
0221a6f2bcbd6ffef0c76e35c758586d8ace490f
aa7c1583ea80d6048bb7e78487b66da01b47e4b6
/src/main/java/ru/miroque/ls/App.java
dd4f039feb6de814995c325e23a423f4eb63a9c0
[]
no_license
miroque/jcore-mthreading
d8761c53a5da19d0981bdf31f457f65d74985de3
23da1c803fc2c36ab08d493a6643a5cce139337a
refs/heads/master
2020-04-28T08:49:12.749835
2019-03-12T05:44:29
2019-03-12T05:44:29
175,143,319
0
0
null
null
null
null
UTF-8
Java
false
false
176
java
package ru.miroque.ls; /** * Hello world! * */ public class App { public static void main( String[] args ) { System.out.println( "Hello World!" ); } }
[ "i.miroque@gmail.com" ]
i.miroque@gmail.com
c3bf72d7333b5eb4c82f37c0d2c42915112a722e
4270be8e2fea16f1d165fe06b606f7016d8c2150
/lesson9/src/main/java/FieldColumn.java
9a1c22628cd4e7459a40325ba318ecc6dee3f71b
[]
no_license
donotcare/java-2017-04
c0f57503bc89582b68842764a027d4d20e7db513
c130eeb524a4d901313896c39ecd578d73646d5c
refs/heads/master
2021-01-18T20:54:43.470006
2017-08-15T19:54:05
2017-08-15T19:54:05
87,000,191
0
0
null
null
null
null
UTF-8
Java
false
false
244
java
public class FieldColumn { public final String fieldName; public final String columnName; public FieldColumn(String fieldName, String columnName) { this.fieldName = fieldName; this.columnName = columnName; } }
[ "bezblagodatnpst@gmail.com" ]
bezblagodatnpst@gmail.com
9124df1ae66071b6e5c1294a526e4dc4cdf3a7b2
377405a1eafa3aa5252c48527158a69ee177752f
/src/com/facebook/internal/ImageResponseCache$BufferedHttpInputStream.java
c4315eb12b94fc3392b45151433a8c90785be397
[]
no_license
apptology/AltFuelFinder
39c15448857b6472ee72c607649ae4de949beb0a
5851be78af47d1d6fcf07f9a4ad7f9a5c4675197
refs/heads/master
2016-08-12T04:00:46.440301
2015-10-25T18:25:16
2015-10-25T18:25:16
44,921,258
0
1
null
null
null
null
UTF-8
Java
false
false
821
java
// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.geocities.com/kpdus/jad.html // Decompiler options: braces fieldsfirst space lnc package com.facebook.internal; import java.io.BufferedInputStream; import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; // Referenced classes of package com.facebook.internal: // ImageResponseCache, Utility private static class connection extends BufferedInputStream { HttpURLConnection connection; public void close() throws IOException { super.close(); Utility.disconnectQuietly(connection); } (InputStream inputstream, HttpURLConnection httpurlconnection) { super(inputstream, 8192); connection = httpurlconnection; } }
[ "rich.foreman@apptology.com" ]
rich.foreman@apptology.com
03b080ff55c6ed79dd615b41ad1e6d308908af41
31308fd8a821cad5e1a0bc7a7a66542cfc2942a7
/src/main/java/com/bbhorty/api/entity/dto/CatalogueDTO.java
66ce8a5708f47e07db2c114da2a3541658cc3359
[]
no_license
Kouraman/hortyapi
d44b711d5c1c18e5a2dfb29861b699d5c05ab188
614ab62e373de92ad218a66f51d3ed525ff92672
refs/heads/master
2023-06-17T14:40:25.336548
2021-07-18T15:30:03
2021-07-18T15:30:03
292,053,951
0
0
null
null
null
null
UTF-8
Java
false
false
260
java
package com.bbhorty.api.entity.dto; import com.bbhorty.api.entity.models.Catalogue; import lombok.Data; import lombok.EqualsAndHashCode; @EqualsAndHashCode(callSuper = true) @Data public class CatalogueDTO extends Catalogue { private String pathName; }
[ "nicolas.brieussel@gmail.com" ]
nicolas.brieussel@gmail.com
b4c30e1c82d1aa6a81c924b15c02f865f56c3d99
4fac06d7896dbc90158a8b5007ed1e3df583f54e
/app/src/main/java/com/example/android/a3learn/UserProfile.java
2b1498441327cb3ad12928645a7679bdc0af1f77
[]
no_license
johnnyn2/3Learn
23c396e27167d0520e6850012cc845e8cb668759
e6a81c2de04c6003080e281f0e4a9812ed549284
refs/heads/master
2022-12-29T02:14:30.126055
2020-10-19T01:54:53
2020-10-19T01:54:53
254,628,248
0
0
null
null
null
null
UTF-8
Java
false
false
1,510
java
//COMP4521 HO WAI KIN 20447589 wkhoae@connect.ust.hk package com.example.android.a3learn; import java.util.ArrayList; public class UserProfile { private String ID, Email, Name, Password; private ArrayList<Note> notes; //default constructor for function ordering public UserProfile(){ } public UserProfile(String userID, String userEmail, String userName, String userPassword) { this.ID = userID; this.Email = userEmail; this.Name = userName; this.Password = userPassword; } public UserProfile(String userID, String userEmail, String userName, String userPassword, ArrayList<Note>notes){ this.ID = userID; this.Email = userEmail; this.Name = userName; this.Password = userPassword; this.notes = notes; } public ArrayList<Note> getNotes(){ return notes; } public void setNotes(ArrayList<Note> notes) { this.notes = notes; } public String getID() { return ID; } public void setID(String ID) { this.ID = ID; } public String getEmail() { return Email; } public void setEmail(String email) { this.Email = email; } public String getName() { return Name; } public void setName(String name) { this.Name = name; } public String getPassword() { return Password; } public void setPassword(String password) { this.Password = password; } }
[ "wkhoae@connect.ust.hk" ]
wkhoae@connect.ust.hk
7b6f59d5e5efaceecbc179c23883a130e4a8a852
834a46db25da7c36fc1d0b66a0bdab176c1ad34d
/history/src/main/java/obp/controller/OrganizationController.java
0feada55d71b19f2f61ece52e864aabe9655935f
[]
no_license
fossabot/OBP
bc0809ea12e39b236e2163a3747c35ba3ee65753
afbc58e8404ad229f9eac693df3b288cb7fc53d2
refs/heads/master
2021-08-15T10:07:54.236195
2017-11-17T17:32:34
2017-11-17T17:32:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
622
java
package obp.controller; import obp.object.OrganizationHistory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import obp.object.Organization; import obp.repo.OrganizationHistoryRepository; @RestController @RequestMapping("/history/organization") public class OrganizationController extends BaseHistoryController<OrganizationHistory> { @Autowired public OrganizationController(OrganizationHistoryRepository repo) { super(repo,OrganizationHistory.class); } }
[ "holtja@corp.saic.com" ]
holtja@corp.saic.com
14752b9b172611b951e619084d56acc98e6778c6
c93815c15c9b5dea2d2405ab21ae2adc133e1fbd
/Spring03/src/com/test01/AbstractTest.java
4ca06ae2a6ab9a2212b2b8958a935435357339bf
[]
no_license
ijw9209/Workspace_Spring
d3377606bfda7a5de02747319be6836cb6bede67
8b2610b2e10bbcfa3dfeeddead1eff435f9bb4e2
refs/heads/master
2022-12-23T16:51:54.114827
2019-09-04T14:50:14
2019-09-04T14:50:14
205,378,006
0
1
null
2022-12-16T01:04:47
2019-08-30T12:28:50
Java
UTF-8
Java
false
false
593
java
package com.test01; import java.util.Calendar; import java.util.GregorianCalendar; public abstract class AbstractTest { public static AbstractTest getInstance() { GregorianCalendar cal = new GregorianCalendar(); int day = cal.get(Calendar.DAY_OF_WEEK); switch (day) { case 1: return new Sunday(); case 2: return new Monday(); case 3: return new Tuesday(); case 4: return new Wednesday(); case 5: return new Thursday(); case 6: return new Friday(); case 7: return new Saturday(); } return null; } public abstract String dayInfo(); }
[ "ijw9209@naver.com" ]
ijw9209@naver.com
c6250483f29a0a67c8ec08a86e6f5935cf8f3489
90312ad74e5af744750d358a9d97a90d99ca9ebf
/app/src/main/java/com/github/vase4kin/teamcityapp/buildlog/view/OnBuildLogLoadListener.java
21e354946add3bfe86c8abf75afcbc5d5770050f
[ "Apache-2.0" ]
permissive
morristech/TeamCityApp
2f8c862f44829141010201027ed83c702cfd806e
358ccd4a217d173e28c1da317e56562df551da8d
refs/heads/master
2020-03-29T22:26:19.451025
2018-07-01T17:00:37
2018-07-01T17:00:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
966
java
/* * Copyright 2016 Andrey Tolpeev * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.github.vase4kin.teamcityapp.buildlog.view; /** * View build log listener */ public interface OnBuildLogLoadListener { /** * Load build log */ void loadBuildLog(); /** * On auth button click */ void onAuthButtonClick(); /** * Open build log in the browser */ void onOpenBuildLogInBrowser(); }
[ "andrey.tolpeev@gmail.com" ]
andrey.tolpeev@gmail.com
d1c3a2672876431dd68872a820aa1545b7c0fa53
46ec969e0319286f09ebdbd93b877cae1a1925bf
/Easy_Atten/app/src/main/java/com/example/easy_atten/DatePickerFragment.java
6afd5846357ebc4dc48e919c23b8c601d570639d
[]
no_license
Mehul352/Easy_Atten
939665da8ebe1ff76f8cdfd2a0444052f8744fc8
48c1b62241c2410c4db426f7b514997e4ccc19f0
refs/heads/master
2023-03-28T21:23:33.985310
2021-04-15T13:42:48
2021-04-15T13:42:48
297,344,080
4
0
null
2021-04-15T13:42:01
2020-09-21T13:14:13
Java
UTF-8
Java
false
false
748
java
package com.example.easy_atten; import android.app.DatePickerDialog; import android.app.Dialog; import android.os.Bundle; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatDialogFragment; import java.util.Calendar; public class DatePickerFragment extends AppCompatDialogFragment { @NonNull @Override public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) { Calendar c = Calendar.getInstance(); int year =c.get(Calendar.YEAR); int month = c.get(Calendar.MONTH); int day = c.get(Calendar.DAY_OF_MONTH); return new DatePickerDialog(getActivity(),(DatePickerDialog.OnDateSetListener)getActivity(),year,month,day); } }
[ "“panchalmehul352@gmail.com”" ]
“panchalmehul352@gmail.com”
228a4c6acbd24377375f56652e8a96cf1ac07694
7aeccbe055cb97fc1533f0ce5a483bbc9f66f7fd
/src/main/java/com/codetaylor/mc/artisanworktables/common/event/RecipeSerializerRegistrationEventHandler.java
94250b9a5a7f85b21195837f090212479f5490b1
[ "Apache-2.0" ]
permissive
codetaylor/artisan-worktables-1.16
f5f0b212a388ef1683fd084c63447d4b5e6a5189
780606327080d314c605951e9f35f123da9c902f
refs/heads/master
2023-07-21T01:05:17.649537
2023-07-10T15:33:27
2023-07-10T15:33:27
330,765,663
0
0
null
null
null
null
UTF-8
Java
false
false
2,752
java
package com.codetaylor.mc.artisanworktables.common.event; import com.codetaylor.mc.artisanworktables.common.recipe.ArtisanRecipe; import com.codetaylor.mc.artisanworktables.common.recipe.ArtisanRecipeShaped; import com.codetaylor.mc.artisanworktables.common.recipe.ArtisanRecipeShapeless; import com.codetaylor.mc.artisanworktables.common.recipe.serializer.*; import com.codetaylor.mc.artisanworktables.common.reference.EnumType; import com.codetaylor.mc.artisanworktables.common.reference.Reference; import com.codetaylor.mc.artisanworktables.common.util.Key; import net.minecraft.item.crafting.IRecipeSerializer; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.registries.IForgeRegistry; import java.util.EnumMap; public class RecipeSerializerRegistrationEventHandler { private final EnumMap<EnumType, IRecipeSerializer<? extends ArtisanRecipe>> registeredSerializersShaped; private final EnumMap<EnumType, IRecipeSerializer<? extends ArtisanRecipe>> registeredSerializersShapeless; public RecipeSerializerRegistrationEventHandler( EnumMap<EnumType, IRecipeSerializer<? extends ArtisanRecipe>> registeredSerializersShaped, EnumMap<EnumType, IRecipeSerializer<? extends ArtisanRecipe>> registeredSerializersShapeless ) { this.registeredSerializersShaped = registeredSerializersShaped; this.registeredSerializersShapeless = registeredSerializersShapeless; } @SubscribeEvent public void on(RegistryEvent.Register<IRecipeSerializer<?>> event) { IForgeRegistry<IRecipeSerializer<?>> registry = event.getRegistry(); for (EnumType type : EnumType.values()) { String name = type.getName(); { RecipeSerializer<ArtisanRecipeShaped> serializer = new RecipeSerializer<>( new RecipeSerializerShapedJsonReader(type, Reference.MAX_RECIPE_WIDTH, Reference.MAX_RECIPE_HEIGHT), new RecipeSerializerShapedPacketReader(type), new RecipeSerializerShapedPacketWriter() ); serializer.setRegistryName(Key.from(name + "_shaped")); this.registeredSerializersShaped.put(type, serializer); registry.register(serializer); } { RecipeSerializer<ArtisanRecipeShapeless> serializer = new RecipeSerializer<>( new RecipeSerializerShapelessJsonReader(type, Reference.MAX_RECIPE_WIDTH, Reference.MAX_RECIPE_HEIGHT), new RecipeSerializerShapelessPacketReader(type), new RecipeSerializerShapelessPacketWriter() ); serializer.setRegistryName(Key.from(name + "_shapeless")); this.registeredSerializersShapeless.put(type, serializer); registry.register(serializer); } } } }
[ "jason@codetaylor.com" ]
jason@codetaylor.com
826cae9a2b5ead25d92eb44f51dc74624f457c05
e617f4ae796f16eeb4705200935a90dfd31955b2
/com/google/android/gms/maps/model/i.java
34deda5eaf55c29bb82fead866c7f20b56169190
[]
no_license
mascot6699/Go-Jek.Android
98dfb73b1c52a7c2100c7cf8baebc0a95d5d511d
051649d0622bcdc7872cb962a0e1c4f6c0f2a113
refs/heads/master
2021-01-20T00:24:46.431341
2016-01-11T05:59:34
2016-01-11T05:59:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,563
java
package com.google.android.gms.maps.model; import android.os.Parcel; import android.os.Parcelable.Creator; import com.google.android.gms.common.internal.safeparcel.a; import com.google.android.gms.common.internal.safeparcel.a.a; import com.google.android.gms.common.internal.safeparcel.b; public class i implements Parcelable.Creator<LatLng> { static void a(LatLng paramLatLng, Parcel paramParcel, int paramInt) { paramInt = b.D(paramParcel); b.c(paramParcel, 1, paramLatLng.getVersionCode()); b.a(paramParcel, 2, paramLatLng.latitude); b.a(paramParcel, 3, paramLatLng.longitude); b.H(paramParcel, paramInt); } public LatLng cM(Parcel paramParcel) { double d1 = 0.0D; int j = a.C(paramParcel); int i = 0; double d2 = 0.0D; while (paramParcel.dataPosition() < j) { int k = a.B(paramParcel); switch (a.aD(k)) { default: a.b(paramParcel, k); break; case 1: i = a.g(paramParcel, k); break; case 2: d2 = a.m(paramParcel, k); break; case 3: d1 = a.m(paramParcel, k); } } if (paramParcel.dataPosition() != j) { throw new a.a("Overread allowed size end=" + j, paramParcel); } return new LatLng(i, d2, d1); } public LatLng[] eC(int paramInt) { return new LatLng[paramInt]; } } /* Location: /Users/michael/Downloads/dex2jar-2.0/GO_JEK.jar!/com/google/android/gms/maps/model/i.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */
[ "michael@MJSTONE-MACBOOK.local" ]
michael@MJSTONE-MACBOOK.local
dd4ac9187b23818b090556c963f9f92149fcd00b
c32b04be176376fdfee7355dad6b4729836b2e4c
/src/main/java/ca/tarasyk/navigator/pathfinding/goal/Goal.java
4974d0f6bd1f4aa2f88e5a88817e7b111f4e6c4b
[]
no_license
qubard/tasky
8422934d26264238d03cf207872042d815f7ddae
0d43d8041d8c882d313d93dd73a427ffa9c00c12
refs/heads/master
2022-04-24T00:04:42.173386
2020-04-30T16:53:15
2020-04-30T16:53:15
199,909,343
5
1
null
null
null
null
UTF-8
Java
false
false
645
java
package ca.tarasyk.navigator.pathfinding.goal; import ca.tarasyk.navigator.BetterBlockPos; import ca.tarasyk.navigator.pathfinding.node.PathNode; public abstract class Goal implements PathGoal { protected BetterBlockPos pos; public Goal(BetterBlockPos pos) { this(pos.getX(), pos.getY(), pos.getZ()); } public Goal(int x, int y, int z) { this.pos = new BetterBlockPos(x, y, z); } public BetterBlockPos getPos() { return pos; } public PathNode toPathNode() { return new PathNode(pos); } @Override public String toString() { return pos.toString(); } }
[ "qubard@gmail.com" ]
qubard@gmail.com
a92124c82ec3615722765152663e5261ed394d14
e9776fc0affbecae0b0295e9114d2f19db1be958
/app/src/main/java/com/bstka/covidpedika/PpkmActivity.java
701005de7961a2cf265d141bef1581fd5d9115df
[]
no_license
bstka/Covidpedika
57a711cdcbc908b6556f936fad4506adcf374080
4329f53c8b576c76ee975dd505a085b438055ac4
refs/heads/master
2023-06-17T21:34:03.718344
2021-07-15T16:30:18
2021-07-15T16:30:18
386,356,453
0
0
null
null
null
null
UTF-8
Java
false
false
334
java
package com.bstka.covidpedika; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; public class PpkmActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_ppkm); } }
[ "bismantaka20@hotmail.com" ]
bismantaka20@hotmail.com
c4605cd0ee8a97418c314ecf18f588ffb64c0353
9f3a1ca565834ab54a9b204907f2259bd3ff0ef9
/app/src/main/java/com/example/kyungjoo/maestro/main/Response.java
ef6245454ae2ca9baccf016aa3f9c47ce3b49953
[]
no_license
JangKyungJoo/maestro-front
3366ef91a9e35433872a27a7465de651206d3a33
b93f5bc241a83419eb9244fb1673a1f71be225ae
refs/heads/master
2021-01-17T19:13:55.836758
2016-11-03T18:41:51
2016-11-03T18:41:51
63,974,768
0
0
null
null
null
null
UTF-8
Java
false
false
234
java
package com.example.kyungjoo.maestro.main; /** * Created by KyungJoo on 2016-07-14. */ public class Response { private int code; private String message; public void setCode(int code){ this.code = code; } }
[ "장경주" ]
장경주
e79534e2c1da02563531a9da1a18d1ffcd29f46a
ecc005ce636e46da773b99eb0cdf9947dfa079c7
/src/main/java/com/github/wolfgang/operation/core/model/ReceiverConfigBean.java
db8772875c7abdc806ea0479d9a7ef0539fb0e12
[]
no_license
wolfgangzhu/operation
13fdce9ef034bc1f6deab1a675e82434a4e37536
3b949e04048f4dc74fea83d0d3b0fb2e0bdf5d74
refs/heads/main
2023-04-03T00:31:14.797586
2021-04-03T14:10:05
2021-04-03T14:10:05
354,288,741
0
0
null
null
null
null
UTF-8
Java
false
false
974
java
package com.github.wolfgang.operation.core.model; /** * @author wolfgang * @date 2020-02-17 14:46:00 * @version $ Id: ReceiverConfigBean.java, v 0.1 wolfgang Exp $ */ public class ReceiverConfigBean { private long expireInMs; private String receiverClass; private String name; public ReceiverConfigBean(long expireInMs, String receiverClass, String name) { this.expireInMs = expireInMs; this.receiverClass = receiverClass; this.name = name; } public String getName() { return name; } public void setName(String name) { this.name = name; } public long getExpireInMs() { return expireInMs; } public void setExpireInMs(long expireInMs) { this.expireInMs = expireInMs; } public String getReceiverClass() { return receiverClass; } public void setReceiverClass(String receiverClass) { this.receiverClass = receiverClass; } }
[ "wolfgang.zhu@zenlayer.com" ]
wolfgang.zhu@zenlayer.com
c5afd22ae0d6a320c8138c0ed3485f68377a3e04
d6f1075832e5e8c4948884e2812ad7153efb3d9a
/src/com/liato/bankdroid/BankEditActivity.java
1939fb621601117f8b11f0e19c2337b3236a7813
[]
no_license
mhagander/android-bankdroid
e3b24da718919918a742a688eb4a7b210c43b968
a50298cdbf13601dd649574306147651848b195a
refs/heads/master
2020-12-30T18:37:34.468971
2010-12-29T18:20:32
2010-12-29T18:20:32
1,210,661
0
0
null
null
null
null
UTF-8
Java
false
false
7,918
java
/* * Copyright (C) 2010 Nullbyte <http://nullbyte.eu> * * 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.liato.bankdroid; import java.util.ArrayList; import java.util.Collections; import java.util.List; import com.liato.bankdroid.appwidget.AutoRefreshService; import com.liato.bankdroid.banking.Bank; import com.liato.bankdroid.banking.BankFactory; import com.liato.bankdroid.banking.exceptions.BankException; import com.liato.bankdroid.banking.exceptions.LoginException; import android.app.AlertDialog; import android.app.ProgressDialog; import android.content.Context; import android.content.DialogInterface; import android.content.res.Resources; import android.graphics.Typeface; import android.os.AsyncTask; import android.os.Bundle; import android.text.method.PasswordTransformationMethod; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.AdapterView.OnItemSelectedListener; import android.widget.ArrayAdapter; import android.widget.EditText; import android.widget.Spinner; import android.widget.TextView; public class BankEditActivity extends LockableActivity implements OnClickListener, OnItemSelectedListener { private final static String TAG = "AccountActivity"; private Bank SELECTED_BANK; private long BANKID = -1; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.bank); ArrayList<Bank> items = BankFactory.listBanks(this); Collections.sort(items); Spinner spnBanks = (Spinner)findViewById(R.id.spnBankeditBanklist); BankSpinnerAdapter<Bank> adapter = new BankSpinnerAdapter<Bank>(this, android.R.layout.simple_spinner_item, items); //adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spnBanks.setAdapter(adapter); spnBanks.setOnItemSelectedListener(this); findViewById(R.id.btnSettingsCancel).setOnClickListener(this); findViewById(R.id.btnSettingsOk).setOnClickListener(this); Bundle extras = getIntent().getExtras(); if (extras != null) { BANKID = extras.getLong("id", -1); if (BANKID != -1) { Bank bank = BankFactory.bankFromDb(BANKID, this, false); if (bank != null) { ((EditText)findViewById(R.id.edtBankeditUsername)).setText(bank.getUsername()); ((EditText)findViewById(R.id.edtBankeditPassword)).setText(bank.getPassword()); ((EditText)findViewById(R.id.edtBankeditCustomName)).setText(bank.getCustomName()); TextView errorDesc = (TextView)findViewById(R.id.txtErrorDesc); if (bank.isDisabled()) { errorDesc.setVisibility(View.VISIBLE); } else { errorDesc.setVisibility(View.INVISIBLE); } SELECTED_BANK = bank; for (int i = 0; i < items.size(); i++) { if (bank.getBanktypeId() == items.get(i).getBanktypeId()) { spnBanks.setSelection(i); break; } } } } } } @Override public void onClick(View v) { if (v.getId() == R.id.btnSettingsCancel) { this.finish(); } else if (v.getId() == R.id.btnSettingsOk){ SELECTED_BANK.setUsername(((EditText) findViewById(R.id.edtBankeditUsername)).getText().toString().trim()); SELECTED_BANK.setPassword(((EditText) findViewById(R.id.edtBankeditPassword)).getText().toString().trim()); SELECTED_BANK.setCustomName(((EditText) findViewById(R.id.edtBankeditCustomName)).getText().toString().trim()); SELECTED_BANK.setDbid(BANKID); new DataRetrieverTask(this, SELECTED_BANK).execute(); } } @Override public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int pos, long id) { SELECTED_BANK = (Bank)parentView.getItemAtPosition(pos); EditText edtUsername = (EditText)findViewById(R.id.edtBankeditUsername); edtUsername.setInputType(SELECTED_BANK.getInputTypeUsername()); edtUsername.setHint(SELECTED_BANK.getInputHintUsername()); //Not possible to set a textfield to both PHONE and PASSWORD :\ EditText edtPassword = (EditText)findViewById(R.id.edtBankeditPassword); edtPassword.setInputType(SELECTED_BANK.getInputTypePassword()); edtPassword.setTransformationMethod(PasswordTransformationMethod.getInstance()); edtPassword.setTypeface(Typeface.MONOSPACE); } @Override public void onNothingSelected(AdapterView<?> arg) { } private class BankSpinnerAdapter<T> extends ArrayAdapter<T> { private int resource; @Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = ((LayoutInflater)super.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(resource, parent, false); } ((TextView)convertView).setText(((Bank)getItem(position)).getName()); return convertView; } public BankSpinnerAdapter(Context context, int textViewResourceId, List<T> items) { super(context, textViewResourceId, items); resource = textViewResourceId; } @Override public View getDropDownView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = ((LayoutInflater)super.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(android.R.layout.simple_spinner_dropdown_item, parent, false); } ((TextView)convertView).setText(((Bank)getItem(position)).getName()); return convertView; } } private class DataRetrieverTask extends AsyncTask<String, Void, Void> { private final ProgressDialog dialog = new ProgressDialog(BankEditActivity.this); private Exception exc = null; private Bank bank; private BankEditActivity context; private Resources res; public DataRetrieverTask(BankEditActivity context, Bank bank) { this.context = context; this.res = context.getResources(); this.bank = bank; } protected void onPreExecute() { this.dialog.setMessage(res.getText(R.string.logging_in)); this.dialog.show(); } protected Void doInBackground(final String... args) { try { Log.d(TAG, "Updating "+bank); bank.update(); bank.updateAllTransactions(); bank.closeConnection(); Log.d(TAG, "Saving "+bank); bank.save(); Log.d(TAG, "Disabled: "+bank.isDisabled()); } catch (BankException e) { this.exc = e; } catch (LoginException e) { this.exc = e; } return null; } protected void onPostExecute(final Void unused) { AutoRefreshService.sendWidgetRefresh(context); if (this.dialog.isShowing()) { this.dialog.dismiss(); } if (this.exc != null) { AlertDialog.Builder builder = new AlertDialog.Builder(BankEditActivity.this); builder.setMessage(this.exc.getMessage()).setTitle(res.getText(R.string.could_not_create_account)) .setIcon(android.R.drawable.ic_dialog_alert) .setNeutralButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog alert = builder.create(); alert.show(); } else { context.finish(); } } } @Override protected void onResume() { super.onResume(); } @Override protected void onPause() { super.onPause(); } @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); } }
[ "x@x00.us" ]
x@x00.us
2cd1bf533e07572e999a8ae8f460a551ac991577
15448fc168098b8adc44c5905bd861adfd1832b7
/ejbca/modules/cesecore-common/src/org/cesecore/util/ui/MultiLineString.java
15278cda47da36416e5f9f0b98ed6dfc4f38295b
[]
no_license
gangware72/Ejbca-Sample
d9ff359d0c3a675ca7e487bb181f4cdb101c123b
821d126072f38225ae321ec45011a5d72750e97a
refs/heads/main
2023-07-19T22:35:36.414622
2021-08-19T23:17:28
2021-08-19T23:17:28
398,092,842
1
0
null
null
null
null
UTF-8
Java
false
false
1,685
java
/************************************************************************* * * * CESeCore: CE Security Core * * * * This software is free software; you can redistribute it and/or * * modify it under the terms of the GNU Lesser General Public * * License as published by the Free Software Foundation; either * * version 2.1 of the License, or any later version. * * * * See terms of license at gnu.org. * * * *************************************************************************/ package org.cesecore.util.ui; import java.io.Serializable; /** * Representation of a multi-line String (text area) for use with DynamicUiProperty. * * Since the type of DynamicUiProperty determines how it should be rendered (for example in this * case a HTML input of type "textarea"), this class is needed as a distinction from a regular * String (that is assumed to be a single line). * * @version $Id$ */ public class MultiLineString implements Serializable { private static final long serialVersionUID = 1L; private String value; public MultiLineString(final String value) { this.value = value; } public String getValue() { return value; } public void setValue(final String value) { this.value = value; } }
[ "edgar.gangware@cradlepoint.com" ]
edgar.gangware@cradlepoint.com
cd4112e62075a872f5a2da21f0780bf23dbf3ed9
ceeea83e2553c0ffef73bb8d3dc784477e066531
/e-ResourceOrginal/src/java/com/erp/Reports/Employeeinformation.java
5927a2b682b26dca9d785f2cd2acd1e05d451cbf
[ "Apache-2.0" ]
permissive
anupammaiti/ERP
99bf67f9335a2fea96e525a82866810875bc8695
8c124deb41c4945c7cd55cc331b021eae4100c62
refs/heads/master
2020-08-13T19:30:59.922232
2019-10-09T17:04:58
2019-10-09T17:04:58
215,025,440
1
0
Apache-2.0
2019-10-14T11:26:11
2019-10-14T11:26:10
null
UTF-8
Java
false
false
3,517
java
package com.erp.Reports; import java.io.IOException; import java.io.InputStream; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.HashMap; import java.util.Properties; import javax.servlet.ServletConfig; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.log4j.Logger; import net.sf.jasperreports.engine.JRException; import net.sf.jasperreports.engine.JasperRunManager; import com.svs.erp.Hr.db.ConnectionUtils; import com.svs.erp.company.DAO.CompanyRegistrationDAO; import com.svs.util.ConvertStackTracetoString; import com.svs.util.Properties_Util; public class Employeeinformation extends HttpServlet { private ServletContext servletContext; final static Logger logger = Logger.getLogger(Employeeinformation.class); ConvertStackTracetoString util_stacktrace=new ConvertStackTracetoString(); private CompanyRegistrationDAO companyregdao=new CompanyRegistrationDAO(); private Properties_Util util_prop=new Properties_Util(); private Properties prop=new Properties(); /** Initializes the Servlet and gets the Initial parameters */ public void init(ServletConfig Conf) throws ServletException { super.init(Conf); try { servletContext = Conf.getServletContext(); } catch (Exception ex) { logger.error(util_stacktrace.sendingErrorAsString(ex)); } } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String name=null; String empid=request.getParameter("empid"); ////////System.out.println("Employee ID in report....."+empid); try { ServletOutputStream servletOutputStream = response.getOutputStream(); InputStream reportStream = servletContext.getResourceAsStream("/Reports/employeeinformations.jasper"); ////////System.out.println("Emp1"); Connection con = null; ConnectionUtils conn=new ConnectionUtils(); con=conn.getDBConnection(); PreparedStatement ps=con.prepareStatement("select name,lname from employee where empno=?"); ps.setString(1,empid); ResultSet rs=ps.executeQuery(); while(rs.next()) { String fname=rs.getString(1); String lname=rs.getString(2); name=fname+" "+lname; } HashMap hm = new HashMap(); //Map reportParameters = new HashMap(); hm.put("empid",empid); hm.put("name",name); String companyname=(String)request.getSession().getAttribute("comp"); String imageName=companyregdao.viewImageNameByCompanyName(companyname);//Getting Image Name by using Companyname. prop=util_prop.getMessageUpload();//Setting properties file to properties Object. String imagePath=prop.getProperty("logopath")+imageName;//Merging(Concatinate) the Path and ImageName. hm.put("imagePath", imagePath); //hm.put("John Doe", new Double(3434.34)); JasperRunManager.runReportToPdfStream(reportStream , servletOutputStream, hm, con); //////System.out.println("Clicked on....."+empid); response.setContentType("application/pdf"); servletOutputStream.flush(); servletOutputStream.close(); } catch (JRException e1) { logger.error(util_stacktrace.sendingErrorAsString(e1)); } catch (Exception e) { logger.error(util_stacktrace.sendingErrorAsString(e)); } } } // JavaScript Document
[ "rrkravikiranrrk@gmail.com" ]
rrkravikiranrrk@gmail.com
daa26092aece13935fba2775d626455ac9fd9744
59ca16736fa737510d11f00499d0058534f7aa18
/typecasting/src/com/tyss/typecasting/objassign/Employee.java
4c69616c67d359ddf00e04f092e3063b737822f6
[]
no_license
TY-Sthambini-K/core-java
0e7fa8572857be4d806e11a156582060ae4ac22d
a53dbf25b7982d5cee4d343a74221add8d6e2dcd
refs/heads/master
2023-03-25T10:15:29.074124
2021-03-25T11:42:11
2021-03-25T11:42:11
351,407,690
0
0
null
null
null
null
UTF-8
Java
false
false
282
java
package com.tyss.typecasting.objassign; public class Employee extends Person{ int eid; String ename; public Employee(int eid, String ename) { super(); this.eid = eid; this.ename = ename; } void work() { System.out.println("working"); System.out.println(eid+" "+ename); } }
[ "sthambini.k@testyantra.in" ]
sthambini.k@testyantra.in
c1c56016f3d210669a78dbee846f3120a1d10357
062dfc5145d74e81ee711febe70697f4d82546ff
/neptune-export/src/main/java/com/amazonaws/services/neptune/cli/RdfExportScopeModule.java
4cc197eb4eee6e964c561247e06860917a77f544
[ "Apache-2.0" ]
permissive
vivgoyal-aws/amazon-neptune-tools
e3ccdad895b138c0a585204610aee0606e26db88
b81872022e9965e8a22b37cfed8d62bd9de6e017
refs/heads/master
2023-06-24T09:44:10.023764
2023-05-03T11:58:34
2023-05-03T11:58:34
371,186,064
0
0
Apache-2.0
2021-05-26T23:56:19
2021-05-26T22:44:54
null
UTF-8
Java
false
false
2,063
java
/* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. A copy of the License is located at http://www.apache.org/licenses/LICENSE-2.0 or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package com.amazonaws.services.neptune.cli; import com.amazonaws.services.neptune.rdf.*; import com.amazonaws.services.neptune.rdf.io.*; import com.github.rvesse.airline.annotations.Option; import com.github.rvesse.airline.annotations.restrictions.AllowedEnumValues; import com.github.rvesse.airline.annotations.restrictions.Once; import org.apache.commons.lang.StringUtils; public class RdfExportScopeModule { @Option(name = {"--rdf-export-scope"}, description = "Export scope (optional, default 'graph').") @Once @AllowedEnumValues(RdfExportScope.class) private RdfExportScope scope = RdfExportScope.graph; @Option(name = {"--sparql"}, description = "SPARQL query.") @Once private String query; public ExportRdfJob createJob(NeptuneSparqlClient client, RdfTargetConfig targetConfig){ if (scope == RdfExportScope.graph){ return new ExportRdfGraphJob(client, targetConfig); } else if (scope == RdfExportScope.edges){ return new ExportRdfEdgesJob(client, targetConfig); } else if (scope == RdfExportScope.query){ if (StringUtils.isEmpty(query)){ throw new IllegalStateException("You must supply a SPARQL query if exporting from a query"); } return new ExportRdfFromQuery(client, targetConfig, query); } throw new IllegalStateException(String.format("Unknown export scope: %s", scope)); } public String scope(){ return scope.name(); } }
[ "noreply@github.com" ]
noreply@github.com
7fd74d321feeaf7e5b22c1421e759adbb77dcb3e
eca4e21e4697d63242802744f01079ce2f590ffb
/ReCapProject/src/ReCapProject/core/utilities/result/DataResult.java
138516e04f3617e93ead07c35113fda364bf8321
[]
no_license
Msaglam666/ReCapProjects
6d60fef09dae7f505a8c9c35cf9d1d3a9a190e0c
c6984ec0b699e2255827bbb80f83dd6acaaa85b2
refs/heads/main
2023-09-05T16:21:58.810216
2021-11-17T20:07:01
2021-11-17T20:07:01
429,184,184
0
0
null
null
null
null
UTF-8
Java
false
false
345
java
package ReCapProject.core.utilities.result; public class DataResult<T> extends Result { private T data; public DataResult(T data, boolean success, String message) { super(success,message); this.data=data; } public DataResult(T data, boolean success) { super(success); this.data=data; } public T getData() { return data; } }
[ "94082746+Msaglam666@users.noreply.github.com" ]
94082746+Msaglam666@users.noreply.github.com