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
e09d29e95fbd1957195b4b8cd5012894535da298
90174046dcba8477587de45a74788280a3f5d694
/src/main/java/normal/CoinChange.java
ddb7ddcc49731aaea9f6205fbdc05f86769a87db
[]
no_license
heobietbay/PracticeKata
687544d84444ac98bd5eead506bf83a1e4578ed5
44644cae73489b9d84267e57f73b689cd21af921
refs/heads/master
2022-11-09T19:15:46.700054
2022-11-07T15:42:02
2022-11-07T15:42:02
67,873,202
0
0
null
2022-10-12T07:17:03
2016-09-10T13:41:37
Java
UTF-8
Java
false
false
1,186
java
package normal; /** * Given an integer representing a given amount of change, write a * function to <b>compute the total number of coins required </b>to make * that amount of change. * You can assume that there is always a 1$ coin. */ public class CoinChange { public static void main(String[] args) { int[] coins = new int[]{1,5,10,25}; System.out.println(solution(1,coins)); } public static int solution(int money, int[] coins) { return solutionRecursive(money,coins); } private static int solutionRecursive(int money, int[] coins) { if (money == 0) return 0; int minCoins = Integer.MAX_VALUE; // Try removing each coin from the total and see how many more coins are required for (int coin : coins) { // Skip a coin if it’s value is greater than the amount remaining if (money - coin >= 0) { int currMinCoins = solutionRecursive(money - coin,coins); if (currMinCoins < minCoins) minCoins = currMinCoins; } } // Add back the coin removed recursively return minCoins + 1; } }
5d3f8e8fc395289720dcb7858033d048829eb59b
60c2408c9ead947e32e5a3137f493d1346deaa27
/fivagest/src/model/soldi/AccontoVirtuale.java
e2b8ff78522d58fc14644b8ac53da846ab7b612a
[]
no_license
lusoria/naico
38b80edb222c322c53e926ceffa8f1c015acb2e2
24af0468814b41ce2ee3b5a92b6a052f21f3f64d
refs/heads/master
2021-01-25T12:07:47.445635
2013-12-13T22:50:41
2013-12-13T22:50:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
699
java
package model.soldi; import java.math.BigDecimal; public class AccontoVirtuale extends Euro { private boolean pagaIVA; public AccontoVirtuale() { super(); this.pagaIVA = false; } public AccontoVirtuale(BigDecimal acconto, boolean pagaIVA) { super(acconto); this.pagaIVA = pagaIVA; } public AccontoVirtuale(double acconto, boolean pagaIVA) { super(acconto); this.pagaIVA = pagaIVA; } public AccontoVirtuale(String acconto, boolean pagaIVA) { super(acconto); this.pagaIVA = pagaIVA; } public boolean getPagaIVA() { return this.pagaIVA; } public void setPagaIVA(boolean pagaIVA) { this.pagaIVA = pagaIVA; } }
[ "nico@nico-pc" ]
nico@nico-pc
09be7771b711f2d3862aaf430991ce14953e7f8d
1ce518b09521578e26e79a1beef350e7485ced8c
/source/app/src/main/java/net/simonvt/menudrawer/VerticalDrawer.java
8ae086a91264cee3f181f48b8f2d8719528f0104
[]
no_license
yash2710/AndroidStudioProjects
7180eb25e0f83d3f14db2713cd46cd89e927db20
e8ba4f5c00664f9084f6154f69f314c374551e51
refs/heads/master
2021-01-10T01:15:07.615329
2016-04-03T09:19:01
2016-04-03T09:19:01
55,338,306
1
1
null
null
null
null
UTF-8
Java
false
false
6,814
java
// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.geocities.com/kpdus/jad.html // Decompiler options: braces fieldsfirst space lnc package net.simonvt.menudrawer; import android.app.Activity; import android.content.Context; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.VelocityTracker; // Referenced classes of package net.simonvt.menudrawer: // DraggableDrawer, BuildLayerFrameLayout public abstract class VerticalDrawer extends DraggableDrawer { VerticalDrawer(Activity activity, int i) { super(activity, i); } public VerticalDrawer(Context context) { super(context); } public VerticalDrawer(Context context, AttributeSet attributeset) { super(context, attributeset); } public VerticalDrawer(Context context, AttributeSet attributeset, int i) { super(context, attributeset, i); } public boolean onInterceptTouchEvent(MotionEvent motionevent) { int i; i = 0xff & motionevent.getAction(); if (i == 0 && mMenuVisible && isCloseEnough()) { setOffsetPixels(0.0F); stopAnimation(); endPeek(); setDrawerState(0); } if (!mMenuVisible || !isContentTouch(motionevent)) goto _L2; else goto _L1 _L1: boolean flag = true; _L4: return flag; _L2: int j; j = mTouchMode; flag = false; if (j == 0) goto _L4; else goto _L3 _L3: if (i != 0 && mIsDragging) { return true; } i; JVM INSTR tableswitch 0 3: default 124 // 0 151 // 1 374 // 2 234 // 3 374; goto _L5 _L6 _L7 _L8 _L7 _L5: if (mVelocityTracker == null) { mVelocityTracker = VelocityTracker.obtain(); } mVelocityTracker.addMovement(motionevent); return mIsDragging; _L6: float f6 = motionevent.getX(); mInitialMotionX = f6; mLastMotionX = f6; float f7 = motionevent.getY(); mInitialMotionY = f7; mLastMotionY = f7; if (onDownAllowDrag(motionevent)) { byte byte0; if (mMenuVisible) { byte0 = 8; } else { byte0 = 0; } setDrawerState(byte0); stopAnimation(); endPeek(); mIsDragging = false; } continue; /* Loop/switch isn't completed */ _L8: float f = motionevent.getX(); float f1 = f - mLastMotionX; float f2 = Math.abs(f1); float f3 = motionevent.getY(); float f4 = f3 - mLastMotionY; float f5 = Math.abs(f4); if (f5 > (float)mTouchSlop && f5 > f2) { if (mOnInterceptMoveEventListener != null && mTouchMode == 2 && canChildScrollVertically(mContentContainer, false, (int)f1, (int)f, (int)f3)) { endDrag(); return false; } if (onMoveAllowDrag(motionevent, f4)) { setDrawerState(2); mIsDragging = true; mLastMotionX = f; mLastMotionY = f3; } } continue; /* Loop/switch isn't completed */ _L7: if (Math.abs(mOffsetPixels) > (float)(mMenuSize / 2)) { openMenu(); } else { closeMenu(); } if (true) goto _L5; else goto _L9 _L9: } protected void onMeasure(int i, int j) { int k = android.view.View.MeasureSpec.getMode(i); int l = android.view.View.MeasureSpec.getMode(j); if (k != 0x40000000 || l != 0x40000000) { throw new IllegalStateException("Must measure with an exact size"); } int i1 = android.view.View.MeasureSpec.getSize(i); int j1 = android.view.View.MeasureSpec.getSize(j); if (!mMenuSizeSet) { mMenuSize = (int)(0.25F * (float)j1); } if (mOffsetPixels == -1F) { openMenu(false); } int k1 = getChildMeasureSpec(i, 0, i1); int l1 = getChildMeasureSpec(i, 0, mMenuSize); mMenuContainer.measure(k1, l1); int i2 = getChildMeasureSpec(i, 0, i1); int j2 = getChildMeasureSpec(i, 0, j1); mContentContainer.measure(i2, j2); setMeasuredDimension(i1, j1); updateTouchAreaSize(); } public boolean onTouchEvent(MotionEvent motionevent) { int i; if (!mMenuVisible && !mIsDragging && mTouchMode == 0) { return false; } i = 0xff & motionevent.getAction(); if (mVelocityTracker == null) { mVelocityTracker = VelocityTracker.obtain(); } mVelocityTracker.addMovement(motionevent); i; JVM INSTR tableswitch 0 3: default 84 // 0 86 // 1 310 // 2 145 // 3 310; goto _L1 _L2 _L3 _L4 _L3 _L1: return true; _L2: float f7 = motionevent.getX(); mInitialMotionX = f7; mLastMotionX = f7; float f8 = motionevent.getY(); mInitialMotionY = f8; mLastMotionY = f8; if (onDownAllowDrag(motionevent)) { stopAnimation(); endPeek(); startLayerTranslation(); } continue; /* Loop/switch isn't completed */ _L4: if (!mIsDragging) { float f2 = Math.abs(motionevent.getX() - mLastMotionX); float f3 = motionevent.getY(); float f4 = f3 - mLastMotionY; float f5 = Math.abs(f4); if (f5 > (float)mTouchSlop && f5 > f2 && onMoveAllowDrag(motionevent, f4)) { setDrawerState(2); mIsDragging = true; float f; float f1; float f6; if (f3 - mInitialMotionY > 0.0F) { f6 = mInitialMotionY + (float)mTouchSlop; } else { f6 = mInitialMotionY - (float)mTouchSlop; } mLastMotionY = f6; } } if (mIsDragging) { startLayerTranslation(); f = motionevent.getY(); f1 = f - mLastMotionY; mLastMotionY = f; onMoveEvent(f1); } continue; /* Loop/switch isn't completed */ _L3: onUpEvent(motionevent); if (true) goto _L1; else goto _L5 _L5: } }
5c8e1b59530deca9ce48c561f336abc2db78720d
01ce221d184efb3cfe55497d712585951c9db031
/algorithms/texture/AreaGranulometry.java
ee8dcd204435ed1393b0594c8dea5b1f7aae9d5a
[ "MIT" ]
permissive
muratcanozdemir/Visual-Processing-Library
05ee76680938590ed54a5fb76e3dd111778eb090
b7388348a66499abe87095b80be108765398c1d2
refs/heads/master
2020-05-07T08:56:06.831198
2019-04-09T11:36:19
2019-04-09T11:36:19
180,352,735
0
0
null
null
null
null
UTF-8
Java
false
false
5,519
java
/* 1: */ package vpt.algorithms.texture; /* 2: */ /* 3: */ import vpt.Algorithm; /* 4: */ import vpt.DoubleImage; /* 5: */ import vpt.GlobalException; /* 6: */ import vpt.Image; /* 7: */ import vpt.algorithms.frequential.FFT; /* 8: */ import vpt.algorithms.mm.gray.connected.GAreaClosing; /* 9: */ import vpt.algorithms.mm.gray.connected.GAreaOpening; /* 10: */ import vpt.algorithms.statistical.Kurtosis; /* 11: */ import vpt.algorithms.statistical.Skewness; /* 12: */ import vpt.algorithms.statistical.Variance; /* 13: */ import vpt.util.Tools; /* 14: */ /* 15: */ public class AreaGranulometry /* 16: */ extends Algorithm /* 17: */ { /* 18: 23 */ public double[] output = null; /* 19: 24 */ public Image input = null; /* 20: 25 */ public Integer len = null; /* 21: 26 */ public Integer step = null; /* 22: 27 */ public Integer valuation = null; /* 23: */ public static final int VOLUME = 0; /* 24: */ public static final int FOURIER_VOLUME = 1; /* 25: */ public static final int FOURIER_VARIANCE = 2; /* 26: */ public static final int MOMENT1 = 3; /* 27: */ public static final int FOURIER_MOMENT1 = 4; /* 28: */ public static final int VARIANCE = 5; /* 29: */ public static final int SKEWNESS = 6; /* 30: */ public static final int KURTOSIS = 7; /* 31: */ public static final int FOURIER_KURTOSIS = 8; /* 32: */ public static final int MOMENT2 = 9; /* 33: */ /* 34: */ public AreaGranulometry() /* 35: */ { /* 36: 41 */ this.inputFields = "input,len,step,valuation"; /* 37: 42 */ this.outputFields = "output"; /* 38: */ } /* 39: */ /* 40: */ public void execute() /* 41: */ throws GlobalException /* 42: */ { /* 43: 46 */ int cdim = this.input.getCDim(); /* 44: 47 */ int size = this.len.intValue() * cdim * 2; /* 45: 48 */ this.output = new double[size]; /* 46: */ /* 47: 50 */ double[] originalValues = new double[cdim]; /* 48: 52 */ for (int c = 0; c < cdim; c++) { /* 49: 53 */ originalValues[c] = valuation(this.input, c); /* 50: */ } /* 51: 55 */ for (int i = 1; i <= this.len.intValue(); i++) /* 52: */ { /* 53: 56 */ Image tmp = GAreaOpening.invoke(this.input, Integer.valueOf(i * this.step.intValue())); /* 54: 58 */ for (int c = 0; c < cdim; c++) { /* 55: 59 */ this.output[(c * this.len.intValue() * 2 + i - 1)] = (valuation(tmp, c) / originalValues[c]); /* 56: */ } /* 57: 61 */ tmp = GAreaClosing.invoke(this.input, Integer.valueOf(i * this.step.intValue())); /* 58: 63 */ for (int c = 0; c < cdim; c++) { /* 59: 64 */ this.output[(c * this.len.intValue() * 2 + this.len.intValue() + i - 1)] = (valuation(tmp, c) / originalValues[c]); /* 60: */ } /* 61: */ } /* 62: */ } /* 63: */ /* 64: */ private double valuation(Image img, int channel) /* 65: */ throws GlobalException /* 66: */ { /* 67: 69 */ switch (this.valuation.intValue()) /* 68: */ { /* 69: */ case 0: /* 70: 71 */ return Tools.volume(img, channel); /* 71: */ case 5: /* 72: 74 */ return Variance.invoke(img).doubleValue(); /* 73: */ case 6: /* 74: 77 */ return Skewness.invoke(img).doubleValue(); /* 75: */ case 7: /* 76: 80 */ return Kurtosis.invoke(img).doubleValue(); /* 77: */ case 2: /* 78: 83 */ DoubleImage[] fft = FFT.invoke(img.getChannel(channel), Boolean.valueOf(false), Integer.valueOf(2)); /* 79: 84 */ return Variance.invoke(fft[0]).doubleValue(); /* 80: */ case 8: /* 81: 87 */ DoubleImage[] fft = FFT.invoke(img.getChannel(channel), Boolean.valueOf(false), Integer.valueOf(2)); /* 82: 88 */ return Kurtosis.invoke(fft[0]).doubleValue(); /* 83: */ case 1: /* 84: 91 */ DoubleImage[] fft = FFT.invoke(img.getChannel(channel), Boolean.valueOf(false), Integer.valueOf(2)); /* 85: 92 */ return Tools.volume(fft[0], 0); /* 86: */ case 3: /* 87: 95 */ return vpt.algorithms.statistical.InvariantMoment.invoke(img, Integer.valueOf(1))[0]; /* 88: */ case 9: /* 89: 98 */ return vpt.algorithms.statistical.InvariantMoment.invoke(img, Integer.valueOf(2))[0]; /* 90: */ case 4: /* 91:101 */ DoubleImage[] fft = FFT.invoke(img, Boolean.valueOf(true), Integer.valueOf(2)); /* 92:102 */ return vpt.algorithms.statistical.InvariantMoment.invoke(fft[0], Integer.valueOf(1))[0]; /* 93: */ } /* 94:105 */ throw new GlobalException("Invalid valuation type"); /* 95: */ } /* 96: */ /* 97: */ public static double[] invoke(Image image, Integer len, Integer step, Integer valuation) /* 98: */ { /* 99: */ try /* 100: */ { /* 101:112 */ return (double[])new AreaGranulometry().preprocess(new Object[] { image, len, step, valuation }); /* 102: */ } /* 103: */ catch (GlobalException e) /* 104: */ { /* 105:114 */ e.printStackTrace(); /* 106: */ } /* 107:115 */ return null; /* 108: */ } /* 109: */ } /* Location: H:\ROI_v0.1.jar * Qualified Name: vpt.algorithms.texture.AreaGranulometry * JD-Core Version: 0.7.0.1 */
29f7dc3954d07ab5076ef44e973ad79c663f074e
34d3cacf9c8ae0828e50fc4dccb33765bf630474
/app/src/main/java/com/example/sharongueta/instachef/MainActivity.java
a5fc3c65d4765996b706a2a1817d9afe46b23d39
[]
no_license
Shergueta/InstaChef
384718d56fa427de5247edb617be949611a12c5a
68888d153df95b2dcbc1c52d0141cefaac6d165d
refs/heads/master
2021-04-03T06:06:11.520204
2018-03-12T15:47:58
2018-03-12T15:47:58
124,884,441
0
0
null
null
null
null
UTF-8
Java
false
false
317
java
package com.example.sharongueta.instachef; import android.app.Activity; import android.os.Bundle; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } }
2830e8eec21b2a159a6cfe3fc352dd0be24ef03e
9bfd60913aca40e9d36415a3001c765e901f112a
/src/main/java/com/Perevertailo/Service/LogHandlerImpl.java
ac13aa62b8b45e08783fc397e728afe8ca56a82f
[]
no_license
AndrePrvt/BMSTest
c5c2c5e31cba636a18561c51c71758e369751b95
d4c3c6b059f2be8c232fa379229c36e1120eb158
refs/heads/master
2021-01-11T13:43:22.067893
2017-06-22T09:37:47
2017-06-22T09:37:47
95,099,108
0
0
null
null
null
null
UTF-8
Java
false
false
1,425
java
package com.Perevertailo.Service; import com.Perevertailo.Model.DTO.MessageDTO; import com.Perevertailo.Repository.FileRepositoryImpl; import com.Perevertailo.Model.SdlSig; import com.Perevertailo.Model.Stopping; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.io.File; import java.io.IOException; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * Created by Boris on 15.06.2017. */ @Service public class LogHandlerImpl implements LogHandler { @Autowired FileRepositoryImpl fileRepository; @Override public Integer getCurrentReloadTime() { return fileRepository.getTime(); } @Override public boolean changeCurrentReloadTime(int time) { if (time > 0){ fileRepository.setTime(time); return true; } return false; } @Override public String getCurrentFilePath() { return fileRepository.getPath(); } @Override public boolean changeCurrentFilePath(String filePath){ File file = new File(filePath); if (file.exists() && file.isFile()){ fileRepository.setPath(filePath); return true; } return false; } @Override public MessageDTO uploadResult() throws IOException { return fileRepository.getXMLMessages(); } }
3bf006634ec9d97c717681cdcdf693e08606c4e6
6835e4ae0174ce7d1ee55f39adb407d7943b3d02
/sample/src/main/java/com/github/sample/ColorDialog.java
db78618effce769645ddcc8925373e91c269acfa
[]
no_license
pengjfcn/CustomTabStrip
8720f6d177db6f4bae122aaf244a3bc87bcde007
34ca83e785d86a65c4cd637d3bfbd18be63c423d
refs/heads/master
2021-01-10T05:28:27.467553
2016-08-30T10:11:04
2016-08-30T10:11:04
50,244,051
1
0
null
null
null
null
UTF-8
Java
false
false
4,160
java
package com.github.sample; import android.app.Dialog; import android.content.Context; import android.graphics.Color; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.SeekBar; public class ColorDialog extends Dialog implements SeekBar.OnSeekBarChangeListener, View.OnClickListener { private View mVColor; private SeekBar mSbAlpha; private SeekBar mSbRed; private SeekBar mSbGreen; private SeekBar mSbBlue; private Button mBtnOk; private int mColor; private OnColorChangedListener mListener; public ColorDialog(Context context) { super(context); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.dialog_color); //set title setTitle(R.string.dialog_color_title); // init view initView(); //init event initEvent(); // initData initData(); } private void initView() { mVColor = findViewById(R.id.dialog_color_show); mSbAlpha = (SeekBar) findViewById(R.id.dialog_color_alpha); mSbRed = (SeekBar) findViewById(R.id.dialog_color_red); mSbGreen = (SeekBar) findViewById(R.id.dialog_color_green); mSbBlue = (SeekBar) findViewById(R.id.dialog_color_blue); mBtnOk = (Button) findViewById(R.id.dialog_color_btn_ok); mSbAlpha.setMax(255); mSbRed.setMax(255); mSbGreen.setMax(255); mSbBlue.setMax(255); } private void initEvent() { mSbAlpha.setOnSeekBarChangeListener(this); mSbRed.setOnSeekBarChangeListener(this); mSbGreen.setOnSeekBarChangeListener(this); mSbBlue.setOnSeekBarChangeListener(this); mBtnOk.setOnClickListener(this); } private void initData() { if (mVColor != null) { mVColor.setBackgroundColor(mColor); } if (mSbAlpha != null) { int alpha = Color.alpha(mColor); mSbAlpha.setProgress(alpha); } if (mSbRed != null) { int red = Color.red(mColor); mSbRed.setProgress(red); } if (mSbGreen != null) { int green = Color.green(mColor); mSbGreen.setProgress(green); } if (mSbBlue != null) { int blue = Color.blue(mColor); mSbBlue.setProgress(blue); } } public void setColor(int color) { this.mColor = color; initData(); } public void setColor(String colorString) { this.mColor = Color.parseColor(colorString); initData(); } @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { int alpha = Color.alpha(mColor); int red = Color.red(mColor); int green = Color.green(mColor); int blue = Color.blue(mColor); if (seekBar == mSbAlpha) { alpha = progress; } else if (seekBar == mSbRed) { red = progress; } else if (seekBar == mSbGreen) { green = progress; } else if (seekBar == mSbBlue) { blue = progress; } this.mColor = Color.argb(alpha, red, green, blue); mVColor.setBackgroundColor(mColor); if (mListener != null) { mListener.onColorChanged(mColor); } } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onStopTrackingTouch(SeekBar seekBar) { } @Override public void onClick(View v) { if (v == mBtnOk) { clickOk(); } } private void clickOk() { dismiss(); } public void setOnColorChangedListener(OnColorChangedListener listener) { this.mListener = listener; } public interface OnColorChangedListener { void onColorChanged(int color); } }
d5fafe72aea1fc773ff3e732c6f1ce72fd783af0
7ba42b7af6cc3be493d9a0b7ad824f8e11ec7ef3
/Hospital/src/com/action/Func.java
a9adf99a9f4d51b1bedff2413a7626bde0fda8c2
[]
no_license
EternalFeather/Medical_Management_System_with_Database
5e7449608764f9d5dd46b06354557e9df5548ccb
d169b2c1956ebfda721b1e82548ab092e6b49af8
refs/heads/master
2020-12-30T10:11:09.102064
2017-08-03T15:15:14
2017-08-03T15:15:14
99,245,697
0
0
null
null
null
null
UTF-8
Java
false
false
959
java
package com.action; import java.io.PrintWriter; import java.util.List; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.apache.struts2.ServletActionContext; import com.opensymphony.xwork2.ActionSupport; import com.bean.*; import com.dao.*; public class Func extends ActionSupport { private List<DoctorBean> list; public List<DoctorBean> getList() { return list; } public void setList(List<DoctorBean> list) { this.list = list; } public String execute() throws Exception { HttpServletResponse response=null; response=ServletActionContext.getResponse(); response.setContentType("text/html;charset=UTF-8"); response.setCharacterEncoding("UTF-8"); PrintWriter out = response.getWriter(); return SUCCESS; } private boolean isInvalid(String value) { return (value == null || value.length() == 0); } public static void main(String[] args) { System.out.println(); } }
b379eb12a778306462a1e25c28dca5b2ed2263d5
87ef261704a8a0691de0b8913d8135d8eb469dfb
/Clase3/ChristianJimbo/src/christianjimbo1/Principal.java
dbc1d6cd4587a1564a64d48977d9983840a6c5ae
[]
no_license
cfjimbo/fp-utpl-18-ejercicios
f90cf1445c32cba6f81211f3b4fef1412bae7d0f
42ac6a1d2cf8f7543df8ae7f9f5ef582147eb0b7
refs/heads/master
2020-03-10T08:21:47.336392
2019-01-14T20:04:33
2019-01-14T20:04:33
129,283,478
0
0
null
null
null
null
UTF-8
Java
false
false
3,437
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 christianjimbo1; /** * * @author Usuario */ public class Principal { public static void main(String[] args) { EquipoFutbol [] lista_equipos = new EquipoFutbol [5]; //Declaracion Arreglo EquipoFutbol n = new EquipoFutbol(); // Llamo a la clase Estudiante con la nueva variable asignada m. n.agregar_nombres("Liga de Quito"); // Llamo al método agregar_nombres de la clase Estudiante y le añado la cadena Christian. int codigo = 1; // Lista con notas double. n.agregar_codigos(codigo); // Llamo al método agregar_notas de la clase Estudiante. int puntajefinal = 10; // Lista con notas double. n.puntaje_final(puntajefinal); EquipoFutbol m = new EquipoFutbol(); // Llamo a la clase Estudiante con la nueva variable asignada m. m.agregar_nombres("Barcelona"); // Llamo al método agregar_nombres de la clase Estudiante y le añado la cadena Christian. int codigo1 = 2; // Lista con notas double. m.agregar_codigos(codigo1); // Llamo al método agregar_notas de la clase Estudiante. int puntajefinal1 = 7; // Lista con notas double. m.puntaje_final(puntajefinal1); EquipoFutbol a = new EquipoFutbol(); // Llamo a la clase Estudiante con la nueva variable asignada m. a.agregar_nombres("Emelec"); // Llamo al método agregar_nombres de la clase Estudiante y le añado la cadena Christian. int codigo2 = 3; // Lista con notas double. a.agregar_codigos(codigo2); // Llamo al método agregar_notas de la clase Estudiante. int puntajefinal2 = 5; // Lista con notas double. a.puntaje_final(puntajefinal2); EquipoFutbol b = new EquipoFutbol(); // Llamo a la clase Estudiante con la nueva variable asignada m. b.agregar_nombres("U. Catolica"); // Llamo al método agregar_nombres de la clase Estudiante y le añado la cadena Christian. int codigo3 = 4; // Lista con notas double. b.agregar_codigos(codigo3); // Llamo al método agregar_notas de la clase Estudiante. int puntajefinal3 = 9; // Lista con notas double. b.puntaje_final(puntajefinal3); EquipoFutbol c = new EquipoFutbol(); // Llamo a la clase Estudiante con la nueva variable asignada m. c.agregar_nombres("Aucas"); // Llamo al método agregar_nombres de la clase Estudiante y le añado la cadena Christian. int codigo4 = 5; // Lista con notas double. c.agregar_codigos(codigo4); // Llamo al método agregar_notas de la clase Estudiante. int puntajefinal4 = 8; // Lista con notas double. c.puntaje_final(puntajefinal4); lista_equipos[0] = n; // lista_estudiantes en la posición 0 asignada a m. lista_equipos[1] = m; // lista_estudiantes en la posición 0 asignada a n. lista_equipos[2] = a; lista_equipos[3] = b; lista_equipos[4] = c; Operador operador = new Operador(); // Llamo a la clase Paralelo con la nueva variable asignada paralelo. operador.agregar_equipos(lista_equipos); // Llamo al método agregar_estudiantes de la clase Paralelo y le añado la lista_estudiantes. operador.presentar_datos(); } }
0409b72f6e714e10e608e709b3f082c8a7ca3597
e6a2f92760f34dab03b31567e7e923e51b3aaa18
/src/main/java/com/code4people/jsonrpclib/binding/annotations/ParamsType.java
05cd23a45a2bfde6da6dca65935a64662af83d95
[]
no_license
code4people/json-rpc-lib-binding
399bc382dc90b9e47cf13af472b4029cc690897a
f82f664baaa684457179061c1b4a00d44e893af9
refs/heads/master
2018-12-19T03:18:51.212566
2018-09-16T11:04:04
2018-09-16T11:04:04
115,360,520
0
0
null
2018-03-25T21:07:15
2017-12-25T20:02:55
Java
UTF-8
Java
false
false
115
java
package com.code4people.jsonrpclib.binding.annotations; public enum ParamsType { DEFAULT, NAMED, POSITIONAL }
72bd82aee9274341c1851618c85ba5bef6d44b19
1f19aec2ecfd756934898cf0ad2758ee18d9eca2
/u-1/u-13/u-13-f1179.java
4d22f56bd9d5e8d02fe0b5dec12e94f4b2eb8e40
[]
no_license
apertureatf/perftest
f6c6e69efad59265197f43af5072aa7af8393a34
584257a0c1ada22e5486052c11395858a87b20d5
refs/heads/master
2020-06-07T17:52:51.172890
2019-06-21T18:53:01
2019-06-21T18:53:01
193,039,805
0
0
null
null
null
null
UTF-8
Java
false
false
106
java
mastercard 5555555555554444 4012888888881881 4222222222222 378282246310005 6011111111111117 2658530105144
ad724999f19898a5d27bda8363c81ab93f39a168
e9a428ea570abbaf2d667385f3e1c16a16713992
/data-storage-service/src/main/java/com/mbrd/assignment/datastorageservice/consumer/MessageConsumer.java
e2ab62d81e778a1c8bdf2052f08971502822926d
[]
no_license
astshar/assignment
6bbacf173d3069b4e58ce1793b4953540c133a15
c3b4643698b782234c2910f8876808dc7d1f53b6
refs/heads/main
2022-12-31T07:34:14.890147
2020-10-25T13:00:47
2020-10-25T13:00:47
307,097,425
0
0
null
null
null
null
UTF-8
Java
false
false
1,906
java
package com.mbrd.assignment.datastorageservice.consumer; import java.io.IOException; import java.util.Objects; import javax.xml.bind.JAXBException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.amqp.core.Message; import org.springframework.amqp.core.Queue; import org.springframework.amqp.rabbit.annotation.RabbitListener; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.google.gson.Gson; import com.mbrd.assignment.datastorageservice.model.UserMessage; import com.mbrd.assignment.datastorageservice.service.StorageService; @Component public class MessageConsumer { @Autowired StorageService service; @Autowired Queue queue; private static final Logger LOGGER = LoggerFactory.getLogger(MessageConsumer.class); @RabbitListener(queues = "#{queue.getName()}") public void receive(Message msg) throws IOException, ClassNotFoundException, JAXBException { Gson gson = new Gson(); String jsonString = new String(msg.getBody()); UserMessage usermessage = gson.fromJson(jsonString, UserMessage.class); if (usermessage.getMethodType().equals("POST")) { String format = usermessage.getFormat(); if (format.equals("CSV") && !Objects.isNull(format)) { service.saveUserCSV(usermessage.getUser()); } else if (format.equals("XML") && !Objects.isNull(format)) { service.saveUserXML(usermessage.getUser()); } else { LOGGER.info("File Format Not Supported!"); } } else if (usermessage.getMethodType().equals("PUT")) { String format = usermessage.getFormat(); if (format.equals("CSV") && !Objects.isNull(format)) { service.updateUserCSV(usermessage.getUser()); } else if (format.equals("XML") && !Objects.isNull(format)) { service.updateUserXML(usermessage.getUser()); } else { LOGGER.info("File Format Not Supported!"); } } } }
3fc541a9f29e084a38d5f4585e049d790d90e4f4
4007f071832fde76e4b26e5b97a43a0136de924c
/app/src/main/java/com/sematec/imdb/ImdbOnlineDetailActivity.java
4f2937229f89701235abd0de3b4c7aa4cc5d5b36
[]
no_license
anddev98/IMDB
14c2381903feb8481be85bf97af811604477c3e4
4fd59466702b1841573a629c52e5d09627b4028b
refs/heads/master
2022-04-27T02:00:12.637161
2020-03-26T18:49:13
2020-03-26T18:49:13
250,344,821
0
0
null
null
null
null
UTF-8
Java
false
false
3,552
java
package com.sematec.imdb; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import com.google.gson.Gson; import com.loopj.android.http.AsyncHttpClient; import com.loopj.android.http.JsonHttpResponseHandler; import com.squareup.picasso.Picasso; import org.json.JSONObject; import Details.Details; import cz.msebera.android.httpclient.Header; public class ImdbOnlineDetailActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_imdb_online_detail); Intent intent = getIntent(); String ImdbId = intent.getStringExtra("id"); String address = "https://www.omdbapi.com/?i="+ImdbId+"&apikey=27e17400"; final TextView txtOnlineTitle = findViewById(R.id.txtOnlineTitle); final TextView txtOnlineYear = findViewById(R.id.txtOnlineYear); final TextView txtOnlineDirector = findViewById(R.id.txtOnlineDirector); final TextView txtOnlineActors = findViewById(R.id.txtOnlineActors); final TextView txtOnlineCountry = findViewById(R.id.txtOnlineCountry); final TextView txtOnlineLanguage = findViewById(R.id.txtOnlineLanguage); final ImageView imgOnlinePoster = findViewById(R.id.imgOnlinePoster); final Button btnSave = findViewById(R.id.btnSave); final ImdbDatabase db = new ImdbDatabase(ImdbOnlineDetailActivity.this,"Imdb",null,1); AsyncHttpClient client = new AsyncHttpClient(); client.get(address,new JsonHttpResponseHandler(){ @Override public void onSuccess(int statusCode, Header[] headers, JSONObject response) { super.onSuccess(statusCode, headers, response); Gson gson = new Gson(); Details details = gson.fromJson(response.toString(),Details.class); final String title = details.getTitle(); final String year = details.getYear(); final String director = details.getDirector(); final String country = details.getCountry(); final String language = details.getLanguage(); final String actors = details.getActors(); txtOnlineTitle.setText(title); txtOnlineYear.setText(year); txtOnlineDirector.setText(director); txtOnlineCountry.setText(country); txtOnlineLanguage.setText(language); txtOnlineActors.setText(actors); final String imageUrl = details.getPoster(); Picasso.get().load(imageUrl).into(imgOnlinePoster); btnSave.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { db.insertMovie(title,year,director,country,language,actors,imageUrl); Toast.makeText(ImdbOnlineDetailActivity.this,"Movie Save to Database",Toast.LENGTH_LONG).show(); } }); } @Override public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { super.onFailure(statusCode, headers, throwable, errorResponse); } }); } }
58c1cd57c09bf22ef5a2ee675a3590c9c9af176e
e9affefd4e89b3c7e2064fee8833d7838c0e0abc
/aws-java-sdk-route53resolver/src/main/java/com/amazonaws/services/route53resolver/model/ListFirewallRulesResult.java
4dd15d94aa1ea7e5a720712f6d1e6c3eb06a2783
[ "Apache-2.0" ]
permissive
aws/aws-sdk-java
2c6199b12b47345b5d3c50e425dabba56e279190
bab987ab604575f41a76864f755f49386e3264b4
refs/heads/master
2023-08-29T10:49:07.379135
2023-08-28T21:05:55
2023-08-28T21:05:55
574,877
3,695
3,092
Apache-2.0
2023-09-13T23:35:28
2010-03-22T23:34:58
null
UTF-8
Java
false
false
8,929
java
/* * Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.route53resolver.model; import java.io.Serializable; import javax.annotation.Generated; /** * * @see <a href="http://docs.aws.amazon.com/goto/WebAPI/route53resolver-2018-04-01/ListFirewallRules" target="_top">AWS * API Documentation</a> */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class ListFirewallRulesResult extends com.amazonaws.AmazonWebServiceResult<com.amazonaws.ResponseMetadata> implements Serializable, Cloneable { /** * <p> * If objects are still available for retrieval, Resolver returns this token in the response. To retrieve the next * batch of objects, provide this token in your next request. * </p> */ private String nextToken; /** * <p> * A list of the rules that you have defined. * </p> * <p> * This might be a partial list of the firewall rules that you've defined. For information, see * <code>MaxResults</code>. * </p> */ private java.util.List<FirewallRule> firewallRules; /** * <p> * If objects are still available for retrieval, Resolver returns this token in the response. To retrieve the next * batch of objects, provide this token in your next request. * </p> * * @param nextToken * If objects are still available for retrieval, Resolver returns this token in the response. To retrieve the * next batch of objects, provide this token in your next request. */ public void setNextToken(String nextToken) { this.nextToken = nextToken; } /** * <p> * If objects are still available for retrieval, Resolver returns this token in the response. To retrieve the next * batch of objects, provide this token in your next request. * </p> * * @return If objects are still available for retrieval, Resolver returns this token in the response. To retrieve * the next batch of objects, provide this token in your next request. */ public String getNextToken() { return this.nextToken; } /** * <p> * If objects are still available for retrieval, Resolver returns this token in the response. To retrieve the next * batch of objects, provide this token in your next request. * </p> * * @param nextToken * If objects are still available for retrieval, Resolver returns this token in the response. To retrieve the * next batch of objects, provide this token in your next request. * @return Returns a reference to this object so that method calls can be chained together. */ public ListFirewallRulesResult withNextToken(String nextToken) { setNextToken(nextToken); return this; } /** * <p> * A list of the rules that you have defined. * </p> * <p> * This might be a partial list of the firewall rules that you've defined. For information, see * <code>MaxResults</code>. * </p> * * @return A list of the rules that you have defined. </p> * <p> * This might be a partial list of the firewall rules that you've defined. For information, see * <code>MaxResults</code>. */ public java.util.List<FirewallRule> getFirewallRules() { return firewallRules; } /** * <p> * A list of the rules that you have defined. * </p> * <p> * This might be a partial list of the firewall rules that you've defined. For information, see * <code>MaxResults</code>. * </p> * * @param firewallRules * A list of the rules that you have defined. </p> * <p> * This might be a partial list of the firewall rules that you've defined. For information, see * <code>MaxResults</code>. */ public void setFirewallRules(java.util.Collection<FirewallRule> firewallRules) { if (firewallRules == null) { this.firewallRules = null; return; } this.firewallRules = new java.util.ArrayList<FirewallRule>(firewallRules); } /** * <p> * A list of the rules that you have defined. * </p> * <p> * This might be a partial list of the firewall rules that you've defined. For information, see * <code>MaxResults</code>. * </p> * <p> * <b>NOTE:</b> This method appends the values to the existing list (if any). Use * {@link #setFirewallRules(java.util.Collection)} or {@link #withFirewallRules(java.util.Collection)} if you want * to override the existing values. * </p> * * @param firewallRules * A list of the rules that you have defined. </p> * <p> * This might be a partial list of the firewall rules that you've defined. For information, see * <code>MaxResults</code>. * @return Returns a reference to this object so that method calls can be chained together. */ public ListFirewallRulesResult withFirewallRules(FirewallRule... firewallRules) { if (this.firewallRules == null) { setFirewallRules(new java.util.ArrayList<FirewallRule>(firewallRules.length)); } for (FirewallRule ele : firewallRules) { this.firewallRules.add(ele); } return this; } /** * <p> * A list of the rules that you have defined. * </p> * <p> * This might be a partial list of the firewall rules that you've defined. For information, see * <code>MaxResults</code>. * </p> * * @param firewallRules * A list of the rules that you have defined. </p> * <p> * This might be a partial list of the firewall rules that you've defined. For information, see * <code>MaxResults</code>. * @return Returns a reference to this object so that method calls can be chained together. */ public ListFirewallRulesResult withFirewallRules(java.util.Collection<FirewallRule> firewallRules) { setFirewallRules(firewallRules); return this; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getNextToken() != null) sb.append("NextToken: ").append(getNextToken()).append(","); if (getFirewallRules() != null) sb.append("FirewallRules: ").append(getFirewallRules()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof ListFirewallRulesResult == false) return false; ListFirewallRulesResult other = (ListFirewallRulesResult) obj; if (other.getNextToken() == null ^ this.getNextToken() == null) return false; if (other.getNextToken() != null && other.getNextToken().equals(this.getNextToken()) == false) return false; if (other.getFirewallRules() == null ^ this.getFirewallRules() == null) return false; if (other.getFirewallRules() != null && other.getFirewallRules().equals(this.getFirewallRules()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getNextToken() == null) ? 0 : getNextToken().hashCode()); hashCode = prime * hashCode + ((getFirewallRules() == null) ? 0 : getFirewallRules().hashCode()); return hashCode; } @Override public ListFirewallRulesResult clone() { try { return (ListFirewallRulesResult) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } }
[ "" ]
fb474d6522f62b7110fb252ed4edcde4da8d0fe0
161193381cb6a6f97066ff45ffb780d729bc4974
/app/src/main/java/com/sissichen/simpletodo/EditItemActivity.java
b2f2fec8618d02f3035820617b7b7d4d902e0428
[]
no_license
qianwen/Android-SimpleTodo
de843a960b0f573d270da893da05b0c151a32cd0
6954832f904fcec4ed5d21e352c225745f661981
refs/heads/master
2020-04-13T08:49:28.252308
2015-01-20T19:09:15
2015-01-20T19:09:15
29,459,728
0
0
null
null
null
null
UTF-8
Java
false
false
2,202
java
package com.sissichen.simpletodo; import android.content.Intent; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.EditText; public class EditItemActivity extends ActionBarActivity { private EditText etEditItem; private int itemPosition; private String originalValue; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_edit_item); etEditItem = (EditText) findViewById(R.id.etEditItem); originalValue = getIntent().getStringExtra("item_value"); //Place cursor at the end of text etEditItem.setText(""); etEditItem.append(originalValue); // Set the default position to be -1 if the data is not available itemPosition = getIntent().getIntExtra("item_position", -1); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_edit_item, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); return super.onOptionsItemSelected(item); } public void onSubmit(View v) { // closes current screen and returns to main list screen this.finish(); } public void onSaveChange(View view) { String input = etEditItem.getText().toString(); // No need to update the list if the value is if (originalValue.equals(input)) { setResult(RESULT_CANCELED); } else { Intent data = new Intent(); data.putExtra("new_value", input); data.putExtra("current_position", itemPosition); setResult(RESULT_OK, data); } this.finish(); } }
2d6ed900f763bb4986951411305614b16516e36e
9b75d8540ff2e55f9ff66918cc5676ae19c3bbe3
/cab.snapp.passenger.play_184.apk-decompiled/sources/cab/snapp/passenger/f/g.java
52533c42dcbaefb11f493388605dcad536352c12
[]
no_license
BaseMax/PopularAndroidSource
a395ccac5c0a7334d90c2594db8273aca39550ed
bcae15340907797a91d39f89b9d7266e0292a184
refs/heads/master
2020-08-05T08:19:34.146858
2019-10-06T20:06:31
2019-10-06T20:06:31
212,433,298
2
0
null
null
null
null
UTF-8
Java
false
false
7,839
java
package cab.snapp.passenger.f; import android.app.Activity; import android.app.Application; import android.content.Context; import android.content.Intent; import android.content.res.Configuration; import android.content.res.Resources; import android.os.Build; import android.os.LocaleList; import android.view.View; import cab.snapp.b.a; import cab.snapp.c.d; import cab.snapp.passenger.activities.root.RootActivity; import cab.snapp.passenger.data_access_layer.network.b; import java.util.Locale; public final class g { public static final int LOCALE_ARABIC = 50; public static final int LOCALE_ENGLISH = 20; public static final int LOCALE_FRENCH = 30; public static final int LOCALE_PERSIAN = 10; public static final int LOCALE_TURKISH = 40; /* renamed from: a reason: collision with root package name */ private static a f570a; /* renamed from: b reason: collision with root package name */ private static b f571b; public static void setSharedPreferencesManager(a aVar) { f570a = aVar; } public static void setNetworkModule(b bVar) { f571b = bVar; } public static int getSavedLocale() { a aVar = f570a; if (aVar == null) { return 10; } Integer num = (Integer) aVar.get("LOCALE_HELPER_SAVED_LOCALE_SHARED_PREF_KEY"); if (num != null) { return num.intValue(); } return 10; } public static void setLayoutDirectionBasedOnLocale(View view) { int savedLocale = getSavedLocale(); if (savedLocale != 0) { if (savedLocale == 10 || savedLocale == 40 || savedLocale == 50) { view.setLayoutDirection(1); } else { view.setLayoutDirection(0); } } } public static boolean changeAppLocale(Context context, int i) { String a2 = a(Integer.valueOf(i)); if (a2.length() == 0 || a(context, a2)) { return false; } a aVar = f570a; if (aVar != null) { aVar.put("LOCALE_HELPER_SAVED_LOCALE_SHARED_PREF_KEY", Integer.valueOf(i)); } changeAppLocaleFromSharedPrefIfNeeded(context, true); f571b.reset(); return true; } public static boolean changeAppLocaleFromSharedPrefIfNeeded(Context context, boolean z) { String a2 = a(Integer.valueOf(getSavedLocale())); if (a2.length() == 0 || a(context, a2)) { return false; } Locale locale = new Locale(a2); Locale.setDefault(locale); Resources resources = context.getApplicationContext().getResources(); Configuration configuration = new Configuration(resources.getConfiguration()); configuration.setLocale(locale); if (Build.VERSION.SDK_INT >= 24) { configuration.setLocales(new LocaleList(new Locale[]{locale})); } if (context instanceof Activity) { Activity activity = (Activity) context; activity.getBaseContext().getResources().updateConfiguration(configuration, resources.getDisplayMetrics()); if (z) { activity.startActivity(new Intent(activity, RootActivity.class)); activity.finish(); } } else if (context instanceof Application) { ((Application) context).getBaseContext().getResources().updateConfiguration(configuration, resources.getDisplayMetrics()); } return true; } private static boolean a(Context context, String str) { if (Build.VERSION.SDK_INT >= 24) { return str.equals(context.getResources().getConfiguration().getLocales().get(0).getLanguage()); } return str.equals(context.getResources().getConfiguration().locale.getLanguage()); } private static String a(Integer num) { String str = ""; if (num == null) { return str; } if (num.intValue() == 10) { str = "fa"; } else if (num.intValue() == 20) { str = "en"; } else if (num.intValue() == 30) { str = "fr"; } else if (num.intValue() == 40) { str = "ug"; } else if (num.intValue() == 50) { str = "ar"; } return str; } public static String getCurrentActiveLocaleString() { int savedLocale = getSavedLocale(); if (savedLocale == 20) { return "en-GB"; } if (savedLocale == 30) { return "fr-FR"; } if (savedLocale != 40) { return savedLocale != 50 ? "fa-IR" : "ar-IR"; } return "tr-TR"; } public static String getCurrentActiveLocaleLanguageString() { int savedLocale = getSavedLocale(); if (savedLocale == 20) { return "en"; } if (savedLocale == 30) { return "fr"; } if (savedLocale != 40) { return savedLocale != 50 ? "fa" : "ar"; } return "ug"; } public static String getCurrentActiveLocaleCountryString() { int savedLocale = getSavedLocale(); if (savedLocale == 20) { return "GB"; } if (savedLocale != 30) { return savedLocale != 40 ? "IR" : "CN"; } return "FR"; } public static String getRealCurrentActiveLocaleString() { int savedLocale = getSavedLocale(); if (savedLocale == 20) { return "en-GB"; } if (savedLocale == 30) { return "fr-FR"; } if (savedLocale != 40) { return savedLocale != 50 ? "fa-IR" : "ar-IR"; } return "ug-CN"; } public static boolean isCurrentLocalRtl() { int savedLocale = getSavedLocale(); return savedLocale == 10 || savedLocale == 40 || savedLocale == 50; } public static String changeNumbersBasedOnCurrentLocale(String str) { if (isCurrentLocalRtl()) { return d.convertEngToPersianNumbers(str); } return d.convertPersianToEnglishNumbers(str); } public static void setLocale(Application application) { if (application != null) { String currentActiveLocaleLanguageString = getCurrentActiveLocaleLanguageString(); String currentActiveLocaleCountryString = getCurrentActiveLocaleCountryString(); if (application.getBaseContext().getResources().getConfiguration().locale.getLanguage().equalsIgnoreCase(currentActiveLocaleLanguageString)) { a(application); return; } Locale.setDefault(new Locale(currentActiveLocaleLanguageString, currentActiveLocaleCountryString)); a(application); } } public static Context changeLocaleInContext(Context context) { if (Build.VERSION.SDK_INT < 24 || context == null) { return context; } try { return f.wrap(context, new Locale(getCurrentActiveLocaleLanguageString(), getCurrentActiveLocaleCountryString())); } catch (Exception e) { e.printStackTrace(); com.a.a.a.logException(e); return context; } } public static void release() { f570a = null; } private static void a(Application application) { Resources resources = application.getBaseContext().getResources(); Configuration configuration = new Configuration(resources.getConfiguration()); configuration.locale = Locale.getDefault(); if (Build.VERSION.SDK_INT >= 24) { configuration.setLocales(new LocaleList(new Locale[]{Locale.getDefault()})); } resources.updateConfiguration(configuration, resources.getDisplayMetrics()); } }
cdc6eb6ff0f175e6eff9c3ced5db0606485a00bb
b6d233a1f5f8196eb1cada7858d2e71935239ccb
/src/main/java/de/ianfd/led/ledappspring/effects/Colorspinner.java
4b2bd287380e04bfa6b9373fd92e8778c86b0cfe
[]
no_license
ianfd/LedControl
f3100e09547e0a55d2cbc41b574ed9fa2d71b189
c811e0a690d7700c0546b1d8020581f47540acee
refs/heads/master
2023-06-02T12:13:26.341700
2021-04-19T13:27:27
2021-04-19T13:27:27
379,918,543
0
0
null
null
null
null
UTF-8
Java
false
false
991
java
package de.ianfd.led.ledappspring.effects; /* * Created by ian on 26.01.21 * Location: de.ianfd.led.ledappspring.effects * Created for the project ledapp-spring with the name Colorspinner */ import com.github.mbelling.ws281x.Color; import com.github.mbelling.ws281x.Ws281xLedStrip; public class Colorspinner extends BasicEffect { private Utils utils; private int currentPos = 0; private int brightness = 125; public Colorspinner(String name, int delay, Utils utils) { super(name, delay); this.utils = utils; } @Override public void firstFrame(Ws281xLedStrip ws281xLedStrip) { } @Override public void runFrame(Ws281xLedStrip ws281xLedStrip) { if (currentPos >= ws281xLedStrip.getLedsCount()) currentPos = 0; Color c = utils.colorWheel(currentPos + 200); ws281xLedStrip.setPixel(currentPos, c); System.out.println("rendering!"); ws281xLedStrip.render(); currentPos++; } }
cb7ea559993c7fa5d4a7a97e7e84f4e958cf4105
03f594cc5d69bd78c26ed34a37e282cf458ad7db
/src/main/java/com/rayootech/controller/user/OrganizationController.java
b0ae5e13f2261bb8c3152775077ec60b5405b649
[]
no_license
Fightingmhao/system102_echartDemo
841a4aa39311642da4dc7bb70c878f0125c7aa58
15fa3b06abef7c83f0e7ddc97e7263e05fd6328b
refs/heads/master
2023-02-20T20:07:13.733930
2021-01-21T02:04:37
2021-01-21T02:04:37
331,486,778
0
0
null
null
null
null
UTF-8
Java
false
false
5,606
java
package com.rayootech.controller.user; import com.rayootech.bean.Org; import com.rayootech.bean.Organization; import com.rayootech.bean.Vo.TreeSelect; import com.rayootech.constant.Constants; import com.rayootech.resultInfo.ResponseEnum; import com.rayootech.resultInfo.ResponseVo; import com.rayootech.service.IMenuService; import com.rayootech.service.IOrganizationService; import com.rayootech.utils.StringUtils; import com.rayootech.utils.excelUtils.ReadExcel; import org.apache.commons.lang3.ArrayUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import java.io.IOException; import java.text.ParseException; import java.util.Iterator; import java.util.List; /** * @author luchunfang * @version 1.0 * @created 2020/11/10 13:20 */ @RestController @RequestMapping("org") public class OrganizationController { @Autowired private IOrganizationService organizationService; @Autowired private IMenuService menuService; @PostMapping("/addBatch") public ResponseVo<Object> addBatch(@RequestParam("file")MultipartFile file) throws ParseException { ReadExcel readExcel = new ReadExcel(file); List<Organization> value = readExcel.getValue(); return organizationService.insertOrganizations(value); } @GetMapping("/importTemplate") public ResponseVo<Object> importTemplate() throws IOException { return organizationService.importTemplate(); } @GetMapping("/test") public ResponseVo<Object> test() throws IOException { return organizationService.test(); } /** * 获取部门列表 */ @GetMapping("/list") public ResponseVo<Object> list(Org org) { List<Org> orgs = organizationService.selectOrgList(org); return ResponseVo.success(orgs); } /** * 根据部门id查询其下级部门和岗位 * */ @GetMapping("/seachPostByOrgId/{orgId}") public ResponseVo<Object> seachPostByOrgId(@PathVariable(value = "orgId", required = false) Long orgId) { List<Org> orgs = organizationService.seachPostByOrgId(orgId); return ResponseVo.success(orgs); } /** * 查询部门列表(排除节点) */ @GetMapping("/list/exclude/{orgId}") public ResponseVo<Object> excludeChild(@PathVariable(value = "orgId", required = false) Long orgId) { List<Org> orgs = organizationService.selectOrgList(new Org()); Iterator<Org> it = orgs.iterator(); while (it.hasNext()) { Org d = (Org) it.next(); if (d.getOrgId().intValue() == orgId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), orgId + "")) { it.remove(); } } return ResponseVo.success(orgs); } /** * 获取组织下拉树列表 */ @GetMapping("/treeselect") public ResponseVo<Object> treeselect(Org org) { List<Org> orgs = organizationService.selectOrgList(org); List<TreeSelect> list = organizationService.buildOrgTreeSelect(orgs); return ResponseVo.success(list); } /** * 新增部门 */ @PostMapping("/addOrg") public ResponseVo<Object> add(@Validated @RequestBody Org org) { if (Constants.NOT_UNIQUE.equals(organizationService.checkOrgNameUnique(org))) { return ResponseVo.error("新增部门'" + org.getOrgName() + "'失败,部门名称已存在"); } if(organizationService.insertOrg(org) == 0){ return ResponseVo.error(ResponseEnum.ERROR); } return ResponseVo.successByMsg("插入成功"); } /** * 删除部门 */ @DeleteMapping("/delete/{orgId}") public ResponseVo<Object> remove(@PathVariable Long orgId) { if (organizationService.hasChildByOrgId(orgId)) { return ResponseVo.error("存在下级部门,不允许删除"); } if (organizationService.checkOrgExistUser(orgId)) { return ResponseVo.error("部门存在用户,不允许删除"); } if(organizationService.deleteOrgById(orgId) == 0){ return ResponseVo.error(ResponseEnum.ERROR); } return ResponseVo.successByMsg("删除成功"); } /** * 根据部门编号获取详细信息 */ @GetMapping(value = "/getInfo/{orgId}") public ResponseVo<Object> getInfo(@PathVariable Long orgId) { return ResponseVo.success(organizationService.selectOrgById(orgId)); } /** * 修改部门 */ @PutMapping("/updateOrg") public ResponseVo<Object> edit(@Validated @RequestBody Org org) { if (Constants.NOT_UNIQUE.equals(organizationService.checkOrgNameUnique(org))) { return ResponseVo.error("修改部门'" + org.getOrgName() + "'失败,部门名称已存在"); } if(organizationService.updateOrg(org) == 0){ return ResponseVo.error(ResponseEnum.ERROR); } return ResponseVo.successByMsg("更新成功"); } @GetMapping("/getDeptName") public ResponseVo<Object> getDeptNa(){ return organizationService.getDetNa(); } @GetMapping("/getDeptByUser/{name}") public ResponseVo<Object> getDeptByUser(@PathVariable String name){ return organizationService.getDeptByUser(name); } }
99a5445b667e53821cd04fad7f437ef937982d3c
fa32414cd8cb03a7dc3ef7d85242ee7914a2f45f
/app/src/main/java/com/google/android/gms/tagmanager/zzat.java
1b9318738e58797301d36179db31236c075c5bcd
[]
no_license
SeniorZhai/Mob
75c594488c4ce815a1f432eb4deacb8e6f697afe
cac498f0b95d7ec6b8da1275b49728578b64ef01
refs/heads/master
2016-08-12T12:49:57.527237
2016-03-10T06:57:09
2016-03-10T06:57:09
53,562,752
4
2
null
null
null
null
UTF-8
Java
false
false
2,595
java
package com.google.android.gms.tagmanager; import android.content.Context; import java.io.ByteArrayOutputStream; import java.io.OutputStream; import java.io.PrintStream; import java.util.concurrent.LinkedBlockingQueue; class zzat extends Thread implements zzas { private static zzat zzaLP; private volatile boolean mClosed = false; private final Context mContext; private volatile boolean zzKU = false; private final LinkedBlockingQueue<Runnable> zzaLO = new LinkedBlockingQueue(); private volatile zzau zzaLQ; private zzat(Context context) { super("GAThread"); if (context != null) { this.mContext = context.getApplicationContext(); } else { this.mContext = context; } start(); } static zzat zzaH(Context context) { if (zzaLP == null) { zzaLP = new zzat(context); } return zzaLP; } private String zzd(Throwable th) { OutputStream byteArrayOutputStream = new ByteArrayOutputStream(); PrintStream printStream = new PrintStream(byteArrayOutputStream); th.printStackTrace(printStream); printStream.flush(); return new String(byteArrayOutputStream.toByteArray()); } public void run() { while (!this.mClosed) { try { Runnable runnable = (Runnable) this.zzaLO.take(); if (!this.zzKU) { runnable.run(); } } catch (InterruptedException e) { zzbg.zzaA(e.toString()); } catch (Throwable th) { zzbg.zzaz("Error on Google TagManager Thread: " + zzd(th)); zzbg.zzaz("Google TagManager is shutting down."); this.zzKU = true; } } } public void zzew(String str) { zzh(str, System.currentTimeMillis()); } public void zzf(Runnable runnable) { this.zzaLO.add(runnable); } void zzh(String str, long j) { final zzat com_google_android_gms_tagmanager_zzat = this; final long j2 = j; final String str2 = str; zzf(new Runnable(this) { final /* synthetic */ zzat zzaLT; public void run() { if (this.zzaLT.zzaLQ == null) { zzcu zzzz = zzcu.zzzz(); zzzz.zza(this.zzaLT.mContext, com_google_android_gms_tagmanager_zzat); this.zzaLT.zzaLQ = zzzz.zzzC(); } this.zzaLT.zzaLQ.zzg(j2, str2); } }); } }
4af0018c37ae684ca9e86e18b620c5f8317160f6
82915a6b4cc9f75df740d8d4966fa8c529e147eb
/src/gov/nasa/worldwind/view/OrbitViewModel.java
696f62fa8d499469251fb7d1db76ab04a08be773
[]
no_license
mdmzero0/WorldWind-Source
0365eacf71fb86602b9ecf7752e6d3b234710bc7
f6158e385a2b0efc94cec5cee7367482ace596e9
refs/heads/master
2020-12-25T10:59:39.731966
2011-07-29T12:12:14
2011-07-29T12:12:14
1,949,055
0
1
null
null
null
null
UTF-8
Java
false
false
998
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package gov.nasa.worldwind.view; import gov.nasa.worldwind.geom.Angle; import gov.nasa.worldwind.geom.Matrix; import gov.nasa.worldwind.geom.Position; import gov.nasa.worldwind.geom.Vec4; import gov.nasa.worldwind.globes.Globe; public abstract interface OrbitViewModel { public abstract Matrix computeTransformMatrix(Globe paramGlobe, Position paramPosition, Angle paramAngle1, Angle paramAngle2, double paramDouble); public abstract ModelCoordinates computeModelCoordinates(Globe paramGlobe, Vec4 paramVec41, Vec4 paramVec42, Vec4 paramVec43); public abstract ModelCoordinates computeModelCoordinates(Globe paramGlobe, Matrix paramMatrix, Vec4 paramVec4); public static abstract interface ModelCoordinates { public abstract Position getCenterPosition(); public abstract Angle getHeading(); public abstract Angle getPitch(); public abstract double getZoom(); } }
92de980def8127be1146b8624a97c02401d5f293
0987f02b4e17dd302b05734b8f18b9f523e6f999
/src/strings/Bank.java
72ef64bdaf63a1b3f5bce2b8e55f867a35aff324
[]
no_license
smrcc/CollectionsRepo
6a0378a8a7861fcf829ae7bb9e11b4f9b0ea3a36
e900c7cc201f5859a02b58827070956c459fc932
refs/heads/master
2020-05-30T15:19:15.047746
2019-06-02T06:56:02
2019-06-02T06:56:02
189,815,377
0
0
null
null
null
null
UTF-8
Java
false
false
576
java
package strings; public interface Bank { float rateofIntrest(); } class indian implements Bank { @Override public float rateofIntrest() { System.out.println("that is my opinion"); System.out.println("ROI :+ rateof intrest is 7.5"); return 7.5f; } } class uco extends indian { public float rateofIntrest() { System.out.println("i am not looser"); System.out.println("ROI :+ rateof intrest is 9.5"); return 8.5f; } public static void main(String args[]) { Bank b=new uco(); b.rateofIntrest(); Bank bb=new indian(); bb.rateofIntrest(); } }
a140ee26becb3dad7e92a6585c035dcc78b0c812
0c1f4b9856281f3587516758fa2d9b693139729f
/RemoteStar_HXD_SDK/src/et/song/remotestar/FragmentDevice.java
826771348aa2a5f3240bd915a49a865fc4bc8092
[]
no_license
plm479104792/homecoo-phone
cff6361e51d736b03df83e09f2585f063f210a05
5e7b8a26306b3ad78bf41ec99a2690bb13a054c3
refs/heads/master
2020-06-02T14:32:07.541380
2017-06-13T02:03:56
2017-06-13T02:03:56
94,094,452
1
1
null
null
null
null
UTF-8
Java
false
false
14,622
java
package et.song.remotestar; import com.actionbarsherlock.app.SherlockFragment; import com.actionbarsherlock.view.MenuItem; import et.song.db.ETDB; import et.song.device.DeviceType; import et.song.etclass.ETDevice; import et.song.etclass.ETGroup; import et.song.etclass.ETPage; import et.song.etclass.ETSave; import et.song.face.IBack; import et.song.global.ETGlobal; import et.song.jni.ir.ETIR; import et.song.remotestar.hxd.sdk.R; import et.song.tool.ETTool; import android.annotation.SuppressLint; import android.app.AlertDialog; import android.app.Dialog; import android.content.BroadcastReceiver; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.IntentFilter; import android.graphics.Color; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentTransaction; import android.util.Log; import android.view.ContextMenu; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.ContextMenu.ContextMenuInfo; import android.widget.AdapterView; import android.widget.BaseAdapter; import android.widget.EditText; import android.widget.GridView; import android.widget.ImageView; import android.widget.TextView; import android.widget.AdapterView.AdapterContextMenuInfo; import android.widget.AdapterView.OnItemClickListener; public class FragmentDevice extends SherlockFragment implements IBack{ private GridView mGridView; private int mGroupIndex; private RecvReceiver mReceiver; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setHasOptionsMenu(true); ((ActivityMain)getActivity()).ShowBottom(); ETPage.getInstance(this.getActivity()).Load(ETDB.getInstance(this.getActivity())); mGroupIndex = getArguments().getInt("group"); String[] devices = getResources().getStringArray(R.array.strs_device); ETGroup group = (ETGroup) ETPage.getInstance(getActivity()).GetItem( mGroupIndex); ETDevice device = (ETDevice) group.GetItem(group.GetCount() - 1); device.SetName(devices[devices.length - 1]); int count = ETIR.SearchAirCode(0, 0, 0); if (count >= 100) { ETTool.MessageBox(getActivity(), 1.0f, getString(R.string.str_caoma), true); } // if (ETGlobal.mTg == null) { // Dialog alertDialog = new AlertDialog.Builder(getActivity()) // .setMessage(R.string.str_study_start_info_6) // .setIcon(R.drawable.ic_launcher) // .setNegativeButton(R.string.str_buy_no, // new DialogInterface.OnClickListener() { // @Override // public void onClick(DialogInterface dialog, // int which) { // Intent intent = new Intent( // ETGlobal.BROADCAST_APP_BUY_NO); // getActivity().sendBroadcast(intent); // } // }) // .setPositiveButton(R.string.str_buy_yes, // new DialogInterface.OnClickListener() { // @Override // public void onClick(DialogInterface dialog, // int which) { // Intent intent = new Intent( // ETGlobal.BROADCAST_APP_BUY_YES); // getActivity().sendBroadcast(intent); // } // }).create(); // alertDialog.show(); // } } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { this.getActivity().setTitle(R.string.str_device); View view = inflater .inflate(R.layout.fragment_device, container, false); mGridView = (GridView) view.findViewById(R.id.grid); mGridView.setBackgroundColor(Color.TRANSPARENT); mGridView.setAdapter(new GridAdapter(getActivity())); mGridView.setOnItemClickListener(new ItemClickListener()); //mGridView.setOnItemLongClickListener(new ItemLongClickListener()); registerForContextMenu(mGridView); return view; } @Override public void onStart() { super.onStart(); getSherlockActivity().getSupportActionBar().setDisplayHomeAsUpEnabled( true); getSherlockActivity().getSupportActionBar().setHomeButtonEnabled(true); mReceiver = new RecvReceiver(); IntentFilter filter = new IntentFilter(); filter.addAction(ETGlobal.BROADCAST_APP_BACK); getActivity().registerReceiver(mReceiver, filter); } @Override public void onStop() { super.onStop(); getActivity().unregisterReceiver(mReceiver); } private void F5() { FragmentDevice fragmentDevice = new FragmentDevice(); FragmentTransaction transaction = getActivity() .getSupportFragmentManager().beginTransaction(); Bundle args = new Bundle(); args.putInt("group", mGroupIndex); fragmentDevice.setArguments(args); transaction.replace(R.id.fragment_container, fragmentDevice); //transaction.addToBackStack(null); transaction.commit(); } @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { // TODO Auto-generated method stub getActivity().getMenuInflater().inflate(R.menu.menu_device_longclick, menu); } @SuppressLint("InflateParams") @Override public boolean onContextItemSelected(android.view.MenuItem item) { AdapterContextMenuInfo menuInfo = (AdapterContextMenuInfo) item .getMenuInfo(); ETGroup group = (ETGroup) ETPage.getInstance(getActivity()).GetItem( mGroupIndex); final ETDevice device = (ETDevice)group.GetItem(menuInfo.position); if (device.GetType() == DeviceType.DEVICE_ADD){ return true; } int id=item.getItemId(); if (id==R.id.menu_device_del) { device.Delete(ETDB.getInstance(getActivity())); F5(); ETSave.getInstance(getActivity()).put("DeviceType", ""); }else if (id==R.id.menu_device_rename) { LayoutInflater mInflater = LayoutInflater.from(getActivity()); View addView = mInflater.inflate(R.layout.dialog_set_name, null); final EditText name = (EditText) addView .findViewById(R.id.edit_name); name.setText(device.GetName()); AlertDialog DialogSetName = new AlertDialog.Builder(getActivity()) .setIcon(R.drawable.ic_launcher) .setView(addView) .setPositiveButton(R.string.str_ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { device.SetName(name.getText().toString()); device.Update(ETDB.getInstance(getActivity())); F5(); } }).create(); DialogSetName.setTitle(R.string.str_dialog_set_name_title); DialogSetName.show(); return true; } // switch (item.getItemId()) { // case R.id.menu_device_del: // device.Delete(ETDB.getInstance(getActivity())); // F5(); // ETSave.getInstance(getActivity()).put("DeviceType", ""); // return true; /* true means: "we handled the event". */ // case R.id.menu_device_rename: // LayoutInflater mInflater = LayoutInflater.from(getActivity()); // View addView = mInflater.inflate(R.layout.dialog_set_name, null); // final EditText name = (EditText) addView // .findViewById(R.id.edit_name); // name.setText(device.GetName()); // AlertDialog DialogSetName = new AlertDialog.Builder(getActivity()) // .setIcon(R.drawable.ic_launcher) // .setView(addView) // .setPositiveButton(R.string.str_ok, // new DialogInterface.OnClickListener() { // public void onClick(DialogInterface dialog, // int whichButton) { // device.SetName(name.getText().toString()); // device.Update(ETDB.getInstance(getActivity())); // F5(); // } // }).create(); // // DialogSetName.setTitle(R.string.str_dialog_set_name_title); // DialogSetName.show(); // return true; // } return super.onContextItemSelected(item); } @Override public boolean onOptionsItemSelected(MenuItem item) { Log.i("Home", "Home"); switch (item.getItemId()) { case android.R.id.home: Back(); return true; } return super.onOptionsItemSelected(item); } private class ItemClickListener implements OnItemClickListener { @Override public void onItemClick(AdapterView<?> arg0, View view, int pos, long arg3) { ((ActivityMain)getActivity()).HideBottom(); ETDevice device = (ETDevice) arg0.getItemAtPosition(pos); FragmentTransaction transaction = getActivity() .getSupportFragmentManager().beginTransaction(); if (device.GetType() == DeviceType.DEVICE_ADD) { // Bundle args = new Bundle(); // args.putInt("group", mGroupIndex); // FragmentWizards fragmentWizards = new FragmentWizards(); // fragmentWizards.setArguments(args); // transaction.setCustomAnimations(R.anim.push_left_in, // R.anim.push_left_out, R.anim.push_left_in, // R.anim.push_left_out); // // transaction.replace(R.id.fragment_container, fragmentWizards); // // transactionBt.addToBackStack(null); // transaction // .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); // transaction.commit(); Bundle args = new Bundle(); args.putInt("group", mGroupIndex); FragmentWizardsOne fragmentWizardsOne = new FragmentWizardsOne(); fragmentWizardsOne.setArguments(args); transaction.replace(R.id.fragment_container, fragmentWizardsOne); //transaction.addToBackStack(null); transaction.commit(); } else { Fragment fragment = null; Bundle args = new Bundle(); args.putInt("group", mGroupIndex); args.putInt("device", pos); switch (device.GetType()) { case DeviceType.DEVICE_REMOTE_TV: fragment = new FragmentTV(); fragment.setArguments(args); transaction.replace(R.id.fragment_container, fragment); break; case DeviceType.DEVICE_REMOTE_IPTV: fragment = new FragmentIPTV(); fragment.setArguments(args); transaction.replace(R.id.fragment_container, fragment); break; case DeviceType.DEVICE_REMOTE_STB: fragment = new FragmentSTB(); fragment.setArguments(args); transaction.replace(R.id.fragment_container, fragment); break; case DeviceType.DEVICE_REMOTE_DVD: fragment = new FragmentDVD(); fragment.setArguments(args); transaction.replace(R.id.fragment_container, fragment); break; case DeviceType.DEVICE_REMOTE_FANS: fragment = new FragmentFans(); fragment.setArguments(args); transaction.replace(R.id.fragment_container, fragment); break; case DeviceType.DEVICE_REMOTE_PJT: fragment = new FragmentPJT(); fragment.setArguments(args); transaction.replace(R.id.fragment_container, fragment); break; case DeviceType.DEVICE_REMOTE_LIGHT: fragment = new FragmentLight(); fragment.setArguments(args); transaction.replace(R.id.fragment_container, fragment); break; case DeviceType.DEVICE_REMOTE_AIR: fragment = new FragmentAIR(); fragment.setArguments(args); transaction.replace(R.id.fragment_container, fragment); break; case DeviceType.DEVICE_REMOTE_DC: fragment = new FragmentDC(); fragment.setArguments(args); transaction.replace(R.id.fragment_container, fragment); break; case DeviceType.DEVICE_REMOTE_POWER: fragment = new FragmentPOWER(); fragment.setArguments(args); transaction.replace(R.id.fragment_container, fragment); break; case DeviceType.DEVICE_REMOTE_CUSTOM: fragment = new FragmentCustom(); fragment.setArguments(args); transaction.replace(R.id.fragment_container, fragment); break; } // transaction.setCustomAnimations(R.anim.push_left_in, // R.anim.push_left_out, R.anim.push_left_in, // R.anim.push_left_out); transaction.replace(R.id.fragment_container, fragment); // transactionBt.addToBackStack(null); // transaction // .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); transaction.commit(); } } } // private class ItemLongClickListener implements OnItemLongClickListener { // // @Override // public boolean onItemLongClick(AdapterView<?> arg0, View view, int pos, // long arg3) { // // return true; // } // // } private class GridAdapter extends BaseAdapter { private LayoutInflater mInflater; public GridAdapter(Context context) { mInflater = LayoutInflater.from(context); } @Override public int getCount() { ETGroup group = (ETGroup) ETPage.getInstance(getActivity()) .GetItem(mGroupIndex); return group.GetCount(); } @Override public Object getItem(int position) { ETGroup group = (ETGroup) ETPage.getInstance(getActivity()) .GetItem(mGroupIndex); return group.GetItem(position); } @Override public long getItemId(int position) { return position; } @SuppressLint("InflateParams") @Override public View getView(int position, View convertView, ViewGroup par) { ViewHolder holder = null; if (convertView == null) { convertView = mInflater.inflate(R.layout.fragment_grid_item, null); holder = new ViewHolder(); holder.image_grid_item_res = ((ImageView) convertView .findViewById(R.id.image_grid_item_res)); holder.text_grid_item_name = ((TextView) convertView .findViewById(R.id.text_grid_item_name)); holder.text_grid_item_context = ((TextView) convertView .findViewById(R.id.text_grid_item_context)); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } ETGroup group = (ETGroup) ETPage.getInstance(getActivity()) .GetItem(mGroupIndex); ETDevice device = (ETDevice) group.GetItem(position); holder.image_grid_item_res .setImageResource(ETGlobal.mDeviceImages[device.GetRes()]); holder.text_grid_item_name.setText(device.GetName()); holder.text_grid_item_context.setText(""); return convertView; } private class ViewHolder { ImageView image_grid_item_res; TextView text_grid_item_name; TextView text_grid_item_context; } } @Override public void Back() { // // TODO Auto-generated method stub FragmentGroup fragmentGroup = new FragmentGroup(); FragmentTransaction transaction = getActivity() .getSupportFragmentManager().beginTransaction(); // transaction.setCustomAnimations(R.anim.push_left_in, // R.anim.push_left_out, R.anim.push_left_in, // R.anim.push_left_out); transaction.replace(R.id.fragment_container, fragmentGroup); // transactionBt.addToBackStack(null); // transaction // .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); transaction.commit(); //((ActivityMain)getActivity()).exit(); } public class RecvReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (action.equals(ETGlobal.BROADCAST_APP_BACK)) { Back(); } } } }
469219f1ca2ab0ed655474e204fa1a1a2ef8b9a7
ce84551d9a90e0666b05763846ea9c3f0b72a69d
/fr.centralesupelec.csd.ejava/src/fr/centralesupelec/csd/ejava/impl/DoubleLiteralExprImpl.java
d3f93ccdeaa072bf2f1a12c267f788979155085d
[ "Apache-2.0" ]
permissive
marcadetd/javaparser.ecore
2ec0caed9fc2a85497fe2738f87bf9db23232866
1df87c42d81c82287a81b3f3332f809812aea85d
refs/heads/master
2023-04-01T11:48:49.615941
2021-03-19T13:13:43
2021-03-19T13:13:43
342,150,597
0
0
null
null
null
null
UTF-8
Java
false
false
1,327
java
/** * Copyright (c) 2021 CentraleSupélec. * This program and the accompanying materials are made * available under the terms of the Apache License version 2.0 * which accompanies this distribution, and is available at * http://www.apache.org/licenses/LICENSE-2.0 * * Contributors: * Computer Science Department, CentraleSupélec * Contacts: * [email protected] * Web site: * https://github.com/marcadetd/javaparser.ecore * */ package fr.centralesupelec.csd.ejava.impl; import org.eclipse.emf.ecore.EClass; import fr.centralesupelec.csd.ejava.DoubleLiteralExpr; import fr.centralesupelec.csd.ejava.EJavaPackage; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Double Literal Expr</b></em>'. * <!-- end-user-doc --> * * @generated */ public class DoubleLiteralExprImpl extends LiteralStringValueExprImpl implements DoubleLiteralExpr { /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected DoubleLiteralExprImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return EJavaPackage.Literals.DOUBLE_LITERAL_EXPR; } } //DoubleLiteralExprImpl
23661cb21b73f76684e35ec6f4d4f8c84888ac06
5409c1c040e03d3ed5d7c5055586061b7a34f8c5
/app/src/test/java/com/example/limaofang/myapplication/ExampleUnitTest.java
60e9775d979929ab056d10e45c93130aa3231849
[]
no_license
limaofang4/lmfsiwo
6eeb3653ed4bbb2afb07f295ac6f5a99630e49dd
037b65d753de1d0a3e8dffdcbb1c5ccf8488cd39
refs/heads/master
2021-01-12T06:37:06.553532
2016-12-27T12:25:10
2016-12-27T12:25:10
77,396,039
0
0
null
null
null
null
UTF-8
Java
false
false
413
java
package com.example.limaofang.myapplication; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
c00f92a2e20c367585991ac5fa042c8f6b3f1451
8af6df7507975fb7830828a3b46a1452fa6bf8e4
/src/main/java/com/archsystemsinc/qam/repository/QamEnvironmentChangeFormRepository.java
42d6cfe31b35d262451f0ddfd3831f5c56d948ed
[]
no_license
Archsystemsllc/radservices
9d9e147c73d8cf2de530e2d50a4220f20dc8cfcd
486c7fa75700647b75e394cf2ea955f787528d8c
refs/heads/master
2021-06-11T13:26:28.201757
2019-09-14T03:57:19
2019-09-14T03:57:19
109,892,514
0
0
null
null
null
null
UTF-8
Java
false
false
6,005
java
package com.archsystemsinc.qam.repository; import java.util.ArrayList; import java.util.Date; import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; import com.archsystemsinc.qam.model.QamEnvironmentChangeForm; /** */ public interface QamEnvironmentChangeFormRepository extends JpaRepository<QamEnvironmentChangeForm, Long>, JpaSpecificationExecutor<QamEnvironmentChangeForm>{ //Queries to Find Months based on CSR Lists by From Date and To Date @Query("SELECT MONTHNAME(c.createdDate) as month, YEAR(c.createdDate) as year,macLookupId,jurisdictionId,qamEnvironmentChangeFormId,documentName,formType FROM QamEnvironmentChangeForm c WHERE EXTRACT(YEAR_MONTH FROM c.createdDate) >= :fromMonthYear and EXTRACT(YEAR_MONTH FROM c.createdDate) <= :toMonthYear " + "and c.macLookupId in (:macLookupIdList) and c.jurisdictionId in (:jurisdictionList) and c.recordStatus = 1 " + "GROUP BY EXTRACT(YEAR_MONTH FROM c.createdDate),c.macLookupId,c.jurisdictionId") public List<Object[]> findMonthsByMonthYearRange(@Param("fromMonthYear") Integer fromMonthYear, @Param("toMonthYear") Integer toMonthYear,@Param("macLookupIdList")ArrayList<Long> macLookupArrayList,@Param("jurisdictionList")ArrayList<Long> jurisdictionArrayList); @Query("SELECT MONTHNAME(c.createdDate) as month, YEAR(c.createdDate) as year,macLookupId,jurisdictionId,qamEnvironmentChangeFormId,documentName,formType FROM QamEnvironmentChangeForm c WHERE EXTRACT(YEAR_MONTH FROM c.createdDate) >= :fromMonthYear and EXTRACT(YEAR_MONTH FROM c.createdDate) <= :toMonthYear " + "and c.recordStatus = 1 " + "GROUP BY EXTRACT(YEAR_MONTH FROM c.createdDate),c.macLookupId,c.jurisdictionId") public List<Object[]> findMonthsByMonthYearRangeAll(@Param("fromMonthYear") Integer fromMonthYear, @Param("toMonthYear") Integer toMonthYear); @Query("SELECT MONTHNAME(c.createdDate) as month, YEAR(c.createdDate) as year,macLookupId,jurisdictionId,qamEnvironmentChangeFormId,documentName,formType FROM QamEnvironmentChangeForm c WHERE EXTRACT(YEAR_MONTH FROM c.createdDate) >= :fromMonthYear and EXTRACT(YEAR_MONTH FROM c.createdDate) <= :toMonthYear " + "and c.jurisdictionId in (:jurisdictionList) and c.recordStatus = 1 " + "GROUP BY EXTRACT(YEAR_MONTH FROM c.createdDate),c.macLookupId,c.jurisdictionId") public List<Object[]> findMonthsByMonthYearRangeAllMac(@Param("fromMonthYear") Integer fromMonthYear, @Param("toMonthYear") Integer toMonthYear,@Param("jurisdictionList")ArrayList<Long> jurisdictionArrayList); @Query("SELECT MONTHNAME(c.createdDate) as month, YEAR(c.createdDate) as year,macLookupId,jurisdictionId,qamEnvironmentChangeFormId,documentName,formType FROM QamEnvironmentChangeForm c WHERE EXTRACT(YEAR_MONTH FROM c.createdDate) >= :fromMonthYear and EXTRACT(YEAR_MONTH FROM c.createdDate) <= :toMonthYear " + "and c.macLookupId in (:macLookupIdList) and c.recordStatus = 1 " + "GROUP BY EXTRACT(YEAR_MONTH FROM c.createdDate),c.macLookupId,c.jurisdictionId") public List<Object[]> findMonthsByMonthYearRangeAllJuris(@Param("fromMonthYear") Integer fromMonthYear, @Param("toMonthYear") Integer toMonthYear,@Param("macLookupIdList")ArrayList<Long> macLookupArrayList); //Queries to Find CSR Lists by From Date and To Date @Query("SELECT c FROM QamEnvironmentChangeForm c WHERE EXTRACT(YEAR_MONTH FROM c.createdDate) >= :fromMonthYear and EXTRACT(YEAR_MONTH FROM c.createdDate) <= :toMonthYear " + "and c.macLookupId in (:macLookupIdList) and c.jurisdictionId in (:jurisdictionList) and c.recordStatus = 1") public List<Object[]> findByMonthYearRange(@Param("fromMonthYear") Integer fromMonthYear, @Param("toMonthYear") Integer toMonthYear,@Param("macLookupIdList")ArrayList<Long> macLookupArrayList,@Param("jurisdictionList")ArrayList<Long> jurisdictionArrayList); @Query("SELECT c FROM QamEnvironmentChangeForm c WHERE EXTRACT(YEAR_MONTH FROM c.createdDate) >= :fromMonthYear and EXTRACT(YEAR_MONTH FROM c.createdDate) <= :toMonthYear " + "and c.recordStatus = 1") public List<Object[]> findByMonthYearRangeAll(@Param("fromMonthYear") Integer fromMonthYear, @Param("toMonthYear") Integer toMonthYear); @Query("SELECT c FROM QamEnvironmentChangeForm c WHERE EXTRACT(YEAR_MONTH FROM c.createdDate) >= :fromMonthYear and EXTRACT(YEAR_MONTH FROM c.createdDate) <= :toMonthYear " + "and c.jurisdictionId in (:jurisdictionList) and c.recordStatus = 1") public List<Object[]> findByMonthYearRangeAllMac(@Param("fromMonthYear") Integer fromMonthYear, @Param("toMonthYear") Integer toMonthYear,@Param("jurisdictionList")ArrayList<Long> jurisdictionArrayList); @Query("SELECT c FROM QamEnvironmentChangeForm c WHERE EXTRACT(YEAR_MONTH FROM c.createdDate) >= :fromMonthYear and EXTRACT(YEAR_MONTH FROM c.createdDate) <= :toMonthYear " + "and c.macLookupId in (:macLookupIdList) and c.recordStatus = 1") public List<Object[]> findByMonthYearRangeAllJuris(@Param("fromMonthYear") Integer fromMonthYear, @Param("toMonthYear") Integer toMonthYear,@Param("macLookupIdList")ArrayList<Long> macLookupArrayList); //Update Functionality @Modifying @Query("update QamEnvironmentChangeForm c set c.recordStatus = :status, c.updateddDate = :updatedDate where c.userId = :userId and EXTRACT(YEAR_MONTH FROM c.createdDate) = :monthYear and c.macLookupId = :macLookupId and c.jurisdictionId = :jurisdictionId" ) int markStatusDeleted(@Param("status") Long status, @Param("userId") Long userId,@Param("monthYear") Integer monthYear,@Param("updatedDate") Date updatedDate, @Param("macLookupId")Long macLookupId, @Param("jurisdictionId")Long jurisdictionId); }
9dcfb85f50b0a854447cc30eb1a2a9037a44a1c8
81d7654b08c3f34be35351a5532348e455e5acd5
/java/projects/bullsfirst-exchange-javaee/bfexch-domain/src/main/java/org/archfirst/bfexch/domain/trading/order/ExecutionReport.java
02ca2b169f015fa67740b2ddf5f88455d99f6756
[]
no_license
popbones/archfirst
832f036ab7c948e5b2fc70dd627374280d9f8f0e
89e6ed128a01cb7fe422fa8e5925a61a2edfdb5d
refs/heads/master
2021-01-10T06:18:26.497760
2014-03-02T06:53:37
2014-03-02T06:53:37
43,199,746
1
0
null
null
null
null
UTF-8
Java
false
false
4,316
java
/** * Copyright 2011 Archfirst * * 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 org.archfirst.bfexch.domain.trading.order; import org.archfirst.common.money.Money; import org.archfirst.common.quantity.DecimalQuantity; /** * ExecutionReport * * @author Naresh Bhatia */ public class ExecutionReport { // ----- Constructors ----- /** * Constructs an ExecutionReport * * @param type * @param order * @param execution is optional. For example, an execution report of type * New simply acknowledges a new order - there is no execution associated * with this report. */ private ExecutionReport( ExecutionReportType type, Order order, Execution execution) { this.type = type; this.orderId = order.getId().toString(); this.executionId = (execution == null) ? null : execution.getId().toString(); this.clientOrderId = order.getClientOrderId(); this.orderStatus = order.getStatus(); this.side = order.getSide(); this.symbol = order.getSymbol(); this.lastQty = (execution == null) ? null : execution.getQuantity(); this.leavesQty = order.getLeavesQty(); this.cumQty = order.getCumQty(); this.lastPrice = (execution == null) ? null : execution.getPrice(); this.weightedAvgPrice = order.getWeightedAveragePriceOfExecutions(); } // ----- Factory Methods ----- public static ExecutionReport createNewType(Order order) { return new ExecutionReport( ExecutionReportType.New, order, null); } public static ExecutionReport createTradeType(Execution execution) { return new ExecutionReport( ExecutionReportType.Trade, execution.getOrder(), execution); } public static ExecutionReport createCanceledType(Order order) { return new ExecutionReport( ExecutionReportType.Canceled, order, null); } public static ExecutionReport createDoneForDayType(Order order) { return new ExecutionReport( ExecutionReportType.DoneForDay, order, null); } // ----- Attributes ----- private final ExecutionReportType type; private final String orderId; private final String executionId; private final String clientOrderId; private final OrderStatus orderStatus; private final OrderSide side; private final String symbol; private final DecimalQuantity lastQty; private final DecimalQuantity leavesQty; private final DecimalQuantity cumQty; private final Money lastPrice; private final Money weightedAvgPrice; // ----- Getters ----- public ExecutionReportType getType() { return type; } public String getOrderId() { return orderId; } public String getExecutionId() { return executionId; } public String getClientOrderId() { return clientOrderId; } public OrderStatus getOrderStatus() { return orderStatus; } public OrderSide getSide() { return side; } public String getSymbol() { return symbol; } public DecimalQuantity getLastQty() { return lastQty; } public DecimalQuantity getLeavesQty() { return leavesQty; } public DecimalQuantity getCumQty() { return cumQty; } public Money getLastPrice() { return lastPrice; } public Money getWeightedAvgPrice() { return weightedAvgPrice; } }
[ "[email protected]@5f1d654b-2d44-f8f1-813d-ae2f855fe689" ]
[email protected]@5f1d654b-2d44-f8f1-813d-ae2f855fe689
4442d32f5909e8696c1172f2a40d1e137397a303
ec6c76fff76d227face9421eb2468d87fcce343a
/graphsearch/src/main/java/uk/co/bigredlobster/graph/search/cost/dijsktra/SearchUniformCostWithPathAndEarlyExit.java
eb286e293e6df80067c78a2f7222303171ee218d
[]
no_license
bgrdlbstr/graph
43cd8e40a696fedc689d2e1be76444c287482fb3
6e4cab56dd91875e5fbbd73cf1bd00a9d123b940
refs/heads/master
2021-06-04T00:08:22.039051
2018-08-12T12:31:37
2018-08-12T12:31:37
134,094,168
0
0
null
2021-03-31T20:49:47
2018-05-19T20:02:29
Java
UTF-8
Java
false
false
2,982
java
package uk.co.bigredlobster.graph.search.cost.dijsktra; import com.google.common.collect.Streams; import uk.co.bigredlobster.graph.basicGridWithCost.GridGraphWithWallsAndCost; import uk.co.bigredlobster.graph.search.cost.CostAndCameFrom; import uk.co.bigredlobster.graph.search.cost.DrawGrid; import uk.co.bigredlobster.graph.search.cost.GraphNodeWithCost; import uk.co.bigredlobster.graph.search.cost.NodeCostComparator; import uk.co.bigredlobster.graph.shared.helpers.DrawStyle; import uk.co.bigredlobster.graph.shared.node.GraphNode; import uk.co.bigredlobster.microtypes.NodeCost; import uk.co.bigredlobster.microtypes.PositionX; import uk.co.bigredlobster.microtypes.PositionY; import uk.co.bigredlobster.microtypes.WallPosition; import java.util.*; import java.util.stream.Collectors; public class SearchUniformCostWithPathAndEarlyExit { private final GridGraphWithWallsAndCost graphWithWallsAndCost; public SearchUniformCostWithPathAndEarlyExit(final GridGraphWithWallsAndCost graphWithWallsAndCost) { this.graphWithWallsAndCost = graphWithWallsAndCost; } public CostAndCameFrom search(final GraphNodeWithCost start, final GraphNodeWithCost goal) { final PriorityQueue<GraphNodeWithCost> frontier = new PriorityQueue<>(new NodeCostComparator()); final Map<GraphNodeWithCost, GraphNodeWithCost> cameFrom = new HashMap<>(); final Map<GraphNodeWithCost, NodeCost> costSoFar = new HashMap<>(); frontier.add(start); cameFrom.put(start, start); costSoFar.put(start, NodeCost.ZERO); GraphNodeWithCost current; while (!frontier.isEmpty()) { current = frontier.remove(); if (current.equals(goal)) break; for (final GraphNode neighbour : graphWithWallsAndCost.graph.successors(current.graphNode)) { final GraphNodeWithCost neighbourWithCost = new GraphNodeWithCost(neighbour, graphWithWallsAndCost.graph.edgeValue(neighbour, current.graphNode).get()); final NodeCost newCost = new NodeCost(costSoFar.get(current).value + neighbourWithCost.cost.value); boolean addIt = false; if (!costSoFar.containsKey(neighbourWithCost)) { addIt = true; } else if (newCost.value < costSoFar.get(neighbourWithCost).value) { addIt = true; } if (addIt) { costSoFar.put(neighbourWithCost, newCost); frontier.add(neighbourWithCost); cameFrom.put(neighbourWithCost, current); } } } return new CostAndCameFrom(cameFrom, costSoFar); } public void drawGrid(final CostAndCameFrom search, final GraphNodeWithCost start, final GraphNodeWithCost goal, final DrawStyle drawStyle) { DrawGrid.drawGrid(graphWithWallsAndCost, search, start, goal, drawStyle); } }
7560c2e1a4dcc718c965bd45a0a6f5b8ab1a76d9
6ea411132b485f4b90d9e5a7e89412f9b1d093f0
/GWTUnite-Tests/src/org/gwtunite/testing/client/tests/FileTests.java
7b0482c0c7445add8b524e82c2ad1fd66363a842
[]
no_license
maddisondavid/gwt-unite
dc4bc373bad1e88472610c36483aed2687506165
c3c68a8530afcfdd19c350ac2c90b5ec8d46f599
refs/heads/master
2021-01-10T07:49:16.142220
2009-10-27T21:16:30
2009-10-27T21:16:30
55,628,159
0
0
null
null
null
null
UTF-8
Java
false
false
10,044
java
package org.gwtunite.testing.client.tests; import org.gwtunite.client.commons.FileUtils; import org.gwtunite.client.file.File; import org.gwtunite.client.file.FileFilter; import org.gwtunite.client.file.FileStream; import org.gwtunite.client.file.FileSystem; import org.gwtunite.client.file.File.FileMode; import org.gwtunite.client.file.File.FileOperationCompletedHandler; import org.gwtunite.testing.client.framework.Test; import org.gwtunite.testing.client.framework.TestCase; public class FileTests extends TestCase{ public void setUp() throws Exception { File sharedDir = FileSystem.getInstance().mountSharedFileSystem(); FileUtils.deleteDirectoryContents(sharedDir); FileSystem.getInstance().removeMountPoint("shared"); } @Test public void listFilesProvidesAllFiles() throws Exception { File mountPoint = FileSystem.getInstance().mountApplicationFileSystem(); File artifacts = mountPoint.resolve("TestArtifacts"); File[] files = artifacts.listFiles(); assertEquals(4, files.length); } @Test public void listFilesWithFilterGivesOnlyCertainFiles() throws Exception { File mountPoint = FileSystem.getInstance().mountApplicationFileSystem(); File artifacts = mountPoint.resolve("TestArtifacts"); File[] files = artifacts.listFiles(new FileFilter() { @Override public boolean accept(File pathname) { return pathname.getName().endsWith(".txt"); } }); assertEquals(1, files.length); assertEquals("ATestFile.txt", files[0].getName()); } @Test public void canReadAnApplicationFile() throws Exception { File appDir = FileSystem.getInstance().mountApplicationFileSystem(); FileStream testFile = appDir.resolve("TestArtifacts/ATestFile.txt").open(FileMode.READ); assertEquals("Hello".length(), testFile.getBytesAvailable()); String string = testFile.read(testFile.getBytesAvailable()); assertEquals("Hello", string); testFile.close(); } @Test public void resetingPositionIsReflectedInFileStream() throws Exception { File appDir = FileSystem.getInstance().mountApplicationFileSystem(); FileStream testFile = appDir.resolve("TestArtifacts/ATestFile.txt").open(FileMode.READ); { assertEquals("Hello".length(), testFile.getBytesAvailable()); String string = testFile.read(testFile.getBytesAvailable()); assertEquals("Hello", string); } testFile.setPosition(0); { assertEquals("Hello".length(), testFile.getBytesAvailable()); String string = testFile.read(testFile.getBytesAvailable()); assertEquals("Hello", string); } testFile.setPosition(-5); { assertEquals("Hello".length(), testFile.getBytesAvailable()); String string = testFile.read(testFile.getBytesAvailable()); assertEquals("Hello", string); } testFile.setPosition(10); assertEquals(0, testFile.getBytesAvailable()); testFile.close(); } @Test public void eofFlagSetCorrectly() throws Exception { File appDir = FileSystem.getInstance().mountApplicationFileSystem(); FileStream testFile = appDir.resolve("TestArtifacts/ATestFile.txt").open(FileMode.READ); assertEquals("Hello".length(), testFile.getBytesAvailable()); String string = testFile.read(testFile.getBytesAvailable()); assertEquals("Hello", string); assertTrue(testFile.isEof()); testFile.close(); } @Test public void readingSeveralCharactersLeavesStreamInKnownPosition() throws Exception { File appDir = FileSystem.getInstance().mountApplicationFileSystem(); FileStream testFile = appDir.resolve("TestArtifacts/ATestFile.txt").open(FileMode.READ); assertEquals("Hello".length(), testFile.getBytesAvailable()); String string = testFile.read(2); assertEquals("He", string); assertEquals(3, testFile.getBytesAvailable()); assertFalse(testFile.isEof()); testFile.close(); } @Test public void fileAttributesAreCorrect() throws Exception { File appDir = FileSystem.getInstance().mountApplicationFileSystem(); File testArtifictsDir = appDir.resolve("TestArtifacts"); // Dir Tests assertTrue(testArtifictsDir.isDirectory()); assertFalse(testArtifictsDir.isFile(),"Checking that directory not file"); // Currently this is broken assertFalse(testArtifictsDir.isArchive()); assertTrue(testArtifictsDir.isReadOnly()); assertEquals("TestArtifacts", testArtifictsDir.getName()); assertEquals(null, testArtifictsDir.getCreated()); assertTrue(testArtifictsDir.exists()); // File Tests { File testFile = testArtifictsDir.resolve("ATestFile.txt"); assertFalse(testFile.isDirectory(),"isDirectory"); assertTrue(testFile.isFile(),"isFile"); assertFalse(testFile.isArchive(),"isArchive"); assertTrue(testFile.isReadOnly(),"isReadOnly"); assertTrue(testFile.exists()); assertEquals("ATestFile.txt", testFile.getName()); assertEquals("mountpoint://application/TestArtifacts/ATestFile.txt", testFile.getVirtualPath()); assertEquals("Hello".length(), testFile.getFileSize()); // assertEquals("TestArtifacts/ATestFile.txt", testFile.getNativePath()); // Currently Broken } // Archive Tests { File testFile = testArtifictsDir.resolve("TestArchive.zip"); assertFalse(testFile.isDirectory(),"isDirectory"); assertTrue(testFile.isFile(),"isFile"); assertTrue(testFile.isArchive(),"isArchive"); assertTrue(testFile.isReadOnly(),"isReadOnly"); assertEquals("TestArchive.zip", testFile.getName()); assertTrue(testFile.exists()); // assertNotNull(testFile.getCreated(),"Checking created date not null"); // Broken for now! // Date created = testFile.getCreated(); // assertEquals(2009, created.getYear()); //assertNotNull(testFile.getModified(),"Testing getModified not null"); } { File testFile = testArtifictsDir.resolve("DoesNotExist"); assertFalse(testFile.exists()); } } @Test public void canWriteAndReadFilesInSharedSpace() throws Exception { File sharedDir = FileSystem.getInstance().mountSharedFileSystem(); assertEquals(0, sharedDir.listFiles().length, "sharedDir not empty"); final String testString = "HelloWorld"; // Write Shared File File newFile = sharedDir.resolve("NewFile"); { FileStream stream = newFile.open(FileMode.WRITE); stream.write(testString); stream.close(); } // Check directory listing assertEquals(1,sharedDir.listFiles().length); assertEquals("NewFile", sharedDir.listFiles()[0].getName()); // Read File back in { FileStream stream = newFile.open(FileMode.READ, FileMode.APPEND); assertEquals(testString.length(), stream.getBytesAvailable(), "Testing file size"); assertEquals(testString, stream.read(stream.getBytesAvailable()), "Testing file contents"); stream.close(); } // Delete File { newFile.delete(); assertEquals(0,sharedDir.listFiles().length); } } @Test public void createDirectoryWorks() throws Exception { File sharedDir = FileSystem.getInstance().mountSharedFileSystem(); // Delete With File object { File newDir = sharedDir.resolve("testMe").mkDir(); assertEquals(1, sharedDir.listFiles().length); newDir.delete(); assertEquals(0, sharedDir.listFiles().length); } // Delete With String Name { File newDir = sharedDir.resolve("testMe").mkDir(); assertEquals(1, sharedDir.listFiles().length); newDir.delete(); assertEquals(0, sharedDir.listFiles().length); } } @Test public void copyMethodsWork() throws Exception { File sharedDir = FileSystem.getInstance().mountSharedFileSystem(); File newDir1 = sharedDir.resolve("testMe").mkDir(); File newDir2 = sharedDir.resolve("testMe2").mkDir(); File newFile = newDir1.resolve("TestFile"); FileStream fileStream = newFile.open(FileMode.WRITE); fileStream.write("Hello"); fileStream.close(); assertEquals(1,newDir1.listFiles().length); newFile.copyTo(newDir2, false); assertEquals(1,newDir1.listFiles().length); assertEquals(1, newDir2.listFiles().length); assertEquals("TestFile", newDir2.listFiles()[0].getName()); // Cleanup newDir1.delete(); newDir2.delete(); assertEquals(0, sharedDir.listFiles().length); } @Test public void moveMethodsWork() throws Exception { File sharedDir = FileSystem.getInstance().mountSharedFileSystem(); File newDir1 = sharedDir.resolve("testMe").mkDir(); File newDir2 = sharedDir.resolve("testMe2").mkDir(); File newFile = newDir1.resolve("TestFile"); FileStream fileStream = newFile.open(FileMode.WRITE); fileStream.write("Hello"); fileStream.close(); assertEquals(1,newDir1.listFiles().length,"Listing Contents of newDir1"); newFile.moveTo(newDir2, false); assertEquals(0,newDir1.listFiles().length); assertEquals(1, newDir2.listFiles().length,"Listing Contents of newDir2 (afterMove)"); assertEquals("TestFile", newDir2.listFiles()[0].getName()); // Cleanup newDir1.delete(); newDir2.delete(); assertEquals(0, sharedDir.listFiles().length); } @Test public void copyMethodsWithCallbackWork() throws Exception{ // Callbacks are not currently, erm, called back (see Opera bug US-1160) File sharedDir = FileSystem.getInstance().mountSharedFileSystem(); File newDir1 = sharedDir.resolve("testMe").mkDir(); File newDir2 = sharedDir.resolve("testMe2").mkDir(); File newFile = newDir1.resolve("TestFile"); FileStream fileStream = newFile.open(FileMode.WRITE); fileStream.write("Hello"); fileStream.close(); assertEquals(1,newDir1.listFiles().length); delayTestFinish(1000); newFile.copyTo(newDir2, true, new FileOperationCompletedHandler() { @Override public void onComplete(File file) { try { assertNotNull(file); assertEquals("MyFile",file.getName()); finishTest(); } catch(Exception e) { handleException(e); } } }); } }
[ "maddisondavid@e14673ba-a55b-11de-bf1c-ef771b8a44ac" ]
maddisondavid@e14673ba-a55b-11de-bf1c-ef771b8a44ac
a0e62c3f1c8bd3a676a013a4bf6b6289fd8ec67d
3088c014ba29ccaad67a9e4cead2cb0826d81c50
/ASOUB_Lesson/Students/Namuun/Week 12/Monday/UnitTest/Idk/Excersice1.java
62b1c4b11afb192e0b1fa20f08d877a983ddcb22
[]
no_license
khangaikhuu/cs_introduction
1abeb0d5c6d342975db984a6007abaa9be3b8bc1
8a6a9156c222631e147a47df8c8fb95f0d24261a
refs/heads/master
2021-07-15T21:09:50.421587
2019-01-18T00:57:06
2019-01-18T00:57:06
147,441,523
0
0
null
null
null
null
UTF-8
Java
false
false
261
java
package Idk; /** * Write a description of class Excersice1 here. * * @author (Namuun) * @version (Wednesday) */ public class Excersice1 { public void Name () { System.out.println("Hello My NAme is Namuun and I like Programming"); } }
e30476e0cdad966169ecf85a9925dfa9d4f64e3f
7e8365ed637c26f62ea8c2b4c140c9c7b7a367f3
/JHotDraw/CH/ifa/draw/figures/RectangleFigure.java
606937677f3460374ca6303028f0862114cf0474
[]
no_license
AA472/CS-290
72ddee8cd330a01576578dbfac37ad6fa52d89e5
fb1aab3baf0bae9701399d26a5452eceb66c60e6
refs/heads/master
2020-04-12T22:33:05.549143
2019-09-28T06:14:14
2019-09-28T06:14:14
162,792,309
0
0
null
null
null
null
UTF-8
Java
false
false
2,208
java
/* * @(#)RectangleFigure.java * * Project: JHotdraw - a GUI framework for technical drawings * http://www.jhotdraw.org * http://jhotdraw.sourceforge.net * Copyright: � by the original author(s) and all contributors * License: Lesser GNU Public License (LGPL) * http://www.opensource.org/licenses/lgpl-license.html */ package CH.ifa.draw.figures; import java.awt.*; import java.io.IOException; import java.util.Vector; import CH.ifa.draw.framework.*; import CH.ifa.draw.standard.*; import CH.ifa.draw.util.*; /** * A rectangle figure. * * @version <$CURRENT_VERSION$> */ public class RectangleFigure extends AttributeFigure { private Rectangle fDisplayBox; /* * Serialization support. */ private static final long serialVersionUID = 184722075881789163L; private int rectangleFigureSerializedDataVersion = 1; public RectangleFigure() { this(new Point(0,0), new Point(0,0)); } public RectangleFigure(Point origin, Point corner) { basicDisplayBox(origin,corner); } public void basicDisplayBox(Point origin, Point corner) { fDisplayBox = new Rectangle(origin); fDisplayBox.add(corner); } public Vector handles() { Vector handles = new Vector(); BoxHandleKit.addHandles(this, handles); return handles; } public Rectangle displayBox() { return new Rectangle( fDisplayBox.x, fDisplayBox.y, fDisplayBox.width, fDisplayBox.height); } protected void basicMoveBy(int x, int y) { fDisplayBox.translate(x,y); } public void drawBackground(Graphics g) { Rectangle r = displayBox(); g.fillRect(r.x, r.y, r.width, r.height); g.fillOval(r.x, r.y, r.width, r.height); } public void drawFrame(Graphics g) { Rectangle r = displayBox(); g.drawRect(r.x, r.y, r.width-1, r.height-1); } //-- store / load ---------------------------------------------- public void write(StorableOutput dw) { super.write(dw); dw.writeInt(fDisplayBox.x); dw.writeInt(fDisplayBox.y); dw.writeInt(fDisplayBox.width); dw.writeInt(fDisplayBox.height); } public void read(StorableInput dr) throws IOException { super.read(dr); fDisplayBox = new Rectangle( dr.readInt(), dr.readInt(), dr.readInt(), dr.readInt()); } }
b496fb42ac47c029a328a0c511cc216d50890e1a
e414c45c9911cdbf047c5c4a993125ac2a1553fd
/Assignment3/test/KnightTest.java
72ea20d11462bf22f41957925834a47cb93c91b0
[]
no_license
northeastern-align/CS5004
a771f333397c0e2b6721865ad25a7f9fa9103fb2
c364e54997ea8e94cecb911d226e28437a4e9222
refs/heads/master
2020-06-28T05:09:17.521495
2019-08-02T12:59:13
2019-08-02T12:59:13
200,149,310
2
3
null
null
null
null
UTF-8
Java
false
false
3,821
java
import org.junit.Before; import org.junit.Test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; /** * JUnit test class for Knight. */ public class KnightTest { private AbstractPiece knightW; private AbstractPiece knightB; @Before public void setUp() { knightW = new Knight(2, 2, Color.WHITE); knightB = new Knight(3, 4, Color.BLACK); } // For tests of abstract methods see PawnTest @Test(expected = IllegalArgumentException.class) public void testIllegalRow() { Knight temp = new Knight(-1, 1, Color.WHITE); assertEquals(-1, temp.getRow()); } @Test(expected = IllegalArgumentException.class) public void testIllegalColumn() { Knight temp = new Knight(1, -1, Color.BLACK); assertEquals(-1, temp.getColumn()); } @Test public void testWhiteMoveFR() { assertTrue(knightW.canMove(4, 3)); } @Test public void testWhiteMoveFL() { assertTrue(knightW.canMove(3, 0)); } @Test public void testWhiteMoveBR() { assertTrue(knightW.canMove(1, 4)); } @Test public void testWhiteMoveBL() { assertTrue(knightW.canMove(0, 1)); } @Test public void testWhiteMoveForward() { assertFalse(knightW.canMove(3, 2)); } @Test public void testWhiteMoveDiagonal() { assertFalse(knightW.canMove(3, 3)); } @Test public void testWhiteMoveRight() { assertFalse(knightW.canMove(2, 7)); } @Test public void testWhiteMoveBack() { assertFalse(knightW.canMove(1, 2)); } @Test public void testWhiteMoveLeft() { assertFalse(knightW.canMove(2, 1)); } @Test public void testWhiteBoundary() { Knight temp = new Knight(1, 1, Color.WHITE); assertFalse(temp.canMove(0, -1)); } @Test public void testBlackMoveFR() { assertTrue(knightB.canMove(2, 2)); } @Test public void testBlackMoveFL() { assertTrue(knightB.canMove(1, 5)); } @Test public void testBlackMoveBR() { assertTrue(knightB.canMove(5, 3)); } @Test public void testBlackMoveBL() { assertTrue(knightB.canMove(4, 6)); } @Test public void testBlackMoveForward() { assertFalse(knightB.canMove(2, 4)); } @Test public void testBlackMoveDiagonal() { assertFalse(knightB.canMove(2, 3)); } @Test public void testBlackMoveRight() { assertFalse(knightB.canMove(3, 0)); } @Test public void testBlackMoveBack() { assertFalse(knightB.canMove(7, 4)); } @Test public void testBlackMoveLeft() { assertFalse(knightB.canMove(3, 7)); } @Test public void testBlackBoundary() { Knight temp = new Knight(6, 6, Color.BLACK); assertFalse(temp.canMove(7, 8)); } @Test public void testMoveSame() { assertTrue(knightB.canMove(3, 4)); } @Test public void testWhiteKill() { assertTrue(knightW.canKill(knightB)); } @Test public void testBlackKill() { assertTrue(knightB.canKill(knightW)); } @Test public void testIllegalKillDirection() { Knight temp = new Knight(3, 3, Color.BLACK); assertFalse(knightW.canKill(temp)); } @Test public void testIllegalKillDistance() { Knight temp = new Knight(4, 6, Color.BLACK); assertFalse(knightW.canKill(temp)); } @Test public void testIllegalKillColor() { Bishop temp = new Bishop(3, 4, Color.WHITE); assertFalse(knightW.canKill(temp)); } @Test public void testKillSameSpace() { Knight temp = new Knight(2, 2, Color.BLACK); assertTrue(knightW.canKill(temp)); } @Test public void testKillOtherPiece() { Queen temp = new Queen(4, 1, Color.BLACK); assertTrue(knightW.canKill(temp)); } @Test public void testIllegalKillOtherPiece() { Rook temp = new Rook(3, 1, Color.WHITE); assertFalse(knightW.canKill(temp)); } }
1b59bb5d832ccdff245a32d7b8314f48d83f2f7a
cb1100e01cfc5854fd8c9087f823a63cad8eaf7f
/MapViewer.java
da886d2d476866bf9c9f33349798836c7e67618e
[]
no_license
atran782/Simulated-Driving
b1cbbdd4b690bb3063e3a23ab3208f38dbcb5403
5b2ab8906ae02c3b8f606e6b63d42d0c409fae6d
refs/heads/master
2020-04-05T10:49:37.057355
2018-11-09T04:51:19
2018-11-09T04:51:19
156,811,931
0
0
null
null
null
null
UTF-8
Java
false
false
1,301
java
/* a map viewer maintains the viewport and ortho projection for specified fixed map view */ public class MapViewer{ private int px, py, pw, ph; // viewport info private double left, right, bottom, top, near, far; // projection info private Mat4 proj; // ortho projection matrix private int projLoc; // uniform location // view info // (not really needed because "map view" // is already looking down the -z axis, // so ortho takes care of everything // Since the vertex shader expects proj and // view, use view = identity matrix private Mat4 view; // will just be identity private int viewLoc; // uniform location public MapViewer( int vx, int vy, int vw, int vh, double l, double r, double b, double t, double n, double f ) { px=vx; py=vy; pw=vw; ph=vh; left=l; right=r; bottom=b; top=t; near=n; far=f; proj = Mat4.ortho( left, right, bottom, top, near, far ); projLoc = OpenGL.getUniformLoc( "proj" ); view = Mat4.identity(); viewLoc = OpenGL.getUniformLoc( "view" ); } // set up viewport and send matrices public void activate(){ OpenGL.viewport( px, py, pw, ph ); OpenGL.sendUniformMatrix4( projLoc, proj ); OpenGL.sendUniformMatrix4( viewLoc, view ); } }
3cbfa44886a3ad1948348d7920fc0be4a1e804c5
9aeb261d951d7efd9511184ed38c9caa0a3cd59f
/src/main/java/com/android/tools/r8/ir/optimize/info/initializer/InstanceInitializerInfoContext.java
8c28004d589d8cfb90f234379cade2c32db7b500
[ "BSD-3-Clause", "MIT", "Apache-2.0", "LicenseRef-scancode-generic-cla", "LicenseRef-scancode-unknown-license-reference" ]
permissive
veryriskyrisk/r8
70bbac0692fcdd7106721015d82d898654ba404a
c4e4ae59b83f3d913c34c55e90000a4756cfe65f
refs/heads/master
2023-03-22T03:51:56.548646
2021-03-17T16:53:58
2021-03-18T09:00:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
502
java
// Copyright (c) 2019, the R8 project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. package com.android.tools.r8.ir.optimize.info.initializer; import com.android.tools.r8.ir.code.InvokeMethod; public abstract class InstanceInitializerInfoContext { public boolean isAlwaysTrue() { return false; } public abstract boolean isSatisfiedBy(InvokeMethod invoke); }
9369f6fd2e0d0d9c495a1cf2bc3e9d33d7c66e08
41577de0e7dc2963c3d3969a579dea207954ae1b
/sc-f-chapter5/service-zuul/src/main/java/com/forezp/servicezuul/filter/MyFilter.java
f11ef1525998e851ad7b54b5897b43ed505e4c08
[]
no_license
luomuhuaxiang/SpringCloudLearning
fe794a4dd5316de22859ae055119ff5294ad3e83
8e7bd0fbb6ad52f9d20f7b78677640712d475f19
refs/heads/master
2020-06-18T05:13:19.143203
2019-08-16T09:45:57
2019-08-16T09:45:57
196,175,849
5
0
null
2019-07-10T09:29:24
2019-07-10T09:29:24
null
UTF-8
Java
false
false
1,408
java
package com.forezp.servicezuul.filter; import com.netflix.zuul.ZuulFilter; import com.netflix.zuul.context.RequestContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; import javax.servlet.http.HttpServletRequest; /** * Email [email protected] * * @author fangzhipeng * create 2018-07-09 **/ @Component public class MyFilter extends ZuulFilter { private static Logger log = LoggerFactory.getLogger(MyFilter.class); @Override public String filterType() { return "pre"; } @Override public int filterOrder() { return 0; } @Override public boolean shouldFilter() { return true; } @Override public Object run() { RequestContext ctx = RequestContext.getCurrentContext(); HttpServletRequest request = ctx.getRequest(); log.info(String.format("%s >>> %s", request.getMethod(), request.getRequestURL().toString())); Object accessToken = request.getParameter("token"); if(accessToken == null) { log.warn("token is empty"); ctx.setSendZuulResponse(false); ctx.setResponseStatusCode(401); try { ctx.getResponse().getWriter().write("token is empty"); }catch (Exception e){} return null; } log.info("ok"); return null; } }
b94161dd8375a6f83b3679f4cd2c1dd20302d0aa
9942a1c2c028768483b01d495bba5f8805ac0449
/vo/src/main/java/com/qzdsoft/eshop/vo/goods/pc/ShoppingCartDelInfo.java
72b597c6e051bae9273d69aeae33924797e9eb0b
[]
no_license
Ysheep/yihuicloud
8f16b3045ff40d29b66735d3d86cd9ce2706ce92
fcb703a7b583e22b0edbcda2289c488c8923f73b
refs/heads/master
2021-05-02T02:03:49.283168
2018-02-09T08:45:37
2018-02-09T08:45:37
120,878,581
0
0
null
null
null
null
UTF-8
Java
false
false
392
java
package com.qzdsoft.eshop.vo.goods.pc; import java.util.List; public class ShoppingCartDelInfo { private Integer userId; private List<Integer> ids; public List<Integer> getIds() { return ids; } public void setIds(List<Integer> ids) { this.ids = ids; } public Integer getUserId() { return userId; } public void setUserId(Integer userId) { this.userId = userId; } }
8b9fb80907cc54b9e52fbc8ddcaeff1b16606d0e
e38adafa932f9c9f386e82bd1b16a000dc1b3613
/toolbox/src/main/java/fi/csc/chipster/toolbox/toolpartsparser/JavaParser.java
08e0750eb18ddc0022f41ad253195986df8db5fa
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
chipster/chipster
1844cf655443ae75423adaa81edfa17ba102fbf2
07a19b305d0a602e70c0d1cec71efea6cf79a281
refs/heads/master
2021-07-22T18:59:28.590186
2020-12-17T14:59:24
2020-12-17T14:59:24
8,553,857
34
11
MIT
2020-12-15T13:13:44
2013-03-04T11:03:05
Java
UTF-8
Java
false
false
1,233
java
package fi.csc.chipster.toolbox.toolpartsparser; import java.lang.reflect.InvocationTargetException; import java.nio.file.Path; import org.apache.log4j.Logger; import fi.csc.chipster.toolbox.SADLTool.ParsedScript; import fi.csc.microarray.comp.java.JavaCompJobBase; public class JavaParser implements ToolPartsParser { static final Logger logger = Logger.getLogger(JavaParser.class); @Override public ParsedScript parse(Path moduleDir, String toolId) throws ClassNotFoundException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException { String sourceResourceName = toolId.substring(0, toolId.lastIndexOf(".java")); // get the job class Class<? extends Object> jobClass = null; jobClass = Class.forName(sourceResourceName); assert(JavaCompJobBase.class.isAssignableFrom(jobClass)); JavaCompJobBase jobInstance; jobInstance = (JavaCompJobBase)jobClass.getDeclaredConstructor().newInstance(); // TODO what to do with other parts ParsedScript ps = new ParsedScript(); ps.SADL = jobInstance.getSADL(); ps.source = "Source code for this tool is available within Chipster source code."; return ps; } }
d77edfc434618a218d3e2497d1e4d1ecccbcfdcf
a39c0f8e4b4db8c753ee59bd2481f9083a7fe719
/app/src/main/java/com/example/healthassistance/viewmodels/LoginViewmodel.java
9294574a08dc1923a8cd41539d833985822fbeac
[]
no_license
mbshuvo325/Health-Assistant
3bd6313ffde594395a290610ceb678b4bbf2cda0
d0fba5317710b15c18e8dc185436ae0b27494c0c
refs/heads/master
2020-11-30T20:38:34.923289
2020-03-19T08:50:01
2020-03-19T08:50:01
230,474,271
0
0
null
null
null
null
UTF-8
Java
false
false
1,240
java
package com.example.healthassistance.viewmodels; import androidx.lifecycle.MutableLiveData; import androidx.lifecycle.ViewModel; import com.example.healthassistance.repos.LoginRepository; import com.google.firebase.auth.FirebaseAuth; public class LoginViewmodel extends ViewModel { public enum AuthenticationState{ AUTHENTICATED,UNAUTHENTICATED } private LoginRepository loginRepository; public MutableLiveData<AuthenticationState> stateLiveData; public MutableLiveData<String > errormsg = new MutableLiveData<>(); public LoginViewmodel() { stateLiveData = new MutableLiveData<>(); loginRepository = new LoginRepository(stateLiveData); errormsg = loginRepository.getErrormsg(); if (loginRepository.getFirebaseUser() != null){ stateLiveData.postValue(AuthenticationState.AUTHENTICATED); }else { stateLiveData.postValue(AuthenticationState.UNAUTHENTICATED); } } public void Login(String email, String password){ loginRepository.loginUser(email,password); } public void LogOutUser(){ FirebaseAuth.getInstance().signOut(); stateLiveData.postValue(AuthenticationState.UNAUTHENTICATED); } }
5f9534ca2fd52ccc2d4225079214317e57ebb902
d99069a57a396a3be6d31b5ca52974ce8fcf1b7f
/src/event/SimpleCalc2.java
0cf9f4d0f8ff41274e181efd690f7ceb14fae20a
[]
no_license
DONGHYUBYOO/GUI
78d684418ae7b69b9418138cbe1f723c2ccd8a40
87e5130bd11679c798a3768ec2819d6853a7ede5
refs/heads/master
2022-04-19T20:00:03.522522
2020-04-17T08:29:11
2020-04-17T08:29:11
255,233,450
0
0
null
null
null
null
UTF-8
Java
false
false
3,905
java
package event; import java.awt.BorderLayout; import java.awt.EventQueue; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import javax.swing.JTextField; import javax.swing.JLabel; import javax.swing.JButton; public class SimpleCalc2 extends JFrame implements ActionListener { private JPanel contentPane; private JTextField txtOp1, txtOp2, txtResult; private JButton btnReset, btnExit, btnPlus, btnSub, btnMulti, btnDivide; int op1, op2; private JLabel labelSymbol; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { SimpleCalc2 frame = new SimpleCalc2(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ public SimpleCalc2() { setTitle("사칙연산 계산기"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 501, 275); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); contentPane.setLayout(new BorderLayout(0, 0)); setContentPane(contentPane); JPanel panel = new JPanel(); contentPane.add(panel, BorderLayout.NORTH); txtOp1 = new JTextField(); panel.add(txtOp1); txtOp1.setColumns(5); labelSymbol = new JLabel("?"); panel.add(labelSymbol); txtOp2 = new JTextField(); panel.add(txtOp2); txtOp2.setColumns(5); JLabel labelEqual = new JLabel("="); panel.add(labelEqual); txtResult = new JTextField(); panel.add(txtResult); txtResult.setColumns(10); JPanel panel_1 = new JPanel(); contentPane.add(panel_1, BorderLayout.SOUTH); btnReset = new JButton("Reset"); btnReset.addActionListener(this); btnPlus = new JButton("+"); btnPlus.addActionListener(this); panel_1.add(btnPlus); btnSub = new JButton("-"); btnSub.addActionListener(this); panel_1.add(btnSub); btnMulti = new JButton("*"); btnMulti.addActionListener(this); panel_1.add(btnMulti); btnDivide = new JButton("/"); btnDivide.addActionListener(this); panel_1.add(btnDivide); panel_1.add(btnReset); btnExit = new JButton("Exit"); btnExit.addActionListener(this); panel_1.add(btnExit); pack(); } @Override public void actionPerformed(ActionEvent e) { JButton btn = (JButton)e.getSource(); getOp(); int result=0; if(btn==btnPlus) { labelSymbol.setText("+"); result=op1+op2; }else if(btn==btnSub) { labelSymbol.setText("-"); result=op1-op2; }else if(btn==btnMulti) { labelSymbol.setText("*"); result=op1*op2; }else if(btn==btnDivide) { labelSymbol.setText("/"); result=op1/op2; }else if(btn==btnReset) { txtOp1.setText(""); txtOp2.setText(""); txtResult.setText(""); }else { System.exit(0); } txtResult.setText(result+""); // if(e.getSource()==btnPlus) { // //txtOp1, txtOp2 숫자를 가져오기 // getOp(); // //사칙연산 라벨 표시 // labelSymbol.setText("+"); // //txtResult 결과 표시 // txtResult.setText(String.valueOf(op1+op2)); // }else if(e.getSource()==btnSub) { // getOp(); // labelSymbol.setText("-"); // txtResult.setText(String.valueOf(op1-op2)); // }else if(e.getSource()==btnMulti) { // getOp(); // labelSymbol.setText("*"); // txtResult.setText(String.valueOf(op1*op2)); // }else if(e.getSource()==btnDivide) { // getOp(); // labelSymbol.setText("/"); // txtResult.setText(String.valueOf(op1/op2)); // }else if(e.getSource()==btnReset) { // //txtOp1, txtOp2, txtResult 초기화 // txtOp1.setText(""); // txtOp2.setText(""); // txtResult.setText(""); // }else { // System.exit(0); // } } public void getOp() { op1=Integer.parseInt(txtOp1.getText()); op2=Integer.parseInt(txtOp2.getText()); } }
6048925886d26811863911ab1786f5880944f8c1
15cf8a940a99b1335250bff9f221cc08d5df9f0f
/src/com/google/android/gms/drive/query/internal/HasFilter.java
87c2e288a8ad3adfcba85f604ac38a0a3adbbe0b
[]
no_license
alamom/mcoc_mod_11.1
0e5153e0e7d83aa082c5447f991b2f6fa5c01d8b
d48cb0d2b3bc058bddb09c761ae5f443d9f2e93d
refs/heads/master
2021-01-11T17:12:37.894951
2017-01-22T19:55:38
2017-01-22T19:55:38
79,739,761
0
0
null
null
null
null
UTF-8
Java
false
false
1,111
java
package com.google.android.gms.drive.query.internal; import android.os.Parcel; import com.google.android.gms.drive.metadata.MetadataField; import com.google.android.gms.drive.metadata.internal.MetadataBundle; public class HasFilter<T> extends AbstractFilter { public static final g CREATOR = new g(); final int BR; final MetadataBundle QL; final MetadataField<T> QM; HasFilter(int paramInt, MetadataBundle paramMetadataBundle) { this.BR = paramInt; this.QL = paramMetadataBundle; this.QM = e.b(paramMetadataBundle); } public <F> F a(f<F> paramf) { return (F)paramf.d(this.QM, getValue()); } public int describeContents() { return 0; } public T getValue() { return (T)this.QL.a(this.QM); } public void writeToParcel(Parcel paramParcel, int paramInt) { g.a(this, paramParcel, paramInt); } } /* Location: C:\tools\androidhack\marvel_bitva_chempionov_v11.1.0_mod_lenov.ru\classes.jar!\com\google\android\gms\drive\query\internal\HasFilter.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */
9f3c087d7009bf23bf1e84a7a6efdc5b635ca779
7ff27d5ba511c2dc01aa1454e78fc9ae4b7876ed
/moip-dev-academy-1/library/src/main/java/br/com/moip/devacademy/library/controller/PatronController.java
c449791d92e0d715fbc2980a4c7b8a434e363ae8
[]
no_license
wirecardBrasil/moip-dev-academy-java
6e70afe16ae0218427df70bdd81e04f59288cbdd
a1da3f0b201a5e82489c20b7b5d9d4c65cb1157d
refs/heads/master
2020-03-08T11:39:05.549409
2018-04-06T14:40:41
2018-04-06T14:40:41
128,104,230
1
0
null
null
null
null
UTF-8
Java
false
false
1,936
java
package br.com.moip.devacademy.library.controller; import br.com.moip.devacademy.library.entity.Patron; import br.com.moip.devacademy.library.repository.PatronRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; /** * Created by leticia.alves on 04/04/18. */ @RestController @RequestMapping("/patrons") public class PatronController { @Autowired private PatronRepository patronRepository; @GetMapping public List<Patron> getAllPatrons() { return patronRepository.findAll(); } @GetMapping("/{id}") public Patron getPatronById(@PathVariable(value = "id") Long patronId) { return patronRepository.findById(patronId).get(); } @PostMapping public Patron createPatron(@RequestBody Patron patron) { return patronRepository.save(patron); } @PutMapping("/{id}") public Patron updatePatron(@PathVariable(value = "id") Long patronId, @RequestBody Patron patronDetails) { Patron patron = patronRepository.findById(patronId).get(); patron.setName(patronDetails.getName()); patron.setPhone(patronDetails.getPhone()); patronRepository.save(patron); return patron; } @DeleteMapping("/{id}") public void deletePatron(@PathVariable(value = "id") Long patronId) { Patron patron = patronRepository.findById(patronId).get(); patronRepository.delete(patron); } }
a907e0ec431c43ecd9e83e4646c11f9fefa27f3c
5a474257353b9bbf88c30688fab17a618b154c22
/snHose-Server/src/main/java/net/minecraft/server/EnchantmentInstance.java
66a4fdedc8623ee0adfb7408bffc22e96f2f4d5d
[]
no_license
RealKezuk/snHose
7e5424cd3edbf99bb6a586b9592943b11cd9d549
8c89453218621426f394fae44625f97b2a57840c
refs/heads/master
2020-07-22T14:24:17.936438
2019-09-09T03:39:21
2019-09-09T03:39:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
491
java
package net.minecraft.server.v1_7_R4; public class EnchantmentInstance extends WeightedRandomChoice { public final Enchantment enchantment; public final int level; public EnchantmentInstance(final Enchantment enchantment, final int level) { super(enchantment.getRandomWeight()); this.enchantment = enchantment; this.level = level; } public EnchantmentInstance(final int n, final int n2) { this(Enchantment.byId[n], n2); } }
b0b90a767b983a10deaaa1ba33a25e73d4412970
5635587c6033e1ec020b1f89d1fa2f00c70d3a09
/src/test/java/com/niyue/coding/leetcode/surroundedregions/SurroundedRegionsTest.java
29c19e72105155a333bb836dc1b67871d7437c79
[]
no_license
arnabs542/coding
1673a012f764c2fc6bf430ab7f48fbae338ff341
19bf62b4a4d9afa7599706731952cbe2b948c4a1
refs/heads/master
2023-01-04T11:21:02.060660
2015-09-30T05:49:38
2015-09-30T05:49:38
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,488
java
package com.niyue.coding.leetcode.surroundedregions; import static org.junit.Assert.*; import org.junit.Test; public class SurroundedRegionsTest { @Test // cannot handle one dimensional case public void testOneDimensionalBoard() { char[][] board = new char[][] { {'X'} }; Solution sl = new Solution(); sl.solve(board); assertEquals('X', board[0][0]); } @Test // forget to initialize 'surrounded' array at first public void testAllO() { char[][] board = new char[][] { {'O', 'O'}, {'O', 'O'} }; Solution sl = new Solution(); sl.solve(board); assertEquals('O', board[0][0]); assertEquals('O', board[0][1]); assertEquals('O', board[1][0]); assertEquals('O', board[1][1]); } @Test // fail to implement a core function to determine isSurrounded correctly at first public void testSingleSurroundedO() { char[][] board = new char[][] { {'X', 'X', 'X'}, {'X', 'O', 'X'}, {'X', 'X', 'X'}, }; Solution sl = new Solution(); sl.solve(board); assertEquals('X', board[1][1]); } @Test // leetcode online judge reported an its internal error when submitted public void test3x3O() { char[][] board = new char[][] { {'O', 'O', 'O'}, {'O', 'O', 'O'}, {'O', 'O', 'O'} }; Solution sl = new Solution(); sl.solve(board); assertEquals('O', board[0][0]); assertEquals('O', board[0][1]); assertEquals('O', board[0][2]); assertEquals('O', board[1][0]); assertEquals('O', board[1][1]); assertEquals('O', board[1][2]); assertEquals('O', board[2][0]); assertEquals('O', board[2][1]); assertEquals('O', board[2][2]); } @Test // added to verify the running time public void testSample() { char[][] board = new char[][] { {'X', 'X', 'X', 'X'}, {'X', 'O', 'O', 'X'}, {'X', 'X', 'O', 'X'}, {'X', 'O', 'X', 'X'} }; Solution sl = new Solution(); sl.solve(board); assertEquals('X', board[1][1]); assertEquals('X', board[1][2]); assertEquals('X', board[2][2]); assertEquals('O', board[3][1]); } @Test // one test case in leetcode's large data set is problematic, the allowed time is pretty close to what the minimum possible time can achieve public void testLargeDataSet() { char[][] board = new char[][] { {'X', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O'}, {'O', 'X', 'O', 'O', 'O', 'O', 'X', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'X', 'X'}, {'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'X', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'X'}, {'O', 'O', 'X', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'X', 'O'}, {'O', 'O', 'O', 'O', 'O', 'X', 'O', 'O', 'O', 'O', 'X', 'O', 'O', 'O', 'O', 'O', 'X', 'O', 'O', 'X'}, {'X', 'O', 'O', 'O', 'X', 'O', 'O', 'O', 'O', 'O', 'X', 'O', 'X', 'O', 'X', 'O', 'X', 'O', 'X', 'O'}, {'O', 'O', 'O', 'O', 'X', 'O', 'O', 'X', 'O', 'O', 'O', 'O', 'O', 'X', 'O', 'O', 'X', 'O', 'O', 'O'}, {'X', 'O', 'O', 'O', 'X', 'X', 'X', 'O', 'X', 'O', 'O', 'O', 'O', 'X', 'X', 'O', 'X', 'O', 'O', 'O'}, {'O', 'O', 'O', 'O', 'O', 'X', 'X', 'X', 'X', 'O', 'O', 'O', 'O', 'X', 'O', 'O', 'X', 'O', 'O', 'O'}, {'X', 'O', 'O', 'O', 'O', 'X', 'O', 'O', 'O', 'O', 'O', 'O', 'X', 'X', 'O', 'O', 'X', 'O', 'O', 'X'}, {'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'X', 'O', 'O', 'X', 'O', 'O', 'O', 'X', 'O', 'X'}, {'O', 'O', 'O', 'O', 'X', 'O', 'X', 'O', 'O', 'X', 'X', 'O', 'O', 'O', 'O', 'O', 'X', 'O', 'O', 'O'}, {'X', 'X', 'O', 'O', 'O', 'O', 'O', 'X', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O'}, {'O', 'X', 'O', 'X', 'O', 'O', 'O', 'X', 'O', 'X', 'O', 'O', 'O', 'X', 'O', 'X', 'O', 'X', 'O', 'O'}, {'O', 'O', 'X', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'X', 'O', 'O', 'O', 'O', 'O', 'X', 'O', 'X', 'O'}, {'X', 'X', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'X', 'O', 'X', 'X', 'O', 'O', 'O', 'X', 'O', 'O'}, {'O', 'O', 'X', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'X', 'O', 'O', 'X', 'O', 'X', 'O', 'X', 'O', 'O'}, {'O', 'O', 'O', 'X', 'O', 'O', 'O', 'O', 'O', 'X', 'X', 'X', 'O', 'O', 'X', 'O', 'O', 'O', 'X', 'O'}, {'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O'}, {'X', 'O', 'O', 'O', 'O', 'X', 'O', 'O', 'O', 'X', 'X', 'O', 'O', 'X', 'O', 'X', 'O', 'X', 'O', 'O'} }; Solution sl = new Solution(); sl.solve(board); assertEquals('O', board[0][1]); assertEquals('X', board[1][1]); } }
952be643a23a28841232855b5f9e5c4ec14bd619
68243b860cf17e73f008ceb62521351ebf708b65
/normalTest/src/com/cpw/desginpattern/observer/Observable.java
e73b73b981d8dc20cf3f62aa2c740d8d9c44f7aa
[]
no_license
yincbao/normalTest
557be9ed084a6c7720d6283e17600d553d7e8b30
7315349dc15db0053edea23744dafe589dacd7ab
refs/heads/master
2021-01-21T14:58:06.446411
2016-07-29T08:53:47
2016-07-29T08:53:47
56,200,216
0
0
null
null
null
null
UTF-8
Java
false
false
1,719
java
package com.cpw.desginpattern.observer; import java.util.ArrayList; import java.util.List; public class Observable { //state private boolean changed = false; //observer collection private List<Observer> observers; public Observable() { observers = new ArrayList<Observer>(0); } //attach a oberver public synchronized void addObserver(Observer o) { if (o == null) throw new NullPointerException(); if (!observers.contains(o)) { observers.add(o); } } //detach a oberver public synchronized void deleteObserver(Observer o) { observers.remove(o); } //trigger all observers attached to this object observer to work public void notifyObservers() { notifyObservers(null); } //trigger all observers attached to this object observer to work public void notifyObservers(Object arg) { synchronized (this) { if (!changed) return; clearChanged(); } for (Observer observer : observers) { observer.update(this, arg); } } //Clears the observer list so that this object no longer has any observers. public synchronized void deleteObservers() { observers.clear(); } //Marks this Observable object as having been changed; protected synchronized void setChanged() { changed = true; } //Indicates that this object has no longer changed, or that it has already //notified all of its observers of its most recent change protected synchronized void clearChanged() { changed = false; } public synchronized boolean hasChanged() { return changed; } public synchronized int countObservers() { return observers.size(); } }
b366afc8ab843db97a4346bd20b27cd8a4d23025
575c19e81594666f51cceb55cb1ab094b218f66b
/octopusconsortium/src/main/java/OctopusConsortium/Core/CommonValues.java
ac984b123f121c74c7afda8da6be4c0484bb2b12
[ "Apache-2.0" ]
permissive
uk-gov-mirror/111online.ITK-MessagingEngine
62b702653ea716786e2684e3d368898533e77534
011e8cbe0bcb982eedc2204318d94e2bb5d4adb2
refs/heads/master
2023-01-22T17:47:54.631879
2020-12-01T14:18:05
2020-12-01T14:18:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,476
java
package OctopusConsortium.Core; import java.math.BigInteger; public class CommonValues { public CommonValues(String ods, String name){ ODS_ORGANISATION_CODE = ods; MANUFACTURER_NAME = name; ODS_URI = "urn:nhs-uk:identity:ods:" + ODS_ORGANISATION_CODE; ODS_ADDRESSING_URI = ODS_ADDRESS_BLANK + ODS_ORGANISATION_CODE; if (MANUFACTURER_NAME != null && !(MANUFACTURER_NAME.isEmpty())){ ODS_ASSIGNING_AUTHORITY_NAME = MANUFACTURER_NAME.toUpperCase() + " NHS TRUST"; } else{ ODS_ASSIGNING_AUTHORITY_NAME = ""; } } public String ODS_ORGANISATION_CODE; public String MANUFACTURER_NAME; public String ODS_URI; public String ODS_ADDRESSING_URI; public static final String ODS_ADDRESS_BLANK = "urn:nhs-uk:addressing:ods:"; //From here: http://www.connectingforhealth.nhs.uk/systemsandservices/data/ods/datafiles/tr.csv/view public String ODS_ASSIGNING_AUTHORITY_NAME; public static final String PATIENTDETAILS_REQUEST_SERVICE = "urn:nhs-itk:services:201005:getPatientDetails-v1-0"; public static final String PATIENTDETAILS_REQUEST_PROFILE = "urn:nhs-en:profile:getPatientDetailsRequest-v1-0"; public static final String SOFTWARE_NAME = "Message Engine ESB"; //Repeat caller public static final BigInteger HASC_VERSION = BigInteger.valueOf(1); public static final String REPEATCALLER_REPORT_SERVICE = "urn:nhs-itk:services:201005:SendNHS111Report-v2-0"; public static final String REPEATCALLER_REPORT_PROFILE = "urn:nhs-en:profile:nhs111CDADocument-v2-0"; public static final String REPEATCALLER_QUERY_SERVICE = "NHS111RepeatCallerSyncQueryResp-v1-0"; public static final String REPEATCALLER_QUERY_PROFILE = "urn:nhs-en:profile:nhs111RepeatCallerQuery-v1-0"; public static final String PATIENTDETAILS_REQUEST_OID = "2.16.840.1.113883.2.1.3.2.4.17.284"; public String getOrganisation_Name() { return MANUFACTURER_NAME + " Message Engine"; } public static final String APP_MAJOR_VERSION = "2"; public static final String APP_MINOR_VERSION = "5"; public static final String APP_REVISION_VERSION = "0"; public static final String APP_VERSION = APP_MAJOR_VERSION + "." + APP_MINOR_VERSION + "." + APP_REVISION_VERSION; public static final String WSDL_MAJOR_VERSION = "2"; public static final String WSDL_MINOR_VERSION = "5"; public static final String WSDL_REVISION_VERSION = "0"; public static final String WSDL_VERSION = WSDL_MAJOR_VERSION + "." + WSDL_MINOR_VERSION + "." + WSDL_REVISION_VERSION; }
273ef93dc6d55f4ca013d6acdb25053f8b6dedcc
53687df48a2ffe231f8596b88356b5632673a784
/data-crawler/src/main/java/service/DataCrawler.java
21508a4b983920c89381fa2aeda99f4fdf3b53ea
[]
no_license
nickbarban/MedicineStorageExaminer
bd948697f82f07409c3798ec18a61c83a6a43a70
ebb3df15b5084302c6845ef428250960cbcdf31f
refs/heads/master
2023-03-09T19:40:15.878405
2015-10-01T15:40:31
2015-10-01T15:40:31
42,923,359
0
0
null
2015-09-22T09:07:43
2015-09-22T09:07:42
null
UTF-8
Java
false
false
156
java
package service; import domain.DataCrawlerException; public interface DataCrawler { void startCrawling(String siteUrl) throws DataCrawlerException; }
9a15550799dfb737a2c2dd5f84f8e028d82efa8a
39cdddfa08314deead5782405f0558a9f4811a96
/src/damropa/code/FilterDamropa.java
ca597382e872bfc487cfaf3f426e4099e92ddcfd
[]
no_license
rudihartono/Damropa
7b77fcb0e2e9f51214d178a0d8ff858f9d2e7743
584a188126e6c8fcae9d939c97b337046bc8ea92
refs/heads/master
2020-05-17T17:00:45.615092
2014-12-23T02:11:39
2014-12-23T02:11:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,635
java
package damropa.code; import google.staticmap.Coordinate; import java.math.BigDecimal; import java.math.RoundingMode; import java.util.ArrayList; /** * Created by rudihartono on 23/12/2014. */ public class FilterDamropa { private ThreeParameters t; private ArrayList<RawDataDamropa> rawdata, filteredbySpeed; private ArrayList<RawDataProcessDamropa> filteredData; private ArrayList<RoadAnomalyDamropa> finalData; private final double SPEED = 5; private int length; public FilterDamropa(){ } public void setParameter(double tz, double tx, double ts){ t = new ThreeParameters(); this.t.setParameter(tz,tx,ts); } public void setLength(int length){ this.length = length; } public int getLength(){return this.length;} public ThreeParameters getParameter(){ return this.t; } public ArrayList<RawDataDamropa> getRawdata(){ return this.rawdata; } public ArrayList<RawDataDamropa> getRawDataSecondPhase(){ return this.filteredbySpeed; } public ArrayList<RawDataProcessDamropa> getFilteredData(){ return this.filteredData; } public ArrayList<RoadAnomalyDamropa> getFinalData(){ return this.finalData; } public void filter_by_speed(ArrayList<RawDataDamropa> e){ RawDataDamropa rawDataDamropa; filteredbySpeed = new ArrayList<RawDataDamropa>(); for(int i=0;i<e.size(); i++){ rawDataDamropa = e.get(i); if(rawDataDamropa.get_speed() > SPEED){ filteredbySpeed.add(e.get(i)); } } } public void high_pass_filter(ArrayList<RawDataDamropa> e){ filteredbySpeed = null; filteredbySpeed = new ArrayList<RawDataDamropa>(); filteredbySpeed.add(new RawDataDamropa(0, 0, e.get(0).get_lat(), e.get(0).get_lng(), e.get(0).get_speed(), e.get(0).get_heading(), e.get(0).get_date())); for(int i = 1;i<e.size() - 1;i++){ double xOut = (float) 0.9*filteredbySpeed.get(i-1).get_x() + 0.9*(e.get(i).get_x() - e.get(i-1).get_x()); double zOut = (float) 0.9*filteredbySpeed.get(i-1).get_z() + 0.9*(e.get(i).get_z() - e.get(i-1).get_z()); //parse big decimal //double xIn = convertFromBigDecimal(xOut); //double zIn = convertFromBigDecimal(zOut); filteredbySpeed.add(new RawDataDamropa(xOut, zOut, rawdata.get(i).get_lat(), rawdata.get(i).get_lng(), rawdata.get(i).get_speed(), rawdata.get(i).get_heading(), rawdata.get(i).get_date())); } } //flter by tz or threshold of z axis //get z and z array into other class data public void filter_by_z(ArrayList<RawDataDamropa> e){ RawDataDamropa rawDataDamropa; filteredData = new ArrayList<RawDataProcessDamropa>(); for(int i=0;i<e.size()-length; i++){ rawDataDamropa = e.get(i); double[] arrayX = new double[length]; double[] arrayZ = new double[length]; double speedSum = 0; if(Math.abs(rawDataDamropa.get_z()) > t.getTz()){ int j=0;//counter for array int k=i;//counter for array of damropalist while(k < i+length){ if(k < e.size()){ arrayX[j] = e.get(k).get_x(); arrayZ[j] = e.get(k).get_z(); speedSum += e.get(k).get_speed(); } k++; j++; } double speedMean = speedSum/length; filteredData.add(new RawDataProcessDamropa(rawDataDamropa.get_lat(),rawDataDamropa.get_lng(),speedMean,e.get(i).get_heading(),e.get(i).get_date(), arrayX,arrayZ)); speedMean = 0; speedSum = 0; i = i+ length; } } } //filter by tx for reject police bump, expansiont joint etc public void filter_by_tx(ArrayList<RawDataProcessDamropa> e){ RawDataProcessDamropa rdm; filteredData = null; filteredData = new ArrayList<RawDataProcessDamropa>(); for(int i=0;i<e.size(); i++){ rdm = e.get(i); boolean isDamageRoad = false; int j = 0; while(j < rdm.getArrayX().length && isDamageRoad == false){ double x = e.get(i).getArrayX()[j]; double z = e.get(i).getArrayZ()[j]; double xzrasio = (x/z); if(z > t.getTz()) { if (Math.abs(xzrasio) > t.getTx()) { isDamageRoad = true; } } j++; } if(isDamageRoad == true){ filteredData.add(rdm); } } } public double convertFromBigDecimal(double param){ BigDecimal value = new BigDecimal(Double.toString(param)); value = value.setScale(7, RoundingMode.UP); double newValue = Double.parseDouble(value.toString()); return newValue; } public void filter_by_ts(ArrayList<RawDataProcessDamropa> e){ RawDataProcessDamropa rdm; filteredData = null; filteredData = new ArrayList<RawDataProcessDamropa>(); for(int i=0;i<e.size(); i++){ rdm = e.get(i); boolean isDamageRoad = false; int j = 0; while(j<e.get(i).getArrayX().length && isDamageRoad == false){ if(rdm.getArrayZ()[j] > t.getTz()) { if (Math.abs(rdm.getArrayZ()[j]) > rdm.get_speed() * t.getTs()) { isDamageRoad = true; } } j++; } if(isDamageRoad == true){ filteredData.add(rdm); } } } public void toRoadAnomali(ArrayList<RawDataProcessDamropa> e){ finalData = new ArrayList<RoadAnomalyDamropa>(); filteredData = null; rawdata = null; int i = 0; while(i < e.size()){ finalData.add(new RoadAnomalyDamropa(new Coordinate(e.get(i).get_lat(),e.get(i).get_lng()),e.get(i).get_speed(), e.get(i).get_heading(),"pothole",e.get(i).get_date())); i++; } } public void setRawdata(ArrayList<RawDataDamropa> e){ rawdata = new ArrayList<RawDataDamropa>(); this.rawdata = e; } public int get_size(){ return filteredData.size(); } public int getFinalDataSize(){return finalData.size();} }
7fc926c4254a251fcad671060115380115a4f55d
389eaf5fb38e660e9f940c718227dbbf97bafb56
/abcd.zip_expanded/TN1/src/main/java/com/TN1/base/TestBase.java
d6917edf6e556bbe2b1676676152130468c90d64
[]
no_license
ashutoshpanchal05/OfficeRepo
77853da319cf8186d49d4ca11cc8d543cb8526cf
d0579078e3e723ac07aab65595be24a9b99f8c75
refs/heads/master
2022-07-11T01:40:45.160614
2019-12-19T11:54:35
2019-12-19T11:54:35
223,963,724
0
0
null
2022-06-29T17:48:13
2019-11-25T14:09:05
JavaScript
UTF-8
Java
false
false
3,343
java
package com.TN1.base; import java.io.FileInputStream; import java.util.Properties; import java.util.concurrent.TimeUnit; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.chrome.ChromeOptions; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.remote.CapabilityType; import org.openqa.selenium.remote.DesiredCapabilities; public class TestBase { public static WebDriver driver; public static Properties prop; public TestBase() { try { prop = new Properties(); FileInputStream ip = new FileInputStream("C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"); prop.load(ip); } catch(Exception e) { e.printStackTrace(); } } public static void initialisation() { String browsername = prop.getProperty("browser"); if(browsername.equals("chrome")) { DesiredCapabilities cap = DesiredCapabilities.chrome(); cap.setBrowserName(browsername); cap.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true); ChromeOptions option = new ChromeOptions(); option.addArguments("disable-infobars"); System.setProperty("webdriver.chrome.driver", "D:\\vm\\chromedriver.exe"); driver = new ChromeDriver(option); } else if (browsername.equals("firefox")) { System.setProperty("webdriver.gecko.driver", "D:\\vm\\geckodriver.exe"); driver = new FirefoxDriver(); } String url = prop.getProperty("url"); driver.get(url); driver.manage().window().maximize(); driver.manage().deleteAllCookies(); driver.manage().timeouts().pageLoadTimeout(2000, TimeUnit.SECONDS); driver.manage().timeouts().implicitlyWait(1000, TimeUnit.SECONDS); } // @BeforeTest // public void initialSetup() // { //// ExtentHtmlReporter reporter=new ExtentHtmlReporter("./Reports/Texas.html"); //// extent = new ExtentReports(); //// extent.attachReporter(reporter); // // } // @AfterTest // public void extentflush() // { //// extent.flush(); // } // public static String getScreenshot(WebDriver driver, String methodname) throws Exception // { // // Create object of SimpleDateFormat class and decide the format // DateFormat dateFormat = new SimpleDateFormat("MM-dd-yyyy "); // // //get current date time with Date() // Date date = new Date(); // // // Now format the date // String todaydate= dateFormat.format(date); // // TakesScreenshot ts = (TakesScreenshot) driver; // File source = ts.getScreenshotAs(OutputType.FILE); // //after execution, you could see a folder "FailedTestsScreenshots" under src folder // String destination = System.getProperty("user.dir") + "/ScreenShots/"+methodname+"_"+ todaydate+".png"; // File finalDestination = new File(destination); // //FileUtils.copyFile(source, finalDestination); // //Returns the captured file path // return destination; // } //// public static void pass() //// { //// Reporter.log("Test Case Passed"); //// //test.log(Status.PASS, "Test Case Passed"); //// //// } //// public static void fail(String methodname) //// { //// //// try { //// getScreenshot(driver,methodname); //// //test.log(Status.FAIL, "Test Case Failed"); //// } catch (Exception e1) { //// // TODO Auto-generated catch block //// e1.printStackTrace(); //// } //// //// } }
949f1413ff18ac639af953b6616511a66f62452e
6f9e9fbf162fca96bb41e55320a21f7039d582fa
/app/src/main/java/pe/kinsamaru/ribbit/FriendsFragment.java
31182cf1abd2fe6cdef55b5de5ba3eef40b98125
[]
no_license
jtrells/Ribbit-tth
7ee6209efe7c59a6ef7fa42b54167e4042e08683
0fb979970e56a5dd283dc28429748ea776b1a130
refs/heads/master
2021-01-17T00:17:17.732191
2014-10-27T01:05:15
2014-10-27T01:05:15
25,797,549
1
0
null
null
null
null
UTF-8
Java
false
false
2,826
java
package pe.kinsamaru.ribbit; import android.app.AlertDialog; import android.os.Bundle; import android.support.v4.app.ListFragment; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import com.parse.FindCallback; import com.parse.ParseException; import com.parse.ParseQuery; import com.parse.ParseRelation; import com.parse.ParseUser; import java.util.List; /** * Created by juan on 10/24/14. */ public class FriendsFragment extends ListFragment { public static final String TAG = FriendsFragment.class.getSimpleName(); protected List<ParseUser> mFriends; protected ParseRelation<ParseUser> mFriendsRelation; protected ParseUser mCurrentUser; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_friends, container, false); return rootView; } @Override public void onResume() { super.onResume(); mCurrentUser = ParseUser.getCurrentUser(); mFriendsRelation = mCurrentUser.getRelation(ParseConstants.KEY_FRIENDS_RELATION); getActivity().setProgressBarIndeterminateVisibility(true); ParseQuery<ParseUser> query = mFriendsRelation.getQuery(); query.addAscendingOrder(ParseConstants.KEY_USERNAME); query.findInBackground(new FindCallback<ParseUser>() { @Override public void done(List<ParseUser> friends, ParseException e) { getActivity().setProgressBarIndeterminateVisibility(false); if ( e == null ) { mFriends = friends; String[] usernames = new String[mFriends.size()]; int i = 0; for (ParseUser user : mFriends) { usernames[i] = user.getUsername(); i++; } ArrayAdapter<String> adapter = new ArrayAdapter<String>(getListView().getContext(), android.R.layout.simple_list_item_1, usernames); setListAdapter(adapter); } else { Log.e(TAG, e.getMessage()); AlertDialog.Builder builder = new AlertDialog.Builder(getListView().getContext()); builder.setMessage(e.getMessage()) .setTitle(R.string.error_title) .setPositiveButton(android.R.string.ok, null); AlertDialog dialog = builder.create(); dialog.show(); } } }); } }
3e2eabedab685d085258810e31ac9b8e1aa91f78
ccf6be9c899fc3460a190c99722019e004370868
/src/TeraGame/src/main/java/com/angelis/tera/game/presentation/network/packet/client/character/CM_CHARACTER_CREATE_NAME_USED_CHECK.java
27c3584a51fb043563d71dca0ea6b1126d586f16
[]
no_license
Mangdar/tera-jenova
d3b8e99935f9292ac6e3b0155021ed01738b79c5
83b420cd36086fdbb01fc8b03f42824d7fdfb1dd
refs/heads/master
2021-01-19T01:57:32.624031
2014-12-27T22:57:10
2014-12-27T22:57:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
901
java
package com.angelis.tera.game.presentation.network.packet.client.character; import java.nio.ByteBuffer; import com.angelis.tera.game.presentation.network.connection.TeraGameConnection; import com.angelis.tera.game.presentation.network.packet.TeraClientPacket; import com.angelis.tera.game.process.services.PlayerService; public class CM_CHARACTER_CREATE_NAME_USED_CHECK extends TeraClientPacket { private short type; private String name; public CM_CHARACTER_CREATE_NAME_USED_CHECK(final ByteBuffer byteBuffer, final TeraGameConnection connection) { super(byteBuffer, connection); } @Override protected void readImpl() { this.type = readH(); this.name = readS(); } @Override protected void runImpl() { PlayerService.getInstance().onPlayerCheckNameUsed(this.getConnection(), type, name); } }
[ "[email protected]@f1fa2e4f-7cc9-b0fc-4b68-2a085ed95716" ]
[email protected]@f1fa2e4f-7cc9-b0fc-4b68-2a085ed95716
36f211453a43decf641c8c32cb2e5fb2e1660428
45112f19c1972f072c63866dbbcd1ffc5123bfad
/Project3/src/COLOR.java
6edc7de2b6784a6fb0ecf3ec47233b9ed470aa8d
[]
no_license
navarrojandg/COMP282
5f10f97d46e74353362c61ee8e17570b9ecd5747
2d8b0ce07e49a86e0986974b6f8f73453f51f7b3
refs/heads/master
2023-04-17T22:49:22.301595
2021-05-11T02:37:13
2021-05-11T02:37:13
341,303,087
0
0
null
null
null
null
UTF-8
Java
false
false
36
java
public enum COLOR { BLACK, RED }
0a71595ec4458086eee05c4afa513c6603623813
4424b655eaa39a9f4028a32a84b62d61ec3db72a
/executive_app/src/main/java/com/lnbinfotech/msplfootwearex/log/LogBean.java
f45fbd770234c461eda32839e06d58d7013c3d4b
[]
no_license
paitsystems/MSPL_Footwear
a2b615bb5568e783329782ce403c6fe5ed793f3d
5072934baeca36214beacadb2d659df35e1b8fcf
refs/heads/master
2022-01-21T06:49:12.566742
2017-09-14T10:31:26
2017-09-14T10:31:26
103,097,964
0
0
null
2019-02-26T07:02:47
2017-09-11T06:24:48
Java
UTF-8
Java
false
false
1,039
java
package com.lnbinfotech.msplfootwearex.log; // Created by lnb on 8/11/2016. public class LogBean { String datetime,classname, networkname, isConnected, isServiceStarted; public String getDatetime() { return datetime; } public void setDatetime(String datetime) { this.datetime = datetime; } public String getClassname() { return classname; } public void setClassname(String classname) { this.classname = classname; } public String getNetworkname() { return networkname; } public void setNetworkname(String networkname) { this.networkname = networkname; } public String getIsConnected() { return isConnected; } public void setIsConnected(String isConnected) { this.isConnected = isConnected; } public String getIsServiceStarted() { return isServiceStarted; } public void setIsServiceStarted(String isServiceStarted) { this.isServiceStarted = isServiceStarted; } }
1ac3aa29bb982d823f1b240ebb56a252ff5c56fb
73f68d0bb44647e5662981b946d66b13e26d76a2
/src/main/java/com/mj/algo/tree/Serialize.java
eb96f3d761e7effc34d5457abfd7df5914beb8c6
[]
no_license
mritunjayonemail/algo
f43c5759aae4467cb356b20506fbd37b9d2a74d7
b9c1a8be6bf80673dded2e65ddd711e0abe0bd72
refs/heads/master
2021-07-12T01:02:53.253222
2021-03-15T05:59:30
2021-03-15T05:59:30
42,799,038
1
0
null
2020-10-13T07:16:09
2015-09-20T03:40:05
Java
UTF-8
Java
false
false
2,878
java
package com.mj.algo.tree; import com.mj.algo.tree.modal.Tree; import java.util.Arrays; import java.util.LinkedList; import java.util.List; /* Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or transmitted across a network connection link to be reconstructed later in the same or another computer environment. Design an algorithm to serialize and deserialize a binary tree. There is no restriction on how your serialization/deserialization algorithm should work. You just need to ensure that a binary tree can be serialized to a string and this string can be deserialized to the original tree structure. Clarification: The input/output format is the same as how LeetCode serializes a binary tree. You do not necessarily need to follow this format, so please be creative and come up with different approaches yourself. Example 1: Input: root = [1,2,3,null,null,4,5] Output: [1,2,3,null,null,4,5] Example 2: Input: root = [] Output: [] Example 3: Input: root = [1] Output: [1] Example 4: Input: root = [1,2] Output: [1,2] */ public class Serialize { private String rSerialize(Tree tree, String str){ if(tree==null) return str + "null,"; str = str + tree.getValue() + ','; str = rSerialize(tree.getLeft(), str); str = rSerialize(tree.getRight(), str); return str; } public String serealize(Tree tree){ return rSerialize(tree, ""); } private Tree<String> rDeserealize(List<String> l){ if(l.get(0).equals("null")){ l.remove(0); return null; } Tree tree = new Tree(l.get(0), null, null); l.remove(0); Tree left = rDeserealize(l); Tree right = rDeserealize(l); tree.setLeft(left); tree.setRight(right); return tree; } public Tree<String> deserealize(String s){ String[] data_array = s.split(","); List<String> data_list = new LinkedList(Arrays.asList(data_array)); return rDeserealize(data_list); } public static void main(String args[]){ Tree<String> child11 = new Tree<String>("D", null, null); Tree<String> child22 = new Tree<String>("E", null, null); Tree<String> child33 = new Tree<String>("F", null, null); Tree<String> child44 = new Tree<String>("G", null, null); Tree<String> child1 = new Tree<String>("B", child11, child22); Tree<String> child2 = new Tree<String>("C", child33, child44); Tree<String> root = new Tree<String>("A", child1, child2); Serialize se = new Serialize(); String ser = se.serealize(root); System.out.println("Serialized string is " + ser); Tree des = se.deserealize(ser); System.out.println("DeSerialized node is " + des); } }
033ffef38f7af7c2f17c49c4b68a1aaea870df70
963599f6f1f376ba94cbb504e8b324bcce5de7a3
/sources/p035ru/unicorn/ujin/view/activity/navigation/p058ui/myrenta/$$Lambda$MyRentaViewModel$nJVBF1EZDvU50ybIkzJ143LJAM0.java
33f541e6a1c81932078494355403a6a4b2150ddd
[]
no_license
NikiHard/cuddly-pancake
563718cb73fdc4b7b12c6233d9bf44f381dd6759
3a5aa80d25d12da08fd621dc3a15fbd536d0b3d4
refs/heads/main
2023-04-09T06:58:04.403056
2021-04-20T00:45:08
2021-04-20T00:45:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
804
java
package p035ru.unicorn.ujin.view.activity.navigation.p058ui.myrenta; import p046io.reactivex.functions.Function; /* renamed from: ru.unicorn.ujin.view.activity.navigation.ui.myrenta.-$$Lambda$MyRentaViewModel$nJVBF1EZDvU50ybIkzJ143LJAM0 reason: invalid class name */ /* compiled from: lambda */ public final /* synthetic */ class $$Lambda$MyRentaViewModel$nJVBF1EZDvU50ybIkzJ143LJAM0 implements Function { public static final /* synthetic */ $$Lambda$MyRentaViewModel$nJVBF1EZDvU50ybIkzJ143LJAM0 INSTANCE = new $$Lambda$MyRentaViewModel$nJVBF1EZDvU50ybIkzJ143LJAM0(); private /* synthetic */ $$Lambda$MyRentaViewModel$nJVBF1EZDvU50ybIkzJ143LJAM0() { } public final Object apply(Object obj) { return MyRentaViewModel.lambda$getMyRentaUniqeNoFilter$34((RentInfo) obj); } }
763bfcf793f939636ed369d42caa2caac1191b2a
465a93d0231c051a4bddeeefe5ec49568ff7a7a3
/cdn/src/main/java/com/jdcloud/sdk/service/cdn/model/DeleteForbiddenStreamResponse.java
79619825aa633e0e4ab92f7b2ee5bbbfa46317e9
[ "Apache-2.0" ]
permissive
13078263112/jdcloud-sdk-java
ee1e9e9e65c171a19f26ea7e5c5b7d8a246e3746
2165655f71246babe3988c08e5a559eea36468d1
refs/heads/master
2022-11-09T14:10:19.960835
2020-06-16T04:13:53
2020-06-16T04:13:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,101
java
/* * Copyright 2018 JDCLOUD.COM * * 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. * * 直播域名操作类接口 * Openapi For JCLOUD cdn * * OpenAPI spec version: v1 * Contact: [email protected] * * NOTE: This class is auto generated by the jdcloud code generator program. */ package com.jdcloud.sdk.service.cdn.model; import com.jdcloud.sdk.service.JdcloudResponse; /** * 删除禁播流 */ public class DeleteForbiddenStreamResponse extends JdcloudResponse<DeleteForbiddenStreamResult> implements java.io.Serializable { private static final long serialVersionUID = 1L; }
11cc81c2dec7d1fe725e623e0184c41da7e9ad1c
e6166130e644447c3fb07bbb4b56d1a97712467b
/src/app/google_map/GoogleMapGenMain.java
7ddb619972844280b8715657c33b2c77031b7b14
[]
no_license
TANJX/Playground
69a74dc0d0ba4e2a7c88fee790c451c53fa05277
389df0e04aed2b6186d6aa02f3f7ad524fb9377f
refs/heads/master
2023-02-17T08:23:42.502329
2019-07-09T15:05:15
2019-07-09T15:05:15
47,091,311
1
0
null
2023-02-09T19:46:17
2015-11-30T02:43:11
Java
UTF-8
Java
false
false
2,855
java
package app.google_map; /* * Created by david on 2019/01/26. * Copyright ISOTOPE Studio */ import javax.imageio.ImageIO; import java.awt.*; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.util.List; public class GoogleMapGenMain { public static void main(String[] args) throws IOException { double x1 = 22.8864101, y1 = 113.6922456, x2 = 22.0119839, y2 = 114.2425105; final String rootPath = "C:\\Users\\david\\Desktop\\Google Maps\\"; for (int zoom = 13; zoom < 14; zoom++) { System.out.println("Generating Zoom " + zoom); generate(x1, y1, x2, y2, zoom, rootPath); } } private static void generate(double x1, double y1, double x2, double y2, int zoom, String rootPath) { List<String> list = GenerateCoords.generateCoords(x1, y1, x2, y2, zoom); final String outputPath = rootPath + "zoom " + zoom + "\\"; File dir = new File(outputPath); if (!dir.exists()) dir.mkdirs(); for (String line : list) { String[] split = line.split(","); if (split.length < 3) continue; double lat = Double.parseDouble(split[1]); double lon = Double.parseDouble(split[2]); String url = StaticAPISign.getUrl(lat, lon, zoom); OpenImage.saveImageOnline(url, outputPath + split[0] + ".png"); System.out.println("Saving " + split[0] + " done!"); } int s1 = Integer.parseInt(list.get(list.size() - 1).split(",")[0].split("-")[0]); int s2 = Integer.parseInt(list.get(list.size() - 1).split(",")[0].split("-")[1]); System.out.println("Saving image..."); // Save as new image try { // create the new image, canvas size is the max. of both image sizes int w = s2 * 1280; int h = s1 * 1200; BufferedImage combined = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB); Graphics g = combined.getGraphics(); File path = new File(outputPath); File[] listOfFiles = path.listFiles(); assert listOfFiles != null; for (File image_file : listOfFiles) { BufferedImage image = ImageIO.read(image_file); String[] split = image_file.getName().split("\\.")[0].split("-"); int x = Integer.parseInt(split[1]) - 1; int y = Integer.parseInt(split[0]) - 1; System.out.println("Adding " + x + " " + y); g.drawImage(image, x * 1280, y * 1200, null); } ImageIO.write(combined, "PNG", new File(new File(rootPath), "combined zoom " + zoom + ".png")); } catch (IOException e) { e.printStackTrace(); } System.out.println("Completed."); } }
e60e5869503150461c4f1876015e58cb4749b989
ce152adea481d8545ec4bd5c81996d45d21804de
/app/src/main/java/com/stevehomes/sreeniavask/todaybtech/B_pri_eee_4_2.java
105d31ff52393ccf4924e428680bf4be9c0203bb
[]
no_license
Sreenivassreee/ToDayBtech
73bd4883c120b831b817dc091a3e1402c05ede3d
1dd6d0f7547952906bd425fb09ce874b328f2b1d
refs/heads/master
2023-01-29T02:08:23.295638
2020-12-10T06:53:15
2020-12-10T06:53:15
320,185,919
2
0
null
null
null
null
UTF-8
Java
false
false
5,155
java
package com.stevehomes.sreeniavask.todaybtech; import android.app.ProgressDialog; import android.content.Intent; import android.graphics.Bitmap; import android.net.Uri; import android.os.Bundle; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; import android.view.WindowManager; import android.webkit.DownloadListener; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.Toast; public class B_pri_eee_4_2 extends AppCompatActivity { private WebView mWebView; Toolbar toolbar; ProgressDialog pDialog; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Utils.onActivityCreateSetTheme(this); setContentView(R.layout.b_pri_eee_4_2); // actionBar = getSupportActionBar(); // actionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#212121"))); mWebView = (WebView) findViewById(R.id.pri_eee_4_2_web); toolbar = findViewById(R.id.toolbar); mWebView.setBackgroundResource(R.drawable.loder); mWebView.setBackgroundColor(0x00000); setSupportActionBar(toolbar); getSupportActionBar().setTitle("Previous Question Papers"); // toolbar.setSubtitle(" SteveHomes"); // toolbar.setLogo(R.drawable.tool_icon); getSupportActionBar().setDisplayShowHomeEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_menu2); // Enable Javascript WebSettings webSettings = mWebView.getSettings(); webSettings.setJavaScriptEnabled(true); if (savedInstanceState == null) { mWebView.loadUrl("https://todaybtech.blogspot.com/p/blog-page_95.html"); } mWebView.setWebViewClient(new WebViewClient()); mWebView.setDownloadListener(new DownloadListener() { public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) { Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(url)); startActivity(i); } }); // if (savedInstanceState == null) { // getSupportFragmentManager().beginTransaction() // .add(R.id.container, new PlaceholderFragment()) // .commit(); // // // } // init(); listener(); } @Override protected void onSaveInstanceState(Bundle outState ) { super.onSaveInstanceState(outState); mWebView.saveState(outState); } @Override protected void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); mWebView.restoreState(savedInstanceState); } private void init() { pDialog = new ProgressDialog(B_pri_eee_4_2.this); pDialog.setTitle("Please Wait..."); pDialog.setMessage("Wait for few seconds till the PDF file loads..."); pDialog.setIndeterminate(false); pDialog.setCancelable(true); } private void listener() { mWebView.setWebViewClient(new WebViewClient() { @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { super.onPageStarted(view, url, favicon); try{ pDialog.show(); } catch (WindowManager.BadTokenException exception ) { }catch(IllegalArgumentException e){ } } @Override public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); try{ pDialog.dismiss(); } catch (WindowManager.BadTokenException exception ) { }catch(IllegalArgumentException e){ } } }); } @Override public void onBackPressed() { if (mWebView.canGoBack()) { mWebView.goBack(); } else { super.onBackPressed(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.main_manu, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.home: Intent intent = new Intent(this, features.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); Toast.makeText(this, "You are at Home ", Toast.LENGTH_SHORT).show(); break; case android.R.id.home: finish(); break; } return super.onOptionsItemSelected(item); } }
5c4c2364b2c2fc74adac7c5ef7a9f2924d93094f
454f8e987947dc0b67a107984588ef6f9b73f4d8
/bulb-spring/src/main/java/com/maxzuo/bulb/spring/ClassPathXmlApplicationContextExample.java
89259988cd89cb7d70776043d19f5c68a78522c1
[]
no_license
tanfengtiantian/bulb
c57d7e7da2d06e1ab1be79a4162f2eb3814d7d4f
553c8ce89f48e7e2b220d15074c6574b343b73e1
refs/heads/master
2020-05-25T12:27:27.896172
2019-05-21T08:54:45
2019-05-21T08:54:45
187,799,098
0
0
null
2019-05-21T08:52:20
2019-05-21T08:52:20
null
UTF-8
Java
false
false
592
java
package com.maxzuo.bulb.spring; import com.maxzuo.bulb.spring.model.Token; import org.springframework.context.support.ClassPathXmlApplicationContext; /** * 应用启动(Spring standlone container) * * Created by zfh on 2019/04/04 */ public class ClassPathXmlApplicationContextExample { public static void main(String[] args) { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("classpath:spring-context.xml"); context.start(); Token token = context.getBean("getToken", Token.class); System.out.println(token); } }
d93853f360c4ca36385b1eb76993f805c3e1b386
64e2edd52df614500c5c62f9a8f61abeca058fc0
/src/main/java/com/is/json/status/NoteMessageStatus.java
d7048e8d3d35b1a93b97b319029e153e251ecfab
[]
no_license
SaltedFishTeam/is
5517cb883c0584b7a5ec95cefe06f593ae8c4dce
27e8e25cb6790ff20811e3530d86cfeb5d1b8f46
refs/heads/master
2020-03-10T20:46:42.400655
2018-06-22T07:07:38
2018-06-22T07:07:38
129,577,085
2
0
null
null
null
null
UTF-8
Java
false
false
448
java
package com.is.json.status; import java.util.List; import com.is.json.entty.NoteMessageVO; public class NoteMessageStatus extends Status { private NoteMessageVO vo; public NoteMessageStatus(String status, int code, String msg) { super(status, code, msg); // TODO Auto-generated constructor stub } public NoteMessageVO getVo() { return vo; } public void setVo(NoteMessageVO vo) { this.vo = vo; } }
37c6b5434412f3ecc57d3d6bd02562aaa2c1da26
8c59bbd7712778cf8185250f87990910074f98ba
/android/app/src/main/java/com/casumo/MainActivity.java
7c608ca4552b080c188fc94887f1515cfc59d124
[]
no_license
Zeus-Syed/casumo-test
506c03a3c506c6e4ad3a05fa48c05f3bfbc0ab76
a325cece5e5fe75bb96b95f9e0543057b930d951
refs/heads/master
2023-04-29T14:43:11.573362
2021-05-29T08:13:30
2021-05-29T08:13:30
371,916,729
0
0
null
null
null
null
UTF-8
Java
false
false
339
java
package com.casumo; 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 "casumo"; } }
7fc08efa042f7d139c0af701960e5a63915410a5
de806161d50f53f4b4249d5ea53ddddc82bfd3f6
/bench4q/branches/Bench4Q_qxl/src/org/bench4Q/common/communication/AbstractSender.java
1ba500d56437b86ef84556ee9cd8b038d71c8a9d
[]
no_license
lijianfeng941227/Bench4Q-TPCW
1ad2141fd852ad88c6db3ed8ae89a56f2fdb0ecc
2e1c84d1bf1d6cdad4b19a348daf85b59e4f1ce4
refs/heads/master
2021-01-11T05:43:33.312249
2016-04-07T01:58:01
2016-04-07T01:58:01
71,343,265
1
0
null
2016-10-19T09:55:21
2016-10-19T09:55:21
null
UTF-8
Java
false
false
4,036
java
/** * ========================================================================= * Bench4Q version 1.1.1 * ========================================================================= * * Bench4Q is available on the Internet at http://forge.ow2.org/projects/jaspte * You can find latest version there. * * Distributed according to the GNU Lesser General Public Licence. * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or any * later version. * * SEE Copyright.txt FOR FULL COPYRIGHT INFORMATION. * * This source code is distributed "as is" in the hope that it will be * useful. It comes with no warranty, and no author or distributor * accepts any responsibility for the consequences of its use. * * * This version is a based on the implementation of TPC-W from University of Wisconsin. * This version used some source code of The Grinder. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Initial developer(s): Zhiquan Duan. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ package org.bench4Q.common.communication; import java.io.IOException; import java.io.ObjectOutputStream; import java.io.OutputStream; import org.bench4Q.common.UncheckedInterruptedException; /** * Abstract class that manages the sending of messages. */ abstract class AbstractSender implements Sender { private volatile boolean m_shutdown = false; /** * Send the given message. * * @param message * A {@link Message}. * @exception CommunicationException * If an error occurs. */ public final void send(Message message) throws CommunicationException { if (m_shutdown) { throw new CommunicationException("Shut down"); } try { writeMessage(message); } catch (IOException e) { UncheckedInterruptedException.ioException(e); throw new CommunicationException("Exception whilst sending message", e); } } /** * Template method for subclasses to implement the sending of a message. * @param message * @throws CommunicationException * @throws IOException */ protected abstract void writeMessage(Message message) throws CommunicationException, IOException; protected static final void writeMessageToStream(Message message, OutputStream stream) throws IOException { // I tried the model of using a single ObjectOutputStream for the // lifetime of the Sender and a single ObjectInputStream for each // Reader. However, the corresponding ObjectInputStream would get // occasional EOF's during readObject. Seems like voodoo to me, // but creating a new ObjectOutputStream for every message fixes // this. // Dr Heinz M. Kabutz's Java Specialists 2004-05-19 newsletter // (http://www.javaspecialists.co.za) may hold the answer. // ObjectOutputStream's cache based on object identity. The EOF // might be due to this, or at least ObjectOutputStream.reset() // may help. I can't get excited enough about the cost of creating // a new ObjectOutputStream() to try this as the bulk of what we // send are long[]'s so aren't cacheable, and it would break sends // that reuse Messages. final ObjectOutputStream objectStream = new ObjectOutputStream(stream); objectStream.writeObject(message); objectStream.flush(); } /** * Cleanly shutdown the <code>Sender</code>. */ public void shutdown() { try { send(new CloseCommunicationMessage()); } catch (CommunicationException e) { // Ignore. } // Keep track of whether we've been closed. Can't rely on delegate // as some implementations don't do anything with close(), e.g. // ByteArrayOutputStream. m_shutdown = true; } /** * Return whether we are shutdown. * * @return <code>true</code> if and only if we are shut down. */ public boolean isShutdown() { return m_shutdown; } }
a9270e8c231c27c2e7eedc0c9a52345ae35523db
73267be654cd1fd76cf2cb9ea3a75630d9f58a41
/services/organizations/src/main/java/com/huaweicloud/sdk/organizations/v1/model/DeclineHandshakeResponse.java
98ba3121a60ae7ade0cec1729f1d4bd1f9180ef9
[ "Apache-2.0" ]
permissive
huaweicloud/huaweicloud-sdk-java-v3
51b32a451fac321a0affe2176663fed8a9cd8042
2f8543d0d037b35c2664298ba39a89cc9d8ed9a3
refs/heads/master
2023-08-29T06:50:15.642693
2023-08-24T08:34:48
2023-08-24T08:34:48
262,207,545
91
57
NOASSERTION
2023-09-08T12:24:55
2020-05-08T02:27:00
Java
UTF-8
Java
false
false
2,183
java
package com.huaweicloud.sdk.organizations.v1.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.huaweicloud.sdk.core.SdkResponse; import java.util.Objects; import java.util.function.Consumer; /** * Response Object */ public class DeclineHandshakeResponse extends SdkResponse { @JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty(value = "handshake") private HandshakeDto handshake; public DeclineHandshakeResponse withHandshake(HandshakeDto handshake) { this.handshake = handshake; return this; } public DeclineHandshakeResponse withHandshake(Consumer<HandshakeDto> handshakeSetter) { if (this.handshake == null) { this.handshake = new HandshakeDto(); handshakeSetter.accept(this.handshake); } return this; } /** * Get handshake * @return handshake */ public HandshakeDto getHandshake() { return handshake; } public void setHandshake(HandshakeDto handshake) { this.handshake = handshake; } @Override public boolean equals(java.lang.Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } DeclineHandshakeResponse that = (DeclineHandshakeResponse) obj; return Objects.equals(this.handshake, that.handshake); } @Override public int hashCode() { return Objects.hash(handshake); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class DeclineHandshakeResponse {\n"); sb.append(" handshake: ").append(toIndentedString(handshake)).append("\n"); sb.append("}"); return sb.toString(); } /** * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } }
718044db65054f2c3f2950c0ec30146f60eec5ea
449c87f12e5fe525b4a385468df58ec0ad7a0e0c
/src/ex_3/Pangrammi.java
458938d828d1c4afd28746ca04fa9348264334ab
[]
no_license
EdoardoErrani993/epjp
8683684a05ebb478950609b9e9681d0249b4ecdc
bc3a0ce2c6f4ef19d55402ddbbdb42653f743c26
refs/heads/master
2020-07-26T21:10:10.302551
2019-10-03T15:53:56
2019-10-03T15:53:56
208,766,396
0
0
null
2019-09-16T09:54:32
2019-09-16T09:54:32
null
UTF-8
Java
false
false
48
java
package ex_3; public class Pangrammi { }
2915006d1c44b5f09eabdcebddc6cf79acae3bce
08a45755c9f907a5d82fc09034d6778e8cf6afc0
/MGL 846/src/main/java/Employee/conn.java
7f85a874f8d938a9aad40575cd080a3f79db6110
[]
no_license
Aklinar/MGL-846
118ca5d970c95a1e8a9fb2ad21eadd62c71f9002
4feb53d2298f9d5ac47736d9c72ac0d76b6e7c8e
refs/heads/master
2023-04-16T09:23:09.894524
2021-04-22T15:35:35
2021-04-22T15:35:35
346,479,486
0
0
null
null
null
null
UTF-8
Java
false
false
739
java
package main.java.Employee; /* CLASS Creation Steps: 1.conn 2.welcome_page 3.login_page 4.details_page 5.add_employee 6.view_employee 7.print_data 8.remove_employee 9.search_employee 10.update_employee */ import java.sql.*; public class conn { //Create two interface public Connection c; // used to set up connection with mysql public Statement st; // used to execute all queries of mysql public conn() { try { Class.forName("com.mysql.cj.jdbc.Driver"); // Load mysql jdbc driver c = DriverManager.getConnection("jdbc:mysql://localhost:3306/ets?useSSL=false&serverTimezone=UTC","root","etsets"); st = c.createStatement(); // helpful to execute query } catch(Exception e) { e.printStackTrace(); } } }
cb7dd2afcb56b29c8687351e43960709eeef1d49
482216af451046e945990054581d92887a14f911
/org.dojotoolkit.optimizer.tests/src/org/dojotoolkit/optimizer/tests/RhinoAMDOptimizerTest.java
34ffe475a0f26e1aaff73917f034c119c2dcc5bc
[ "BSD-3-Clause", "AFL-2.1" ]
permissive
zazl/optimizer
fe7baa7acaf1d75dbb70557b234f5b0cf56f0bbe
233395469223dfcf039fc785c78b7c29ac4ebe5d
refs/heads/master
2021-01-23T09:52:12.638454
2019-10-18T14:13:41
2019-10-18T14:13:41
1,967,880
4
0
NOASSERTION
2019-10-18T14:13:42
2011-06-28T18:13:38
Java
UTF-8
Java
false
false
669
java
/* Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved. Available via Academic Free License >= 2.1 OR the modified BSD license. see: http://dojotoolkit.org/license for details */ package org.dojotoolkit.optimizer.tests; import org.dojotoolkit.optimizer.amd.rhino.AMDJSOptimizerFactory; import org.osgi.framework.BundleContext; public class RhinoAMDOptimizerTest extends AMDOptimizerTest { public RhinoAMDOptimizerTest(BundleContext bundleContext, String[] ids, String handlerConfig) { super(bundleContext, ids, handlerConfig); } protected void setUp() throws Exception { super.setUp(); factory = new AMDJSOptimizerFactory(); } }
2fd45b35222a06671d84601bd8e5d30c713dd2ee
e11a56fd52fc39b32baf9f2e98bfe7bb0da59883
/ykposprint/android/src/main/java/com/jd/ykposprint/BTPrinterPackage.java
cb00660c49b8f943cf01037e226c72431b36f554
[]
no_license
fenglingwy/YKPrintNpm
4ad6b759fd64d7c8d0ac8400c7d31223a42a3ff8
2085ed5b634d1c072ebb38d0af7682fd120e87e7
refs/heads/master
2021-07-06T23:59:46.473303
2020-08-27T09:10:56
2020-08-27T09:10:56
178,205,491
0
0
null
null
null
null
UTF-8
Java
false
false
774
java
package com.jd.ykposprint; import com.facebook.react.ReactPackage; import com.facebook.react.bridge.NativeModule; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.uimanager.ViewManager; import java.util.Arrays; import java.util.Collections; import java.util.List; /** * Created by limingguang on 2018/8/25. */ public class BTPrinterPackage implements ReactPackage { @Override public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) { return Arrays.<NativeModule>asList( new BTPrinterModule(reactContext) ); } @Override public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) { return Collections.emptyList(); } }
86fa5bf1e08b6d102e3c4a03818d2f5d4e50fead
f7be1e0b012824ce61771f6113a0b39cd3a4f336
/src/boj/Main_백준_15685_드래곤커브_서울8반_김영연.java
a4187b173169f7eb8b12dbff0ac4e8f508a66ae2
[]
no_license
yeongyeonkim/SSAFY_Algo
cc406f5f3da0b9d9c780ce80e9419685813e6d9b
9ba9dc77b09c415748b0196628e9dd65873af83c
refs/heads/master
2022-02-28T14:14:20.015859
2022-02-10T07:17:55
2022-02-10T07:17:55
201,189,317
0
0
null
null
null
null
UTF-8
Java
false
false
1,929
java
package boj; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.StringTokenizer; public class Main_백준_15685_드래곤커브_서울8반_김영연 { static boolean[][] visit; static ArrayList<Integer> dragon; static int[] dx = {0, -1, 0, 1}; static int[] dy = {1, 0, -1, 0}; public static void make_dragon() { //스택처럼 ArrayList의 요소들을 전체크기만큼 뒤에서부터 0인덱스까지 참조하며 //그값에 해당하는 값을 ArrayList에 add하는방식 for(int g=1; g<=10; g++) { //g의 범위가 10까지이므로. int size = dragon.size(); int index = size-1; for(int i=0; i<size; i++) { //사이즈만큼반복 int num = dragon.get(index); num = num + 1 == 4 ? 0 : num + 1; dragon.add(num); index--; } } } public static void move(int x, int y, int dir, int k) { //visit으로 점 visit[x][y] = true; for(int i=0; i<k; i++) { int num = (dragon.get(i) + dir)%4; x += dx[num]; y += dy[num]; visit[x][y] = true; } } public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); StringTokenizer st; dragon = new ArrayList<>(); dragon.add(0); make_dragon(); visit = new boolean[101][101]; int cnt = 0; for(int i=0; i<n; i++) { st = new StringTokenizer(br.readLine(), " "); int y = Integer.parseInt(st.nextToken()); int x = Integer.parseInt(st.nextToken()); int dir = Integer.parseInt(st.nextToken()); int k = (int) Math.pow(2, Integer.parseInt(st.nextToken())); move(x, y, dir, k); } for(int i=0; i<=99; i++) { for(int j=0; j<=99; j++) { if(visit[i][j] && visit[i+1][j] && visit[i][j+1] && visit[i+1][j+1]) cnt++; } } System.out.println(cnt); } }
87e67d994541633b53f2a52072a7b201f15e7ac2
e2c85a214fc7174cda8e398a24f9c091b458eb65
/src/main/java/com/mmk/business/condition/WxUserCondition.java
0274fd2869fab6ab852e04621bd095d2cdb73362
[]
no_license
sunzhongqiang/system
708b3e24bf125b5bea1d8c332820e668e04d2742
09ae96f0d33d1cc50ba4e67d1ad8aae76234de0d
refs/heads/master
2021-01-11T03:17:55.565023
2017-01-04T00:43:17
2017-01-04T00:43:17
71,093,131
1
0
null
null
null
null
UTF-8
Java
false
false
372
java
/* * * WxUserCondition 创建于 2016-10-28 14:50:57 版权归作者和作者当前组织所有 */ package com.mmk.business.condition; import com.mmk.business.model.WxUser; /** * WxUserCondition : 微信用户 扩展查询模型 * 2016-10-28 14:50:57 *@author 胡广玲 huguangling *@version 1.0 * */ public class WxUserCondition extends WxUser{ }
[ "Administrator@PC201506111414" ]
Administrator@PC201506111414
a32e46432901ac5ed2d79b2c5a84b1fe73af9df6
3aeec4a30092ca90cc352d577891f80970a0e857
/Prav/stackop.java
0c147b71888bae96aa40d3d930e9a4d8c89ce84a
[]
no_license
ipravin/BasicJava
da4c682a1151f02bfdced27f9a5f677882448eae
168b953fe1708de8ae553fd372d6499072dc0658
refs/heads/master
2022-02-10T21:14:41.895809
2019-07-20T06:47:15
2019-07-20T06:47:15
197,890,894
0
0
null
null
null
null
UTF-8
Java
false
false
1,064
java
class stackop { int s[]=new int [20]; int sp,n; stackop(int nm) { for(int i=0;i<20;i++) s[i]=0; sp=-1; n=nm; } void pushdata (int item) { if(sp==(n-1)) System.out.println("Stack Overflows"); else { sp++; s[sp]=item; } } void popdata() { int v; if(sp==-1) System.out.println("Stack Underflows"); else { v=s[sp]; System.out.println("POpped out : " +v); sp--; } } void display() { if(sp==-1) System.out.println("Stack Empty"); else { System.out.println("SP--------->|" +s[sp]+"|"); System.out.println("____"); for(int i=sp-1;i>=0;i--) { System.out.println(" |"+s[i]+"|"); System.out.println("___"); } } } }
ad98c8566f048b2d9839914674693e9d77e2682e
4e21625f70f4e688b3fcddd7be846b5541b63d43
/src/test/java/com/shaddytechie/shopsRUs/ShopsRUsApplicationTests.java
0834b849c7822994e4326e1c8c8ff1cd9718f1d3
[]
no_license
slheamshaddy/shopsRUs
cc84bea03cb7b75570eac74fdac1ef5f93858eca
d6a611ca974fa8d054afe790138c3574831fa986
refs/heads/master
2023-03-10T16:16:24.976929
2021-03-02T16:01:52
2021-03-02T16:01:52
343,383,863
0
0
null
null
null
null
UTF-8
Java
false
false
219
java
package com.shaddytechie.shopsRUs; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class ShopsRUsApplicationTests { @Test void contextLoads() { } }
587cba9aa7ff23c48709cde5a32c18eb3cb15b3a
307272e488b71b13600398670dcf8e0936b8fb43
/Android/LayoutDemo/app/src/androidTest/java/com/example/layoutdemo/layoutdemo/ExampleInstrumentedTest.java
60a717d4c798deaa7726cadd435a30a1528332ac
[]
no_license
yrameshk26/Personal-Learning
da3670f4276fff79365e9dac74042cab39743721
01e713ced3485c2b0680f09c18cd8519322d08dc
refs/heads/master
2021-08-29T21:58:47.015418
2017-12-15T04:55:45
2017-12-15T04:55:45
62,563,029
0
0
null
null
null
null
UTF-8
Java
false
false
770
java
package com.example.layoutdemo.layoutdemo; 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.example.layoutdemo.layoutdemo", appContext.getPackageName()); } }
6783e26ea8723c0b74ea100c79e34113b4027658
fa93c9be2923e697fb8a2066f8fb65c7718cdec7
/sources/com/google/android/gms/internal/ads/zzchu.java
a440614b0ebea5a79addbe58db28c103b2af66ca
[]
no_license
Auch-Auch/avito_source
b6c9f4b0e5c977b36d5fbc88c52f23ff908b7f8b
76fdcc5b7e036c57ecc193e790b0582481768cdc
refs/heads/master
2023-05-06T01:32:43.014668
2021-05-25T10:19:22
2021-05-25T10:19:22
370,650,685
0
0
null
null
null
null
UTF-8
Java
false
false
5,690
java
package com.google.android.gms.internal.ads; import android.content.Context; import android.os.Bundle; import androidx.annotation.Nullable; import java.lang.ref.WeakReference; public final class zzchu extends zzbpd { private final zzaug zzdvj; private final WeakReference<zzbfq> zzfur; private final zzbyg zzfus; private final zzbpx zzfuu; private final zzdqm zzfuv; private final zzbtb zzfuw; private final zzcaz zzfuz; private boolean zzgce = false; private final zzbui zzgcs; private final Context zzvr; public zzchu(zzbpg zzbpg, Context context, @Nullable zzbfq zzbfq, zzcaz zzcaz, zzbyg zzbyg, zzbtb zzbtb, zzbui zzbui, zzbpx zzbpx, zzdkx zzdkx, zzdqm zzdqm) { super(zzbpg); this.zzvr = context; this.zzfuz = zzcaz; this.zzfur = new WeakReference<>(zzbfq); this.zzfus = zzbyg; this.zzfuw = zzbtb; this.zzgcs = zzbui; this.zzfuu = zzbpx; this.zzfuv = zzdqm; this.zzdvj = new zzavh(zzdkx.zzdsh); } public final void finalize() throws Throwable { try { zzbfq zzbfq = this.zzfur.get(); if (((Boolean) zzwe.zzpu().zzd(zzaat.zzcww)).booleanValue()) { if (!this.zzgce && zzbfq != null) { zzbbi.zzedy.execute(zzcht.zzh(zzbfq)); } } else if (zzbfq != null) { zzbfq.destroy(); } } finally { super.finalize(); } } public final Bundle getAdMetadata() { return this.zzgcs.getAdMetadata(); } public final boolean isClosed() { return this.zzfuu.isClosed(); } public final boolean zzanh() { return this.zzgce; } /* JADX WARN: Multi-variable type inference failed */ /* JADX WARN: Type inference failed for: r5v3, types: [android.content.Context] */ /* JADX WARNING: Unknown variable types count: 1 */ /* Code decompiled incorrectly, please refer to instructions dump. */ public final boolean zzb(boolean r4, @androidx.annotation.Nullable android.app.Activity r5) { /* r3 = this; com.google.android.gms.internal.ads.zzaai<java.lang.Boolean> r0 = com.google.android.gms.internal.ads.zzaat.zzcnp com.google.android.gms.internal.ads.zzaap r1 = com.google.android.gms.internal.ads.zzwe.zzpu() java.lang.Object r0 = r1.zzd(r0) java.lang.Boolean r0 = (java.lang.Boolean) r0 boolean r0 = r0.booleanValue() r1 = 0 if (r0 == 0) goto L_0x0048 com.google.android.gms.ads.internal.zzp.zzkp() android.content.Context r0 = r3.zzvr boolean r0 = com.google.android.gms.internal.ads.zzayh.zzav(r0) if (r0 == 0) goto L_0x0048 java.lang.String r4 = "Rewarded ads that show when your app is in the background are a violation of AdMob policies and may lead to blocked ad serving. To learn more, visit https://googlemobileadssdk.page.link/admob-interstitial-policies" com.google.android.gms.internal.ads.zzbbd.zzfe(r4) com.google.android.gms.internal.ads.zzbtb r4 = r3.zzfuw r4.zzajk() com.google.android.gms.internal.ads.zzaai<java.lang.Boolean> r4 = com.google.android.gms.internal.ads.zzaat.zzcnq com.google.android.gms.internal.ads.zzaap r5 = com.google.android.gms.internal.ads.zzwe.zzpu() java.lang.Object r4 = r5.zzd(r4) java.lang.Boolean r4 = (java.lang.Boolean) r4 boolean r4 = r4.booleanValue() if (r4 == 0) goto L_0x0047 com.google.android.gms.internal.ads.zzdqm r4 = r3.zzfuv com.google.android.gms.internal.ads.zzdlj r5 = r3.zzflg com.google.android.gms.internal.ads.zzdlh r5 = r5.zzhbq com.google.android.gms.internal.ads.zzdkz r5 = r5.zzhbn java.lang.String r5 = r5.zzdsg r4.zzhc(r5) L_0x0047: return r1 L_0x0048: boolean r0 = r3.zzgce if (r0 == 0) goto L_0x005e java.lang.String r4 = "The rewarded ad have been showed." com.google.android.gms.internal.ads.zzbbd.zzfe(r4) com.google.android.gms.internal.ads.zzbtb r4 = r3.zzfuw int r5 = com.google.android.gms.internal.ads.zzdmd.zzhcx r0 = 0 com.google.android.gms.internal.ads.zzuw r5 = com.google.android.gms.internal.ads.zzdmb.zza(r5, r0, r0) r4.zzh(r5) return r1 L_0x005e: r0 = 1 r3.zzgce = r0 com.google.android.gms.internal.ads.zzbyg r2 = r3.zzfus r2.zzaiz() if (r5 != 0) goto L_0x006a android.content.Context r5 = r3.zzvr L_0x006a: com.google.android.gms.internal.ads.zzcaz r2 = r3.zzfuz // Catch:{ zzcbc -> 0x0075 } r2.zza(r4, r5) // Catch:{ zzcbc -> 0x0075 } com.google.android.gms.internal.ads.zzbyg r4 = r3.zzfus // Catch:{ zzcbc -> 0x0075 } r4.zzaix() // Catch:{ zzcbc -> 0x0075 } return r0 L_0x0075: r4 = move-exception com.google.android.gms.internal.ads.zzbtb r5 = r3.zzfuw r5.zza(r4) return r1 */ throw new UnsupportedOperationException("Method not decompiled: com.google.android.gms.internal.ads.zzchu.zzb(boolean, android.app.Activity):boolean"); } public final zzaug zzqw() { return this.zzdvj; } public final boolean zzqx() { zzbfq zzbfq = this.zzfur.get(); return zzbfq != null && !zzbfq.zzabt(); } }
2d441ee55a14f23aa758ebc3267452d8845c2295
c4faf92837f3c163be4f0089adfbc60828b7fce3
/src/by/it/_examples_/jd03_02/demo/crud/CN.java
172c99fa6b7540eef50eb24b2235efea12a60b07
[]
no_license
AlexandrRogov/JD2018-04-11
f3407f240f0dcfa76d4a56346c40e606f49764bb
4597619c75cbf8e5b35ed72ad5808413502b57e2
refs/heads/master
2020-03-15T11:50:33.268173
2018-07-05T23:21:10
2018-07-05T23:21:10
132,129,820
0
1
null
2018-05-04T11:09:42
2018-05-04T11:09:41
null
UTF-8
Java
false
false
639
java
package by.it._examples_.jd03_02.demo.crud; interface CN { //Корректно держать настройки соединения вне кода (!) //Обычно это файлы конфигурации сервера или фреймворка //конфигурация в этом случае - обычно bean с инициализацией из XML //ТАК ЧТО ЭТО ЛИШЬ ПРИМЕР! String URL_DB = "jdbc:mysql://127.0.0.1:2016/it_academy"+ "?useUnicode=true&characterEncoding=UTF-8"; String USER_DB = "root"; String PASSWORD_DB = ""; }
b99aba0e1bc213cd88693a0d63cac12aa99eeedb
5e96687499d4dbfbdfdcd88c3609630595a30a69
/Spring-Hibernate-CXF/src/main/java/com/spring/test/cxf/utilities/StartupBean.java
33539fa4d27e74e69503290b1b42f70299a869a5
[]
no_license
ally-jarrett/Spring-Hibernate-Examples
d9aadb0457c7b05a2ba55ff1af2972d4d3020ceb
2bcdbc3720b092a309de00854372c1e2a63c3c5a
refs/heads/master
2020-04-05T20:04:00.553870
2014-10-08T14:36:24
2014-10-08T14:36:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,406
java
package com.spring.test.cxf.utilities; import java.util.ArrayList; import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import com.spring.test.cxf.dao.ProductDao; import com.spring.test.cxf.model.Product; /** * Really basic bean to insert some data into the DB on startup * */ public class StartupBean { private static final Logger LOG = LoggerFactory.getLogger(StartupBean.class); @Autowired @Qualifier("productDao") ProductDao productDao; /** * Populate DB with some records to play with on startup... * * @throws Exception */ public void create() throws Exception { int dbRecords = this.countDBRecords(); if (dbRecords > 0) { LOG.info("There are already " + dbRecords + " records in the DB "); } else { LOG.info("Attempting to Populate Database"); List<Product> productsArray = new ArrayList<Product>(); Product prod1 = new Product(); prod1.setProductName("MAC Book Pro Retina 15"); prod1.setProductManufacturer("Apple"); prod1.setColour("Silver"); productsArray.add(prod1); Product prod2 = new Product(); prod2.setProductName("MAC Book Air"); prod2.setProductManufacturer("Apple"); prod2.setColour("Silver"); productsArray.add(prod2); Product prod3 = new Product(); prod3.setProductName("MAC Book Retina 13"); prod3.setProductManufacturer("Apple"); prod3.setColour("Silver"); productsArray.add(prod3); for (Product p : productsArray) { this.insertNewRecord(p); } LOG.info("Database Successfully Populated"); dbRecords = this.countDBRecords(); if (dbRecords > 0) { LOG.info("There is a total of " + dbRecords + " products in the DB"); } else { LOG.info("There are 0 records in the DB, Something went wrong...."); } } } /** * Insert new Record * * @param product */ private void insertNewRecord(Product product) { try { LOG.info("Inserting new Record into Database..."); productDao.save(product); } catch (Exception e) { LOG.info("Something went wrong with DAO...."); LOG.info("Exception: " + e.getLocalizedMessage()); } } /** * Return number of records in the Product Table * * @return */ private int countDBRecords() { return productDao.getAll().size(); } }
722d2c3d74b3e3e40233c61473e680acf9c16866
74b4499f2445d5e85516a6f700ae429de207863e
/workspace/jdbcdemo/src/jdbcdemo/Driver.java
837617bc60e9579e757bf3a61b64f73cbdf897a2
[]
no_license
Saurabh-16/Mayhem
a012475cf3b8eca019ada50a0cd9d533f84ed956
7c61df033eaba518d381ef61d20502a85133c14d
refs/heads/master
2021-01-10T15:33:44.787752
2018-08-11T17:58:34
2018-08-11T17:58:34
36,862,083
0
0
null
null
null
null
UTF-8
Java
false
false
578
java
package jdbcdemo; import java.sql.*; public class Driver { public static void main(String[] args) { try{ Connection myconn = DriverManager.getConnection("jdbc:mysql://localhost:3306/saurabh","root","password"); PreparedStatement myStmt = myconn.prepareStatement("select id from employee where id>=?"); myStmt.setInt(1, 2); ResultSet rs=myStmt.executeQuery(); while(rs.next()) { int a= rs.getInt(1); System.out.println(a); } } catch(SQLException ecp) { ecp.printStackTrace(); } } }
0b18c906a797d4cecd07853a948bc8ea2392ba3a
30d50207159752142caee37e3e5f34558f659bf0
/SWCert/Solution1.java
58bc5e24e153994ed5cb631f8c407f60fb0a5aba
[]
no_license
Amagong/learn_algorithm
2107d42e8bf12bd5d4cfa58e74cd8a71807af900
ecfe9bef9c4b257f5433c2338a986535f0839307
refs/heads/master
2021-01-20T16:10:58.586372
2017-04-04T23:10:14
2017-04-04T23:10:14
null
0
0
null
null
null
null
UHC
Java
false
false
4,389
java
///////////////////////////////////////////////////////// // SDS SW Certificate // Problem : 그림자 (Professional) // Author : SW Competency Development TF // Copyright(c) 2016 Samsung SDS Co. ltd. // All rights reserved. / Confidential // 본 문서를 SDS 직원이 아닌 외부인에게 공유하거나 // 외부 사이트 등 공중에 게시하는 행위를 절대 금합니다. ///////////////////////////////////////////////////////// import java.io.FileInputStream; import java.util.LinkedList; import java.util.Scanner; public class Solution1 { static int Answer; static int M, N; // 지원자의 월급 static int[] S = new int[20]; // 지원자의 악기 연주 정보 static int[][] P = new int[24][20]; // 악기별 연주가능한 지원자가 있는지 여부 static int[] C = new int[24]; // 솔루션 저장 리스트 static LinkedList<Integer> list = new LinkedList<Integer>(); public static void main(String[] args) throws Exception { /* * 아래의 메소드 호출은 앞으로 표준 입력(키보드) 대신 input.txt 파일로부터 읽어오겠다는 의미의 코드입니다. 여러분이 * 작성한 코드를 테스트 할 때, 편의를 위해서 input.txt에 입력을 저장한 후, 이 코드를 프로그램의 처음 부분에 * 추가하면 이후 입력을 수행할 때 표준 입력 대신 파일로부터 입력을 받아올 수 있습니다. 따라서 테스트를 수행할 때에는 아래 * 주석을 지우고 이 메소드를 사용하셔도 좋습니다. 단, 채점을 위해 코드를 제출하실 때에는 반드시 이 메소드를 지우거나 주석 * 처리 하셔야 합니다. */ System.setIn(new FileInputStream("sample_input.txt")); /* * 표준입력 System.in 으로부터 스캐너를 만들어 데이터를 읽어옵니다. */ Scanner sc = new Scanner(System.in); /* * 테스트 케이스의 수를 입력 받습니다. */ int T = sc.nextInt(); /* * T 개의 테스트 케이스가 주어지므로, 각각을 처리합니다. */ for(int test_case = 1; test_case <= T; ++test_case) { // 지원자의 수 N = sc.nextInt(); // 악기의 수 M = sc.nextInt(); // 지원자의 월급 for(int i = 0; i < N; i++) { S[i] = sc.nextInt(); } // 지원자의 악기 연주 정보 for(int i = 0; i < M; i++) { for(int j = 0; j < N; j++) { P[i][j] = sc.nextInt(); } } /* * * 이곳에 여러분의 코드를 작성합니다. * 테스트 케이스 개수 T만큼 각각의 결과가 Answer로 최종 출력 됩니다. * */ Answer = Integer.MAX_VALUE; list.clear(); backtrack(0, 0); /* 결과 값 출력 */ System.out.println("#" + test_case + " " + Answer); } } // pos : 연주자 번호, cost : 현재까지 계산된 코스트 public static void backtrack(int pos, int cost) { if(pos == N) { int covered = 0; for(int i = 0; i < M; i++) { C[i] = 0; } // 모든 악기에 대해서 가능한 연주자가 한 명 이상인지를 판단 // 리스트에 현재까지 저장된 연주자 정보를 가저옴 for(int i : list) { for(int j = 0; j < M; j++) { // i 연주자가 j 악기를 연주할 수 있는 경우 if(P[j][i] == 1 && C[j] == 0) { covered ++; C[j] = 1; } } } // 모든 악기에 대해 가능한 연주자가 한 명 이상이고 // 계산된 비용이 현재까지 찾아낸 해보다 작을 경우 저장 if(covered == M && cost < Answer) { Answer = cost; } return; } // 계산된 비용이 현재까지 찾은 최적해보다 클 경우 더 이상 하위의 경우는 탐색하지 않아도 된다. if(cost > Answer) { return; } // 채용/채용 하지 않음 두 가지의 경우가 있다. for(int i = 0; i < 2; i++) { // 다음 연주자로 재귀호출 if(i == 1) { // 채용일 경우 연주자 번호을 리스트에 저장 list.add(pos); backtrack(pos + 1, cost + S[pos]); // 앞에서 저장된 연주자 번호를 리스트에서 제거 list.removeLast(); } else { backtrack(pos + 1, cost); } } } }
383a1471cbee69629ac0f81eaf090ba796b8371d
88d679be2704a4f64701de823b7de95e9ab55531
/TestProject/src/main/java/com/qbs/TestProjectApplication.java
3c7b585429823ffc39b8091108e9582f16612937
[]
no_license
Projectclass14/Project
c7ca20e3fedb9e57a560521603837e9644261796
ea33eaf6c42cfec93b4123a222dbf6569e42c063
refs/heads/main
2023-07-23T04:18:21.849446
2021-08-27T07:41:26
2021-08-27T07:41:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
310
java
package com.qbs; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class TestProjectApplication { public static void main(String[] args) { SpringApplication.run(TestProjectApplication.class, args); } }
8536b534724feee11a6f34f8fc64f0121781dff9
603dacaa6502627e0fb5ca5f7b359b00385d60f3
/src/Service/Representation/Account/Representation/AccountRepresentationImpl.java
3b70edc75e3ad2e1b413f95fef7c5cc43a3849ab
[]
no_license
natialemu/lakeshore-marketplace
9be2e2efa35c35f3b699fd4fe09b8d6d3cd218f6
76586a8d4ea329d13edcb5a5cb45de154848d42d
refs/heads/master
2021-09-02T04:32:06.683012
2017-12-30T09:27:54
2017-12-30T09:27:54
103,177,821
2
2
null
2017-12-04T22:58:07
2017-09-11T19:19:03
Java
UTF-8
Java
false
false
1,260
java
package Service.Representation.Account.Representation; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import Service.Representation.AbstractRepresentation; @XmlRootElement(name = "Account") @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "") public class AccountRepresentationImpl extends AbstractRepresentation implements AccountRepresentation{ private String username; private String accountStatus; private String emailAddress; private String password; @Override public void setPassword(String password) { this.password = password; } @Override public String getPassword() { return password; } public AccountRepresentationImpl() {} public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getAccountStatus() { return accountStatus; } public void setAccountStatus(String accountStatus) { this.accountStatus = accountStatus; } public String getEmailAddress() { return emailAddress; } public void setEmailAddress(String emailAddress) { this.emailAddress = emailAddress; } }
9ab5916733a37c104ed2a7fa288915f45d78b720
827735c09767b01bef426e61f0cad2e37463ba1a
/app/src/main/java/com/red/alert/activities/settings/General.java
6c576749d95e5831a0eabfaed3d91d7849786276
[ "Apache-2.0" ]
permissive
eladnava/redalert-android
3c4451e9de6c8267d9c7f45d380ddcbe1f8ae557
b7acc4a29381d74703e8ff850f03269d5d5f6d33
refs/heads/master
2023-08-07T14:43:10.634936
2023-07-28T09:25:11
2023-07-28T09:25:11
43,698,568
73
22
Apache-2.0
2021-05-16T13:50:05
2015-10-05T16:35:42
Java
UTF-8
Java
false
false
33,005
java
package com.red.alert.activities.settings; import android.app.AlertDialog; import android.app.Dialog; import android.app.ProgressDialog; import android.content.ActivityNotFoundException; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.preference.CheckBoxPreference; import android.preference.ListPreference; import android.preference.Preference; import android.preference.PreferenceCategory; import androidx.core.view.MenuItemCompat; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.widget.Toast; import com.red.alert.R; import com.red.alert.config.API; import com.red.alert.config.Lifeshield; import com.red.alert.config.Logging; import com.red.alert.config.Support; import com.red.alert.config.Testing; import com.red.alert.logic.alerts.AlertLogic; import com.red.alert.logic.alerts.AlertTypes; import com.red.alert.logic.communication.broadcasts.LocationSelectionEvents; import com.red.alert.logic.communication.broadcasts.SelfTestEvents; import com.red.alert.logic.communication.broadcasts.SettingsEvents; import com.red.alert.logic.integration.BluetoothIntegration; import com.red.alert.logic.push.FCMRegistration; import com.red.alert.logic.push.PushyRegistration; import com.red.alert.logic.settings.AppPreferences; import com.red.alert.model.req.SelfTestRequest; import com.red.alert.ui.activities.AppCompatPreferenceActivity; import com.red.alert.ui.compatibility.ProgressDialogCompat; import com.red.alert.ui.dialogs.AlertDialogBuilder; import com.red.alert.ui.dialogs.custom.BluetoothDialogs; import com.red.alert.ui.elements.SearchableMultiSelectPreference; import com.red.alert.ui.localization.rtl.RTLSupport; import com.red.alert.ui.notifications.AppNotifications; import com.red.alert.utils.backend.RedAlertAPI; import com.red.alert.utils.caching.Singleton; import com.red.alert.utils.communication.Broadcasts; import com.red.alert.utils.feedback.Volume; import com.red.alert.utils.marketing.GooglePlay; import com.red.alert.utils.metadata.AppVersion; import com.red.alert.utils.metadata.LocationData; import com.red.alert.utils.networking.HTTP; import com.red.alert.utils.threading.AsyncTaskAdapter; public class General extends AppCompatPreferenceActivity { boolean mIsTesting; boolean mIsDestroyed; boolean mFcmTestPassed; boolean mPushyTestPassed; String mPreviousZones; String mPreviousCities; MenuItem mLoadingItem; Preference mRate; Preference mWebsite; Preference mContact; Preference mAdvanced; Preference mTestAlert; Preference mLifeshield; CheckBoxPreference mNotificationsEnabled; PreferenceCategory mMainCategory; ListPreference mLanguageSelection; SearchableMultiSelectPreference mCitySelection; SearchableMultiSelectPreference mZoneSelection; SharedPreferences.OnSharedPreferenceChangeListener mBroadcastListener = new SharedPreferences.OnSharedPreferenceChangeListener() { @Override public void onSharedPreferenceChanged(SharedPreferences Preferences, String Key) { // Asked for reload? if (Key.equalsIgnoreCase(LocationSelectionEvents.LOCATIONS_UPDATED)) { // Refresh city/region descriptions refreshAreaValues(); // Update subscriptions on the server-side new UpdateSubscriptionsAsync().execute(); } // FCM test passed? if (Key.equalsIgnoreCase(SelfTestEvents.FCM_TEST_PASSED)) { mFcmTestPassed = true; } // Pushy test passed? if (Key.equalsIgnoreCase(SelfTestEvents.PUSHY_TEST_PASSED)) { mPushyTestPassed = true; } } }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Support for RTL languages RTLSupport.mirrorActionBar(this); // Load UI elements initializeUI(); // Handle extra parameters handleIntentExtras(); // Volume keys should control alert volume Volume.setVolumeKeysAction(this); } void handleIntentExtras() { // Get extras Bundle extras = getIntent().getExtras(); // None sent? if (extras == null) { return; } // Get zone selection boolean boolean showZoneSelection = extras.getBoolean(SettingsEvents.SHOW_ZONE_SELECTION); // Show selection? if (showZoneSelection) { mZoneSelection.showDialog(); } } @Override protected void onPause() { super.onPause(); // Unregister for broadcasts Broadcasts.unsubscribe(this, mBroadcastListener); } @Override protected void onDestroy() { super.onDestroy(); // Avoid hiding invalid dialogs mIsDestroyed = true; } @Override protected void onResume() { super.onResume(); // Support for RTL languages RTLSupport.mirrorActionBar(this); // Clear notifications and stop any playing sounds AppNotifications.clearAll(this); // Register for broadcasts Broadcasts.subscribe(this, mBroadcastListener); } void selfTestCompleted(int result) { // Use builder to create dialog AlertDialog.Builder builder = new AlertDialog.Builder(this); // Use builder to create dialog builder.setTitle(getString(R.string.test)).setMessage(getString(result)).setPositiveButton(R.string.okay, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int id) { // Stop siren (and clear notifications) AppNotifications.clearAll(General.this); // Close dialog dialogInterface.dismiss(); } }); // Avoid cancellation builder.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface Dialog) { // Stop siren (and clear notifications) AppNotifications.clearAll(General.this); } }); try { // Build it Dialog dialog = builder.create(); // Show it dialog.show(); // Support for RTL languages RTLSupport.mirrorDialog(dialog, this); } catch (Exception exc) { // Show toast instead Toast.makeText(this, getString(result), Toast.LENGTH_LONG).show(); } } @Override public void onConfigurationChanged(android.content.res.Configuration newConfig) { super.onConfigurationChanged(newConfig); // Support for RTL languages RTLSupport.mirrorActionBar(this); } void initializeUI() { // Allow click on home button getSupportActionBar().setDisplayHomeAsUpEnabled(true); // Load settings from XML There is no non-deprecated way to do it on API Level 7 addPreferencesFromResource(R.xml.settings); // Cache resource IDs mRate = findPreference(getString(R.string.ratePref)); mWebsite = findPreference(getString(R.string.websitePref)); mContact = findPreference(getString(R.string.contactPref)); mAdvanced = findPreference(getString(R.string.advancedPref)); mTestAlert = findPreference(getString(R.string.selfTestPref)); mLifeshield = findPreference(getString(R.string.lifeshieldPref)); mMainCategory = (PreferenceCategory) findPreference(getString(R.string.mainCategoryPref)); mCitySelection = ((SearchableMultiSelectPreference) findPreference(getString(R.string.selectedCitiesPref))); mZoneSelection = ((SearchableMultiSelectPreference) findPreference(getString(R.string.selectedZonesPref))); mLanguageSelection = (ListPreference) findPreference(getString(R.string.langPref)); mNotificationsEnabled = (CheckBoxPreference)findPreference(getString(R.string.enabledPref)); // Populate setting values initializeSettings(); // Set up listeners initializeListeners(); } void initializeSettings() { // Set entries & values mZoneSelection.setEntries(getResources().getStringArray(R.array.zoneNames)); mZoneSelection.setEntryValues(getResources().getStringArray(R.array.zoneValues)); // Set entries & values mCitySelection.setEntries(LocationData.getAllCityNames(this)); mCitySelection.setEntryValues(LocationData.getAllCityValues(this)); // Not registered yet? if (!RedAlertAPI.isRegistered(this)) { mNotificationsEnabled.setEnabled(false); } // Refresh area values refreshAreaValues(); } void refreshAreaValues() { // Get selected cities String selectedCities = Singleton.getSharedPreferences(this).getString(getString(R.string.selectedCitiesPref), getString(R.string.none)); // Update summary text mCitySelection.setSummary(getString(R.string.cityDesc) + "\r\n(" + LocationData.getSelectedCityNamesByValues(this, selectedCities, mCitySelection.getEntries(), mCitySelection.getEntryValues()) + ")"); // Get selected zones String selectedZones = Singleton.getSharedPreferences(this).getString(getString(R.string.selectedZonesPref), getString(R.string.none)); // Update summary text mZoneSelection.setSummary(getString(R.string.zonesDesc) + "\r\n(" + LocationData.getSelectedCityNamesByValues(this, selectedZones, mZoneSelection.getEntries(), mZoneSelection.getEntryValues()) + ")"); // Save in case the update subscriptions request fails if (mPreviousZones == null && mPreviousCities == null) { mPreviousZones = selectedZones; mPreviousCities = selectedCities; } } void initializeListeners() { // Language preference select mLanguageSelection.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object o) { // Show instructions toast Toast.makeText(General.this, R.string.langSelectionSuccess, Toast.LENGTH_LONG).show(); // Update the preference return true; } }); // Test push mTestAlert.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { // Did we enable a device integration but Bluetooth is disabled? if (BluetoothIntegration.isIntegrationEnabled(General.this) && !BluetoothIntegration.isBluetoothEnabled()) { // Ask user politely to enable Bluetooth BluetoothDialogs.showEnableBluetoothDialog(General.this); // Don't run the test yet return false; } // Not already testing? if (!mIsTesting) { // Send a test push new PerformSelfTestAsync().execute(); } // Consume event return true; } }); // Website button mWebsite.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { // Initialize browser intent Intent browser = new Intent(Intent.ACTION_VIEW, Uri.parse(Support.WEBSITE_LINK)); try { // Open browser startActivity(browser); } catch (ActivityNotFoundException ex) { // Do nothing } // Consume event return true; } }); // Lifeshield website button mLifeshield.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { // Initialize browser intent Intent browser = new Intent(Intent.ACTION_VIEW, Uri.parse(Lifeshield.WEBSITE_LINK)); try { // Open browser startActivity(browser); } catch (ActivityNotFoundException ex) { // Do nothing } // Consume event return true; } }); // Notification toggle listener mNotificationsEnabled.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newValue) { // Update notification preferences on the server-side new UpdateNotificationsAsync().execute(); // Tell Android to persist new checkbox value return true; } }); // Rate button mRate.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { // Open app page GooglePlay.openAppListingPage(General.this); // Consume event return true; } }); // Set up contact click listener mContact.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { // Add debug flags String body = getContactEmailBody(); // Set up contact click listener Intent selectorIntent = new Intent(Intent.ACTION_SENDTO); selectorIntent.setData(Uri.parse("mailto:")); // Prepare e-mail intent final Intent emailIntent = new Intent(Intent.ACTION_SEND); // Add e-mail, subject & debug body emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[]{Support.CONTACT_EMAIL}); emailIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.appName)); emailIntent.putExtra(Intent.EXTRA_TEXT, body); // Limit to mail apps only emailIntent.setSelector(selectorIntent); try { // Try to open user's e-mail app startActivity(Intent.createChooser(emailIntent, getString(R.string.contact))); } catch (ActivityNotFoundException exc) { // Show a toast instead Toast.makeText(General.this, R.string.manualContact, Toast.LENGTH_LONG).show(); } // Consume event return true; } }); // Set up advanced settings listener mAdvanced.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { // Prepare new intent Intent advanced = new Intent(); // Set advanced class advanced.setClass(General.this, Advanced.class); // Show advanced settings startActivity(advanced); // Consume event return true; } }); } String getContactEmailBody() { // Add sent via and app version String body = getString(R.string.sentVia) + " " + getString(R.string.appName) + " " + AppVersion.getVersionName(General.this); // Break 2 lines body += "\r\n\r\n"; // Add selected zones body += getString(R.string.selectedZones) + ": " + LocationData.getSelectedCityNamesByValues(this, Singleton.getSharedPreferences(this).getString(getString(R.string.selectedZonesPref), ""), getResources().getStringArray(R.array.zoneNames), getResources().getStringArray(R.array.zoneValues)); // Break 1 line body += "\r\n"; // Add selected cities body += getString(R.string.selectedCities) + ": " + LocationData.getSelectedCityNamesByValues(this, Singleton.getSharedPreferences(this).getString(getString(R.string.selectedCitiesPref), ""), LocationData.getAllCityNames(this), LocationData.getAllCityValues(this)); // Break 1 line body += "\r\n"; // Add selected secondary cities body += getString(R.string.selectedSecondaryCities) + ": " + LocationData.getSelectedCityNamesByValues(this, Singleton.getSharedPreferences(this).getString(getString(R.string.selectedSecondaryCitiesPref), ""), LocationData.getAllCityNames(this), LocationData.getAllCityValues(this)); // Break 2 lines body += "\r\n\r\n"; // Add debug info body += getString(R.string.debugInfo) + ": "; // Add setting values & push notification device information body += "user.id=" + RedAlertAPI.getUserId(this) + ", "; body += "user.hash=" + RedAlertAPI.getUserHash(this) + ", "; body += "primary.enabled=" + AppPreferences.getNotificationsEnabled(this) + ", "; body += "secondary.enabled=" + AppPreferences.getNotificationsEnabled(this) + ", "; body += "location.enabled=" + AppPreferences.getLocationAlertsEnabled(this) + ", "; body += "volume.primary=" + AppPreferences.getPrimaryAlertVolume(this, -1) + ", "; body += "volume.secondary=" + AppPreferences.getSecondaryAlertVolume(this, -1) + ", "; body += "fcm=" + FCMRegistration.isRegistered(this) + ", "; body += "fcm.token=" + FCMRegistration.getRegistrationToken(this) + ", "; body += "pushy=" + PushyRegistration.isRegistered(this) + ", "; body += "pushy.token=" + PushyRegistration.getRegistrationToken(this) + ", "; body += "android.sdk=" + Build.VERSION.SDK_INT + ", "; body += "android.version=" + Build.VERSION.RELEASE + ", "; body += "phone.manufacturer=" + Build.MANUFACTURER + ", "; body += "phone.model=" + Build.MODEL; // Break 2 lines body += "\r\n\r\n"; // Add default problem description text body += getString(R.string.problemDesc); // Break a few lines body += "\r\n"; // Return body return body; } void sendTestPushViaPushy() throws Exception { // Log to logcat Log.d(Logging.TAG, "Testing Pushy..."); // Reset test flag mPushyTestPassed = false; // Not registered? if (!PushyRegistration.isRegistered(this)) { // No need for localization - only shows up in logcat for now throw new Exception("The device is not registered for push notifications via Pushy."); } // Grab registration token String token = PushyRegistration.getRegistrationToken(this); // Get user's locale String locale = getResources().getConfiguration().locale.getLanguage(); // Create registration request SelfTestRequest test = new SelfTestRequest(token, locale, API.PUSHY_PLATFORM_IDENTIFIER); // Send the request to our API HTTP.post(API.API_ENDPOINT + "/test", Singleton.getJackson().writeValueAsString(test)); } void sendTestPushViaFcm() throws Exception { // Log to logcat Log.d(Logging.TAG, "Testing FCM..."); // Reset test flag mFcmTestPassed = false; // Not registered? if (!FCMRegistration.isRegistered(this)) { // No need for localization - only shows up in logcat for now throw new Exception("The device is not registered for push notifications via FCM."); } // Grab registration token String token = FCMRegistration.getRegistrationToken(this); // Get user's locale String locale = getResources().getConfiguration().locale.getLanguage(); // Create registration request SelfTestRequest test = new SelfTestRequest(token, locale, API.PLATFORM_IDENTIFIER); // Send the request to our API HTTP.post(API.API_ENDPOINT + "/test", Singleton.getJackson().writeValueAsString(test)); } boolean didPassFcmTest() { // Calculate the max timestamp long maxTimestamp = System.currentTimeMillis() + Testing.PUSH_GATEWAY_TIMEOUT_SECONDS * 1000; // Wait until boolean value changes or enough time passes while (!mFcmTestPassed && System.currentTimeMillis() < maxTimestamp) { // Sleep to relieve the thread try { Thread.sleep(100); } catch (Exception exc) { } } // Return the outcome of the test return mFcmTestPassed; } boolean didPassPushyTest() { // Calculate the max timestamp long maxTimestamp = System.currentTimeMillis() + Testing.PUSH_GATEWAY_TIMEOUT_SECONDS * 1000; // Wait until boolean value changes or enough time passes while (!mPushyTestPassed && System.currentTimeMillis() < maxTimestamp) { // Sleep to relieve the thread try { Thread.sleep(100); } catch (Exception exc) { } } // Return the outcome of the test return mPushyTestPassed; } void toggleProgressBarVisibility(boolean visibility) { // Set loading visibility if (mLoadingItem != null) { mLoadingItem.setVisible(visibility); } } void initializeLoadingIndicator(Menu OptionsMenu) { // Add refresh in Action Bar mLoadingItem = OptionsMenu.add(Menu.NONE, Menu.NONE, Menu.NONE, getString(R.string.signing_up)); // Set up the view MenuItemCompat.setActionView(mLoadingItem, R.layout.loading); // Specify the show flags MenuItemCompat.setShowAsAction(mLoadingItem, MenuItem.SHOW_AS_ACTION_ALWAYS); // Hide by default mLoadingItem.setVisible(false); } @Override public boolean onCreateOptionsMenu(Menu OptionsMenu) { // Add loading indicator initializeLoadingIndicator(OptionsMenu); // Add settings button initializeShareButton(OptionsMenu); // Show the menu return true; } void initializeShareButton(Menu OptionsMenu) { // Add share button MenuItem shareItem = OptionsMenu.add(Menu.NONE, Menu.NONE, Menu.NONE, getString(R.string.share)); // Set up the view shareItem.setIcon(R.drawable.ic_share); // Specify the show flags MenuItemCompat.setShowAsAction(shareItem, MenuItem.SHOW_AS_ACTION_ALWAYS); // On click, open share shareItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { // Prepare share intent Intent shareIntent = new Intent(Intent.ACTION_SEND); // Set as text/plain shareIntent.setType("text/plain"); // Add text shareIntent.putExtra(Intent.EXTRA_TEXT, getString(R.string.shareMessage)); // Show chooser startActivity(Intent.createChooser(shareIntent, getString(R.string.shareDesc))); // Consume event return true; } }); } public boolean onOptionsItemSelected(final MenuItem Item) { // Check item ID switch (Item.getItemId()) { // Home button? case android.R.id.home: onBackPressed(); } return super.onOptionsItemSelected(Item); } public class PerformSelfTestAsync extends AsyncTaskAdapter<Integer, String, Integer> { ProgressDialog mLoading; public PerformSelfTestAsync() { // Prevent concurrent testing mIsTesting = true; // Fix progress dialog appearance on old devices mLoading = ProgressDialogCompat.getStyledProgressDialog(General.this); // Prevent cancel mLoading.setCancelable(false); // Set default message mLoading.setMessage(getString(R.string.loading)); // Show the progress dialog mLoading.show(); } @Override protected void onProgressUpdate(String... value) { super.onProgressUpdate(value); // Update progress dialog mLoading.setMessage(value[0]); } @Override protected Integer doInBackground(Integer... Parameter) { // Test results boolean fcmFailed = false, pushyFailed = false; // IsTesting FCM publishProgress(getString(R.string.testingFCM)); try { // Send a test push sendTestPushViaFcm(); } catch (Exception exc) { // FCM test is done fcmFailed = true; // Log to console Log.e(Logging.TAG, "FCM test failed", exc); } // Wait for test push to arrive if (!fcmFailed) { if (!didPassFcmTest()) { fcmFailed = true; } } // Done with FCM, testing Pushy publishProgress(getString(R.string.testingPushy)); try { // Send a test push sendTestPushViaPushy(); } catch (Exception exc) { // We failed pushyFailed = true; // Log to console Log.e(Logging.TAG, "Pushy test failed", exc); } // Wait for test push to arrive if (!pushyFailed) { if (!didPassPushyTest()) { pushyFailed = true; } } // At least one passed? if (!fcmFailed || !pushyFailed) { // Display "successful test" message AlertLogic.processIncomingAlert(getString(R.string.testSuccessful), AlertTypes.TEST, General.this); } // Both succeeded? if (!fcmFailed && !pushyFailed) { return R.string.testSuccessfulLong; } // Both failed? else if (fcmFailed && pushyFailed) { return R.string.testFailed; } // Only FCM failed? else if (fcmFailed) { return R.string.fcmTestFailed; } // Only Pushy failed? else if (pushyFailed) { return R.string.pushyTestFailed; } return 0; } @Override protected void onPostExecute(Integer result) { // No longer testing mIsTesting = false; // Activity dead? if (isFinishing() || mIsDestroyed) { return; } // Hide progress dialog if (mLoading.isShowing()) { mLoading.dismiss(); } // Hide loading indicator toggleProgressBarVisibility(false); // Show result dialog selfTestCompleted(result); } } public class UpdateSubscriptionsAsync extends AsyncTaskAdapter<Integer, String, Exception> { ProgressDialog mLoading; public UpdateSubscriptionsAsync() { // Fix progress dialog appearance on old devices mLoading = ProgressDialogCompat.getStyledProgressDialog(General.this); // Prevent cancel mLoading.setCancelable(false); // Set default message mLoading.setMessage(getString(R.string.loading)); // Show the progress dialog mLoading.show(); } @Override protected Exception doInBackground(Integer... Parameter) { try { // Update alert subscriptions RedAlertAPI.subscribe(General.this); } catch (Exception exc) { // Return exception to onPostExecute return exc; } // Success return null; } @Override protected void onPostExecute(Exception exc) { // Failed? if (exc != null) { // Log it Log.e(Logging.TAG, "Updating subscriptions failed", exc); // Restore previous city/region selections SharedPreferences.Editor editor = Singleton.getSharedPreferences(General.this).edit(); // Restore original values editor.putString(getString(R.string.selectedZonesPref), mPreviousZones); editor.putString(getString(R.string.selectedCitiesPref), mPreviousCities); // Save and flush to disk editor.commit(); } // Activity dead? if (isFinishing() || mIsDestroyed) { return; } // Hide loading dialog if (mLoading.isShowing()) { mLoading.dismiss(); } // Show error if failed if (exc != null) { // Build an error message String errorMessage = getString(R.string.apiRequestFailed) + "\n\n" + exc.getMessage() + "\n\n" + exc.getCause(); // Build the dialog AlertDialogBuilder.showGenericDialog(getString(R.string.error), errorMessage, General.this, null); } else { // Clear previously cached values mPreviousZones = null; mPreviousCities = null; } // Refresh city/region setting values refreshAreaValues(); } } public class UpdateNotificationsAsync extends AsyncTaskAdapter<Integer, String, Exception> { ProgressDialog mLoading; public UpdateNotificationsAsync() { // Fix progress dialog appearance on old devices mLoading = ProgressDialogCompat.getStyledProgressDialog(General.this); // Prevent cancel mLoading.setCancelable(false); // Set default message mLoading.setMessage(getString(R.string.loading)); // Show the progress dialog mLoading.show(); } @Override protected Exception doInBackground(Integer... Parameter) { try { // Update notification preferences RedAlertAPI.updateNotificationPreferences(General.this); } catch (Exception exc) { // Return exception to onPostExecute return exc; } // Success return null; } @Override protected void onPostExecute(Exception exc) { // Failed? if (exc != null) { // Log it Log.e(Logging.TAG, "Updating notification preferences failed", exc); // Restore previous notification toggle state SharedPreferences.Editor editor = Singleton.getSharedPreferences(General.this).edit(); // Restore original values editor.putBoolean(getString(R.string.enabledPref), ! AppPreferences.getNotificationsEnabled(General.this)); // Save and flush to disk editor.commit(); } // Activity dead? if (isFinishing() || mIsDestroyed) { return; } // Hide loading dialog if (mLoading.isShowing()) { mLoading.dismiss(); } // Show error if failed if (exc != null) { // Build an error message String errorMessage = getString(R.string.apiRequestFailed) + "\n\n" + exc.getMessage() + "\n\n" + exc.getCause(); // Build the dialog AlertDialogBuilder.showGenericDialog(getString(R.string.error), errorMessage, General.this, null); } // Refresh checkbox with new value mNotificationsEnabled.setChecked(AppPreferences.getNotificationsEnabled(General.this)); } } }
e4a0b2e90fd47ec51204d490db6036fb332ac11e
b50f61feea6a61c7771a7f53812a7e1c3a862980
/motocross/src/main/java/com/rosa/swift/core/network/json/sap/photoBase/JPhotoGetDocIn.java
c9f450e3bdd9840105bfc11a91d7993633d830a2
[]
no_license
LikhanovP/s14_question
eb91c75f926f6dc4c0090872c29a20ea4030dec5
4c524ce45f32cc726770d5c3985c74824db181d0
refs/heads/master
2021-01-19T05:06:35.629216
2017-04-06T10:15:03
2017-04-06T10:15:03
87,414,994
0
0
null
null
null
null
UTF-8
Java
false
false
324
java
package com.rosa.swift.core.network.json.sap.photoBase; import com.google.gson.annotations.SerializedName; /** * Created by egorov on 04.10.2016. */ public class JPhotoGetDocIn { @SerializedName("SESSION_ID") public String session_id; @SerializedName("PHOTO_DOC_VIEW") public String photo_doc_view; }
5ced29fb6524a47a6935937ba1590d200cd48393
fa93c9be2923e697fb8a2066f8fb65c7718cdec7
/sources/com/avito/android/safedeal/profile_settings/ProfileDeliverySettingsResourceProviderImpl.java
a80f3be290998192d2961577ddc36c70483427e6
[]
no_license
Auch-Auch/avito_source
b6c9f4b0e5c977b36d5fbc88c52f23ff908b7f8b
76fdcc5b7e036c57ecc193e790b0582481768cdc
refs/heads/master
2023-05-06T01:32:43.014668
2021-05-25T10:19:22
2021-05-25T10:19:22
370,650,685
0
0
null
null
null
null
UTF-8
Java
false
false
1,991
java
package com.avito.android.safedeal.profile_settings; import android.content.res.Resources; import com.avito.android.remote.auth.AuthSource; import com.avito.android.safedeal.R; import com.facebook.common.util.UriUtil; import javax.inject.Inject; import kotlin.Metadata; import kotlin.jvm.internal.Intrinsics; import org.jetbrains.annotations.NotNull; @Metadata(bv = {1, 0, 3}, d1 = {"\u0000\u0018\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u000e\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0004\u0018\u00002\u00020\u0001B\u0011\b\u0007\u0012\u0006\u0010\t\u001a\u00020\b¢\u0006\u0004\b\n\u0010\u000bR\u001c\u0010\u0007\u001a\u00020\u00028\u0016@\u0016X–\u0004¢\u0006\f\n\u0004\b\u0003\u0010\u0004\u001a\u0004\b\u0005\u0010\u0006¨\u0006\f"}, d2 = {"Lcom/avito/android/safedeal/profile_settings/ProfileDeliverySettingsResourceProviderImpl;", "Lcom/avito/android/safedeal/profile_settings/ProfileDeliverySettingsResourceProvider;", "", AuthSource.SEND_ABUSE, "Ljava/lang/String;", "getSettingsLoadingError", "()Ljava/lang/String;", "settingsLoadingError", "Landroid/content/res/Resources;", UriUtil.LOCAL_RESOURCE_SCHEME, "<init>", "(Landroid/content/res/Resources;)V", "safedeal_release"}, k = 1, mv = {1, 4, 2}) public final class ProfileDeliverySettingsResourceProviderImpl implements ProfileDeliverySettingsResourceProvider { @NotNull public final String a; @Inject public ProfileDeliverySettingsResourceProviderImpl(@NotNull Resources resources) { Intrinsics.checkNotNullParameter(resources, UriUtil.LOCAL_RESOURCE_SCHEME); String string = resources.getString(R.string.settings_loading_error_message); Intrinsics.checkNotNullExpressionValue(string, "res.getString(com.avito.…gs_loading_error_message)"); this.a = string; } @Override // com.avito.android.safedeal.profile_settings.ProfileDeliverySettingsResourceProvider @NotNull public String getSettingsLoadingError() { return this.a; } }
45bcb54db599888b29088cba333a01eaa94fa680
c13330687180d3f311d0e2ad7a98e97c718c3d5c
/src/com/justep/justepExt/biz/core/RequestContext.java
091cdfd125dafaef7a4f5464c8f9abea63eb0691
[]
no_license
007slm/JavaSnippets
4ced813c62445e3db7729756a495f579c065be4e
56108f7cf20e2e1fe2fd5008c2ed7c59e9099ddc
refs/heads/master
2016-09-07T18:31:56.455154
2013-10-21T09:18:55
2013-10-21T09:18:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
525
java
package com.justep.justepExt.biz.core; import java.util.HashMap; import java.util.Map; public class RequestContext implements Context{ private Map<String,Object> params = new HashMap<String,Object>(); public void initialValue(){ } public Object get(String key) { return params.get(key); } public Object put(String key, Object value) { return params.put(key, value); } public boolean contains(String key) { return params.containsKey(key); } public void remove(String key) { params.remove(key); } }
8c7d263db0feadbc203ba37b2bca7689f4534d44
44825ee193f460e522522bbaa6b00a2717672bc0
/app/src/main/java/sample/mqtt/simone/com/applicationsubmqtt/PushMessage.java
9f37dd9d11446bbfc67e7fe77366eb48c6ae244a
[]
no_license
SimonS91/MqttAndroidSubscriber
28b111a65cf14f63d0446384d2b7d10151af4e1c
d8a9c2750e3e4daf10a657cd2a087a38eeb9ee18
refs/heads/master
2016-08-12T12:39:19.756328
2015-11-25T14:30:09
2015-11-25T14:30:09
46,866,508
0
0
null
null
null
null
UTF-8
Java
false
false
7,414
java
package sample.mqtt.simone.com.applicationsubmqtt; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.app.Service; import android.content.Context; import android.content.Intent; import android.os.IBinder; import android.util.Log; import android.widget.Toast; import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken; import org.eclipse.paho.client.mqttv3.MqttCallback; import org.eclipse.paho.client.mqttv3.MqttClient; import org.eclipse.paho.client.mqttv3.MqttConnectOptions; import org.eclipse.paho.client.mqttv3.MqttException; import org.eclipse.paho.client.mqttv3.MqttMessage; import org.eclipse.paho.client.mqttv3.MqttTopic; import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence; import java.util.ArrayList; import java.util.Collections; import java.util.List; /** * Created by Simone Sorge on 25/11/2015. */ public class PushMessage extends Service implements MqttCallback { private String TAG = "PushMsgService"; @Override public IBinder onBind(Intent intent) { return null; } private MqttClient mqttClient; private static String Client_ID = "MqttExample"; private static final String broker = "tcp://10.0.2.2:1883"; public static boolean CLEAN_SESSION = Boolean.TRUE; private String SUBSCRIBE_MESSAGE = "android_message"; private static final String ACTION_START = Client_ID + ".START"; private static final String ACTION_STOP = Client_ID + ".STOP"; public static void actionStart(Context ctx) { Intent i = new Intent(ctx,PushMessage.class); i.setAction(ACTION_START); ctx.startService(i); } public static void actionStop(Context ctx) { Intent i = new Intent(ctx,PushMessage.class); i.setAction(ACTION_STOP); ctx.startService(i); } private static List<onPushMessageListener> onPushMesageListeners = new ArrayList<onPushMessageListener>(); public final static List<onPushMessageListener> getOnPushMesageListeners() { return Collections.unmodifiableList(onPushMesageListeners); } private final static void notifyOnPushMessage(String msg) { List<onPushMessageListener> mLm = getOnPushMesageListeners(); for (onPushMessageListener l:mLm) { try { if(l!=null) { l.onNewPushMessage(msg); } }catch (Exception ex) { ex.printStackTrace(); } } } public final static void addPushMessageListeners(onPushMessageListener mOnPushMesageListeners) { PushMessage.onPushMesageListeners.add(mOnPushMesageListeners); } public final static void removePushMessageListeners(onPushMessageListener mOnPushMessageListeners) { PushMessage.onPushMesageListeners.remove(mOnPushMessageListeners); } private NotificationManager notificationManager; @Override public void onCreate() { super.onCreate(); notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); Client_ID = MqttApplication.getInstance().getDeviceId(); } @Override public int onStartCommand(Intent intent,int flags,int startId) { super.onStartCommand(intent, flags, startId); if(intent.getAction().equals(ACTION_STOP)== true) { stop(); stopSelf(); }else if (intent.getAction().equals(ACTION_START)==true) { onStartConnectioned(); } onStartConnectioned(); return START_STICKY; } private void onStartConnectioned() { Log.d(TAG, "Sono dentro ONSTARTCONNECTION!!!!!!!!!!!!"); MqttConnectOptions conOpitions = new MqttConnectOptions(); conOpitions.setCleanSession(CLEAN_SESSION); //conOpitions.setKeepAliveInterval(30); try { mqttClient = new MqttClient(broker,Client_ID,new MemoryPersistence()); mqttClient.setCallback(this); mqttClient.connect(conOpitions); Log.d(TAG,"Connessione avvenuta"); String myTopic = "pahodemo/test"; MqttTopic topic = mqttClient.getTopic(myTopic); int subQoS = 1; mqttClient.subscribe(myTopic, subQoS); MqttApplication.getInstance().setMqttStart(Boolean.TRUE); Toast.makeText(this, "PushMsgService start... SUCC", Toast.LENGTH_LONG).show(); } catch (MqttException ex) { ex.printStackTrace(); MqttApplication.getInstance().setMqttStart(Boolean.FALSE); } try { Thread.sleep(5000); mqttClient.disconnect(); Log.d(TAG,"disconnesso!!!!!!!"); } catch (Exception e) { e.printStackTrace(); } } private void stop() { if(mqttClient!= null && mqttClient.isConnected()) { try { mqttClient.disconnect(); MqttApplication.getInstance().setMqttStart(Boolean.FALSE); Toast.makeText(this, "PushMsgService stop... SUCC", Toast.LENGTH_LONG).show(); } catch (MqttException ex) { ex.printStackTrace(); } } } private void showNotification(String text) { NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); Notification myNotication; PendingIntent contentIntent = PendingIntent.getActivity(this, 0, new Intent(""), 0); Notification.Builder builder = new Notification.Builder(this); builder.setContentTitle("MQTT"); builder.setContentText(text); builder.setContentIntent(contentIntent); builder.setSmallIcon(R.drawable.icon); builder.setOngoing(true); myNotication = builder.build(); nm.notify(1,myNotication); } @Override public void onDestroy() { super.onDestroy(); } @Override public void connectionLost(Throwable arg0) { Log.d(TAG, "Connection Lost"); Log.e(TAG, " ", arg0); } @Override public void deliveryComplete(IMqttDeliveryToken arg0) { Log.d(TAG, "deliveryComplete()"); try { MqttMessage msg = arg0.getMessage(); if(msg!=null) { byte bytes[] = msg.getPayload(); if(bytes != null) { String message = new String(bytes); Log.d(TAG,"deliveryMessage(): "+message); showNotification(message); notifyOnPushMessage(message); } } }catch (MqttException ex) { ex.printStackTrace(); } } @Override public void messageArrived(String sub, MqttMessage arg1) throws Exception { Log.d(TAG,"messageArraived()"+sub); if(arg1!=null) { byte bytes[] = arg1.getPayload(); if(bytes!=null) { String message = new String(bytes); Log.d(TAG,"deliveryComplete"+message); showNotification(message); notifyOnPushMessage(message); } } } }
f2fe78c18ead630133b8f70f468c73e0a121256b
7338cbeb3430270165fe8cc37c642de158e96e9d
/src/webscraper/offRZScorePct.java
01c6880692a6085e29e51976b76932ba295a90f5
[]
no_license
jpsilvashy/CollegeFootballGambling
9c6ec0b2f1200b7451aa7215eb4c39608a87e903
90b4615074348179ce9363540c26b4c6fc50a0ac
refs/heads/master
2023-03-15T13:48:00.051457
2017-09-24T22:21:01
2017-09-24T22:21:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,416
java
package webscraper; import java.io.IOException; import java.util.HashMap; import java.util.Map; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; import updateDB.updateoffRZScorePct; import updateDB.updateoffRushAvg; public class offRZScorePct { public static void main(String[] args) throws IOException { String url = "http://www.cfbstats.com/2016/leader/national/team/offense/split01/category27/sort01.html"; Document doc = Jsoup.connect(url).get(); Elements tableRowElements = doc.select("table.leaders tr"); Map<String, Double> offRZScorePctMap = new HashMap<String, Double>(); for (Element row : tableRowElements.subList(1, tableRowElements.size())) { String teamName = row.select(".team-name").text(); String redzonePct = row.select("td:nth-child(6)").text(); try { // the String to int conversion happens here double redzonePctDouble = Double.parseDouble(redzonePct.trim()); offRZScorePctMap.put(teamName, redzonePctDouble); System.out.println("teamName = " + teamName + " and redzonePctDouble = " + redzonePctDouble); } catch (NumberFormatException nfe) { System.out.println("NumberFormatException: " + nfe.getMessage()); } } updateoffRZScorePct u = new updateoffRZScorePct(); u.receiveMap(offRZScorePctMap); } }
ae1727aed27479d093114ced884fb014b828b7c6
d6271b0d68986a34df43748b05aca8e2291a7d23
/src/up9/Student_task/LabClassUI.java
3f71d3bc2044dd398dc7bc88cec27a2597e4cb74
[]
no_license
Kostyf/up9
f62e755244abf1cd1e3aecef257f4038927e56a8
888246a5d99af38aa5173b2ddebf0868e4de5cd3
refs/heads/master
2023-01-02T17:30:29.017894
2020-10-31T19:47:31
2020-10-31T19:47:31
308,959,997
0
0
null
null
null
null
UTF-8
Java
false
false
256
java
package up9.Student_task; public interface LabClassUI { void sortByGPA(); Student searchByName(String name) throws StudentNotFoundException; void printOutStudents(); void addStudent(String name, Double ID) throws EmptyStringException; }
5046dd5169cc0b4ff72e5e2bb6e161c3f9686dc5
730eab815f5721c6a10c4f8a111c623aac2d0a40
/src/test/java/com/github/stefanbirkner/jmarkdown2deckjs/JMarkdown2DeckJsTest.java
a0dc4bec483bfca001da0d60fb3ac3523a3d85cd
[]
no_license
stefanbirkner/jmarkdown2deckjs
e97dca7eb42f409f5e99ef96f99bff1f719091b0
2da153b5e8119686c19f786a0bf6ca3c19826d55
refs/heads/master
2023-08-15T06:36:55.607926
2015-01-22T11:06:00
2015-01-22T11:06:00
20,365,801
0
0
null
null
null
null
UTF-8
Java
false
false
1,174
java
package com.github.stefanbirkner.jmarkdown2deckjs; import org.apache.commons.io.IOUtils; import org.junit.Test; import java.io.IOException; import java.io.InputStream; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertThat; public class JMarkdown2DeckJsTest { @Test public void convertsThreeSlides() throws Exception { String markdown = getResource("threeSlides.md"); String html = new JMarkdown2DeckJs().convert(markdown); assertThat(html, is(equalTo(getResource("threeSlides.html")))); } @Test public void convertsThreeSlidesWithUrlPrefix() throws Exception { Configuration configuration = new Configuration("http://dummy.domain/"); String markdown = getResource("threeSlides.md"); String html = new JMarkdown2DeckJs(configuration).convert(markdown); assertThat(html, is(equalTo(getResource("threeSlidesWithUrlPrefix.html")))); } private String getResource(String name) throws IOException { InputStream resource = getClass().getResourceAsStream(name); return IOUtils.toString(resource); } }
ba589a9949d38e9f1b85d592df20af98a8cb146b
08c5675ad0985859d12386ca3be0b1a84cc80a56
/src/main/java/java/nio/MappedByteBuffer.java
69f7d4e676b1b12d26a54cf05fe34eafc798a125
[]
no_license
ytempest/jdk1.8-analysis
1e5ff386ed6849ea120f66ca14f1769a9603d5a7
73f029efce2b0c5eaf8fe08ee8e70136dcee14f7
refs/heads/master
2023-03-18T04:37:52.530208
2021-03-09T02:51:16
2021-03-09T02:51:16
345,863,779
0
0
null
null
null
null
UTF-8
Java
false
false
7,264
java
/* * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * * * */ package java.nio; import java.io.FileDescriptor; import sun.misc.Unsafe; /** * A direct byte buffer whose content is a memory-mapped region of a file. * * <p> Mapped byte buffers are created via the {@link * java.nio.channels.FileChannel#map FileChannel.map} method. This class * extends the {@link ByteBuffer} class with operations that are specific to * memory-mapped file regions. * * <p> A mapped byte buffer and the file mapping that it represents remain * valid until the buffer itself is garbage-collected. * * <p> The content of a mapped byte buffer can change at any time, for example * if the content of the corresponding region of the mapped file is changed by * this program or another. Whether or not such changes occur, and when they * occur, is operating-system dependent and therefore unspecified. * * <a name="inaccess"></a><p> All or part of a mapped byte buffer may become * inaccessible at any time, for example if the mapped file is truncated. An * attempt to access an inaccessible region of a mapped byte buffer will not * change the buffer's content and will cause an unspecified exception to be * thrown either at the time of the access or at some later time. It is * therefore strongly recommended that appropriate precautions be taken to * avoid the manipulation of a mapped file by this program, or by a * concurrently running program, except to read or write the file's content. * * <p> Mapped byte buffers otherwise behave no differently than ordinary direct * byte buffers. </p> * * @author Mark Reinhold * @author JSR-51 Expert Group * @since 1.4 */ public abstract class MappedByteBuffer extends ByteBuffer { // This is a little bit backwards: By rights MappedByteBuffer should be a // subclass of DirectByteBuffer, but to keep the spec clear and simple, and // for optimization purposes, it's easier to do it the other way around. // This works because DirectByteBuffer is a package-private class. // For mapped buffers, a FileDescriptor that may be used for mapping // operations if valid; null if the buffer is not mapped. private final FileDescriptor fd; // This should only be invoked by the DirectByteBuffer constructors // MappedByteBuffer(int mark, int pos, int lim, int cap, // package-private FileDescriptor fd) { super(mark, pos, lim, cap); this.fd = fd; } MappedByteBuffer(int mark, int pos, int lim, int cap) { // package-private super(mark, pos, lim, cap); this.fd = null; } private void checkMapped() { if (fd == null) // Can only happen if a luser explicitly casts a direct byte buffer throw new UnsupportedOperationException(); } // Returns the distance (in bytes) of the buffer from the page aligned address // of the mapping. Computed each time to avoid storing in every direct buffer. private long mappingOffset() { int ps = Bits.pageSize(); long offset = address % ps; return (offset >= 0) ? offset : (ps + offset); } private long mappingAddress(long mappingOffset) { return address - mappingOffset; } private long mappingLength(long mappingOffset) { return (long) capacity() + mappingOffset; } /** * Tells whether or not this buffer's content is resident in physical * memory. * * <p> A return value of <tt>true</tt> implies that it is highly likely * that all of the data in this buffer is resident in physical memory and * may therefore be accessed without incurring any virtual-memory page * faults or I/O operations. A return value of <tt>false</tt> does not * necessarily imply that the buffer's content is not resident in physical * memory. * * <p> The returned value is a hint, rather than a guarantee, because the * underlying operating system may have paged out some of the buffer's data * by the time that an invocation of this method returns. </p> * * @return <tt>true</tt> if it is likely that this buffer's content * is resident in physical memory */ public final boolean isLoaded() { checkMapped(); if ((address == 0) || (capacity() == 0)) return true; long offset = mappingOffset(); long length = mappingLength(offset); return isLoaded0(mappingAddress(offset), length, Bits.pageCount(length)); } // not used, but a potential target for a store, see load() for details. private static byte unused; /** * Loads this buffer's content into physical memory. * * <p> This method makes a best effort to ensure that, when it returns, * this buffer's content is resident in physical memory. Invoking this * method may cause some number of page faults and I/O operations to * occur. </p> * * @return This buffer */ public final MappedByteBuffer load() { checkMapped(); if ((address == 0) || (capacity() == 0)) return this; long offset = mappingOffset(); long length = mappingLength(offset); load0(mappingAddress(offset), length); // Read a byte from each page to bring it into memory. A checksum // is computed as we go along to prevent the compiler from otherwise // considering the loop as dead code. Unsafe unsafe = Unsafe.getUnsafe(); int ps = Bits.pageSize(); int count = Bits.pageCount(length); long a = mappingAddress(offset); byte x = 0; for (int i = 0; i < count; i++) { x ^= unsafe.getByte(a); a += ps; } if (unused != 0) unused = x; return this; } /** * Forces any changes made to this buffer's content to be written to the * storage device containing the mapped file. * * <p> If the file mapped into this buffer resides on a local storage * device then when this method returns it is guaranteed that all changes * made to the buffer since it was created, or since this method was last * invoked, will have been written to that device. * * <p> If the file does not reside on a local device then no such guarantee * is made. * * <p> If this buffer was not mapped in read/write mode ({@link * java.nio.channels.FileChannel.MapMode#READ_WRITE}) then invoking this * method has no effect. </p> * * @return This buffer */ public final MappedByteBuffer force() { checkMapped(); if ((address != 0) && (capacity() != 0)) { long offset = mappingOffset(); force0(fd, mappingAddress(offset), mappingLength(offset)); } return this; } private native boolean isLoaded0(long address, long length, int pageCount); private native void load0(long address, long length); private native void force0(FileDescriptor fd, long address, long length); }
3fd702f50ab23efe2b4551809f912bc682c21343
5b82e2f7c720c49dff236970aacd610e7c41a077
/QueryReformulation-master 2/data/ExampleSourceCodeFiles/MBindings.java
17d4c5bf15dda364e99572d504fabf4589408de2
[]
no_license
shy942/EGITrepoOnlineVersion
4b157da0f76dc5bbf179437242d2224d782dd267
f88fb20497dcc30ff1add5fe359cbca772142b09
refs/heads/master
2021-01-20T16:04:23.509863
2016-07-21T20:43:22
2016-07-21T20:43:22
63,737,385
0
0
null
null
null
null
UTF-8
Java
false
false
994
java
/Users/user/eclipse.platform.ui/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/commands/MBindings.java org eclipse model application commands java util list user doc representation model object bindings user doc model doc mixin lists binding contexts active object active example values org eclipse contexts dialog org eclipse contexts window noimplement this intended implemented clients model doc features supported link org eclipse model application commands bindings binding contexts binding contexts model true true generated bindings returns binding contexts reference list list contents type link org eclipse model application commands binding context user doc user doc model doc strong developers strong add detailed documentation editing comment org eclipse model workbench model elements ecore there gen model documentation node type attribute model doc binding contexts reference list model generated list binding context binding contexts bindings
406295e22698cc51b78c2cef929da74b853162eb
16b001ba4f4380e7767a3469e27bb075cc26fad8
/Sun/src/main/java/com/codekisu/repository/UserRepository.java
87d59a2b68e36770c9eb1aa8e84011191fa3dbe7
[]
no_license
datlt2000/blog-sun
cf9cf949ab5d8e493d8486f4e49bb802bc7efccc
527855f5bc2318e424f31991fec50ee16a73b369
refs/heads/master
2022-12-21T22:17:37.398546
2020-10-01T10:32:53
2020-10-01T10:32:53
296,885,445
0
0
null
null
null
null
UTF-8
Java
false
false
404
java
package com.codekisu.repository; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import com.codekisu.data.User; @Repository public interface UserRepository extends JpaRepository<User, Long>{ User findById(long id); User findBySignature(String signature); User findByName(String name); User findByEmail(String email); }
dccdc73e3f7c1e5c2d5b7be3abedda2bd3df2113
40665051fadf3fb75e5a8f655362126c1a2a3af6
/abixen-abixen-platform/2662882d75e74b0aa369fc6912534e5cb392bed4/8/UserServiceTest.java
bdfdbe45cce9f234c72b5ed99b027291607b5740
[]
no_license
fermadeiral/StyleErrors
6f44379207e8490ba618365c54bdfef554fc4fde
d1a6149d9526eb757cf053bc971dbd92b2bfcdf1
refs/heads/master
2020-07-15T12:55:10.564494
2019-10-24T02:30:45
2019-10-24T02:30:45
205,546,543
2
0
null
null
null
null
UTF-8
Java
false
false
6,828
java
/** * Copyright (c) 2010-present Abixen Systems. All rights reserved. * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. */ package com.abixen.platform.core.service; import com.abixen.platform.core.configuration.PlatformConfiguration; import com.abixen.platform.core.configuration.properties.PlatformTestResourceConfigurationProperties; import com.abixen.platform.core.form.UserChangePasswordForm; import com.abixen.platform.core.model.enumtype.UserGender; import com.abixen.platform.core.model.impl.User; import com.abixen.platform.core.util.UserBuilder; import org.apache.log4j.Logger; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.web.multipart.MultipartFile; import java.io.File; import java.io.IOException; import java.util.Date; import java.util.Random; import static org.junit.Assert.*; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = PlatformConfiguration.class) public class UserServiceTest { static Logger log = Logger.getLogger(UserServiceTest.class.getName()); @Autowired private UserService userService; @Autowired private DomainBuilderService domainBuilderService; @Autowired private PlatformTestResourceConfigurationProperties platformResourceConfigurationProperties; private File avatarFile; @Test public void createUser() { log.debug("createUser()"); UserBuilder userBuilder = domainBuilderService.newUserBuilderInstance(); userBuilder.credentials("username", "password"); userBuilder.screenName("screenName"); userBuilder.personalData("firstName", "middleName", "lastName"); userBuilder.additionalData(new Date(), "jobTitle", UserGender.MALE); userBuilder.registrationIp("127.0.0.1"); User user = userBuilder.build(); userService.createUser(user); User userFromDB = userService.findUser("username"); assertNotNull(userFromDB); } @Test public void changeUserPasswordPositiveCase() { log.debug("changeUserPassword() positive case"); String newpassword = "newPassword"; UserBuilder userBuilder = domainBuilderService.newUserBuilderInstance(); userBuilder.credentials("usernameA", "password"); userBuilder.screenName("screenNameA"); userBuilder.personalData("firstName", "middleName", "lastName"); userBuilder.additionalData(new Date(), "jobTitle", UserGender.MALE); userBuilder.registrationIp("127.0.0.1"); User user = userBuilder.build(); userService.createUser(user); UserChangePasswordForm passwordForm = new UserChangePasswordForm(); passwordForm.setCurrentPassword("password"); passwordForm.setNewPassword(newpassword); UserChangePasswordForm newPasswordForm = userService.changeUserPassword(user, passwordForm); User userFromDB = userService.findUser("usernameA"); PasswordEncoder encoder = new BCryptPasswordEncoder(); assertNotNull(userFromDB); assertTrue(encoder.matches(newpassword, userFromDB.getPassword())); } @Test(expected = UsernameNotFoundException.class) public void changeUserPasswordNegativeCase() { log.debug("changeUserPassword() negative case"); String newpassword = "newPassword"; UserBuilder userBuilder = domainBuilderService.newUserBuilderInstance(); userBuilder.credentials("usernameB", "password"); userBuilder.screenName("screenNameB"); userBuilder.personalData("firstName", "middleName", "lastName"); userBuilder.additionalData(new Date(), "jobTitle", UserGender.MALE); userBuilder.registrationIp("127.0.0.1"); User user = userBuilder.build(); userService.createUser(user); UserChangePasswordForm passwordForm = new UserChangePasswordForm(); passwordForm.setCurrentPassword("someNotCorrectpassword"); passwordForm.setNewPassword(newpassword); userService.changeUserPassword(user, passwordForm); } @Test public void changeUserAvatar() throws IOException { log.debug("changeUserAvatar() positive case"); UserBuilder userBuilder = domainBuilderService.newUserBuilderInstance(); userBuilder.credentials("usernameC", "password"); userBuilder.screenName("screenNameC"); userBuilder.personalData("firstName", "middleName", "lastName"); userBuilder.additionalData(new Date(), "jobTitle", UserGender.MALE); userBuilder.registrationIp("127.0.0.1"); User user = userBuilder.build(); user.setAvatarFileName("oldAvatarName"); userService.createUser(user); MultipartFile newAvatarFile = mock(MultipartFile.class); when(newAvatarFile.getName()).thenReturn("newAvatarFile"); byte[] bytes = new byte[32]; new Random().nextBytes(bytes); when(newAvatarFile.getBytes()).thenReturn(bytes); User updatedUser = null; try { updatedUser = userService.changeUserAvatar(user.getId(), newAvatarFile); } catch (IOException e) { e.printStackTrace(); } avatarFile = new File(platformResourceConfigurationProperties.getImageLibraryDirectory() + "/user-avatar/" + updatedUser.getAvatarFileName()); assertNotNull(updatedUser); assertNotEquals(updatedUser.getAvatarFileName(), user.getAvatarFileName()); assertTrue(avatarFile.exists()); avatarFile.delete(); } /*@Test public void updateUser() { log.debug("updateUser()"); User user = userService.findUser("username"); user.setFirstname("firstname2"); userService.updateUser(user); User userAfterUpdate = userService.findUser("username"); assertEquals("firstname2", userAfterUpdate.getFirstname()); }*/ }
4e5fc23302868f0c6d1d7abd3f245f96e26b5839
82be361ba40d06e2b797908a11a695ce3c631ca8
/docs/thay_tung/ojb-master/src/tools/org/apache/ojb/tools/mapping/reversedb2/dbmetatreemodel/DBMetaColumnNode.java
c7b663f3d1d58e97689e92cd634ab529f5ef44e0
[ "Apache-2.0" ]
permissive
phamtuanchip/ch-cnttk2
ac01dfded36d7216a616c40e7eb432a2fd1f6bc5
3b67c28b8b7b1d58071d5c2305c6be36fce9ac9a
refs/heads/master
2021-01-16T18:30:34.161841
2017-01-21T14:46:05
2017-01-21T14:46:05
32,536,612
0
0
null
null
null
null
UTF-8
Java
false
false
2,654
java
package org.apache.ojb.tools.mapping.reversedb2.dbmetatreemodel; /* Copyright 2002-2005 The Apache Software Foundation * * 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. */ /** * This class represents a columns of a table * @author <a href="mailto:[email protected]">Florian Bruckner</a> * @version $Id: DBMetaColumnNode.java,v 1.1 2007-08-24 22:17:41 ewestfal Exp $ */ public class DBMetaColumnNode extends ReverseDbTreeNode implements java.io.Serializable { static final long serialVersionUID = -7694494988930854647L; /** Key for accessing the column name in the attributes Map */ public static final String ATT_COLUMN_NAME = "Column Name"; /** Creates a new instance of DBMetaSchemaNode * @param pdbMeta DatabaseMetaData implementation where this node gets its data from. * @param pdbMetaTreeModel The TreeModel this node is associated to. * @param pschemaNode The parent node for this node. * @param pstrColumnName The name of the column this node is representing. */ public DBMetaColumnNode(java.sql.DatabaseMetaData pdbMeta, DatabaseMetaDataTreeModel pdbMetaTreeModel, DBMetaTableNode ptableNode, String pstrColumnName) { super(pdbMeta, pdbMetaTreeModel, ptableNode); this.setAttribute(ATT_COLUMN_NAME, pstrColumnName); } /** * @see ReverseDbTreeNode#isLeaf() */ public boolean getAllowsChildren() { return false; } /** * @see ReverseDbTreeNode#getAllowsChildren() */ public boolean isLeaf() { return true; } /** * @see Object#toString() */ public String toString() { return this.getAttribute(ATT_COLUMN_NAME).toString(); } public Class getPropertyEditorClass() { return org.apache.ojb.tools.mapping.reversedb2.propertyEditors.JPnlPropertyEditorDBMetaColumn.class; } /** * Do nothing as there are no children for a column. */ protected boolean _load () { return true; } }
cf7ae372c671128da21acd26e1ccc84c5cd7402f
f79d2b18491d93e5e26eca89de06a7bf3768f42b
/aerfa-ui/src/main/java/com/zhangysh/accumulate/ui/support/service/IRedisManageService.java
d583990610305090e6bf657a5a291ed387eda90a
[]
no_license
1989zhang/aerfa
bd68c489a32477eb52c85f5a1e6991ee25007d01
bb31df4af61f6f72595a904ad6f2eef6643fb8b8
refs/heads/master
2022-12-10T05:54:20.776092
2020-05-30T15:57:50
2020-05-30T15:57:50
238,894,009
1
0
null
2022-12-06T00:44:14
2020-02-07T10:11:57
JavaScript
UTF-8
Java
false
false
3,175
java
package com.zhangysh.accumulate.ui.support.service; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import com.zhangysh.accumulate.common.constant.CacheConstant; import com.zhangysh.accumulate.pojo.support.dataobj.RedisParam; import com.zhangysh.accumulate.pojo.support.transobj.RedisParamDto; /***** * redis管理相关 * @author zhangysh * @date 2019年5月18日 *****/ @FeignClient(name = "${feign.back.name}") public interface IRedisManageService { /***** * 获取redis配置相关信息 * @param aerfatoken token对象 * @param redisParamDto 查询条件和分页对象 ***/ @RequestMapping(value = "/support/redis/config",method = RequestMethod.POST) public String getRedisConfig(@RequestHeader(CacheConstant.COOKIE_NAME_AERFATOKEN) String aerfatoken,@RequestBody RedisParamDto redisParamDto); /***** * 获取redis的运行状态信息 * @param aerfatoken token对象 * @param redisParamDto 查询条件和分页对象 ***/ @RequestMapping(value = "/support/redis/states",method = RequestMethod.POST) public String getRedisStatus(@RequestHeader(CacheConstant.COOKIE_NAME_AERFATOKEN) String aerfatoken); /***** * 获取redis存储的key和对应的values * @param aerfatoken token对象 * @param redisParamDto 查询条件和分页对象 ***/ @RequestMapping(value = "/support/redis/storage",method = RequestMethod.POST) public String getRedisStorage(@RequestHeader(CacheConstant.COOKIE_NAME_AERFATOKEN) String aerfatoken,@RequestBody RedisParamDto redisParamDto); /*** * 保存填写的redis键值信息 * @param aerfatoken token对象 * @param redisParam 保存的键值对象 ****/ @RequestMapping(value = "/support/redis/save_add_storage",method = RequestMethod.POST) public String saveAddStorage(@RequestHeader(CacheConstant.COOKIE_NAME_AERFATOKEN) String aerfatoken,@RequestBody RedisParam redisParam); /*** * 根据key获取单个redis存储对象 * @param aerfatoken token对象 * @param redisKey redis存的键 ******/ @RequestMapping(value = "/support/redis/storage_single",method = RequestMethod.POST) public String getRedisStorageSingle(@RequestHeader(CacheConstant.COOKIE_NAME_AERFATOKEN) String aerfatoken,@RequestBody String redisKey); /**** *删除redis存储对象,可以删除多个,中间英文,隔开 *@param aerfatoken token对象 *@param redisKeys 要删除的个人redis的key集合 ***/ @RequestMapping(value = "/support/redis/remove_storage",method = RequestMethod.POST) public String deleteRedisStorageByKeys(@RequestHeader(CacheConstant.COOKIE_NAME_AERFATOKEN) String aerfatoken,@RequestBody String redisKeys); /**** * 清理redis缓存,必须值清理部分key,因为是重要操作所以必须记录日志 ***/ @RequestMapping(value = "/support/redis/clean_up",method = RequestMethod.POST) public String cleanUpRedis(@RequestHeader(CacheConstant.COOKIE_NAME_AERFATOKEN) String aerfatoken); }
6ca28d43c4781ca505bbbe7fb0f46034967dd41c
25baed098f88fc0fa22d051ccc8027aa1834a52b
/src/main/java/com/ljh/daoMz/JytPrivatecloudBookIntradayMapper.java
74765bee91111ac027593129db7c129b9430c1d0
[]
no_license
woai555/ljh
a5015444082f2f39d58fb3e38260a6d61a89af9f
17cf8f4415c9ae7d9fedae46cd9e9d0d3ce536f9
refs/heads/master
2022-07-11T06:52:07.620091
2022-01-05T06:51:27
2022-01-05T06:51:27
132,585,637
0
0
null
2022-06-17T03:29:19
2018-05-08T09:25:32
Java
UTF-8
Java
false
false
314
java
package com.ljh.daoMz; import com.ljh.bean.JytPrivatecloudBookIntraday; import com.baomidou.mybatisplus.core.mapper.BaseMapper; /** * <p> * Mapper 接口 * </p> * * @author ljh * @since 2020-10-26 */ public interface JytPrivatecloudBookIntradayMapper extends BaseMapper<JytPrivatecloudBookIntraday> { }
b86795959f6d17f3514d3b40e3919d5a73846269
05a7d6b81f422abddcdde25dd661387f204bf736
/app/src/main/java/com/example/firebasecrudoperation/LoginActivity.java
4b80da9ffa9298f7117de10b9064e0de7eaae8cb
[]
no_license
shahkushal38/CourseLibraryApp
dd8f25359395e5ab921783e48c675fb462270f49
fd72809bfe573bb80c33853b74ee1a5a67e282f1
refs/heads/master
2023-08-19T00:04:29.644795
2021-09-22T10:24:26
2021-09-22T10:24:26
402,041,624
2
0
null
null
null
null
UTF-8
Java
false
false
3,801
java
package com.example.firebasecrudoperation; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.text.TextUtils; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.ProgressBar; import android.widget.TextView; import android.widget.Toast; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; import com.google.android.material.textfield.TextInputEditText; import com.google.firebase.auth.AuthResult; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; public class LoginActivity extends AppCompatActivity { private TextInputEditText EditLoginUsername, EditLoginPassword; private Button LoginButton; private TextView RegistrationText; private ProgressBar LoginProgressBar; private FirebaseAuth mAuth; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); EditLoginUsername =findViewById(R.id.EditLoginUsername); EditLoginPassword = findViewById(R.id.EditLoginPassword); LoginButton = findViewById(R.id.Loginbutton); RegistrationText = findViewById(R.id.RegistrationText); LoginProgressBar=findViewById(R.id.LoginProgressBar); mAuth=FirebaseAuth.getInstance(); RegistrationText.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i=new Intent(LoginActivity.this, RegistrationActivity.class); startActivity(i); } }); LoginButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { LoginProgressBar.setVisibility(View.VISIBLE); String username= EditLoginUsername.getText().toString(); String password = EditLoginPassword.getText().toString(); if(TextUtils.isEmpty(username) && TextUtils.isEmpty(password)) { Toast.makeText(LoginActivity.this, "Enter your Username and Password", Toast.LENGTH_SHORT).show(); } else { mAuth.signInWithEmailAndPassword(username,password).addOnCompleteListener(new OnCompleteListener<AuthResult>() { @Override public void onComplete(@NonNull Task<AuthResult> task) { if(task.isSuccessful()) { LoginProgressBar.setVisibility(View.GONE); Toast.makeText(LoginActivity.this, "Login Successfull", Toast.LENGTH_SHORT).show(); Intent i= new Intent(LoginActivity.this, MainActivity.class); startActivity(i); finish(); } else { LoginProgressBar.setVisibility(View.GONE); Toast.makeText(LoginActivity.this, "Need To Login", Toast.LENGTH_SHORT).show(); } } }); } } }); } @Override protected void onStart() { super.onStart(); FirebaseUser user=mAuth.getCurrentUser(); if(user!=null) { Intent i=new Intent(LoginActivity.this, MainActivity.class); startActivity(i); this.finish(); } } }
4371f4045e8c5279833b19ed97ee05c38b46c26e
7aa100425eaa910bec20e723f6eacfac195d357d
/AddressBook/src/main/java/com/sg/addressbook/App.java
71925b2f2d9f65965f187c2ba1a5a0eb165c8a23
[]
no_license
JCLogsdon34/Java-OOP
99ceb4de5ce9e909d130d1424e2a8b346dbc6fbc
7b2c1c2a31eb9185defd8f8885244e306f4a5729
refs/heads/master
2021-09-28T14:08:52.352324
2018-11-17T21:19:08
2018-11-17T21:19:08
113,358,077
0
0
null
null
null
null
UTF-8
Java
false
false
1,092
java
package com.sg.addressbook; import com.sg.addressbook.controller.AddressBookController; import com.sg.addressbook.dao.AddressBookAuditDao; import com.sg.addressbook.dao.AddressBookAuditDaoImpl; import com.sg.addressbook.dao.AddressBookDao; import com.sg.addressbook.dao.AddressBookDaoFileImpl; import com.sg.addressbook.service.AddressBookServiceLayer; import com.sg.addressbook.service.AddressBookServiceLayerImpl; import com.sg.addressbook.ui.AddressBookView; import com.sg.addressbook.ui.UserIO; import com.sg.addressbook.ui.UserIOConsoleImpl; public class App { public static void main(String[] args) { UserIO myIo = new UserIOConsoleImpl(); AddressBookView myView = new AddressBookView(myIo); AddressBookDao myDao; myDao = new AddressBookDaoFileImpl(); AddressBookAuditDao myAuditDao = new AddressBookAuditDaoImpl(); AddressBookServiceLayer myService = new AddressBookServiceLayerImpl(myDao); AddressBookController controller = new AddressBookController(myDao, myView); controller.run(); } }
a8ad314ecc89836154763c1cd10c9ed320bab347
8a6453cd49949798c11f57462d3f64a1fa2fc441
/aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/GetParameterRequest.java
cef6ecc02321eb2a9e754ad70aebc7b213df41bb
[ "Apache-2.0" ]
permissive
tedyu/aws-sdk-java
138837a2be45ecb73c14c0d1b5b021e7470520e1
c97c472fd66d7fc8982cb4cf3c4ae78de590cfe8
refs/heads/master
2020-04-14T14:17:28.985045
2019-01-02T21:46:53
2019-01-02T21:46:53
163,892,339
0
0
Apache-2.0
2019-01-02T21:38:39
2019-01-02T21:38:39
null
UTF-8
Java
false
false
6,056
java
/* * Copyright 2013-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.simplesystemsmanagement.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.AmazonWebServiceRequest; /** * * @see <a href="http://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/GetParameter" target="_top">AWS API * Documentation</a> */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class GetParameterRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable { /** * <p> * The name of the parameter you want to query. * </p> */ private String name; /** * <p> * Return decrypted values for secure string parameters. This flag is ignored for String and StringList parameter * types. * </p> */ private Boolean withDecryption; /** * <p> * The name of the parameter you want to query. * </p> * * @param name * The name of the parameter you want to query. */ public void setName(String name) { this.name = name; } /** * <p> * The name of the parameter you want to query. * </p> * * @return The name of the parameter you want to query. */ public String getName() { return this.name; } /** * <p> * The name of the parameter you want to query. * </p> * * @param name * The name of the parameter you want to query. * @return Returns a reference to this object so that method calls can be chained together. */ public GetParameterRequest withName(String name) { setName(name); return this; } /** * <p> * Return decrypted values for secure string parameters. This flag is ignored for String and StringList parameter * types. * </p> * * @param withDecryption * Return decrypted values for secure string parameters. This flag is ignored for String and StringList * parameter types. */ public void setWithDecryption(Boolean withDecryption) { this.withDecryption = withDecryption; } /** * <p> * Return decrypted values for secure string parameters. This flag is ignored for String and StringList parameter * types. * </p> * * @return Return decrypted values for secure string parameters. This flag is ignored for String and StringList * parameter types. */ public Boolean getWithDecryption() { return this.withDecryption; } /** * <p> * Return decrypted values for secure string parameters. This flag is ignored for String and StringList parameter * types. * </p> * * @param withDecryption * Return decrypted values for secure string parameters. This flag is ignored for String and StringList * parameter types. * @return Returns a reference to this object so that method calls can be chained together. */ public GetParameterRequest withWithDecryption(Boolean withDecryption) { setWithDecryption(withDecryption); return this; } /** * <p> * Return decrypted values for secure string parameters. This flag is ignored for String and StringList parameter * types. * </p> * * @return Return decrypted values for secure string parameters. This flag is ignored for String and StringList * parameter types. */ public Boolean isWithDecryption() { return this.withDecryption; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getName() != null) sb.append("Name: ").append(getName()).append(","); if (getWithDecryption() != null) sb.append("WithDecryption: ").append(getWithDecryption()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof GetParameterRequest == false) return false; GetParameterRequest other = (GetParameterRequest) obj; if (other.getName() == null ^ this.getName() == null) return false; if (other.getName() != null && other.getName().equals(this.getName()) == false) return false; if (other.getWithDecryption() == null ^ this.getWithDecryption() == null) return false; if (other.getWithDecryption() != null && other.getWithDecryption().equals(this.getWithDecryption()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode()); hashCode = prime * hashCode + ((getWithDecryption() == null) ? 0 : getWithDecryption().hashCode()); return hashCode; } @Override public GetParameterRequest clone() { return (GetParameterRequest) super.clone(); } }
[ "" ]
31d0e0770aa8e0cecf1a1c020d2029d700484059
2e6f1a275351472690eeb17b9749358790161fb5
/shopping_car/src/main/java/com/qianwang/shopping_car/adapter/RightMenuAdapter.java
853fcfc96a75b829a05f41a4001ae536572b5b2c
[]
no_license
xiaotianzhen/stydy
d6bafad65da650a3536f8e0a50c7519ed8ead8b2
0d39b47ff51ef9bba7a09b476f64cb8cdaddb680
refs/heads/master
2020-11-29T14:46:32.495726
2017-04-21T09:55:20
2017-04-21T09:55:20
87,492,680
1
0
null
null
null
null
UTF-8
Java
false
false
7,157
java
package com.qianwang.shopping_car.adapter; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import com.qianwang.shopping_car.R; import com.qianwang.shopping_car.bean.Dish; import com.qianwang.shopping_car.bean.DishMenu; import com.qianwang.shopping_car.bean.ShopCart; import com.qianwang.shopping_car.imp.ShopCartImp; import java.util.List; /** * Created by sky on 2017/4/1. */ public class RightMenuAdapter extends RecyclerView.Adapter { private List<DishMenu> mList; private final int MENU_TYPE = 0; private final int DISH_TYPE = 1; private int dishCount; private ShopCart mShopCart; private ShopCartImp shopCartImp; public RightMenuAdapter(List<DishMenu> list, ShopCart shopCart) { mList = list; this.mShopCart = shopCart; for (DishMenu menu : mList) { dishCount += menu.getDishList().size() + 1; } } public void setShopCartImp(ShopCartImp shopCartImp) { this.shopCartImp = shopCartImp; } @Override public int getItemViewType(int position) { int sum = 0; for (DishMenu menu : mList) { if (position == sum) { return MENU_TYPE; } else { sum += menu.getDishList().size() + 1; } } return DISH_TYPE; } @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { if (viewType == MENU_TYPE) { View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.right_menu_item, parent, false); TitleHoder mTitleHoder = new TitleHoder(view); return mTitleHoder; } else { View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.right_dish_item, parent, false); ViewHoder mViewHoder = new ViewHoder(view); return mViewHoder; } } @Override public void onBindViewHolder(RecyclerView.ViewHolder holder, final int position) { if (getItemViewType(position) == MENU_TYPE) { TitleHoder mTitleHoder = (TitleHoder) holder; //不能作为全局变量 ,应该通过onBindViewHolder 中的holder相关联; if (mTitleHoder != null) { mTitleHoder.tv_right_menu.setText(getMenuByPosition(position).getMenuName()); mTitleHoder.right_menu_layout.setContentDescription(position + ""); } } else { final ViewHoder mViewHoder = (ViewHoder) holder; if (mViewHoder != null) { final Dish dish = getDishByPosition(position); mViewHoder.right_dish_name.setText(dish.getDishName()); mViewHoder.right_dish_price.setText(dish.getDishPrice()+""); mViewHoder.right_dish_item.setContentDescription(position+""); int count = 0; if(mShopCart.getShoppingSingleMap().containsKey(dish)){ count = mShopCart.getShoppingSingleMap().get(dish); } if(count<=0){ mViewHoder.right_dish_remove_iv.setVisibility(View.GONE); mViewHoder.right_dish_account.setVisibility(View.GONE); }else { mViewHoder.right_dish_remove_iv.setVisibility(View.VISIBLE); mViewHoder.right_dish_account.setVisibility(View.VISIBLE); mViewHoder.right_dish_account.setText(count+""); } mViewHoder.right_dish_add_iv.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if(mShopCart.addShoppingSingle(dish)) { notifyItemChanged(position); if(shopCartImp!=null) shopCartImp.add(view,position); } } }); mViewHoder.right_dish_remove_iv.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if(mShopCart.subShoppingSingle(dish)){ notifyItemChanged(position); if(shopCartImp!=null) shopCartImp.remove(view,position); } } }); } } } public DishMenu getMenuByPosition(int position) { int sum = 0; for (DishMenu menu : mList) { if (position == sum) { return menu; } sum += menu.getDishList().size() + 1; } return null; } public Dish getDishByPosition(int position) { for(DishMenu menu:mList){ if(position>0 && position<=menu.getDishList().size()){ return menu.getDishList().get(position-1); } else{ position-=menu.getDishList().size()+1; } } return null; } public DishMenu getMenuOfMenuByPosition(int position) { for (DishMenu menu : mList) { if (position == 0) return menu; if (position > 0 && position <= menu.getDishList().size()) { return menu; } else { position -= menu.getDishList().size() + 1; } } return null; } @Override public int getItemCount() { return dishCount; } class TitleHoder extends RecyclerView.ViewHolder { private TextView tv_right_menu; private LinearLayout right_menu_layout; public TitleHoder(View itemView) { super(itemView); tv_right_menu = (TextView) itemView.findViewById(R.id.tv_right_menu); right_menu_layout = (LinearLayout) itemView.findViewById(R.id.right_menu_layout); } } class ViewHoder extends RecyclerView.ViewHolder { private TextView right_dish_name; private TextView right_dish_price; private TextView right_dish_account; private ImageView right_dish_remove_iv; private ImageView right_dish_add_iv; private LinearLayout right_dish_item; public ViewHoder(View itemView) { super(itemView); right_dish_name = (TextView) itemView.findViewById(R.id.right_dish_name); right_dish_account = (TextView) itemView.findViewById(R.id.right_dish_account); right_dish_price = (TextView) itemView.findViewById(R.id.right_dish_price); right_dish_add_iv = (ImageView) itemView.findViewById(R.id.right_dish_add); right_dish_remove_iv = (ImageView) itemView.findViewById(R.id.right_dish_remove); right_dish_item = (LinearLayout) itemView.findViewById(R.id.right_dish_item); } } }
1ad4ab43581d74162173cd7993cadfcd5872e66f
cade64bebb66cf212dc65391974ff90593f605d1
/final-Test/src/final_test/Base.java
33ed91dbf88d49a92274fae5c75ee39cdfd94cc6
[]
no_license
HassenBenSlima/SOLID-LambdaExpression-DesignPattern-Junit5-Java8
9bebfc7ddaf7c23873e42f7de74b1fbd7443e623
b03dedb05c18ab1026aaa27e3af3389318838410
refs/heads/master
2022-11-11T19:27:57.082180
2020-06-24T21:31:09
2020-06-24T21:31:09
274,773,353
0
0
null
2023-09-05T22:00:45
2020-06-24T21:30:22
Java
ISO-8859-1
Java
false
false
1,040
java
package final_test; /** * Une méthode final est une méthode qui ne peut pas être redéfinie. * La surcharge (overload en anglais), consiste à créer une méthode du même nom mais avec des paramètres différents. * La redéfinition (overrides en anglais), consiste à créer une méthode de remplacement dans une classe fille, * avec la même signature (paramètre et type de retour) que la méthode de la classe parente qu'elle remplace... */ /** * Une méthode final est une méthode qui ne peut pas être surchargée. Une classe * final est une classe qui ne peut pas être héritée. * */ public class Base { int a; public Base(int i) { this.a = i; } public Base() { this.a = 1000; } public final void Show() { System.out.println(this.a); } public final void Show(String n) { System.out.println(n); System.out.println(this.a); } } class D extends Base { // public void Show() { // System.out.println(super.a); // } } class Abstract { public static void main(String argv[]) { new Base(50); } }
3b4ba872520f89e94257e7cc1d1dac33b532f17b
3bae68a5bcc8067fd145a13eae4185e0d54539e4
/src/phonebook/v2/PhoneBookDAOImpl.java
0f7dcc7d990cd20db4527e85a1cae495d7faae8e
[]
no_license
ddorori7/MiniProject
10a82607d23b62e162a808a0ed72e1ded5db5cd6
24fae72621b826278871a8d01d6788364e29c7ac
refs/heads/master
2023-07-10T05:43:10.574323
2021-08-19T06:59:06
2021-08-19T06:59:06
391,876,291
0
0
null
null
null
null
UTF-8
Java
false
false
4,538
java
package phonebook.v2; import java.sql.*; import java.util.ArrayList; import java.util.List; public class PhoneBookDAOImpl implements PhoneBookDAO { // 접속 코드(커넥션 확보) private Connection getConnection() throws SQLException { Connection conn = null; try { Class.forName("oracle.jdbc.driver.OracleDriver"); String dburl = "jdbc:oracle:thin:@localhost:1521:xe"; conn = DriverManager.getConnection(dburl, "C##BITUSER", "bituser"); } catch (ClassNotFoundException e) { System.err.println("드라이버 로드 실패!"); e.printStackTrace(); } return conn; } // getConnection() end @Override public List<PhoneBookVO> getList() { // 전체 목록 List<PhoneBookVO> list = new ArrayList<PhoneBookVO>(); Connection conn = null; Statement stmt = null; ResultSet rs = null; try { conn = getConnection(); stmt = conn.createStatement(); String sql = "SELECT id, name, hp, tel FROM phone_book" + " ORDER BY id"; rs = stmt.executeQuery(sql); // 루프: 객체화 while (rs.next()) { Long id = rs.getLong(1); String name = rs.getString(2); String hp = rs.getString(3); String tel = rs.getString(4); PhoneBookVO vo = new PhoneBookVO(id, name, hp, tel); list.add(vo); } } catch (SQLException e) { e.printStackTrace(); } finally { try { rs.close(); stmt.close(); conn.close(); } catch (Exception e) { e.printStackTrace(); } } return list; } // getList() end @Override public List<PhoneBookVO> search(String keyword) { // 검색 List<PhoneBookVO> list = new ArrayList<PhoneBookVO>(); Connection conn = null; PreparedStatement pstmt = null; ResultSet rs = null; try { conn = getConnection(); String sql = "SELECT id, name, hp, tel" + " FROM phone_book " + " WHERE name LIKE ?"; pstmt = conn.prepareStatement(sql); pstmt.setString(1, "%" + keyword + "%"); rs = pstmt.executeQuery(); // ResultSet -> List 변환 while (rs.next()) { Long id = rs.getLong(1); String name = rs.getString(2); String hp = rs.getString(3); String tel = rs.getString(4); PhoneBookVO vo = new PhoneBookVO(id, name, hp, tel); list.add(vo); } } catch (SQLException e) { System.out.println("[검색결과가 없습니다.]"); // e.printStackTrace(); } finally { try { rs.close(); pstmt.close(); conn.close(); } catch (Exception e) { // e.printStackTrace(); } } return list; } // search(String keyword) end @Override public boolean insert(PhoneBookVO vo) { Connection conn = null; PreparedStatement pstmt = null; int insertedCount = 0; try { conn = getConnection(); // 실행 계획 String sql = "INSERT INTO phone_book " + " VALUES(seq_phone_book.NEXTVAL, ?, ?, ?)"; pstmt = conn.prepareStatement(sql); // 준비 pstmt.setString(1, vo.getName()); pstmt.setString(2, vo.getHp()); pstmt.setString(3, vo.getTel()); insertedCount = pstmt.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); } finally { try { pstmt.close(); conn.close(); } catch (Exception e) { e.printStackTrace(); } } return 1 == insertedCount; } // insert(PhoneBookVO vo) end // @Override // public boolean update(PhoneBookVO vo) { // 수정 // Connection conn = null; // PreparedStatement pstmt = null; // int updatedCount = 0; // // try { // conn = getConnection(); // String sql = "UPDATE phone_book SET name = ?, hp = ? " + " WHERE id = ?"; // pstmt = conn.prepareStatement(sql); // pstmt.setString(1, vo.getName()); // pstmt.setString(2, vo.getHp()); // pstmt.setString(3, vo.getTel()); // // updatedCount = pstmt.executeUpdate(); // } catch (SQLException e) { // e.printStackTrace(); // } finally { // try { // pstmt.close(); // conn.close(); // } catch (Exception e) { // e.printStackTrace(); // } // } // return 1 == updatedCount; // } // update(PhoneBookVO vo) end @Override public boolean delete(Long id) { // 삭제 Connection conn = null; PreparedStatement pstmt = null; int deletedCount = 0; try { conn = getConnection(); String sql = "DELETE FROM phone_book " + " WHERE id = ?"; pstmt = conn.prepareStatement(sql); pstmt.setLong(1, id); deletedCount = pstmt.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); } finally { try { pstmt.close(); conn.close(); } catch (Exception e) { e.printStackTrace(); } } return 1 == deletedCount; } // delete(Long id) end }
76540b44848f08653086f031ea75e7161c1e29a5
b103f828c5834737b55885d805bca5cd1abcfbac
/backend/src/main/java/com/springmvc/dto/MaterialInstockBill.java
2c00b0e8eb65d9ca40a4cb39251558916c39360d
[]
no_license
l1346792580123/an-erp
7f5a8935d3bf0d5c7dbccb18894d08d671393bd1
6054eee35828d6feffdd0cb077712f5584173185
refs/heads/master
2020-03-17T00:34:42.908704
2018-05-22T11:10:18
2018-05-22T11:10:18
133,122,222
1
0
null
2018-05-22T11:10:19
2018-05-12T06:58:49
Java
UTF-8
Java
false
false
152
java
package com.springmvc.dto; import com.springmvc.pojo.MaterialInstockBillEntity; public class MaterialInstockBill extends MaterialInstockBillEntity { }
9e99aa579ed8e46614d5435a32a6f1d0c27cc0cc
c1036341d15c2d84e963b9ae49e9243ed10c1c00
/src/controller/POIReportController.java
462203d2e7c5bded7a60160b5e3490fd5c354f2e
[]
no_license
achan41/CS4400Project
b2de1f65cf0989d9119d1c3a104c9217ca5b98f1
2c590a1ad270434c25d990544757769e84c609ec
refs/heads/master
2021-01-19T04:33:25.475666
2017-04-06T19:00:21
2017-04-06T19:00:21
87,380,722
0
0
null
2017-04-06T03:07:07
2017-04-06T03:07:07
null
UTF-8
Java
false
false
471
java
package controller; import fxapp.MainFXApplication; public class POIReportController { /** a link back to the main application class */ private MainFXApplication mainApplication; /** * setup the main application link so we can call methods there * * @param mainFXApplication a reference (link) to our main class */ public void setMainApp(MainFXApplication mainFXApplication) { mainApplication = mainFXApplication; } }