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
501f06925fcc205f535ab3095c8dd39f2a05d3bf
67216a70a31399b73d84e2d0f96011bb155d61f3
/dfplatform/src/main/java/com/esign/service/dfplatform/BO/DfpHttpRequestBO.java
9465a3ab8b6bca340a79abebf56360e1b62776d5
[]
no_license
wuzhiqiang15/dataFactory
174bd626200587cf2aff5915fa883743e1c1535c
b00f2dc6fd1e72c9c2399fb11f54570c969e3176
refs/heads/main
2023-06-11T19:02:55.893133
2021-07-01T06:14:23
2021-07-01T06:14:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
511
java
package com.esign.service.dfplatform.BO; import com.esign.service.dfplatform.util.client.HttpClientRequest; import lombok.Data; import java.util.List; /** * @Author: huangtai * @Description: http请求模型 * @Date: 2020/9/14 16:38 */ @Data public class DfpHttpRequestBO { int apiId; int apiOrder; String requestDescript; String requestOtherName; HttpClientRequest httpClientRequest; List<DfpParamsBO> dfpParamsBOS; List<DfpGetFromResponseBO> dfpGetFromResponseBOS; }
4cad03d8455227d80d1e302132fbcf367473bd3f
3fcd99f033ac157da4d9be74d89ec8ec685e7491
/hoauapp_si/src/main/java/com/hoau/hoauapp/si/newoms/ResetPwdResponse.java
e0a377fe38dff8c747cf6e472fe4e8cf1e89b23a
[]
no_license
mcqingxian/hoauapp
2fa3741bb0107e4bbb69d20a54a52228c8b51773
6fd5cc8063229afd0e207040d8fb61ea96f2a935
refs/heads/master
2021-01-02T22:36:01.642768
2017-08-04T14:38:21
2017-08-04T14:38:21
99,350,012
0
0
null
null
null
null
GB18030
Java
false
false
1,537
java
package com.hoau.hoauapp.si.newoms; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * <p>anonymous complex type的 Java 类。 * * <p>以下模式片段指定包含在此类中的预期内容。 * * <pre> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="out" type="{http://model.mobile.interfaces.sinotrans.com}ResetPwdResModel"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "out" }) @XmlRootElement(name = "resetPwdResponse") public class ResetPwdResponse { @XmlElement(required = true, nillable = true) protected ResetPwdResModel out; /** * 获取out属性的值。 * * @return * possible object is * {@link ResetPwdResModel } * */ public ResetPwdResModel getOut() { return out; } /** * 设置out属性的值。 * * @param value * allowed object is * {@link ResetPwdResModel } * */ public void setOut(ResetPwdResModel value) { this.out = value; } }
c560c5f4fcf712723b5cd11d7085e4e03fe54c45
0acc204321de7fdd4fe8c94e3e0805da2e947a5d
/app/src/main/java/com/archermind/music/loadingview/LoadingIndicatorView.java
150bd6ba3e6fb63bf2f9c46e2949519c217b8a3f
[]
no_license
chengtao1993/OnlineMusic
637ed24c29c15b52d9e404b5626336a1112e6f1c
cefb0e42622edea86c3853609f95ecde6c0f3d6f
refs/heads/master
2020-04-19T09:20:36.223904
2019-03-01T11:03:11
2019-03-01T11:03:11
168,107,391
0
0
null
null
null
null
UTF-8
Java
false
false
13,572
java
package com.archermind.music.loadingview; import android.annotation.TargetApi; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Rect; import android.graphics.drawable.Animatable; import android.graphics.drawable.Drawable; import android.os.Build; import android.text.TextUtils; import android.util.AttributeSet; import android.util.Log; import android.view.View; import android.view.animation.AnimationUtils; import com.archermind.music.R; import com.archermind.music.loadingview.indicators.BallPulseIndicator; public class LoadingIndicatorView extends View { private static final String TAG="LoadingIndicatorView"; private static final BallPulseIndicator DEFAULT_INDICATOR=new BallPulseIndicator(); private static final int MIN_SHOW_TIME = 500; // ms private static final int MIN_DELAY = 500; // ms private long mStartTime = -1; private boolean mPostedHide = false; private boolean mPostedShow = false; private boolean mDismissed = false; private final Runnable mDelayedHide = new Runnable() { @Override public void run() { mPostedHide = false; mStartTime = -1; setVisibility(View.GONE); } }; private final Runnable mDelayedShow = new Runnable() { @Override public void run() { mPostedShow = false; if (!mDismissed) { mStartTime = System.currentTimeMillis(); setVisibility(View.VISIBLE); } } }; int mMinWidth; int mMaxWidth; int mMinHeight; int mMaxHeight; private Indicator mIndicator; private int mIndicatorColor; private boolean mShouldStartAnimationDrawable; public LoadingIndicatorView(Context context) { super(context); init(context, null,0,0); } public LoadingIndicatorView(Context context, AttributeSet attrs) { super(context, attrs); init(context, attrs,0,R.style.LoadingIndicatorView); } public LoadingIndicatorView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(context, attrs,defStyleAttr,R.style.LoadingIndicatorView); } @TargetApi(Build.VERSION_CODES.LOLLIPOP) public LoadingIndicatorView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); init(context,attrs,defStyleAttr,R.style.LoadingIndicatorView); } private void init(Context context,AttributeSet attrs,int defStyleAttr, int defStyleRes) { mMinWidth = 24; mMaxWidth = 48; mMinHeight = 24; mMaxHeight = 48; final TypedArray a = context.obtainStyledAttributes( attrs, R.styleable.LoadingIndicatorView, defStyleAttr, defStyleRes); mMinWidth = a.getDimensionPixelSize(R.styleable.LoadingIndicatorView_minWidth, mMinWidth); mMaxWidth = a.getDimensionPixelSize(R.styleable.LoadingIndicatorView_maxWidth, mMaxWidth); mMinHeight = a.getDimensionPixelSize(R.styleable.LoadingIndicatorView_minHeight, mMinHeight); mMaxHeight = a.getDimensionPixelSize(R.styleable.LoadingIndicatorView_maxHeight, mMaxHeight); String indicatorName=a.getString(R.styleable.LoadingIndicatorView_indicatorName); mIndicatorColor=a.getColor(R.styleable.LoadingIndicatorView_indicatorColor, Color.WHITE); setIndicator(indicatorName); if (mIndicator==null){ setIndicator(DEFAULT_INDICATOR); } a.recycle(); } public Indicator getIndicator() { return mIndicator; } public void setIndicator(Indicator d) { if (mIndicator != d) { if (mIndicator != null) { mIndicator.setCallback(null); unscheduleDrawable(mIndicator); } mIndicator = d; //need to set indicator color again if you didn't specified when you update the indicator . setIndicatorColor(mIndicatorColor); if (d != null) { d.setCallback(this); } postInvalidate(); } } /** * setIndicatorColor(0xFF00FF00) * or * setIndicatorColor(Color.BLUE) * or * setIndicatorColor(Color.parseColor("#FF4081")) * or * setIndicatorColor(0xFF00FF00) * or * setIndicatorColor(getResources().getColor(android.R.color.black)) * @param color */ public void setIndicatorColor(int color){ this.mIndicatorColor=color; mIndicator.setColor(color); } /** * You should pay attention to pass this parameter with two way: * for example: * 1. Only class Name,like "SimpleIndicator".(This way would use default package name with * "com.archermind.music.loadingview.indicators") * 2. Class name with full package,like "com.my.android.indicators.SimpleIndicator". * @param indicatorName the class must be extend Indicator . */ public void setIndicator(String indicatorName){ if (TextUtils.isEmpty(indicatorName)){ return; } StringBuilder drawableClassName=new StringBuilder(); if (!indicatorName.contains(".")){ String defaultPackageName=getClass().getPackage().getName(); drawableClassName.append(defaultPackageName) .append(".indicators") .append("."); } drawableClassName.append(indicatorName); try { Class<?> drawableClass = Class.forName(drawableClassName.toString()); Indicator indicator = (Indicator) drawableClass.newInstance(); setIndicator(indicator); } catch (ClassNotFoundException e) { Log.e(TAG,"Didn't find your class , check the name again !"); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } } public void smoothToShow(){ startAnimation(AnimationUtils.loadAnimation(getContext(),android.R.anim.fade_in)); setVisibility(VISIBLE); } public void smoothToHide(){ startAnimation(AnimationUtils.loadAnimation(getContext(),android.R.anim.fade_out)); setVisibility(GONE); } public void hide() { mDismissed = true; removeCallbacks(mDelayedShow); long diff = System.currentTimeMillis() - mStartTime; if (diff >= MIN_SHOW_TIME || mStartTime == -1) { // The progress spinner has been shown long enough // OR was not shown yet. If it wasn't shown yet, // it will just never be shown. setVisibility(View.GONE); } else { // The progress spinner is shown, but not long enough, // so put a delayed message in to hide it when its been // shown long enough. if (!mPostedHide) { postDelayed(mDelayedHide, MIN_SHOW_TIME - diff); mPostedHide = true; } } } public void show() { // Reset the start time. mStartTime = -1; mDismissed = false; removeCallbacks(mDelayedHide); if (!mPostedShow) { postDelayed(mDelayedShow, MIN_DELAY); mPostedShow = true; } } @Override protected boolean verifyDrawable(Drawable who) { return who == mIndicator || super.verifyDrawable(who); } void startAnimation() { if (getVisibility() != VISIBLE) { return; } if (mIndicator instanceof Animatable) { mShouldStartAnimationDrawable = true; } postInvalidate(); } void stopAnimation() { if (mIndicator instanceof Animatable) { mIndicator.stop(); mShouldStartAnimationDrawable = false; } postInvalidate(); } @Override public void setVisibility(int v) { if (getVisibility() != v) { super.setVisibility(v); if (v == GONE || v == INVISIBLE) { stopAnimation(); } else { startAnimation(); } } } @Override protected void onVisibilityChanged(View changedView, int visibility) { super.onVisibilityChanged(changedView, visibility); if (visibility == GONE || visibility == INVISIBLE) { stopAnimation(); } else { startAnimation(); } } @Override public void invalidateDrawable(Drawable dr) { if (verifyDrawable(dr)) { final Rect dirty = dr.getBounds(); final int scrollX = getScrollX() + getPaddingLeft(); final int scrollY = getScrollY() + getPaddingTop(); invalidate(dirty.left + scrollX, dirty.top + scrollY, dirty.right + scrollX, dirty.bottom + scrollY); } else { super.invalidateDrawable(dr); } } @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { updateDrawableBounds(w, h); } private void updateDrawableBounds(int w, int h) { // onDraw will translate the canvas so we draw starting at 0,0. // Subtract out padding for the purposes of the calculations below. w -= getPaddingRight() + getPaddingLeft(); h -= getPaddingTop() + getPaddingBottom(); int right = w; int bottom = h; int top = 0; int left = 0; if (mIndicator != null) { // Maintain aspect ratio. Certain kinds of animated drawables // get very confused otherwise. final int intrinsicWidth = mIndicator.getIntrinsicWidth(); final int intrinsicHeight = mIndicator.getIntrinsicHeight(); final float intrinsicAspect = (float) intrinsicWidth / intrinsicHeight; final float boundAspect = (float) w / h; if (intrinsicAspect != boundAspect) { if (boundAspect > intrinsicAspect) { // New width is larger. Make it smaller to match height. final int width = (int) (h * intrinsicAspect); left = (w - width) / 2; right = left + width; } else { // New height is larger. Make it smaller to match width. final int height = (int) (w * (1 / intrinsicAspect)); top = (h - height) / 2; bottom = top + height; } } mIndicator.setBounds(left, top, right, bottom); } } @Override protected synchronized void onDraw(Canvas canvas) { super.onDraw(canvas); drawTrack(canvas); } void drawTrack(Canvas canvas) { final Drawable d = mIndicator; if (d != null) { // Translate canvas so a indeterminate circular progress bar with padding // rotates properly in its animation final int saveCount = canvas.save(); canvas.translate(getPaddingLeft(), getPaddingTop()); d.draw(canvas); canvas.restoreToCount(saveCount); if (mShouldStartAnimationDrawable && d instanceof Animatable) { ((Animatable) d).start(); mShouldStartAnimationDrawable = false; } } } @Override protected synchronized void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int dw = 0; int dh = 0; final Drawable d = mIndicator; if (d != null) { dw = Math.max(mMinWidth, Math.min(mMaxWidth, d.getIntrinsicWidth())); dh = Math.max(mMinHeight, Math.min(mMaxHeight, d.getIntrinsicHeight())); } updateDrawableState(); dw += getPaddingLeft() + getPaddingRight(); dh += getPaddingTop() + getPaddingBottom(); final int measuredWidth = resolveSizeAndState(dw, widthMeasureSpec, 0); final int measuredHeight = resolveSizeAndState(dh, heightMeasureSpec, 0); setMeasuredDimension(measuredWidth, measuredHeight); } @Override protected void drawableStateChanged() { super.drawableStateChanged(); updateDrawableState(); } private void updateDrawableState() { final int[] state = getDrawableState(); if (mIndicator != null && mIndicator.isStateful()) { mIndicator.setState(state); } } @TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override public void drawableHotspotChanged(float x, float y) { super.drawableHotspotChanged(x, y); if (mIndicator != null) { mIndicator.setHotspot(x, y); } } @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); startAnimation(); removeCallbacks(); } @Override protected void onDetachedFromWindow() { stopAnimation(); // This should come after stopAnimation(), otherwise an invalidate message remains in the // queue, which can prevent the entire view hierarchy from being GC'ed during a rotation super.onDetachedFromWindow(); removeCallbacks(); } private void removeCallbacks() { removeCallbacks(mDelayedHide); removeCallbacks(mDelayedShow); } }
10e69d95e737d7cd3faae4bdb83f1efe25e7c66a
f512de528875e86c6e49581a3b702be1e3549a49
/app/src/main/java/com/example/henry/ndktest/MainActivity.java
26dc983175255c18445b99573548575758eeb3bf
[]
no_license
doubleh777/NDKTest
1c2be49f21b0e514158e69780a50a06bd631d281
0c7e673c4a6529c2e70b08550144f03674a94351
refs/heads/master
2021-01-23T20:21:35.925706
2015-09-22T08:11:21
2015-09-22T08:11:21
42,919,955
0
0
null
null
null
null
UTF-8
Java
false
false
952
java
package com.example.henry.ndktest; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v7.app.ActionBarActivity; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.View; import android.view.Menu; import android.view.MenuItem; import android.widget.TextView; public class MainActivity extends ActionBarActivity { static { System.loadLibrary("NDKTest"); } public native String getStringFromNative(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); TextView view = (TextView) findViewById(R.id.textView); view.setText(test()); } public String test(){ return getStringFromNative() + " But I don't like you!"; } }
2be718a22a53edfa87eb835a0a6ecb4da832a6f0
151e65ef89ddb8b3adb881a098a1534fc8297661
/se-web/.svn/pristine/2b/2be718a22a53edfa87eb835a0a6ecb4da832a6f0.svn-base
bc8dc21381b30401f83cd9b3d0d0d4dcef075976
[]
no_license
Ox0400/test
94adc938bf6f1b75c2798e1abd2d4e348e0907aa
116b6927ee9acf56188e1bdad6bd7224d017035a
refs/heads/master
2023-03-17T17:58:20.746343
2020-02-08T07:16:12
2020-02-08T07:16:12
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,177
package com.xjw.entity.po.sys; import java.math.BigDecimal; import com.xjw.base.entity.BasePo; /** * 会员配置 */ public class VipConfig extends BasePo { private static final long serialVersionUID = -8854148832724902501L; /** 会员等级 */ private Integer level; /** 月累计存款 */ private BigDecimal monthDepositAmount; /** 周有效投注 */ private BigDecimal weekBetAmount; /** 每月免费筹码 */ private BigDecimal monthChipAmount; public Integer getLevel() { return level; } public void setLevel(Integer level) { this.level = level; } public BigDecimal getMonthDepositAmount() { return monthDepositAmount; } public void setMonthDepositAmount(BigDecimal monthDepositAmount) { this.monthDepositAmount = monthDepositAmount; } public BigDecimal getWeekBetAmount() { return weekBetAmount; } public void setWeekBetAmount(BigDecimal weekBetAmount) { this.weekBetAmount = weekBetAmount; } public BigDecimal getMonthChipAmount() { return monthChipAmount; } public void setMonthChipAmount(BigDecimal monthChipAmount) { this.monthChipAmount = monthChipAmount; } }
0a263104d9d639db0199a02241c7bb3fcb4fac92
6c031e328c34c549a08f910b7a9c0dd8b46868cf
/src/main/java/info/varden/irclinqed/packet/Packet444NoLogin.java
d28cf7ec4ce1fa935d4e87b0ea465634ae71e5f5
[ "Apache-2.0" ]
permissive
bilde2910/IRCLinqed
5f839dd3bf79c0e3e9d005926887fb7de77bff83
124e648dfd46e660f4c2646d010ec5cfd4e0eaff
refs/heads/master
2016-08-11T21:02:37.856200
2016-03-05T13:42:33
2016-03-05T13:42:33
53,203,162
2
1
null
null
null
null
UTF-8
Java
false
false
1,163
java
/* Copyright 2014 Marius Lindvall 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 info.varden.irclinqed.packet; import info.varden.irclinqed.IRCLinqed; import info.varden.irclinqed.MessageType; import info.varden.irclinqed.irc.IRCThread; import info.varden.irclinqed.irc.NumericResponsePacket; public class Packet444NoLogin extends NumericResponsePacket { public Packet444NoLogin(IRCLinqed il, IRCThread thread, String command) { super(il, thread, command); } @Override public void handle() { addMessageToChat(MessageType.SERVER_ERROR, thread.getNetworkName(), "User " + getParam(1) + " could not be summoned (not logged in)"); } }
c790c79362523aa1593ddb6b0641fa5f51d27a02
b67d8a94f349494062ecf87d29980f42fc87dfb8
/src/com/example/rockpapperscissors/fields/Field.java
8ad3d8e31b023ed7385880205dbd32345df72761
[]
no_license
mdocevski/bachelor_project
a800cb7f3c9f17a5f229f7a5cc86f3fd6b25bb42
e1cc50488074fed311efd08569d4e6f193c71497
refs/heads/master
2021-01-12T09:46:09.729165
2016-12-12T10:32:58
2016-12-12T10:32:58
76,245,717
0
0
null
null
null
null
UTF-8
Java
false
false
2,416
java
//package com.example.rockpapperscissors.fields; // //import com.example.rockpapperscissors.CONSTANTS; // //public class Field { // private int mType; // private FieldItem mFieldItem = null; // // public Field(Field pField){ // mType = pField.mType; // } // // public int getType() { // return mType; // } // // public void setType(int pType) { // this.mType = pType; // if(mFieldItem != null){ // mFieldItem.setType(pType); // mFieldItem.adjustSprite(); // } // // } // // public FieldItem getFieldItem() { // return mFieldItem; // } // // public void setFieldItem(FieldItem pFigure) { // mFieldItem = pFigure; // } // // public Figure getFigure () { // if (mFieldItem != null && Figure.class == mFieldItem.getClass()){ // return (Figure) mFieldItem; // } // return null; // } // // public boolean isFigure () { // if (mFieldItem != null && Figure.class == mFieldItem.getClass()) return true; // return false; // // } // // public boolean isPickup () { // if (mFieldItem != null && Pickup.class == mFieldItem.getClass()) return true; // return false; // } // // public void setPickup (Pickup pPickup) { // mFieldItem = pPickup; // } // // public Pickup getPickup () { // if (mFieldItem != null && Pickup.class == mFieldItem.getClass()) // return (Pickup) mFieldItem; // return null; // } // // public void setFigure (Figure pFigure) { // mFieldItem = pFigure; // } // // public Field() { // this.mType = CONSTANTS.EMPTY; // } // // public boolean isFriendly() { // return (mType == CONSTANTS.FRIENDLY_SEXTANGLE // || mType == CONSTANTS.FRIENDLY_SQUARE || mType == CONSTANTS.FRIENDLY_TRIANGLE); // } // // public boolean isAvailable() { // return (mType == CONSTANTS.EMPTY || mType == CONSTANTS.ENEMY_SEXTANGLE // || mType == CONSTANTS.ENEMY_SQUARE || mType == CONSTANTS.ENEMY_TRIANGLE || mType == CONSTANTS.COINS ); // } // // public boolean isEnemy () { // return (mType == CONSTANTS.ENEMY_SEXTANGLE // || mType == CONSTANTS.ENEMY_SQUARE || mType == CONSTANTS.ENEMY_TRIANGLE); // } // // public boolean isCoins () { // return mType == CONSTANTS.COINS; // } // // public boolean isEmpty () { // return mType == CONSTANTS.EMPTY; // } // // public void removeFieldItem () { // if (null != mFieldItem){ // mFieldItem.detachSprite(); // mFieldItem = null; // } // } // // public void empty () { // removeFieldItem(); // mType = CONSTANTS.EMPTY; // } //}
7f01afafb52661ad7d971912fa1da42fa1a43cc3
e5a861743e9a94789a216e3d28860e732a515d2c
/app/src/androidTest/java/com/abutech/root/resultapp/ExampleInstrumentedTest.java
c548b7c013b42d8c405660cd5b7b6cb078c7493f
[]
no_license
abuvanth/WeatherApp
09ab9616b4949362cb160ed3297a23a89f338b60
41c6e793af98dc4174402d03cb44234a8cd87c97
refs/heads/master
2021-01-11T20:08:45.864129
2017-01-28T12:44:02
2017-01-28T12:44:02
79,049,871
0
0
null
null
null
null
UTF-8
Java
false
false
756
java
package com.abutech.root.resultapp; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumentation test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.abutech.root.resultapp", appContext.getPackageName()); } }
1956daa2d5ef790a3c4acfb68c89624cf6062f5a
8ec360de039ca3be1329023cbf95d0f0537e4be9
/src/main/java/co/gc/Week6Capstone/Week6CapstoneApplication.java
5f31d0cff3ebe5221e69ff579b5c2e1592d7aaf0
[]
no_license
kiaraa/Week6Capstone
973dcbd05350b402b1adfb879837aef1e82a0dc2
7141c1d4019d350d26679551ccd547fbd7c66284
refs/heads/master
2020-07-11T07:12:25.742599
2019-08-26T12:51:08
2019-08-26T12:51:08
204,474,993
0
0
null
null
null
null
UTF-8
Java
false
false
326
java
package co.gc.Week6Capstone; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class Week6CapstoneApplication { public static void main(String[] args) { SpringApplication.run(Week6CapstoneApplication.class, args); } }
b0b8dc93dd07e4ff2194f3c80582f64b86e4195b
fdf414bf5c9522dc00915bbbdfb8716c60fe2771
/test/test/src/main/java/com/_520it/crm/mapper/LogMapper.java
debcebe75a9be42796a69168e63b0307956b9e3b
[]
no_license
kangbinlin/test
d6dcaf90e341e953ce14001e1621d06b465c5e9e
aba021a9203fea5957c371a071f43bb15e3ffe80
refs/heads/master
2023-03-31T04:02:03.180413
2021-03-26T11:38:43
2021-03-26T11:38:43
351,757,320
1
0
null
null
null
null
UTF-8
Java
false
false
293
java
package com._520it.crm.mapper; import com._520it.crm.domain.Log; import java.util.List; public interface LogMapper { int deleteByPrimaryKey(Long id); int insert(Log record); Log selectByPrimaryKey(Long id); List<Log> selectAll(); int updateByPrimaryKey(Log record); }
b91f3d04f9e32761b2f54e4bef886e9b77f07c02
f680094f6d14de8d3f57bd25013729f2d5578592
/src/org/encog/ml/data/MLDataSet.java
8be61937fc63d7baa3e0cf2e8b6034ffc8d94cf2
[]
no_license
bernardobreder/demo-neural-network
82dc070f04eb8995ece040274a9c04e06c5cb153
adf4485064bc4c1cf9dbad2f54242e31e23bdcd2
refs/heads/master
2022-04-07T06:19:31.087748
2020-02-10T11:58:47
2020-02-10T11:58:47
104,338,038
1
0
null
null
null
null
UTF-8
Java
false
false
3,476
java
/* * Encog(tm) Core v3.3 - Java Version * http://www.heatonresearch.com/encog/ * https://github.com/encog/encog-java-core * Copyright 2008-2014 Heaton Research, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * For more information on Heaton Research copyrights, licenses * and trademarks visit: * http://www.heatonresearch.com/copyright */ package org.encog.ml.data; /** * An interface designed to abstract classes that store machine learning data. * This interface is designed to provide EngineDataSet objects. These can be * used to train machine learning methods using both supervised and unsupervised * training. * * Some implementations of this interface are memory based. That is they store * the entire contents of the dataset in memory. * * Other implementations of this interface are not memory based. These * implementations read in data as it is needed. This allows very large datasets * to be used. Typically the add methods are not supported on non-memory based * datasets. * * @author jheaton */ public interface MLDataSet extends Iterable<MLDataPair> { /** * @return The size of the ideal data. */ int getIdealSize(); /** * @return The size of the input data. */ int getInputSize(); /** * @return True if this is a supervised training set. */ boolean isSupervised(); /** * Determine the total number of records in the set. * * @return The total number of records in the set. */ long getRecordCount(); /** * Read an individual record, specified by index, in random order. * * @param index * The index to read. * @param pair * The pair that the record will be copied into. */ void getRecord(long index, MLDataPair pair); /** * Opens an additional instance of this dataset. * * @return The new instance. */ MLDataSet openAdditional(); /** * Add a object to the dataset. This is used with unsupervised training, as * no ideal output is provided. Note: not all implemenations support the add * methods. * * @param data1 * The data item to be added. */ void add(MLData data1); /** * Add a set of input and ideal data to the dataset. This is used with * supervised training, as ideal output is provided. Note: not all * implementations support the add methods. * * @param inputData * Input data. * @param idealData * Ideal data. */ void add(MLData inputData, MLData idealData); /** * Add a an object to the dataset. This is used with unsupervised training, * as no ideal output is provided. Note: not all implementations support the * add methods. * * @param inputData * A MLDataPair object that contains both input and ideal data. */ void add(MLDataPair inputData); /** * Close this datasource and release any resources obtained by it, including * any iterators created. */ void close(); int size(); MLDataPair get(int index); }
ade386d13d7be0a5a2ce7dfe443e295b67de8997
eea442d8371a96947d0c909ba1343b30ceb3e7af
/app/src/main/java/com/example/extodo2/data/TaskRespository.java
43f481aa8b3735689a42358841174ad310552ad4
[]
no_license
duythach0405/extodo22
1d12217acadd22fbc971321fa360d76246bff575
99ba97410e57929faf0132aacb1f18e6ce706cf8
refs/heads/master
2022-11-28T10:58:09.398596
2020-08-10T11:19:48
2020-08-10T11:19:48
286,900,389
0
0
null
null
null
null
UTF-8
Java
false
false
1,951
java
package com.example.extodo2.data; import com.google.common.base.Optional; import java.util.List; import io.reactivex.Flowable; import static com.google.common.base.Preconditions.checkNotNull; public class TaskRespository implements TaskDataSource { private static TaskRespository INSTANCE = null; private final TaskDataSource mTasksLocalDataSource; public TaskRespository(TaskDataSource tasksLocalDataSource) { this.mTasksLocalDataSource = tasksLocalDataSource; } public static TaskRespository getInstance(TaskDataSource tasksLocalDataSource) { if (INSTANCE == null){ INSTANCE = new TaskRespository(tasksLocalDataSource); } return INSTANCE; } @Override public Flowable<List<Task>> getTasks() { return mTasksLocalDataSource.getTasks(); } @Override public Flowable<Optional<Task>> getTask(String taskId) { return mTasksLocalDataSource .getTask(taskId) .firstElement().toFlowable(); } @Override public void saveTask(Task task) { mTasksLocalDataSource.saveTask(task); } @Override public void completeTask(Task task) { mTasksLocalDataSource.completeTask(task); } @Override public void completeTask(String taskId) { mTasksLocalDataSource.completeTask(taskId); } @Override public void activateTask(Task task) { mTasksLocalDataSource.activateTask(task); } @Override public void activateTask(String taskId) { mTasksLocalDataSource.activateTask(taskId); } @Override public void clearCompletedTasks() { mTasksLocalDataSource.clearCompletedTasks(); } @Override public void deleteAllTasks() { mTasksLocalDataSource.deleteAllTasks(); } @Override public void deleteTask(String taskId) { mTasksLocalDataSource.deleteTask(checkNotNull(taskId)); } }
7f30839b2c75456bd346c7d8f8de33be21ce519c
2d5e7020195b5afd5e946c410d8b7fa9812a2f3d
/14LoginMVC/src/java/com/example/util/DbUtil.java
be7d6b3c5957c9ef9ee5f19d9c86e107574142af
[]
no_license
upcebu/j2ee
fb988dddfbd6cbd14d338eebbb807552b84ac226
87e0dab079021f98b4ed829e5466216e88a3ad4c
refs/heads/master
2021-01-19T02:14:04.780083
2015-05-15T17:23:20
2015-05-15T17:23:20
33,190,600
0
0
null
null
null
null
UTF-8
Java
false
false
2,462
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 com.example.util; import com.example.dao.UserDao; import com.example.model.UserBean; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.util.Properties; import java.util.logging.Level; import java.util.logging.Logger; /** * * @author DCS */ public class DbUtil { private Connection connection = null; public Connection getConnection(){ if(connection != null){ return connection; }else{ try{ Properties prop = new Properties(); InputStream inputStream = DbUtil.class.getClassLoader().getResourceAsStream("/db.properties"); prop.load(inputStream); String driver = prop.getProperty("driver"); String url = prop.getProperty("url"); String user = prop.getProperty("user"); String pass = prop.getProperty("password"); Class.forName(driver); connection = DriverManager.getConnection(url, user, pass); }catch(ClassNotFoundException e){ System.out.println("CLASS NOT FOUND"); e.printStackTrace(); }catch(SQLException e){ System.out.println("SQL EXCEPTION"); e.printStackTrace(); } catch(FileNotFoundException e){ System.out.println("FILE NOT FOUND"); e.printStackTrace(); }catch(IOException e){ System.out.println("IOEXCEPTION"); e.printStackTrace(); }catch(Exception e){ System.out.println("GENERIC EXCEPTION"); e.printStackTrace(); } return connection; } } public boolean disconnect(){ try{ connection.close(); }catch(SQLException se){ //Handle errors for JDBC se.printStackTrace(); }catch(Exception e){ //Handle errors for Class.forName e.printStackTrace(); } return true; } }
deb27cc3d00638c253f66e81963ff38dd744baae
ef6fead2bf1aaedbef0707b5ad900c1bfe52e0eb
/SLIB/src/main/java/com/sp/lib/activity/STestActivity.java
2aa7c03054d6be598d0a35a08d8dab261ab3707f
[]
no_license
summerEnd/Svmuu
431f404a90c7d3b53162952b28d4012ef6a3a2f2
e9ec97bcbcafa52175c4490dd7be7f751334ff7e
refs/heads/master
2021-01-23T08:57:01.926816
2015-07-15T10:16:06
2015-07-15T10:16:06
33,851,430
0
0
null
null
null
null
UTF-8
Java
false
false
2,474
java
package com.sp.lib.activity; import android.app.Activity; import android.app.ListActivity; import android.content.Intent; import android.graphics.Color; import android.os.Bundle; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ListView; import android.widget.TextView; import com.sp.lib.widget.material.MaterialLayout; import java.util.ArrayList; import java.util.List; public abstract class STestActivity extends ListActivity { private List<Class<? extends Activity>> activities = new ArrayList<Class<? extends Activity>>(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addTest(activities); setListAdapter(new MyAdapter()); } /** * add your test Here * * @param activities */ protected abstract void addTest(List<Class<? extends Activity>> activities); private class MyAdapter extends BaseAdapter implements View.OnClickListener{ @Override public int getCount() { return activities.size(); } @Override public Object getItem(int position) { return activities.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { MaterialLayout layout; if (convertView == null) { layout = new MaterialLayout(STestActivity.this); layout.setMaterialBackground(Color.WHITE); layout.setMaterialWave(Color.LTGRAY); TextView textView = new TextView(STestActivity.this); textView.setTextColor(Color.BLACK); textView.setTextSize(17); textView.setPadding(10,15,10,15); layout.addView(textView); layout.setOnClickListener(this); } else { layout = (MaterialLayout) convertView; } ((TextView) layout.getChildAt(1)).setText(activities.get(position).getSimpleName()); layout.setTag(position); return layout; } @Override public void onClick(View v) { int position= (int) v.getTag(); startActivity(new Intent(STestActivity.this, activities.get(position))); } } }
c706e95382343cbe217feb61f3f94cda32807bf9
c7066be95e0f4e403611e6de6fcf52aaef00b3cd
/business/order/src/main/java/org/hkm/order/mybatis/OrderDiscountTypeTypeHandler.java
cc408116bd3e7637c5914b34d0972a7afab72625
[]
no_license
houkemian/my_micro_service
0b0f585311d7ae9fcec973f6d9cd0f533399efc3
7d65b1fe5a78d43cce8157fdc2730d9b1c46bd49
refs/heads/master
2022-06-29T23:43:21.294114
2020-04-09T08:57:49
2020-04-09T08:57:49
251,099,767
1
0
null
2022-06-21T03:05:44
2020-03-29T18:09:23
Java
UTF-8
Java
false
false
1,278
java
package org.hkm.order.mybatis; import org.apache.ibatis.type.BaseTypeHandler; import org.apache.ibatis.type.JdbcType; import org.apache.ibatis.type.MappedTypes; import org.hkm.order.entity.Order; import java.sql.CallableStatement; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; @MappedTypes(Order.DiscountType.class) public class OrderDiscountTypeTypeHandler extends BaseTypeHandler<Order.DiscountType> { @Override public void setNonNullParameter(PreparedStatement preparedStatement, int i, Order.DiscountType discountType, JdbcType jdbcType) throws SQLException { preparedStatement.setInt(i, discountType.val()); } @Override public Order.DiscountType getNullableResult(ResultSet resultSet, String s) throws SQLException { return Order.DiscountType.discountType(resultSet.getInt(s)); } @Override public Order.DiscountType getNullableResult(ResultSet resultSet, int i) throws SQLException { return Order.DiscountType.discountType(resultSet.getInt(i)); } @Override public Order.DiscountType getNullableResult(CallableStatement callableStatement, int i) throws SQLException { return Order.DiscountType.discountType(callableStatement.getInt(i)); } }
4345791e4297bb3dbac2bfe5d345652382bc8a86
02d8e30608af405b3376cb40b23e63129e4a3f3d
/app/src/main/java/com/begoit/mooc/offline/utils/CourseFormatUtils.java
61a8a1a01647d9e0ee696f2920275ed865fe6150
[]
no_license
XiaYL/begoit
c2a312f495df529245709cb57a244e8d386b2e42
229c189c95a6d51ecf7d15298d35d36b3419fe9a
refs/heads/master
2020-09-23T01:38:45.428641
2019-11-25T16:16:34
2019-11-25T16:16:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,125
java
package com.begoit.mooc.offline.utils; import com.begoit.mooc.offline.entity.course.course_detail.course_files.CourseDetailFilesData; /** * @Description:对课程数据的一些操作 * @Author:gxj * @Time 2019/4/15 */ public class CourseFormatUtils { /** * 对课程章节添加序号 * @param entity * @return */ public static CourseDetailFilesData addPosition(CourseDetailFilesData entity) { if (entity != null && entity.data != null && entity.data.articleClass != null) { int i = 0; int j = 0; for (i = 0; i < entity.data.articleClass.size(); i++) { entity.data.articleClass.get(i).chapterPosition = i + 1 + ""; if (entity.data.articleClass.get(i) != null && entity.data.articleClass.get(i).articel != null) { for (j = 0; j < entity.data.articleClass.get(i).articel.size(); j++) { entity.data.articleClass.get(i).articel.get(j).sectionPosition = (i + 1) + "-" + (j + 1); } } } } return entity; } }
1e18a24537fd36ce60b9a6a6b8601896350e3425
b511da024818e27ce8cc43a7d5e025fc3d5fc082
/Problem/src/algo/Trie.java
414532d2032ab43ed2ce6d77e97b149498862fc7
[]
no_license
JJongSue/ssafy_algorithm
47c6eb1a541d3b152da2dbcd1750306eaa9d18b6
b12ca4e9c3bb77888fd10490a75ce615851bf88a
refs/heads/master
2021-07-06T04:47:49.424172
2020-11-29T12:12:02
2020-11-29T12:12:02
208,687,156
0
0
null
null
null
null
UTF-8
Java
false
false
664
java
package algo; public class Trie { static Node trie[] = new Node[200]; static class Node{ int next[] = new int[26]; int cnt; public Node() { for(int i=0;i<26;i++) next[i] = -1; cnt=0; } } static int root; static int trieN; void init() { root = 0; trieN = 0; trie[0] = new Node(); } void Insert(int trieIdx, int bufIdx, int buffer_size, String buf) { trie[trieIdx].cnt++; if(bufIdx == buffer_size) return; int ch = buf.charAt(bufIdx) - 'a'; if(trie[trieIdx].next[ch] == -1) { trie[trieIdx].next[ch] = ++trieN; trie[trieN] = new Node(); } Insert(trie[trieIdx].next[ch], bufIdx+1, buffer_size, buf); } }
2dd4a9550c849a77b7b4c336edaa3f1a52fb9f84
f1e64e8f51066ad01385a0566858c85d74a89e10
/VolleySample/app/src/main/gen/com/example/kgpi01/volleysample/Manifest.java
67d7692623133f5f0b8a0b93c1217c4d3b1d00b1
[]
no_license
kgpi/AndroidSample
0274a09d37b897b6dae21f39aa7b206d72066afd
0eec47c38f621610f18e0c2c01c89522497729a6
refs/heads/master
2021-01-10T08:20:20.532012
2015-12-30T08:27:43
2015-12-30T08:27:43
46,611,138
0
0
null
null
null
null
UTF-8
Java
false
false
201
java
/*___Generated_by_IDEA___*/ package com.example.kgpi01.volleysample; /* This stub is only used by the IDE. It is NOT the Manifest class actually packed into the APK */ public final class Manifest { }
4709ad9979a5de43af2fd8e06262f9c60bedd51b
1ed72a651f7bb97c8afb04ba6c3c02dc7c66c428
/src/main/java/com/hillel/lecture_12/MainConverter.java
41b5ac4bd25644d1e01eaea7b1a2c7d3cb168942
[]
no_license
MarinaOn/home-work-tasks
d5e0b8c3ddd4173feacba4e6d225b55824192085
0797a79caa6ab48044ea558b33e0f2f87be338cd
refs/heads/master
2021-02-03T22:47:57.960202
2020-04-22T20:52:19
2020-04-22T20:52:19
243,564,294
0
0
null
2020-02-27T16:35:38
2020-02-27T16:35:37
null
UTF-8
Java
false
false
634
java
package com.hillel.lecture_12; public class MainConverter { public static void main(String[] args) throws ConverterCalculationException { ConverterFactory converterFactory = new ConverterFactory(); try { IConverter converter = converterFactory.createConverter(ConverterTypes.CELSIUSTOFAHRENHEIT); System.out.println(converter.doubleConvert(-10.0)); } catch (ConverterCalculationException e){ System.out.println("The value is lower than 0!"); } catch (MissedConverterExeption exception){ System.out.println("No such converter"); } } }
9ef9f1b787545962740506b84b093fc5f086de58
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/23/23_d74022c117aa44ce560772802459be762ebe2277/TutorialToolBehaviorProvider/23_d74022c117aa44ce560772802459be762ebe2277_TutorialToolBehaviorProvider_s.java
b5bc916480c3e43fb3bf1fe9682a7a931ff8560f
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
10,527
java
/******************************************************************************* * <copyright> * * Copyright (c) 2005, 2010 SAP AG. * 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: * SAP AG - initial API, implementation and documentation * * </copyright> * *******************************************************************************/ package org.eclipse.graphiti.examples.tutorial.diagram; import java.util.ArrayList; import java.util.List; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; import org.eclipse.graphiti.dt.IDiagramTypeProvider; import org.eclipse.graphiti.examples.tutorial.TutorialImageProvider; import org.eclipse.graphiti.examples.tutorial.features.TutorialCollapseDummyFeature; import org.eclipse.graphiti.examples.tutorial.features.TutorialRenameEClassFeature; import org.eclipse.graphiti.features.ICreateConnectionFeature; import org.eclipse.graphiti.features.ICreateFeature; import org.eclipse.graphiti.features.IFeatureProvider; import org.eclipse.graphiti.features.context.ICustomContext; import org.eclipse.graphiti.features.context.IDoubleClickContext; import org.eclipse.graphiti.features.context.IPictogramElementContext; import org.eclipse.graphiti.features.context.impl.CreateConnectionContext; import org.eclipse.graphiti.features.context.impl.CustomContext; import org.eclipse.graphiti.features.custom.ICustomFeature; import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm; import org.eclipse.graphiti.mm.pictograms.Anchor; import org.eclipse.graphiti.mm.pictograms.AnchorContainer; import org.eclipse.graphiti.mm.pictograms.ContainerShape; import org.eclipse.graphiti.mm.pictograms.PictogramElement; import org.eclipse.graphiti.palette.IPaletteCompartmentEntry; import org.eclipse.graphiti.palette.impl.ConnectionCreationToolEntry; import org.eclipse.graphiti.palette.impl.ObjectCreationToolEntry; import org.eclipse.graphiti.palette.impl.PaletteCompartmentEntry; import org.eclipse.graphiti.palette.impl.StackEntry; import org.eclipse.graphiti.platform.IPlatformImageConstants; import org.eclipse.graphiti.services.Graphiti; import org.eclipse.graphiti.tb.ContextButtonEntry; import org.eclipse.graphiti.tb.ContextEntryHelper; import org.eclipse.graphiti.tb.ContextMenuEntry; import org.eclipse.graphiti.tb.DefaultToolBehaviorProvider; import org.eclipse.graphiti.tb.IContextButtonEntry; import org.eclipse.graphiti.tb.IContextButtonPadData; import org.eclipse.graphiti.tb.IContextMenuEntry; import org.eclipse.graphiti.tb.IDecorator; import org.eclipse.graphiti.tb.ImageDecorator; public class TutorialToolBehaviorProvider extends DefaultToolBehaviorProvider { public TutorialToolBehaviorProvider(IDiagramTypeProvider dtp) { super(dtp); } @Override public IContextButtonPadData getContextButtonPad(IPictogramElementContext context) { IContextButtonPadData data = super.getContextButtonPad(context); PictogramElement pe = context.getPictogramElement(); // 1. set the generic context buttons // note, that we do not add 'remove' (just as an example) setGenericContextButtons(data, pe, CONTEXT_BUTTON_DELETE | CONTEXT_BUTTON_UPDATE); // 2. set the collapse button // simply use a dummy custom feature (senseless example) CustomContext cc = new CustomContext(new PictogramElement[] { pe }); ICustomFeature[] cf = getFeatureProvider().getCustomFeatures(cc); for (int i = 0; i < cf.length; i++) { ICustomFeature iCustomFeature = cf[i]; if (iCustomFeature instanceof TutorialCollapseDummyFeature) { IContextButtonEntry collapseButton = ContextEntryHelper.createCollapseContextButton(true, iCustomFeature, cc); data.setCollapseContextButton(collapseButton); break; } } // 3. add one domain specific context-button, which offers all // available connection-features as drag&drop features... // 3.a. create new CreateConnectionContext CreateConnectionContext ccc = new CreateConnectionContext(); ccc.setSourcePictogramElement(pe); Anchor anchor = null; if (pe instanceof Anchor) { anchor = (Anchor) pe; } else if (pe instanceof AnchorContainer) { // assume, that our shapes always have chopbox anchors anchor = Graphiti.getPeService().getChopboxAnchor((AnchorContainer) pe); } ccc.setSourceAnchor(anchor); // 3.b. create context button and add all applicable features ContextButtonEntry button = new ContextButtonEntry(null, context); button.setText("Create connection"); //$NON-NLS-1$ button.setIconId(TutorialImageProvider.IMG_EREFERENCE); ICreateConnectionFeature[] features = getFeatureProvider().getCreateConnectionFeatures(); for (ICreateConnectionFeature feature : features) { if (feature.isAvailable(ccc) && feature.canStartConnection(ccc)) button.addDragAndDropFeature(feature); } // 3.c. add context button, if it contains at least one feature if (button.getDragAndDropFeatures().size() > 0) { data.getDomainSpecificContextButtons().add(button); } return data; } @Override public IContextMenuEntry[] getContextMenu(ICustomContext context) { // create a sub-menu for all custom features ContextMenuEntry subMenu = new ContextMenuEntry(null, context); subMenu.setText("Cu&stom"); //$NON-NLS-1$ subMenu.setDescription("Custom features submenu"); //$NON-NLS-1$ // display sub-menu hierarchical or flat subMenu.setSubmenu(true); // create a menu-entry in the sub-menu for each custom feature ICustomFeature[] customFeatures = getFeatureProvider().getCustomFeatures(context); for (int i = 0; i < customFeatures.length; i++) { ICustomFeature customFeature = customFeatures[i]; if (customFeature.isAvailable(context)) { ContextMenuEntry menuEntry = new ContextMenuEntry(customFeature, context); subMenu.add(menuEntry); } } IContextMenuEntry ret[] = new IContextMenuEntry[] { subMenu }; return ret; } @Override public IPaletteCompartmentEntry[] getPalette() { List<IPaletteCompartmentEntry> ret = new ArrayList<IPaletteCompartmentEntry>(); // add compartments from super class IPaletteCompartmentEntry[] superCompartments = super.getPalette(); for (int i = 0; i < superCompartments.length; i++) ret.add(superCompartments[i]); // add new compartment at the end of the existing compartments PaletteCompartmentEntry compartmentEntry = new PaletteCompartmentEntry("Stacked", null); //$NON-NLS-1$ ret.add(compartmentEntry); // add new stack entry to new compartment StackEntry stackEntry = new StackEntry("EObject", "EObject", null); //$NON-NLS-1$ //$NON-NLS-2$ compartmentEntry.addToolEntry(stackEntry); // add all create-features to the new stack-entry IFeatureProvider featureProvider = getFeatureProvider(); ICreateFeature[] createFeatures = featureProvider.getCreateFeatures(); for (ICreateFeature cf : createFeatures) { ObjectCreationToolEntry objectCreationToolEntry = new ObjectCreationToolEntry(cf.getCreateName(), cf.getCreateDescription(), cf.getCreateImageId(), cf.getCreateLargeImageId(), cf); stackEntry.addCreationToolEntry(objectCreationToolEntry); } // add all create-connection-features to the new stack-entry ICreateConnectionFeature[] createConnectionFeatures = featureProvider.getCreateConnectionFeatures(); for (ICreateConnectionFeature cf : createConnectionFeatures) { ConnectionCreationToolEntry connectionCreationToolEntry = new ConnectionCreationToolEntry(cf.getCreateName(), cf.getCreateDescription(), cf.getCreateImageId(), cf.getCreateLargeImageId()); connectionCreationToolEntry.addCreateConnectionFeature(cf); stackEntry.addCreationToolEntry(connectionCreationToolEntry); } return ret.toArray(new IPaletteCompartmentEntry[ret.size()]); } @Override public ICustomFeature getDoubleClickFeature(IDoubleClickContext context) { ICustomFeature customFeature = new TutorialRenameEClassFeature(getFeatureProvider()); // canExecute() tests especially if the context contains a EClass if (customFeature.canExecute(context)) { return customFeature; } return super.getDoubleClickFeature(context); } @Override public IDecorator[] getDecorators(PictogramElement pe) { IFeatureProvider featureProvider = getFeatureProvider(); Object bo = featureProvider.getBusinessObjectForPictogramElement(pe); if (bo instanceof EClass) { EClass eClass = (EClass) bo; String name = eClass.getName(); if (name != null && name.length() > 0 && !(name.charAt(0) >= 'A' && name.charAt(0) <= 'Z')) { IDecorator imageRenderingDecorator = new ImageDecorator(IPlatformImageConstants.IMG_ECLIPSE_WARNING_TSK); imageRenderingDecorator.setMessage("Name should start with upper case letter"); //$NON-NLS-1$ return new IDecorator[] { imageRenderingDecorator }; } } return super.getDecorators(pe); } @Override public GraphicsAlgorithm[] getClickArea(PictogramElement pe) { IFeatureProvider featureProvider = getFeatureProvider(); Object bo = featureProvider.getBusinessObjectForPictogramElement(pe); if (bo instanceof EClass) { GraphicsAlgorithm invisible = pe.getGraphicsAlgorithm(); GraphicsAlgorithm rectangle = invisible.getGraphicsAlgorithmChildren().get(0); return new GraphicsAlgorithm[] { rectangle }; } return super.getClickArea(pe); } @Override public GraphicsAlgorithm getSelectionBorder(PictogramElement pe) { if (pe instanceof ContainerShape) { GraphicsAlgorithm invisible = pe.getGraphicsAlgorithm(); if (!invisible.getLineVisible()) { EList<GraphicsAlgorithm> graphicsAlgorithmChildren = invisible.getGraphicsAlgorithmChildren(); if (!graphicsAlgorithmChildren.isEmpty()) { return graphicsAlgorithmChildren.get(0); } } } return super.getSelectionBorder(pe); } @Override public String getToolTip(GraphicsAlgorithm ga) { PictogramElement pe = ga.getPictogramElement(); Object bo = getFeatureProvider().getBusinessObjectForPictogramElement(pe); if (bo instanceof EClass) { String name = ((EClass) bo).getName(); if (name != null && !name.isEmpty()) { return name; } } return super.getToolTip(ga); } }
3c79817d2646a5cfc3cf171b93a7228490086b4a
8b96417ea286f9b2d3ec7d448e1a31c0ba8d57cb
/metaobj/metaobj-util/tool-lib/src/java/org/sakaiproject/metaobj/shared/control/servlet/SakaiComponentDispatchServlet.java
4b3f084111de1f4f36b286260d3286b57b76a0f6
[ "ECL-2.0" ]
permissive
deemsys/Deemsys_Learnguild
d5b11c5d1ad514888f14369b9947582836749883
606efcb2cdc2bc6093f914f78befc65ab79d32be
refs/heads/master
2021-01-15T16:16:12.036004
2013-08-13T12:13:45
2013-08-13T12:13:45
12,083,202
0
1
null
null
null
null
UTF-8
Java
false
false
6,227
java
/********************************************************************************** * $URL: https://source.sakaiproject.org/svn/metaobj/tags/sakai-2.9.2/metaobj-util/tool-lib/src/java/org/sakaiproject/metaobj/shared/control/servlet/SakaiComponentDispatchServlet.java $ * $Id: SakaiComponentDispatchServlet.java 73944 2010-02-21 11:37:41Z [email protected] $ *********************************************************************************** * * Copyright (c) 2004, 2005, 2006, 2007, 2008, 2009 The Sakai Foundation * * Licensed under the Educational Community 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.osedu.org/licenses/ECL-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.sakaiproject.metaobj.shared.control.servlet; import java.util.Iterator; import java.util.List; import java.util.Map; import javax.servlet.ServletConfig; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.metaobj.shared.model.Agent; import org.sakaiproject.metaobj.shared.model.Artifact; import org.sakaiproject.metaobj.shared.model.Id; import org.sakaiproject.metaobj.shared.model.IdImpl; import org.sakaiproject.metaobj.shared.model.OspException; import org.sakaiproject.tool.api.Session; import org.sakaiproject.tool.api.ToolSession; import org.sakaiproject.tool.cover.SessionManager; import org.springframework.web.servlet.DispatcherServlet; public class SakaiComponentDispatchServlet extends DispatcherServlet { private class SimpleAgent2 implements Agent { String uid = ""; String eid = ""; SimpleAgent2(String eid, String uid) { this.eid = eid; this.uid = uid; } public Id getId() { return new IdImpl(uid, null); } public Id getEid() { return new IdImpl(eid, null); } public Artifact getProfile() { return null; //To change body of implemented methods use File | Settings | File Templates. } public Object getProperty(String key) { return null; //To change body of implemented methods use File | Settings | File Templates. } public String getDisplayName() { return this.uid; } public boolean isInRole(String role) { return false; //To change body of implemented methods use File | Settings | File Templates. } public boolean isInitialized() { return false; //To change body of implemented methods use File | Settings | File Templates. } public String getRole() { return null; //To change body of implemented methods use File | Settings | File Templates. } public List getWorksiteRoles(String worksiteId) { return null; //To change body of implemented methods use File | Settings | File Templates. } public List getWorksiteRoles() { return null; //To change body of implemented methods use File | Settings | File Templates. } public boolean isRole() { return false; } public String getName() { return null; //To change body of implemented methods use File | Settings | File Templates. } public String getPassword() { return null; // not implemented } } protected final transient Log logger = LogFactory.getLog(getClass()); public static final String TOOL_STATE_VIEW_KEY = "osp.tool.state.view"; public static final String TOOL_STATE_VIEW_REQUEST_PARAMS_KEY = "osp.tool.state.request.params"; /** * Obtain and use the handler for this method. * The handler will be obtained by applying the servlet's HandlerMappings in order. * The HandlerAdapter will be obtained by querying the servlet's * installed HandlerAdapters to find the first that supports the handler class. * Both doGet() and doPost() are handled by this method. * It's up to HandlerAdapters to decide which methods are acceptable. */ protected void doService(HttpServletRequest req, HttpServletResponse resp) throws Exception { // This class has been removed from all places where it was used and replaced by the Spring // dispatcher from which it inherits. Delegate to super for now in case this ever gets called. // There is one place that depends on the tool constants above, in CommentListGenerator. // These constants should be relocated and this class purged. super.doService(req, resp); } /** * Called by the servlet container to indicate to a servlet that the * servlet is being placed into service. See {@link javax.servlet.Servlet#init}. * <p/> * <p>This implementation stores the {@link javax.servlet.ServletConfig} * object it receives from the servlet container for later use. * When overriding this form of the method, call * <code>super.init(config)</code>. * * @param config the <code>ServletConfig</code> object * that contains configutation * information for this servlet * @throws javax.servlet.ServletException if an exception occurs that * interrupts the servlet's normal * operation * @see javax.servlet.UnavailableException */ public void init(ServletConfig config) throws ServletException { super.init(config); } protected RequestSetupFilter getFilter() { return (RequestSetupFilter) ComponentManager.getInstance().get(RequestSetupFilter.class.getName()); } }
f995e7c5beb41d24fde0048cecb2030ef04cb362
43cb89f20b58b16bdb97937887271be96d1a241e
/src/test/java/com/learning/steps/LoginSteps.java
f99f1dcd1b82fc6784f6e793a7a2f67ebac2d993
[]
no_license
JagrutiThorat/TestProjects
7a9c410984515f438ae89fa31455d63ea04e7e20
78fab2e0e673decfa6220968536a308fe4b08b3f
refs/heads/master
2021-07-25T05:04:06.943756
2017-11-05T13:22:58
2017-11-05T13:22:58
109,579,203
0
0
null
null
null
null
UTF-8
Java
false
false
1,620
java
package com.learning.steps; import org.junit.Assert; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import cucumber.api.java.en.Given; import cucumber.api.java.en.Then; import cucumber.api.java.en.When; public class LoginSteps { FirefoxDriver driver = new FirefoxDriver(); @Given("^user hits the url \"([^\"]*)\"$") public void user_hits_the_url(String url) throws Throwable { driver.get(url); driver.findElement(By.partialLinkText("Gmail")).click(); driver.findElement(By.linkText("Sign In")).click(); } @When("^user enters the username \"([^\"]*)\" And password \"([^\"]*)\"$") public void user_enters_the_username_And_password(String username, String password) throws Throwable { driver.findElement(By.id("identifierId")).sendKeys(username); driver.findElement(By.id("identifierNext")).click(); WebElement ide5= driver.findElement(By.xpath("//input[@name='password']")); WebDriverWait wait = new WebDriverWait(driver, 20); wait.until(ExpectedConditions.elementToBeClickable(ide5)); ide5.sendKeys(password); WebElement id4 = driver.findElement(By.xpath(".//*[@id='passwordNext']/content/span")); id4.click(); } @Then("^user see \"([^\"]*)\" button$") public void user_see_button(String compose) throws Throwable { WebElement id8 = driver.findElement(By.xpath("//div[contains(text(),'COMPOSE')]")); Assert.assertEquals(compose,id8.getText()); } }
150127a9b0b9e2e48bf03812c320cb726e97e765
28c84be60c5eb64a8bea2b3b58817fb5a0811611
/android/app/src/main/java/com/mobile_31_july_dev_8340/MainActivity.java
68089620d3cd09e968c1f426d1035d4280a709bd
[]
no_license
crowdbotics-apps/mobile-31-july-dev-8340
5b114a40df4f8061590b49d51bb244e1afddbc45
4f3bd03a29f17c5feacdd64f64e1bdcb34824ae9
refs/heads/master
2022-11-27T13:40:11.412098
2020-07-31T08:25:53
2020-07-31T08:25:53
283,946,765
0
0
null
null
null
null
UTF-8
Java
false
false
391
java
package com.mobile_31_july_dev_8340; import com.facebook.react.ReactActivity; public class MainActivity extends ReactActivity { /** * Returns the name of the main component registered from JavaScript. * This is used to schedule rendering of the component. */ @Override protected String getMainComponentName() { return "mobile_31_july_dev_8340"; } }
ce5ccece32ec08adf6bfc04909b20af08bbaa106
2650a12195147758e68019cdef8e8b097e663091
/service/auth-service/src/main/java/com/bht/saigonparking/service/auth/configuration/CustomSQLServerDialect.java
c89390fdf532361aed4e3517704b5ba67cdc68cd
[ "Apache-2.0" ]
permissive
huynhthanhbinh/saigonparking
7e9ac17bd246af9970b3dbb26dcac890e1136bfe
0ae6da03120a92e411ecb6bef2a983ab31b0b716
refs/heads/master
2022-12-24T15:13:12.471734
2020-09-20T05:56:36
2020-09-20T05:56:36
240,213,924
1
0
null
null
null
null
UTF-8
Java
false
false
889
java
package com.bht.saigonparking.service.auth.configuration; import java.util.HashMap; import java.util.Map; import org.hibernate.dialect.SQLServerDialect; import org.hibernate.dialect.function.StandardSQLFunction; import org.hibernate.type.Type; /** * Custom SQL Server Dialect * Extends from Hibernate SQL Server Dialect * This class will be called on hibernate init * Register all user-defined functions here! * * @author bht */ public final class CustomSQLServerDialect extends SQLServerDialect { public CustomSQLServerDialect() { super(); Map<String, Type> userDefinedFunctions = registeredUserDefinedFunctions(); userDefinedFunctions.forEach((func, type) -> registerFunction(func, new StandardSQLFunction(func, type))); } private Map<String, Type> registeredUserDefinedFunctions() { return new HashMap<>(); } }
d97532b8ce1e57b6539d32874083f997f6317f81
a5ca3d9323fd60644a00ef5df233eac29d3a1c6d
/dapp/dapp-service-server/src/main/java/com/bosha/dapp/server/mq/WitnessMqListener.java
6f2a3691b77a8b4d89fe6ef6fb0df8807643244b
[]
no_license
pulsarchain/pulsar-service-api
6211b998d08e5875319bf8f34e54766f593a8122
fc0b1162afc935fd03d81eeb929bb2d8c654d6bd
refs/heads/master
2022-12-07T22:48:59.625966
2020-08-26T07:07:01
2020-08-26T07:07:01
290,420,727
0
0
null
null
null
null
UTF-8
Java
false
false
4,726
java
package com.bosha.dapp.server.mq; import java.util.Date; import com.bosha.dapp.api.entity.SparksFundation; import com.bosha.dapp.api.entity.SparksOrg; import com.bosha.dapp.api.entity.SparksStar; import com.bosha.dapp.api.entity.SparksWitness; import com.bosha.dapp.api.enums.SparksStarStatusEnum; import com.bosha.dapp.api.enums.WitnessEnum; import com.bosha.dapp.server.mapper.SparksFundationMapper; import com.bosha.dapp.server.mapper.SparksOrgMapper; import com.bosha.dapp.server.mapper.SparksStarMapper; import com.bosha.dapp.server.mapper.SparksWitnessMapper; import com.bosha.user.api.dto.BlockDto; import lombok.extern.slf4j.Slf4j; import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; import org.apache.rocketmq.spring.core.RocketMQListener; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; /** * Created with IntelliJ IDEA 2020.1 * * @DESCRIPTION: WitnessMqListener * @Author liqingping:[email protected] * @Date 2020-05-26 14:16 */ @Slf4j @RocketMQMessageListener(consumerGroup = "${spring.application.name}" + "_witness", topic = BlockDto.TransactionDto.TOPIC) @Component public class WitnessMqListener implements RocketMQListener<BlockDto.TransactionDto> { @Autowired private SparksWitnessMapper witnessMapper; @Autowired private SparksStarMapper sparksStarMapper; @Autowired private SparksOrgMapper orgMapper; @Autowired private SparksFundationMapper fundationMapper; @Override public void onMessage(BlockDto.TransactionDto message) { String hash = message.getHash(); SparksWitness witness = witnessMapper.getByHash(hash); if (witness == null) return; log.info("【邀请见证】witness={}\nmsg={}", witness, message); witness.setUpdateTime(message.getTransactionTime()); witness.setAmount(message.getAmount()); witnessMapper.updateByPrimaryKeySelective(witness); WitnessEnum instance = WitnessEnum.getInstance(witness.getType()); switch (instance) { case MAKE: case WIPE: case LIGHT: SparksStar sparksStar = sparksStarMapper.selectByPrimaryKey(witness.getReleatedId()); if (sparksStar == null) { log.warn("【星星之火见证】未查询到相关记录:{}", witness); return; } if (sparksStar.getStatus() != SparksStarStatusEnum.WITNESSING.getStatus()) return; int count = witnessMapper.countSuccess(sparksStar.getId()); if (count == 8) { sparksStar.setStatus(SparksStarStatusEnum.SUCCESS.getStatus()); sparksStar.setUpdateTime(new Date()); sparksStarMapper.updateByPrimaryKeySelective(sparksStar); log.info("【星星之火见证】成功:{}", sparksStar); } break; case ORG: SparksOrg sparksOrg = orgMapper.selectByPrimaryKey(witness.getReleatedId()); if (sparksOrg == null) { log.warn("【机构见证】未查询到相关记录:{}", witness); return; } if (sparksOrg.getStatus() != SparksOrg.STATUS_WITNESSING) return; int sparksOrgCount = witnessMapper.countSuccess(sparksOrg.getId()); if (sparksOrgCount == 10) { sparksOrg.setUpdateTime(new Date()); sparksOrg.setStatus(SparksOrg.STATUS_SUCCESS); orgMapper.updateByPrimaryKeySelective(sparksOrg); log.info("【机构见证】成功:{}", sparksOrg); } break; case FUNDATION: SparksFundation fundation = fundationMapper.selectByPrimaryKey(witness.getReleatedId()); if (fundation == null) { log.warn("【基金见证】为查询到相关记录:{}", witness); return; } if (fundation.getStatus() != SparksFundation.STATUS_WITNESSING) return; int fundationCount = witnessMapper.countSuccess(fundation.getId()); if (fundationCount == 10) { fundation.setUpdateTime(new Date()); fundation.setStatus(SparksFundation.STATUS_SUCCESS); fundationMapper.updateByPrimaryKeySelective(fundation); log.info("【基金见证】成功:{}", fundation); } break; } } }
22950d5b5aef9e5c6e71ff88eafced07ad220fb6
038ee6b20cae51169a2ed4ed64a7b8e99b5cbaad
/schemaOrgGson/src/org/kyojo/schemaorg/m3n4/gson/core/container/IsAccessibleForFreeDeserializer.java
8a177c3b10f58407ecb60ce7809f1994af1c5d59
[ "Apache-2.0" ]
permissive
nagaikenshin/schemaOrg
3dec1626781913930da5585884e3484e0b525aea
4c9d6d098a2741c2dc2a814f1c708ee55c36e9a8
refs/heads/master
2021-06-25T04:52:49.995840
2019-05-12T06:22:37
2019-05-12T06:22:37
134,319,974
1
0
null
null
null
null
UTF-8
Java
false
false
1,127
java
package org.kyojo.schemaorg.m3n4.gson.core.container; import java.lang.reflect.Field; import java.lang.reflect.Type; import java.util.HashMap; import java.util.Map; import org.kyojo.gson.JsonDeserializationContext; import org.kyojo.gson.JsonDeserializer; import org.kyojo.gson.JsonElement; import org.kyojo.gson.JsonParseException; import org.kyojo.schemaorg.m3n4.core.impl.IS_ACCESSIBLE_FOR_FREE; import org.kyojo.schemaorg.m3n4.core.Container.IsAccessibleForFree; import org.kyojo.schemaorg.m3n4.gson.DeserializerTemplate; public class IsAccessibleForFreeDeserializer implements JsonDeserializer<IsAccessibleForFree> { public static Map<String, Field> fldMap = new HashMap<>(); @Override public IsAccessibleForFree deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context) throws JsonParseException { if(jsonElement.isJsonPrimitive()) { return new IS_ACCESSIBLE_FOR_FREE(jsonElement.getAsBoolean()); } return DeserializerTemplate.deserializeSub(jsonElement, type, context, new IS_ACCESSIBLE_FOR_FREE(), IsAccessibleForFree.class, IS_ACCESSIBLE_FOR_FREE.class, fldMap); } }
590f27ca27a0b2d1cef395bead90a41f8397f5a3
4a10c99bfc9560d38c6fa2bb8fe5b7d8bc23c4f4
/src/MinCountToDelete.java
7b25687dbe1cbc938b6d4dec8ef774cfba2bd35b
[]
no_license
05himanshu05/HackerRank
d722cb672238d02a58c7c7463d7a9260d73858a2
22495a1b514340bf4d2e8e67fae1c1cbc738053f
refs/heads/main
2023-07-07T11:16:46.928399
2021-08-02T10:26:14
2021-08-02T10:26:14
373,145,232
0
0
null
null
null
null
UTF-8
Java
false
false
1,064
java
import java.util.ArrayList; import java.util.HashMap; import java.util.Map.Entry; public class MinCountToDelete { public static void main(String[] args) { String s = "aaaabbbbcccc"; System.out.println(minCountToDelte(s)); } static int minCountToDelte(String s) { char[] chars = s.toCharArray(); HashMap<Character, Integer> map = new HashMap<>(); for (char c : chars) { if (map.containsKey(c)) { map.put(c, map.get(c) + 1); } else { map.put(c, 1); } } System.out.println("map = " + map); ArrayList<Integer> list = new ArrayList<>(); for (Entry<Character, Integer> entry : map.entrySet()) { list.add(entry.getValue()); } System.out.println("list values = "+list); int deletionCount = 0; for (int i = 0; i < list.size(); i++) { for (int j = i + 1; j < list.size(); j++) { if( (list.get(i)>0) && (list.get(i)==list.get(j))) { System.out.println(j); list.set(j, list.get(j)-1); deletionCount++; } else break; } } return deletionCount; } }
506735fd3fce1420394edbb2fd5ccb6ec2d193bb
62721342b158a7e117a2f465ca2b97e6179dae3f
/src/ir/ues/jlwr/common/CreateXYChart.java
77db28ed8ad19a501ff3d3258a229e8d68b95886
[]
no_license
ahrnazemi/jlwr
62019bb433538541a9514d37d3788d012daaad3a
985d447d252a2702a1bbe5c9f253ed8520a50269
refs/heads/master
2021-01-19T12:58:16.045644
2014-08-24T10:31:09
2014-08-24T10:31:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,087
java
package ir.ues.jlwr.common; import ir.ues.jlwr.regression.SimpleRegression; import java.io.File; import java.io.IOException; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartUtilities; import org.jfree.chart.JFreeChart; import org.jfree.chart.plot.PlotOrientation; import org.jfree.data.xy.XYSeries; import org.jfree.data.xy.XYSeriesCollection; public class CreateXYChart { private static final int SLICE = 100; public static final String C_R_ADDRESS_FILE = System .getProperty("user.dir"); private ClassicReggression cr; public ClassicReggression getCr() { return cr; } public CreateXYChart(ClassicReggression cr) { this.cr = cr; } public JFreeChart createXYChart() throws NonValidFileFormat { XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(createXYSeries()); JFreeChart chart = ChartFactory.createXYLineChart(MessageService .getResourceBundle().getString("XY-Chart"), // Title MessageService.getResourceBundle().getString("x-axis"), // x-axis // Label MessageService.getResourceBundle().getString("y-axis"), // y-axis // Label dataset, // Dataset PlotOrientation.VERTICAL, // Plot Orientation true, // Show Legend true, // Use tooltips false // Configure chart to generate URLs? ); return chart; } private XYSeries createXYSeries() throws NonValidFileFormat { XYSeries series = new XYSeries(MessageService.getResourceBundle() .getString("XYGraph")); SimpleRegression simpleRegression = getCr().getSimpleRegression(); double min = getCr().getMin(); double max = getCr().getMax(); for (double i = min; i < max; i = i + (max - min) / SLICE) { series.add(i, simpleRegression.predict(i)); } return series; } public File SaveChart() throws IOException, NonValidFileFormat { File imageFile = new File(C_R_ADDRESS_FILE + "/" + System.currentTimeMillis() + ".jpg"); //ChartUtilities.saveChartAsJPEG(imageFile, createXYChart(), // (int) GUI.getWidthLabel(), (int) GUI.getHeightLabel()); return imageFile; } }
40d4e19bc072c968ff6976a2686e5f5fb3744634
96c5a6fb5ce0e5a70acf37a5a7b2aa006861da2a
/Problema2/Socio.java
8f9d86caaa280488fcbbed6c0b2654e92349e7ca
[]
no_license
aawan1996/DAW-Java
e8bbdc16dd7204f0fef92de9d8351c319aa93883
ba9d18fd4ab5dc5dc3c59a9ded0ad0f028c4aff6
refs/heads/master
2021-08-19T01:47:27.326444
2017-11-24T11:19:38
2017-11-24T11:19:38
109,535,997
0
0
null
null
null
null
UTF-8
Java
false
false
1,036
java
import java.io.*; public class Socio { private String nombre; private String dni; private int numeroSocio; private Documento [] document; ////////////////////////////////////////// // CONSTRUCTOR ////////////////////////////////////////// public Socio (String nombre,String dni,int numeroSocio,Documento [] document){ this.nombre = nombre; this.dni = dni; this.numeroSocio = numeroSocio; this.document = document; } ////////////////////////////////////////// // Método SET Y GET ////////////////////////////////////////// public void setNombre(String nombre){ this.nombre = nombre; } public void setDni(String dni){ this.dni = dni; } public void setNumeroSocio(int numeroSocio){ this.numeroSocio = numeroSocio; } // public void setPrestado(String prestado){ // this.prestado = prestado; // } public String getNombre(){ return this.nombre; } public String getDni(){ return this.dni; } public int getNumeroSocio(){ return this.numeroSocio; } }
4924eda7f4fab8413456bc5065e39cf08adc1be3
8b6bbf6097bc4310c3367ecd8ef5284337026f45
/src/main/java/com/zhiliao/hotel/model/ZlCheckoutOrder.java
881ba73be3cf8daa3b07c8863232f77dd8efb01c
[]
no_license
17639101203/zhiliao_hotel_applets_api
e6eb47756005affb5a906ab21124b0bffe4f7f6f
0422fdf69a2cf19f5f172835eff3047eadf85be1
refs/heads/master
2022-12-31T10:56:37.428432
2020-09-11T01:47:55
2020-09-11T01:47:55
254,516,153
0
0
null
null
null
null
UTF-8
Java
false
false
2,175
java
package com.zhiliao.hotel.model; import lombok.Data; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.Table; import java.io.Serializable; /** * @author null * @date 2020-06-06 */ @Table(name = "zl_checkoutorder") @Data public class ZlCheckoutOrder implements Serializable { /** * 订单ID */ @Id @GeneratedValue(generator = "JDBC") private Long orderid; /** * 用户ID */ private Long userid; /** * 订单编号 */ private String orderserialno; /** * zl_ordertype表ID */ private Byte moldtype; /** * 来自1小程序C端,2小程序B端,3公众号,4民宿,5好评返现,6分时酒店 */ private Integer comeformid; /** * 酒店ID */ private Integer hotelid; /** * 酒店名 */ private String hotelname; /** * 楼层数 */ private String floornumber; /** * 房间ID */ private Integer roomid; /** * 房间号 */ private String roomnumber; /** * 用户名 */ private String username; /** * 手机 */ private String tel; /** * 订单状态:-1:取消退房;0等待退房;1完成退房;2已接单 */ private Byte orderstatus; /** * 取消用户类型:1-用户,2-平台 */ private Byte cancelusertype; /** * 取消原因 */ private String cancelremark; /** * 操作员 */ private String operatorname; /** * 操作员IP */ private String operatorip; /** * 操作员备注 */ private String operatorremark; /** * 退房时间 */ private Integer checkoutdate; /** * 备注 */ private String remark; /** * 用户删除:0否;1是 */ private Boolean isuserdelete; /** * 删除状态:0正常;1删除; */ private Boolean isdelete; /** * 创建时间(下单时间) */ private Integer createdate; /** * 修改时间(操作时间) */ private Integer updatedate; }
[ "15838947620jhh" ]
15838947620jhh
73bc293a0ebf5cc2d28379586c85127e9ce18fd9
40cd4da5514eb920e6a6889e82590e48720c3d38
/desktop/applis/apps/apps_util/expressionlanguageutil/src/main/java/code/expressionlanguage/guicompos/stds/FctCompoBorTitle.java
9d82f761840c6f2a9573bdc343374ad0a1c95d8e
[]
no_license
Cardman/projects
02704237e81868f8cb614abb37468cebb4ef4b31
23a9477dd736795c3af10bccccb3cdfa10c8123c
refs/heads/master
2023-08-17T11:27:41.999350
2023-08-15T07:09:28
2023-08-15T07:09:28
34,724,613
4
0
null
2020-10-13T08:08:38
2015-04-28T10:39:03
Java
UTF-8
Java
false
false
952
java
package code.expressionlanguage.guicompos.stds; import code.expressionlanguage.AbstractExiting; import code.expressionlanguage.ContextEl; import code.expressionlanguage.exec.ArgumentWrapper; import code.expressionlanguage.exec.StackCall; import code.expressionlanguage.exec.util.ArgumentListCall; import code.expressionlanguage.guicompos.CustComponentStruct; import code.expressionlanguage.stds.StdCaller; import code.expressionlanguage.structs.NullStruct; import code.expressionlanguage.structs.Struct; public final class FctCompoBorTitle implements StdCaller { @Override public ArgumentWrapper call(AbstractExiting _exit, ContextEl _cont, Struct _instance, ArgumentListCall _firstArgs, StackCall _stackCall) { CustComponentStruct inst_ = (CustComponentStruct)_instance; inst_.setTitledBorder(_firstArgs.getArgumentWrappers().get(0).getValue().getStruct()); return new ArgumentWrapper(NullStruct.NULL_VALUE); } }
d824fe725a98a3c2f334562ef055ba1d1545c539
69435caa32555767b4c09dedc7b37673043d5f9b
/src/main/java/ch/zhaw/gpi/eumzugplattform/EumzugPlattform2018Application.java
557bc1dafbf22a9782c6701164b323af732130fe
[ "Unlicense" ]
permissive
zhaw-gpi/eumzug-plattform-2018
880ca645c26da8d8c92fec03f82272dcf8aef13c
b7dbe551e4676e5ecf8e0c442ed2fd92a8e85f86
refs/heads/master
2021-09-24T16:35:44.640662
2021-09-23T13:18:28
2021-09-23T13:18:28
144,579,272
5
2
null
null
null
null
UTF-8
Java
false
false
1,328
java
package ch.zhaw.gpi.eumzugplattform; import org.camunda.bpm.spring.boot.starter.annotation.EnableProcessApplication; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; /** * Hauptklasse für die Prozessapplikation, welche diese mit allen Abhängigkeiten * ausführt. Basis ist das SpringBoot-Framework, welches von Camunda erweitert * wurde. * * Zusammengefasst werden dabei folgende Schritte durchlaufen: * 1. Tomcat initialisieren 2. Camunda REST API aktivieren 3. * Camunda Job Executor initialisieren 4. Camunda Process Engine inklusive * Datenbank initialisieren gemäss application.properties * 5. Sofern noch nicht vorhanden, den Demo-Admin-User erstellen gemäss * application.properties 6. Die Webapps (Tasklist, Admin, Cockpit) deployen 7. * Gefundene Prozesse (z.B. ExampleProcess) deployen 8. Alle Komponenten starten * => unter localhost:8080 ist Tomcat erreichbar * */ @SpringBootApplication @EnableProcessApplication public class EumzugPlattform2018Application { /** * Haupt-Methode, welche beim Run-Befehl eine * Camunda-Prozessapplikation erstellt. * * @param args */ public static void main(String[] args) { SpringApplication.run(EumzugPlattform2018Application.class, args); } }
854ebcc14b5dfaa5f40fd993d1ee676ba7b72911
86215bd7ab2457497727be0193d3960feec3b524
/demo-fpml/src/main/generated-source/org/fpml/reporting/Portfolio.java
97ad00d4f19aeb4d7f14d244d204c6bff1a8d210
[]
no_license
prasobhpk/stephennimmo-templates
4770d5619488fe39ffa289b6ede36578c29d6c4d
ce2b04c09b6352311df65ad8643f682452f9d6a7
refs/heads/master
2016-09-11T13:47:44.366025
2013-08-21T18:29:55
2013-08-21T18:29:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,230
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2011.06.01 at 08:58:10 AM CDT // package org.fpml.reporting; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlID; import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlSeeAlso; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; /** * A type representing an arbitary grouping of trade references. * * <p>Java class for Portfolio complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="Portfolio"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="partyPortfolioName" type="{http://www.fpml.org/FpML-5/reporting}PartyPortfolioName" minOccurs="0"/> * &lt;element name="tradeId" type="{http://www.fpml.org/FpML-5/reporting}TradeId" maxOccurs="unbounded" minOccurs="0"/> * &lt;element name="portfolio" type="{http://www.fpml.org/FpML-5/reporting}Portfolio" maxOccurs="unbounded" minOccurs="0"/> * &lt;/sequence> * &lt;attribute name="id" type="{http://www.w3.org/2001/XMLSchema}ID" /> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "Portfolio", propOrder = { "partyPortfolioName", "tradeId", "portfolio" }) @XmlSeeAlso({ QueryPortfolio.class }) public class Portfolio implements Serializable { private final static long serialVersionUID = 1L; protected PartyPortfolioName partyPortfolioName; protected List<TradeId> tradeId; protected List<Portfolio> portfolio; @XmlAttribute @XmlJavaTypeAdapter(CollapsedStringAdapter.class) @XmlID @XmlSchemaType(name = "ID") protected String id; /** * Gets the value of the partyPortfolioName property. * * @return * possible object is * {@link PartyPortfolioName } * */ public PartyPortfolioName getPartyPortfolioName() { return partyPortfolioName; } /** * Sets the value of the partyPortfolioName property. * * @param value * allowed object is * {@link PartyPortfolioName } * */ public void setPartyPortfolioName(PartyPortfolioName value) { this.partyPortfolioName = value; } /** * Gets the value of the tradeId property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the tradeId property. * * <p> * For example, to add a new item, do as follows: * <pre> * getTradeId().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link TradeId } * * */ public List<TradeId> getTradeId() { if (tradeId == null) { tradeId = new ArrayList<TradeId>(); } return this.tradeId; } /** * Gets the value of the portfolio property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the portfolio property. * * <p> * For example, to add a new item, do as follows: * <pre> * getPortfolio().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link Portfolio } * * */ public List<Portfolio> getPortfolio() { if (portfolio == null) { portfolio = new ArrayList<Portfolio>(); } return this.portfolio; } /** * Gets the value of the id property. * * @return * possible object is * {@link String } * */ public String getId() { return id; } /** * Sets the value of the id property. * * @param value * allowed object is * {@link String } * */ public void setId(String value) { this.id = value; } }
[ "[email protected]@ea902603-27ce-0092-70ca-3da810587992" ]
[email protected]@ea902603-27ce-0092-70ca-3da810587992
597b1c52f5ec837ce1d7bb656a2b6f0e5abe51f0
4f35b4d7e000306ea412b925d22c56af4c06350f
/app/src/main/java/br/com/javamedicalhealth/conversordesolucoes/FragmentResultado.java
1354a99b9bc040f8f02403c4ea78992ef98dfc17
[]
no_license
jmedicalh/ConvSol
6ab04239a16cb320d79b3d687e0c23de371f04ca
de63d7cd8dd16f53473bbecdc09528d68709ea86
refs/heads/master
2021-01-17T14:55:47.214727
2016-10-19T13:50:46
2016-10-19T13:50:57
70,279,601
0
0
null
null
null
null
UTF-8
Java
false
false
4,936
java
package br.com.javamedicalhealth.conversordesolucoes; import android.content.Context; import android.content.SharedPreferences; import android.content.res.Resources; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.TextView; import com.google.android.gms.ads.AdRequest; import com.google.android.gms.ads.AdView; import br.com.javamedicalhealth.conversordesolucoes.conversor.CalculoConversao; import br.com.javamedicalhealth.conversordesolucoes.modelos.ModelSolucao; import static android.content.Context.MODE_PRIVATE; import static br.com.javamedicalhealth.conversordesolucoes.MainActivity.MY_PREFS_NAME; /** * Created by isaac on 10/10/16. */ public class FragmentResultado extends Fragment{ TextView txtLinha1; TextView txtLinha2; Button button; //para o calculo CalculoConversao calcular = new CalculoConversao(); private AdView mAdView; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.activity_resultado, container, false); return view; } //para propaganda rodar corretamente // @Override public void onResume() { super.onResume(); if(mAdView != null){ mAdView.resume(); } //calculo o soro calcularSoro(); } @Override public void onPause() { if(mAdView != null){ mAdView.pause(); } super.onPause(); } @Override public void onDestroy() { if(mAdView != null){ mAdView.destroy(); } super.onDestroy(); } //fim da propaganda //apos a criação e sabendeo que poderei trabalhar com resultados @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { txtLinha1 = (TextView)getActivity().findViewById(R.id.txtMenssagem); txtLinha2 = (TextView)getActivity().findViewById(R.id.txtMenssagem2); button = (Button) getActivity().findViewById(R.id.cmdOK); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { ((MainActivity)getActivity()).apagaFragments(); ((MainActivity)getActivity()).reInflaFragments(); } }); //trabalhando com a propaganda mAdView = (AdView)view.findViewById(R.id.adView2); AdRequest adRequest = new AdRequest.Builder() .addTestDevice(AdRequest.DEVICE_ID_EMULATOR) .addTestDevice("04307137381340F4DFFFC5DDFBB5C8E3") .addTestDevice("435FD46EBF905EF6B3A9106B76E6B757") .build(); mAdView.loadAd(adRequest); /*fim da inicialização da propaganda*/ //calculo o soro calcularSoro(); } private void calcularSoro(){ Context context = getActivity(); SharedPreferences prefs = context.getSharedPreferences(MY_PREFS_NAME, MODE_PRIVATE); calcular.setPM(prefs.getFloat("porcentPrescrito", 0f)); calcular.setAmp(prefs.getFloat("porcentAmpola", 0f)); calcular.setExist(prefs.getFloat("porcentExistente", 0f)); //verifico volumes int volJogarFora; int numBolsas; int volPrescrito = prefs.getInt("volumePrescrito", 0); int volExistente = prefs.getInt("volumeExistente", 0); if(volPrescrito < volExistente){ volJogarFora = volExistente - volPrescrito; calcular.setVolume(volPrescrito); numBolsas = 1; }else{ volJogarFora = 0; calcular.setVolume(volExistente); numBolsas = volPrescrito /volExistente; } Resources resources = getResources(); String [] tipoAmpola = resources.getStringArray(R.array.ampola); setResultado(calcular.Calcula(), tipoAmpola[prefs.getInt("tipoAmpola", 0)], Integer.toString(numBolsas), volJogarFora); } public void setResultado(String valor, String strTipoAmpola, String frascos, int volJogarFora){ String msg = getView().getResources().getString(R.string.extrair); if(volJogarFora > 0){ float f = (float) volJogarFora; f = f + Float.parseFloat(valor); msg = msg.replace("$", Float.toString(f)); }else { msg = msg.replace("$", valor); } String msg2 = getView().getResources().getString(R.string.incluir); msg2 = msg2.replace("$", valor); msg2 = msg2.replace("%", strTipoAmpola); msg2 = msg2.replace("#", frascos); txtLinha1.setText(msg); txtLinha2.setText(msg2); } }
017edb3ca589b427d3f5655d8ee5b0ab7660b860
08daa730757fecb415f0b7ada911edb8a9143422
/src/com/company/Main.java
24c38ef2161bf80fb76399fd957c61a797036401
[]
no_license
Maksim-17/kurs
4196b7ecae5845e3aeb8f636f9f5239af6a93dde
416757a1d837e72ab701dd889605325287591f10
refs/heads/master
2020-08-29T03:29:19.390226
2019-10-27T19:16:38
2019-10-27T19:16:38
217,910,821
0
0
null
null
null
null
UTF-8
Java
false
false
621
java
package com.company; import java.util.Scanner; public class Main { public static void main(String[] args) { //public class Main { //public static void main (String [] args){ Scanner sc = new Scanner(System.in); //System.out.println("Введите число в бинарном формате"); int X = sc.nextInt(); //System.out.print("Число переведено в двоичный формат: "); System.out.println(Integer.toBinaryString(X)); } } // write your code here
019bde41efee92b128cae30810d8d2e642781980
3c7e996556f87d7b19a16f9c6132839c5d625e39
/Java-fun/src/main/java/com/lawshiga/ProtectedExample/ProtectedModifierSubClass.java
824a9ce17945281f2f218f6b703575a5b9749970
[]
no_license
Lawshiga95/Java-Fundamentals
64ea725b749de9d35d71b65cff719c222288c97d
0f129547a3ce13ba8feeeb9b195e411767202f5c
refs/heads/master
2023-02-19T20:40:33.516350
2021-01-21T19:10:43
2021-01-21T19:10:43
331,050,098
0
0
null
null
null
null
UTF-8
Java
false
false
338
java
package com.lawshiga.ProtectedExample; import com.lawshiga.accessmodifier.PrivateClassExample; public class ProtectedModifierSubClass extends PrivateClassExample { protected double salary; protected String designation; public int accessAge(int age){ return getAge();//accessing getAge() from the superclass } }
79c7b348824e87ea9f354ace7143246f43145502
f7377bd80e340bd1420ac1be0d4afed7fcf7e619
/src/main/java/com/jxc/service/CustomerService.java
a6cb0db2d31704082631808941d83d2198024f82
[]
no_license
melgino/Jxc
c67e22d73133bdc9d86469c3c37680277056b5ac
430a6dabe062e28736b67bd023f2f3c8ce7c6219
refs/heads/master
2022-11-08T01:36:54.268907
2019-10-10T17:13:58
2019-10-10T17:13:58
214,239,963
1
0
null
2022-10-12T20:32:40
2019-10-10T17:06:02
JavaScript
UTF-8
Java
false
false
1,054
java
package com.jxc.service; import java.util.List; import org.springframework.data.domain.Sort.Direction; import com.jxc.entity.Customer; /** * 客户Service接口 * @author java1234 小锋老师 * */ public interface CustomerService { /** * 根据名称模糊查询客户信息 * @param name * @return */ public List<Customer> findByName(String name); /** * 根据id查询实体 * @param id * @return */ public Customer findById(Integer id); /** * 添加或者修改客户信息 * @param customer */ public void save(Customer customer); /** * 根据条件分页查询客户信息 * @param customer * @param page * @param pageSize * @param direction * @param properties * @return */ public List<Customer> list(Customer customer,Integer page,Integer pageSize,Direction direction,String... properties); /** * 获取总记录数 * @param customer * @return */ public Long getCount(Customer customer); /** * 根据id删除客户 * @param id */ public void delete(Integer id); }
[ "“[email protected]”" ]
65c2d24af943039363f513759efdd402c283e168
e74cc2bedffd6e84250a0047c20888a3aa8db42f
/src/com/academy/patterns/resource/aquisition/is/initialization/SecretPolygon.java
00df3506f2308ca8ee1bbebea411b49e2df08dd7
[]
no_license
kelheor/commons
46ab5b4784d5e38743a90ccdbaf8a6d4d2ad3669
27aebac0b972f1f24077d1151badb6463ad23b7d
refs/heads/master
2021-01-10T08:51:28.104435
2015-07-10T12:37:06
2015-07-10T12:37:06
36,869,018
0
0
null
null
null
null
UTF-8
Java
false
false
374
java
package com.academy.patterns.resource.aquisition.is.initialization; /** * Created by keos on 01.07.15. */ public class SecretPolygon implements AutoCloseable { public SecretPolygon() { System.out.println("ENTERING SECRET POLYGON"); } @Override public void close() throws Exception { System.out.println("LEAVING SECRET POLYGON"); } }
525d9afad7c5aaa4a12061bc75addeb2e83d3b05
e36e601b9aa5a8363500594f071b90a9f6677016
/AnimalSerializable/src/animalserializable/SerializeObjectToFile.java
02c7530150b8e91c467807bc8df6b87bc61a428a
[]
no_license
gontarzhd03/cis3306
9490755ee24b07d9d2d9693923f1e7e98d3b676a
1c7a1d46379b68b1a7444054e26a81950c3be7ea
refs/heads/master
2021-05-12T01:48:25.726976
2018-05-06T20:19:19
2018-05-06T20:19:19
117,565,320
0
0
null
null
null
null
UTF-8
Java
false
false
1,407
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 animalserializable; import java.io.*; /** * * @author 55gontarhd03 */ public class SerializeObjectToFile { private static String fileName; public SerializeObjectToFile(String fileNameIn) { fileName = fileNameIn; } public static void writeObjectToFile(Object object1) { try(ObjectOutputStream fileout1 = new ObjectOutputStream(new FileOutputStream(fileName));) { fileout1.writeObject(object1); } catch(IOException e) { System.out.println("I O Exception"); } } public static Object readObjectFromFile() { try(ObjectInputStream fileout1 = new ObjectInputStream(new FileInputStream(fileName));) { return fileout1.readObject(); } catch(IOException e) { System.out.println("I O Exception"); return null; } catch(ClassNotFoundException e) { System.out.println("I O Exception"); return null; } } public static String getFileName() { return fileName; } public static void setFileName(String aFileName) { fileName = aFileName; } }
f67254ea29259602a7671d4a529379306b60efe1
53c303263af1f854de6bc6b7012cc1158ed80bee
/graduate-design-user-info-manage-service/src/main/java/fun/liwudi/graduatedesignuserinfomanage/rest/UserLoginRest.java
59737ac29ad9e595996857c501e99d0da9c43983
[ "Apache-2.0" ]
permissive
zhangannyi/practise-of-springcloud-and-docker
e99648a7c29f20c3172ab08c39ac0d06c52a09fa
199711e1b6e181e7ad4cc77fcfff02c3523fdc70
refs/heads/main
2023-03-05T09:02:45.248270
2021-02-13T07:45:19
2021-02-13T07:45:19
336,964,484
0
0
Apache-2.0
2021-02-13T07:45:20
2021-02-08T04:56:18
Java
UTF-8
Java
false
false
788
java
package fun.liwudi.graduatedesignuserinfomanage.rest; import fun.liwudi.graduatedesignuserinfomanage.domain.JsonResponse; import fun.liwudi.graduatedesignuserinfomanage.domain.UserLogin; import fun.liwudi.graduatedesignuserinfomanage.service.UserLoginService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; /** * @author 李武第 */ @RestController public class UserLoginRest { @Autowired UserLoginService userLoginService; @PostMapping("/login") public JsonResponse login(@RequestBody UserLogin userLogin){ return userLoginService.login(userLogin); } }
b15a25cd14f9fc7fb60253e759ccca6fb1b321b1
94b037a458beec7c6bd6d2049e07b704517ae75f
/dreams/src/main/java/ci/jsi/entites/dataValueAudit/DataValueAuditRepository.java
457537f6dc5be66d6ef752f2a6f30aedff34d953
[]
no_license
cyrillekouassi/DREAMS
ec8ee5672f50cf9ad87e19194ac958cf07abbd6a
2e97481ac7cdb6d3b7e30bf1eee4986954c7006f
refs/heads/master
2020-03-18T23:52:44.195602
2018-08-31T12:47:42
2018-08-31T12:47:42
135,435,528
0
0
null
null
null
null
UTF-8
Java
false
false
201
java
package ci.jsi.entites.dataValueAudit; import org.springframework.data.jpa.repository.JpaRepository; public interface DataValueAuditRepository extends JpaRepository<DataValueAudit, Long> { }
aabe84892c991013979b82c23b7b4292bec97361
bf9d941779a2574adf62bf055171f8c2dae0be49
/src/main/webapp/ROOT/WEB-INF/application/app/controllers/Utils.java
564b21a50c78bf676b23f708a53658655073f00a
[]
no_license
boozt/deploy
6febf512d25ce0054b86500d87f544bd534d0829
e47e869e50af8d18c0f1a635088a46a3d672e3e2
refs/heads/master
2021-10-26T11:57:28.081809
2019-04-12T14:08:04
2019-04-12T14:08:04
105,534,927
0
0
null
null
null
null
UTF-8
Java
false
false
5,424
java
package controllers; import java.text.DateFormat; import java.text.DateFormatSymbols; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; import java.util.Locale; import java.util.TimeZone; public class Utils { public static int AUTOCOMPLETE_MAX = 15; public static SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); public static SimpleDateFormat sdfH = new SimpleDateFormat("dd-MM-yyyy");//dd-MM-yyyy HH public static SimpleDateFormat sdfHms = new SimpleDateFormat("dd-MM-yyyy");//dd-MM-yyyy HH:mm:ss public static String format(SimpleDateFormat isdf, Date date) { // isdf.setTimeZone(TimeZone.getTimeZone("America/New_York")); // TimeZone.setDefault(TimeZone.getTimeZone("America/New_York")); String ret= isdf.format(date); // TimeZone.setDefault(TimeZone.getTimeZone("Europe/Istanbul")); // isdf.setTimeZone(TimeZone.getTimeZone("Europe/Istanbul")); return ret; } public static Date parse(SimpleDateFormat isdf, String date) throws ParseException { Date ret= isdf.parse(date); return ret; } public static String getFirstWeekdayOfMonthEng(int diff) { Calendar cal = Calendar.getInstance(); cal.add(Calendar.MONTH, diff); cal.set(Calendar.DATE, 1); DateFormatSymbols dfs = new DateFormatSymbols(); String ret = dfs.getWeekdays()[cal.get(Calendar.DAY_OF_WEEK)]; return ret; } public static String getMonthYearTr(int diff) { Calendar cal = Calendar.getInstance(); cal.add(Calendar.MONTH, diff); DateFormatSymbols dfs = new DateFormatSymbols(); String ret = dfs.getMonths()[cal.get(Calendar.MONTH)] + " " + cal.get(Calendar.YEAR); return ret; } public static Date getFirstDayOfCurrentMonth(int diff) { Calendar cal = Calendar.getInstance(); cal.add(Calendar.MONTH, diff); cal.set(Calendar.DATE, 1); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); Date ret = cal.getTime(); return ret; } public static Date getToday() { Calendar cal = Calendar.getInstance(); Date ret = cal.getTime(); return ret; } public static Date getToday(int diff) { Calendar cal = Calendar.getInstance(); cal.add(Calendar.DAY_OF_YEAR, diff); Date ret = cal.getTime(); return ret; } public static String getTodayStr(int diff) { Calendar cal = Calendar.getInstance(); cal.add(Calendar.DAY_OF_YEAR, diff); Date ret = cal.getTime(); return new SimpleDateFormat("dd-MM-yyyy").format(ret); } public static int getCurrentMonthLength(int diff) { Calendar cal = Calendar.getInstance(); cal.add(Calendar.MONTH, diff); int ret = cal.getActualMaximum(Calendar.DAY_OF_MONTH); return ret; } public static Date getLastDayOfCurrentMonth(int diff) { Calendar cal = Calendar.getInstance(); cal.add(Calendar.MONTH, diff); cal.set(Calendar.DATE, cal.getActualMaximum(Calendar.DAY_OF_MONTH)); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); Date ret = cal.getTime(); return ret; } public static int getDOM(Date date) { Calendar cal = Calendar.getInstance(); cal.setTime(date); int ret = cal.get(Calendar.DAY_OF_MONTH); return ret; } public static int getDOMForCurrentMonthStart(Date date, int diff) { Calendar calDate = Calendar.getInstance(); calDate.setTime(date); Calendar calFirstday = Calendar.getInstance(); calFirstday.add(Calendar.MONTH, diff); calFirstday.set(Calendar.DATE, 1); calFirstday.set(Calendar.MINUTE, 0); calFirstday.set(Calendar.SECOND, 0); int ret = 1; if (calDate.compareTo(calFirstday) > 0) { ret = calDate.get(Calendar.DAY_OF_MONTH); } return ret; } public static int getDOMForCurrentMonthEnd(Date date, int diff) { Calendar calDate = Calendar.getInstance(); calDate.setTime(date); Calendar calLastday = Calendar.getInstance(); calLastday.add(Calendar.MONTH, diff); calLastday.set(Calendar.DATE, calLastday.getActualMaximum(Calendar.DAY_OF_MONTH)); calLastday.set(Calendar.MINUTE, 0); calLastday.set(Calendar.SECOND, 0); int ret = 0; if (calDate.compareTo(calLastday) >= 0) ret = calLastday.getActualMaximum(Calendar.DAY_OF_MONTH); else ret = calDate.get(Calendar.DAY_OF_MONTH); return ret; } public static int daysBetween(String d1, String d2) { try { Calendar cal1 = new GregorianCalendar(); Calendar cal2 = new GregorianCalendar(); Date date = sdf.parse(d1); cal1.setTime(date); date = sdf.parse(d2); cal2.setTime(date); int ret = (int) ((cal2.getTime().getTime() - cal1.getTime() .getTime()) / (1000 * 60 * 60 * 24)); return ret; } catch (Throwable e) { return 0; } } public static int daysBetweenToday(String d1) { try { Calendar cal1 = new GregorianCalendar(); Calendar cal2 = new GregorianCalendar(); cal1.setTime(getToday()); Date date = sdf.parse(d1); cal2.setTime(date); int ret = (int) ((cal2.getTime().getTime() - cal1.getTime() .getTime()) / (1000 * 60 * 60 * 24)) ; if (ret>=0) ret++; return ret; } catch (Throwable e) { return 0; } } public static int daysBetween(Date d1, Date d2) { int ret = (int) ((d2.getTime() - d1.getTime()) / (1000 * 60 * 60 * 24)); return ret; } public static void main(String[] args) { Calendar cal = Calendar.getInstance(); DateFormat f = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); // setToDefault(); System.out.println(f.format(cal.getTime())); } }
ff6a34bf67ecb2f890cb5f4e9947ae2582a18500
dd90264bbfb79700d1d32effc207b555c29f3bcf
/wuai/trunks/commons/src/main/java/com/wuai/company/entity/Response/RechargeOrdersResponse.java
f00189c318719cf66f785f785042a930841a7797
[]
no_license
tomzhang/other_workplace
8cead3feda7e9f067412da8252d83da56a000b51
9b5beaf4ed3586e6037bd84968c6a407a8635e16
refs/heads/master
2020-04-22T22:18:23.913665
2019-01-26T03:36:19
2019-01-26T03:36:19
170,703,419
1
0
null
2019-02-14T14:23:21
2019-02-14T14:23:20
null
UTF-8
Java
false
false
369
java
package com.wuai.company.entity.Response; import lombok.Getter; import lombok.Setter; import lombok.ToString; import javax.sql.rowset.serial.SerialArray; import java.io.Serializable; /** * Created by hyf on 2018/1/12. */ @Getter @Setter @ToString public class RechargeOrdersResponse implements Serializable { private String uuid; private Integer userId; }
[ "Pj879227577" ]
Pj879227577
78b5f2e8a03199198b1c6847e1d51bf368259e8b
cb46e9c140618f73c3ad0411e686f8ceb968ae2f
/app/src/main/java/com/example/administrator/flappybird01/game/layer/CameraSurface.java
e18e1be264d21d4ad3e34156890714d4ec37120f
[]
no_license
renxingkai/FlappyBird
1efcd8acb168c5b9b50ce6b43d960606675e2f07
e97b10c86c4380b15f3df9596a0083fd3cd7d049
refs/heads/master
2021-01-10T05:06:47.213237
2016-01-25T08:33:16
2016-01-25T08:33:16
50,332,600
0
0
null
null
null
null
UTF-8
Java
false
false
2,362
java
package com.example.administrator.flappybird01.game.layer; import android.content.Context; import android.hardware.Camera; import android.util.AttributeSet; import android.view.SurfaceHolder; import android.view.SurfaceView; import java.io.IOException; /** * CameraSurface * * @author: Xingkai Ren * @time:2016/1/23 9:27 */ public class CameraSurface extends SurfaceView implements SurfaceHolder.Callback { public static final String TAG = "CameraSurface..."; private SurfaceHolder holder; protected Camera camera; //照相机---硬件设备包 private boolean ispreview; /** * 初始化 */ public void init() { holder = getHolder(); holder.addCallback(this);//添加监听器到this ispreview=false; } public CameraSurface(Context context) { //MainActivity中setContentView中调用 super(context); init(); } public CameraSurface(Context context, AttributeSet attrs) { //xml中布局调用 super(context, attrs); init(); } @Override public void surfaceCreated(SurfaceHolder holder) { camera = Camera.open();//若不传递参数默认后置摄像头 if (null != camera) { try { //camera.setDisplayOrientation(90); camera.setPreviewDisplay(holder);//设置预览 } catch (IOException e) { e.printStackTrace(); camera.release(); camera=null; } Camera.Parameters parameters=camera.getParameters(); parameters.setPreviewSize(getWidth(),getHeight());//设置预览尺寸 camera.setParameters(parameters);//传递预览尺寸参数 camera.startPreview();//开始预览 ispreview=true;//开始预览变量赋为真 } } @Override public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { } @Override public void surfaceDestroyed(SurfaceHolder holder) { if (null != camera) { //相机开启了 if (ispreview) { //并且判断是处在预览状态下 camera.stopPreview();//停止照相机 } camera.release();//释放照相机 camera = null; } } }
7fa423835e9744e1d82e0a813f664f958e1d46fc
616bf5e39625a17d94e69bfc9bd902b278419f2c
/src/main/java/com/zhengpp/platform/exception/CommonExceptionHandler.java
e7d6296fdb52f6080cb290f84996453ff9d2328f
[]
no_license
zpp360/platform
83c0944f28c429777b7a1026c8de1e3ddff6e8c8
d81506183e1d83419ca12f81399a9a8412e1cf08
refs/heads/master
2020-06-09T13:13:21.870893
2019-06-25T06:35:32
2019-06-25T06:35:32
193,442,779
0
0
null
2019-11-02T08:48:37
2019-06-24T05:56:04
Java
UTF-8
Java
false
false
662
java
package com.zhengpp.platform.exception; import org.apache.log4j.Logger; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ResponseBody; /** * 统一异常处理 */ @ControllerAdvice public class CommonExceptionHandler { private static Logger log = Logger.getLogger(CommonExceptionHandler.class); @ExceptionHandler(Exception.class) @ResponseBody public String exceptionHandler(Exception e){ //输错错误到日志文件 log.error(e,e); //返回系统异常 return "error"; } }
7ac6b92a66127834c38dc408587db2ebaed08c76
4da758f179d940accfb3304b2d8fe8928ece1d8a
/javasea-volcano/javasea-volcano-common/src/main/java/com/zhirui/lmwy/common/persistence/model/result/ResultMsg.java
87eac68ed83fda82d6e5c2386cf46bdfa2f50281
[]
no_license
fredwang0412/java-sea
e15bdd01b91b05d7af69a777e0925d36bccccbf0
0380c42be481b4be4f7f38e44f525255cc3a5631
refs/heads/master
2023-09-04T14:42:53.828319
2021-11-17T02:19:30
2021-11-17T02:19:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
743
java
package com.zhirui.lmwy.common.persistence.model.result; import io.swagger.annotations.ApiModel; import java.io.Serializable; @ApiModel("返回信息") public interface ResultMsg extends Serializable { String QUERY_SUCCESS = "查询成功!"; String QUERY_FAIL = "查询失败!"; String INSERT_SUCCESS = "新增成功!"; String INSERT_FAIL = "新增失败!"; String UPDATE_SUCCESS = "更新成功!"; String UPDATE_FAIL = "更新失败!"; String DELETE_SUCCESS = "删除成功!"; String DELETE_FAIL = "删除失败!"; String CATCHEXCEPTION = "捕获到异常!"; String INCONFORMITY = "参数不符合要求!"; String SERVICE_ERROR = "服务异常,请与管理员联系!"; }
bace72c11573d6d08a673bcd5059d04542d318b2
884ec2b0be8eccbc973d76ce6ddd60c54b0937dd
/src/day02/StdOutput.java
6e49c006786655c5bc0212482bdec037bf6cb924
[]
no_license
soongu/java_study
f16e5d98d676756921116cf7213b03d294be6370
90466b74651f01b3ced27dbefe3b3bf02d8e9653
refs/heads/master
2023-02-24T15:57:39.163750
2021-02-02T01:16:40
2021-02-02T01:16:40
334,020,682
1
1
null
null
null
null
UTF-8
Java
false
false
791
java
package day02; public class StdOutput { public static void main(String[] args) { String dog = "멍멍이"; String cat = "야옹이"; System.out.println(dog); System.out.println(cat); int month = 3; int day = 1; String annivasary = "삼일절"; System.out.println(month + "월 " + day + "일은 " + annivasary + "입니다."); System.out.printf("%d월 %d일은 %s입니다.\n", month, day, annivasary); System.out.println("안녕하세요!!!"); System.out.println("============================="); // %f는 자동으로 소수점 6자리를 맞춥니다. double saleRate = 0.25; System.out.printf("할인율은 %.2f%%입니다.\n", saleRate); } }
95084e73c06b69f7b00c149a1aa1fc5f039917fa
685fcce60aa0b8942b08082ce4de2f6343ac1b5e
/Workspace/Name/src/encapsulation/Child.java
98e40d2eed325ac18c4bce36314af5eeb71157ac
[]
no_license
Ullasinip/Actitime.New
0582be41ed3346526d069a29cd86a48d902d1cf1
bad19fa0bc47274acb37d16e69e80a25839aec36
refs/heads/master
2020-12-20T15:56:16.455307
2020-01-25T05:31:12
2020-01-25T05:31:12
236,128,069
0
0
null
null
null
null
UTF-8
Java
false
false
183
java
package encapsulation; public class Child extends Parent { void marry() { System.out.println("ABC"); } void dowry() //final methods cannot be overidden { } }
[ "TechEng@GMPI" ]
TechEng@GMPI
7e0e32d8c99f9a7c8bbc216f15b5f688f656e476
364b9a2c52a1719f129890b78e67873282d6577e
/TicketPopGet/src/com/kh/user/controller/LoginAdminServlet.java
82180b8e9913252a07d2a84aa343a102fedc1f3d
[]
no_license
JH-Seo2020/Project_TicketPopGet
c0309f3e9fdd4f40e93bf2ab7018f57c4a5ae0cb
4c21fa59e460084c9fa4e5d80147772fef0df33d
refs/heads/master
2022-12-29T07:55:18.914708
2020-10-10T19:25:50
2020-10-10T19:25:50
295,769,027
0
0
null
null
null
null
UTF-8
Java
false
false
1,989
java
package com.kh.user.controller; import java.io.IOException; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import com.kh.user.model.service.MemberService; import com.kh.user.model.vo.Member; /** * Servlet implementation class LoginAdminServlet */ @WebServlet("/login.ad") public class LoginAdminServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public LoginAdminServlet() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("UTF-8"); String userId = request.getParameter("userId"); // 입력한 아이디 String userPwd = request.getParameter("userPwd"); // 입력한 비밀번호 if(userId.equals("ADMIN")) { int loginAdmin = new MemberService().loginAdmin(userId, userPwd); if(loginAdmin != 0) { request.getRequestDispatcher("views/admin/adminCommon/adminMainMenu.jsp").forward(request, response);; }else { request.setAttribute("errorMsg", "로그인에 실패하였습니다."); RequestDispatcher view = request.getRequestDispatcher("views/common/errorPage.jsp"); view.forward(request, response); } }else { } } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub doGet(request, response); } }
2e51080312dc1043e601fb0223092a4e88eda2ae
0e2db85eb20fdff7f6cd1dff67402d391ba6ec9b
/src/PRACTICA/Main.java
fed8c35c953e6702b26c9742905a57fb6ba6c010
[]
no_license
sdeulofeu/practica
df78b219b93478649e5c9343360fcaf510c0f785
7c1ea06dd6df80e250f05168458fc7e1470075b1
refs/heads/main
2023-01-13T19:13:18.849587
2020-11-20T15:24:16
2020-11-20T15:24:16
314,582,904
0
0
null
null
null
null
ISO-8859-1
Java
false
false
91,363
java
package PRACTICA; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.io.*; import java.time.Duration; import java.time.LocalDate; import java.time.LocalTime; import java.util.ArrayList; import java.util.Calendar; import java.util.Random; import java.util.Scanner; import javax.swing.*; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.JTableHeader; public class Main { static Scanner LECTOR = new Scanner(System.in); static boolean EXIT=false; static String nom, cognom1,cognom2, dni; static String nom2; static double codiFederat; static char sexe; static boolean firstTime; static String path; static File arxiuInicial,clasificacioF,clasificacio,esportistes,esportistesF,proves,club,participant,participantF,marato,prova10k,marxaP; static ImageIcon icon = new ImageIcon("png\\sport.PNG"); static ImageIcon iconTick = new ImageIcon("png\\tickk.png"); static ImageIcon iconError = new ImageIcon("png\\error.PNG"); static String finalTime; static ArrayList<Esportista> arrayEsportista = new ArrayList<Esportista>(); static ArrayList<EsportistaFederat> arrayEsporistaFederat = new ArrayList<EsportistaFederat>(); static ArrayList<Club> arrayClub = new ArrayList<Club>(); static ArrayList<Prova> arrayProva = new ArrayList<Prova>(); static ArrayList<Participant> arrayParticipant = new ArrayList<Participant>(); static ArrayList<Participant> arrayParticipantF = new ArrayList<Participant>(); //Arrays per les proves especifiques static ArrayList<Marato> arrayMarato = new ArrayList<Marato>(); static ArrayList<Prova10000> arrayProva10k = new ArrayList<Prova10000>(); static ArrayList<MarxaPopular> arrayMarxaP = new ArrayList<MarxaPopular>(); static int numEsportistes; static int numClubs; static int numProves; static int numParticipants; public static void main(String[] args) { Arxiu(); //creem els arxius necessaris i comprovem si es la primera vegada que s'executa. if (firstTime) JOptionPane.showMessageDialog(null,"Benvingut al Gestor Definitiu\n per a Clubs d'Atletisme ","Benvinguda",JOptionPane.INFORMATION_MESSAGE,icon); else LoadData(); while(!EXIT) { MenuMain(); } } //MENU PRINCIPAL private static void MenuMain() { String[] opcions = {"Dades", "Inscripció", "Proves", "Sortir"}; int opcio = JOptionPane.showOptionDialog(null,"Seleccioni una opció","Menú Principal",JOptionPane.NO_OPTION,JOptionPane.PLAIN_MESSAGE,icon,opcions,null); if(opcio==JOptionPane.CLOSED_OPTION) System.exit(0); //Si es tenca la finestra, que es tenqui el programa switch(opcio) { case 0: MenuDades(); //Menu General de Dades break; case 1: MenuInscripcio(); //Menu General de Inscripcio break; case 2: MenuProves(); //Menu General de Proves break; case 3: EXIT=true; //Exit menu break; default: } } //MENUS SECUNDARIS private static void MenuProves() { String[] opcions = {"Entrada Temps", "Classificació","Tornar"}; int opcio = JOptionPane.showOptionDialog(null,"Seleccioni una opció","Menu Proves",JOptionPane.NO_OPTION,JOptionPane.PLAIN_MESSAGE,icon,opcions,null); if(opcio==JOptionPane.CLOSED_OPTION) System.exit(0); switch(opcio) { case 0: MenuEntradaTemps(); //SubMenu d'Entrada de temps en les inscripcions SaveData(); break; case 1: MenuClassificacio(); //Menú de Classificació break; } } private static void MenuDades() { String[] opcions = {"Alta de Dades", "Modificació de Dades", "Consulta de Dades", "Tornar"}; int opcio = JOptionPane.showOptionDialog(null,"Seleccioni una opció","Menú Dades",JOptionPane.NO_OPTION,JOptionPane.PLAIN_MESSAGE,icon,opcions,null); if(opcio==JOptionPane.CLOSED_OPTION) System.exit(0); switch(opcio) { case 0: MenuDadesAlta(); break; case 1: MenuDadesModif(); break; case 2: MenuDadesConsult(); break; } } private static void MenuInscripcio() { String[] opcions = {"Inscripció Prova", "Anul·lació Inscripció", "Llistar Inscripció", "Tornar"}; int opcio = JOptionPane.showOptionDialog(null,"Seleccioni una opció","Menu Inscripcio",JOptionPane.NO_OPTION,JOptionPane.PLAIN_MESSAGE,icon,opcions,null); if(opcio==JOptionPane.CLOSED_OPTION) System.exit(0); switch(opcio) { case 0: InscripcioProva(); SaveData(); break; case 1: AnulacioProva(); SaveData(); break; case 2: LlistaInscripcio(); break; case 3: System.out.println("Exiting Inscripció"); default: } } //MENU SECUNDARI PROVES private static void MenuEntradaTemps() { String[] opcions = {"Sortida Participants", "Arribada Participants","Tornar"}; int opcio = JOptionPane.showOptionDialog(null,"Seleccioni una opció","Menu Entrada Temps Proves",JOptionPane.NO_OPTION,JOptionPane.PLAIN_MESSAGE,icon,opcions,null); if(opcio==JOptionPane.CLOSED_OPTION) System.exit(0); ArrayList<String> nomProves = new ArrayList<String>(); Object[] array = null; Object seleccion = null; int index=0; switch(opcio) { case 0: tempsProva(opcio,nomProves,array,seleccion,index); break; case 1: tempsArribadaParticipant(array, seleccion, index); break; } } private static void MenuClassificacio() { String[] opcions = {"Total", "Sexe","Categoria","Tornar"}; int opcio = JOptionPane.showOptionDialog(null,"Seleccioni una opció","Menu Classificació Proves",JOptionPane.NO_OPTION,JOptionPane.PLAIN_MESSAGE,icon,opcions,null); if(opcio==JOptionPane.CLOSED_OPTION) System.exit(0); switch(opcio) { case 0: showClasificacioTotal(); break; case 1: showClasificacioSexe(); break; case 2: showClasificacioCategoria(); break; } } //MENU SECUNDARI DADES private static void MenuDadesConsult() { String[] opcions = {"Consulta Club", "Consulta Esportista", "Consulta Prova", "Tornar"}; int opcio = JOptionPane.showOptionDialog(null,"Seleccioni una opció","Menú Dades Consulta",JOptionPane.NO_OPTION,JOptionPane.PLAIN_MESSAGE,icon,opcions,null); if(opcio==JOptionPane.CLOSED_OPTION) System.exit(0); switch(opcio) { case 0: ConsultaClub(); break; case 1: ConsultaEsportista(); break; case 2: ConsultaProva(); break; } } private static void MenuDadesModif() { String[] opcions = {"Modificar Prova", "Modificar Esportista", "Modificar Club", "Tornar"}; int opcio = JOptionPane.showOptionDialog(null,"Seleccioni una opció","Menú Dades Modificació",JOptionPane.NO_OPTION,JOptionPane.PLAIN_MESSAGE,icon,opcions,null); if(opcio==JOptionPane.CLOSED_OPTION) System.exit(0); switch(opcio) { case 0: ModificarProva(); SaveData(); //Despres de fer canvis, ho guardem break; case 1: //escollim gràficament quin tipus de participant vol modificar String[] options = new String[] {"Federats", "No Federats"}; int response = JOptionPane.showOptionDialog(null, "Escull un tipus d'Esportista a Modificar", "Modifica Esportista", JOptionPane.DEFAULT_OPTION, JOptionPane.PLAIN_MESSAGE, icon, options, options[0]); if(response==0) { ModificarEsportistaFederat(); SaveData(); } else if(response==1) { ModificarEsportista(); SaveData(); } else { MenuMain(); } break; case 2: ModificarClub(); SaveData(); break; case 3: System.out.println("Exiting Modificació de Dades"); default: } } private static void MenuDadesAlta() { String[] opcions = {"Alta Club", "Alta Esportista", "Alta Prova", "Tornar"}; int opcio = JOptionPane.showOptionDialog(null,"Seleccioni una opció","Menú Dades Alta",JOptionPane.NO_OPTION,JOptionPane.PLAIN_MESSAGE,icon,opcions,null); if(opcio==JOptionPane.CLOSED_OPTION) System.exit(0); switch(opcio) { case 0: AltaClub(); SaveData(); break; case 1: AltaEsportista(); SaveData(); break; case 2: AltaProva(); SaveData(); break; case 3: System.out.println("Exiting Alta de Dades"); default: } } //MENU SECUNDARI INSCRIPCIO INSCRIPCIONS private static void InscripcioProva() { if((arrayMarato.size()!=0)||(arrayMarxaP.size()!=0)||(arrayProva10k.size()!=0)) { int x=0; String[] opcions = {"Marató", "Marxa Popular", "Prova10000", "Tornar"}; int opcio = JOptionPane.showOptionDialog(null,"Seleccioni una Prova","Menu Inscripcio",JOptionPane.NO_OPTION,JOptionPane.PLAIN_MESSAGE,icon,opcions,null); switch(opcio) { case 0: //MARATÓ if((arrayMarato.size()!=0)) InscripcioMarato(x); else JOptionPane.showMessageDialog(null,"Afegeix avans alguna Marató","Inscripció Marató",JOptionPane.INFORMATION_MESSAGE,iconError); break; case 1: //MARXA POPULAR if((arrayMarxaP.size()!=0)) InscripcioMarxaP(x); else JOptionPane.showMessageDialog(null,"Afegeix avans alguna Marxa Popular","Inscripció Marxa Popular",JOptionPane.INFORMATION_MESSAGE,iconError); break; case 2: //PROVA10K if((arrayProva10k.size()!=0)) InscripcioProva10k(x); else JOptionPane.showMessageDialog(null,"Afegeix avans alguna Prova10k","Inscripció Prova10000",JOptionPane.INFORMATION_MESSAGE,iconError); break; case 3: break; } } else { JOptionPane.showMessageDialog(null,"Afegeix avans alguna Prova","Inscripció Prova",JOptionPane.INFORMATION_MESSAGE,iconError); } } //MÈTODES DE DADES (MODIFICAR) private static void ModificarClub() { //Creem una array auxiliar, per treballar amb els noms dels clubs. ArrayList<String> nomClubs = new ArrayList<String>(); for(int p=0;p<arrayClub.size();p++) { nomClubs.add(arrayClub.get(p).getNom()); } //Seleccionem gràficament quin Club es vol modificar Object[] array = nomClubs.toArray(new Object[nomClubs.size()]); Object seleccion = JOptionPane.showInputDialog( null, "Seleccioni un Club a Modificar", "Modificació Club", JOptionPane.QUESTION_MESSAGE, null, array, array[0]); if(seleccion==null) return; int index = nomClubs.indexOf(seleccion); //Seleccionem, quin paràmetre del objecte Club, volem modificar String[] opcions = {"Nom Club", "Població Club", "Any Fundació","Codi Postal","Tornar"}; int opcio = JOptionPane.showOptionDialog(null,"Seleccioni una opció","Modificació Club",JOptionPane.NO_OPTION,JOptionPane.PLAIN_MESSAGE,icon,opcions,null); Object value; switch(opcio) { case 0: //MODIFICAR NOM value = JOptionPane.showInputDialog(null,"Nom nou: ","Modificació Club", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; arrayClub.get(index).modificaNom((String)value); break; case 1: //MODIFICAR POBLACIO value = JOptionPane.showInputDialog(null,"Població nova: ","Modificació Club", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; arrayClub.get(index).modificaPoblacio((String)value); break; case 2: //MODIFICAR ANY value = JOptionPane.showInputDialog(null,"Any nou: ","Modificació Club", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; arrayClub.get(index).modificaAny((String)value); break; case 3: //MODIFICAR CODI POSTAL value = JOptionPane.showInputDialog(null,"Codi Postal nou: ","Modificació Club", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; arrayClub.get(index).modificaCodiPostal((String)value); break; case 4: default: break; } } private static void ModificarEsportista() { //Generem una array auxiliar per tal de treballar amb els noms dels esportistes i poguer escollir quin modificar ArrayList<String> nomEsportistes = new ArrayList<String>(); for(int p=0;p<arrayEsportista.size();p++) { nomEsportistes.add(arrayEsportista.get(p).getNom()); } //Seleccionem quin esportista volem seleccionar Object[] array = nomEsportistes.toArray(new Object[nomEsportistes.size()]); Object seleccion = JOptionPane.showInputDialog( null, "Seleccioni un Esportista a Modificar", "Modificació Esportista", JOptionPane.QUESTION_MESSAGE, null, array, array[0]); if(seleccion==null) return; int indexEsportista = nomEsportistes.indexOf(seleccion); //Seleccionem quina caracteristica volem modificar String[] opcions = {"Nom", "Cognom", "Segon Cognom", "Sexe","Data Naixement","DNI","Tornar"}; int opcio = JOptionPane.showOptionDialog(null,"Seleccioni una opció","Modificació Esportista",JOptionPane.NO_OPTION,JOptionPane.PLAIN_MESSAGE,icon,opcions,null); Object value; String index2; switch(opcio) { case 0: //MODIFICAR NOM value = JOptionPane.showInputDialog(null,"Nom: ","Modificació Esportista", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; arrayEsportista.get(indexEsportista).modificaNom((String)value); break; case 1: //MODIFICAR COGNOM 1 value = JOptionPane.showInputDialog(null,"Cognom: ","Modificació Esportista", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; arrayEsportista.get(indexEsportista).modificaCognom((String)value); break; case 2: //MODIFICAR COGNOM 2 value = JOptionPane.showInputDialog(null,"Segon Cognom: ","Modificació Esportista", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; arrayEsportista.get(indexEsportista).modificaCognom2((String)value); break; case 3: //MODIFICAR SEXE value = JOptionPane.showInputDialog(null,"Sexe: ","Modificació Esportista", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; index2 = (String)value; arrayEsportista.get(indexEsportista).modificaSexe(index2.charAt(0)); break; case 4: //MODIFICAR DATA NAIXEMENT value = JOptionPane.showInputDialog(null,"Data Naixement(dd/mm/yyyy): ","Modificació Esportista", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; String resultat=(String)value; String[] split = resultat.split("/"); int dia=Integer.parseInt(split[0]); int mes =Integer.parseInt(split[1]); int any=Integer.parseInt(split[2]); LocalDate data = LocalDate.of(any, mes, dia); arrayEsportista.get(indexEsportista).modificaData(data); break; case 5: //MODIFICAR DNI value = JOptionPane.showInputDialog(null,"DNI: ","Modificació Esportista", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; arrayEsportista.get(indexEsportista).modificaDNI((String)value); break; default: break; } } private static void ModificarEsportistaFederat() { //Generem una array auxiliar per tal de treballar amb els noms dels esportistes i poguer escollir quin modificar ArrayList<String> nomEsportistes = new ArrayList<String>(); for(int p=0;p<arrayEsporistaFederat.size();p++) { nomEsportistes.add(arrayEsporistaFederat.get(p).getNom()); } Object[] array = nomEsportistes.toArray(new Object[nomEsportistes.size()]); Object seleccion = JOptionPane.showInputDialog( null, "Seleccioni un Esportista a Modificar", "Modificació Esportista", JOptionPane.QUESTION_MESSAGE, null, array, array[0]); if(seleccion==null) return; int indexEsportista = nomEsportistes.indexOf(seleccion); String[] opcions = {"Nom", "Cognom", "Segon Cognom", "Sexe","Data Naixement","DNI","Club","Tornar"}; int opcio = JOptionPane.showOptionDialog(null,"Seleccioni una opció","Modificació Esportista",JOptionPane.NO_OPTION,JOptionPane.PLAIN_MESSAGE,icon,opcions,null); Object value; String index2; switch(opcio) { case 0: //MODIFICAR NOM value = JOptionPane.showInputDialog(null,"Nom: ","Modificació Esportista", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; arrayEsporistaFederat.get(indexEsportista).modificaNom((String)value); break; case 1: //MODIFICAR COGNOM value = JOptionPane.showInputDialog(null,"Cognom: ","Modificació Esportista", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; arrayEsporistaFederat.get(indexEsportista).modificaCognom((String)value); break; case 2: //MODIFICAR COGNOM 2 value = JOptionPane.showInputDialog(null,"Segon Cognom: ","Modificació Esportista", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; arrayEsporistaFederat.get(indexEsportista).modificaCognom2((String)value); break; case 3: //MODIFICAR SEXE value = JOptionPane.showInputDialog(null,"Sexe: ","Modificació Esportista", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; index2 = (String)value; arrayEsporistaFederat.get(indexEsportista).modificaSexe(index2.charAt(0)); break; case 4: //MODIFICAR DATA_NAIXEMENT value = JOptionPane.showInputDialog(null,"Data Naixement(dd/mm/yyyy): ","Modificació Esportista", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; String[] split = ((String)value).split("/"); int dia=Integer.parseInt(split[0]); int mes =Integer.parseInt(split[1]); int any=Integer.parseInt(split[2]); LocalDate data = LocalDate.of(any, mes, dia); arrayEsporistaFederat.get(indexEsportista).modificaData(data); break; case 5: //MODIFICAR DNI value = JOptionPane.showInputDialog(null,"DNI: ","Modificació Esportista", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; index2 = (String)value; arrayEsporistaFederat.get(indexEsportista).modificaDNI((String)value); break; case 6: //MODIFICAR CLUB //Agrupem els noms dels clubs per tal de poguer seleccionar comodament un nou club dels registrats ArrayList<String> nomClubs = new ArrayList<String>(); for(int p=0;p<arrayClub.size();p++) { nomClubs.add(arrayClub.get(p).getNom()); } array = nomClubs.toArray(new Object[nomClubs.size()]); seleccion = JOptionPane.showInputDialog( null, "Seleccioni un Club", "Modificació Esportsita", JOptionPane.QUESTION_MESSAGE, null, array, array[0]); if(seleccion==null) return; int index = nomClubs.indexOf(seleccion); String aux_club=arrayClub.get(index).getNom(); arrayEsporistaFederat.get(indexEsportista).modificaCIub(aux_club); break; } } private static void ModificarProva() { Object[] array; Object seleccion; int index=2; int auxii=0; ArrayList<String> nomProves = new ArrayList<String>(); String[] opcions = {"Marató", "Marxa Popular", "Prova10000", "Tornar"}; int opcio = JOptionPane.showOptionDialog(null,"Seleccioni una Prova","Menu Modificar Prova",JOptionPane.NO_OPTION,JOptionPane.PLAIN_MESSAGE,icon,opcions,null); switch(opcio) { case 0: //MODIFICAR MARATO for(int p=0;p<arrayMarato.size();p++) { nomProves.add(arrayMarato.get(p).getNom()); } array = nomProves.toArray(new Object[nomProves.size()]); seleccion = JOptionPane.showInputDialog( null, "Seleccioni una Prova a Modificar", "Modificació Prova", JOptionPane.QUESTION_MESSAGE, icon, array, array[0]); if(seleccion==null) return; index = nomProves.indexOf(seleccion); auxii=1; break; case 1: //MODIFICAR MARXA for(int p=0;p<arrayMarxaP.size();p++) { nomProves.add(arrayMarxaP.get(p).getNom()); } array = nomProves.toArray(new Object[nomProves.size()]); seleccion = JOptionPane.showInputDialog( null, "Seleccioni una Prova a Modificar", "Modificació Prova", JOptionPane.QUESTION_MESSAGE, icon, array, array[0]); if(seleccion==null) return; index = nomProves.indexOf(seleccion); auxii=2; break; case 2: //MODIFICAR PROVA for(int p=0;p<arrayProva10k.size();p++) { nomProves.add(arrayProva10k.get(p).getNom()); } array = nomProves.toArray(new Object[nomProves.size()]); seleccion = JOptionPane.showInputDialog( null, "Seleccioni una Prova a Modificar", "Modificació Prova", JOptionPane.QUESTION_MESSAGE, icon, array, array[0]); if(seleccion==null) return; index = nomProves.indexOf(seleccion); auxii=3; break; } String[] opcions2 = {"Nom", "Any", "Codi","Data","Hora Sortida","Tornar"}; int opcio2 = JOptionPane.showOptionDialog(null,"Seleccioni una opció","Modificació Prova",JOptionPane.NO_OPTION,JOptionPane.PLAIN_MESSAGE,icon,opcions2,null); Object value; switch(opcio2) { case 0: //MODIFICAR NOM if(auxii==1) { value = JOptionPane.showInputDialog(null,"Nom nou: ","Modificació Nom Marató", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; arrayMarato.get(index).modificaNom((String)value); } else if(auxii==2) { value = JOptionPane.showInputDialog(null,"Nom nou: ","Modificació Nom Marxa Popular", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; arrayMarxaP.get(index).modificaNom((String)value); } else if(auxii==3) { value = JOptionPane.showInputDialog(null,"Nom nou: ","Modificació Nom Prova10000", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; arrayProva10k.get(index).modificaNom((String)value); } break; case 1: //MODIFICAR ANY if(auxii==1) { value = JOptionPane.showInputDialog(null,"Any: ","Modificació Any Marató", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; arrayMarato.get(index).modificaAny((String)value); } else if(auxii==2) { value = JOptionPane.showInputDialog(null,"Any: ","Modificació Any Marxa Popular", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; arrayMarxaP.get(index).modificaAny((String)value); } else if(auxii==3) { value = JOptionPane.showInputDialog(null,"Any: ","Modificació Any Prova10000", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; arrayProva10k.get(index).modificaAny((String)value); } break; case 2: //MODIFICAR CODI if(auxii==1) { value = JOptionPane.showInputDialog(null,"Codi: ","Modificació Codi Marató", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; arrayMarato.get(index).modificaCodiProva((String)value); } else if(auxii==2) { value = JOptionPane.showInputDialog(null,"Codi: ","Modificació Codi Marxa Popular", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; arrayMarxaP.get(index).modificaCodiProva((String)value); } else if(auxii==3) { value = JOptionPane.showInputDialog(null,"Codi: ","Modificació Codi Prova10000", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; arrayProva10k.get(index).modificaCodiProva((String)value); } break; case 3: //MODIFICAR DATA if(auxii==1) { value = JOptionPane.showInputDialog(null,"Data: ","Modificació Data Marató", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; arrayMarato.get(index).modificaData((String)value); } else if(auxii==2) { value = JOptionPane.showInputDialog(null,"Data: ","Modificació Data Marxa Popular", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; arrayMarxaP.get(index).modificaData((String)value); } else if(auxii==3) { value = JOptionPane.showInputDialog(null,"Data: ","Modificació Data Prova10000", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; arrayProva10k.get(index).modificaData((String)value); } break; case 4: //MODIFICAR HORA SORTIDA if(auxii==1) { value = JOptionPane.showInputDialog(null,"Hora Sortida (00h00m00s): ","Modificació Hora Sortida Marató", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; String resultat=(String)value; String[] split = resultat.split(":"); int hora=Integer.parseInt(split[0]); int min =Integer.parseInt(split[1]); int sec=Integer.parseInt(split[2]); LocalTime horaSortida = LocalTime.of(hora, min,sec); arrayMarato.get(index).modificaHoraSortida(horaSortida); } else if(auxii==2) { value = JOptionPane.showInputDialog(null,"Hora Sortida (00h00m00s): ","Modificació Hora Sortida Marxa Popular", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; String resultat=(String)value; String[] split = resultat.split(":"); int hora=Integer.parseInt(split[0]); int min =Integer.parseInt(split[1]); int sec=Integer.parseInt(split[2]); LocalTime horaSortida = LocalTime.of(hora, min,sec); arrayMarxaP.get(index).modificaHoraSortida(horaSortida); } else if(auxii==3) { value = JOptionPane.showInputDialog(null,"Hora Sortida (00h00m00s): ","Modificació Hora Sortida Prova10000", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; String resultat=(String)value; String[] split = resultat.split(":"); int hora=Integer.parseInt(split[0]); int min =Integer.parseInt(split[1]); int sec=Integer.parseInt(split[2]); LocalTime horaSortida = LocalTime.of(hora, min,sec); arrayProva10k.get(index).modificaHoraSortida(horaSortida); } break; } } //MÈTODES DE DADES (ALTA) private static void AltaProva() { String nomProva=null,codiProva=null,any = null,participants = null,index2=null,nomClub=null;Object value; String[] opcions = {"Marató", "Prova1000", "Marxa Popular","Tornar"}; int opcio = JOptionPane.showOptionDialog(null,"Seleccioni una opció","Alta de Prova",JOptionPane.NO_OPTION,JOptionPane.PLAIN_MESSAGE,icon,opcions,null); switch(opcio) { case 0://Marató Marato marato=new Marato(nomClub, codiProva, any, participants); value = JOptionPane.showInputDialog(null,"Nom: ","Alta Marató", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; index2 = (String)value; marato.setNom(index2); codiProva=GeneradorCodiProva(); marato.setCodiProva(codiProva); value = JOptionPane.showInputDialog(null,"Any: ","Alta Marató", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; index2 = (String)value; marato.setAny(index2); marato.setParticipants("100"); value = JOptionPane.showInputDialog(null,"Data: ","Alta Marató", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; index2 = (String)value; marato.setData(index2); value = JOptionPane.showInputDialog(null,"Hora Sortida(00h00m00s): ","Alta Marató", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; index2 = (String)value; String resultat=(String)value; String[] split = resultat.split(":"); int hora=Integer.parseInt(split[0]); int min =Integer.parseInt(split[1]); int sec=Integer.parseInt(split[2]); LocalTime horaSortida = LocalTime.of(hora, min,sec); marato.setHoraSortida(horaSortida); arrayMarato.add(marato); numParticipants++; break; case 1://Prova10000 Prova10000 prova10k=new Prova10000(nomClub, codiProva, any, participants); value = JOptionPane.showInputDialog(null,"Nom: ","Alta Prova10000", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; index2 = (String)value; nomProva =index2; prova10k.setNom(nomProva); codiProva=GeneradorCodiProva(); prova10k.setCodiProva(codiProva); value = JOptionPane.showInputDialog(null,"Any: ","Alta Prova10000", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; index2 = (String)value; prova10k.setAny(index2); value = JOptionPane.showInputDialog(null,"Data: ","Alta Prova10000", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; index2 = (String)value; prova10k.setData(index2); if(arrayClub.size()!=0) { ArrayList<String> nomClubs = new ArrayList<String>(); for(int p=0;p<arrayClub.size();p++) { nomClubs.add(arrayClub.get(p).getNom()); } Object[] array = nomClubs.toArray(new Object[nomClubs.size()]); Object seleccion = JOptionPane.showInputDialog( null, "Seleccioni un Club a Amfitrio", "Alta Prova", JOptionPane.QUESTION_MESSAGE, null, array, array[0]); int index = nomClubs.indexOf(seleccion); prova10k.setClubAnfitrio(arrayClub.get(index).getNom()); System.out.println("Club Host --> "+arrayClub.get(index).getNom()); value = JOptionPane.showInputDialog(null,"Hora (00h00m00s): ","Alta Prova10000", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; index2 = (String)value; resultat=(String)value; split = resultat.split(":"); hora=Integer.parseInt(split[0]); min =Integer.parseInt(split[1]); sec=Integer.parseInt(split[2]); horaSortida = LocalTime.of(hora, min, sec); System.out.println(horaSortida); prova10k.setHoraSortida(horaSortida); value = JOptionPane.showInputDialog(null,"Ubicació: ","Alta Prova10000", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; index2 = (String)value; prova10k.setUbicacio(index2); prova10k.setParticipants("150"); arrayProva10k.add(prova10k); numParticipants++; } else { JOptionPane.showMessageDialog(null,"Avans afegeix algun Club","Alta Prova10000",JOptionPane.INFORMATION_MESSAGE,iconError); } break; case 2: MarxaPopular marxa=new MarxaPopular(nomClub, codiProva, any, participants); value = JOptionPane.showInputDialog(null,"Nom: ","Alta Marxa Popular", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; index2 = (String)value; marxa.setNom(index2); codiProva=GeneradorCodiProva(); marxa.setCodiProva(codiProva); value = JOptionPane.showInputDialog(null,"Any: ","Alta Marxa Popular", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; index2 = (String)value; marxa.setAny(index2); marxa.setParticipants("100"); value = JOptionPane.showInputDialog(null,"Ubicació: ","Alta Marxa Popular", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; index2 = (String)value; marxa.setUbicacio(index2); value = JOptionPane.showInputDialog(null,"Data: ","Alta Marxa Popular", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; index2 = (String)value; marxa.setData(index2); value = JOptionPane.showInputDialog(null,"Hora (00h00m00s): ","Alta Marxa Popular", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; resultat=(String)value; split = resultat.split(":"); hora=Integer.parseInt(split[0]); min =Integer.parseInt(split[1]); sec=Integer.parseInt(split[2]); horaSortida = LocalTime.of(hora, min,sec); marxa.sethSortida(horaSortida); arrayMarxaP.add(marxa); numParticipants++; break; case 3: break; } } private static void AltaClub() { Object value; value = JOptionPane.showInputDialog(null,"Nom: ","Alta Club", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; String nomClub = (String)value; value = JOptionPane.showInputDialog(null,"Població: ","Alta Club", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; String poblacioClub = (String)value; value = JOptionPane.showInputDialog(null,"Codi Postal: ","Alta Club", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; String codiPostal = (String)value; int codiClub = creaComprovaCodiClub(); value = JOptionPane.showInputDialog(null,"Any Fundació: ","Alta Club", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; String anyFundacioClub = (String)value; numClubs++; Club e = new Club(nomClub, poblacioClub, codiPostal, anyFundacioClub, codiClub); arrayClub.add(e); JOptionPane.showMessageDialog(null," Club Afegit!","Afegir Club",JOptionPane.INFORMATION_MESSAGE,iconTick); } private static void AltaEsportista() { Object value; value = JOptionPane.showInputDialog(null,"DNI: ","Alta Esportista", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; String dni = (String)value; if(dni.contentEquals("")) {System.out.println("Error!"); return;} //ComprovaDniRepetitEnElsObjectes value = JOptionPane.showInputDialog(null,"Data NaixementI: ","Alta Esportista", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; if(((String)value).contentEquals("")) {System.out.println("Error!"); return;} String[] split = ((String)value).split("/"); int dia=Integer.parseInt(split[0]); int mes =Integer.parseInt(split[1]); int any=Integer.parseInt(split[2]); LocalDate data = LocalDate.of(any, mes, dia); value = JOptionPane.showInputDialog(null,"Nom Esportista: ","Alta Esportista", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; String nom = (String)value; if(nom.contentEquals("")) {System.out.println("Error!"); return;} value = JOptionPane.showInputDialog(null,"Cognoms Esportista: ","Alta Esportista", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; String cog = (String)value; if(cog.contentEquals("")) {System.out.println("Error!"); return;} String[] cognoms = cog.split(" "); String cognom=cognoms[0]; String cognom2=cognoms[1]; value = JOptionPane.showInputDialog(null,"Sexe(H/D): ","Alta Esportista", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; String aux = (String)value; if(aux.contentEquals("")) {System.out.println("Error!"); return;} char sexe =aux.charAt(0); int option = JOptionPane.showConfirmDialog(null, "Vol federar-se?", "Alta Esportista",JOptionPane.YES_NO_OPTION,JOptionPane.WARNING_MESSAGE,icon); if (option == JOptionPane.YES_OPTION) { ArrayList<String> nomClubs = new ArrayList<String>(); for(int p=0;p<arrayClub.size();p++) { nomClubs.add(arrayClub.get(p).getNom()); } if(nomClubs.size()!=0) { Object[] array = nomClubs.toArray(new Object[nomClubs.size()]); Object seleccion = JOptionPane.showInputDialog( null, "Seleccioni un Club a Federar-se", "Alta Esportista", JOptionPane.QUESTION_MESSAGE, icon, array, array[0]); String club = (String) (seleccion); int codiFederat=creaComprovaCodiFederat(); //Comprovar i tal EsportistaFederat e = new EsportistaFederat(nom, cognom, cognom2, sexe, data, dni, club, (String.valueOf(codiFederat))); arrayEsporistaFederat.add(e); } else { JOptionPane.showMessageDialog(null," Avans afegeix algun Club","Alta Esportista",JOptionPane.INFORMATION_MESSAGE,iconError); } numEsportistes++; } else { Esportista e = new Esportista(nom, cognom, cognom2, sexe, data, dni); arrayEsportista.add(e); } } //MÈTODES DE DADES (CONSULTA) private static void ConsultaProva() { String[] options = new String[] {"Marató", "Marxa Popular","Prova 10000"}; int response = JOptionPane.showOptionDialog(null, "Escull un tipus de Prova a Consultar", "Consulta Prova", JOptionPane.DEFAULT_OPTION, JOptionPane.PLAIN_MESSAGE, icon, options, options[0]); if(response==0) { showMarato(); } else if(response==1) { showMarxaPopular(); } else if(response==2) { showProva10k(); } else MenuMain(); } private static void ConsultaEsportista() { String[] options = new String[] {"Federats", "No Federats"}; int response = JOptionPane.showOptionDialog(null, "Escull un tipus d'Esportista a Consultar", "Consulta Esportista", JOptionPane.DEFAULT_OPTION, JOptionPane.PLAIN_MESSAGE, icon, options, options[0]); if(response==0) { showEsportistesFederats(); } else if(response==1) { showEsportistes(); } else { MenuMain(); } } private static void ConsultaClub() { if(arrayClub.size()!=0) { showClub(); } else { JOptionPane.showMessageDialog(null,"Afegeix avans algun Club","Consulta Club",JOptionPane.INFORMATION_MESSAGE,iconError); } } //MÈTODES DE INSCRIPCIO private static void InscripcioProva10k(int x) { try { ArrayList<String> nomProves = new ArrayList<String>(); for(int p=0;p<arrayProva10k.size();p++) { nomProves.add(arrayProva10k.get(p).getNom()); } Object[] array2 = nomProves.toArray(new Object[nomProves.size()]); Object seleccion2 = JOptionPane.showInputDialog( null, "Seleccioni la Marató", "Inscripció Prova", JOptionPane.QUESTION_MESSAGE, icon, array2, array2[0]); if(seleccion2==null) return; x = nomProves.indexOf(seleccion2); int dorsal=creaComprovaDorsal(); LocalTime tempsProva = LocalTime.of(0, 0, 0); if(arrayEsporistaFederat.size()!=0) { ArrayList<String> nomEsportistes = new ArrayList<String>(); for(int p=0;p<arrayEsporistaFederat.size();p++) { nomEsportistes.add(arrayEsporistaFederat.get(p).getNom()); } Object[] array = nomEsportistes.toArray(new Object[nomEsportistes.size()]); Object seleccion = JOptionPane.showInputDialog( null, "Seleccioni un Esportista a Inscriure's", "Inscripció Prova", JOptionPane.QUESTION_MESSAGE, icon, array, array[0]); if(seleccion==null) return; int indexNomEsportista = nomEsportistes.indexOf(seleccion); LocalDate data=arrayEsporistaFederat.get(indexNomEsportista).getDataNaixement(); LocalDate absolut= LocalDate.of(1969, 12, 31); LocalDate vetera= LocalDate.of(1969, 12, 21); String categoria=""; if(data.isBefore(absolut)) categoria="Absolut"; if(data.isAfter(vetera)) categoria="Veterà"; Participant nouParticipant =new Participant( arrayEsporistaFederat.get(indexNomEsportista).getNom(), arrayEsporistaFederat.get(indexNomEsportista).getCognom1(), arrayEsporistaFederat.get(indexNomEsportista).getCognom2(), arrayEsporistaFederat.get(indexNomEsportista).getSexe(), arrayEsporistaFederat.get(indexNomEsportista).getDataNaixement(), arrayEsporistaFederat.get(indexNomEsportista).getDni(), categoria,"", dorsal,tempsProva, ""); nouParticipant.setCategoria(categoria); nouParticipant.setDorsal(dorsal); System.out.println("nouParticipant.setDorsal(dorsal) --> dorsal: "+dorsal); nouParticipant.setTempsProva(tempsProva); nouParticipant.setClub(arrayEsporistaFederat.get(indexNomEsportista).getClub()); nouParticipant.setCodiProva(arrayProva10k.get(x).getCodiProva()); arrayParticipantF.add(nouParticipant); } else { JOptionPane.showMessageDialog(null,"Afegeix avans algun Esportista","Inscripció Prova10000",JOptionPane.INFORMATION_MESSAGE,iconError); } }catch(Exception e) {JOptionPane.showMessageDialog(null,"Error Inscrivint Prova10k","Inscripció Prova10000",JOptionPane.INFORMATION_MESSAGE,iconError); } } private static void InscripcioMarxaP(int x) { try { ArrayList<String> nomClubs = new ArrayList<String>(); for(int p=0;p<arrayMarxaP.size();p++) { nomClubs.add(arrayMarxaP.get(p).getNom()); } Object[] array2 = nomClubs.toArray(new Object[nomClubs.size()]); Object seleccion2 = JOptionPane.showInputDialog(null, "Seleccioni la Marxa Popular", "Inscripció Prova", JOptionPane.QUESTION_MESSAGE, icon, array2, array2[0]); if(seleccion2==null) return; x = nomClubs.indexOf(seleccion2); Random rand = new Random(); int dorsal=rand.nextInt(100); LocalTime tempsProva = LocalTime.of(0, 0,0); if(arrayEsportista.size()!=0) { ArrayList<String> nomEsportistes = new ArrayList<String>(); for(int p=0;p<arrayEsportista.size();p++) { nomEsportistes.add(arrayEsportista.get(p).getNom()); } Object[] array = nomEsportistes.toArray(new Object[nomEsportistes.size()]); Object seleccion = JOptionPane.showInputDialog( null, "Seleccioni un Esportista a Inscriure's", "Inscripció Prova", JOptionPane.QUESTION_MESSAGE, icon, array, array[0]); if(seleccion==null) return; int indexNomEsportista = nomEsportistes.indexOf(seleccion); LocalDate data=arrayEsportista.get(indexNomEsportista).getDataNaixement(); LocalDate absolut= LocalDate.of(1969, 12, 31); LocalDate vetera= LocalDate.of(1969, 12, 21); String categoria=""; if(data.isBefore(absolut)) categoria="Absolut"; if(data.isAfter(vetera)) categoria="Veterà"; Participant nouParticipant =new Participant( arrayEsportista.get(indexNomEsportista).getNom(), arrayEsportista.get(indexNomEsportista).getCognom1(), arrayEsportista.get(indexNomEsportista).getCognom2(), arrayEsportista.get(indexNomEsportista).getSexe(), arrayEsportista.get(indexNomEsportista).getDataNaixement(), arrayEsportista.get(indexNomEsportista).getDni(), categoria,"", dorsal,tempsProva, ""); nouParticipant.setCategoria(categoria); nouParticipant.setDorsal(dorsal); nouParticipant.setTempsProva(tempsProva); nouParticipant.setCodiProva(arrayMarxaP.get(x).getCodiProva()); arrayParticipant.add(nouParticipant); } else { JOptionPane.showMessageDialog(null,"Afegeix avans algun Esportista","Inscripció Marxa Popular",JOptionPane.INFORMATION_MESSAGE,iconError); } }catch(Exception e) {JOptionPane.showMessageDialog(null,"Error Inscrivint Marxa PP","Inscripció Marxa Popular",JOptionPane.INFORMATION_MESSAGE,iconError); } } private static void InscripcioMarato(int x) { try { //MARATO ArrayList<String> nomClubs = new ArrayList<String>(); for(int p=0;p<arrayMarato.size();p++) { nomClubs.add(arrayMarato.get(p).getNom()); } Object[] array2 = nomClubs.toArray(new Object[nomClubs.size()]); Object seleccion2 = JOptionPane.showInputDialog( null, "Seleccioni la Marató", "Inscripció Prova", JOptionPane.QUESTION_MESSAGE, icon, array2, array2[0]); if(seleccion2==null) return; x = nomClubs.indexOf(seleccion2); int dorsal=creaComprovaDorsal(); LocalTime tempsProva = LocalTime.of(0, 0, 0); if(arrayEsporistaFederat.size()!=0) { ArrayList<String> nomEsportistes = new ArrayList<String>(); for(int p=0;p<arrayEsporistaFederat.size();p++) { nomEsportistes.add(arrayEsporistaFederat.get(p).getNom()); } Object[] array = nomEsportistes.toArray(new Object[nomEsportistes.size()]); Object seleccion = JOptionPane.showInputDialog( null, "Seleccioni un Esportista a Inscriure's", "Inscripció Prova", JOptionPane.QUESTION_MESSAGE, icon, array, array[0]); if(seleccion==null) return; int indexNomEsportista = nomEsportistes.indexOf(seleccion); LocalDate data=arrayEsporistaFederat.get(indexNomEsportista).getDataNaixement(); LocalDate absolut= LocalDate.of(1969, 12, 31); LocalDate vetera= LocalDate.of(1969, 12, 21); String categoria=""; if(data.isBefore(absolut)) categoria="Absolut"; if(data.isAfter(vetera)) categoria="Veterà"; Participant nouParticipant =new Participant( arrayEsporistaFederat.get(indexNomEsportista).getNom(), arrayEsporistaFederat.get(indexNomEsportista).getCognom1(), arrayEsporistaFederat.get(indexNomEsportista).getCognom2(), arrayEsporistaFederat.get(indexNomEsportista).getSexe(), arrayEsporistaFederat.get(indexNomEsportista).getDataNaixement(), arrayEsporistaFederat.get(indexNomEsportista).getDni(), categoria,"", dorsal,tempsProva, ""); nouParticipant.setCategoria(categoria); nouParticipant.setDorsal(dorsal); System.out.println("nouParticipant.setDorsal(dorsal) --> dorsal: "+dorsal); nouParticipant.setTempsProva(tempsProva); nouParticipant.setClub(arrayEsporistaFederat.get(indexNomEsportista).getClub()); nouParticipant.setCodiProva(arrayMarato.get(x).getCodiProva()); arrayParticipantF.add(nouParticipant); } else { JOptionPane.showMessageDialog(null,"Afegeix avans algun Esportista","Inscripció Marató",JOptionPane.INFORMATION_MESSAGE,iconError); } }catch(Exception e) {JOptionPane.showMessageDialog(null,"Error Inscrivint Marató","Inscripció Marató",JOptionPane.INFORMATION_MESSAGE,iconError); } } private static void LlistaInscripcio() { if((arrayParticipant.size()!=0)||(arrayParticipantF.size()!=0)) { String[] options = new String[] {"Participants Federats", "Participants No Federats"}; int response = JOptionPane.showOptionDialog(null, "Escull un tipus de Participant a Consultar", "Consulta Esportista", JOptionPane.DEFAULT_OPTION, JOptionPane.PLAIN_MESSAGE, icon, options, options[0]); if(response==0) { showInscripcionsParticipantsFederats(); //arrayParticipantF.get(0).MostrarDades(); } else if(response==1) { showInscripcionsParticipants(); //arrayParticipant.get(0).MostrarDades(); } else { MenuMain(); } } else JOptionPane.showMessageDialog(null,"Realitza alguna Inscripció","Llistar Inscripcions",JOptionPane.INFORMATION_MESSAGE,iconError); } private static void AnulacioProva() { System.out.println(arrayParticipant.size()); System.out.println(arrayParticipantF.size()); if((arrayParticipant.size()!=0)||(arrayParticipantF.size()!=0)) { Object[] array; Object seleccion; int index=2; ArrayList<String> nomParticipantsInscrits = new ArrayList<String>(); for(int p=0;p<arrayParticipant.size();p++) { if(arrayParticipant.size()>0) { nomParticipantsInscrits.add(arrayParticipant.get(p).getNom()); } } for(int p=0;p<arrayParticipantF.size();p++) { if(arrayParticipantF.size()>0) { nomParticipantsInscrits.add(arrayParticipantF.get(p).getNom()); } } array = nomParticipantsInscrits.toArray(new Object[nomParticipantsInscrits.size()]); seleccion = JOptionPane.showInputDialog( null, "Seleccioni un Participant", "Anulació Inscripció", JOptionPane.QUESTION_MESSAGE, null, array, array[0]); if(seleccion==null) return; index = nomParticipantsInscrits.indexOf(seleccion); String nomPart=nomParticipantsInscrits.get(index); for(int p=0;p<arrayParticipantF.size();p++) { if(nomPart.compareTo(arrayParticipantF.get(p).getNom())==0) { arrayParticipantF.remove(p); System.out.println(nomPart+" deleted successfully"); } } for(int p=0;p<arrayParticipant.size();p++) { if(nomPart.compareTo(arrayParticipant.get(p).getNom())==0) { arrayParticipant.remove(p); System.out.println(nomPart+" deleted successfully"); } } } else JOptionPane.showMessageDialog(null,"Realitza avans una Inscripció","Anul·lar Inscripcions",JOptionPane.INFORMATION_MESSAGE,iconError); } //MÈTODES PER EL MENU PROVES (CLASSIFICACIO) private static void showClasificacioSexe() { } private static void showClasificacioTotal() { String[] columnes = {"Posició","Dorsal","Nom","Sexe","Categoria","Temps"}; //Emplenar la taula int aux_I=0; Object[][] files = new Object[arrayParticipantF.size()+arrayParticipant.size()][6]; JTable table = new JTable(files, columnes); for (int j = 0; j < arrayParticipantF.size(); j++) { arrayParticipantF.get(j).showClassificacio(files,aux_I,j+1); aux_I++; } for (int j = 0; j < arrayParticipant.size(); j++) { arrayParticipant.get(j).showClassificacio(files,aux_I,j+1); aux_I++; } //Personalitzar-la PersonalitzarJTable(table); JScrollPane jsp = new JScrollPane(table); jsp.setPreferredSize(new Dimension (900, 400)); JOptionPane.showMessageDialog(null,jsp,"CLASSIFICACIÓ PROVA ("+arrayParticipantF.size()+")",JOptionPane.INFORMATION_MESSAGE,icon); } private static void showClasificacioCategoria() { Object[][] files = new Object[arrayParticipantF.size()][6]; String[] columnes = {"Posició","Dorsal","Nom","Sexe","Categoria","Temps"}; JTable table = new JTable(files, columnes); //Emplenar la taula int aux_I=0; for (int j = 0; j < arrayParticipantF.size(); j++) { arrayParticipantF.get(j).showClassificacio(files,aux_I,j); aux_I++; } //Personalitzar-la PersonalitzarJTable(table); JScrollPane jsp = new JScrollPane(table); jsp.setPreferredSize(new Dimension (900, 400)); JOptionPane.showMessageDialog(null,jsp,"CLASSIFICACIÓ PROVA ("+arrayParticipantF.size()+")",JOptionPane.INFORMATION_MESSAGE,icon); } //MÈTODES MENU DE PROVES (ENTRAR TEMPS) private static void tempsArribadaParticipant(Object[] array, Object seleccion, int index) { try { ArrayList<String> nomParticipants = new ArrayList<String>(); Duration tempsRecorregut; for(int p=0;p<arrayParticipant.size();p++) { nomParticipants.add(arrayParticipant.get(p).getNom()); } for(int p=0;p<arrayParticipantF.size();p++) { nomParticipants.add(arrayParticipantF.get(p).getNom()); } array = nomParticipants.toArray(new Object[nomParticipants.size()]); seleccion = JOptionPane.showInputDialog( null, "Seleccioni un Participant", "Entrada Temps Participant", JOptionPane.QUESTION_MESSAGE, icon, array, array[0]); if(seleccion==null) return; index = nomParticipants.indexOf(seleccion); String nomPart=nomParticipants.get(index); for(int p=0;p<arrayParticipantF.size();p++) { if(nomPart.compareTo(arrayParticipantF.get(p).getNom())==0) { Object value = JOptionPane.showInputDialog(null,"Hora d'arribada (00h00m00s): ","Entrada Temps Prova 10000", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; String resultat=(String)value; String[] split = resultat.split(":"); int hora=Integer.parseInt(split[0]); int min =Integer.parseInt(split[1]); int sec=Integer.parseInt(split[2]); LocalTime horaSortida = LocalTime.of(hora, min,sec); LocalTime HoraInicial = arrayParticipantF.get(p).getTempsProva(); tempsRecorregut=Duration.between(HoraInicial, horaSortida); finalTime = tempsRecorregut.toHoursPart()+":"+tempsRecorregut.toMinutesPart()+":"+tempsRecorregut.toSecondsPart(); arrayParticipantF.get(p).setTempsProva2(finalTime); //System.out.println("hora inicial: "+HoraInicial+"\nhora sortida: "+horaSortida); // System.out.println("temps rec: "+finalTime); } } for(int p=0;p<arrayParticipant.size();p++) { if(nomPart.compareTo(arrayParticipant.get(p).getNom())==0) { Object value = JOptionPane.showInputDialog(null,"Hora d'arribada (00h00m00s): ","Entrada Temps Prova 10000", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; String resultat=(String)value; String[] split = resultat.split(":"); int hora=Integer.parseInt(split[0]); int min =Integer.parseInt(split[1]); int sec=Integer.parseInt(split[2]); LocalTime horaSortida = LocalTime.of(hora, min,sec); LocalTime HoraInicial = arrayParticipantF.get(p).getTempsProva(); tempsRecorregut=Duration.between(HoraInicial, horaSortida); finalTime = tempsRecorregut.toHoursPart()+":"+tempsRecorregut.toMinutesPart()+":"+tempsRecorregut.toSecondsPart(); arrayParticipant.get(p).setTempsProva2(finalTime); System.out.println("hora inicial: "+HoraInicial+"\nhora sortida: "+horaSortida); System.out.println("temps rec: "+finalTime); } } } catch(ArrayIndexOutOfBoundsException e) { JOptionPane.showMessageDialog(null,"Afegeix avans un Participant","Entrada Arribada Participant",JOptionPane.INFORMATION_MESSAGE,iconError); } } private static void tempsProva(int opcio, ArrayList<String> nomProves, Object[] array, Object seleccion, int index) { String[] opcions2 = {"Marató", "Marxa Popular", "Prova10000", "Tornar"}; opcio = JOptionPane.showOptionDialog(null,"Seleccioni una Prova","Entrada Temps Prova",JOptionPane.NO_OPTION,JOptionPane.PLAIN_MESSAGE,icon,opcions2,null); switch(opcio) { case 0: //MARATÓ if(arrayMarato.size()!=0) { for(int p=0;p<arrayMarato.size();p++) { nomProves.add(arrayMarato.get(p).getNom()); } array = nomProves.toArray(new Object[nomProves.size()]); seleccion = JOptionPane.showInputDialog( null, "Seleccioni una Prova", "Entrada Temps Prova Marató", JOptionPane.QUESTION_MESSAGE, icon, array, array[0]); if(seleccion==null) return; index = nomProves.indexOf(seleccion); Object value = JOptionPane.showInputDialog(null,"Temps Sortida (00h00m00s): ","Entrada Temps Prova Marató", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; String resultat=(String)value; String[] split = resultat.split(":"); int hora=Integer.parseInt(split[0]); int min =Integer.parseInt(split[1]); int sec = 0; LocalTime horaSortida; if(split.length>2) { sec=Integer.parseInt(split[2]); horaSortida = LocalTime.of(hora, min,sec); } else { horaSortida = LocalTime.of(hora, min,00); } arrayParticipantF.get(index).modificaHoraSortida(horaSortida); } else JOptionPane.showMessageDialog(null,"Afegeix avans una Marató","Entrada Temps Marató",JOptionPane.INFORMATION_MESSAGE,iconError); break; case 1: //MARXA POPULAR if(arrayMarxaP.size()!=0) { for(int p=0;p<arrayMarxaP.size();p++) { nomProves.add(arrayMarxaP.get(p).getNom()); } array = nomProves.toArray(new Object[nomProves.size()]); seleccion = JOptionPane.showInputDialog( null, "Seleccioni una Prova", "Entrada Temps Prova Marxa", JOptionPane.QUESTION_MESSAGE, icon, array, array[0]); if(seleccion==null) return; index = nomProves.indexOf(seleccion); Object value = JOptionPane.showInputDialog(null,"Temps Sortida (00h00m00s): ","Entrada Temps Prova Marxa", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; String resultat=(String)value; String[] split = resultat.split(":"); int hora=Integer.parseInt(split[0]); int min =Integer.parseInt(split[1]); int sec=Integer.parseInt(split[2]); LocalTime horaSortida = LocalTime.of(hora, min,sec); arrayMarxaP.get(index).modificaHoraSortida(horaSortida); } else JOptionPane.showMessageDialog(null,"Afegeix avans una Marató","Entrada Temps Marató",JOptionPane.INFORMATION_MESSAGE,iconError); break; case 2: //PROVA 10K if(arrayProva10k.size()!=0) { for(int p=0;p<arrayProva10k.size();p++) { nomProves.add(arrayProva10k.get(p).getNom()); } array = nomProves.toArray(new Object[nomProves.size()]); seleccion = JOptionPane.showInputDialog( null, "Seleccioni una Prova", "Entrada Temps Prova 10000", JOptionPane.QUESTION_MESSAGE, icon, array, array[0]); if(seleccion==null) return; index = nomProves.indexOf(seleccion); Object value = JOptionPane.showInputDialog(null,"Temps Sortida (00h00m00s): ","Entrada Temps Prova 10000", JOptionPane.PLAIN_MESSAGE, icon,null,""); if(value==null) return; String resultat=(String)value; String[] split = resultat.split(":"); int hora=Integer.parseInt(split[0]); int min =Integer.parseInt(split[1]); int sec=Integer.parseInt(split[2]); LocalTime horaSortida = LocalTime.of(hora, min,sec); arrayProva10k.get(index).modificaHoraSortida(horaSortida); } else JOptionPane.showMessageDialog(null,"Afegeix avans una Prova 10000","Entrada Temps Prova 10000",JOptionPane.INFORMATION_MESSAGE,iconError); break; case 3: break; } } //Mètode per a carregar les dades que es guarden en els arxius. //S'encarrega de crear els objectes que en la sessió anteriore s van crear //MÈTODES AUXILIARS private static void LoadData() { System.out.print("--loading esportista data ["); //LOAD ESPORTISTES DATA try { Scanner lector = new Scanner(esportistes); //Si el lector troba algo a l'arxiu if(lector.hasNext()) { numEsportistes=lector.nextInt(); //Recull el nombre de assignatures lector.nextLine(); //Bucle per anar llegint i troçejant cada linia, guardant les dades que ens interessa a les arrays adecuades for(int p=0;p<numEsportistes;p++) { String linia=lector.nextLine(); String[] parts = linia.split("#"); String resultat=(String)parts[4]; String[] split = resultat.split("-"); int dia=Integer.parseInt(split[2]); int mes =Integer.parseInt(split[1]); int any=Integer.parseInt(split[0]); LocalDate data = LocalDate.of(any, mes, dia); Esportista e = new Esportista(parts[0], parts[1], parts[2], parts[5].charAt(0), data, parts[3]); arrayEsportista.add(e); } System.out.print(arrayEsportista.size()+"] --\n"); } lector.close(); } catch(FileNotFoundException e) { System.out.println("NULL]"); } catch(Exception e) { System.out.println("Error loading esportsita data --> "+e); } System.out.print("--loading esportistaF data ["); //LOAD ESPORTISTES DATA try { Scanner lector = new Scanner(esportistesF); //Si el lector troba algo a l'arxiu if(lector.hasNext()) { numEsportistes=lector.nextInt(); //Recull el nombre de assignatures lector.nextLine(); //Bucle per anar llegint i troçejant cada linia, guardant les dades que ens interessa a les arrays adecuades for(int p=0;p<numEsportistes;p++) { String linia=lector.nextLine(); String[] parts = linia.split("#"); String resultat=(String)parts[4]; String[] split = resultat.split("-"); int dia=Integer.parseInt(split[2]); int mes =Integer.parseInt(split[1]); int any=Integer.parseInt(split[0]); LocalDate data = LocalDate.of(any, mes, dia); EsportistaFederat e = new EsportistaFederat(parts[0], parts[1], parts[2], parts[7].charAt(0),data,parts[3],parts[6],parts[5]); arrayEsporistaFederat.add(e); } System.out.print(arrayEsporistaFederat.size()+"] --\n"); } lector.close(); } catch(FileNotFoundException e) { System.out.println("NULL]"); } catch(Exception e) { System.out.println("Error loading esportsitaF data --> "+e); } System.out.print("--loading club data ["); //LOAD CLUB DATA try { Scanner lector = new Scanner(club); //Si el lector troba algo a l'arxiu if(lector.hasNext()) { numClubs=lector.nextInt(); //Recull el nombre de assignatures lector.nextLine(); //Bucle per anar llegint i troçejant cada linia, guardant les dades que ens interessa a les arrays adecuades for(int p=0;p<numClubs;p++) { String linia=lector.nextLine(); String[] parts = linia.split("#"); arrayClub.add(new Club(parts[0], parts[1], parts[2], parts[4], Integer.parseInt(parts[3]))); } System.out.print(arrayClub.size()+"] --\n"); } lector.close(); } catch(FileNotFoundException e) { System.out.println("NULL]"); } catch(Exception e) { System.out.println("Error loading club data --> "+e); } System.out.print("--loading Marato data ["); try { Scanner lector = new Scanner(marato); //Si el lector troba algo a l'arxiu if(lector.hasNext()) { numProves=lector.nextInt(); //Recull el nombre de assignatures lector.nextLine(); numParticipants+=numProves; //Bucle per anar llegint i troçejant cada linia, guardant les dades que ens interessa a les arrays adecuades for(int p=0;p<numProves;p++) { String linia=lector.nextLine(); String[] parts = linia.split("#"); Marato ep = new Marato(parts[0],parts[1],parts[2],parts[5]); String resultat=(String)parts[3]; String[] split = resultat.split(":"); int hora=Integer.parseInt(split[0]); int min =Integer.parseInt(split[1]); int sec = 0; LocalTime horaSortida; if(split.length>2) { sec=Integer.parseInt(split[2]); horaSortida = LocalTime.of(hora, min,sec); } else { horaSortida = LocalTime.of(hora, min,00); } ep.setHoraSortida(horaSortida); ep.setData(parts[4]); arrayMarato.add(ep); } System.out.print(arrayMarato.size()+"] --\n"); } lector.close(); } catch(FileNotFoundException e) { System.out.println("NULL]"); } catch(Exception e) { System.out.println("Error loading Marato data --> "+e); } System.out.print("--loading Marxa PP data ["); try { Scanner lector = new Scanner(marxaP); //Si el lector troba algo a l'arxiu if(lector.hasNext()) { numProves=lector.nextInt(); //Recull el nombre de assignatures lector.nextLine(); numParticipants+=numProves; //Bucle per anar llegint i troçejant cada linia, guardant les dades que ens interessa a les arrays adecuades for(int p=0;p<numProves;p++) { String linia=lector.nextLine(); String[] parts = linia.split("#"); MarxaPopular ep = new MarxaPopular(parts[0],parts[1],parts[2],parts[3]); String resultat=(String)parts[6]; String[] split = resultat.split(":"); int hora=Integer.parseInt(split[0]); int min =Integer.parseInt(split[1]); int sec = 0; LocalTime horaSortida; if(split.length>2) { sec=Integer.parseInt(split[2]); horaSortida = LocalTime.of(hora, min,sec); } else { horaSortida = LocalTime.of(hora, min,00); } ep.setUbicacio(parts[4]); ep.setData(parts[5]); ep.sethSortida(horaSortida); arrayMarxaP.add(ep); } System.out.print(arrayMarxaP.size()+"] --\n"); } lector.close(); } catch(FileNotFoundException e) { System.out.println("NULL]"); } catch(Exception e) { System.out.println("Error loading Marxa data --> "+e); } System.out.print("--loading Prova10k data ["); try { Scanner lector = new Scanner(prova10k); //Si el lector troba algo a l'arxiu if(lector.hasNext()) { numProves=lector.nextInt(); //Recull el nombre de assignatures lector.nextLine(); numParticipants+=numProves; //Bucle per anar llegint i troçejant cada linia, guardant les dades que ens interessa a les arrays adecuades for(int p=0;p<numProves;p++) { String linia=lector.nextLine(); String[] parts = linia.split("#"); Prova10000 ep = new Prova10000(parts[0],parts[1],parts[2],parts[3]); String resultat=parts[7]; String[] split = resultat.split(":"); int hora=Integer.parseInt(split[0]); int min =Integer.parseInt(split[1]); int sec = 0; LocalTime horaSortida; if(split.length>2) { sec=Integer.parseInt(split[2]); horaSortida = LocalTime.of(hora, min,sec); } else { horaSortida = LocalTime.of(hora, min,00); } ep.setUbicacio(parts[4]); ep.setHoraSortida(horaSortida); ep.setData(parts[6]); ep.setClubAnfitrio(parts[5]); arrayProva10k.add(ep); } System.out.print(arrayProva10k.size()+"] --\n"); } lector.close(); } catch(FileNotFoundException e) { System.out.println("NULL]"); } catch(Exception e) { System.out.println("Error loading Prova10k data --> "+e); } System.out.print("--loading participants data ["); try { Scanner lector = new Scanner(participant); //Si el lector troba algo a l'arxiu if(lector.hasNext()) { numProves=lector.nextInt(); //Recull el nombre de assignatures lector.nextLine(); //Bucle per anar llegint i troçejant cada linia, guardant les dades que ens interessa a les arrays adecuades for(int p=0;p<numProves;p++) { String linia=lector.nextLine(); String[] parts = linia.split("#"); String resultat=(String)parts[4]; String[] split = resultat.split("-"); int dia=Integer.parseInt(split[2]); int mes =Integer.parseInt(split[1]); int any=Integer.parseInt(split[0]); LocalDate data = LocalDate.of(any, mes, dia); Participant e = new Participant(parts[0],parts[1],parts[2],parts[3].charAt(0), data,parts[5],parts[6],"",Long.parseLong(parts[7]), null, parts[9]); resultat=(String)parts[8]; split = resultat.split(":"); int hora=Integer.parseInt(split[0]); int min =Integer.parseInt(split[1]); int sec = 0; LocalTime horaSortida; if(split.length>2) { sec=Integer.parseInt(split[2]); horaSortida = LocalTime.of(hora, min,sec); } else { horaSortida = LocalTime.of(hora, min,00); } arrayParticipant.add(e); arrayParticipant.get(p).setCategoria(parts[6]); arrayParticipant.get(p).setCodiProva(parts[9]); arrayParticipant.get(p).setTempsProva(horaSortida); } System.out.print(arrayParticipant.size()+"] --\n"); } lector.close(); } catch(FileNotFoundException e) { System.out.println("NULL]"); } catch(Exception e) { System.out.println("Error loading participants --> "+e); } System.out.print("--loading participants F data ["); try { Scanner lector = new Scanner(participantF); //Si el lector troba algo a l'arxiu if(lector.hasNext()) { numProves=lector.nextInt(); //Recull el nombre de assignatures lector.nextLine(); //Bucle per anar llegint i troçejant cada linia, guardant les dades que ens interessa a les arrays adecuades for(int p=0;p<numProves;p++) { String linia=lector.nextLine(); String[] parts = linia.split("#"); String resultat=(String)parts[4]; String[] split = resultat.split("-"); int dia=Integer.parseInt(split[2]); int mes =Integer.parseInt(split[1]); int any=Integer.parseInt(split[0]); LocalDate data = LocalDate.of(any, mes, dia); Participant e = new Participant(parts[0],parts[1],parts[2],parts[3].charAt(0), data,parts[5],parts[6],parts[7],0, null, parts[10]); arrayParticipantF.add(e); resultat=(String)parts[9]; split = resultat.split(":"); int hora=Integer.parseInt(split[0]); int min =Integer.parseInt(split[1]); int sec = 0; LocalTime horaSortida; if(split.length>2) { sec=Integer.parseInt(split[2]); horaSortida = LocalTime.of(hora, min,sec); } else { horaSortida = LocalTime.of(hora, min,00); } arrayParticipantF.get(p).setCategoria(parts[6]); arrayParticipantF.get(p).setCodiProva(parts[10]); arrayParticipantF.get(p).setClub(parts[7]); arrayParticipantF.get(p).setDorsal(Long.parseLong(parts[8])); arrayParticipantF.get(p).setTempsProva(horaSortida); } System.out.print(arrayParticipantF.size()+"] --\n"); } lector.close(); } catch(FileNotFoundException e) { System.out.println("NULL]"); } catch(Exception e) { System.out.println("Error loading participants F data --> "+e); } } //Mètode per a guardar les dades locals a els arxius per tal de poguer rescatar la informació en la seguent //sessió utilitzant el LoadData. private static void SaveData() { //Guardant Esportistes try { PrintStream escriptor = new PrintStream(esportistes); System.out.println("\n\nGuardant els esportistes ("+arrayEsportista.size()+")"); escriptor.println(arrayEsportista.size()); for(int p=0;p<arrayEsportista.size();p++) { escriptor.print(arrayEsportista.get(p).getNom()); escriptor.print("#"); escriptor.print(arrayEsportista.get(p).getCognom1()); escriptor.print("#"); escriptor.print(arrayEsportista.get(p).getCognom2()); escriptor.print("#"); escriptor.print(arrayEsportista.get(p).getDni()); escriptor.print("#"); escriptor.print(arrayEsportista.get(p).getDataNaixement()); escriptor.print("#"); escriptor.print(arrayEsportista.get(p).getSexe()+"\n"); } escriptor.close(); } catch(Exception e) {System.out.println("Error Guardant els Esportistes "+e);} //Guardant Esportistes Federats try { PrintStream escriptor = new PrintStream(esportistesF); System.out.println("Guardant els esportistesF ("+arrayEsporistaFederat.size()+")"); escriptor.println(arrayEsporistaFederat.size()); for(int p=0;p<arrayEsporistaFederat.size();p++) { escriptor.print(arrayEsporistaFederat.get(p).getNom()); escriptor.print("#"); escriptor.print(arrayEsporistaFederat.get(p).getCognom1()); escriptor.print("#"); escriptor.print(arrayEsporistaFederat.get(p).getCognom2()); escriptor.print("#"); escriptor.print(arrayEsporistaFederat.get(p).getDni()); escriptor.print("#"); escriptor.print(arrayEsporistaFederat.get(p).getDataNaixement()); escriptor.print("#"); escriptor.print(arrayEsporistaFederat.get(p).getCodiFederat()); escriptor.print("#"); escriptor.print(arrayEsporistaFederat.get(p).getClub()); escriptor.print("#"); escriptor.print(arrayEsporistaFederat.get(p).getSexe()+"\n"); } escriptor.close(); } catch(Exception e) {System.out.println("Error Guardant els EsportistesF "+e);} //Guardant Club try { PrintStream escriptor = new PrintStream(club); System.out.println("Guardant els Clubs ("+arrayClub.size()+")"); escriptor.println(arrayClub.size()); for(int p=0;p<arrayClub.size();p++) { escriptor.print(arrayClub.get(p).getNom()); escriptor.print("#"); escriptor.print(arrayClub.get(p).getPoblacio()); escriptor.print("#"); escriptor.print(arrayClub.get(p).getCodiPostal()); escriptor.print("#"); escriptor.print(arrayClub.get(p).getCodiClub()); escriptor.print("#"); escriptor.print(arrayClub.get(p).getAnyFede()+"\n"); } escriptor.close(); } catch(Exception e) {System.out.println("Error Guardant els clubs "+e);} //GUARDANT PROVES //Guardant Maratons try { PrintStream escriptor = new PrintStream(marato); System.out.println("Guardant les Maratons ("+arrayMarato.size()+")"); escriptor.println(arrayMarato.size()); for(int p=0;p<arrayMarato.size();p++) { escriptor.print(arrayMarato.get(p).getNom()); escriptor.print("#"); escriptor.print(arrayMarato.get(p).getCodiProva()); escriptor.print("#"); escriptor.print(arrayMarato.get(p).getAny()); escriptor.print("#"); escriptor.print(arrayMarato.get(p).getHoraSortida()); escriptor.print("#"); escriptor.print(arrayMarato.get(p).getData()); escriptor.print("#"); escriptor.print(arrayMarato.get(p).getParticipants()+"\n"); } escriptor.close(); } catch(Exception e) {System.out.println("Error Guardant les maratons "+e);} //Guardant Prova10000 try { PrintStream escriptor = new PrintStream(prova10k); System.out.println("Guardant Proves10K ("+arrayProva10k.size()+")"); escriptor.println(arrayProva10k.size()); for(int p=0;p<arrayProva10k.size();p++) { escriptor.print(arrayProva10k.get(p).getNom()); escriptor.print("#"); escriptor.print(arrayProva10k.get(p).getCodiProva()); escriptor.print("#"); escriptor.print(arrayProva10k.get(p).getAny()); escriptor.print("#"); escriptor.print(arrayProva10k.get(p).getParticipants()); escriptor.print("#"); escriptor.print(arrayProva10k.get(p).getUbicacio()); escriptor.print("#"); escriptor.print(arrayProva10k.get(p).getClubAnfitrio()); escriptor.print("#"); escriptor.print(arrayProva10k.get(p).getData()); escriptor.print("#"); escriptor.print((arrayProva10k.get(p).getHoraSortida()) /*+(arrayProva10k.get(p).getHoraSortida().getSecond()*/+"\n"); } escriptor.close(); } catch(Exception e) {System.out.println("Error Guardant les Proves 10K "+e);} //Guardant MarxaPopular try { PrintStream escriptor = new PrintStream(marxaP); System.out.println("Guardant Marxes PPs ("+arrayMarxaP.size()+")"); escriptor.println(arrayMarxaP.size()); for(int p=0;p<arrayMarxaP.size();p++) { escriptor.print(arrayMarxaP.get(p).getNom()); escriptor.print("#"); escriptor.print(arrayMarxaP.get(p).getCodiProva()); escriptor.print("#"); escriptor.print(arrayMarxaP.get(p).getAny()); escriptor.print("#"); escriptor.print(arrayMarxaP.get(p).getParticipants()); escriptor.print("#"); escriptor.print(arrayMarxaP.get(p).getUbicacio()); escriptor.print("#"); escriptor.print(arrayMarxaP.get(p).getData()); escriptor.print("#"); escriptor.print(arrayMarxaP.get(p).gethSortida()+"\n"); } escriptor.close(); } catch(Exception e) {System.out.println("Error Guardant les Marxes PPs "+e);} //Guardant Participants try { PrintStream escriptor = new PrintStream(participant); System.out.println("Guardant els Participants ("+arrayParticipant.size()+")"); escriptor.println(arrayParticipant.size()); for(int p=0;p<arrayParticipant.size();p++) { escriptor.print(arrayParticipant.get(p).getNom()); escriptor.print("#"); escriptor.print(arrayParticipant.get(p).getCognom1()); escriptor.print("#"); escriptor.print(arrayParticipant.get(p).getCognom2()); escriptor.print("#"); escriptor.print(arrayParticipant.get(p).getSexe()); escriptor.print("#"); escriptor.print(arrayParticipant.get(p).getDataNaixement()); escriptor.print("#"); escriptor.print(arrayParticipant.get(p).getDni()); escriptor.print("#"); escriptor.print(arrayParticipant.get(p).getCategoria()); escriptor.print("#"); escriptor.print(arrayParticipant.get(p).getDorsal()); System.out.println("dorsal (saving prticipant) "+arrayParticipant.get(p).getDorsal()); escriptor.print("#"); escriptor.print(arrayParticipant.get(p).getTempsProva()); escriptor.print("#"); escriptor.print(arrayParticipant.get(p).getCodiProva()+"\n"); } escriptor.close(); } catch(Exception e) {System.out.println("Error Guardant els Participants Normals"+e);} //Guardant ParticipantsF try { PrintStream escriptor = new PrintStream(participantF); System.out.println("Guardant els ParticipantsF ("+arrayParticipantF.size()+")"); escriptor.println(arrayParticipantF.size()); for(int p=0;p<arrayParticipantF.size();p++) { escriptor.print(arrayParticipantF.get(p).getNom()); escriptor.print("#"); escriptor.print(arrayParticipantF.get(p).getCognom1()); escriptor.print("#"); escriptor.print(arrayParticipantF.get(p).getCognom2()); escriptor.print("#"); escriptor.print(arrayParticipantF.get(p).getSexe()); escriptor.print("#"); escriptor.print(arrayParticipantF.get(p).getDataNaixement()); escriptor.print("#"); escriptor.print(arrayParticipantF.get(p).getDni()); escriptor.print("#"); escriptor.print(arrayParticipantF.get(p).getCategoria()); escriptor.print("#"); escriptor.print(arrayParticipantF.get(p).getClub()); escriptor.print("#"); escriptor.print(arrayParticipantF.get(p).getDorsal()); escriptor.print("#"); escriptor.print(arrayParticipantF.get(p).getTempsProva()); escriptor.print("#"); escriptor.print(arrayParticipantF.get(p).getCodiProva()+"\n"); } escriptor.close(); } catch(Exception e) {System.out.println("Error Guardant els Participants F"+e);} } private static void Arxiu() { try { arxiuInicial = new File("practicaFile.txt"); esportistes = new File("esportistes.txt"); proves = new File("proves.txt"); club = new File("club.txt"); participant = new File("participant.txt"); participantF = new File("participantf.txt"); clasificacio = new File("clasificacioF.txt"); clasificacioF = new File("clasificacio.txt"); marato=new File("marato.txt"); prova10k=new File("prova10k.txt"); marxaP=new File("marxaP.txt"); esportistesF=new File("esportistesF.txt"); if (arxiuInicial.createNewFile()){firstTime=true;} else firstTime=false; } catch (IOException e) { System.out.println("An error occurred."); e.printStackTrace(); } } private static void PersonalitzarJTable(JTable table) { DefaultTableCellRenderer defaultRenderer = (DefaultTableCellRenderer) table.getDefaultRenderer(Object.class); JTableHeader header = table.getTableHeader(); defaultRenderer.setHorizontalAlignment(JLabel.CENTER); defaultRenderer.setBackground(Color.LIGHT_GRAY); header.setForeground(Color.yellow); header.setBackground(Color.black); header.setFont(new Font("Microsoft JhengHei", Font.BOLD,16)); table.setGridColor(Color.BLACK); } private static void showEsportistes() { if(arrayEsportista.size()!=0) { Object[][] files = new Object[arrayEsportista.size()][6]; String[] columnes = {"Nom","1r Cognom","2n Cognom","DNI","DataNaix","Sexe"}; JTable table = new JTable(files, columnes); //Emplenar la taula int aux_I=0; for (int j = 0; j < arrayEsportista.size(); j++) { arrayEsportista.get(j).show(files,aux_I); aux_I++; } //Personalitzar-la PersonalitzarJTable(table); JScrollPane jsp = new JScrollPane(table); jsp.setPreferredSize(new Dimension (900, 400)); JOptionPane.showMessageDialog(null,jsp,"LLISTAR ESPORTISTES FED ("+arrayEsportista.size()+")",JOptionPane.INFORMATION_MESSAGE,icon); } else JOptionPane.showMessageDialog(null,"Afegeix avans algun Esportista!","Consulta Esportista",JOptionPane.INFORMATION_MESSAGE,iconError); } private static void showEsportistesFederats() { if(arrayEsporistaFederat.size()!=0) { Object[][] files = new Object[arrayEsporistaFederat.size()][8]; String[] columnes = {"Nom","1r Cognom","2n Cognom","DNI","DataNaix","codi Federat","club","Sexe"}; JTable table = new JTable(files, columnes); //Emplenar la taula int aux_I=0; for (int j = 0; j < arrayEsporistaFederat.size(); j++) { arrayEsporistaFederat.get(j).show(files,aux_I); aux_I++; } //Personalitzar-la PersonalitzarJTable(table); JScrollPane jsp = new JScrollPane(table); jsp.setPreferredSize(new Dimension (900, 400)); JOptionPane.showMessageDialog(null,jsp,"LLISTAR ESPORTISTES FED ("+arrayEsporistaFederat.size()+")",JOptionPane.INFORMATION_MESSAGE,icon); } else JOptionPane.showMessageDialog(null,"Afegeix avans algun Esportista!","Consulta Esportista",JOptionPane.INFORMATION_MESSAGE,iconError); } private static void showProva10k() { if(arrayProva10k.size()!=0) { Object[][] files = new Object[arrayProva10k.size()][8]; String[] columnes = {"Nom","Codi Prova","Any","Participants","Ubicació","Club Host","Data","Hora Sortida"}; JTable table = new JTable(files, columnes); int aux_I=0; for (int j = 0; j < arrayProva10k.size(); j++) { arrayProva10k.get(j).show(files,aux_I); aux_I++; } PersonalitzarJTable(table); JScrollPane jsp = new JScrollPane(table); jsp.setPreferredSize(new Dimension (900, 400)); JOptionPane.showMessageDialog(null,jsp,"LLISTAR PROVA 10K ("+arrayProva10k.size()+")",JOptionPane.INFORMATION_MESSAGE,icon); } else { JOptionPane.showMessageDialog(null,"Afegeix avans alguna Prova10000!","Consulta Prova10000",JOptionPane.INFORMATION_MESSAGE,iconError); } } private static void showClub() { Object[][] files = new Object[arrayClub.size()][5]; String[] columnes = {"Nom","Ubicació","Codi Postal","Codi Club","Any Fundació"}; JTable table = new JTable(files, columnes); //Emplenar la taula int aux_I=0; for (int j = 0; j < arrayClub.size(); j++) { arrayClub.get(j).show(files,aux_I); aux_I++; } //Personalitzar-la PersonalitzarJTable(table); JScrollPane jsp = new JScrollPane(table); jsp.setPreferredSize(new Dimension (900, 400)); JOptionPane.showMessageDialog(null,jsp,"LLISTAR CLUBS ("+arrayClub.size()+")",JOptionPane.INFORMATION_MESSAGE,icon); } private static void showMarxaPopular() { if(arrayMarxaP.size()!=0) { Object[][] files = new Object[arrayMarxaP.size()][7]; String[] columnes = {"Nom","Codi Prova","Any","Participants","Ubicació","Data","Hora Sortida"}; JTable table = new JTable(files, columnes); //Emplenar la taula int aux_I=0; for (int j = 0; j < arrayMarxaP.size(); j++) { arrayMarxaP.get(j).show(files,aux_I); aux_I++; } PersonalitzarJTable(table); JScrollPane jsp = new JScrollPane(table); jsp.setPreferredSize(new Dimension (900, 400)); JOptionPane.showMessageDialog(null,jsp,"LLISTAR MARXES POPULARS ("+arrayMarxaP.size()+")",JOptionPane.INFORMATION_MESSAGE,icon); } else { JOptionPane.showMessageDialog(null,"Afegeix avans alguna Marxa Popular!","Consulta Marxa Popular",JOptionPane.INFORMATION_MESSAGE,iconError); } } private static void showMarato() { if(arrayMarato.size()!=0) { Object[][] files = new Object[arrayMarato.size()][6]; String[] columnes = {"Nom","Codi Prova","Any","Participants","Data","Hora Sortida"}; JTable table = new JTable(files, columnes); //Emplenar la taula int aux_I=0; for (int j = 0; j < arrayMarato.size(); j++) { arrayMarato.get(j).show(files,aux_I); aux_I++; } //Personalitzar-la PersonalitzarJTable(table); JScrollPane jsp = new JScrollPane(table); jsp.setPreferredSize(new Dimension (900, 400)); JOptionPane.showMessageDialog(null,jsp,"LLISTAR MARATONS ("+arrayMarato.size()+")",JOptionPane.INFORMATION_MESSAGE,icon); } else { JOptionPane.showMessageDialog(null,"Afegeix avans alguna Marató!","Consulta Marató",JOptionPane.INFORMATION_MESSAGE,iconError); } } private static void showInscripcionsParticipants() { if(arrayParticipant.size()!=0) { Object[][] files = new Object[arrayParticipant.size()][10]; String[] columnes = {"Codi Prova","Nom","Cognom","Sexe","Data Naix","DNI","Categoria","Dorsal","Temps"}; JTable table = new JTable(files, columnes); //Emplenar la taula //;getCategoria();this.getClub();this.getDorsal();this.getTempsProva();this.getCodiProva(); int aux_I=0; for (int j = 0; j < arrayParticipant.size(); j++) { arrayParticipant.get(j).show(files,aux_I); aux_I++; } //Personalitzar-la PersonalitzarJTable(table); JScrollPane jsp = new JScrollPane(table); jsp.setPreferredSize(new Dimension (900, 400)); JOptionPane.showMessageDialog(null,jsp,"LLISTAR Participants ("+arrayParticipant.size()+")",JOptionPane.INFORMATION_MESSAGE,icon); } else { JOptionPane.showMessageDialog(null,"Realitza avans una Inscripció","Llistar Inscripcions",JOptionPane.INFORMATION_MESSAGE,iconError); } } private static void showInscripcionsParticipantsFederats() { if(arrayParticipantF.size()!=0) { Object[][] files = new Object[arrayParticipantF.size()][10]; String[] columnes = {"Codi Prova","Nom","Cognom","Sexe","Data Naix","DNI","Categoria","Club","Dorsal","Temps"}; JTable table = new JTable(files, columnes); //Emplenar la taula //;getCategoria();this.getClub();this.getDorsal();this.getTempsProva();this.getCodiProva(); int aux_I=0; for (int j = 0; j < arrayParticipantF.size(); j++) { arrayParticipantF.get(j).showFed(files,aux_I); aux_I++; } //Personalitzar-la PersonalitzarJTable(table); JScrollPane jsp = new JScrollPane(table); jsp.setPreferredSize(new Dimension (900, 400)); JOptionPane.showMessageDialog(null,jsp,"LLISTAR ParticipantsF ("+arrayParticipantF.size()+")",JOptionPane.INFORMATION_MESSAGE,icon); } else JOptionPane.showMessageDialog(null,"Realitza avans una Inscripció","Llistar Inscripcions",JOptionPane.INFORMATION_MESSAGE,iconError); } //Mètode que retrorna un codi acceptable per la prova tipus (AAAAPPPP) //Es forma a partir del nombre de participants actuals. private static String GeneradorCodiProva() { String str = String.format("%04d", numParticipants+1); int year = Calendar.getInstance().get(Calendar.YEAR); return (year+str); } //Mètode que retorna el codi de federació unic per a l'esportista federat. private static int creaComprovaCodiFederat() { Random rand = new Random(); int num = rand.nextInt(1000); for (int p=0;p<arrayEsporistaFederat.size();p++) { if(num==Integer.parseInt(arrayEsporistaFederat.get(p).getCodiFederat())) //Si coincideix amb algun altre, torna a generar-ne { creaComprovaCodiFederat(); } } return num; } //Mètode per a crear i comprovar el codi unic del club creat private static int creaComprovaCodiClub() { Random rand = new Random(); int num = rand.nextInt(100); for (int p=0;p<arrayClub.size();p++) { if(num==arrayClub.get(p).getCodiClub()) { creaComprovaCodiClub(); } } return num; } //Mètode per a crear i comprovar el dorsal unic de participant private static int creaComprovaDorsal() { Random rand = new Random(); int num = rand.nextInt(100); for (int p=0;p<arrayParticipantF.size();p++) { if(num==arrayParticipantF.get(p).getDorsal()) { creaComprovaDorsal(); } } return num; } }
23a2965559749e0221ae977f2e1d6f9b9923002b
cbcca7b7a8d263f6ac7ffd687fd6d5c4fb365148
/scf-server/src/test/java/com/github/leeyazhou/scf/server/deploy/bytecode/TestClass.java
01d61128373c2f0ccba9d7d89cc193536022aefc
[ "Apache-2.0" ]
permissive
bytesgo/iscoder-rpc
53dde53844491aafc3953c9777845c53d627d8ff
be4ff3fea3344663ebffa52a252f1e8b85ac876d
refs/heads/master
2023-07-21T14:43:43.235147
2023-07-18T01:55:46
2023-07-18T01:55:46
94,415,117
0
0
Apache-2.0
2023-07-18T01:55:48
2017-06-15T07:59:20
Java
UTF-8
Java
false
false
577
java
package com.github.leeyazhou.scf.server.deploy.bytecode; import java.util.List; public class TestClass { public List<String> getList(List<String> list) { return null; } public List<TestEntity> getListEntity(List<TestEntity> list) { return null; } public List<TestEntity> getListEntity(int a, String b) { return null; } public List<TestEntity> getListEntity(String a, String b) { return null; } public TestEntity getListEntity(String b, int a) { return null; } public TestEntity getListEntity(String a) { return null; } }
831a2ed822c8dba849c7cdf7e9ccb4cde020edd9
f41f6cf4e8005e53f4ad6c5e33218f09b16e510e
/common/src/main/java/com/sxds/common/tools/UiTool.java
5f3421fda3f1aa1ca09af79768eb332d5c91dd37
[]
no_license
inRush/Graphene-Wallet
63857f97c1e9356f5262cc514ca16d6a606c72cd
706f47c8d24f9a7a9e063bfde73b384fc53fad56
refs/heads/dev
2020-03-16T00:32:42.137678
2018-05-07T06:04:45
2018-05-07T06:04:45
132,419,464
5
0
null
null
null
null
UTF-8
Java
false
false
2,595
java
package com.sxds.common.tools; import android.annotation.SuppressLint; import android.app.Activity; import android.content.res.Resources; import android.graphics.Rect; import android.os.Build; import android.util.DisplayMetrics; import android.view.Window; /** * @author qiujuer Email:[email protected] * @version 1.0.0 */ public class UiTool { private static int STATUS_BAR_HEIGHT = -1; /** * 得到我们的状态栏的高度 * @param activity BaseActivity * @return 状态栏的高度 */ @SuppressLint("ObsoleteSdkInt") public static int getStatusBarHeight(Activity activity) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && STATUS_BAR_HEIGHT == -1) { try { final Resources res = activity.getResources(); // 尝试获取status_bar_height这个属性的Id对应的资源int值 int resourceId = res.getIdentifier("status_bar_height", "dimen", "android"); if (resourceId <= 0) { Class<?> clazz = Class.forName("com.android.internal.R$dimen"); Object object = clazz.newInstance(); resourceId = Integer.parseInt(clazz.getField("status_bar_height") .get(object).toString()); } // 如果拿到了就直接调用获取值 if (resourceId > 0) { STATUS_BAR_HEIGHT = res.getDimensionPixelSize(resourceId); } // 如果还是未拿到 if (STATUS_BAR_HEIGHT <= 0) { // 通过Window拿取 Rect rectangle = new Rect(); Window window = activity.getWindow(); window.getDecorView().getWindowVisibleDisplayFrame(rectangle); STATUS_BAR_HEIGHT = rectangle.top; } } catch (Exception e) { e.printStackTrace(); } } return STATUS_BAR_HEIGHT; } public static int getScreenWidth(Activity activity) { DisplayMetrics displayMetrics = activity.getResources().getDisplayMetrics(); //int width = activity.getWindowManager().getDefaultDisplay().getWidth(); return displayMetrics.widthPixels; } public static int getScreenHeight(Activity activity) { DisplayMetrics displayMetrics = activity.getResources().getDisplayMetrics(); //int width = activity.getWindowManager().getDefaultDisplay().getWidth(); return displayMetrics.heightPixels; } }
2301cc950847a26f0817d7ad36449232b7db0ee1
8fa221482da055f4c8105b590617a27595826cc3
/sources/com/amazon/device/iap/internal/C0185a.java
6d41df31ba9927032bf936752d8dc703cb086d2b
[]
no_license
TehVenomm/sauceCodeProject
4ed2f12393e67508986aded101fa2db772bd5c6b
0b4e49a98d14b99e7d144a20e4c9ead408694d78
refs/heads/master
2023-03-15T16:36:41.544529
2018-10-08T03:44:58
2018-10-08T03:44:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
361
java
package com.amazon.device.iap.internal; /* renamed from: com.amazon.device.iap.internal.a */ public interface C0185a { /* renamed from: a */ void mo1176a(String str, String str2); /* renamed from: a */ boolean mo1177a(); /* renamed from: b */ void mo1178b(String str, String str2); /* renamed from: b */ boolean mo1179b(); }
41a200256bf38fdc3ab9891e091f9572898ee7cb
42975583c9d8e119dbdb65ce7d4e6e7d10268cef
/stage-1/lesson-4/src/main/java/pers/qly/deep/in/java/stage1/lesson4/stream/StreamDemo.java
e58fe01f9b35a77e09aea20c4cdda979ea035468
[]
no_license
70Cloud/deep-in-java
52114752fa9c127b570b0be1cb1428ddb4b1675c
29aa0af535f58cf66f123e6d8f5a91031ab44cdd
refs/heads/master
2023-04-29T22:13:53.726210
2019-07-15T14:06:36
2019-07-15T14:06:36
181,702,482
0
0
null
2023-04-17T19:34:55
2019-04-16T14:10:18
Java
UTF-8
Java
false
false
1,668
java
package pers.qly.deep.in.java.stage1.lesson4.stream; import java.util.Comparator; import java.util.stream.Stream; /** * @Author: NoNo * @Description: * @Date: Create in 15:58 2019/2/16 */ public class StreamDemo { public static void main(String[] args) { count(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); line(); sort(6, 4, 7, 9, 8, 1, 3, 2, 5); line(); // 比较器 , 倒序排序 sort((x, y) -> (x < y) ? 1 : ((x == y) ? 0 : -1), 6, 4, 7, 9, 8, 1, 3, 2, 5); line(); parallelSort(1, 2, 3, 4, 5, 6, 7, 8, 9); } private static void line() { System.out.println(); } private static void parallelSort(Integer... numbers) { Stream.of(numbers) .sorted() .parallel() // 转换并行 Stream 操作(如果数据没有相互依赖可以这么做) .forEach(StreamDemo::println); } private static void println(Object object) { System.out.printf("[%s] : %s\n", Thread.currentThread().getName(), object); } private static void sort(Integer... numbers) { Stream.of(numbers) .sorted() .forEach(System.out::println); } private static void sort(Comparator<Integer> comparator, Integer... numbers) { Stream.of(numbers) .sorted(comparator) .forEach(System.out::println); } private static void count(Integer... numbers) { Stream.of(numbers) .reduce(Integer::sum) // 合并/聚合 .map(String::valueOf) .ifPresent(System.out::println); } }
d6a8c67ccc2b0c722e5a68c1aead4f1fa6d2a5be
5d3f15be7de4dec3d5be6c3e81d68877d0a264e3
/app/src/main/java/com/example/mycar/AddCar.java
66170d5e6f61f56182b75e68951916084da6a729
[]
no_license
Tolyzenkov/MyCar
df3b8772515c91e18ac42853ce9d3f3612596452
37548a46da7166458b2dd88d1db664fc972aa71b
refs/heads/master
2023-01-01T21:16:57.637541
2020-10-25T12:09:33
2020-10-25T12:09:33
304,219,914
0
0
null
null
null
null
UTF-8
Java
false
false
3,430
java
package com.example.mycar; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.graphics.Color; import android.os.Bundle; import android.util.Log; import android.view.Gravity; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Spinner; import android.widget.TextView; import java.util.ArrayList; public class AddCar extends AppCompatActivity { Spinner brandSpinner, modelSpinner, fuelSpinner; ArrayList brandSpinnerArrayList, modelSpinnerArrayList, fuelSpinnerArrayList; ArrayAdapter brandSpinnerAdapter, modelSpinnerAdapter, fuelSpinnerAdapter; String brand; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_add_car); brandSpinner = (Spinner) findViewById(R.id.spinnerBrand); modelSpinner = (Spinner) findViewById(R.id.modelSpinner); fuelSpinner = (Spinner) findViewById(R.id.typeOfFuel); brandSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { ((TextView)brandSpinner.getChildAt(0)).setTextColor(Color.WHITE); ((TextView)brandSpinner.getChildAt(0)).setGravity(Gravity.LEFT); ((TextView)brandSpinner.getChildAt(0)).setTextSize(16); String selectedBrand = brandSpinner.getSelectedItem().toString(); switch (selectedBrand) { case "Toyota": modelSpinner.setAdapter(new ArrayAdapter<String>(AddCar.this, android.R.layout.simple_spinner_dropdown_item, getResources().getStringArray(R.array.ToyotaModels))); break; case "Nissan": modelSpinner.setAdapter(new ArrayAdapter<String>(AddCar.this, android.R.layout.simple_spinner_dropdown_item, getResources().getStringArray(R.array.NissanModels))); break; case "Honda": modelSpinner.setAdapter(new ArrayAdapter<String>(AddCar.this, android.R.layout.simple_spinner_dropdown_item, getResources().getStringArray(R.array.HondaModels))); break; case "Subaru": modelSpinner.setAdapter(new ArrayAdapter<String>(AddCar.this, android.R.layout.simple_spinner_dropdown_item, getResources().getStringArray(R.array.SubaruModels))); break; } } @Override public void onNothingSelected(AdapterView<?> adapterView) { } }); modelSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { } @Override public void onNothingSelected(AdapterView<?> adapterView) { } }); } public void cancel(View view) { Intent addCarIntent = new Intent(AddCar.this, MainActivity.class); startActivity(addCarIntent); } }
a07df6555a78cc3acda366f6882b746a4161b129
8f8803e50e93dce8ac70db898d02f49480ddb121
/src/test/java/com/waes/diffapi/helper/DiffRequestHelper.java
c602feeabb50cc560321ab5fc5895991ab6e0c0b
[]
no_license
gnrivero/diff-api
1da2d9b3a6614800d10eff595a809be10aa7803b
2711f230268cec0ff0a2b375298cc8de013dca7a
refs/heads/develop
2023-02-27T13:25:38.904452
2021-02-08T15:00:50
2021-02-08T15:00:50
332,241,193
0
1
null
2021-02-08T14:51:58
2021-01-23T15:22:15
Java
UTF-8
Java
false
false
347
java
package com.waes.diffapi.helper; import com.waes.diffapi.domain.dto.DiffRequest; public final class DiffRequestHelper { public static DiffRequest getDiffRequest() { return new DiffRequest("dGVzdA=="); } public static DiffRequest getDiffRequestWithCustomValue(String value) { return new DiffRequest(value); } }
29628a876b3df0d5f02641f5d745779fce16794b
384950dfb62513ed62199eb167a360aea1c61271
/app/src/main/java/com/merlin/time/my/feedback/adapter/FeedbackBaseHolder.java
c361053d0f2866e4925f124922a2804688f635e1
[]
no_license
merlin721/Network
e9d2d5aa14a1699fee2d96c627a7611071fc4609
2424de42cdf46c237dca7c91e11b28f055e36f4d
refs/heads/master
2020-07-03T13:58:23.262278
2019-08-12T12:56:23
2019-08-12T12:56:23
201,927,101
0
0
null
null
null
null
UTF-8
Java
false
false
358
java
package com.merlin.time.my.feedback.adapter; import android.support.v7.widget.RecyclerView; import android.view.View; /** * @author merlin720 * @date 2019/2/16 * @mail [email protected] * @description */ public class FeedbackBaseHolder extends RecyclerView.ViewHolder { public FeedbackBaseHolder(View itemView) { super(itemView); } }
2403c41e17c5d8def56dceb918682df1dc1a0ee3
9d14880f8d247134b1a1875e64cfcc4acec6bbaf
/SGCteam4/src/main/java/br/gov/ufms/SGCteam04/repositories/OpcaoPagamentoRepository.java
57ee06e348556823084b0dad72905784ca503f9d
[]
no_license
wandermarmf/CONSOFT_2017_TEAM4
9206e9749a1316f3dd4ea45a0010880d14365b2d
53e2ac3b607c94e119a9ee10f786cb4723390c88
refs/heads/master
2021-01-20T04:10:07.427998
2017-08-10T04:37:15
2017-08-10T04:37:15
89,651,217
0
0
null
null
null
null
UTF-8
Java
false
false
361
java
package br.gov.ufms.SGCteam04.repositories; import br.gov.ufms.SGCteam04.models.OpcaoPagamento; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; /** * Created by Marco Cardoso on 7/10/2017. */ @Repository public interface OpcaoPagamentoRepository extends CrudRepository<OpcaoPagamento,Integer>{ }
f997665aa9c1d98a6945004c4ff4fd2a98af5a0d
f89ae97df6504ce77595c9f7eb90301291d32ed8
/jdbcbasic/src/jdbcbasic/UpdateMySQL.java
806bebad48f180fdb699303cbcf2a779587bf365
[]
no_license
Sonny1245/dynamic-registration-form
630a60fc79ef80ee2f60f2e1dc47be0855e37d8d
134650cb3ab9319292d47bfabaa769fbdb5d7c9a
refs/heads/master
2023-06-24T10:26:00.016869
2023-06-09T20:54:59
2023-06-09T20:54:59
364,685,552
1
0
null
2021-05-05T21:15:05
2021-05-05T19:30:12
Java
UTF-8
Java
false
false
968
java
package jdbcbasic; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; public class UpdateMySQL { public static void main(String[] args) throws ClassNotFoundException, SQLException { String url = "jdbc:mysql://localhost:3306/employees?" + "useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC"; String username = "hbstudent"; String password = "hbstudent"; // 1. Just load the Driver: Class.forName("com.mysql.cj.jdbc.Driver"); // 2. Get a connection: Connection conn = DriverManager.getConnection(url, username, password); // 3. Create a statement: Statement myStmt = conn.createStatement(); String UPDATE_SQL = "update employee " + "set first_name = 'Steven', last_name = 'Smith' " + "WHERE id = 4"; myStmt.executeUpdate(UPDATE_SQL); System.out.println("Update Completed!"); } }
7cc7e900b73f504f37fc21f838c50e94273ed0ed
66e2f35b7b56865552616cf400e3a8f5928d12a2
/src/main/java/com/alipay/api/response/AlipayMarketingToolFengdieTemplateQueryResponse.java
5ee490e76d365611fbab327dc68511de140828c8
[ "Apache-2.0" ]
permissive
xiafaqi/alipay-sdk-java-all
18dc797400847c7ae9901566e910527f5495e497
606cdb8014faa3e9125de7f50cbb81b2db6ee6cc
refs/heads/master
2022-11-25T08:43:11.997961
2020-07-23T02:58:22
2020-07-23T02:58:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
896
java
package com.alipay.api.response; import java.util.List; import com.alipay.api.internal.mapping.ApiField; import com.alipay.api.internal.mapping.ApiListField; import com.alipay.api.domain.FengdieTemplate; import com.alipay.api.AlipayResponse; /** * ALIPAY API: alipay.marketing.tool.fengdie.template.query response. * * @author auto create * @since 1.0, 2019-05-22 14:29:19 */ public class AlipayMarketingToolFengdieTemplateQueryResponse extends AlipayResponse { private static final long serialVersionUID = 6111555665993337712L; /** * 开发者开发上传的H5模板列表 */ @ApiListField("template") @ApiField("fengdie_template") private List<FengdieTemplate> template; public void setTemplate(List<FengdieTemplate> template) { this.template = template; } public List<FengdieTemplate> getTemplate( ) { return this.template; } }
687c859bd655ab80a03025a51d2fefc130969b6d
ece42929894c7ded0a3f15d69ac576db0eb2350c
/mock/src/main/java/no/nav/sbl/dialogarena/sendsoknad/mockmodul/arbeid/ArbeidsforholdMock.java
2e082cb8fbc0256ca249eee45a4509c7f0ac291c
[ "MIT" ]
permissive
navikt/sendsoknad-legacy
4c9378e1c5bd016c0354f11736707d659b49cc73
72eb83954166d861f8e265d09c32e0c18c60a3ee
refs/heads/main
2023-07-09T18:41:15.923873
2021-07-01T09:59:04
2021-07-09T13:35:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,829
java
package no.nav.sbl.dialogarena.sendsoknad.mockmodul.arbeid; import no.nav.sbl.dialogarena.sendsoknad.domain.util.ServiceUtils; import no.nav.tjeneste.virksomhet.arbeidsforhold.v3.binding.ArbeidsforholdV3; import no.nav.tjeneste.virksomhet.arbeidsforhold.v3.informasjon.arbeidsforhold.*; import no.nav.tjeneste.virksomhet.arbeidsforhold.v3.meldinger.FinnArbeidsforholdPrArbeidstakerRequest; import no.nav.tjeneste.virksomhet.arbeidsforhold.v3.meldinger.FinnArbeidsforholdPrArbeidstakerResponse; import no.nav.tjeneste.virksomhet.organisasjon.v4.binding.HentOrganisasjonOrganisasjonIkkeFunnet; import no.nav.tjeneste.virksomhet.organisasjon.v4.binding.HentOrganisasjonUgyldigInput; import no.nav.tjeneste.virksomhet.organisasjon.v4.binding.OrganisasjonV4; import no.nav.tjeneste.virksomhet.organisasjon.v4.informasjon.Organisasjon; import no.nav.tjeneste.virksomhet.organisasjon.v4.informasjon.UstrukturertNavn; import no.nav.tjeneste.virksomhet.organisasjon.v4.informasjon.Virksomhet; import no.nav.tjeneste.virksomhet.organisasjon.v4.meldinger.HentOrganisasjonRequest; import no.nav.tjeneste.virksomhet.organisasjon.v4.meldinger.HentOrganisasjonResponse; import org.mockito.stubbing.Answer; import java.math.BigDecimal; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; public class ArbeidsforholdMock { public ArbeidsforholdV3 arbeidMock() { ArbeidsforholdV3 amock = mock(ArbeidsforholdV3.class); try { when(amock.finnArbeidsforholdPrArbeidstaker(any(FinnArbeidsforholdPrArbeidstakerRequest.class))).then((Answer<FinnArbeidsforholdPrArbeidstakerResponse>) invocationOnMock -> { FinnArbeidsforholdPrArbeidstakerResponse response = new FinnArbeidsforholdPrArbeidstakerResponse(); Arbeidsforhold arbeidsforhold = new Arbeidsforhold(); arbeidsforhold.setAnsettelsesPeriode(hentPeriode()); arbeidsforhold.getArbeidsavtale().add(lagArbeidsavtale()); response.getArbeidsforhold().add(arbeidsforhold); return response; }); } catch (Exception ignored) { } return amock; } private AnsettelsesPeriode hentPeriode() { AnsettelsesPeriode periode = new AnsettelsesPeriode(); Gyldighetsperiode gperiode = new Gyldighetsperiode(); gperiode.setFom(ServiceUtils.stringTilXmldato("2014-01-02")); // gperiode.setTom(ServiceUtils.stringTilXmldato("2015-01-01")); // Denne avgjør om man er ansatt eller ikke for øyeblikket periode.setPeriode(gperiode); return periode; } private Arbeidsavtale lagArbeidsavtale() { Arbeidsavtale avtale = new Arbeidsavtale(); avtale.setStillingsprosent(BigDecimal.valueOf(100)); Avloenningstyper avloenningstyper = new Avloenningstyper(); avloenningstyper.setKodeRef("fast"); avtale.setAvloenningstype(avloenningstyper); return avtale; } public OrganisasjonV4 organisasjonMock() { OrganisasjonV4 mock = mock(OrganisasjonV4.class); try { HentOrganisasjonResponse response = new HentOrganisasjonResponse(); Organisasjon organisasjon = new Virksomhet(); UstrukturertNavn value = new UstrukturertNavn(); value.getNavnelinje().add("Mock navn arbeidsgiver"); organisasjon.setNavn(value); response.setOrganisasjon(organisasjon); when(mock.hentOrganisasjon(any(HentOrganisasjonRequest.class))).thenReturn(response); } catch (HentOrganisasjonOrganisasjonIkkeFunnet | HentOrganisasjonUgyldigInput hentOrganisasjonOrganisasjonIkkeFunnet) { hentOrganisasjonOrganisasjonIkkeFunnet.printStackTrace(); } return mock; } }
54ae08fec184258678c33e238e13d50f515e7e16
fb8e24089e0d30d1a9710aeab254aac0f58d6335
/src/models/Employee.java
db3c689d5e8bbf616148b3c7010ae7dcfe2f009e
[]
no_license
kmhsy/daily_report_system
4c8590f9b82c045d9ce22f58636cc70ad4dc7cf6
b9e9422409ea7c3ecfa814a81e08b7fb4cf965ac
refs/heads/master
2022-12-05T18:01:25.009034
2019-09-21T08:15:17
2019-09-21T08:15:17
209,950,499
0
0
null
2022-11-24T08:18:55
2019-09-21T08:28:55
Java
UTF-8
Java
false
false
2,937
java
package models; import java.sql.Timestamp; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.Table; @Table(name = "employees") @NamedQueries({ @NamedQuery( name = "getAllEmployees", query= "SELECT e FROM Employee AS e ORDER BY e.id DESC" ), @NamedQuery( name = "getEmployeesCount", query = "SELECT COUNT(e) FROM Employee AS e" ), @NamedQuery( name = "checkRegisteredCode", query = "SELECT COUNT(e) FROM Employee AS e WHERE e.code = :code" ), @NamedQuery( name = "checkLoginCodeAndPassword", query = "SELECT e FROM Employee AS e WHERE e.delete_flag = 0 AND e.code = :code AND e.password = :pass" ) }) @Entity public class Employee { @Id @Column(name = "id") @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; @Column(name = "code",nullable = false, unique = true) private String code; @Column(name = "name",nullable =false, unique = false) private String name; @Column(name = "password",length = 64,nullable = false) private String password; @Column(name = "admin_flag",nullable = false) private Integer admin_flag; @Column(name = "created_at",nullable = false) private Timestamp created_at; @Column(name = "updated_at",nullable = false) private Timestamp updated_at; @Column(name = "delete_flag", nullable = false) private Integer delete_flag; public Integer getId() { return id; } public void setId(Integer 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 getPassword() { return password; } public void setPassword(String password) { this.password = password; } public Integer getAdmin_flag() { return admin_flag; } public void setAdmin_flag(Integer admin_flag) { this.admin_flag = admin_flag; } public Timestamp getCreated_at() { return created_at; } public void setCreated_at(Timestamp created_at) { this.created_at = created_at; } public Timestamp getUpdated_at() { return updated_at; } public void setUpdated_at(Timestamp updated_at) { this.updated_at = updated_at; } public Integer getDelete_flag() { return delete_flag; } public void setDelete_flag(Integer delete_flag) { this.delete_flag = delete_flag; } }
da4bf4ed803ecdfd9febcda925b53e34977a9031
5ca6dcc6b79d6be7cfcb0b41992b3567ba5b8beb
/blogPessoal/src/main/java/com/generation/blogPessoal/controller/UsuarioController.java
b9654edcd5e90f481d873285d065dc744c09e331
[]
no_license
richardfujii/12_04_2021_Atividade_Deploy_Swagger
3392b5c0a5605a07f12187f36d55c7176fde6dc7
b189fca05e8128415d86e829053d8064d5161cf1
refs/heads/master
2023-04-08T21:37:05.347771
2021-04-13T01:56:52
2021-04-13T01:56:52
357,393,306
0
0
null
null
null
null
UTF-8
Java
false
false
1,350
java
package com.generation.blogPessoal.controller; import java.util.Optional; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.generation.blogPessoal.model.UserLogin; import com.generation.blogPessoal.model.Usuario; import com.generation.blogPessoal.service.UsuarioService; @RestController @RequestMapping("/usuarios") @CrossOrigin(origins = "*", allowedHeaders = "*") public class UsuarioController { @Autowired private UsuarioService usuarioService; @PostMapping("/logar") public ResponseEntity<UserLogin> Autentication(@RequestBody Optional<UserLogin> user){ return usuarioService.Logar(user).map(resp -> ResponseEntity.ok(resp)) .orElse(ResponseEntity.status(HttpStatus.UNAUTHORIZED).build()); } @PostMapping("/cadastrar") public ResponseEntity<Usuario> Post(@RequestBody Usuario usuario){ return ResponseEntity.status(HttpStatus.CREATED) .body(usuarioService.CadastrarUsuario(usuario)); } }
cd89a1b3a1ff9aafcb44772674bdc152b367f1b8
9d6089379238e00c0a5fb2949c1a6e7c19b50958
/bin/platform/bootstrap/gensrc/de/hybris/platform/advancedsavedquery/enums/AdvancedQueryComparatorEnum.java
1eb0c9ea1a321ea742984840e7b6c064a1e574d0
[]
no_license
ChintalaVenkat/learning_hybris
55ce582b4796a843511d0ea83f4859afea52bd88
6d29f59578512f9fa44a3954dc67d0f0a5216f9b
refs/heads/master
2021-06-18T17:47:12.173132
2021-03-26T11:00:09
2021-03-26T11:00:09
193,689,090
0
0
null
2019-06-25T10:46:40
2019-06-25T10:46:39
null
UTF-8
Java
false
false
2,343
java
/* * * [y] hybris Platform * * Copyright (c) 2000-2011 hybris AG * All rights reserved. * * This software is the confidential and proprietary information of hybris * ("Confidential Information"). You shall not disclose such Confidential * Information and shall use it only in accordance with the terms of the * license agreement you entered into with hybris. * */ package de.hybris.platform.advancedsavedquery.enums; import de.hybris.platform.core.HybrisEnumValue; /** * Generated enum AdvancedQueryComparatorEnum declared at extension advancedsavedquery. */ @SuppressWarnings("PMD") public enum AdvancedQueryComparatorEnum implements HybrisEnumValue { /** * Generated enum value for AdvancedQueryComparatorEnum.equals declared at extension advancedsavedquery. */ EQUALS("equals"), /** * Generated enum value for AdvancedQueryComparatorEnum.contains declared at extension advancedsavedquery. */ CONTAINS("contains"), /** * Generated enum value for AdvancedQueryComparatorEnum.gt declared at extension advancedsavedquery. */ GT("gt"), /** * Generated enum value for AdvancedQueryComparatorEnum.gtandequals declared at extension advancedsavedquery. */ GTANDEQUALS("gtandequals"), /** * Generated enum value for AdvancedQueryComparatorEnum.lt declared at extension advancedsavedquery. */ LT("lt"), /** * Generated enum value for AdvancedQueryComparatorEnum.ltandequals declared at extension advancedsavedquery. */ LTANDEQUALS("ltandequals"), /** * Generated enum value for AdvancedQueryComparatorEnum.startwidth declared at extension advancedsavedquery. */ STARTWIDTH("startwidth"); /**<i>Generated model type code constant.</i>*/ public final static String _TYPECODE = "AdvancedQueryComparatorEnum"; /** The code of this enum.*/ private final String code; /** * Creates a new enum value for this enum type. * * @param code the enum value code */ private AdvancedQueryComparatorEnum(final String code) { this.code = code.intern(); } /** * Gets the code of this enum value. * * @return code of value */ @Override public String getCode() { return this.code; } /** * Gets the type this enum value belongs to. * * @return code of type */ @Override public String getType() { return getClass().getSimpleName(); } }
5ec9c8ecf6fa708eb5b00fdf99da4c87440375e8
97a6e6703c1d80bec21e37922ba837075dc67553
/src/main/java/com/pastore/financas/services/UsuarioService.java
1fb15504bbc4cdaff71f742fd54eea9829bd796e
[]
no_license
thiagopastore86/treino-financas
4e371eaff5dc41a29b88f263399e71b8bca38252
4f9564c0d29f8479db2e3bb0566345e9ad0225fa
refs/heads/master
2023-06-03T16:58:55.015498
2021-06-24T01:10:44
2021-06-24T01:10:44
378,771,243
0
0
null
null
null
null
UTF-8
Java
false
false
259
java
package com.pastore.financas.services; import com.pastore.financas.model.entity.Usuario; public interface UsuarioService { Usuario autenticar (String email, String senha); Usuario salvarUsuario(Usuario usuario); void validarEmail(String email); }
7931b9ac4d5a087ea9dc960460236c1f6afa7a5c
566e95f43c65befeca978ada4fcda558906a9385
/src/main/java/br/com/facec/programacao2/db/InicializacaoBancoDeDados.java
28a3a2e4333176745946575e6b20f9184e4c3178
[]
no_license
emmanuelneri/programacao2
198d20bae0b0a6c1eff67fbe3903ea5b22801414
3fa3434bf962f85f71f8ce90a1f586d8b2168be6
refs/heads/master
2022-09-27T20:08:25.892802
2019-06-08T00:58:18
2019-06-08T00:58:18
185,693,003
0
0
null
2022-09-08T01:00:17
2019-05-08T23:30:57
Java
UTF-8
Java
false
false
1,830
java
package br.com.facec.programacao2.db; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; public class InicializacaoBancoDeDados { public void criarTabelaCliente() { String sql = "create table if not exists cliente(" + "id bigserial primary key," + "nome varchar(40) not null" + ");"; criarTabela(sql); } public void criarTabelaFuncionario() { String sql = "create table if not exists funcionario(" + "id bigserial primary key," + "nome varchar(40) not null" + ");"; criarTabela(sql); } public void criarTabelaAtendimento() { String sql = "create table if not exists atendimento(" + "id bigserial primary key," + "id_cliente bigint not null," + "id_funcionario bigint not null," + "data_hora timestamp not null," + "descricao_problema varchar(100)," + "status varchar(50) not null," + " CONSTRAINT atendimento_id_cliente_fk FOREIGN KEY (id_cliente) REFERENCES cliente(id)," + " CONSTRAINT atendimento_id_funcionario_fk FOREIGN KEY (id_funcionario) REFERENCES funcionario(id)" + ");"; criarTabela(sql); } private void criarTabela(final String sql) { Connection conexao = FabricaDeConexao.criarConexao(); try { PreparedStatement declaracaoPreparada = conexao.prepareStatement(sql); declaracaoPreparada.execute(); declaracaoPreparada.close(); conexao.close(); } catch (SQLException e) { throw new RuntimeException("Erro ao criar tabela", e); } } }
ee27785a9802ebe8c48116b22ac185ef0890599e
0050d5fe2826339c2e765025584712c7bce30c37
/SpringJPA2-2/src/main/java/SpringJPAM2M/Application.java
fd0e5228bdbd0ea90db7530698ad4ddcdcccb571
[]
no_license
baoquoc2203/SpringJPA
44f3f5b114c3cb25c5274a3c1c489a8017afd207
0545d5cdc3c20d36245081b0119890d0a5613b0b
refs/heads/master
2021-03-07T01:14:26.351394
2020-03-10T12:45:25
2020-03-10T12:45:25
246,236,228
0
0
null
null
null
null
UTF-8
Java
false
false
1,392
java
package SpringJPAM2M; import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; import java.util.Arrays; @SpringBootApplication public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } @Bean public CommandLineRunner mappingDemo(StudentRepository studentRepository, CourseRepository courseRepository) { return args -> { // create a student Student student = new Student("John Doe", 15, "8th"); // save the student studentRepository.save(student); // create three courses Course course1 = new Course("Machine Learning", "ML", 12, 1500); Course course2 = new Course("Database Systems", "DS", 8, 800); Course course3 = new Course("Web Basics", "WB", 10, 0); // save courses courseRepository.saveAll(Arrays.asList(course1, course2, course3)); // add courses to the student student.getCourses().addAll(Arrays.asList(course1, course2, course3)); // update the student studentRepository.save(student); }; } }
4d34b59a60b40d50f6871e2873cea262d431e25a
6253283b67c01a0d7395e38aeeea65e06f62504b
/decompile/app/Mms/src/main/java/cn/com/xy/sms/sdk/util/StringUtils.java
28f5b7ff0fa6d5f5c730d11a4549128ef017a5cf
[]
no_license
sufadi/decompile-hw
2e0457a0a7ade103908a6a41757923a791248215
4c3efd95f3e997b44dd4ceec506de6164192eca3
refs/heads/master
2023-03-15T15:56:03.968086
2017-11-08T03:29:10
2017-11-08T03:29:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
12,331
java
package cn.com.xy.sms.sdk.util; import com.google.android.gms.location.places.Place; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.Closeable; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.regex.Pattern; import java.util.zip.GZIPInputStream; import java.util.zip.GZIPOutputStream; import javax.xml.parsers.DocumentBuilderFactory; import org.json.JSONArray; import org.json.JSONException; import org.w3c.dom.Document; /* compiled from: Unknown */ public class StringUtils { public static final String MPLUG86 = "+86"; private static final String a = "0123456789ABCDEF"; private static final String b = "UTF-8"; private static final String c = "+86"; private static final String d = "\\+86"; private static final String e = "0086"; private static final String f = "86"; private static final String g = "17951"; private static final String h = "12593"; public static final String phoneFiled10193 = "10193"; public static final String phoneFiled12520 = "12520"; public static final String phoneFiled17908 = "17908"; public static final String phoneFiled17909 = "17909"; public static final String phoneFiled17911 = "17911"; public static final String phoneFiled179110 = "179110"; public static byte[] MD5(byte[] bArr) { MessageDigest instance; try { instance = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException e) { instance = null; } if (instance == null) { return null; } instance.update(bArr); return instance.digest(); } public static boolean allValuesIsNotNull(String... strArr) { if (strArr == null || strArr.length == 0) { return false; } for (String isNull : strArr) { if (isNull(isNull)) { return false; } } return true; } public static List<String> arryToList(JSONArray jSONArray) { if (jSONArray != null) { try { if (jSONArray.length() > 0) { List<String> arrayList = new ArrayList(); for (int i = 0; i < jSONArray.length(); i++) { arrayList.add(jSONArray.get(i).toString()); } return arrayList; } } catch (JSONException e) { } } return null; } public static String bytesToHexString(byte[] bArr) { int i = 0; if (bArr == null) { return null; } String str = "0123456789abcdef"; char[] cArr = new char[(bArr.length * 2)]; int i2 = 0; while (i2 < bArr.length) { cArr[i] = (char) str.charAt((bArr[i2] >> 4) & 15); i++; cArr[i] = (char) str.charAt(bArr[i2] & 15); i2++; i++; } return String.valueOf(cArr); } public static byte[] compressGZip(byte[] bArr) { byte[] bArr2 = null; try { OutputStream byteArrayOutputStream = new ByteArrayOutputStream(); GZIPOutputStream gZIPOutputStream = new GZIPOutputStream(byteArrayOutputStream); gZIPOutputStream.write(bArr); gZIPOutputStream.finish(); gZIPOutputStream.close(); bArr2 = byteArrayOutputStream.toByteArray(); byteArrayOutputStream.close(); return bArr2; } catch (Throwable th) { return bArr2; } } public static byte[] decodToBytes(String str) { Throwable th; ByteArrayOutputStream byteArrayOutputStream = null; ByteArrayOutputStream byteArrayOutputStream2; try { byteArrayOutputStream2 = new ByteArrayOutputStream(str.length() / 2); int i = 0; while (i < str.length()) { try { byteArrayOutputStream2.write((a.indexOf(str.charAt(i)) << 4) | a.indexOf(str.charAt(i + 1))); i += 2; } catch (Throwable th2) { Throwable th3 = th2; byteArrayOutputStream = byteArrayOutputStream2; th = th3; } } byte[] toByteArray = byteArrayOutputStream2.toByteArray(); try { byteArrayOutputStream2.close(); } catch (IOException e) { } return toByteArray; } catch (Throwable th4) { th = th4; if (byteArrayOutputStream != null) { try { byteArrayOutputStream.close(); } catch (IOException e2) { } } throw th; } } public static String decode(String str) { try { return new String(decodToBytes(str), b); } catch (Throwable th) { return null; } } public static String encode(String str) { try { return encode(str.getBytes(b)); } catch (Throwable th) { return null; } } public static String encode(byte[] bArr) { try { StringBuilder stringBuilder = new StringBuilder(bArr.length << 1); for (int i = 0; i < bArr.length; i++) { stringBuilder.append(a.charAt((bArr[i] & 240) >> 4)); stringBuilder.append(a.charAt(bArr[i] & 15)); } return stringBuilder.toString(); } catch (Exception e) { return null; } } public static String getFileMD5(String str) { try { InputStream fileInputStream = new FileInputStream(str); byte[] bArr = new byte[Place.TYPE_SUBLOCALITY_LEVEL_2]; MessageDigest instance = MessageDigest.getInstance("MD5"); while (true) { int read = fileInputStream.read(bArr); if (read > 0) { instance.update(bArr, 0, read); } else { fileInputStream.close(); return getMD5(instance.digest()); } } } catch (Throwable th) { return null; } } public static long getLongByString(String str) { try { return isNull(str) ? -1 : Long.parseLong(str); } catch (Throwable th) { return -1; } } public static String getMD5(String str) { return getMD5(str.getBytes()); } public static String getMD5(byte[] bArr) { return bytesToHexString(MD5(bArr)); } public static String getNoNullString(String str) { return str != null ? str.trim() : ""; } public static String getPhoneNumberNo86(String str) { if (isNull(str)) { return str; } str = str.replace(" ", "").replace("-", "").replace("(", "").replace(")", ""); return !str.startsWith("+86") ? !str.startsWith(e) ? !str.startsWith(f) ? (str.startsWith(g) && str.length() > 10) ? str.replaceFirst(g, "") : (str.startsWith(h) && str.length() > 10) ? str.replaceFirst(h, "") : (!str.startsWith(phoneFiled12520) || str.length() <= 10) ? str : str.replaceFirst(phoneFiled12520, "") : str.replaceFirst(f, "") : str.replaceFirst(e, "") : str.replaceFirst(d, ""); } public static String getSubString(String str) { return (!isNull(str) && str.length() >= 7) ? str.substring(0, 7) : str; } public static String getTwoDigitType(String str) { return !isNull(str) ? str.length() >= 2 ? str.length() <= 2 ? str : "99" : "0" + str : ""; } public static String getValueByKey(Map<String, String> map, String str) { return (map == null || map.isEmpty() || isNull(str)) ? "" : (String) map.get(str); } public static String handlerAssemble(String str) { try { StringBuffer stringBuffer = new StringBuffer(); for (int i = 0; i < 4; i++) { int i2 = i << 4; stringBuffer.append(decode(str.substring(i2, i2 + 16))); } return stringBuffer.toString(); } catch (Throwable th) { return ""; } } public static boolean isNull(String str) { return str == null || str.trim().length() == 0 || str.trim().equalsIgnoreCase("null"); } public static boolean isNull2(String str) { return str == null || str.trim().length() == 0; } public static boolean isNumber(String str) { if (isNull(str)) { return false; } return Pattern.compile("[0-9]*").matcher(getPhoneNumberNo86(str)).matches(); } public static boolean isPhoneNumber(String str) { return !isNull(str) ? sj(getPhoneNumberNo86(str)) : false; } public static String[] jsonArryToArray(JSONArray jSONArray) { if (jSONArray == null || jSONArray.length() <= 0) { return null; } String[] strArr = new String[jSONArray.length()]; for (int i = 0; i < jSONArray.length(); i++) { try { strArr[i] = jSONArray.getString(i); } catch (JSONException e) { } } return strArr; } public static String replaceBlank(String str) { return !isNull(str) ? str.replaceAll("\\s", "") : null; } public static boolean sj(String str) { if (str == null || str.length() != 11 || "13800138000".equals(str)) { return false; } if (str.startsWith("13") || str.startsWith("14") || str.startsWith("15") || str.startsWith("18") || str.startsWith("17")) { return true; } return false; } public static Document stringConvertXML(String str, String str2) { Closeable byteArrayInputStream; Document parse; Throwable th; Closeable closeable = null; if (isNull(str)) { return closeable; } try { if (str.indexOf("?>") != -1) { str = str.substring(str.indexOf("?>") + 2); } StringBuilder stringBuilder = new StringBuilder(str2); stringBuilder.append(str); DocumentBuilderFactory newInstance = DocumentBuilderFactory.newInstance(); byteArrayInputStream = new ByteArrayInputStream(stringBuilder.toString().getBytes("utf-8")); try { parse = newInstance.newDocumentBuilder().parse(byteArrayInputStream); f.a(byteArrayInputStream); } catch (Throwable th2) { Throwable th3 = th2; closeable = byteArrayInputStream; th = th3; f.a(closeable); throw th; } } catch (Throwable th4) { th = th4; f.a(closeable); throw th; } return parse; } public static String trim(String str) { return (str == null || str.length() == 0) ? "" : str.trim().replace("\r", "").replace("\n", "").replace("\t", ""); } public static byte[] uncompressGZip(byte[] bArr) { InputStream byteArrayInputStream = new ByteArrayInputStream(bArr); GZIPInputStream gZIPInputStream = new GZIPInputStream(byteArrayInputStream); byte[] bArr2 = new byte[Place.TYPE_SUBLOCALITY_LEVEL_2]; ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); while (true) { int read = gZIPInputStream.read(bArr2, 0, Place.TYPE_SUBLOCALITY_LEVEL_2); if (read != -1) { byteArrayOutputStream.write(bArr2, 0, read); } else { bArr2 = byteArrayOutputStream.toByteArray(); byteArrayOutputStream.flush(); byteArrayOutputStream.close(); gZIPInputStream.close(); byteArrayInputStream.close(); return bArr2; } } } }
03340bb2cdc5e4e33a2192ae8e8fdcd6f786dbff
e7e9570e0dfe929f15b6207c7864f833468dca3d
/src/main/java/network/messages/toclient/PingToClient.java
5f7369e32d0a05bcae66c21f11f34de35abae347
[]
no_license
dario-passarello/santorini
5f35559b5da633d851fd9c798a1e914b82dec4b7
7146aaae0febc732ceacf835a1968c48675f3dfa
refs/heads/master
2022-11-27T15:59:13.753956
2020-07-03T00:21:37
2020-07-03T00:21:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
447
java
package network.messages.toclient; import network.messages.Message; import view.screens.Screen; import java.util.logging.Level; /** * A ping message to check if the client connection is still alive */ public class PingToClient implements Message<Screen> { @Override public void execute(Screen target) { //Do nothing, it's only a ping } @Override public Level getLoggerLever(){ return Level.FINE; } }
96999089357e2629417c853ad280a29c90572f67
0c052819af6f64fa9cb9238fc83bcdc02e1df472
/CDM/src/main/java/com/oszimt/cdm/Main.java
697aca20772c98c06b432ff1b6ccff80616dbdf4
[]
no_license
jhuettel/CDM
475481c95ee545ebac7d3dab51157a3e4ba4b7a4
c5aaddb6dcc86f7fc3acc24cc98a2f43626e01aa
refs/heads/master
2022-07-10T04:50:39.172762
2019-06-04T20:40:41
2019-06-04T20:40:41
190,268,445
0
0
null
2022-06-21T01:13:42
2019-06-04T19:43:20
Java
UTF-8
Java
false
false
385
java
package com.oszimt.cdm; import com.oszimt.cdm.business.BusinessSort; import com.oszimt.cdm.data.XMLData; import com.oszimt.cdm.view.Gui; public class Main { @SuppressWarnings("unused") public static void main(String[] args) { // Tui tui = new Tui(new BusinessSort(new XMLModifier())); Gui gui = new Gui(new BusinessSort(new XMLData())); } }
34b58e87ce53125677e8276a2489d676438381d9
fd121e69b8df3725ad912fe5163140b803e5aaaf
/src/main/java/indi/kevin/selfLearn1/common/Reflect/Loaders.java
a3c3eba05b0508bde5af2a4ac13e516895ec10c9
[]
no_license
kevhxr/selfLearn1
be52cae7d76718ccb38bcdf8a08aaee366b462e0
6c95fca11ca5d59764f5f69e28f96376e524e0c4
refs/heads/master
2022-12-22T03:29:39.539220
2020-02-09T14:36:35
2020-02-09T14:36:35
136,690,245
0
0
null
2022-12-10T02:34:35
2018-06-09T04:20:42
Java
UTF-8
Java
false
false
1,672
java
package indi.kevin.selfLearn1.common.Reflect; import java.io.*; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Iterator; import java.util.Properties; public class Loaders { public static void main(String[] args) throws IOException, ClassNotFoundException, IllegalAccessException, InstantiationException, InvocationTargetException { /*ClassLoader c = Loaders.class.getClassLoader(); while(c!=null){ System.out.println(c.getClass().getName()); c = c.getParent(); }*/ Properties prop = new Properties(); String className = null,propKey; BufferedReader bR = new BufferedReader(new InputStreamReader(new FileInputStream("src/main/WEB-INF/className.properties"))); prop.load(bR); Iterator<String> iterator = prop.stringPropertyNames().iterator(); while(iterator.hasNext()){ propKey = iterator.next(); className = prop.get(propKey).toString(); System.out.println(className); } Class c = Class.forName(className); Object o = c.newInstance(); Method[] methods = c.getMethods(); for(Method m : methods){ System.out.println(m.getName()); if(m.getName().equals("getName")){ m.invoke(o,"kevin"); } } /* String readLine; while((readLine = bR.readLine())!=null){ System.out.println(readLine); }*/ } } class T{ public T(){ } public String getName(String name){ System.out.println("hello"+name); return "hello"+name; } }
d8faa1ea4d17db683ee48d3088ff2ad6758a4b6d
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/25/25_80a6818f01eb55afc35550da158ae7a585d0f883/CLIReportingUtils/25_80a6818f01eb55afc35550da158ae7a585d0f883_CLIReportingUtils_t.java
674e83a0899acbc3dda806f88eb731d67d1740e9
[]
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
16,932
java
package org.apache.maven.cli; import org.apache.maven.embedder.MavenEmbedderConsoleLogger; import org.apache.maven.embedder.MavenEmbedderLogger; import org.apache.maven.errors.CoreErrorReporter; import org.apache.maven.errors.DefaultCoreErrorReporter; import org.apache.maven.execution.MavenExecutionRequest; import org.apache.maven.execution.MavenExecutionResult; import org.apache.maven.execution.ReactorManager; import org.apache.maven.lifecycle.LifecycleExecutionException; import org.apache.maven.project.MavenProject; import org.apache.maven.project.ProjectBuildingException; import org.apache.maven.reactor.MavenExecutionException; import org.codehaus.plexus.util.Os; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.StringWriter; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Iterator; import java.util.Properties; import java.util.TimeZone; /** * Utility class used to report errors, statistics, application version info, etc. * * @author jdcasey * */ public final class CLIReportingUtils { public static final long MB = 1024 * 1024; public static final int MS_PER_SEC = 1000; public static final int SEC_PER_MIN = 60; private static final String NEWLINE = System.getProperty( "line.separator" ); private CLIReportingUtils() { } static void showVersion() { InputStream resourceAsStream; try { Properties properties = new Properties(); resourceAsStream = MavenCli.class.getClassLoader() .getResourceAsStream( "META-INF/maven/org.apache.maven/maven-core/pom.properties" ); if ( resourceAsStream != null ) { properties.load( resourceAsStream ); if ( properties.getProperty( "builtOn" ) != null ) { System.out.println( "Maven version: " + properties.getProperty( "version", "unknown" ) + " built on " + properties.getProperty( "builtOn" ) ); } else { System.out.println( "Maven version: " + properties.getProperty( "version", "unknown" ) ); } } else { System.out.println( "Maven version: unknown" ); } System.out.println( "Java version: " + System.getProperty( "java.version", "<unknown java version>" ) ); //TODO: when plexus can return the family type, add that here because it will make it easier to know what profile activation settings to use. System.out.println( "OS name: \"" + Os.OS_NAME + "\" version: \"" + Os.OS_VERSION + "\" arch: \"" + Os.OS_ARCH + "\"" ); } catch ( IOException e ) { System.err.println( "Unable determine version from JAR file: " + e.getMessage() ); } } /** * Logs result of the executed build. * @param request - build parameters * @param result - result of build * @param logger - the logger to use */ public static void logResult( MavenExecutionRequest request, MavenExecutionResult result, MavenEmbedderLogger logger ) { ReactorManager reactorManager = result.getReactorManager(); logReactorSummary( reactorManager, logger ); boolean printSuccess = true; if ( result.hasExceptions() ) { for ( Iterator i = result.getExceptions().iterator(); i.hasNext(); ) { Exception e = (Exception) i.next(); showError( e, request.isShowErrors(), request.getErrorReporter(), logger ); } line( logger ); if ( !request.isShowErrors() ) { logger.info( "For more information, run with the -e flag" ); line( logger ); } if ( ( reactorManager != null ) && !ReactorManager.FAIL_NEVER.equals( reactorManager.getFailureBehavior() ) ) { logger.info( "BUILD FAILED" ); line( logger ); stats( request.getStartTime(), logger ); line( logger ); printSuccess = false; } else { logger.info( " + Ignoring build failures" ); } } if ( printSuccess ) { line( logger ); logger.info( "BUILD SUCCESSFUL" ); line( logger ); stats( request.getStartTime(), logger ); line( logger ); } logger.close(); } static void showError( String message, Exception e, boolean showErrors ) { MavenEmbedderLogger logger = new MavenEmbedderConsoleLogger(); showError( message, e, showErrors, new DefaultCoreErrorReporter(), logger ); if ( !showErrors ) { logger.info( "For more information, run with the -e flag" ); } } private static void showError( Exception e, boolean show, CoreErrorReporter reporter, MavenEmbedderLogger logger ) { showError( null, e, show, reporter, logger ); } /** * Format the exception and output it through the logger. * @param message - error message * @param e - exception that was thrown * @param showStackTraces * @param logger */ //mkleint: public because used in netbeans integration public static void showError( String message, Exception e, boolean showStackTraces, CoreErrorReporter reporter, MavenEmbedderLogger logger ) { StringWriter writer = new StringWriter(); writer.write( NEWLINE ); if ( message != null ) { writer.write( message ); writer.write( NEWLINE ); } buildErrorMessage( e, showStackTraces, reporter, writer ); writer.write( NEWLINE ); if ( showStackTraces ) { writer.write( "Error stacktrace:" ); writer.write( NEWLINE ); e.printStackTrace( new PrintWriter( writer ) ); } logger.error( writer.toString() ); } public static void buildErrorMessage( Exception e, boolean showStackTraces, CoreErrorReporter reporter, StringWriter writer ) { if ( reporter != null ) { Throwable reported = reporter.findReportedException( e ); if ( reported != null ) { writer.write( reporter.getFormattedMessage( reported ) ); if ( showStackTraces ) { writer.write( NEWLINE ); writer.write( NEWLINE ); Throwable cause = reporter.getRealCause( reported ); if ( cause != null ) { cause.printStackTrace( new PrintWriter( writer ) ); } } writer.write( NEWLINE ); writer.write( NEWLINE ); return; } } boolean handled = false; if ( e instanceof ProjectBuildingException ) { handled = handleProjectBuildingException( (ProjectBuildingException) e, showStackTraces, writer ); } else if ( e instanceof LifecycleExecutionException ) { handled = handleLifecycleExecutionException( (LifecycleExecutionException) e, showStackTraces, writer ); } else if ( e instanceof MavenExecutionException ) { handled = handleMavenExecutionException( (MavenExecutionException) e, showStackTraces, writer ); } if ( !handled ) { handleGenericException( e, showStackTraces, writer ); } } private static boolean handleMavenExecutionException( MavenExecutionException e, boolean showStackTraces, StringWriter writer ) { handleGenericException( e, showStackTraces, writer ); if ( e.getPomFile() != null ) { writer.write( NEWLINE ); writer.write( NEWLINE ); writer.write( "POM File: " ); writer.write( e.getPomFile().getAbsolutePath() ); writer.write( NEWLINE ); writer.write( NEWLINE ); } return true; } private static void handleGenericException( Throwable exception, boolean showStackTraces, StringWriter writer ) { writer.write( exception.getMessage() ); writer.write( NEWLINE ); } private static boolean handleLifecycleExecutionException( LifecycleExecutionException e, boolean showStackTraces, StringWriter writer ) { handleGenericException( e, showStackTraces, writer ); MavenProject project = e.getProject(); writer.write( NEWLINE ); writer.write( "While building project with id: " ); writer.write( project.getId() ); writer.write( NEWLINE ); if ( project.getFile() != null ) { writer.write( "Project File: " ); writer.write( project.getFile().getAbsolutePath() ); } writer.write( NEWLINE ); return true; } private static boolean handleProjectBuildingException( ProjectBuildingException e, boolean showStackTraces, StringWriter writer ) { handleGenericException( e, showStackTraces, writer ); writer.write( NEWLINE ); writer.write( "Failing project's id: " ); writer.write( e.getProjectId() ); writer.write( NEWLINE ); if ( e.getPomFile() == null ) { writer.write( "Source: Super POM (implied root ancestor of all Maven POMs)" ); } else { writer.write( "Project File: " ); writer.write( e.getPomFile().getAbsolutePath() ); } writer.write( NEWLINE ); return true; } private static void logReactorSummary( ReactorManager rm, MavenEmbedderLogger logger ) { if ( ( rm != null ) && rm.hasMultipleProjects() && rm.executedMultipleProjects() ) { logger.info( "" ); logger.info( "" ); // ------------------------- // Reactor Summary: // ------------------------- // o project-name...........FAILED // o project2-name..........SKIPPED (dependency build failed or was skipped) // o project-3-name.........SUCCESS line( logger ); logger.info( "Reactor Summary:" ); line( logger ); for ( Iterator it = rm.getSortedProjects().iterator(); it.hasNext(); ) { MavenProject project = (MavenProject) it.next(); if ( rm.hasBuildFailure( project ) ) { logReactorSummaryLine( project.getName(), "FAILED", rm.getBuildFailure( project ).getTime(), logger ); } else if ( rm.isBlackListed( project ) ) { logReactorSummaryLine( project.getName(), "SKIPPED (dependency build failed or was skipped)", logger ); } else if ( rm.hasBuildSuccess( project ) ) { logReactorSummaryLine( project.getName(), "SUCCESS", rm.getBuildSuccess( project ).getTime(), logger ); } else { logReactorSummaryLine( project.getName(), "NOT BUILT", logger ); } } line( logger ); } } private static void stats( Date start, MavenEmbedderLogger logger ) { Date finish = new Date(); long time = finish.getTime() - start.getTime(); logger.info( "Total time: " + formatTime( time ) ); logger.info( "Finished at: " + finish ); //noinspection CallToSystemGC System.gc(); Runtime r = Runtime.getRuntime(); logger.info( "Final Memory: " + ( r.totalMemory() - r.freeMemory() ) / MB + "M/" + r.totalMemory() / MB + "M" ); } private static void line( MavenEmbedderLogger logger ) { logger.info( "------------------------------------------------------------------------" ); } private static String formatTime( long ms ) { long secs = ms / MS_PER_SEC; long min = secs / SEC_PER_MIN; secs = secs % SEC_PER_MIN; String msg = ""; if ( min > 1 ) { msg = min + " minutes "; } else if ( min == 1 ) { msg = "1 minute "; } if ( secs > 1 ) { msg += secs + " seconds"; } else if ( secs == 1 ) { msg += "1 second"; } else if ( min == 0 ) { msg += "< 1 second"; } return msg; } private static void logReactorSummaryLine( String name, String status, MavenEmbedderLogger logger ) { logReactorSummaryLine( name, status, -1, logger ); } private static void logReactorSummaryLine( String name, String status, long time, MavenEmbedderLogger logger ) { StringBuffer messageBuffer = new StringBuffer(); messageBuffer.append( name ); int dotCount = 54; dotCount -= name.length(); messageBuffer.append( " " ); for ( int i = 0; i < dotCount; i++ ) { messageBuffer.append( '.' ); } messageBuffer.append( " " ); messageBuffer.append( status ); if ( time >= 0 ) { messageBuffer.append( " [" ); messageBuffer.append( getFormattedTime( time ) ); messageBuffer.append( "]" ); } logger.info( messageBuffer.toString() ); } private static String getFormattedTime( long time ) { String pattern = "s.SSS's'"; if ( time / 60000L > 0 ) { pattern = "m:s" + pattern; if ( time / 3600000L > 0 ) { pattern = "H:m" + pattern; } } DateFormat fmt = new SimpleDateFormat( pattern ); fmt.setTimeZone( TimeZone.getTimeZone( "UTC" ) ); return fmt.format( new Date( time ) ); } }
6635c73321c83c3c544562fe3219a5ac53439441
566209f13704f33c4ecd59de90af4a75aa6895da
/src/main/java/gestion/stage/entites/Filiere.java
ec0d38ac7916faac6d7864587f56174663ac84a5
[]
no_license
wattfarnas97/PfaProject
c5fa82f8bb28f150939b156944a0e4be0f5026fe
3bbb367a579eac4170d536f13e28189c50386bc5
refs/heads/master
2020-06-16T00:37:52.531709
2019-07-05T15:41:30
2019-07-05T15:41:30
195,433,158
0
0
null
null
null
null
UTF-8
Java
false
false
657
java
package gestion.stage.entites; import java.io.Serializable; import java.util.Collection; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.OneToMany; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @Entity @Data @AllArgsConstructor @NoArgsConstructor public class Filiere implements Serializable { @Id@GeneratedValue(strategy=GenerationType.IDENTITY) private Integer id; @Column(unique=true) private String libelle; }
6c8753bf9612491fb0585937d7999b9431fc6ac9
024478364ab2ab74f627cbdc6ea5627d32f78e75
/src/main/java/com/example/realproperty/dao/UserDao.java
b371d3df6386e0202e5122999f39724927ff87f7
[]
no_license
viettdd00692/realproperty
7c85410d608661a3f339edd8d95c446dfab851cd
835aef7be64855183ec5185e5a5dfbe445cffc23
refs/heads/master
2023-07-21T19:43:31.574179
2020-07-03T14:16:32
2020-07-03T14:16:32
270,377,918
0
0
null
2023-07-13T06:54:09
2020-06-07T17:18:41
JavaScript
UTF-8
Java
false
false
173
java
package com.example.realproperty.dao; import com.example.realproperty.entity.UserAccount; public interface UserDao { UserAccount getUserByUsername(String username); }
f65ded58ac919eb43934d3cf83bee9aedacfc1b1
e910f472558d69c1b93a169d7ae1045c19ccad03
/src/FirstExercise/Problem0118.java
396fcdf6b6aec39fa70e61434039716698ab7e5a
[]
no_license
njuselw/AdvancedAlgorithm
c2f899b265c7db1b22fa44c2e42052c18b0590e1
845e9446cadfa2572efe0ec6dec96b00e3e51fb0
refs/heads/master
2023-04-01T19:49:59.456890
2021-04-09T06:26:52
2021-04-09T06:26:52
327,781,385
21
3
null
null
null
null
UTF-8
Java
false
false
1,683
java
package FirstExercise; import java.util.Scanner; public class Problem0118 { /* Description 实现计数排序,通过多次遍历数组,统计比每一个元素小的其它元素个数,根据该统计量对数据进行排序。 Input 输入的每一行表示一个元素为正整数的数组,所有值用空格隔开,第一个值为数值长度,其余为数组元素值。 Output 输出的每一行为排序结果,用空格隔开,末尾不要空格。 */ //计数排序 public static void countSort(int[] nums) { int max = nums[0], min = nums[0]; for (int i = 1; i < nums.length; i++) { //求数组最大最小值 max = Math.max(max, nums[i]); min = Math.min(min, nums[i]); } int[] cnt = new int[max - min + 1]; //数组取值范围为 min ~ max for (int i = 0; i < nums.length; i++) { cnt[nums[i] - min]++; //求得每个取值的个数 } int index = 0; for (int i = 0; i < cnt.length; i++) { for (int j = 0; j < cnt[i]; j++) { nums[index++] = min + i; } } } public static void main(String[] args) { Scanner scanner = new Scanner(System.in); while (scanner.hasNext()) { int N = scanner.nextInt(); int[] nums = new int[N]; for (int i = 0; i < N; i++) { nums[i] = scanner.nextInt(); } countSort(nums); for (int i = 0; i < N - 1; i++) { System.out.print(nums[i] + " "); } System.out.println(nums[N - 1]); } } }
77b0226c703412c31a4d86733aa01ed5beea894e
b6625c64b02f73c753a100a1215e6009b39bedeb
/src/main/java/me/gravitinos/minigame/gamecore/util/NeuralNetwork/Layers/Dense/DenseLayer.java
f42bd22f1bc4219dea6422cf3eba0e54feab6d93
[]
no_license
mattlack15/GBedWars
d088f2d4818fb3b55f00db09f9063a1301493555
8f8beb7998398603bb34ef5f74c9e88c36a6d166
refs/heads/master
2022-04-20T23:54:04.998731
2020-04-17T16:57:39
2020-04-17T16:57:39
240,989,054
1
0
null
null
null
null
UTF-8
Java
false
false
3,398
java
package me.gravitinos.minigame.gamecore.util.NeuralNetwork.Layers.Dense; import me.gravitinos.minigame.gamecore.util.NeuralNetwork.Layers.Layer; import me.gravitinos.minigame.gamecore.util.NeuralNetwork.Resources.ActivationFunction; import me.gravitinos.minigame.gamecore.util.NeuralNetwork.Resources.Matrix; import java.util.ArrayList; import java.util.Random; public class DenseLayer extends Layer { private ArrayList<Node> nodes = new ArrayList<>(); private ArrayList<Node> sources = new ArrayList<>(); private boolean inputLayer = true; private Matrix latestInput = new Matrix(1,1); private boolean regularizationL2; private int inputSize; private ActivationFunction activationFunction; //Constructors public DenseLayer(int nodes, int inputs, ActivationFunction acfunc, boolean regularizationL2, Random rand) { this.inputSize = inputs; this.regularizationL2 = regularizationL2; this.activationFunction = acfunc; for(int i = 0; i < nodes; i++) { Node node = new Node(inputs, acfunc, rand); node.setRegularizationL2(regularizationL2); this.nodes.add(node); } } // @Override public ArrayList<Matrix> feedForward(ArrayList<Matrix> input) { Matrix in = input.get(0); this.latestInput = in; Matrix out = new Matrix(this.nodes.size(), 1); for(int i = 0; i < nodes.size(); i++) { nodes.get(i).updateState(in); out.set(i, 0, nodes.get(i).getState()); } ArrayList<Matrix> o = new ArrayList<>(); o.add(out); return o; } public ArrayList<Node> getNodes(){ return this.nodes; } public DenseLayer setDropOut(double prob) { for(Node nodes : this.nodes) { nodes.setDropOutProbability(prob); } return this; } @Override public ArrayList<Matrix> propBack(ArrayList<Matrix> inputDer) { Matrix der = inputDer.get(0); Matrix outDers = new Matrix((sources.size() != 0 ? sources.size() : 1), 1); for(int i = 0; i < der.rowCount(); i++) { double nodeDer = der.get(i, 0); Matrix newDer = this.nodes.get(i).propBack(nodeDer); if(!this.inputLayer) { // System.out.println(newDer); } outDers.add(newDer); } if(!this.inputLayer) { // System.out.println("Equals: " + outDers); } if(this.inputLayer) { // System.out.println("Weights first nodes: "); for(Node nodes : this.nodes) { // System.out.println("--"); // System.out.println(nodes.getWeights()); } } ArrayList<Matrix> outDersContainer = new ArrayList<>(); outDersContainer.add(outDers); return outDersContainer; } @Override public void updateParams() { //System.out.println("Updatein Layer -> Layer size: " + this.nodes.size()); if(this.inputLayer) { // System.out.println("updating input layer"); } nodes.forEach(n -> n.updateParams(this.getLearningRate())); } @Override public void setup(Layer prevLayer) { if(!(prevLayer instanceof DenseLayer)) { return; } this.inputLayer = false; this.sources = ((DenseLayer)prevLayer).getNodes(); for(Node nodes : this.nodes) { nodes.setup(this.sources.size(), this.activationFunction); } } @Override public int getNumLearnableParams() { return this.nodes.size() * this.getInputSize() + this.getInputSize(); } public int getInputSize() { return inputSize; } @Override public ArrayList<Matrix> getDimensions() { ArrayList<Matrix> out = new ArrayList<>(); out.add(new Matrix(this.inputSize, 1)); return out; } }
f8a458b08841eb05fb190cb1a6543137469eec34
dab443f708bb3b495439f9178d8bdf89e3aa93c2
/engine-api/src/main/java/org/lex/perf/engine/EngineFactory.java
29903150475085ed983d499fbf59f978fe364162
[ "Apache-2.0" ]
permissive
lexas2509/perf
f4993d1b801219aec2ba794a3c76f71c4236786b
08e322d9a2adff564a241c7a77a08258abf86c6f
refs/heads/master
2021-01-16T00:28:01.563419
2015-05-17T09:38:54
2015-05-17T09:38:54
17,107,322
0
0
null
null
null
null
UTF-8
Java
false
false
791
java
package org.lex.perf.engine; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Created by Алексей on 29.03.2015. */ public class EngineFactory { private final static Logger LOGGER = LoggerFactory.getLogger(EngineFactory.class); private static Engine engineImpl; private static void initFactory() { Class cl; try { cl = EngineFactory.class.getClassLoader().loadClass("org.lex.perf.engine.EngineImpl"); engineImpl = (Engine) cl.newInstance(); } catch (Exception e) { LOGGER.error("Can't instantiate IndexFactory", e); throw new RuntimeException(e); } } static { initFactory(); } public static Engine getEngine() { return engineImpl; } }
cb11374f69f6de2e94194eea72b7f96540508bcc
82ac6502313f833d55ff926b70b12cac35495ab6
/assessments/accumulator_pattern/assessment/test/ProfileTestSuite.java
ca3dbf9e8f2226b4e18118d0398999b9b4727f37
[]
no_license
jessepye/java-drills
6b01710242816b349a1b4ff6890822b2dc502be1
877a2af5653f50972c67c8e2d4d27c24d49cd200
refs/heads/master
2023-04-19T13:44:27.405861
2021-04-28T22:12:36
2021-04-28T22:12:36
362,586,791
0
0
null
null
null
null
UTF-8
Java
false
false
384
java
import com.galvanize.NumberListUtilTest; import org.junit.runner.RunWith; import org.junit.runners.Suite; @RunWith(Suite.class) @Suite.SuiteClasses( { NumberListUtilAssessment.class, StringUtilAssessment.class, HospitalAssessment.class, CashRegisterAssessment.class }) public class ProfileTestSuite { }
26f9453208f74c9c9341798e43a6f9da9a88fef9
0af8b92686a58eb0b64e319b22411432aca7a8f3
/single-large-project/src/test/java/org/gradle/test/performancenull_262/Testnull_26120.java
ace319bb1105830238dbcf35e119e05ba88bd45c
[]
no_license
gradle/performance-comparisons
b0d38db37c326e0ce271abebdb3c91769b860799
e53dc7182fafcf9fedf07920cbbea8b40ee4eef4
refs/heads/master
2023-08-14T19:24:39.164276
2022-11-24T05:18:33
2022-11-24T05:18:33
80,121,268
17
15
null
2022-09-30T08:04:35
2017-01-26T14:25:33
null
UTF-8
Java
false
false
308
java
package org.gradle.test.performancenull_262; import static org.junit.Assert.*; public class Testnull_26120 { private final Productionnull_26120 production = new Productionnull_26120("value"); @org.junit.Test public void test() { assertEquals(production.getProperty(), "value"); } }
d746f4d0b345a2eca5a86c107f384248d7c9d3d1
86fa67369e29c0086601fad2d5502322f539a321
/runtime/doovos/sites/sousse/sys/tmp/jjit/src/jjit/local/jnt/Bench/Applet/init__V_44AFC1AA/init_071.java
5819700fdbe3261185de123cccff75b059ac26cd
[]
no_license
thevpc/doovos
05a4ce98825bf3dbbdc7972c43cd15fc18afdabb
1ae822549a3a546381dbf3b722814e0be1002b11
refs/heads/master
2021-01-12T14:56:52.283641
2020-08-22T12:37:40
2020-08-22T12:37:40
72,081,680
1
0
null
null
null
null
UTF-8
Java
false
false
3,198
java
package jjit.local.jnt.Bench.Applet.init__V_44AFC1AA; import org.doovos.kernel.api.jvm.interpreter.*; import org.doovos.kernel.api.jvm.interpreter.KFrame; import org.doovos.kernel.api.jvm.reflect.KClass; import org.doovos.kernel.api.jvm.reflect.KClassRepository; import org.doovos.kernel.api.jvm.reflect.KField; import org.doovos.kernel.api.memory.*; import org.doovos.kernel.api.memory.KMemoryManager; import org.doovos.kernel.api.memory.KRegister; import org.doovos.kernel.api.process.KLocalThread; import org.doovos.kernel.api.process.KProcess; import org.doovos.kernel.vanilla.jvm.interpreter.jjit.instr.*; import org.doovos.kernel.vanilla.jvm.interpreter.jjit.instr.JJITInstruction; /** * jnt.Bench.Applet * init()V * [count=4] [191] ALOAD(0) [192] GETFIELD(jnt.Bench.Applet,table,Ljava/awt/List;) [193] ALOAD(7) [194] INVOKEVIRTUAL(java.awt.Component,setBackground(Ljava/awt/Color;)V) */ public final class init_071 extends JJITAbstractInstruction implements Cloneable{ private KField c_table = null; private KClassRepository c_repo; private KClass c_CApplet = null; private KMemoryManager c_memman; public JJITInstruction run(KFrame frame) throws Exception { // **REMOVED Unused Var** KRegister s0; // **REMOVED Unused Var** KRegister s1; // **REMOVED Unused Var** KReference s0_ref; KRegister[] regs = null; KLocalThread thread = frame.getThread(); KReference ref; // **REMOVED Unused Var** KFrame nextFrame = null; // this_ref 0 ; r=1/w=0 : NotCached // local_7 7 ; r=1/w=0 : NotCached // *********[191] ALOAD(0) // **REMOVED Substitution** s0 = frame.getLocal(0); // *********[192] GETFIELD(jnt.Bench.Applet,table,Ljava/awt/List;) // **REMOVED Substitution** s0_ref = c_table.getInstanceRef(((KReference)frame.getLocal(0))); // *********[193] ALOAD(7) // **REMOVED Substitution** s1 = frame.getLocal(7); // *********[194] INVOKEVIRTUAL(java.awt.Component,setBackground(Ljava/awt/Color;)V) regs = new KRegister[2]; regs[1] = frame.getLocal(7); ref = c_table.getInstanceRef(((KReference)frame.getLocal(0))); regs[0] = ref; frame.setProgramCounter(71); // **REMOVED Substitution** nextFrame = thread.pushFrame(c_memman.getKClass(ref).getVirtualMethodBySignature("setBackground(Ljava/awt/Color;)V"),regs); return ((JJITInstruction)thread.pushFrame(c_memman.getKClass(ref).getVirtualMethodBySignature("setBackground(Ljava/awt/Color;)V"),regs).getCurrentInstruction()); } public void init(int index,JJITInstruction[] instructions,KRegister[] constants,KProcess process) throws Exception { // *********[191] ALOAD(0) // *********[192] GETFIELD(jnt.Bench.Applet,table,Ljava/awt/List;) c_repo = process.getClassRepository(); c_CApplet = c_repo.getClassByName("jnt.Bench.Applet"); c_table = c_CApplet.getField("table",true); // *********[193] ALOAD(7) // *********[194] INVOKEVIRTUAL(java.awt.Component,setBackground(Ljava/awt/Color;)V) c_memman = process.getMemoryManager(); } }
74c221cb5dc50c237bb5d0da12f69afc078c709a
b090a52c6c9af9be030c199c4a2d3259cf9778d0
/src/main/java/it/polimi/ProgettoIngSW2019/model/SpawningPoint.java
be359b8d03b4aa5c081e09a105cc1bf8b3c82b7f
[]
no_license
nicholasmagatti/ing-sw-2019-Iovine-LoBue-Magatti
798e38191f32076f400c6a5dabb28f3a8ea9cfde
17ffe1d3ec6677812c4be445109ed322c249541e
refs/heads/master
2022-06-07T20:03:29.474359
2020-04-14T10:17:46
2020-04-14T10:17:46
176,560,163
0
0
null
2022-05-20T21:14:34
2019-03-19T16:57:43
Java
UTF-8
Java
false
false
2,447
java
package it.polimi.ProgettoIngSW2019.model; import it.polimi.ProgettoIngSW2019.common.enums.SquareType; import java.util.ArrayList; import java.util.List; /** * Class SpawningPoint extends Square * * @Author: Luca Iovine */ public class SpawningPoint extends Square { private final static int MAX_CARD = 3; private List<WeaponCard> weaponCards; WeaponCard weapon; /** * Constructor * * @param idRoom identify the room of appartenance * @param isBlockedAtWest identify if there is a wall at its left * @param isBlockedAtEast identify if there is a wall at its right * @param isBlockedAtNorth identify if there is a wall at its up * @param isBlockedAtSouth identify if there is a wall at its down * @Author: Luca Iovine */ public SpawningPoint(int idRoom, Boolean isBlockedAtNorth, Boolean isBlockedAtEast, Boolean isBlockedAtSouth, Boolean isBlockedAtWest) { super(idRoom, isBlockedAtNorth, isBlockedAtEast, isBlockedAtSouth, isBlockedAtWest); weaponCards = new ArrayList<>(); setSquareType(SquareType.SPAWNING_POINT); } /** * @return the list of wapon on the square * @Author: Luca Iovine */ //NOT TO BE TESTED public List<WeaponCard> getWeaponCards(){ return this.weaponCards; } /** * Pick the Weapon Card chosen by the player and remove it from the table * * @param weaponCardToGrab card to grab * @return weapon card grabbed from the game table by the player * @Author: Luca Iovine */ //NOT TO BE TESTED public void removeWeaponFromSpawnPoint(WeaponCard weaponCardToGrab){ weaponCards.remove(weaponCardToGrab); } /** * At the end of the turn every weapon card missing on the table has to be replaced * * @Author: Luca Iovine */ //NOT TO BE TESTED @Override public void reset(Deck deck){ while(weaponCards.size() != MAX_CARD){ weapon = (WeaponCard) deck.drawCard(); if(weapon != null) weaponCards.add(weapon); } } /** * In case someone wanna grab a new weapon but he alredy has 3 weapon card * * @Author: Luca Iovine */ //TESTED --> ShouldSwapTheTwoCard public void swapWeaponsOnSpawnPoint(WeaponCard cardToGrab, WeaponCard cardToFree){ weaponCards.remove(cardToGrab); weaponCards.add(cardToFree); } }
4c931ae21074b78b71ce11930f0f9280b010d2bc
3d1b735bb66b0c0c6ade1e493fc7a97936172b28
/dubbo-api/src/test/java/com/api/dubboapi/DubboApiApplicationTests.java
6cf8f6014e5a3e542a8aef0f35f04b1859252c70
[]
no_license
shitianxianga/rentalsystem
8535a771dfb04023bcc8d6c083d8ebe084a2bb55
6cc7e065aa406cae7ba2536f3532c61d82203040
refs/heads/master
2022-12-17T14:54:01.290228
2019-08-24T01:34:47
2019-08-24T01:34:47
203,998,727
2
0
null
2022-12-06T00:32:56
2019-08-23T12:56:43
CSS
UTF-8
Java
false
false
344
java
package com.api.dubboapi; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class DubboApiApplicationTests { @Test public void contextLoads() { } }
420d19adc2835ff09b71212485413d36eaf737fa
d2cb1f4f186238ed3075c2748552e9325763a1cb
/methods_all/nonstatic_methods/java_lang_Runtime_maxMemory.java
1ee5244c08241fefcd33a53788332b188be66f14
[]
no_license
Adabot1/data
9e5c64021261bf181b51b4141aab2e2877b9054a
352b77eaebd8efdb4d343b642c71cdbfec35054e
refs/heads/master
2020-05-16T14:22:19.491115
2019-05-25T04:35:00
2019-05-25T04:35:00
183,001,929
4
0
null
null
null
null
UTF-8
Java
false
false
132
java
class java_lang_Runtime_maxMemory{ public static void function() {java.lang.Runtime obj = new java.lang.Runtime();obj.maxMemory();}}
1de0a93fdcf4089fb9093b0c3da6a4939039a083
9955eb321c24721ab58205a9bfb22acdde27292c
/WebService/src/main/java/vn/its/rest/service/BillService.java
cc101e1ded1d8f4792540c562597618e3dd223af
[]
no_license
tuannt39-study/SmartShop
92223267d049d344b2fc659e37c5c82ad144b5a1
29d7e22db77e667742cfd81ce495364b5ec3022b
refs/heads/master
2021-08-24T05:06:47.825314
2017-11-05T08:23:22
2017-11-05T08:23:22
113,534,274
0
0
null
null
null
null
UTF-8
Java
false
false
298
java
package vn.its.rest.service; import java.util.List; import vn.its.rest.model.Bill; public interface BillService { public List<Bill> findAllBill(); public Bill findBillById(long id); public void updateBill(Bill bill); public void deleteBill(long id); public void addBill(Bill bill); }
12ce23a8f93295f7427c63ca7c9f04627f11d8ea
4b0d06526173850f1189a5a4f2fa3ea25697dac7
/src/com/xu/dp/Backpack_01.java
82d0825b8569f02b876ac66e663acabead8324ee
[ "Apache-2.0" ]
permissive
XuDeveloper/AlgorthimLearning
f787ab3263e2ef769ca61715cb156c23c58623f4
dc0223dcf78c652edf0bbc709ada874f0d18ba79
refs/heads/master
2020-03-24T01:05:33.552434
2019-10-20T02:56:57
2019-10-20T02:56:57
142,321,841
0
1
null
null
null
null
UTF-8
Java
false
false
3,139
java
package com.xu.dp; import java.util.Arrays; /** * 01背包问题 */ public class Backpack_01 { /** * * @param n 物品总数 * @param c 总容量 * @param w 每件物品的容量 * @param v 每件物品的价值 * @return 最大价值 */ public int getBest(int n, int c, int[] w, int[] v) { // 动态规划 if (n == 0) { return 0; } int[][] dp = new int[n][c + 1]; for (int i = 0; i < c + 1; i++) { if (w[0] <= i) { dp[0][i] = v[0]; } else { dp[0][i] = 0; } } for (int i = 1; i < n; i++) { for (int j = 0; j < c + 1; j++) { if (w[i] > j) { dp[i][j] = dp[i - 1][j]; } else { dp[i][j] = Math.max(dp[i][j], dp[i - 1][j - w[i]] + v[i]); } } } return dp[n - 1][c]; } private int[][] memo; public int backpack01(int n, int c, int[] w, int[] v) { // 记忆化搜索 memo = new int[n][c + 1]; for (int i = 0; i < n; i++) { for (int j = 0; j < c + 1; j++) { memo[i][j] = -1; } } return bestValue(n, c, w, v, n - 1); } public int bestValue(int n, int c, int[] w, int[] v, int index) { if (index < 0 || c <= 0) { return 0; } if (memo[index][c] != -1) { return memo[index][c]; } int res = bestValue(n, c, w, v, index - 1); if (w[index] <= c) { res = Math.max(res, v[index] + bestValue(n, c - w[index], w, v, index - 1)); } memo[index][c] = res; return res; } public int backpack01_improve1(int n, int c, int[] w, int[] v) { // 空间复杂度优化1:由多行变成两行 if (n == 0) { return 0; } int[][] dp = new int[2][c + 1]; for (int i = 0; i < c + 1; i++) { if (w[0] <= i) { dp[0][i] = v[0]; } else { dp[0][i] = 0; } } for (int i = 1; i < n; i++) { for (int j = 0; j < c + 1; j++) { if (w[i] > j) { dp[i % 2][j] = dp[(i - 1) % 2][j]; } else { dp[i % 2][j] = Math.max(dp[i % 2][j], dp[(i - 1) % 2][j - w[i]] + v[i]); } } } return dp[(n - 1) % 2][c]; } public int backpack01_improve2(int n, int c, int[] w, int[] v) { // 空间复杂度优化2:由多行变成一行 if (n == 0) { return 0; } int[] dp = new int[c + 1]; for (int i = 0; i < c + 1; i++) { if (w[0] <= i) { dp[i] = v[0]; } else { dp[i] = 0; } } for (int i = 1; i < n; i++) { for (int j = c; j >= w[i]; j--) { dp[j] = Math.max(dp[j], v[i] + dp[j - w[i]]); } } return dp[c]; } }
e576e192536962846c76ff30169f3ae2c9c8f623
ffe2c3f34fefbf7d05cdc6d5642fa3a407678196
/core/src/ru/spbstu/icst/lunarrover/screens/LevelList.java
9bf663d07fa58f31fb07e4de44bb825190167c7b
[]
no_license
rmnshv/LunarRover
43809301ed9f9542119ca4e338a567ee25bf800c
29d9accda82500b65237a544f44ebb10caa41259
refs/heads/master
2022-09-16T04:27:30.134839
2020-05-14T17:14:06
2020-05-14T17:14:06
263,977,830
0
0
null
null
null
null
UTF-8
Java
false
false
4,248
java
package ru.spbstu.icst.lunarrover.screens; import com.badlogic.gdx.Input; import com.badlogic.gdx.scenes.scene2d.Group; import com.badlogic.gdx.scenes.scene2d.InputEvent; import com.badlogic.gdx.scenes.scene2d.actions.Actions; import com.badlogic.gdx.scenes.scene2d.ui.Image; import com.badlogic.gdx.scenes.scene2d.ui.ImageButton; import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable; import com.boontaran.games.StageGame; import ru.spbstu.icst.lunarrover.LunarRover; import ru.spbstu.icst.lunarrover.Setting; import ru.spbstu.icst.lunarrover.media.LevelIcon; public class LevelList extends StageGame { public static final int ON_BACK = 1; public static final int ON_LEVEL_SELECTED = 2; public static final int ON_OPEN_MARKET = 3; public static final int ON_SHARE = 4; private Group container; private int selectedLevelId = 0; public LevelList() { Image bg = new Image(LunarRover.atlas.findRegion("intro_bg")); addBackground(bg, true, false); container = new Group(); addChild(container); int row = 4, col = 4; float space = 20; float iconWidth = 0, iconHeight = 0; int id = 1; int x, y; int progress = LunarRover.data.getProgress(); for (y = 0; y < row; ++y){ for (x = 0; x < col; ++x){ LevelIcon icon = new LevelIcon(id); container.addActor(icon); if (iconWidth == 0){ iconWidth = icon.getWidth(); iconHeight = icon.getHeight(); } icon.setX(x * (iconWidth + space)); icon.setY(((row - 1) - y) * (iconHeight + space)); if (id <= progress){ icon.setLock(false); } if (id == progress){ icon.setHighlight(); } if (Setting.DEBUG_GAME){ icon.setLock(false); } icon.addListener(iconlistener); id++; } } container.setWidth(col * iconWidth + (col - 1) * space); container.setHeight(row * iconHeight + (row - 1) * space); container.setX(30); container.setY(getHeight() - container.getHeight() - 30); container.setColor(1, 1, 1, 0); container.addAction(Actions.alpha(1, 0.4f)); ImageButton rateBtn = new ImageButton(new TextureRegionDrawable(LunarRover.atlas.findRegion("rate")), new TextureRegionDrawable(LunarRover.atlas.findRegion("rate_down"))); addChild(rateBtn); rateBtn.setX(getWidth() - rateBtn.getWidth() - 20); rateBtn.setY(getHeight() - rateBtn.getHeight() - 20); rateBtn.addListener(new ClickListener(){ @Override public void clicked(InputEvent event, float x, float y) { call(ON_OPEN_MARKET); } }); ImageButton shareBtn = new ImageButton(new TextureRegionDrawable(LunarRover.atlas.findRegion("share")), new TextureRegionDrawable(LunarRover.atlas.findRegion("share_down"))); addChild(shareBtn); shareBtn.setX(getWidth() - shareBtn.getWidth() - 20); shareBtn.setY(20); rateBtn.addListener(new ClickListener(){ @Override public void clicked(InputEvent event, float x, float y) { call(ON_SHARE); } }); } public int getSelectedLevelId(){ return selectedLevelId; } private ClickListener iconlistener = new ClickListener(){ @Override public void clicked(InputEvent event, float x, float y) { selectedLevelId = ((LevelIcon)event.getTarget()).getId(); LunarRover.media.playSound("click.ogg"); call(ON_LEVEL_SELECTED); } }; @Override public boolean keyUp(int keycode) { if (keycode == Input.Keys.BACK || keycode == Input.Keys.ESCAPE){ LunarRover.media.playSound("click.ogg"); call(ON_BACK); return true; } return super.keyUp(keycode); } }
8b8cbf8a44f1fcdd409dcb1794aff7d70f966226
06dba042b8388c8c4c9c8a71af5bd3cb4c4a7384
/asmCodeGenerator/CodeGenerator/SimpleCodeGenerator.java
cfeab2c0544ddb164ea26106b5ed9206338a3a23
[]
no_license
JW752/simple-compiler
2569be71a2133a7a2cced86fcc6a2df7ffa83406
ec4356a9a27ee9fdb3eab7417a9aa1b55df5a0f9
refs/heads/master
2020-05-01T02:08:44.497815
2019-03-22T22:13:21
2019-03-22T22:13:21
177,206,151
0
2
null
2019-03-22T21:20:45
2019-03-22T20:38:55
Java
UTF-8
Java
false
false
215
java
package asmCodeGenerator.CodeGenerator; import asmCodeGenerator.codeStorage.*; public interface SimpleCodeGenerator { public ASMCodeChunk generate(); public ASMCodeChunk generate(Object... var); }
a545e21cea3e0bae4a0ba253ecd68f8b691defef
f08eec8aef3ebd6fdd6080b51f264cb523c4bad7
/src/servers/ServerA.java
d3694400e6f694ab6be60946b6a741ede5bbc3bc
[]
no_license
Richti/ProjetDS
4e5ed280858478dc59470f16bd36c9caff1a4e46
fa9cdf427b82353fd007ddba22cdea22d8a73b2f
refs/heads/master
2021-01-12T08:40:34.721338
2016-12-16T19:31:29
2016-12-16T19:31:29
76,656,184
0
0
null
null
null
null
UTF-8
Java
false
false
1,798
java
package servers; import java.net.InetAddress; import java.rmi.server.UnicastRemoteObject; import registries.LocateGlobalRegistry; import services.SimpleSorterA; import services.SimpleSorterB; import services.Sorter; /** * Server program. * * Note: After the main method exits, the JVM will still run. This is because * the skeleton implements a non-daemon listening thread, which waits for * incoming requests forever. * */ public class ServerA { // // CONSTANTS // private static final String SERVICE_NAME1 = "SimpleSorterA_ServerA"; private static final String SERVICE_NAME2 = "SimpleSorterB_ServerA"; // // MAIN // public static void main(String[] args) throws Exception { // check the name of the local machine (two methods) System.out.println("ServerA: running on host " + InetAddress.getLocalHost()); System.out.println("ServerA: hostname property " + System.getProperty("java.rmi.server.hostname")); // instanciate the remote object Sorter sorterA = new SimpleSorterA(); Sorter sorterB = new SimpleSorterB(); System.out.println("ServerA: instanciated SimpleSorter"); // create a skeleton and a stub for that remote object Sorter stubA = (Sorter) UnicastRemoteObject.exportObject(sorterA, 0); Sorter stubB = (Sorter) UnicastRemoteObject.exportObject(sorterB, 0); System.out.println("ServerA: generated skeleton and stub"); // register the remote object's stub in the registry LocateGlobalRegistry.getLocateGlobalRegistry().bind(SERVICE_NAME1, stubA); LocateGlobalRegistry.getLocateGlobalRegistry().bind(SERVICE_NAME2, stubB); // main terminates here, but the JVM still runs because of the skeleton System.out.println("ServerA: ready"); } }
91554811c7354c9754c43f7e021b58173d5440fe
ab950cdc8e59165e341c838053c4811caf30eec8
/jOOQ/src/main/java/org/jooq/Typed.java
c07dd62038d749da5becdef5bd7eaad891601dc0
[ "Apache-2.0" ]
permissive
cdalexndr/jOOQ
12e408df7d9ce9393f506120d5d69a8154f4419c
b91e9235b30d07db4091583e30e21198f5d919c7
refs/heads/main
2023-08-12T12:57:52.911066
2021-09-29T15:59:01
2021-09-29T15:59:01
411,799,887
0
0
NOASSERTION
2021-09-29T19:12:38
2021-09-29T19:12:37
null
UTF-8
Java
false
false
2,194
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. * * Other licenses: * ----------------------------------------------------------------------------- * Commercial licenses for this work are available. These replace the above * ASL 2.0 and offer limited warranties, support, maintenance, and commercial * database integrations. * * For more information, please visit: http://www.jooq.org/licenses * * * * * * * * * * * * * * * * */ package org.jooq; import org.jooq.impl.QOM.MTyped; import org.jetbrains.annotations.NotNull; /** * A marker interface for all query parts that have a {@link DataType}. * <p> * While there is no requirement for implementations to also implement * {@link Named}, a lot of implementations do. * * @author Lukas Eder */ public interface Typed<T> extends QueryPart, MTyped<T> { /** * The object's underlying {@link Converter}. * <p> * By default, all typed objects reference an identity-converter * <code>Converter&lt;T, T&gt;</code>. If an implementation is generated, * custom data types may be obtained by a custom {@link Converter} placed on * the generated object. */ @NotNull Converter<?, T> getConverter(); /** * The object's underlying {@link Binding}. */ @NotNull Binding<?, T> getBinding(); /** * The Java type of the object. */ @NotNull Class<T> getType(); /** * The type of this object (might not be dialect-specific). */ @NotNull DataType<T> getDataType(); /** * The dialect-specific type of this object. */ @NotNull DataType<T> getDataType(Configuration configuration); }
16a16cff72eb71fbca019e59d8d1971b6192bdd9
084e1a9ff02aa0e300f614614cbc6a084d2c8e8f
/src/test/java/io/github/jhipster/application/security/DomainUserDetailsServiceIntTest.java
ea86843f2946b8c03a0126909dc0c18424ec8dd6
[]
no_license
omoniyi24/jhipster-application-mondgodb-cardoc
1fcc4d7ebf334b1e7829a1f6af9a06af8dfd5f16
0b53b35d6c79727223881d982396250b41242885
refs/heads/master
2020-05-18T00:15:03.544604
2019-04-29T11:13:54
2019-04-29T11:13:54
184,056,350
0
0
null
2019-04-29T11:14:33
2019-04-29T11:13:45
Java
UTF-8
Java
false
false
4,520
java
package io.github.jhipster.application.security; import io.github.jhipster.application.CarDocMongodbApp; import io.github.jhipster.application.domain.User; import io.github.jhipster.application.repository.UserRepository; import org.apache.commons.lang3.RandomStringUtils; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.test.context.junit4.SpringRunner; import java.util.Locale; import static org.assertj.core.api.Assertions.assertThat; /** * Test class for DomainUserDetailsService. * * @see DomainUserDetailsService */ @RunWith(SpringRunner.class) @SpringBootTest(classes = CarDocMongodbApp.class) public class DomainUserDetailsServiceIntTest { private static final String USER_ONE_LOGIN = "test-user-one"; private static final String USER_ONE_EMAIL = "test-user-one@localhost"; private static final String USER_TWO_LOGIN = "test-user-two"; private static final String USER_TWO_EMAIL = "test-user-two@localhost"; private static final String USER_THREE_LOGIN = "test-user-three"; private static final String USER_THREE_EMAIL = "test-user-three@localhost"; @Autowired private UserRepository userRepository; @Autowired private UserDetailsService domainUserDetailsService; private User userOne; private User userTwo; private User userThree; @Before public void init() { userRepository.deleteAll(); userOne = new User(); userOne.setLogin(USER_ONE_LOGIN); userOne.setPassword(RandomStringUtils.random(60)); userOne.setActivated(true); userOne.setEmail(USER_ONE_EMAIL); userOne.setFirstName("userOne"); userOne.setLastName("doe"); userOne.setLangKey("en"); userRepository.save(userOne); userTwo = new User(); userTwo.setLogin(USER_TWO_LOGIN); userTwo.setPassword(RandomStringUtils.random(60)); userTwo.setActivated(true); userTwo.setEmail(USER_TWO_EMAIL); userTwo.setFirstName("userTwo"); userTwo.setLastName("doe"); userTwo.setLangKey("en"); userRepository.save(userTwo); userThree = new User(); userThree.setLogin(USER_THREE_LOGIN); userThree.setPassword(RandomStringUtils.random(60)); userThree.setActivated(false); userThree.setEmail(USER_THREE_EMAIL); userThree.setFirstName("userThree"); userThree.setLastName("doe"); userThree.setLangKey("en"); userRepository.save(userThree); } @Test public void assertThatUserCanBeFoundByLogin() { UserDetails userDetails = domainUserDetailsService.loadUserByUsername(USER_ONE_LOGIN); assertThat(userDetails).isNotNull(); assertThat(userDetails.getUsername()).isEqualTo(USER_ONE_LOGIN); } @Test public void assertThatUserCanBeFoundByLoginIgnoreCase() { UserDetails userDetails = domainUserDetailsService.loadUserByUsername(USER_ONE_LOGIN.toUpperCase(Locale.ENGLISH)); assertThat(userDetails).isNotNull(); assertThat(userDetails.getUsername()).isEqualTo(USER_ONE_LOGIN); } @Test public void assertThatUserCanBeFoundByEmail() { UserDetails userDetails = domainUserDetailsService.loadUserByUsername(USER_TWO_EMAIL); assertThat(userDetails).isNotNull(); assertThat(userDetails.getUsername()).isEqualTo(USER_TWO_LOGIN); } @Test public void assertThatUserCanBeFoundByEmailIgnoreCase() { UserDetails userDetails = domainUserDetailsService.loadUserByUsername(USER_TWO_EMAIL.toUpperCase(Locale.ENGLISH)); assertThat(userDetails).isNotNull(); assertThat(userDetails.getUsername()).isEqualTo(USER_TWO_LOGIN); } @Test public void assertThatEmailIsPrioritizedOverLogin() { UserDetails userDetails = domainUserDetailsService.loadUserByUsername(USER_ONE_EMAIL); assertThat(userDetails).isNotNull(); assertThat(userDetails.getUsername()).isEqualTo(USER_ONE_LOGIN); } @Test(expected = UserNotActivatedException.class) public void assertThatUserNotActivatedExceptionIsThrownForNotActivatedUsers() { domainUserDetailsService.loadUserByUsername(USER_THREE_LOGIN); } }
7219e83e99b0c18528ed825bf8e0c68198332704
76e82b766b6d88d220948b54ee33277757ce6d33
/src/test/java/com/vadrin/mmtstrain/MmtsTrainApplicationTests.java
5c30facecd86e2f724d87f0be790d090ea55727b
[ "MIT" ]
permissive
gv-prashanth/mmts-train
5532ded6a96e2ad82ef522de8e0c26092964a665
37629c0f6d576e728d5433d2d8c6774d91b8dabd
refs/heads/master
2023-08-31T13:31:49.766136
2023-08-28T07:29:14
2023-08-28T07:29:14
120,722,362
0
1
MIT
2018-11-14T12:19:38
2018-02-08T06:45:24
Java
UTF-8
Java
false
false
340
java
package com.vadrin.mmtstrain; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class MmtsTrainApplicationTests { @Test public void contextLoads() { } }
220f0460c795c9813a21fd2f958384d1667584ea
74f11390228d709f49473aaf670fc7fa29daea8f
/src/test/java/com/agpulse/demoironbankstarter/DemoIronBankStarterApplicationTests.java
d2f9bfa181e99b9c43870fb489de6391e6bfeb78
[]
no_license
mmalyutin/demo-iron-bank-starter-agpule
b61633db413e8fd0b1a1ccaf5434e4d3daacd44f
ef7cb8be6ce09fe3f2ed8165a6885627432af6fe
refs/heads/master
2022-04-03T05:38:59.446129
2020-02-02T08:22:09
2020-02-02T08:22:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
245
java
package com.agpulse.demoironbankstarter; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class DemoIronBankStarterApplicationTests { @Test void contextLoads() { } }
[ "kit2009" ]
kit2009
f02bb80199e1feedf8af4e09369a67a790903ef4
838268f20580176b1f62955f787b4741c4513e69
/src/main/java/com/specbee/cloudflare/service/util/RandomUtil.java
b3c9cbeeedd1528509cfdef440f905f01b640e5f
[]
no_license
GauravRao/cloudflare-demo
872c4a63acdd697917baebc69e4aaa89c359f189
fb0005c8caadf85823c24ef9089c6f8f7a36535b
refs/heads/master
2022-04-23T20:44:02.481956
2020-04-26T14:21:52
2020-04-26T14:21:52
259,047,801
0
0
null
2020-04-26T14:19:25
2020-04-26T14:14:19
Java
UTF-8
Java
false
false
896
java
package com.specbee.cloudflare.service.util; import org.apache.commons.lang3.RandomStringUtils; /** * Utility class for generating random Strings. */ public final class RandomUtil { private static final int DEF_COUNT = 20; private RandomUtil() { } /** * Generate a password. * * @return the generated password */ public static String generatePassword() { return RandomStringUtils.randomAlphanumeric(DEF_COUNT); } /** * Generate an activation key. * * @return the generated activation key */ public static String generateActivationKey() { return RandomStringUtils.randomNumeric(DEF_COUNT); } /** * Generate a reset key. * * @return the generated reset key */ public static String generateResetKey() { return RandomStringUtils.randomNumeric(DEF_COUNT); } }
b2056bcb9f564ff0a17dbe9e8a9eb01f6fe6af7c
ff3cd58a09a8286b42814f808aedc76285d54999
/app/src/test/java/com/example/stasan/ExampleUnitTest.java
44aa73e12af9dc1160276ef0c3589b85019f8f00
[]
no_license
safranilmi/stasan
ba478566483b0ab5eee76f430e35df7b7690ad83
187a2203e5c6c15e0e04e0988ca052c726ac47ba
refs/heads/master
2022-12-04T15:43:17.603071
2020-08-18T03:36:18
2020-08-18T03:36:18
288,344,787
0
0
null
null
null
null
UTF-8
Java
false
false
379
java
package com.example.stasan; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
36c873b111a8b22aeba7715385c16484d4fbb6f5
975945cf2c76b20d5d4448b89f7057e33d1a9ebc
/business/src/main/java/com/shareshenghuo/app/shop/OrderManageActivity.java
75cf8217019744306ad08080787445d2b347c533
[]
no_license
gy121681/Share
aa64f67746f88d55e884e5ae48b3789422175f8f
031286dc1d2ce4ebe7fe2665ebd525d1946ad163
refs/heads/master
2021-01-15T12:02:34.908825
2017-08-08T03:01:07
2017-08-08T03:01:07
99,643,530
3
0
null
null
null
null
UTF-8
Java
false
false
2,773
java
package com.shareshenghuo.app.shop; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.View; import android.view.View.OnClickListener; import android.widget.TextView; import com.shareshenghuo.app.shop.R; import com.shareshenghuo.app.shop.fragment.OrderListFragment; import com.shareshenghuo.app.shop.widget.MyTabView; public class OrderManageActivity extends BaseTopActivity implements OnClickListener { private TextView tvTitle; private MyTabView tabView; private List<Fragment> fragments; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_order_manage); initView(); } public void initView() { tvTitle = getView(R.id.tvTopTitle); tabView = (MyTabView) findViewById(R.id.tabOrderManage); List<Map<String,Integer>> titles = new ArrayList<Map<String,Integer>>(); Map<String,Integer> map = new HashMap<String, Integer>(); map.put("全部", null); titles.add(map); map = new HashMap<String, Integer>(); map.put("待接单", null); titles.add(map); map = new HashMap<String, Integer>(); map.put("进行中", null); titles.add(map); map = new HashMap<String, Integer>(); map.put("已结束", null); titles.add(map); fragments = new ArrayList<Fragment>(); fragments.add(new OrderListFragment()); fragments.add(new OrderListFragment()); fragments.add(new OrderListFragment()); fragments.add(new OrderListFragment()); for(int i=0; i<4; i++) ((OrderListFragment) fragments.get(i)).status = i; tabView.createView(titles, fragments, getSupportFragmentManager()); tvTitle.setOnClickListener(this); getView(R.id.llTopBack).setOnClickListener(this); getView(R.id.llTopSearch).setOnClickListener(this); } @Override public void onClick(View v) { switch(v.getId()) { case R.id.llTopBack: finish(); break; case R.id.llTopSearch: startActivity(new Intent(this, SearchOrderActivity.class)); break; case R.id.tvTopTitle: showOrderTypeDlg(); break; } } private String[] items = {"全部订单", "外卖订单", "到店消费"}; public void showOrderTypeDlg() { new AlertDialog.Builder(this).setItems(items, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface arg0, int which) { tvTitle.setText(items[which]); for(int i=0; i<4; i++) { OrderListFragment f = (OrderListFragment) fragments.get(i); f.order_type = which; f.onPullDownToRefresh(null); } } }) .show(); } }
972296f975997267a49e4f85f5d4656d84fe1314
0830718cc03004986dd9189ca8b91a8da419256a
/src/JavaStudy/Jan_29/YSH/Book.java
14dc25922c95381760ec6155896073074e1ff728
[]
no_license
Brilliant-Kwon/JavaEx
3f46dba3ca81df38b2872da68c36de348c69f704
fdc76d9b15e76b2d719b3c7e2be2d5fa7a38d656
refs/heads/master
2020-04-17T02:27:32.978565
2019-03-14T00:41:24
2019-03-14T00:41:24
166,135,514
0
0
null
null
null
null
UTF-8
Java
false
false
912
java
package JavaStudy.Jan_29.YSH; public class Book extends Product{ private int isbn; private String writer; private String bookName; public Book(int sik, String info, String producer, int price,int isbn,String writer,String bookName) { super(sik, info, producer, price); this.isbn=isbn; this.writer=writer; this.bookName=bookName; } public int getIsbn() { return isbn; } public String getWriter() { return writer; } public String getBookName() { return bookName; } public void setIsbn(int isbn) { this.isbn = isbn; } public void setWriter(String writer) { this.writer = writer; } public void setBookName(String bookName) { this.bookName = bookName; } @Override public void showInfo() { // TODO Auto-generated method stub super.showInfo(); System.out.println("isbn>>"+isbn); System.out.println("작가>>"+writer); System.out.println("책이름>>"+bookName); } }
a1528f1d1c80d61ec2807409275dd6169e80384f
c1e24d47a405e5531e693879fbdbcad005e9d852
/PARA/PARA-core/src/main/java/Maps/Map.java
90659975b80279b7db744d2d67b0407568d3059f
[]
no_license
adampolek/para
65879f796279958a21c9996c17637a262aaf223c
eaa332e5f62e639fb103c1b26cd507ab0e39529e
refs/heads/master
2020-05-18T09:04:40.916865
2018-12-04T16:08:06
2018-12-04T16:08:06
184,313,463
1
0
null
null
null
null
UTF-8
Java
false
false
3,168
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 Maps; import java.io.File; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.List; import java.util.Random; import java.util.Scanner; /** * * @author Sawek */ public class Map { private String name; int[][] mapa = new int[25][25]; int counter = 0; int numberFights = 0; public String getName() { return name; } public Map(String name) { this.name = name; for (int i = 0; i < 25; i++) { for (int j = 0; j < 25; j++) { mapa[i][j] = 0; } } } public void setCellMap(int x, int y, int number) { mapa[x][y] = number; } public void makeMap(String name) throws FileNotFoundException { Scanner scanner = new Scanner(new File(name)); int x=0, y=0; char znak; int t; String line; while(scanner.hasNextLine()){ y = 0; line=scanner.nextLine(); int length=line.length(); for(int i=0;i<length;i++){ znak = line.charAt(i); //1 mozna wejsc(komnata) 0 nie mozna(puste pole) if (znak == '0') t = 0; else if (znak == '1') { t = 1; counter++; } else t = 3; mapa[x][i] = t; y++; } x++; } } public void setFightOnMap() { // ustawienie 2 czyli walki na mapie narazie nielosowo resetMap(); Random rand = new Random(); numberFights = rand.nextInt(10) + 1; List<Integer> wherefight = new ArrayList<>(); int fightcounter = counter / numberFights; for (int i = 0; i < numberFights; i++) { wherefight.add(rand.nextInt(fightcounter) + i * fightcounter + 1); } if (wherefight.get(0) == 1) { wherefight.set(0, 2); } if (wherefight.get(numberFights - 1) > counter) { wherefight.set(numberFights - 1, counter - 1); } counter = 0; for (int i = 0; i < 25; i++) { for (int j = 0; j < 25; j++) { if (mapa[i][j] == 1) { counter++; if (!wherefight.isEmpty()) if (counter == wherefight.get(0)) { mapa[i][j] = 2; System.out.println(i + ", " + j); wherefight.remove(0); } } } } } public void resetMap() { for (int i = 0; i < 25; i++) { for (int j = 0; j < 25; j++) { if (mapa[i][j] == 2) { mapa[i][j] = 1; } } } } public int getNumberFights() { return numberFights; } public int[][] getMap() { return mapa; } }
8f6c43c8a6aaf18128a01cc8988467ddbeb2faaa
605c2487f6d5a26298b9007890730550fe241890
/src/main/java/com/chris/nettylecture/nio/NioClient.java
983d711be5d89b587be0e9f151d7d277292379c3
[]
no_license
nightwatch2018/netty4_lecture
427804281da4601a907bb3acf88a7a887b7c77ce
0d8a88e9b48613ecf242a1ff1574371cc7ef02a4
refs/heads/master
2020-03-17T14:14:00.299886
2018-05-25T12:30:00
2018-05-25T12:30:00
133,664,258
0
0
null
null
null
null
UTF-8
Java
false
false
3,419
java
package com.chris.nettylecture.nio; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.InetSocketAddress; import java.nio.ByteBuffer; import java.nio.channels.SelectionKey; import java.nio.channels.Selector; import java.nio.channels.SocketChannel; import java.time.LocalDateTime; import java.util.Set; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; public class NioClient { public static void main(String[] args) throws IOException { try { SocketChannel socketChannel = SocketChannel.open(); socketChannel.configureBlocking(false); Selector selector = Selector.open(); socketChannel.register(selector, SelectionKey.OP_CONNECT); socketChannel.connect(new InetSocketAddress("127.0.0.1", 8899)); while (true) { selector.select(); Set<SelectionKey> keySet = selector.selectedKeys(); for (SelectionKey selectionKey : keySet) { if (selectionKey.isConnectable()) { SocketChannel client = (SocketChannel) selectionKey.channel(); if (client.isConnectionPending()) { client.finishConnect(); ByteBuffer writeBuffer = ByteBuffer.allocate(1024); writeBuffer.put((LocalDateTime.now() + " 连接成功").getBytes()); writeBuffer.flip(); client.write(writeBuffer); ExecutorService executorService = Executors.newSingleThreadExecutor(Executors.defaultThreadFactory()); executorService.submit(() -> { while (true) { try { writeBuffer.clear(); InputStreamReader input = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(input); String sendMessage = br.readLine(); writeBuffer.put(sendMessage.getBytes()); writeBuffer.flip(); client.write(writeBuffer); } catch (Exception ex) { ex.printStackTrace(); } } }); } client.register(selector, SelectionKey.OP_READ); } else if (selectionKey.isReadable()) { SocketChannel client = (SocketChannel) selectionKey.channel(); ByteBuffer readBuffer = ByteBuffer.allocate(1024); int count = client.read(readBuffer); if (count > 0) { String receivedMessage = new String(readBuffer.array(), 0, count); System.out.println(receivedMessage); } } } keySet.clear(); } } catch (Exception ex) { ex.printStackTrace(); } } }
0859d865a4360131a59514c016c9da7dd0a35d38
082aaf84615ed65020a27fa8fb46c20797dacc72
/services/WMSTUDIO/src/com/testing26thjuly_/wmstudio/Table65Id.java
940d7ab8937fceab248da55c76e78300f43efea4
[]
no_license
Sushma-M/Testing_2Aug_
d3f254338cf156db18e90706aea2233340ecd6a2
77cf5efdad74a298af6863a626a90638eea01c22
refs/heads/master
2021-01-17T16:24:24.547675
2016-08-02T10:17:35
2016-08-02T10:17:35
64,747,143
0
0
null
null
null
null
UTF-8
Java
false
false
1,630
java
/*Copyright (c) 2016-2017 wavemaker.com All Rights Reserved. This software is the confidential and proprietary information of wavemaker.com You shall not disclose such Confidential Information and shall use it only in accordance with the terms of the source code license agreement you entered into with wavemaker.com*/ package com.testing26thjuly_.wmstudio; /*This is a Studio Managed File. DO NOT EDIT THIS FILE. Your changes may be reverted by Studio.*/ import java.io.Serializable; import java.util.Objects; public class Table65Id implements Serializable { private String stringCol; private int id; private short shortCol; public String getStringCol() { return this.stringCol; } public void setStringCol(String stringCol) { this.stringCol = stringCol; } public int getId() { return this.id; } public void setId(int id) { this.id = id; } public short getShortCol() { return this.shortCol; } public void setShortCol(short shortCol) { this.shortCol = shortCol; } @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Table65)) return false; final Table65 table65 = (Table65) o; return Objects.equals(getStringCol(), table65.getStringCol()) && Objects.equals(getId(), table65.getId()) && Objects.equals(getShortCol(), table65.getShortCol()); } @Override public int hashCode() { return Objects.hash(getStringCol(), getId(), getShortCol()); } }
[ "root@50d297549a19" ]
root@50d297549a19
59d8671e3baeca9264619197fba2ce3a852081bf
4fc2858a02172926fd24459305ce481cdd324a40
/algorithm-leetcode-master/src/Problem_0826_安排工作以达到最大收益.java
7a2eaf59ac4890a481adb4a30787b5a5480f92d2
[]
no_license
qqxqqbot/algorithmzuo
ecb3fd4505862d3d6e8bfd8955778a7152c77960
ef76cb207cc490d0aa34590ab57821c0b6063c90
refs/heads/master
2023-05-08T09:42:17.244171
2021-06-06T11:06:26
2021-06-06T11:06:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,512
java
import java.util.Arrays; import java.util.Comparator; /** * @author cuilihuan * @data 2021/5/10 17:15 */ public class Problem_0826_安排工作以达到最大收益 { public static void main(String[] args) { System.out.println(new Problem_0826_安排工作以达到最大收益().maxProfitAssignment(new int[]{2, 4, 6, 8, 10}, new int[]{10, 20, 30, 40, 50}, new int[]{4, 5, 6, 7})); } class Info { int difficutlty; int profit; public Info(int difficutlty, int profit) { this.difficutlty = difficutlty; this.profit = profit; } } public int maxProfitAssignment(int[] difficulty, int[] profit, int[] worker) { if (worker == null || worker.length == 0) return 0; Info[] info = new Info[difficulty.length]; for (int i = 0; i < difficulty.length; i++) { info[i] = new Info(difficulty[i], profit[i]); } Arrays.sort(info, new Comparator<Info>() { @Override public int compare(Info o1, Info o2) { return o1.difficutlty - o2.difficutlty; } }); Arrays.sort(worker); int ans = 0; int i = 0; int curMax = 0; for(Integer work : worker){ while (i < info.length && work >= info[i].difficutlty ){ curMax = Math.max(curMax, info[i].profit); i++; } ans += curMax; } return ans; } }