blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
313
a08576cbda983e7d7289466ffc852c5869bcb335
6877a06e2200847c3630226e3d2b564db33c8c43
/JVB/[409 kay] Programowanie generyczne/src/PairTest3.java
6caaa9e2961b2f4446fe9fc6be00302fecb8c56d
[]
no_license
lukaszmagiera26/Exercises
210f42876a29457877f858994580a9cf1ab644d8
4e88361f20329f50910e52cc01eb5a114f902ce4
refs/heads/master
2020-03-25T23:34:56.162731
2018-09-18T08:45:32
2018-09-18T08:45:32
144,281,956
1
0
null
null
null
null
WINDOWS-1250
Java
false
false
1,857
java
/** * @version 1.01 2012-01-26 * @author Cay Horstmann */ public class PairTest3 { public static void main(String[] args) { Manager ceo = new Manager("Stanisław Skąpy", 800000, 2003, 12, 15); Manager cfo = new Manager("Piotr Podstępny", 600000, 2003, 12, 15); Pair<Manager> buddies = new Pair<>(ceo, cfo); printBuddies(buddies); ceo.setBonus(1000000); cfo.setBonus(500000); Manager[] managers = { ceo, cfo }; Pair<Employee> result = new Pair<>(); minmaxBonus(managers, result); System.out.println("pierwszy: " + result.getFirst().getName() + ", drugi: " + result.getSecond().getName()); maxminBonus(managers, result); System.out.println("pierwszy: " + result.getFirst().getName() + ", drugi: " + result.getSecond().getName()); } public static void printBuddies(Pair<? extends Employee> p) { Employee first = p.getFirst(); Employee second = p.getSecond(); System.out.println(first.getName() + " i " + second.getName() + "są kumplami."); } public static void minmaxBonus(Manager[] a, Pair<? super Manager> result) { if (a == null || a.length == 0) return; Manager min = a[0]; Manager max = a[0]; for (int i = 1; i < a.length; i++) { if (min.getBonus() > a[i].getBonus()) min = a[i]; if (max.getBonus() < a[i].getBonus()) max = a[i]; } result.setFirst(min); result.setSecond(max); } public static void maxminBonus(Manager[] a, Pair<? super Manager> result) { minmaxBonus(a, result); PairAlg.swapHelper(result); // metoda swapHelper chwyta typ wieloznaczny } } class PairAlg { public static boolean hasNulls(Pair<?> p) { return p.getFirst() == null || p.getSecond() == null; } public static void swap(Pair<?> p) { swapHelper(p); } public static <T> void swapHelper(Pair<T> p) { T t = p.getFirst(); p.setFirst(p.getSecond()); p.setSecond(t); } }
b03a5711d081bb346f4d84ae3e669e74a91f5ecd
29155cad17764163b2a9b1fd929c77d802b1f44a
/src/main/java/com/saleor/saleor_api/security/JwtAuthenticationFilter.java
f51968e6ad6c4399a17281436537631be56d3070
[]
no_license
hungpham1998/saleor_api
732287181a3a0d3784eb60ed09dca9437bdc6a57
c010a9dc89c9c2bfe6923a7a7553a855bd6c459a
refs/heads/main
2023-02-22T21:26:22.058464
2021-02-01T08:01:19
2021-02-01T15:17:03
331,016,887
0
0
null
2021-02-01T08:04:18
2021-01-19T15:02:07
Java
UTF-8
Java
false
false
2,825
java
package com.saleor.saleor_api.security; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.web.authentication.WebAuthenticationDetailsSource; import org.springframework.util.StringUtils; import org.springframework.web.filter.OncePerRequestFilter; import javax.servlet.FilterChain; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; public class JwtAuthenticationFilter extends OncePerRequestFilter { @Autowired JwtTokenProvider tokenProvider; @Autowired CustomUserDetailsService customUserDetailsService; private static final Logger logger = LoggerFactory.getLogger(JwtAuthenticationFilter.class); @Override protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { try { // Lấy jwt từ request String jwt = getJwtFromRequest(request); if (StringUtils.hasText(jwt) && tokenProvider.validateToken(jwt)) { // Lấy id user từ chuỗi jwt Long userId = tokenProvider.getUserIdFromJWT(jwt); /* Note that you could also encode the user's username and roles inside JWT claims and create the UserDetails object by parsing those claims from the JWT. That would avoid the following database hit. It's completely up to you. */ UserDetails userDetails = customUserDetailsService.loadUserById(userId); UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(userDetails, null, userDetails.getAuthorities()); authentication.setDetails(new WebAuthenticationDetailsSource().buildDetails(request)); SecurityContextHolder.getContext().setAuthentication(authentication); } } catch (Exception ex) { logger.error("Could not set user authentication in security context", ex); } filterChain.doFilter(request, response); } private String getJwtFromRequest(HttpServletRequest request) { String bearerToken = request.getHeader("Authorization"); if (StringUtils.hasText(bearerToken) && bearerToken.startsWith("Bearer ")) { return bearerToken.substring(7, bearerToken.length()); } return null; } }
d2a6065c4c75459cb75d838bdd80caad33491a89
5b0bc607d9520c90e31b3a58a3cf336b25effb53
/src/main/java/fillestyn/_3_3/ImportClass.java
8142df14eb3cfe7bba8da39778b0af79ae3e6ca7
[]
no_license
JevPrentice/OracleOcaPreperation
deed8cfb807ed76674b57d7cb94dbdac518e4ead
4600b75a8c47a4682f136efda5112c3dc704128c
refs/heads/master
2021-06-29T00:59:18.078155
2020-10-14T06:18:41
2020-10-14T06:18:41
157,953,334
0
0
null
null
null
null
UTF-8
Java
false
false
1,420
java
package fillestyn._3_3; /* Invalid ambiguous import for Date import java.util.Date; import java.sql.Date; -- */ // -- Both these are valid if you want to import Date //import java.util.Date; //import java.util.*; // -- //-- You can’t import classes from a subpackage by using an asterisk in the import statement. // -- e.g. java.* != java.util.Date /* Unlike in C or C++, importing a class doesn’t add to the size of a Java .class file. An import statement enables Java to refer to the imported classes without embedding their source code in the target .class file. */ //import RandomClassOnDefaultPackage; // <-- DEFAULT PACKAGE /* -- Not defining a package means the class is in the default package and classes in the default package can use each other without import statements A class from a default package can’t be used in any named packaged class regardless */ /* You can import an individual static member of a class or all its static members by using the import static statement. */ import static fillestyn._0.random.TestStatic.addTwoNumbers; import static fillestyn._0.random.TestStatic.person; // import static one._0.random.TestStatic.*; //-- Can also import all static members with wild card /** * @author fillestyn66 */ public class ImportClass { public void sayHisName() { person.sayMyName(); } int addTwoNumbersAgain(int a, int b) { return addTwoNumbers(20, 30); } }
b61d9116d8045ca017bc8a51cf9aabbc2284b053
95e944448000c08dd3d6915abb468767c9f29d3c
/sources/com/p280ss/android/ugc/aweme/awemeservice/C23137d.java
1c76574a3feda4a849ecb823b033b145ce521b29
[]
no_license
xrealm/tiktok-src
261b1faaf7b39d64bb7cb4106dc1a35963bd6868
90f305b5f981d39cfb313d75ab231326c9fca597
refs/heads/master
2022-11-12T06:43:07.401661
2020-07-04T20:21:12
2020-07-04T20:21:12
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,847
java
package com.p280ss.android.ugc.aweme.awemeservice; import com.bytedance.jedi.model.p599a.C11750c; import com.bytedance.jedi.model.p601c.C11786e; import com.p280ss.android.ugc.aweme.awemeservice.api.IAwemeService; import com.p280ss.android.ugc.aweme.awemeservice.p1047b.C23134a; import com.p280ss.android.ugc.aweme.awemeservice.p1047b.C23135b; import com.p280ss.android.ugc.aweme.feed.model.Aweme; import java.util.List; import kotlin.Pair; import p346io.reactivex.C7492s; /* renamed from: com.ss.android.ugc.aweme.awemeservice.d */ public final class C23137d implements IAwemeService { public final C11750c<String, Aweme> getAwemeCache() { return C23134a.f61064a; } public final void clearCache() { C23133b.m76028a().mo60277b(); } public final C7492s<List<Pair<String, Aweme>>> observeAwemes() { return C23135b.m76054b(); } public final void increaseCommentCount(String str) { C23133b.m76028a().mo60280c(str); } public final C7492s<C11786e<Aweme>> observeAwemeById(String str) { return C23135b.m76052a(str); } public final void setFeedCount(long j) { C23133b.m76028a().mo60274a(j); } public final Aweme getAwemeById(String str) { return C23133b.m76028a().mo60276b(str); } public final Aweme getProfileSelfSeeAweme(String str) { return C23133b.m76028a().mo60272a(str); } public final Aweme getRawAdAwemeByAdId(String str) { return C23114a.m75956a().mo60229b(str); } public final Aweme getRawAdAwemeById(String str) { return C23114a.m75956a().mo60227a(str); } public final Aweme updateAweme(Aweme aweme) { return C23133b.m76028a().mo60270a(aweme); } public final Aweme updateRawAdAweme(Aweme aweme) { return C23114a.m75956a().mo60226a(aweme); } public final void updateCollectStatus(String str, int i) { C23133b.m76028a().mo60282d(str, i); } public final void updateCommentCount(String str, int i) { C23133b.m76028a().mo60278b(str, i); } public final void updateCommentSetting(Aweme aweme, int i) { C23133b.m76028a(); C23133b.m76030b(aweme, i); } public final void updatePreventDownloadType(Aweme aweme, int i) { C23133b.m76028a(); C23133b.m76032c(aweme, i); } public final void updatePublishAwemePromotions(String str, String str2) { C23133b.m76028a().mo60275a(str, str2); } public final void updateUserDigg(String str, int i) { C23133b.m76028a().mo60281c(str, i); } public final Aweme updateProfileSelfSeeAweme(Aweme aweme, int i) { return C23133b.m76028a().mo60271a(aweme, i); } public final Aweme getProfileSelfSeeAweme(String str, int i) { return C23133b.m76028a().mo60273a(str, i); } }
5035469e191e6c4d98e4e14cd64b594b5bdf7ab5
6d95d8c0113aecaa619cddeaa15a65f9ccb95afa
/src/main/java/com/cg/surveyportal/exceptions/QuestionNotFoundException.java
fb7e2713fa715c4da2b23385a35fbdd255a618ad
[]
no_license
Tarunng/SurveyPortal2
81373059f0325c4d78bc8d8173854eeab9a895a6
4a93e62cab9363321fad6d60f54dbcb62cd12821
refs/heads/master
2023-04-08T03:54:54.455303
2021-04-17T15:14:05
2021-04-17T15:14:05
358,492,987
0
0
null
null
null
null
UTF-8
Java
false
false
225
java
package com.cg.surveyportal.exceptions; public class QuestionNotFoundException extends Exception{ public QuestionNotFoundException(){ } public QuestionNotFoundException(String msg){ super(msg); } }
3c69e7da3f0727fec922dea74959688a2613783d
7930564fadb0ea6d01019bb0dcc007abd8dd1cbc
/Game Client/src/com/daybreak/Util/Vector2i.java
298e8efec367ce6a77b6ecce12c736e68f570dc5
[]
no_license
mario10-7/RuneSpire-2D
306acf2e44fcdc1662535810512ffb682b1d5ee8
90114757f41cf61a4317fa2f93d084ab4a206888
refs/heads/master
2021-01-22T19:49:28.545601
2014-09-28T22:21:18
2014-09-28T22:21:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,016
java
package com.daybreak.Util; public class Vector2i { float x; float y; public Vector2i(float x, float y) { set(x, y); } public Vector2i(Vector2i vector) { set(vector.x, vector.y); } public Vector2i() { set(0, 0); } public Vector2i add(Vector2i vector){ this.x += vector.x; this.y += vector.y; return this; } public Vector2i substract(Vector2i vector){ this.x -= vector.x; this.y -= vector.y; return this; } public void set(float x, float y) { this.x = x; this.y = y; } public float getX() { return x; } public float getY() { return y; } public Vector2i setX(float x) { this.x = x; return this; } public Vector2i setY(float y) { this.y = y; return this; } public boolean equals(Object object) { if (!(object instanceof Vector2i)) return false; Vector2i vec = (Vector2i) object; if (vec.getX() == this.getX() && vec.getY() == this.getY()) return true; return false; } }
998e4b744050e107ff8475d7ea8fc7c87e26a192
01ea3be5456935cc76d7e5774a8ba0763fa211bf
/controle-veiculos-usuarios/src/main/java/br/com/zup/orange/controleveiculosusuarios/exception/GlobalExceptionHandler.java
d822b027dd32e33692d7ea1492116133ce941315
[]
no_license
chronosquad/zup-orange-diego-alves
0812c92788d7f343938d4ae6223e829f4fb98c6f
97b0e3b6aba3760912ed19d12c7135916586fea1
refs/heads/main
2023-06-04T12:50:45.803722
2021-06-20T21:40:52
2021-06-20T21:40:52
378,744,510
0
0
null
null
null
null
UTF-8
Java
false
false
1,215
java
package br.com.zup.orange.controleveiculosusuarios.exception; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.context.request.WebRequest; import java.util.Date; @ControllerAdvice public class GlobalExceptionHandler { @ExceptionHandler(ResourseNotFoundException.class) public ResponseEntity<?> handleResourseNotFoundException(ResourseNotFoundException exception, WebRequest request){ ErrorDetails errorDetails = new ErrorDetails(new Date(), exception.getMessage(), request.getDescription(false)); return new ResponseEntity(errorDetails, HttpStatus.NOT_FOUND); } @ExceptionHandler(Exception.class) public ResponseEntity<?> handleGlobalException(Exception exception, WebRequest request){ ErrorDetails errorDetails = new ErrorDetails(new Date(), "Favor verificar os parametros passados!", request.getDescription(false)); return new ResponseEntity(errorDetails, HttpStatus.BAD_REQUEST); } }
c914e622e6a9309a38e40e0ff619436ab7ddf92d
aa7bb8c02fde55184d1cf9eb575b9f2be7d47390
/src/main/java/com/eduardojr/cursomc2/resources/exceptions/ValidationError.java
7af873b09d3f7d2c197a39b9afa355804cd69fed
[]
no_license
eduardomsj/spring-ionic-backend
8923d25c8f62ddc442183b17601064b2ec79e464
9241dcccde12a66ef1df8638f9ff37954751d335
refs/heads/master
2020-03-29T12:10:54.554289
2018-10-20T08:42:41
2018-10-20T08:42:41
149,887,857
0
0
null
null
null
null
UTF-8
Java
false
false
608
java
package com.eduardojr.cursomc2.resources.exceptions; import java.util.ArrayList; import java.util.List; public class ValidationError extends StandardError { private static final long serialVersionUID = 1L; private List<FieldMessage> errors = new ArrayList<>(); public ValidationError(Long timestamp, Integer status, String error, String message, String path) { super(timestamp, status, error, message, path); } public List<FieldMessage> getErrors() { return errors; } public void addError(String fieldName, String message) { errors.add(new FieldMessage(fieldName, message)); } }
9c3a912666c0b68f0b57a32be9fe47ef1da70cf6
61690526f6c3382a6b54652a9437bdcc19b312df
/sources/com/zipow/videobox/view/FavoriteListView.java
57d3fc28dd937a27b516cc7cd069f7f382100f6e
[]
no_license
12security/zoom-android-app
21640097f5e1621c6750d9054386ae5985fcf41f
ad31c673839f9216d18911ec76632813f7b6dbfa
refs/heads/master
2022-04-20T06:42:20.161514
2020-04-19T15:30:46
2020-04-19T15:30:46
257,034,793
1
0
null
null
null
null
UTF-8
Java
false
false
18,893
java
package com.zipow.videobox.view; import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; import android.os.Bundle; import android.os.Parcelable; import android.util.AttributeSet; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.AdapterView.OnItemLongClickListener; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentManager; import com.zipow.videobox.ConfActivity; import com.zipow.videobox.ptapp.FavoriteMgr; import com.zipow.videobox.ptapp.PTApp; import com.zipow.videobox.ptapp.ZoomContact; import com.zipow.videobox.util.ConfLocalHelper; import com.zipow.videobox.view.IMView.StartHangoutFailedDialog; import java.util.ArrayList; import p021us.zoom.androidlib.app.ZMActivity; import p021us.zoom.androidlib.app.ZMDialogFragment; import p021us.zoom.androidlib.util.CompatUtils; import p021us.zoom.androidlib.util.StringUtil; import p021us.zoom.androidlib.widget.QuickSearchListView; import p021us.zoom.androidlib.widget.ZMAlertDialog; import p021us.zoom.androidlib.widget.ZMAlertDialog.Builder; import p021us.zoom.androidlib.widget.ZMMenuAdapter; import p021us.zoom.androidlib.widget.ZMSimpleMenuItem; import p021us.zoom.videomeetings.C4558R; public class FavoriteListView extends QuickSearchListView implements OnItemClickListener, OnItemLongClickListener { private static final String TAG = "FavoriteListView"; private FavoriteListAdapter mAdapter; @Nullable private String mFilter; public static class ContextMenuFragment extends ZMDialogFragment { private static final String ARG_BUDDYITEM = "buddyItem"; public static final int MI_PHONE_CALL = 1; public static final int MI_REMOVE_BUDDY = 2; public static final int MI_VIDEO_CALL = 0; @Nullable private ZMMenuAdapter<ContextMenuItem> mAdapter; public static void show(@Nullable FragmentManager fragmentManager, @NonNull FavoriteItem favoriteItem) { if (fragmentManager != null) { Bundle bundle = new Bundle(); bundle.putSerializable("buddyItem", favoriteItem); ContextMenuFragment contextMenuFragment = new ContextMenuFragment(); contextMenuFragment.setArguments(bundle); contextMenuFragment.show(fragmentManager, ContextMenuFragment.class.getName()); } } public ContextMenuFragment() { setCancelable(true); } public void onStart() { super.onStart(); } @NonNull public Dialog onCreateDialog(Bundle bundle) { if (getArguments() == null) { return createEmptyDialog(); } FavoriteItem favoriteItem = (FavoriteItem) getArguments().getSerializable("buddyItem"); this.mAdapter = createUpdateAdapter(); String screenName = favoriteItem.getScreenName(); if (StringUtil.isEmptyOrNull(screenName)) { screenName = favoriteItem.getEmail(); } ZMAlertDialog create = new Builder(getActivity()).setTitle((CharSequence) screenName).setAdapter(this.mAdapter, new OnClickListener() { public void onClick(DialogInterface dialogInterface, int i) { ContextMenuFragment.this.onSelectItem(i); } }).create(); create.setCanceledOnTouchOutside(true); return create; } private ZMMenuAdapter<ContextMenuItem> createUpdateAdapter() { Bundle arguments = getArguments(); if (arguments == null) { return null; } ContextMenuItem[] contextMenuItemArr = isInCall() ? new ContextMenuItem[]{new ContextMenuItem(0, getText(getConfMenuItemText((FavoriteItem) arguments.getSerializable("buddyItem"))).toString()), new ContextMenuItem(2, getText(C4558R.string.zm_mi_remove_buddy).toString())} : new ContextMenuItem[]{new ContextMenuItem(0, getText(C4558R.string.zm_btn_video_call).toString()), new ContextMenuItem(1, getText(C4558R.string.zm_btn_audio_call).toString()), new ContextMenuItem(2, getText(C4558R.string.zm_mi_remove_buddy).toString())}; ZMMenuAdapter<ContextMenuItem> zMMenuAdapter = this.mAdapter; if (zMMenuAdapter == null) { this.mAdapter = new ZMMenuAdapter<>(getActivity(), false); } else { zMMenuAdapter.clear(); } this.mAdapter.addAll((MenuItemType[]) contextMenuItemArr); return this.mAdapter; } public void refresh() { ZMMenuAdapter createUpdateAdapter = createUpdateAdapter(); if (createUpdateAdapter != null) { createUpdateAdapter.notifyDataSetChanged(); } } private int getConfMenuItemText(@Nullable FavoriteItem favoriteItem) { switch (PTApp.getInstance().getCallStatus()) { case 1: return C4558R.string.zm_mi_return_to_conf; case 2: if (favoriteItem == null || !PTApp.getInstance().probeUserStatus(favoriteItem.getUserID())) { return C4558R.string.zm_mi_invite_to_conf; } return C4558R.string.zm_mi_return_to_conf; default: return C4558R.string.zm_mi_start_conf; } } private boolean isInCall() { switch (PTApp.getInstance().getCallStatus()) { case 1: case 2: return true; default: return false; } } /* access modifiers changed from: private */ public void onSelectItem(int i) { ContextMenuItem contextMenuItem = (ContextMenuItem) this.mAdapter.getItem(i); Bundle arguments = getArguments(); if (arguments != null) { FavoriteItem favoriteItem = (FavoriteItem) arguments.getSerializable("buddyItem"); switch (contextMenuItem.getAction()) { case 0: onSelectVideoCall(favoriteItem); break; case 1: onSelectPhoneCall(favoriteItem); break; case 2: RemoveBuddyConfirmDialog.show(getFragmentManager(), favoriteItem); break; } } } private void onSelectVideoCall(@Nullable FavoriteItem favoriteItem) { switch (PTApp.getInstance().getCallStatus()) { case 1: returnToConf(); return; case 2: if (favoriteItem == null || !PTApp.getInstance().probeUserStatus(favoriteItem.getUserID())) { inviteToConf(favoriteItem); return; } else { returnToConf(); return; } default: startConf(favoriteItem, true); return; } } private void onSelectPhoneCall(@Nullable FavoriteItem favoriteItem) { switch (PTApp.getInstance().getCallStatus()) { case 1: returnToConf(); return; case 2: if (favoriteItem == null || !PTApp.getInstance().probeUserStatus(favoriteItem.getUserID())) { inviteToConf(favoriteItem); return; } else { returnToConf(); return; } default: startConf(favoriteItem, false); return; } } private void startConf(@Nullable FavoriteItem favoriteItem, boolean z) { if (favoriteItem != null) { FragmentActivity activity = getActivity(); if (activity != null) { int inviteToVideoCall = ConfActivity.inviteToVideoCall(activity, favoriteItem.getUserID(), z ? 1 : 0); if (inviteToVideoCall != 0) { StartHangoutFailedDialog.show(((ZMActivity) activity).getSupportFragmentManager(), StartHangoutFailedDialog.class.getName(), inviteToVideoCall); } } } } private void inviteToConf(@Nullable FavoriteItem favoriteItem) { if (favoriteItem != null) { PTApp instance = PTApp.getInstance(); String activeCallId = instance.getActiveCallId(); if (!StringUtil.isEmptyOrNull(activeCallId)) { FragmentActivity activity = getActivity(); if (activity != null) { if (instance.inviteBuddiesToConf(new String[]{favoriteItem.getUserID()}, null, activeCallId, 0, activity.getString(C4558R.string.zm_msg_invitation_message_template)) == 0) { ConfLocalHelper.returnToConf(activity); } } } } } private void returnToConf() { FragmentActivity activity = getActivity(); if (activity != null) { ConfLocalHelper.returnToConf(activity); } } } static class ContextMenuItem extends ZMSimpleMenuItem { public ContextMenuItem(int i, String str) { super(i, str); } } public static class RemoveBuddyConfirmDialog extends ZMDialogFragment { private static final String ARG_BUDDYITEM = "buddyItem"; public RemoveBuddyConfirmDialog() { setCancelable(true); } public static void show(@Nullable FragmentManager fragmentManager, @Nullable FavoriteItem favoriteItem) { if (fragmentManager != null && favoriteItem != null) { Bundle bundle = new Bundle(); bundle.putSerializable("buddyItem", favoriteItem); RemoveBuddyConfirmDialog removeBuddyConfirmDialog = new RemoveBuddyConfirmDialog(); removeBuddyConfirmDialog.setArguments(bundle); removeBuddyConfirmDialog.show(fragmentManager, RemoveBuddyConfirmDialog.class.getName()); } } public void onStart() { super.onStart(); } @NonNull public Dialog onCreateDialog(Bundle bundle) { Bundle arguments = getArguments(); if (arguments == null) { return createEmptyDialog(); } FavoriteItem favoriteItem = (FavoriteItem) arguments.getSerializable("buddyItem"); String screenName = favoriteItem.getScreenName(); if (StringUtil.isEmptyOrNull(screenName)) { screenName = favoriteItem.getEmail(); } return new Builder(getActivity()).setTitle((CharSequence) getString(C4558R.string.zm_msg_remove_favorite_confirm, screenName)).setPositiveButton(C4558R.string.zm_btn_ok, (OnClickListener) new OnClickListener() { public void onClick(DialogInterface dialogInterface, int i) { RemoveBuddyConfirmDialog.this.onClickOK(); } }).setNegativeButton(C4558R.string.zm_btn_cancel, (OnClickListener) new OnClickListener() { public void onClick(@NonNull DialogInterface dialogInterface, int i) { dialogInterface.cancel(); } }).create(); } /* access modifiers changed from: private */ public void onClickOK() { Bundle arguments = getArguments(); if (arguments != null) { FavoriteItem favoriteItem = (FavoriteItem) arguments.getSerializable("buddyItem"); FavoriteMgr favoriteMgr = PTApp.getInstance().getFavoriteMgr(); if (!(favoriteMgr == null || favoriteItem == null)) { favoriteMgr.removeFavorite(favoriteItem.getUserID()); } } } } public FavoriteListView(Context context, AttributeSet attributeSet, int i) { super(context, attributeSet, i); initView(); } public FavoriteListView(Context context, AttributeSet attributeSet) { super(context, attributeSet); initView(); } public FavoriteListView(Context context) { super(context); initView(); } private void initView() { this.mAdapter = new FavoriteListAdapter(getContext()); if (isInEditMode()) { _editmode_loadAllFavoriteItems(this.mAdapter); } else { loadAllFavoriteItems(this.mAdapter); } setAdapter(this.mAdapter); setOnItemClickListener(this); setOnItemLongClickListener(this); } private void _editmode_loadAllFavoriteItems(@NonNull FavoriteListAdapter favoriteListAdapter) { for (int i = 0; i < 20; i++) { ZoomContact zoomContact = new ZoomContact(); zoomContact.setFirstName("Buddy"); zoomContact.setLastName(String.valueOf(i)); zoomContact.setUserID(String.valueOf(i)); favoriteListAdapter.addItem(new FavoriteItem(zoomContact)); } } private void loadAllFavoriteItems(@NonNull FavoriteListAdapter favoriteListAdapter) { FavoriteMgr favoriteMgr = PTApp.getInstance().getFavoriteMgr(); if (favoriteMgr != null) { String str = ""; String str2 = this.mFilter; if (str2 != null && str2.length() > 0) { str = this.mFilter.toLowerCase(CompatUtils.getLocalDefault()); } ArrayList<ZoomContact> arrayList = new ArrayList<>(); favoriteListAdapter.clear(); if (favoriteMgr.getFavoriteListWithFilter(null, arrayList)) { for (ZoomContact favoriteItem : arrayList) { FavoriteItem favoriteItem2 = new FavoriteItem(favoriteItem); String screenName = favoriteItem2.getScreenName(); if (screenName == null) { screenName = ""; } String email = favoriteItem2.getEmail(); if (email == null) { email = ""; } if (str.length() <= 0 || screenName.toLowerCase(CompatUtils.getLocalDefault()).indexOf(str) >= 0 || email.toLowerCase(CompatUtils.getLocalDefault()).indexOf(str) >= 0) { favoriteListAdapter.addItem(favoriteItem2); } } } favoriteListAdapter.sort(false); } } public void addZoomContact(@Nullable ZoomContact zoomContact) { if (zoomContact != null) { String str = this.mFilter; if (str == null || str.length() <= 0) { this.mAdapter.addItem(new FavoriteItem(zoomContact)); this.mAdapter.sort(true); this.mAdapter.notifyDataSetChanged(); } else { reloadFavoriteItems(); } } } public void updateZoomContact(@Nullable ZoomContact zoomContact) { if (zoomContact != null) { String str = this.mFilter; if (str == null || str.length() <= 0) { this.mAdapter.updateItem(new FavoriteItem(zoomContact)); this.mAdapter.sort(true); this.mAdapter.notifyDataSetChanged(); } else { reloadFavoriteItems(); } } } public void updateZoomContact(String str) { FavoriteMgr favoriteMgr = PTApp.getInstance().getFavoriteMgr(); if (favoriteMgr != null) { ZoomContact zoomContact = new ZoomContact(); if (favoriteMgr.getFavoriteByUserID(str, zoomContact)) { updateZoomContact(zoomContact); } else { this.mAdapter.notifyDataSetChanged(); } } } public void reloadFavoriteItems() { this.mAdapter.clear(); loadAllFavoriteItems(this.mAdapter); this.mAdapter.notifyDataSetChanged(); } public void onItemClick(AdapterView<?> adapterView, View view, int i, long j) { Object itemAtPosition = getItemAtPosition(i); if (itemAtPosition instanceof FavoriteItem) { ContextMenuFragment.show(((ZMActivity) getContext()).getSupportFragmentManager(), (FavoriteItem) itemAtPosition); } } public boolean onItemLongClick(AdapterView<?> adapterView, View view, int i, long j) { Object itemAtPosition = getItemAtPosition(i); if (!(itemAtPosition instanceof FavoriteItem)) { return false; } ContextMenuFragment.show(((ZMActivity) getContext()).getSupportFragmentManager(), (FavoriteItem) itemAtPosition); return true; } public void onRestoreInstanceState(Parcelable parcelable) { if (parcelable instanceof Bundle) { Bundle bundle = (Bundle) parcelable; Parcelable parcelable2 = bundle.getParcelable("IMBuddyListView.superState"); this.mFilter = bundle.getString("IMBuddyListView.mFilter"); parcelable = parcelable2; } super.onRestoreInstanceState(parcelable); } public Parcelable onSaveInstanceState() { Parcelable onSaveInstanceState = super.onSaveInstanceState(); Bundle bundle = new Bundle(); bundle.putParcelable("IMBuddyListView.superState", onSaveInstanceState); bundle.putString("IMBuddyListView.mFilter", this.mFilter); return bundle; } public void setFilter(@Nullable String str) { this.mFilter = str; } @Nullable public String getFilter() { return this.mFilter; } public void filter(@Nullable String str) { if (str == null) { str = ""; } this.mFilter = str.trim().toLowerCase(CompatUtils.getLocalDefault()); reloadFavoriteItems(); } public void refreshContextMenu() { ContextMenuFragment contextMenuFragment = (ContextMenuFragment) ((ZMActivity) getContext()).getSupportFragmentManager().findFragmentByTag(ContextMenuFragment.class.getName()); if (contextMenuFragment != null) { contextMenuFragment.refresh(); } } }
[ "" ]
48cdf13dcfd5d700c8c3974c78dd51f7d72a0483
bd6eb465d3937cad8557f9abc34251856297c6c0
/app/build/generated/not_namespaced_r_class_sources/debug/processDebugResources/r/com/google/firebase/database/R.java
32459924300e047fa85b23b0ed25bcc450cd0bf9
[ "MIT" ]
permissive
emakuthi/mainstaffappage
f8c9d018153ccef0689089ba1a955fc192966cbe
396a19d3e8b5f5c32a9a5174617532799516a3fc
refs/heads/master
2020-06-17T02:46:03.820802
2019-07-05T12:12:24
2019-07-05T12:12:24
195,771,126
0
0
null
null
null
null
UTF-8
Java
false
false
16,180
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * gradle plugin from the resource data it found. It * should not be modified by hand. */ package com.google.firebase.database; public final class R { private R() {} public static final class attr { private attr() {} public static final int buttonSize = 0x7f030057; public static final int circleCrop = 0x7f03007c; public static final int colorScheme = 0x7f030097; public static final int font = 0x7f0300df; public static final int fontProviderAuthority = 0x7f0300e1; public static final int fontProviderCerts = 0x7f0300e2; public static final int fontProviderFetchStrategy = 0x7f0300e3; public static final int fontProviderFetchTimeout = 0x7f0300e4; public static final int fontProviderPackage = 0x7f0300e5; public static final int fontProviderQuery = 0x7f0300e6; public static final int fontStyle = 0x7f0300e7; public static final int fontWeight = 0x7f0300e9; public static final int imageAspectRatio = 0x7f030106; public static final int imageAspectRatioAdjust = 0x7f030107; public static final int scopeUris = 0x7f030197; } public static final class bool { private bool() {} public static final int abc_action_bar_embed_tabs = 0x7f040000; } public static final class color { private color() {} public static final int common_google_signin_btn_text_dark = 0x7f05005b; public static final int common_google_signin_btn_text_dark_default = 0x7f05005c; public static final int common_google_signin_btn_text_dark_disabled = 0x7f05005d; public static final int common_google_signin_btn_text_dark_focused = 0x7f05005e; public static final int common_google_signin_btn_text_dark_pressed = 0x7f05005f; public static final int common_google_signin_btn_text_light = 0x7f050060; public static final int common_google_signin_btn_text_light_default = 0x7f050061; public static final int common_google_signin_btn_text_light_disabled = 0x7f050062; public static final int common_google_signin_btn_text_light_focused = 0x7f050063; public static final int common_google_signin_btn_text_light_pressed = 0x7f050064; public static final int common_google_signin_btn_tint = 0x7f050065; public static final int notification_action_color_filter = 0x7f0500a6; public static final int notification_icon_bg_color = 0x7f0500a7; public static final int notification_material_background_media_default_color = 0x7f0500a8; public static final int primary_text_default_material_dark = 0x7f0500ae; public static final int ripple_material_light = 0x7f0500b5; public static final int secondary_text_default_material_dark = 0x7f0500b7; public static final int secondary_text_default_material_light = 0x7f0500b8; } public static final class dimen { private dimen() {} public static final int compat_button_inset_horizontal_material = 0x7f060050; public static final int compat_button_inset_vertical_material = 0x7f060051; public static final int compat_button_padding_horizontal_material = 0x7f060052; public static final int compat_button_padding_vertical_material = 0x7f060053; public static final int compat_control_corner_material = 0x7f060054; public static final int notification_action_icon_size = 0x7f0600c7; public static final int notification_action_text_size = 0x7f0600c8; public static final int notification_big_circle_margin = 0x7f0600c9; public static final int notification_content_margin_start = 0x7f0600ca; public static final int notification_large_icon_height = 0x7f0600cb; public static final int notification_large_icon_width = 0x7f0600cc; public static final int notification_main_column_padding_top = 0x7f0600cd; public static final int notification_media_narrow_margin = 0x7f0600ce; public static final int notification_right_icon_size = 0x7f0600cf; public static final int notification_right_side_padding_top = 0x7f0600d0; public static final int notification_small_icon_background_padding = 0x7f0600d1; public static final int notification_small_icon_size_as_large = 0x7f0600d2; public static final int notification_subtext_size = 0x7f0600d3; public static final int notification_top_pad = 0x7f0600d4; public static final int notification_top_pad_large_text = 0x7f0600d5; } public static final class drawable { private drawable() {} public static final int common_full_open_on_phone = 0x7f070066; public static final int common_google_signin_btn_icon_dark = 0x7f070067; public static final int common_google_signin_btn_icon_dark_focused = 0x7f070068; public static final int common_google_signin_btn_icon_dark_normal = 0x7f070069; public static final int common_google_signin_btn_icon_dark_normal_background = 0x7f07006a; public static final int common_google_signin_btn_icon_disabled = 0x7f07006b; public static final int common_google_signin_btn_icon_light = 0x7f07006c; public static final int common_google_signin_btn_icon_light_focused = 0x7f07006d; public static final int common_google_signin_btn_icon_light_normal = 0x7f07006e; public static final int common_google_signin_btn_icon_light_normal_background = 0x7f07006f; public static final int common_google_signin_btn_text_dark = 0x7f070070; public static final int common_google_signin_btn_text_dark_focused = 0x7f070071; public static final int common_google_signin_btn_text_dark_normal = 0x7f070072; public static final int common_google_signin_btn_text_dark_normal_background = 0x7f070073; public static final int common_google_signin_btn_text_disabled = 0x7f070074; public static final int common_google_signin_btn_text_light = 0x7f070075; public static final int common_google_signin_btn_text_light_focused = 0x7f070076; public static final int common_google_signin_btn_text_light_normal = 0x7f070077; public static final int common_google_signin_btn_text_light_normal_background = 0x7f070078; public static final int googleg_disabled_color_18 = 0x7f070085; public static final int googleg_standard_color_18 = 0x7f070086; public static final int notification_action_background = 0x7f070091; public static final int notification_bg = 0x7f070092; public static final int notification_bg_low = 0x7f070093; public static final int notification_bg_low_normal = 0x7f070094; public static final int notification_bg_low_pressed = 0x7f070095; public static final int notification_bg_normal = 0x7f070096; public static final int notification_bg_normal_pressed = 0x7f070097; public static final int notification_icon_background = 0x7f070098; public static final int notification_template_icon_bg = 0x7f070099; public static final int notification_template_icon_low_bg = 0x7f07009a; public static final int notification_tile_bg = 0x7f07009b; public static final int notify_panel_notification_icon_bg = 0x7f07009c; } public static final class id { private id() {} public static final int action0 = 0x7f080009; public static final int action_container = 0x7f080011; public static final int action_divider = 0x7f080013; public static final int action_image = 0x7f080014; public static final int action_text = 0x7f08001a; public static final int actions = 0x7f08001b; public static final int adjust_height = 0x7f08001f; public static final int adjust_width = 0x7f080020; public static final int async = 0x7f080024; public static final int auto = 0x7f080025; public static final int blocking = 0x7f080029; public static final int cancel_action = 0x7f08002d; public static final int chronometer = 0x7f080035; public static final int dark = 0x7f080047; public static final int end_padder = 0x7f08005b; public static final int forever = 0x7f080069; public static final int icon = 0x7f080070; public static final int icon_group = 0x7f080071; public static final int icon_only = 0x7f080072; public static final int info = 0x7f080075; public static final int italic = 0x7f080077; public static final int light = 0x7f08007d; public static final int line1 = 0x7f08007e; public static final int line3 = 0x7f08007f; public static final int media_actions = 0x7f080084; public static final int none = 0x7f08008f; public static final int normal = 0x7f080090; public static final int notification_background = 0x7f080091; public static final int notification_main_column = 0x7f080092; public static final int notification_main_column_container = 0x7f080093; public static final int right_icon = 0x7f0800a5; public static final int right_side = 0x7f0800a6; public static final int standard = 0x7f0800cf; public static final int status_bar_latest_event_content = 0x7f0800d1; public static final int text = 0x7f0800d9; public static final int text2 = 0x7f0800da; public static final int time = 0x7f0800e5; public static final int title = 0x7f0800e6; public static final int wide = 0x7f0800fd; } public static final class integer { private integer() {} public static final int cancel_button_image_alpha = 0x7f090004; public static final int google_play_services_version = 0x7f090008; public static final int status_bar_notification_info_maxnum = 0x7f09000f; } public static final class layout { private layout() {} public static final int notification_action = 0x7f0b0033; public static final int notification_action_tombstone = 0x7f0b0034; public static final int notification_media_action = 0x7f0b0035; public static final int notification_media_cancel_action = 0x7f0b0036; public static final int notification_template_big_media = 0x7f0b0037; public static final int notification_template_big_media_custom = 0x7f0b0038; public static final int notification_template_big_media_narrow = 0x7f0b0039; public static final int notification_template_big_media_narrow_custom = 0x7f0b003a; public static final int notification_template_custom_big = 0x7f0b003b; public static final int notification_template_icon_group = 0x7f0b003c; public static final int notification_template_lines_media = 0x7f0b003d; public static final int notification_template_media = 0x7f0b003e; public static final int notification_template_media_custom = 0x7f0b003f; public static final int notification_template_part_chronometer = 0x7f0b0040; public static final int notification_template_part_time = 0x7f0b0041; } public static final class string { private string() {} public static final int common_google_play_services_enable_button = 0x7f0e0034; public static final int common_google_play_services_enable_text = 0x7f0e0035; public static final int common_google_play_services_enable_title = 0x7f0e0036; public static final int common_google_play_services_install_button = 0x7f0e0037; public static final int common_google_play_services_install_text = 0x7f0e0038; public static final int common_google_play_services_install_title = 0x7f0e0039; public static final int common_google_play_services_notification_channel_name = 0x7f0e003a; public static final int common_google_play_services_notification_ticker = 0x7f0e003b; public static final int common_google_play_services_unknown_issue = 0x7f0e003c; public static final int common_google_play_services_unsupported_text = 0x7f0e003d; public static final int common_google_play_services_update_button = 0x7f0e003e; public static final int common_google_play_services_update_text = 0x7f0e003f; public static final int common_google_play_services_update_title = 0x7f0e0040; public static final int common_google_play_services_updating_text = 0x7f0e0041; public static final int common_google_play_services_wear_update_text = 0x7f0e0042; public static final int common_open_on_phone = 0x7f0e0043; public static final int common_signin_button_text = 0x7f0e0044; public static final int common_signin_button_text_long = 0x7f0e0045; public static final int status_bar_notification_info_overflow = 0x7f0e006a; } public static final class style { private style() {} public static final int TextAppearance_Compat_Notification = 0x7f0f011f; public static final int TextAppearance_Compat_Notification_Info = 0x7f0f0120; public static final int TextAppearance_Compat_Notification_Info_Media = 0x7f0f0121; public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0f0122; public static final int TextAppearance_Compat_Notification_Line2_Media = 0x7f0f0123; public static final int TextAppearance_Compat_Notification_Media = 0x7f0f0124; public static final int TextAppearance_Compat_Notification_Time = 0x7f0f0125; public static final int TextAppearance_Compat_Notification_Time_Media = 0x7f0f0126; public static final int TextAppearance_Compat_Notification_Title = 0x7f0f0127; public static final int TextAppearance_Compat_Notification_Title_Media = 0x7f0f0128; public static final int Widget_Compat_NotificationActionContainer = 0x7f0f01ce; public static final int Widget_Compat_NotificationActionText = 0x7f0f01cf; } public static final class styleable { private styleable() {} public static final int[] FontFamily = { 0x7f0300e1, 0x7f0300e2, 0x7f0300e3, 0x7f0300e4, 0x7f0300e5, 0x7f0300e6 }; public static final int FontFamily_fontProviderAuthority = 0; public static final int FontFamily_fontProviderCerts = 1; public static final int FontFamily_fontProviderFetchStrategy = 2; public static final int FontFamily_fontProviderFetchTimeout = 3; public static final int FontFamily_fontProviderPackage = 4; public static final int FontFamily_fontProviderQuery = 5; public static final int[] FontFamilyFont = { 0x1010532, 0x1010533, 0x101053f, 0x101056f, 0x1010570, 0x7f0300df, 0x7f0300e7, 0x7f0300e8, 0x7f0300e9, 0x7f03021c }; public static final int FontFamilyFont_android_font = 0; public static final int FontFamilyFont_android_fontWeight = 1; public static final int FontFamilyFont_android_fontStyle = 2; public static final int FontFamilyFont_android_ttcIndex = 3; public static final int FontFamilyFont_android_fontVariationSettings = 4; public static final int FontFamilyFont_font = 5; public static final int FontFamilyFont_fontStyle = 6; public static final int FontFamilyFont_fontVariationSettings = 7; public static final int FontFamilyFont_fontWeight = 8; public static final int FontFamilyFont_ttcIndex = 9; public static final int[] LoadingImageView = { 0x7f03007c, 0x7f030106, 0x7f030107 }; public static final int LoadingImageView_circleCrop = 0; public static final int LoadingImageView_imageAspectRatio = 1; public static final int LoadingImageView_imageAspectRatioAdjust = 2; public static final int[] SignInButton = { 0x7f030057, 0x7f030097, 0x7f030197 }; public static final int SignInButton_buttonSize = 0; public static final int SignInButton_colorScheme = 1; public static final int SignInButton_scopeUris = 2; } }
169dc85db038953aa19988019ed696fe5c9dafd6
1815b3c25be25ff83c23908ee6de610c25e4495b
/fbcore/src/main/java/com/facebook/common/references/ResourceReleaser.java
30db6c5acfdc1f5c07646cb18ff96c9865039406
[ "BSD-3-Clause", "LicenseRef-scancode-unknown" ]
permissive
MaTriXy/fresco
1341447465713469d49adcebce60670bfb18993f
e05b18eafe36c6809b889bfc9ccb66598eabda7b
refs/heads/master
2020-04-05T23:08:37.528037
2017-12-25T13:15:57
2017-12-25T13:15:57
33,048,595
0
0
BSD-3-Clause
2017-12-25T13:15:58
2015-03-28T20:13:29
Java
UTF-8
Java
false
false
1,247
java
/* * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ package com.facebook.common.references; /** * Interface that abstracts the action of releasing a resource. * * <p>There are multiple components that own resources that are shared by others, like pools and * caches. This interface should be implemented by classes that want to perform some action * when a particular resource is no longer needed. * @param <T> type of resource managed by this ResourceReleaser */ public interface ResourceReleaser<T> { /** * <p>Release the given value. * * <p>After calling this method, the caller is no longer responsible for * managing lifetime of the value. * <p>This method is not permitted to throw an exception and is always required to succeed. * It is often called from contexts like catch blocks or finally blocks to cleanup resources. * Throwing an exception could result in swallowing the original exception.</p> * @param value */ void release(T value); }
dd873061eb4fc2b0160850efd6aac03adec3c94e
e8366581d8aa62836f3fdb195198b6e399a89361
/src/skymine/AlgoFSFUIMinerUemax.java
23e2504897213bfc8553934c0d3c7314f693fc84
[]
no_license
pvanh/FSFUI
086a66e4760c0ae7fa9933697f496411d4cfcb13
7913cc01b6eb42434275e68fcf802700451e1a70
refs/heads/master
2020-08-01T02:12:10.260651
2019-09-25T11:06:42
2019-09-25T11:06:42
210,823,676
0
0
null
null
null
null
UTF-8
Java
false
false
22,321
java
package skymine; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileInputStream; import java.io.FileWriter; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; /** * * * This is an implementation of the skyline frequent-utility itemsets mining algorithm using uemax array and rtwu model * * Copyright (c) 2018 Nguyen Manh Hung, Philippe Fournier-Viger * * This file is part of the SPMF DATA MINING SOFTWARE * (http://www.philippe-fournier-viger.com/spmf). * * * SPMF is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any later * version. * * SPMF 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 General Public License for more details. * * * You should have received a copy of the GNU General Public License along with * SPMF. If not, see . * * @author Nguyen Manh Hung, Philippe Fournier-Viger */ public class AlgoFSFUIMinerUemax { double maxMemory = 0; // the maximum memory usage long startTimestamp = 0; // the time the algorithm started long endTimestamp = 0; // the time the algorithm terminated int csfuiCount =0; //the number of PSFUP int sfuiCount =0; // the number of SFUP generated int searchCount =0; //the number of search patterns int numberOfJoins=0;//the number of joining two utility lists Map<Integer, Integer> mapItemToTWU; Map<Integer, Map<Integer, Long>> mapRTWU; BufferedWriter writer = null; // writer to write the output file // this class represent an item and its utility in a transaction class Pair{ int item = 0; int utility = 0; } public AlgoFSFUIMinerUemax() { } public void runAlgorithm(String input, String output) throws IOException { // reset maximum maxMemory =0; startTimestamp = System.currentTimeMillis(); writer = new BufferedWriter(new FileWriter(output)); // We create a map to store the TWU of each item mapItemToTWU = new HashMap<Integer, Integer>(); mapRTWU = new HashMap<Integer, Map<Integer, Long>>(); // We scan the database a first time to calculate the TWU of each item. BufferedReader myInput = null; String thisLine; try { // prepare the object for reading the file myInput = new BufferedReader(new InputStreamReader( new FileInputStream(new File(input)))); // for each line (transaction) until the end of file while ((thisLine = myInput.readLine()) != null) { // if the line is a comment, is empty or is a // kind of metadata if (thisLine.isEmpty() == true || thisLine.charAt(0) == '#' || thisLine.charAt(0) == '%' || thisLine.charAt(0) == '@') { continue; } // split the transaction according to the : separator String split[] = thisLine.split(":"); // the first part is the list of items String items[] = split[0].split(" "); // the second part is the transaction utility int transactionUtility = Integer.parseInt(split[1]); // for each item, we add the transaction utility to its TWU for(int i=0; i <items.length; i++){ // convert item to integer Integer item = Integer.parseInt(items[i]); // get the current TWU of that item Integer twu = mapItemToTWU.get(item); // add the utility of the item in the current transaction to its twu twu = (twu == null)? transactionUtility : twu + transactionUtility; mapItemToTWU.put(item, twu); } } } catch (Exception e) { // catches exception if error while reading the input file e.printStackTrace(); }finally { if(myInput != null){ myInput.close(); } } // CREATE A LIST TO STORE THE EXTENT UTILITY LIST OF ITEMS List<ExtentUtilityList> listOfUtilityLists = new ArrayList<ExtentUtilityList>(); // CREATE A MAP TO STORE THE EXTENT UTILITY LIST FOR EACH ITEM. // Key : item Value : Extent utility list associated to that item Map<Integer, ExtentUtilityList> mapItemToExtUtilityList = new HashMap<Integer, ExtentUtilityList>(); // For each item for(Integer item: mapItemToTWU.keySet()){ // create an empty Extent Utility List that we will fill later. ExtentUtilityList uList = new ExtentUtilityList(item); mapItemToExtUtilityList.put(item, uList); // add the item to the list of high TWU items listOfUtilityLists.add(uList); } // SORT THE LIST OF HIGH TWU ITEMS IN ASCENDING ORDER Collections.sort(listOfUtilityLists, new Comparator<ExtentUtilityList>(){ public int compare(ExtentUtilityList o1, ExtentUtilityList o2) { // compare the TWU of the items return compareItems(o1.item, o2.item); } } ); // SECOND DATABASE PASS TO CONSTRUCT THE EXTENT UTILITY LISTS OF ALL 1-ITEMSETS int tid =0;// A variable to count the number of transaction try { // prepare object for reading the file myInput = new BufferedReader(new InputStreamReader(new FileInputStream(new File(input)))); // for each line (transaction) until the end of file while ((thisLine = myInput.readLine()) != null) { // if the line is a comment, is empty or is a // kind of metadata if (thisLine.isEmpty() == true || thisLine.charAt(0) == '#' || thisLine.charAt(0) == '%' || thisLine.charAt(0) == '@') { continue; } // split the line according to the separator String split[] = thisLine.split(":"); // get the list of items String items[] = split[0].split(" "); // get the list of utility values corresponding to each item // for that transaction String utilityValues[] = split[2].split(" "); // Copy the transaction into lists int remainingUtility =0; // Create a list to store items List<Pair> revisedTransaction = new ArrayList<Pair>(); // for each item for(int i=0; i <items.length; i++){ /// convert values to integers Pair pair = new Pair(); pair.item = Integer.parseInt(items[i]); pair.utility = Integer.parseInt(utilityValues[i]); // add it to variale revisedTransaction revisedTransaction.add(pair); remainingUtility += pair.utility; } Collections.sort(revisedTransaction, new Comparator<Pair>(){ public int compare(Pair o1, Pair o2) { return compareItems(o1.item, o2.item); }}); // for each item left in the transaction //for(Pair pair : revisedTransaction){ for(int i = 0; i< revisedTransaction.size(); i++){ Pair pair = revisedTransaction.get(i); // subtract the utility of this item from the remaining utility remainingUtility = remainingUtility - pair.utility; // get the utility list of this item ExtentUtilityList extUtilityListOfItem = mapItemToExtUtilityList.get(pair.item); // Add a new Element to the utility list of this item corresponding to this transaction ExtentElement element = new ExtentElement(tid, 0, pair.utility, remainingUtility); //Sua lai extUtilityListOfItem.addElementImproved(element); // BEGIN NEW rtwu model Map<Integer, Long> mapRtwuItem = mapRTWU.get(pair.item); if(mapRtwuItem == null) { mapRtwuItem = new HashMap<Integer, Long>(); mapRTWU.put(pair.item, mapRtwuItem); } long UtilFromItem_i=remainingUtility+pair.utility; for(int j = i+1; j< revisedTransaction.size(); j++){ Pair pairAfter = revisedTransaction.get(j); Long rtwuSum = mapRtwuItem.get(pairAfter.item); if(rtwuSum == null) { mapRtwuItem.put(pairAfter.item, UtilFromItem_i); }else { //twuSum + UtilFromItem_i mapRtwuItem.put(pairAfter.item, rtwuSum + UtilFromItem_i); } } // END rtwu model } tid++; // increase tid number for next transaction } } catch (Exception e) { // to catch error while reading the input file e.printStackTrace(); }finally { if(myInput != null){ myInput.close(); } } // check the memory usage checkMemory(); // Mine the database recursively //This array is used to store the max utility value of each frequency,uEmax[0] is meaningless //uEmax[1] stored the max utiliey value of all the itemsets which have frequency equals to 1 int uEmax[]=new int[tid+1]; //The list is used to store the current candidate skyline frequent-utility itemsets (CSFUIs) //csfuiList[1]store the psfup has frequent equals to 1 SkylineList csfuiList[] = new SkylineList[tid+1]; //The list is used to store the current skyline frequent-utility itemsets (SFUIs) List<Skyline> skylineList=new ArrayList<Skyline>(); //test //This method is used to mine all the CSFUIs SFUIMiner(new int[0], null, listOfUtilityLists, csfuiList, skylineList, uEmax); //This method is used to mine all the SFUIs from CSFUIs judgeSkyline(skylineList,csfuiList,uEmax); //This method is used to write out all the CSFUIs writeOut(skylineList); csfuiCount=getcsfuiCount(csfuiList); // check the memory usage again and close the file. checkMemory(); // close output file writer.close(); // record end time endTimestamp = System.currentTimeMillis(); } private int compareItems(int item1, int item2) { int compare = mapItemToTWU.get(item1) - mapItemToTWU.get(item2); // if the same, use the lexical order otherwise use the TWU return (compare == 0)? item1 - item2 : compare; } /** * This is the recursive method to find all candidate skyline frequent-utility itemsets * @param prefix This is the current prefix. Initially, it is empty. * @param pUL This is the Extent Utility List of the prefix. Initially, it is empty. * @param ULs The extent utility lists corresponding to each extension of the prefix. * @param csfuiList Current candidate skyline frequent-utility itemsets.Initially, it is empty. * @param skylineList Current skyline frequent-utility itemsets.Initially, it is empty. * @param uEmax The array of max utility value of each frequency.Initially, it is zero. * @throws IOException */ private void SFUIMiner(int [] prefix, ExtentUtilityList pUL, List<ExtentUtilityList> ULs, SkylineList csfuiList[], List<Skyline> skylineList, int [] uEmax) throws IOException { // For each extension X of prefix P for(int i=0; i< ULs.size(); i++){ ExtentUtilityList X = ULs.get(i); searchCount++; //temp store the frequency of X int temp=X.elements.size(); //judge whether whether X is a PSFUP //if the utility of X equals to the PSFUP which has same frequency with X, insert X to csfuiList // Nếu có Util bằng đúng uEmax thì Them vào danh sách if(X.sumIutils+X.sumItemutils== uEmax[temp]&&uEmax[temp]!=0){ Skyline tempPoint=new Skyline(); tempPoint.itemSet=itemSetString(prefix, X.item); tempPoint.frequent=temp; tempPoint.utility=X.sumIutils+X.sumItemutils; csfuiList[temp].add(tempPoint); } //if the utility of X more than the PSFUP which has same frequency with X, update csfuiList // Nếu có util lớn hơn thì reset danh sách if(X.sumIutils+X.sumItemutils>uEmax[temp]){ uEmax[temp]=X.sumIutils+X.sumItemutils; //if csfuiList[temp] is null, insert X to csfuiList if(csfuiList[temp]==null){ SkylineList tempList= new SkylineList(); Skyline tempPoint=new Skyline(); tempPoint.itemSet=itemSetString(prefix, X.item); tempPoint.frequent=temp; tempPoint.utility=X.sumIutils+X.sumItemutils; tempList.add(tempPoint); csfuiList[temp]=tempList; } //if csfuiList[temp] is not null, update csfuiList[temp] else{ //This is the number of CSFUIs which has same frequency with X. int templength=csfuiList[temp].size(); if(templength==1){ csfuiList[temp].get(0).itemSet=itemSetString(prefix, X.item); csfuiList[temp].get(0).utility=X.sumIutils+X.sumItemutils; } else { for(int j=templength-1;j>0;j--){ csfuiList[temp].remove(j); } csfuiList[temp].get(0).itemSet=itemSetString(prefix, X.item); csfuiList[temp].get(0).utility=X.sumIutils+X.sumItemutils; } } } // If the sum of the remaining utilities for pX // is higher than uEmax[j], we explore extensions of pX. // (this is the pruning condition) // Nếu cùng tần suất mà có thể cho util lơn hơn thì tiếp tục xây dựng Ulist if(X.sumIutils + +X.sumItemutils+ X.sumRutils >= uEmax[temp] && uEmax[temp]!=0){ // This list will contain the utility lists of pX extensions. List<ExtentUtilityList> exULs = new ArrayList<ExtentUtilityList>(); // For each extension of p appearing // after X according to the ascending order for(int j=i+1; j < ULs.size(); j++){ ExtentUtilityList Y = ULs.get(j); int tmp1=Y.elements.size(); // we construct the extension pXY // and add it to the list of extensions of pX // Bo sung kiem tra // =========================== END OF NEW OPTIMIZATION // NEW OPTIMIZATION USED IN MFHM // (min (X.sumIutils,Y.sumIutils)+RTWU(X<Y) // Chú ý phải sửa lại trong UList Map<Integer, Long> mapRTWUF = mapRTWU.get(X.item); Long rtwuF; if(mapRTWUF != null) { rtwuF = mapRTWUF.get(Y.item);// Lay util cua cap long test; if (X.sumIutils<Y.sumIutils ) test=X.sumIutils; else test=Y.sumIutils; if(rtwuF != null) test+=rtwuF; if(rtwuF == null || test < uEmax[temp] || test<uEmax[tmp1]) {// Bo qua Y theo dieu kien EUCS continue; } } // exULs.add(construct(pUL, X, Y)); numberOfJoins++; } // We create new prefix pX int [] newPrefix = new int[prefix.length+1]; System.arraycopy(prefix, 0, newPrefix, 0, prefix.length); newPrefix[prefix.length] = X.item; // We make a recursive call to discover all itemsets with the prefix pXY SFUIMiner(newPrefix, X, exULs, csfuiList, skylineList, uEmax); } } } /** * This method constructs the extent utility list of pXY * @param P : the extent utility list of prefix P. * @param px : the extent utility list of pX * @param py : the extent utility list of pY * @return the extent utility list of pXY */ private ExtentUtilityList construct(ExtentUtilityList P, ExtentUtilityList px, ExtentUtilityList py) { // create an empy utility list for pXY ExtentUtilityList pxyUL = new ExtentUtilityList(py.item); // for each element in the utility list of pX for(ExtentElement ex : px.elements){ // do a binary search to find element ey in py with tid = ex.tid ExtentElement ey = findElementWithTID(py, ex.tid); if(ey == null){ continue; } ExtentElement eXY1 = new ExtentElement(ex.tid, ex.itemSetutils +ex.itemUtils, ey.itemUtils, ey.rutils); // add the new element to the utility list of pXY pxyUL.addElementImproved(eXY1); } // return the utility list of pXY. return pxyUL; } /** * Do a binary search to find the element with a given tid in a utility list * @param ulist the utility list * @param tid the tid * @return the element or null if none has the tid. */ private ExtentElement findElementWithTID(ExtentUtilityList ulist, int tid){ List<ExtentElement> list = ulist.elements; // perform a binary search to check if the subset appears in level k-1. int first = 0; int last = list.size() - 1; // the binary search while( first <= last ) { int middle = ( first + last ) >>> 1; // divide by 2 if(list.get(middle).tid < tid){ first = middle + 1; // the itemset compared is larger than the subset according to the lexical order } else if(list.get(middle).tid > tid){ last = middle - 1; // the itemset compared is smaller than the subset is smaller according to the lexical order } else{ return list.get(middle); } } return null; } /** * Method to write out itemset name * @param prefix This is the current prefix * @param item This is the new item added after the prefix * @return the itemset name */ private String itemSetString(int[] prefix, int item) throws IOException { //Create a string buffer StringBuilder buffer = new StringBuilder(); // append the prefix for (int i = 0; i < prefix.length; i++) { buffer.append(prefix[i]); buffer.append(' '); } // append the last item buffer.append(item); return buffer.toString(); } /** * Method to write skyline frequent-utility itemset to the output file. * @param skylineList The list of skyline frequent-utility itemsets */ private void writeOut(List<Skyline> skylineList) throws IOException { sfuiCount=skylineList.size(); //Create a string buffer StringBuilder buffer = new StringBuilder(); // buffer.append("Total skyline frequent-utility itemset: "); // buffer.append(sfuiCount); // buffer.append(System.lineSeparator()); for(int i=0;i<sfuiCount;i++){ buffer.append(skylineList.get(i).itemSet); buffer.append(" #SUP:"); buffer.append(skylineList.get(i).frequent); buffer.append(" #UTILITY:"); buffer.append(skylineList.get(i).utility); buffer.append(System.lineSeparator()); // write to file } writer.write(buffer.toString()); } /** * Method to judge whether the PSFUP is a SFUP * @param skylineList The skyline frequent-utility itemset list * @param csfuiList The candidate skyline frequent-utility itemset list * @param uEmax The max utility value of each frequency */ private void judgeSkyline(List<Skyline> skylineList, SkylineList csfuiList[], int uEmax[]) { for(int i=1;i<csfuiList.length;i++){ //if temp equals to 0, the value of csfuiList[i] is higher than all the value of csfuiList[j](j>i) int temp=0; //compare csfuiList[i] with csfuiList[j],(j>i) if(csfuiList[i]!=null){ int j=i+1; while(j<csfuiList.length){ if(csfuiList[j]==null){ j++; } else{ if(csfuiList[i].get(0).utility <=csfuiList[j].get(0).utility){ temp=1; break; } else{ j++; } } } //it temp equals to 0, this PSFUP is a SFUP if(temp==0){ for(int k=0;k<csfuiList[i].size();k++) skylineList.add(csfuiList[i].get(k)); } } } } /** * Method to get the count of PSFUP. * @param csfuiList the candidate skyline frequent-utility itemset list * @return the count of CSFUIs */ private int getcsfuiCount(SkylineList csfuiList[]) { for(int i=1;i<csfuiList.length;i++){ if(csfuiList[i]!=null){ csfuiCount=csfuiCount+csfuiList[i].size(); } } return csfuiCount; } /** * Method to check the memory usage and keep the maximum memory usage. */ private void checkMemory() { // get the current memory usage double currentMemory = (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / 1024d / 1024d; // if higher than the maximum until now if (currentMemory > maxMemory) { // replace the maximum with the current memory usage maxMemory = currentMemory; } } /** * Print statistics about the latest execution to System.out. */ public void printStats() { System.out.println("============= uEmax and rtwu skyline ALGORITHM v 2.12 - STATS ============="); System.out.println(" Total time ~ " + (endTimestamp - startTimestamp) + " ms"); System.out.println(" Memory ~ " + maxMemory+ " MB"); System.out.println(" Skyline itemsets count : " + sfuiCount); System.out.println(" The numer of extent utility list: " + searchCount); System.out.println(" The number of join operations two extent utility lists: " + numberOfJoins); System.out.println(" The number of potential SFUIs : " + csfuiCount); System.out.println("==================================================="); } }
8c2cef1d31b95a946feea5a6a29915204753c0ad
f88937f0954d1f4c5f3bd1b298d54e1d326b1c9a
/java/com/baiyi/jj/app/entity/VideoMedieInfo.java
c5b3ea78ce84f475c82866bc439d50a0f032d8ac
[]
no_license
sixdoor123/mx
ff431223d473515f2bf2c24743346deaecec61fd
49fe9a1d0ffa7b00351f44753484d8d624b44635
refs/heads/master
2020-04-23T10:59:55.865339
2019-02-22T00:23:37
2019-02-22T00:23:37
171,121,186
0
0
null
null
null
null
UTF-8
Java
false
false
1,999
java
package com.baiyi.jj.app.entity; import com.baiyi.core.database.AbstractBaseModel; public class VideoMedieInfo extends AbstractBaseModel{ private boolean wifi; private String media_backup_path; private String cover_img_url; private String media_remark; private String media_path; private String media_type; private String media_codec; private int media_width; private int media_height; private double media_duration; public String getMedia_codec() { return media_codec; } public void setMedia_codec(String media_codec) { this.media_codec = media_codec; } public int getMedia_width() { return media_width; } public void setMedia_width(int media_width) { this.media_width = media_width; } public int getMedia_height() { return media_height; } public void setMedia_height(int media_height) { this.media_height = media_height; } public double getMedia_duration() { return media_duration; } public void setMedia_duration(double media_duration) { this.media_duration = media_duration; } public boolean isWifi() { return wifi; } public void setWifi(boolean wifi) { this.wifi = wifi; } public String getMedia_backup_path() { return media_backup_path; } public void setMedia_backup_path(String media_backup_path) { this.media_backup_path = media_backup_path; } public String getCover_img_url() { return cover_img_url; } public void setCover_img_url(String cover_img_url) { this.cover_img_url = cover_img_url; } public String getMedia_remark() { return media_remark; } public void setMedia_remark(String media_remark) { this.media_remark = media_remark; } public String getMedia_path() { return media_path; } public void setMedia_path(String media_path) { this.media_path = media_path; } public String getMedia_type() { return media_type; } public void setMedia_type(String media_type) { this.media_type = media_type; } }
[ "sixdoor123" ]
sixdoor123
a79176b70f7645a958cfdd9afc19c82b7fc38dbb
059a46cb6a2594588521d7e8138c7c528abe5ad1
/src/me/Cutiemango/MangoQuest/model/QuestSetting.java
58c2caf6b1d1eb5a4fb910d9d12e9d8f94259879
[]
no_license
murayuki/MangoQuest
965c77dd7c7da571985a55c6b9433765b46984db
c836ded50c275f9be8ac6b111e0b2d1ac1ffffd7
refs/heads/master
2023-03-01T18:16:51.537109
2021-02-07T09:43:25
2021-02-07T09:43:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,916
java
package me.Cutiemango.MangoQuest.model; import me.Cutiemango.MangoQuest.I18n; import org.bukkit.World; public class QuestSetting { // Visibility private boolean displayOnTake = true; private boolean displayOnProgress = true; private boolean displayOnFinish = true; private boolean displayOnInteraction = true; // FailMessage protected String failRequirementMessage = I18n.locMsg("Requirements.NotMeet.Default"); // Redo & Quit // protected boolean isRedoable = false; protected boolean isQuitable = true; protected String quitAcceptMsg = I18n.locMsg("QuestQuitMsg.DefaultQuit"); protected String quitCancelMsg = I18n.locMsg("QuestQuitMsg.DefaultCancel"); protected String quitDenyMsg = I18n.locMsg("QuestQuitMsg.Denied"); protected RedoSetting redoSetting = RedoSetting.ONCE_ONLY; protected long redoDelay = 0L; protected int resetDay = 1; protected int resetHour = 0; // Limitations protected boolean isTimeLimited = false; protected long timeLimit = 60000L; protected boolean usePermission = false; protected World worldLimit = null; public boolean displayOnTake() { return displayOnTake; } public boolean displayOnProgress() { return displayOnProgress; } public boolean displayOnFinish() { return displayOnFinish; } public boolean displayOnInteraction() { return displayOnInteraction; } public void toggle(boolean b1, boolean b2, boolean b3, boolean b4) { displayOnTake = b1; displayOnProgress = b2; displayOnFinish = b3; displayOnInteraction = b4; } public enum RedoSetting { DAILY(I18n.locMsg("QuestEditor.RedoSetting.Daily")), WEEKLY(I18n.locMsg("QuestEditor.RedoSetting.Weekly")), COOLDOWN(I18n.locMsg("QuestEditor.RedoSetting.Cooldown")), ONCE_ONLY(I18n.locMsg("QuestEditor.RedoSetting.OnceOnly")); RedoSetting(String s) { name = s; } private String name; public String getName() { return name; } } }
441cbac14eb9a29888d547d0c9f58bed2a1b778d
1229b2af20daa786234a5b2e9e8e8c44faf1b408
/src/com/yhy/race/Imperial.java
cc87c994db633aff48574b1ea2b83cc9fb83d3bf
[]
no_license
July24/AutoChess
c23abc7b3bd42b0e29b1d639f5455e4f31aecf5e
7d4ab2673400665494f85cf009e8be2769ace41a
refs/heads/master
2020-09-22T15:53:13.456686
2019-12-02T08:47:01
2019-12-02T08:47:01
225,265,129
0
0
null
null
null
null
GB18030
Java
false
false
266
java
package com.yhy.race; /** * 帝王 种族 * 诺克萨斯之手Darius、荣耀行刑官Draven、不祥之刃Katarina * 诺克萨斯统领Swain * 随机一名帝王攻击翻倍(2) * 所有帝王攻击翻倍(2) */ public interface Imperial extends Race{ }
0a350d9771d7ee58f84f4575c9d918da9bade6bc
3667d01c408d393d71a383801010662f2eb12883
/src/java/com/healthDepartment/location/tableClasses/ZoneNewBean.java
0aa63477b27ddd6e466a5d1c570b9fef23f677ff
[]
no_license
Vikrant-Stack/IPMS
54121ffce54f0741c3e3b8ded7f8b1282f01603e
3b890d4a915616c5c9c843bc956773ac876a0071
refs/heads/master
2021-05-17T11:16:36.735413
2020-03-28T08:47:56
2020-03-28T08:47:56
250,751,863
0
0
null
null
null
null
UTF-8
Java
false
false
1,876
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.healthDepartment.location.tableClasses; /** * * @author Administrator */ public class ZoneNewBean { private int zoneId,CityId,revision_no; private String zoneName,zoneDescription,cityName,language_type,zone_no,active; public int getRevision_no() { return revision_no; } public void setRevision_no(int revision_no) { this.revision_no = revision_no; } public String getActive() { return active; } public void setActive(String active) { this.active = active; } public int getCityId() { return CityId; } public void setCityId(int CityId) { this.CityId = CityId; } public String getZone_no() { return zone_no; } public void setZone_no(String zone_no) { this.zone_no = zone_no; } public String getCityName() { return cityName; } public void setCityName(String cityName) { this.cityName = cityName; } public String getLanguage_type() { return language_type; } public void setLanguage_type(String language_type) { this.language_type = language_type; } public int getZoneId() { return zoneId; } public void setZoneId(int zoneId) { this.zoneId = zoneId; } public String getZoneName() { return zoneName; } public void setZoneName(String zoneName) { this.zoneName = zoneName; } public String getZoneDescription() { return zoneDescription; } public void setZoneDescription(String zoneDescription) { this.zoneDescription = zoneDescription; } }
[ "saini@INS-Vikrant" ]
saini@INS-Vikrant
5504f8eb92bf132a2d6cbaf88e7ed4a39b47d8fc
6a00974ab34892d58a8a2fee40722affbb8086de
/src/filter/ValidateFilter.java
692165cbd349c4d9c3252597693e84c4d955109b
[]
no_license
yushulinfeng/QianXun_Server
fffa68ae5c3e0d8915a87d03c72f2ac3c20c2844
831243c4a8a2b8b8a38fe28f2e63ffd3ffe7c122
refs/heads/master
2021-01-20T08:06:47.858427
2017-06-21T00:17:00
2017-06-21T00:17:00
90,019,146
0
0
null
null
null
null
UTF-8
Java
false
false
2,478
java
package filter; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import util.TimeUtil; import util.ValidateUtil; import config.BasicInfoConfig; //@WebFilter(filterName = "validateFilter", urlPatterns = { "*.action", "*.action?*" }) public class ValidateFilter implements Filter { @Override public void destroy() { } @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; HttpServletResponse resp = (HttpServletResponse) response; resp.addHeader("Access-Control-Allow-Origin", "*"); try { System.out.println("CharacterEncoding:" + req.getCharacterEncoding()); System.out.println("RequestURI:" + req.getRequestURI()); System.out.println("QueryString:" + req.getQueryString()); System.out.println("ServletPath:" + req.getServletPath()); String timestamp = req.getParameter("timestamp"); String signature = req.getParameter("signature"); System.out.println("timestamp:" + timestamp); System.out.println("signature:" + signature); if (req.getServletPath().equals("/util_getTimestamp.action")) { PrintWriter pw = resp.getWriter(); pw.write(TimeUtil.currentTime()); pw.flush(); pw.close(); return;//TODO } // action过滤器 if (timestamp != null && signature != null) { long ts = Long.parseLong(timestamp); long cur = System.currentTimeMillis(); // 在5分钟之内 if (Math.abs(cur - ts) <= 5 * 60 * 1000) { String md5 = ValidateUtil.MD5(timestamp + BasicInfoConfig.secretKey); md5 = ValidateUtil.MD5(md5);// 加两次md5 System.out.println("md5 success:" + md5.equals(signature)); if (md5.equals(signature)) { chain.doFilter(request, response); } else { ((HttpServletResponse) response).sendRedirect("/index.jsp"); } } } } catch (Exception e) { e.printStackTrace(); ((HttpServletResponse) response).sendRedirect("/index.jsp"); System.out.println("Verify failed.");// 验证失败 } } @Override public void init(FilterConfig arg0) throws ServletException { } }
315782c66725a348630a4850d37416b66f6b1824
896fabf7f0f4a754ad11f816a853f31b4e776927
/opera-mini-handler-dex2jar.jar/com/opera/mini/android/notifications/o.java
5629a85040cf786da026199e3f232d35f56a0075
[]
no_license
messarju/operamin-decompile
f7b803daf80620ec476b354d6aaabddb509bc6da
418f008602f0d0988cf7ebe2ac1741333ba3df83
refs/heads/main
2023-07-04T04:48:46.770740
2021-08-09T12:13:17
2021-08-09T12:04:45
394,273,979
0
0
null
null
null
null
UTF-8
Java
false
false
2,322
java
// // Decompiled by Procyon v0.6-prerelease // package com.opera.mini.android.notifications; import com.opera.mini.android.Browser; import android.content.Context; import android.app.NotificationManager; import android.content.SharedPreferences$Editor; import com.opera.mini.android.x; import com.opera.mini.android.events.EventDispatcher; import android.content.SharedPreferences; public abstract class o { private String B; private byte C; private int Code; protected String I; protected g J; protected SharedPreferences Z; public o(final g j, final SharedPreferences z, final String i, final int code, final String b, final byte c) { this.Code = code; this.J = j; this.Z = z; this.I = i; this.B = b; this.C = c; EventDispatcher.Z(new p(this, (byte)0)); } public final byte B() { return this.C; } public final String C() { return this.I; } protected abstract long Code(); protected final void Code(final boolean b) { x.Code(this.Z.edit().putBoolean(this.I + ":enabled", b)); } protected void I() { new StringBuilder("SystemNotification.send(): ").append(this.I); final Context i = this.J.I(); ((NotificationManager)i.getSystemService("notification")).notify(this.I.hashCode(), q.Code(i, "com.opera.mini.android.ACTION_NOTIFICATION:" + this.I, i.getResources().getString(2130968583), i.getResources().getString(this.Code))); x.Code(this.Z.edit().putInt(this.I + ":PENDING_IMPRESSIONS", this.c() + 1)); if (x.s()) { this.J.C().Code(this.I, this.J.c()); } } public final void a() { x.Code(this.Z.edit().putInt(this.I + ":PENDING_CLICKS", this.d() + 1)); if (x.s()) { this.J.C().I(this.I, this.J.c()); } Browser.Z.Code(this.B); } protected final boolean b() { return this.Z.getBoolean(this.I + ":enabled", false); } public final int c() { return this.Z.getInt(this.I + ":PENDING_IMPRESSIONS", 0); } public final int d() { return this.Z.getInt(this.I + ":PENDING_CLICKS", 0); } public final boolean e() { return this.c() + this.d() > 0; } }
5f4eb8d3f05b18c430a660c75cbe3b6bc75ccf26
74e7e0b83a3393c60b1733f95b7d8008f4b6e395
/src/main/java/es/ucm/fdi/tp/chess/ChessState.java
c23ef2fd863e8dbf0d8cc4c14bdd68bd2f189552
[]
no_license
darroyos/Board-SmartGames
f3e0fdfb78e73ee511d882ed35a6268a3f3ba914
5154c2f311d2915a7d8a756c962088722eca6f3f
refs/heads/master
2021-03-24T12:23:15.793046
2017-06-03T08:13:46
2017-06-03T08:13:46
91,890,026
0
0
null
null
null
null
UTF-8
Java
false
false
15,425
java
package es.ucm.fdi.tp.chess; import es.ucm.fdi.tp.base.model.GameState; import java.awt.*; import java.util.ArrayList; import java.util.List; import java.util.logging.Logger; import static es.ucm.fdi.tp.chess.ChessAction.Special; import static es.ucm.fdi.tp.chess.ChessBoard.*; /** * A chess state. Implements all rules except for move-repetition and * overly protracted endgames. * * @author mfreire */ public class ChessState extends GameState<ChessState, ChessAction> { private static final Logger log = Logger.getLogger(ChessState.class.getName()); private final int turn; private boolean finished; private int winner; private final ChessBoard board; private final int canCastle[]; // {white, black}, 0=no, 1=short, 2=long, 3=both private final int enPassant; // -1 if none, column of pawn that advanced twice otherwise private final boolean inCheck; public static final int WHITE = 0; public static final int BLACK = 1; protected static final int CASTLE_SHORT = 1; protected static final int CASTLE_LONG = 2; protected static final int CASTLE_DONE = 4; protected ArrayList<ChessAction> valid; /** * Creates an empty chess board; */ public ChessState() { super(2); turn = WHITE; winner = -1; finished = false; board = new ChessBoard(); canCastle = new int[]{ CASTLE_SHORT | CASTLE_LONG, CASTLE_SHORT | CASTLE_LONG}; enPassant = -1; inCheck = false; valid = null; updateValid(); } /** * Creates a chess board with a given position * @param previous board (used mostly to look at turn) * @param board to use * @param canCastle representing the state of castling; canCastle[WHITE] is * 0 if not allowed, * 1 if only short castling still possible, * 2 if only long castling still possible * 3 if both types of castling are still possible * @param enPassant with column where enemy pawn just finished a double-advance * @param inCheck if king is currently in check */ public ChessState(ChessState previous, ChessBoard board, int[] canCastle, int enPassant, boolean inCheck) { super(2); this.board = board; this.turn = otherPlayer(previous.turn); this.canCastle = canCastle; this.enPassant = enPassant; this.inCheck = inCheck; valid = null; updateValid(); if (valid.isEmpty()) { finished = true; if (inCheck) { winner = previous.turn; } } else { finished = false; winner = -1; } } /** * @param player * @return opposite player */ public static int otherPlayer(int player) { return player == BLACK ? WHITE : BLACK; } public boolean isValid(ChessAction action) { return valid.contains(action); } /** * @param board to search in * @param turn of king to search for * @param kingPos to write position into * @return true if found, false if not */ protected static boolean findKing(ChessBoard board, int turn, Point kingPos) { for (int i = 0; i < DIM; i++) { for (int j = 0; j < DIM; j++) { byte p = board.get(i, j); if (sameTurn(p, turn) && Piece.valueOf(p) == Piece.King) { kingPos.setLocation(j, i); return true; } } } return false; } /** * Generates valid moves for current player. * This can only be called once per state * (as states are immutable, and results get cached). */ private void updateValid() { if (valid != null) { return; } int otherTurn = otherPlayer(turn); valid = new ArrayList<>(); ArrayList<ChessAction> candidates = new ArrayList<>(); // generate for (int i = 0; i < DIM; i++) { for (int j = 0; j < DIM; j++) { byte p = board.get(i, j); if (sameTurn(p, turn)) { generateActions(p, turn, i, j, candidates); } } } // filter out those that expose king, add checks Point myKing = new Point(); Point kingPos = new Point(); Point otherKing = new Point(); if ( ! findKing(board, turn, myKing)) { throw new IllegalStateException("king for " + turn + " not found: \n" + board); } if ( ! findKing(board, otherTurn, otherKing)) { throw new IllegalStateException("king for " + otherTurn + " not found: \n" + board); } for (ChessAction a : candidates) { ChessBoard next = new ChessBoard(board); a.applyTo(next); if (myKing.y == a.getSrcRow() && myKing.x == a.getSrcCol()) { kingPos.setLocation(a.getDstCol(), a.getDstRow()); } else { kingPos.setLocation(myKing); } if ( ! threatenedBy(next, otherTurn, kingPos.y, kingPos.x)) { a.setCheck(threatenedBy(next, turn, otherKing.y, otherKing.x)); valid.add(a); } } } /** * Returns a list of valid actions for the current player. * @param playerNumber * to generate actions for * @return */ public List<ChessAction> validActions(int playerNumber) { return valid; } /** * Returns the piece (see ChessBoard) at the given position. * @param row * @param col * @return piece at the given position. Note that * chess piece codes are NOT player codes (there are many piece types). * See ChessBoard to make sense of the returned int: * ChessBoard.black(p) and ChessBoard.white(p) will tell you piece-color * ChessBoard.Piece.valueOf(p) will tell you piece-type. */ public int at(int row, int col) { return board.get(row, col); } public int getTurn() { return turn; } @Override public double evaluate(int turn) { if (finished) { return turn == winner ? 1 : -1; } /* * static evaluation of positions in chess is a huge topic; * feel free to improve on this heuristic. */ // the greater the piece-value advantage, the better double score = 0; for (int i = 0; i < DIM; i++) { for (int j = 0; j < DIM; j++) { byte p = board.get(i, j); if (!ChessBoard.empty(p)) { score += .01 * Piece.valueOf(p) .getValue(!sameTurn(p, turn)); } } } // the more possible moves, the better ("board control") score += .0005 * valid.size(); // castling, or having the option to do so, is good score += canCastle[turn] == 0 ? 0 : (canCastle[turn] == CASTLE_DONE ? .001 : .0005); return score; } public boolean isFinished() { return finished; } public int getWinner() { return winner; } /** * @return a copy of the board */ public ChessBoard getBoard() { return new ChessBoard(board); } public String toString() { return board.toString() + ("whiteCastle: " + canCastle[0] + " ") + ("blackCastle: " + canCastle[1] + " ") + (enPassant != -1 ? "passant" + enPassant + " " : "") + (turn == WHITE ? "; white" : "black") + " to play\n"; } protected void addPawnAction(int turn, int row, int col, int dstRow, int dstCol, int queenRow, ArrayList<ChessAction> as) { if (row != queenRow) { as.add(new ChessAction(turn, row, col, dstRow, dstCol)); } else { for (Special s : ChessAction.QUEENING_SPECIALS) { as.add(new ChessAction(turn, row, col, dstRow, dstCol, s)); } } } protected void pawnActions(byte p, int turn, int row, int col, ArrayList<ChessAction> as, int dy, int queenRow, int doubleRow, int passantRow) { // advance? if (empty(board.get(row + dy, col))) { addPawnAction(turn, row, col, row + dy, col, queenRow, as); if (row == doubleRow && empty(board.get(row + dy + dy, col))) { as.add(new ChessAction(turn, row, col, row + dy + dy, col)); } } // capture? if (enemy(p, board.get(row + dy, col + 1))) { addPawnAction(turn, row, col, row + dy, col + 1, queenRow, as); } if (enemy(p, board.get(row + dy, col - 1))) { addPawnAction(turn, row, col, row + dy, col - 1, queenRow, as); } // en-passant capture? if (row == passantRow && enPassant != -1) { if (enPassant == col + 1) { as.add(new ChessAction(turn, row, col, row + dy, col + 1, Special.EnPassant)); } else if (enPassant == col - 1) { as.add(new ChessAction(turn, row, col, row + dy, col - 1, Special.EnPassant)); } } } protected void castlingActions(byte p, int turn, int row, int col, ArrayList<ChessAction> as, int kingRow) { int other = turn == BLACK ? WHITE : BLACK; // not in inCheck, empty&non-threatened king transit, empty rook-transit if (!inCheck) { if ((canCastle[turn] & CASTLE_SHORT) != 0 && empty(board.get(kingRow, 5)) && !threatenedBy(board, other, kingRow, 5) && empty(board.get(kingRow, 6)) && !threatenedBy(board, other, kingRow, 6)) { as.add(new ChessAction(turn, row, col, kingRow, 6, Special.ShortCastle)); } if ((canCastle[turn] & CASTLE_LONG) != 0 && empty(board.get(kingRow, 1)) && empty(board.get(kingRow, 2)) && !threatenedBy(board, other, kingRow, 2) && empty(board.get(kingRow, 3)) && !threatenedBy(board, other, kingRow, 3)) { as.add(new ChessAction(turn, row, col, kingRow, 2, Special.LongCastle)); } } } protected static boolean pawnCanCapture(byte p, int srcRow, int srcCol, int dstRow, int dstCol, int dy) { return srcRow + dy == dstRow && ((srcCol == dstCol + 1) || (srcCol == dstCol - 1)); } /** * Used to generate non-pawn actions. Simply looks for empty-or-enemy squares * along a given direction, given by row and column deltas. If 'multiple' is se to true, * continues looking until non-empty square found (useful for rook, bishop, queen) */ protected void deltaActions(byte p, int turn, int row, int col, int dy, int dx, ArrayList<ChessAction> as, boolean multiple) { int dRow = row, dCol = col; byte target; do { dRow += dy; dCol += dx; target = board.get(dRow, dCol); if (empty(target) || enemy(p, target)) { as.add(new ChessAction(turn, row, col, dRow, dCol)); } } while (multiple && empty(target)); } protected static boolean canDeltaCapture(ChessBoard b, byte p, int row, int col, int dy, int dx, int dstRow, int dstCol, boolean multiple) { int dRow = row, dCol = col; do { dRow += dy; dCol += dx; if (dRow == dstRow && dCol == dstCol) return true; } while (multiple && empty(b.get(dRow, dCol))); return false; } protected void generateActions(byte p, int turn, int row, int col, ArrayList<ChessAction> as) { Piece piece = Piece.valueOf(p); if (piece == Piece.Pawn) { if (ChessBoard.black(p)) { pawnActions(p, turn, row, col, as, 1, 6, 1, 4); } else { pawnActions(p, turn, row, col, as, -1, 1, 6, 3); } } else if (piece.getDeltas() != null) { for (int[] d : piece.getDeltas()) { deltaActions(p, turn, row, col, d[0], d[1], as, piece.hasLinearMotion()); } if (piece == Piece.King) { if (ChessBoard.black(p)) { castlingActions(p, turn, row, col, as, 0); } else { castlingActions(p, turn, row, col, as, 7); } } } } /** * @param b board to check in * @param turn of player that threatens * @param row of victim * @param col of victim * @return true if there is at least 1 piece of turn that can capture the victim */ protected static boolean threatenedBy(ChessBoard b, int turn, int row, int col) { for (int i = 0; i < DIM; i++) { for (int j = 0; j < DIM; j++) { byte p = b.get(i, j); if (sameTurn(p, turn) && canCapture(b, p, i, j, row, col)) { log.fine("" + row +", "+col+" : by " + i+","+j + " " + Piece.valueOf(p)); return true; } } } return false; } protected static boolean canCapture(ChessBoard b, byte p, int row, int col, int dstRow, int dstCol) { Piece piece = Piece.valueOf(p); if (piece == Piece.Pawn) { return pawnCanCapture(p, row, col, dstRow, dstCol, ChessBoard.black(p) ? 1 : -1); } else if (piece.getDeltas() != null) { for (int[] d : piece.getDeltas()) { if (canDeltaCapture(b, p, row, col, d[0], d[1], dstRow, dstCol, piece.hasLinearMotion())) { return true; } } } return false; } protected int[] canCastle() { return canCastle.clone(); } /** * @return true if the current player is in check */ public boolean isInCheck() { return inCheck; } public int getDimension() { return DIM; } @Override public String getGameDescription() { return "Chess"; } }
658bc61b33ffe6a56df43d79776f9fbce35fb1d5
6d8edd15e381ad481267600a19eff46e6bf813c4
/src/br/com/bytebank/banco/testeutil/TesteArrayLinkedList.java
c7fcaba386c3c0408bcfb2060466269038dcf3e2
[]
no_license
felipeqa/bank-java
319279a877a061f845ecf795207dac3139efbda4
e60689208abfeea5b4a9f263f607affcd47d68e4
refs/heads/master
2020-03-25T08:49:06.418546
2018-09-12T01:21:36
2018-09-12T01:21:36
143,633,164
0
0
null
null
null
null
UTF-8
Java
false
false
1,324
java
package br.com.bytebank.banco.testeutil; import br.com.bytebank.banco.modelo.Conta; import br.com.bytebank.banco.modelo.ContaCorrente; import br.com.bytebank.banco.modelo.ContaPoupanca; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; public class TesteArrayLinkedList { public static void main(String[] args) { //Generics <> List<Conta> lista = new LinkedList<Conta>(); Conta conta1 = new ContaPoupanca(1212, 3636379); Conta conta2 = new ContaCorrente(4545,369852); lista.add(conta1); lista.add(conta2); System.out.println("Quantidade de Objetos atualmente " + lista.size()); Conta ref = lista.get(0); System.out.println(ref.getNumeroConta()); lista.remove(0); Conta conta3 = new ContaPoupanca(0001, 999999); Conta conta4 = new ContaCorrente(5000,321321); lista.add(conta3); lista.add(conta4); System.out.println("Quantidade de Objetos atualmente " + lista.size()); for (int i = 0; i < lista.size(); i++ ){ Object referencia = lista.get(i); System.out.println(referencia); } System.out.println("----------------"); for(Conta conta : lista){ System.out.println(conta); } } }
f7978949586d88a37fc086fd2a0bb4d5a31f43a4
58e1bb13538baf25300670e20819613ef927a176
/IdeaWorkSpace/cmfzapp/src/main/java/com/baizhi/service/BannerService.java
055165ecf973823f9fe77110709e6c868c6ec89a
[]
no_license
LetsGoTomCat/bianbolei
db8ab0ca4d23fb73add1b49bc77629d2cc5b5094
3a756e40645e347075f7b7d95a56b3e689f98ca6
refs/heads/master
2022-06-23T14:12:50.588180
2019-05-31T06:03:32
2019-05-31T06:03:32
189,533,212
0
0
null
2022-06-21T01:12:24
2019-05-31T05:31:05
JavaScript
UTF-8
Java
false
false
380
java
package com.baizhi.service; import com.baizhi.entity.Banner; import java.util.List; import java.util.Map; public interface BannerService { public Map<String, Object> queryAll(Integer page, Integer rows); public void insert(Banner banner); public void update(String path, String id); public void delete(List ids); public void updateall(Banner banner); }
161978e8416d73c80fbd0ef0f92fa0a1b3dac683
6275f55dcb3e2e8739160bc2bb72c44d18045f2e
/services/wfm/src/test/java/org/openkilda/wfm/topology/TestFlowGenMetricsBolt.java
38cba9352501f78102d2e5ed5d3b165b6612ef73
[ "Apache-2.0" ]
permissive
nikitamarchenko/open-kilda
bbf3f21ae39ac68c6596bc8906fce60caa64f407
4eb61169126d5a346086dc019ab60b672eea5d77
refs/heads/master
2018-11-11T11:27:03.101085
2018-04-06T14:56:30
2018-04-06T14:57:04
106,708,130
0
1
Apache-2.0
2018-08-22T12:44:57
2017-10-12T15:04:45
Java
UTF-8
Java
false
false
981
java
package org.openkilda.wfm.topology; import org.openkilda.wfm.topology.stats.metrics.FlowMetricGenBolt; import java.util.HashMap; import java.util.Map; public class TestFlowGenMetricsBolt extends FlowMetricGenBolt{ private long cookie; private String flowId; private String srcSw; private String dstSw; private String direction; public TestFlowGenMetricsBolt(long cookie, String flowId, String srcSw, String dstSw) { this.cookie = cookie; this.flowId = flowId; this.srcSw = srcSw; this.dstSw = dstSw; } @Override protected Map getFlowWithCookie(Long cookie) { Map<String, Object> result = new HashMap<>(); result.put("cookie", cookie); result.put("flowid", flowId); result.put("src_switch", srcSw); result.put("dst_switch", dstSw); Map<String, Object> cypherResult = new HashMap<>(); cypherResult.put("r", result); return cypherResult; } }
3f0c5bb1702b875a937e9a259cc5bd0c356e5103
7a944c9e1f3b3a5b87484c48a9b6c2ac3e217f31
/src/main/java/ru/harionovsky/bunstore/controllers/OrderController.java
293f060802a5d19715cc8f19f8d2810157936893
[]
no_license
Harionovsky/BunStore
39e965b3470e71d928918ccccaaf0627beac3681
3ff697dbc7e244db06d9fc62ee6bd01c6a2081ab
refs/heads/master
2021-03-27T18:59:28.329639
2017-11-01T15:00:30
2017-11-01T15:00:30
108,410,955
0
0
null
null
null
null
UTF-8
Java
false
false
7,980
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 ru.harionovsky.bunstore.controllers; import java.util.ArrayList; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; import ru.harionovsky.bunstore.models.*; import ru.harionovsky.bunstore.utils.Basket; /** * * @author Harionovsky */ @Controller @RequestMapping("/order") public class OrderController extends BaseController { @RequestMapping public ModelAndView order() { ModelAndView mvOrder = new ModelAndView("order"); List<Orders> listOrder = dbBS.Order.where("IsDone is null", "ID desc"); List<String[]> listO = new ArrayList<>(listOrder.size()); List<Reserve> listReserve; StringBuilder strBuilder; Ware elemWare; for (Orders itemO : listOrder) { String[] arrItem = new String[5]; arrItem[0] = "" + itemO.getId(); arrItem[1] = itemO.getFio(); arrItem[2] = itemO.getPhone(); arrItem[3] = itemO.getAddress(); listReserve = dbBS.Reserve.where("OrderID = " + itemO.getId()); strBuilder = new StringBuilder(listReserve.size()); for (Reserve itemR : listReserve) { elemWare = dbBS.Ware.find(itemR.getWareid()); if (elemWare != null) { if (strBuilder.length() > 0) strBuilder.append("; "); strBuilder.append("(").append(elemWare.getCode()).append(") ").append(elemWare.getName()). append(" = ").append(itemR.getQuantity()).append(" шт."); } } arrItem[4] = strBuilder.toString(); listO.add(arrItem); } mvOrder.addObject("listO", listO); return mvOrder; } @RequestMapping(value = "/add", method = RequestMethod.POST) public ModelAndView orderAdd(String[] Ware, String[] Count, HttpServletRequest objRequest, HttpServletResponse objResponse) { String sCookie = ""; int iWareID, iQuant; if (Ware.length == Count.length) { StringBuilder strBuilder = new StringBuilder(Ware.length); for (int i = 0; i < Ware.length; i++) { iQuant = Integer.parseInt(Count[i]); iWareID = Integer.parseInt(Ware[i]); Ware elemWare = dbBS.Ware.find(iWareID); if (elemWare != null && iQuant > 0) { Warehouse elemWH = dbBS.Warehouse.first("WareID = " + iWareID); if ((elemWH == null) || (elemWH.getQuantity() < iQuant)) { ModelAndView mvImpossible = new ModelAndView("impossible"); mvImpossible.addObject("message", "Извините, на складе нет товара \"" + elemWare.getName() + "\" в достаточном количестве"); return mvImpossible; } else { if (strBuilder.length() > 0) strBuilder.append(Basket.SEPARATOR); strBuilder.append(Ware[i]).append("=").append(Count[i]); } } } sCookie = strBuilder.toString(); } if (sCookie.isEmpty()) { ModelAndView mvImpossible = new ModelAndView("impossible"); mvImpossible.addObject("message", "Корзина пуста"); return mvImpossible; } Basket objBasket = new Basket(objRequest, objResponse); objBasket.save(sCookie); return new ModelAndView("orderedit"); } @RequestMapping(value = "/save", method = RequestMethod.POST) public ModelAndView orderInsert(String FIO, String Phone, String Address, HttpServletRequest objRequest, HttpServletResponse objResponse) { Basket objBasket = new Basket(objRequest, objResponse); String[] arrBasket = objBasket.all(); int[] arrWare = new int[arrBasket.length]; int[] arrQuant = new int[arrBasket.length]; Ware elemWare; Warehouse elemWH; Reserve elemReserve; String[] arrLine; int iWareID, iQuant; boolean bIsEmpty = true; // Проверяем количество и списываем его со склада for (int i = 0; i < arrBasket.length; i++) { arrLine = arrBasket[i].split("="); iWareID = Integer.parseInt(arrLine[0]); iQuant = Integer.parseInt(arrLine[1]); elemWare = dbBS.Ware.find(iWareID); if (elemWare != null && iQuant > 0) { elemWH = dbBS.Warehouse.first("WareID = " + iWareID); if ((elemWH != null) && (elemWH.getQuantity() >= iQuant)) { elemWH.setQuantity(elemWH.getQuantity() - iQuant); dbBS.Warehouse.update(elemWH); arrWare[i] = iWareID; arrQuant[i] = iQuant; bIsEmpty = false; } else { arrWare[i] = 0; arrQuant[i] = 0; } } } // Создаём заявку и заносим количество в резерв if (bIsEmpty == false) { Orders elemOrder = new Orders(FIO, Phone, Address); int iOrderID = dbBS.Order.insert(elemOrder); for (int i = 0; i < arrWare.length; i++) { elemReserve = new Reserve(); elemReserve.setOrderid(iOrderID); elemReserve.setWareid(arrWare[i]); elemReserve.setQuantity(arrQuant[i]); dbBS.Reserve.insert(elemReserve); } } // Очищаем корзину objBasket.save(""); return new ModelAndView("redirect:/order/thanks"); } @RequestMapping("/cancel") public ModelAndView orderCancel(int id) { Orders elemOrder = dbBS.Order.find(id); if (elemOrder != null) { List<Reserve> listReserve = dbBS.Reserve.where("OrderID = " + elemOrder.getId()); for (Reserve itemR : listReserve) { Warehouse elemWH = dbBS.Warehouse.first("WareID = " + itemR.getWareid()); if (elemWH == null) { elemWH = new Warehouse(itemR.getWareid(), itemR.getQuantity()); dbBS.Warehouse.insert(elemWH); } else { elemWH.setQuantity(elemWH.getQuantity() + itemR.getQuantity()); dbBS.Warehouse.update(elemWH); } dbBS.Reserve.delete(itemR); } dbBS.Order.delete(elemOrder); } return new ModelAndView("redirect:/order"); } @RequestMapping("/done") public ModelAndView orderDone(int id) { Orders elemOrder = dbBS.Order.find(id); if (elemOrder != null) { elemOrder.setIsdone(true); dbBS.Order.update(elemOrder); } return new ModelAndView("redirect:/order"); } @RequestMapping("/thanks") public ModelAndView thanks() { return new ModelAndView("thanks"); } }
[ "" ]
26412b41dff3552cfb4b0cc5392514fe73f46a6c
2957ec7edc8102f4926af685c04ae9ae0a8b092b
/Eclipse_Projects/Wzorce_Projektowe/src/pl/wiktorjasica/builder/ZestawKomputerowy.java
d288a8e6191542decb05d0b6480c15d7d0de8ec8
[]
no_license
WiktorJasica/Java_Learning_Programs
4b6465a0384779458c7fb3e66fde7a2f2042e9aa
5069f88d89084438b078246bc47ef550b60381ea
refs/heads/master
2020-06-30T18:45:44.114228
2019-08-15T13:24:23
2019-08-15T13:24:23
200,915,177
0
0
null
null
null
null
UTF-8
Java
false
false
639
java
package pl.wiktorjasica.builder; public class ZestawKomputerowy { private String monitor; private String HDD; private String kartaGraficzna; private String procesor; public void setMonitor(String monitor) { this.monitor = monitor; } public void setHDD(String hDD) { HDD = hDD; } public void setKartaGraficzna(String kartaGraficzna) { this.kartaGraficzna = kartaGraficzna; } public void setProcesor(String procesor) { this.procesor = procesor; } public String show() { return "ZestawKomputerowy: monitor=" + monitor + ", HDD=" + HDD + ", kartaGraficzna=" + kartaGraficzna + ", procesor=" + procesor; } }
9bfb7c04272c5bec5b604fe04a890efbf545bccb
49ecb0daf855576adb7dbc1066b843045b54893b
/Pertemuan 10/Minggu10/modif/ModifQueueMain.java
0e2c098238642d618a4fafe726ae8c3b29b9b894
[]
no_license
zulfanakbar/Algoritma-dan-Struktur-Data
7a9e16f5e13b7390d3a8c2663f18a4dff3c0394d
b6cce639ad6711492211a02e6a1e14d491c71581
refs/heads/master
2020-12-29T11:33:03.248101
2020-05-14T04:35:56
2020-05-14T04:35:56
238,592,475
0
0
null
null
null
null
UTF-8
Java
false
false
1,604
java
package modif; import java.util.Scanner; public class ModifQueueMain { public static void menu() { System.out.println("\nMasukkan operasi yang diinginkan"); System.out.println("1. Enqueue"); System.out.println("2. Dequeue"); System.out.println("3. Print"); System.out.println("4. Peek"); System.out.println("5. Peek Rear"); System.out.println("----------------------"); } public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.print("Masukkan jumlah maksimal antrian : "); int n = sc.nextInt(); ModifQueue Q = new ModifQueue(n); int pilih; do { menu(); pilih = sc.nextInt(); switch (pilih) { case 1: System.out.print("Masukkan data baru : "); int dataMasuk = sc.nextInt(); Q.Enqueue(dataMasuk); break; case 2: int dataKeluar = Q.Dequeue(); if (dataKeluar != 0) { System.out.println("Data yang dikeluarkan: " + dataKeluar); } break; case 3: Q.print(); break; case 4: Q.peek(); break; case 5: Q.peekRear(); break; } } while (pilih > 0 || pilih < 5); } }
6869e5f4bfa7b486c6c41c7d1474df724eb136bc
d7db4edca6ca5400ca79069bafc59434ba3a54a0
/src/cn/itcast/servletcontext/ServletContextDemo1.java
0d4c28c034e3802a44d0bf70346bd9c6198d1f65
[]
no_license
freetomyself/check_login_download
8a013aebafa208175fb9b367b3942ef70a6961a4
a17ead72d8e063f643d4c36062e1ad82b9fc23d7
refs/heads/master
2020-06-04T12:22:53.712680
2019-06-25T11:27:18
2019-06-25T11:27:18
192,019,617
0
0
null
null
null
null
UTF-8
Java
false
false
1,092
java
package cn.itcast.servletcontext; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; /** * @program: day15_response--${PACKAGE_NAME} * @author: WaHotDog 2019-05-24 11:43 **/ @WebServlet( "/servletContextDemo1") public class ServletContextDemo1 extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { /*ServletContext对象获取*/ ServletContext context1 = request.getServletContext(); ServletContext context2 = this.getServletContext(); System.out.println(context1); System.out.println(context2); System.out.println(context1==context2); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { this.doPost(request,response); } }
0b3d688831111e8be4bf55f158a2ccd0be813a1e
44550f4e2b5f9e5d9249c830b6c71f53893b97ba
/src/com/spymaze/levelbuilder/level/Level.java
bbd17597cfe68fff0286e92e734bf69243f419fd
[]
no_license
Bradsta/Spy-Maze-Level-Builder
f94fbdc5fa4ce7955126977c94abc57c095285cf
808a28f21983d2cea1f9a72917b6190eebb9891f
refs/heads/master
2021-05-02T12:18:24.954229
2016-09-29T05:53:52
2016-09-29T05:53:52
46,160,967
0
0
null
null
null
null
UTF-8
Java
false
false
7,660
java
package com.spymaze.levelbuilder.level; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.util.ArrayList; import com.spymaze.levelbuilder.sprite.CharacterSprite; import com.spymaze.levelbuilder.sprite.Direction; import com.spymaze.levelbuilder.sprite.LoadedTileSprite; import com.spymaze.levelbuilder.sprite.Sprite; import com.spymaze.levelbuilder.sprite.TileSprite; import com.spymaze.levelbuilder.utility.Utility; public class Level { public TileSprite[][] tileSprites; public ArrayList<CharacterSprite> charSprites = new ArrayList<CharacterSprite>(); public int xMax; public int yMax; private int tilesWidth; private int tilesHeight; public Level(TileSprite[][] tileSprites, ArrayList<CharacterSprite> charSprites, int xMax, int yMax) { this.tileSprites = tileSprites; this.charSprites = charSprites; this.xMax = xMax; this.yMax = yMax; tilesWidth = Utility.nextEven((float) xMax / 64.0F); tilesHeight = Utility.nextEven((float) yMax / 64.0F); } /** * Returns an instance of a Level that is encoded into a file. * * @param loc * @return */ public static Level loadLevel(File loc, int xMax, int yMax) { try { TileSprite[][] ts = null; ArrayList<CharacterSprite> cs = new ArrayList<CharacterSprite>(); FileReader fStream = new FileReader(loc); BufferedReader br = new BufferedReader(fStream); String nextLine = null; while ((nextLine = br.readLine()) != null) { String dec = Utility.encryptString(nextLine, '1'); if (dec.contains("Dimensions")) { ts = new TileSprite[Integer.parseInt(dec.replace("Dimensions:", "").split(" ")[0])] [Integer.parseInt(dec.replace("Dimensions:", "").split(" ")[1])]; } else if (dec.contains("tile")) { TileSprite used = null; if (dec.contains("\\tile.png")) used = TileSprite.TILE; else if (dec.contains("\\unreachabletile.png")) used = TileSprite.UNREACHABLE; else if (dec.contains("\\developmentTile.png")) used = TileSprite.DEV_TILE; else if (dec.contains("\\starttile.png")) { used = TileSprite.START_TILE; } else { used = TileSprite.END_TILE; } ts[Integer.parseInt(Utility.parse("x:", " ", dec))][Integer.parseInt(Utility.parse("y:", " ", dec))] = used; } else if (dec.contains("char")) { File spriteLoc = Sprite.ENEMY.f; Direction dir = null; String directionParsed = Utility.parse("dir:", " ", dec); for (Direction d : Direction.values()) { if (d.toString().equals(directionParsed)) { dir = d; break; } } cs.add(new CharacterSprite(spriteLoc, dir, Integer.parseInt(Utility.parse("x:", " ", dec)), Integer.parseInt(Utility.parse("y:", " ", dec)), 0, 0)); } } br.close(); return new Level(ts, cs, xMax, yMax); } catch (Exception e) { e.printStackTrace(); } return null; } /** * Returns the tiles that should be drawn on the screen currently to avoid any need to draw the entire map. * <p> * Does not loop through all tiles on the map, but rather the tiles that should be loaded for more efficiency. * <p> * * @param guy The main guy. * @param lastLoaded The last loaded tile sprites. * @param deltaX The change of the guy since we last loaded the tiles on the x-axis. (-1 <= deltaX <= 1) * @param deltaY The change of the guy since we last loaded the tiles on the y-axis. (-1 <= deltaY <= 1) * @param xMax The width of the view. * @param yMax The height of the view. * @return The loaded two dimensional tile sprite array. */ public ArrayList<LoadedTileSprite> getLoadedTiles(CharacterSprite guy, ArrayList<LoadedTileSprite> lastLoaded, int deltaX, int deltaY) { //Offsets +-1 to draw 1 tile off screen int loadedTilesStartX = ((guy.xLoc-(tilesWidth/2)-1) < 0) ? 0 : (guy.xLoc-(tilesWidth/2)-1); int loadedTilesEndX = (this.tileSprites.length < (guy.xLoc+(tilesWidth/2)+1)) ? this.tileSprites.length : (guy.xLoc+(tilesWidth/2)+1); int loadedTilesStartY = ((guy.yLoc-(tilesHeight/2)-1) < 0) ? 0 : (guy.yLoc-(tilesHeight/2)-1); int loadedTilesEndY = (this.tileSprites[0].length < (guy.yLoc+(tilesHeight/2)+1)) ? this.tileSprites[0].length : (guy.yLoc+(tilesHeight/2)+1); ArrayList<LoadedTileSprite> lts = (lastLoaded == null) ? new ArrayList<LoadedTileSprite>() : lastLoaded; int add = 0; int remove = 0; if (lts.size() == 0) { for (int x=loadedTilesStartX; x < loadedTilesEndX; x++) { for (int y=loadedTilesStartY; y < loadedTilesEndY; y++) { lts.add(new LoadedTileSprite(this.tileSprites[x][y].f, x - (guy.xLoc-(tilesWidth/2)), y - (guy.yLoc-(tilesHeight/2)))); } } } else if (deltaX != 0) { add = (deltaX == 1) ? guy.xLoc+(tilesWidth/2) : guy.xLoc-(tilesWidth/2)-1; remove = (deltaX == 1) ? -1 : tilesWidth; for (int index=0; index < lts.size(); index++) { if (lts.get(index).xLoc == remove) { lts.remove(index); index--; continue; } lts.get(index).xLoc -= deltaX; } if (add >= 0 && add < this.tileSprites.length) { for (int y=loadedTilesStartY; y < loadedTilesEndY; y++) { lts.add(new LoadedTileSprite(this.tileSprites[add][y].f, add - (guy.xLoc-(tilesWidth/2)), y - (guy.yLoc-(tilesHeight/2)))); } } } else if (deltaY != 0) { add = (deltaY == 1) ? guy.yLoc+(tilesHeight/2) : guy.yLoc-(tilesHeight/2)-1; remove = (deltaY == 1) ? -1 : tilesHeight; for (int index=0; index < lts.size(); index++) { if (lts.get(index).yLoc == remove) { lts.remove(index); index--; continue; } lts.get(index).yLoc -= deltaY; } if (add >= 0 && add < this.tileSprites[0].length) { for (int x=loadedTilesStartX; x < loadedTilesEndX; x++) { lts.add(new LoadedTileSprite(this.tileSprites[x][add].f, x - (guy.xLoc-(tilesWidth/2)), add - (guy.yLoc-(tilesHeight/2)))); } } } return lts; } /** * Returns the enemies that should be drawn on the screen currently to avoid any need of drawing all of them. * <p> * * @param guy * @param character * @return */ public CharacterSprite getLoadedChar(CharacterSprite guy, CharacterSprite character) { if ((character.xLoc >= (guy.xLoc-(tilesWidth/2)-1) && character.xLoc <= (guy.xLoc+(tilesWidth/2)+1)) && (character.yLoc >= (guy.yLoc-(tilesHeight/2)-1) && character.yLoc <= (guy.yLoc+(tilesHeight/2)+1))) { if (character.loadedCharSprite == null) { character.loadedCharSprite = character.clone(); } else { //Not creating a new instance, but just updating current values. character.loadedCharSprite.xOffset = character.xOffset; character.loadedCharSprite.yOffset = character.yOffset; character.loadedCharSprite.i = character.i; } character.loadedCharSprite.xLoc = character.xLoc - (guy.xLoc-(tilesWidth/2)); character.loadedCharSprite.yLoc = character.yLoc - (guy.yLoc-(tilesHeight/2)); } else { character.loadedCharSprite = null; } return character.loadedCharSprite; } /** * Returns where the guy is supposed to be painted. * <p> * * @param guy The main guy. * @param xMax The width of the view. * @param yMax The height of the view * @return Where the guy is supposed to be painted at in the loaded tile sprite 2D array. */ public CharacterSprite getLoadedGuy(CharacterSprite guy) { CharacterSprite loadedGuy = new CharacterSprite(guy.f, guy.direction, tilesWidth/2, tilesHeight/2, guy.xOffset, guy.yOffset); loadedGuy.i = guy.i; return loadedGuy; } }
1464a0f9a65c35cfad6986837ab67d5fad3f73ce
baa6c4e790e515fd4424aaf2709b8dc402b706d9
/src/display/DisplayManager.java
d329d283a955e5f943396653e3fb47fc3fd3b222
[]
no_license
sachavincent/gameEngine
eb2bb8ccdfa506ce665e0db43e57eae641fc089f
a649938f226411cf35d729fc24c9af4d449ec1c4
refs/heads/master
2023-08-17T19:24:21.146924
2021-09-21T11:09:38
2021-09-21T11:09:38
213,746,717
0
0
null
null
null
null
UTF-8
Java
false
false
2,406
java
package display; import java.io.PrintStream; import util.math.Maths; public class DisplayManager { public static int FRAMERATE_LIMIT = 300, CURRENT_FPS = FRAMERATE_LIMIT, TPS = 20; public static double MSPT; private static double FRAMERATE_LIMIT_NS = 1000000000 / (double) FRAMERATE_LIMIT; public static PrintStream outStream; public static PrintStream errStream; public static final int MIN_FRAMERATE = 30; public static final int MAX_FRAMERATE = 300; public static final String FRAMERATE_INFINITE = "Inf."; public static final boolean IS_DEBUG = java.lang.management.ManagementFactory. getRuntimeMXBean(). getInputArguments().toString().indexOf("jdwp") >= 0; private static void setWindow() { // GLFWImage image = GLFWImage.malloc(); // ByteBuffer buf = null; // GLFWImage.Buffer images = null; // try { // PNGDecoder dec = new PNGDecoder(new FileInputStream(RES_PATH + "/insula_preview.png")); // int width = dec.getWidth(); // int height = dec.getHeight(); // buf = BufferUtils.createByteBuffer(width * height * 4); // dec.decode(buf, width * 4, PNGDecoder.Format.RGBA); // buf.flip(); // image.set(width, height, buf); // images = GLFWImage.malloc(1); // images.put(0, image); // // glfwSetWindowIcon(window, images); // } catch (IOException e) { // e.printStackTrace(); // } finally { // if (buf != null) // buf.clear(); // if (images != null) // images.free(); // image.free(); // } } public static void setCurrentFps(int fps) { Display.limitFramerate = fps < Integer.MAX_VALUE; FRAMERATE_LIMIT = fps; FRAMERATE_LIMIT_NS = 1000000000 / (double) fps; } public static void setFPS(String fps) { if (fps.equalsIgnoreCase(FRAMERATE_INFINITE)) setCurrentFps(Integer.MAX_VALUE); else { try { int fpsValue = Integer.parseInt(fps); setCurrentFps(Maths.clamp(fpsValue, MIN_FRAMERATE, MAX_FRAMERATE)); } catch (NumberFormatException e) { } } } public static double getFramerateLimitNS() { return FRAMERATE_LIMIT_NS; } }
057550b296ddc716c16dafb983bc2e3c8d996bda
f4a04325ebdcb0cd20d067592d3ad672e517ac3a
/state3/Talk/ChatOperations.java
e9e43b820e1971b718c897bbde565deca2a6b172
[ "MIT" ]
permissive
emeric254/corba-m2-stri
2ce4800faed62bb009750bd58a75fb1bf58d14ff
3e49617101134e75f9ce7bae800d6a4cb1770ebd
refs/heads/master
2021-01-13T07:57:32.496714
2016-12-13T21:30:19
2016-12-13T21:30:19
71,998,084
0
0
null
null
null
null
UTF-8
Java
false
false
338
java
package Talk; /** * Talk/ChatOperations.java . * Generated by the IDL-to-Java compiler (portable), version "3.2" * from Contract.idl * vendredi 4 novembre 2016 15 h 14 CET */ public interface ChatOperations { void inscription (Talk.Step1 s) throws Talk.genericError; void diffusion (Talk.Message m); } // interface ChatOperations
3a4c63cb670bbcd488117925ff1b4eeef5184cc1
277538012ee7d9dd51c9301af9d51765ece6bfb0
/src/com/virus17/designpattern/observer/Product.java
012c19f202621384de82baf9d6dc089b663614ec
[]
no_license
virus17/JDP
41f50c28c317456170d644e7f2fa703124442048
27f73ab2867deebcb8b2a47628348a3fc79445d6
refs/heads/master
2021-01-20T06:43:30.429603
2015-03-31T18:00:52
2015-03-31T18:00:52
29,926,949
0
0
null
null
null
null
UTF-8
Java
false
false
1,213
java
package com.virus17.designpattern.observer; import java.util.ArrayList; import java.util.List; public class Product implements Subject { //Variable to keep Observers list List<Observer> observersList = new ArrayList<Observer>(); //Product Specific Variables String productName; String availability; public Product(final String productName, final String availability) { this.productName = productName; this.availability = availability; } public String getProductName() { return productName; } public void setProductName(final String productName) { this.productName = productName; } public String getAvailability() { return availability; } /** * Whenever availability will change, notify the observers * @param availability */ public void setAvailability(final String availability) { this.availability = availability; notifyObservers(); } @Override public void registerObserver(final Observer observer) { observersList.add(observer); } @Override public void removeObserver(final Observer observer) { observersList.remove(observer); } @Override public void notifyObservers() { for(Observer ob : observersList) { ob.update(availability); } } }
7fbca21c6e856235fb7d166f8af240aec5db6a71
7d7f10f676bedaf2cd83afb7d85d41b4f215d79e
/revise these/epi/quickSort.java
60cbee02de819157370f42ca1bd065d0866e62ba
[]
no_license
ManojKumarPatnaik/cs-170
069507f5a6e66487d7ba1c2e13a6de584a66de6a
31755c87561696533644ff032a0d4fa3cec514cb
refs/heads/master
2021-12-22T03:47:53.264896
2017-03-10T02:48:16
2017-03-10T02:48:16
371,672,587
1
0
null
null
null
null
UTF-8
Java
false
false
1,510
java
import java.util.Arrays; /* * Modification of quicksort that reduces the number of recursive call by * performing insertion sort whenever the subarray size < 10 */ public class QuickSortEfficient { public static void main(String[] args){ int[] test = {8, 3, 0, -1, 2, 8, -1, 7, 1, 0, 8}; quickSortEff(test); System.out.println(Arrays.toString(test)); } public static void quickSortEff(int[] test){ quickSortEff(test, 0, test.length - 1); } private static void quickSortEff(int[] test, int low, int high){ if (high <= low) return; if (high <= low + 10) insertionSort(test, low, high); int pivotIndex = partition(test, low, high); quickSortEff(test, low, pivotIndex - 1); quickSortEff(test, pivotIndex + 1, high); } private static int partition(int[] test, int low, int high){ int pivotElement = test[low]; int i = low + 1; int j = high; while (true){ while(test[i] < pivotElement){ i++; if (i == high) break; } while(test[j] >= pivotElement){ j--; if (j == low) break; } if (i >= j) break; int temp = test[i]; test[i] = test[j]; test[j] = temp; } int temp2 = test[j]; test[j] = test[low]; test[low] = temp2; return j; } private static void insertionSort(int[] a, int low, int high){ for (int i = low; i < high; i++){ int j = i + 1; while (j > low && a[j] < a[j - 1]){ int temp = a[j]; a[j] = a[j - 1]; a[j - 1] = temp; j--; } } } }
90985be3117b754e556ca845430fa1ac29bb3f45
e36cd1a1ed2b64212e76b03f958ec22eef8cf026
/src/thread/shareData/AddRunnable.java
6d7cdb99801f1fcea5317f38189328d7399b2b46
[ "Apache-2.0" ]
permissive
JDawnF/learning
89e9e9679ab81fdd5617501863661ceea93820cc
f441127813c7172120b7f25cd7a5a30dbec589e5
refs/heads/master
2021-06-16T07:42:52.993673
2021-03-03T15:17:41
2021-03-03T15:17:41
167,142,271
0
0
null
null
null
null
UTF-8
Java
false
false
261
java
package thread.shareData; /** * @program: learning * @author: baichen **/ public class AddRunnable implements Runnable { MyData data; public AddRunnable(MyData data){ this.data=data; } public void run() { data.add(); } }
9154d347ac823c41b7d6f2b449ff4af1565ac24e
0244630d93990e607bd2366a57ef7f66a7a01b15
/src/main/java/fr/aven/bot/commands/modo/TempMuteThread.java
ade55b52c71e30e703572abdd14346c3ec93827e
[]
no_license
lucastldn/AvenBot
a73437cdd5a2f88855d5636daed53ca7a09afeb3
e591aefe52786807f5e3585446c2776cffa45e71
refs/heads/master
2023-08-28T21:58:05.067004
2021-09-21T06:23:47
2021-09-21T06:23:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
160
java
package fr.aven.bot.commands.modo; import java.util.TimerTask; public class TempMuteThread extends TimerTask { @Override public void run() { } }
7ceb92dacf9cb8d85adc4ebaf72af4045b741cca
1105eed0dfd8caaf29a3c479d2b910c9738eed1d
/ren-automation-tests/src/test/java/com/exigen/ren/modules/policy/gb_dn/master/TestAddNetworkArrangement.java
0c16d35e4b8c94c882dde9268e3128a523f1a42d
[]
no_license
NandiniDR29/123
3123d04b44f2b6c74b6c5c3c1c9c271a8028e520
22138c8dd8267270aca05d67a7ae8cec791abb81
refs/heads/master
2022-12-09T15:01:34.815286
2020-09-22T05:26:56
2020-09-22T05:26:56
297,538,529
0
0
null
null
null
null
UTF-8
Java
false
false
5,379
java
package com.exigen.ren.modules.policy.gb_dn.master; import com.exigen.istf.data.TestData; import com.exigen.istf.utils.TestInfo; import com.exigen.ren.common.enums.NavigationEnum; import com.exigen.ren.common.pages.NavigationPage; import com.exigen.ren.main.modules.caseprofile.CaseProfileContext; import com.exigen.ren.main.modules.customer.CustomerContext; import com.exigen.ren.main.modules.policy.gb_dn.masterpolicy.GroupDentalMasterPolicyContext; import com.exigen.ren.main.modules.policy.gb_dn.masterpolicy.metadata.PlanDefinitionTabMetaData; import com.exigen.ren.modules.BaseTest; import com.google.common.collect.ImmutableList; import org.testng.annotations.Test; import static com.exigen.istf.verification.CustomSoftAssertions.assertSoftly; import static com.exigen.ren.main.enums.PolicyConstants.PlanDental.ALACARTE; import static com.exigen.ren.main.enums.PolicyConstants.PlanDental.ASO; import static com.exigen.ren.main.enums.ValueConstants.VALUE_NO; import static com.exigen.ren.main.enums.ValueConstants.VALUE_YES; import static com.exigen.ren.main.modules.policy.gb_dn.masterpolicy.metadata.PlanDefinitionTabMetaData.CO_INSURANCE; import static com.exigen.ren.main.modules.policy.gb_dn.masterpolicy.metadata.PlanDefinitionTabMetaData.CoInsuranceMetaData.NETWORK_ARRANGEMENT; import static com.exigen.ren.main.modules.policy.gb_dn.masterpolicy.metadata.PlanDefinitionTabMetaData.CoInsuranceMetaData.UC_PERCENTILE_LEVEL; import static com.exigen.ren.main.modules.policy.gb_dn.masterpolicy.metadata.PlanDefinitionTabMetaData.PPO_EPO_PLAN; import static com.exigen.ren.main.modules.policy.gb_dn.masterpolicy.metadata.PolicyInformationTabMetaData.ASO_PLAN; import static com.exigen.ren.main.modules.policy.gb_dn.masterpolicy.metadata.PolicyInformationTabMetaData.SITUS_STATE; import static com.exigen.ren.utils.components.Components.POLICY_GROUPBENEFITS; import static com.exigen.ren.utils.groups.Groups.*; public class TestAddNetworkArrangement extends BaseTest implements CustomerContext, CaseProfileContext, GroupDentalMasterPolicyContext { @Test(groups = {GB, GB_PRECONFIGURED, GB_DN, WITHOUT_TS, REGRESSION}) @TestInfo(testCaseId = {"REN-21560", "REN-22484", "REN-22486"}, component = POLICY_GROUPBENEFITS) public void testAddNetworkArrangement() { mainApp().open(); createDefaultNonIndividualCustomer(); createDefaultCaseProfile(groupDentalMasterPolicy.getType()); groupDentalMasterPolicy.initiate(getDefaultDNMasterPolicyData()); LOGGER.info("REN-21560 step 01 setting Situs State"); groupDentalMasterPolicy.getDefaultWorkspace().fillUpTo(getDefaultDNMasterPolicyData() .adjust(TestData.makeKeyPath(policyInformationTab.getClass().getSimpleName(), SITUS_STATE.getLabel()), "NV"), planDefinitionTab.getClass()); assertSoftly(softly -> { LOGGER.info("REN-21560 step 2 and step 3"); planDefinitionTab.getAssetList().getAsset(PlanDefinitionTabMetaData.PLAN).setValue(ImmutableList.of(ALACARTE)); LOGGER.info("REN-21560 step 4"); softly.assertThat(planDefinitionTab.getAssetList().getAsset(CO_INSURANCE).getAsset(NETWORK_ARRANGEMENT)).isPresent().isDisabled(); LOGGER.info("REN-21560 step 6 and REN-22486 step 1 and step 2"); softly.assertThat(planDefinitionTab.getAssetList().getAsset(PPO_EPO_PLAN)).isPresent().isEnabled().hasValue(VALUE_NO); planDefinitionTab.getAssetList().getAsset(PlanDefinitionTabMetaData.PPO_EPO_PLAN).setValue(VALUE_YES); planDefinitionTab.getAssetList().getAsset(CO_INSURANCE).getAsset(UC_PERCENTILE_LEVEL).setValue("PPO Schedule"); softly.assertThat(planDefinitionTab.getAssetList().getAsset(CO_INSURANCE).getAsset(NETWORK_ARRANGEMENT)).hasValue("Renaissance NV Elite MAC Ren OON"); LOGGER.info("REN-21560 step 7"); NavigationPage.toLeftMenuTab(NavigationEnum.GroupBenefitsTab.POLICY_INFORMATION.get()); policyInformationTab.getAssetList().getAsset(SITUS_STATE).setValue("WV"); NavigationPage.PolicyNavigation.leftMenu(NavigationEnum.GroupBenefitsTab.PLAN_DEFINITION.get()); planDefinitionTab.getAssetList().getAsset(PlanDefinitionTabMetaData.PLAN).setValue(ImmutableList.of(ALACARTE)); planDefinitionTab.getAssetList().getAsset(PPO_EPO_PLAN).setValue(VALUE_NO); planDefinitionTab.getAssetList().getAsset(CO_INSURANCE).getAsset(UC_PERCENTILE_LEVEL).setValue("REN 80th"); softly.assertThat(planDefinitionTab.getAssetList().getAsset(CO_INSURANCE).getAsset(NETWORK_ARRANGEMENT)).hasValue("Renaissance PPO Plus WV (2015)"); LOGGER.info("REN-22484 step 1"); NavigationPage.toLeftMenuTab(NavigationEnum.GroupBenefitsTab.POLICY_INFORMATION.get()); policyInformationTab.getAssetList().getAsset(SITUS_STATE).setValue("AK"); policyInformationTab.getAssetList().getAsset(ASO_PLAN).setValue(VALUE_YES); LOGGER.info("REN-22484 step 2"); NavigationPage.toLeftMenuTab(NavigationEnum.GroupBenefitsTab.PLAN_DEFINITION.get()); planDefinitionTab.getAssetList().getAsset(PlanDefinitionTabMetaData.PLAN).setValue(ImmutableList.of(ASO)); softly.assertThat(planDefinitionTab.getAssetList().getAsset(PPO_EPO_PLAN)).isDisabled().hasValue(VALUE_NO); }); } }
10202b4cb543f471970794240222f6cf9f6a1ef8
fb04f3e08b1f4f07502093da79a90efa4717d023
/java/src/model/Move.java
6be249c4770fa9de6c62929428c20d8efba348bc
[]
no_license
jakubrak/chess
208ad2ea546bee633c7659a2041068d77312794d
012fda62e8218b3749878a033e788c382d04729a
refs/heads/master
2020-04-03T09:33:46.619309
2018-10-29T07:33:58
2018-10-29T07:33:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
988
java
package model; import exceptions.IllegalMoveException; /** * Chess move. * @author Jakub Rak */ abstract class Move { /** * Does a chess move. * @throws IllegalMoveException */ abstract void doMove() throws IllegalMoveException; /** * @return piece which is captured */ Piece getCapturedPiece() { return null; } /** * @return square to which piece is being moved */ abstract Square getEndSquare(); /** * @return piece which is being moved */ abstract Piece getPiece(); /** * @return square from which piece is being moved */ abstract Square getStartSquare(); /** * Undoes a chess move. */ abstract void undoMove(); /** * @return true if piece which is being moved was moved any time before, otherwise false */ abstract boolean wasMoved(); /** * @return true if path which piece is being moved along with is clear, otherwise false */ abstract boolean isPathClear(); }
b2a10c75412619363f8f7704261710b720a04a33
b764ca4126e6102a47d1c0dd4fa93f21a6ac303a
/app/src/main/java/com/wxkj/tongcheng/zxing/camera/Intents.java
30febcc80b9351f963c75ffa77f4a2474f5a5b31
[]
no_license
zjd0217/samecity
f4c06d6e75e9ea3ac804850e95cd22be04432374
233e45e69eb8ef3333dee4397283c41c04d27491
refs/heads/master
2020-04-03T01:27:43.813687
2018-10-27T06:41:03
2018-10-27T06:41:03
154,931,302
0
0
null
null
null
null
UTF-8
Java
false
false
10,133
java
/* * Copyright (C) 2008 ZXing authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.wxkj.tongcheng.zxing.camera; /** * This class provides the constants to use when sending an Intent to Barcode Scanner. * These strings are effectively API and cannot be changed. * * @author [email protected] (Daniel Switkin) */ public final class Intents { private Intents() { } public static final class Scan { /** * Send this intent to open the Barcodes app in scanning mode, find a barcode, and return * the results. */ public static final String ACTION = "com.google.zxing.client.android.SCAN"; /** * By default, sending this will decode all barcodes that we understand. However it * may be useful to limit scanning to certain formats. Use * {@link android.content.Intent#putExtra(String, String)} with one of the values below. * * Setting this is effectively shorthand for setting explicit formats with {@link #FORMATS}. * It is overridden by that setting. */ public static final String MODE = "SCAN_MODE"; /** * Decode only UPC and EAN barcodes. This is the right choice for shopping apps which get * prices, reviews, etc. for products. */ public static final String PRODUCT_MODE = "PRODUCT_MODE"; /** * Decode only 1D barcodes. */ public static final String ONE_D_MODE = "ONE_D_MODE"; /** * Decode only QR codes. */ public static final String QR_CODE_MODE = "QR_CODE_MODE"; /** * Decode only Data Matrix codes. */ public static final String DATA_MATRIX_MODE = "DATA_MATRIX_MODE"; /** * Decode only Aztec. */ public static final String AZTEC_MODE = "AZTEC_MODE"; /** * Decode only PDF417. */ public static final String PDF417_MODE = "PDF417_MODE"; /** * Comma-separated list of formats to scan for. The values must match the names of * {@link com.google.zxing.BarcodeFormat}s, e.g. {@link com.google.zxing.BarcodeFormat#EAN_13}. * Example: "EAN_13,EAN_8,QR_CODE". This overrides {@link #MODE}. */ public static final String FORMATS = "SCAN_FORMATS"; /** * Optional parameter to specify the id of the camera from which to recognize barcodes. * Overrides the default camera that would otherwise would have been selected. * If provided, should be an int. */ public static final String CAMERA_ID = "SCAN_CAMERA_ID"; /** * @see com.google.zxing.DecodeHintType#CHARACTER_SET */ public static final String CHARACTER_SET = "CHARACTER_SET"; /** * Optional parameters to specify the width and height of the scanning rectangle in pixels. * The app will try to honor these, but will clamp them to the size of the preview frame. * You should specify both or neither, and pass the size as an int. */ public static final String WIDTH = "SCAN_WIDTH"; public static final String HEIGHT = "SCAN_HEIGHT"; /** * Desired duration in milliseconds for which to pause after a successful scan before * returning to the calling intent. Specified as a long, not an integer! * For example: 1000L, not 1000. */ public static final String RESULT_DISPLAY_DURATION_MS = "RESULT_DISPLAY_DURATION_MS"; /** * Prompt to show on-screen when scanning by intent. Specified as a {@link String}. */ public static final String PROMPT_MESSAGE = "PROMPT_MESSAGE"; /** * If a barcode is found, Barcodes returns {@link android.app.Activity#RESULT_OK} to * {@link android.app.Activity#onActivityResult(int, int, android.content.Intent)} * of the app which requested the scan via * {@link android.app.Activity#startActivityForResult(android.content.Intent, int)} * The barcodes contents can be retrieved with * {@link android.content.Intent#getStringExtra(String)}. * If the user presses Back, the result code will be {@link android.app.Activity#RESULT_CANCELED}. */ public static final String RESULT = "SCAN_RESULT"; /** * Call {@link android.content.Intent#getStringExtra(String)} with {@link #RESULT_FORMAT} * to determine which barcode format was found. * See {@link com.google.zxing.BarcodeFormat} for possible values. */ public static final String RESULT_FORMAT = "SCAN_RESULT_FORMAT"; /** * Call {@link android.content.Intent#getStringExtra(String)} with {@link #RESULT_UPC_EAN_EXTENSION} * to return the content of any UPC extension barcode that was also found. Only applicable * to {@link com.google.zxing.BarcodeFormat#UPC_A} and {@link com.google.zxing.BarcodeFormat#EAN_13} * formats. */ public static final String RESULT_UPC_EAN_EXTENSION = "SCAN_RESULT_UPC_EAN_EXTENSION"; /** * Call {@link android.content.Intent#getByteArrayExtra(String)} with {@link #RESULT_BYTES} * to get a {@code byte[]} of raw bytes in the barcode, if available. */ public static final String RESULT_BYTES = "SCAN_RESULT_BYTES"; /** * Key for the value of {@link com.google.zxing.ResultMetadataType#ORIENTATION}, if available. * Call {@link android.content.Intent#getIntArrayExtra(String)} with {@link #RESULT_ORIENTATION}. */ public static final String RESULT_ORIENTATION = "SCAN_RESULT_ORIENTATION"; /** * Key for the value of {@link com.google.zxing.ResultMetadataType#ERROR_CORRECTION_LEVEL}, if available. * Call {@link android.content.Intent#getStringExtra(String)} with {@link #RESULT_ERROR_CORRECTION_LEVEL}. */ public static final String RESULT_ERROR_CORRECTION_LEVEL = "SCAN_RESULT_ERROR_CORRECTION_LEVEL"; /** * Prefix for keys that map to the values of {@link com.google.zxing.ResultMetadataType#BYTE_SEGMENTS}, * if available. The actual values will be set under a series of keys formed by adding 0, 1, 2, ... * to this prefix. So the first byte segment is under key "SCAN_RESULT_BYTE_SEGMENTS_0" for example. * Call {@link android.content.Intent#getByteArrayExtra(String)} with these keys. */ public static final String RESULT_BYTE_SEGMENTS_PREFIX = "SCAN_RESULT_BYTE_SEGMENTS_"; /** * Setting this to false will not save scanned codes in the history. Specified as a {@code boolean}. */ public static final String SAVE_HISTORY = "SAVE_HISTORY"; private Scan() { } } public static final class History { public static final String ITEM_NUMBER = "ITEM_NUMBER"; private History() { } } public static final class Encode { /** * Send this intent to encode a piece of data as a QR code and display it full screen, so * that another person can scan the barcode from your screen. */ public static final String ACTION = "com.google.zxing.client.android.ENCODE"; /** * The data to encode. Use {@link android.content.Intent#putExtra(String, String)} or * {@link android.content.Intent#putExtra(String, android.os.Bundle)}, * depending on the type and format specified. Non-QR Code formats should * just use a String here. For QR Code, see Contents for details. */ public static final String DATA = "ENCODE_DATA"; /** * The type of data being supplied if the format is QR Code. Use * {@link android.content.Intent#putExtra(String, String)} with one of {@link Contents.Type}. */ public static final String TYPE = "ENCODE_TYPE"; /** * The barcode format to be displayed. If this isn't specified or is blank, * it defaults to QR Code. Use {@link android.content.Intent#putExtra(String, String)}, where * format is one of {@link com.google.zxing.BarcodeFormat}. */ public static final String FORMAT = "ENCODE_FORMAT"; /** * Normally the contents of the barcode are displayed to the user in a TextView. Setting this * boolean to false will hide that TextView, showing only the encode barcode. */ public static final String SHOW_CONTENTS = "ENCODE_SHOW_CONTENTS"; private Encode() { } } public static final class SearchBookContents { /** * Use Google Book Search to search the contents of the book provided. */ public static final String ACTION = "com.google.zxing.client.android.SEARCH_BOOK_CONTENTS"; /** * The book to search, identified by ISBN number. */ public static final String ISBN = "ISBN"; /** * An optional field which is the text to search for. */ public static final String QUERY = "QUERY"; private SearchBookContents() { } } public static final class WifiConnect { /** * Internal intent used to trigger connection to a wi-fi network. */ public static final String ACTION = "com.google.zxing.client.android.WIFI_CONNECT"; /** * The network to connect to, all the configuration provided here. */ public static final String SSID = "SSID"; /** * The network to connect to, all the configuration provided here. */ public static final String TYPE = "TYPE"; /** * The network to connect to, all the configuration provided here. */ public static final String PASSWORD = "PASSWORD"; private WifiConnect() { } } public static final class Share { /** * Give the user a choice of items to encode as a barcode, then render it as a QR Code and * display onscreen for a friend to scan with their phone. */ public static final String ACTION = "com.google.zxing.client.android.SHARE"; private Share() { } } }
3bc03437bf2887525ef757ab767927d6dac5f3a4
38ad6c5ed88fcf0e83d8a241254c0f668393e0dc
/integration/spark/src/main/scala/org/apache/spark/sql/secondaryindex/util/IndexTableUtil.java
d9477d62bc0a7c5751664046d57707ab5fcdcd05
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "BSD-2-Clause" ]
permissive
jackylk/incubator-carbondata
602982f69167903f5b15f3f2cefd95ad340f1ced
c377cd12a73b896d61eb69512681cfc8b255bd21
refs/heads/master
2021-05-23T21:48:18.421888
2020-02-23T08:24:29
2020-03-02T08:53:43
62,279,476
0
6
Apache-2.0
2019-06-13T13:07:04
2016-06-30T04:32:26
Scala
UTF-8
Java
false
false
2,489
java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.spark.sql.secondaryindex.util; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.apache.spark.sql.secondaryindex.exception.IndexTableExistException; import org.apache.carbondata.core.metadata.schema.indextable.IndexTableInfo; public class IndexTableUtil { /** * adds index table info into parent table properties * */ public static String checkAndAddIndexTable(String gsonData, IndexTableInfo newIndexTable) throws IndexTableExistException { IndexTableInfo[] indexTableInfos = IndexTableInfo.fromGson(gsonData); if (null == indexTableInfos) { indexTableInfos = new IndexTableInfo[0]; } List<IndexTableInfo> indexTables = new ArrayList<>(Arrays.asList(indexTableInfos)); for (IndexTableInfo indexTable : indexTableInfos) { if (indexTable.getIndexCols().size() == newIndexTable.getIndexCols().size()) { //If column order is not same, then also index table creation should be successful //eg., index1 is a,b,d and index2 is a,d,b. Both table creation should be successful boolean isColumnOrderSame = true; for (int i = 0; i < indexTable.getIndexCols().size(); i++) { if (!indexTable.getIndexCols().get(i) .equalsIgnoreCase(newIndexTable.getIndexCols().get(i))) { isColumnOrderSame = false; break; } } if (isColumnOrderSame) { throw new IndexTableExistException("Index Table with selected columns already exist"); } } } indexTables.add(newIndexTable); return IndexTableInfo.toGson(indexTables.toArray(new IndexTableInfo[0])); } }
905e9861e482d641b3ca80c7b613b3f5772bd903
ecab95bd300876f081d95d89634ce4314f37873d
/src/main/java/eu/franzoni/abagail/rl/test/MDPTest.java
c4c6b57ffd74fea0356ee5eb81c05153aedb518b
[]
no_license
alanfranz/ABAGAIL
b4fb87e4f8ab2294ba9ed4c3fdd8d14ac9388d40
53626b9e9253c886d0787fd7ed258acb962be061
refs/heads/master
2020-08-04T22:09:43.268115
2019-10-12T15:59:38
2019-10-12T15:59:38
212,293,975
0
0
null
2019-10-02T08:49:40
2019-10-02T08:49:39
null
UTF-8
Java
false
false
3,287
java
package eu.franzoni.abagail.rl.test; import eu.franzoni.abagail.rl.EpsilonGreedyStrategy; import eu.franzoni.abagail.rl.Policy; import eu.franzoni.abagail.rl.PolicyIteration; import eu.franzoni.abagail.rl.QLambda; import eu.franzoni.abagail.rl.SarsaLambda; import eu.franzoni.abagail.rl.SimpleMarkovDecisionProcess; import eu.franzoni.abagail.rl.ValueIteration; import eu.franzoni.abagail.shared.FixedIterationTrainer; import eu.franzoni.abagail.shared.ThresholdTrainer; /** * A markov decision process test * @author Andrew Guillory [email protected] * @version 1.0 */ public class MDPTest { /** * The main method * @param args ignored */ public static void main(String[] args) { // the andrew moore tutorial mdp SimpleMarkovDecisionProcess mdp = new SimpleMarkovDecisionProcess(); mdp.setRewards(new double[] {0, 0, 10, 10}); mdp.setTransitionMatrices(new double[][][] { {{ 1.0, 0, 0, 0}, {.5, .5, 0, 0 }}, {{ .5, 0, 0, .5}, { 0, 1, 0, 0 }}, {{ .5, 0, .5, 0}, {.5, .5, 0, 0 }}, {{ 0, 0, .5, .5}, {0, 1, 0, 0 }}}); mdp.setInitialState(0); // solve it ValueIteration vi = new ValueIteration(.9, mdp); ThresholdTrainer tt = new ThresholdTrainer(vi); long startTime = System.currentTimeMillis(); tt.train(); Policy p = vi.getPolicy(); long finishTime = System.currentTimeMillis(); System.out.println("Value iteration learned : " + p); System.out.println("in " + tt.getIterations() + " iterations"); System.out.println("and " + (finishTime - startTime) + " ms"); PolicyIteration pi = new PolicyIteration(.9, mdp); tt = new ThresholdTrainer(pi); startTime = System.currentTimeMillis(); tt.train(); p = pi.getPolicy(); finishTime = System.currentTimeMillis(); System.out.println("Policy iteration learned : " + p); System.out.println("in " + tt.getIterations() + " iterations"); System.out.println("and " + (finishTime - startTime) + " ms"); QLambda ql = new QLambda(.5, .9, .2, .995, new EpsilonGreedyStrategy(.3), mdp); FixedIterationTrainer fit = new FixedIterationTrainer(ql, 100); startTime = System.currentTimeMillis(); fit.train(); p = ql.getPolicy(); finishTime = System.currentTimeMillis(); System.out.println("Q lambda learned : " + p); System.out.println("in " + 100 + " iterations"); System.out.println("and " + (finishTime - startTime) + " ms"); System.out.println("Acquiring " + ql.getTotalReward() + " reward"); SarsaLambda sl = new SarsaLambda(.5, .9, .2, .995, new EpsilonGreedyStrategy(.3), mdp); fit = new FixedIterationTrainer(sl, 100); startTime = System.currentTimeMillis(); fit.train(); p = sl.getPolicy(); finishTime = System.currentTimeMillis(); System.out.println("Sarsa lambda learned : " + p); System.out.println("in " + 100 + " iterations"); System.out.println("and " + (finishTime - startTime) + " ms"); System.out.println("Acquiring " + sl.getTotalReward() + " reward"); } }
f20aa412f61bb968d9f13af79ccce59a534281dc
c67753ba6bf1312a741a930af27e87a3e7df11ef
/picker/src/main/java/com/warehouse/picker/Test.java
9b37dd148b8ab592b21739a009e00a9d7930d903
[]
no_license
KritikaHk/PickerApis
eb2e1f8756280b93a0bebdfbf834ee2fb525ca2c
5462af239e96ea93885190ea19ac038102572892
refs/heads/master
2020-09-10T22:44:05.585982
2019-11-15T21:25:04
2019-11-15T21:25:04
221,855,445
0
1
null
null
null
null
UTF-8
Java
false
false
195
java
package com.warehouse.picker; public class Test { public static void main(String[] args) { Number a =1; Long b = 1L; System.out.println(a.longValue() == b); } }
05d3b491abb77fbacf5642ed9cc00f84609b820a
6679bc0f400db36d3bee536ef88188b8b1c9711e
/java181106/src/DAO.java
b69705d5589e5b3a0d77566532ca61034a63e958
[]
no_license
leeneko/eclipse-workspace
b780ce734cb11bf622d68041d90810fde30792aa
b38680d0521c3ce68cfcc435d86489fc507173f1
refs/heads/master
2021-10-18T05:44:35.760451
2019-02-14T05:15:15
2019-02-14T05:15:15
152,379,051
0
0
null
null
null
null
UTF-8
Java
false
false
2,726
java
import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; public class DAO { public ArrayList<VO> select(String s) { ArrayList<VO> list = new ArrayList<VO>(); try { // String sql = "SELECT * FROM MEMBER WHERE name LIKE '%" + s + "%'"; String sql = "SELECT * FROM MEMBER WHERE name LIKE ?"; Connection conn = DBConnection.conn(); PreparedStatement pst = conn.prepareStatement(sql); pst.setString(1, "%" + s + "%"); ResultSet rs = pst.executeQuery(); if (rs != null) { while (rs.next()) { String tempName = rs.getString("name"); int tempAge = rs.getInt("age"); String tempPhone = rs.getString("phonenum"); list.add(new VO(tempName, tempAge, tempPhone)); } } else { System.out.println("검색 실패"); } rs.close(); pst.close(); conn.close(); } catch (SQLException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } return list; } public ArrayList<VO> select() { ArrayList<VO> list = new ArrayList<VO>(); try { String sql = "SELECT * FROM MEMBER"; Connection conn = DBConnection.conn(); PreparedStatement pst = conn.prepareStatement(sql); ResultSet rs = pst.executeQuery(); if(rs != null) { while (rs.next()) { String name = rs.getString(1); int age = rs.getInt(2); String phone = rs.getString(3); list.add(new VO(name, age, phone)); } } else { System.out.println("테이블에 정보가 없습니다"); } rs.close(); pst.close(); conn.close(); } catch (SQLException e) { e.printStackTrace(); } return list; } public void insert(String name, int age, String phone) { VO vo = new VO(name, age, phone); try { String sql = "INSERT INTO MEMBER VALUES(?, ?, ?)"; Connection conn = DBConnection.conn(); PreparedStatement pst = conn.prepareStatement(sql); pst.setString(1, vo.getName()); pst.setInt(2, vo.getAge()); pst.setString(3, vo.getPhone()); int cnt = pst.executeUpdate(); if (cnt > 0) { System.out.println("입력 성공"); } else { System.out.println("입력 실패"); } pst.close(); conn.close(); } catch (SQLException e) { e.printStackTrace(); } } public int delete(String s) { int result = 0; try { String sql = "DELETE FROM member WHERE name = ?"; Connection conn = DBConnection.conn(); PreparedStatement pst = conn.prepareStatement(sql); pst.setString(1, s); result = pst.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } return result; } }
6164302ea2178c76977274f8928a7d3b309d160e
1f5c27a5490b45379dfe53316fa60e31a45fa948
/Battleship Demo2/Ships/Cruiser.java
e6cc47cba5a1510a8a32883ee28fb67272fb6f44
[]
no_license
SeherD/Battleship
a4066a7d097e6e82d089603785aa746367d0f225
2e570263e9041d58befde961744e350ebac84991
refs/heads/master
2021-01-15T04:13:56.421003
2020-04-15T22:39:18
2020-04-15T22:39:18
242,874,283
1
1
null
null
null
null
UTF-8
Java
false
false
768
java
package Ships; import Game.*; /** * This class is a child class of Ship. * @author T2G6: Seher Dawar, Tian Xia, Jessica Tran and Spencer Luong. * @version 2.21: GUI March 2020 */ public class Cruiser extends Ship { private final String SHIP_NAME = "Battleship"; private final int SHIP_SIZE = 4; private final char ID = 'B'; /** * Constructor with no parameter. * @Constructor */ public Cruiser() { super(); shipName = SHIP_NAME; shipSize = SHIP_SIZE; id = ID; } /** * Constructor with 3 parameters: start and end Tiles and player. * @Constructor */ public Cruiser(Tile a, Tile b, String player) { super(a, b, player); shipName = SHIP_NAME; this.shipSize = SHIP_SIZE; this.id = ID; } }
3a4fc31727651b681c34b91b7efac59d7fa9382d
91fa4f70a28cf9c718b80cee2071ae1cb7c48747
/src/main/java/com/internship/changeit/googleModels/GeoAddress.java
bf4f1dc80edc1efdc579b0e70f5d8cb22e77f458
[]
no_license
isd-soft/changeIt
63feef9a0bf5aaa2dfcd982a587bc156a413c30f
79bed62c759020e7e31e2c375a96c981e5bca0cf
refs/heads/main
2023-01-22T07:34:26.943094
2020-12-03T20:22:51
2020-12-03T20:22:51
311,299,605
0
0
null
2020-12-03T09:41:41
2020-11-09T10:18:05
Java
UTF-8
Java
false
false
334
java
package com.internship.changeit.googleModels; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Data; import java.util.List; @Data public class GeoAddress { @JsonProperty("long_name") private String longName; @JsonProperty("short_name") private String shortName; private List<String> types; }
0ffe2d4325583087f48bc3e1cf1d083f720cf1f3
7d1e79dc260a89e6ebbe65253884cee504998411
/MyBatis/src/main/java/com/kaishengit/entity/Movie.java
ec7b3adcea14906cdca79b517e6f105da84832dc
[]
no_license
wangpengfei66/learn-SSM
4af9a5276c968aa702b16e6d1449ed01d05fd5c2
61b977e650be25f1ad73c53307e989ac23abb836
refs/heads/master
2020-12-02T22:42:42.111271
2017-08-29T14:58:01
2017-08-29T14:58:01
96,170,383
0
0
null
null
null
null
UTF-8
Java
false
false
822
java
package com.kaishengit.entity; public class Movie { private Integer id; private Integer rank; private String name; private Double score; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public Integer getRank() { return rank; } public void setRank(Integer rank) { this.rank = rank; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Double getScore() { return score; } public void setScore(Double score) { this.score = score; } @Override public String toString() { return "Movie [id=" + id + ", rank=" + rank + ", name=" + name + ", score=" + score + "]"; } }
f05ba4374e66359c6692dfddbfbed33f86e3ee3e
9487d370a953e88850d19693725f2ed253880e1d
/library/src/main/java/me/dkzwm/smoothrefreshlayout/view/ProgressWheel.java
5de18fa2e558b07f858c2b69e847643e69df714e
[ "MIT" ]
permissive
54SunSir/SmoothRefreshLayout
0ccba6335c41180c5ae2450e1b967c9bb8d4db30
2132166eefcc9bb3767ac417f85655291b18cbc4
refs/heads/master
2020-12-02T07:45:31.131099
2017-07-08T01:13:49
2017-07-08T01:13:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
21,569
java
package me.dkzwm.smoothrefreshlayout.view; import android.annotation.TargetApi; import android.content.Context; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Paint.Style; import android.graphics.RectF; import android.os.Build; import android.os.Parcel; import android.os.Parcelable; import android.os.SystemClock; import android.provider.Settings; import android.util.AttributeSet; import android.view.View; /** * A Material style progress wheel, compatible up to 2.2. * Todd Davies' Progress Wheel https://github.com/Todd-Davies/ProgressWheel * * @author Nico Hormazábal * <p/> * Licensed under the Apache License 2.0 license see: * http://www.apache.org/licenses/LICENSE-2.0 */ public class ProgressWheel extends View { private static final String TAG = ProgressWheel.class.getSimpleName(); private final int barLength = 16; private final int barMaxLength = 270; private final long pauseGrowingTime = 200; /** * ********* * DEFAULTS * * ********** */ //Sizes (with defaults in DP) private int circleRadius = 28; private int barWidth = 4; private int rimWidth = 4; private boolean fillRadius = false; private double timeStartGrowing = 0; private double barSpinCycleTime = 460; private float barExtraLength = 0; private boolean barGrowingFromFront = true; private long pausedTimeWithoutGrowing = 0; //Colors (with defaults) private int barColor = 0xAA000000; private int rimColor = 0x00FFFFFF; //Paints private Paint barPaint = new Paint(); private Paint rimPaint = new Paint(); //Rectangles private RectF circleBounds = new RectF(); //Animation //The amount of degrees per second private float spinSpeed = 230.0f; //private float spinSpeed = 120.0f; // The last time the spinner was animated private long lastTimeAnimated = 0; private boolean linearProgress; private float mProgress = 0.0f; private float mTargetProgress = 0.0f; private boolean isSpinning = false; private ProgressCallback callback; private boolean shouldAnimate; /** * The constructor for the ProgressWheel */ public ProgressWheel(Context context, AttributeSet attrs) { super(context, attrs); setAnimationEnabled(); } /** * The constructor for the ProgressWheel */ public ProgressWheel(Context context) { super(context); setAnimationEnabled(); } @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) private void setAnimationEnabled() { int currentApiVersion = Build.VERSION.SDK_INT; float animationValue; if (currentApiVersion >= Build.VERSION_CODES.JELLY_BEAN_MR1) { animationValue = Settings.Global.getFloat(getContext().getContentResolver(), Settings.Global.ANIMATOR_DURATION_SCALE, 1); } else { animationValue = Settings.System.getFloat(getContext().getContentResolver(), Settings.System.ANIMATOR_DURATION_SCALE, 1); } shouldAnimate = animationValue != 0; } //---------------------------------- //Setting up stuff //---------------------------------- @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); int viewWidth = circleRadius + this.getPaddingLeft() + this.getPaddingRight(); int viewHeight = circleRadius + this.getPaddingTop() + this.getPaddingBottom(); int widthMode = MeasureSpec.getMode(widthMeasureSpec); int widthSize = MeasureSpec.getSize(widthMeasureSpec); int heightMode = MeasureSpec.getMode(heightMeasureSpec); int heightSize = MeasureSpec.getSize(heightMeasureSpec); int width; int height; //Measure Width if (widthMode == MeasureSpec.EXACTLY) { //Must be this size width = widthSize; } else if (widthMode == MeasureSpec.AT_MOST) { //Can't be bigger than... width = Math.min(viewWidth, widthSize); } else { //Be whatever you want width = viewWidth; } //Measure Height if (heightMode == MeasureSpec.EXACTLY || widthMode == MeasureSpec.EXACTLY) { //Must be this size height = heightSize; } else if (heightMode == MeasureSpec.AT_MOST) { //Can't be bigger than... height = Math.min(viewHeight, heightSize); } else { //Be whatever you want height = viewHeight; } setMeasuredDimension(width, height); } /** * Use onSizeChanged instead of onAttachedToWindow to get the dimensions of the view, * because this method is called after measuring the dimensions of MATCH_PARENT & WRAP_CONTENT. * Use this dimensions to setup the bounds and paints. */ @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); setupBounds(w, h); setupPaints(); invalidate(); } /** * Set the properties of the paints we're using to * draw the progress wheel */ private void setupPaints() { barPaint.setColor(barColor); barPaint.setAntiAlias(true); barPaint.setStyle(Style.STROKE); barPaint.setStrokeWidth(barWidth); rimPaint.setColor(rimColor); rimPaint.setAntiAlias(true); rimPaint.setStyle(Style.STROKE); rimPaint.setStrokeWidth(rimWidth); } /** * Set the bounds of the component */ private void setupBounds(int layout_width, int layout_height) { int paddingTop = getPaddingTop(); int paddingBottom = getPaddingBottom(); int paddingLeft = getPaddingLeft(); int paddingRight = getPaddingRight(); if (!fillRadius) { // Width should equal to Height, find the min value to setup the circle int minValue = Math.min(layout_width - paddingLeft - paddingRight, layout_height - paddingBottom - paddingTop); int circleDiameter = Math.min(minValue, circleRadius * 2 - barWidth * 2); // Calc the Offset if needed for centering the wheel in the available space int xOffset = (layout_width - paddingLeft - paddingRight - circleDiameter) / 2 + paddingLeft; int yOffset = (layout_height - paddingTop - paddingBottom - circleDiameter) / 2 + paddingTop; circleBounds = new RectF(xOffset + barWidth, yOffset + barWidth, xOffset + circleDiameter - barWidth, yOffset + circleDiameter - barWidth); } else { circleBounds = new RectF(paddingLeft + barWidth, paddingTop + barWidth, layout_width - paddingRight - barWidth, layout_height - paddingBottom - barWidth); } } public void setCallback(ProgressCallback progressCallback) { callback = progressCallback; if (!isSpinning) { runCallback(); } } //---------------------------------- //Animation stuff //---------------------------------- protected void onDraw(Canvas canvas) { super.onDraw(canvas); canvas.drawArc(circleBounds, 360, 360, false, rimPaint); boolean mustInvalidate = false; if (!shouldAnimate) { return; } if (isSpinning) { //Draw the spinning bar mustInvalidate = true; long deltaTime = (SystemClock.uptimeMillis() - lastTimeAnimated); float deltaNormalized = deltaTime * spinSpeed / 1000.0f; updateBarLength(deltaTime); mProgress += deltaNormalized; if (mProgress > 360) { mProgress -= 360f; // A full turn has been completed // we run the callback with -1 in case we want to // do something, like changing the color runCallback(-1.0f); } lastTimeAnimated = SystemClock.uptimeMillis(); float from = mProgress - 90; float length = barLength + barExtraLength; if (isInEditMode()) { from = 0; length = 135; } canvas.drawArc(circleBounds, from, length, false, barPaint); } else { float oldProgress = mProgress; if (mProgress != mTargetProgress) { //We smoothly increase the progress bar mustInvalidate = true; float deltaTime = (float) (SystemClock.uptimeMillis() - lastTimeAnimated) / 1000; float deltaNormalized = deltaTime * spinSpeed; mProgress = Math.min(mProgress + deltaNormalized, mTargetProgress); lastTimeAnimated = SystemClock.uptimeMillis(); } if (oldProgress != mProgress) { runCallback(); } float offset = 0.0f; float progress = mProgress; if (!linearProgress) { float factor = 2.0f; offset = (float) (1.0f - Math.pow(1.0f - mProgress / 360.0f, 2.0f * factor)) * 360.0f; progress = (float) (1.0f - Math.pow(1.0f - mProgress / 360.0f, factor)) * 360.0f; } if (isInEditMode()) { progress = 360; } canvas.drawArc(circleBounds, offset - 90, progress, false, barPaint); } if (mustInvalidate) { invalidate(); } } @Override protected void onVisibilityChanged(View changedView, int visibility) { super.onVisibilityChanged(changedView, visibility); if (visibility == VISIBLE) { lastTimeAnimated = SystemClock.uptimeMillis(); } } private void updateBarLength(long deltaTimeInMilliSeconds) { if (pausedTimeWithoutGrowing >= pauseGrowingTime) { timeStartGrowing += deltaTimeInMilliSeconds; if (timeStartGrowing > barSpinCycleTime) { // We completed a size change cycle // (growing or shrinking) timeStartGrowing -= barSpinCycleTime; //if(barGrowingFromFront) { pausedTimeWithoutGrowing = 0; //} barGrowingFromFront = !barGrowingFromFront; } float distance = (float) Math.cos((timeStartGrowing / barSpinCycleTime + 1) * Math.PI) / 2 + 0.5f; float destLength = (barMaxLength - barLength); if (barGrowingFromFront) { barExtraLength = distance * destLength; } else { float newLength = destLength * (1 - distance); mProgress += (barExtraLength - newLength); barExtraLength = newLength; } } else { pausedTimeWithoutGrowing += deltaTimeInMilliSeconds; } } /** * Check if the wheel is currently spinning */ public boolean isSpinning() { return isSpinning; } /** * Reset the count (in increment mode) */ public void resetCount() { mProgress = 0.0f; mTargetProgress = 0.0f; invalidate(); } /** * Turn off spin mode */ public void stopSpinning() { isSpinning = false; mProgress = 0.0f; mTargetProgress = 0.0f; invalidate(); } /** * Puts the view on spin mode */ public void spin() { lastTimeAnimated = SystemClock.uptimeMillis(); isSpinning = true; invalidate(); } private void runCallback(float value) { if (callback != null) { callback.onProgressUpdate(value); } } private void runCallback() { if (callback != null) { float normalizedProgress = (float) Math.round(mProgress * 100 / 360.0f) / 100; callback.onProgressUpdate(normalizedProgress); } } /** * Set the progress to a specific value, * the bar will be set instantly to that value * * @param progress the progress between 0 and 1 */ public void setInstantProgress(float progress) { if (isSpinning) { mProgress = 0.0f; isSpinning = false; } if (progress > 1.0f) { progress -= 1.0f; } else if (progress < 0) { progress = 0; } if (progress == mTargetProgress) { return; } mTargetProgress = Math.min(progress * 360.0f, 360.0f); mProgress = mTargetProgress; lastTimeAnimated = SystemClock.uptimeMillis(); invalidate(); } // Great way to save a view's state http://stackoverflow.com/a/7089687/1991053 @Override public Parcelable onSaveInstanceState() { Parcelable superState = super.onSaveInstanceState(); WheelSavedState ss = new WheelSavedState(superState); // We save everything that can be changed at runtime ss.mProgress = this.mProgress; ss.mTargetProgress = this.mTargetProgress; ss.isSpinning = this.isSpinning; ss.spinSpeed = this.spinSpeed; ss.barWidth = this.barWidth; ss.barColor = this.barColor; ss.rimWidth = this.rimWidth; ss.rimColor = this.rimColor; ss.circleRadius = this.circleRadius; ss.linearProgress = this.linearProgress; ss.fillRadius = this.fillRadius; return ss; } @Override public void onRestoreInstanceState(Parcelable state) { if (!(state instanceof WheelSavedState)) { super.onRestoreInstanceState(state); return; } WheelSavedState ss = (WheelSavedState) state; super.onRestoreInstanceState(ss.getSuperState()); this.mProgress = ss.mProgress; this.mTargetProgress = ss.mTargetProgress; this.isSpinning = ss.isSpinning; this.spinSpeed = ss.spinSpeed; this.barWidth = ss.barWidth; this.barColor = ss.barColor; this.rimWidth = ss.rimWidth; this.rimColor = ss.rimColor; this.circleRadius = ss.circleRadius; this.linearProgress = ss.linearProgress; this.fillRadius = ss.fillRadius; this.lastTimeAnimated = SystemClock.uptimeMillis(); } /** * @return the current progress between 0.0 and 1.0, * if the wheel is indeterminate, then the result is -1 */ public float getProgress() { return isSpinning ? -1 : mProgress / 360.0f; } //---------------------------------- //Getters + setters //---------------------------------- /** * Set the progress to a specific value, * the bar will smoothly animate until that value * * @param progress the progress between 0 and 1 */ public void setProgress(float progress) { if (isSpinning) { mProgress = 0.0f; isSpinning = false; runCallback(); } if (progress > 1.0f) { progress -= 1.0f; } else if (progress < 0) { progress = 0; } if (progress == mTargetProgress) { return; } // If we are currently in the right position // we set again the last time animated so the // animation starts smooth from here if (mProgress == mTargetProgress) { lastTimeAnimated = SystemClock.uptimeMillis(); } mTargetProgress = Math.min(progress * 360.0f, 360.0f); invalidate(); } /** * Sets the determinate progress mode * * @param isLinear if the progress should increase linearly */ public void setLinearProgress(boolean isLinear) { linearProgress = isLinear; if (!isSpinning) { invalidate(); } } /** * @return the radius of the wheel in pixels */ public int getCircleRadius() { return circleRadius; } /** * Sets the radius of the wheel * * @param circleRadius the expected radius, in pixels */ public void setCircleRadius(int circleRadius) { this.circleRadius = circleRadius; if (!isSpinning) { invalidate(); } } /** * @return the width of the spinning bar */ public int getBarWidth() { return barWidth; } /** * Sets the width of the spinning bar * * @param barWidth the spinning bar width in pixels */ public void setBarWidth(int barWidth) { this.barWidth = barWidth; if (!isSpinning) { invalidate(); } } /** * @return the color of the spinning bar */ public int getBarColor() { return barColor; } /** * Sets the color of the spinning bar * * @param barColor The spinning bar color */ public void setBarColor(int barColor) { this.barColor = barColor; setupPaints(); if (!isSpinning) { invalidate(); } } /** * @return the color of the wheel's contour */ public int getRimColor() { return rimColor; } /** * Sets the color of the wheel's contour * * @param rimColor the color for the wheel */ public void setRimColor(int rimColor) { this.rimColor = rimColor; setupPaints(); if (!isSpinning) { invalidate(); } } /** * @return the base spinning speed, in full circle turns per second * (1.0 equals on full turn in one second), this value also is applied for * the smoothness when setting a progress */ public float getSpinSpeed() { return spinSpeed / 360.0f; } /** * Sets the base spinning speed, in full circle turns per second * (1.0 equals on full turn in one second), this value also is applied for * the smoothness when setting a progress * * @param spinSpeed the desired base speed in full turns per second */ public void setSpinSpeed(float spinSpeed) { this.spinSpeed = spinSpeed * 360.0f; } /** * @return the width of the wheel's contour in pixels */ public int getRimWidth() { return rimWidth; } /** * Sets the width of the wheel's contour * * @param rimWidth the width in pixels */ public void setRimWidth(int rimWidth) { this.rimWidth = rimWidth; if (!isSpinning) { invalidate(); } } public interface ProgressCallback { /** * Method to call when the progress reaches a value * in order to avoid float precision issues, the progress * is rounded to a float with two decimals. * <p> * In indeterminate mode, the callback is called each time * the wheel completes an animation cycle, with, the progress value is -1.0f * * @param progress a double value between 0.00 and 1.00 both included */ public void onProgressUpdate(float progress); } static class WheelSavedState extends BaseSavedState { //required field that makes Parcelables from a Parcel public static final Creator<WheelSavedState> CREATOR = new Creator<WheelSavedState>() { public WheelSavedState createFromParcel(Parcel in) { return new WheelSavedState(in); } public WheelSavedState[] newArray(int size) { return new WheelSavedState[size]; } }; float mProgress; float mTargetProgress; boolean isSpinning; float spinSpeed; int barWidth; int barColor; int rimWidth; int rimColor; int circleRadius; boolean linearProgress; boolean fillRadius; WheelSavedState(Parcelable superState) { super(superState); } private WheelSavedState(Parcel in) { super(in); this.mProgress = in.readFloat(); this.mTargetProgress = in.readFloat(); this.isSpinning = in.readByte() != 0; this.spinSpeed = in.readFloat(); this.barWidth = in.readInt(); this.barColor = in.readInt(); this.rimWidth = in.readInt(); this.rimColor = in.readInt(); this.circleRadius = in.readInt(); this.linearProgress = in.readByte() != 0; this.fillRadius = in.readByte() != 0; } @Override public void writeToParcel(Parcel out, int flags) { super.writeToParcel(out, flags); out.writeFloat(this.mProgress); out.writeFloat(this.mTargetProgress); out.writeByte((byte) (isSpinning ? 1 : 0)); out.writeFloat(this.spinSpeed); out.writeInt(this.barWidth); out.writeInt(this.barColor); out.writeInt(this.rimWidth); out.writeInt(this.rimColor); out.writeInt(this.circleRadius); out.writeByte((byte) (linearProgress ? 1 : 0)); out.writeByte((byte) (fillRadius ? 1 : 0)); } } }
82b789125465f035c8486123396afc6489a46656
b363c6be4c7fe7f75fd45375c0306081e4d4d298
/taotao-manager/taotao-manager-service/src/main/java/com/taotao/service/ItemParamService.java
ce004689c851e55bc2902403a07f64a2da8b7ba4
[]
no_license
BenjaminGao999/taotao
e52fbabb6716a55947b8796e03835ef524bf6f7c
48d3131066ab3faaac144d4f5644f2b24aade670
refs/heads/master
2020-03-28T11:41:58.761735
2018-08-28T10:14:33
2018-08-28T10:14:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
333
java
package com.taotao.service; import com.taotao.common.pojo.EasyUIDataGridResult; import com.taotao.common.pojo.TaotaoResult; /** * 规格参数 * Created by yvettee on 18-8-24. */ public interface ItemParamService { EasyUIDataGridResult getItemParamList(int page, int rows); TaotaoResult getItemParamByCid(Long cid); }
[ "cxj1198979481" ]
cxj1198979481
55c65b10cd8a9de06d2c03e64d64b420a99a330b
82922cf8d867558463350ccb206ad0d3da3f4d93
/demo/src/main/java/com/peilw/child/config/MyWebSecurityConfig.java
68380e464ba1ecebea32ef104d92a0fb76f924dd
[]
no_license
peilewang/Spring4xTest
c0d99558e18f67f177441abaeafb6c9a36cbecbf
9fbc2c89bd348b659ffd1c0bc1f2456c7d5090c8
refs/heads/master
2021-02-16T20:24:39.694002
2020-04-15T13:32:36
2020-04-15T13:32:36
245,042,221
0
0
null
2020-05-15T22:20:03
2020-03-05T01:34:10
Java
UTF-8
Java
false
false
7,724
java
package com.peilw.child.config; import com.fasterxml.jackson.databind.ObjectMapper; import com.peilw.child.components.CustomAccessDecisionManager; import com.peilw.child.components.CustomFilterInvocationSecurityMetadataSource; import org.springframework.context.annotation.Bean; import org.springframework.security.authentication.*; import org.springframework.security.config.BeanIds; import org.springframework.security.config.annotation.ObjectPostProcessor; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.core.Authentication; import org.springframework.security.core.AuthenticationException; import org.springframework.security.crypto.password.NoOpPasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.web.access.intercept.FilterSecurityInterceptor; import org.springframework.security.web.authentication.AuthenticationFailureHandler; import org.springframework.security.web.authentication.AuthenticationSuccessHandler; import org.springframework.security.web.authentication.logout.LogoutHandler; import org.springframework.security.web.authentication.logout.LogoutSuccessHandler; import javax.security.auth.login.CredentialException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.PrintWriter; import java.util.HashMap; import java.util.Map; public class MyWebSecurityConfig extends WebSecurityConfigurerAdapter { @Bean PasswordEncoder passwordEncoder() { return NoOpPasswordEncoder.getInstance(); } @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.inMemoryAuthentication() .withUser("admin").password("123").roles("ADMIN", "USER") .and() .withUser("sang").password("123").roles("USER"); } @Bean CustomFilterInvocationSecurityMetadataSource cfisms() { return new CustomFilterInvocationSecurityMetadataSource(); } @Bean CustomAccessDecisionManager cadm() { return new CustomAccessDecisionManager(); } @Bean @Override public AuthenticationManager authenticationManagerBean() throws Exception { return super.authenticationManagerBean(); } @Override protected void configure(HttpSecurity httpSecurity) throws Exception { httpSecurity.authorizeRequests().withObjectPostProcessor(new ObjectPostProcessor<FilterSecurityInterceptor>() { public <O extends FilterSecurityInterceptor> O postProcess(O object) { object.setSecurityMetadataSource(cfisms()); object.setAccessDecisionManager(cadm()); return object; } } ).antMatchers("/admin/**") .hasRole("ADMIN").antMatchers("/USER/**").access("hasAnyRole ( ' ADMIN' , 'USER')").antMatchers("/db/**") .access("hasRole('ADMIN') and hasAnyRole('DBA')")/*.anyRequest().authenticated()*/.and().formLogin().loginPage("login_page").loginProcessingUrl("/login") .usernameParameter("name").passwordParameter("password").successHandler( new AuthenticationSuccessHandler() { @Override public void onAuthenticationSuccess(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Authentication authentication) throws IOException { Object principal = authentication.getPrincipal(); httpServletResponse.setContentType("application/json;charset=utf- 8"); PrintWriter out = httpServletResponse.getWriter(); httpServletResponse.setStatus(200); Map<String, Object> map = new HashMap<String, Object>(); map.put("status", 200); map.put("msg", principal); ObjectMapper objectMapper = new ObjectMapper(); out.write(objectMapper.writeValueAsString(map)); out.flush(); out.close(); } } ).failureHandler( new AuthenticationFailureHandler() { @Override public void onAuthenticationFailure(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, AuthenticationException authenticationException) throws IOException { httpServletResponse.setContentType("application/json;charset=utf- 8"); httpServletResponse.setStatus(401); PrintWriter out = httpServletResponse.getWriter(); Map<String, Object> map = new HashMap<String, Object>(); map.put("status", 401); if (authenticationException instanceof LockedException) { map.put("msg", "登录账户被锁定"); } else if (authenticationException instanceof BadCredentialsException) { map.put("msg", "用户名或密码错误"); } else if (authenticationException instanceof DisabledException) { map.put("msg", "账户被禁用"); } else if (authenticationException instanceof AccountExpiredException) { map.put("msg", "账户已过期"); } else if (authenticationException instanceof CredentialsExpiredException) { map.put("msg", "密码已过期"); } else { map.put("msg", "登录失败!"); } ObjectMapper objectMapper = new ObjectMapper(); out.write(objectMapper.writeValueAsString(map)); out.flush(); out.close(); } } ).permitAll().and().logout().logoutUrl("/logout").clearAuthentication(true).invalidateHttpSession(true) .addLogoutHandler( new LogoutHandler() { @Override public void logout(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Authentication authentication) { } } ).logoutSuccessHandler( new LogoutSuccessHandler() { @Override public void onLogoutSuccess(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Authentication authentication) throws IOException, ServletException { httpServletResponse.sendRedirect("/login_page"); } } ); } }
7b5140c83ade2e8ecac8b3a6896b4001802f3d4e
4717e3ae325364f4da55134a4133eadfe3b03a4e
/critter/src/main/java/com/udacity/jdnd/course3/critter/controller/PetController.java
0fbf46b274312953f65d8f90849d218d390a9945
[ "MIT" ]
permissive
xlsarath/CritterChronologer
29174bae69d411be7b136dd6266fa3b1a55cfd29
3e8d2fe2a8ff4ab1294a33bf3c4fed5338108a06
refs/heads/master
2023-04-04T19:51:43.716288
2020-07-22T19:47:36
2020-07-22T19:47:36
281,025,993
0
0
null
null
null
null
UTF-8
Java
false
false
1,423
java
package com.udacity.jdnd.course3.critter.controller; import com.udacity.jdnd.course3.critter.dto.PetDTO; import com.udacity.jdnd.course3.critter.entity.Pet; import com.udacity.jdnd.course3.critter.service.PetService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Optional; import java.util.stream.Collectors; /** * Handles web requests related to Pets. */ @RestController @RequestMapping("/pet") public class PetController { @Autowired private final PetService petService; public PetController(PetService petService) { this.petService = petService; } @PostMapping public PetDTO savePet(@RequestBody PetDTO petDTO) { return PetDTO.getInstance(petService.savePet(Pet.getInstance(petDTO), petDTO.getOwnerId())); } @GetMapping("/{petId}") public PetDTO getPet(@PathVariable long petId) { return petService.getPet(petId).map(PetDTO::getInstance).orElse(null); } @GetMapping public List<PetDTO> getPets() { return petService.getPets().stream().map(PetDTO::getInstance).collect(Collectors.toList()); } @GetMapping("/owner/{ownerId}") public List<PetDTO> getPetsByOwner(@PathVariable long ownerId) { return petService.getPetsByOwner(ownerId).stream().map(PetDTO::getInstance).collect(Collectors.toList()); } }
d18ff15e51af02d84e789a52ba578db194df26e1
47d5aa96da5536c3df550d158150029f5dabacb0
/src/main/java/io/jhipster/fileuploaddemo/repository/package-info.java
b7f7afae067b29d7028ef34fa4302e01f9bea959
[]
no_license
BulkSecurityGeneratorProject/fileUploadDemo
5dec5faeb3910606a73edc6b69b3308c42c14402
c779018cf13d2cb284a56ba8b610aac09e5840c0
refs/heads/master
2022-12-15T07:24:12.087734
2019-02-15T18:06:50
2019-02-15T18:06:50
296,604,117
0
0
null
2020-09-18T11:40:29
2020-09-18T11:40:28
null
UTF-8
Java
false
false
88
java
/** * Spring Data JPA repositories. */ package io.jhipster.fileuploaddemo.repository;
cfe00da763b704cb8ca2d06a640dab896cc3277d
e1eb4db5a89a10a5d797dff5a890257eb55c2413
/src/main/java/com/vther/zookeeper/demo/Cons.java
546dd2b29fa793ba0b47453a61127b794b0d267e
[]
no_license
vther/zookeeper-demo
e0b38f3ae7e43ba2e2dac1910fd74fc1ff1e810f
247f6bcb338f39b2738d5f46f78bd52c4da2e9cd
refs/heads/master
2021-06-21T13:08:58.887282
2017-08-14T14:57:27
2017-08-14T14:57:27
100,277,967
0
0
null
null
null
null
UTF-8
Java
false
false
110
java
package com.vther.zookeeper.demo; public interface Cons { String ZOOKEEPER_URL = "192.168.1.105:2181"; }
0a556cf0a4bb4721d7373d59590305b002a41108
ad5b11ce6186ca76bf4098852d34b4a806906b1f
/zhao_sheng/src/main/java/com/yfy/app/notice/bean/ContactsGroup.java
e1c6e023dc3a08e0121465f14687cfcab042719f
[]
no_license
Zhaoxianxv/zhao_sheng1
700666c2589529aee9a25597f63cc6a07dcfe78c
9fdd9512bf38fcfe4ccbe197034a006a3d053c66
refs/heads/master
2022-12-14T03:07:48.096666
2020-09-06T03:36:17
2020-09-06T03:36:17
291,885,920
1
0
null
null
null
null
UTF-8
Java
false
false
2,867
java
package com.yfy.app.notice.bean; import android.os.Parcel; import android.os.Parcelable; import com.yfy.final_tag.TagFinal; import java.util.ArrayList; import java.util.List; public class ContactsGroup implements Parcelable { /** * depid : 6 * depname : 行政部 */ private String depid; private String depname; private String departid; private String departname; private String selectuser; private List<ChildBean> userinfob; private List<ChildBean> userinfo; public String getDepartid() { return departid; } public void setDepartid(String departid) { this.departid = departid; } public String getDepartname() { return departname; } public void setDepartname(String departname) { this.departname = departname; } public String getSelectuser() { return selectuser; } public void setSelectuser(String selectuser) { this.selectuser = selectuser; } public List<ChildBean> getUserinfo() { return userinfo; } public void setUserinfo(List<ChildBean> userinfo) { this.userinfo = userinfo; } public String getDepid() { return depid; } public void setDepid(String depid) { this.depid = depid; } public String getDepname() { return depname; } public void setDepname(String depname) { this.depname = depname; } public List<ChildBean> getUserinfob() { return userinfob; } public void setUserinfob(List<ChildBean> userinfob) { this.userinfob = userinfob; } public ContactsGroup() { } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(this.depid); dest.writeString(this.depname); dest.writeString(this.departid); dest.writeString(this.departname); dest.writeString(this.selectuser); dest.writeTypedList(this.userinfob); dest.writeTypedList(this.userinfo); } protected ContactsGroup(Parcel in) { this.depid = in.readString(); this.depname = in.readString(); this.departid = in.readString(); this.departname = in.readString(); this.selectuser = in.readString(); this.userinfob = in.createTypedArrayList(ChildBean.CREATOR); this.userinfo = in.createTypedArrayList(ChildBean.CREATOR); } public static final Creator<ContactsGroup> CREATOR = new Creator<ContactsGroup>() { @Override public ContactsGroup createFromParcel(Parcel source) { return new ContactsGroup(source); } @Override public ContactsGroup[] newArray(int size) { return new ContactsGroup[size]; } }; }
00056e3f3ba65a648e7c0af92bca0b097eb61b1d
9899f4f2f331c3f6e7f81b49825a01c01fdca1e2
/app/src/main/java/com/marst/android/popular/movies/services/FetchMoviesTask.java
132a1b3283a470db6a245beeaa4150bdc168392e
[]
no_license
marjan4jc/marstMovies
5e10316042f101d04fc3573b302007277ff1bc36
c021c7ef815417e2ce9336698a62ca192f8092ce
refs/heads/master
2021-05-15T15:13:40.107491
2017-11-01T06:29:00
2017-11-01T06:29:00
107,296,884
0
0
null
2017-10-29T06:16:42
2017-10-17T16:40:50
Java
UTF-8
Java
false
false
3,273
java
package com.marst.android.popular.movies.services; import android.annotation.TargetApi; import android.app.Activity; import android.content.Context; import android.os.Build; import android.support.annotation.NonNull; import android.util.Log; import android.view.View; import android.widget.ProgressBar; import com.marst.android.popular.movies.R; import com.marst.android.popular.movies.data.Movie; import com.marst.android.popular.movies.data.MoviesResponse; import com.marst.android.popular.movies.utils.MovieApiInterface; import com.marst.android.popular.movies.utils.NetworkUtils; import java.util.List; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; import static com.marst.android.popular.movies.utils.NetworkUtils.isNetworkConnectionAvailable; @TargetApi(Build.VERSION_CODES.CUPCAKE) public class FetchMoviesTask { private final OnEventListener<List<Movie>> mCallBack; private final Context mContext; private final String TAG = FetchMoviesTask.class.getSimpleName(); public FetchMoviesTask(Context mContext,boolean isTopRated, OnEventListener<List<Movie>> mCallBack) { this.mCallBack = mCallBack; this.mContext = mContext; fetchMovies(isTopRated); } /** * * @param isTopRated */ private void fetchMovies(boolean isTopRated) { MovieApiInterface movieApiService = NetworkUtils.getClient().create(MovieApiInterface.class); if(isNetworkConnectionAvailable(mContext)) { Call<MoviesResponse> callTheMovieDB; ProgressBar progressBarIndicator = ((Activity)mContext).findViewById(R.id.pb_loading_indicator); progressBarIndicator.setVisibility(View.VISIBLE); if(isTopRated) { callTheMovieDB = movieApiService.getTopRatedMovies(NetworkUtils.getApiKey()); } else { callTheMovieDB = movieApiService.getPopularMovies(NetworkUtils.getApiKey()); } callTheMovieDB.enqueue(new Callback<MoviesResponse>() { @Override public void onResponse(@NonNull Call<MoviesResponse> call, @NonNull Response<MoviesResponse> response) { if (mCallBack != null) { List<Movie> movies; if(response.body().getResults()!=null) { movies = response.body().getResults(); if (movies!=null) { Log.d(TAG, mContext.getString(R.string.number_movies) + movies.size()); mCallBack.onSuccess(movies); } else { Log.d(TAG,mContext.getString(R.string.no_movies_returned)); mCallBack.onSuccessNoMovies(); } } } } @Override public void onFailure(@NonNull Call<MoviesResponse> call, @NonNull Throwable t) { Log.e(TAG,t.getMessage()); mCallBack.onFailure(new Exception(t)); } }); } else { mCallBack.onSuccess(null); } } }
3c8df0e3cef5b0b1cbb73a3151a0d321f1d75ebb
60c3c4527c3e79d0c4a53950cb9e628df8186491
/Chapter12/eureka-server/src/main/java/com/spring/server/eureka/EurekaServerApplication.java
6f6c8c5cc9f3cbe9117544732f262ea92c505a14
[ "MIT" ]
permissive
PacktPublishing/Hands-On-High-Performance-with-Spring-5
96bc337f6e42fe49ccef5641b1a52ffc51ab1fa6
6db3f9ce601bf2440044e19915834a629ae4405a
refs/heads/master
2023-02-07T02:47:06.083164
2023-01-30T08:15:03
2023-01-30T08:15:03
133,801,101
28
22
null
null
null
null
UTF-8
Java
false
false
423
java
package com.spring.server.eureka; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; @SpringBootApplication @EnableEurekaServer public class EurekaServerApplication { public static void main(String[] args) { SpringApplication.run(EurekaServerApplication.class, args); } }
df34e05feb456c8e05f37c3c0e64c73a4757b1cd
878a014b366df409fb8488b2c36e4ae5d40b9538
/src/main/java/com/ivanv/cursomc/services/validation/ClienteUpdate.java
8c61bbf5a0e82ae4d68e019fa7f0948a88a4353a
[]
no_license
ivanvoliveira/spring-project
bd7fa56448d37d492659a4f575ba803c6acdf28b
f8367b89d15dcf2051b5896c6b4288f66d866d37
refs/heads/master
2020-11-26T12:58:14.277867
2020-01-07T19:17:12
2020-01-07T19:17:12
229,077,701
0
0
null
null
null
null
UTF-8
Java
false
false
572
java
package com.ivanv.cursomc.services.validation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import javax.validation.Constraint; import javax.validation.Payload; @Constraint(validatedBy = ClienteUpdateValidator.class) @Target({ ElementType.TYPE }) @Retention(RetentionPolicy.RUNTIME) public @interface ClienteUpdate { String message() default "Erro de validação"; Class<?>[] groups() default {}; Class<? extends Payload>[] payload() default {}; }
ec11c2337dbbeb61d66e1bde0f78b28342a5c7e9
b7a59519a3616550d0fc6a0d051e4428aae8e274
/aw-model/src/main/java/com/awrank/web/model/utils/user/CurrentUserUtils.java
0d5d96f7e1e3c3c98a700bf15ffceb64720b7a67
[]
no_license
awrank/awrank-web
e4ab67e67072261de292478c85a954e4e13aca78
7650cea306cfe1265c9b77e4324fe41d65893738
refs/heads/master
2021-01-10T20:57:48.785229
2013-03-27T20:04:40
2013-03-27T20:04:40
7,739,499
0
0
null
null
null
null
UTF-8
Java
false
false
1,741
java
package com.awrank.web.model.utils.user; import com.awrank.web.model.domain.User; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.stereotype.Component; /** * @author Alex Polyakov */ @Component public class CurrentUserUtils implements ApplicationContextAware { private static ApplicationContext applicationContext = null; private static final ThreadLocal<User> CURRENT_USER = new ThreadLocal<User>(); private static User anonymous = null; /** * get user linked thread or ANONYMOUS * * @return */ public static User getCurrentUser() { User user = CURRENT_USER.get(); if (user == null && applicationContext != null) { if (anonymous == null) { // TODO // UserDao userDao = applicationContext.getBean(UserDao.class); // if (userDao != null) { // anonymous = userDao.select("[email protected]"); // } } user = anonymous; } return user; } /** * link user in thread * * @param user */ public static void setCurrentUser(User user) { CURRENT_USER.set(user); } /** * unlink user of thread * необходимо вызывать в конце обработки запроса так как используется пул потоков */ public static void removeCurrentUser() { CURRENT_USER.remove(); } public static ApplicationContext getApplicationContext() { return applicationContext; } @Override public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { CurrentUserUtils.applicationContext = applicationContext; } }
[ "qazsedcft1" ]
qazsedcft1
4595dcd1a681903c819896342471e13fdbc26a5f
ccff479098c9f3d0503bee224070a7afcd690fd5
/src/receiver/AutoUpdateReceiver.java
101ff4c5fed38fa7d52c809157167a9974bd8dc1
[ "Apache-2.0" ]
permissive
betterwmj/coolWeather
a95589a489d7021b0d7808772e738585623fd19a
a88cf00d565bd57240ff675adda970e639536303
refs/heads/master
2016-08-11T21:25:54.837174
2016-03-28T10:43:21
2016-03-28T10:43:21
54,822,509
0
0
null
null
null
null
UTF-8
Java
false
false
379
java
package receiver; import service.AutoUpdateService; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; public class AutoUpdateReceiver extends BroadcastReceiver{ @Override public void onReceive(Context context, Intent intent) { Intent i=new Intent(context,AutoUpdateService.class); context.startService(i); } }
adbf8e1f04a7b86ea7cf5e3f4bc2072e641fc2b8
47892b39a165a0e5d9c7c62e9c2fcb63625d31b7
/src/main/java/com/cs/community/controller/IndexController.java
8901b4fbb3f7662836ee1907472584d8de516056
[]
no_license
chsong3/MyCommunity
c333c2e44f2d75b557940fb59bf34d3031fe7623
42c9dbf02f7ce87c55bfa70fdf117fcb9ef594a4
refs/heads/master
2022-06-29T04:09:23.567093
2019-09-24T23:17:53
2019-09-24T23:17:53
204,926,415
0
0
null
2022-06-17T02:29:11
2019-08-28T12:27:37
Java
UTF-8
Java
false
false
1,358
java
package com.cs.community.controller; import com.cs.community.dto.QuestionDTO; import com.cs.community.mapper.UserMapper; import com.cs.community.model.User; import com.cs.community.service.QuestionService; import com.cs.community.service.UserService; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestParam; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import java.util.List; /** * Created by codedrinker on 2019/4/24. */ @Controller public class IndexController { @Autowired UserService userService; @Autowired QuestionService questionService; @GetMapping("/") public String index(HttpServletRequest request,Model model, @RequestParam(defaultValue = "1",value = "pageNum")Integer pageNum) { PageHelper.startPage(pageNum,5); List<QuestionDTO> questionItems=questionService.findAllQuestionItems(); PageInfo<QuestionDTO> pageInfo=new PageInfo<QuestionDTO>(questionItems); model.addAttribute("pageInfo",pageInfo); return "index"; } }
3d4cf878bca792ec7813f2b67605e87b3ce28958
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/6/6_0fcbcd759a8001ec7b592ea4e8114b19c89df053/CompilationManager/6_0fcbcd759a8001ec7b592ea4e8114b19c89df053_CompilationManager_t.java
aec3d80f9960f41b173a63622f32879e9bfded77
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
14,638
java
/** * Licensed to Cloudera, Inc. under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. Cloudera, Inc. licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.cloudera.sqoop.orm; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.net.URL; import java.net.URLDecoder; import java.util.ArrayList; import java.util.Enumeration; import java.util.List; import java.util.jar.JarOutputStream; import java.util.zip.ZipEntry; import javax.tools.JavaCompiler; import javax.tools.JavaFileObject; import javax.tools.StandardJavaFileManager; import javax.tools.ToolProvider; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.mapred.JobConf; import com.cloudera.sqoop.SqoopOptions; import com.cloudera.sqoop.util.FileListing; import com.cloudera.sqoop.shims.HadoopShim; /** * Manages the compilation of a bunch of .java files into .class files * and eventually a jar. * * Also embeds this program's jar into the lib/ directory inside the compiled * jar to ensure that the job runs correctly. */ public class CompilationManager { /** If we cannot infer a jar name from a table name, etc., use this. */ public static final String DEFAULT_CODEGEN_JAR_NAME = "sqoop-codegen-created.jar"; public static final Log LOG = LogFactory.getLog( CompilationManager.class.getName()); private SqoopOptions options; private List<String> sources; public CompilationManager(final SqoopOptions opts) { options = opts; sources = new ArrayList<String>(); } public void addSourceFile(String sourceName) { sources.add(sourceName); } /** * locate the hadoop-*-core.jar in $HADOOP_HOME or --hadoop-home. * If that doesn't work, check our classpath. * @return the filename of the hadoop-*-core.jar file. */ private String findHadoopCoreJar() { String hadoopHome = options.getHadoopHome(); if (null == hadoopHome) { LOG.info("$HADOOP_HOME is not set"); return findJarForClass(JobConf.class); } if (!hadoopHome.endsWith(File.separator)) { hadoopHome = hadoopHome + File.separator; } File hadoopHomeFile = new File(hadoopHome); LOG.info("HADOOP_HOME is " + hadoopHomeFile.getAbsolutePath()); File [] entries = hadoopHomeFile.listFiles(); if (null == entries) { LOG.warn("HADOOP_HOME appears empty or missing"); return findJarForClass(JobConf.class); } for (File f : entries) { if (f.getName().startsWith("hadoop-") && f.getName().endsWith("-core.jar")) { LOG.info("Found hadoop core jar at: " + f.getAbsolutePath()); return f.getAbsolutePath(); } } return findJarForClass(JobConf.class); } /** * Compile the .java files into .class files via embedded javac call. */ public void compile() throws IOException { List<String> args = new ArrayList<String>(); // ensure that the jar output dir exists. String jarOutDir = options.getJarOutputDir(); File jarOutDirObj = new File(jarOutDir); if (!jarOutDirObj.exists()) { boolean mkdirSuccess = jarOutDirObj.mkdirs(); if (!mkdirSuccess) { LOG.debug("Warning: Could not make directories for " + jarOutDir); } } else if (LOG.isDebugEnabled()) { LOG.debug("Found existing " + jarOutDir); } // find hadoop-*-core.jar for classpath. String coreJar = findHadoopCoreJar(); if (null == coreJar) { // Couldn't find a core jar to insert into the CP for compilation. If, // however, we're running this from a unit test, then the path to the // .class files might be set via the hadoop.alt.classpath property // instead. Check there first. String coreClassesPath = System.getProperty("hadoop.alt.classpath"); if (null == coreClassesPath) { // no -- we're out of options. Fail. throw new IOException("Could not find hadoop core jar!"); } else { coreJar = coreClassesPath; } } // find sqoop jar for compilation classpath String sqoopJar = findThisJar(); if (null != sqoopJar) { sqoopJar = File.pathSeparator + sqoopJar; } else { LOG.warn("Could not find sqoop jar; child compilation may fail"); sqoopJar = ""; } String curClasspath = System.getProperty("java.class.path"); String srcOutDir = new File(options.getCodeOutputDir()).getAbsolutePath(); if (!srcOutDir.endsWith(File.separator)) { srcOutDir = srcOutDir + File.separator; } args.add("-sourcepath"); args.add(srcOutDir); args.add("-d"); args.add(jarOutDir); args.add("-classpath"); args.add(curClasspath + File.pathSeparator + coreJar + sqoopJar); JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); if (null == compiler) { LOG.error("It seems as though you are running sqoop with a JRE."); LOG.error("Sqoop requires a JDK that can compile Java code."); LOG.error("Please install a JDK and set $JAVA_HOME to use it."); throw new IOException("Could not start Java compiler."); } StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, null); ArrayList<String> srcFileNames = new ArrayList<String>(); for (String srcfile : sources) { srcFileNames.add(srcOutDir + srcfile); LOG.debug("Adding source file: " + srcOutDir + srcfile); } if (LOG.isDebugEnabled()) { LOG.debug("Invoking javac with args:"); for (String arg : args) { LOG.debug(" " + arg); } } Iterable<? extends JavaFileObject> srcFileObjs = fileManager.getJavaFileObjectsFromStrings(srcFileNames); JavaCompiler.CompilationTask task = compiler.getTask( null, // Write to stderr fileManager, null, // No special diagnostic handling args, null, // Compile all classes in the source compilation units srcFileObjs); boolean result = task.call(); if (!result) { throw new IOException("Error returned by javac"); } } /** * @return the complete filename of the .jar file to generate. */ public String getJarFilename() { String jarOutDir = options.getJarOutputDir(); String tableName = options.getTableName(); String specificClassName = options.getClassName(); if (specificClassName != null && specificClassName.length() > 0) { return jarOutDir + specificClassName + ".jar"; } else if (null != tableName && tableName.length() > 0) { return jarOutDir + tableName + ".jar"; } else if (this.sources.size() == 1) { // if we only have one source file, find it's base name, // turn "foo.java" into "foo", and then return jarDir + "foo" + ".jar" String srcFileName = this.sources.get(0); String basename = new File(srcFileName).getName(); String [] parts = basename.split("\\."); String preExtPart = parts[0]; return jarOutDir + preExtPart + ".jar"; } else { return jarOutDir + DEFAULT_CODEGEN_JAR_NAME; } } /** * Searches through a directory and its children for .class * files to add to a jar. * * @param dir - The root directory to scan with this algorithm. * @param jstream - The JarOutputStream to write .class files to. */ private void addClassFilesFromDir(File dir, JarOutputStream jstream) throws IOException { LOG.debug("Scanning for .class files in directory: " + dir); List<File> dirEntries = FileListing.getFileListing(dir); String baseDirName = dir.getAbsolutePath(); if (!baseDirName.endsWith(File.separator)) { baseDirName = baseDirName + File.separator; } // For each input class file, create a zipfile entry for it, // read the file into a buffer, and write it to the jar file. for (File entry : dirEntries) { if (!entry.isDirectory()) { // Chomp off the portion of the full path that is shared // with the base directory where class files were put; // we only record the subdir parts in the zip entry. String fullPath = entry.getAbsolutePath(); String chompedPath = fullPath.substring(baseDirName.length()); boolean include = chompedPath.endsWith(".class") && sources.contains( chompedPath.substring(0, chompedPath.length() - ".class".length()) + ".java"); if (include) { // include this file. LOG.debug("Got classfile: " + entry.getPath() + " -> " + chompedPath); ZipEntry ze = new ZipEntry(chompedPath); jstream.putNextEntry(ze); copyFileToStream(entry, jstream); jstream.closeEntry(); } } } } /** * Create an output jar file to use when executing MapReduce jobs. */ public void jar() throws IOException { String jarOutDir = options.getJarOutputDir(); String jarFilename = getJarFilename(); LOG.info("Writing jar file: " + jarFilename); File jarFileObj = new File(jarFilename); if (jarFileObj.exists()) { LOG.debug("Found existing jar (" + jarFilename + "); removing."); if (!jarFileObj.delete()) { LOG.warn("Could not remove existing jar file: " + jarFilename); } } FileOutputStream fstream = null; JarOutputStream jstream = null; try { fstream = new FileOutputStream(jarFilename); jstream = new JarOutputStream(fstream); addClassFilesFromDir(new File(jarOutDir), jstream); // put our own jar in there in its lib/ subdir String thisJarFile = findThisJar(); if (null != thisJarFile) { addLibJar(thisJarFile, jstream); } else { // couldn't find our own jar (we were running from .class files?) LOG.warn("Could not find jar for Sqoop; " + "MapReduce jobs may not run correctly."); } String shimJarFile = findShimJar(); if (null != shimJarFile) { addLibJar(shimJarFile, jstream); } else { // Couldn't find the shim jar. LOG.warn("Could not find jar for Sqoop shims."); LOG.warn("MapReduce jobs may not run correctly."); } jstream.finish(); } finally { if (null != jstream) { try { jstream.close(); } catch (IOException ioe) { LOG.warn("IOException closing jar stream: " + ioe.toString()); } } if (null != fstream) { try { fstream.close(); } catch (IOException ioe) { LOG.warn("IOException closing file stream: " + ioe.toString()); } } } LOG.debug("Finished writing jar file " + jarFilename); } /** * Add a jar in the lib/ directory of a JarOutputStream we're building. * @param jarFilename the source jar file to include. * @param jstream the JarOutputStream to write to. */ private void addLibJar(String jarFilename, JarOutputStream jstream) throws IOException { File thisJarFileObj = new File(jarFilename); String thisJarBasename = thisJarFileObj.getName(); String thisJarEntryName = "lib" + File.separator + thisJarBasename; ZipEntry ze = new ZipEntry(thisJarEntryName); jstream.putNextEntry(ze); copyFileToStream(thisJarFileObj, jstream); jstream.closeEntry(); } private static final int BUFFER_SZ = 4096; /** * Utility method to copy a .class file into the jar stream. * @param f * @param ostream * @throws IOException */ private void copyFileToStream(File f, OutputStream ostream) throws IOException { FileInputStream fis = new FileInputStream(f); byte [] buffer = new byte[BUFFER_SZ]; try { while (true) { int bytesReceived = fis.read(buffer); if (bytesReceived < 1) { break; } ostream.write(buffer, 0, bytesReceived); } } finally { fis.close(); } } private String findThisJar() { return findJarForClass(CompilationManager.class); } private String findShimJar() { HadoopShim h = HadoopShim.get(); if (null == h) { return null; } return findJarForClass(h.getClass()); } // Method mostly cloned from o.a.h.mapred.JobConf.findContainingJar(). private String findJarForClass(Class<? extends Object> classObj) { ClassLoader loader = classObj.getClassLoader(); String classFile = classObj.getName().replaceAll("\\.", "/") + ".class"; try { for (Enumeration<URL> itr = loader.getResources(classFile); itr.hasMoreElements();) { URL url = (URL) itr.nextElement(); if ("jar".equals(url.getProtocol())) { String toReturn = url.getPath(); if (toReturn.startsWith("file:")) { toReturn = toReturn.substring("file:".length()); } // URLDecoder is a misnamed class, since it actually decodes // x-www-form-urlencoded MIME type rather than actual // URL encoding (which the file path has). Therefore it would // decode +s to ' 's which is incorrect (spaces are actually // either unencoded or encoded as "%20"). Replace +s first, so // that they are kept sacred during the decoding process. toReturn = toReturn.replaceAll("\\+", "%2B"); toReturn = URLDecoder.decode(toReturn, "UTF-8"); return toReturn.replaceAll("!.*$", ""); } } } catch (IOException e) { throw new RuntimeException(e); } return null; } }
2e093366cbc3ad9188e3f4be60488ff2c5c5d867
69c69e4606079d9b53c3f9a01219b40d84f6c92b
/src/main/java/com/mycompany/SimpleForm.java
1f67b92bc6615407ad509f023519e7bbed444593
[]
no_license
andruhon/WicketDragAndDropFileAjaxUpload
00962af83901736426f4a83daa09f099dcf8d68c
7eae49467655d8a0a4573e16f5e074688c8f12f6
refs/heads/master
2021-05-12T17:16:18.364065
2018-02-06T22:27:53
2018-02-06T22:27:53
117,041,045
0
0
null
null
null
null
UTF-8
Java
false
false
1,771
java
package com.mycompany; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.markup.html.form.AjaxButton; import org.apache.wicket.markup.html.WebMarkupContainer; import org.apache.wicket.markup.html.WebPage; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.form.DropDownChoice; import org.apache.wicket.markup.html.form.Form; import org.apache.wicket.markup.html.form.TextArea; import org.apache.wicket.markup.html.form.TextField; import org.apache.wicket.model.IModel; import org.apache.wicket.model.Model; import java.util.Arrays; public class SimpleForm extends WebPage { private final WebMarkupContainer submittedData; IModel<String> textFieldModel = Model.of(); IModel<String> textAreaModel = Model.of(); IModel<String> dropDownModel = Model.of(); public SimpleForm() { final Form<Object> form = new Form<>("form"); add(form); form.add(new TextField<>("textField", textFieldModel)); form.add(new TextArea<>("textArea", textAreaModel)); form.add(new DropDownChoice<>("dropDown", dropDownModel, Arrays.asList("A", "B", "C"))); form.add(new AjaxButton("submit") { @Override protected void onSubmit(AjaxRequestTarget target) { super.onSubmit(target); target.add(submittedData); } }); submittedData = new WebMarkupContainer("submittedData"); submittedData.setOutputMarkupId(true); add(submittedData); submittedData.add(new Label("textFieldSubmitted", textFieldModel)); submittedData.add(new Label("textAreaSubmitted", textAreaModel)); submittedData.add(new Label("dropDownSubmitted", dropDownModel)); } }
5556da7de48ea65f190784e818e9104d657bc80f
7d509288fdb56aa41a81c9076cc4b710ae1b4a5d
/ShareConsumption/app/src/main/java/org/blogsite/youngsoft/piggybank/activity/auth/DonationList_Activity.java
c2bfe39c8054ffacc77e8331df48cc86e0ba1715
[ "Apache-2.0" ]
permissive
backup201911-buchiGO/tcle
c115adbca4b090cab08667197ad49681f7cc3da3
5736fdd63687e669623a3234f305c2ea31a7bb8a
refs/heads/master
2020-03-23T09:19:12.665378
2018-07-21T08:41:56
2018-07-21T08:41:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
10,147
java
package org.blogsite.youngsoft.piggybank.activity.auth; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.graphics.Typeface; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.Button; import android.widget.GridView; import android.widget.Spinner; import org.blogsite.youngsoft.piggybank.R; import org.blogsite.youngsoft.piggybank.adapter.DonationAdapter; import org.blogsite.youngsoft.piggybank.adapter.SpinnerAdapter; import org.blogsite.youngsoft.piggybank.dialog.ConfirmUtils; import org.blogsite.youngsoft.piggybank.dialog.DonationRegistUtils; import org.blogsite.youngsoft.piggybank.dialog.YesNoDialog; import org.blogsite.youngsoft.piggybank.logs.PGLog; import org.blogsite.youngsoft.piggybank.logs.StackTrace; import org.blogsite.youngsoft.piggybank.setting.DonationList; import org.blogsite.youngsoft.piggybank.setting.Donations; import org.blogsite.youngsoft.piggybank.setting.PBSettings; import org.blogsite.youngsoft.piggybank.setting.PBSettingsUtils; import org.blogsite.youngsoft.piggybank.utils.ButtonClick; import org.blogsite.youngsoft.piggybank.utils.IButtonClickListner; import org.blogsite.youngsoft.piggybank.utils.SmsUtils; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; public class DonationList_Activity extends AppCompatActivity implements View.OnClickListener { private static final String TAG = "DonationList_Activity"; private DonationList donationList = new DonationList(); private final Context context = this; private GridView gridview; private ArrayList<String> nameList; private ArrayList<Integer> imageList; private int oldId = -1; private PBSettings settings = null; private IButtonClickListner listner; private Donations selDonation = null; private YesNoDialog confirm = null; private Button registButton; private ArrayList<String> donaton_cat_list; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.donation_list); getSupportActionBar().setDisplayHomeAsUpEnabled(true); gridview = (GridView) findViewById(R.id.donationgrid); settings = PBSettingsUtils.getInstance().getSettings(); donationList = settings.getDonationList(); donaton_cat_list = new ArrayList<String>(); donaton_cat_list.add(getString(R.string.catagory_all)); donaton_cat_list.add(getString(R.string.catagory_buddhism)); donaton_cat_list.add(getString(R.string.catagory_catholic)); donaton_cat_list.add(getString(R.string.catagory_christian)); donaton_cat_list.add(getString(R.string.catagory_welfare)); donaton_cat_list.add(getString(R.string.catagory_sicial)); donaton_cat_list.add(getString(R.string.catagory_policy)); donaton_cat_list.add(getString(R.string.catagory_etc)); oldId = 0; initCustomSpinner(); nameList = new ArrayList<String>(); imageList = new ArrayList<Integer>(); HashMap<String, ArrayList<Donations>> donations = donationList.getDonations(); Iterator<String> it = donations.keySet().iterator(); while (it.hasNext()) { String key = it.next(); ArrayList<Donations> donationList = donations.get(key); for (Donations d : donationList) { String name = d.getName(); if(!existDonationName(name)) { nameList.add(d.getName()); if (d.getResId() == -1) { imageList.add(d.getResId()); } else { imageList.add(d.getResId()); } } } } listner = new ButtonClick(context) { public void onYesNoClick(final boolean yes){ confirm.dismiss(); if(yes){ settings.setDonations(selDonation); Intent returnIntent = new Intent(); returnIntent.putExtra("Name",selDonation.getName()); setResult(Activity.RESULT_OK,returnIntent); finish(); } } }; gridview.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { HashMap<String, ArrayList<Donations>> donations = donationList.getDonations(); Iterator<String> it = donations.keySet().iterator(); String name = nameList.get(position); String category = ""; while(it.hasNext()){ category = it.next(); ArrayList<Donations> donationList = donations.get(category); for(Donations d : donationList){ if(name.equals(d.getName())){ selDonation = d; break; } } } confirm = new YesNoDialog(context, getString(R.string.select_donation), "<b><font color=\"#FCFF33\">" + selDonation.getName() + "</font></b><br/><br/>" + getString(R.string.address) + ":" + selDonation.getAddress() + "<br/><br/>" + getString(R.string.select_donation_question), listner); confirm.setHtml(true); confirm.show(); } }); DonationAdapter adapter = new DonationAdapter(context, nameList, imageList); adapter.notifyDataSetChanged(); gridview.setAdapter(adapter); SmsUtils.setGridViewHeightBasedOnChildren(context, gridview); registButton = findViewById(R.id.registButton); registButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { DonationRegistUtils donationRegistUtils = new DonationRegistUtils(context); donationRegistUtils.show(); } }); } /** * 후원기관 이름 중복 테스트 * @param name * @return */ private boolean existDonationName(String name){ boolean ret = false; for(String n : nameList){ if(n.equals(name)){ ret = true; break; } } return ret; } private void initCustomSpinner() { try { Spinner spinner_donation = (Spinner) findViewById(R.id.spinner_donation); SpinnerAdapter adapter = new SpinnerAdapter(context, donaton_cat_list); spinner_donation.setAdapter(adapter); spinner_donation.setSelection(oldId); spinner_donation.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { if(position!=oldId){ oldId = position; String item = parent.getItemAtPosition(position).toString(); nameList.clear(); imageList.clear(); HashMap<String, ArrayList<Donations>> donations = donationList.getDonations(); ArrayList<Donations> list = null; if(getString(R.string.catagory_all).equals(item)){ Iterator<String> it = donations.keySet().iterator(); while(it.hasNext()){ String key = it.next(); ArrayList<Donations> donationList = donations.get(key); for(Donations d : donationList){ String name = d.getName(); if(!existDonationName(name)) { nameList.add(name); if (d.getResId() == -1) { imageList.add(d.getResId()); } else { imageList.add(d.getResId()); } } } } }else{ list = donations.get(item); if(list!=null) { for (Donations d : list) { nameList.add(d.getName()); if(d.getResId()==-1) { imageList.add(d.getResId()); }else{ imageList.add(d.getResId()); } } } } DonationAdapter adapter = new DonationAdapter(context, nameList, imageList); adapter.notifyDataSetChanged(); gridview.setAdapter(adapter); SmsUtils.setGridViewHeightBasedOnChildren(context, gridview); } } @Override public void onNothingSelected(AdapterView<?> parent) { } }); }catch (Exception e){ PGLog.e(TAG, StackTrace.getStackTrace(e)); } } @Override public void onClick(View v) { } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == android.R.id.home) { onBackPressed(); return true; } return super.onOptionsItemSelected(item); } }
4406a3873319864af1959a4c1b18ae6588fd6343
900921aa169364e80ce64a8dadd278bcb8fc75df
/app/src/main/java/com/thebipolaroptimist/projecttwo/views/CustomListPreference.java
90d91b75e315ebd5764eeac26a1c54e57f333c66
[]
no_license
no1isnothing/projecttwo
849e16ecf328aba6ae016e0741a30e8cfa16fbd6
006166dd0f865a57b6438a3e8abd480318501cb9
refs/heads/master
2021-05-11T21:28:43.493537
2018-07-12T18:48:26
2018-07-12T18:48:26
117,468,242
0
0
null
2018-07-23T22:13:54
2018-01-14T21:29:38
Java
UTF-8
Java
false
false
4,668
java
package com.thebipolaroptimist.projecttwo.views; import android.app.AlertDialog; import android.app.Dialog; import android.arch.lifecycle.ViewModelProviders; import android.content.DialogInterface; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.v4.app.DialogFragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.LinearLayout; import android.widget.ScrollView; import com.thebipolaroptimist.projecttwo.R; import com.thebipolaroptimist.projecttwo.SettingsFragmentViewModel; import com.thebipolaroptimist.projecttwo.models.SelectableWordData; import java.util.Set; import static com.thebipolaroptimist.projecttwo.SettingsFragment.CATEGORY_KEY; /** * Custom Preference Class * A list of action rows representing detail types * On creation a row is added for each existing detail type * The user can add new rows or remove existing rows */ public class CustomListPreference extends DialogFragment { private static final String TAG ="CustomListPreference"; private LinearLayout mLayout; private String mCategory; private Set<SelectableWordData> mValues; private SettingsFragmentViewModel mViewModel; public CustomListPreference() { } public void setData(Set<SelectableWordData> data) { mValues = data; } @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); LayoutInflater inflater = getActivity().getLayoutInflater(); ViewGroup view = (ViewGroup) inflater.inflate(R.layout.custom_list_preference_dialog, null); builder.setView(view); Bundle bundle = getArguments(); if(bundle != null && bundle.containsKey(CATEGORY_KEY)) mCategory = bundle.getString("category"); mLayout = view.findViewById(R.id.pref_list); final ScrollView scroll = view.findViewById(R.id.pref_list_scroll); Button addItemButton = view.findViewById(R.id.pref_list_add_button); addItemButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { addRow(null, null); //Return scroll to the bottom after adding a new row scroll.postDelayed(new Runnable() { @Override public void run() { scroll.fullScroll(View.FOCUS_DOWN); } }, 200); } }); mViewModel = ViewModelProviders.of(this).get(SettingsFragmentViewModel.class); if(mValues == null) { mValues = mViewModel.getDetails(mCategory); } for(SelectableWordData data : mValues) { addRow(data.getWord(), data.getColor()); } if(mValues.size() == 0) { addRow(null, null); } builder.setTitle(mCategory + " Types "); builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { getValuesFromUI(); mViewModel.setDetailsAndStore(mCategory, mValues); } }); builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dismiss(); } }); return builder.create(); } @Override public void onSaveInstanceState(Bundle outState) { outState.putString("category", mCategory); getValuesFromUI(); mViewModel.setDetails(mCategory, mValues); } private void addRow(String title, String color) { mLayout.addView(new ActionRow(getActivity(), title, color, R.drawable.ic_delete_black, new ActionRow.OnClickListener() { @Override public void onClick(View view) { mLayout.removeView(view); } })); } private void getValuesFromUI() { int count = mLayout.getChildCount(); mValues.clear(); for(int i = 0; i < count; i++) { ActionRow row = (ActionRow) mLayout.getChildAt(i); String name = row.getName(); String color = row.getColor(); if(!name.isEmpty() && color != null) { mValues.add(new SelectableWordData(name, color, true)); } } } }
b7326092fea2a9ca538eb9c04a6050ef6eca7f84
5a2e9aef07e7f62b5bcb5d5f75bb2b7e4cf49480
/src/main/java/fon/iot/smartplugspring/service/UserService.java
4c550f552b96c0459b81b2ccf0d728e4584ca44f
[ "MIT" ]
permissive
madicnikola/smart-plug-spring-api
fadde0bb9e75b045bf577716e51fc707545823b1
550c9bc939ad322ec72a98303119e8955dadb135
refs/heads/main
2023-05-28T22:09:07.954486
2021-06-14T20:51:05
2021-06-14T20:51:05
317,386,653
0
0
null
null
null
null
UTF-8
Java
false
false
4,020
java
package fon.iot.smartplugspring.service; import fon.iot.smartplugspring.config.JwtTokenUtil; import fon.iot.smartplugspring.dao.UserRepository; import fon.iot.smartplugspring.dto.PasswordChangeRequest; import fon.iot.smartplugspring.entity.UserEntity; import fon.iot.smartplugspring.exceptions.InvalidHeaders; import fon.iot.smartplugspring.exceptions.InvalidPasswordException; import fon.iot.smartplugspring.exceptions.UserNotFoundException; import fon.iot.smartplugspring.exceptions.WrongPasswordException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpHeaders; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.stereotype.Service; import java.util.List; import java.util.Optional; @Service public class UserService { private final UserRepository userRepository; private final JwtTokenUtil tokenUtil; @Autowired public UserService(UserRepository userRepository, JwtTokenUtil tokenUtil) { this.userRepository = userRepository; this.tokenUtil = tokenUtil; } public List<UserEntity> getUsers() { return userRepository.findAll(); } public UserEntity getUserById(long userID) { Optional<UserEntity> optionalUser = userRepository.findById(userID); if (!optionalUser.isPresent()) throw new UserNotFoundException("User not found"); return optionalUser.get(); } public UserEntity saveUser(UserEntity user) { try { return userRepository.save(user); } catch (Exception e) { throw e; } } public UserEntity updateUser(long userID, UserEntity user) { Optional<UserEntity> optionalUser = userRepository.findById(userID); if (!optionalUser.isPresent()) throw new UserNotFoundException("User not found"); user.setId(userID); return userRepository.save(user); } public void deleteUser(long userID) { Optional<UserEntity> optionalUser = userRepository.findById(userID); if (!optionalUser.isPresent()) throw new UserNotFoundException("User not found"); userRepository.delete(new UserEntity(userID)); } public UserEntity signin(String username, String password) { Optional<UserEntity> optionalUser = userRepository.findByUsername(username); if (!optionalUser.isPresent()) { throw new UserNotFoundException("User not found!"); } UserEntity user = optionalUser.get(); if (user.getPassword() != password) { throw new WrongPasswordException("Wrong password"); } return user; } public void changePassword(HttpHeaders headers, PasswordChangeRequest request) throws InvalidPasswordException { String username = getUsernameFromHeaders(headers); System.out.println(username); UserEntity user = getUserByUsername(username); System.out.println(request.getCurrentPassword()); if (new BCryptPasswordEncoder().matches(request.getCurrentPassword(), user.getPassword())) { user.setPassword(new BCryptPasswordEncoder().encode(request.getNewPassword())); userRepository.save(user); } else { throw new InvalidPasswordException("Wrong password!"); } } private String getUsernameFromHeaders(HttpHeaders headers) { String token = headers.getFirst("Authorization") == null ? "" : headers.getFirst("Authorization").substring(7); if (token.isEmpty()) { throw new InvalidHeaders("Unauthorized!"); } return tokenUtil.getUsernameFromToken(token); } public UserEntity getUserByUsername(String username) { Optional<UserEntity> optionalUser = userRepository.findByUsername(username); if (!optionalUser.isPresent()) throw new UserNotFoundException("User not found!"); return optionalUser.get(); } }
a9cba3c7f402d7b0ca4001e1088bda328074d7f5
21ae91ac64ab848cce620d8aec88556c9231b949
/src/main/java/com/demo/vertex/redis/RedisService.java
fc36afa144167bfd8e9066209abe39646a86208a
[]
no_license
uyathiraj/vertx-demo
ccd9d1b1503dd92529c0d68e7ee582d2ea8a4df2
0027fda6ba301e77fb00c1f929671f0823cad4a3
refs/heads/master
2022-04-17T06:50:00.341489
2020-04-14T10:30:39
2020-04-14T10:30:39
255,577,151
0
0
null
null
null
null
UTF-8
Java
false
false
263
java
package com.demo.vertex.redis; import io.reactivex.Single; import io.vertx.reactivex.redis.client.Redis; public interface RedisService { public void pushToRedis(Redis client,String key,String value); public Single<String> read(Redis client,String key); }
10918ccab73d5f06df75229258e98e497b2ccc91
b2bca179e41fd4eb20941f85563ab22f417a4fc6
/_/examples/pizzamodel/src/main/java/com/packt/masterjbpm6/pizza/model/OrderBOM.java
fefa6c1483da546a15491c0666996adb6c548f3c
[ "Apache-2.0" ]
permissive
paullewallencom/jbpm6-978-1-7832-8957-8
4585078bd04366aee8335f1fa7e3645047a459fa
cde5636a2679b3d9522e5cd1993a8d8df894d271
refs/heads/main
2023-02-05T19:26:57.932792
2020-12-30T09:55:52
2020-12-30T09:55:52
319,479,699
0
0
null
null
null
null
UTF-8
Java
false
false
550
java
package com.packt.masterjbpm6.pizza.model; import java.util.List; public class OrderBOM extends BoM { private static final long serialVersionUID = -7299344970651808160L; private String orderRef = null; public OrderBOM(String orderRef) { this.orderRef = orderRef; } public void calcBom(List<Pizza> pizzas) { for (Pizza pizza : pizzas) { for (Material material : pizza.getType().getAllIngredients()) { super.addMaterial(material, 1.0); } } } public String getOrderRef() { return orderRef; } }
01d76f5acba13fea6405e782f31c2d409c4f2e0e
3912f4cded024cff7b7418b992fae26733006a89
/src/main/java/junit/tutorial/ch8/Member.java
60eebf39e10c18149ab79790426817387df9f77b
[ "MIT" ]
permissive
toms74209200/JUnit_practice
87880ea5e14a703a791cb474f4a52181a2e8775f
a6033992b8c03ac12b2dbb4d944806f387bf35aa
refs/heads/master
2023-04-14T09:08:56.931106
2021-05-03T06:01:11
2021-05-03T06:01:11
328,169,253
0
0
null
null
null
null
UTF-8
Java
false
false
195
java
package junit.tutorial.ch8; public class Member { public static boolean canEntry(int age, Gender gender) { if (gender == Gender.MALE) return false; return 25 >= age; } }
4c4cd9f1e23039a6bba2408b3eb26ef0d594e599
188a3ffa1c019c4665bc2db486462983ed0f7789
/src/main/java/com/bigdata/engineer/fds/event/source/consumer/processor/RuleEngine.java
a979e864cdfdb584d410f9ad0a9535c1ddab91ba
[]
no_license
chanhosong/FDS
01a31f5edd908fba7d890c4da2c54db0a320f0d6
da48e7fa0961824a9f6844ae59497fb1f4beed63
refs/heads/master
2022-07-29T16:31:49.425818
2017-08-12T12:34:16
2017-08-12T12:34:16
99,399,402
0
0
null
null
null
null
UTF-8
Java
false
false
18,166
java
package com.bigdata.engineer.fds.event.source.consumer.processor; import com.bigdata.engineer.event.generator.eventunit.config.EventConstants; import com.bigdata.engineer.event.generator.eventunit.utils.EventOperations; import com.bigdata.engineer.fds.event.source.consumer.config.KafkaConsumerConstants; import com.bigdata.engineer.fds.event.source.consumer.domain.FraudDetectionEvent; import com.bigdata.engineer.fds.event.source.consumer.domain.LogEvent; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import org.apache.kafka.streams.processor.Processor; import org.apache.kafka.streams.processor.ProcessorContext; import org.apache.kafka.streams.processor.ProcessorSupplier; import org.apache.kafka.streams.state.KeyValueIterator; import org.apache.kafka.streams.state.KeyValueStore; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import java.time.Instant; import java.time.ZoneId; import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; import java.time.temporal.ChronoUnit; import java.util.Map; import java.util.Objects; public class RuleEngine implements ProcessorSupplier<String, Map<String , Map<String, LogEvent>>> { private static final Logger logger = LogManager.getLogger(RuleEngine.class); @Override public Processor<String, Map<String , Map<String, LogEvent>>> get() { return new Processor<String, Map<String , Map<String, LogEvent>>>() { private ProcessorContext context; private KeyValueStore<String, Map<String, LogEvent>> NewAccountEventStore;//Index, CustomerID, Events private KeyValueStore<String, Map<String, LogEvent>> DepositEventStore; private KeyValueStore<String, Map<String, LogEvent>> WithdrawEventStore; private KeyValueStore<String, Map<String, LogEvent>> TransferEventStore; private DateTimeFormatter formatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME; private Instant days7Ago = ZonedDateTime.now().minusDays(7).toInstant(); private ObjectMapper mapper = new ObjectMapper(); private int fraudDetectionsIndex = 0; @Override @SuppressWarnings("unchecked") public void init(ProcessorContext context) { // keep the processor context locally because we need it in punctuate() and commit() this.context = context; // call this processor's punctuate() method every 1000 milliseconds. this.context.schedule(1000); // retrieve the key-value store named "FraudStore" this.NewAccountEventStore = (KeyValueStore<String, Map<String, LogEvent>>) context.getStateStore("FraudStore.NewAccountEvent"); this.DepositEventStore = (KeyValueStore<String, Map<String, LogEvent>>) context.getStateStore("FraudStore.DepositEvent"); this.WithdrawEventStore = (KeyValueStore<String, Map<String, LogEvent>>) context.getStateStore("FraudStore.WithdrawEvent"); this.TransferEventStore = (KeyValueStore<String, Map<String, LogEvent>>) context.getStateStore("FraudStore.TransferEvent"); } @Override public void process(String type, Map<String , Map<String, LogEvent>> eventMap) {//index, customer, eventLogs try { if (Objects.equals(type, EventConstants.TRANSFER_EVENT_LOG_APPENDER.toLowerCase().trim())) { eventMap.keySet().forEach(e->{//index로 순환 eventMap.values().forEach(customer-> { customer.values().forEach(transferEvent->{ int fraudAmount = Integer.valueOf(transferEvent.getBeforetransferamount()) - Integer.valueOf(transferEvent.getTransferamount()); //1. 이체후에 10000원 이하의 수상한 잔액계좌를 확인한다 if (!transferEvent.getCustomerid().matches(transferEvent.getReceivecustomerid()) && fraudAmount <= 10000) { if (logger.isDebugEnabled()) { logger.info("Step1. 비정상 감지경고(잔액이 10000원 이하):: " + "이체한날짜: " + formatter.format(Instant.ofEpochMilli(Long.valueOf(transferEvent.getTimestamp())).atZone(ZoneId.systemDefault())) + ", 고객이름: " + transferEvent.getCustomerid() + ", 이체 계좌: " + transferEvent.getTransferaccount() + ", 이체 했었던 금액: "+ transferEvent.getTransferamount() + ", 이체 직전 잔액: " + transferEvent.getBeforetransferamount() + ", 이체후 잔액: " + fraudAmount); } //2. 신규로 계좌를 만든지 7일이하인지 확인한다 this.NewAccountEventStore.all().forEachRemaining(indexStore-> { if (!Objects.equals(indexStore.value, null) && !Objects.equals(indexStore.value.get(transferEvent.getCustomerid()),null)) { LogEvent customerValue = indexStore.value.get(transferEvent.getCustomerid()); if(!Instant.ofEpochMilli(Long.valueOf(transferEvent.getTimestamp())).isBefore(days7Ago)) {//계좌를 만든지 7일이 안지남 - 바정상 if(transferEvent.getTransferaccount().contains(customerValue.getAccountid())) { if (logger.isWarnEnabled()) { logger.info("Step2. 비정상 감지경고(잔액이 10000원이하면서 7일이내의 신규계좌):: " + "이체한 날짜: " + formatter.format(Instant.ofEpochMilli(Long.valueOf(transferEvent.getTimestamp())).atZone(ZoneId.systemDefault())) + ", 계좌를 만든날짜: " + formatter.format(Instant.ofEpochMilli(Long.valueOf(customerValue.getTimestamp())).atZone(ZoneId.systemDefault())) + ", 고객이름: " + customerValue.getCustomerid() + ", 계좌번호: " + customerValue.getAccountid()); } this.DepositEventStore.all().forEachRemaining(d->{ if (!Objects.equals(d.value, null) && !Objects.equals(d.value.get(customerValue.getCustomerid()), null)) { LogEvent depositEvent = d.value.get(customerValue.getCustomerid()); if ( 900000 <= Integer.valueOf(depositEvent.getCreditamount()) && Integer.valueOf(depositEvent.getCreditamount()) <= 1000000) { if (logger.isWarnEnabled()) { logger.warn("Step3. 비정상 감지경고 입금내역(7일이내 입금한 금액이 90-100만원이상):: " + "이체한 날짜: " + formatter.format(Instant.ofEpochMilli(Long.valueOf(transferEvent.getTimestamp())).atZone(ZoneId.systemDefault())) + ", 입금날짜: " + formatter.format(Instant.ofEpochMilli(Long.valueOf(depositEvent.getTimestamp())).atZone(ZoneId.systemDefault())) + ", 고객이름: " + depositEvent.getCustomerid() + ", 계좌번호: " + depositEvent.getAccountid() + ", 입금액: " + depositEvent.getCreditamount()); } this.WithdrawEventStore.all().forEachRemaining(w->{ if (!Objects.equals(w.value, null) && !Objects.equals(w.value.get(customerValue.getCustomerid()), null)) { LogEvent withdrawEvent = w.value.get(customerValue.getCustomerid()); Instant depositTimestamp = Instant.ofEpochMilli(Long.valueOf(depositEvent.getTimestamp())); Instant withdrawTimestamp = Instant.ofEpochMilli(Long.valueOf(withdrawEvent.getTimestamp())); if(ChronoUnit.SECONDS.between(depositTimestamp, withdrawTimestamp) <= 7200) {//2시간 이내에 출금된 기록을 확인함 if (logger.isDebugEnabled()) { logger.warn("Step4. 비정상 감지경고(출금시간이 2시간이내):: " + "출금한 날짜: " + formatter.format(Instant.ofEpochMilli(Long.valueOf(withdrawEvent.getTimestamp())).atZone(ZoneId.systemDefault())) + ", 입금한날짜: " + formatter.format(Instant.ofEpochMilli(Long.valueOf(depositEvent.getTimestamp())).atZone(ZoneId.systemDefault())) + ", 고객이름: " + withdrawEvent.getCustomerid() + ", 계좌번호: " + withdrawEvent.getAccountid() + ", 출금액: " + withdrawEvent.getDebitamount()); } FraudDetectionEvent fraudDetectionEvent = new FraudDetectionEvent(); fraudDetectionEvent.setType(EventConstants.FRAUD_DETECTION_EVENT_LOG_APPENDER); fraudDetectionEvent.setTimestamp(EventOperations.getTimestamp()); fraudDetectionEvent.setCustomerid(withdrawEvent.getCustomerid()); fraudDetectionEvent.setAccountid(customerValue.getAccountid()); fraudDetectionEvent.setTransferaccount(transferEvent.getTransferaccount()); fraudDetectionEvent.setBeforetransferamount(transferEvent.getBeforetransferamount()); fraudDetectionEvent.setReceivebankname(transferEvent.getReceivebankname()); fraudDetectionEvent.setReceivecustomerid(transferEvent.getReceivecustomerid()); fraudDetectionEvent.setCreditamount(depositEvent.getCreditamount()); fraudDetectionEvent.setDebitamount(withdrawEvent.getDebitamount()); fraudDetectionEvent.setTransferamount(transferEvent.getTransferamount()); String fraudDetectionEventJSON = null; try { fraudDetectionEventJSON = mapper.writeValueAsString(fraudDetectionEvent); } catch (JsonProcessingException e1) { e1.printStackTrace(); } // logger.error("Step5. 최종 비정상 이체내역:: " + fraudDetectionEventJSON); nextProcess(String.valueOf(fraudDetectionsIndex++), fraudDetectionEventJSON); } } }); } } }); } } } }); /*next process*/ // this.NewAccountEventStore.all().forEachRemaining(a->{ // if (!Objects.equals(a.value, null)) { // ((Map) a.value).values().forEach(f->{//Map<Integer, LogEvent> // ((Map) a.value).keySet().forEach(g->{ // if (((LogEvent) f).getTimestamp() == customervalues.getTimestamp())//2. 신규로 계좌를 만든지 7일 // System.out.println(KafkaConsumerConstants.LOG_APPENDER + "[" + g + ", " + ((LogEvent) f).getType() + ", " + a.key + ", " + ((LogEvent) f).getTimestamp() + ", " + ((LogEvent) f).getAccountid() + ", " + ((LogEvent) f).getCreditamount() + ", " + ((LogEvent) f).getDebitamount() + ", " + ((LogEvent) f).getBeforetransferamount() + ", " + ((LogEvent) f).getReceivebankname() + ", " + ((LogEvent) f).getReceivecustomerid() + ", " + ((LogEvent) f).getTransferaccount() + ", " + ((LogEvent) f).getTransferamount() + "]"); // }); // }); // } // }); // nextProcess(customervalues.getCustomerid(), customervalues.getTransferaccount()); } }); }); }); } } catch (Exception e) { e.printStackTrace(); } // commit the current processing progress context.commit(); } @Override public void punctuate(long timestamp) { if (logger.isDebugEnabled()) { print(this.NewAccountEventStore.name(), this.NewAccountEventStore.all(), timestamp); print(this.DepositEventStore.name(), this.DepositEventStore.all(), timestamp); print(this.WithdrawEventStore.name(), this.WithdrawEventStore.all(), timestamp); print(this.TransferEventStore.name(), this.TransferEventStore.all(), timestamp); } } private void print(String name, KeyValueIterator<String, Map<String, LogEvent>> iter, long timestamp) { logger.debug("----------- " + name + " " + timestamp + " ----------- "); iter.forEachRemaining(e->{ if (!Objects.equals(e.value, null)) { ((Map) e.value).values().forEach(f->{//Map<Integer, LogEvent> ((Map) e.value).keySet().forEach(g->{ logger.debug(KafkaConsumerConstants.LOG_APPENDER + "[" + g + ", " + ((LogEvent) f).getType() + ", " + e.key + ", " + ((LogEvent) f).getTimestamp() + ", " + ((LogEvent) f).getAccountid() + ", " + ((LogEvent) f).getCreditamount() + ", " + ((LogEvent) f).getDebitamount() + ", " + ((LogEvent) f).getBeforetransferamount() + ", " + ((LogEvent) f).getReceivebankname() + ", " + ((LogEvent) f).getReceivecustomerid() + ", " + ((LogEvent) f).getTransferaccount() + ", " + ((LogEvent) f).getTransferamount() + "]"); }); }); } }); } private void nextProcess(String index, String json) { context.forward(index, json); context.commit(); } @Override public void close() {} }; } }
1728b0cf15a1acb6550f61bfc632d441876fa36d
b559d3acf1d499f85e5f300202e6ee5379dc6b3d
/zxing-android-embedded/src/com/journeyapps/barcodescanner/CaptureManager.java
ca2419c26f6a273a5021c7b9feecc8ec74033d58
[ "MIT" ]
permissive
wangwenwang/SXJF_android
099b27d21d521ba35e83e58ecedf147b3ec24d17
c574dbb3650cb26c0be449c453ae09a673bebbd5
refs/heads/master
2022-12-09T14:54:05.954018
2020-09-02T06:39:43
2020-09-02T06:39:43
284,453,031
1
0
null
null
null
null
UTF-8
Java
false
false
16,594
java
package com.journeyapps.barcodescanner; import android.Manifest; import android.annotation.TargetApi; import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; import android.content.pm.ActivityInfo; import android.content.pm.PackageManager; import android.content.res.Configuration; import android.graphics.Bitmap; import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.support.v4.app.ActivityCompat; import android.support.v4.content.ContextCompat; import android.util.Log; import android.view.Display; import android.view.Surface; import android.view.Window; import android.view.WindowManager; import com.google.zxing.ResultMetadataType; import com.google.zxing.ResultPoint; import com.google.zxing.client.android.BeepManager; import com.google.zxing.client.android.InactivityTimer; import com.google.zxing.client.android.Intents; import com.google.zxing.client.android.R; import com.google.zxing.integration.android.IntentIntegrator; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.util.List; import java.util.Map; /** * Manages barcode scanning for a CaptureActivity. This class may be used to have a custom Activity * (e.g. with a customized look and feel, or a different superclass), but not the barcode scanning * process itself. * * This is intended for an Activity that is dedicated to capturing a single barcode and returning * it via setResult(). For other use cases, use DefaultBarcodeScannerView or BarcodeView directly. * * The following is managed by this class: * - Orientation lock * - InactivityTimer * - BeepManager * - Initializing from an Intent (via IntentIntegrator) * - Setting the result and finishing the Activity when a barcode is scanned * - Displaying camera errors */ public class CaptureManager { private static final String TAG = CaptureManager.class.getSimpleName(); private static int cameraPermissionReqCode = 250; private Activity activity; private DecoratedBarcodeView barcodeView; private int orientationLock = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; private static final String SAVED_ORIENTATION_LOCK = "SAVED_ORIENTATION_LOCK"; private boolean returnBarcodeImagePath = false; private boolean destroyed = false; private InactivityTimer inactivityTimer; private BeepManager beepManager; private Handler handler; private boolean finishWhenClosed = false; public boolean is_Continuous_Scan = true; private BarcodeCallback callback = new BarcodeCallback() { @Override public void barcodeResult(final BarcodeResult result) { barcodeView.pause(); beepManager.playBeepSoundAndVibrate(); handler.post(new Runnable() { @Override public void run() { returnResult(result); } }); } @Override public void possibleResultPoints(List<ResultPoint> resultPoints) { } }; private final CameraPreview.StateListener stateListener = new CameraPreview.StateListener() { @Override public void previewSized() { } @Override public void previewStarted() { } @Override public void previewStopped() { } @Override public void cameraError(Exception error) { displayFrameworkBugMessageAndExit(); } @Override public void cameraClosed() { if(finishWhenClosed) { Log.d(TAG, "Camera closed; finishing activity"); finish(); } } }; public CaptureManager(Activity activity, DecoratedBarcodeView barcodeView) { this.activity = activity; this.barcodeView = barcodeView; barcodeView.getBarcodeView().addStateListener(stateListener); handler = new Handler(); inactivityTimer = new InactivityTimer(activity, new Runnable() { @Override public void run() { Log.d(TAG, "Finishing due to inactivity"); finish(); } }); beepManager = new BeepManager(activity); } /** * Perform initialization, according to preferences set in the intent. * * @param intent the intent containing the scanning preferences * @param savedInstanceState saved state, containing orientation lock */ public void initializeFromIntent(Intent intent, Bundle savedInstanceState) { Window window = activity.getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); if (savedInstanceState != null) { // If the screen was locked and unlocked again, we may start in a different orientation // (even one not allowed by the manifest). In this case we restore the orientation we were // previously locked to. this.orientationLock = savedInstanceState.getInt(SAVED_ORIENTATION_LOCK, ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); } if(intent != null) { // Only lock the orientation if it's not locked to something else yet boolean orientationLocked = intent.getBooleanExtra(Intents.Scan.ORIENTATION_LOCKED, true); if (orientationLocked) { lockOrientation(); } if (Intents.Scan.ACTION.equals(intent.getAction())) { barcodeView.initializeFromIntent(intent); } if (!intent.getBooleanExtra(Intents.Scan.BEEP_ENABLED, true)) { beepManager.setBeepEnabled(false); } if (intent.hasExtra(Intents.Scan.TIMEOUT)) { Runnable runnable = new Runnable() { @Override public void run() { returnResultTimeout(); } }; handler.postDelayed(runnable, intent.getLongExtra(Intents.Scan.TIMEOUT, 0L)); } if (Intents.Scan.ACTION.equals(intent.getAction())) { boolean continuous_scan = intent.getBooleanExtra(Intents.Scan.IS_CONTINUOUS_SCAN, true); is_Continuous_Scan = continuous_scan; } if (intent.getBooleanExtra(Intents.Scan.BARCODE_IMAGE_ENABLED, false)) { returnBarcodeImagePath = true; } } } /** * Lock display to current orientation. */ protected void lockOrientation() { // Only get the orientation if it's not locked to one yet. if (this.orientationLock == ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) { // Adapted from http://stackoverflow.com/a/14565436 Display display = activity.getWindowManager().getDefaultDisplay(); int rotation = display.getRotation(); int baseOrientation = activity.getResources().getConfiguration().orientation; int orientation = 0; if (baseOrientation == Configuration.ORIENTATION_LANDSCAPE) { if (rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_90) { orientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; } else { orientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE; } } else if (baseOrientation == Configuration.ORIENTATION_PORTRAIT) { if (rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_270) { orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; } else { orientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT; } } this.orientationLock = orientation; } //noinspection ResourceType activity.setRequestedOrientation(this.orientationLock); } /** * Start decoding. */ public void decode() { barcodeView.decodeSingle(callback); } /** * Call from Activity#onResume(). */ public void onResume() { if(Build.VERSION.SDK_INT >= 23) { openCameraWithPermission(); } else { barcodeView.resume(); } inactivityTimer.start(); } private boolean askedPermission = false; @TargetApi(23) private void openCameraWithPermission() { if (ContextCompat.checkSelfPermission(this.activity, Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED) { barcodeView.resume(); } else if(!askedPermission) { ActivityCompat.requestPermissions(this.activity, new String[]{Manifest.permission.CAMERA}, cameraPermissionReqCode); askedPermission = true; } else { // Wait for permission result } } /** * Call from Activity#onRequestPermissionsResult * @param requestCode The request code passed in {@link android.support.v4.app.ActivityCompat#requestPermissions(Activity, String[], int)}. * @param permissions The requested permissions. * @param grantResults The grant results for the corresponding permissions * which is either {@link android.content.pm.PackageManager#PERMISSION_GRANTED} * or {@link android.content.pm.PackageManager#PERMISSION_DENIED}. Never null. */ public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) { if(requestCode == cameraPermissionReqCode) { if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { // permission was granted barcodeView.resume(); } else { // TODO: display better error message. displayFrameworkBugMessageAndExit(); } } } /** * Call from Activity#onPause(). */ public void onPause() { inactivityTimer.cancel(); barcodeView.pauseAndWait(); } /** * Call from Activity#onDestroy(). */ public void onDestroy() { destroyed = true; inactivityTimer.cancel(); handler.removeCallbacksAndMessages(null); } /** * Call from Activity#onSaveInstanceState(). */ public void onSaveInstanceState(Bundle outState) { outState.putInt(SAVED_ORIENTATION_LOCK, this.orientationLock); } /** * Create a intent to return as the Activity result. * * @param rawResult the BarcodeResult, must not be null. * @param barcodeImagePath a path to an exported file of the Barcode Image, can be null. * @return the Intent */ public static Intent resultIntent(BarcodeResult rawResult, String barcodeImagePath) { Intent intent = new Intent(Intents.Scan.ACTION); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); intent.putExtra(Intents.Scan.RESULT, rawResult.toString()); intent.putExtra(Intents.Scan.RESULT_FORMAT, rawResult.getBarcodeFormat().toString()); byte[] rawBytes = rawResult.getRawBytes(); if (rawBytes != null && rawBytes.length > 0) { intent.putExtra(Intents.Scan.RESULT_BYTES, rawBytes); } Map<ResultMetadataType, ?> metadata = rawResult.getResultMetadata(); if (metadata != null) { if (metadata.containsKey(ResultMetadataType.UPC_EAN_EXTENSION)) { intent.putExtra(Intents.Scan.RESULT_UPC_EAN_EXTENSION, metadata.get(ResultMetadataType.UPC_EAN_EXTENSION).toString()); } Number orientation = (Number) metadata.get(ResultMetadataType.ORIENTATION); if (orientation != null) { intent.putExtra(Intents.Scan.RESULT_ORIENTATION, orientation.intValue()); } String ecLevel = (String) metadata.get(ResultMetadataType.ERROR_CORRECTION_LEVEL); if (ecLevel != null) { intent.putExtra(Intents.Scan.RESULT_ERROR_CORRECTION_LEVEL, ecLevel); } @SuppressWarnings("unchecked") Iterable<byte[]> byteSegments = (Iterable<byte[]>) metadata.get(ResultMetadataType.BYTE_SEGMENTS); if (byteSegments != null) { int i = 0; for (byte[] byteSegment : byteSegments) { intent.putExtra(Intents.Scan.RESULT_BYTE_SEGMENTS_PREFIX + i, byteSegment); i++; } } } if (barcodeImagePath != null) { intent.putExtra(Intents.Scan.RESULT_BARCODE_IMAGE_PATH, barcodeImagePath); } return intent; } /** * Save the barcode image to a temporary file stored in the application's cache, and return its path. * Only does so if returnBarcodeImagePath is enabled. * * @param rawResult the BarcodeResult, must not be null * @return the path or null */ private String getBarcodeImagePath(BarcodeResult rawResult) { String barcodeImagePath = null; if (returnBarcodeImagePath) { Bitmap bmp = rawResult.getBitmap(); try { File bitmapFile = File.createTempFile("barcodeimage", ".jpg", activity.getCacheDir()); FileOutputStream outputStream = new FileOutputStream(bitmapFile); bmp.compress(Bitmap.CompressFormat.JPEG, 100, outputStream); outputStream.close(); barcodeImagePath = bitmapFile.getAbsolutePath(); } catch (IOException e) { Log.w(TAG, "Unable to create temporary file and store bitmap! " + e); } } return barcodeImagePath; } private void finish() { activity.finish(); } protected void closeAndFinish() { if(barcodeView.getBarcodeView().isCameraClosed()) { // finish(); } else { finishWhenClosed = true; } barcodeView.pause(); inactivityTimer.cancel(); } protected void returnResultTimeout() { Intent intent = new Intent(Intents.Scan.ACTION); intent.putExtra(Intents.Scan.TIMEOUT, true); activity.setResult(Activity.RESULT_CANCELED, intent); closeAndFinish(); } public interface ResultCallBack { void callBack(int requestCode, int resultCode, Intent intent); } private ResultCallBack mResultCallBack; public void setResultCallBack(ResultCallBack resultCallBack) { this.mResultCallBack = resultCallBack; } protected void returnResult(BarcodeResult rawResult) { Intent intent = resultIntent(rawResult, getBarcodeImagePath(rawResult)); activity.setResult(Activity.RESULT_OK, intent); closeAndFinish(); if (barcodeView.getBarcodeView().isCameraClosed()) { if (null != mResultCallBack) { mResultCallBack.callBack(IntentIntegrator.REQUEST_CODE, Activity.RESULT_OK, intent); } // 不是连续扫码,扫码成功后返回 if(!is_Continuous_Scan){ activity.finish(); } } else { finishWhenClosed = true; } barcodeView.pause(); inactivityTimer.cancel(); } protected void displayFrameworkBugMessageAndExit() { if (activity.isFinishing() || this.destroyed || finishWhenClosed) { return; } AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setTitle(activity.getString(R.string.zxing_app_name)); builder.setMessage(activity.getString(R.string.zxing_msg_camera_framework_bug)); builder.setPositiveButton(R.string.zxing_button_ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { finish(); } }); builder.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { finish(); } }); builder.show(); } public static int getCameraPermissionReqCode() { return cameraPermissionReqCode; } public static void setCameraPermissionReqCode(int cameraPermissionReqCode) { CaptureManager.cameraPermissionReqCode = cameraPermissionReqCode; } }
48bc077bb3fd8d6e03209e3ca7adc933c7c5c870
43858a27da03e37e71165e1034aabce762ea87cf
/src/main/java/com/michonski/football/service/ModelMapper.java
f526bd910252f3132b5ae1ef105209fd27eb8fd9
[]
no_license
miles87/football
1027afc0157b24c67abfb219eed36047af0472fe
6d060d745742669ce38c3dd6b28117a927cc893b
refs/heads/master
2020-08-10T02:05:53.379169
2019-10-10T16:20:11
2019-10-10T16:20:11
214,230,175
0
0
null
null
null
null
UTF-8
Java
false
false
2,343
java
package com.michonski.football.service; import com.michonski.football.dto.PlayerDto; import com.michonski.football.dto.TeamDto; import com.michonski.football.dto.security.RegisterUser; import com.michonski.football.model.Player; import com.michonski.football.model.Team; import com.michonski.football.model.security.Role; import com.michonski.football.model.security.User; import java.util.HashSet; public interface ModelMapper { static TeamDto fromTeamToTeamDto(Team team) { return TeamDto.builder() .id(team.getId()) .name(team.getName()) .point(team.getPoint()) .rate(team.getRate()) .build(); } static Team fromTeamDtoToTeam(TeamDto teamDto){ return Team.builder() .id(teamDto.getId()) .name(teamDto.getName()) .point(teamDto.getPoint()) .rate(teamDto.getRate()) .players(new HashSet<>()) .build(); } static PlayerDto fromPlayerToPlayerDto(Player player) { return PlayerDto.builder() .id(player.getId()) .firstName(player.getFirstName()) .lastName(player.getLastName()) .birthDate(player.getBirthDate()) .number(player.getNumber()) .price(player.getPrice()) .teamDto(player.getTeam() == null ? null : fromTeamToTeamDto(player.getTeam())) .build(); } static Player fromPlayerDtoToPlayer(PlayerDto playerDto){ return Player.builder() .id(playerDto.getId()) .firstName(playerDto.getFirstName()) .lastName(playerDto.getLastName()) .birthDate(playerDto.getBirthDate()) .number(playerDto.getNumber()) .price(playerDto.getPrice()) .team(playerDto.getTeamDto() == null ? null : fromTeamDtoToTeam(playerDto.getTeamDto())) .build(); } static User fromRegisterUserToUser(RegisterUser registerUser) { return registerUser == null ? null : User.builder() .username(registerUser.getUsername()) .password(registerUser.getPassword()) .role(Role.ROLE_USER) .build(); } }
37c0189b358c19fc1da1902f1be39e17dbbd57b2
7a4e0dd2c311d636b4a4e020786790929c30085d
/BugBuster/app/src/main/java/jp/android/bugsbuster/Number.java
ff56b4c4bb7b296259644adefa46e8063a3760bd
[]
no_license
Reyurnible/BugBuster
439da0c3782b85eb253d95f4d04a9ecb1cd559bf
cfefd4ea103f6d854904f1f7d40f159241ffdba6
refs/heads/master
2020-12-07T15:19:08.521440
2015-01-14T07:59:53
2015-01-14T07:59:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,834
java
/** * �ԍ��̃e�L�X�g�N���X * @author WISITKARD WILASINEE * @data 2013/10/10 * @update 22013/10/10 8:00 * WISITKARD WILASINEE * �K���ɂ������ */ package jp.android.bugsbuster; import javax.microedition.khronos.opengles.GL10; import android.content.Context; import jp.android.bugsbuster.processing.PImage; public class Number { private static final float MAX_FRAME = 16.0f; private int max_num = 0; private PImage mNumPolygon[]; private int mPosX = 0; private int mPosY = 0; private int mWidth = 0; private int mHeight = 0; public Number(int digit) { mNumPolygon = new PImage[digit]; max_num = digit; for(int i=0; i<max_num;i++) { mNumPolygon[i] = new PImage(); }; setNumber(0); setPosition(0,0); } public void init(int value, int x, int y) { mPosX = x; mPosY = y; mWidth = 100; mHeight = 200; for(int i=0;i<max_num;i++) { mNumPolygon[i].init(0, 0, mWidth, mHeight); } setNumber(value); setPosition(x, y); } public void setNumber(int value) { float tile = 1/MAX_FRAME; int digit = 1; for(int i=max_num-1;i>=0;i--) { int num = ( value / digit) % 10; mNumPolygon[i].image.setTile(tile, 1, num*tile, 0); digit *= 10; } } public void setPosition(int x, int y) { mPosX = x; mPosY = y; int offset = (max_num/2)*mWidth; for(int i=0; i<max_num;i++) { mNumPolygon[i].setPosition(mPosX-offset+(i*mWidth), mPosY); } } public void update() { } public void draw(GL10 gl) { } public void loadTexture(GL10 gl, Context context, int id) { for(int i=0;i<max_num;i++) { mNumPolygon[i].loadTexture(gl, context, id); } } }
1130b49312a47abb454fa55418434c509bf829ae
897384ff380046d53c6f5aa1f2dc3b2e46b222fe
/jpa-domain/src/main/java/pt/jaybee/moldes/domain/proxies/UserProxy.java
4afd231be698425f652fd5387eb1c083e3df32c2
[]
no_license
rjvq85/moldes
ff9604cedf3dcfae5cd494567177b24504351b4b
9e2443b0872d8919811220bc77524ce68dbb959a
refs/heads/master
2021-01-10T05:17:47.359103
2016-02-01T10:16:35
2016-02-01T10:16:35
49,881,729
0
0
null
null
null
null
UTF-8
Java
false
false
1,024
java
package pt.jaybee.moldes.domain.proxies; import pt.jaybee.moldes.domain.awareness.EntityAware; import pt.jaybee.moldes.domain.entities.UserEntity; import pt.jaybee.moldes.service.facades.user.User; public class UserProxy implements EntityAware<UserEntity>, User { private UserEntity entity; @Override public UserEntity getEntity() { return entity; } @Override public void setEmail(String email) { entity.setEmail(email); } @Override public void setUsername(String username) { entity.setUsername(username); } @Override public void setPassword(String password) { entity.setPassword(password); } @Override public Integer getId() { return entity.getId(); } @Override public String getEmail() { return entity.getEmail(); } @Override public String getUsername() { return entity.getUsername(); } public String getPassword() { return entity.getPassword(); } }
cee19a6e998ac958f5576fa5ef0e97ea09bd2a49
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/2/2_981fc2dc0b734ce912f52663d7132adf5949843b/SuperSearch/2_981fc2dc0b734ce912f52663d7132adf5949843b_SuperSearch_s.java
1a817b693f40924f82837ac50141d6b369fa7d13
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
5,532
java
package org.lvlv.supersearch; import static android.provider.BaseColumns._ID; import static org.lvlv.supersearch.Constants.*; import android.app.Activity; import android.content.Intent; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.database.Cursor; import android.database.sqlite.SQLiteCursor; import android.database.sqlite.SQLiteDatabase; import android.net.Uri; import android.os.Bundle; import android.view.KeyEvent; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.view.View.OnKeyListener; import android.widget.AdapterView; import android.widget.Button; import android.widget.EditText; import android.widget.SimpleCursorAdapter; import android.widget.Spinner; import android.widget.AdapterView.OnItemSelectedListener; public class SuperSearch extends Activity implements OnClickListener,OnKeyListener, OnItemSelectedListener { private Button goButton; private Spinner location; private EditText inputText; private SearchesData searches; private SharedPreferences settings; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); goButton = (Button) findViewById(R.id.go_button); location = (Spinner) findViewById(R.id.search_location); inputText = (EditText) findViewById(R.id.search_input); goButton.setOnClickListener(this); location.setOnKeyListener(this); inputText.setOnKeyListener(this); location.setOnItemSelectedListener(this); searches = new SearchesData(this); SharedPreferences preferences = getSharedPreferences(PREFS_NAME, 0); if (true){ //!preferences.getBoolean(FIRST_RUN, true)) { this.startActivityForResult(new Intent(this, WizardActivity.class), REQUEST_EULA); } populateFields(); } @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); } @Override protected void onRestoreInstanceState(Bundle inState) { super.onRestoreInstanceState(inState); } @Override protected void onResume() { super.onResume(); } @Override protected void onStart() { super.onStart(); setupSearches(); } private void setupSearches() { try { Cursor cursor = getSearches(); String[] from = new String[] { Constants.NAME, Constants.URL }; int[] to = new int[] { R.id.name, R.id.url }; SimpleCursorAdapter adapter = new SimpleCursorAdapter(this, R.layout.spinnerrow, cursor, from, to ); adapter.setDropDownViewResource(R.layout.spinnerrow); location.setAdapter(adapter); } finally { searches.close(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); MenuItem help = menu.add(R.string.list_menu_help); help.setIcon(android.R.drawable.ic_menu_help); help.setIntent(new Intent(SuperSearch.this, HelpActivity.class)); MenuItem settings = menu.add(R.string.manage_label); settings.setIcon(android.R.drawable.ic_menu_preferences); settings.setIntent(new Intent(SuperSearch.this, ModifySearches.class)); return true; } public void onItemSelected(AdapterView<?> adapterView, View view, int arg2, long arg3) { populateFields(); } private void populateFields() { SQLiteCursor selection = (SQLiteCursor) location.getSelectedItem(); if (selection != null) { goButton.setText(selection.getString(3)); } } private void doSearch() { SQLiteCursor selection = (SQLiteCursor) location.getSelectedItem(); if (selection != null) { Uri uri = Uri.parse(selection.getString(2).replaceAll("%s", inputText.getText().toString())); Intent intent = new Intent(Intent.ACTION_VIEW, uri); startActivity(intent); } } public final static int REQUEST_EULA = 1; private static String[] FROM = { _ID, NAME, URL, TERM}; private static String ORDER_BY = NAME + " ASC" ; private Cursor getSearches() { SQLiteDatabase db = searches.getReadableDatabase(); Cursor cursor = db.query(TABLE_NAME, FROM, null, null, null, null, ORDER_BY); startManagingCursor(cursor); return cursor; } public void onClick(View v) { doSearch(); } public boolean onKey(View v, int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_ENTER) { doSearch(); return true; } return false; } public void onNothingSelected(AdapterView<?> arg0) { // TODO Auto-generated method stub } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { switch(requestCode) { case REQUEST_EULA: if(resultCode == Activity.RESULT_OK) { // yay they agreed, so store that info searches.addSearch("Answers.com", "http://answers.com/%s", "Search"); searches.addSearch("Google", "http://google.com/search?q=%s", "Search"); searches.addSearch("Wikipedia", "http://en.wikipedia.org/wiki/Special:Search?search=%s", "Search"); searches.addSearch("Merriam-Webster", "http://www.merriam-webster.com/dictionary/%s", "Define"); settings = getSharedPreferences(PREFS_NAME, 0); SharedPreferences.Editor editor = settings.edit(); editor.putBoolean(FIRST_RUN, false); editor.commit(); } else { // user didnt agree, so close this.finish(); } break; } } }
7a34663ff7f251d6e0d905f4c614a9e64e54d94e
8ec78e6ae1b611fd6e7d795fb0234f8c282d593e
/Engine-EJB/src/test/java/ru/simplgroupp/dao/impl/TestDebtDAO.java
cd1c607387c893f882082bb4710285e7d7d4d83c
[]
no_license
vo0doO/microcredit
96678f7afddd2899ea127281168202e36ee739c0
5d16e73674685d32196af33982d922ba0c9a8a59
refs/heads/master
2021-01-18T22:23:25.182233
2016-11-25T09:04:36
2016-11-25T09:04:36
87,050,783
0
2
null
2017-04-03T07:55:10
2017-04-03T07:55:10
null
UTF-8
Java
false
false
1,035
java
package ru.simplgroupp.dao.impl; import static org.junit.Assert.*; import java.util.Properties; import javax.ejb.EJB; import javax.ejb.embeddable.EJBContainer; import javax.naming.Context; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import ru.simplgroupp.dao.interfaces.DebtDao; import ru.simplgroupp.persistence.DebtEntity; import ru.simplgroupp.util.DatesUtils; public class TestDebtDAO { @EJB DebtDao debtDao; @Before public void setUp() throws Exception { System.setProperty("javax.xml.bind.JAXBContext","com.sun.xml.internal.bind.v2.ContextFactory"); final Properties p = new Properties(); p.load(this.getClass().getResourceAsStream("/test.properties")); final Context context = EJBContainer.createEJBContainer(p).getContext(); context.bind("inject", this); } @Test public void testFindDebt() { DebtEntity debt=debtDao.findDebt(13808, 13, new Double(202), 2, DatesUtils.makeDate(2014, 12, 5)); Assert.assertNotNull(debt); } }
619d0bc28ceee7c8fc3f109a8ee94cf3dda6b8de
d936c0ebcbeebfd0539f7eb3fa55f63f5203a271
/src/main/java/com/dani/course/entities/enums/OrderStatus.java
0037a0e3cc73d44d0d7439f154ac6f1d8526a5ca
[]
no_license
daniisantiago/ProjetoWebService-SpringBoot
e6180116486412345f8574786601a439fb75f6be
bb0005f517894054c9a6cd6db0aaf3e96736d647
refs/heads/master
2022-08-19T00:47:06.894582
2020-05-27T22:11:35
2020-05-27T22:11:35
263,469,261
0
0
null
null
null
null
UTF-8
Java
false
false
494
java
package com.dani.course.entities.enums; public enum OrderStatus { WAITING_PAYMENT(1), PAID(2), SHIPPED(3), DELIVERED(4), CANCELED(5); private int code; private OrderStatus(int code) { this.code = code; } public int getCode() { return code; } public static OrderStatus valueOf(int code) { for(OrderStatus value : OrderStatus.values()) { if(value.getCode() == code) { return value; } } throw new IllegalArgumentException("Invalid OrderStatus code"); } }
c9c995c46776fa0ee36ca20f1a542b93419b97ea
8d9293642d3c12f81cc5f930e0147a9d65bd6efb
/src/main/java/net/minecraft/client/resources/SkinManager.java
fcf40f1e9e30d8055a9670dd22cf09ec293f989c
[]
no_license
NicholasBlackburn1/Blackburn-1.17
7c086591ac77cf433af248435026cf9275223daa
fd960b995b33df75ce61865ba119274d9b0e4704
refs/heads/main
2022-07-28T03:27:14.736924
2021-09-23T15:55:53
2021-09-23T15:55:53
399,960,376
5
0
null
null
null
null
UTF-8
Java
false
false
6,050
java
package net.minecraft.client.resources; import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Iterables; import com.google.common.collect.Maps; import com.google.common.hash.Hashing; import com.mojang.authlib.GameProfile; import com.mojang.authlib.minecraft.InsecureTextureException; import com.mojang.authlib.minecraft.MinecraftProfileTexture; import com.mojang.authlib.minecraft.MinecraftSessionService; import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type; import com.mojang.authlib.properties.Property; import com.mojang.blaze3d.systems.RenderSystem; import java.io.File; import java.util.Map; import java.util.UUID; import java.util.concurrent.TimeUnit; import javax.annotation.Nullable; import net.minecraft.Util; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.texture.AbstractTexture; import net.minecraft.client.renderer.texture.HttpTexture; import net.minecraft.client.renderer.texture.MissingTextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @OnlyIn(Dist.CLIENT) public class SkinManager { public static final String PROPERTY_TEXTURES = "textures"; private final TextureManager textureManager; private final File skinsDirectory; private final MinecraftSessionService sessionService; private final LoadingCache<String, Map<Type, MinecraftProfileTexture>> insecureSkinCache; public SkinManager(TextureManager p_118812_, File p_118813_, final MinecraftSessionService p_118814_) { this.textureManager = p_118812_; this.skinsDirectory = p_118813_; this.sessionService = p_118814_; this.insecureSkinCache = CacheBuilder.newBuilder().expireAfterAccess(15L, TimeUnit.SECONDS).build(new CacheLoader<String, Map<Type, MinecraftProfileTexture>>() { public Map<Type, MinecraftProfileTexture> load(String p_118853_) { GameProfile gameprofile = new GameProfile((UUID)null, "dummy_mcdummyface"); gameprofile.getProperties().put("textures", new Property("textures", p_118853_, "")); try { return p_118814_.getTextures(gameprofile, false); } catch (Throwable throwable) { return ImmutableMap.of(); } } }); } public ResourceLocation registerTexture(MinecraftProfileTexture p_118826_, Type p_118827_) { return this.registerTexture(p_118826_, p_118827_, (SkinManager.SkinTextureCallback)null); } private ResourceLocation registerTexture(MinecraftProfileTexture p_118829_, Type p_118830_, @Nullable SkinManager.SkinTextureCallback p_118831_) { String s = Hashing.sha1().hashUnencodedChars(p_118829_.getHash()).toString(); ResourceLocation resourcelocation = new ResourceLocation("skins/" + s); AbstractTexture abstracttexture = this.textureManager.getTexture(resourcelocation, MissingTextureAtlasSprite.getTexture()); if (abstracttexture == MissingTextureAtlasSprite.getTexture()) { File file1 = new File(this.skinsDirectory, s.length() > 2 ? s.substring(0, 2) : "xx"); File file2 = new File(file1, s); HttpTexture httptexture = new HttpTexture(file2, p_118829_.getUrl(), DefaultPlayerSkin.getDefaultSkin(), p_118830_ == Type.SKIN, () -> { if (p_118831_ != null) { p_118831_.onSkinTextureAvailable(p_118830_, resourcelocation, p_118829_); } }); this.textureManager.register(resourcelocation, httptexture); } else if (p_118831_ != null) { p_118831_.onSkinTextureAvailable(p_118830_, resourcelocation, p_118829_); } return resourcelocation; } public void registerSkins(GameProfile p_118818_, SkinManager.SkinTextureCallback p_118819_, boolean p_118820_) { Runnable runnable = () -> { Map<Type, MinecraftProfileTexture> map = Maps.newHashMap(); try { map.putAll(this.sessionService.getTextures(p_118818_, p_118820_)); } catch (InsecureTextureException insecuretextureexception1) { } if (map.isEmpty()) { p_118818_.getProperties().clear(); if (p_118818_.getId().equals(Minecraft.getInstance().getUser().getGameProfile().getId())) { p_118818_.getProperties().putAll(Minecraft.getInstance().getProfileProperties()); map.putAll(this.sessionService.getTextures(p_118818_, false)); } else { this.sessionService.fillProfileProperties(p_118818_, p_118820_); try { map.putAll(this.sessionService.getTextures(p_118818_, p_118820_)); } catch (InsecureTextureException insecuretextureexception) { } } } Minecraft.getInstance().execute(() -> { RenderSystem.recordRenderCall(() -> { ImmutableList.of(Type.SKIN, Type.CAPE).forEach((p_174848_) -> { if (map.containsKey(p_174848_)) { this.registerTexture(map.get(p_174848_), p_174848_, p_118819_); } }); }); }); }; Util.backgroundExecutor().execute(runnable); } public Map<Type, MinecraftProfileTexture> getInsecureSkinInformation(GameProfile p_118816_) { Property property = Iterables.getFirst(p_118816_.getProperties().get("textures"), (Property)null); return (Map<Type, MinecraftProfileTexture>)(property == null ? ImmutableMap.of() : this.insecureSkinCache.getUnchecked(property.getValue())); } @OnlyIn(Dist.CLIENT) public interface SkinTextureCallback { void onSkinTextureAvailable(Type p_118857_, ResourceLocation p_118858_, MinecraftProfileTexture p_118859_); } }
c37bfa0a38c73c93a5ecf29531c50b8b09a8c963
a744882fb7cf18944bd6719408e5a9f2f0d6c0dd
/sourcecode8/src/java/security/cert/CertificateException.java
9b42ad750ebb81944f8cc71d98f082db53e73cd8
[ "Apache-2.0" ]
permissive
hanekawasann/learn
a39b8d17fd50fa8438baaa5b41fdbe8bd299ab33
eef678f1b8e14b7aab966e79a8b5a777cfc7ab14
refs/heads/master
2022-09-13T02:18:07.127489
2020-04-26T07:58:35
2020-04-26T07:58:35
176,686,231
0
0
Apache-2.0
2022-09-01T23:21:38
2019-03-20T08:16:05
Java
UTF-8
Java
false
false
3,297
java
/* * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package java.security.cert; import java.security.GeneralSecurityException; /** * This exception indicates one of a variety of certificate problems. * * @author Hemma Prafullchandra * @see Certificate */ public class CertificateException extends GeneralSecurityException { private static final long serialVersionUID = 3192535253797119798L; /** * Constructs a certificate exception with no detail message. A detail * message is a String that describes this particular exception. */ public CertificateException() { super(); } /** * Constructs a certificate exception with the given detail * message. A detail message is a String that describes this * particular exception. * * @param msg the detail message. */ public CertificateException(String msg) { super(msg); } /** * Creates a {@code CertificateException} with the specified * detail message and cause. * * @param message the detail message (which is saved for later retrieval * by the {@link #getMessage()} method). * @param cause the cause (which is saved for later retrieval by the * {@link #getCause()} method). (A {@code null} value is permitted, * and indicates that the cause is nonexistent or unknown.) * @since 1.5 */ public CertificateException(String message, Throwable cause) { super(message, cause); } /** * Creates a {@code CertificateException} with the specified cause * and a detail message of {@code (cause==null ? null : cause.toString())} * (which typically contains the class and detail message of * {@code cause}). * * @param cause the cause (which is saved for later retrieval by the * {@link #getCause()} method). (A {@code null} value is permitted, * and indicates that the cause is nonexistent or unknown.) * @since 1.5 */ public CertificateException(Throwable cause) { super(cause); } }
f78c0ee0eabe3f9ebe26f0d2b9d004a7480b2db8
9cf373a9fb092b51379d46b89316d3f868d9269b
/src/codeforces/div_2_273/A.java
6dd567f3879e2b112e10d30ebf251afa5d97d5d2
[]
no_license
v11yu/Acm
2fa8a5a859085a5a8e0a22e2380b805b6d566cb3
9f649d14c1c8ed455c96dea9e4933d093bd1c133
refs/heads/master
2021-01-19T16:51:53.491415
2015-08-12T07:44:44
2015-08-12T07:44:44
23,113,129
0
0
null
null
null
null
UTF-8
Java
false
false
361
java
package codeforces.div_2_273; import java.util.Scanner; public class A { public static void main(String[] args) { int num[] = new int[5]; Scanner cin = new Scanner(System.in); int sum = 0; for(int i=0;i<5;i++){ num[i] = cin.nextInt(); sum +=num[i]; } if(sum % 5 ==0 && sum!=0) System.out.println(sum/5); else System.out.println(-1); } }
a5c1780b64853b00e07e1c271ac82cb77f016176
a63336a87b465e41f8135a07c06f968c14aa48df
/km/com/hifiremote/jp1/RFVendorPanel.java
21913fdb6eaaf18ff760d3fda82ecf4c27a4e185
[]
no_license
nandub/RemoteMaster
e764b96dea04022e5fcea5fefc89afec985952e2
8c03cba91683fa0c96aa51c701f5322d03a300bc
refs/heads/master
2020-05-22T00:30:55.391028
2020-05-07T10:36:39
2020-05-07T10:36:39
186,172,683
1
0
null
null
null
null
UTF-8
Java
false
false
1,883
java
package com.hifiremote.jp1; import java.awt.BorderLayout; import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.JScrollPane; import com.hifiremote.jp1.JP1Table; import com.hifiremote.jp1.ProtocolDataPanel.DisplayArea; public class RFVendorPanel extends KMPanel implements ActionListener { public RFVendorPanel( DeviceUpgrade upgrade ) { super( "RF Vendor Data", upgrade ); setLayout( new BorderLayout() ); RFVendorTableModel vendorTableModel = new RFVendorTableModel(); vendorTable = new JP1Table( vendorTableModel ); vendorTable.initColumns(); JScrollPane scrollPane = new JScrollPane( vendorTable ); add( scrollPane, BorderLayout.CENTER ); setData( upgrade ); String msg = "NOTE: Vendor String and User String are not required to be text strings. Their " + "length in bytes is fixed but the bytes can have any hex value. For this reason " + "the only editable column in the table is the Hex Value column."; JPanel msgPanel = new JPanel( new BorderLayout() ); msgPanel.setBorder( BorderFactory.createCompoundBorder( BorderFactory.createLineBorder( Color.GRAY ), BorderFactory.createEmptyBorder( 5, 5, 5, 5 ) ) ); DisplayArea msgArea = new DisplayArea( msg, null ); msgPanel.add( msgArea, BorderLayout.CENTER ); add( msgPanel, BorderLayout.PAGE_END ); } public void setData( DeviceUpgrade upgrade ) { RFVendorTableModel model = ( RFVendorTableModel )vendorTable.getModel(); model.setDeviceUpgrade( upgrade ); model.fireTableDataChanged(); } @Override public void actionPerformed( ActionEvent arg0 ) { // TODO Auto-generated method stub } private JP1Table vendorTable = null; }
ab2643fa2dbf0f8a7ecc6a3a39a4dd49468843ff
bd9c8849bcb21ea33f5c88ba14b5703144551d02
/juc/src/main/java/com/cjean/zoo/juc/syn/TestWaitNotifyDemo09.java
36329691b0a7802bcc9f078156b3b2ca228c6e85
[]
no_license
cjeanGitHub/zoo
18743c0672a23ebe790c3401d33004c5716e821a
39d1a2437a66ecf3311fb4ca543c38d8e543ab2a
refs/heads/master
2022-12-16T04:17:22.012070
2020-09-17T10:04:05
2020-09-17T10:04:05
295,582,839
0
0
null
null
null
null
UTF-8
Java
false
false
2,478
java
package com.cjean.zoo.juc.syn; import java.util.ArrayList; import java.util.List; import java.util.concurrent.TimeUnit; public class TestWaitNotifyDemo09 { static volatile List<Object> objects = new ArrayList<>(); private static final Object o1 = new Object();//锁 public static void main(String[] args) { /** * 由于会有cpu时间片等问题,导致2个线程在读取集合大小时并不一定时非常及时的 */ // System.out.println(objects.size()); // final Object o1 = new Object(); // Object o2 = new Object(); // int[] size = {0}; new Thread(() -> { System.out.println("t2启动"); synchronized (o1) { if (4 != objects.size()) { try { System.out.println("t2启动..pre .wait"); o1.wait(); System.out.println("t2启动...wait"); } catch (InterruptedException e) { e.printStackTrace(); } } } try { TimeUnit.SECONDS.sleep(1); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("t2停止"); }, "t2").start(); new Thread(() -> { System.out.println("t1启动"); synchronized (o1) { for (int i = 0; i < 10; i++) { objects.add(new Object()); System.out.println("add: " + objects.size()); if (4 == i) { // 增加这个睡眠 解决 当 size = 5时,也解除了wait状态, // 但是t1继续追加元素,导致在t2线程中 if size始终不是4,再次wait的窘境 // try { // TimeUnit.SECONDS.sleep(1); // } catch (InterruptedException e) { // e.printStackTrace(); // } o1.notify(); try { TimeUnit.SECONDS.sleep(1); } catch (InterruptedException e) { e.printStackTrace(); } } } } System.out.println("t1停止"); }, "t1").start(); } }
80cce3b428fde7e698f348fa70e5467a30d92df5
ff2683777d02413e973ee6af2d71ac1a1cac92d3
/src/main/java/com/alipay/api/response/AlipayEcoEduKtBillingSendResponse.java
43dca31011d1772230ebae20975f3fbec7d58662
[ "Apache-2.0" ]
permissive
weizai118/alipay-sdk-java-all
c30407fec93e0b2e780b4870b3a71e9d7c55ed86
ec977bf06276e8b16c4b41e4c970caeaf21e100b
refs/heads/master
2020-05-31T21:01:16.495008
2019-05-28T13:14:39
2019-05-28T13:14:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
665
java
package com.alipay.api.response; import com.alipay.api.internal.mapping.ApiField; import com.alipay.api.AlipayResponse; /** * ALIPAY API: alipay.eco.edu.kt.billing.send response. * * @author auto create * @since 1.0, 2019-03-17 14:44:13 */ public class AlipayEcoEduKtBillingSendResponse extends AlipayResponse { private static final long serialVersionUID = 2448178369843275388L; /** * 支付宝-中小学-教育缴费的账单号 */ @ApiField("order_no") private String orderNo; public void setOrderNo(String orderNo) { this.orderNo = orderNo; } public String getOrderNo( ) { return this.orderNo; } }
5fe3af18d5685cf696781f7faa46d8db78d45417
ac0ec9cb3b93b742f9801ab1e9cb4f7a8ac063d4
/SubmissionServiceMaven/ClientDCIBridgeAPI/src/main/java/uk/ac/wmin/cpc/submission/clients/ClientDCIBridge.java
c5cb901ba3a9791669954b65ee63482eba81bf5d
[]
no_license
meilhab/SubmissionService
77cc96c1bbf472e4c293c6421d92d1de954060c3
362252504ec3706ae8730806b6543442844865cd
refs/heads/master
2021-01-25T04:02:32.237352
2014-09-09T10:22:36
2014-09-09T10:22:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,578
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package uk.ac.wmin.cpc.submission.clients; import java.net.MalformedURLException; import java.net.URL; import org.ggf.schemas.jsdl._2005._11.jsdl.JobDefinitionType; import uk.ac.wmin.cpc.submission.frontend.impl.ExecutionException; import uk.ac.wmin.cpc.submission.frontend.impl.FileManagementException; import uk.ac.wmin.cpc.submission.frontend.impl.IllegalParameterException; import uk.ac.wmin.cpc.submission.frontend.impl.RepositoryCommunicationException; import uk.ac.wmin.cpc.submission.frontend.impl.WSExecutionService; import uk.ac.wmin.cpc.submission.frontend.impl.WSExecutionService_Service; import uk.ac.wmin.cpc.submission.frontend.impl.WrongJSDLException; /** * * @author Benoit Meilhac <[email protected]> */ public class ClientDCIBridge { private static final String WSDL_LOCATION = "WSExecutionService?wsdl"; // private static final String CERTIFICATE_LOCATION = // "/certificates/certificate_submission_test_cloud"; private String urlSubmissionService; private String urlRepository; public ClientDCIBridge() { this.urlSubmissionService = null; this.urlRepository = null; } public ClientDCIBridge(String urlSubmissionService, String urlRepository) { this.urlSubmissionService = urlSubmissionService; this.urlRepository = urlRepository; } public String getUrlSubmissionService() { return urlSubmissionService; } public void setUrlSubmissionService(String urlSubmissionService) { this.urlSubmissionService = urlSubmissionService; } public String getUrlRepository() { return urlRepository; } public void setUrlRepository(String urlRepository) { this.urlRepository = urlRepository; } private WSExecutionService callSubmissionService() throws MalformedURLException, IllegalParameterException { // URL certURL = ClientDCIBridge.class.getResource(CERTIFICATE_LOCATION); // // if (certURL == null) { // throw new IllegalParameterException( // "Keystore for the submission service not found", null); // } // // if (urlSubmissionService == null) { // throw new IllegalParameterException( // "URL of the submission service not set up", null); // } // // System.setProperty("javax.net.ssl.trustStore", certURL.getPath()); // System.setProperty("javax.net.ssl.trustStorePassword", "changeit"); URL urlService = new URL((urlSubmissionService.endsWith("/") ? urlSubmissionService : urlSubmissionService + "/") + WSDL_LOCATION); WSExecutionService_Service service = new WSExecutionService_Service(urlService); return service.getWSExecutionService(); } public JobDefinitionType modifyJSDLFile(JobDefinitionType jsdl) throws FileManagementException, IllegalParameterException, MalformedURLException, RepositoryCommunicationException, WrongJSDLException { return callSubmissionService().modifyJSDLFile(urlRepository, jsdl); } public String submitToDciBridge(String dciBridgeLocation, JobDefinitionType jsdl) throws ExecutionException, FileManagementException, IllegalParameterException, MalformedURLException, RepositoryCommunicationException, WrongJSDLException { return callSubmissionService().submitToDciBridge(dciBridgeLocation, jsdl); } }
052a52d41ab4679e8542f2902f7d033503633a82
9f38bedf3a3365fdd8b78395930979a41330afc8
/branches/tycho/cns/edu.iu.cns.database.load.framework/src/edu/iu/cns/database/load/framework/Entity.java
1d3144e2d677c69135b3be9aab3fc03d550ed1c9
[]
no_license
project-renard-survey/nwb
6a6ca10abb1e65163374d251be088e033bf3c6e0
612f215ac032e14669b3e8f75bc13ac0d4eda9dc
refs/heads/master
2020-04-01T16:11:01.156528
2015-08-03T18:30:34
2015-08-03T18:30:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,354
java
package edu.iu.cns.database.load.framework; import java.util.Dictionary; import java.util.List; import org.cishell.utilities.StringUtilities; import edu.iu.cns.database.load.framework.utilities.DatabaseTableKeyGenerator; public abstract class Entity<T extends Entity<?>> extends RowItem<T> { private int primaryKey; public Entity(DatabaseTableKeyGenerator keyGenerator, Dictionary<String, Object> attributes) { super(attributes); this.primaryKey = keyGenerator.getNextKey(); getAttributes().put(Schema.PRIMARY_KEY, this.primaryKey); } public final int getPrimaryKey() { return this.primaryKey; } public abstract Object createMergeKey(); /** * merge assumes that shouldMerge(otherAddress) would return true. */ public abstract void merge(T otherItem); /// Side-effects mergeKey. protected static void addStringOrAlternativeToMergeKey( List<Object> mergeKey, String string, Object alternative) { mergeKey.add(StringUtilities.alternativeIfNotNull_Empty_OrWhitespace(string, alternative)); } /// Side-effects mergeKey. protected static void addCaseInsensitiveStringOrAlternativeToMergeKey( List<Object> mergeKey, String string, Object alternative) { mergeKey.add(StringUtilities.alternativeIfNotNull_Empty_OrWhitespace_IgnoreCase( string, alternative)); } }
dc8bfef6cc0514a3fd738f02dc4bd8f9d3d1f3b4
939bc9b579671de84fb6b5bd047db57b3d186aca
/jdk.jfr/jdk/jfr/internal/JVM.java
405e3967ed593a6d80b98260fdb43fe58e5208b1
[]
no_license
lc274534565/jdk11-rm
509702ceacfe54deca4f688b389d836eb5021a17
1658e7d9e173f34313d2e5766f4f7feef67736e8
refs/heads/main
2023-01-24T07:11:16.084577
2020-11-16T14:21:37
2020-11-16T14:21:37
313,315,578
1
1
null
null
null
null
UTF-8
Java
false
false
14,108
java
/* * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * * * */ package jdk.jfr.internal; import java.io.IOException; import java.util.List; import jdk.internal.HotSpotIntrinsicCandidate; import jdk.jfr.Event; /** * Interface against the JVM. * */ public final class JVM { private static final JVM jvm = new JVM(); // JVM signals file changes by doing Object#notifu on this object static final Object FILE_DELTA_CHANGE = new Object(); static final long RESERVED_CLASS_ID_LIMIT = 400; private volatile boolean recording; private volatile boolean nativeOK; private static native void registerNatives(); static { registerNatives(); for (LogTag tag : LogTag.values()) { subscribeLogLevel(tag, tag.id); } Options.ensureInitialized(); } /** * Get the one and only JVM. * * @return the JVM */ public static JVM getJVM() { return jvm; } private JVM() { } /** * Begin recording events * * Requires that JFR has been started with {@link #createNativeJFR()} */ public native void beginRecording(); /** * Return ticks * * @return the time, in ticks * */ @HotSpotIntrinsicCandidate public static native long counterTime(); /** * Emits native periodic event. * * @param eventTypeId type id * * @param timestamp commit time for event * @param when when it is being done {@link Periodic.When} * * @return true if the event was committed */ public native boolean emitEvent(long eventTypeId, long timestamp, long when); /** * End recording events, which includes flushing data in thread buffers * * Requires that JFR has been started with {@link #createNativeJFR()} * */ public native void endRecording(); /** * Return a list of all classes deriving from {@link Event} * * @return list of event classes. */ public native List<Class<? extends Event>> getAllEventClasses(); /** * Return a count of the number of unloaded classes deriving from {@link Event} * * @return number of unloaded event classes. */ public native long getUnloadedEventClassCount(); /** * Return a unique identifier for a class. The class is marked as being * "in use" in JFR. * * @param clazz clazz * * @return a unique class identifier */ @HotSpotIntrinsicCandidate public static native long getClassId(Class<?> clazz); // temporary workaround until we solve intrinsics supporting epoch shift tagging public static native long getClassIdNonIntrinsic(Class<?> clazz); /** * Return process identifier. * * @return process identifier */ public native String getPid(); /** * Return unique identifier for stack trace. * * Requires that JFR has been started with {@link #createNativeJFR()} * * @param skipCount number of frames to skip * @return a unique stack trace identifier */ public native long getStackTraceId(int skipCount); /** * Return identifier for thread * * @param t thread * @return a unique thread identifier */ public native long getThreadId(Thread t); /** * Frequency, ticks per second * * @return frequency */ public native long getTicksFrequency(); /** * Write message to log. Should swallow null or empty message, and be able * to handle any Java character and not crash with very large message * * @param tagSetId the tagset id * @param level on level * @param message log message * */ public static native void log(int tagSetId, int level, String message); /** * Subscribe to LogLevel updates for LogTag * * @param lt the log tag to subscribe * @param tagSetId the tagset id */ public static native void subscribeLogLevel(LogTag lt, int tagSetId); /** * Call to invoke event tagging and retransformation of the passed classes * * @param classes */ public native synchronized void retransformClasses(Class<?>[] classes); /** * Enable event * * @param eventTypeId event type id * * @param enabled enable event */ public native void setEnabled(long eventTypeId, boolean enabled); /** * Interval at which the JVM should notify on {@link #FILE_DELTA_CHANGE} * * @param delta number of bytes, reset after file rotation */ public native void setFileNotification(long delta); /** * Set the number of global buffers to use * * @param count * * @throws IllegalArgumentException if count is not within a valid range * @throws IllegalStateException if value can't be changed */ public native void setGlobalBufferCount(long count) throws IllegalArgumentException, IllegalStateException; /** * Set size of a global buffer * * @param size * * @throws IllegalArgumentException if buffer size is not within a valid * range */ public native void setGlobalBufferSize(long size) throws IllegalArgumentException; /** * Set overall memory size * * @param size * * @throws IllegalArgumentException if memory size is not within a valid * range */ public native void setMemorySize(long size) throws IllegalArgumentException; /** /** * Set interval for method samples, in milliseconds. * * Setting interval to 0 turns off the method sampler. * * @param intervalMillis the sampling interval */ public native void setMethodSamplingInterval(long type, long intervalMillis); /** * Sets the file where data should be written. * * Requires that JFR has been started with {@link #createNativeJFR()} * * <pre> * Recording Previous Current Action * ============================================== * true null null Ignore, keep recording in-memory * true null file1 Start disk recording * true file null Copy out metadata to disk and continue in-memory recording * true file1 file2 Copy out metadata and start with new File (file2) * false * null Ignore, but start recording to memory with {@link #beginRecording()} * false * file Ignore, but start recording to disk with {@link #beginRecording()} * * </pre> * * recording can be set to true/false with {@link #beginRecording()} * {@link #endRecording()} * * @param file the file where data should be written, or null if it should * not be copied out (in memory). * * @throws IOException */ public native void setOutput(String file); /** * Controls if a class deriving from jdk.jfr.Event should * always be instrumented on class load. * * @param force, true to force initialization, false otherwise */ public native void setForceInstrumentation(boolean force); /** * Turn on/off thread sampling. * * @param sampleThreads true if threads should be sampled, false otherwise. * * @throws IllegalStateException if state can't be changed. */ public native void setSampleThreads(boolean sampleThreads) throws IllegalStateException; /** * Turn on/off compressed integers. * * @param compressed true if compressed integers should be used, false * otherwise. * * @throws IllegalStateException if state can't be changed. */ public native void setCompressedIntegers(boolean compressed) throws IllegalStateException; /** * Set stack depth. * * @param depth * * @throws IllegalArgumentException if not within a valid range * @throws IllegalStateException if depth can't be changed */ public native void setStackDepth(int depth) throws IllegalArgumentException, IllegalStateException; /** * Turn on stack trace for an event * * @param eventTypeId the event id * * @param enabled if stack traces should be enabled */ public native void setStackTraceEnabled(long eventTypeId, boolean enabled); /** * Set thread buffer size. * * @param size * * @throws IllegalArgumentException if size is not within a valid range * @throws IllegalStateException if size can't be changed */ public native void setThreadBufferSize(long size) throws IllegalArgumentException, IllegalStateException; /** * Set threshold for event, * * Long.MAXIMUM_VALUE = no limit * * @param eventTypeId the id of the event type * @param ticks threshold in ticks, * @return true, if it could be set */ public native boolean setThreshold(long eventTypeId, long ticks); /** * Store the metadata descriptor that is to be written at the end of a * chunk, data should be written after GMT offset and size of metadata event * should be adjusted * * Requires that JFR has been started with {@link #createNativeJFR()} * * @param bytes binary representation of metadata descriptor * * @param binary representation of descriptor */ public native void storeMetadataDescriptor(byte[] bytes); public void endRecording_() { endRecording(); recording = false; } public void beginRecording_() { beginRecording(); recording = true; } public boolean isRecording() { return recording; } /** * If the JVM supports JVM TI and retransformation has not been disabled this * method will return true. This flag can not change during the lifetime of * the JVM. * * @return if transform is allowed */ public native boolean getAllowedToDoEventRetransforms(); /** * Set up native resources, data structures, threads etc. for JFR * * @param simulateFailure simulate a initialization failure and rollback in * native, used for testing purposes * * @throws IllegalStateException if native part of JFR could not be created. * */ private native boolean createJFR(boolean simulateFailure) throws IllegalStateException; /** * Destroys native part of JFR. If already destroy, call is ignored. * * Requires that JFR has been started with {@link #createNativeJFR()} * * @return if an instance was actually destroyed. * */ private native boolean destroyJFR(); public boolean createFailedNativeJFR() throws IllegalStateException { return createJFR(true); } public void createNativeJFR() { nativeOK = createJFR(false); } public boolean destroyNativeJFR() { boolean result = destroyJFR(); nativeOK = !result; return result; } public boolean hasNativeJFR() { return nativeOK; } /** * Cheap test to check if JFR functionality is available. * * @return */ public native boolean isAvailable(); /** * To convert ticks to wall clock time. */ public native double getTimeConversionFactor(); /** * Return a unique identifier for a class. Compared to {@link #getClassId()} * , this method does not tag the class as being "in-use". * * @param clazz class * * @return a unique class identifier */ public native long getTypeId(Class<?> clazz); /** * Fast path fetching the EventWriter using VM intrinsics * * @return thread local EventWriter */ @HotSpotIntrinsicCandidate public static native Object getEventWriter(); /** * Create a new EventWriter * * @return thread local EventWriter */ public static native EventWriter newEventWriter(); /** * Flushes the EventWriter for this thread. */ public static native boolean flush(EventWriter writer, int uncommittedSize, int requestedSize); /** * Sets the location of the disk repository, to be used at an emergency * dump. * * @param dirText */ public native void setRepositoryLocation(String dirText); /** * Access to VM termination support. * *@param errorMsg descriptive message to be include in VM termination sequence */ public native void abort(String errorMsg); /** * Adds a string to the string constant pool. * * If the same string is added twice, two entries will be created. * * @param id identifier associated with the string, not negative * * @param s string constant to be added, not null * * @return the current epoch of this insertion attempt */ public static native boolean addStringConstant(boolean epoch, long id, String s); /** * Gets the address of the jboolean epoch. * * The epoch alternates every checkpoint. * * @return The address of the jboolean. */ public native long getEpochAddress(); public native void uncaughtException(Thread thread, Throwable t); /** * Sets cutoff for event. * * Determines how long the event should be allowed to run. * * Long.MAXIMUM_VALUE = no limit * * @param eventTypeId the id of the event type * @param cutoffTicks cutoff in ticks, * @return true, if it could be set */ public native boolean setCutoff(long eventTypeId, long cutoffTicks); /** * Emit old object sample events. * * @param cutoff the cutoff in ticks * @param emitAll emit all samples in old object queue */ public native void emitOldObjectSamples(long cutoff, boolean emitAll); }
7b77c10406fda756bd3d2fd06e0c4452c258cd01
707434f922bc5ffc6a9220da1e784703ffc36fc3
/数据展示/ssyjsdata/src/main/java/com/yjs/service/KmService.java
80c76378936944c7b9d418c4d3f79abfad5e4116
[]
no_license
WildSepDaisy/ssyjs
e48a9c36242e1821df94ef2a3bba602bf06f5c4b
11a2c951cc3a4613fa569f4b944cc6dce216f4d9
refs/heads/main
2023-02-13T00:50:41.965785
2021-01-06T01:03:53
2021-01-06T01:03:53
327,157,261
2
0
null
null
null
null
UTF-8
Java
false
false
212
java
package com.yjs.service; import com.yjs.bean.Zws; import java.util.List; public interface KmService { public List<Zws> getKm1List(); public List<Zws> getKm2List(); public List<Zws> getKm3List(); }
e715e6fc78969800b0ab09b30254b9719fd97701
0cba8bfc572bccfdb83cf7ebbbd696979f6d4e10
/src/main/java/br/com/starterpack/resource/TaskResource.java
46f00f2cc09e4205c502f40b6f1a76fae35fd76c
[]
no_license
alexvingg/starterpack
ef62275c80e073cc76b41d85fa53a36834b076b4
d6a88359ac85372ab53a243ba0c2754195317b8a
refs/heads/master
2022-11-04T23:01:13.445291
2020-06-20T15:05:30
2020-06-20T15:05:30
264,770,824
0
0
null
null
null
null
UTF-8
Java
false
false
1,378
java
package br.com.starterpack.resource; import br.com.starterpack.core.resource.AbstractCrudResource; import br.com.starterpack.core.resource.ICrudResource; import br.com.starterpack.entity.Task; import br.com.starterpack.service.TaskService; import br.com.starterpack.core.response.Response; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.context.request.async.DeferredResult; @RestController @RequestMapping(value = "/api/v1/tasks") public class TaskResource extends AbstractCrudResource<Task, TaskService, String> { @Autowired private TaskService taskService; @Override public TaskService getService() { return this.taskService; } @RequestMapping(value = "/toggleDone", method = RequestMethod.PUT) public DeferredResult<ResponseEntity<Response>> toggleDone(@RequestBody Task task) { final DeferredResult<ResponseEntity<Response>> dr = new DeferredResult<>(); this.getService().toogleDone(task); dr.setResult(ResponseEntity.ok(Response.ok())); return dr; } }
1d812e5f0ab0b01ffc177614489ed37acf8306cd
1a42b56c1e2d66dbedd2cbd9c88104ae511fe409
/Backend/src/main/java/com/rush/Gcart/model/Product.java
fa3bf5b0088e3773e0eb29c69be909dfd2a7772a
[]
no_license
susmitha1mohan/Gcart
751f6dcb89e610e7dc4ec951e4b97b437e2c53d2
6b939c06442cb9daff12c7cc3715bade8fae4850
refs/heads/master
2020-04-27T15:51:29.144588
2019-03-09T09:20:58
2019-03-09T09:20:58
174,462,958
0
0
null
null
null
null
UTF-8
Java
false
false
2,812
java
package com.rush.Gcart.model; import java.util.UUID; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Transient; import javax.validation.constraints.Min; import org.springframework.web.multipart.MultipartFile; import com.fasterxml.jackson.annotation.JsonIgnore; @Entity public class Product { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private int id; private String code; private String name; private String brand; @JsonIgnore private String description; @Column(name="unit_price") @Min(value = 1, message = "Minimum price should be 1") private int unitPrice; private int quantity; @Column(name="is_active") private boolean active; @JsonIgnore @Column(name="category_id") private int categoryID; @JsonIgnore @Column(name="supplier_id") private int supplierID; private int purchases; private int views; @Transient private MultipartFile file; public MultipartFile getFile() { return file; } public void setFile(MultipartFile file) { this.file = file; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getBrand() { return brand; } public void setBrand(String brand) { this.brand = brand; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public int getUnitPrice() { return unitPrice; } public void setUnitPrice(int unitPrice) { this.unitPrice = unitPrice; } public int getQuantity() { return quantity; } public void setQuantity(int quantity) { this.quantity = quantity; } public boolean isActive() { return active; } public void setActive(boolean active) { this.active = active; } public int getCategoryID() { return categoryID; } public void setCategoryID(int categoryID) { this.categoryID = categoryID; } public int getSupplierID() { return supplierID; } public void setSupplierID(int supplierID) { this.supplierID = supplierID; } public int getPurchases() { return purchases; } public void setPurchases(int purchases) { this.purchases = purchases; } public int getViews() { return views; } public void setViews(int views) { this.views = views; } public Product() { this.code = "PRD" + UUID.randomUUID().toString().substring(26).toUpperCase(); } }
[ "Admin@DESKTOP-8KOFJHK" ]
Admin@DESKTOP-8KOFJHK
66cd61aff931df04a22c453190bccc18418c1168
c3d58380072b8c20b19ceb4ec9436e92dba65f89
/src/customException/GrammarNotFoundException.java
7c544831f7d48deb4ce8d17a82b75b4820cdc355
[]
no_license
gomezLF/CYK-algorithm-implementation
6be31434fd011097f0f5617c17bad68d7fbd86fd
9662533552e32fbc563998e1dd30a0c073dc8cb7
refs/heads/master
2023-01-12T07:05:35.099201
2020-11-20T00:57:25
2020-11-20T00:57:25
313,107,095
0
1
null
null
null
null
UTF-8
Java
false
false
521
java
package customException; import javafx.scene.control.Alert; import javafx.scene.control.ButtonType; public class GrammarNotFoundException extends Exception{ public GrammarNotFoundException() { super("Para ejecutar el algoritmo CYK, debe ingresar una GIC en FNC y no dejar campos sin llenar"); } public void message(){ Alert alert = new Alert(Alert.AlertType.WARNING, "", ButtonType.CLOSE); alert.setHeaderText(super.getMessage()); alert.show(); } }
6e9d8c45093b6f5942a43545ab4ec89dacaab805
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/5/5_b438289a4ddcc5cd2e0e8eab8edf4afdae2d71b0/INodeFactory/5_b438289a4ddcc5cd2e0e8eab8edf4afdae2d71b0_INodeFactory_t.java
8aaa7619cbeaf828b8faa2463aab10e4144a071e
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
8,667
java
/******************************************************************************* * Copyright (c) 2006, 2009 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.cdt.core.dom.ast; import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator; import org.eclipse.cdt.core.dom.ast.gnu.IGNUASTCompoundStatementExpression; import org.eclipse.cdt.core.parser.IScanner; import org.eclipse.cdt.core.parser.IToken; /** * Factory for creating AST nodes. This interface contains factory methods * for nodes that are available for both C and C++. * * Extending interfaces should use covariant return types where appropriate to * allow the construction of language-specific versions of certain nodes. * * Most methods accept child nodes as parameters when constructing a new node. * For convenience it is always allowed to pass null for any of these parameters. * In this case the newly constructed node may be initialized using its * set() and add() methods instead. * * Nodes created by this factory are not frozen, i.e. for any node created by this * factory the following holds <code> node.isFrozen() == false </code>. * * None of the factory methods should return null. * * @author Mike Kucera * @since 5.1 * @noextend This interface is not intended to be extended by clients. * @noimplement This interface is not intended to be implemented by clients. */ public interface INodeFactory { /** * Creates a "dummy" name using an empty char array. */ public IASTName newName(); public IASTName newName(char[] name); /** * @deprecated use {@link #newTranslationUnit(IScanner)}, instead. */ @Deprecated public IASTTranslationUnit newTranslationUnit(); /** * Creates a new translation unit that cooperates with the given scanner in order * to track macro-expansions and location information. * @param scanner the preprocessor the translation unit interacts with. * @since 5.2 */ public IASTTranslationUnit newTranslationUnit(IScanner scanner); public IASTLiteralExpression newLiteralExpression(int kind, String rep); public IASTUnaryExpression newUnaryExpression(int operator, IASTExpression operand); public IASTIdExpression newIdExpression(IASTName name); public IASTArraySubscriptExpression newArraySubscriptExpression(IASTExpression arrayExpr, IASTExpression subscript); public IASTFunctionCallExpression newFunctionCallExpression(IASTExpression idExpr, IASTExpression argList); public IASTExpressionList newExpressionList(); public IASTCastExpression newCastExpression(int operator, IASTTypeId typeId, IASTExpression operand); public IASTBinaryExpression newBinaryExpression(int op, IASTExpression expr1, IASTExpression expr2); public IASTConditionalExpression newConditionalExpession(IASTExpression expr1, IASTExpression expr2, IASTExpression expr3); public IASTTypeIdInitializerExpression newTypeIdInitializerExpression(IASTTypeId typeId, IASTInitializer initializer); public IASTLabelStatement newLabelStatement(IASTName name, IASTStatement nestedStatement); public IASTCaseStatement newCaseStatement(IASTExpression expr); public IASTDefaultStatement newDefaultStatement(); public IASTExpressionStatement newExpressionStatement(IASTExpression expression); public IASTNullStatement newNullStatement(); public IASTCompoundStatement newCompoundStatement(); public IASTSwitchStatement newSwitchStatement(IASTExpression controller, IASTStatement body); public IASTIfStatement newIfStatement(IASTExpression condition, IASTStatement then, IASTStatement elseClause); public IASTWhileStatement newWhileStatement(IASTExpression condition, IASTStatement body); public IASTDoStatement newDoStatement(IASTStatement body, IASTExpression condition); public IASTForStatement newForStatement(IASTStatement init, IASTExpression condition, IASTExpression iterationExpression, IASTStatement body); public IASTGotoStatement newGotoStatement(IASTName name); public IASTContinueStatement newContinueStatement(); public IASTBreakStatement newBreakStatement(); public IASTReturnStatement newReturnStatement(IASTExpression retValue); public IASTDeclarationStatement newDeclarationStatement(IASTDeclaration declaration); public IASTTypeIdExpression newTypeIdExpression(int operator, IASTTypeId typeId); public IASTTypeId newTypeId(IASTDeclSpecifier declSpecifier, IASTDeclarator declarator); public IASTDeclarator newDeclarator(IASTName name); public IASTSimpleDeclaration newSimpleDeclaration(IASTDeclSpecifier declSpecifier); public IASTInitializerExpression newInitializerExpression(IASTExpression expression); public IASTInitializerList newInitializerList(); public IASTFunctionDefinition newFunctionDefinition(IASTDeclSpecifier declSpecifier, IASTFunctionDeclarator declarator, IASTStatement bodyStatement); public IASTStandardFunctionDeclarator newFunctionDeclarator(IASTName name); public IASTASMDeclaration newASMDeclaration(String assembly); public IASTProblemDeclaration newProblemDeclaration(IASTProblem problem); public IASTProblemStatement newProblemStatement(IASTProblem problem); public IASTProblemExpression newProblemExpression(IASTProblem problem); public IASTProblem newProblem(int id, char[] arg, boolean error); public IASTEnumerationSpecifier newEnumerationSpecifier(IASTName name); public IASTEnumerator newEnumerator(IASTName name, IASTExpression value); public IASTElaboratedTypeSpecifier newElaboratedTypeSpecifier(int kind, IASTName name); public IASTArrayModifier newArrayModifier(IASTExpression expr); public IASTArrayDeclarator newArrayDeclarator(IASTName name); public IASTParameterDeclaration newParameterDeclaration(IASTDeclSpecifier declSpec, IASTDeclarator declarator); public IASTFieldDeclarator newFieldDeclarator(IASTName name, IASTExpression bitFieldSize); public IASTSimpleDeclSpecifier newSimpleDeclSpecifier(); public IGNUASTCompoundStatementExpression newGNUCompoundStatementExpression(IASTCompoundStatement compoundStatement); public IASTPointer newPointer(); public IASTFieldReference newFieldReference(IASTName name, IASTExpression owner); public IASTNamedTypeSpecifier newTypedefNameSpecifier(IASTName name); public IASTCompositeTypeSpecifier newCompositeTypeSpecifier(int key, IASTName name); /** * Provides the offsets for a node. The offsets are artificial numbers that identify the * position of a node in the translation unit. They are not file-offsets. You can obtain * valid offsets via {@link IToken#getOffset()} or {@link IToken#getEndOffset()} from tokens * provided by the scanner for this translation unit. * <par> May throw an exception when the node provided was not created by this factory. * @param node a node created by this factory * @param offset the offset (inclusive) for the node * @param endOffset the end offset (exclusive) for the node * @see #newTranslationUnit(IScanner) * @since 5.2 */ public void setOffsets(IASTNode node, int offset, int endOffset); /** * Provides the end offset for a node. The offset is an artificial numbers that identifies the * position of a node in the translation unit. It is not a file-offset. You can obtain a * valid offset via {@link IToken#getEndOffset()} from a token provided by the scanner for * this translation unit. * <par> May throw an exception when the node provided was not created by this factory. * @param node a node created by this factory * @param endOffset the end offset (exclusive) for the node * @see #newTranslationUnit(IScanner) * @since 5.2 */ void setEndOffset(IASTNode node, int endOffset); /** * Adjusts the end-offset of a node to be the same as the end-offset of a given node. * <par> May throw an exception when either one of the nodes provided was not created by this factory. * @param node a node created by this factory * @param endNode a node created by this factory defining the end for the other node. * @since 5.2 */ void setEndOffset(IASTNode node, IASTNode endNode); }
73da4fc82c74ac641d2c8a5bb93dfe4f9a5454d8
4b0bf4787e89bcae7e4759bde6d7f3ab2c81f849
/aliyun-java-sdk-retailbot/src/main/java/com/aliyuncs/retailbot/model/v20210224/ProcessMessageResponse.java
3a7074052f7bec5ca257e8343a0d5c20287ddbba
[ "Apache-2.0" ]
permissive
aliyun/aliyun-openapi-java-sdk
a263fa08e261f12d45586d1b3ad8a6609bba0e91
e19239808ad2298d32dda77db29a6d809e4f7add
refs/heads/master
2023-09-03T12:28:09.765286
2023-09-01T09:03:00
2023-09-01T09:03:00
39,555,898
1,542
1,317
NOASSERTION
2023-09-14T07:27:05
2015-07-23T08:41:13
Java
UTF-8
Java
false
false
1,927
java
/* * 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.aliyuncs.retailbot.model.v20210224; import com.aliyuncs.AcsResponse; import com.aliyuncs.retailbot.transform.v20210224.ProcessMessageResponseUnmarshaller; import com.aliyuncs.transform.UnmarshallerContext; /** * @author auto create * @version */ public class ProcessMessageResponse extends AcsResponse { private String requestId; private String data; private Boolean success; private String code; private String message; public String getRequestId() { return this.requestId; } public void setRequestId(String requestId) { this.requestId = requestId; } public String getData() { return this.data; } public void setData(String data) { this.data = data; } public Boolean getSuccess() { return this.success; } public void setSuccess(Boolean success) { this.success = success; } public String getCode() { return this.code; } public void setCode(String code) { this.code = code; } public String getMessage() { return this.message; } public void setMessage(String message) { this.message = message; } @Override public ProcessMessageResponse getInstance(UnmarshallerContext context) { return ProcessMessageResponseUnmarshaller.unmarshall(this, context); } @Override public boolean checkShowJsonItemName() { return false; } }
3a55728aee141f0ff1db7cfb000dae420b07918a
d4e4e83248570f3d731936dd4bc96e611dbf9bca
/app/build/generated/source/kapt/debug/com/devsawe/associateandroiddeveloperpracticeproject/DataBinderMapperImpl.java
1a2c3d18de8ddd96c2809d1d469963018d18a5da
[]
no_license
sawepeter/AADProject
40501ba58ea6794d75884a79532bd2cc845725b0
e4d55c9b11a7dca005806830902a971725293e52
refs/heads/master
2022-12-08T13:39:45.748824
2020-09-11T11:21:30
2020-09-11T11:21:30
294,675,146
2
0
null
null
null
null
UTF-8
Java
false
false
9,216
java
package com.devsawe.associateandroiddeveloperpracticeproject; import android.util.SparseArray; import android.util.SparseIntArray; import android.view.View; import androidx.databinding.DataBinderMapper; import androidx.databinding.DataBindingComponent; import androidx.databinding.ViewDataBinding; import com.devsawe.associateandroiddeveloperpracticeproject.databinding.ActivityMainBindingImpl; import com.devsawe.associateandroiddeveloperpracticeproject.databinding.ConfirmDialogLayoutBindingImpl; import com.devsawe.associateandroiddeveloperpracticeproject.databinding.FragmentHomeBindingImpl; import com.devsawe.associateandroiddeveloperpracticeproject.databinding.FragmentLeaderBindingImpl; import com.devsawe.associateandroiddeveloperpracticeproject.databinding.FragmentSplashBindingImpl; import com.devsawe.associateandroiddeveloperpracticeproject.databinding.FragmentSubmitBindingImpl; import com.devsawe.associateandroiddeveloperpracticeproject.databinding.LeaderboardItemBindingImpl; import com.devsawe.associateandroiddeveloperpracticeproject.databinding.NotSuccessfulDailogLayoutBindingImpl; import com.devsawe.associateandroiddeveloperpracticeproject.databinding.SuccessfulDailogLayoutBindingImpl; import java.lang.IllegalArgumentException; import java.lang.Integer; import java.lang.Object; import java.lang.Override; import java.lang.RuntimeException; import java.lang.String; import java.util.ArrayList; import java.util.HashMap; import java.util.List; public class DataBinderMapperImpl extends DataBinderMapper { private static final int LAYOUT_ACTIVITYMAIN = 1; private static final int LAYOUT_CONFIRMDIALOGLAYOUT = 2; private static final int LAYOUT_FRAGMENTHOME = 3; private static final int LAYOUT_FRAGMENTLEADER = 4; private static final int LAYOUT_FRAGMENTSPLASH = 5; private static final int LAYOUT_FRAGMENTSUBMIT = 6; private static final int LAYOUT_LEADERBOARDITEM = 7; private static final int LAYOUT_NOTSUCCESSFULDAILOGLAYOUT = 8; private static final int LAYOUT_SUCCESSFULDAILOGLAYOUT = 9; private static final SparseIntArray INTERNAL_LAYOUT_ID_LOOKUP = new SparseIntArray(9); static { INTERNAL_LAYOUT_ID_LOOKUP.put(com.devsawe.associateandroiddeveloperpracticeproject.R.layout.activity_main, LAYOUT_ACTIVITYMAIN); INTERNAL_LAYOUT_ID_LOOKUP.put(com.devsawe.associateandroiddeveloperpracticeproject.R.layout.confirm_dialog_layout, LAYOUT_CONFIRMDIALOGLAYOUT); INTERNAL_LAYOUT_ID_LOOKUP.put(com.devsawe.associateandroiddeveloperpracticeproject.R.layout.fragment_home, LAYOUT_FRAGMENTHOME); INTERNAL_LAYOUT_ID_LOOKUP.put(com.devsawe.associateandroiddeveloperpracticeproject.R.layout.fragment_leader, LAYOUT_FRAGMENTLEADER); INTERNAL_LAYOUT_ID_LOOKUP.put(com.devsawe.associateandroiddeveloperpracticeproject.R.layout.fragment_splash, LAYOUT_FRAGMENTSPLASH); INTERNAL_LAYOUT_ID_LOOKUP.put(com.devsawe.associateandroiddeveloperpracticeproject.R.layout.fragment_submit, LAYOUT_FRAGMENTSUBMIT); INTERNAL_LAYOUT_ID_LOOKUP.put(com.devsawe.associateandroiddeveloperpracticeproject.R.layout.leaderboard_item, LAYOUT_LEADERBOARDITEM); INTERNAL_LAYOUT_ID_LOOKUP.put(com.devsawe.associateandroiddeveloperpracticeproject.R.layout.not_successful_dailog_layout, LAYOUT_NOTSUCCESSFULDAILOGLAYOUT); INTERNAL_LAYOUT_ID_LOOKUP.put(com.devsawe.associateandroiddeveloperpracticeproject.R.layout.successful_dailog_layout, LAYOUT_SUCCESSFULDAILOGLAYOUT); } @Override public ViewDataBinding getDataBinder(DataBindingComponent component, View view, int layoutId) { int localizedLayoutId = INTERNAL_LAYOUT_ID_LOOKUP.get(layoutId); if(localizedLayoutId > 0) { final Object tag = view.getTag(); if(tag == null) { throw new RuntimeException("view must have a tag"); } switch(localizedLayoutId) { case LAYOUT_ACTIVITYMAIN: { if ("layout/activity_main_0".equals(tag)) { return new ActivityMainBindingImpl(component, view); } throw new IllegalArgumentException("The tag for activity_main is invalid. Received: " + tag); } case LAYOUT_CONFIRMDIALOGLAYOUT: { if ("layout/confirm_dialog_layout_0".equals(tag)) { return new ConfirmDialogLayoutBindingImpl(component, view); } throw new IllegalArgumentException("The tag for confirm_dialog_layout is invalid. Received: " + tag); } case LAYOUT_FRAGMENTHOME: { if ("layout/fragment_home_0".equals(tag)) { return new FragmentHomeBindingImpl(component, view); } throw new IllegalArgumentException("The tag for fragment_home is invalid. Received: " + tag); } case LAYOUT_FRAGMENTLEADER: { if ("layout/fragment_leader_0".equals(tag)) { return new FragmentLeaderBindingImpl(component, view); } throw new IllegalArgumentException("The tag for fragment_leader is invalid. Received: " + tag); } case LAYOUT_FRAGMENTSPLASH: { if ("layout/fragment_splash_0".equals(tag)) { return new FragmentSplashBindingImpl(component, view); } throw new IllegalArgumentException("The tag for fragment_splash is invalid. Received: " + tag); } case LAYOUT_FRAGMENTSUBMIT: { if ("layout/fragment_submit_0".equals(tag)) { return new FragmentSubmitBindingImpl(component, view); } throw new IllegalArgumentException("The tag for fragment_submit is invalid. Received: " + tag); } case LAYOUT_LEADERBOARDITEM: { if ("layout/leaderboard_item_0".equals(tag)) { return new LeaderboardItemBindingImpl(component, view); } throw new IllegalArgumentException("The tag for leaderboard_item is invalid. Received: " + tag); } case LAYOUT_NOTSUCCESSFULDAILOGLAYOUT: { if ("layout/not_successful_dailog_layout_0".equals(tag)) { return new NotSuccessfulDailogLayoutBindingImpl(component, view); } throw new IllegalArgumentException("The tag for not_successful_dailog_layout is invalid. Received: " + tag); } case LAYOUT_SUCCESSFULDAILOGLAYOUT: { if ("layout/successful_dailog_layout_0".equals(tag)) { return new SuccessfulDailogLayoutBindingImpl(component, view); } throw new IllegalArgumentException("The tag for successful_dailog_layout is invalid. Received: " + tag); } } } return null; } @Override public ViewDataBinding getDataBinder(DataBindingComponent component, View[] views, int layoutId) { if(views == null || views.length == 0) { return null; } int localizedLayoutId = INTERNAL_LAYOUT_ID_LOOKUP.get(layoutId); if(localizedLayoutId > 0) { final Object tag = views[0].getTag(); if(tag == null) { throw new RuntimeException("view must have a tag"); } switch(localizedLayoutId) { } } return null; } @Override public int getLayoutId(String tag) { if (tag == null) { return 0; } Integer tmpVal = InnerLayoutIdLookup.sKeys.get(tag); return tmpVal == null ? 0 : tmpVal; } @Override public String convertBrIdToString(int localId) { String tmpVal = InnerBrLookup.sKeys.get(localId); return tmpVal; } @Override public List<DataBinderMapper> collectDependencies() { ArrayList<DataBinderMapper> result = new ArrayList<DataBinderMapper>(1); result.add(new androidx.databinding.library.baseAdapters.DataBinderMapperImpl()); return result; } private static class InnerBrLookup { static final SparseArray<String> sKeys = new SparseArray<String>(4); static { sKeys.put(0, "_all"); sKeys.put(1, "leaderBoardItem"); sKeys.put(2, "type"); sKeys.put(3, "viewmodel"); } } private static class InnerLayoutIdLookup { static final HashMap<String, Integer> sKeys = new HashMap<String, Integer>(9); static { sKeys.put("layout/activity_main_0", com.devsawe.associateandroiddeveloperpracticeproject.R.layout.activity_main); sKeys.put("layout/confirm_dialog_layout_0", com.devsawe.associateandroiddeveloperpracticeproject.R.layout.confirm_dialog_layout); sKeys.put("layout/fragment_home_0", com.devsawe.associateandroiddeveloperpracticeproject.R.layout.fragment_home); sKeys.put("layout/fragment_leader_0", com.devsawe.associateandroiddeveloperpracticeproject.R.layout.fragment_leader); sKeys.put("layout/fragment_splash_0", com.devsawe.associateandroiddeveloperpracticeproject.R.layout.fragment_splash); sKeys.put("layout/fragment_submit_0", com.devsawe.associateandroiddeveloperpracticeproject.R.layout.fragment_submit); sKeys.put("layout/leaderboard_item_0", com.devsawe.associateandroiddeveloperpracticeproject.R.layout.leaderboard_item); sKeys.put("layout/not_successful_dailog_layout_0", com.devsawe.associateandroiddeveloperpracticeproject.R.layout.not_successful_dailog_layout); sKeys.put("layout/successful_dailog_layout_0", com.devsawe.associateandroiddeveloperpracticeproject.R.layout.successful_dailog_layout); } } }
381add6967b7016338aaf5ab662ec52f907e9483
139960e2d7d55e71c15e6a63acb6609e142a2ace
/mobile_app1/module1170/src/main/java/module1170packageJava0/Foo155.java
38eb0b4f8f5da2ca9a5a2d0abdb25609b6857fce
[ "Apache-2.0" ]
permissive
uber-common/android-build-eval
448bfe141b6911ad8a99268378c75217d431766f
7723bfd0b9b1056892cef1fef02314b435b086f2
refs/heads/master
2023-02-18T22:25:15.121902
2023-02-06T19:35:34
2023-02-06T19:35:34
294,831,672
83
7
Apache-2.0
2021-09-24T08:55:30
2020-09-11T23:27:37
Java
UTF-8
Java
false
false
353
java
package module1170packageJava0; import java.lang.Integer; public class Foo155 { Integer int0; Integer int1; public void foo0() { new module1170packageJava0.Foo154().foo4(); } public void foo1() { foo0(); } public void foo2() { foo1(); } public void foo3() { foo2(); } public void foo4() { foo3(); } }
a8f1c142bac387c8c3a6ac0a449b7c331e371c14
71aadc373849283c8da51564d1a527e7bf40dccf
/src/main/java/gov/nasa/jpl/view_repo/webscripts/MmsProductsGet.java
ca6dbe7d008ba3fccf1846d65cabb15d4b92be0c
[]
no_license
testgonzalez/EMS-Repo
fc49aa33b2238664d979f46684fb18467f670582
df962eeb9adcff8e938d805751edf7e51bec1840
refs/heads/2.2
2020-12-01T03:06:05.591098
2016-02-12T03:03:59
2016-02-12T03:03:59
51,562,964
0
0
null
2016-02-12T03:04:00
2016-02-12T02:34:40
JavaScript
UTF-8
Java
false
false
2,782
java
package gov.nasa.jpl.view_repo.webscripts; import gov.nasa.jpl.mbee.util.Utils; import gov.nasa.jpl.view_repo.util.NodeUtil; import gov.nasa.jpl.view_repo.webscripts.util.ProductsWebscript; import java.util.HashMap; import java.util.Map; import javax.servlet.http.HttpServletResponse; import org.apache.log4j.*; import org.alfresco.repo.model.Repository; import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.service.ServiceRegistry; import org.json.JSONException; import org.json.JSONObject; import org.springframework.extensions.webscripts.Cache; import org.springframework.extensions.webscripts.Status; import org.springframework.extensions.webscripts.WebScriptRequest; public class MmsProductsGet extends AbstractJavaWebScript { public MmsProductsGet() { super(); } public MmsProductsGet( Repository repository, ServiceRegistry services ) { this.repository = repository; this.services = services; } @Override protected boolean validateRequest( WebScriptRequest req, Status status ) { // TODO Auto-generated method stub return false; } @Override protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache) { MmsProductsGet instance = new MmsProductsGet(repository, getServices()); return instance.executeImplImpl(req, status, cache); } @Override protected Map<String, Object> executeImplImpl(WebScriptRequest req, Status status, Cache cache) { // AuthenticationUtil.setRunAsUser( "admin" ); printHeader( req ); //clearCaches(); Map<String, Object> model = new HashMap<String, Object>(); MmsProductsGet instance = new MmsProductsGet(repository, getServices()); JSONObject jsonObject = NodeUtil.newJsonObject(); try { ProductsWebscript productWs = new ProductsWebscript(repository, getServices(), instance.response); jsonObject.put("products", productWs.handleProducts(req)); appendResponseStatusInfo( instance ); if (!Utils.isNullOrEmpty(response.toString())) jsonObject.put("message", response.toString()); model.put("res", NodeUtil.jsonToString( jsonObject, 2 )); } catch (Exception e) { model.put("res", createResponseJson()); if (e instanceof JSONException) { log(Level.ERROR, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "JSON creation error"); } else { log(Level.ERROR, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Internal server error" ); } e.printStackTrace(); } status.setCode(responseStatus.getCode()); printFooter(); return model; } }
f915e85638ce28ccedcd1091d37cd704813f61a6
4e83429f515ac02f4a8129d6180597338598c1ce
/std-demo/math-demo/src/test/java/com/bulain/sort/BubbleSortTest.java
c280a7503929c5a4f42505eb300359885910fab4
[ "MIT" ]
permissive
bulain/java-demo
d79ad0c6fc8cd66f917c87bd62d7f7dbeeca4a45
702f6efebebe23e5830282ee60bd22633d3be39f
refs/heads/master
2023-09-03T15:36:53.056605
2023-08-20T11:31:46
2023-08-20T11:31:46
134,266,362
0
0
MIT
2023-09-14T19:46:20
2018-05-21T12:29:53
Java
UTF-8
Java
false
false
692
java
package com.bulain.sort; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; public class BubbleSortTest { private BubbleSort sort = new BubbleSort(); @Test public void test() { int[] result = new int[]{1, 2, 3, 4, 5, 6, 7, 8}; int[] params = new int[]{2, 3, 5, 6, 8, 4, 1, 7}; sort.sort(params); Assertions.assertArrayEquals(result, params); params = new int[]{1, 2, 3, 4, 5, 6, 7, 8}; sort.sort(params); Assertions.assertArrayEquals(result, params); params = new int[]{8, 7, 6, 5, 4, 3, 2, 1}; sort.sort(params); Assertions.assertArrayEquals(result, params); } }
f15c5879f844ea31f9990584649879107923c5e8
87c20625c33a06f87fdbbb8520fb487c65df8dea
/src/Model/Message.java
4b1c624b05d5ef9c22f03bec141314cf01bda2f0
[]
no_license
razbenya/Asteroids
76dfecec94fda580cf7afbeb071fb7aa4e4b2622
30addcd1056fd551c604f589619cbc43f73f58e2
refs/heads/master
2021-01-18T20:51:29.876412
2017-04-02T15:20:39
2017-04-02T15:20:39
86,994,621
1
0
null
null
null
null
UTF-8
Java
false
false
133
java
package Model; public interface Message { public String getMessageString(); public void stringToMessage(String fileMessage); }
5088d4283b322a1c7201464d024bf5844ed67293
79179e47118e56b0ff13f0a98ab644b59e75c8ea
/com/gtu/centraltechfest/workshopEntry/WorkshopFee.java
4d2e9d4ca3137fb26530b3c26f86254f5ee3aefd
[]
no_license
niketpatel2525/GTU-TechFest
7d95f41a2365ef73c13f339d0b6e296bbb1f3cbd
3f135e5f2abb44a34f024919dbe4bd0a70d0dfab
refs/heads/master
2021-01-21T08:08:40.965260
2017-02-27T17:55:38
2017-02-27T17:55:38
83,338,374
0
0
null
null
null
null
UTF-8
Java
false
false
464
java
package com.gtu.centraltechfest.workshopEntry; public class WorkshopFee { public static final String home_fees_work = "Registration Fees per Participant:Rs. 750"; public static final String mobilemaking_fees_work = "Registration Fees per Participant:Rs. 800"; public static final String oracle_fees_work = "Registration Fees per Participant:Free"; public static final String tallbuilding_fees_work = "Registration Fees per Participant:Rs. 950"; }
d8e280085413e12d95ac620acdceb13c839b8ca2
732a7acce6c8032446689d098b90862c51bebf11
/ap_appserver/src/com/xf/entity/gov/ConstructionDust.java
f032f48ca59b71bc753c9ccae58a537cc4522b19
[]
no_license
tangyu355/environment
609e77755af4af004d35771aab6da6c3b1084cb3
dd8cdf1da9749d0cf1ccebaee511eae941cb30c5
refs/heads/master
2020-03-07T21:32:23.721217
2018-04-02T15:27:28
2018-04-02T15:27:28
127,728,965
0
1
null
2018-04-02T15:27:29
2018-04-02T08:39:08
Java
UTF-8
Java
false
false
3,595
java
package com.xf.entity.gov; import java.util.Map; import org.apache.ibatis.type.Alias; @Alias("ConstructionDust") public class ConstructionDust { private int id; private int accountid; private String fillTime; private int fillyear; private int province; private int city; private int town; private int country; private int street; private int area; private double constructArea; private double buildingArea; private double startWorkArea; private double completeArea; private double hasStartedArea; private int hasStartNumber; private double notStartArea; private int notStartNumber; private String department; private String townname; private int status; private double avgWorktime; public int getId() { return id; } public void setId(int id) { this.id = id; } public int getAccountid() { return accountid; } public void setAccountid(int accountid) { this.accountid = accountid; } public String getFillTime() { return fillTime; } public void setFillTime(String fillTime) { this.fillTime = fillTime; } public int getFillyear() { return fillyear; } public void setFillyear(int fillyear) { this.fillyear = fillyear; } public int getProvince() { return province; } public void setProvince(int province) { this.province = province; } public int getCity() { return city; } public void setCity(int city) { this.city = city; } public int getTown() { return town; } public void setTown(int town) { this.town = town; } public int getCountry() { return country; } public void setCountry(int country) { this.country = country; } public int getStreet() { return street; } public void setStreet(int street) { this.street = street; } public int getArea() { return area; } public void setArea(int area) { this.area = area; } public double getConstructArea() { return constructArea; } public void setConstructArea(double constructArea) { this.constructArea = constructArea; } public double getBuildingArea() { return buildingArea; } public void setBuildingArea(double buildingArea) { this.buildingArea = buildingArea; } public double getStartWorkArea() { return startWorkArea; } public void setStartWorkArea(double startWorkArea) { this.startWorkArea = startWorkArea; } public double getCompleteArea() { return completeArea; } public void setCompleteArea(double completeArea) { this.completeArea = completeArea; } public double getHasStartedArea() { return hasStartedArea; } public void setHasStartedArea(double hasStartedArea) { this.hasStartedArea = hasStartedArea; } public int getHasStartNumber() { return hasStartNumber; } public void setHasStartNumber(int hasStartNumber) { this.hasStartNumber = hasStartNumber; } public double getNotStartArea() { return notStartArea; } public void setNotStartArea(double notStartArea) { this.notStartArea = notStartArea; } public int getNotStartNumber() { return notStartNumber; } public void setNotStartNumber(int notStartNumber) { this.notStartNumber = notStartNumber; } public String getDepartment() { return department; } public void setDepartment(String department) { this.department = department; } public String getTownname() { return townname; } public void setTownname(String townname) { this.townname = townname; } public int getStatus() { return status; } public void setStatus(int status) { this.status = status; } public double getAvgWorktime() { return avgWorktime; } public void setAvgWorktime(double avgWorktime) { this.avgWorktime = avgWorktime; } }
1428934369f8d6780706186777ab46ce25ad3250
db485147083bed69d849b58f1fc2c0a02d6134f6
/src/main/java/com/example/TransactionGenerator.java
84103ccf7a1333a732e9c7ba125c9ef1ad05bacb
[ "Apache-2.0" ]
permissive
nikitap492/Storm-demo
b063353846cbefe1a27103de4d1999063633d50a
127cca6d3090cd7218ad41dd67dad5b785a169d8
refs/heads/master
2021-08-24T13:19:36.716237
2017-11-21T07:19:51
2017-11-21T07:19:51
111,413,138
0
0
null
null
null
null
UTF-8
Java
false
false
2,090
java
package com.example; import lombok.val; import javax.security.auth.login.AccountException; import javax.swing.*; import java.math.BigDecimal; import java.math.MathContext; import java.math.RoundingMode; import java.time.LocalDateTime; import java.util.*; import java.util.stream.Stream; import java.util.stream.StreamSupport; /** * @author Podshivalov N.A. * @since 18.11.2017. */ public class TransactionGenerator { private static final int DEFAULT_CACHE_SIZE = 10; private static final MathContext ROUND_RULE = new MathContext(2, RoundingMode.HALF_UP); private static final Random random = new Random(); private String[] accountCache; public TransactionGenerator(){ doAccountCache(DEFAULT_CACHE_SIZE); } public TransactionGenerator(int cacheSize){ doAccountCache(cacheSize); } Collection<CardTransaction> generate(int num){ int cacheSize = accountCache.length; val now = LocalDateTime.now(); val transactions = new ArrayList<CardTransaction>(num); while (num-- >= 0){ val payer = accountCache[random.nextInt(cacheSize)]; String recipient; do { recipient = accountCache[random.nextInt(cacheSize)]; }while (!payer.equals(recipient)); val createdAt = now.minusHours(random.nextInt(23)) .minusMinutes(random.nextInt(60)) .minusSeconds(random.nextInt(60)); val transaction = new CardTransaction(payer, recipient, createdAt, randomAmount()); transactions.add(transaction); } return transactions; } private BigDecimal randomAmount(){ return BigDecimal.valueOf(random.nextDouble() * 100).round(ROUND_RULE); } private void doAccountCache(int size){ accountCache = new String[size]; while (size-- > 0){ accountCache[size] = generateAccountNum().toString(); } } private Long generateAccountNum(){ return ((long) (random.nextDouble() * 10000000000000000L)); } }
dd36f8f66c459fdd7d07fe8e328d0d00ff5d2773
4f578916a498fecdbca68bbeed15cf1b30063aa9
/AppTest.java
9066f2f4a1e70782e618ce34ff982a9ecd3e3ea9
[]
no_license
MatthewMarkBrown/ADP_Assignment1
8d94c7e1985021a86055988f656eeac7d021562e
542285200b36c58143365568415a54d383240598
refs/heads/master
2020-04-22T17:56:05.553611
2019-02-13T18:44:56
2019-02-13T18:44:56
170,559,427
1
0
null
2019-02-13T18:39:54
2019-02-13T18:39:54
null
UTF-8
Java
false
false
411
java
package ac.za.cput; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import org.junit.Test; /** * Unit test for simple App. */ public class AppTest { /** * Rigorous Test :-) */ @Test public void shouldAnswerWithTrue() { Calculater calc = new Calculater(); assertEquals(10,calc.calcSum(5,5)); } }
4806869c08c433f038e4bbfec674418f45721ef5
852285f45aea08a94830a25da63d53319067ece9
/src/controller/PolygonControler.java
73d4c7332aa00c274740d4798059c45625225de8
[]
no_license
smidlik/PGRF1_2019
6bb304395863134eb65abec822bd46638f118f52
cfd89c746ac9b7ce39c595cc9900f4d017a3f456
refs/heads/master
2020-09-09T01:00:32.390176
2019-11-12T19:38:20
2019-11-12T19:38:20
221,296,677
0
0
null
null
null
null
UTF-8
Java
false
false
3,098
java
package controller; import fill.ScanLine; import misc.Lines; import model.Point; import renderer.Renderer; import view.Raster; import javax.swing.*; import java.awt.*; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.ArrayList; import java.util.List; public class PolygonControler extends Controler { private List<Point> polygonPoints = new ArrayList<>(); private ScanLine scanLine; public PolygonControler(Raster raster, Lines lines, Color borderColor, Color fillColor) { renderer = new Renderer(raster, lines, borderColor); fillMethod = new ScanLine(raster, fillColor.getRGB(), borderColor.getRGB()); scanLine = new ScanLine(raster, fillColor.getRGB(), borderColor.getRGB()); initObjects(raster); initListeners(raster); } private void update(Raster raster) { raster.clear(); renderer.drawPolygon(polygonPoints); } @Override public void initObjects(Raster raster) { } @Override public void initListeners(Raster raster) { raster.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (fillState) { scanLine.init(polygonPoints); scanLine.fill(e.getX(), e.getY()); } } }); raster.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { if (!fillState) { if (SwingUtilities.isLeftMouseButton(e)) { polygonPoints.add(new Point(e.getX(), e.getY())); if (polygonPoints.size() == 1) { // při prvním kliknutí přidat rovnou i druhý bod polygonPoints.add(new Point(e.getX(), e.getY())); } } else update(raster); } } }); raster.addMouseMotionListener(new MouseAdapter() { @Override public void mouseDragged(MouseEvent e) { if (SwingUtilities.isLeftMouseButton(e)) { polygonPoints.get(polygonPoints.size() - 1).x = e.getX(); polygonPoints.get(polygonPoints.size() - 1).y = e.getY(); } update(raster); } }); raster.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { // při zmáčknutí klávesy C vymazat plátno if (e.getKeyCode() == KeyEvent.VK_C) { raster.clear(); polygonPoints = new ArrayList<>(); scanLine.init(polygonPoints); } if (e.getKeyCode() == KeyEvent.VK_F) { fillState = !fillState; raster.setFillLbl(fillState); } } }); } }
588eeac9cfbd637127bf6d61c9a81bcbf09fe604
16b4af814a1beabeb1a1f8dd5acd9c9cd4d2f91e
/app/src/main/java/cn/ucai/fulicenter/model/net/IModelNewGoods.java
3a70e692cfa880aaec21f5ff215c8e8c3f8c7844
[]
no_license
Springdayang/fulicenter-201610
3c953ec91eeaf12a4b1b243d247760897167ba2b
9b79dc094ef367d4dfdc6e7e1d135d90775adb37
refs/heads/master
2021-01-12T01:30:21.675944
2017-01-20T00:47:03
2017-01-20T00:47:03
78,396,161
0
0
null
null
null
null
UTF-8
Java
false
false
379
java
package cn.ucai.fulicenter.model.net; import android.content.Context; import cn.ucai.fulicenter.model.bean.NewGoodsBean; import cn.ucai.fulicenter.model.util.OkHttpUtils; /** * Created by Administrator on 2017/1/11 0011. */ public interface IModelNewGoods { void downData(Context context,int catId, int pageId, OkHttpUtils.OnCompleteListener<NewGoodsBean[]>listener); }
67e8c7b5a5622ea8b446f5db62afea59c0066249
dc91fa11794711f7a31ff43ccdb21f005faf3b9b
/Sesion-05/Reto-03/solucion/src/main/java/com/example/demo/data/LibroRepository.java
506fe4934966783acd37fd2d33cd221437377cd2
[]
no_license
beduExpert/C1-Backend-Java
3f77f155c19d7c059e01b02d6e13ba94d2606932
696050c962ccc1282033a5ac672080b0c10fc3d5
refs/heads/master
2022-09-25T20:57:53.982372
2022-08-26T13:13:52
2022-08-26T13:13:52
217,122,759
1
3
null
null
null
null
UTF-8
Java
false
false
139
java
package com.example.demo.data; import com.example.demo.Libro; public interface LibroRepository { Iterable<Libro> encuentraTodos(); }
182aef8128e88d624469b6681aade7d5885a9fb9
d1a6d1e511df6db8d8dd0912526e3875c7e1797d
/genny_JavaWithoutLambdasApi21/applicationModule/src/main/java/applicationModulepackageJava14/Foo302.java
f9e429f0cd6176d67ba81c95d034b5a60df22c96
[]
no_license
NikitaKozlov/generated-project-for-desugaring
0bc1443ab3ddc84cd289331c726761585766aea7
81506b3711004185070ca4bb9a93482b70011d36
refs/heads/master
2020-03-20T00:35:06.996525
2018-06-12T09:30:37
2018-06-12T09:30:37
137,049,317
0
0
null
null
null
null
UTF-8
Java
false
false
348
java
package applicationModulepackageJava14; public class Foo302 { public void foo0() { new applicationModulepackageJava14.Foo301().foo5(); } public void foo1() { foo0(); } public void foo2() { foo1(); } public void foo3() { foo2(); } public void foo4() { foo3(); } public void foo5() { foo4(); } }